mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into preserveTypeAliases
# Conflicts: # tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt # tests/baselines/reference/reactDefaultPropsInferenceSuccess.errors.txt # tests/baselines/reference/variadicTuples1.errors.txt
This commit is contained in:
@@ -29,7 +29,7 @@ If possible, please try testing the nightly version of TS to see if it's already
|
||||
For npm: `typescript@next`
|
||||
This is also the 'Nightly' version in the playground: http://www.typescriptlang.org/play/?ts=Nightly
|
||||
|
||||
Note: The TypeScript Playground can be used to try older verions of TypeScript.
|
||||
Note: The TypeScript Playground can be used to try older versions of TypeScript.
|
||||
|
||||
Please keep and fill in the line that best applies:
|
||||
-->
|
||||
|
||||
+202
-154
@@ -202,7 +202,8 @@ namespace ts {
|
||||
Source = 1 << 0,
|
||||
Target = 1 << 1,
|
||||
PropertyCheck = 1 << 2,
|
||||
InPropertyCheck = 1 << 3,
|
||||
UnionIntersectionCheck = 1 << 3,
|
||||
InPropertyCheck = 1 << 4,
|
||||
}
|
||||
|
||||
const enum MappedTypeModifiers {
|
||||
@@ -10637,6 +10638,10 @@ namespace ts {
|
||||
return type;
|
||||
}
|
||||
|
||||
function getIsLateCheckFlag(s: Symbol): CheckFlags {
|
||||
return getCheckFlags(s) & CheckFlags.Late;
|
||||
}
|
||||
|
||||
/** Resolve the members of a mapped type { [P in K]: T } */
|
||||
function resolveMappedTypeMembers(type: MappedType) {
|
||||
const members: SymbolTable = createSymbolTable();
|
||||
@@ -10695,8 +10700,9 @@ namespace ts {
|
||||
const isReadonly = !!(templateModifiers & MappedTypeModifiers.IncludeReadonly ||
|
||||
!(templateModifiers & MappedTypeModifiers.ExcludeReadonly) && modifiersProp && isReadonlySymbol(modifiersProp));
|
||||
const stripOptional = strictNullChecks && !isOptional && modifiersProp && modifiersProp.flags & SymbolFlags.Optional;
|
||||
const lateFlag: CheckFlags = modifiersProp ? getIsLateCheckFlag(modifiersProp) : 0;
|
||||
const prop = <MappedSymbol>createSymbol(SymbolFlags.Property | (isOptional ? SymbolFlags.Optional : 0), propName,
|
||||
CheckFlags.Mapped | (isReadonly ? CheckFlags.Readonly : 0) | (stripOptional ? CheckFlags.StripOptional : 0));
|
||||
lateFlag | CheckFlags.Mapped | (isReadonly ? CheckFlags.Readonly : 0) | (stripOptional ? CheckFlags.StripOptional : 0));
|
||||
prop.mappedType = type;
|
||||
prop.nameType = propNameType;
|
||||
prop.keyType = keyType;
|
||||
@@ -12951,7 +12957,7 @@ namespace ts {
|
||||
// is true for each of the synthesized type parameters.
|
||||
function createTupleTargetType(elementFlags: readonly ElementFlags[], readonly: boolean, namedMemberDeclarations: readonly (NamedTupleMember | ParameterDeclaration)[] | undefined): TupleType {
|
||||
const arity = elementFlags.length;
|
||||
const minLength = findLastIndex(elementFlags, f => !!(f & (ElementFlags.Required | ElementFlags.Variadic))) + 1;
|
||||
const minLength = countWhere(elementFlags, f => !!(f & (ElementFlags.Required | ElementFlags.Variadic)));
|
||||
let typeParameters: TypeParameter[] | undefined;
|
||||
const properties: Symbol[] = [];
|
||||
let combinedFlags: ElementFlags = 0;
|
||||
@@ -13008,89 +13014,90 @@ namespace ts {
|
||||
}
|
||||
|
||||
function createNormalizedTypeReference(target: GenericType, typeArguments: readonly Type[] | undefined) {
|
||||
return target.objectFlags & ObjectFlags.Tuple && (<TupleType>target).combinedFlags & ElementFlags.Variadic ?
|
||||
createNormalizedTupleType(target as TupleType, typeArguments!) :
|
||||
createTypeReference(target, typeArguments);
|
||||
return target.objectFlags & ObjectFlags.Tuple ? createNormalizedTupleType(target as TupleType, typeArguments!) : createTypeReference(target, typeArguments);
|
||||
}
|
||||
|
||||
function createNormalizedTupleType(target: TupleType, elementTypes: readonly Type[]): Type {
|
||||
// Transform [A, ...(X | Y | Z)] into [A, ...X] | [A, ...Y] | [A, ...Z]
|
||||
const unionIndex = findIndex(elementTypes, (t, i) => !!(target.elementFlags[i] & ElementFlags.Variadic && t.flags & (TypeFlags.Never | TypeFlags.Union)));
|
||||
if (unionIndex >= 0) {
|
||||
return checkCrossProductUnion(map(elementTypes, (t, i) => target.elementFlags[i] & ElementFlags.Variadic ? t : unknownType)) ?
|
||||
mapType(elementTypes[unionIndex], t => createNormalizedTupleType(target, replaceElement(elementTypes, unionIndex, t))) :
|
||||
errorType;
|
||||
}
|
||||
// If there are no variadic elements with non-generic types, just create a type reference with the same target type.
|
||||
const spreadIndex = findIndex(elementTypes, (t, i) => !!(target.elementFlags[i] & ElementFlags.Variadic) && !(t.flags & TypeFlags.InstantiableNonPrimitive) && !isGenericMappedType(t));
|
||||
if (spreadIndex < 0) {
|
||||
if (!(target.combinedFlags & ElementFlags.NonRequired)) {
|
||||
// No need to normalize when we only have regular required elements
|
||||
return createTypeReference(target, elementTypes);
|
||||
}
|
||||
// We have non-generic variadic elements that need normalization.
|
||||
if (target.combinedFlags & ElementFlags.Variadic) {
|
||||
// Transform [A, ...(X | Y | Z)] into [A, ...X] | [A, ...Y] | [A, ...Z]
|
||||
const unionIndex = findIndex(elementTypes, (t, i) => !!(target.elementFlags[i] & ElementFlags.Variadic && t.flags & (TypeFlags.Never | TypeFlags.Union)));
|
||||
if (unionIndex >= 0) {
|
||||
return checkCrossProductUnion(map(elementTypes, (t, i) => target.elementFlags[i] & ElementFlags.Variadic ? t : unknownType)) ?
|
||||
mapType(elementTypes[unionIndex], t => createNormalizedTupleType(target, replaceElement(elementTypes, unionIndex, t))) :
|
||||
errorType;
|
||||
}
|
||||
}
|
||||
// We have optional, rest, or variadic elements that may need normalizing. Normalization ensures that all variadic
|
||||
// elements are generic and that the tuple type has one of the following layouts, disregarding variadic elements:
|
||||
// (1) Zero or more required elements, followed by zero or more optional elements, followed by zero or one rest element.
|
||||
// (2) Zero or more required elements, followed by a rest element, followed by zero or more required elements.
|
||||
// In either layout, zero or more generic variadic elements may be present at any location.
|
||||
const expandedTypes: Type[] = [];
|
||||
const expandedFlags: ElementFlags[] = [];
|
||||
let expandedDeclarations: (NamedTupleMember | ParameterDeclaration)[] | undefined = [];
|
||||
let optionalIndex = -1;
|
||||
let restTypes: Type[] | undefined;
|
||||
let lastRequiredIndex = -1;
|
||||
let firstRestIndex = -1;
|
||||
let lastOptionalOrRestIndex = -1;
|
||||
for (let i = 0; i < elementTypes.length; i++) {
|
||||
const type = elementTypes[i];
|
||||
const flags = target.elementFlags[i];
|
||||
if (flags & ElementFlags.Variadic) {
|
||||
if (type.flags & TypeFlags.InstantiableNonPrimitive || isGenericMappedType(type)) {
|
||||
// Generic variadic elements stay as they are (except following a rest element).
|
||||
addElementOrRest(type, ElementFlags.Variadic, target.labeledElementDeclarations?.[i]);
|
||||
// Generic variadic elements stay as they are.
|
||||
addElement(type, ElementFlags.Variadic, target.labeledElementDeclarations?.[i]);
|
||||
}
|
||||
else if (isTupleType(type)) {
|
||||
// Spread variadic elements with tuple types into the resulting tuple.
|
||||
forEach(getTypeArguments(type), (t, n) => addElementOrRest(t, type.target.elementFlags[n], type.target.labeledElementDeclarations?.[n]));
|
||||
forEach(getTypeArguments(type), (t, n) => addElement(t, type.target.elementFlags[n], type.target.labeledElementDeclarations?.[n]));
|
||||
}
|
||||
else {
|
||||
// Treat everything else as an array type and create a rest element.
|
||||
addElementOrRest(isArrayLikeType(type) && getIndexTypeOfType(type, IndexKind.Number) || errorType, ElementFlags.Rest, target.labeledElementDeclarations?.[i]);
|
||||
addElement(isArrayLikeType(type) && getIndexTypeOfType(type, IndexKind.Number) || errorType, ElementFlags.Rest, target.labeledElementDeclarations?.[i]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Copy other element kinds with no change.
|
||||
addElementOrRest(type, flags, target.labeledElementDeclarations?.[i]);
|
||||
addElement(type, flags, target.labeledElementDeclarations?.[i]);
|
||||
}
|
||||
}
|
||||
if (restTypes) {
|
||||
// Create a union of the collected rest element types.
|
||||
expandedTypes[expandedTypes.length - 1] = getUnionType(restTypes);
|
||||
// Turn optional elements preceding the last required element into required elements
|
||||
for (let i = 0; i < lastRequiredIndex; i++) {
|
||||
if (expandedFlags[i] & ElementFlags.Optional) expandedFlags[i] = ElementFlags.Required;
|
||||
}
|
||||
if (firstRestIndex >= 0 && firstRestIndex < lastOptionalOrRestIndex) {
|
||||
// Turn elements between first rest and last optional/rest into a single rest element
|
||||
expandedTypes[firstRestIndex] = getUnionType(sameMap(expandedTypes.slice(firstRestIndex, lastOptionalOrRestIndex + 1),
|
||||
(t, i) => expandedFlags[firstRestIndex + i] & ElementFlags.Variadic ? getIndexedAccessType(t, numberType) : t));
|
||||
expandedTypes.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
||||
expandedFlags.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
||||
expandedDeclarations?.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
||||
}
|
||||
const tupleTarget = getTupleTargetType(expandedFlags, target.readonly, expandedDeclarations);
|
||||
return tupleTarget === emptyGenericType ? emptyObjectType :
|
||||
expandedFlags.length ? createTypeReference(tupleTarget, expandedTypes) :
|
||||
tupleTarget;
|
||||
|
||||
function addElementOrRest(type: Type, flags: ElementFlags, declaration: NamedTupleMember | ParameterDeclaration | undefined) {
|
||||
if (restTypes) {
|
||||
// A rest element was previously added, so simply collect the type of this element.
|
||||
restTypes.push(flags & ElementFlags.Variadic ? getIndexedAccessType(type, numberType) : type);
|
||||
function addElement(type: Type, flags: ElementFlags, declaration: NamedTupleMember | ParameterDeclaration | undefined) {
|
||||
if (flags & ElementFlags.Required) {
|
||||
lastRequiredIndex = expandedFlags.length;
|
||||
}
|
||||
if (flags & ElementFlags.Rest && firstRestIndex < 0) {
|
||||
firstRestIndex = expandedFlags.length;
|
||||
}
|
||||
if (flags & (ElementFlags.Optional | ElementFlags.Rest)) {
|
||||
lastOptionalOrRestIndex = expandedFlags.length;
|
||||
}
|
||||
expandedTypes.push(type);
|
||||
expandedFlags.push(flags);
|
||||
if (expandedDeclarations && declaration) {
|
||||
expandedDeclarations.push(declaration);
|
||||
}
|
||||
else {
|
||||
if (flags & ElementFlags.Required && optionalIndex >= 0) {
|
||||
// Turn preceding optional elements into required elements
|
||||
for (let i = optionalIndex; i < expandedFlags.length; i++) {
|
||||
if (expandedFlags[i] & ElementFlags.Optional) expandedFlags[i] = ElementFlags.Required;
|
||||
}
|
||||
optionalIndex = -1;
|
||||
}
|
||||
else if (flags & ElementFlags.Optional && optionalIndex < 0) {
|
||||
optionalIndex = expandedFlags.length;
|
||||
}
|
||||
else if (flags & ElementFlags.Rest) {
|
||||
// Start collecting element types when a rest element is added.
|
||||
restTypes = [type];
|
||||
}
|
||||
expandedTypes.push(type);
|
||||
expandedFlags.push(flags);
|
||||
if (expandedDeclarations && declaration) {
|
||||
expandedDeclarations.push(declaration);
|
||||
}
|
||||
else {
|
||||
expandedDeclarations = undefined;
|
||||
}
|
||||
expandedDeclarations = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13108,6 +13115,17 @@ namespace ts {
|
||||
getIndexType(type.target.readonly ? globalReadonlyArrayType : globalArrayType)));
|
||||
}
|
||||
|
||||
// Return count of starting consecutive tuple elements of the given kind(s)
|
||||
function getStartElementCount(type: TupleType, flags: ElementFlags) {
|
||||
const index = findIndex(type.elementFlags, f => !(f & flags));
|
||||
return index >= 0 ? index : type.elementFlags.length;
|
||||
}
|
||||
|
||||
// Return count of ending consecutive tuple elements of the given kind(s)
|
||||
function getEndElementCount(type: TupleType, flags: ElementFlags) {
|
||||
return type.elementFlags.length - findLastIndex(type.elementFlags, f => !(f & flags)) - 1;
|
||||
}
|
||||
|
||||
function getTypeFromOptionalTypeNode(node: OptionalTypeNode): Type {
|
||||
const type = getTypeFromTypeNode(node.type);
|
||||
return strictNullChecks ? getOptionalType(type) : type;
|
||||
@@ -14758,7 +14776,7 @@ namespace ts {
|
||||
else if (isSpreadableProperty(prop)) {
|
||||
const isSetonlyAccessor = prop.flags & SymbolFlags.SetAccessor && !(prop.flags & SymbolFlags.GetAccessor);
|
||||
const flags = SymbolFlags.Property | SymbolFlags.Optional;
|
||||
const result = createSymbol(flags, prop.escapedName, readonly ? CheckFlags.Readonly : 0);
|
||||
const result = createSymbol(flags, prop.escapedName, getIsLateCheckFlag(prop) | (readonly ? CheckFlags.Readonly : 0));
|
||||
result.type = isSetonlyAccessor ? undefinedType : getTypeOfSymbol(prop);
|
||||
result.declarations = prop.declarations;
|
||||
result.nameType = getSymbolLinks(prop).nameType;
|
||||
@@ -14906,7 +14924,7 @@ namespace ts {
|
||||
return prop;
|
||||
}
|
||||
const flags = SymbolFlags.Property | (prop.flags & SymbolFlags.Optional);
|
||||
const result = createSymbol(flags, prop.escapedName, readonly ? CheckFlags.Readonly : 0);
|
||||
const result = createSymbol(flags, prop.escapedName, getIsLateCheckFlag(prop) | (readonly ? CheckFlags.Readonly : 0));
|
||||
result.type = isSetonlyAccessor ? undefinedType : getTypeOfSymbol(prop);
|
||||
result.declarations = prop.declarations;
|
||||
result.nameType = getSymbolLinks(prop).nameType;
|
||||
@@ -17088,38 +17106,14 @@ namespace ts {
|
||||
// Note that these checks are specifically ordered to produce correct results. In particular,
|
||||
// we need to deconstruct unions before intersections (because unions are always at the top),
|
||||
// and we need to handle "each" relations before "some" relations for the same kind of type.
|
||||
if (source.flags & TypeFlags.Union) {
|
||||
result = relation === comparableRelation ?
|
||||
someTypeRelatedToType(source as UnionType, target, reportErrors && !(source.flags & TypeFlags.Primitive), intersectionState) :
|
||||
eachTypeRelatedToType(source as UnionType, target, reportErrors && !(source.flags & TypeFlags.Primitive), intersectionState);
|
||||
if (source.flags & TypeFlags.UnionOrIntersection || target.flags & TypeFlags.UnionOrIntersection) {
|
||||
result = getConstituentCount(source) * getConstituentCount(target) >= 4 ?
|
||||
recursiveTypeRelatedTo(source, target, reportErrors, intersectionState | IntersectionState.UnionIntersectionCheck) :
|
||||
structuredTypeRelatedTo(source, target, reportErrors, intersectionState | IntersectionState.UnionIntersectionCheck);
|
||||
}
|
||||
else {
|
||||
if (target.flags & TypeFlags.Union) {
|
||||
result = typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source), <UnionType>target, reportErrors && !(source.flags & TypeFlags.Primitive) && !(target.flags & TypeFlags.Primitive));
|
||||
}
|
||||
else if (target.flags & TypeFlags.Intersection) {
|
||||
result = typeRelatedToEachType(getRegularTypeOfObjectLiteral(source), target as IntersectionType, reportErrors, IntersectionState.Target);
|
||||
}
|
||||
else if (source.flags & TypeFlags.Intersection) {
|
||||
// Check to see if any constituents of the intersection are immediately related to the target.
|
||||
//
|
||||
// Don't report errors though. Checking whether a constituent is related to the source is not actually
|
||||
// useful and leads to some confusing error messages. Instead it is better to let the below checks
|
||||
// take care of this, or to not elaborate at all. For instance,
|
||||
//
|
||||
// - For an object type (such as 'C = A & B'), users are usually more interested in structural errors.
|
||||
//
|
||||
// - For a union type (such as '(A | B) = (C & D)'), it's better to hold onto the whole intersection
|
||||
// than to report that 'D' is not assignable to 'A' or 'B'.
|
||||
//
|
||||
// - For a primitive type or type parameter (such as 'number = A & B') there is no point in
|
||||
// breaking the intersection apart.
|
||||
result = someTypeRelatedToType(<IntersectionType>source, target, /*reportErrors*/ false, IntersectionState.Source);
|
||||
}
|
||||
if (!result && (source.flags & TypeFlags.StructuredOrInstantiable || target.flags & TypeFlags.StructuredOrInstantiable)) {
|
||||
if (result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState)) {
|
||||
resetErrorInfo(saveErrorInfo);
|
||||
}
|
||||
if (!result && !(source.flags & TypeFlags.Union) && (source.flags & (TypeFlags.StructuredOrInstantiable) || target.flags & TypeFlags.StructuredOrInstantiable)) {
|
||||
if (result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState)) {
|
||||
resetErrorInfo(saveErrorInfo);
|
||||
}
|
||||
}
|
||||
if (!result && source.flags & (TypeFlags.Intersection | TypeFlags.TypeParameter)) {
|
||||
@@ -17627,6 +17621,37 @@ namespace ts {
|
||||
if (intersectionState & IntersectionState.PropertyCheck) {
|
||||
return propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, IntersectionState.None);
|
||||
}
|
||||
if (intersectionState & IntersectionState.UnionIntersectionCheck) {
|
||||
// Note that these checks are specifically ordered to produce correct results. In particular,
|
||||
// we need to deconstruct unions before intersections (because unions are always at the top),
|
||||
// and we need to handle "each" relations before "some" relations for the same kind of type.
|
||||
if (source.flags & TypeFlags.Union) {
|
||||
return relation === comparableRelation ?
|
||||
someTypeRelatedToType(source as UnionType, target, reportErrors && !(source.flags & TypeFlags.Primitive), intersectionState & ~IntersectionState.UnionIntersectionCheck) :
|
||||
eachTypeRelatedToType(source as UnionType, target, reportErrors && !(source.flags & TypeFlags.Primitive), intersectionState & ~IntersectionState.UnionIntersectionCheck);
|
||||
}
|
||||
if (target.flags & TypeFlags.Union) {
|
||||
return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source), <UnionType>target, reportErrors && !(source.flags & TypeFlags.Primitive) && !(target.flags & TypeFlags.Primitive));
|
||||
}
|
||||
if (target.flags & TypeFlags.Intersection) {
|
||||
return typeRelatedToEachType(getRegularTypeOfObjectLiteral(source), target as IntersectionType, reportErrors, IntersectionState.Target);
|
||||
}
|
||||
// Source is an intersection. Check to see if any constituents of the intersection are immediately related
|
||||
// to the target.
|
||||
//
|
||||
// Don't report errors though. Checking whether a constituent is related to the source is not actually
|
||||
// useful and leads to some confusing error messages. Instead it is better to let the below checks
|
||||
// take care of this, or to not elaborate at all. For instance,
|
||||
//
|
||||
// - For an object type (such as 'C = A & B'), users are usually more interested in structural errors.
|
||||
//
|
||||
// - For a union type (such as '(A | B) = (C & D)'), it's better to hold onto the whole intersection
|
||||
// than to report that 'D' is not assignable to 'A' or 'B'.
|
||||
//
|
||||
// - For a primitive type or type parameter (such as 'number = A & B') there is no point in
|
||||
// breaking the intersection apart.
|
||||
return someTypeRelatedToType(<IntersectionType>source, target, /*reportErrors*/ false, IntersectionState.Source);
|
||||
}
|
||||
const flags = source.flags & target.flags;
|
||||
if (relation === identityRelation && !(flags & TypeFlags.Object)) {
|
||||
if (flags & TypeFlags.Index) {
|
||||
@@ -18397,48 +18422,60 @@ namespace ts {
|
||||
}
|
||||
return Ternary.False;
|
||||
}
|
||||
const maxArity = Math.max(sourceArity, targetArity);
|
||||
for (let i = 0; i < maxArity; i++) {
|
||||
const targetFlags = i < targetArity ? target.target.elementFlags[i] : targetRestFlag;
|
||||
const sourceFlags = isTupleType(source) && i < sourceArity ? source.target.elementFlags[i] : sourceRestFlag;
|
||||
let canExcludeDiscriminants = !!excludedProperties;
|
||||
if (sourceFlags && targetFlags) {
|
||||
if (targetFlags & ElementFlags.Variadic && !(sourceFlags & ElementFlags.Variadic) ||
|
||||
(sourceFlags & ElementFlags.Variadic && !(targetFlags & ElementFlags.Variable))) {
|
||||
if (reportErrors) {
|
||||
reportError(Diagnostics.Element_at_index_0_is_variadic_in_one_type_but_not_in_the_other, i);
|
||||
}
|
||||
return Ternary.False;
|
||||
const sourceTypeArguments = getTypeArguments(source);
|
||||
const targetTypeArguments = getTypeArguments(target);
|
||||
const startCount = Math.min(isTupleType(source) ? getStartElementCount(source.target, ElementFlags.NonRest) : 0, getStartElementCount(target.target, ElementFlags.NonRest));
|
||||
const endCount = Math.min(isTupleType(source) ? getEndElementCount(source.target, ElementFlags.NonRest) : 0, targetRestFlag ? getEndElementCount(target.target, ElementFlags.NonRest) : 0);
|
||||
let canExcludeDiscriminants = !!excludedProperties;
|
||||
for (let i = 0; i < targetArity; i++) {
|
||||
const sourceIndex = i < targetArity - endCount ? i : i + sourceArity - targetArity;
|
||||
const sourceFlags = isTupleType(source) && (i < startCount || i >= targetArity - endCount) ? source.target.elementFlags[sourceIndex] : ElementFlags.Rest;
|
||||
const targetFlags = target.target.elementFlags[i];
|
||||
if (targetFlags & ElementFlags.Variadic && !(sourceFlags & ElementFlags.Variadic)) {
|
||||
if (reportErrors) {
|
||||
reportError(Diagnostics.Source_provides_no_match_for_variadic_element_at_position_0_in_target, i);
|
||||
}
|
||||
if (targetFlags & ElementFlags.Required) {
|
||||
if (!(sourceFlags & ElementFlags.Required)) {
|
||||
if (reportErrors) {
|
||||
reportError(Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, i, typeToString(source), typeToString(target));
|
||||
}
|
||||
return Ternary.False;
|
||||
}
|
||||
}
|
||||
// We can only exclude discriminant properties if we have not yet encountered a variable-length element.
|
||||
if (canExcludeDiscriminants) {
|
||||
if (sourceFlags & ElementFlags.Variable || targetFlags & ElementFlags.Variable) {
|
||||
canExcludeDiscriminants = false;
|
||||
}
|
||||
if (canExcludeDiscriminants && excludedProperties?.has(("" + i) as __String)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
const sourceType = getTypeArguments(source)[Math.min(i, sourceArity - 1)];
|
||||
const targetType = getTypeArguments(target)[Math.min(i, targetArity - 1)];
|
||||
const targetCheckType = sourceFlags & ElementFlags.Variadic && targetFlags & ElementFlags.Rest ? createArrayType(targetType) : targetType;
|
||||
const related = isRelatedTo(sourceType, targetCheckType, reportErrors, /*headMessage*/ undefined, intersectionState);
|
||||
if (!related) {
|
||||
if (reportErrors) {
|
||||
reportIncompatibleError(Diagnostics.Types_of_property_0_are_incompatible, i);
|
||||
}
|
||||
return Ternary.False;
|
||||
}
|
||||
result &= related;
|
||||
return Ternary.False;
|
||||
}
|
||||
if (sourceFlags & ElementFlags.Variadic && !(targetFlags & ElementFlags.Variable)) {
|
||||
if (reportErrors) {
|
||||
reportError(Diagnostics.Variadic_element_at_position_0_in_source_does_not_match_element_at_position_1_in_target, sourceIndex, i);
|
||||
}
|
||||
return Ternary.False;
|
||||
}
|
||||
if (targetFlags & ElementFlags.Required && !(sourceFlags & ElementFlags.Required)) {
|
||||
if (reportErrors) {
|
||||
reportError(Diagnostics.Source_provides_no_match_for_required_element_at_position_0_in_target, i);
|
||||
}
|
||||
return Ternary.False;
|
||||
}
|
||||
// We can only exclude discriminant properties if we have not yet encountered a variable-length element.
|
||||
if (canExcludeDiscriminants) {
|
||||
if (sourceFlags & ElementFlags.Variable || targetFlags & ElementFlags.Variable) {
|
||||
canExcludeDiscriminants = false;
|
||||
}
|
||||
if (canExcludeDiscriminants && excludedProperties?.has(("" + i) as __String)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
const sourceType = !isTupleType(source) ? sourceTypeArguments[0] :
|
||||
i < startCount || i >= targetArity - endCount ? sourceTypeArguments[sourceIndex] :
|
||||
getElementTypeOfSliceOfTupleType(source, startCount, endCount) || neverType;
|
||||
const targetType = targetTypeArguments[i];
|
||||
const targetCheckType = sourceFlags & ElementFlags.Variadic && targetFlags & ElementFlags.Rest ? createArrayType(targetType) : targetType;
|
||||
const related = isRelatedTo(sourceType, targetCheckType, reportErrors, /*headMessage*/ undefined, intersectionState);
|
||||
if (!related) {
|
||||
if (reportErrors) {
|
||||
if (i < startCount || i >= targetArity - endCount || sourceArity - startCount - endCount === 1) {
|
||||
reportIncompatibleError(Diagnostics.Type_at_position_0_in_source_is_not_compatible_with_type_at_position_1_in_target, sourceIndex, i);
|
||||
}
|
||||
else {
|
||||
reportIncompatibleError(Diagnostics.Type_at_positions_0_through_1_in_source_is_not_compatible_with_type_at_position_2_in_target, startCount, sourceArity - endCount - 1, i);
|
||||
}
|
||||
}
|
||||
return Ternary.False;
|
||||
}
|
||||
result &= related;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -19404,10 +19441,6 @@ namespace ts {
|
||||
return restType && createArrayType(restType);
|
||||
}
|
||||
|
||||
function getEndLengthOfType(type: Type) {
|
||||
return isTupleType(type) ? getTypeReferenceArity(type) - findLastIndex(type.target.elementFlags, f => !(f & (ElementFlags.Required | ElementFlags.Optional))) - 1 : 0;
|
||||
}
|
||||
|
||||
function getElementTypeOfSliceOfTupleType(type: TupleTypeReference, index: number, endSkipCount = 0, writing = false) {
|
||||
const length = getTypeReferenceArity(type) - endSkipCount;
|
||||
if (index < length) {
|
||||
@@ -20724,20 +20757,17 @@ namespace ts {
|
||||
return;
|
||||
}
|
||||
const startLength = isTupleType(source) ? Math.min(source.target.fixedLength, target.target.fixedLength) : 0;
|
||||
const sourceRestType = !isTupleType(source) || sourceArity > 0 && source.target.elementFlags[sourceArity - 1] & ElementFlags.Rest ?
|
||||
getTypeArguments(source)[sourceArity - 1] : undefined;
|
||||
const endLength = !(target.target.combinedFlags & ElementFlags.Variable) ? 0 :
|
||||
sourceRestType ? getEndLengthOfType(target) :
|
||||
Math.min(getEndLengthOfType(source), getEndLengthOfType(target));
|
||||
const sourceEndLength = sourceRestType ? 0 : endLength;
|
||||
const endLength = Math.min(isTupleType(source) ? getEndElementCount(source.target, ElementFlags.Fixed) : 0,
|
||||
target.target.hasRestElement ? getEndElementCount(target.target, ElementFlags.Fixed) : 0);
|
||||
// Infer between starting fixed elements.
|
||||
for (let i = 0; i < startLength; i++) {
|
||||
inferFromTypes(getTypeArguments(source)[i], elementTypes[i]);
|
||||
}
|
||||
if (sourceRestType && sourceArity - startLength === 1) {
|
||||
if (!isTupleType(source) || sourceArity - startLength - endLength === 1 && source.target.elementFlags[startLength] & ElementFlags.Rest) {
|
||||
// Single rest element remains in source, infer from that to every element in target
|
||||
const restType = getTypeArguments(source)[startLength];
|
||||
for (let i = startLength; i < targetArity - endLength; i++) {
|
||||
inferFromTypes(elementFlags[i] & ElementFlags.Variadic ? createArrayType(sourceRestType) : sourceRestType, elementTypes[i]);
|
||||
inferFromTypes(elementFlags[i] & ElementFlags.Variadic ? createArrayType(restType) : restType, elementTypes[i]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -20747,20 +20777,20 @@ namespace ts {
|
||||
const targetInfo = getInferenceInfoForType(elementTypes[startLength]);
|
||||
if (targetInfo && targetInfo.impliedArity !== undefined) {
|
||||
// Infer slices from source based on implied arity of T.
|
||||
inferFromTypes(sliceTupleType(source, startLength, sourceEndLength + sourceArity - targetInfo.impliedArity), elementTypes[startLength]);
|
||||
inferFromTypes(sliceTupleType(source, startLength + targetInfo.impliedArity, sourceEndLength), elementTypes[startLength + 1]);
|
||||
inferFromTypes(sliceTupleType(source, startLength, endLength + sourceArity - targetInfo.impliedArity), elementTypes[startLength]);
|
||||
inferFromTypes(sliceTupleType(source, startLength + targetInfo.impliedArity, endLength), elementTypes[startLength + 1]);
|
||||
}
|
||||
}
|
||||
else if (middleLength === 1 && elementFlags[startLength] & ElementFlags.Variadic) {
|
||||
// Middle of target is exactly one variadic element. Infer the slice between the fixed parts in the source.
|
||||
// If target ends in optional element(s), make a lower priority a speculative inference.
|
||||
const endsInOptional = target.target.elementFlags[targetArity - 1] & ElementFlags.Optional;
|
||||
const sourceSlice = isTupleType(source) ? sliceTupleType(source, startLength, sourceEndLength) : createArrayType(sourceRestType!);
|
||||
const sourceSlice = isTupleType(source) ? sliceTupleType(source, startLength, endLength) : createArrayType(getTypeArguments(source)[0]);
|
||||
inferWithPriority(sourceSlice, elementTypes[startLength], endsInOptional ? InferencePriority.SpeculativeTuple : 0);
|
||||
}
|
||||
else if (middleLength === 1 && elementFlags[startLength] & ElementFlags.Rest) {
|
||||
// Middle of target is exactly one rest element. If middle of source is not empty, infer union of middle element types.
|
||||
const restType = isTupleType(source) ? getElementTypeOfSliceOfTupleType(source, startLength, sourceEndLength) : sourceRestType;
|
||||
const restType = isTupleType(source) ? getElementTypeOfSliceOfTupleType(source, startLength, endLength) : getTypeArguments(source)[0];
|
||||
if (restType) {
|
||||
inferFromTypes(restType, elementTypes[startLength]);
|
||||
}
|
||||
@@ -20768,7 +20798,7 @@ namespace ts {
|
||||
}
|
||||
// Infer between ending fixed elements
|
||||
for (let i = 0; i < endLength; i++) {
|
||||
inferFromTypes(sourceRestType || getTypeArguments(source)[sourceArity - i - 1], elementTypes[targetArity - i - 1]);
|
||||
inferFromTypes(getTypeArguments(source)[sourceArity - i - 1], elementTypes[targetArity - i - 1]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -21587,6 +21617,10 @@ namespace ts {
|
||||
return changed ? mappedTypes && getUnionType(mappedTypes, noReductions ? UnionReduction.None : UnionReduction.Literal) : type;
|
||||
}
|
||||
|
||||
function getConstituentCount(type: Type) {
|
||||
return type.flags & TypeFlags.UnionOrIntersection ? (<UnionOrIntersectionType>type).types.length : 1;
|
||||
}
|
||||
|
||||
function extractTypesOfKind(type: Type, kind: TypeFlags) {
|
||||
return filterType(type, t => (t.flags & kind) !== 0);
|
||||
}
|
||||
@@ -27243,7 +27277,11 @@ namespace ts {
|
||||
}
|
||||
if (restType) {
|
||||
const spreadType = getSpreadArgumentType(args, argCount, args.length, restType, /*context*/ undefined, checkMode);
|
||||
const errorNode = reportErrors ? argCount < args.length ? args[argCount] : node : undefined;
|
||||
const restArgCount = args.length - argCount;
|
||||
const errorNode = !reportErrors ? undefined :
|
||||
restArgCount === 0 ? node :
|
||||
restArgCount === 1 ? args[argCount] :
|
||||
setTextRangePosEnd(createSyntheticExpression(node, spreadType), args[argCount].pos, args[args.length - 1].end);
|
||||
if (!checkTypeRelatedTo(spreadType, restType, relation, errorNode, headMessage, /*containingMessageChain*/ undefined, errorOutputContainer)) {
|
||||
Debug.assert(!reportErrors || !!errorOutputContainer.errors, "rest parameter should have errors when reporting errors");
|
||||
maybeAddMissingAwaitInfo(errorNode, spreadType, restType);
|
||||
@@ -29102,6 +29140,10 @@ namespace ts {
|
||||
return createTupleType(types, flags, /*readonly*/ false, length(names) === length(types) ? names : undefined);
|
||||
}
|
||||
|
||||
// Return the number of parameters in a signature. The rest parameter, if present, counts as one
|
||||
// parameter. For example, the parameter count of (x: number, y: number, ...z: string[]) is 3 and
|
||||
// the parameter count of (x: number, ...args: [number, ...string[], boolean])) is also 3. In the
|
||||
// latter example, the effective rest type is [...string[], boolean].
|
||||
function getParameterCount(signature: Signature) {
|
||||
const length = signature.parameters.length;
|
||||
if (signatureHasRestParameter(signature)) {
|
||||
@@ -32250,8 +32292,7 @@ namespace ts {
|
||||
let seenOptionalElement = false;
|
||||
let seenRestElement = false;
|
||||
const hasNamedElement = some(elementTypes, isNamedTupleMember);
|
||||
for (let i = 0; i < elementTypes.length; i++) {
|
||||
const e = elementTypes[i];
|
||||
for (const e of elementTypes) {
|
||||
if (e.kind !== SyntaxKind.NamedTupleMember && hasNamedElement) {
|
||||
grammarErrorOnNode(e, Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names);
|
||||
break;
|
||||
@@ -32268,19 +32309,23 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
else if (flags & ElementFlags.Rest) {
|
||||
if (seenRestElement) {
|
||||
grammarErrorOnNode(e, Diagnostics.A_rest_element_cannot_follow_another_rest_element);
|
||||
break;
|
||||
}
|
||||
seenRestElement = true;
|
||||
}
|
||||
else if (flags & ElementFlags.Optional) {
|
||||
if (seenRestElement) {
|
||||
grammarErrorOnNode(e, Diagnostics.An_optional_element_cannot_follow_a_rest_element);
|
||||
break;
|
||||
}
|
||||
seenOptionalElement = true;
|
||||
}
|
||||
else if (seenOptionalElement) {
|
||||
grammarErrorOnNode(e, Diagnostics.A_required_element_cannot_follow_an_optional_element);
|
||||
break;
|
||||
}
|
||||
if (seenRestElement && i !== elementTypes.length - 1) {
|
||||
grammarErrorOnNode(e, Diagnostics.A_rest_element_must_be_last_in_a_tuple_type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
forEach(node.elements, checkSourceElement);
|
||||
getTypeFromTypeNode(node);
|
||||
@@ -35764,7 +35809,7 @@ namespace ts {
|
||||
const implementedTypeNodes = getEffectiveImplementsTypeNodes(node);
|
||||
if (implementedTypeNodes) {
|
||||
for (const typeRefNode of implementedTypeNodes) {
|
||||
if (!isEntityNameExpression(typeRefNode.expression)) {
|
||||
if (!isEntityNameExpression(typeRefNode.expression) || isOptionalChain(typeRefNode.expression)) {
|
||||
error(typeRefNode.expression, Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments);
|
||||
}
|
||||
checkTypeReferenceNode(typeRefNode);
|
||||
@@ -36113,7 +36158,7 @@ namespace ts {
|
||||
checkObjectTypeForDuplicateDeclarations(node);
|
||||
}
|
||||
forEach(getInterfaceBaseTypeNodes(node), heritageElement => {
|
||||
if (!isEntityNameExpression(heritageElement.expression)) {
|
||||
if (!isEntityNameExpression(heritageElement.expression) || isOptionalChain(heritageElement.expression)) {
|
||||
error(heritageElement.expression, Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments);
|
||||
}
|
||||
checkTypeReferenceNode(heritageElement);
|
||||
@@ -38758,7 +38803,10 @@ namespace ts {
|
||||
isOptionalParameter,
|
||||
moduleExportsSomeValue,
|
||||
isArgumentsLocalBinding,
|
||||
getExternalModuleFileFromDeclaration,
|
||||
getExternalModuleFileFromDeclaration: nodeIn => {
|
||||
const node = getParseTreeNode(nodeIn, hasPossibleExternalModuleReference);
|
||||
return node && getExternalModuleFileFromDeclaration(node);
|
||||
},
|
||||
getTypeReferenceDirectivesForEntityName,
|
||||
getTypeReferenceDirectivesForSymbol,
|
||||
isLiteralConstDeclaration,
|
||||
@@ -38919,7 +38967,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function getExternalModuleFileFromDeclaration(declaration: AnyImportOrReExport | ModuleDeclaration | ImportTypeNode): SourceFile | undefined {
|
||||
function getExternalModuleFileFromDeclaration(declaration: AnyImportOrReExport | ModuleDeclaration | ImportTypeNode | ImportCall): SourceFile | undefined {
|
||||
const specifier = declaration.kind === SyntaxKind.ModuleDeclaration ? tryCast(declaration.name, isStringLiteral) : getExternalModuleName(declaration);
|
||||
const moduleSymbol = resolveExternalModuleNameWorker(specifier!, specifier!, /*moduleNotFoundError*/ undefined); // TODO: GH#18217
|
||||
if (!moduleSymbol) {
|
||||
|
||||
@@ -843,10 +843,6 @@
|
||||
"category": "Error",
|
||||
"code": 1255
|
||||
},
|
||||
"A rest element must be last in a tuple type.": {
|
||||
"category": "Error",
|
||||
"code": 1256
|
||||
},
|
||||
"A required element cannot follow an optional element.": {
|
||||
"category": "Error",
|
||||
"code": 1257
|
||||
@@ -875,6 +871,14 @@
|
||||
"category": "Error",
|
||||
"code": 1264
|
||||
},
|
||||
"A rest element cannot follow another rest element.": {
|
||||
"category": "Error",
|
||||
"code": 1265
|
||||
},
|
||||
"An optional element cannot follow a rest element.": {
|
||||
"category": "Error",
|
||||
"code": 1266
|
||||
},
|
||||
|
||||
"'with' statements are not allowed in an async function block.": {
|
||||
"category": "Error",
|
||||
@@ -2621,9 +2625,25 @@
|
||||
"category": "Error",
|
||||
"code": 2621
|
||||
},
|
||||
"Element at index {0} is variadic in one type but not in the other.": {
|
||||
"Source provides no match for required element at position {0} in target.": {
|
||||
"category": "Error",
|
||||
"code": 2622
|
||||
"code": 2623
|
||||
},
|
||||
"Source provides no match for variadic element at position {0} in target.": {
|
||||
"category": "Error",
|
||||
"code": 2624
|
||||
},
|
||||
"Variadic element at position {0} in source does not match element at position {1} in target.": {
|
||||
"category": "Error",
|
||||
"code": 2625
|
||||
},
|
||||
"Type at position {0} in source is not compatible with type at position {1} in target.": {
|
||||
"category": "Error",
|
||||
"code": 2626
|
||||
},
|
||||
"Type at positions {0} through {1} in source is not compatible with type at position {2} in target.": {
|
||||
"category": "Error",
|
||||
"code": 2627
|
||||
},
|
||||
|
||||
"Cannot augment module '{0}' with value exports because it resolves to a non-module entity.": {
|
||||
|
||||
@@ -511,12 +511,12 @@ namespace ts {
|
||||
* 3- The containing SourceFile has an entry in renamedDependencies for the import as requested by some module loaders (e.g. System).
|
||||
* Otherwise, a new StringLiteral node representing the module name will be returned.
|
||||
*/
|
||||
export function getExternalModuleNameLiteral(factory: NodeFactory, importNode: ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration, sourceFile: SourceFile, host: EmitHost, resolver: EmitResolver, compilerOptions: CompilerOptions) {
|
||||
const moduleName = getExternalModuleName(importNode)!; // TODO: GH#18217
|
||||
if (moduleName.kind === SyntaxKind.StringLiteral) {
|
||||
export function getExternalModuleNameLiteral(factory: NodeFactory, importNode: ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration | ImportCall, sourceFile: SourceFile, host: EmitHost, resolver: EmitResolver, compilerOptions: CompilerOptions) {
|
||||
const moduleName = getExternalModuleName(importNode);
|
||||
if (moduleName && isStringLiteral(moduleName)) {
|
||||
return tryGetModuleNameFromDeclaration(importNode, host, factory, resolver, compilerOptions)
|
||||
|| tryRenameExternalModule(factory, <StringLiteral>moduleName, sourceFile)
|
||||
|| factory.cloneNode(<StringLiteral>moduleName);
|
||||
|| tryRenameExternalModule(factory, moduleName, sourceFile)
|
||||
|| factory.cloneNode(moduleName);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
@@ -528,7 +528,7 @@ namespace ts {
|
||||
*/
|
||||
function tryRenameExternalModule(factory: NodeFactory, moduleName: LiteralExpression, sourceFile: SourceFile) {
|
||||
const rename = sourceFile.renamedDependencies && sourceFile.renamedDependencies.get(moduleName.text);
|
||||
return rename && factory.createStringLiteral(rename);
|
||||
return rename ? factory.createStringLiteral(rename) : undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -551,7 +551,7 @@ namespace ts {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function tryGetModuleNameFromDeclaration(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration, host: EmitHost, factory: NodeFactory, resolver: EmitResolver, compilerOptions: CompilerOptions) {
|
||||
function tryGetModuleNameFromDeclaration(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ImportCall, host: EmitHost, factory: NodeFactory, resolver: EmitResolver, compilerOptions: CompilerOptions) {
|
||||
return tryGetModuleNameFromFile(factory, resolver.getExternalModuleFileFromDeclaration(declaration), host, compilerOptions);
|
||||
}
|
||||
|
||||
|
||||
@@ -90,8 +90,6 @@ namespace ts {
|
||||
return visitPropertyDeclaration(node as PropertyDeclaration);
|
||||
case SyntaxKind.VariableStatement:
|
||||
return visitVariableStatement(node as VariableStatement);
|
||||
case SyntaxKind.ComputedPropertyName:
|
||||
return visitComputedPropertyName(node as ComputedPropertyName);
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
return visitPropertyAccessExpression(node as PropertyAccessExpression);
|
||||
case SyntaxKind.PrefixUnaryExpression:
|
||||
@@ -184,7 +182,7 @@ namespace ts {
|
||||
let node = visitEachChild(name, visitor, context);
|
||||
if (some(pendingExpressions)) {
|
||||
const expressions = pendingExpressions;
|
||||
expressions.push(name.expression);
|
||||
expressions.push(node.expression);
|
||||
pendingExpressions = [];
|
||||
node = factory.updateComputedPropertyName(
|
||||
node,
|
||||
|
||||
@@ -609,7 +609,10 @@ namespace ts {
|
||||
}
|
||||
|
||||
function visitImportCallExpression(node: ImportCall): Expression {
|
||||
const argument = visitNode(firstOrUndefined(node.arguments), moduleExpressionElementVisitor);
|
||||
const externalModuleName = getExternalModuleNameLiteral(factory, node, currentSourceFile, host, resolver, compilerOptions);
|
||||
const firstArgument = visitNode(firstOrUndefined(node.arguments), moduleExpressionElementVisitor);
|
||||
// Only use the external module name if it differs from the first argument. This allows us to preserve the quote style of the argument on output.
|
||||
const argument = externalModuleName && (!firstArgument || !isStringLiteral(firstArgument) || firstArgument.text !== externalModuleName.text) ? externalModuleName : firstArgument;
|
||||
const containsLexicalThis = !!(node.transformFlags & TransformFlags.ContainsLexicalThis);
|
||||
switch (compilerOptions.module) {
|
||||
case ModuleKind.AMD:
|
||||
|
||||
@@ -1495,13 +1495,17 @@ namespace ts {
|
||||
// }
|
||||
// };
|
||||
// });
|
||||
const externalModuleName = getExternalModuleNameLiteral(factory, node, currentSourceFile, host, resolver, compilerOptions);
|
||||
const firstArgument = visitNode(firstOrUndefined(node.arguments), destructuringAndImportCallVisitor);
|
||||
// Only use the external module name if it differs from the first argument. This allows us to preserve the quote style of the argument on output.
|
||||
const argument = externalModuleName && (!firstArgument || !isStringLiteral(firstArgument) || firstArgument.text !== externalModuleName.text) ? externalModuleName : firstArgument;
|
||||
return factory.createCallExpression(
|
||||
factory.createPropertyAccessExpression(
|
||||
contextObject,
|
||||
factory.createIdentifier("import")
|
||||
),
|
||||
/*typeArguments*/ undefined,
|
||||
some(node.arguments) ? [visitNode(node.arguments[0], destructuringAndImportCallVisitor)] : []
|
||||
argument ? [argument] : []
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+12
-9
@@ -4607,7 +4607,7 @@ namespace ts {
|
||||
isOptionalParameter(node: ParameterDeclaration): boolean;
|
||||
moduleExportsSomeValue(moduleReferenceExpression: Expression): boolean;
|
||||
isArgumentsLocalBinding(node: Identifier): boolean;
|
||||
getExternalModuleFileFromDeclaration(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration | ImportTypeNode): SourceFile | undefined;
|
||||
getExternalModuleFileFromDeclaration(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration | ImportTypeNode | ImportCall): SourceFile | undefined;
|
||||
getTypeReferenceDirectivesForEntityName(name: EntityNameOrEntityNameExpression): string[] | undefined;
|
||||
getTypeReferenceDirectivesForSymbol(symbol: Symbol, meaning?: SymbolFlags): string[] | undefined;
|
||||
isLiteralConstDeclaration(node: VariableDeclaration | PropertyDeclaration | PropertySignature | ParameterDeclaration): boolean;
|
||||
@@ -5251,18 +5251,21 @@ namespace ts {
|
||||
}
|
||||
|
||||
export const enum ElementFlags {
|
||||
Required = 1 << 0, // T
|
||||
Optional = 1 << 1, // T?
|
||||
Rest = 1 << 2, // ...T[]
|
||||
Variadic = 1 << 3, // ...T
|
||||
Variable = Rest | Variadic,
|
||||
Required = 1 << 0, // T
|
||||
Optional = 1 << 1, // T?
|
||||
Rest = 1 << 2, // ...T[]
|
||||
Variadic = 1 << 3, // ...T
|
||||
Fixed = Required | Optional,
|
||||
Variable = Rest | Variadic,
|
||||
NonRequired = Optional | Rest | Variadic,
|
||||
NonRest = Required | Optional | Variadic,
|
||||
}
|
||||
|
||||
export interface TupleType extends GenericType {
|
||||
elementFlags: readonly ElementFlags[];
|
||||
minLength: number;
|
||||
fixedLength: number;
|
||||
hasRestElement: boolean;
|
||||
minLength: number; // Number of required or variadic elements
|
||||
fixedLength: number; // Number of initial required or optional elements
|
||||
hasRestElement: boolean; // True if tuple has any rest or variadic elements
|
||||
combinedFlags: ElementFlags;
|
||||
readonly: boolean;
|
||||
labeledElementDeclarations?: readonly (NamedTupleMember | ParameterDeclaration)[];
|
||||
|
||||
+13
-10
@@ -907,6 +907,10 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function hasPossibleExternalModuleReference(node: Node): node is AnyImportOrReExport | ModuleDeclaration | ImportTypeNode | ImportCall {
|
||||
return isAnyImportOrReExport(node) || isModuleDeclaration(node) || isImportTypeNode(node) || isImportCall(node);
|
||||
}
|
||||
|
||||
export function isAnyImportOrReExport(node: Node): node is AnyImportOrReExport {
|
||||
return isAnyImportSyntax(node) || isExportDeclaration(node);
|
||||
}
|
||||
@@ -2426,7 +2430,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function getExternalModuleName(node: AnyImportOrReExport | ImportTypeNode): Expression | undefined {
|
||||
export function getExternalModuleName(node: AnyImportOrReExport | ImportTypeNode | ImportCall): Expression | undefined {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
case SyntaxKind.ExportDeclaration:
|
||||
@@ -2435,6 +2439,8 @@ namespace ts {
|
||||
return node.moduleReference.kind === SyntaxKind.ExternalModuleReference ? node.moduleReference.expression : undefined;
|
||||
case SyntaxKind.ImportType:
|
||||
return isLiteralImportTypeNode(node) ? node.argument.literal : undefined;
|
||||
case SyntaxKind.CallExpression:
|
||||
return node.arguments[0];
|
||||
default:
|
||||
return Debug.assertNever(node);
|
||||
}
|
||||
@@ -3065,14 +3071,7 @@ namespace ts {
|
||||
return !!originalKeywordKind && !isContextualKeyword(originalKeywordKind);
|
||||
}
|
||||
|
||||
export type TriviaKind =
|
||||
SyntaxKind.SingleLineCommentTrivia
|
||||
| SyntaxKind.MultiLineCommentTrivia
|
||||
| SyntaxKind.NewLineTrivia
|
||||
| SyntaxKind.WhitespaceTrivia
|
||||
| SyntaxKind.ShebangTrivia
|
||||
| SyntaxKind.ConflictMarkerTrivia;
|
||||
export function isTrivia(token: SyntaxKind): token is TriviaKind {
|
||||
export function isTrivia(token: SyntaxKind): token is TriviaSyntaxKind {
|
||||
return SyntaxKind.FirstTriviaToken <= token && token <= SyntaxKind.LastTriviaToken;
|
||||
}
|
||||
|
||||
@@ -3580,7 +3579,8 @@ namespace ts {
|
||||
}
|
||||
|
||||
// TODO: Should prefix `++` and `--` be moved to the `Update` precedence?
|
||||
// TODO: We are missing `TypeAssertionExpression`
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
case SyntaxKind.NonNullExpression:
|
||||
case SyntaxKind.PrefixUnaryExpression:
|
||||
case SyntaxKind.TypeOfExpression:
|
||||
case SyntaxKind.VoidExpression:
|
||||
@@ -3602,6 +3602,9 @@ namespace ts {
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
return OperatorPrecedence.Member;
|
||||
|
||||
case SyntaxKind.AsExpression:
|
||||
return OperatorPrecedence.Relational;
|
||||
|
||||
case SyntaxKind.ThisKeyword:
|
||||
case SyntaxKind.SuperKeyword:
|
||||
case SyntaxKind.Identifier:
|
||||
|
||||
Vendored
+280
-185
@@ -594,6 +594,10 @@ interface ImageEncodeOptions {
|
||||
type?: string;
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
url?: string;
|
||||
}
|
||||
|
||||
interface InputEventInit extends UIEventInit {
|
||||
data?: string | null;
|
||||
inputType?: string;
|
||||
@@ -611,7 +615,7 @@ interface IntersectionObserverEntryInit {
|
||||
}
|
||||
|
||||
interface IntersectionObserverInit {
|
||||
root?: Element | null;
|
||||
root?: Element | Document | null;
|
||||
rootMargin?: string;
|
||||
threshold?: number | number[];
|
||||
}
|
||||
@@ -642,6 +646,8 @@ interface KeyAlgorithm {
|
||||
}
|
||||
|
||||
interface KeyboardEventInit extends EventModifierInit {
|
||||
/** @deprecated */
|
||||
charCode?: number;
|
||||
code?: string;
|
||||
isComposing?: boolean;
|
||||
key?: string;
|
||||
@@ -1023,18 +1029,13 @@ interface PermissionDescriptor {
|
||||
name: PermissionName;
|
||||
}
|
||||
|
||||
interface PipeOptions {
|
||||
preventAbort?: boolean;
|
||||
preventCancel?: boolean;
|
||||
preventClose?: boolean;
|
||||
signal?: AbortSignal;
|
||||
}
|
||||
|
||||
interface PointerEventInit extends MouseEventInit {
|
||||
coalescedEvents?: PointerEvent[];
|
||||
height?: number;
|
||||
isPrimary?: boolean;
|
||||
pointerId?: number;
|
||||
pointerType?: string;
|
||||
predictedEvents?: PointerEvent[];
|
||||
pressure?: number;
|
||||
tangentialPressure?: number;
|
||||
tiltX?: number;
|
||||
@@ -1138,7 +1139,16 @@ interface PushSubscriptionOptionsInit {
|
||||
|
||||
interface QueuingStrategy<T = any> {
|
||||
highWaterMark?: number;
|
||||
size?: QueuingStrategySizeCallback<T>;
|
||||
size?: QueuingStrategySize<T>;
|
||||
}
|
||||
|
||||
interface QueuingStrategyInit {
|
||||
/**
|
||||
* Creates a new ByteLengthQueuingStrategy with the provided high water mark.
|
||||
*
|
||||
* Note that the provided high water mark will not be validated ahead of time. Instead, if it is negative, NaN, or not a number, the resulting ByteLengthQueuingStrategy will cause the corresponding stream constructor to throw.
|
||||
*/
|
||||
highWaterMark: number;
|
||||
}
|
||||
|
||||
interface RTCAnswerOptions extends RTCOfferAnswerOptions {
|
||||
@@ -1239,17 +1249,36 @@ interface RTCIceCandidatePair {
|
||||
interface RTCIceCandidatePairStats extends RTCStats {
|
||||
availableIncomingBitrate?: number;
|
||||
availableOutgoingBitrate?: number;
|
||||
bytesDiscardedOnSend?: number;
|
||||
bytesReceived?: number;
|
||||
bytesSent?: number;
|
||||
circuitBreakerTriggerCount?: number;
|
||||
consentExpiredTimestamp?: number;
|
||||
consentRequestsSent?: number;
|
||||
currentRoundTripTime?: number;
|
||||
currentRtt?: number;
|
||||
firstRequestTimestamp?: number;
|
||||
lastPacketReceivedTimestamp?: number;
|
||||
lastPacketSentTimestamp?: number;
|
||||
lastRequestTimestamp?: number;
|
||||
lastResponseTimestamp?: number;
|
||||
localCandidateId?: string;
|
||||
nominated?: boolean;
|
||||
packetsDiscardedOnSend?: number;
|
||||
packetsReceived?: number;
|
||||
packetsSent?: number;
|
||||
priority?: number;
|
||||
readable?: boolean;
|
||||
remoteCandidateId?: string;
|
||||
roundTripTime?: number;
|
||||
requestsReceived?: number;
|
||||
requestsSent?: number;
|
||||
responsesReceived?: number;
|
||||
responsesSent?: number;
|
||||
retransmissionsReceived?: number;
|
||||
retransmissionsSent?: number;
|
||||
state?: RTCStatsIceCandidatePairState;
|
||||
totalRoundTripTime?: number;
|
||||
totalRtt?: number;
|
||||
transportId?: string;
|
||||
writable?: boolean;
|
||||
}
|
||||
|
||||
interface RTCIceGatherOptions {
|
||||
@@ -1487,9 +1516,9 @@ interface RTCSsrcRange {
|
||||
}
|
||||
|
||||
interface RTCStats {
|
||||
id: string;
|
||||
timestamp: number;
|
||||
type: RTCStatsType;
|
||||
id?: string;
|
||||
timestamp?: number;
|
||||
type?: RTCStatsType;
|
||||
}
|
||||
|
||||
interface RTCStatsEventInit extends EventInit {
|
||||
@@ -1507,25 +1536,43 @@ interface RTCTrackEventInit extends EventInit {
|
||||
}
|
||||
|
||||
interface RTCTransportStats extends RTCStats {
|
||||
activeConnection?: boolean;
|
||||
bytesReceived?: number;
|
||||
bytesSent?: number;
|
||||
dtlsCipher?: string;
|
||||
dtlsState?: RTCDtlsTransportState;
|
||||
iceRole?: RTCIceRole;
|
||||
localCertificateId?: string;
|
||||
packetsReceived?: number;
|
||||
packetsSent?: number;
|
||||
remoteCertificateId?: string;
|
||||
rtcpTransportStatsId?: string;
|
||||
selectedCandidatePairChanges?: number;
|
||||
selectedCandidatePairId?: string;
|
||||
srtpCipher?: string;
|
||||
tlsGroup?: string;
|
||||
tlsVersion?: string;
|
||||
}
|
||||
|
||||
interface ReadableStreamReadDoneResult<T> {
|
||||
interface ReadableStreamDefaultReadDoneResult {
|
||||
done: true;
|
||||
value?: T;
|
||||
value?: undefined;
|
||||
}
|
||||
|
||||
interface ReadableStreamReadValueResult<T> {
|
||||
interface ReadableStreamDefaultReadValueResult<T> {
|
||||
done: false;
|
||||
value: T;
|
||||
}
|
||||
|
||||
interface ReadableWritablePair<R = any, W = any> {
|
||||
readable: ReadableStream<R>;
|
||||
/**
|
||||
* Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use.
|
||||
*
|
||||
* Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
|
||||
*/
|
||||
writable: WritableStream<W>;
|
||||
}
|
||||
|
||||
interface RegistrationOptions {
|
||||
scope?: string;
|
||||
type?: WorkerType;
|
||||
@@ -1587,6 +1634,10 @@ interface RequestInit {
|
||||
window?: any;
|
||||
}
|
||||
|
||||
interface ResizeObserverOptions {
|
||||
box?: ResizeObserverBoxOptions;
|
||||
}
|
||||
|
||||
interface ResponseInit {
|
||||
headers?: HeadersInit;
|
||||
status?: number;
|
||||
@@ -1700,6 +1751,16 @@ interface ShareData {
|
||||
url?: string;
|
||||
}
|
||||
|
||||
interface SpeechRecognitionErrorEventInit extends EventInit {
|
||||
error: SpeechRecognitionErrorCode;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
interface SpeechRecognitionEventInit extends EventInit {
|
||||
resultIndex?: number;
|
||||
results: SpeechRecognitionResultList;
|
||||
}
|
||||
|
||||
interface SpeechSynthesisErrorEventInit extends SpeechSynthesisEventInit {
|
||||
error: SpeechSynthesisErrorCode;
|
||||
}
|
||||
@@ -1746,6 +1807,30 @@ interface StoreSiteSpecificExceptionsInformation extends StoreExceptionsInformat
|
||||
arrayOfDomainStrings?: string[];
|
||||
}
|
||||
|
||||
interface StreamPipeOptions {
|
||||
preventAbort?: boolean;
|
||||
preventCancel?: boolean;
|
||||
/**
|
||||
* Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.
|
||||
*
|
||||
* Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
|
||||
*
|
||||
* Errors and closures of the source and destination streams propagate as follows:
|
||||
*
|
||||
* An error in this source readable stream will abort destination, unless preventAbort is truthy. The returned promise will be rejected with the source's error, or with any error that occurs during aborting the destination.
|
||||
*
|
||||
* An error in destination will cancel this source readable stream, unless preventCancel is truthy. The returned promise will be rejected with the destination's error, or with any error that occurs during canceling the source.
|
||||
*
|
||||
* When this source readable stream closes, destination will be closed, unless preventClose is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error.
|
||||
*
|
||||
* If destination starts out closed or closing, this source readable stream will be canceled, unless preventCancel is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source.
|
||||
*
|
||||
* The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set.
|
||||
*/
|
||||
preventClose?: boolean;
|
||||
signal?: AbortSignal;
|
||||
}
|
||||
|
||||
interface TextDecodeOptions {
|
||||
stream?: boolean;
|
||||
}
|
||||
@@ -1789,10 +1874,10 @@ interface TrackEventInit extends EventInit {
|
||||
}
|
||||
|
||||
interface Transformer<I = any, O = any> {
|
||||
flush?: TransformStreamDefaultControllerCallback<O>;
|
||||
flush?: TransformerFlushCallback<O>;
|
||||
readableType?: undefined;
|
||||
start?: TransformStreamDefaultControllerCallback<O>;
|
||||
transform?: TransformStreamDefaultControllerTransformCallback<I, O>;
|
||||
start?: TransformerStartCallback<O>;
|
||||
transform?: TransformerTransformCallback<I, O>;
|
||||
writableType?: undefined;
|
||||
}
|
||||
|
||||
@@ -1812,26 +1897,18 @@ interface ULongRange {
|
||||
min?: number;
|
||||
}
|
||||
|
||||
interface UnderlyingByteSource {
|
||||
autoAllocateChunkSize?: number;
|
||||
cancel?: ReadableStreamErrorCallback;
|
||||
pull?: ReadableByteStreamControllerCallback;
|
||||
start?: ReadableByteStreamControllerCallback;
|
||||
type: "bytes";
|
||||
}
|
||||
|
||||
interface UnderlyingSink<W = any> {
|
||||
abort?: WritableStreamErrorCallback;
|
||||
close?: WritableStreamDefaultControllerCloseCallback;
|
||||
start?: WritableStreamDefaultControllerStartCallback;
|
||||
abort?: UnderlyingSinkAbortCallback;
|
||||
close?: UnderlyingSinkCloseCallback;
|
||||
start?: UnderlyingSinkStartCallback;
|
||||
type?: undefined;
|
||||
write?: WritableStreamDefaultControllerWriteCallback<W>;
|
||||
write?: UnderlyingSinkWriteCallback<W>;
|
||||
}
|
||||
|
||||
interface UnderlyingSource<R = any> {
|
||||
cancel?: ReadableStreamErrorCallback;
|
||||
pull?: ReadableStreamDefaultControllerCallback<R>;
|
||||
start?: ReadableStreamDefaultControllerCallback<R>;
|
||||
cancel?: UnderlyingSourceCancelCallback;
|
||||
pull?: UnderlyingSourcePullCallback<R>;
|
||||
start?: UnderlyingSourceStartCallback<R>;
|
||||
type?: undefined;
|
||||
}
|
||||
|
||||
@@ -2320,7 +2397,9 @@ declare var AudioParamMap: {
|
||||
new(): AudioParamMap;
|
||||
};
|
||||
|
||||
/** The Web Audio API events that occur when a ScriptProcessorNode input buffer is ready to be processed. */
|
||||
/** The Web Audio API events that occur when a ScriptProcessorNode input buffer is ready to be processed.
|
||||
* @deprecated As of the August 29 2014 Web Audio API spec publication, this feature has been marked as deprecated, and is soon to be replaced by AudioWorklet.
|
||||
*/
|
||||
interface AudioProcessingEvent extends Event {
|
||||
readonly inputBuffer: AudioBuffer;
|
||||
readonly outputBuffer: AudioBuffer;
|
||||
@@ -2563,13 +2642,13 @@ declare var BroadcastChannel: {
|
||||
|
||||
/** This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. */
|
||||
interface ByteLengthQueuingStrategy extends QueuingStrategy<ArrayBufferView> {
|
||||
highWaterMark: number;
|
||||
size(chunk: ArrayBufferView): number;
|
||||
readonly highWaterMark: number;
|
||||
readonly size: QueuingStrategySize<ArrayBufferView>;
|
||||
}
|
||||
|
||||
declare var ByteLengthQueuingStrategy: {
|
||||
prototype: ByteLengthQueuingStrategy;
|
||||
new(options: { highWaterMark: number }): ByteLengthQueuingStrategy;
|
||||
new(init: QueuingStrategyInit): ByteLengthQueuingStrategy;
|
||||
};
|
||||
|
||||
/** A CDATA section that can be used within XML to include extended portions of unescaped text. The symbols < and & don’t need escaping as they normally do when inside a CDATA section. */
|
||||
@@ -3614,13 +3693,13 @@ declare var ConvolverNode: {
|
||||
|
||||
/** This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. */
|
||||
interface CountQueuingStrategy extends QueuingStrategy {
|
||||
highWaterMark: number;
|
||||
size(chunk: any): 1;
|
||||
readonly highWaterMark: number;
|
||||
readonly size: QueuingStrategySize;
|
||||
}
|
||||
|
||||
declare var CountQueuingStrategy: {
|
||||
prototype: CountQueuingStrategy;
|
||||
new(options: { highWaterMark: number }): CountQueuingStrategy;
|
||||
new(init: QueuingStrategyInit): CountQueuingStrategy;
|
||||
};
|
||||
|
||||
interface Credential {
|
||||
@@ -4680,6 +4759,7 @@ interface Document extends Node, DocumentAndElementEventHandlers, DocumentOrShad
|
||||
createEvent(eventInterface: "SVGZoomEvents"): SVGZoomEvent;
|
||||
createEvent(eventInterface: "SecurityPolicyViolationEvent"): SecurityPolicyViolationEvent;
|
||||
createEvent(eventInterface: "ServiceWorkerMessageEvent"): ServiceWorkerMessageEvent;
|
||||
createEvent(eventInterface: "SpeechRecognitionErrorEvent"): SpeechRecognitionErrorEvent;
|
||||
createEvent(eventInterface: "SpeechRecognitionEvent"): SpeechRecognitionEvent;
|
||||
createEvent(eventInterface: "SpeechSynthesisErrorEvent"): SpeechSynthesisErrorEvent;
|
||||
createEvent(eventInterface: "SpeechSynthesisEvent"): SpeechSynthesisEvent;
|
||||
@@ -4747,14 +4827,14 @@ interface Document extends Node, DocumentAndElementEventHandlers, DocumentOrShad
|
||||
exitPointerLock(): void;
|
||||
getAnimations(): Animation[];
|
||||
/**
|
||||
* Returns a reference to the first object with the specified value of the ID or NAME attribute.
|
||||
* @param elementId String that specifies the ID value. Case-insensitive.
|
||||
* Returns a reference to the first object with the specified value of the ID attribute.
|
||||
* @param elementId String that specifies the ID value.
|
||||
*/
|
||||
getElementById(elementId: string): HTMLElement | null;
|
||||
getElementById<E extends Element = HTMLElement>(elementId: string): E | null;
|
||||
/**
|
||||
* Returns a HTMLCollection of the elements in the object on which the method was invoked (a document or an element) that have all the classes given by classNames. The classNames argument is interpreted as a space-separated list of classes.
|
||||
*/
|
||||
getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;
|
||||
getElementsByClassName<E extends Element = HTMLElement>(classNames: string): HTMLCollectionOf<E>;
|
||||
/**
|
||||
* Gets a collection of objects based on the value of the NAME or ID attribute.
|
||||
* @param elementName Gets a collection of objects based on the value of the NAME or ID attribute.
|
||||
@@ -4929,6 +5009,7 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface: "SVGZoomEvents"): SVGZoomEvent;
|
||||
createEvent(eventInterface: "SecurityPolicyViolationEvent"): SecurityPolicyViolationEvent;
|
||||
createEvent(eventInterface: "ServiceWorkerMessageEvent"): ServiceWorkerMessageEvent;
|
||||
createEvent(eventInterface: "SpeechRecognitionErrorEvent"): SpeechRecognitionErrorEvent;
|
||||
createEvent(eventInterface: "SpeechRecognitionEvent"): SpeechRecognitionEvent;
|
||||
createEvent(eventInterface: "SpeechSynthesisErrorEvent"): SpeechSynthesisErrorEvent;
|
||||
createEvent(eventInterface: "SpeechSynthesisEvent"): SpeechSynthesisEvent;
|
||||
@@ -4949,7 +5030,7 @@ interface DocumentEvent {
|
||||
/** A minimal document object that has no parent. It is used as a lightweight version of Document that stores a segment of a document structure comprised of nodes just like a standard document. The key difference is that because the document fragment isn't part of the active document tree structure, changes made to the fragment don't affect the document, cause reflow, or incur any performance impact that can occur when changes are made. */
|
||||
interface DocumentFragment extends Node, NonElementParentNode, ParentNode {
|
||||
readonly ownerDocument: Document;
|
||||
getElementById(elementId: string): HTMLElement | null;
|
||||
getElementById<E extends Element = HTMLElement>(elementId: string): E | null;
|
||||
}
|
||||
|
||||
declare var DocumentFragment: {
|
||||
@@ -5057,7 +5138,6 @@ interface ElementEventMap {
|
||||
|
||||
/** Element is the most general base class from which all objects in a Document inherit. It only has methods and properties common to all kinds of elements. More specific classes inherit from Element. */
|
||||
interface Element extends Node, Animatable, ChildNode, InnerHTML, NonDocumentTypeChildNode, ParentNode, Slottable {
|
||||
readonly assignedSlot: HTMLSlotElement | null;
|
||||
readonly attributes: NamedNodeMap;
|
||||
/**
|
||||
* Allows for manipulation of element's class content attribute as a set of whitespace-separated tokens through a DOMTokenList object.
|
||||
@@ -5136,7 +5216,7 @@ interface Element extends Node, Animatable, ChildNode, InnerHTML, NonDocumentTyp
|
||||
/**
|
||||
* Returns a HTMLCollection of the elements in the object on which the method was invoked (a document or an element) that have all the classes given by classNames. The classNames argument is interpreted as a space-separated list of classes.
|
||||
*/
|
||||
getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;
|
||||
getElementsByClassName<E extends Element = HTMLElement>(classNames: string): HTMLCollectionOf<E>;
|
||||
getElementsByTagName<K extends keyof HTMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementTagNameMap[K]>;
|
||||
getElementsByTagName<K extends keyof SVGElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<SVGElementTagNameMap[K]>;
|
||||
getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;
|
||||
@@ -5612,24 +5692,7 @@ declare var GamepadPose: {
|
||||
};
|
||||
|
||||
interface GenericTransformStream {
|
||||
/**
|
||||
* Returns a readable stream whose chunks are strings resulting from running encoding's decoder on the chunks written to writable.
|
||||
*/
|
||||
readonly readable: ReadableStream;
|
||||
/**
|
||||
* Returns a writable stream which accepts [AllowShared] BufferSource chunks and runs them through encoding's decoder before making them available to readable.
|
||||
*
|
||||
* Typically this will be used via the pipeThrough() method on a ReadableStream source.
|
||||
*
|
||||
* ```
|
||||
* var decoder = new TextDecoderStream(encoding);
|
||||
* byteReadable
|
||||
* .pipeThrough(decoder)
|
||||
* .pipeTo(textWritable);
|
||||
* ```
|
||||
*
|
||||
* If the error mode is "fatal" and encoding's decoder returns error, both readable and writable will be errored with a TypeError.
|
||||
*/
|
||||
readonly writable: WritableStream;
|
||||
}
|
||||
|
||||
@@ -5693,6 +5756,7 @@ interface GlobalEventHandlersEventMap {
|
||||
"animationiteration": AnimationEvent;
|
||||
"animationstart": AnimationEvent;
|
||||
"auxclick": MouseEvent;
|
||||
"beforeinput": InputEvent;
|
||||
"blur": FocusEvent;
|
||||
"cancel": Event;
|
||||
"canplay": Event;
|
||||
@@ -5700,6 +5764,9 @@ interface GlobalEventHandlersEventMap {
|
||||
"change": Event;
|
||||
"click": MouseEvent;
|
||||
"close": Event;
|
||||
"compositionend": CompositionEvent;
|
||||
"compositionstart": CompositionEvent;
|
||||
"compositionupdate": CompositionEvent;
|
||||
"contextmenu": MouseEvent;
|
||||
"cuechange": Event;
|
||||
"dblclick": MouseEvent;
|
||||
@@ -6604,6 +6671,7 @@ interface HTMLElement extends Element, DocumentAndElementEventHandlers, ElementC
|
||||
readonly offsetParent: Element | null;
|
||||
readonly offsetTop: number;
|
||||
readonly offsetWidth: number;
|
||||
readonly parentElement: HTMLElement | null;
|
||||
spellcheck: boolean;
|
||||
title: string;
|
||||
translate: boolean;
|
||||
@@ -7339,7 +7407,7 @@ interface HTMLInputElement extends HTMLElement {
|
||||
* @param end The offset into the text field for the end of the selection.
|
||||
* @param direction The direction in which the selection is performed.
|
||||
*/
|
||||
setSelectionRange(start: number, end: number, direction?: "forward" | "backward" | "none"): void;
|
||||
setSelectionRange(start: number | null, end: number | null, direction?: "forward" | "backward" | "none"): void;
|
||||
/**
|
||||
* Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value.
|
||||
* @param n Value to decrement the value by.
|
||||
@@ -8635,7 +8703,6 @@ declare var HTMLTableElement: {
|
||||
};
|
||||
|
||||
interface HTMLTableHeaderCellElement extends HTMLTableCellElement {
|
||||
scope: string;
|
||||
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLTableHeaderCellElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
||||
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLTableHeaderCellElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
||||
@@ -8846,7 +8913,7 @@ interface HTMLTextAreaElement extends HTMLElement {
|
||||
* @param end The offset into the text field for the end of the selection.
|
||||
* @param direction The direction in which the selection is performed.
|
||||
*/
|
||||
setSelectionRange(start: number, end: number, direction?: "forward" | "backward" | "none"): void;
|
||||
setSelectionRange(start: number | null, end: number | null, direction?: "forward" | "backward" | "none"): void;
|
||||
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLTextAreaElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
||||
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLTextAreaElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
||||
@@ -9613,7 +9680,7 @@ declare var InputEvent: {
|
||||
|
||||
/** provides a way to asynchronously observe changes in the intersection of a target element with an ancestor element or with a top-level document's viewport. */
|
||||
interface IntersectionObserver {
|
||||
readonly root: Element | null;
|
||||
readonly root: Element | Document | null;
|
||||
readonly rootMargin: string;
|
||||
readonly thresholds: ReadonlyArray<number>;
|
||||
disconnect(): void;
|
||||
@@ -10552,7 +10619,8 @@ declare var MouseEvent: {
|
||||
new(type: string, eventInitDict?: MouseEventInit): MouseEvent;
|
||||
};
|
||||
|
||||
/** Provides event properties that are specific to modifications to the Document Object Model (DOM) hierarchy and nodes. */
|
||||
/** Provides event properties that are specific to modifications to the Document Object Model (DOM) hierarchy and nodes.
|
||||
* @deprecated DOM4 [DOM] provides a new mechanism using a MutationObserver interface which addresses the use cases that mutation events solve, but in a more performant manner. Thus, this specification describes mutation events for reference and completeness of legacy behavior, but deprecates the use of the MutationEvent interface. */
|
||||
interface MutationEvent extends Event {
|
||||
readonly attrChange: number;
|
||||
readonly attrName: string;
|
||||
@@ -10797,7 +10865,7 @@ interface Node extends EventTarget {
|
||||
/**
|
||||
* Returns the parent element.
|
||||
*/
|
||||
readonly parentElement: HTMLElement | null;
|
||||
readonly parentElement: Element | null;
|
||||
/**
|
||||
* Returns the parent.
|
||||
*/
|
||||
@@ -11030,7 +11098,6 @@ declare var NodeList: {
|
||||
};
|
||||
|
||||
interface NodeListOf<TNode extends Node> extends NodeList {
|
||||
length: number;
|
||||
item(index: number): TNode;
|
||||
/**
|
||||
* Performs the specified action for each node in an list.
|
||||
@@ -11056,7 +11123,7 @@ interface NonElementParentNode {
|
||||
/**
|
||||
* Returns the first element within node's descendants whose ID is elementId.
|
||||
*/
|
||||
getElementById(elementId: string): Element | null;
|
||||
getElementById<E extends Element = HTMLElement>(elementId: string): E | null;
|
||||
}
|
||||
|
||||
interface NotificationEventMap {
|
||||
@@ -11539,7 +11606,9 @@ declare var PerformanceMeasure: {
|
||||
new(): PerformanceMeasure;
|
||||
};
|
||||
|
||||
/** The legacy PerformanceNavigation interface represents information about how the navigation to the current document was done. */
|
||||
/** The legacy PerformanceNavigation interface represents information about how the navigation to the current document was done.
|
||||
* @deprecated This interface is deprecated in the Navigation Timing Level 2 specification. Please use the PerformanceNavigationTiming interface instead.
|
||||
*/
|
||||
interface PerformanceNavigation {
|
||||
readonly redirectCount: number;
|
||||
readonly type: number;
|
||||
@@ -11629,7 +11698,9 @@ declare var PerformanceResourceTiming: {
|
||||
new(): PerformanceResourceTiming;
|
||||
};
|
||||
|
||||
/** A legacy interface kept for backwards compatibility and contains properties that offer performance timing information for various events which occur during the loading and use of the current page. You get a PerformanceTiming object describing your page using the window.performance.timing property. */
|
||||
/** A legacy interface kept for backwards compatibility and contains properties that offer performance timing information for various events which occur during the loading and use of the current page. You get a PerformanceTiming object describing your page using the window.performance.timing property.
|
||||
* @deprecated This interface is deprecated in the Navigation Timing Level 2 specification. Please use the PerformanceNavigationTiming interface instead.
|
||||
*/
|
||||
interface PerformanceTiming {
|
||||
readonly connectEnd: number;
|
||||
readonly connectStart: number;
|
||||
@@ -11772,6 +11843,8 @@ interface PointerEvent extends MouseEvent {
|
||||
readonly tiltY: number;
|
||||
readonly twist: number;
|
||||
readonly width: number;
|
||||
getCoalescedEvents(): PointerEvent[];
|
||||
getPredictedEvents(): PointerEvent[];
|
||||
}
|
||||
|
||||
declare var PointerEvent: {
|
||||
@@ -12475,64 +12548,26 @@ declare var Range: {
|
||||
toString(): string;
|
||||
};
|
||||
|
||||
interface ReadableByteStreamController {
|
||||
readonly byobRequest: ReadableStreamBYOBRequest | undefined;
|
||||
readonly desiredSize: number | null;
|
||||
close(): void;
|
||||
enqueue(chunk: ArrayBufferView): void;
|
||||
error(error?: any): void;
|
||||
}
|
||||
|
||||
declare var ReadableByteStreamController: {
|
||||
prototype: ReadableByteStreamController;
|
||||
new(): ReadableByteStreamController;
|
||||
};
|
||||
|
||||
/** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */
|
||||
interface ReadableStream<R = any> {
|
||||
readonly locked: boolean;
|
||||
cancel(reason?: any): Promise<void>;
|
||||
getReader(options: { mode: "byob" }): ReadableStreamBYOBReader;
|
||||
getReader(): ReadableStreamDefaultReader<R>;
|
||||
pipeThrough<T>({ writable, readable }: { writable: WritableStream<R>, readable: ReadableStream<T> }, options?: PipeOptions): ReadableStream<T>;
|
||||
pipeTo(dest: WritableStream<R>, options?: PipeOptions): Promise<void>;
|
||||
pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
|
||||
pipeTo(dest: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;
|
||||
tee(): [ReadableStream<R>, ReadableStream<R>];
|
||||
}
|
||||
|
||||
declare var ReadableStream: {
|
||||
prototype: ReadableStream;
|
||||
new(underlyingSource: UnderlyingByteSource, strategy?: { highWaterMark?: number, size?: undefined }): ReadableStream<Uint8Array>;
|
||||
new<R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
|
||||
};
|
||||
|
||||
interface ReadableStreamBYOBReader {
|
||||
readonly closed: Promise<void>;
|
||||
cancel(reason?: any): Promise<void>;
|
||||
read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;
|
||||
releaseLock(): void;
|
||||
}
|
||||
|
||||
declare var ReadableStreamBYOBReader: {
|
||||
prototype: ReadableStreamBYOBReader;
|
||||
new(): ReadableStreamBYOBReader;
|
||||
};
|
||||
|
||||
interface ReadableStreamBYOBRequest {
|
||||
readonly view: ArrayBufferView;
|
||||
respond(bytesWritten: number): void;
|
||||
respondWithNewView(view: ArrayBufferView): void;
|
||||
}
|
||||
|
||||
declare var ReadableStreamBYOBRequest: {
|
||||
prototype: ReadableStreamBYOBRequest;
|
||||
new(): ReadableStreamBYOBRequest;
|
||||
};
|
||||
|
||||
interface ReadableStreamDefaultController<R = any> {
|
||||
readonly desiredSize: number | null;
|
||||
close(): void;
|
||||
enqueue(chunk: R): void;
|
||||
error(error?: any): void;
|
||||
error(e?: any): void;
|
||||
}
|
||||
|
||||
declare var ReadableStreamDefaultController: {
|
||||
@@ -12540,29 +12575,21 @@ declare var ReadableStreamDefaultController: {
|
||||
new(): ReadableStreamDefaultController;
|
||||
};
|
||||
|
||||
interface ReadableStreamDefaultReader<R = any> {
|
||||
readonly closed: Promise<void>;
|
||||
cancel(reason?: any): Promise<void>;
|
||||
read(): Promise<ReadableStreamReadResult<R>>;
|
||||
interface ReadableStreamDefaultReader<R = any> extends ReadableStreamGenericReader {
|
||||
read(): Promise<ReadableStreamDefaultReadResult<R>>;
|
||||
releaseLock(): void;
|
||||
}
|
||||
|
||||
declare var ReadableStreamDefaultReader: {
|
||||
prototype: ReadableStreamDefaultReader;
|
||||
new(): ReadableStreamDefaultReader;
|
||||
new<R = any>(stream: ReadableStream<R>): ReadableStreamDefaultReader<R>;
|
||||
};
|
||||
|
||||
interface ReadableStreamReader<R = any> {
|
||||
cancel(): Promise<void>;
|
||||
read(): Promise<ReadableStreamReadResult<R>>;
|
||||
releaseLock(): void;
|
||||
interface ReadableStreamGenericReader {
|
||||
readonly closed: Promise<undefined>;
|
||||
cancel(reason?: any): Promise<void>;
|
||||
}
|
||||
|
||||
declare var ReadableStreamReader: {
|
||||
prototype: ReadableStreamReader;
|
||||
new(): ReadableStreamReader;
|
||||
};
|
||||
|
||||
/** This Fetch API interface represents a resource request. */
|
||||
interface Request extends Body {
|
||||
/**
|
||||
@@ -12633,6 +12660,39 @@ declare var Request: {
|
||||
new(input: RequestInfo, init?: RequestInit): Request;
|
||||
};
|
||||
|
||||
interface ResizeObserver {
|
||||
disconnect(): void;
|
||||
observe(target: Element, options?: ResizeObserverOptions): void;
|
||||
unobserve(target: Element): void;
|
||||
}
|
||||
|
||||
declare var ResizeObserver: {
|
||||
prototype: ResizeObserver;
|
||||
new(callback: ResizeObserverCallback): ResizeObserver;
|
||||
};
|
||||
|
||||
interface ResizeObserverEntry {
|
||||
readonly borderBoxSize: ReadonlyArray<ResizeObserverSize>;
|
||||
readonly contentBoxSize: ReadonlyArray<ResizeObserverSize>;
|
||||
readonly contentRect: DOMRectReadOnly;
|
||||
readonly target: Element;
|
||||
}
|
||||
|
||||
declare var ResizeObserverEntry: {
|
||||
prototype: ResizeObserverEntry;
|
||||
new(): ResizeObserverEntry;
|
||||
};
|
||||
|
||||
interface ResizeObserverSize {
|
||||
readonly blockSize: number;
|
||||
readonly inlineSize: number;
|
||||
}
|
||||
|
||||
declare var ResizeObserverSize: {
|
||||
prototype: ResizeObserverSize;
|
||||
new(): ResizeObserverSize;
|
||||
};
|
||||
|
||||
/** This Fetch API interface represents the response to a request. */
|
||||
interface Response extends Body {
|
||||
readonly headers: Headers;
|
||||
@@ -12992,7 +13052,9 @@ interface SVGElement extends Element, DocumentAndElementEventHandlers, DocumentA
|
||||
/** @deprecated */
|
||||
readonly className: any;
|
||||
readonly ownerSVGElement: SVGSVGElement | null;
|
||||
readonly parentElement: SVGElement | null;
|
||||
readonly viewportElement: SVGElement | null;
|
||||
getElementsByClassName<E extends Element = SVGElement>(classNames: string): HTMLCollectionOf<E>;
|
||||
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
||||
removeEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
||||
@@ -13580,6 +13642,7 @@ interface SVGForeignObjectElement extends SVGGraphicsElement {
|
||||
readonly width: SVGAnimatedLength;
|
||||
readonly x: SVGAnimatedLength;
|
||||
readonly y: SVGAnimatedLength;
|
||||
getElementsByClassName<E extends Element = HTMLElement>(classNames: string): HTMLCollectionOf<E>;
|
||||
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGForeignObjectElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
||||
removeEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGForeignObjectElement, ev: SVGElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
||||
@@ -14383,7 +14446,7 @@ interface SVGSVGElement extends SVGGraphicsElement, DocumentEvent, SVGFitToViewB
|
||||
forceRedraw(): void;
|
||||
getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleDeclaration;
|
||||
getCurrentTime(): number;
|
||||
getElementById(elementId: string): Element;
|
||||
getElementById<E extends Element = HTMLElement>(elementId: string): E | null;
|
||||
getEnclosureList(rect: SVGRect, referenceElement: SVGElement | null): NodeListOf<SVGCircleElement | SVGEllipseElement | SVGImageElement | SVGLineElement | SVGPathElement | SVGPolygonElement | SVGPolylineElement | SVGRectElement | SVGTextElement | SVGUseElement>;
|
||||
getIntersectionList(rect: SVGRect, referenceElement: SVGElement | null): NodeListOf<SVGCircleElement | SVGEllipseElement | SVGImageElement | SVGLineElement | SVGPathElement | SVGPolygonElement | SVGPolylineElement | SVGRectElement | SVGTextElement | SVGUseElement>;
|
||||
pauseAnimations(): void;
|
||||
@@ -14457,7 +14520,7 @@ declare var SVGStringList: {
|
||||
};
|
||||
|
||||
/** Corresponds to the SVG <style> element. */
|
||||
interface SVGStyleElement extends SVGElement {
|
||||
interface SVGStyleElement extends SVGElement, LinkStyle {
|
||||
disabled: boolean;
|
||||
media: string;
|
||||
title: string;
|
||||
@@ -14811,7 +14874,9 @@ interface ScriptProcessorNodeEventMap {
|
||||
"audioprocess": AudioProcessingEvent;
|
||||
}
|
||||
|
||||
/** Allows the generation, processing, or analyzing of audio using JavaScript. */
|
||||
/** Allows the generation, processing, or analyzing of audio using JavaScript.
|
||||
* @deprecated As of the August 29 2014 Web Audio API spec publication, this feature has been marked as deprecated, and was replaced by AudioWorklet (see AudioWorkletNode).
|
||||
*/
|
||||
interface ScriptProcessorNode extends AudioNode {
|
||||
/** @deprecated */
|
||||
readonly bufferSize: number;
|
||||
@@ -14922,7 +14987,7 @@ interface ServiceWorkerContainer extends EventTarget {
|
||||
readonly ready: Promise<ServiceWorkerRegistration>;
|
||||
getRegistration(clientURL?: string): Promise<ServiceWorkerRegistration | undefined>;
|
||||
getRegistrations(): Promise<ReadonlyArray<ServiceWorkerRegistration>>;
|
||||
register(scriptURL: string, options?: RegistrationOptions): Promise<ServiceWorkerRegistration>;
|
||||
register(scriptURL: string | URL, options?: RegistrationOptions): Promise<ServiceWorkerRegistration>;
|
||||
startMessages(): void;
|
||||
addEventListener<K extends keyof ServiceWorkerContainerEventMap>(type: K, listener: (this: ServiceWorkerContainer, ev: ServiceWorkerContainerEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
||||
@@ -14935,7 +15000,9 @@ declare var ServiceWorkerContainer: {
|
||||
new(): ServiceWorkerContainer;
|
||||
};
|
||||
|
||||
/** This ServiceWorker API interface contains information about an event sent to a ServiceWorkerContainer target. This extends the default message event to allow setting a ServiceWorker object as the source of a message. The event object is accessed via the handler function of a message event, when fired by a message received from a service worker. */
|
||||
/** This ServiceWorker API interface contains information about an event sent to a ServiceWorkerContainer target. This extends the default message event to allow setting a ServiceWorker object as the source of a message. The event object is accessed via the handler function of a message event, when fired by a message received from a service worker.
|
||||
* @deprecated In modern browsers, this interface has been deprecated. Service worker messages will now use the MessageEvent interface, for consistency with other web messaging features.
|
||||
*/
|
||||
interface ServiceWorkerMessageEvent extends Event {
|
||||
readonly data: any;
|
||||
readonly lastEventId: string;
|
||||
@@ -15096,7 +15163,7 @@ interface SpeechRecognitionEventMap {
|
||||
"audioend": Event;
|
||||
"audiostart": Event;
|
||||
"end": Event;
|
||||
"error": ErrorEvent;
|
||||
"error": SpeechRecognitionErrorEvent;
|
||||
"nomatch": SpeechRecognitionEvent;
|
||||
"result": SpeechRecognitionEvent;
|
||||
"soundend": Event;
|
||||
@@ -15115,7 +15182,7 @@ interface SpeechRecognition extends EventTarget {
|
||||
onaudioend: ((this: SpeechRecognition, ev: Event) => any) | null;
|
||||
onaudiostart: ((this: SpeechRecognition, ev: Event) => any) | null;
|
||||
onend: ((this: SpeechRecognition, ev: Event) => any) | null;
|
||||
onerror: ((this: SpeechRecognition, ev: ErrorEvent) => any) | null;
|
||||
onerror: ((this: SpeechRecognition, ev: SpeechRecognitionErrorEvent) => any) | null;
|
||||
onnomatch: ((this: SpeechRecognition, ev: SpeechRecognitionEvent) => any) | null;
|
||||
onresult: ((this: SpeechRecognition, ev: SpeechRecognitionEvent) => any) | null;
|
||||
onsoundend: ((this: SpeechRecognition, ev: Event) => any) | null;
|
||||
@@ -15147,6 +15214,16 @@ declare var SpeechRecognitionAlternative: {
|
||||
new(): SpeechRecognitionAlternative;
|
||||
};
|
||||
|
||||
interface SpeechRecognitionErrorEvent extends Event {
|
||||
readonly error: SpeechRecognitionErrorCode;
|
||||
readonly message: string;
|
||||
}
|
||||
|
||||
declare var SpeechRecognitionErrorEvent: {
|
||||
prototype: SpeechRecognitionErrorEvent;
|
||||
new(type: string, eventInitDict: SpeechRecognitionErrorEventInit): SpeechRecognitionErrorEvent;
|
||||
};
|
||||
|
||||
interface SpeechRecognitionEvent extends Event {
|
||||
readonly resultIndex: number;
|
||||
readonly results: SpeechRecognitionResultList;
|
||||
@@ -15154,7 +15231,7 @@ interface SpeechRecognitionEvent extends Event {
|
||||
|
||||
declare var SpeechRecognitionEvent: {
|
||||
prototype: SpeechRecognitionEvent;
|
||||
new(): SpeechRecognitionEvent;
|
||||
new(type: string, eventInitDict: SpeechRecognitionEventInit): SpeechRecognitionEvent;
|
||||
};
|
||||
|
||||
interface SpeechRecognitionResult {
|
||||
@@ -15470,14 +15547,14 @@ declare var Text: {
|
||||
/** A decoder for a specific method, that is a specific character encoding, like utf-8, iso-8859-2, koi8, cp1261, gbk, etc. A decoder takes a stream of bytes as input and emits a stream of code points. For a more scalable, non-native library, see StringView – a C-like representation of strings based on typed arrays. */
|
||||
interface TextDecoder extends TextDecoderCommon {
|
||||
/**
|
||||
* Returns the result of running encoding's decoder. The method can be invoked zero or more times with options's stream set to true, and then once without options's stream (or set to false), to process a fragmented stream. If the invocation without options's stream (or set to false) has no input, it's clearest to omit both arguments.
|
||||
* Returns the result of running encoding's decoder. The method can be invoked zero or more times with options's stream set to true, and then once without options's stream (or set to false), to process a fragmented input. If the invocation without options's stream (or set to false) has no input, it's clearest to omit both arguments.
|
||||
*
|
||||
* ```
|
||||
* var string = "", decoder = new TextDecoder(encoding), buffer;
|
||||
* while(buffer = next_chunk()) {
|
||||
* string += decoder.decode(buffer, {stream:true});
|
||||
* }
|
||||
* string += decoder.decode(); // end-of-stream
|
||||
* string += decoder.decode(); // end-of-queue
|
||||
* ```
|
||||
*
|
||||
* If the error mode is "fatal" and encoding's decoder returns error, throws a TypeError.
|
||||
@@ -15496,11 +15573,11 @@ interface TextDecoderCommon {
|
||||
*/
|
||||
readonly encoding: string;
|
||||
/**
|
||||
* Returns true if error mode is "fatal", and false otherwise.
|
||||
* Returns true if error mode is "fatal", otherwise false.
|
||||
*/
|
||||
readonly fatal: boolean;
|
||||
/**
|
||||
* Returns true if ignore BOM flag is set, and false otherwise.
|
||||
* Returns the value of ignore BOM.
|
||||
*/
|
||||
readonly ignoreBOM: boolean;
|
||||
}
|
||||
@@ -15522,7 +15599,7 @@ interface TextEncoder extends TextEncoderCommon {
|
||||
*/
|
||||
encode(input?: string): Uint8Array;
|
||||
/**
|
||||
* Runs the UTF-8 encoder on source, stores the result of that operation into destination, and returns the progress made as a dictionary whereby read is the number of converted code units of source and written is the number of bytes modified in destination.
|
||||
* Runs the UTF-8 encoder on source, stores the result of that operation into destination, and returns the progress made as an object wherein read is the number of converted code units of source and written is the number of bytes modified in destination.
|
||||
*/
|
||||
encodeInto(source: string, destination: Uint8Array): TextEncoderEncodeIntoResult;
|
||||
}
|
||||
@@ -18377,6 +18454,8 @@ interface WindowEventMap extends GlobalEventHandlersEventMap, WindowEventHandler
|
||||
"ended": Event;
|
||||
"error": ErrorEvent;
|
||||
"focus": FocusEvent;
|
||||
"gamepadconnected": GamepadEvent;
|
||||
"gamepaddisconnected": GamepadEvent;
|
||||
"hashchange": HashChangeEvent;
|
||||
"input": Event;
|
||||
"invalid": Event;
|
||||
@@ -18462,7 +18541,7 @@ interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandler
|
||||
readonly event: Event | undefined;
|
||||
/** @deprecated */
|
||||
readonly external: External;
|
||||
readonly frameElement: Element;
|
||||
readonly frameElement: Element | null;
|
||||
readonly frames: Window;
|
||||
readonly history: History;
|
||||
readonly innerHeight: number;
|
||||
@@ -18480,6 +18559,8 @@ interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandler
|
||||
ondevicemotion: ((this: Window, ev: DeviceMotionEvent) => any) | null;
|
||||
ondeviceorientation: ((this: Window, ev: DeviceOrientationEvent) => any) | null;
|
||||
ondeviceorientationabsolute: ((this: Window, ev: DeviceOrientationEvent) => any) | null;
|
||||
ongamepadconnected: ((this: Window, ev: GamepadEvent) => any) | null;
|
||||
ongamepaddisconnected: ((this: Window, ev: GamepadEvent) => any) | null;
|
||||
onmousewheel: ((this: Window, ev: Event) => any) | null;
|
||||
onmsgesturechange: ((this: Window, ev: Event) => any) | null;
|
||||
onmsgesturedoubletap: ((this: Window, ev: Event) => any) | null;
|
||||
@@ -18701,7 +18782,7 @@ declare var WritableStream: {
|
||||
|
||||
/** This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. */
|
||||
interface WritableStreamDefaultController {
|
||||
error(error?: any): void;
|
||||
error(e?: any): void;
|
||||
}
|
||||
|
||||
declare var WritableStreamDefaultController: {
|
||||
@@ -18711,9 +18792,9 @@ declare var WritableStreamDefaultController: {
|
||||
|
||||
/** This Streams API interface is the object returned by WritableStream.getWriter() and once created locks the < writer to the WritableStream ensuring that no other streams can write to the underlying sink. */
|
||||
interface WritableStreamDefaultWriter<W = any> {
|
||||
readonly closed: Promise<void>;
|
||||
readonly closed: Promise<undefined>;
|
||||
readonly desiredSize: number | null;
|
||||
readonly ready: Promise<void>;
|
||||
readonly ready: Promise<undefined>;
|
||||
abort(reason?: any): Promise<void>;
|
||||
close(): Promise<void>;
|
||||
releaseLock(): void;
|
||||
@@ -18722,7 +18803,7 @@ interface WritableStreamDefaultWriter<W = any> {
|
||||
|
||||
declare var WritableStreamDefaultWriter: {
|
||||
prototype: WritableStreamDefaultWriter;
|
||||
new(): WritableStreamDefaultWriter;
|
||||
new<W = any>(stream: WritableStream<W>): WritableStreamDefaultWriter<W>;
|
||||
};
|
||||
|
||||
/** An XML document. It inherits from the generic Document and does not add any specific methods or properties to it: nevertheless, several algorithms behave differently with the two types of documents. */
|
||||
@@ -19234,7 +19315,7 @@ interface PositionErrorCallback {
|
||||
(positionError: GeolocationPositionError): void;
|
||||
}
|
||||
|
||||
interface QueuingStrategySizeCallback<T = any> {
|
||||
interface QueuingStrategySize<T = any> {
|
||||
(chunk: T): number;
|
||||
}
|
||||
|
||||
@@ -19250,46 +19331,54 @@ interface RTCStatsCallback {
|
||||
(report: RTCStatsReport): void;
|
||||
}
|
||||
|
||||
interface ReadableByteStreamControllerCallback {
|
||||
(controller: ReadableByteStreamController): void | PromiseLike<void>;
|
||||
interface ResizeObserverCallback {
|
||||
(entries: ResizeObserverEntry[], observer: ResizeObserver): void;
|
||||
}
|
||||
|
||||
interface ReadableStreamDefaultControllerCallback<R> {
|
||||
(controller: ReadableStreamDefaultController<R>): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface ReadableStreamErrorCallback {
|
||||
(reason: any): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface TransformStreamDefaultControllerCallback<O> {
|
||||
interface TransformerFlushCallback<O> {
|
||||
(controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface TransformStreamDefaultControllerTransformCallback<I, O> {
|
||||
interface TransformerStartCallback<O> {
|
||||
(controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface TransformerTransformCallback<I, O> {
|
||||
(chunk: I, controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface UnderlyingSinkAbortCallback {
|
||||
(reason: any): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface UnderlyingSinkCloseCallback {
|
||||
(): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface UnderlyingSinkStartCallback {
|
||||
(controller: WritableStreamDefaultController): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface UnderlyingSinkWriteCallback<W> {
|
||||
(chunk: W, controller: WritableStreamDefaultController): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface UnderlyingSourceCancelCallback {
|
||||
(reason: any): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface UnderlyingSourcePullCallback<R> {
|
||||
(controller: ReadableStreamController<R>): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface UnderlyingSourceStartCallback<R> {
|
||||
(controller: ReadableStreamController<R>): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface VoidFunction {
|
||||
(): void;
|
||||
}
|
||||
|
||||
interface WritableStreamDefaultControllerCloseCallback {
|
||||
(): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface WritableStreamDefaultControllerStartCallback {
|
||||
(controller: WritableStreamDefaultController): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface WritableStreamDefaultControllerWriteCallback<W> {
|
||||
(chunk: W, controller: WritableStreamDefaultController): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface WritableStreamErrorCallback {
|
||||
(reason: any): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface HTMLElementTagNameMap {
|
||||
"a": HTMLAnchorElement;
|
||||
"abbr": HTMLElement;
|
||||
@@ -19501,7 +19590,7 @@ declare var document: Document;
|
||||
declare var event: Event | undefined;
|
||||
/** @deprecated */
|
||||
declare var external: External;
|
||||
declare var frameElement: Element;
|
||||
declare var frameElement: Element | null;
|
||||
declare var frames: Window;
|
||||
declare var history: History;
|
||||
declare var innerHeight: number;
|
||||
@@ -19520,6 +19609,8 @@ declare var ondevicelight: ((this: Window, ev: DeviceLightEvent) => any) | null;
|
||||
declare var ondevicemotion: ((this: Window, ev: DeviceMotionEvent) => any) | null;
|
||||
declare var ondeviceorientation: ((this: Window, ev: DeviceOrientationEvent) => any) | null;
|
||||
declare var ondeviceorientationabsolute: ((this: Window, ev: DeviceOrientationEvent) => any) | null;
|
||||
declare var ongamepadconnected: ((this: Window, ev: GamepadEvent) => any) | null;
|
||||
declare var ongamepaddisconnected: ((this: Window, ev: GamepadEvent) => any) | null;
|
||||
declare var onmousewheel: ((this: Window, ev: Event) => any) | null;
|
||||
declare var onmsgesturechange: ((this: Window, ev: Event) => any) | null;
|
||||
declare var onmsgesturedoubletap: ((this: Window, ev: Event) => any) | null;
|
||||
@@ -19939,7 +20030,8 @@ type ConstrainDouble = number | ConstrainDoubleRange;
|
||||
type ConstrainBoolean = boolean | ConstrainBooleanParameters;
|
||||
type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters;
|
||||
type PerformanceEntryList = PerformanceEntry[];
|
||||
type ReadableStreamReadResult<T> = ReadableStreamReadValueResult<T> | ReadableStreamReadDoneResult<T>;
|
||||
type ReadableStreamReader<T> = ReadableStreamDefaultReader<T>;
|
||||
type ReadableStreamController<T> = ReadableStreamDefaultController<T>;
|
||||
type VibratePattern = number | number[];
|
||||
type COSEAlgorithmIdentifier = number;
|
||||
type UvmEntry = number[];
|
||||
@@ -19978,6 +20070,7 @@ type RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport;
|
||||
/** @deprecated */
|
||||
type MouseWheelEvent = WheelEvent;
|
||||
type WindowProxy = Window;
|
||||
type ReadableStreamDefaultReadResult<T> = ReadableStreamDefaultReadValueResult<T> | ReadableStreamDefaultReadDoneResult;
|
||||
type AlignSetting = "center" | "end" | "left" | "right" | "start";
|
||||
type AnimationPlayState = "finished" | "idle" | "paused" | "running";
|
||||
type AppendMode = "segments" | "sequence";
|
||||
@@ -20049,7 +20142,7 @@ type OverSampleType = "2x" | "4x" | "none";
|
||||
type PanningModelType = "HRTF" | "equalpower";
|
||||
type PaymentComplete = "fail" | "success" | "unknown";
|
||||
type PaymentShippingType = "delivery" | "pickup" | "shipping";
|
||||
type PermissionName = "accelerometer" | "ambient-light-sensor" | "background-sync" | "bluetooth" | "camera" | "clipboard" | "device-info" | "geolocation" | "gyroscope" | "magnetometer" | "microphone" | "midi" | "notifications" | "persistent-storage" | "push" | "speaker";
|
||||
type PermissionName = "accelerometer" | "ambient-light-sensor" | "background-fetch" | "background-sync" | "bluetooth" | "camera" | "clipboard-read" | "clipboard-write" | "device-info" | "display-capture" | "geolocation" | "gyroscope" | "magnetometer" | "microphone" | "midi" | "nfc" | "notifications" | "persistent-storage" | "push" | "speaker";
|
||||
type PermissionState = "denied" | "granted" | "prompt";
|
||||
type PlaybackDirection = "alternate" | "alternate-reverse" | "normal" | "reverse";
|
||||
type PositionAlignSetting = "auto" | "center" | "line-left" | "line-right";
|
||||
@@ -20083,9 +20176,9 @@ type RTCRtpTransceiverDirection = "inactive" | "recvonly" | "sendonly" | "sendre
|
||||
type RTCSctpTransportState = "closed" | "connected" | "connecting";
|
||||
type RTCSdpType = "answer" | "offer" | "pranswer" | "rollback";
|
||||
type RTCSignalingState = "closed" | "have-local-offer" | "have-local-pranswer" | "have-remote-offer" | "have-remote-pranswer" | "stable";
|
||||
type RTCStatsIceCandidatePairState = "cancelled" | "failed" | "frozen" | "inprogress" | "succeeded" | "waiting";
|
||||
type RTCStatsIceCandidatePairState = "failed" | "frozen" | "in-progress" | "succeeded" | "waiting";
|
||||
type RTCStatsIceCandidateType = "host" | "peerreflexive" | "relayed" | "serverreflexive";
|
||||
type RTCStatsType = "candidatepair" | "datachannel" | "inboundrtp" | "localcandidate" | "outboundrtp" | "remotecandidate" | "session" | "track" | "transport";
|
||||
type RTCStatsType = "candidate-pair" | "certificate" | "codec" | "csrc" | "data-channel" | "ice-server" | "inbound-rtp" | "local-candidate" | "media-source" | "outbound-rtp" | "peer-connection" | "receiver" | "remote-candidate" | "remote-inbound-rtp" | "remote-outbound-rtp" | "sctp-transport" | "sender" | "stream" | "track" | "transceiver" | "transport";
|
||||
type ReadyState = "closed" | "ended" | "open";
|
||||
type ReferrerPolicy = "" | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url";
|
||||
type RequestCache = "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload";
|
||||
@@ -20094,6 +20187,7 @@ type RequestDestination = "" | "audio" | "audioworklet" | "document" | "embed" |
|
||||
type RequestMode = "cors" | "navigate" | "no-cors" | "same-origin";
|
||||
type RequestRedirect = "error" | "follow" | "manual";
|
||||
type ResidentKeyRequirement = "discouraged" | "preferred" | "required";
|
||||
type ResizeObserverBoxOptions = "border-box" | "content-box" | "device-pixel-content-box";
|
||||
type ResizeQuality = "high" | "low" | "medium" | "pixelated";
|
||||
type ResponseType = "basic" | "cors" | "default" | "error" | "opaque" | "opaqueredirect";
|
||||
type ScopedCredentialType = "ScopedCred";
|
||||
@@ -20105,6 +20199,7 @@ type SelectionMode = "end" | "preserve" | "select" | "start";
|
||||
type ServiceWorkerState = "activated" | "activating" | "installed" | "installing" | "parsed" | "redundant";
|
||||
type ServiceWorkerUpdateViaCache = "all" | "imports" | "none";
|
||||
type ShadowRootMode = "closed" | "open";
|
||||
type SpeechRecognitionErrorCode = "aborted" | "audio-capture" | "bad-grammar" | "language-not-supported" | "network" | "no-speech" | "not-allowed" | "service-not-allowed";
|
||||
type SpeechSynthesisErrorCode = "audio-busy" | "audio-hardware" | "canceled" | "interrupted" | "invalid-argument" | "language-unavailable" | "network" | "not-allowed" | "synthesis-failed" | "synthesis-unavailable" | "text-too-long" | "voice-unavailable";
|
||||
type TextTrackKind = "captions" | "chapters" | "descriptions" | "metadata" | "subtitles";
|
||||
type TextTrackMode = "disabled" | "hidden" | "showing";
|
||||
|
||||
Vendored
+13
-13
@@ -1,17 +1,17 @@
|
||||
interface ProxyHandler<T extends object> {
|
||||
getPrototypeOf? (target: T): object | null;
|
||||
setPrototypeOf? (target: T, v: any): boolean;
|
||||
isExtensible? (target: T): boolean;
|
||||
preventExtensions? (target: T): boolean;
|
||||
getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor | undefined;
|
||||
has? (target: T, p: PropertyKey): boolean;
|
||||
get? (target: T, p: PropertyKey, receiver: any): any;
|
||||
set? (target: T, p: PropertyKey, value: any, receiver: any): boolean;
|
||||
deleteProperty? (target: T, p: PropertyKey): boolean;
|
||||
defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean;
|
||||
ownKeys? (target: T): PropertyKey[];
|
||||
apply? (target: T, thisArg: any, argArray?: any): any;
|
||||
construct? (target: T, argArray: any, newTarget?: any): object;
|
||||
apply?(target: T, thisArg: any, argArray: any[]): any;
|
||||
construct?(target: T, argArray: any[], newTarget: Function): object;
|
||||
defineProperty?(target: T, p: string | symbol, attributes: PropertyDescriptor): boolean;
|
||||
deleteProperty?(target: T, p: string | symbol): boolean;
|
||||
get?(target: T, p: string | symbol, receiver: any): any;
|
||||
getOwnPropertyDescriptor?(target: T, p: string | symbol): PropertyDescriptor | undefined;
|
||||
getPrototypeOf?(target: T): object | null;
|
||||
has?(target: T, p: string | symbol): boolean;
|
||||
isExtensible?(target: T): boolean;
|
||||
ownKeys?(target: T): ArrayLike<string | symbol>;
|
||||
preventExtensions?(target: T): boolean;
|
||||
set?(target: T, p: string | symbol, value: any, receiver: any): boolean;
|
||||
setPrototypeOf?(target: T, v: object | null): boolean;
|
||||
}
|
||||
|
||||
interface ProxyConstructor {
|
||||
|
||||
Vendored
+126
-151
@@ -243,6 +243,10 @@ interface ImageEncodeOptions {
|
||||
type?: string;
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
url?: string;
|
||||
}
|
||||
|
||||
interface JsonWebKey {
|
||||
alg?: string;
|
||||
crv?: string;
|
||||
@@ -334,13 +338,6 @@ interface PermissionDescriptor {
|
||||
name: PermissionName;
|
||||
}
|
||||
|
||||
interface PipeOptions {
|
||||
preventAbort?: boolean;
|
||||
preventCancel?: boolean;
|
||||
preventClose?: boolean;
|
||||
signal?: AbortSignal;
|
||||
}
|
||||
|
||||
interface PostMessageOptions {
|
||||
transfer?: any[];
|
||||
}
|
||||
@@ -383,19 +380,38 @@ interface PushSubscriptionOptionsInit {
|
||||
|
||||
interface QueuingStrategy<T = any> {
|
||||
highWaterMark?: number;
|
||||
size?: QueuingStrategySizeCallback<T>;
|
||||
size?: QueuingStrategySize<T>;
|
||||
}
|
||||
|
||||
interface ReadableStreamReadDoneResult<T> {
|
||||
interface QueuingStrategyInit {
|
||||
/**
|
||||
* Creates a new ByteLengthQueuingStrategy with the provided high water mark.
|
||||
*
|
||||
* Note that the provided high water mark will not be validated ahead of time. Instead, if it is negative, NaN, or not a number, the resulting ByteLengthQueuingStrategy will cause the corresponding stream constructor to throw.
|
||||
*/
|
||||
highWaterMark: number;
|
||||
}
|
||||
|
||||
interface ReadableStreamDefaultReadDoneResult {
|
||||
done: true;
|
||||
value?: T;
|
||||
value?: undefined;
|
||||
}
|
||||
|
||||
interface ReadableStreamReadValueResult<T> {
|
||||
interface ReadableStreamDefaultReadValueResult<T> {
|
||||
done: false;
|
||||
value: T;
|
||||
}
|
||||
|
||||
interface ReadableWritablePair<R = any, W = any> {
|
||||
readable: ReadableStream<R>;
|
||||
/**
|
||||
* Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use.
|
||||
*
|
||||
* Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
|
||||
*/
|
||||
writable: WritableStream<W>;
|
||||
}
|
||||
|
||||
interface RegistrationOptions {
|
||||
scope?: string;
|
||||
type?: WorkerType;
|
||||
@@ -495,6 +511,30 @@ interface StorageEstimate {
|
||||
usage?: number;
|
||||
}
|
||||
|
||||
interface StreamPipeOptions {
|
||||
preventAbort?: boolean;
|
||||
preventCancel?: boolean;
|
||||
/**
|
||||
* Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.
|
||||
*
|
||||
* Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
|
||||
*
|
||||
* Errors and closures of the source and destination streams propagate as follows:
|
||||
*
|
||||
* An error in this source readable stream will abort destination, unless preventAbort is truthy. The returned promise will be rejected with the source's error, or with any error that occurs during aborting the destination.
|
||||
*
|
||||
* An error in destination will cancel this source readable stream, unless preventCancel is truthy. The returned promise will be rejected with the destination's error, or with any error that occurs during canceling the source.
|
||||
*
|
||||
* When this source readable stream closes, destination will be closed, unless preventClose is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error.
|
||||
*
|
||||
* If destination starts out closed or closing, this source readable stream will be canceled, unless preventCancel is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source.
|
||||
*
|
||||
* The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set.
|
||||
*/
|
||||
preventClose?: boolean;
|
||||
signal?: AbortSignal;
|
||||
}
|
||||
|
||||
interface SyncEventInit extends ExtendableEventInit {
|
||||
lastChance?: boolean;
|
||||
tag: string;
|
||||
@@ -515,33 +555,25 @@ interface TextEncoderEncodeIntoResult {
|
||||
}
|
||||
|
||||
interface Transformer<I = any, O = any> {
|
||||
flush?: TransformStreamDefaultControllerCallback<O>;
|
||||
flush?: TransformerFlushCallback<O>;
|
||||
readableType?: undefined;
|
||||
start?: TransformStreamDefaultControllerCallback<O>;
|
||||
transform?: TransformStreamDefaultControllerTransformCallback<I, O>;
|
||||
start?: TransformerStartCallback<O>;
|
||||
transform?: TransformerTransformCallback<I, O>;
|
||||
writableType?: undefined;
|
||||
}
|
||||
|
||||
interface UnderlyingByteSource {
|
||||
autoAllocateChunkSize?: number;
|
||||
cancel?: ReadableStreamErrorCallback;
|
||||
pull?: ReadableByteStreamControllerCallback;
|
||||
start?: ReadableByteStreamControllerCallback;
|
||||
type: "bytes";
|
||||
}
|
||||
|
||||
interface UnderlyingSink<W = any> {
|
||||
abort?: WritableStreamErrorCallback;
|
||||
close?: WritableStreamDefaultControllerCloseCallback;
|
||||
start?: WritableStreamDefaultControllerStartCallback;
|
||||
abort?: UnderlyingSinkAbortCallback;
|
||||
close?: UnderlyingSinkCloseCallback;
|
||||
start?: UnderlyingSinkStartCallback;
|
||||
type?: undefined;
|
||||
write?: WritableStreamDefaultControllerWriteCallback<W>;
|
||||
write?: UnderlyingSinkWriteCallback<W>;
|
||||
}
|
||||
|
||||
interface UnderlyingSource<R = any> {
|
||||
cancel?: ReadableStreamErrorCallback;
|
||||
pull?: ReadableStreamDefaultControllerCallback<R>;
|
||||
start?: ReadableStreamDefaultControllerCallback<R>;
|
||||
cancel?: UnderlyingSourceCancelCallback;
|
||||
pull?: UnderlyingSourcePullCallback<R>;
|
||||
start?: UnderlyingSourceStartCallback<R>;
|
||||
type?: undefined;
|
||||
}
|
||||
|
||||
@@ -701,13 +733,13 @@ declare var BroadcastChannel: {
|
||||
|
||||
/** This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. */
|
||||
interface ByteLengthQueuingStrategy extends QueuingStrategy<ArrayBufferView> {
|
||||
highWaterMark: number;
|
||||
size(chunk: ArrayBufferView): number;
|
||||
readonly highWaterMark: number;
|
||||
readonly size: QueuingStrategySize<ArrayBufferView>;
|
||||
}
|
||||
|
||||
declare var ByteLengthQueuingStrategy: {
|
||||
prototype: ByteLengthQueuingStrategy;
|
||||
new(options: { highWaterMark: number }): ByteLengthQueuingStrategy;
|
||||
new(init: QueuingStrategyInit): ByteLengthQueuingStrategy;
|
||||
};
|
||||
|
||||
/** Provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the ServiceWorker life cycle. Note that the Cache interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec. */
|
||||
@@ -900,7 +932,7 @@ declare var Client: {
|
||||
interface Clients {
|
||||
claim(): Promise<void>;
|
||||
get(id: string): Promise<Client | undefined>;
|
||||
matchAll(options?: ClientQueryOptions): Promise<ReadonlyArray<Client>>;
|
||||
matchAll<T extends ClientQueryOptions>(options?: T): Promise<ReadonlyArray<T["type"] extends "window" ? WindowClient : Client>>;
|
||||
openWindow(url: string): Promise<WindowClient | null>;
|
||||
}
|
||||
|
||||
@@ -941,13 +973,13 @@ interface ConcatParams extends Algorithm {
|
||||
|
||||
/** This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. */
|
||||
interface CountQueuingStrategy extends QueuingStrategy {
|
||||
highWaterMark: number;
|
||||
size(chunk: any): 1;
|
||||
readonly highWaterMark: number;
|
||||
readonly size: QueuingStrategySize;
|
||||
}
|
||||
|
||||
declare var CountQueuingStrategy: {
|
||||
prototype: CountQueuingStrategy;
|
||||
new(options: { highWaterMark: number }): CountQueuingStrategy;
|
||||
new(init: QueuingStrategyInit): CountQueuingStrategy;
|
||||
};
|
||||
|
||||
/** Basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives. */
|
||||
@@ -1624,24 +1656,7 @@ declare var FormData: {
|
||||
};
|
||||
|
||||
interface GenericTransformStream {
|
||||
/**
|
||||
* Returns a readable stream whose chunks are strings resulting from running encoding's decoder on the chunks written to writable.
|
||||
*/
|
||||
readonly readable: ReadableStream;
|
||||
/**
|
||||
* Returns a writable stream which accepts [AllowShared] BufferSource chunks and runs them through encoding's decoder before making them available to readable.
|
||||
*
|
||||
* Typically this will be used via the pipeThrough() method on a ReadableStream source.
|
||||
*
|
||||
* ```
|
||||
* var decoder = new TextDecoderStream(encoding);
|
||||
* byteReadable
|
||||
* .pipeThrough(decoder)
|
||||
* .pipeTo(textWritable);
|
||||
* ```
|
||||
*
|
||||
* If the error mode is "fatal" and encoding's decoder returns error, both readable and writable will be errored with a TypeError.
|
||||
*/
|
||||
readonly writable: WritableStream;
|
||||
}
|
||||
|
||||
@@ -2707,64 +2722,26 @@ declare var PushSubscriptionOptions: {
|
||||
new(): PushSubscriptionOptions;
|
||||
};
|
||||
|
||||
interface ReadableByteStreamController {
|
||||
readonly byobRequest: ReadableStreamBYOBRequest | undefined;
|
||||
readonly desiredSize: number | null;
|
||||
close(): void;
|
||||
enqueue(chunk: ArrayBufferView): void;
|
||||
error(error?: any): void;
|
||||
}
|
||||
|
||||
declare var ReadableByteStreamController: {
|
||||
prototype: ReadableByteStreamController;
|
||||
new(): ReadableByteStreamController;
|
||||
};
|
||||
|
||||
/** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */
|
||||
interface ReadableStream<R = any> {
|
||||
readonly locked: boolean;
|
||||
cancel(reason?: any): Promise<void>;
|
||||
getReader(options: { mode: "byob" }): ReadableStreamBYOBReader;
|
||||
getReader(): ReadableStreamDefaultReader<R>;
|
||||
pipeThrough<T>({ writable, readable }: { writable: WritableStream<R>, readable: ReadableStream<T> }, options?: PipeOptions): ReadableStream<T>;
|
||||
pipeTo(dest: WritableStream<R>, options?: PipeOptions): Promise<void>;
|
||||
pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
|
||||
pipeTo(dest: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;
|
||||
tee(): [ReadableStream<R>, ReadableStream<R>];
|
||||
}
|
||||
|
||||
declare var ReadableStream: {
|
||||
prototype: ReadableStream;
|
||||
new(underlyingSource: UnderlyingByteSource, strategy?: { highWaterMark?: number, size?: undefined }): ReadableStream<Uint8Array>;
|
||||
new<R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
|
||||
};
|
||||
|
||||
interface ReadableStreamBYOBReader {
|
||||
readonly closed: Promise<void>;
|
||||
cancel(reason?: any): Promise<void>;
|
||||
read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;
|
||||
releaseLock(): void;
|
||||
}
|
||||
|
||||
declare var ReadableStreamBYOBReader: {
|
||||
prototype: ReadableStreamBYOBReader;
|
||||
new(): ReadableStreamBYOBReader;
|
||||
};
|
||||
|
||||
interface ReadableStreamBYOBRequest {
|
||||
readonly view: ArrayBufferView;
|
||||
respond(bytesWritten: number): void;
|
||||
respondWithNewView(view: ArrayBufferView): void;
|
||||
}
|
||||
|
||||
declare var ReadableStreamBYOBRequest: {
|
||||
prototype: ReadableStreamBYOBRequest;
|
||||
new(): ReadableStreamBYOBRequest;
|
||||
};
|
||||
|
||||
interface ReadableStreamDefaultController<R = any> {
|
||||
readonly desiredSize: number | null;
|
||||
close(): void;
|
||||
enqueue(chunk: R): void;
|
||||
error(error?: any): void;
|
||||
error(e?: any): void;
|
||||
}
|
||||
|
||||
declare var ReadableStreamDefaultController: {
|
||||
@@ -2772,29 +2749,21 @@ declare var ReadableStreamDefaultController: {
|
||||
new(): ReadableStreamDefaultController;
|
||||
};
|
||||
|
||||
interface ReadableStreamDefaultReader<R = any> {
|
||||
readonly closed: Promise<void>;
|
||||
cancel(reason?: any): Promise<void>;
|
||||
read(): Promise<ReadableStreamReadResult<R>>;
|
||||
interface ReadableStreamDefaultReader<R = any> extends ReadableStreamGenericReader {
|
||||
read(): Promise<ReadableStreamDefaultReadResult<R>>;
|
||||
releaseLock(): void;
|
||||
}
|
||||
|
||||
declare var ReadableStreamDefaultReader: {
|
||||
prototype: ReadableStreamDefaultReader;
|
||||
new(): ReadableStreamDefaultReader;
|
||||
new<R = any>(stream: ReadableStream<R>): ReadableStreamDefaultReader<R>;
|
||||
};
|
||||
|
||||
interface ReadableStreamReader<R = any> {
|
||||
cancel(): Promise<void>;
|
||||
read(): Promise<ReadableStreamReadResult<R>>;
|
||||
releaseLock(): void;
|
||||
interface ReadableStreamGenericReader {
|
||||
readonly closed: Promise<undefined>;
|
||||
cancel(reason?: any): Promise<void>;
|
||||
}
|
||||
|
||||
declare var ReadableStreamReader: {
|
||||
prototype: ReadableStreamReader;
|
||||
new(): ReadableStreamReader;
|
||||
};
|
||||
|
||||
/** This Fetch API interface represents a resource request. */
|
||||
interface Request extends Body {
|
||||
/**
|
||||
@@ -2922,7 +2891,7 @@ interface ServiceWorkerContainer extends EventTarget {
|
||||
readonly ready: Promise<ServiceWorkerRegistration>;
|
||||
getRegistration(clientURL?: string): Promise<ServiceWorkerRegistration | undefined>;
|
||||
getRegistrations(): Promise<ReadonlyArray<ServiceWorkerRegistration>>;
|
||||
register(scriptURL: string, options?: RegistrationOptions): Promise<ServiceWorkerRegistration>;
|
||||
register(scriptURL: string | URL, options?: RegistrationOptions): Promise<ServiceWorkerRegistration>;
|
||||
startMessages(): void;
|
||||
addEventListener<K extends keyof ServiceWorkerContainerEventMap>(type: K, listener: (this: ServiceWorkerContainer, ev: ServiceWorkerContainerEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
||||
@@ -3108,14 +3077,14 @@ declare var SyncManager: {
|
||||
/** A decoder for a specific method, that is a specific character encoding, like utf-8, iso-8859-2, koi8, cp1261, gbk, etc. A decoder takes a stream of bytes as input and emits a stream of code points. For a more scalable, non-native library, see StringView – a C-like representation of strings based on typed arrays. */
|
||||
interface TextDecoder extends TextDecoderCommon {
|
||||
/**
|
||||
* Returns the result of running encoding's decoder. The method can be invoked zero or more times with options's stream set to true, and then once without options's stream (or set to false), to process a fragmented stream. If the invocation without options's stream (or set to false) has no input, it's clearest to omit both arguments.
|
||||
* Returns the result of running encoding's decoder. The method can be invoked zero or more times with options's stream set to true, and then once without options's stream (or set to false), to process a fragmented input. If the invocation without options's stream (or set to false) has no input, it's clearest to omit both arguments.
|
||||
*
|
||||
* ```
|
||||
* var string = "", decoder = new TextDecoder(encoding), buffer;
|
||||
* while(buffer = next_chunk()) {
|
||||
* string += decoder.decode(buffer, {stream:true});
|
||||
* }
|
||||
* string += decoder.decode(); // end-of-stream
|
||||
* string += decoder.decode(); // end-of-queue
|
||||
* ```
|
||||
*
|
||||
* If the error mode is "fatal" and encoding's decoder returns error, throws a TypeError.
|
||||
@@ -3134,11 +3103,11 @@ interface TextDecoderCommon {
|
||||
*/
|
||||
readonly encoding: string;
|
||||
/**
|
||||
* Returns true if error mode is "fatal", and false otherwise.
|
||||
* Returns true if error mode is "fatal", otherwise false.
|
||||
*/
|
||||
readonly fatal: boolean;
|
||||
/**
|
||||
* Returns true if ignore BOM flag is set, and false otherwise.
|
||||
* Returns the value of ignore BOM.
|
||||
*/
|
||||
readonly ignoreBOM: boolean;
|
||||
}
|
||||
@@ -3160,7 +3129,7 @@ interface TextEncoder extends TextEncoderCommon {
|
||||
*/
|
||||
encode(input?: string): Uint8Array;
|
||||
/**
|
||||
* Runs the UTF-8 encoder on source, stores the result of that operation into destination, and returns the progress made as a dictionary whereby read is the number of converted code units of source and written is the number of bytes modified in destination.
|
||||
* Runs the UTF-8 encoder on source, stores the result of that operation into destination, and returns the progress made as an object wherein read is the number of converted code units of source and written is the number of bytes modified in destination.
|
||||
*/
|
||||
encodeInto(source: string, destination: Uint8Array): TextEncoderEncodeIntoResult;
|
||||
}
|
||||
@@ -5539,7 +5508,7 @@ declare var WritableStream: {
|
||||
|
||||
/** This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. */
|
||||
interface WritableStreamDefaultController {
|
||||
error(error?: any): void;
|
||||
error(e?: any): void;
|
||||
}
|
||||
|
||||
declare var WritableStreamDefaultController: {
|
||||
@@ -5549,9 +5518,9 @@ declare var WritableStreamDefaultController: {
|
||||
|
||||
/** This Streams API interface is the object returned by WritableStream.getWriter() and once created locks the < writer to the WritableStream ensuring that no other streams can write to the underlying sink. */
|
||||
interface WritableStreamDefaultWriter<W = any> {
|
||||
readonly closed: Promise<void>;
|
||||
readonly closed: Promise<undefined>;
|
||||
readonly desiredSize: number | null;
|
||||
readonly ready: Promise<void>;
|
||||
readonly ready: Promise<undefined>;
|
||||
abort(reason?: any): Promise<void>;
|
||||
close(): Promise<void>;
|
||||
releaseLock(): void;
|
||||
@@ -5560,7 +5529,7 @@ interface WritableStreamDefaultWriter<W = any> {
|
||||
|
||||
declare var WritableStreamDefaultWriter: {
|
||||
prototype: WritableStreamDefaultWriter;
|
||||
new(): WritableStreamDefaultWriter;
|
||||
new<W = any>(stream: WritableStream<W>): WritableStreamDefaultWriter<W>;
|
||||
};
|
||||
|
||||
interface XMLHttpRequestEventMap extends XMLHttpRequestEventTargetEventMap {
|
||||
@@ -5856,50 +5825,54 @@ interface PerformanceObserverCallback {
|
||||
(entries: PerformanceObserverEntryList, observer: PerformanceObserver): void;
|
||||
}
|
||||
|
||||
interface QueuingStrategySizeCallback<T = any> {
|
||||
interface QueuingStrategySize<T = any> {
|
||||
(chunk: T): number;
|
||||
}
|
||||
|
||||
interface ReadableByteStreamControllerCallback {
|
||||
(controller: ReadableByteStreamController): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface ReadableStreamDefaultControllerCallback<R> {
|
||||
(controller: ReadableStreamDefaultController<R>): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface ReadableStreamErrorCallback {
|
||||
(reason: any): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface TransformStreamDefaultControllerCallback<O> {
|
||||
interface TransformerFlushCallback<O> {
|
||||
(controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface TransformStreamDefaultControllerTransformCallback<I, O> {
|
||||
interface TransformerStartCallback<O> {
|
||||
(controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface TransformerTransformCallback<I, O> {
|
||||
(chunk: I, controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface UnderlyingSinkAbortCallback {
|
||||
(reason: any): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface UnderlyingSinkCloseCallback {
|
||||
(): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface UnderlyingSinkStartCallback {
|
||||
(controller: WritableStreamDefaultController): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface UnderlyingSinkWriteCallback<W> {
|
||||
(chunk: W, controller: WritableStreamDefaultController): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface UnderlyingSourceCancelCallback {
|
||||
(reason: any): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface UnderlyingSourcePullCallback<R> {
|
||||
(controller: ReadableStreamController<R>): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface UnderlyingSourceStartCallback<R> {
|
||||
(controller: ReadableStreamController<R>): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface VoidFunction {
|
||||
(): void;
|
||||
}
|
||||
|
||||
interface WritableStreamDefaultControllerCloseCallback {
|
||||
(): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface WritableStreamDefaultControllerStartCallback {
|
||||
(controller: WritableStreamDefaultController): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface WritableStreamDefaultControllerWriteCallback<W> {
|
||||
(chunk: W, controller: WritableStreamDefaultController): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface WritableStreamErrorCallback {
|
||||
(reason: any): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns dedicatedWorkerGlobal's name, i.e. the value given to the Worker constructor. Primarily useful for debugging.
|
||||
*/
|
||||
@@ -5977,7 +5950,8 @@ type OnErrorEventHandler = OnErrorEventHandlerNonNull | null;
|
||||
type TimerHandler = string | Function;
|
||||
type PerformanceEntryList = PerformanceEntry[];
|
||||
type PushMessageDataInit = BufferSource | string;
|
||||
type ReadableStreamReadResult<T> = ReadableStreamReadValueResult<T> | ReadableStreamReadDoneResult<T>;
|
||||
type ReadableStreamReader<T> = ReadableStreamDefaultReader<T>;
|
||||
type ReadableStreamController<T> = ReadableStreamDefaultController<T>;
|
||||
type VibratePattern = number | number[];
|
||||
type AlgorithmIdentifier = string | Algorithm;
|
||||
type HashAlgorithmIdentifier = AlgorithmIdentifier;
|
||||
@@ -6004,6 +5978,7 @@ type DOMTimeStamp = number;
|
||||
type FormDataEntryValue = File | string;
|
||||
type IDBValidKey = number | string | Date | BufferSource | IDBArrayKey;
|
||||
type Transferable = ArrayBuffer | MessagePort | ImageBitmap | OffscreenCanvas;
|
||||
type ReadableStreamDefaultReadResult<T> = ReadableStreamDefaultReadValueResult<T> | ReadableStreamDefaultReadDoneResult;
|
||||
type BinaryType = "arraybuffer" | "blob";
|
||||
type CanvasDirection = "inherit" | "ltr" | "rtl";
|
||||
type CanvasFillRule = "evenodd" | "nonzero";
|
||||
@@ -6026,7 +6001,7 @@ type KeyUsage = "decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "u
|
||||
type NotificationDirection = "auto" | "ltr" | "rtl";
|
||||
type NotificationPermission = "default" | "denied" | "granted";
|
||||
type OffscreenRenderingContextId = "2d" | "bitmaprenderer" | "webgl" | "webgl2";
|
||||
type PermissionName = "accelerometer" | "ambient-light-sensor" | "background-sync" | "bluetooth" | "camera" | "clipboard" | "device-info" | "geolocation" | "gyroscope" | "magnetometer" | "microphone" | "midi" | "notifications" | "persistent-storage" | "push" | "speaker";
|
||||
type PermissionName = "accelerometer" | "ambient-light-sensor" | "background-fetch" | "background-sync" | "bluetooth" | "camera" | "clipboard-read" | "clipboard-write" | "device-info" | "display-capture" | "geolocation" | "gyroscope" | "magnetometer" | "microphone" | "midi" | "nfc" | "notifications" | "persistent-storage" | "push" | "speaker";
|
||||
type PermissionState = "denied" | "granted" | "prompt";
|
||||
type PremultiplyAlpha = "default" | "none" | "premultiply";
|
||||
type PushEncryptionKeyName = "auth" | "p256dh";
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace ts.formatting {
|
||||
kind: T;
|
||||
}
|
||||
|
||||
export type TextRangeWithTriviaKind = TextRangeWithKind<TriviaKind>;
|
||||
export type TextRangeWithTriviaKind = TextRangeWithKind<TriviaSyntaxKind>;
|
||||
|
||||
export interface TokenInfo {
|
||||
leadingTrivia: TextRangeWithTriviaKind[] | undefined;
|
||||
|
||||
+4
-1
@@ -2591,7 +2591,10 @@ declare namespace ts {
|
||||
Optional = 2,
|
||||
Rest = 4,
|
||||
Variadic = 8,
|
||||
Variable = 12
|
||||
Fixed = 3,
|
||||
Variable = 12,
|
||||
NonRequired = 14,
|
||||
NonRest = 11
|
||||
}
|
||||
export interface TupleType extends GenericType {
|
||||
elementFlags: readonly ElementFlags[];
|
||||
|
||||
+4
-1
@@ -2591,7 +2591,10 @@ declare namespace ts {
|
||||
Optional = 2,
|
||||
Rest = 4,
|
||||
Variadic = 8,
|
||||
Variable = 12
|
||||
Fixed = 3,
|
||||
Variable = 12,
|
||||
NonRequired = 14,
|
||||
NonRest = 11
|
||||
}
|
||||
export interface TupleType extends GenericType {
|
||||
elementFlags: readonly ElementFlags[];
|
||||
|
||||
@@ -2,9 +2,9 @@ tests/cases/compiler/baseClassImprovedMismatchErrors.ts(8,5): error TS2416: Prop
|
||||
Type 'string | Derived' is not assignable to type 'string | Base'.
|
||||
Type 'Derived' is not assignable to type 'string | Base'.
|
||||
Type 'Derived' is not assignable to type 'Base'.
|
||||
Types of property 'n' are incompatible.
|
||||
Type 'string | Derived' is not assignable to type 'string | Base'.
|
||||
Type 'Derived' is not assignable to type 'string | Base'.
|
||||
The types returned by 'fn()' are incompatible between these types.
|
||||
Type 'string | number' is not assignable to type 'number'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/baseClassImprovedMismatchErrors.ts(9,5): error TS2416: Property 'fn' in type 'Derived' is not assignable to the same property in base type 'Base'.
|
||||
Type '() => string | number' is not assignable to type '() => number'.
|
||||
Type 'string | number' is not assignable to type 'number'.
|
||||
@@ -13,9 +13,9 @@ tests/cases/compiler/baseClassImprovedMismatchErrors.ts(14,5): error TS2416: Pro
|
||||
Type 'string | DerivedInterface' is not assignable to type 'string | Base'.
|
||||
Type 'DerivedInterface' is not assignable to type 'string | Base'.
|
||||
Type 'DerivedInterface' is not assignable to type 'Base'.
|
||||
Types of property 'n' are incompatible.
|
||||
Type 'string | DerivedInterface' is not assignable to type 'string | Base'.
|
||||
Type 'DerivedInterface' is not assignable to type 'string | Base'.
|
||||
The types returned by 'fn()' are incompatible between these types.
|
||||
Type 'string | number' is not assignable to type 'number'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/baseClassImprovedMismatchErrors.ts(15,5): error TS2416: Property 'fn' in type 'DerivedInterface' is not assignable to the same property in base type 'Base'.
|
||||
Type '() => string | number' is not assignable to type '() => number'.
|
||||
Type 'string | number' is not assignable to type 'number'.
|
||||
@@ -36,9 +36,9 @@ tests/cases/compiler/baseClassImprovedMismatchErrors.ts(15,5): error TS2416: Pro
|
||||
!!! error TS2416: Type 'string | Derived' is not assignable to type 'string | Base'.
|
||||
!!! error TS2416: Type 'Derived' is not assignable to type 'string | Base'.
|
||||
!!! error TS2416: Type 'Derived' is not assignable to type 'Base'.
|
||||
!!! error TS2416: Types of property 'n' are incompatible.
|
||||
!!! error TS2416: Type 'string | Derived' is not assignable to type 'string | Base'.
|
||||
!!! error TS2416: Type 'Derived' is not assignable to type 'string | Base'.
|
||||
!!! error TS2416: The types returned by 'fn()' are incompatible between these types.
|
||||
!!! error TS2416: Type 'string | number' is not assignable to type 'number'.
|
||||
!!! error TS2416: Type 'string' is not assignable to type 'number'.
|
||||
fn() {
|
||||
~~
|
||||
!!! error TS2416: Property 'fn' in type 'Derived' is not assignable to the same property in base type 'Base'.
|
||||
@@ -55,9 +55,9 @@ tests/cases/compiler/baseClassImprovedMismatchErrors.ts(15,5): error TS2416: Pro
|
||||
!!! error TS2416: Type 'string | DerivedInterface' is not assignable to type 'string | Base'.
|
||||
!!! error TS2416: Type 'DerivedInterface' is not assignable to type 'string | Base'.
|
||||
!!! error TS2416: Type 'DerivedInterface' is not assignable to type 'Base'.
|
||||
!!! error TS2416: Types of property 'n' are incompatible.
|
||||
!!! error TS2416: Type 'string | DerivedInterface' is not assignable to type 'string | Base'.
|
||||
!!! error TS2416: Type 'DerivedInterface' is not assignable to type 'string | Base'.
|
||||
!!! error TS2416: The types returned by 'fn()' are incompatible between these types.
|
||||
!!! error TS2416: Type 'string | number' is not assignable to type 'number'.
|
||||
!!! error TS2416: Type 'string' is not assignable to type 'number'.
|
||||
fn() {
|
||||
~~
|
||||
!!! error TS2416: Property 'fn' in type 'DerivedInterface' is not assignable to the same property in base type 'Base'.
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingOptionalChain.ts(9,21): error TS2500: A class can only implement an identifier/qualified-name with optional type arguments.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingOptionalChain.ts (1 errors) ====
|
||||
namespace A {
|
||||
export class B {}
|
||||
}
|
||||
|
||||
// ok
|
||||
class C1 extends A?.B {}
|
||||
|
||||
// error
|
||||
class C2 implements A?.B {}
|
||||
~~~~
|
||||
!!! error TS2500: A class can only implement an identifier/qualified-name with optional type arguments.
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
//// [classExtendingOptionalChain.ts]
|
||||
namespace A {
|
||||
export class B {}
|
||||
}
|
||||
|
||||
// ok
|
||||
class C1 extends A?.B {}
|
||||
|
||||
// error
|
||||
class C2 implements A?.B {}
|
||||
|
||||
|
||||
//// [classExtendingOptionalChain.js]
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var A;
|
||||
(function (A) {
|
||||
var B = /** @class */ (function () {
|
||||
function B() {
|
||||
}
|
||||
return B;
|
||||
}());
|
||||
A.B = B;
|
||||
})(A || (A = {}));
|
||||
// ok
|
||||
var C1 = /** @class */ (function (_super) {
|
||||
__extends(C1, _super);
|
||||
function C1() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
return C1;
|
||||
}((A === null || A === void 0 ? void 0 : A.B)));
|
||||
// error
|
||||
var C2 = /** @class */ (function () {
|
||||
function C2() {
|
||||
}
|
||||
return C2;
|
||||
}());
|
||||
@@ -0,0 +1,22 @@
|
||||
=== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingOptionalChain.ts ===
|
||||
namespace A {
|
||||
>A : Symbol(A, Decl(classExtendingOptionalChain.ts, 0, 0))
|
||||
|
||||
export class B {}
|
||||
>B : Symbol(B, Decl(classExtendingOptionalChain.ts, 0, 13))
|
||||
}
|
||||
|
||||
// ok
|
||||
class C1 extends A?.B {}
|
||||
>C1 : Symbol(C1, Decl(classExtendingOptionalChain.ts, 2, 1))
|
||||
>A?.B : Symbol(A.B, Decl(classExtendingOptionalChain.ts, 0, 13))
|
||||
>A : Symbol(A, Decl(classExtendingOptionalChain.ts, 0, 0))
|
||||
>B : Symbol(A.B, Decl(classExtendingOptionalChain.ts, 0, 13))
|
||||
|
||||
// error
|
||||
class C2 implements A?.B {}
|
||||
>C2 : Symbol(C2, Decl(classExtendingOptionalChain.ts, 5, 24))
|
||||
>A?.B : Symbol(A.B, Decl(classExtendingOptionalChain.ts, 0, 13))
|
||||
>A : Symbol(A, Decl(classExtendingOptionalChain.ts, 0, 0))
|
||||
>B : Symbol(A.B, Decl(classExtendingOptionalChain.ts, 0, 13))
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
=== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingOptionalChain.ts ===
|
||||
namespace A {
|
||||
>A : typeof A
|
||||
|
||||
export class B {}
|
||||
>B : B
|
||||
}
|
||||
|
||||
// ok
|
||||
class C1 extends A?.B {}
|
||||
>C1 : C1
|
||||
>A?.B : A.B
|
||||
>A : typeof A
|
||||
>B : typeof A.B
|
||||
|
||||
// error
|
||||
class C2 implements A?.B {}
|
||||
>C2 : C2
|
||||
>A : typeof A
|
||||
|
||||
@@ -3,7 +3,6 @@ tests/cases/compiler/classPropertyErrorOnNameOnly.ts(7,3): error TS2322: Type '(
|
||||
Type 'undefined' is not assignable to type 'string'.
|
||||
tests/cases/compiler/classPropertyErrorOnNameOnly.ts(24,7): error TS2322: Type '(val: Values) => "1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'FuncType'.
|
||||
Type 'string | undefined' is not assignable to type 'string'.
|
||||
Type 'undefined' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/classPropertyErrorOnNameOnly.ts (2 errors) ====
|
||||
@@ -38,7 +37,6 @@ tests/cases/compiler/classPropertyErrorOnNameOnly.ts(24,7): error TS2322: Type '
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '(val: Values) => "1" | "2" | "3" | "4" | "5" | undefined' is not assignable to type 'FuncType'.
|
||||
!!! error TS2322: Type 'string | undefined' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'string'.
|
||||
switch (val) {
|
||||
case 1:
|
||||
return "1";
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ function wrapResponse<T>(response: T): APIResponse<T> {
|
||||
}
|
||||
|
||||
async function get() {
|
||||
const response = await Promise.resolve((undefined!));
|
||||
const response = await Promise.resolve(undefined!);
|
||||
const result: APIResponse<{ email: string; }> = wrapResponse(response);
|
||||
return result;
|
||||
}
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ function wrapResponse<T>(response: T): APIResponse<T> {
|
||||
}
|
||||
|
||||
async function get() {
|
||||
const d = await Promise.resolve((undefined!));
|
||||
const d = await Promise.resolve(undefined!);
|
||||
const result: APIResponse<{ email: string; }> = wrapResponse(d);
|
||||
return result;
|
||||
}
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ function wrapResponse<T>(response: T): APIResponse<T> {
|
||||
}
|
||||
|
||||
async function get() {
|
||||
const d = await Promise.resolve((undefined!));
|
||||
const d = await Promise.resolve(undefined!);
|
||||
console.log(d);
|
||||
const result: APIResponse<{ email: string; }> = wrapResponse(d);
|
||||
return result;
|
||||
|
||||
@@ -9,9 +9,9 @@ import model = require("./greeter")
|
||||
var el = document.getElementById('content');
|
||||
>el : HTMLElement
|
||||
>document.getElementById('content') : HTMLElement
|
||||
>document.getElementById : (elementId: string) => HTMLElement
|
||||
>document.getElementById : <E extends Element = HTMLElement>(elementId: string) => E
|
||||
>document : Document
|
||||
>getElementById : (elementId: string) => HTMLElement
|
||||
>getElementById : <E extends Element = HTMLElement>(elementId: string) => E
|
||||
>'content' : "content"
|
||||
|
||||
var greeter = new model.Greeter(el);
|
||||
|
||||
@@ -8,9 +8,9 @@ import model = require("./greeter")
|
||||
var el = document.getElementById('content');
|
||||
>el : HTMLElement
|
||||
>document.getElementById('content') : HTMLElement
|
||||
>document.getElementById : (elementId: string) => HTMLElement
|
||||
>document.getElementById : <E extends Element = HTMLElement>(elementId: string) => E
|
||||
>document : Document
|
||||
>getElementById : (elementId: string) => HTMLElement
|
||||
>getElementById : <E extends Element = HTMLElement>(elementId: string) => E
|
||||
>'content' : "content"
|
||||
|
||||
var greeter = new model.Greeter(el);
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
tests/cases/compiler/index.ts(3,14): error TS4023: Exported variable 'spread' has or is using name 'SYMBOL' from external module "tests/cases/compiler/bug" but cannot be named.
|
||||
|
||||
|
||||
==== tests/cases/compiler/bug.ts (0 errors) ====
|
||||
export const SYMBOL = Symbol()
|
||||
|
||||
export interface Interface {
|
||||
readonly [SYMBOL]: string; // remove readonly and @showEmit to see the expected error
|
||||
}
|
||||
|
||||
export function createInstance(): Interface {
|
||||
return {
|
||||
[SYMBOL]: ''
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/index.ts (1 errors) ====
|
||||
import { createInstance } from './bug'
|
||||
|
||||
export const spread = {
|
||||
~~~~~~
|
||||
!!! error TS4023: Exported variable 'spread' has or is using name 'SYMBOL' from external module "tests/cases/compiler/bug" but cannot be named.
|
||||
...createInstance(),
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
//// [tests/cases/compiler/declarationEmitReadonlyComputedProperty.ts] ////
|
||||
|
||||
//// [bug.ts]
|
||||
export const SYMBOL = Symbol()
|
||||
|
||||
export interface Interface {
|
||||
readonly [SYMBOL]: string; // remove readonly and @showEmit to see the expected error
|
||||
}
|
||||
|
||||
export function createInstance(): Interface {
|
||||
return {
|
||||
[SYMBOL]: ''
|
||||
}
|
||||
}
|
||||
|
||||
//// [index.ts]
|
||||
import { createInstance } from './bug'
|
||||
|
||||
export const spread = {
|
||||
...createInstance(),
|
||||
}
|
||||
|
||||
//// [bug.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.createInstance = exports.SYMBOL = void 0;
|
||||
exports.SYMBOL = Symbol();
|
||||
function createInstance() {
|
||||
var _a;
|
||||
return _a = {},
|
||||
_a[exports.SYMBOL] = '',
|
||||
_a;
|
||||
}
|
||||
exports.createInstance = createInstance;
|
||||
//// [index.js]
|
||||
"use strict";
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
exports.__esModule = true;
|
||||
exports.spread = void 0;
|
||||
var bug_1 = require("./bug");
|
||||
exports.spread = __assign({}, bug_1.createInstance());
|
||||
|
||||
|
||||
//// [bug.d.ts]
|
||||
export declare const SYMBOL: unique symbol;
|
||||
export interface Interface {
|
||||
readonly [SYMBOL]: string;
|
||||
}
|
||||
export declare function createInstance(): Interface;
|
||||
@@ -0,0 +1,34 @@
|
||||
=== tests/cases/compiler/bug.ts ===
|
||||
export const SYMBOL = Symbol()
|
||||
>SYMBOL : Symbol(SYMBOL, Decl(bug.ts, 0, 12))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
|
||||
|
||||
export interface Interface {
|
||||
>Interface : Symbol(Interface, Decl(bug.ts, 0, 30))
|
||||
|
||||
readonly [SYMBOL]: string; // remove readonly and @showEmit to see the expected error
|
||||
>[SYMBOL] : Symbol(Interface[SYMBOL], Decl(bug.ts, 2, 28))
|
||||
>SYMBOL : Symbol(SYMBOL, Decl(bug.ts, 0, 12))
|
||||
}
|
||||
|
||||
export function createInstance(): Interface {
|
||||
>createInstance : Symbol(createInstance, Decl(bug.ts, 4, 1))
|
||||
>Interface : Symbol(Interface, Decl(bug.ts, 0, 30))
|
||||
|
||||
return {
|
||||
[SYMBOL]: ''
|
||||
>[SYMBOL] : Symbol([SYMBOL], Decl(bug.ts, 7, 10))
|
||||
>SYMBOL : Symbol(SYMBOL, Decl(bug.ts, 0, 12))
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/index.ts ===
|
||||
import { createInstance } from './bug'
|
||||
>createInstance : Symbol(createInstance, Decl(index.ts, 0, 8))
|
||||
|
||||
export const spread = {
|
||||
>spread : Symbol(spread, Decl(index.ts, 2, 12))
|
||||
|
||||
...createInstance(),
|
||||
>createInstance : Symbol(createInstance, Decl(index.ts, 0, 8))
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
=== tests/cases/compiler/bug.ts ===
|
||||
export const SYMBOL = Symbol()
|
||||
>SYMBOL : unique symbol
|
||||
>Symbol() : unique symbol
|
||||
>Symbol : SymbolConstructor
|
||||
|
||||
export interface Interface {
|
||||
readonly [SYMBOL]: string; // remove readonly and @showEmit to see the expected error
|
||||
>[SYMBOL] : string
|
||||
>SYMBOL : unique symbol
|
||||
}
|
||||
|
||||
export function createInstance(): Interface {
|
||||
>createInstance : () => Interface
|
||||
|
||||
return {
|
||||
>{ [SYMBOL]: '' } : { [SYMBOL]: string; }
|
||||
|
||||
[SYMBOL]: ''
|
||||
>[SYMBOL] : string
|
||||
>SYMBOL : unique symbol
|
||||
>'' : ""
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/index.ts ===
|
||||
import { createInstance } from './bug'
|
||||
>createInstance : () => import("tests/cases/compiler/bug").Interface
|
||||
|
||||
export const spread = {
|
||||
>spread : { [SYMBOL]: string; }
|
||||
>{ ...createInstance(),} : { [SYMBOL]: string; }
|
||||
|
||||
...createInstance(),
|
||||
>createInstance() : import("tests/cases/compiler/bug").Interface
|
||||
>createInstance : () => import("tests/cases/compiler/bug").Interface
|
||||
}
|
||||
@@ -7,7 +7,7 @@ tests/cases/conformance/es6/for-ofStatements/for-of39.ts(1,11): error TS2769: No
|
||||
Type 'IteratorYieldResult<[string, number] | [string, true]>' is not assignable to type 'IteratorYieldResult<readonly [string, boolean]>'.
|
||||
Type '[string, number] | [string, true]' is not assignable to type 'readonly [string, boolean]'.
|
||||
Type '[string, number]' is not assignable to type 'readonly [string, boolean]'.
|
||||
Types of property '1' are incompatible.
|
||||
Type at position 1 in source is not compatible with type at position 1 in target.
|
||||
Type 'number' is not assignable to type 'boolean'.
|
||||
Overload 2 of 3, '(entries?: readonly (readonly [string, boolean])[]): Map<string, boolean>', gave the following error.
|
||||
Type 'number' is not assignable to type 'boolean'.
|
||||
@@ -25,7 +25,7 @@ tests/cases/conformance/es6/for-ofStatements/for-of39.ts(1,11): error TS2769: No
|
||||
!!! error TS2769: Type 'IteratorYieldResult<[string, number] | [string, true]>' is not assignable to type 'IteratorYieldResult<readonly [string, boolean]>'.
|
||||
!!! error TS2769: Type '[string, number] | [string, true]' is not assignable to type 'readonly [string, boolean]'.
|
||||
!!! error TS2769: Type '[string, number]' is not assignable to type 'readonly [string, boolean]'.
|
||||
!!! error TS2769: Types of property '1' are incompatible.
|
||||
!!! error TS2769: Type at position 1 in source is not compatible with type at position 1 in target.
|
||||
!!! error TS2769: Type 'number' is not assignable to type 'boolean'.
|
||||
!!! error TS2769: Overload 2 of 3, '(entries?: readonly (readonly [string, boolean])[]): Map<string, boolean>', gave the following error.
|
||||
!!! error TS2769: Type 'number' is not assignable to type 'boolean'.
|
||||
|
||||
@@ -21,7 +21,7 @@ declare var document: Document;
|
||||
|
||||
interface Document {
|
||||
getElementById(elementId: string): HTMLElement;
|
||||
>getElementById : { (elementId: string): HTMLElement; (elementId: string): HTMLElement; }
|
||||
>getElementById : { <E extends Element = HTMLElement>(elementId: string): E; (elementId: string): HTMLElement; }
|
||||
>elementId : string
|
||||
}
|
||||
|
||||
@@ -36,9 +36,9 @@ var elements = names.map(function (name) {
|
||||
|
||||
return document.getElementById(name);
|
||||
>document.getElementById(name) : HTMLElement
|
||||
>document.getElementById : { (elementId: string): HTMLElement; (elementId: string): HTMLElement; }
|
||||
>document.getElementById : { <E extends Element = HTMLElement>(elementId: string): E; (elementId: string): HTMLElement; }
|
||||
>document : Document
|
||||
>getElementById : { (elementId: string): HTMLElement; (elementId: string): HTMLElement; }
|
||||
>getElementById : { <E extends Element = HTMLElement>(elementId: string): E; (elementId: string): HTMLElement; }
|
||||
>name : string
|
||||
|
||||
});
|
||||
|
||||
@@ -408,7 +408,7 @@ f20(42, "hello", ...t3);
|
||||
>t3 : boolean[]
|
||||
|
||||
f20(42, "hello", ...t2, true);
|
||||
>f20(42, "hello", ...t2, true) : [number, string, string, ...boolean[]]
|
||||
>f20(42, "hello", ...t2, true) : [number, string, string, ...boolean[], boolean]
|
||||
>f20 : <T extends unknown[]>(...args: T) => T
|
||||
>42 : 42
|
||||
>"hello" : "hello"
|
||||
|
||||
@@ -114,7 +114,7 @@ tests/cases/conformance/types/rest/genericRestParameters3.ts(59,5): error TS2345
|
||||
|
||||
let a = bar(10, 20);
|
||||
let b = bar<CoolArray<number>>(10, 20); // Error
|
||||
~~
|
||||
~~~~~~
|
||||
!!! error TS2345: Argument of type '[10, 20]' is not assignable to parameter of type 'CoolArray<number>'.
|
||||
!!! error TS2345: Property 'hello' is missing in type '[10, 20]' but required in type 'CoolArray<number>'.
|
||||
!!! related TS2728 tests/cases/conformance/types/rest/genericRestParameters3.ts:30:5: 'hello' is declared here.
|
||||
@@ -133,7 +133,7 @@ tests/cases/conformance/types/rest/genericRestParameters3.ts(59,5): error TS2345
|
||||
!!! error TS2345: Property 'hello' is missing in type '[number]' but required in type 'CoolArray<unknown>'.
|
||||
!!! related TS2728 tests/cases/conformance/types/rest/genericRestParameters3.ts:30:5: 'hello' is declared here.
|
||||
baz(1, 2); // Error
|
||||
~
|
||||
~~~~
|
||||
!!! error TS2345: Argument of type '[number, number]' is not assignable to parameter of type 'CoolArray<unknown>'.
|
||||
!!! error TS2345: Property 'hello' is missing in type '[number, number]' but required in type 'CoolArray<unknown>'.
|
||||
!!! related TS2728 tests/cases/conformance/types/rest/genericRestParameters3.ts:30:5: 'hello' is declared here.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -9,7 +9,6 @@ tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS236
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(11,21): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(2,2): error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(3,59): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(3,71): error TS2339: Property 'url' does not exist on type 'ImportMeta'.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(6,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(6,28): error TS2339: Property 'scriptElement' does not exist on type 'ImportMeta'.
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(1,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'.
|
||||
@@ -25,7 +24,7 @@ tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS
|
||||
|
||||
|
||||
!!! error TS2468: Cannot find global value 'Promise'.
|
||||
==== tests/cases/conformance/es2019/importMeta/example.ts (5 errors) ====
|
||||
==== tests/cases/conformance/es2019/importMeta/example.ts (4 errors) ====
|
||||
// Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example
|
||||
(async () => {
|
||||
~~~~~~~~~~~~~
|
||||
@@ -33,8 +32,6 @@ tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS
|
||||
const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString());
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'.
|
||||
~~~
|
||||
!!! error TS2339: Property 'url' does not exist on type 'ImportMeta'.
|
||||
const blob = await response.blob();
|
||||
|
||||
const size = import.meta.scriptElement.dataset.size || 300;
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
>fetch : Symbol(fetch, Decl(lib.dom.d.ts, --, --))
|
||||
>new URL("../hamsters.jpg", import.meta.url).toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
>URL : Symbol(URL, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --))
|
||||
>import.meta.url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
|
||||
const blob = await response.blob();
|
||||
@@ -72,7 +74,7 @@ let globalC = import.import.import.malkovich;
|
||||
=== tests/cases/conformance/es2019/importMeta/assignmentTargets.ts ===
|
||||
export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta;
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
import.meta = foo;
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
@@ -82,7 +84,7 @@ declare global {
|
||||
>global : Symbol(global, Decl(assignmentTargets.ts, 1, 18))
|
||||
|
||||
interface ImportMeta {
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
wellKnownProperty: { a: number, b: string, c: boolean };
|
||||
>wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
>new URL("../hamsters.jpg", import.meta.url) : URL
|
||||
>URL : { new (url: string, base?: string | URL): URL; prototype: URL; createObjectURL(object: any): string; revokeObjectURL(url: string): void; }
|
||||
>"../hamsters.jpg" : "../hamsters.jpg"
|
||||
>import.meta.url : any
|
||||
>import.meta.url : string
|
||||
>import.meta : ImportMeta
|
||||
>meta : any
|
||||
>url : any
|
||||
>url : string
|
||||
>toString : () => string
|
||||
|
||||
const blob = await response.blob();
|
||||
|
||||
@@ -9,7 +9,6 @@ tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS236
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(11,21): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(2,2): error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(3,59): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(3,71): error TS2339: Property 'url' does not exist on type 'ImportMeta'.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(6,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(6,28): error TS2339: Property 'scriptElement' does not exist on type 'ImportMeta'.
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(1,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'.
|
||||
@@ -25,7 +24,7 @@ tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS
|
||||
|
||||
|
||||
!!! error TS2468: Cannot find global value 'Promise'.
|
||||
==== tests/cases/conformance/es2019/importMeta/example.ts (5 errors) ====
|
||||
==== tests/cases/conformance/es2019/importMeta/example.ts (4 errors) ====
|
||||
// Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example
|
||||
(async () => {
|
||||
~~~~~~~~~~~~~
|
||||
@@ -33,8 +32,6 @@ tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS
|
||||
const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString());
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'.
|
||||
~~~
|
||||
!!! error TS2339: Property 'url' does not exist on type 'ImportMeta'.
|
||||
const blob = await response.blob();
|
||||
|
||||
const size = import.meta.scriptElement.dataset.size || 300;
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
>fetch : Symbol(fetch, Decl(lib.dom.d.ts, --, --))
|
||||
>new URL("../hamsters.jpg", import.meta.url).toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
>URL : Symbol(URL, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --))
|
||||
>import.meta.url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
|
||||
const blob = await response.blob();
|
||||
@@ -72,7 +74,7 @@ let globalC = import.import.import.malkovich;
|
||||
=== tests/cases/conformance/es2019/importMeta/assignmentTargets.ts ===
|
||||
export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta;
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
import.meta = foo;
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
@@ -82,7 +84,7 @@ declare global {
|
||||
>global : Symbol(global, Decl(assignmentTargets.ts, 1, 18))
|
||||
|
||||
interface ImportMeta {
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
wellKnownProperty: { a: number, b: string, c: boolean };
|
||||
>wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
>new URL("../hamsters.jpg", import.meta.url) : URL
|
||||
>URL : { new (url: string, base?: string | URL): URL; prototype: URL; createObjectURL(object: any): string; revokeObjectURL(url: string): void; }
|
||||
>"../hamsters.jpg" : "../hamsters.jpg"
|
||||
>import.meta.url : any
|
||||
>import.meta.url : string
|
||||
>import.meta : ImportMeta
|
||||
>meta : any
|
||||
>url : any
|
||||
>url : string
|
||||
>toString : () => string
|
||||
|
||||
const blob = await response.blob();
|
||||
|
||||
@@ -3,7 +3,6 @@ tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,44): error TS23
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,63): error TS2339: Property 'blue' does not exist on type 'ImportMeta'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(2,2): error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(3,71): error TS2339: Property 'url' does not exist on type 'ImportMeta'.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(6,28): error TS2339: Property 'scriptElement' does not exist on type 'ImportMeta'.
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,23): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,23): error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
|
||||
@@ -12,14 +11,12 @@ tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS
|
||||
|
||||
|
||||
!!! error TS2468: Cannot find global value 'Promise'.
|
||||
==== tests/cases/conformance/es2019/importMeta/example.ts (3 errors) ====
|
||||
==== tests/cases/conformance/es2019/importMeta/example.ts (2 errors) ====
|
||||
// Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example
|
||||
(async () => {
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.
|
||||
const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString());
|
||||
~~~
|
||||
!!! error TS2339: Property 'url' does not exist on type 'ImportMeta'.
|
||||
const blob = await response.blob();
|
||||
|
||||
const size = import.meta.scriptElement.dataset.size || 300;
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
>fetch : Symbol(fetch, Decl(lib.dom.d.ts, --, --))
|
||||
>new URL("../hamsters.jpg", import.meta.url).toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
>URL : Symbol(URL, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --))
|
||||
>import.meta.url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
|
||||
const blob = await response.blob();
|
||||
@@ -72,7 +74,7 @@ let globalC = import.import.import.malkovich;
|
||||
=== tests/cases/conformance/es2019/importMeta/assignmentTargets.ts ===
|
||||
export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta;
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
import.meta = foo;
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
@@ -82,7 +84,7 @@ declare global {
|
||||
>global : Symbol(global, Decl(assignmentTargets.ts, 1, 18))
|
||||
|
||||
interface ImportMeta {
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
wellKnownProperty: { a: number, b: string, c: boolean };
|
||||
>wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
>new URL("../hamsters.jpg", import.meta.url) : URL
|
||||
>URL : { new (url: string, base?: string | URL): URL; prototype: URL; createObjectURL(object: any): string; revokeObjectURL(url: string): void; }
|
||||
>"../hamsters.jpg" : "../hamsters.jpg"
|
||||
>import.meta.url : any
|
||||
>import.meta.url : string
|
||||
>import.meta : ImportMeta
|
||||
>meta : any
|
||||
>url : any
|
||||
>url : string
|
||||
>toString : () => string
|
||||
|
||||
const blob = await response.blob();
|
||||
|
||||
@@ -3,7 +3,6 @@ tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,44): error TS23
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,63): error TS2339: Property 'blue' does not exist on type 'ImportMeta'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(2,2): error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(3,71): error TS2339: Property 'url' does not exist on type 'ImportMeta'.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(6,28): error TS2339: Property 'scriptElement' does not exist on type 'ImportMeta'.
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,23): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,23): error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
|
||||
@@ -12,14 +11,12 @@ tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS
|
||||
|
||||
|
||||
!!! error TS2468: Cannot find global value 'Promise'.
|
||||
==== tests/cases/conformance/es2019/importMeta/example.ts (3 errors) ====
|
||||
==== tests/cases/conformance/es2019/importMeta/example.ts (2 errors) ====
|
||||
// Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example
|
||||
(async () => {
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.
|
||||
const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString());
|
||||
~~~
|
||||
!!! error TS2339: Property 'url' does not exist on type 'ImportMeta'.
|
||||
const blob = await response.blob();
|
||||
|
||||
const size = import.meta.scriptElement.dataset.size || 300;
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
>fetch : Symbol(fetch, Decl(lib.dom.d.ts, --, --))
|
||||
>new URL("../hamsters.jpg", import.meta.url).toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
>URL : Symbol(URL, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --))
|
||||
>import.meta.url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
|
||||
const blob = await response.blob();
|
||||
@@ -72,7 +74,7 @@ let globalC = import.import.import.malkovich;
|
||||
=== tests/cases/conformance/es2019/importMeta/assignmentTargets.ts ===
|
||||
export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta;
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
import.meta = foo;
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
@@ -82,7 +84,7 @@ declare global {
|
||||
>global : Symbol(global, Decl(assignmentTargets.ts, 1, 18))
|
||||
|
||||
interface ImportMeta {
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
wellKnownProperty: { a: number, b: string, c: boolean };
|
||||
>wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
>new URL("../hamsters.jpg", import.meta.url) : URL
|
||||
>URL : { new (url: string, base?: string | URL): URL; prototype: URL; createObjectURL(object: any): string; revokeObjectURL(url: string): void; }
|
||||
>"../hamsters.jpg" : "../hamsters.jpg"
|
||||
>import.meta.url : any
|
||||
>import.meta.url : string
|
||||
>import.meta : ImportMeta
|
||||
>meta : any
|
||||
>url : any
|
||||
>url : string
|
||||
>toString : () => string
|
||||
|
||||
const blob = await response.blob();
|
||||
|
||||
@@ -3,7 +3,6 @@ tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,44): error TS23
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,63): error TS2339: Property 'blue' does not exist on type 'ImportMeta'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(2,2): error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(3,71): error TS2339: Property 'url' does not exist on type 'ImportMeta'.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(6,28): error TS2339: Property 'scriptElement' does not exist on type 'ImportMeta'.
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,23): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,23): error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
|
||||
@@ -12,14 +11,12 @@ tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS
|
||||
|
||||
|
||||
!!! error TS2468: Cannot find global value 'Promise'.
|
||||
==== tests/cases/conformance/es2019/importMeta/example.ts (3 errors) ====
|
||||
==== tests/cases/conformance/es2019/importMeta/example.ts (2 errors) ====
|
||||
// Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example
|
||||
(async () => {
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.
|
||||
const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString());
|
||||
~~~
|
||||
!!! error TS2339: Property 'url' does not exist on type 'ImportMeta'.
|
||||
const blob = await response.blob();
|
||||
|
||||
const size = import.meta.scriptElement.dataset.size || 300;
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
>fetch : Symbol(fetch, Decl(lib.dom.d.ts, --, --))
|
||||
>new URL("../hamsters.jpg", import.meta.url).toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
>URL : Symbol(URL, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --))
|
||||
>import.meta.url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
|
||||
const blob = await response.blob();
|
||||
@@ -72,7 +74,7 @@ let globalC = import.import.import.malkovich;
|
||||
=== tests/cases/conformance/es2019/importMeta/assignmentTargets.ts ===
|
||||
export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta;
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
import.meta = foo;
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
@@ -82,7 +84,7 @@ declare global {
|
||||
>global : Symbol(global, Decl(assignmentTargets.ts, 1, 18))
|
||||
|
||||
interface ImportMeta {
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
wellKnownProperty: { a: number, b: string, c: boolean };
|
||||
>wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
>new URL("../hamsters.jpg", import.meta.url) : URL
|
||||
>URL : { new (url: string, base?: string | URL): URL; prototype: URL; createObjectURL(object: any): string; revokeObjectURL(url: string): void; }
|
||||
>"../hamsters.jpg" : "../hamsters.jpg"
|
||||
>import.meta.url : any
|
||||
>import.meta.url : string
|
||||
>import.meta : ImportMeta
|
||||
>meta : any
|
||||
>url : any
|
||||
>url : string
|
||||
>toString : () => string
|
||||
|
||||
const blob = await response.blob();
|
||||
|
||||
@@ -3,7 +3,6 @@ tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,44): error TS23
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,63): error TS2339: Property 'blue' does not exist on type 'ImportMeta'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(2,2): error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(3,71): error TS2339: Property 'url' does not exist on type 'ImportMeta'.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(6,28): error TS2339: Property 'scriptElement' does not exist on type 'ImportMeta'.
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,23): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,23): error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
|
||||
@@ -12,14 +11,12 @@ tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS
|
||||
|
||||
|
||||
!!! error TS2468: Cannot find global value 'Promise'.
|
||||
==== tests/cases/conformance/es2019/importMeta/example.ts (3 errors) ====
|
||||
==== tests/cases/conformance/es2019/importMeta/example.ts (2 errors) ====
|
||||
// Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example
|
||||
(async () => {
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.
|
||||
const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString());
|
||||
~~~
|
||||
!!! error TS2339: Property 'url' does not exist on type 'ImportMeta'.
|
||||
const blob = await response.blob();
|
||||
|
||||
const size = import.meta.scriptElement.dataset.size || 300;
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
>fetch : Symbol(fetch, Decl(lib.dom.d.ts, --, --))
|
||||
>new URL("../hamsters.jpg", import.meta.url).toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
>URL : Symbol(URL, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --))
|
||||
>import.meta.url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
|
||||
const blob = await response.blob();
|
||||
@@ -72,7 +74,7 @@ let globalC = import.import.import.malkovich;
|
||||
=== tests/cases/conformance/es2019/importMeta/assignmentTargets.ts ===
|
||||
export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta;
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
import.meta = foo;
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
@@ -82,7 +84,7 @@ declare global {
|
||||
>global : Symbol(global, Decl(assignmentTargets.ts, 1, 18))
|
||||
|
||||
interface ImportMeta {
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
wellKnownProperty: { a: number, b: string, c: boolean };
|
||||
>wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
>new URL("../hamsters.jpg", import.meta.url) : URL
|
||||
>URL : { new (url: string, base?: string | URL): URL; prototype: URL; createObjectURL(object: any): string; revokeObjectURL(url: string): void; }
|
||||
>"../hamsters.jpg" : "../hamsters.jpg"
|
||||
>import.meta.url : any
|
||||
>import.meta.url : string
|
||||
>import.meta : ImportMeta
|
||||
>meta : any
|
||||
>url : any
|
||||
>url : string
|
||||
>toString : () => string
|
||||
|
||||
const blob = await response.blob();
|
||||
|
||||
@@ -3,7 +3,6 @@ tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,44): error TS23
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,63): error TS2339: Property 'blue' does not exist on type 'ImportMeta'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(2,2): error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(3,71): error TS2339: Property 'url' does not exist on type 'ImportMeta'.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(6,28): error TS2339: Property 'scriptElement' does not exist on type 'ImportMeta'.
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,23): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,23): error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
|
||||
@@ -12,14 +11,12 @@ tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS
|
||||
|
||||
|
||||
!!! error TS2468: Cannot find global value 'Promise'.
|
||||
==== tests/cases/conformance/es2019/importMeta/example.ts (3 errors) ====
|
||||
==== tests/cases/conformance/es2019/importMeta/example.ts (2 errors) ====
|
||||
// Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example
|
||||
(async () => {
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.
|
||||
const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString());
|
||||
~~~
|
||||
!!! error TS2339: Property 'url' does not exist on type 'ImportMeta'.
|
||||
const blob = await response.blob();
|
||||
|
||||
const size = import.meta.scriptElement.dataset.size || 300;
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
>fetch : Symbol(fetch, Decl(lib.dom.d.ts, --, --))
|
||||
>new URL("../hamsters.jpg", import.meta.url).toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
>URL : Symbol(URL, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --))
|
||||
>import.meta.url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
|
||||
const blob = await response.blob();
|
||||
@@ -72,7 +74,7 @@ let globalC = import.import.import.malkovich;
|
||||
=== tests/cases/conformance/es2019/importMeta/assignmentTargets.ts ===
|
||||
export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta;
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
import.meta = foo;
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
@@ -82,7 +84,7 @@ declare global {
|
||||
>global : Symbol(global, Decl(assignmentTargets.ts, 1, 18))
|
||||
|
||||
interface ImportMeta {
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
wellKnownProperty: { a: number, b: string, c: boolean };
|
||||
>wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
>new URL("../hamsters.jpg", import.meta.url) : URL
|
||||
>URL : { new (url: string, base?: string | URL): URL; prototype: URL; createObjectURL(object: any): string; revokeObjectURL(url: string): void; }
|
||||
>"../hamsters.jpg" : "../hamsters.jpg"
|
||||
>import.meta.url : any
|
||||
>import.meta.url : string
|
||||
>import.meta : ImportMeta
|
||||
>meta : any
|
||||
>url : any
|
||||
>url : string
|
||||
>toString : () => string
|
||||
|
||||
const blob = await response.blob();
|
||||
|
||||
@@ -3,7 +3,6 @@ tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,44): error TS23
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,63): error TS2339: Property 'blue' does not exist on type 'ImportMeta'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(2,2): error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(3,71): error TS2339: Property 'url' does not exist on type 'ImportMeta'.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(6,28): error TS2339: Property 'scriptElement' does not exist on type 'ImportMeta'.
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,23): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,23): error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
|
||||
@@ -12,14 +11,12 @@ tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS
|
||||
|
||||
|
||||
!!! error TS2468: Cannot find global value 'Promise'.
|
||||
==== tests/cases/conformance/es2019/importMeta/example.ts (3 errors) ====
|
||||
==== tests/cases/conformance/es2019/importMeta/example.ts (2 errors) ====
|
||||
// Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example
|
||||
(async () => {
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.
|
||||
const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString());
|
||||
~~~
|
||||
!!! error TS2339: Property 'url' does not exist on type 'ImportMeta'.
|
||||
const blob = await response.blob();
|
||||
|
||||
const size = import.meta.scriptElement.dataset.size || 300;
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
>fetch : Symbol(fetch, Decl(lib.dom.d.ts, --, --))
|
||||
>new URL("../hamsters.jpg", import.meta.url).toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
>URL : Symbol(URL, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --))
|
||||
>import.meta.url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
|
||||
const blob = await response.blob();
|
||||
@@ -72,7 +74,7 @@ let globalC = import.import.import.malkovich;
|
||||
=== tests/cases/conformance/es2019/importMeta/assignmentTargets.ts ===
|
||||
export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta;
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
import.meta = foo;
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
@@ -82,7 +84,7 @@ declare global {
|
||||
>global : Symbol(global, Decl(assignmentTargets.ts, 1, 18))
|
||||
|
||||
interface ImportMeta {
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
wellKnownProperty: { a: number, b: string, c: boolean };
|
||||
>wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
>new URL("../hamsters.jpg", import.meta.url) : URL
|
||||
>URL : { new (url: string, base?: string | URL): URL; prototype: URL; createObjectURL(object: any): string; revokeObjectURL(url: string): void; }
|
||||
>"../hamsters.jpg" : "../hamsters.jpg"
|
||||
>import.meta.url : any
|
||||
>import.meta.url : string
|
||||
>import.meta : ImportMeta
|
||||
>meta : any
|
||||
>url : any
|
||||
>url : string
|
||||
>toString : () => string
|
||||
|
||||
const blob = await response.blob();
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
tests/cases/conformance/interfaces/interfaceDeclarations/interfaceExtendingOptionalChain.ts(5,22): error TS2499: An interface can only extend an identifier/qualified-name with optional type arguments.
|
||||
|
||||
|
||||
==== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceExtendingOptionalChain.ts (1 errors) ====
|
||||
namespace Foo {
|
||||
export class Bar {}
|
||||
}
|
||||
|
||||
interface C1 extends Foo?.Bar {}
|
||||
~~~~~~~~
|
||||
!!! error TS2499: An interface can only extend an identifier/qualified-name with optional type arguments.
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
//// [interfaceExtendingOptionalChain.ts]
|
||||
namespace Foo {
|
||||
export class Bar {}
|
||||
}
|
||||
|
||||
interface C1 extends Foo?.Bar {}
|
||||
|
||||
|
||||
//// [interfaceExtendingOptionalChain.js]
|
||||
var Foo;
|
||||
(function (Foo) {
|
||||
var Bar = /** @class */ (function () {
|
||||
function Bar() {
|
||||
}
|
||||
return Bar;
|
||||
}());
|
||||
Foo.Bar = Bar;
|
||||
})(Foo || (Foo = {}));
|
||||
@@ -0,0 +1,14 @@
|
||||
=== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceExtendingOptionalChain.ts ===
|
||||
namespace Foo {
|
||||
>Foo : Symbol(Foo, Decl(interfaceExtendingOptionalChain.ts, 0, 0))
|
||||
|
||||
export class Bar {}
|
||||
>Bar : Symbol(Bar, Decl(interfaceExtendingOptionalChain.ts, 0, 15))
|
||||
}
|
||||
|
||||
interface C1 extends Foo?.Bar {}
|
||||
>C1 : Symbol(C1, Decl(interfaceExtendingOptionalChain.ts, 2, 1))
|
||||
>Foo?.Bar : Symbol(Foo.Bar, Decl(interfaceExtendingOptionalChain.ts, 0, 15))
|
||||
>Foo : Symbol(Foo, Decl(interfaceExtendingOptionalChain.ts, 0, 0))
|
||||
>Bar : Symbol(Foo.Bar, Decl(interfaceExtendingOptionalChain.ts, 0, 15))
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
=== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceExtendingOptionalChain.ts ===
|
||||
namespace Foo {
|
||||
>Foo : typeof Foo
|
||||
|
||||
export class Bar {}
|
||||
>Bar : Bar
|
||||
}
|
||||
|
||||
interface C1 extends Foo?.Bar {}
|
||||
>Foo : typeof Foo
|
||||
|
||||
@@ -74,8 +74,8 @@ export function assertNodeProperty<
|
||||
>tagName : T
|
||||
|
||||
node[prop];
|
||||
>node[prop] : ElementTagNameMap[T][P]
|
||||
>node : ElementTagNameMap[T]
|
||||
>node[prop] : ((Node | null) & ElementTagNameMap[T])[P]
|
||||
>node : (Node | null) & ElementTagNameMap[T]
|
||||
>prop : P
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ tests/cases/compiler/intersectionsOfLargeUnions2.ts(31,15): error TS2536: Type '
|
||||
interface ElementTagNameMap {
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2300: Duplicate identifier 'ElementTagNameMap'.
|
||||
!!! related TS6203 /.ts/lib.dom.d.ts:19501:6: 'ElementTagNameMap' was also declared here.
|
||||
!!! related TS6203 /.ts/lib.dom.d.ts:19590:6: 'ElementTagNameMap' was also declared here.
|
||||
[index: number]: HTMLElement
|
||||
}
|
||||
|
||||
|
||||
@@ -88,8 +88,8 @@ export function assertNodeProperty<
|
||||
>tagName : T
|
||||
|
||||
node[prop];
|
||||
>node[prop] : ElementTagNameMap[T][P]
|
||||
>node : ElementTagNameMap[T]
|
||||
>node[prop] : ((Node | null) & ElementTagNameMap[T])[P]
|
||||
>node : (Node | null) & ElementTagNameMap[T]
|
||||
>prop : P
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern28.ts(2,24): error
|
||||
Type 'IteratorYieldResult<[string, number] | [string, boolean]>' is not assignable to type 'IteratorYieldResult<readonly [string, number]>'.
|
||||
Type '[string, number] | [string, boolean]' is not assignable to type 'readonly [string, number]'.
|
||||
Type '[string, boolean]' is not assignable to type 'readonly [string, number]'.
|
||||
Types of property '1' are incompatible.
|
||||
Type at position 1 in source is not compatible with type at position 1 in target.
|
||||
Type 'boolean' is not assignable to type 'number'.
|
||||
Overload 2 of 3, '(entries?: readonly (readonly [string, number])[]): Map<string, number>', gave the following error.
|
||||
Type 'boolean' is not assignable to type 'number'.
|
||||
@@ -26,7 +26,7 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern28.ts(2,24): error
|
||||
!!! error TS2769: Type 'IteratorYieldResult<[string, number] | [string, boolean]>' is not assignable to type 'IteratorYieldResult<readonly [string, number]>'.
|
||||
!!! error TS2769: Type '[string, number] | [string, boolean]' is not assignable to type 'readonly [string, number]'.
|
||||
!!! error TS2769: Type '[string, boolean]' is not assignable to type 'readonly [string, number]'.
|
||||
!!! error TS2769: Types of property '1' are incompatible.
|
||||
!!! error TS2769: Type at position 1 in source is not compatible with type at position 1 in target.
|
||||
!!! error TS2769: Type 'boolean' is not assignable to type 'number'.
|
||||
!!! error TS2769: Overload 2 of 3, '(entries?: readonly (readonly [string, number])[]): Map<string, number>', gave the following error.
|
||||
!!! error TS2769: Type 'boolean' is not assignable to type 'number'.
|
||||
@@ -22,7 +22,6 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(64,33): error
|
||||
Type '"size"' is not assignable to type 'keyof Shape'.
|
||||
tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(66,24): error TS2345: Argument of type '"size"' is not assignable to parameter of type 'keyof Shape'.
|
||||
tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(67,24): error TS2345: Argument of type '"name" | "size"' is not assignable to parameter of type 'keyof Shape'.
|
||||
Type '"size"' is not assignable to type 'keyof Shape'.
|
||||
tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(73,5): error TS2536: Type 'keyof T | keyof U' cannot be used to index type 'T | U'.
|
||||
tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(74,5): error TS2536: Type 'keyof T | keyof U' cannot be used to index type 'T | U'.
|
||||
tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(82,5): error TS2322: Type 'keyof T | keyof U' is not assignable to type 'keyof T & keyof U'.
|
||||
@@ -34,14 +33,8 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(82,5): error
|
||||
Type 'string | number | symbol' is not assignable to type 'keyof U'.
|
||||
Type 'string' is not assignable to type 'keyof U'.
|
||||
tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(83,5): error TS2322: Type 'keyof T | keyof U' is not assignable to type 'keyof T & keyof U'.
|
||||
Type 'keyof T' is not assignable to type 'keyof T & keyof U'.
|
||||
Type 'keyof T' is not assignable to type 'keyof U'.
|
||||
tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(86,5): error TS2322: Type 'keyof T | keyof U' is not assignable to type 'keyof T & keyof U'.
|
||||
Type 'keyof T' is not assignable to type 'keyof T & keyof U'.
|
||||
Type 'keyof T' is not assignable to type 'keyof U'.
|
||||
tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(87,5): error TS2322: Type 'keyof T | keyof U' is not assignable to type 'keyof T & keyof U'.
|
||||
Type 'keyof T' is not assignable to type 'keyof T & keyof U'.
|
||||
Type 'keyof T' is not assignable to type 'keyof U'.
|
||||
tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(103,9): error TS2322: Type 'Extract<keyof T, string>' is not assignable to type 'K'.
|
||||
'Extract<keyof T, string>' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'.
|
||||
Type 'string & keyof T' is not assignable to type 'K'.
|
||||
@@ -191,7 +184,6 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(142,5): error
|
||||
setProperty(shape, cond ? "name" : "size", 10); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '"name" | "size"' is not assignable to parameter of type 'keyof Shape'.
|
||||
!!! error TS2345: Type '"size"' is not assignable to type 'keyof Shape'.
|
||||
}
|
||||
|
||||
function f20<T, U>(x: T | U, y: T & U, k1: keyof (T | U), k2: keyof T & keyof U, k3: keyof (T & U), k4: keyof T | keyof U) {
|
||||
@@ -223,20 +215,14 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(142,5): error
|
||||
k1 = k4; // Error
|
||||
~~
|
||||
!!! error TS2322: Type 'keyof T | keyof U' is not assignable to type 'keyof T & keyof U'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'keyof T & keyof U'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'keyof U'.
|
||||
|
||||
k2 = k1;
|
||||
k2 = k3; // Error
|
||||
~~
|
||||
!!! error TS2322: Type 'keyof T | keyof U' is not assignable to type 'keyof T & keyof U'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'keyof T & keyof U'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'keyof U'.
|
||||
k2 = k4; // Error
|
||||
~~
|
||||
!!! error TS2322: Type 'keyof T | keyof U' is not assignable to type 'keyof T & keyof U'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'keyof T & keyof U'.
|
||||
!!! error TS2322: Type 'keyof T' is not assignable to type 'keyof U'.
|
||||
|
||||
k3 = k1;
|
||||
k3 = k2;
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,51 +1,30 @@
|
||||
tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(3,32): error TS2344: Type 'boolean | undefined' does not satisfy the constraint 'boolean'.
|
||||
Type 'undefined' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(12,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
Type 'undefined' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(13,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
Type 'undefined' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(14,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
Type 'undefined' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(15,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
Type 'undefined' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(16,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
Type 'undefined' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(17,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
Type 'undefined' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(18,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
Type 'undefined' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(19,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
Type 'undefined' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(20,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
Type 'undefined' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(21,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
Type 'undefined' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(22,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
Type 'undefined' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(23,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
Type 'undefined' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(24,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
Type 'undefined' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(25,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
Type 'undefined' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(38,1): error TS2322: Type 'undefined' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(39,1): error TS2322: Type 'undefined' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(40,1): error TS2322: Type 'undefined' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(41,1): error TS2322: Type 'undefined' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(46,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
Type 'undefined' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(47,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
Type 'undefined' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(48,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
Type 'undefined' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(49,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
Type 'undefined' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(50,7): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
Type 'undefined' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(55,5): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
Type 'undefined' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(63,5): error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
Type 'undefined' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(79,7): error TS2322: Type 'number | boolean | undefined' is not assignable to type 'number | boolean'.
|
||||
Type 'undefined' is not assignable to type 'number | boolean'.
|
||||
tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(85,1): error TS2322: Type 'undefined' is not assignable to type 'string'.
|
||||
@@ -76,59 +55,45 @@ tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(99,11): error TS232
|
||||
const e1: boolean = strMap["foo"];
|
||||
~~
|
||||
!!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'.
|
||||
const e2: boolean = strMap.bar;
|
||||
~~
|
||||
!!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'.
|
||||
const e3: boolean = strMap[0];
|
||||
~~
|
||||
!!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'.
|
||||
const e4: boolean = strMap[0 as string | number];
|
||||
~~
|
||||
!!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'.
|
||||
const e5: boolean = strMap[0 as string | 0 | 1];
|
||||
~~
|
||||
!!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'.
|
||||
const e6: boolean = strMap[0 as 0 | 1];
|
||||
~~
|
||||
!!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'.
|
||||
const e7: boolean = strMap["foo" as "foo" | "baz"];
|
||||
~~
|
||||
!!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'.
|
||||
const e8: boolean = strMap[NumericEnum1.A];
|
||||
~~
|
||||
!!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'.
|
||||
const e9: boolean = strMap[NumericEnum2.A];
|
||||
~~
|
||||
!!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'.
|
||||
const e10: boolean = strMap[StringEnum1.A];
|
||||
~~~
|
||||
!!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'.
|
||||
const e11: boolean = strMap[StringEnum1.A as StringEnum1];
|
||||
~~~
|
||||
!!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'.
|
||||
const e12: boolean = strMap[NumericEnum1.A as NumericEnum1];
|
||||
~~~
|
||||
!!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'.
|
||||
const e13: boolean = strMap[NumericEnum2.A as NumericEnum2];
|
||||
~~~
|
||||
!!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'.
|
||||
const e14: boolean = strMap[null as any];
|
||||
~~~
|
||||
!!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'.
|
||||
|
||||
// Should be OK
|
||||
const ok1: boolean | undefined = strMap["foo"];
|
||||
@@ -160,23 +125,18 @@ tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(99,11): error TS232
|
||||
const num_ok1: boolean = numMap[0];
|
||||
~~~~~~~
|
||||
!!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'.
|
||||
const num_ok2: boolean = numMap[0 as number];
|
||||
~~~~~~~
|
||||
!!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'.
|
||||
const num_ok3: boolean = numMap[0 as 0 | 1];
|
||||
~~~~~~~
|
||||
!!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'.
|
||||
const num_ok4: boolean = numMap[NumericEnum1.A];
|
||||
~~~~~~~
|
||||
!!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'.
|
||||
const num_ok5: boolean = numMap[NumericEnum2.A];
|
||||
~~~~~~~
|
||||
!!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'.
|
||||
|
||||
// Generics
|
||||
function generic1<T extends { [s: string]: boolean }>(arg: T): boolean {
|
||||
@@ -184,7 +144,6 @@ tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(99,11): error TS232
|
||||
return arg["blah"];
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'.
|
||||
}
|
||||
function generic2<T extends { [s: string]: boolean }>(arg: T): boolean {
|
||||
// Should OK
|
||||
@@ -195,7 +154,6 @@ tests/cases/conformance/pedantic/noUncheckedIndexedAccess.ts(99,11): error TS232
|
||||
return strMap[arg];
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type 'boolean | undefined' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'boolean'.
|
||||
}
|
||||
|
||||
// Element access into known properties is ok
|
||||
|
||||
@@ -5,7 +5,6 @@ tests/cases/conformance/types/spread/objectSpreadStrictNull.ts(14,9): error TS23
|
||||
tests/cases/conformance/types/spread/objectSpreadStrictNull.ts(15,9): error TS2322: Type '{ sn: number | undefined; }' is not assignable to type '{ sn: string | number; }'.
|
||||
Types of property 'sn' are incompatible.
|
||||
Type 'number | undefined' is not assignable to type 'string | number'.
|
||||
Type 'undefined' is not assignable to type 'string | number'.
|
||||
tests/cases/conformance/types/spread/objectSpreadStrictNull.ts(18,9): error TS2322: Type '{ sn: string | number | undefined; }' is not assignable to type '{ sn: string | number | boolean; }'.
|
||||
Types of property 'sn' are incompatible.
|
||||
Type 'string | number | undefined' is not assignable to type 'string | number | boolean'.
|
||||
@@ -42,7 +41,6 @@ tests/cases/conformance/types/spread/objectSpreadStrictNull.ts(42,5): error TS23
|
||||
!!! error TS2322: Type '{ sn: number | undefined; }' is not assignable to type '{ sn: string | number; }'.
|
||||
!!! error TS2322: Types of property 'sn' are incompatible.
|
||||
!!! error TS2322: Type 'number | undefined' is not assignable to type 'string | number'.
|
||||
!!! error TS2322: Type 'undefined' is not assignable to type 'string | number'.
|
||||
let allUndefined: { sn: string | number | undefined } = { ...undefinedString, ...undefinedNumber };
|
||||
|
||||
let undefinedWithOptionalContinues: { sn: string | number | boolean } = { ...definiteBoolean, ...undefinedString, ...optionalNumber };
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
tests/cases/conformance/types/tuple/optionalTupleElements1.ts(11,29): error TS1257: A required element cannot follow an optional element.
|
||||
tests/cases/conformance/types/tuple/optionalTupleElements1.ts(15,5): error TS2322: Type 'T2' is not assignable to type 'T1'.
|
||||
Property '2' is optional in type '[number, string, (boolean | undefined)?]' but required in type '[number, string, boolean]'.
|
||||
Source provides no match for required element at position 2 in target.
|
||||
tests/cases/conformance/types/tuple/optionalTupleElements1.ts(16,5): error TS2322: Type 'T3' is not assignable to type 'T1'.
|
||||
Property '1' is optional in type '[number, (string | undefined)?, (boolean | undefined)?]' but required in type '[number, string, boolean]'.
|
||||
Source provides no match for required element at position 1 in target.
|
||||
tests/cases/conformance/types/tuple/optionalTupleElements1.ts(17,5): error TS2322: Type 'T4' is not assignable to type 'T1'.
|
||||
Property '0' is optional in type '[(number | undefined)?, (string | undefined)?, (boolean | undefined)?]' but required in type '[number, string, boolean]'.
|
||||
Source provides no match for required element at position 0 in target.
|
||||
tests/cases/conformance/types/tuple/optionalTupleElements1.ts(20,5): error TS2322: Type 'T3' is not assignable to type 'T2'.
|
||||
Property '1' is optional in type '[number, (string | undefined)?, (boolean | undefined)?]' but required in type '[number, string, (boolean | undefined)?]'.
|
||||
Source provides no match for required element at position 1 in target.
|
||||
tests/cases/conformance/types/tuple/optionalTupleElements1.ts(21,5): error TS2322: Type 'T4' is not assignable to type 'T2'.
|
||||
Property '0' is optional in type '[(number | undefined)?, (string | undefined)?, (boolean | undefined)?]' but required in type '[number, string, (boolean | undefined)?]'.
|
||||
Source provides no match for required element at position 0 in target.
|
||||
tests/cases/conformance/types/tuple/optionalTupleElements1.ts(25,5): error TS2322: Type 'T4' is not assignable to type 'T3'.
|
||||
Property '0' is optional in type '[(number | undefined)?, (string | undefined)?, (boolean | undefined)?]' but required in type '[number, (string | undefined)?, (boolean | undefined)?]'.
|
||||
Source provides no match for required element at position 0 in target.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/tuple/optionalTupleElements1.ts (7 errors) ====
|
||||
@@ -33,32 +33,32 @@ tests/cases/conformance/types/tuple/optionalTupleElements1.ts(25,5): error TS232
|
||||
t1 = t2; // Error
|
||||
~~
|
||||
!!! error TS2322: Type 'T2' is not assignable to type 'T1'.
|
||||
!!! error TS2322: Property '2' is optional in type '[number, string, (boolean | undefined)?]' but required in type '[number, string, boolean]'.
|
||||
!!! error TS2322: Source provides no match for required element at position 2 in target.
|
||||
t1 = t3; // Error
|
||||
~~
|
||||
!!! error TS2322: Type 'T3' is not assignable to type 'T1'.
|
||||
!!! error TS2322: Property '1' is optional in type '[number, (string | undefined)?, (boolean | undefined)?]' but required in type '[number, string, boolean]'.
|
||||
!!! error TS2322: Source provides no match for required element at position 1 in target.
|
||||
t1 = t4; // Error
|
||||
~~
|
||||
!!! error TS2322: Type 'T4' is not assignable to type 'T1'.
|
||||
!!! error TS2322: Property '0' is optional in type '[(number | undefined)?, (string | undefined)?, (boolean | undefined)?]' but required in type '[number, string, boolean]'.
|
||||
!!! error TS2322: Source provides no match for required element at position 0 in target.
|
||||
t2 = t1;
|
||||
t2 = t2;
|
||||
t2 = t3; // Error
|
||||
~~
|
||||
!!! error TS2322: Type 'T3' is not assignable to type 'T2'.
|
||||
!!! error TS2322: Property '1' is optional in type '[number, (string | undefined)?, (boolean | undefined)?]' but required in type '[number, string, (boolean | undefined)?]'.
|
||||
!!! error TS2322: Source provides no match for required element at position 1 in target.
|
||||
t2 = t4; // Error
|
||||
~~
|
||||
!!! error TS2322: Type 'T4' is not assignable to type 'T2'.
|
||||
!!! error TS2322: Property '0' is optional in type '[(number | undefined)?, (string | undefined)?, (boolean | undefined)?]' but required in type '[number, string, (boolean | undefined)?]'.
|
||||
!!! error TS2322: Source provides no match for required element at position 0 in target.
|
||||
t3 = t1;
|
||||
t3 = t2;
|
||||
t3 = t3;
|
||||
t3 = t4; // Error
|
||||
~~
|
||||
!!! error TS2322: Type 'T4' is not assignable to type 'T3'.
|
||||
!!! error TS2322: Property '0' is optional in type '[(number | undefined)?, (string | undefined)?, (boolean | undefined)?]' but required in type '[number, (string | undefined)?, (boolean | undefined)?]'.
|
||||
!!! error TS2322: Source provides no match for required element at position 0 in target.
|
||||
t4 = t1;
|
||||
t4 = t2;
|
||||
t4 = t3;
|
||||
|
||||
@@ -8,7 +8,9 @@ foo();
|
||||
//// [b.ts]
|
||||
import Foo from "./a";
|
||||
export default function foo() { new Foo(); }
|
||||
|
||||
|
||||
// https://github.com/microsoft/TypeScript/issues/37429
|
||||
import("./a");
|
||||
|
||||
//// [output.js]
|
||||
define("b", ["require", "exports", "a"], function (require, exports, a_1) {
|
||||
@@ -16,6 +18,8 @@ define("b", ["require", "exports", "a"], function (require, exports, a_1) {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
function foo() { new a_1.default(); }
|
||||
exports.default = foo;
|
||||
// https://github.com/microsoft/TypeScript/issues/37429
|
||||
new Promise((resolve_1, reject_1) => { require(["a"], resolve_1, reject_1); });
|
||||
});
|
||||
define("a", ["require", "exports", "b"], function (require, exports, b_1) {
|
||||
"use strict";
|
||||
|
||||
@@ -16,3 +16,7 @@ export default function foo() { new Foo(); }
|
||||
>foo : Symbol(foo, Decl(b.ts, 0, 22))
|
||||
>Foo : Symbol(Foo, Decl(b.ts, 0, 6))
|
||||
|
||||
// https://github.com/microsoft/TypeScript/issues/37429
|
||||
import("./a");
|
||||
>"./a" : Symbol("tests/cases/conformance/es6/moduleExportsAmd/src/a", Decl(a.ts, 0, 0))
|
||||
|
||||
|
||||
@@ -18,3 +18,8 @@ export default function foo() { new Foo(); }
|
||||
>new Foo() : Foo
|
||||
>Foo : typeof Foo
|
||||
|
||||
// https://github.com/microsoft/TypeScript/issues/37429
|
||||
import("./a");
|
||||
>import("./a") : Promise<typeof import("tests/cases/conformance/es6/moduleExportsAmd/src/a")>
|
||||
>"./a" : "./a"
|
||||
|
||||
|
||||
@@ -8,6 +8,9 @@ foo();
|
||||
//// [b.ts]
|
||||
import Foo from "./a";
|
||||
export default function foo() { new Foo(); }
|
||||
|
||||
// https://github.com/microsoft/TypeScript/issues/37429
|
||||
import("./a");
|
||||
|
||||
|
||||
//// [output.js]
|
||||
@@ -24,6 +27,8 @@ System.register("b", ["a"], function (exports_1, context_1) {
|
||||
}
|
||||
],
|
||||
execute: function () {
|
||||
// https://github.com/microsoft/TypeScript/issues/37429
|
||||
context_1.import("a");
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
@@ -16,3 +16,7 @@ export default function foo() { new Foo(); }
|
||||
>foo : Symbol(foo, Decl(b.ts, 0, 22))
|
||||
>Foo : Symbol(Foo, Decl(b.ts, 0, 6))
|
||||
|
||||
// https://github.com/microsoft/TypeScript/issues/37429
|
||||
import("./a");
|
||||
>"./a" : Symbol("tests/cases/conformance/es6/moduleExportsSystem/src/a", Decl(a.ts, 0, 0))
|
||||
|
||||
|
||||
@@ -18,3 +18,8 @@ export default function foo() { new Foo(); }
|
||||
>new Foo() : Foo
|
||||
>Foo : typeof Foo
|
||||
|
||||
// https://github.com/microsoft/TypeScript/issues/37429
|
||||
import("./a");
|
||||
>import("./a") : Promise<typeof import("tests/cases/conformance/es6/moduleExportsSystem/src/a")>
|
||||
>"./a" : "./a"
|
||||
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
//// [privateNameComputedPropertyName1.ts]
|
||||
class A {
|
||||
#a = 'a';
|
||||
#b: string;
|
||||
|
||||
readonly #c = 'c';
|
||||
readonly #d: string;
|
||||
|
||||
#e = '';
|
||||
|
||||
constructor() {
|
||||
this.#b = 'b';
|
||||
this.#d = 'd';
|
||||
}
|
||||
|
||||
test() {
|
||||
const data: Record<string, string> = { a: 'a', b: 'b', c: 'c', d: 'd', e: 'e' };
|
||||
const {
|
||||
[this.#a]: a,
|
||||
[this.#b]: b,
|
||||
[this.#c]: c,
|
||||
[this.#d]: d,
|
||||
[this.#e = 'e']: e,
|
||||
} = data;
|
||||
console.log(a, b, c, d, e);
|
||||
|
||||
const a1 = data[this.#a];
|
||||
const b1 = data[this.#b];
|
||||
const c1 = data[this.#c];
|
||||
const d1 = data[this.#d];
|
||||
const e1 = data[this.#e];
|
||||
console.log(a1, b1, c1, d1);
|
||||
}
|
||||
}
|
||||
|
||||
new A().test();
|
||||
|
||||
|
||||
|
||||
//// [privateNameComputedPropertyName1.js]
|
||||
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to set private field on non-instance");
|
||||
}
|
||||
privateMap.set(receiver, value);
|
||||
return value;
|
||||
};
|
||||
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to get private field on non-instance");
|
||||
}
|
||||
return privateMap.get(receiver);
|
||||
};
|
||||
var _a, _b, _c, _d, _e;
|
||||
class A {
|
||||
constructor() {
|
||||
_a.set(this, 'a');
|
||||
_b.set(this, void 0);
|
||||
_c.set(this, 'c');
|
||||
_d.set(this, void 0);
|
||||
_e.set(this, '');
|
||||
__classPrivateFieldSet(this, _b, 'b');
|
||||
__classPrivateFieldSet(this, _d, 'd');
|
||||
}
|
||||
test() {
|
||||
const data = { a: 'a', b: 'b', c: 'c', d: 'd', e: 'e' };
|
||||
const { [__classPrivateFieldGet(this, _a)]: a, [__classPrivateFieldGet(this, _b)]: b, [__classPrivateFieldGet(this, _c)]: c, [__classPrivateFieldGet(this, _d)]: d, [__classPrivateFieldSet(this, _e, 'e')]: e, } = data;
|
||||
console.log(a, b, c, d, e);
|
||||
const a1 = data[__classPrivateFieldGet(this, _a)];
|
||||
const b1 = data[__classPrivateFieldGet(this, _b)];
|
||||
const c1 = data[__classPrivateFieldGet(this, _c)];
|
||||
const d1 = data[__classPrivateFieldGet(this, _d)];
|
||||
const e1 = data[__classPrivateFieldGet(this, _e)];
|
||||
console.log(a1, b1, c1, d1);
|
||||
}
|
||||
}
|
||||
_a = new WeakMap(), _b = new WeakMap(), _c = new WeakMap(), _d = new WeakMap(), _e = new WeakMap();
|
||||
new A().test();
|
||||
@@ -0,0 +1,127 @@
|
||||
=== tests/cases/conformance/classes/members/privateNames/privateNameComputedPropertyName1.ts ===
|
||||
class A {
|
||||
>A : Symbol(A, Decl(privateNameComputedPropertyName1.ts, 0, 0))
|
||||
|
||||
#a = 'a';
|
||||
>#a : Symbol(A.#a, Decl(privateNameComputedPropertyName1.ts, 0, 9))
|
||||
|
||||
#b: string;
|
||||
>#b : Symbol(A.#b, Decl(privateNameComputedPropertyName1.ts, 1, 13))
|
||||
|
||||
readonly #c = 'c';
|
||||
>#c : Symbol(A.#c, Decl(privateNameComputedPropertyName1.ts, 2, 15))
|
||||
|
||||
readonly #d: string;
|
||||
>#d : Symbol(A.#d, Decl(privateNameComputedPropertyName1.ts, 4, 22))
|
||||
|
||||
#e = '';
|
||||
>#e : Symbol(A.#e, Decl(privateNameComputedPropertyName1.ts, 5, 24))
|
||||
|
||||
constructor() {
|
||||
this.#b = 'b';
|
||||
>this.#b : Symbol(A.#b, Decl(privateNameComputedPropertyName1.ts, 1, 13))
|
||||
>this : Symbol(A, Decl(privateNameComputedPropertyName1.ts, 0, 0))
|
||||
|
||||
this.#d = 'd';
|
||||
>this.#d : Symbol(A.#d, Decl(privateNameComputedPropertyName1.ts, 4, 22))
|
||||
>this : Symbol(A, Decl(privateNameComputedPropertyName1.ts, 0, 0))
|
||||
}
|
||||
|
||||
test() {
|
||||
>test : Symbol(A.test, Decl(privateNameComputedPropertyName1.ts, 12, 5))
|
||||
|
||||
const data: Record<string, string> = { a: 'a', b: 'b', c: 'c', d: 'd', e: 'e' };
|
||||
>data : Symbol(data, Decl(privateNameComputedPropertyName1.ts, 15, 13))
|
||||
>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --))
|
||||
>a : Symbol(a, Decl(privateNameComputedPropertyName1.ts, 15, 46))
|
||||
>b : Symbol(b, Decl(privateNameComputedPropertyName1.ts, 15, 54))
|
||||
>c : Symbol(c, Decl(privateNameComputedPropertyName1.ts, 15, 62))
|
||||
>d : Symbol(d, Decl(privateNameComputedPropertyName1.ts, 15, 70))
|
||||
>e : Symbol(e, Decl(privateNameComputedPropertyName1.ts, 15, 78))
|
||||
|
||||
const {
|
||||
[this.#a]: a,
|
||||
>this.#a : Symbol(A.#a, Decl(privateNameComputedPropertyName1.ts, 0, 9))
|
||||
>this : Symbol(A, Decl(privateNameComputedPropertyName1.ts, 0, 0))
|
||||
>a : Symbol(a, Decl(privateNameComputedPropertyName1.ts, 16, 15))
|
||||
|
||||
[this.#b]: b,
|
||||
>this.#b : Symbol(A.#b, Decl(privateNameComputedPropertyName1.ts, 1, 13))
|
||||
>this : Symbol(A, Decl(privateNameComputedPropertyName1.ts, 0, 0))
|
||||
>b : Symbol(b, Decl(privateNameComputedPropertyName1.ts, 17, 25))
|
||||
|
||||
[this.#c]: c,
|
||||
>this.#c : Symbol(A.#c, Decl(privateNameComputedPropertyName1.ts, 2, 15))
|
||||
>this : Symbol(A, Decl(privateNameComputedPropertyName1.ts, 0, 0))
|
||||
>c : Symbol(c, Decl(privateNameComputedPropertyName1.ts, 18, 25))
|
||||
|
||||
[this.#d]: d,
|
||||
>this.#d : Symbol(A.#d, Decl(privateNameComputedPropertyName1.ts, 4, 22))
|
||||
>this : Symbol(A, Decl(privateNameComputedPropertyName1.ts, 0, 0))
|
||||
>d : Symbol(d, Decl(privateNameComputedPropertyName1.ts, 19, 25))
|
||||
|
||||
[this.#e = 'e']: e,
|
||||
>this.#e : Symbol(A.#e, Decl(privateNameComputedPropertyName1.ts, 5, 24))
|
||||
>this : Symbol(A, Decl(privateNameComputedPropertyName1.ts, 0, 0))
|
||||
>e : Symbol(e, Decl(privateNameComputedPropertyName1.ts, 20, 25))
|
||||
|
||||
} = data;
|
||||
>data : Symbol(data, Decl(privateNameComputedPropertyName1.ts, 15, 13))
|
||||
|
||||
console.log(a, b, c, d, e);
|
||||
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
|
||||
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
|
||||
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
|
||||
>a : Symbol(a, Decl(privateNameComputedPropertyName1.ts, 16, 15))
|
||||
>b : Symbol(b, Decl(privateNameComputedPropertyName1.ts, 17, 25))
|
||||
>c : Symbol(c, Decl(privateNameComputedPropertyName1.ts, 18, 25))
|
||||
>d : Symbol(d, Decl(privateNameComputedPropertyName1.ts, 19, 25))
|
||||
>e : Symbol(e, Decl(privateNameComputedPropertyName1.ts, 20, 25))
|
||||
|
||||
const a1 = data[this.#a];
|
||||
>a1 : Symbol(a1, Decl(privateNameComputedPropertyName1.ts, 25, 13))
|
||||
>data : Symbol(data, Decl(privateNameComputedPropertyName1.ts, 15, 13))
|
||||
>this.#a : Symbol(A.#a, Decl(privateNameComputedPropertyName1.ts, 0, 9))
|
||||
>this : Symbol(A, Decl(privateNameComputedPropertyName1.ts, 0, 0))
|
||||
|
||||
const b1 = data[this.#b];
|
||||
>b1 : Symbol(b1, Decl(privateNameComputedPropertyName1.ts, 26, 13))
|
||||
>data : Symbol(data, Decl(privateNameComputedPropertyName1.ts, 15, 13))
|
||||
>this.#b : Symbol(A.#b, Decl(privateNameComputedPropertyName1.ts, 1, 13))
|
||||
>this : Symbol(A, Decl(privateNameComputedPropertyName1.ts, 0, 0))
|
||||
|
||||
const c1 = data[this.#c];
|
||||
>c1 : Symbol(c1, Decl(privateNameComputedPropertyName1.ts, 27, 13))
|
||||
>data : Symbol(data, Decl(privateNameComputedPropertyName1.ts, 15, 13))
|
||||
>this.#c : Symbol(A.#c, Decl(privateNameComputedPropertyName1.ts, 2, 15))
|
||||
>this : Symbol(A, Decl(privateNameComputedPropertyName1.ts, 0, 0))
|
||||
|
||||
const d1 = data[this.#d];
|
||||
>d1 : Symbol(d1, Decl(privateNameComputedPropertyName1.ts, 28, 13))
|
||||
>data : Symbol(data, Decl(privateNameComputedPropertyName1.ts, 15, 13))
|
||||
>this.#d : Symbol(A.#d, Decl(privateNameComputedPropertyName1.ts, 4, 22))
|
||||
>this : Symbol(A, Decl(privateNameComputedPropertyName1.ts, 0, 0))
|
||||
|
||||
const e1 = data[this.#e];
|
||||
>e1 : Symbol(e1, Decl(privateNameComputedPropertyName1.ts, 29, 13))
|
||||
>data : Symbol(data, Decl(privateNameComputedPropertyName1.ts, 15, 13))
|
||||
>this.#e : Symbol(A.#e, Decl(privateNameComputedPropertyName1.ts, 5, 24))
|
||||
>this : Symbol(A, Decl(privateNameComputedPropertyName1.ts, 0, 0))
|
||||
|
||||
console.log(a1, b1, c1, d1);
|
||||
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
|
||||
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
|
||||
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
|
||||
>a1 : Symbol(a1, Decl(privateNameComputedPropertyName1.ts, 25, 13))
|
||||
>b1 : Symbol(b1, Decl(privateNameComputedPropertyName1.ts, 26, 13))
|
||||
>c1 : Symbol(c1, Decl(privateNameComputedPropertyName1.ts, 27, 13))
|
||||
>d1 : Symbol(d1, Decl(privateNameComputedPropertyName1.ts, 28, 13))
|
||||
}
|
||||
}
|
||||
|
||||
new A().test();
|
||||
>new A().test : Symbol(A.test, Decl(privateNameComputedPropertyName1.ts, 12, 5))
|
||||
>A : Symbol(A, Decl(privateNameComputedPropertyName1.ts, 0, 0))
|
||||
>test : Symbol(A.test, Decl(privateNameComputedPropertyName1.ts, 12, 5))
|
||||
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
=== tests/cases/conformance/classes/members/privateNames/privateNameComputedPropertyName1.ts ===
|
||||
class A {
|
||||
>A : A
|
||||
|
||||
#a = 'a';
|
||||
>#a : string
|
||||
>'a' : "a"
|
||||
|
||||
#b: string;
|
||||
>#b : string
|
||||
|
||||
readonly #c = 'c';
|
||||
>#c : "c"
|
||||
>'c' : "c"
|
||||
|
||||
readonly #d: string;
|
||||
>#d : string
|
||||
|
||||
#e = '';
|
||||
>#e : string
|
||||
>'' : ""
|
||||
|
||||
constructor() {
|
||||
this.#b = 'b';
|
||||
>this.#b = 'b' : "b"
|
||||
>this.#b : string
|
||||
>this : this
|
||||
>'b' : "b"
|
||||
|
||||
this.#d = 'd';
|
||||
>this.#d = 'd' : "d"
|
||||
>this.#d : string
|
||||
>this : this
|
||||
>'d' : "d"
|
||||
}
|
||||
|
||||
test() {
|
||||
>test : () => void
|
||||
|
||||
const data: Record<string, string> = { a: 'a', b: 'b', c: 'c', d: 'd', e: 'e' };
|
||||
>data : Record<string, string>
|
||||
>{ a: 'a', b: 'b', c: 'c', d: 'd', e: 'e' } : { a: string; b: string; c: string; d: string; e: string; }
|
||||
>a : string
|
||||
>'a' : "a"
|
||||
>b : string
|
||||
>'b' : "b"
|
||||
>c : string
|
||||
>'c' : "c"
|
||||
>d : string
|
||||
>'d' : "d"
|
||||
>e : string
|
||||
>'e' : "e"
|
||||
|
||||
const {
|
||||
[this.#a]: a,
|
||||
>this.#a : string
|
||||
>this : this
|
||||
>a : string
|
||||
|
||||
[this.#b]: b,
|
||||
>this.#b : string
|
||||
>this : this
|
||||
>b : string
|
||||
|
||||
[this.#c]: c,
|
||||
>this.#c : "c"
|
||||
>this : this
|
||||
>c : string
|
||||
|
||||
[this.#d]: d,
|
||||
>this.#d : string
|
||||
>this : this
|
||||
>d : string
|
||||
|
||||
[this.#e = 'e']: e,
|
||||
>this.#e = 'e' : "e"
|
||||
>this.#e : string
|
||||
>this : this
|
||||
>'e' : "e"
|
||||
>e : string
|
||||
|
||||
} = data;
|
||||
>data : Record<string, string>
|
||||
|
||||
console.log(a, b, c, d, e);
|
||||
>console.log(a, b, c, d, e) : void
|
||||
>console.log : (...data: any[]) => void
|
||||
>console : Console
|
||||
>log : (...data: any[]) => void
|
||||
>a : string
|
||||
>b : string
|
||||
>c : string
|
||||
>d : string
|
||||
>e : string
|
||||
|
||||
const a1 = data[this.#a];
|
||||
>a1 : string
|
||||
>data[this.#a] : string
|
||||
>data : Record<string, string>
|
||||
>this.#a : string
|
||||
>this : this
|
||||
|
||||
const b1 = data[this.#b];
|
||||
>b1 : string
|
||||
>data[this.#b] : string
|
||||
>data : Record<string, string>
|
||||
>this.#b : string
|
||||
>this : this
|
||||
|
||||
const c1 = data[this.#c];
|
||||
>c1 : string
|
||||
>data[this.#c] : string
|
||||
>data : Record<string, string>
|
||||
>this.#c : "c"
|
||||
>this : this
|
||||
|
||||
const d1 = data[this.#d];
|
||||
>d1 : string
|
||||
>data[this.#d] : string
|
||||
>data : Record<string, string>
|
||||
>this.#d : string
|
||||
>this : this
|
||||
|
||||
const e1 = data[this.#e];
|
||||
>e1 : string
|
||||
>data[this.#e] : string
|
||||
>data : Record<string, string>
|
||||
>this.#e : string
|
||||
>this : this
|
||||
|
||||
console.log(a1, b1, c1, d1);
|
||||
>console.log(a1, b1, c1, d1) : void
|
||||
>console.log : (...data: any[]) => void
|
||||
>console : Console
|
||||
>log : (...data: any[]) => void
|
||||
>a1 : string
|
||||
>b1 : string
|
||||
>c1 : string
|
||||
>d1 : string
|
||||
}
|
||||
}
|
||||
|
||||
new A().test();
|
||||
>new A().test() : void
|
||||
>new A().test : () => void
|
||||
>new A() : A
|
||||
>A : typeof A
|
||||
>test : () => void
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
//// [privateNameComputedPropertyName1.ts]
|
||||
class A {
|
||||
#a = 'a';
|
||||
#b: string;
|
||||
|
||||
readonly #c = 'c';
|
||||
readonly #d: string;
|
||||
|
||||
#e = '';
|
||||
|
||||
constructor() {
|
||||
this.#b = 'b';
|
||||
this.#d = 'd';
|
||||
}
|
||||
|
||||
test() {
|
||||
const data: Record<string, string> = { a: 'a', b: 'b', c: 'c', d: 'd', e: 'e' };
|
||||
const {
|
||||
[this.#a]: a,
|
||||
[this.#b]: b,
|
||||
[this.#c]: c,
|
||||
[this.#d]: d,
|
||||
[this.#e = 'e']: e,
|
||||
} = data;
|
||||
console.log(a, b, c, d, e);
|
||||
|
||||
const a1 = data[this.#a];
|
||||
const b1 = data[this.#b];
|
||||
const c1 = data[this.#c];
|
||||
const d1 = data[this.#d];
|
||||
const e1 = data[this.#e];
|
||||
console.log(a1, b1, c1, d1);
|
||||
}
|
||||
}
|
||||
|
||||
new A().test();
|
||||
|
||||
|
||||
|
||||
//// [privateNameComputedPropertyName1.js]
|
||||
class A {
|
||||
constructor() {
|
||||
this.#a = 'a';
|
||||
this.#c = 'c';
|
||||
this.#e = '';
|
||||
this.#b = 'b';
|
||||
this.#d = 'd';
|
||||
}
|
||||
#a;
|
||||
#b;
|
||||
#c;
|
||||
#d;
|
||||
#e;
|
||||
test() {
|
||||
const data = { a: 'a', b: 'b', c: 'c', d: 'd', e: 'e' };
|
||||
const { [this.#a]: a, [this.#b]: b, [this.#c]: c, [this.#d]: d, [this.#e = 'e']: e, } = data;
|
||||
console.log(a, b, c, d, e);
|
||||
const a1 = data[this.#a];
|
||||
const b1 = data[this.#b];
|
||||
const c1 = data[this.#c];
|
||||
const d1 = data[this.#d];
|
||||
const e1 = data[this.#e];
|
||||
console.log(a1, b1, c1, d1);
|
||||
}
|
||||
}
|
||||
new A().test();
|
||||
@@ -0,0 +1,127 @@
|
||||
=== tests/cases/conformance/classes/members/privateNames/privateNameComputedPropertyName1.ts ===
|
||||
class A {
|
||||
>A : Symbol(A, Decl(privateNameComputedPropertyName1.ts, 0, 0))
|
||||
|
||||
#a = 'a';
|
||||
>#a : Symbol(A.#a, Decl(privateNameComputedPropertyName1.ts, 0, 9))
|
||||
|
||||
#b: string;
|
||||
>#b : Symbol(A.#b, Decl(privateNameComputedPropertyName1.ts, 1, 13))
|
||||
|
||||
readonly #c = 'c';
|
||||
>#c : Symbol(A.#c, Decl(privateNameComputedPropertyName1.ts, 2, 15))
|
||||
|
||||
readonly #d: string;
|
||||
>#d : Symbol(A.#d, Decl(privateNameComputedPropertyName1.ts, 4, 22))
|
||||
|
||||
#e = '';
|
||||
>#e : Symbol(A.#e, Decl(privateNameComputedPropertyName1.ts, 5, 24))
|
||||
|
||||
constructor() {
|
||||
this.#b = 'b';
|
||||
>this.#b : Symbol(A.#b, Decl(privateNameComputedPropertyName1.ts, 1, 13))
|
||||
>this : Symbol(A, Decl(privateNameComputedPropertyName1.ts, 0, 0))
|
||||
|
||||
this.#d = 'd';
|
||||
>this.#d : Symbol(A.#d, Decl(privateNameComputedPropertyName1.ts, 4, 22))
|
||||
>this : Symbol(A, Decl(privateNameComputedPropertyName1.ts, 0, 0))
|
||||
}
|
||||
|
||||
test() {
|
||||
>test : Symbol(A.test, Decl(privateNameComputedPropertyName1.ts, 12, 5))
|
||||
|
||||
const data: Record<string, string> = { a: 'a', b: 'b', c: 'c', d: 'd', e: 'e' };
|
||||
>data : Symbol(data, Decl(privateNameComputedPropertyName1.ts, 15, 13))
|
||||
>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --))
|
||||
>a : Symbol(a, Decl(privateNameComputedPropertyName1.ts, 15, 46))
|
||||
>b : Symbol(b, Decl(privateNameComputedPropertyName1.ts, 15, 54))
|
||||
>c : Symbol(c, Decl(privateNameComputedPropertyName1.ts, 15, 62))
|
||||
>d : Symbol(d, Decl(privateNameComputedPropertyName1.ts, 15, 70))
|
||||
>e : Symbol(e, Decl(privateNameComputedPropertyName1.ts, 15, 78))
|
||||
|
||||
const {
|
||||
[this.#a]: a,
|
||||
>this.#a : Symbol(A.#a, Decl(privateNameComputedPropertyName1.ts, 0, 9))
|
||||
>this : Symbol(A, Decl(privateNameComputedPropertyName1.ts, 0, 0))
|
||||
>a : Symbol(a, Decl(privateNameComputedPropertyName1.ts, 16, 15))
|
||||
|
||||
[this.#b]: b,
|
||||
>this.#b : Symbol(A.#b, Decl(privateNameComputedPropertyName1.ts, 1, 13))
|
||||
>this : Symbol(A, Decl(privateNameComputedPropertyName1.ts, 0, 0))
|
||||
>b : Symbol(b, Decl(privateNameComputedPropertyName1.ts, 17, 25))
|
||||
|
||||
[this.#c]: c,
|
||||
>this.#c : Symbol(A.#c, Decl(privateNameComputedPropertyName1.ts, 2, 15))
|
||||
>this : Symbol(A, Decl(privateNameComputedPropertyName1.ts, 0, 0))
|
||||
>c : Symbol(c, Decl(privateNameComputedPropertyName1.ts, 18, 25))
|
||||
|
||||
[this.#d]: d,
|
||||
>this.#d : Symbol(A.#d, Decl(privateNameComputedPropertyName1.ts, 4, 22))
|
||||
>this : Symbol(A, Decl(privateNameComputedPropertyName1.ts, 0, 0))
|
||||
>d : Symbol(d, Decl(privateNameComputedPropertyName1.ts, 19, 25))
|
||||
|
||||
[this.#e = 'e']: e,
|
||||
>this.#e : Symbol(A.#e, Decl(privateNameComputedPropertyName1.ts, 5, 24))
|
||||
>this : Symbol(A, Decl(privateNameComputedPropertyName1.ts, 0, 0))
|
||||
>e : Symbol(e, Decl(privateNameComputedPropertyName1.ts, 20, 25))
|
||||
|
||||
} = data;
|
||||
>data : Symbol(data, Decl(privateNameComputedPropertyName1.ts, 15, 13))
|
||||
|
||||
console.log(a, b, c, d, e);
|
||||
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
|
||||
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
|
||||
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
|
||||
>a : Symbol(a, Decl(privateNameComputedPropertyName1.ts, 16, 15))
|
||||
>b : Symbol(b, Decl(privateNameComputedPropertyName1.ts, 17, 25))
|
||||
>c : Symbol(c, Decl(privateNameComputedPropertyName1.ts, 18, 25))
|
||||
>d : Symbol(d, Decl(privateNameComputedPropertyName1.ts, 19, 25))
|
||||
>e : Symbol(e, Decl(privateNameComputedPropertyName1.ts, 20, 25))
|
||||
|
||||
const a1 = data[this.#a];
|
||||
>a1 : Symbol(a1, Decl(privateNameComputedPropertyName1.ts, 25, 13))
|
||||
>data : Symbol(data, Decl(privateNameComputedPropertyName1.ts, 15, 13))
|
||||
>this.#a : Symbol(A.#a, Decl(privateNameComputedPropertyName1.ts, 0, 9))
|
||||
>this : Symbol(A, Decl(privateNameComputedPropertyName1.ts, 0, 0))
|
||||
|
||||
const b1 = data[this.#b];
|
||||
>b1 : Symbol(b1, Decl(privateNameComputedPropertyName1.ts, 26, 13))
|
||||
>data : Symbol(data, Decl(privateNameComputedPropertyName1.ts, 15, 13))
|
||||
>this.#b : Symbol(A.#b, Decl(privateNameComputedPropertyName1.ts, 1, 13))
|
||||
>this : Symbol(A, Decl(privateNameComputedPropertyName1.ts, 0, 0))
|
||||
|
||||
const c1 = data[this.#c];
|
||||
>c1 : Symbol(c1, Decl(privateNameComputedPropertyName1.ts, 27, 13))
|
||||
>data : Symbol(data, Decl(privateNameComputedPropertyName1.ts, 15, 13))
|
||||
>this.#c : Symbol(A.#c, Decl(privateNameComputedPropertyName1.ts, 2, 15))
|
||||
>this : Symbol(A, Decl(privateNameComputedPropertyName1.ts, 0, 0))
|
||||
|
||||
const d1 = data[this.#d];
|
||||
>d1 : Symbol(d1, Decl(privateNameComputedPropertyName1.ts, 28, 13))
|
||||
>data : Symbol(data, Decl(privateNameComputedPropertyName1.ts, 15, 13))
|
||||
>this.#d : Symbol(A.#d, Decl(privateNameComputedPropertyName1.ts, 4, 22))
|
||||
>this : Symbol(A, Decl(privateNameComputedPropertyName1.ts, 0, 0))
|
||||
|
||||
const e1 = data[this.#e];
|
||||
>e1 : Symbol(e1, Decl(privateNameComputedPropertyName1.ts, 29, 13))
|
||||
>data : Symbol(data, Decl(privateNameComputedPropertyName1.ts, 15, 13))
|
||||
>this.#e : Symbol(A.#e, Decl(privateNameComputedPropertyName1.ts, 5, 24))
|
||||
>this : Symbol(A, Decl(privateNameComputedPropertyName1.ts, 0, 0))
|
||||
|
||||
console.log(a1, b1, c1, d1);
|
||||
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
|
||||
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
|
||||
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
|
||||
>a1 : Symbol(a1, Decl(privateNameComputedPropertyName1.ts, 25, 13))
|
||||
>b1 : Symbol(b1, Decl(privateNameComputedPropertyName1.ts, 26, 13))
|
||||
>c1 : Symbol(c1, Decl(privateNameComputedPropertyName1.ts, 27, 13))
|
||||
>d1 : Symbol(d1, Decl(privateNameComputedPropertyName1.ts, 28, 13))
|
||||
}
|
||||
}
|
||||
|
||||
new A().test();
|
||||
>new A().test : Symbol(A.test, Decl(privateNameComputedPropertyName1.ts, 12, 5))
|
||||
>A : Symbol(A, Decl(privateNameComputedPropertyName1.ts, 0, 0))
|
||||
>test : Symbol(A.test, Decl(privateNameComputedPropertyName1.ts, 12, 5))
|
||||
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
=== tests/cases/conformance/classes/members/privateNames/privateNameComputedPropertyName1.ts ===
|
||||
class A {
|
||||
>A : A
|
||||
|
||||
#a = 'a';
|
||||
>#a : string
|
||||
>'a' : "a"
|
||||
|
||||
#b: string;
|
||||
>#b : string
|
||||
|
||||
readonly #c = 'c';
|
||||
>#c : "c"
|
||||
>'c' : "c"
|
||||
|
||||
readonly #d: string;
|
||||
>#d : string
|
||||
|
||||
#e = '';
|
||||
>#e : string
|
||||
>'' : ""
|
||||
|
||||
constructor() {
|
||||
this.#b = 'b';
|
||||
>this.#b = 'b' : "b"
|
||||
>this.#b : string
|
||||
>this : this
|
||||
>'b' : "b"
|
||||
|
||||
this.#d = 'd';
|
||||
>this.#d = 'd' : "d"
|
||||
>this.#d : string
|
||||
>this : this
|
||||
>'d' : "d"
|
||||
}
|
||||
|
||||
test() {
|
||||
>test : () => void
|
||||
|
||||
const data: Record<string, string> = { a: 'a', b: 'b', c: 'c', d: 'd', e: 'e' };
|
||||
>data : Record<string, string>
|
||||
>{ a: 'a', b: 'b', c: 'c', d: 'd', e: 'e' } : { a: string; b: string; c: string; d: string; e: string; }
|
||||
>a : string
|
||||
>'a' : "a"
|
||||
>b : string
|
||||
>'b' : "b"
|
||||
>c : string
|
||||
>'c' : "c"
|
||||
>d : string
|
||||
>'d' : "d"
|
||||
>e : string
|
||||
>'e' : "e"
|
||||
|
||||
const {
|
||||
[this.#a]: a,
|
||||
>this.#a : string
|
||||
>this : this
|
||||
>a : string
|
||||
|
||||
[this.#b]: b,
|
||||
>this.#b : string
|
||||
>this : this
|
||||
>b : string
|
||||
|
||||
[this.#c]: c,
|
||||
>this.#c : "c"
|
||||
>this : this
|
||||
>c : string
|
||||
|
||||
[this.#d]: d,
|
||||
>this.#d : string
|
||||
>this : this
|
||||
>d : string
|
||||
|
||||
[this.#e = 'e']: e,
|
||||
>this.#e = 'e' : "e"
|
||||
>this.#e : string
|
||||
>this : this
|
||||
>'e' : "e"
|
||||
>e : string
|
||||
|
||||
} = data;
|
||||
>data : Record<string, string>
|
||||
|
||||
console.log(a, b, c, d, e);
|
||||
>console.log(a, b, c, d, e) : void
|
||||
>console.log : (...data: any[]) => void
|
||||
>console : Console
|
||||
>log : (...data: any[]) => void
|
||||
>a : string
|
||||
>b : string
|
||||
>c : string
|
||||
>d : string
|
||||
>e : string
|
||||
|
||||
const a1 = data[this.#a];
|
||||
>a1 : string
|
||||
>data[this.#a] : string
|
||||
>data : Record<string, string>
|
||||
>this.#a : string
|
||||
>this : this
|
||||
|
||||
const b1 = data[this.#b];
|
||||
>b1 : string
|
||||
>data[this.#b] : string
|
||||
>data : Record<string, string>
|
||||
>this.#b : string
|
||||
>this : this
|
||||
|
||||
const c1 = data[this.#c];
|
||||
>c1 : string
|
||||
>data[this.#c] : string
|
||||
>data : Record<string, string>
|
||||
>this.#c : "c"
|
||||
>this : this
|
||||
|
||||
const d1 = data[this.#d];
|
||||
>d1 : string
|
||||
>data[this.#d] : string
|
||||
>data : Record<string, string>
|
||||
>this.#d : string
|
||||
>this : this
|
||||
|
||||
const e1 = data[this.#e];
|
||||
>e1 : string
|
||||
>data[this.#e] : string
|
||||
>data : Record<string, string>
|
||||
>this.#e : string
|
||||
>this : this
|
||||
|
||||
console.log(a1, b1, c1, d1);
|
||||
>console.log(a1, b1, c1, d1) : void
|
||||
>console.log : (...data: any[]) => void
|
||||
>console : Console
|
||||
>log : (...data: any[]) => void
|
||||
>a1 : string
|
||||
>b1 : string
|
||||
>c1 : string
|
||||
>d1 : string
|
||||
}
|
||||
}
|
||||
|
||||
new A().test();
|
||||
>new A().test() : void
|
||||
>new A().test : () => void
|
||||
>new A() : A
|
||||
>A : typeof A
|
||||
>test : () => void
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
//// [privateNameComputedPropertyName2.ts]
|
||||
let getX: (a: A) => number;
|
||||
|
||||
class A {
|
||||
#x = 100;
|
||||
[(getX = (a: A) => a.#x, "_")]() {}
|
||||
}
|
||||
|
||||
console.log(getX(new A));
|
||||
|
||||
|
||||
//// [privateNameComputedPropertyName2.js]
|
||||
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to get private field on non-instance");
|
||||
}
|
||||
return privateMap.get(receiver);
|
||||
};
|
||||
var _x;
|
||||
let getX;
|
||||
class A {
|
||||
constructor() {
|
||||
_x.set(this, 100);
|
||||
}
|
||||
[(_x = new WeakMap(), (getX = (a) => __classPrivateFieldGet(a, _x), "_"))]() { }
|
||||
}
|
||||
console.log(getX(new A));
|
||||
@@ -0,0 +1,28 @@
|
||||
=== tests/cases/conformance/classes/members/privateNames/privateNameComputedPropertyName2.ts ===
|
||||
let getX: (a: A) => number;
|
||||
>getX : Symbol(getX, Decl(privateNameComputedPropertyName2.ts, 0, 3))
|
||||
>a : Symbol(a, Decl(privateNameComputedPropertyName2.ts, 0, 11))
|
||||
>A : Symbol(A, Decl(privateNameComputedPropertyName2.ts, 0, 27))
|
||||
|
||||
class A {
|
||||
>A : Symbol(A, Decl(privateNameComputedPropertyName2.ts, 0, 27))
|
||||
|
||||
#x = 100;
|
||||
>#x : Symbol(A.#x, Decl(privateNameComputedPropertyName2.ts, 2, 9))
|
||||
|
||||
[(getX = (a: A) => a.#x, "_")]() {}
|
||||
>[(getX = (a: A) => a.#x, "_")] : Symbol(A[(getX = (a: A) => a.#x, "_")], Decl(privateNameComputedPropertyName2.ts, 3, 13))
|
||||
>getX : Symbol(getX, Decl(privateNameComputedPropertyName2.ts, 0, 3))
|
||||
>a : Symbol(a, Decl(privateNameComputedPropertyName2.ts, 4, 14))
|
||||
>A : Symbol(A, Decl(privateNameComputedPropertyName2.ts, 0, 27))
|
||||
>a.#x : Symbol(A.#x, Decl(privateNameComputedPropertyName2.ts, 2, 9))
|
||||
>a : Symbol(a, Decl(privateNameComputedPropertyName2.ts, 4, 14))
|
||||
}
|
||||
|
||||
console.log(getX(new A));
|
||||
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
|
||||
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
|
||||
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
|
||||
>getX : Symbol(getX, Decl(privateNameComputedPropertyName2.ts, 0, 3))
|
||||
>A : Symbol(A, Decl(privateNameComputedPropertyName2.ts, 0, 27))
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
=== tests/cases/conformance/classes/members/privateNames/privateNameComputedPropertyName2.ts ===
|
||||
let getX: (a: A) => number;
|
||||
>getX : (a: A) => number
|
||||
>a : A
|
||||
|
||||
class A {
|
||||
>A : A
|
||||
|
||||
#x = 100;
|
||||
>#x : number
|
||||
>100 : 100
|
||||
|
||||
[(getX = (a: A) => a.#x, "_")]() {}
|
||||
>[(getX = (a: A) => a.#x, "_")] : () => void
|
||||
>(getX = (a: A) => a.#x, "_") : "_"
|
||||
>getX = (a: A) => a.#x, "_" : "_"
|
||||
>getX = (a: A) => a.#x : (a: A) => number
|
||||
>getX : (a: A) => number
|
||||
>(a: A) => a.#x : (a: A) => number
|
||||
>a : A
|
||||
>a.#x : number
|
||||
>a : A
|
||||
>"_" : "_"
|
||||
}
|
||||
|
||||
console.log(getX(new A));
|
||||
>console.log(getX(new A)) : void
|
||||
>console.log : (...data: any[]) => void
|
||||
>console : Console
|
||||
>log : (...data: any[]) => void
|
||||
>getX(new A) : number
|
||||
>getX : (a: A) => number
|
||||
>new A : A
|
||||
>A : typeof A
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
//// [privateNameComputedPropertyName2.ts]
|
||||
let getX: (a: A) => number;
|
||||
|
||||
class A {
|
||||
#x = 100;
|
||||
[(getX = (a: A) => a.#x, "_")]() {}
|
||||
}
|
||||
|
||||
console.log(getX(new A));
|
||||
|
||||
|
||||
//// [privateNameComputedPropertyName2.js]
|
||||
let getX;
|
||||
class A {
|
||||
constructor() {
|
||||
this.#x = 100;
|
||||
}
|
||||
#x;
|
||||
[(getX = (a) => a.#x, "_")]() { }
|
||||
}
|
||||
console.log(getX(new A));
|
||||
@@ -0,0 +1,28 @@
|
||||
=== tests/cases/conformance/classes/members/privateNames/privateNameComputedPropertyName2.ts ===
|
||||
let getX: (a: A) => number;
|
||||
>getX : Symbol(getX, Decl(privateNameComputedPropertyName2.ts, 0, 3))
|
||||
>a : Symbol(a, Decl(privateNameComputedPropertyName2.ts, 0, 11))
|
||||
>A : Symbol(A, Decl(privateNameComputedPropertyName2.ts, 0, 27))
|
||||
|
||||
class A {
|
||||
>A : Symbol(A, Decl(privateNameComputedPropertyName2.ts, 0, 27))
|
||||
|
||||
#x = 100;
|
||||
>#x : Symbol(A.#x, Decl(privateNameComputedPropertyName2.ts, 2, 9))
|
||||
|
||||
[(getX = (a: A) => a.#x, "_")]() {}
|
||||
>[(getX = (a: A) => a.#x, "_")] : Symbol(A[(getX = (a: A) => a.#x, "_")], Decl(privateNameComputedPropertyName2.ts, 3, 13))
|
||||
>getX : Symbol(getX, Decl(privateNameComputedPropertyName2.ts, 0, 3))
|
||||
>a : Symbol(a, Decl(privateNameComputedPropertyName2.ts, 4, 14))
|
||||
>A : Symbol(A, Decl(privateNameComputedPropertyName2.ts, 0, 27))
|
||||
>a.#x : Symbol(A.#x, Decl(privateNameComputedPropertyName2.ts, 2, 9))
|
||||
>a : Symbol(a, Decl(privateNameComputedPropertyName2.ts, 4, 14))
|
||||
}
|
||||
|
||||
console.log(getX(new A));
|
||||
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
|
||||
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
|
||||
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
|
||||
>getX : Symbol(getX, Decl(privateNameComputedPropertyName2.ts, 0, 3))
|
||||
>A : Symbol(A, Decl(privateNameComputedPropertyName2.ts, 0, 27))
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
=== tests/cases/conformance/classes/members/privateNames/privateNameComputedPropertyName2.ts ===
|
||||
let getX: (a: A) => number;
|
||||
>getX : (a: A) => number
|
||||
>a : A
|
||||
|
||||
class A {
|
||||
>A : A
|
||||
|
||||
#x = 100;
|
||||
>#x : number
|
||||
>100 : 100
|
||||
|
||||
[(getX = (a: A) => a.#x, "_")]() {}
|
||||
>[(getX = (a: A) => a.#x, "_")] : () => void
|
||||
>(getX = (a: A) => a.#x, "_") : "_"
|
||||
>getX = (a: A) => a.#x, "_" : "_"
|
||||
>getX = (a: A) => a.#x : (a: A) => number
|
||||
>getX : (a: A) => number
|
||||
>(a: A) => a.#x : (a: A) => number
|
||||
>a : A
|
||||
>a.#x : number
|
||||
>a : A
|
||||
>"_" : "_"
|
||||
}
|
||||
|
||||
console.log(getX(new A));
|
||||
>console.log(getX(new A)) : void
|
||||
>console.log : (...data: any[]) => void
|
||||
>console : Console
|
||||
>log : (...data: any[]) => void
|
||||
>getX(new A) : number
|
||||
>getX : (a: A) => number
|
||||
>new A : A
|
||||
>A : typeof A
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
//// [privateNameComputedPropertyName3.ts]
|
||||
class Foo {
|
||||
#name;
|
||||
|
||||
constructor(name) {
|
||||
this.#name = name;
|
||||
}
|
||||
|
||||
getValue(x) {
|
||||
const obj = this;
|
||||
|
||||
class Bar {
|
||||
#y = 100;
|
||||
|
||||
[obj.#name]() {
|
||||
return x + this.#y;
|
||||
}
|
||||
}
|
||||
|
||||
return new Bar()[obj.#name]();
|
||||
}
|
||||
}
|
||||
|
||||
console.log(new Foo("NAME").getValue(100));
|
||||
|
||||
|
||||
//// [privateNameComputedPropertyName3.js]
|
||||
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to set private field on non-instance");
|
||||
}
|
||||
privateMap.set(receiver, value);
|
||||
return value;
|
||||
};
|
||||
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to get private field on non-instance");
|
||||
}
|
||||
return privateMap.get(receiver);
|
||||
};
|
||||
var _name;
|
||||
class Foo {
|
||||
constructor(name) {
|
||||
_name.set(this, void 0);
|
||||
__classPrivateFieldSet(this, _name, name);
|
||||
}
|
||||
getValue(x) {
|
||||
var _y;
|
||||
const obj = this;
|
||||
class Bar {
|
||||
constructor() {
|
||||
_y.set(this, 100);
|
||||
}
|
||||
[(_y = new WeakMap(), __classPrivateFieldGet(obj, _name))]() {
|
||||
return x + __classPrivateFieldGet(this, _y);
|
||||
}
|
||||
}
|
||||
return new Bar()[__classPrivateFieldGet(obj, _name)]();
|
||||
}
|
||||
}
|
||||
_name = new WeakMap();
|
||||
console.log(new Foo("NAME").getValue(100));
|
||||
@@ -0,0 +1,57 @@
|
||||
=== tests/cases/conformance/classes/members/privateNames/privateNameComputedPropertyName3.ts ===
|
||||
class Foo {
|
||||
>Foo : Symbol(Foo, Decl(privateNameComputedPropertyName3.ts, 0, 0))
|
||||
|
||||
#name;
|
||||
>#name : Symbol(Foo.#name, Decl(privateNameComputedPropertyName3.ts, 0, 11))
|
||||
|
||||
constructor(name) {
|
||||
>name : Symbol(name, Decl(privateNameComputedPropertyName3.ts, 3, 16))
|
||||
|
||||
this.#name = name;
|
||||
>this.#name : Symbol(Foo.#name, Decl(privateNameComputedPropertyName3.ts, 0, 11))
|
||||
>this : Symbol(Foo, Decl(privateNameComputedPropertyName3.ts, 0, 0))
|
||||
>name : Symbol(name, Decl(privateNameComputedPropertyName3.ts, 3, 16))
|
||||
}
|
||||
|
||||
getValue(x) {
|
||||
>getValue : Symbol(Foo.getValue, Decl(privateNameComputedPropertyName3.ts, 5, 5))
|
||||
>x : Symbol(x, Decl(privateNameComputedPropertyName3.ts, 7, 13))
|
||||
|
||||
const obj = this;
|
||||
>obj : Symbol(obj, Decl(privateNameComputedPropertyName3.ts, 8, 13))
|
||||
>this : Symbol(Foo, Decl(privateNameComputedPropertyName3.ts, 0, 0))
|
||||
|
||||
class Bar {
|
||||
>Bar : Symbol(Bar, Decl(privateNameComputedPropertyName3.ts, 8, 25))
|
||||
|
||||
#y = 100;
|
||||
>#y : Symbol(Bar.#y, Decl(privateNameComputedPropertyName3.ts, 10, 19))
|
||||
|
||||
[obj.#name]() {
|
||||
>[obj.#name] : Symbol(Bar[obj.#name], Decl(privateNameComputedPropertyName3.ts, 11, 21))
|
||||
>obj.#name : Symbol(Foo.#name, Decl(privateNameComputedPropertyName3.ts, 0, 11))
|
||||
>obj : Symbol(obj, Decl(privateNameComputedPropertyName3.ts, 8, 13))
|
||||
|
||||
return x + this.#y;
|
||||
>x : Symbol(x, Decl(privateNameComputedPropertyName3.ts, 7, 13))
|
||||
>this.#y : Symbol(Bar.#y, Decl(privateNameComputedPropertyName3.ts, 10, 19))
|
||||
>this : Symbol(Bar, Decl(privateNameComputedPropertyName3.ts, 8, 25))
|
||||
}
|
||||
}
|
||||
|
||||
return new Bar()[obj.#name]();
|
||||
>Bar : Symbol(Bar, Decl(privateNameComputedPropertyName3.ts, 8, 25))
|
||||
>obj.#name : Symbol(Foo.#name, Decl(privateNameComputedPropertyName3.ts, 0, 11))
|
||||
>obj : Symbol(obj, Decl(privateNameComputedPropertyName3.ts, 8, 13))
|
||||
}
|
||||
}
|
||||
|
||||
console.log(new Foo("NAME").getValue(100));
|
||||
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
|
||||
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
|
||||
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
|
||||
>new Foo("NAME").getValue : Symbol(Foo.getValue, Decl(privateNameComputedPropertyName3.ts, 5, 5))
|
||||
>Foo : Symbol(Foo, Decl(privateNameComputedPropertyName3.ts, 0, 0))
|
||||
>getValue : Symbol(Foo.getValue, Decl(privateNameComputedPropertyName3.ts, 5, 5))
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
=== tests/cases/conformance/classes/members/privateNames/privateNameComputedPropertyName3.ts ===
|
||||
class Foo {
|
||||
>Foo : Foo
|
||||
|
||||
#name;
|
||||
>#name : any
|
||||
|
||||
constructor(name) {
|
||||
>name : any
|
||||
|
||||
this.#name = name;
|
||||
>this.#name = name : any
|
||||
>this.#name : any
|
||||
>this : this
|
||||
>name : any
|
||||
}
|
||||
|
||||
getValue(x) {
|
||||
>getValue : (x: any) => any
|
||||
>x : any
|
||||
|
||||
const obj = this;
|
||||
>obj : this
|
||||
>this : this
|
||||
|
||||
class Bar {
|
||||
>Bar : Bar
|
||||
|
||||
#y = 100;
|
||||
>#y : number
|
||||
>100 : 100
|
||||
|
||||
[obj.#name]() {
|
||||
>[obj.#name] : () => any
|
||||
>obj.#name : any
|
||||
>obj : this
|
||||
|
||||
return x + this.#y;
|
||||
>x + this.#y : any
|
||||
>x : any
|
||||
>this.#y : number
|
||||
>this : this
|
||||
}
|
||||
}
|
||||
|
||||
return new Bar()[obj.#name]();
|
||||
>new Bar()[obj.#name]() : error
|
||||
>new Bar()[obj.#name] : error
|
||||
>new Bar() : Bar
|
||||
>Bar : typeof Bar
|
||||
>obj.#name : any
|
||||
>obj : this
|
||||
}
|
||||
}
|
||||
|
||||
console.log(new Foo("NAME").getValue(100));
|
||||
>console.log(new Foo("NAME").getValue(100)) : void
|
||||
>console.log : (...data: any[]) => void
|
||||
>console : Console
|
||||
>log : (...data: any[]) => void
|
||||
>new Foo("NAME").getValue(100) : error
|
||||
>new Foo("NAME").getValue : (x: any) => any
|
||||
>new Foo("NAME") : Foo
|
||||
>Foo : typeof Foo
|
||||
>"NAME" : "NAME"
|
||||
>getValue : (x: any) => any
|
||||
>100 : 100
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
//// [privateNameComputedPropertyName3.ts]
|
||||
class Foo {
|
||||
#name;
|
||||
|
||||
constructor(name) {
|
||||
this.#name = name;
|
||||
}
|
||||
|
||||
getValue(x) {
|
||||
const obj = this;
|
||||
|
||||
class Bar {
|
||||
#y = 100;
|
||||
|
||||
[obj.#name]() {
|
||||
return x + this.#y;
|
||||
}
|
||||
}
|
||||
|
||||
return new Bar()[obj.#name]();
|
||||
}
|
||||
}
|
||||
|
||||
console.log(new Foo("NAME").getValue(100));
|
||||
|
||||
|
||||
//// [privateNameComputedPropertyName3.js]
|
||||
class Foo {
|
||||
constructor(name) {
|
||||
this.#name = name;
|
||||
}
|
||||
#name;
|
||||
getValue(x) {
|
||||
const obj = this;
|
||||
class Bar {
|
||||
constructor() {
|
||||
this.#y = 100;
|
||||
}
|
||||
#y;
|
||||
[obj.#name]() {
|
||||
return x + this.#y;
|
||||
}
|
||||
}
|
||||
return new Bar()[obj.#name]();
|
||||
}
|
||||
}
|
||||
console.log(new Foo("NAME").getValue(100));
|
||||
@@ -0,0 +1,57 @@
|
||||
=== tests/cases/conformance/classes/members/privateNames/privateNameComputedPropertyName3.ts ===
|
||||
class Foo {
|
||||
>Foo : Symbol(Foo, Decl(privateNameComputedPropertyName3.ts, 0, 0))
|
||||
|
||||
#name;
|
||||
>#name : Symbol(Foo.#name, Decl(privateNameComputedPropertyName3.ts, 0, 11))
|
||||
|
||||
constructor(name) {
|
||||
>name : Symbol(name, Decl(privateNameComputedPropertyName3.ts, 3, 16))
|
||||
|
||||
this.#name = name;
|
||||
>this.#name : Symbol(Foo.#name, Decl(privateNameComputedPropertyName3.ts, 0, 11))
|
||||
>this : Symbol(Foo, Decl(privateNameComputedPropertyName3.ts, 0, 0))
|
||||
>name : Symbol(name, Decl(privateNameComputedPropertyName3.ts, 3, 16))
|
||||
}
|
||||
|
||||
getValue(x) {
|
||||
>getValue : Symbol(Foo.getValue, Decl(privateNameComputedPropertyName3.ts, 5, 5))
|
||||
>x : Symbol(x, Decl(privateNameComputedPropertyName3.ts, 7, 13))
|
||||
|
||||
const obj = this;
|
||||
>obj : Symbol(obj, Decl(privateNameComputedPropertyName3.ts, 8, 13))
|
||||
>this : Symbol(Foo, Decl(privateNameComputedPropertyName3.ts, 0, 0))
|
||||
|
||||
class Bar {
|
||||
>Bar : Symbol(Bar, Decl(privateNameComputedPropertyName3.ts, 8, 25))
|
||||
|
||||
#y = 100;
|
||||
>#y : Symbol(Bar.#y, Decl(privateNameComputedPropertyName3.ts, 10, 19))
|
||||
|
||||
[obj.#name]() {
|
||||
>[obj.#name] : Symbol(Bar[obj.#name], Decl(privateNameComputedPropertyName3.ts, 11, 21))
|
||||
>obj.#name : Symbol(Foo.#name, Decl(privateNameComputedPropertyName3.ts, 0, 11))
|
||||
>obj : Symbol(obj, Decl(privateNameComputedPropertyName3.ts, 8, 13))
|
||||
|
||||
return x + this.#y;
|
||||
>x : Symbol(x, Decl(privateNameComputedPropertyName3.ts, 7, 13))
|
||||
>this.#y : Symbol(Bar.#y, Decl(privateNameComputedPropertyName3.ts, 10, 19))
|
||||
>this : Symbol(Bar, Decl(privateNameComputedPropertyName3.ts, 8, 25))
|
||||
}
|
||||
}
|
||||
|
||||
return new Bar()[obj.#name]();
|
||||
>Bar : Symbol(Bar, Decl(privateNameComputedPropertyName3.ts, 8, 25))
|
||||
>obj.#name : Symbol(Foo.#name, Decl(privateNameComputedPropertyName3.ts, 0, 11))
|
||||
>obj : Symbol(obj, Decl(privateNameComputedPropertyName3.ts, 8, 13))
|
||||
}
|
||||
}
|
||||
|
||||
console.log(new Foo("NAME").getValue(100));
|
||||
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
|
||||
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
|
||||
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
|
||||
>new Foo("NAME").getValue : Symbol(Foo.getValue, Decl(privateNameComputedPropertyName3.ts, 5, 5))
|
||||
>Foo : Symbol(Foo, Decl(privateNameComputedPropertyName3.ts, 0, 0))
|
||||
>getValue : Symbol(Foo.getValue, Decl(privateNameComputedPropertyName3.ts, 5, 5))
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
=== tests/cases/conformance/classes/members/privateNames/privateNameComputedPropertyName3.ts ===
|
||||
class Foo {
|
||||
>Foo : Foo
|
||||
|
||||
#name;
|
||||
>#name : any
|
||||
|
||||
constructor(name) {
|
||||
>name : any
|
||||
|
||||
this.#name = name;
|
||||
>this.#name = name : any
|
||||
>this.#name : any
|
||||
>this : this
|
||||
>name : any
|
||||
}
|
||||
|
||||
getValue(x) {
|
||||
>getValue : (x: any) => any
|
||||
>x : any
|
||||
|
||||
const obj = this;
|
||||
>obj : this
|
||||
>this : this
|
||||
|
||||
class Bar {
|
||||
>Bar : Bar
|
||||
|
||||
#y = 100;
|
||||
>#y : number
|
||||
>100 : 100
|
||||
|
||||
[obj.#name]() {
|
||||
>[obj.#name] : () => any
|
||||
>obj.#name : any
|
||||
>obj : this
|
||||
|
||||
return x + this.#y;
|
||||
>x + this.#y : any
|
||||
>x : any
|
||||
>this.#y : number
|
||||
>this : this
|
||||
}
|
||||
}
|
||||
|
||||
return new Bar()[obj.#name]();
|
||||
>new Bar()[obj.#name]() : error
|
||||
>new Bar()[obj.#name] : error
|
||||
>new Bar() : Bar
|
||||
>Bar : typeof Bar
|
||||
>obj.#name : any
|
||||
>obj : this
|
||||
}
|
||||
}
|
||||
|
||||
console.log(new Foo("NAME").getValue(100));
|
||||
>console.log(new Foo("NAME").getValue(100)) : void
|
||||
>console.log : (...data: any[]) => void
|
||||
>console : Console
|
||||
>log : (...data: any[]) => void
|
||||
>new Foo("NAME").getValue(100) : error
|
||||
>new Foo("NAME").getValue : (x: any) => any
|
||||
>new Foo("NAME") : Foo
|
||||
>Foo : typeof Foo
|
||||
>"NAME" : "NAME"
|
||||
>getValue : (x: any) => any
|
||||
>100 : 100
|
||||
|
||||
@@ -5,7 +5,6 @@ tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx(27,36): error TS2769:
|
||||
Type 'void' is not assignable to type 'boolean'.
|
||||
Overload 2 of 2, '(props: Props, context?: any): FieldFeedback<Props>', gave the following error.
|
||||
Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'.
|
||||
Type '(value: string) => void' is not assignable to type '(value: string) => boolean'.
|
||||
tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx(43,41): error TS2769: No overload matches this call.
|
||||
Overload 1 of 2, '(props: Readonly<Props>): FieldFeedbackBeta<Props>', gave the following error.
|
||||
Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'.
|
||||
@@ -13,7 +12,6 @@ tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx(43,41): error TS2769:
|
||||
Type 'void' is not assignable to type 'boolean'.
|
||||
Overload 2 of 2, '(props: Props, context?: any): FieldFeedbackBeta<Props>', gave the following error.
|
||||
Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'.
|
||||
Type '(value: string) => void' is not assignable to type '(value: string) => boolean'.
|
||||
tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx(64,37): error TS2769: No overload matches this call.
|
||||
Overload 1 of 2, '(props: Readonly<MyPropsProps>): FieldFeedback2<MyPropsProps>', gave the following error.
|
||||
Type '(value: string) => void' is not assignable to type '(value: string) => boolean'.
|
||||
@@ -58,7 +56,6 @@ tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx(64,37): error TS2769:
|
||||
!!! error TS2769: Type 'void' is not assignable to type 'boolean'.
|
||||
!!! error TS2769: Overload 2 of 2, '(props: Props, context?: any): FieldFeedback<Props>', gave the following error.
|
||||
!!! error TS2769: Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'.
|
||||
!!! error TS2769: Type '(value: string) => void' is not assignable to type '(value: string) => boolean'.
|
||||
!!! related TS6500 tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx:6:3: The expected type comes from property 'when' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<FieldFeedback<Props>> & Pick<Readonly<{ children?: ReactNode; }> & Readonly<Props>, "children" | "error"> & Partial<Pick<Readonly<{ children?: ReactNode; }> & Readonly<Props>, "when">> & Partial<Pick<{ when: () => boolean; }, never>>'
|
||||
!!! related TS6500 tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx:6:3: The expected type comes from property 'when' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<FieldFeedback<Props>> & Pick<Readonly<{ children?: ReactNode; }> & Readonly<Props>, "children" | "error"> & Partial<Pick<Readonly<{ children?: ReactNode; }> & Readonly<Props>, "when">> & Partial<Pick<{ when: () => boolean; }, never>>'
|
||||
|
||||
@@ -85,7 +82,6 @@ tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx(64,37): error TS2769:
|
||||
!!! error TS2769: Type 'void' is not assignable to type 'boolean'.
|
||||
!!! error TS2769: Overload 2 of 2, '(props: Props, context?: any): FieldFeedbackBeta<Props>', gave the following error.
|
||||
!!! error TS2769: Type '(value: string) => void' is not assignable to type '"a" | "b" | ((value: string) => boolean) | undefined'.
|
||||
!!! error TS2769: Type '(value: string) => void' is not assignable to type '(value: string) => boolean'.
|
||||
!!! related TS6500 tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx:6:3: The expected type comes from property 'when' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<FieldFeedbackBeta<Props>> & Pick<Readonly<{ children?: ReactNode; }> & Readonly<Props>, "children"> & Partial<Pick<Readonly<{ children?: ReactNode; }> & Readonly<Props>, keyof Props>> & Partial<Pick<BaseProps, never>>'
|
||||
!!! related TS6500 tests/cases/compiler/reactDefaultPropsInferenceSuccess.tsx:6:3: The expected type comes from property 'when' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<FieldFeedbackBeta<Props>> & Pick<Readonly<{ children?: ReactNode; }> & Readonly<Props>, "children"> & Partial<Pick<Readonly<{ children?: ReactNode; }> & Readonly<Props>, keyof Props>> & Partial<Pick<BaseProps, never>>'
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
tests/cases/conformance/types/tuple/restTupleElements1.ts(3,22): error TS1257: A required element cannot follow an optional element.
|
||||
tests/cases/conformance/types/tuple/restTupleElements1.ts(8,13): error TS1256: A rest element must be last in a tuple type.
|
||||
tests/cases/conformance/types/tuple/restTupleElements1.ts(9,13): error TS2574: A rest element type must be an array type.
|
||||
tests/cases/conformance/types/tuple/restTupleElements1.ts(10,13): error TS2574: A rest element type must be an array type.
|
||||
tests/cases/conformance/types/tuple/restTupleElements1.ts(10,16): error TS8020: JSDoc types can only be used inside documentation comments.
|
||||
tests/cases/conformance/types/tuple/restTupleElements1.ts(23,31): error TS2344: Type 'number[]' does not satisfy the constraint '[number, ...number[]]'.
|
||||
Property '0' is optional in type 'number[]' but required in type '[number, ...number[]]'.
|
||||
Source provides no match for required element at position 0 in target.
|
||||
tests/cases/conformance/types/tuple/restTupleElements1.ts(24,31): error TS2344: Type '[]' does not satisfy the constraint '[number, ...number[]]'.
|
||||
Source has 0 element(s) but target requires 1.
|
||||
tests/cases/conformance/types/tuple/restTupleElements1.ts(29,18): error TS2344: Type 'number[]' does not satisfy the constraint '[number]'.
|
||||
@@ -16,16 +15,18 @@ tests/cases/conformance/types/tuple/restTupleElements1.ts(32,31): error TS2344:
|
||||
tests/cases/conformance/types/tuple/restTupleElements1.ts(33,31): error TS2344: Type '[string, ...number[]]' does not satisfy the constraint '[number, ...number[]]'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/tuple/restTupleElements1.ts(34,31): error TS2344: Type '[number, number, string]' does not satisfy the constraint '[number, ...number[]]'.
|
||||
Types of property '2' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
Type at positions 1 through 2 in source is not compatible with type at position 1 in target.
|
||||
Type 'string | number' is not assignable to type 'number'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/tuple/restTupleElements1.ts(35,31): error TS2344: Type '[number, number, number, string]' does not satisfy the constraint '[number, ...number[]]'.
|
||||
Types of property '3' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
Type at positions 1 through 3 in source is not compatible with type at position 1 in target.
|
||||
Type 'string | number' is not assignable to type 'number'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/tuple/restTupleElements1.ts(59,4): error TS2345: Argument of type '[]' is not assignable to parameter of type '[unknown, ...unknown[]]'.
|
||||
Source has 0 element(s) but target requires 1.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/tuple/restTupleElements1.ts (14 errors) ====
|
||||
==== tests/cases/conformance/types/tuple/restTupleElements1.ts (13 errors) ====
|
||||
type T00 = [string?];
|
||||
type T01 = [string, string?];
|
||||
type T02 = [string?, string]; // Error
|
||||
@@ -36,8 +37,6 @@ tests/cases/conformance/types/tuple/restTupleElements1.ts(59,4): error TS2345: A
|
||||
type T05 = [...[...[...string[]]]];
|
||||
type T06 = [string, ...string[]];
|
||||
type T07 = [...string[], string]; // Error
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1256: A rest element must be last in a tuple type.
|
||||
type T08 = [...string]; // Error
|
||||
~~~~~~~~~
|
||||
!!! error TS2574: A rest element type must be an array type.
|
||||
@@ -61,7 +60,7 @@ tests/cases/conformance/types/tuple/restTupleElements1.ts(59,4): error TS2345: A
|
||||
assign<[number, ...number[]], number[]>(); // Error
|
||||
~~~~~~~~
|
||||
!!! error TS2344: Type 'number[]' does not satisfy the constraint '[number, ...number[]]'.
|
||||
!!! error TS2344: Property '0' is optional in type 'number[]' but required in type '[number, ...number[]]'.
|
||||
!!! error TS2344: Source provides no match for required element at position 0 in target.
|
||||
assign<[number, ...number[]], []>(); // Error
|
||||
~~
|
||||
!!! error TS2344: Type '[]' does not satisfy the constraint '[number, ...number[]]'.
|
||||
@@ -90,13 +89,15 @@ tests/cases/conformance/types/tuple/restTupleElements1.ts(59,4): error TS2345: A
|
||||
assign<[number, ...number[]], [number, number, string]>(); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2344: Type '[number, number, string]' does not satisfy the constraint '[number, ...number[]]'.
|
||||
!!! error TS2344: Types of property '2' are incompatible.
|
||||
!!! error TS2344: Type 'string' is not assignable to type 'number'.
|
||||
!!! error TS2344: Type at positions 1 through 2 in source is not compatible with type at position 1 in target.
|
||||
!!! error TS2344: Type 'string | number' is not assignable to type 'number'.
|
||||
!!! error TS2344: Type 'string' is not assignable to type 'number'.
|
||||
assign<[number, ...number[]], [number, number, number, string]>(); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2344: Type '[number, number, number, string]' does not satisfy the constraint '[number, ...number[]]'.
|
||||
!!! error TS2344: Types of property '3' are incompatible.
|
||||
!!! error TS2344: Type 'string' is not assignable to type 'number'.
|
||||
!!! error TS2344: Type at positions 1 through 3 in source is not compatible with type at position 1 in target.
|
||||
!!! error TS2344: Type 'string | number' is not assignable to type 'number'.
|
||||
!!! error TS2344: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
type T20 = [number, string, ...boolean[]];
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ tests/cases/conformance/types/rest/restTuplesFromContextualTypes.ts(56,7): error
|
||||
Types of parameters 'b' and 'args' are incompatible.
|
||||
Type 'T' is not assignable to type '[b: T[0], ...x: T[number][]]'.
|
||||
Type 'any[]' is not assignable to type '[b: T[0], ...x: T[number][]]'.
|
||||
Property '0' is optional in type 'any[]' but required in type '[b: T[0], ...x: T[number][]]'.
|
||||
Source provides no match for required element at position 0 in target.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/rest/restTuplesFromContextualTypes.ts (1 errors) ====
|
||||
@@ -67,7 +67,7 @@ tests/cases/conformance/types/rest/restTuplesFromContextualTypes.ts(56,7): error
|
||||
!!! error TS2345: Types of parameters 'b' and 'args' are incompatible.
|
||||
!!! error TS2345: Type 'T' is not assignable to type '[b: T[0], ...x: T[number][]]'.
|
||||
!!! error TS2345: Type 'any[]' is not assignable to type '[b: T[0], ...x: T[number][]]'.
|
||||
!!! error TS2345: Property '0' is optional in type 'any[]' but required in type '[b: T[0], ...x: T[number][]]'.
|
||||
!!! error TS2345: Source provides no match for required element at position 0 in target.
|
||||
}
|
||||
|
||||
declare function f5<T extends any[], U>(f: (...args: T) => U): (...args: T) => U;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/spliceTuples.ts(23,1): error TS2322: Type '[number, string, boolean, ...boolean[]]' is not assignable to type '[number, string, boolean, boolean, ...boolean[]]'.
|
||||
Property '3' is optional in type '[number, string, boolean, ...boolean[]]' but required in type '[number, string, boolean, boolean, ...boolean[]]'.
|
||||
Source provides no match for required element at position 3 in target.
|
||||
|
||||
|
||||
==== tests/cases/compiler/spliceTuples.ts (1 errors) ====
|
||||
@@ -28,5 +28,5 @@ tests/cases/compiler/spliceTuples.ts(23,1): error TS2322: Type '[number, string,
|
||||
k6 = [1, ...sbb_];
|
||||
~~
|
||||
!!! error TS2322: Type '[number, string, boolean, ...boolean[]]' is not assignable to type '[number, string, boolean, boolean, ...boolean[]]'.
|
||||
!!! error TS2322: Property '3' is optional in type '[number, string, boolean, ...boolean[]]' but required in type '[number, string, boolean, boolean, ...boolean[]]'.
|
||||
!!! error TS2322: Source provides no match for required element at position 3 in target.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user