From 3d3dae089f79c2839fc9a7133c1c00fd0fc83aa3 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 13 Jan 2017 22:53:02 -0800 Subject: [PATCH 01/18] Adds support for type parameter defaults --- src/compiler/checker.ts | 265 ++++++++-- src/compiler/declarationEmitter.ts | 17 + src/compiler/diagnosticMessages.json | 12 + src/compiler/parser.ts | 5 + src/compiler/types.ts | 11 + src/services/services.ts | 1 + tests/baselines/reference/genericDefaults.js | 238 +++++++++ .../reference/genericDefaults.symbols | 390 ++++++++++++++ .../baselines/reference/genericDefaults.types | 500 ++++++++++++++++++ .../genericDefaultsErrors.errors.txt | 114 ++++ .../reference/genericDefaultsErrors.js | 87 +++ tests/cases/compiler/genericDefaults.ts | 86 +++ tests/cases/compiler/genericDefaultsErrors.ts | 39 ++ 13 files changed, 1711 insertions(+), 54 deletions(-) create mode 100644 tests/baselines/reference/genericDefaults.js create mode 100644 tests/baselines/reference/genericDefaults.symbols create mode 100644 tests/baselines/reference/genericDefaults.types create mode 100644 tests/baselines/reference/genericDefaultsErrors.errors.txt create mode 100644 tests/baselines/reference/genericDefaultsErrors.js create mode 100644 tests/cases/compiler/genericDefaults.ts create mode 100644 tests/cases/compiler/genericDefaultsErrors.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 9e4e81e3da918..96ee4835b9c92 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -164,13 +164,13 @@ namespace ts { // in getPropagatingFlagsOfTypes, and it is checked in inferFromTypes. anyFunctionType.flags |= TypeFlags.ContainsAnyFunctionType; - const noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - const circularConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + const noConstraintOrDefaultType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + const circularConstraintOrDefaultType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - const anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); - const unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); - const resolvingSignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); - const silentNeverSignature = createSignature(undefined, undefined, undefined, emptyArray, silentNeverType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); + const anySignature = createSignature(undefined, undefined, 0, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); + const unknownSignature = createSignature(undefined, undefined, 0, undefined, emptyArray, unknownType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); + const resolvingSignature = createSignature(undefined, undefined, 0, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); + const silentNeverSignature = createSignature(undefined, undefined, 0, undefined, emptyArray, silentNeverType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); const enumNumberIndexInfo = createIndexInfo(stringType, /*isReadonly*/ true); @@ -374,7 +374,8 @@ namespace ts { Type, ResolvedBaseConstructorType, DeclaredType, - ResolvedReturnType + ResolvedReturnType, + ResolvedDefault } const builtinGlobals = createMap(); @@ -2650,6 +2651,13 @@ namespace ts { writeSpace(writer); buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, symbolStack); } + const defaultType = getDefaultOfTypeParameter(tp); + if (defaultType) { + writeSpace(writer); + writePunctuation(writer, SyntaxKind.EqualsToken); + writeSpace(writer); + buildTypeDisplay(defaultType, writer, enclosingDeclaration, flags, symbolStack); + } } function buildParameterDisplay(p: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, symbolStack?: Symbol[]) { @@ -3046,6 +3054,9 @@ namespace ts { if (propertyName === TypeSystemPropertyName.ResolvedReturnType) { return (target).resolvedReturnType; } + if (propertyName === TypeSystemPropertyName.ResolvedDefault) { + return (target).resolvedDefault; + } Debug.fail("Unhandled TypeSystemPropertyName " + propertyName); } @@ -3793,7 +3804,7 @@ namespace ts { function getConstructorsForTypeArguments(type: Type, typeArgumentNodes: TypeNode[]): Signature[] { const typeArgCount = typeArgumentNodes ? typeArgumentNodes.length : 0; return filter(getSignaturesOfType(type, SignatureKind.Construct), - sig => (sig.typeParameters ? sig.typeParameters.length : 0) === typeArgCount); + sig => typeArgCount >= sig.minTypeArgumentCount && typeArgCount <= (sig.typeParameters ? sig.typeParameters.length : 0)); } function getInstantiatedConstructorsForTypeArguments(type: Type, typeArgumentNodes: TypeNode[]): Signature[] { @@ -4000,6 +4011,7 @@ namespace ts { type.typeParameters = concatenate(outerTypeParameters, localTypeParameters); type.outerTypeParameters = outerTypeParameters; type.localTypeParameters = localTypeParameters; + type.minTypeArgumentCount = getMinTypeArgumentCount(localTypeParameters); (type).instantiations = createMap(); (type).instantiations[getTypeListId(type.typeParameters)] = type; (type).target = type; @@ -4043,6 +4055,7 @@ namespace ts { // Initialize the instantiation cache for generic type aliases. The declared type corresponds to // an instantiation of the type alias with the type parameters supplied as type arguments. links.typeParameters = typeParameters; + links.minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); links.instantiations = createMap(); links.instantiations[getTypeListId(typeParameters)] = type; } @@ -4351,11 +4364,12 @@ namespace ts { resolveObjectTypeMembers(type, source, typeParameters, typeArguments); } - function createSignature(declaration: SignatureDeclaration, typeParameters: TypeParameter[], thisParameter: Symbol | undefined, parameters: Symbol[], + function createSignature(declaration: SignatureDeclaration, typeParameters: TypeParameter[], minTypeArgumentCount: number, thisParameter: Symbol | undefined, parameters: Symbol[], resolvedReturnType: Type, typePredicate: TypePredicate, minArgumentCount: number, hasRestParameter: boolean, hasLiteralTypes: boolean): Signature { const sig = new Signature(checker); sig.declaration = declaration; sig.typeParameters = typeParameters; + sig.minTypeArgumentCount = minTypeArgumentCount; sig.parameters = parameters; sig.thisParameter = thisParameter; sig.resolvedReturnType = resolvedReturnType; @@ -4367,7 +4381,7 @@ namespace ts { } function cloneSignature(sig: Signature): Signature { - return createSignature(sig.declaration, sig.typeParameters, sig.thisParameter, sig.parameters, sig.resolvedReturnType, + return createSignature(sig.declaration, sig.typeParameters, sig.minTypeArgumentCount, sig.thisParameter, sig.parameters, sig.resolvedReturnType, sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasLiteralTypes); } @@ -4375,17 +4389,19 @@ namespace ts { const baseConstructorType = getBaseConstructorTypeOfClass(classType); const baseSignatures = getSignaturesOfType(baseConstructorType, SignatureKind.Construct); if (baseSignatures.length === 0) { - return [createSignature(undefined, classType.localTypeParameters, undefined, emptyArray, classType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false)]; + return [createSignature(undefined, classType.localTypeParameters, classType.minTypeArgumentCount, undefined, emptyArray, classType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false)]; } const baseTypeNode = getBaseTypeNodeOfClass(classType); const typeArguments = map(baseTypeNode.typeArguments, getTypeFromTypeNode); const typeArgCount = typeArguments ? typeArguments.length : 0; const result: Signature[] = []; for (const baseSig of baseSignatures) { + const minTypeArgumentCount = baseSig.minTypeArgumentCount; const typeParamCount = baseSig.typeParameters ? baseSig.typeParameters.length : 0; - if (typeParamCount === typeArgCount) { - const sig = typeParamCount ? createSignatureInstantiation(baseSig, typeArguments) : cloneSignature(baseSig); + if (typeArgCount >= minTypeArgumentCount && typeArgCount <= typeParamCount) { + const sig = typeParamCount ? createSignatureInstantiation(baseSig, fillMissingTypeArguments(typeArguments, baseSig.typeParameters, minTypeArgumentCount)) : cloneSignature(baseSig); sig.typeParameters = classType.localTypeParameters; + sig.minTypeArgumentCount = classType.minTypeArgumentCount; sig.resolvedReturnType = classType; result.push(sig); } @@ -4759,11 +4775,11 @@ namespace ts { function getBaseConstraintOfType(type: TypeVariable | UnionOrIntersectionType): Type { const constraint = getResolvedBaseConstraint(type); - return constraint !== noConstraintType && constraint !== circularConstraintType ? constraint : undefined; + return constraint !== noConstraintOrDefaultType && constraint !== circularConstraintOrDefaultType ? constraint : undefined; } function hasNonCircularBaseConstraint(type: TypeVariable): boolean { - return getResolvedBaseConstraint(type) !== circularConstraintType; + return getResolvedBaseConstraint(type) !== circularConstraintOrDefaultType; } /** @@ -4777,7 +4793,7 @@ namespace ts { if (!type.resolvedBaseConstraint) { typeStack = []; const constraint = getBaseConstraint(type); - type.resolvedBaseConstraint = circular ? circularConstraintType : getTypeWithThisArgument(constraint || noConstraintType, type); + type.resolvedBaseConstraint = circular ? circularConstraintOrDefaultType : getTypeWithThisArgument(constraint || noConstraintOrDefaultType, type); } return type.resolvedBaseConstraint; @@ -4824,6 +4840,45 @@ namespace ts { } } + function getDefaultOfTypeParameter(typeParameter: TypeParameter): Type { + return hasNonCircularDefault(typeParameter) ? getDefaultFromTypeParameter(typeParameter) : undefined; + // const defaultType = getResolvedDefault(typeParameter); + // return defaultType !== noConstraintOrDefaultType && defaultType !== circularConstraintOrDefaultType ? defaultType : undefined; + } + + function hasNonCircularDefault(type: TypeParameter) { + return getResolvedDefault(type) !== circularConstraintOrDefaultType; + } + + function getResolvedDefault(typeParameter: TypeParameter) { + if (!typeParameter.resolvedDefault) { + if (!pushTypeResolution(typeParameter, TypeSystemPropertyName.ResolvedDefault)) { + return circularConstraintOrDefaultType; + } + const defaultType = getDefaultFromTypeParameter(typeParameter); + const type = defaultType && getResolvedDefaultWorker(defaultType); + if (!popTypeResolution()) { + return typeParameter.resolvedDefault = circularConstraintOrDefaultType; + } + typeParameter.resolvedDefault = type || noConstraintOrDefaultType; + } + return typeParameter.resolvedDefault; + } + + function getResolvedDefaultWorker(type: Type): Type { + if (type.flags & TypeFlags.TypeParameter) { + return getResolvedDefault(type); + } + if (type.flags & TypeFlags.UnionOrIntersection) { + const types = (type).types; + const defaultTypes = filter(map(types, getResolvedDefaultWorker), x => x !== circularConstraintOrDefaultType); + return type.flags & TypeFlags.Union && defaultTypes.length === types.length ? getUnionType(defaultTypes) : + type.flags & TypeFlags.Intersection && defaultTypes.length ? getIntersectionType(defaultTypes) : + undefined; + } + return type; + } + /** * For a type parameter, return the base constraint of the type parameter. For the string, number, * boolean, and symbol primitive types, return the corresponding object types. Otherwise return the @@ -5106,6 +5161,53 @@ namespace ts { } } + /** + * Gets the minimum number of type arguments needed to satisfy all non-optional type + * parameters. + */ + function getMinTypeArgumentCount(typeParameters: TypeParameter[] | undefined): number { + let minTypeArgumentCount = 0; + if (typeParameters) { + for (let i = 0; i < typeParameters.length; i++) { + if (!getDefaultFromTypeParameter(typeParameters[i])) { + minTypeArgumentCount = i + 1; + } + } + } + return minTypeArgumentCount; + } + + function fillMissingTypeArguments(typeArguments: Type[] | undefined, typeParameters: TypeParameter[] | undefined, minTypeArgumentCount: number) { + const numTypeArguments = typeArguments ? typeArguments.length : 0; + const numTypeParameters = typeParameters ? typeParameters.length : 0; + if (numTypeArguments >= minTypeArgumentCount && numTypeArguments <= numTypeParameters) { + if (numTypeParameters) { + if (!typeArguments) { + typeArguments = []; + } + const mapper: TypeMapper = t => { + for (let i = 0; i < numTypeParameters; i++) { + if (t === typeParameters[i]) { + if (!typeArguments[i]) { + typeArguments[i] = emptyObjectType; + const defaultType = getDefaultOfTypeParameter(typeParameters[i]); + if (defaultType) { + typeArguments[i] = instantiateType(defaultType, mapper); + } + } + return typeArguments[i]; + } + } + return t; + }; + for (let i = numTypeArguments; i < numTypeParameters; i++) { + typeArguments[i] = instantiateType(typeParameters[i], mapper); + } + } + } + return typeArguments; + } + function getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature { const links = getNodeLinks(declaration); if (!links.resolvedSignature) { @@ -5172,7 +5274,7 @@ namespace ts { createTypePredicateFromTypePredicateNode(declaration.type as TypePredicateNode) : undefined; - links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, returnType, typePredicate, minArgumentCount, hasRestParameter(declaration), hasLiteralTypes); + links.resolvedSignature = createSignature(declaration, typeParameters, getMinTypeArgumentCount(typeParameters), thisParameter, parameters, returnType, typePredicate, minArgumentCount, hasRestParameter(declaration), hasLiteralTypes); } return links.resolvedSignature; } @@ -5303,6 +5405,7 @@ namespace ts { } function getSignatureInstantiation(signature: Signature, typeArguments: Type[]): Signature { + typeArguments = fillMissingTypeArguments(typeArguments, signature.typeParameters, signature.minTypeArgumentCount); const instantiations = signature.instantiations || (signature.instantiations = createMap()); const id = getTypeListId(typeArguments); return instantiations[id] || (instantiations[id] = createSignatureInstantiation(signature, typeArguments)); @@ -5381,14 +5484,28 @@ namespace ts { if (!typeParameter.constraint) { if (typeParameter.target) { const targetConstraint = getConstraintOfTypeParameter(typeParameter.target); - typeParameter.constraint = targetConstraint ? instantiateType(targetConstraint, typeParameter.mapper) : noConstraintType; + typeParameter.constraint = targetConstraint ? instantiateType(targetConstraint, typeParameter.mapper) : noConstraintOrDefaultType; } else { const constraintDeclaration = getConstraintDeclaration(typeParameter); - typeParameter.constraint = constraintDeclaration ? getTypeFromTypeNode(constraintDeclaration) : noConstraintType; + typeParameter.constraint = constraintDeclaration ? getTypeFromTypeNode(constraintDeclaration) : noConstraintOrDefaultType; } } - return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; + return typeParameter.constraint === noConstraintOrDefaultType ? undefined : typeParameter.constraint; + } + + function getDefaultFromTypeParameter(typeParameter: TypeParameter): Type | undefined { + if (!typeParameter.default) { + if (typeParameter.target) { + const targetDefault = getDefaultFromTypeParameter(typeParameter.target); + typeParameter.default = targetDefault ? instantiateType(targetDefault, typeParameter.mapper) : noConstraintOrDefaultType; + } + else { + const defaultDeclaration = typeParameter.symbol && forEach(typeParameter.symbol.declarations, decl => isTypeParameter(decl) && decl.default); + typeParameter.default = defaultDeclaration ? getTypeFromTypeNode(defaultDeclaration) : noConstraintOrDefaultType; + } + } + return typeParameter.default === noConstraintOrDefaultType ? undefined : typeParameter.default; } function getParentSymbolOfTypeParameter(typeParameter: TypeParameter): Symbol { @@ -5463,14 +5580,22 @@ namespace ts { const type = getDeclaredTypeOfSymbol(getMergedSymbol(symbol)); const typeParameters = type.localTypeParameters; if (typeParameters) { - if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) { - error(node, Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, /*enclosingDeclaration*/ undefined, TypeFormatFlags.WriteArrayAsGenericType), typeParameters.length); + const numTypeArguments = node.typeArguments ? node.typeArguments.length : 0; + if (numTypeArguments < type.minTypeArgumentCount || numTypeArguments > typeParameters.length) { + error(node, + type.minTypeArgumentCount === typeParameters.length + ? Diagnostics.Generic_type_0_requires_1_type_argument_s + : Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments, + typeToString(type, /*enclosingDeclaration*/ undefined, TypeFormatFlags.WriteArrayAsGenericType), + type.minTypeArgumentCount, + typeParameters.length); return unknownType; } // In a type reference, the outer type parameters of the referenced class or interface are automatically // supplied as type arguments and the type reference only specifies arguments for the local type parameters // of the class or interface. - return createTypeReference(type, concatenate(type.outerTypeParameters, map(node.typeArguments, getTypeFromTypeNode))); + const typeArguments = concatenate(type.outerTypeParameters, fillMissingTypeArguments(map(node.typeArguments, getTypeFromTypeNode), typeParameters, type.minTypeArgumentCount)); + return createTypeReference(type, typeArguments); } if (node.typeArguments) { error(node, Diagnostics.Type_0_is_not_generic, typeToString(type)); @@ -5492,10 +5617,17 @@ namespace ts { // declared type. Instantiations are cached using the type identities of the type arguments as the key. function getTypeFromTypeAliasReference(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference, symbol: Symbol): Type { const type = getDeclaredTypeOfSymbol(symbol); - const typeParameters = getSymbolLinks(symbol).typeParameters; + const { typeParameters, minTypeArgumentCount } = getSymbolLinks(symbol); if (typeParameters) { - if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) { - error(node, Diagnostics.Generic_type_0_requires_1_type_argument_s, symbolToString(symbol), typeParameters.length); + const numTypeArguments = node.typeArguments ? node.typeArguments.length : 0; + if (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length) { + error(node, + minTypeArgumentCount === typeParameters.length + ? Diagnostics.Generic_type_0_requires_1_type_argument_s + : Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments, + symbolToString(symbol), + minTypeArgumentCount, + typeParameters.length); return unknownType; } const typeArguments = map(node.typeArguments, getTypeFromTypeNode); @@ -5724,6 +5856,7 @@ namespace ts { type.typeParameters = typeParameters; type.outerTypeParameters = undefined; type.localTypeParameters = typeParameters; + type.minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); type.instantiations = createMap(); type.instantiations[getTypeListId(type.typeParameters)] = type; type.target = type; @@ -6608,7 +6741,7 @@ namespace ts { if (signature.typePredicate) { freshTypePredicate = cloneTypePredicate(signature.typePredicate, mapper); } - const result = createSignature(signature.declaration, freshTypeParameters, + const result = createSignature(signature.declaration, freshTypeParameters, signature.minTypeArgumentCount, signature.thisParameter && instantiateSymbol(signature.thisParameter, mapper), instantiateList(signature.parameters, mapper, instantiateSymbol), instantiateType(signature.resolvedReturnType, mapper), @@ -9004,11 +9137,13 @@ namespace ts { inferenceSucceeded = !!unionOrSuperType; } else { - // Infer the empty object type when no inferences were made. It is important to remember that - // in this case, inference still succeeds, meaning there is no error for not having inference - // candidates. An inference error only occurs when there are *conflicting* candidates, i.e. + // Infer either the default or the empty object type when no inferences were + // made. It is important to remember that in this case, inference still + // succeeds, meaning there is no error for not having inference candidates. An + // inference error only occurs when there are *conflicting* candidates, i.e. // candidates with no common supertype. - inferredType = emptyObjectType; + const defaultType = getDefaultOfTypeParameter(context.signature.typeParameters[index]); + inferredType = defaultType ? instantiateType(defaultType, getInferenceMapper(context)) : emptyObjectType; inferenceSucceeded = true; } context.inferredTypes[index] = inferredType; @@ -12710,8 +12845,9 @@ namespace ts { // If the user supplied type arguments, but the number of type arguments does not match // the declared number of type parameters, the call has an incorrect arity. + const numTypeParameters = signature.typeParameters ? signature.typeParameters.length : 0; const hasRightNumberOfTypeArgs = !typeArguments || - (signature.typeParameters && typeArguments.length === signature.typeParameters.length); + (typeArguments.length >= signature.minTypeArgumentCount && typeArguments.length <= numTypeParameters); if (!hasRightNumberOfTypeArgs) { return false; } @@ -12833,7 +12969,7 @@ namespace ts { const typeParameters = signature.typeParameters; let typeArgumentsAreAssignable = true; let mapper: TypeMapper; - for (let i = 0; i < typeParameters.length; i++) { + for (let i = 0; i < typeArgumentNodes.length; i++) { if (typeArgumentsAreAssignable /* so far */) { const constraint = getConstraintOfTypeParameter(typeParameters[i]); if (constraint) { @@ -13405,23 +13541,25 @@ namespace ts { ? createInferenceContext(originalCandidate, /*inferUnionTypes*/ false) : undefined; + if (typeArguments) { + for (let i = 0; i < typeArguments.length; i++) { + inferenceContext.inferredTypes[i] = getTypeFromTypeNode(typeArguments[i]); + inferenceContext.inferences[i].isFixed = true; + } + } + while (true) { candidate = originalCandidate; if (candidate.typeParameters) { - let typeArgumentTypes: Type[]; - if (typeArguments) { - typeArgumentTypes = map(typeArguments, getTypeFromTypeNode); - typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, /*reportErrors*/ false); - } - else { + typeArgumentsAreValid = typeArguments ? checkTypeArguments(candidate, typeArguments, inferenceContext.inferredTypes, /*reportErrors*/ false) : true; + if (typeArgumentsAreValid) { inferTypeArguments(node, candidate, args, excludeArgument, inferenceContext); typeArgumentsAreValid = inferenceContext.failedTypeParameterIndex === undefined; - typeArgumentTypes = inferenceContext.inferredTypes; } if (!typeArgumentsAreValid) { break; } - candidate = getSignatureInstantiation(candidate, typeArgumentTypes); + candidate = getSignatureInstantiation(candidate, inferenceContext.inferredTypes); } if (!checkApplicableSignature(node, args, candidate, relation, excludeArgument, /*reportErrors*/ false)) { break; @@ -15394,11 +15532,19 @@ namespace ts { } checkSourceElement(node.constraint); + checkSourceElement(node.default); const typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); if (!hasNonCircularBaseConstraint(typeParameter)) { error(node.constraint, Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)); } - getConstraintOfTypeParameter(getDeclaredTypeOfTypeParameter(getSymbolOfNode(node))); + if (!hasNonCircularDefault(typeParameter)) { + error(node.default, Diagnostics.Type_parameter_0_has_a_circular_default, typeToString(typeParameter)); + } + const constraintType = getConstraintOfTypeParameter(typeParameter); + const defaultType = getDefaultOfTypeParameter(typeParameter); + if (constraintType && defaultType) { + checkTypeAssignableTo(defaultType, getTypeWithThisArgument(constraintType, defaultType), node.default, Diagnostics.Type_0_does_not_satisfy_the_constraint_1); + } if (produceDiagnostics) { checkTypeNameIsReserved(node.name, Diagnostics.Type_parameter_name_cannot_be_0); } @@ -15948,7 +16094,7 @@ namespace ts { checkDecorators(node); } - function checkTypeArgumentConstraints(typeParameters: TypeParameter[], typeArgumentNodes: TypeNode[]): boolean { + function checkTypeArgumentConstraints(typeParameters: TypeParameter[], typeArgumentNodes: TypeNode[], minTypeArgumentCount: number): boolean { let typeArguments: Type[]; let mapper: TypeMapper; let result = true; @@ -15956,7 +16102,7 @@ namespace ts { const constraint = getConstraintOfTypeParameter(typeParameters[i]); if (constraint) { if (!typeArguments) { - typeArguments = map(typeArgumentNodes, getTypeFromTypeNode); + typeArguments = fillMissingTypeArguments(map(typeArgumentNodes, getTypeFromTypeNode), typeParameters, minTypeArgumentCount); mapper = createTypeMapper(typeParameters, typeArguments); } const typeArgument = typeArguments[i]; @@ -15980,7 +16126,8 @@ namespace ts { if (produceDiagnostics) { const symbol = getNodeLinks(node).resolvedSymbol; const typeParameters = symbol.flags & SymbolFlags.TypeAlias ? getSymbolLinks(symbol).typeParameters : (type).target.localTypeParameters; - checkTypeArgumentConstraints(typeParameters, node.typeArguments); + const minTypeArgumentCount = symbol.flags & SymbolFlags.TypeAlias ? getSymbolLinks(symbol).minTypeArgumentCount : (type).target.minTypeArgumentCount; + checkTypeArgumentConstraints(typeParameters, node.typeArguments, minTypeArgumentCount); } } if (type.flags & TypeFlags.Enum && !(type).memberTypes && getNodeLinks(node).resolvedSymbol.flags & SymbolFlags.EnumMember) { @@ -18182,14 +18329,23 @@ namespace ts { } } - /** Check each type parameter and check that type parameters have no duplicate type parameter declarations */ + /** + * Check each type parameter and check that type parameters have no duplicate type parameter declarations + */ function checkTypeParameters(typeParameterDeclarations: TypeParameterDeclaration[]) { if (typeParameterDeclarations) { + let seenDefault = false; for (let i = 0; i < typeParameterDeclarations.length; i++) { const node = typeParameterDeclarations[i]; checkTypeParameter(node); if (produceDiagnostics) { + if (node.default) { + seenDefault = true; + } + else if (seenDefault) { + error(node, Diagnostics.Required_type_parameters_may_not_follow_optional_type_parameters); + } for (let j = 0; j < i; j++) { if (typeParameterDeclarations[j].symbol === node.symbol) { error(node.name, Diagnostics.Duplicate_identifier_0, declarationNameToString(node.name)); @@ -18273,7 +18429,7 @@ namespace ts { if (baseTypeNode.typeArguments) { forEach(baseTypeNode.typeArguments, checkSourceElement); for (const constructor of getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments)) { - if (!checkTypeArgumentConstraints(constructor.typeParameters, baseTypeNode.typeArguments)) { + if (!checkTypeArgumentConstraints(constructor.typeParameters, baseTypeNode.typeArguments, constructor.minTypeArgumentCount)) { break; } } @@ -18472,14 +18628,15 @@ namespace ts { if (tp1.name.text !== tp2.name.text) { return false; } - if (!tp1.constraint && !tp2.constraint) { - continue; - } - if (!tp1.constraint || !tp2.constraint) { - return false; + if (tp1.constraint || tp2.constraint) { + if (!tp1.constraint || !tp2.constraint || !isTypeIdenticalTo(getTypeFromTypeNode(tp1.constraint), getTypeFromTypeNode(tp2.constraint))) { + return false; + } } - if (!isTypeIdenticalTo(getTypeFromTypeNode(tp1.constraint), getTypeFromTypeNode(tp2.constraint))) { - return false; + if (tp1.default || tp2.default) { + if (!tp1.default || !tp2.default || !isTypeIdenticalTo(getTypeFromTypeNode(tp1.default), getTypeFromTypeNode(tp2.default))) { + return false; + } } } return true; diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index cd98622e080a1..240ef647fb3b2 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -1000,6 +1000,23 @@ namespace ts { emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.constraint, getTypeParameterConstraintVisibilityError); } } + if (node.default && !isPrivateMethodTypeParameter(node)) { + write(" = "); + if (node.parent.kind === SyntaxKind.FunctionType || + node.parent.kind === SyntaxKind.ConstructorType || + (node.parent.parent && node.parent.parent.kind === SyntaxKind.TypeLiteral)) { + Debug.assert(node.parent.kind === SyntaxKind.MethodDeclaration || + node.parent.kind === SyntaxKind.MethodSignature || + node.parent.kind === SyntaxKind.FunctionType || + node.parent.kind === SyntaxKind.ConstructorType || + node.parent.kind === SyntaxKind.CallSignature || + node.parent.kind === SyntaxKind.ConstructSignature); + emitType(node.default); + } + else { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.default, getTypeParameterConstraintVisibilityError); + } + } function getTypeParameterConstraintVisibilityError(): SymbolAccessibilityDiagnostic { // Type parameter constraints are named by user so we should always be able to name it diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 52fc401d1f151..0d8479eea9607 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -2035,6 +2035,18 @@ "category": "Error", "code": 2704 }, + "Required type parameters may not follow optional type parameters": { + "category": "Error", + "code": 2705 + }, + "Type parameter '{0}' has a circular default.": { + "category": "Error", + "code": 2706 + }, + "Generic type '{0}' requires between {1} and {2} type arguments": { + "category": "Error", + "code": 2707 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 026f844315bbf..6ac417419de11 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -66,6 +66,7 @@ namespace ts { case SyntaxKind.TypeParameter: return visitNode(cbNode, (node).name) || visitNode(cbNode, (node).constraint) || + visitNode(cbNode, (node).default) || visitNode(cbNode, (node).expression); case SyntaxKind.ShorthandPropertyAssignment: return visitNodes(cbNodes, node.decorators) || @@ -2098,6 +2099,10 @@ namespace ts { } } + if (parseOptional(SyntaxKind.EqualsToken)) { + node.default = parseType(); + } + return finishNode(node); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 954ad21ba29af..30a054d481ed9 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -604,6 +604,7 @@ namespace ts { kind: SyntaxKind.TypeParameter; name: Identifier; constraint?: TypeNode; + default?: TypeNode; // For error recovery purposes. expression?: Expression; @@ -2679,6 +2680,7 @@ namespace ts { type?: Type; // Type of value symbol declaredType?: Type; // Type of class, interface, enum, type alias, or type parameter typeParameters?: TypeParameter[]; // Type parameters of type alias (undefined if non-generic) + minTypeArgumentCount?: number; inferredClassType?: Type; // Type of an inferred ES5 class instantiations?: Map; // Instantiations of generic type alias (undefined if non-generic) mapper?: TypeMapper; // Type mapper for instantiation alias @@ -2880,6 +2882,8 @@ namespace ts { typeParameters: TypeParameter[]; // Type parameters (undefined if non-generic) outerTypeParameters: TypeParameter[]; // Outer type parameters (undefined if none) localTypeParameters: TypeParameter[]; // Local type parameters (undefined if none) + /* @internal */ + minTypeArgumentCount: number; thisType: TypeParameter; // The "this" type (undefined if none) /* @internal */ resolvedBaseConstructorType?: Type; // Resolved base constructor type of class @@ -2986,18 +2990,23 @@ namespace ts { /* @internal */ resolvedBaseConstraint: Type; /* @internal */ + resolvedDefault: Type; + /* @internal */ resolvedIndexType: IndexType; } // Type parameters (TypeFlags.TypeParameter) export interface TypeParameter extends TypeVariable { constraint: Type; // Constraint + default?: Type; /* @internal */ target?: TypeParameter; // Instantiation target /* @internal */ mapper?: TypeMapper; // Instantiation mapper /* @internal */ isThisType?: boolean; + /* @internal */ + resolvedDefaultType?: Type; } // Indexed access types (TypeFlags.IndexedAccess) @@ -3021,6 +3030,8 @@ namespace ts { export interface Signature { declaration: SignatureDeclaration; // Originating declaration typeParameters: TypeParameter[]; // Type parameters (undefined if non-generic) + /* @internal */ + minTypeArgumentCount: number; // Number of non-optional type parameters parameters: Symbol[]; // Parameters /* @internal */ thisParameter?: Symbol; // symbol of this-type parameter diff --git a/src/services/services.ts b/src/services/services.ts index fac7715033b50..850ac3b40172b 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -396,6 +396,7 @@ namespace ts { parameters: Symbol[]; thisParameter: Symbol; resolvedReturnType: Type; + minTypeArgumentCount: number; minArgumentCount: number; hasRestParameter: boolean; hasLiteralTypes: boolean; diff --git a/tests/baselines/reference/genericDefaults.js b/tests/baselines/reference/genericDefaults.js new file mode 100644 index 0000000000000..aeedbd5d9e162 --- /dev/null +++ b/tests/baselines/reference/genericDefaults.js @@ -0,0 +1,238 @@ +//// [genericDefaults.ts] +declare const x: any; + +declare function f00(a?: T): T; +const f00c00 = f00(); +const f00c01 = f00(1); +const f00c02 = f00("a"); +const f00c03 = f00(); +const f00c04 = f00(1); +const f00c05 = f00("a"); + +declare function f01(a?: T, b?: U): [T, U]; +const f01c00 = f01(); +const f01c01 = f01(1); +const f01c02 = f01(1, "a"); +const f01c03 = f01(); +const f01c04 = f01(1); +const f01c05 = f01(1, "a"); +const f01c06 = f01(); +const f01c07 = f01(1); +const f01c08 = f01(1, "a"); + +declare function f02(a?: T, b?: U): [T, U]; +const f02c00 = f02(); +const f02c01 = f02(1); +const f02c02 = f02(1, "a"); +const f02c03 = f02(); +const f02c04 = f02(1); +const f02c05 = f02(1, "a"); +const f02c06 = f02(); +const f02c07 = f02(1); +const f02c08 = f02(1, "a"); + +declare function f03(a?: T, b?: U): [T, U]; +const f03c00 = f03(); +const f03c01 = f03(1); +const f03c02 = f03(1, 1); +const f03c03 = f03(); +const f03c04 = f03(1); +const f03c05 = f03(1, 2); +const f03c06 = f03(); +const f03c07 = f03(1); +const f03c08 = f03(1, 2); + +interface i00 { a: T; } +const i00c00 = (x).a; +const i00c01 = (>x).a; + +interface i01 { a: [T, U]; } +const i01c00 = (>x).a; +const i01c01 = (>x).a; + +interface i02 { a: [T, U]; } +const i02c00 = (>x).a; +const i02c01 = (>x).a; +const i02c02 = (>x).a; +const i02c03 = (>x).a; +const i02c04 = (>x).a; + +interface i03 { a: [T, U]; } +const i03c00 = (>x).a; +const i03c01 = (>x).a; +const i03c02 = (>x).a; +const i03c03 = (>x).a; +const i03c04 = (>x).a; + +interface Base01 { a: T; } +interface Base01Constructor { new (a?: T): Base01; } + +declare const Base01: Base01Constructor; +const Base01c00 = new Base01(); +const Base01c01 = new Base01(1); +const Base01c02 = new Base01(); +const Base01c03 = new Base01(1); + +declare class Derived01 extends Base01 { } +const Derived01c00 = new Derived01(); +const Derived01c01 = new Derived01(1); +const Derived01c02 = new Derived01(); +const Derived01c03 = new Derived01(1); + +declare class Derived02 extends Base01 { } +const Derived02c00 = new Derived02(); +const Derived02c01 = new Derived02(1); +const Derived02c02 = new Derived02(); +const Derived02c03 = new Derived02(1); + + +//// [genericDefaults.js] +var f00c00 = f00(); +var f00c01 = f00(1); +var f00c02 = f00("a"); +var f00c03 = f00(); +var f00c04 = f00(1); +var f00c05 = f00("a"); +var f01c00 = f01(); +var f01c01 = f01(1); +var f01c02 = f01(1, "a"); +var f01c03 = f01(); +var f01c04 = f01(1); +var f01c05 = f01(1, "a"); +var f01c06 = f01(); +var f01c07 = f01(1); +var f01c08 = f01(1, "a"); +var f02c00 = f02(); +var f02c01 = f02(1); +var f02c02 = f02(1, "a"); +var f02c03 = f02(); +var f02c04 = f02(1); +var f02c05 = f02(1, "a"); +var f02c06 = f02(); +var f02c07 = f02(1); +var f02c08 = f02(1, "a"); +var f03c00 = f03(); +var f03c01 = f03(1); +var f03c02 = f03(1, 1); +var f03c03 = f03(); +var f03c04 = f03(1); +var f03c05 = f03(1, 2); +var f03c06 = f03(); +var f03c07 = f03(1); +var f03c08 = f03(1, 2); +var i00c00 = x.a; +var i00c01 = x.a; +var i01c00 = x.a; +var i01c01 = x.a; +var i02c00 = x.a; +var i02c01 = x.a; +var i02c02 = x.a; +var i02c03 = x.a; +var i02c04 = x.a; +var i03c00 = x.a; +var i03c01 = x.a; +var i03c02 = x.a; +var i03c03 = x.a; +var i03c04 = x.a; +var Base01c00 = new Base01(); +var Base01c01 = new Base01(1); +var Base01c02 = new Base01(); +var Base01c03 = new Base01(1); +var Derived01c00 = new Derived01(); +var Derived01c01 = new Derived01(1); +var Derived01c02 = new Derived01(); +var Derived01c03 = new Derived01(1); +var Derived02c00 = new Derived02(); +var Derived02c01 = new Derived02(1); +var Derived02c02 = new Derived02(); +var Derived02c03 = new Derived02(1); + + +//// [genericDefaults.d.ts] +declare const x: any; +declare function f00(a?: T): T; +declare const f00c00: number; +declare const f00c01 = 1; +declare const f00c02 = "a"; +declare const f00c03: number; +declare const f00c04: number; +declare const f00c05: string; +declare function f01(a?: T, b?: U): [T, U]; +declare const f01c00: [{}, {}]; +declare const f01c01: [number, number]; +declare const f01c02: [number, string]; +declare const f01c03: [number, number]; +declare const f01c04: [number, number]; +declare const f01c05: [number, string]; +declare const f01c06: [number, string]; +declare const f01c07: [number, string]; +declare const f01c08: [number, string]; +declare function f02(a?: T, b?: U): [T, U]; +declare const f02c00: [number, number]; +declare const f02c01: [1, 1]; +declare const f02c02: [1, string]; +declare const f02c03: [number, number]; +declare const f02c04: [number, number]; +declare const f02c05: [number, string]; +declare const f02c06: [number, string]; +declare const f02c07: [number, string]; +declare const f02c08: [number, string]; +declare function f03(a?: T, b?: U): [T, U]; +declare const f03c00: [number, number]; +declare const f03c01: [1, 1]; +declare const f03c02: [1, 1]; +declare const f03c03: [number, number]; +declare const f03c04: [number, number]; +declare const f03c05: [number, number]; +declare const f03c06: [number, number]; +declare const f03c07: [number, number]; +declare const f03c08: [number, number]; +interface i00 { + a: T; +} +declare const i00c00: number; +declare const i00c01: number; +interface i01 { + a: [T, U]; +} +declare const i01c00: [number, number]; +declare const i01c01: [number, string]; +interface i02 { + a: [T, U]; +} +declare const i02c00: [number, number]; +declare const i02c01: [1, 1]; +declare const i02c02: [number, number]; +declare const i02c03: [1, number]; +declare const i02c04: [number, 1]; +interface i03 { + a: [T, U]; +} +declare const i03c00: [number, number]; +declare const i03c01: [1, 1]; +declare const i03c02: [number, number]; +declare const i03c03: [1, 1]; +declare const i03c04: [number, 1]; +interface Base01 { + a: T; +} +interface Base01Constructor { + new (a?: T): Base01; +} +declare const Base01: Base01Constructor; +declare const Base01c00: Base01; +declare const Base01c01: Base01; +declare const Base01c02: Base01; +declare const Base01c03: Base01; +declare class Derived01 extends Base01 { +} +declare const Derived01c00: Derived01<{}>; +declare const Derived01c01: Derived01; +declare const Derived01c02: Derived01; +declare const Derived01c03: Derived01; +declare class Derived02 extends Base01 { +} +declare const Derived02c00: Derived02; +declare const Derived02c01: Derived02; +declare const Derived02c02: Derived02; +declare const Derived02c03: Derived02; diff --git a/tests/baselines/reference/genericDefaults.symbols b/tests/baselines/reference/genericDefaults.symbols new file mode 100644 index 0000000000000..fe8dff0412ee6 --- /dev/null +++ b/tests/baselines/reference/genericDefaults.symbols @@ -0,0 +1,390 @@ +=== tests/cases/compiler/genericDefaults.ts === +declare const x: any; +>x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) + +declare function f00(a?: T): T; +>f00 : Symbol(f00, Decl(genericDefaults.ts, 0, 21)) +>T : Symbol(T, Decl(genericDefaults.ts, 2, 21)) +>a : Symbol(a, Decl(genericDefaults.ts, 2, 33)) +>T : Symbol(T, Decl(genericDefaults.ts, 2, 21)) +>T : Symbol(T, Decl(genericDefaults.ts, 2, 21)) + +const f00c00 = f00(); +>f00c00 : Symbol(f00c00, Decl(genericDefaults.ts, 3, 5)) +>f00 : Symbol(f00, Decl(genericDefaults.ts, 0, 21)) + +const f00c01 = f00(1); +>f00c01 : Symbol(f00c01, Decl(genericDefaults.ts, 4, 5)) +>f00 : Symbol(f00, Decl(genericDefaults.ts, 0, 21)) + +const f00c02 = f00("a"); +>f00c02 : Symbol(f00c02, Decl(genericDefaults.ts, 5, 5)) +>f00 : Symbol(f00, Decl(genericDefaults.ts, 0, 21)) + +const f00c03 = f00(); +>f00c03 : Symbol(f00c03, Decl(genericDefaults.ts, 6, 5)) +>f00 : Symbol(f00, Decl(genericDefaults.ts, 0, 21)) + +const f00c04 = f00(1); +>f00c04 : Symbol(f00c04, Decl(genericDefaults.ts, 7, 5)) +>f00 : Symbol(f00, Decl(genericDefaults.ts, 0, 21)) + +const f00c05 = f00("a"); +>f00c05 : Symbol(f00c05, Decl(genericDefaults.ts, 8, 5)) +>f00 : Symbol(f00, Decl(genericDefaults.ts, 0, 21)) + +declare function f01(a?: T, b?: U): [T, U]; +>f01 : Symbol(f01, Decl(genericDefaults.ts, 8, 32)) +>T : Symbol(T, Decl(genericDefaults.ts, 10, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 10, 23)) +>T : Symbol(T, Decl(genericDefaults.ts, 10, 21)) +>a : Symbol(a, Decl(genericDefaults.ts, 10, 31)) +>T : Symbol(T, Decl(genericDefaults.ts, 10, 21)) +>b : Symbol(b, Decl(genericDefaults.ts, 10, 37)) +>U : Symbol(U, Decl(genericDefaults.ts, 10, 23)) +>T : Symbol(T, Decl(genericDefaults.ts, 10, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 10, 23)) + +const f01c00 = f01(); +>f01c00 : Symbol(f01c00, Decl(genericDefaults.ts, 11, 5)) +>f01 : Symbol(f01, Decl(genericDefaults.ts, 8, 32)) + +const f01c01 = f01(1); +>f01c01 : Symbol(f01c01, Decl(genericDefaults.ts, 12, 5)) +>f01 : Symbol(f01, Decl(genericDefaults.ts, 8, 32)) + +const f01c02 = f01(1, "a"); +>f01c02 : Symbol(f01c02, Decl(genericDefaults.ts, 13, 5)) +>f01 : Symbol(f01, Decl(genericDefaults.ts, 8, 32)) + +const f01c03 = f01(); +>f01c03 : Symbol(f01c03, Decl(genericDefaults.ts, 14, 5)) +>f01 : Symbol(f01, Decl(genericDefaults.ts, 8, 32)) + +const f01c04 = f01(1); +>f01c04 : Symbol(f01c04, Decl(genericDefaults.ts, 15, 5)) +>f01 : Symbol(f01, Decl(genericDefaults.ts, 8, 32)) + +const f01c05 = f01(1, "a"); +>f01c05 : Symbol(f01c05, Decl(genericDefaults.ts, 16, 5)) +>f01 : Symbol(f01, Decl(genericDefaults.ts, 8, 32)) + +const f01c06 = f01(); +>f01c06 : Symbol(f01c06, Decl(genericDefaults.ts, 17, 5)) +>f01 : Symbol(f01, Decl(genericDefaults.ts, 8, 32)) + +const f01c07 = f01(1); +>f01c07 : Symbol(f01c07, Decl(genericDefaults.ts, 18, 5)) +>f01 : Symbol(f01, Decl(genericDefaults.ts, 8, 32)) + +const f01c08 = f01(1, "a"); +>f01c08 : Symbol(f01c08, Decl(genericDefaults.ts, 19, 5)) +>f01 : Symbol(f01, Decl(genericDefaults.ts, 8, 32)) + +declare function f02(a?: T, b?: U): [T, U]; +>f02 : Symbol(f02, Decl(genericDefaults.ts, 19, 43)) +>T : Symbol(T, Decl(genericDefaults.ts, 21, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 21, 38)) +>T : Symbol(T, Decl(genericDefaults.ts, 21, 21)) +>a : Symbol(a, Decl(genericDefaults.ts, 21, 46)) +>T : Symbol(T, Decl(genericDefaults.ts, 21, 21)) +>b : Symbol(b, Decl(genericDefaults.ts, 21, 52)) +>U : Symbol(U, Decl(genericDefaults.ts, 21, 38)) +>T : Symbol(T, Decl(genericDefaults.ts, 21, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 21, 38)) + +const f02c00 = f02(); +>f02c00 : Symbol(f02c00, Decl(genericDefaults.ts, 22, 5)) +>f02 : Symbol(f02, Decl(genericDefaults.ts, 19, 43)) + +const f02c01 = f02(1); +>f02c01 : Symbol(f02c01, Decl(genericDefaults.ts, 23, 5)) +>f02 : Symbol(f02, Decl(genericDefaults.ts, 19, 43)) + +const f02c02 = f02(1, "a"); +>f02c02 : Symbol(f02c02, Decl(genericDefaults.ts, 24, 5)) +>f02 : Symbol(f02, Decl(genericDefaults.ts, 19, 43)) + +const f02c03 = f02(); +>f02c03 : Symbol(f02c03, Decl(genericDefaults.ts, 25, 5)) +>f02 : Symbol(f02, Decl(genericDefaults.ts, 19, 43)) + +const f02c04 = f02(1); +>f02c04 : Symbol(f02c04, Decl(genericDefaults.ts, 26, 5)) +>f02 : Symbol(f02, Decl(genericDefaults.ts, 19, 43)) + +const f02c05 = f02(1, "a"); +>f02c05 : Symbol(f02c05, Decl(genericDefaults.ts, 27, 5)) +>f02 : Symbol(f02, Decl(genericDefaults.ts, 19, 43)) + +const f02c06 = f02(); +>f02c06 : Symbol(f02c06, Decl(genericDefaults.ts, 28, 5)) +>f02 : Symbol(f02, Decl(genericDefaults.ts, 19, 43)) + +const f02c07 = f02(1); +>f02c07 : Symbol(f02c07, Decl(genericDefaults.ts, 29, 5)) +>f02 : Symbol(f02, Decl(genericDefaults.ts, 19, 43)) + +const f02c08 = f02(1, "a"); +>f02c08 : Symbol(f02c08, Decl(genericDefaults.ts, 30, 5)) +>f02 : Symbol(f02, Decl(genericDefaults.ts, 19, 43)) + +declare function f03(a?: T, b?: U): [T, U]; +>f03 : Symbol(f03, Decl(genericDefaults.ts, 30, 43)) +>T : Symbol(T, Decl(genericDefaults.ts, 32, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 32, 38)) +>T : Symbol(T, Decl(genericDefaults.ts, 32, 21)) +>T : Symbol(T, Decl(genericDefaults.ts, 32, 21)) +>a : Symbol(a, Decl(genericDefaults.ts, 32, 56)) +>T : Symbol(T, Decl(genericDefaults.ts, 32, 21)) +>b : Symbol(b, Decl(genericDefaults.ts, 32, 62)) +>U : Symbol(U, Decl(genericDefaults.ts, 32, 38)) +>T : Symbol(T, Decl(genericDefaults.ts, 32, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 32, 38)) + +const f03c00 = f03(); +>f03c00 : Symbol(f03c00, Decl(genericDefaults.ts, 33, 5)) +>f03 : Symbol(f03, Decl(genericDefaults.ts, 30, 43)) + +const f03c01 = f03(1); +>f03c01 : Symbol(f03c01, Decl(genericDefaults.ts, 34, 5)) +>f03 : Symbol(f03, Decl(genericDefaults.ts, 30, 43)) + +const f03c02 = f03(1, 1); +>f03c02 : Symbol(f03c02, Decl(genericDefaults.ts, 35, 5)) +>f03 : Symbol(f03, Decl(genericDefaults.ts, 30, 43)) + +const f03c03 = f03(); +>f03c03 : Symbol(f03c03, Decl(genericDefaults.ts, 36, 5)) +>f03 : Symbol(f03, Decl(genericDefaults.ts, 30, 43)) + +const f03c04 = f03(1); +>f03c04 : Symbol(f03c04, Decl(genericDefaults.ts, 37, 5)) +>f03 : Symbol(f03, Decl(genericDefaults.ts, 30, 43)) + +const f03c05 = f03(1, 2); +>f03c05 : Symbol(f03c05, Decl(genericDefaults.ts, 38, 5)) +>f03 : Symbol(f03, Decl(genericDefaults.ts, 30, 43)) + +const f03c06 = f03(); +>f03c06 : Symbol(f03c06, Decl(genericDefaults.ts, 39, 5)) +>f03 : Symbol(f03, Decl(genericDefaults.ts, 30, 43)) + +const f03c07 = f03(1); +>f03c07 : Symbol(f03c07, Decl(genericDefaults.ts, 40, 5)) +>f03 : Symbol(f03, Decl(genericDefaults.ts, 30, 43)) + +const f03c08 = f03(1, 2); +>f03c08 : Symbol(f03c08, Decl(genericDefaults.ts, 41, 5)) +>f03 : Symbol(f03, Decl(genericDefaults.ts, 30, 43)) + +interface i00 { a: T; } +>i00 : Symbol(i00, Decl(genericDefaults.ts, 41, 41)) +>T : Symbol(T, Decl(genericDefaults.ts, 43, 14)) +>a : Symbol(i00.a, Decl(genericDefaults.ts, 43, 27)) +>T : Symbol(T, Decl(genericDefaults.ts, 43, 14)) + +const i00c00 = (x).a; +>i00c00 : Symbol(i00c00, Decl(genericDefaults.ts, 44, 5)) +>(x).a : Symbol(i00.a, Decl(genericDefaults.ts, 43, 27)) +>i00 : Symbol(i00, Decl(genericDefaults.ts, 41, 41)) +>x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) +>a : Symbol(i00.a, Decl(genericDefaults.ts, 43, 27)) + +const i00c01 = (>x).a; +>i00c01 : Symbol(i00c01, Decl(genericDefaults.ts, 45, 5)) +>(>x).a : Symbol(i00.a, Decl(genericDefaults.ts, 43, 27)) +>i00 : Symbol(i00, Decl(genericDefaults.ts, 41, 41)) +>x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) +>a : Symbol(i00.a, Decl(genericDefaults.ts, 43, 27)) + +interface i01 { a: [T, U]; } +>i01 : Symbol(i01, Decl(genericDefaults.ts, 45, 34)) +>T : Symbol(T, Decl(genericDefaults.ts, 47, 14)) +>U : Symbol(U, Decl(genericDefaults.ts, 47, 16)) +>T : Symbol(T, Decl(genericDefaults.ts, 47, 14)) +>a : Symbol(i01.a, Decl(genericDefaults.ts, 47, 25)) +>T : Symbol(T, Decl(genericDefaults.ts, 47, 14)) +>U : Symbol(U, Decl(genericDefaults.ts, 47, 16)) + +const i01c00 = (>x).a; +>i01c00 : Symbol(i01c00, Decl(genericDefaults.ts, 48, 5)) +>(>x).a : Symbol(i01.a, Decl(genericDefaults.ts, 47, 25)) +>i01 : Symbol(i01, Decl(genericDefaults.ts, 45, 34)) +>x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) +>a : Symbol(i01.a, Decl(genericDefaults.ts, 47, 25)) + +const i01c01 = (>x).a; +>i01c01 : Symbol(i01c01, Decl(genericDefaults.ts, 49, 5)) +>(>x).a : Symbol(i01.a, Decl(genericDefaults.ts, 47, 25)) +>i01 : Symbol(i01, Decl(genericDefaults.ts, 45, 34)) +>x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) +>a : Symbol(i01.a, Decl(genericDefaults.ts, 47, 25)) + +interface i02 { a: [T, U]; } +>i02 : Symbol(i02, Decl(genericDefaults.ts, 49, 42)) +>T : Symbol(T, Decl(genericDefaults.ts, 51, 14)) +>U : Symbol(U, Decl(genericDefaults.ts, 51, 31)) +>T : Symbol(T, Decl(genericDefaults.ts, 51, 14)) +>a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40)) +>T : Symbol(T, Decl(genericDefaults.ts, 51, 14)) +>U : Symbol(U, Decl(genericDefaults.ts, 51, 31)) + +const i02c00 = (>x).a; +>i02c00 : Symbol(i02c00, Decl(genericDefaults.ts, 52, 5)) +>(>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40)) +>i02 : Symbol(i02, Decl(genericDefaults.ts, 49, 42)) +>x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) +>a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40)) + +const i02c01 = (>x).a; +>i02c01 : Symbol(i02c01, Decl(genericDefaults.ts, 53, 5)) +>(>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40)) +>i02 : Symbol(i02, Decl(genericDefaults.ts, 49, 42)) +>x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) +>a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40)) + +const i02c02 = (>x).a; +>i02c02 : Symbol(i02c02, Decl(genericDefaults.ts, 54, 5)) +>(>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40)) +>i02 : Symbol(i02, Decl(genericDefaults.ts, 49, 42)) +>x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) +>a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40)) + +const i02c03 = (>x).a; +>i02c03 : Symbol(i02c03, Decl(genericDefaults.ts, 55, 5)) +>(>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40)) +>i02 : Symbol(i02, Decl(genericDefaults.ts, 49, 42)) +>x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) +>a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40)) + +const i02c04 = (>x).a; +>i02c04 : Symbol(i02c04, Decl(genericDefaults.ts, 56, 5)) +>(>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40)) +>i02 : Symbol(i02, Decl(genericDefaults.ts, 49, 42)) +>x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) +>a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40)) + +interface i03 { a: [T, U]; } +>i03 : Symbol(i03, Decl(genericDefaults.ts, 56, 37)) +>T : Symbol(T, Decl(genericDefaults.ts, 58, 14)) +>U : Symbol(U, Decl(genericDefaults.ts, 58, 31)) +>T : Symbol(T, Decl(genericDefaults.ts, 58, 14)) +>T : Symbol(T, Decl(genericDefaults.ts, 58, 14)) +>a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50)) +>T : Symbol(T, Decl(genericDefaults.ts, 58, 14)) +>U : Symbol(U, Decl(genericDefaults.ts, 58, 31)) + +const i03c00 = (>x).a; +>i03c00 : Symbol(i03c00, Decl(genericDefaults.ts, 59, 5)) +>(>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50)) +>i03 : Symbol(i03, Decl(genericDefaults.ts, 56, 37)) +>x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) +>a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50)) + +const i03c01 = (>x).a; +>i03c01 : Symbol(i03c01, Decl(genericDefaults.ts, 60, 5)) +>(>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50)) +>i03 : Symbol(i03, Decl(genericDefaults.ts, 56, 37)) +>x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) +>a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50)) + +const i03c02 = (>x).a; +>i03c02 : Symbol(i03c02, Decl(genericDefaults.ts, 61, 5)) +>(>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50)) +>i03 : Symbol(i03, Decl(genericDefaults.ts, 56, 37)) +>x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) +>a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50)) + +const i03c03 = (>x).a; +>i03c03 : Symbol(i03c03, Decl(genericDefaults.ts, 62, 5)) +>(>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50)) +>i03 : Symbol(i03, Decl(genericDefaults.ts, 56, 37)) +>x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) +>a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50)) + +const i03c04 = (>x).a; +>i03c04 : Symbol(i03c04, Decl(genericDefaults.ts, 63, 5)) +>(>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50)) +>i03 : Symbol(i03, Decl(genericDefaults.ts, 56, 37)) +>x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) +>a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50)) + +interface Base01 { a: T; } +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 63, 37), Decl(genericDefaults.ts, 68, 13)) +>T : Symbol(T, Decl(genericDefaults.ts, 65, 17)) +>a : Symbol(Base01.a, Decl(genericDefaults.ts, 65, 21)) +>T : Symbol(T, Decl(genericDefaults.ts, 65, 17)) + +interface Base01Constructor { new (a?: T): Base01; } +>Base01Constructor : Symbol(Base01Constructor, Decl(genericDefaults.ts, 65, 29)) +>T : Symbol(T, Decl(genericDefaults.ts, 66, 35)) +>a : Symbol(a, Decl(genericDefaults.ts, 66, 47)) +>T : Symbol(T, Decl(genericDefaults.ts, 66, 35)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 63, 37), Decl(genericDefaults.ts, 68, 13)) +>T : Symbol(T, Decl(genericDefaults.ts, 66, 35)) + +declare const Base01: Base01Constructor; +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 63, 37), Decl(genericDefaults.ts, 68, 13)) +>Base01Constructor : Symbol(Base01Constructor, Decl(genericDefaults.ts, 65, 29)) + +const Base01c00 = new Base01(); +>Base01c00 : Symbol(Base01c00, Decl(genericDefaults.ts, 69, 5)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 63, 37), Decl(genericDefaults.ts, 68, 13)) + +const Base01c01 = new Base01(1); +>Base01c01 : Symbol(Base01c01, Decl(genericDefaults.ts, 70, 5)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 63, 37), Decl(genericDefaults.ts, 68, 13)) + +const Base01c02 = new Base01(); +>Base01c02 : Symbol(Base01c02, Decl(genericDefaults.ts, 71, 5)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 63, 37), Decl(genericDefaults.ts, 68, 13)) + +const Base01c03 = new Base01(1); +>Base01c03 : Symbol(Base01c03, Decl(genericDefaults.ts, 72, 5)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 63, 37), Decl(genericDefaults.ts, 68, 13)) + +declare class Derived01 extends Base01 { } +>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 72, 40)) +>T : Symbol(T, Decl(genericDefaults.ts, 74, 24)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 63, 37), Decl(genericDefaults.ts, 68, 13)) +>T : Symbol(T, Decl(genericDefaults.ts, 74, 24)) + +const Derived01c00 = new Derived01(); +>Derived01c00 : Symbol(Derived01c00, Decl(genericDefaults.ts, 75, 5)) +>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 72, 40)) + +const Derived01c01 = new Derived01(1); +>Derived01c01 : Symbol(Derived01c01, Decl(genericDefaults.ts, 76, 5)) +>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 72, 40)) + +const Derived01c02 = new Derived01(); +>Derived01c02 : Symbol(Derived01c02, Decl(genericDefaults.ts, 77, 5)) +>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 72, 40)) + +const Derived01c03 = new Derived01(1); +>Derived01c03 : Symbol(Derived01c03, Decl(genericDefaults.ts, 78, 5)) +>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 72, 40)) + +declare class Derived02 extends Base01 { } +>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 78, 46)) +>T : Symbol(T, Decl(genericDefaults.ts, 80, 24)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 63, 37), Decl(genericDefaults.ts, 68, 13)) +>T : Symbol(T, Decl(genericDefaults.ts, 80, 24)) + +const Derived02c00 = new Derived02(); +>Derived02c00 : Symbol(Derived02c00, Decl(genericDefaults.ts, 81, 5)) +>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 78, 46)) + +const Derived02c01 = new Derived02(1); +>Derived02c01 : Symbol(Derived02c01, Decl(genericDefaults.ts, 82, 5)) +>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 78, 46)) + +const Derived02c02 = new Derived02(); +>Derived02c02 : Symbol(Derived02c02, Decl(genericDefaults.ts, 83, 5)) +>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 78, 46)) + +const Derived02c03 = new Derived02(1); +>Derived02c03 : Symbol(Derived02c03, Decl(genericDefaults.ts, 84, 5)) +>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 78, 46)) + diff --git a/tests/baselines/reference/genericDefaults.types b/tests/baselines/reference/genericDefaults.types new file mode 100644 index 0000000000000..c693d4e4048d0 --- /dev/null +++ b/tests/baselines/reference/genericDefaults.types @@ -0,0 +1,500 @@ +=== tests/cases/compiler/genericDefaults.ts === +declare const x: any; +>x : any + +declare function f00(a?: T): T; +>f00 : (a?: T) => T +>T : T +>a : T +>T : T +>T : T + +const f00c00 = f00(); +>f00c00 : number +>f00() : number +>f00 : (a?: T) => T + +const f00c01 = f00(1); +>f00c01 : 1 +>f00(1) : 1 +>f00 : (a?: T) => T +>1 : 1 + +const f00c02 = f00("a"); +>f00c02 : "a" +>f00("a") : "a" +>f00 : (a?: T) => T +>"a" : "a" + +const f00c03 = f00(); +>f00c03 : number +>f00() : number +>f00 : (a?: T) => T + +const f00c04 = f00(1); +>f00c04 : number +>f00(1) : number +>f00 : (a?: T) => T +>1 : 1 + +const f00c05 = f00("a"); +>f00c05 : string +>f00("a") : string +>f00 : (a?: T) => T +>"a" : "a" + +declare function f01(a?: T, b?: U): [T, U]; +>f01 : (a?: T, b?: U) => [T, U] +>T : T +>U : U +>T : T +>a : T +>T : T +>b : U +>U : U +>T : T +>U : U + +const f01c00 = f01(); +>f01c00 : [{}, {}] +>f01() : [{}, {}] +>f01 : (a?: T, b?: U) => [T, U] + +const f01c01 = f01(1); +>f01c01 : [number, number] +>f01(1) : [number, number] +>f01 : (a?: T, b?: U) => [T, U] +>1 : 1 + +const f01c02 = f01(1, "a"); +>f01c02 : [number, string] +>f01(1, "a") : [number, string] +>f01 : (a?: T, b?: U) => [T, U] +>1 : 1 +>"a" : "a" + +const f01c03 = f01(); +>f01c03 : [number, number] +>f01() : [number, number] +>f01 : (a?: T, b?: U) => [T, U] + +const f01c04 = f01(1); +>f01c04 : [number, number] +>f01(1) : [number, number] +>f01 : (a?: T, b?: U) => [T, U] +>1 : 1 + +const f01c05 = f01(1, "a"); +>f01c05 : [number, string] +>f01(1, "a") : [number, string] +>f01 : (a?: T, b?: U) => [T, U] +>1 : 1 +>"a" : "a" + +const f01c06 = f01(); +>f01c06 : [number, string] +>f01() : [number, string] +>f01 : (a?: T, b?: U) => [T, U] + +const f01c07 = f01(1); +>f01c07 : [number, string] +>f01(1) : [number, string] +>f01 : (a?: T, b?: U) => [T, U] +>1 : 1 + +const f01c08 = f01(1, "a"); +>f01c08 : [number, string] +>f01(1, "a") : [number, string] +>f01 : (a?: T, b?: U) => [T, U] +>1 : 1 +>"a" : "a" + +declare function f02(a?: T, b?: U): [T, U]; +>f02 : (a?: T, b?: U) => [T, U] +>T : T +>U : U +>T : T +>a : T +>T : T +>b : U +>U : U +>T : T +>U : U + +const f02c00 = f02(); +>f02c00 : [number, number] +>f02() : [number, number] +>f02 : (a?: T, b?: U) => [T, U] + +const f02c01 = f02(1); +>f02c01 : [1, 1] +>f02(1) : [1, 1] +>f02 : (a?: T, b?: U) => [T, U] +>1 : 1 + +const f02c02 = f02(1, "a"); +>f02c02 : [1, string] +>f02(1, "a") : [1, string] +>f02 : (a?: T, b?: U) => [T, U] +>1 : 1 +>"a" : "a" + +const f02c03 = f02(); +>f02c03 : [number, number] +>f02() : [number, number] +>f02 : (a?: T, b?: U) => [T, U] + +const f02c04 = f02(1); +>f02c04 : [number, number] +>f02(1) : [number, number] +>f02 : (a?: T, b?: U) => [T, U] +>1 : 1 + +const f02c05 = f02(1, "a"); +>f02c05 : [number, string] +>f02(1, "a") : [number, string] +>f02 : (a?: T, b?: U) => [T, U] +>1 : 1 +>"a" : "a" + +const f02c06 = f02(); +>f02c06 : [number, string] +>f02() : [number, string] +>f02 : (a?: T, b?: U) => [T, U] + +const f02c07 = f02(1); +>f02c07 : [number, string] +>f02(1) : [number, string] +>f02 : (a?: T, b?: U) => [T, U] +>1 : 1 + +const f02c08 = f02(1, "a"); +>f02c08 : [number, string] +>f02(1, "a") : [number, string] +>f02 : (a?: T, b?: U) => [T, U] +>1 : 1 +>"a" : "a" + +declare function f03(a?: T, b?: U): [T, U]; +>f03 : (a?: T, b?: U) => [T, U] +>T : T +>U : U +>T : T +>T : T +>a : T +>T : T +>b : U +>U : U +>T : T +>U : U + +const f03c00 = f03(); +>f03c00 : [number, number] +>f03() : [number, number] +>f03 : (a?: T, b?: U) => [T, U] + +const f03c01 = f03(1); +>f03c01 : [1, 1] +>f03(1) : [1, 1] +>f03 : (a?: T, b?: U) => [T, U] +>1 : 1 + +const f03c02 = f03(1, 1); +>f03c02 : [1, 1] +>f03(1, 1) : [1, 1] +>f03 : (a?: T, b?: U) => [T, U] +>1 : 1 +>1 : 1 + +const f03c03 = f03(); +>f03c03 : [number, number] +>f03() : [number, number] +>f03 : (a?: T, b?: U) => [T, U] + +const f03c04 = f03(1); +>f03c04 : [number, number] +>f03(1) : [number, number] +>f03 : (a?: T, b?: U) => [T, U] +>1 : 1 + +const f03c05 = f03(1, 2); +>f03c05 : [number, number] +>f03(1, 2) : [number, number] +>f03 : (a?: T, b?: U) => [T, U] +>1 : 1 +>2 : 2 + +const f03c06 = f03(); +>f03c06 : [number, number] +>f03() : [number, number] +>f03 : (a?: T, b?: U) => [T, U] + +const f03c07 = f03(1); +>f03c07 : [number, number] +>f03(1) : [number, number] +>f03 : (a?: T, b?: U) => [T, U] +>1 : 1 + +const f03c08 = f03(1, 2); +>f03c08 : [number, number] +>f03(1, 2) : [number, number] +>f03 : (a?: T, b?: U) => [T, U] +>1 : 1 +>2 : 2 + +interface i00 { a: T; } +>i00 : i00 +>T : T +>a : T +>T : T + +const i00c00 = (x).a; +>i00c00 : number +>(x).a : number +>(x) : i00 +>x : i00 +>i00 : i00 +>x : any +>a : number + +const i00c01 = (>x).a; +>i00c01 : number +>(>x).a : number +>(>x) : i00 +>>x : i00 +>i00 : i00 +>x : any +>a : number + +interface i01 { a: [T, U]; } +>i01 : i01 +>T : T +>U : U +>T : T +>a : [T, U] +>T : T +>U : U + +const i01c00 = (>x).a; +>i01c00 : [number, number] +>(>x).a : [number, number] +>(>x) : i01 +>>x : i01 +>i01 : i01 +>x : any +>a : [number, number] + +const i01c01 = (>x).a; +>i01c01 : [number, string] +>(>x).a : [number, string] +>(>x) : i01 +>>x : i01 +>i01 : i01 +>x : any +>a : [number, string] + +interface i02 { a: [T, U]; } +>i02 : i02 +>T : T +>U : U +>T : T +>a : [T, U] +>T : T +>U : U + +const i02c00 = (>x).a; +>i02c00 : [number, number] +>(>x).a : [number, number] +>(>x) : i02 +>>x : i02 +>i02 : i02 +>x : any +>a : [number, number] + +const i02c01 = (>x).a; +>i02c01 : [1, 1] +>(>x).a : [1, 1] +>(>x) : i02<1, 1> +>>x : i02<1, 1> +>i02 : i02 +>x : any +>a : [1, 1] + +const i02c02 = (>x).a; +>i02c02 : [number, number] +>(>x).a : [number, number] +>(>x) : i02 +>>x : i02 +>i02 : i02 +>x : any +>a : [number, number] + +const i02c03 = (>x).a; +>i02c03 : [1, number] +>(>x).a : [1, number] +>(>x) : i02<1, number> +>>x : i02<1, number> +>i02 : i02 +>x : any +>a : [1, number] + +const i02c04 = (>x).a; +>i02c04 : [number, 1] +>(>x).a : [number, 1] +>(>x) : i02 +>>x : i02 +>i02 : i02 +>x : any +>a : [number, 1] + +interface i03 { a: [T, U]; } +>i03 : i03 +>T : T +>U : U +>T : T +>T : T +>a : [T, U] +>T : T +>U : U + +const i03c00 = (>x).a; +>i03c00 : [number, number] +>(>x).a : [number, number] +>(>x) : i03 +>>x : i03 +>i03 : i03 +>x : any +>a : [number, number] + +const i03c01 = (>x).a; +>i03c01 : [1, 1] +>(>x).a : [1, 1] +>(>x) : i03<1, 1> +>>x : i03<1, 1> +>i03 : i03 +>x : any +>a : [1, 1] + +const i03c02 = (>x).a; +>i03c02 : [number, number] +>(>x).a : [number, number] +>(>x) : i03 +>>x : i03 +>i03 : i03 +>x : any +>a : [number, number] + +const i03c03 = (>x).a; +>i03c03 : [1, 1] +>(>x).a : [1, 1] +>(>x) : i03<1, 1> +>>x : i03<1, 1> +>i03 : i03 +>x : any +>a : [1, 1] + +const i03c04 = (>x).a; +>i03c04 : [number, 1] +>(>x).a : [number, 1] +>(>x) : i03 +>>x : i03 +>i03 : i03 +>x : any +>a : [number, 1] + +interface Base01 { a: T; } +>Base01 : Base01 +>T : T +>a : T +>T : T + +interface Base01Constructor { new (a?: T): Base01; } +>Base01Constructor : Base01Constructor +>T : T +>a : T +>T : T +>Base01 : Base01 +>T : T + +declare const Base01: Base01Constructor; +>Base01 : Base01Constructor +>Base01Constructor : Base01Constructor + +const Base01c00 = new Base01(); +>Base01c00 : Base01 +>new Base01() : Base01 +>Base01 : Base01Constructor + +const Base01c01 = new Base01(1); +>Base01c01 : Base01 +>new Base01(1) : Base01 +>Base01 : Base01Constructor +>1 : 1 + +const Base01c02 = new Base01(); +>Base01c02 : Base01 +>new Base01() : Base01 +>Base01 : Base01Constructor + +const Base01c03 = new Base01(1); +>Base01c03 : Base01 +>new Base01(1) : Base01 +>Base01 : Base01Constructor +>1 : 1 + +declare class Derived01 extends Base01 { } +>Derived01 : Derived01 +>T : T +>Base01 : Base01 +>T : T + +const Derived01c00 = new Derived01(); +>Derived01c00 : Derived01<{}> +>new Derived01() : Derived01<{}> +>Derived01 : typeof Derived01 + +const Derived01c01 = new Derived01(1); +>Derived01c01 : Derived01 +>new Derived01(1) : Derived01 +>Derived01 : typeof Derived01 +>1 : 1 + +const Derived01c02 = new Derived01(); +>Derived01c02 : Derived01 +>new Derived01() : Derived01 +>Derived01 : typeof Derived01 + +const Derived01c03 = new Derived01(1); +>Derived01c03 : Derived01 +>new Derived01(1) : Derived01 +>Derived01 : typeof Derived01 +>1 : 1 + +declare class Derived02 extends Base01 { } +>Derived02 : Derived02 +>T : T +>Base01 : Base01 +>T : T + +const Derived02c00 = new Derived02(); +>Derived02c00 : Derived02 +>new Derived02() : Derived02 +>Derived02 : typeof Derived02 + +const Derived02c01 = new Derived02(1); +>Derived02c01 : Derived02 +>new Derived02(1) : Derived02 +>Derived02 : typeof Derived02 +>1 : 1 + +const Derived02c02 = new Derived02(); +>Derived02c02 : Derived02 +>new Derived02() : Derived02 +>Derived02 : typeof Derived02 + +const Derived02c03 = new Derived02(1); +>Derived02c03 : Derived02 +>new Derived02(1) : Derived02 +>Derived02 : typeof Derived02 +>1 : 1 + diff --git a/tests/baselines/reference/genericDefaultsErrors.errors.txt b/tests/baselines/reference/genericDefaultsErrors.errors.txt new file mode 100644 index 0000000000000..5e19e25f270e9 --- /dev/null +++ b/tests/baselines/reference/genericDefaultsErrors.errors.txt @@ -0,0 +1,114 @@ +tests/cases/compiler/genericDefaultsErrors.ts(4,26): error TS2706: Type parameter 'T' has a circular default. +tests/cases/compiler/genericDefaultsErrors.ts(5,26): error TS2706: Type parameter 'T' has a circular default. +tests/cases/compiler/genericDefaultsErrors.ts(5,33): error TS2706: Type parameter 'U' has a circular default. +tests/cases/compiler/genericDefaultsErrors.ts(6,29): error TS2705: Required type parameters may not follow optional type parameters +tests/cases/compiler/genericDefaultsErrors.ts(7,41): error TS2344: Type 'number' does not satisfy the constraint 'string'. +tests/cases/compiler/genericDefaultsErrors.ts(8,59): error TS2344: Type 'T' does not satisfy the constraint 'number'. + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/genericDefaultsErrors.ts(9,44): error TS2344: Type 'T' does not satisfy the constraint 'number'. +tests/cases/compiler/genericDefaultsErrors.ts(10,39): error TS2344: Type 'number' does not satisfy the constraint 'T'. +tests/cases/compiler/genericDefaultsErrors.ts(14,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/genericDefaultsErrors.ts(17,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/genericDefaultsErrors.ts(20,11): error TS2428: All declarations of 'i00' must have identical type parameters. +tests/cases/compiler/genericDefaultsErrors.ts(23,11): error TS2428: All declarations of 'i01' must have identical type parameters. +tests/cases/compiler/genericDefaultsErrors.ts(25,19): error TS2706: Type parameter 'T' has a circular default. +tests/cases/compiler/genericDefaultsErrors.ts(26,19): error TS2706: Type parameter 'T' has a circular default. +tests/cases/compiler/genericDefaultsErrors.ts(26,26): error TS2706: Type parameter 'U' has a circular default. +tests/cases/compiler/genericDefaultsErrors.ts(27,22): error TS2705: Required type parameters may not follow optional type parameters +tests/cases/compiler/genericDefaultsErrors.ts(28,34): error TS2344: Type 'number' does not satisfy the constraint 'string'. +tests/cases/compiler/genericDefaultsErrors.ts(29,52): error TS2344: Type 'T' does not satisfy the constraint 'number'. + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/genericDefaultsErrors.ts(30,37): error TS2344: Type 'T' does not satisfy the constraint 'number'. +tests/cases/compiler/genericDefaultsErrors.ts(31,32): error TS2344: Type 'number' does not satisfy the constraint 'T'. +tests/cases/compiler/genericDefaultsErrors.ts(34,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments +tests/cases/compiler/genericDefaultsErrors.ts(35,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments +tests/cases/compiler/genericDefaultsErrors.ts(38,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments + + +==== tests/cases/compiler/genericDefaultsErrors.ts (23 errors) ==== + + declare const x: any; + + declare function f00(): void; + ~ +!!! error TS2706: Type parameter 'T' has a circular default. + declare function f01(): void; + ~ +!!! error TS2706: Type parameter 'T' has a circular default. + ~ +!!! error TS2706: Type parameter 'U' has a circular default. + declare function f02(); + ~ +!!! error TS2705: Required type parameters may not follow optional type parameters + declare function f03(): void; + ~~~~~~ +!!! error TS2344: Type 'number' does not satisfy the constraint 'string'. + declare function f04(): void; + ~ +!!! error TS2344: Type 'T' does not satisfy the constraint 'number'. +!!! error TS2344: Type 'string' is not assignable to type 'number'. + declare function f05(): void; + ~ +!!! error TS2344: Type 'T' does not satisfy the constraint 'number'. + declare function f06(): void; + ~~~~~~ +!!! error TS2344: Type 'number' does not satisfy the constraint 'T'. + + declare function f07(): void; + f07(); // ok + f07<1>(); // error + ~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + f07<1, 2>(); // ok + f07<1, 2, 3>(); // ok + f07<1, 2, 3, 4>(); // error + ~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + + interface i00 { } + interface i00 { } + ~~~ +!!! error TS2428: All declarations of 'i00' must have identical type parameters. + + interface i01 { } + interface i01 { } + ~~~ +!!! error TS2428: All declarations of 'i01' must have identical type parameters. + + interface i02 { } + ~ +!!! error TS2706: Type parameter 'T' has a circular default. + interface i03 { } + ~ +!!! error TS2706: Type parameter 'T' has a circular default. + ~ +!!! error TS2706: Type parameter 'U' has a circular default. + interface i04 { } + ~ +!!! error TS2705: Required type parameters may not follow optional type parameters + interface i05 { } + ~~~~~~ +!!! error TS2344: Type 'number' does not satisfy the constraint 'string'. + interface i06 { } + ~ +!!! error TS2344: Type 'T' does not satisfy the constraint 'number'. +!!! error TS2344: Type 'string' is not assignable to type 'number'. + interface i07 { } + ~ +!!! error TS2344: Type 'T' does not satisfy the constraint 'number'. + interface i08 { } + ~~~~~~ +!!! error TS2344: Type 'number' does not satisfy the constraint 'T'. + + interface i09 { } + type i09t00 = i09; // error + ~~~ +!!! error TS2707: Generic type 'i09' requires between 2 and 3 type arguments + type i09t01 = i09<1>; // error + ~~~~~~ +!!! error TS2707: Generic type 'i09' requires between 2 and 3 type arguments + type i09t02 = i09<1, 2>; // ok + type i09t03 = i09<1, 2, 3>; // ok + type i09t04 = i09<1, 2, 3, 4>; // error + ~~~~~~~~~~~~~~~ +!!! error TS2707: Generic type 'i09' requires between 2 and 3 type arguments \ No newline at end of file diff --git a/tests/baselines/reference/genericDefaultsErrors.js b/tests/baselines/reference/genericDefaultsErrors.js new file mode 100644 index 0000000000000..9615ad2e36299 --- /dev/null +++ b/tests/baselines/reference/genericDefaultsErrors.js @@ -0,0 +1,87 @@ +//// [genericDefaultsErrors.ts] + +declare const x: any; + +declare function f00(): void; +declare function f01(): void; +declare function f02(); +declare function f03(): void; +declare function f04(): void; +declare function f05(): void; +declare function f06(): void; + +declare function f07(): void; +f07(); // ok +f07<1>(); // error +f07<1, 2>(); // ok +f07<1, 2, 3>(); // ok +f07<1, 2, 3, 4>(); // error + +interface i00 { } +interface i00 { } + +interface i01 { } +interface i01 { } + +interface i02 { } +interface i03 { } +interface i04 { } +interface i05 { } +interface i06 { } +interface i07 { } +interface i08 { } + +interface i09 { } +type i09t00 = i09; // error +type i09t01 = i09<1>; // error +type i09t02 = i09<1, 2>; // ok +type i09t03 = i09<1, 2, 3>; // ok +type i09t04 = i09<1, 2, 3, 4>; // error + +//// [genericDefaultsErrors.js] +f07(); // ok +f07(); // error +f07(); // ok +f07(); // ok +f07(); // error + + +//// [genericDefaultsErrors.d.ts] +declare const x: any; +declare function f00(): void; +declare function f01(): void; +declare function f02(): any; +declare function f03(): void; +declare function f04(): void; +declare function f05(): void; +declare function f06(): void; +declare function f07(): void; +interface i00 { +} +interface i00 { +} +interface i01 { +} +interface i01 { +} +interface i02 { +} +interface i03 { +} +interface i04 { +} +interface i05 { +} +interface i06 { +} +interface i07 { +} +interface i08 { +} +interface i09 { +} +declare type i09t00 = i09; +declare type i09t01 = i09<1>; +declare type i09t02 = i09<1, 2>; +declare type i09t03 = i09<1, 2, 3>; +declare type i09t04 = i09<1, 2, 3, 4>; diff --git a/tests/cases/compiler/genericDefaults.ts b/tests/cases/compiler/genericDefaults.ts new file mode 100644 index 0000000000000..9ab0ede05b6e8 --- /dev/null +++ b/tests/cases/compiler/genericDefaults.ts @@ -0,0 +1,86 @@ +// @declaration: true +declare const x: any; + +declare function f00(a?: T): T; +const f00c00 = f00(); +const f00c01 = f00(1); +const f00c02 = f00("a"); +const f00c03 = f00(); +const f00c04 = f00(1); +const f00c05 = f00("a"); + +declare function f01(a?: T, b?: U): [T, U]; +const f01c00 = f01(); +const f01c01 = f01(1); +const f01c02 = f01(1, "a"); +const f01c03 = f01(); +const f01c04 = f01(1); +const f01c05 = f01(1, "a"); +const f01c06 = f01(); +const f01c07 = f01(1); +const f01c08 = f01(1, "a"); + +declare function f02(a?: T, b?: U): [T, U]; +const f02c00 = f02(); +const f02c01 = f02(1); +const f02c02 = f02(1, "a"); +const f02c03 = f02(); +const f02c04 = f02(1); +const f02c05 = f02(1, "a"); +const f02c06 = f02(); +const f02c07 = f02(1); +const f02c08 = f02(1, "a"); + +declare function f03(a?: T, b?: U): [T, U]; +const f03c00 = f03(); +const f03c01 = f03(1); +const f03c02 = f03(1, 1); +const f03c03 = f03(); +const f03c04 = f03(1); +const f03c05 = f03(1, 2); +const f03c06 = f03(); +const f03c07 = f03(1); +const f03c08 = f03(1, 2); + +interface i00 { a: T; } +const i00c00 = (x).a; +const i00c01 = (>x).a; + +interface i01 { a: [T, U]; } +const i01c00 = (>x).a; +const i01c01 = (>x).a; + +interface i02 { a: [T, U]; } +const i02c00 = (>x).a; +const i02c01 = (>x).a; +const i02c02 = (>x).a; +const i02c03 = (>x).a; +const i02c04 = (>x).a; + +interface i03 { a: [T, U]; } +const i03c00 = (>x).a; +const i03c01 = (>x).a; +const i03c02 = (>x).a; +const i03c03 = (>x).a; +const i03c04 = (>x).a; + +interface Base01 { a: T; } +interface Base01Constructor { new (a?: T): Base01; } + +declare const Base01: Base01Constructor; +const Base01c00 = new Base01(); +const Base01c01 = new Base01(1); +const Base01c02 = new Base01(); +const Base01c03 = new Base01(1); + +declare class Derived01 extends Base01 { } +const Derived01c00 = new Derived01(); +const Derived01c01 = new Derived01(1); +const Derived01c02 = new Derived01(); +const Derived01c03 = new Derived01(1); + +declare class Derived02 extends Base01 { } +const Derived02c00 = new Derived02(); +const Derived02c01 = new Derived02(1); +const Derived02c02 = new Derived02(); +const Derived02c03 = new Derived02(1); diff --git a/tests/cases/compiler/genericDefaultsErrors.ts b/tests/cases/compiler/genericDefaultsErrors.ts new file mode 100644 index 0000000000000..470b4998e926e --- /dev/null +++ b/tests/cases/compiler/genericDefaultsErrors.ts @@ -0,0 +1,39 @@ +// @declaration: true + +declare const x: any; + +declare function f00(): void; +declare function f01(): void; +declare function f02(); +declare function f03(): void; +declare function f04(): void; +declare function f05(): void; +declare function f06(): void; + +declare function f07(): void; +f07(); // ok +f07<1>(); // error +f07<1, 2>(); // ok +f07<1, 2, 3>(); // ok +f07<1, 2, 3, 4>(); // error + +interface i00 { } +interface i00 { } + +interface i01 { } +interface i01 { } + +interface i02 { } +interface i03 { } +interface i04 { } +interface i05 { } +interface i06 { } +interface i07 { } +interface i08 { } + +interface i09 { } +type i09t00 = i09; // error +type i09t01 = i09<1>; // error +type i09t02 = i09<1, 2>; // ok +type i09t03 = i09<1, 2, 3>; // ok +type i09t04 = i09<1, 2, 3, 4>; // error \ No newline at end of file From 442f5408b6ecb4e4b34986bc161ed9037e5e61b5 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 13 Jan 2017 23:48:20 -0800 Subject: [PATCH 02/18] Updated Promise and PromiseLike to use defaults --- src/lib/es2015.promise.d.ts | 35 +- src/lib/es5.d.ts | 34 +- .../asyncFunctionDeclaration15_es5.errors.txt | 4 +- .../reference/inferenceLimit.symbols | 8 +- .../baselines/reference/inferenceLimit.types | 8 +- ...ibrary_NoErrorDuplicateLibOptions1.symbols | 4 +- ...eLibrary_NoErrorDuplicateLibOptions1.types | 4 +- ...ibrary_NoErrorDuplicateLibOptions2.symbols | 4 +- ...eLibrary_NoErrorDuplicateLibOptions2.types | 4 +- ...larizeLibrary_TargetES5UsingES6Lib.symbols | 4 +- ...dularizeLibrary_TargetES5UsingES6Lib.types | 4 +- tests/baselines/reference/promiseType.js | 403 +++-- tests/baselines/reference/promiseType.symbols | 1091 +++++++++---- tests/baselines/reference/promiseType.types | 1448 ++++++++++++----- .../reference/promiseTypeStrictNull.js | 403 +++-- .../reference/promiseTypeStrictNull.symbols | 1091 +++++++++---- .../reference/promiseTypeStrictNull.types | 1448 ++++++++++++----- .../promiseVoidErrorCallback.symbols | 8 +- .../reference/promiseVoidErrorCallback.types | 8 +- tests/cases/compiler/promiseType.ts | 215 ++- tests/cases/compiler/promiseTypeStrictNull.ts | 215 ++- 21 files changed, 4515 insertions(+), 1928 deletions(-) diff --git a/src/lib/es2015.promise.d.ts b/src/lib/es2015.promise.d.ts index e27da2ce11b6c..08ab94a94d596 100644 --- a/src/lib/es2015.promise.d.ts +++ b/src/lib/es2015.promise.d.ts @@ -8,45 +8,14 @@ interface Promise { * @param onrejected The callback to execute when the Promise is rejected. * @returns A Promise for the completion of which ever callback is executed. */ - then(onfulfilled?: ((value: T) => T | PromiseLike) | undefined | null, onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): Promise; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled: ((value: T) => T | PromiseLike) | undefined | null, onrejected: (reason: any) => TResult | PromiseLike): Promise; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled: (value: T) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled: (value: T) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; - - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): Promise; + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): Promise; /** * Attaches a callback for only the rejection of the Promise. * @param onrejected The callback to execute when the Promise is rejected. * @returns A Promise for the completion of the callback. */ - catch(onrejected: (reason: any) => TResult | PromiseLike): Promise; + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise; } interface PromiseConstructor { diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index e5eabe950a273..2ae09022e0af1 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -1316,39 +1316,7 @@ interface PromiseLike { * @param onrejected The callback to execute when the Promise is rejected. * @returns A Promise for the completion of which ever callback is executed. */ - then( - onfulfilled?: ((value: T) => T | PromiseLike) | undefined | null, - onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): PromiseLike; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then( - onfulfilled: ((value: T) => T | PromiseLike) | undefined | null, - onrejected: (reason: any) => TResult | PromiseLike): PromiseLike; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then( - onfulfilled: (value: T) => TResult | PromiseLike, - onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): PromiseLike; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then( - onfulfilled: (value: T) => TResult1 | PromiseLike, - onrejected: (reason: any) => TResult2 | PromiseLike): PromiseLike; + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): PromiseLike; } interface ArrayLike { diff --git a/tests/baselines/reference/asyncFunctionDeclaration15_es5.errors.txt b/tests/baselines/reference/asyncFunctionDeclaration15_es5.errors.txt index 5fa332339124a..a5334d5b9d736 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration15_es5.errors.txt +++ b/tests/baselines/reference/asyncFunctionDeclaration15_es5.errors.txt @@ -6,7 +6,7 @@ tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration1 tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(10,23): error TS1055: Type 'typeof Thenable' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value. Type 'Thenable' is not assignable to type 'PromiseLike'. Types of property 'then' are incompatible. - Type '() => void' is not assignable to type '{ (onfulfilled?: (value: any) => any, onrejected?: (reason: any) => any): PromiseLike; (onfulfilled: (value: any) => any, onrejected: (reason: any) => TResult | PromiseLike): PromiseLike; (onfulfilled: (value: any) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; (onfulfilled: (value: any) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): PromiseLike; }'. + Type '() => void' is not assignable to type '(onfulfilled?: (value: any) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => PromiseLike'. Type 'void' is not assignable to type 'PromiseLike'. tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(17,16): error TS1059: Return expression in async function does not have a valid callable 'then' member. tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(23,25): error TS1058: Operand for 'await' does not have a valid callable 'then' member. @@ -37,7 +37,7 @@ tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration1 !!! error TS1055: Type 'typeof Thenable' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value. !!! error TS1055: Type 'Thenable' is not assignable to type 'PromiseLike'. !!! error TS1055: Types of property 'then' are incompatible. -!!! error TS1055: Type '() => void' is not assignable to type '{ (onfulfilled?: (value: any) => any, onrejected?: (reason: any) => any): PromiseLike; (onfulfilled: (value: any) => any, onrejected: (reason: any) => TResult | PromiseLike): PromiseLike; (onfulfilled: (value: any) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; (onfulfilled: (value: any) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): PromiseLike; }'. +!!! error TS1055: Type '() => void' is not assignable to type '(onfulfilled?: (value: any) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => PromiseLike'. !!! error TS1055: Type 'void' is not assignable to type 'PromiseLike'. async function fn7() { return; } // valid: Promise async function fn8() { return 1; } // valid: Promise diff --git a/tests/baselines/reference/inferenceLimit.symbols b/tests/baselines/reference/inferenceLimit.symbols index 721e7af7560df..dc9e42c52e4b4 100644 --- a/tests/baselines/reference/inferenceLimit.symbols +++ b/tests/baselines/reference/inferenceLimit.symbols @@ -37,14 +37,14 @@ export class BrokenClass { >reject : Symbol(reject, Decl(file1.ts, 13, 34)) this.doStuff(order.id) ->this.doStuff(order.id) .then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>this.doStuff(order.id) .then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >this.doStuff : Symbol(BrokenClass.doStuff, Decl(file1.ts, 27, 3)) >this : Symbol(BrokenClass, Decl(file1.ts, 1, 39)) >doStuff : Symbol(BrokenClass.doStuff, Decl(file1.ts, 27, 3)) >order : Symbol(order, Decl(file1.ts, 12, 25)) .then((items) => { ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >items : Symbol(items, Decl(file1.ts, 15, 17)) order.items = items; @@ -60,7 +60,7 @@ export class BrokenClass { }; return Promise.all(result.map(populateItems)) ->Promise.all(result.map(populateItems)) .then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise.all(result.map(populateItems)) .then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.all : Symbol(PromiseConstructor.all, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >all : Symbol(PromiseConstructor.all, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) @@ -70,7 +70,7 @@ export class BrokenClass { >populateItems : Symbol(populateItems, Decl(file1.ts, 12, 7)) .then((orders: Array) => { ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >orders : Symbol(orders, Decl(file1.ts, 23, 13)) >Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >MyModule : Symbol(MyModule, Decl(file1.ts, 1, 6)) diff --git a/tests/baselines/reference/inferenceLimit.types b/tests/baselines/reference/inferenceLimit.types index c123e21802ecc..bf917e18e93c8 100644 --- a/tests/baselines/reference/inferenceLimit.types +++ b/tests/baselines/reference/inferenceLimit.types @@ -46,7 +46,7 @@ export class BrokenClass { this.doStuff(order.id) >this.doStuff(order.id) .then((items) => { order.items = items; resolve(order); }) : Promise ->this.doStuff(order.id) .then : { (onfulfilled?: (value: void) => void | PromiseLike, onrejected?: (reason: any) => void | PromiseLike): Promise; (onfulfilled: (value: void) => void | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: void) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: void) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>this.doStuff(order.id) .then : (onfulfilled?: (value: void) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >this.doStuff(order.id) : Promise >this.doStuff : (id: number) => Promise >this : this @@ -56,7 +56,7 @@ export class BrokenClass { >id : any .then((items) => { ->then : { (onfulfilled?: (value: void) => void | PromiseLike, onrejected?: (reason: any) => void | PromiseLike): Promise; (onfulfilled: (value: void) => void | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: void) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: void) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: void) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >(items) => { order.items = items; resolve(order); } : (items: void) => void >items : void @@ -78,7 +78,7 @@ export class BrokenClass { return Promise.all(result.map(populateItems)) >Promise.all(result.map(populateItems)) .then((orders: Array) => { resolve(orders); }) : Promise ->Promise.all(result.map(populateItems)) .then : { (onfulfilled?: (value: {}[]) => {}[] | PromiseLike<{}[]>, onrejected?: (reason: any) => {}[] | PromiseLike<{}[]>): Promise<{}[]>; (onfulfilled: (value: {}[]) => {}[] | PromiseLike<{}[]>, onrejected: (reason: any) => TResult | PromiseLike): Promise<{}[] | TResult>; (onfulfilled: (value: {}[]) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: {}[]) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>Promise.all(result.map(populateItems)) .then : (onfulfilled?: (value: {}[]) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >Promise.all(result.map(populateItems)) : Promise<{}[]> >Promise.all : { (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise<[T1, T2, T3, T4]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; (values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; (values: (T | PromiseLike)[]): Promise; (values: Iterable>): Promise; } >Promise : PromiseConstructor @@ -90,7 +90,7 @@ export class BrokenClass { >populateItems : (order: any) => Promise<{}> .then((orders: Array) => { ->then : { (onfulfilled?: (value: {}[]) => {}[] | PromiseLike<{}[]>, onrejected?: (reason: any) => {}[] | PromiseLike<{}[]>): Promise<{}[]>; (onfulfilled: (value: {}[]) => {}[] | PromiseLike<{}[]>, onrejected: (reason: any) => TResult | PromiseLike): Promise<{}[] | TResult>; (onfulfilled: (value: {}[]) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: {}[]) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: {}[]) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >(orders: Array) => { resolve(orders); } : (orders: MyModule.MyModel[]) => void >orders : MyModule.MyModel[] >Array : T[] diff --git a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.symbols b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.symbols index d8520698e6cd3..9516fb0507ed5 100644 --- a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.symbols +++ b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.symbols @@ -121,9 +121,9 @@ declare var console: any; >console : Symbol(console, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 52, 11)) out().then(() => { ->out().then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>out().then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >out : Symbol(out, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 45, 37)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) console.log("Yea!"); >console : Symbol(console, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 52, 11)) diff --git a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.types b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.types index 40b299d63a030..b259e30172d9c 100644 --- a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.types +++ b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.types @@ -148,10 +148,10 @@ declare var console: any; out().then(() => { >out().then(() => { console.log("Yea!");}) : Promise ->out().then : { (onfulfilled?: (value: {}) => {} | PromiseLike<{}>, onrejected?: (reason: any) => {} | PromiseLike<{}>): Promise<{}>; (onfulfilled: (value: {}) => {} | PromiseLike<{}>, onrejected: (reason: any) => TResult | PromiseLike): Promise<{} | TResult>; (onfulfilled: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: {}) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>out().then : (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >out() : Promise<{}> >out : () => Promise<{}> ->then : { (onfulfilled?: (value: {}) => {} | PromiseLike<{}>, onrejected?: (reason: any) => {} | PromiseLike<{}>): Promise<{}>; (onfulfilled: (value: {}) => {} | PromiseLike<{}>, onrejected: (reason: any) => TResult | PromiseLike): Promise<{} | TResult>; (onfulfilled: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: {}) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >() => { console.log("Yea!");} : () => void console.log("Yea!"); diff --git a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.symbols b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.symbols index ea1eb599c6fb0..7bafb34fa7d38 100644 --- a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.symbols +++ b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.symbols @@ -121,9 +121,9 @@ declare var console: any; >console : Symbol(console, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 52, 11)) out().then(() => { ->out().then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>out().then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >out : Symbol(out, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 45, 37)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) console.log("Yea!"); >console : Symbol(console, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 52, 11)) diff --git a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.types b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.types index 3022a0ce8b119..4fa4c085bca58 100644 --- a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.types +++ b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.types @@ -148,10 +148,10 @@ declare var console: any; out().then(() => { >out().then(() => { console.log("Yea!");}) : Promise ->out().then : { (onfulfilled?: (value: {}) => {} | PromiseLike<{}>, onrejected?: (reason: any) => {} | PromiseLike<{}>): Promise<{}>; (onfulfilled: (value: {}) => {} | PromiseLike<{}>, onrejected: (reason: any) => TResult | PromiseLike): Promise<{} | TResult>; (onfulfilled: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: {}) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>out().then : (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >out() : Promise<{}> >out : () => Promise<{}> ->then : { (onfulfilled?: (value: {}) => {} | PromiseLike<{}>, onrejected?: (reason: any) => {} | PromiseLike<{}>): Promise<{}>; (onfulfilled: (value: {}) => {} | PromiseLike<{}>, onrejected: (reason: any) => TResult | PromiseLike): Promise<{} | TResult>; (onfulfilled: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: {}) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >() => { console.log("Yea!");} : () => void console.log("Yea!"); diff --git a/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.symbols b/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.symbols index ed1fb96ded3aa..46c0b701b3418 100644 --- a/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.symbols +++ b/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.symbols @@ -121,9 +121,9 @@ declare var console: any; >console : Symbol(console, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 52, 11)) out().then(() => { ->out().then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>out().then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >out : Symbol(out, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 45, 37)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) console.log("Yea!"); >console : Symbol(console, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 52, 11)) diff --git a/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.types b/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.types index d98ee87029562..25cd47601e018 100644 --- a/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.types +++ b/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.types @@ -148,10 +148,10 @@ declare var console: any; out().then(() => { >out().then(() => { console.log("Yea!");}) : Promise ->out().then : { (onfulfilled?: (value: {}) => {} | PromiseLike<{}>, onrejected?: (reason: any) => {} | PromiseLike<{}>): Promise<{}>; (onfulfilled: (value: {}) => {} | PromiseLike<{}>, onrejected: (reason: any) => TResult | PromiseLike): Promise<{} | TResult>; (onfulfilled: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: {}) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>out().then : (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >out() : Promise<{}> >out : () => Promise<{}> ->then : { (onfulfilled?: (value: {}) => {} | PromiseLike<{}>, onrejected?: (reason: any) => {} | PromiseLike<{}>): Promise<{}>; (onfulfilled: (value: {}) => {} | PromiseLike<{}>, onrejected: (reason: any) => TResult | PromiseLike): Promise<{} | TResult>; (onfulfilled: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: {}) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >() => { console.log("Yea!");} : () => void console.log("Yea!"); diff --git a/tests/baselines/reference/promiseType.js b/tests/baselines/reference/promiseType.js index 4e42ea240733e..d6b82ebb4d505 100644 --- a/tests/baselines/reference/promiseType.js +++ b/tests/baselines/reference/promiseType.js @@ -1,16 +1,6 @@ //// [promiseType.ts] declare var p: Promise; - -const a = p.then(); -const b = p.then(b => 1); -const c = p.then(b => 1, e => 'error'); -const d = p.then(b => 1, e => { }); -const e = p.then(b => 1, e => { throw Error(); }); -const f = p.then(b => 1, e => Promise.reject(Error())); -const g = p.catch(e => 'error'); -const h = p.catch(e => { }); -const i = p.catch(e => { throw Error(); }); -const j = p.catch(e => Promise.reject(Error())); +declare var x: any; async function A() { const a = await p; @@ -22,17 +12,15 @@ async function B() { return 1; } -// NOTE: This reports a "No best comment type exists among return expressions." error, and is -// ignored to get the types result for the test. -// async function C() { -// try { -// const a = await p; -// return 1; -// } -// catch (e) { -// return 'error'; -// } -// } +async function C() { + try { + const a = await p; + return 1; + } + catch (e) { + return 'error'; + } +} async function D() { try { @@ -96,64 +84,140 @@ async function I() { // addresses github issue #4903: const p00 = p.catch(); -const p01 = p.catch(undefined); -const p07 = p.catch(null); -const p02 = p.catch(() => 1); -const p03 = p.catch(() => {}); -const p04 = p.catch(() => {throw 1}); -const p05 = p.catch(() => Promise.reject(1)); -const p06 = p.catch(() => Promise.resolve(1)); +const p01 = p.then(); -const p10 = p.then(); +const p10 = p.catch(undefined); +const p11 = p.catch(null); +const p12 = p.catch(() => 1); +const p13 = p.catch(() => x); +const p14 = p.catch(() => undefined); +const p15 = p.catch(() => null); +const p16 = p.catch(() => {}); +const p17 = p.catch(() => {throw 1}); +const p18 = p.catch(() => Promise.reject(1)); +const p19 = p.catch(() => Promise.resolve(1)); const p20 = p.then(undefined); -const p21 = p.then(() => 1); -const p22 = p.then(() => {}); -const p23 = p.then(() => {throw 1}); -const p24 = p.then(() => Promise.resolve(1)); -const p25 = p.then(() => Promise.reject(1)); +const p21 = p.then(null); +const p22 = p.then(() => 1); +const p23 = p.then(() => x); +const p24 = p.then(() => undefined); +const p25 = p.then(() => null); +const p26 = p.then(() => {}); +const p27 = p.then(() => {throw 1}); +const p28 = p.then(() => Promise.resolve(1)); +const p29 = p.then(() => Promise.reject(1)); const p30 = p.then(undefined, undefined); -const p31 = p.then(undefined, () => 1); -const p32 = p.then(undefined, () => {}); -const p33 = p.then(undefined, () => {throw 1}); -const p34 = p.then(undefined, () => Promise.resolve(1)); -const p35 = p.then(undefined, () => Promise.reject(1)); +const p31 = p.then(undefined, null); +const p32 = p.then(undefined, () => 1); +const p33 = p.then(undefined, () => x); +const p34 = p.then(undefined, () => undefined); +const p35 = p.then(undefined, () => null); +const p36 = p.then(undefined, () => {}); +const p37 = p.then(undefined, () => {throw 1}); +const p38 = p.then(undefined, () => Promise.resolve(1)); +const p39 = p.then(undefined, () => Promise.reject(1)); + +const p40 = p.then(null, undefined); +const p41 = p.then(null, null); +const p42 = p.then(null, () => 1); +const p43 = p.then(null, () => x); +const p44 = p.then(null, () => undefined); +const p45 = p.then(null, () => null); +const p46 = p.then(null, () => {}); +const p47 = p.then(null, () => {throw 1}); +const p48 = p.then(null, () => Promise.resolve(1)); +const p49 = p.then(null, () => Promise.reject(1)); + +const p50 = p.then(() => "1", undefined); +const p51 = p.then(() => "1", null); +const p52 = p.then(() => "1", () => 1); +const p53 = p.then(() => "1", () => x); +const p54 = p.then(() => "1", () => undefined); +const p55 = p.then(() => "1", () => null); +const p56 = p.then(() => "1", () => {}); +const p57 = p.then(() => "1", () => {throw 1}); +const p58 = p.then(() => "1", () => Promise.resolve(1)); +const p59 = p.then(() => "1", () => Promise.reject(1)); + +const p60 = p.then(() => x, undefined); +const p61 = p.then(() => x, null); +const p62 = p.then(() => x, () => 1); +const p63 = p.then(() => x, () => x); +const p64 = p.then(() => x, () => undefined); +const p65 = p.then(() => x, () => null); +const p66 = p.then(() => x, () => {}); +const p67 = p.then(() => x, () => {throw 1}); +const p68 = p.then(() => x, () => Promise.resolve(1)); +const p69 = p.then(() => x, () => Promise.reject(1)); -const p40 = p.then(() => "1", undefined); -const p41 = p.then(() => "1", () => 1); -const p42 = p.then(() => "1", () => {}); -const p43 = p.then(() => "1", () => {throw 1}); -const p44 = p.then(() => "1", () => Promise.resolve(1)); -const p45 = p.then(() => "1", () => Promise.reject(1)); +const p70 = p.then(() => undefined, undefined); +const p71 = p.then(() => undefined, null); +const p72 = p.then(() => undefined, () => 1); +const p73 = p.then(() => undefined, () => x); +const p74 = p.then(() => undefined, () => undefined); +const p75 = p.then(() => undefined, () => null); +const p76 = p.then(() => undefined, () => {}); +const p77 = p.then(() => undefined, () => {throw 1}); +const p78 = p.then(() => undefined, () => Promise.resolve(1)); +const p79 = p.then(() => undefined, () => Promise.reject(1)); -const p50 = p.then(() => {}, undefined); -const p51 = p.then(() => {}, () => 1); -const p52 = p.then(() => {}, () => {}); -const p53 = p.then(() => {}, () => {throw 1}); -const p54 = p.then(() => {}, () => Promise.resolve(1)); -const p55 = p.then(() => {}, () => Promise.reject(1)); +const p80 = p.then(() => null, undefined); +const p81 = p.then(() => null, null); +const p82 = p.then(() => null, () => 1); +const p83 = p.then(() => null, () => x); +const p84 = p.then(() => null, () => undefined); +const p85 = p.then(() => null, () => null); +const p86 = p.then(() => null, () => {}); +const p87 = p.then(() => null, () => {throw 1}); +const p88 = p.then(() => null, () => Promise.resolve(1)); +const p89 = p.then(() => null, () => Promise.reject(1)); -const p60 = p.then(() => {throw 1}, undefined); -const p61 = p.then(() => {throw 1}, () => 1); -const p62 = p.then(() => {throw 1}, () => {}); -const p63 = p.then(() => {throw 1}, () => {throw 1}); -const p64 = p.then(() => {throw 1}, () => Promise.resolve(1)); -const p65 = p.then(() => {throw 1}, () => Promise.reject(1)); +const p90 = p.then(() => {}, undefined); +const p91 = p.then(() => {}, null); +const p92 = p.then(() => {}, () => 1); +const p93 = p.then(() => {}, () => x); +const p94 = p.then(() => {}, () => undefined); +const p95 = p.then(() => {}, () => null); +const p96 = p.then(() => {}, () => {}); +const p97 = p.then(() => {}, () => {throw 1}); +const p98 = p.then(() => {}, () => Promise.resolve(1)); +const p99 = p.then(() => {}, () => Promise.reject(1)); -const p70 = p.then(() => Promise.resolve("1"), undefined); -const p71 = p.then(() => Promise.resolve("1"), () => 1); -const p72 = p.then(() => Promise.resolve("1"), () => {}); -const p73 = p.then(() => Promise.resolve("1"), () => {throw 1}); -const p74 = p.then(() => Promise.resolve("1"), () => Promise.resolve(1)); -const p75 = p.then(() => Promise.resolve("1"), () => Promise.reject(1)); +const pa0 = p.then(() => {throw 1}, undefined); +const pa1 = p.then(() => {throw 1}, null); +const pa2 = p.then(() => {throw 1}, () => 1); +const pa3 = p.then(() => {throw 1}, () => x); +const pa4 = p.then(() => {throw 1}, () => undefined); +const pa5 = p.then(() => {throw 1}, () => null); +const pa6 = p.then(() => {throw 1}, () => {}); +const pa7 = p.then(() => {throw 1}, () => {throw 1}); +const pa8 = p.then(() => {throw 1}, () => Promise.resolve(1)); +const pa9 = p.then(() => {throw 1}, () => Promise.reject(1)); -const p80 = p.then(() => Promise.reject(1), undefined); -const p81 = p.then(() => Promise.reject(1), () => 1); -const p82 = p.then(() => Promise.reject(1), () => {}); -const p83 = p.then(() => Promise.reject(1), () => {throw 1}); -const p84 = p.then(() => Promise.reject(1), () => Promise.resolve(1)); -const p85 = p.then(() => Promise.reject(1), () => Promise.reject(1)); +const pb0 = p.then(() => Promise.resolve("1"), undefined); +const pb1 = p.then(() => Promise.resolve("1"), null); +const pb2 = p.then(() => Promise.resolve("1"), () => 1); +const pb3 = p.then(() => Promise.resolve("1"), () => x); +const pb4 = p.then(() => Promise.resolve("1"), () => undefined); +const pb5 = p.then(() => Promise.resolve("1"), () => null); +const pb6 = p.then(() => Promise.resolve("1"), () => {}); +const pb7 = p.then(() => Promise.resolve("1"), () => {throw 1}); +const pb8 = p.then(() => Promise.resolve("1"), () => Promise.resolve(1)); +const pb9 = p.then(() => Promise.resolve("1"), () => Promise.reject(1)); + +const pc0 = p.then(() => Promise.reject("1"), undefined); +const pc1 = p.then(() => Promise.reject("1"), null); +const pc2 = p.then(() => Promise.reject("1"), () => 1); +const pc3 = p.then(() => Promise.reject("1"), () => x); +const pc4 = p.then(() => Promise.reject("1"), () => undefined); +const pc5 = p.then(() => Promise.reject("1"), () => null); +const pc6 = p.then(() => Promise.reject("1"), () => {}); +const pc7 = p.then(() => Promise.reject("1"), () => {throw 1}); +const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1)); +const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1)); + //// [promiseType.js] var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { @@ -164,16 +228,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -const a = p.then(); -const b = p.then(b => 1); -const c = p.then(b => 1, e => 'error'); -const d = p.then(b => 1, e => { }); -const e = p.then(b => 1, e => { throw Error(); }); -const f = p.then(b => 1, e => Promise.reject(Error())); -const g = p.catch(e => 'error'); -const h = p.catch(e => { }); -const i = p.catch(e => { throw Error(); }); -const j = p.catch(e => Promise.reject(Error())); function A() { return __awaiter(this, void 0, void 0, function* () { const a = yield p; @@ -186,17 +240,17 @@ function B() { return 1; }); } -// NOTE: This reports a "No best comment type exists among return expressions." error, and is -// ignored to get the types result for the test. -// async function C() { -// try { -// const a = await p; -// return 1; -// } -// catch (e) { -// return 'error'; -// } -// } +function C() { + return __awaiter(this, void 0, void 0, function* () { + try { + const a = yield p; + return 1; + } + catch (e) { + return 'error'; + } + }); +} function D() { return __awaiter(this, void 0, void 0, function* () { try { @@ -264,53 +318,124 @@ function I() { } // addresses github issue #4903: const p00 = p.catch(); -const p01 = p.catch(undefined); -const p07 = p.catch(null); -const p02 = p.catch(() => 1); -const p03 = p.catch(() => { }); -const p04 = p.catch(() => { throw 1; }); -const p05 = p.catch(() => Promise.reject(1)); -const p06 = p.catch(() => Promise.resolve(1)); -const p10 = p.then(); +const p01 = p.then(); +const p10 = p.catch(undefined); +const p11 = p.catch(null); +const p12 = p.catch(() => 1); +const p13 = p.catch(() => x); +const p14 = p.catch(() => undefined); +const p15 = p.catch(() => null); +const p16 = p.catch(() => { }); +const p17 = p.catch(() => { throw 1; }); +const p18 = p.catch(() => Promise.reject(1)); +const p19 = p.catch(() => Promise.resolve(1)); const p20 = p.then(undefined); -const p21 = p.then(() => 1); -const p22 = p.then(() => { }); -const p23 = p.then(() => { throw 1; }); -const p24 = p.then(() => Promise.resolve(1)); -const p25 = p.then(() => Promise.reject(1)); +const p21 = p.then(null); +const p22 = p.then(() => 1); +const p23 = p.then(() => x); +const p24 = p.then(() => undefined); +const p25 = p.then(() => null); +const p26 = p.then(() => { }); +const p27 = p.then(() => { throw 1; }); +const p28 = p.then(() => Promise.resolve(1)); +const p29 = p.then(() => Promise.reject(1)); const p30 = p.then(undefined, undefined); -const p31 = p.then(undefined, () => 1); -const p32 = p.then(undefined, () => { }); -const p33 = p.then(undefined, () => { throw 1; }); -const p34 = p.then(undefined, () => Promise.resolve(1)); -const p35 = p.then(undefined, () => Promise.reject(1)); -const p40 = p.then(() => "1", undefined); -const p41 = p.then(() => "1", () => 1); -const p42 = p.then(() => "1", () => { }); -const p43 = p.then(() => "1", () => { throw 1; }); -const p44 = p.then(() => "1", () => Promise.resolve(1)); -const p45 = p.then(() => "1", () => Promise.reject(1)); -const p50 = p.then(() => { }, undefined); -const p51 = p.then(() => { }, () => 1); -const p52 = p.then(() => { }, () => { }); -const p53 = p.then(() => { }, () => { throw 1; }); -const p54 = p.then(() => { }, () => Promise.resolve(1)); -const p55 = p.then(() => { }, () => Promise.reject(1)); -const p60 = p.then(() => { throw 1; }, undefined); -const p61 = p.then(() => { throw 1; }, () => 1); -const p62 = p.then(() => { throw 1; }, () => { }); -const p63 = p.then(() => { throw 1; }, () => { throw 1; }); -const p64 = p.then(() => { throw 1; }, () => Promise.resolve(1)); -const p65 = p.then(() => { throw 1; }, () => Promise.reject(1)); -const p70 = p.then(() => Promise.resolve("1"), undefined); -const p71 = p.then(() => Promise.resolve("1"), () => 1); -const p72 = p.then(() => Promise.resolve("1"), () => { }); -const p73 = p.then(() => Promise.resolve("1"), () => { throw 1; }); -const p74 = p.then(() => Promise.resolve("1"), () => Promise.resolve(1)); -const p75 = p.then(() => Promise.resolve("1"), () => Promise.reject(1)); -const p80 = p.then(() => Promise.reject(1), undefined); -const p81 = p.then(() => Promise.reject(1), () => 1); -const p82 = p.then(() => Promise.reject(1), () => { }); -const p83 = p.then(() => Promise.reject(1), () => { throw 1; }); -const p84 = p.then(() => Promise.reject(1), () => Promise.resolve(1)); -const p85 = p.then(() => Promise.reject(1), () => Promise.reject(1)); +const p31 = p.then(undefined, null); +const p32 = p.then(undefined, () => 1); +const p33 = p.then(undefined, () => x); +const p34 = p.then(undefined, () => undefined); +const p35 = p.then(undefined, () => null); +const p36 = p.then(undefined, () => { }); +const p37 = p.then(undefined, () => { throw 1; }); +const p38 = p.then(undefined, () => Promise.resolve(1)); +const p39 = p.then(undefined, () => Promise.reject(1)); +const p40 = p.then(null, undefined); +const p41 = p.then(null, null); +const p42 = p.then(null, () => 1); +const p43 = p.then(null, () => x); +const p44 = p.then(null, () => undefined); +const p45 = p.then(null, () => null); +const p46 = p.then(null, () => { }); +const p47 = p.then(null, () => { throw 1; }); +const p48 = p.then(null, () => Promise.resolve(1)); +const p49 = p.then(null, () => Promise.reject(1)); +const p50 = p.then(() => "1", undefined); +const p51 = p.then(() => "1", null); +const p52 = p.then(() => "1", () => 1); +const p53 = p.then(() => "1", () => x); +const p54 = p.then(() => "1", () => undefined); +const p55 = p.then(() => "1", () => null); +const p56 = p.then(() => "1", () => { }); +const p57 = p.then(() => "1", () => { throw 1; }); +const p58 = p.then(() => "1", () => Promise.resolve(1)); +const p59 = p.then(() => "1", () => Promise.reject(1)); +const p60 = p.then(() => x, undefined); +const p61 = p.then(() => x, null); +const p62 = p.then(() => x, () => 1); +const p63 = p.then(() => x, () => x); +const p64 = p.then(() => x, () => undefined); +const p65 = p.then(() => x, () => null); +const p66 = p.then(() => x, () => { }); +const p67 = p.then(() => x, () => { throw 1; }); +const p68 = p.then(() => x, () => Promise.resolve(1)); +const p69 = p.then(() => x, () => Promise.reject(1)); +const p70 = p.then(() => undefined, undefined); +const p71 = p.then(() => undefined, null); +const p72 = p.then(() => undefined, () => 1); +const p73 = p.then(() => undefined, () => x); +const p74 = p.then(() => undefined, () => undefined); +const p75 = p.then(() => undefined, () => null); +const p76 = p.then(() => undefined, () => { }); +const p77 = p.then(() => undefined, () => { throw 1; }); +const p78 = p.then(() => undefined, () => Promise.resolve(1)); +const p79 = p.then(() => undefined, () => Promise.reject(1)); +const p80 = p.then(() => null, undefined); +const p81 = p.then(() => null, null); +const p82 = p.then(() => null, () => 1); +const p83 = p.then(() => null, () => x); +const p84 = p.then(() => null, () => undefined); +const p85 = p.then(() => null, () => null); +const p86 = p.then(() => null, () => { }); +const p87 = p.then(() => null, () => { throw 1; }); +const p88 = p.then(() => null, () => Promise.resolve(1)); +const p89 = p.then(() => null, () => Promise.reject(1)); +const p90 = p.then(() => { }, undefined); +const p91 = p.then(() => { }, null); +const p92 = p.then(() => { }, () => 1); +const p93 = p.then(() => { }, () => x); +const p94 = p.then(() => { }, () => undefined); +const p95 = p.then(() => { }, () => null); +const p96 = p.then(() => { }, () => { }); +const p97 = p.then(() => { }, () => { throw 1; }); +const p98 = p.then(() => { }, () => Promise.resolve(1)); +const p99 = p.then(() => { }, () => Promise.reject(1)); +const pa0 = p.then(() => { throw 1; }, undefined); +const pa1 = p.then(() => { throw 1; }, null); +const pa2 = p.then(() => { throw 1; }, () => 1); +const pa3 = p.then(() => { throw 1; }, () => x); +const pa4 = p.then(() => { throw 1; }, () => undefined); +const pa5 = p.then(() => { throw 1; }, () => null); +const pa6 = p.then(() => { throw 1; }, () => { }); +const pa7 = p.then(() => { throw 1; }, () => { throw 1; }); +const pa8 = p.then(() => { throw 1; }, () => Promise.resolve(1)); +const pa9 = p.then(() => { throw 1; }, () => Promise.reject(1)); +const pb0 = p.then(() => Promise.resolve("1"), undefined); +const pb1 = p.then(() => Promise.resolve("1"), null); +const pb2 = p.then(() => Promise.resolve("1"), () => 1); +const pb3 = p.then(() => Promise.resolve("1"), () => x); +const pb4 = p.then(() => Promise.resolve("1"), () => undefined); +const pb5 = p.then(() => Promise.resolve("1"), () => null); +const pb6 = p.then(() => Promise.resolve("1"), () => { }); +const pb7 = p.then(() => Promise.resolve("1"), () => { throw 1; }); +const pb8 = p.then(() => Promise.resolve("1"), () => Promise.resolve(1)); +const pb9 = p.then(() => Promise.resolve("1"), () => Promise.reject(1)); +const pc0 = p.then(() => Promise.reject("1"), undefined); +const pc1 = p.then(() => Promise.reject("1"), null); +const pc2 = p.then(() => Promise.reject("1"), () => 1); +const pc3 = p.then(() => Promise.reject("1"), () => x); +const pc4 = p.then(() => Promise.reject("1"), () => undefined); +const pc5 = p.then(() => Promise.reject("1"), () => null); +const pc6 = p.then(() => Promise.reject("1"), () => { }); +const pc7 = p.then(() => Promise.reject("1"), () => { throw 1; }); +const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1)); +const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1)); diff --git a/tests/baselines/reference/promiseType.symbols b/tests/baselines/reference/promiseType.symbols index 845aed26d5e32..db99acda97114 100644 --- a/tests/baselines/reference/promiseType.symbols +++ b/tests/baselines/reference/promiseType.symbols @@ -3,149 +3,74 @@ declare var p: Promise; >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) -const a = p.then(); ->a : Symbol(a, Decl(promiseType.ts, 2, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) - -const b = p.then(b => 1); ->b : Symbol(b, Decl(promiseType.ts, 3, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->b : Symbol(b, Decl(promiseType.ts, 3, 17)) - -const c = p.then(b => 1, e => 'error'); ->c : Symbol(c, Decl(promiseType.ts, 4, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->b : Symbol(b, Decl(promiseType.ts, 4, 17)) ->e : Symbol(e, Decl(promiseType.ts, 4, 24)) - -const d = p.then(b => 1, e => { }); ->d : Symbol(d, Decl(promiseType.ts, 5, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->b : Symbol(b, Decl(promiseType.ts, 5, 17)) ->e : Symbol(e, Decl(promiseType.ts, 5, 24)) - -const e = p.then(b => 1, e => { throw Error(); }); ->e : Symbol(e, Decl(promiseType.ts, 6, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->b : Symbol(b, Decl(promiseType.ts, 6, 17)) ->e : Symbol(e, Decl(promiseType.ts, 6, 24)) ->Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) - -const f = p.then(b => 1, e => Promise.reject(Error())); ->f : Symbol(f, Decl(promiseType.ts, 7, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->b : Symbol(b, Decl(promiseType.ts, 7, 17)) ->e : Symbol(e, Decl(promiseType.ts, 7, 24)) ->Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) ->reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) - -const g = p.catch(e => 'error'); ->g : Symbol(g, Decl(promiseType.ts, 8, 5)) ->p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->e : Symbol(e, Decl(promiseType.ts, 8, 18)) - -const h = p.catch(e => { }); ->h : Symbol(h, Decl(promiseType.ts, 9, 5)) ->p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->e : Symbol(e, Decl(promiseType.ts, 9, 18)) - -const i = p.catch(e => { throw Error(); }); ->i : Symbol(i, Decl(promiseType.ts, 10, 5)) ->p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->e : Symbol(e, Decl(promiseType.ts, 10, 18)) ->Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) - -const j = p.catch(e => Promise.reject(Error())); ->j : Symbol(j, Decl(promiseType.ts, 11, 5)) ->p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->e : Symbol(e, Decl(promiseType.ts, 11, 18)) ->Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) ->reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +declare var x: any; +>x : Symbol(x, Decl(promiseType.ts, 1, 11)) async function A() { ->A : Symbol(A, Decl(promiseType.ts, 11, 48)) +>A : Symbol(A, Decl(promiseType.ts, 1, 19)) const a = await p; ->a : Symbol(a, Decl(promiseType.ts, 14, 9)) +>a : Symbol(a, Decl(promiseType.ts, 4, 9)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) return a; ->a : Symbol(a, Decl(promiseType.ts, 14, 9)) +>a : Symbol(a, Decl(promiseType.ts, 4, 9)) } async function B() { ->B : Symbol(B, Decl(promiseType.ts, 16, 1)) +>B : Symbol(B, Decl(promiseType.ts, 6, 1)) const a = await p; ->a : Symbol(a, Decl(promiseType.ts, 19, 9)) +>a : Symbol(a, Decl(promiseType.ts, 9, 9)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) return 1; } -// NOTE: This reports a "No best comment type exists among return expressions." error, and is -// ignored to get the types result for the test. -// async function C() { -// try { -// const a = await p; -// return 1; -// } -// catch (e) { -// return 'error'; -// } -// } +async function C() { +>C : Symbol(C, Decl(promiseType.ts, 11, 1)) + + try { + const a = await p; +>a : Symbol(a, Decl(promiseType.ts, 15, 13)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) + + return 1; + } + catch (e) { +>e : Symbol(e, Decl(promiseType.ts, 18, 11)) + + return 'error'; + } +} async function D() { >D : Symbol(D, Decl(promiseType.ts, 21, 1)) try { const a = await p; ->a : Symbol(a, Decl(promiseType.ts, 37, 13)) +>a : Symbol(a, Decl(promiseType.ts, 25, 13)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) return 1; } catch (e) { ->e : Symbol(e, Decl(promiseType.ts, 40, 11)) +>e : Symbol(e, Decl(promiseType.ts, 28, 11)) } } async function E() { ->E : Symbol(E, Decl(promiseType.ts, 42, 1)) +>E : Symbol(E, Decl(promiseType.ts, 30, 1)) try { const a = await p; ->a : Symbol(a, Decl(promiseType.ts, 46, 13)) +>a : Symbol(a, Decl(promiseType.ts, 34, 13)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) return 1; } catch (e) { ->e : Symbol(e, Decl(promiseType.ts, 49, 11)) +>e : Symbol(e, Decl(promiseType.ts, 37, 11)) throw Error(); >Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) @@ -153,17 +78,17 @@ async function E() { } async function F() { ->F : Symbol(F, Decl(promiseType.ts, 52, 1)) +>F : Symbol(F, Decl(promiseType.ts, 40, 1)) try { const a = await p; ->a : Symbol(a, Decl(promiseType.ts, 56, 13)) +>a : Symbol(a, Decl(promiseType.ts, 44, 13)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) return 1; } catch (e) { ->e : Symbol(e, Decl(promiseType.ts, 59, 11)) +>e : Symbol(e, Decl(promiseType.ts, 47, 11)) return Promise.reject(Error()); >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) @@ -174,36 +99,36 @@ async function F() { } async function G() { ->G : Symbol(G, Decl(promiseType.ts, 62, 1)) +>G : Symbol(G, Decl(promiseType.ts, 50, 1)) try { const a = await p; ->a : Symbol(a, Decl(promiseType.ts, 66, 13)) +>a : Symbol(a, Decl(promiseType.ts, 54, 13)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) return a; ->a : Symbol(a, Decl(promiseType.ts, 66, 13)) +>a : Symbol(a, Decl(promiseType.ts, 54, 13)) } catch (e) { ->e : Symbol(e, Decl(promiseType.ts, 69, 11)) +>e : Symbol(e, Decl(promiseType.ts, 57, 11)) return; } } async function H() { ->H : Symbol(H, Decl(promiseType.ts, 72, 1)) +>H : Symbol(H, Decl(promiseType.ts, 60, 1)) try { const a = await p; ->a : Symbol(a, Decl(promiseType.ts, 76, 13)) +>a : Symbol(a, Decl(promiseType.ts, 64, 13)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) return a; ->a : Symbol(a, Decl(promiseType.ts, 76, 13)) +>a : Symbol(a, Decl(promiseType.ts, 64, 13)) } catch (e) { ->e : Symbol(e, Decl(promiseType.ts, 79, 11)) +>e : Symbol(e, Decl(promiseType.ts, 67, 11)) throw Error(); >Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) @@ -211,18 +136,18 @@ async function H() { } async function I() { ->I : Symbol(I, Decl(promiseType.ts, 82, 1)) +>I : Symbol(I, Decl(promiseType.ts, 70, 1)) try { const a = await p; ->a : Symbol(a, Decl(promiseType.ts, 86, 13)) +>a : Symbol(a, Decl(promiseType.ts, 74, 13)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) return a; ->a : Symbol(a, Decl(promiseType.ts, 86, 13)) +>a : Symbol(a, Decl(promiseType.ts, 74, 13)) } catch (e) { ->e : Symbol(e, Decl(promiseType.ts, 89, 11)) +>e : Symbol(e, Decl(promiseType.ts, 77, 11)) return Promise.reject(Error()); >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) @@ -235,390 +160,916 @@ async function I() { // addresses github issue #4903: const p00 = p.catch(); ->p00 : Symbol(p00, Decl(promiseType.ts, 96, 5)) ->p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>p00 : Symbol(p00, Decl(promiseType.ts, 84, 5)) +>p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) + +const p01 = p.then(); +>p01 : Symbol(p01, Decl(promiseType.ts, 85, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) -const p01 = p.catch(undefined); ->p01 : Symbol(p01, Decl(promiseType.ts, 97, 5)) ->p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p10 = p.catch(undefined); +>p10 : Symbol(p10, Decl(promiseType.ts, 87, 5)) +>p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) -const p07 = p.catch(null); ->p07 : Symbol(p07, Decl(promiseType.ts, 98, 5)) ->p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p11 = p.catch(null); +>p11 : Symbol(p11, Decl(promiseType.ts, 88, 5)) +>p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) -const p02 = p.catch(() => 1); ->p02 : Symbol(p02, Decl(promiseType.ts, 99, 5)) ->p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p12 = p.catch(() => 1); +>p12 : Symbol(p12, Decl(promiseType.ts, 89, 5)) +>p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) -const p03 = p.catch(() => {}); ->p03 : Symbol(p03, Decl(promiseType.ts, 100, 5)) ->p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p13 = p.catch(() => x); +>p13 : Symbol(p13, Decl(promiseType.ts, 90, 5)) +>p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseType.ts, 1, 11)) -const p04 = p.catch(() => {throw 1}); ->p04 : Symbol(p04, Decl(promiseType.ts, 101, 5)) ->p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p14 = p.catch(() => undefined); +>p14 : Symbol(p14, Decl(promiseType.ts, 91, 5)) +>p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p15 = p.catch(() => null); +>p15 : Symbol(p15, Decl(promiseType.ts, 92, 5)) +>p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) + +const p16 = p.catch(() => {}); +>p16 : Symbol(p16, Decl(promiseType.ts, 93, 5)) +>p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) + +const p17 = p.catch(() => {throw 1}); +>p17 : Symbol(p17, Decl(promiseType.ts, 94, 5)) +>p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) -const p05 = p.catch(() => Promise.reject(1)); ->p05 : Symbol(p05, Decl(promiseType.ts, 102, 5)) ->p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p18 = p.catch(() => Promise.reject(1)); +>p18 : Symbol(p18, Decl(promiseType.ts, 95, 5)) +>p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p06 = p.catch(() => Promise.resolve(1)); ->p06 : Symbol(p06, Decl(promiseType.ts, 103, 5)) ->p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p19 = p.catch(() => Promise.resolve(1)); +>p19 : Symbol(p19, Decl(promiseType.ts, 96, 5)) +>p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p10 = p.then(); ->p10 : Symbol(p10, Decl(promiseType.ts, 105, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p20 = p.then(undefined); +>p20 : Symbol(p20, Decl(promiseType.ts, 98, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) -const p20 = p.then(undefined); ->p20 : Symbol(p20, Decl(promiseType.ts, 107, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p21 = p.then(null); +>p21 : Symbol(p21, Decl(promiseType.ts, 99, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p22 = p.then(() => 1); +>p22 : Symbol(p22, Decl(promiseType.ts, 100, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p23 = p.then(() => x); +>p23 : Symbol(p23, Decl(promiseType.ts, 101, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseType.ts, 1, 11)) + +const p24 = p.then(() => undefined); +>p24 : Symbol(p24, Decl(promiseType.ts, 102, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) -const p21 = p.then(() => 1); ->p21 : Symbol(p21, Decl(promiseType.ts, 108, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p25 = p.then(() => null); +>p25 : Symbol(p25, Decl(promiseType.ts, 103, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) -const p22 = p.then(() => {}); ->p22 : Symbol(p22, Decl(promiseType.ts, 109, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p26 = p.then(() => {}); +>p26 : Symbol(p26, Decl(promiseType.ts, 104, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) -const p23 = p.then(() => {throw 1}); ->p23 : Symbol(p23, Decl(promiseType.ts, 110, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p27 = p.then(() => {throw 1}); +>p27 : Symbol(p27, Decl(promiseType.ts, 105, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) -const p24 = p.then(() => Promise.resolve(1)); ->p24 : Symbol(p24, Decl(promiseType.ts, 111, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p28 = p.then(() => Promise.resolve(1)); +>p28 : Symbol(p28, Decl(promiseType.ts, 106, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p25 = p.then(() => Promise.reject(1)); ->p25 : Symbol(p25, Decl(promiseType.ts, 112, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p29 = p.then(() => Promise.reject(1)); +>p29 : Symbol(p29, Decl(promiseType.ts, 107, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p30 = p.then(undefined, undefined); ->p30 : Symbol(p30, Decl(promiseType.ts, 114, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>p30 : Symbol(p30, Decl(promiseType.ts, 109, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) +>undefined : Symbol(undefined) + +const p31 = p.then(undefined, null); +>p31 : Symbol(p31, Decl(promiseType.ts, 110, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p32 = p.then(undefined, () => 1); +>p32 : Symbol(p32, Decl(promiseType.ts, 111, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p33 = p.then(undefined, () => x); +>p33 : Symbol(p33, Decl(promiseType.ts, 112, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) +>x : Symbol(x, Decl(promiseType.ts, 1, 11)) + +const p34 = p.then(undefined, () => undefined); +>p34 : Symbol(p34, Decl(promiseType.ts, 113, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) +>undefined : Symbol(undefined) + +const p35 = p.then(undefined, () => null); +>p35 : Symbol(p35, Decl(promiseType.ts, 114, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p36 = p.then(undefined, () => {}); +>p36 : Symbol(p36, Decl(promiseType.ts, 115, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p37 = p.then(undefined, () => {throw 1}); +>p37 : Symbol(p37, Decl(promiseType.ts, 116, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p38 = p.then(undefined, () => Promise.resolve(1)); +>p38 : Symbol(p38, Decl(promiseType.ts, 117, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const p39 = p.then(undefined, () => Promise.reject(1)); +>p39 : Symbol(p39, Decl(promiseType.ts, 118, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) +>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const p40 = p.then(null, undefined); +>p40 : Symbol(p40, Decl(promiseType.ts, 120, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p41 = p.then(null, null); +>p41 : Symbol(p41, Decl(promiseType.ts, 121, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p42 = p.then(null, () => 1); +>p42 : Symbol(p42, Decl(promiseType.ts, 122, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p43 = p.then(null, () => x); +>p43 : Symbol(p43, Decl(promiseType.ts, 123, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseType.ts, 1, 11)) + +const p44 = p.then(null, () => undefined); +>p44 : Symbol(p44, Decl(promiseType.ts, 124, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p45 = p.then(null, () => null); +>p45 : Symbol(p45, Decl(promiseType.ts, 125, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p46 = p.then(null, () => {}); +>p46 : Symbol(p46, Decl(promiseType.ts, 126, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p47 = p.then(null, () => {throw 1}); +>p47 : Symbol(p47, Decl(promiseType.ts, 127, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p48 = p.then(null, () => Promise.resolve(1)); +>p48 : Symbol(p48, Decl(promiseType.ts, 128, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const p49 = p.then(null, () => Promise.reject(1)); +>p49 : Symbol(p49, Decl(promiseType.ts, 129, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const p50 = p.then(() => "1", undefined); +>p50 : Symbol(p50, Decl(promiseType.ts, 131, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p51 = p.then(() => "1", null); +>p51 : Symbol(p51, Decl(promiseType.ts, 132, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p52 = p.then(() => "1", () => 1); +>p52 : Symbol(p52, Decl(promiseType.ts, 133, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p53 = p.then(() => "1", () => x); +>p53 : Symbol(p53, Decl(promiseType.ts, 134, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseType.ts, 1, 11)) + +const p54 = p.then(() => "1", () => undefined); +>p54 : Symbol(p54, Decl(promiseType.ts, 135, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p55 = p.then(() => "1", () => null); +>p55 : Symbol(p55, Decl(promiseType.ts, 136, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p56 = p.then(() => "1", () => {}); +>p56 : Symbol(p56, Decl(promiseType.ts, 137, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p57 = p.then(() => "1", () => {throw 1}); +>p57 : Symbol(p57, Decl(promiseType.ts, 138, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p58 = p.then(() => "1", () => Promise.resolve(1)); +>p58 : Symbol(p58, Decl(promiseType.ts, 139, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const p59 = p.then(() => "1", () => Promise.reject(1)); +>p59 : Symbol(p59, Decl(promiseType.ts, 140, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const p60 = p.then(() => x, undefined); +>p60 : Symbol(p60, Decl(promiseType.ts, 142, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseType.ts, 1, 11)) +>undefined : Symbol(undefined) + +const p61 = p.then(() => x, null); +>p61 : Symbol(p61, Decl(promiseType.ts, 143, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseType.ts, 1, 11)) + +const p62 = p.then(() => x, () => 1); +>p62 : Symbol(p62, Decl(promiseType.ts, 144, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseType.ts, 1, 11)) + +const p63 = p.then(() => x, () => x); +>p63 : Symbol(p63, Decl(promiseType.ts, 145, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseType.ts, 1, 11)) +>x : Symbol(x, Decl(promiseType.ts, 1, 11)) + +const p64 = p.then(() => x, () => undefined); +>p64 : Symbol(p64, Decl(promiseType.ts, 146, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseType.ts, 1, 11)) +>undefined : Symbol(undefined) + +const p65 = p.then(() => x, () => null); +>p65 : Symbol(p65, Decl(promiseType.ts, 147, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseType.ts, 1, 11)) + +const p66 = p.then(() => x, () => {}); +>p66 : Symbol(p66, Decl(promiseType.ts, 148, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseType.ts, 1, 11)) + +const p67 = p.then(() => x, () => {throw 1}); +>p67 : Symbol(p67, Decl(promiseType.ts, 149, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseType.ts, 1, 11)) + +const p68 = p.then(() => x, () => Promise.resolve(1)); +>p68 : Symbol(p68, Decl(promiseType.ts, 150, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseType.ts, 1, 11)) +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const p69 = p.then(() => x, () => Promise.reject(1)); +>p69 : Symbol(p69, Decl(promiseType.ts, 151, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseType.ts, 1, 11)) +>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const p70 = p.then(() => undefined, undefined); +>p70 : Symbol(p70, Decl(promiseType.ts, 153, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) >undefined : Symbol(undefined) -const p31 = p.then(undefined, () => 1); ->p31 : Symbol(p31, Decl(promiseType.ts, 115, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p71 = p.then(() => undefined, null); +>p71 : Symbol(p71, Decl(promiseType.ts, 154, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) -const p32 = p.then(undefined, () => {}); ->p32 : Symbol(p32, Decl(promiseType.ts, 116, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p72 = p.then(() => undefined, () => 1); +>p72 : Symbol(p72, Decl(promiseType.ts, 155, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) -const p33 = p.then(undefined, () => {throw 1}); ->p33 : Symbol(p33, Decl(promiseType.ts, 117, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p73 = p.then(() => undefined, () => x); +>p73 : Symbol(p73, Decl(promiseType.ts, 156, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) +>x : Symbol(x, Decl(promiseType.ts, 1, 11)) -const p34 = p.then(undefined, () => Promise.resolve(1)); ->p34 : Symbol(p34, Decl(promiseType.ts, 118, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p74 = p.then(() => undefined, () => undefined); +>p74 : Symbol(p74, Decl(promiseType.ts, 157, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) +>undefined : Symbol(undefined) + +const p75 = p.then(() => undefined, () => null); +>p75 : Symbol(p75, Decl(promiseType.ts, 158, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p76 = p.then(() => undefined, () => {}); +>p76 : Symbol(p76, Decl(promiseType.ts, 159, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p77 = p.then(() => undefined, () => {throw 1}); +>p77 : Symbol(p77, Decl(promiseType.ts, 160, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p78 = p.then(() => undefined, () => Promise.resolve(1)); +>p78 : Symbol(p78, Decl(promiseType.ts, 161, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p35 = p.then(undefined, () => Promise.reject(1)); ->p35 : Symbol(p35, Decl(promiseType.ts, 119, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p79 = p.then(() => undefined, () => Promise.reject(1)); +>p79 : Symbol(p79, Decl(promiseType.ts, 162, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p40 = p.then(() => "1", undefined); ->p40 : Symbol(p40, Decl(promiseType.ts, 121, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p80 = p.then(() => null, undefined); +>p80 : Symbol(p80, Decl(promiseType.ts, 164, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) -const p41 = p.then(() => "1", () => 1); ->p41 : Symbol(p41, Decl(promiseType.ts, 122, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p81 = p.then(() => null, null); +>p81 : Symbol(p81, Decl(promiseType.ts, 165, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) -const p42 = p.then(() => "1", () => {}); ->p42 : Symbol(p42, Decl(promiseType.ts, 123, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p82 = p.then(() => null, () => 1); +>p82 : Symbol(p82, Decl(promiseType.ts, 166, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) -const p43 = p.then(() => "1", () => {throw 1}); ->p43 : Symbol(p43, Decl(promiseType.ts, 124, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p83 = p.then(() => null, () => x); +>p83 : Symbol(p83, Decl(promiseType.ts, 167, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseType.ts, 1, 11)) -const p44 = p.then(() => "1", () => Promise.resolve(1)); ->p44 : Symbol(p44, Decl(promiseType.ts, 125, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p84 = p.then(() => null, () => undefined); +>p84 : Symbol(p84, Decl(promiseType.ts, 168, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p85 = p.then(() => null, () => null); +>p85 : Symbol(p85, Decl(promiseType.ts, 169, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p86 = p.then(() => null, () => {}); +>p86 : Symbol(p86, Decl(promiseType.ts, 170, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p87 = p.then(() => null, () => {throw 1}); +>p87 : Symbol(p87, Decl(promiseType.ts, 171, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p88 = p.then(() => null, () => Promise.resolve(1)); +>p88 : Symbol(p88, Decl(promiseType.ts, 172, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p45 = p.then(() => "1", () => Promise.reject(1)); ->p45 : Symbol(p45, Decl(promiseType.ts, 126, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p89 = p.then(() => null, () => Promise.reject(1)); +>p89 : Symbol(p89, Decl(promiseType.ts, 173, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p50 = p.then(() => {}, undefined); ->p50 : Symbol(p50, Decl(promiseType.ts, 128, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p90 = p.then(() => {}, undefined); +>p90 : Symbol(p90, Decl(promiseType.ts, 175, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) -const p51 = p.then(() => {}, () => 1); ->p51 : Symbol(p51, Decl(promiseType.ts, 129, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p91 = p.then(() => {}, null); +>p91 : Symbol(p91, Decl(promiseType.ts, 176, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) -const p52 = p.then(() => {}, () => {}); ->p52 : Symbol(p52, Decl(promiseType.ts, 130, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p92 = p.then(() => {}, () => 1); +>p92 : Symbol(p92, Decl(promiseType.ts, 177, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) -const p53 = p.then(() => {}, () => {throw 1}); ->p53 : Symbol(p53, Decl(promiseType.ts, 131, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p93 = p.then(() => {}, () => x); +>p93 : Symbol(p93, Decl(promiseType.ts, 178, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseType.ts, 1, 11)) -const p54 = p.then(() => {}, () => Promise.resolve(1)); ->p54 : Symbol(p54, Decl(promiseType.ts, 132, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p94 = p.then(() => {}, () => undefined); +>p94 : Symbol(p94, Decl(promiseType.ts, 179, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p95 = p.then(() => {}, () => null); +>p95 : Symbol(p95, Decl(promiseType.ts, 180, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p96 = p.then(() => {}, () => {}); +>p96 : Symbol(p96, Decl(promiseType.ts, 181, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p97 = p.then(() => {}, () => {throw 1}); +>p97 : Symbol(p97, Decl(promiseType.ts, 182, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p98 = p.then(() => {}, () => Promise.resolve(1)); +>p98 : Symbol(p98, Decl(promiseType.ts, 183, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p55 = p.then(() => {}, () => Promise.reject(1)); ->p55 : Symbol(p55, Decl(promiseType.ts, 133, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p99 = p.then(() => {}, () => Promise.reject(1)); +>p99 : Symbol(p99, Decl(promiseType.ts, 184, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p60 = p.then(() => {throw 1}, undefined); ->p60 : Symbol(p60, Decl(promiseType.ts, 135, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pa0 = p.then(() => {throw 1}, undefined); +>pa0 : Symbol(pa0, Decl(promiseType.ts, 186, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) -const p61 = p.then(() => {throw 1}, () => 1); ->p61 : Symbol(p61, Decl(promiseType.ts, 136, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pa1 = p.then(() => {throw 1}, null); +>pa1 : Symbol(pa1, Decl(promiseType.ts, 187, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const pa2 = p.then(() => {throw 1}, () => 1); +>pa2 : Symbol(pa2, Decl(promiseType.ts, 188, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) -const p62 = p.then(() => {throw 1}, () => {}); ->p62 : Symbol(p62, Decl(promiseType.ts, 137, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pa3 = p.then(() => {throw 1}, () => x); +>pa3 : Symbol(pa3, Decl(promiseType.ts, 189, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseType.ts, 1, 11)) -const p63 = p.then(() => {throw 1}, () => {throw 1}); ->p63 : Symbol(p63, Decl(promiseType.ts, 138, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pa4 = p.then(() => {throw 1}, () => undefined); +>pa4 : Symbol(pa4, Decl(promiseType.ts, 190, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) -const p64 = p.then(() => {throw 1}, () => Promise.resolve(1)); ->p64 : Symbol(p64, Decl(promiseType.ts, 139, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pa5 = p.then(() => {throw 1}, () => null); +>pa5 : Symbol(pa5, Decl(promiseType.ts, 191, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const pa6 = p.then(() => {throw 1}, () => {}); +>pa6 : Symbol(pa6, Decl(promiseType.ts, 192, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const pa7 = p.then(() => {throw 1}, () => {throw 1}); +>pa7 : Symbol(pa7, Decl(promiseType.ts, 193, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const pa8 = p.then(() => {throw 1}, () => Promise.resolve(1)); +>pa8 : Symbol(pa8, Decl(promiseType.ts, 194, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p65 = p.then(() => {throw 1}, () => Promise.reject(1)); ->p65 : Symbol(p65, Decl(promiseType.ts, 140, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pa9 = p.then(() => {throw 1}, () => Promise.reject(1)); +>pa9 : Symbol(pa9, Decl(promiseType.ts, 195, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p70 = p.then(() => Promise.resolve("1"), undefined); ->p70 : Symbol(p70, Decl(promiseType.ts, 142, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pb0 = p.then(() => Promise.resolve("1"), undefined); +>pb0 : Symbol(pb0, Decl(promiseType.ts, 197, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) -const p71 = p.then(() => Promise.resolve("1"), () => 1); ->p71 : Symbol(p71, Decl(promiseType.ts, 143, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pb1 = p.then(() => Promise.resolve("1"), null); +>pb1 : Symbol(pb1, Decl(promiseType.ts, 198, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const pb2 = p.then(() => Promise.resolve("1"), () => 1); +>pb2 : Symbol(pb2, Decl(promiseType.ts, 199, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p72 = p.then(() => Promise.resolve("1"), () => {}); ->p72 : Symbol(p72, Decl(promiseType.ts, 144, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pb3 = p.then(() => Promise.resolve("1"), () => x); +>pb3 : Symbol(pb3, Decl(promiseType.ts, 200, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseType.ts, 1, 11)) -const p73 = p.then(() => Promise.resolve("1"), () => {throw 1}); ->p73 : Symbol(p73, Decl(promiseType.ts, 145, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pb4 = p.then(() => Promise.resolve("1"), () => undefined); +>pb4 : Symbol(pb4, Decl(promiseType.ts, 201, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) -const p74 = p.then(() => Promise.resolve("1"), () => Promise.resolve(1)); ->p74 : Symbol(p74, Decl(promiseType.ts, 146, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pb5 = p.then(() => Promise.resolve("1"), () => null); +>pb5 : Symbol(pb5, Decl(promiseType.ts, 202, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const pb6 = p.then(() => Promise.resolve("1"), () => {}); +>pb6 : Symbol(pb6, Decl(promiseType.ts, 203, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p75 = p.then(() => Promise.resolve("1"), () => Promise.reject(1)); ->p75 : Symbol(p75, Decl(promiseType.ts, 147, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pb7 = p.then(() => Promise.resolve("1"), () => {throw 1}); +>pb7 : Symbol(pb7, Decl(promiseType.ts, 204, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const pb8 = p.then(() => Promise.resolve("1"), () => Promise.resolve(1)); +>pb8 : Symbol(pb8, Decl(promiseType.ts, 205, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const pb9 = p.then(() => Promise.resolve("1"), () => Promise.reject(1)); +>pb9 : Symbol(pb9, Decl(promiseType.ts, 206, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const pc0 = p.then(() => Promise.reject("1"), undefined); +>pc0 : Symbol(pc0, Decl(promiseType.ts, 208, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const pc1 = p.then(() => Promise.reject("1"), null); +>pc1 : Symbol(pc1, Decl(promiseType.ts, 209, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const pc2 = p.then(() => Promise.reject("1"), () => 1); +>pc2 : Symbol(pc2, Decl(promiseType.ts, 210, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const pc3 = p.then(() => Promise.reject("1"), () => x); +>pc3 : Symbol(pc3, Decl(promiseType.ts, 211, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseType.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseType.ts, 1, 11)) -const p80 = p.then(() => Promise.reject(1), undefined); ->p80 : Symbol(p80, Decl(promiseType.ts, 149, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pc4 = p.then(() => Promise.reject("1"), () => undefined); +>pc4 : Symbol(pc4, Decl(promiseType.ts, 212, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) -const p81 = p.then(() => Promise.reject(1), () => 1); ->p81 : Symbol(p81, Decl(promiseType.ts, 150, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pc5 = p.then(() => Promise.reject("1"), () => null); +>pc5 : Symbol(pc5, Decl(promiseType.ts, 213, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p82 = p.then(() => Promise.reject(1), () => {}); ->p82 : Symbol(p82, Decl(promiseType.ts, 151, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pc6 = p.then(() => Promise.reject("1"), () => {}); +>pc6 : Symbol(pc6, Decl(promiseType.ts, 214, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p83 = p.then(() => Promise.reject(1), () => {throw 1}); ->p83 : Symbol(p83, Decl(promiseType.ts, 152, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pc7 = p.then(() => Promise.reject("1"), () => {throw 1}); +>pc7 : Symbol(pc7, Decl(promiseType.ts, 215, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p84 = p.then(() => Promise.reject(1), () => Promise.resolve(1)); ->p84 : Symbol(p84, Decl(promiseType.ts, 153, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1)); +>pc8 : Symbol(pc8, Decl(promiseType.ts, 216, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) @@ -626,11 +1077,11 @@ const p84 = p.then(() => Promise.reject(1), () => Promise.resolve(1)); >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p85 = p.then(() => Promise.reject(1), () => Promise.reject(1)); ->p85 : Symbol(p85, Decl(promiseType.ts, 154, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1)); +>pc9 : Symbol(pc9, Decl(promiseType.ts, 217, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) diff --git a/tests/baselines/reference/promiseType.types b/tests/baselines/reference/promiseType.types index 3d055f73f0a9a..3228d266319f5 100644 --- a/tests/baselines/reference/promiseType.types +++ b/tests/baselines/reference/promiseType.types @@ -3,124 +3,8 @@ declare var p: Promise; >p : Promise >Promise : Promise -const a = p.then(); ->a : Promise ->p.then() : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } - -const b = p.then(b => 1); ->b : Promise<1> ->p.then(b => 1) : Promise<1> ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->b => 1 : (b: boolean) => 1 ->b : boolean ->1 : 1 - -const c = p.then(b => 1, e => 'error'); ->c : Promise ->p.then(b => 1, e => 'error') : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->b => 1 : (b: boolean) => 1 ->b : boolean ->1 : 1 ->e => 'error' : (e: any) => string ->e : any ->'error' : "error" - -const d = p.then(b => 1, e => { }); ->d : Promise ->p.then(b => 1, e => { }) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->b => 1 : (b: boolean) => 1 ->b : boolean ->1 : 1 ->e => { } : (e: any) => void ->e : any - -const e = p.then(b => 1, e => { throw Error(); }); ->e : Promise<1> ->p.then(b => 1, e => { throw Error(); }) : Promise<1> ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->b => 1 : (b: boolean) => 1 ->b : boolean ->1 : 1 ->e => { throw Error(); } : (e: any) => never ->e : any ->Error() : Error ->Error : ErrorConstructor - -const f = p.then(b => 1, e => Promise.reject(Error())); ->f : Promise<1> ->p.then(b => 1, e => Promise.reject(Error())) : Promise<1> ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->b => 1 : (b: boolean) => 1 ->b : boolean ->1 : 1 ->e => Promise.reject(Error()) : (e: any) => Promise ->e : any ->Promise.reject(Error()) : Promise ->Promise.reject : { (reason: any): Promise; (reason: any): Promise; } ->Promise : PromiseConstructor ->reject : { (reason: any): Promise; (reason: any): Promise; } ->Error() : Error ->Error : ErrorConstructor - -const g = p.catch(e => 'error'); ->g : Promise ->p.catch(e => 'error') : Promise ->p.catch : { (onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } ->p : Promise ->catch : { (onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } ->e => 'error' : (e: any) => "error" ->e : any ->'error' : "error" - -const h = p.catch(e => { }); ->h : Promise ->p.catch(e => { }) : Promise ->p.catch : { (onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } ->p : Promise ->catch : { (onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } ->e => { } : (e: any) => void ->e : any - -const i = p.catch(e => { throw Error(); }); ->i : Promise ->p.catch(e => { throw Error(); }) : Promise ->p.catch : { (onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } ->p : Promise ->catch : { (onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } ->e => { throw Error(); } : (e: any) => never ->e : any ->Error() : Error ->Error : ErrorConstructor - -const j = p.catch(e => Promise.reject(Error())); ->j : Promise ->p.catch(e => Promise.reject(Error())) : Promise ->p.catch : { (onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } ->p : Promise ->catch : { (onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } ->e => Promise.reject(Error()) : (e: any) => Promise ->e : any ->Promise.reject(Error()) : Promise ->Promise.reject : { (reason: any): Promise; (reason: any): Promise; } ->Promise : PromiseConstructor ->reject : { (reason: any): Promise; (reason: any): Promise; } ->Error() : Error ->Error : ErrorConstructor +declare var x: any; +>x : any async function A() { >A : () => Promise @@ -146,17 +30,25 @@ async function B() { >1 : 1 } -// NOTE: This reports a "No best comment type exists among return expressions." error, and is -// ignored to get the types result for the test. -// async function C() { -// try { -// const a = await p; -// return 1; -// } -// catch (e) { -// return 'error'; -// } -// } +async function C() { +>C : () => Promise<1 | "error"> + + try { + const a = await p; +>a : boolean +>await p : boolean +>p : Promise + + return 1; +>1 : 1 + } + catch (e) { +>e : any + + return 'error'; +>'error' : "error" + } +} async function D() { >D : () => Promise @@ -291,58 +183,92 @@ async function I() { const p00 = p.catch(); >p00 : Promise >p.catch() : Promise ->p.catch : { (onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +>p.catch : (onrejected?: (reason: any) => TResult | PromiseLike) => Promise >p : Promise ->catch : { (onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +>catch : (onrejected?: (reason: any) => TResult | PromiseLike) => Promise -const p01 = p.catch(undefined); +const p01 = p.then(); >p01 : Promise +>p.then() : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise + +const p10 = p.catch(undefined); +>p10 : Promise >p.catch(undefined) : Promise ->p.catch : { (onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +>p.catch : (onrejected?: (reason: any) => TResult | PromiseLike) => Promise >p : Promise ->catch : { (onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +>catch : (onrejected?: (reason: any) => TResult | PromiseLike) => Promise >undefined : undefined -const p07 = p.catch(null); ->p07 : Promise +const p11 = p.catch(null); +>p11 : Promise >p.catch(null) : Promise ->p.catch : { (onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +>p.catch : (onrejected?: (reason: any) => TResult | PromiseLike) => Promise >p : Promise ->catch : { (onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +>catch : (onrejected?: (reason: any) => TResult | PromiseLike) => Promise >null : null -const p02 = p.catch(() => 1); ->p02 : Promise ->p.catch(() => 1) : Promise ->p.catch : { (onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +const p12 = p.catch(() => 1); +>p12 : Promise +>p.catch(() => 1) : Promise +>p.catch : (onrejected?: (reason: any) => TResult | PromiseLike) => Promise >p : Promise ->catch : { (onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } ->() => 1 : () => 1 +>catch : (onrejected?: (reason: any) => TResult | PromiseLike) => Promise +>() => 1 : () => number >1 : 1 -const p03 = p.catch(() => {}); ->p03 : Promise +const p13 = p.catch(() => x); +>p13 : Promise +>p.catch(() => x) : Promise +>p.catch : (onrejected?: (reason: any) => TResult | PromiseLike) => Promise +>p : Promise +>catch : (onrejected?: (reason: any) => TResult | PromiseLike) => Promise +>() => x : () => any +>x : any + +const p14 = p.catch(() => undefined); +>p14 : Promise +>p.catch(() => undefined) : Promise +>p.catch : (onrejected?: (reason: any) => TResult | PromiseLike) => Promise +>p : Promise +>catch : (onrejected?: (reason: any) => TResult | PromiseLike) => Promise +>() => undefined : () => any +>undefined : undefined + +const p15 = p.catch(() => null); +>p15 : Promise +>p.catch(() => null) : Promise +>p.catch : (onrejected?: (reason: any) => TResult | PromiseLike) => Promise +>p : Promise +>catch : (onrejected?: (reason: any) => TResult | PromiseLike) => Promise +>() => null : () => any +>null : null + +const p16 = p.catch(() => {}); +>p16 : Promise >p.catch(() => {}) : Promise ->p.catch : { (onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +>p.catch : (onrejected?: (reason: any) => TResult | PromiseLike) => Promise >p : Promise ->catch : { (onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +>catch : (onrejected?: (reason: any) => TResult | PromiseLike) => Promise >() => {} : () => void -const p04 = p.catch(() => {throw 1}); ->p04 : Promise +const p17 = p.catch(() => {throw 1}); +>p17 : Promise >p.catch(() => {throw 1}) : Promise ->p.catch : { (onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +>p.catch : (onrejected?: (reason: any) => TResult | PromiseLike) => Promise >p : Promise ->catch : { (onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +>catch : (onrejected?: (reason: any) => TResult | PromiseLike) => Promise >() => {throw 1} : () => never >1 : 1 -const p05 = p.catch(() => Promise.reject(1)); ->p05 : Promise +const p18 = p.catch(() => Promise.reject(1)); +>p18 : Promise >p.catch(() => Promise.reject(1)) : Promise ->p.catch : { (onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +>p.catch : (onrejected?: (reason: any) => TResult | PromiseLike) => Promise >p : Promise ->catch : { (onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +>catch : (onrejected?: (reason: any) => TResult | PromiseLike) => Promise >() => Promise.reject(1) : () => Promise >Promise.reject(1) : Promise >Promise.reject : { (reason: any): Promise; (reason: any): Promise; } @@ -350,12 +276,12 @@ const p05 = p.catch(() => Promise.reject(1)); >reject : { (reason: any): Promise; (reason: any): Promise; } >1 : 1 -const p06 = p.catch(() => Promise.resolve(1)); ->p06 : Promise +const p19 = p.catch(() => Promise.resolve(1)); +>p19 : Promise >p.catch(() => Promise.resolve(1)) : Promise ->p.catch : { (onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +>p.catch : (onrejected?: (reason: any) => TResult | PromiseLike) => Promise >p : Promise ->catch : { (onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +>catch : (onrejected?: (reason: any) => TResult | PromiseLike) => Promise >() => Promise.resolve(1) : () => Promise >Promise.resolve(1) : Promise >Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } @@ -363,53 +289,81 @@ const p06 = p.catch(() => Promise.resolve(1)); >resolve : { (value: T | PromiseLike): Promise; (): Promise; } >1 : 1 -const p10 = p.then(); ->p10 : Promise ->p.then() : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } - const p20 = p.then(undefined); >p20 : Promise >p.then(undefined) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >undefined : undefined -const p21 = p.then(() => 1); ->p21 : Promise<1> ->p.then(() => 1) : Promise<1> ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const p21 = p.then(null); +>p21 : Promise +>p.then(null) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>null : null + +const p22 = p.then(() => 1); +>p22 : Promise +>p.then(() => 1) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->() => 1 : () => 1 +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => 1 : () => number >1 : 1 -const p22 = p.then(() => {}); ->p22 : Promise +const p23 = p.then(() => x); +>p23 : Promise +>p.then(() => x) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => x : () => any +>x : any + +const p24 = p.then(() => undefined); +>p24 : Promise +>p.then(() => undefined) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => undefined : () => any +>undefined : undefined + +const p25 = p.then(() => null); +>p25 : Promise +>p.then(() => null) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => null : () => any +>null : null + +const p26 = p.then(() => {}); +>p26 : Promise >p.then(() => {}) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >() => {} : () => void -const p23 = p.then(() => {throw 1}); ->p23 : Promise ->p.then(() => {throw 1}) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const p27 = p.then(() => {throw 1}); +>p27 : Promise +>p.then(() => {throw 1}) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >() => {throw 1} : () => never >1 : 1 -const p24 = p.then(() => Promise.resolve(1)); ->p24 : Promise +const p28 = p.then(() => Promise.resolve(1)); +>p28 : Promise >p.then(() => Promise.resolve(1)) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >() => Promise.resolve(1) : () => Promise >Promise.resolve(1) : Promise >Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } @@ -417,12 +371,12 @@ const p24 = p.then(() => Promise.resolve(1)); >resolve : { (value: T | PromiseLike): Promise; (): Promise; } >1 : 1 -const p25 = p.then(() => Promise.reject(1)); ->p25 : Promise ->p.then(() => Promise.reject(1)) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const p29 = p.then(() => Promise.reject(1)); +>p29 : Promise +>p.then(() => Promise.reject(1)) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >() => Promise.reject(1) : () => Promise >Promise.reject(1) : Promise >Promise.reject : { (reason: any): Promise; (reason: any): Promise; } @@ -433,47 +387,86 @@ const p25 = p.then(() => Promise.reject(1)); const p30 = p.then(undefined, undefined); >p30 : Promise >p.then(undefined, undefined) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >undefined : undefined >undefined : undefined -const p31 = p.then(undefined, () => 1); ->p31 : Promise ->p.then(undefined, () => 1) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const p31 = p.then(undefined, null); +>p31 : Promise +>p.then(undefined, null) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >undefined : undefined ->() => 1 : () => 1 +>null : null + +const p32 = p.then(undefined, () => 1); +>p32 : Promise +>p.then(undefined, () => 1) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>undefined : undefined +>() => 1 : () => number >1 : 1 -const p32 = p.then(undefined, () => {}); ->p32 : Promise +const p33 = p.then(undefined, () => x); +>p33 : Promise +>p.then(undefined, () => x) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>undefined : undefined +>() => x : () => any +>x : any + +const p34 = p.then(undefined, () => undefined); +>p34 : Promise +>p.then(undefined, () => undefined) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>undefined : undefined +>() => undefined : () => any +>undefined : undefined + +const p35 = p.then(undefined, () => null); +>p35 : Promise +>p.then(undefined, () => null) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>undefined : undefined +>() => null : () => any +>null : null + +const p36 = p.then(undefined, () => {}); +>p36 : Promise >p.then(undefined, () => {}) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >undefined : undefined >() => {} : () => void -const p33 = p.then(undefined, () => {throw 1}); ->p33 : Promise +const p37 = p.then(undefined, () => {throw 1}); +>p37 : Promise >p.then(undefined, () => {throw 1}) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >undefined : undefined >() => {throw 1} : () => never >1 : 1 -const p34 = p.then(undefined, () => Promise.resolve(1)); ->p34 : Promise +const p38 = p.then(undefined, () => Promise.resolve(1)); +>p38 : Promise >p.then(undefined, () => Promise.resolve(1)) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >undefined : undefined >() => Promise.resolve(1) : () => Promise >Promise.resolve(1) : Promise @@ -482,12 +475,12 @@ const p34 = p.then(undefined, () => Promise.resolve(1)); >resolve : { (value: T | PromiseLike): Promise; (): Promise; } >1 : 1 -const p35 = p.then(undefined, () => Promise.reject(1)); ->p35 : Promise +const p39 = p.then(undefined, () => Promise.reject(1)); +>p39 : Promise >p.then(undefined, () => Promise.reject(1)) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >undefined : undefined >() => Promise.reject(1) : () => Promise >Promise.reject(1) : Promise @@ -496,55 +489,203 @@ const p35 = p.then(undefined, () => Promise.reject(1)); >reject : { (reason: any): Promise; (reason: any): Promise; } >1 : 1 -const p40 = p.then(() => "1", undefined); ->p40 : Promise<"1"> ->p.then(() => "1", undefined) : Promise<"1"> ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const p40 = p.then(null, undefined); +>p40 : Promise +>p.then(null, undefined) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>null : null +>undefined : undefined + +const p41 = p.then(null, null); +>p41 : Promise +>p.then(null, null) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>null : null +>null : null + +const p42 = p.then(null, () => 1); +>p42 : Promise +>p.then(null, () => 1) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>null : null +>() => 1 : () => number +>1 : 1 + +const p43 = p.then(null, () => x); +>p43 : Promise +>p.then(null, () => x) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>null : null +>() => x : () => any +>x : any + +const p44 = p.then(null, () => undefined); +>p44 : Promise +>p.then(null, () => undefined) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>null : null +>() => undefined : () => any +>undefined : undefined + +const p45 = p.then(null, () => null); +>p45 : Promise +>p.then(null, () => null) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->() => "1" : () => "1" +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>null : null +>() => null : () => any +>null : null + +const p46 = p.then(null, () => {}); +>p46 : Promise +>p.then(null, () => {}) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>null : null +>() => {} : () => void + +const p47 = p.then(null, () => {throw 1}); +>p47 : Promise +>p.then(null, () => {throw 1}) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>null : null +>() => {throw 1} : () => never +>1 : 1 + +const p48 = p.then(null, () => Promise.resolve(1)); +>p48 : Promise +>p.then(null, () => Promise.resolve(1)) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>null : null +>() => Promise.resolve(1) : () => Promise +>Promise.resolve(1) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>1 : 1 + +const p49 = p.then(null, () => Promise.reject(1)); +>p49 : Promise +>p.then(null, () => Promise.reject(1)) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>null : null +>() => Promise.reject(1) : () => Promise +>Promise.reject(1) : Promise +>Promise.reject : { (reason: any): Promise; (reason: any): Promise; } +>Promise : PromiseConstructor +>reject : { (reason: any): Promise; (reason: any): Promise; } +>1 : 1 + +const p50 = p.then(() => "1", undefined); +>p50 : Promise +>p.then(() => "1", undefined) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => "1" : () => string >"1" : "1" >undefined : undefined -const p41 = p.then(() => "1", () => 1); ->p41 : Promise ->p.then(() => "1", () => 1) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const p51 = p.then(() => "1", null); +>p51 : Promise +>p.then(() => "1", null) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => "1" : () => string +>"1" : "1" +>null : null + +const p52 = p.then(() => "1", () => 1); +>p52 : Promise +>p.then(() => "1", () => 1) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->() => "1" : () => "1" +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => "1" : () => string >"1" : "1" >() => 1 : () => number >1 : 1 -const p42 = p.then(() => "1", () => {}); ->p42 : Promise ->p.then(() => "1", () => {}) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const p53 = p.then(() => "1", () => x); +>p53 : Promise +>p.then(() => "1", () => x) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => "1" : () => string +>"1" : "1" +>() => x : () => any +>x : any + +const p54 = p.then(() => "1", () => undefined); +>p54 : Promise +>p.then(() => "1", () => undefined) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => "1" : () => string +>"1" : "1" +>() => undefined : () => any +>undefined : undefined + +const p55 = p.then(() => "1", () => null); +>p55 : Promise +>p.then(() => "1", () => null) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->() => "1" : () => "1" +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => "1" : () => string +>"1" : "1" +>() => null : () => any +>null : null + +const p56 = p.then(() => "1", () => {}); +>p56 : Promise +>p.then(() => "1", () => {}) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => "1" : () => string >"1" : "1" >() => {} : () => void -const p43 = p.then(() => "1", () => {throw 1}); ->p43 : Promise<"1"> ->p.then(() => "1", () => {throw 1}) : Promise<"1"> ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const p57 = p.then(() => "1", () => {throw 1}); +>p57 : Promise +>p.then(() => "1", () => {throw 1}) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->() => "1" : () => "1" +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => "1" : () => string >"1" : "1" >() => {throw 1} : () => never >1 : 1 -const p44 = p.then(() => "1", () => Promise.resolve(1)); ->p44 : Promise ->p.then(() => "1", () => Promise.resolve(1)) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const p58 = p.then(() => "1", () => Promise.resolve(1)); +>p58 : Promise +>p.then(() => "1", () => Promise.resolve(1)) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->() => "1" : () => "1" +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => "1" : () => string >"1" : "1" >() => Promise.resolve(1) : () => Promise >Promise.resolve(1) : Promise @@ -553,13 +694,13 @@ const p44 = p.then(() => "1", () => Promise.resolve(1)); >resolve : { (value: T | PromiseLike): Promise; (): Promise; } >1 : 1 -const p45 = p.then(() => "1", () => Promise.reject(1)); ->p45 : Promise<"1"> ->p.then(() => "1", () => Promise.reject(1)) : Promise<"1"> ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const p59 = p.then(() => "1", () => Promise.reject(1)); +>p59 : Promise +>p.then(() => "1", () => Promise.reject(1)) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->() => "1" : () => "1" +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => "1" : () => string >"1" : "1" >() => Promise.reject(1) : () => Promise >Promise.reject(1) : Promise @@ -568,50 +709,434 @@ const p45 = p.then(() => "1", () => Promise.reject(1)); >reject : { (reason: any): Promise; (reason: any): Promise; } >1 : 1 -const p50 = p.then(() => {}, undefined); ->p50 : Promise +const p60 = p.then(() => x, undefined); +>p60 : Promise +>p.then(() => x, undefined) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => x : () => any +>x : any +>undefined : undefined + +const p61 = p.then(() => x, null); +>p61 : Promise +>p.then(() => x, null) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => x : () => any +>x : any +>null : null + +const p62 = p.then(() => x, () => 1); +>p62 : Promise +>p.then(() => x, () => 1) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => x : () => any +>x : any +>() => 1 : () => number +>1 : 1 + +const p63 = p.then(() => x, () => x); +>p63 : Promise +>p.then(() => x, () => x) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => x : () => any +>x : any +>() => x : () => any +>x : any + +const p64 = p.then(() => x, () => undefined); +>p64 : Promise +>p.then(() => x, () => undefined) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => x : () => any +>x : any +>() => undefined : () => any +>undefined : undefined + +const p65 = p.then(() => x, () => null); +>p65 : Promise +>p.then(() => x, () => null) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => x : () => any +>x : any +>() => null : () => any +>null : null + +const p66 = p.then(() => x, () => {}); +>p66 : Promise +>p.then(() => x, () => {}) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => x : () => any +>x : any +>() => {} : () => void + +const p67 = p.then(() => x, () => {throw 1}); +>p67 : Promise +>p.then(() => x, () => {throw 1}) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => x : () => any +>x : any +>() => {throw 1} : () => never +>1 : 1 + +const p68 = p.then(() => x, () => Promise.resolve(1)); +>p68 : Promise +>p.then(() => x, () => Promise.resolve(1)) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => x : () => any +>x : any +>() => Promise.resolve(1) : () => Promise +>Promise.resolve(1) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>1 : 1 + +const p69 = p.then(() => x, () => Promise.reject(1)); +>p69 : Promise +>p.then(() => x, () => Promise.reject(1)) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => x : () => any +>x : any +>() => Promise.reject(1) : () => Promise +>Promise.reject(1) : Promise +>Promise.reject : { (reason: any): Promise; (reason: any): Promise; } +>Promise : PromiseConstructor +>reject : { (reason: any): Promise; (reason: any): Promise; } +>1 : 1 + +const p70 = p.then(() => undefined, undefined); +>p70 : Promise +>p.then(() => undefined, undefined) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => undefined : () => any +>undefined : undefined +>undefined : undefined + +const p71 = p.then(() => undefined, null); +>p71 : Promise +>p.then(() => undefined, null) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => undefined : () => any +>undefined : undefined +>null : null + +const p72 = p.then(() => undefined, () => 1); +>p72 : Promise +>p.then(() => undefined, () => 1) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => undefined : () => any +>undefined : undefined +>() => 1 : () => number +>1 : 1 + +const p73 = p.then(() => undefined, () => x); +>p73 : Promise +>p.then(() => undefined, () => x) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => undefined : () => any +>undefined : undefined +>() => x : () => any +>x : any + +const p74 = p.then(() => undefined, () => undefined); +>p74 : Promise +>p.then(() => undefined, () => undefined) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => undefined : () => any +>undefined : undefined +>() => undefined : () => any +>undefined : undefined + +const p75 = p.then(() => undefined, () => null); +>p75 : Promise +>p.then(() => undefined, () => null) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => undefined : () => any +>undefined : undefined +>() => null : () => any +>null : null + +const p76 = p.then(() => undefined, () => {}); +>p76 : Promise +>p.then(() => undefined, () => {}) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => undefined : () => any +>undefined : undefined +>() => {} : () => void + +const p77 = p.then(() => undefined, () => {throw 1}); +>p77 : Promise +>p.then(() => undefined, () => {throw 1}) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => undefined : () => any +>undefined : undefined +>() => {throw 1} : () => never +>1 : 1 + +const p78 = p.then(() => undefined, () => Promise.resolve(1)); +>p78 : Promise +>p.then(() => undefined, () => Promise.resolve(1)) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => undefined : () => any +>undefined : undefined +>() => Promise.resolve(1) : () => Promise +>Promise.resolve(1) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>1 : 1 + +const p79 = p.then(() => undefined, () => Promise.reject(1)); +>p79 : Promise +>p.then(() => undefined, () => Promise.reject(1)) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => undefined : () => any +>undefined : undefined +>() => Promise.reject(1) : () => Promise +>Promise.reject(1) : Promise +>Promise.reject : { (reason: any): Promise; (reason: any): Promise; } +>Promise : PromiseConstructor +>reject : { (reason: any): Promise; (reason: any): Promise; } +>1 : 1 + +const p80 = p.then(() => null, undefined); +>p80 : Promise +>p.then(() => null, undefined) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => null : () => any +>null : null +>undefined : undefined + +const p81 = p.then(() => null, null); +>p81 : Promise +>p.then(() => null, null) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => null : () => any +>null : null +>null : null + +const p82 = p.then(() => null, () => 1); +>p82 : Promise +>p.then(() => null, () => 1) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => null : () => any +>null : null +>() => 1 : () => number +>1 : 1 + +const p83 = p.then(() => null, () => x); +>p83 : Promise +>p.then(() => null, () => x) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => null : () => any +>null : null +>() => x : () => any +>x : any + +const p84 = p.then(() => null, () => undefined); +>p84 : Promise +>p.then(() => null, () => undefined) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => null : () => any +>null : null +>() => undefined : () => any +>undefined : undefined + +const p85 = p.then(() => null, () => null); +>p85 : Promise +>p.then(() => null, () => null) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => null : () => any +>null : null +>() => null : () => any +>null : null + +const p86 = p.then(() => null, () => {}); +>p86 : Promise +>p.then(() => null, () => {}) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => null : () => any +>null : null +>() => {} : () => void + +const p87 = p.then(() => null, () => {throw 1}); +>p87 : Promise +>p.then(() => null, () => {throw 1}) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => null : () => any +>null : null +>() => {throw 1} : () => never +>1 : 1 + +const p88 = p.then(() => null, () => Promise.resolve(1)); +>p88 : Promise +>p.then(() => null, () => Promise.resolve(1)) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => null : () => any +>null : null +>() => Promise.resolve(1) : () => Promise +>Promise.resolve(1) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>1 : 1 + +const p89 = p.then(() => null, () => Promise.reject(1)); +>p89 : Promise +>p.then(() => null, () => Promise.reject(1)) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => null : () => any +>null : null +>() => Promise.reject(1) : () => Promise +>Promise.reject(1) : Promise +>Promise.reject : { (reason: any): Promise; (reason: any): Promise; } +>Promise : PromiseConstructor +>reject : { (reason: any): Promise; (reason: any): Promise; } +>1 : 1 + +const p90 = p.then(() => {}, undefined); +>p90 : Promise >p.then(() => {}, undefined) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >() => {} : () => void >undefined : undefined -const p51 = p.then(() => {}, () => 1); ->p51 : Promise +const p91 = p.then(() => {}, null); +>p91 : Promise +>p.then(() => {}, null) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => {} : () => void +>null : null + +const p92 = p.then(() => {}, () => 1); +>p92 : Promise >p.then(() => {}, () => 1) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >() => {} : () => void >() => 1 : () => number >1 : 1 -const p52 = p.then(() => {}, () => {}); ->p52 : Promise +const p93 = p.then(() => {}, () => x); +>p93 : Promise +>p.then(() => {}, () => x) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => {} : () => void +>() => x : () => any +>x : any + +const p94 = p.then(() => {}, () => undefined); +>p94 : Promise +>p.then(() => {}, () => undefined) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => {} : () => void +>() => undefined : () => any +>undefined : undefined + +const p95 = p.then(() => {}, () => null); +>p95 : Promise +>p.then(() => {}, () => null) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => {} : () => void +>() => null : () => any +>null : null + +const p96 = p.then(() => {}, () => {}); +>p96 : Promise >p.then(() => {}, () => {}) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >() => {} : () => void >() => {} : () => void -const p53 = p.then(() => {}, () => {throw 1}); ->p53 : Promise +const p97 = p.then(() => {}, () => {throw 1}); +>p97 : Promise >p.then(() => {}, () => {throw 1}) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >() => {} : () => void >() => {throw 1} : () => never >1 : 1 -const p54 = p.then(() => {}, () => Promise.resolve(1)); ->p54 : Promise +const p98 = p.then(() => {}, () => Promise.resolve(1)); +>p98 : Promise >p.then(() => {}, () => Promise.resolve(1)) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >() => {} : () => void >() => Promise.resolve(1) : () => Promise >Promise.resolve(1) : Promise @@ -620,12 +1145,12 @@ const p54 = p.then(() => {}, () => Promise.resolve(1)); >resolve : { (value: T | PromiseLike): Promise; (): Promise; } >1 : 1 -const p55 = p.then(() => {}, () => Promise.reject(1)); ->p55 : Promise +const p99 = p.then(() => {}, () => Promise.reject(1)); +>p99 : Promise >p.then(() => {}, () => Promise.reject(1)) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >() => {} : () => void >() => Promise.reject(1) : () => Promise >Promise.reject(1) : Promise @@ -634,54 +1159,97 @@ const p55 = p.then(() => {}, () => Promise.reject(1)); >reject : { (reason: any): Promise; (reason: any): Promise; } >1 : 1 -const p60 = p.then(() => {throw 1}, undefined); ->p60 : Promise ->p.then(() => {throw 1}, undefined) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const pa0 = p.then(() => {throw 1}, undefined); +>pa0 : Promise +>p.then(() => {throw 1}, undefined) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >() => {throw 1} : () => never >1 : 1 >undefined : undefined -const p61 = p.then(() => {throw 1}, () => 1); ->p61 : Promise ->p.then(() => {throw 1}, () => 1) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const pa1 = p.then(() => {throw 1}, null); +>pa1 : Promise +>p.then(() => {throw 1}, null) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => {throw 1} : () => never +>1 : 1 +>null : null + +const pa2 = p.then(() => {throw 1}, () => 1); +>pa2 : Promise +>p.then(() => {throw 1}, () => 1) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => {throw 1} : () => never +>1 : 1 +>() => 1 : () => number +>1 : 1 + +const pa3 = p.then(() => {throw 1}, () => x); +>pa3 : Promise +>p.then(() => {throw 1}, () => x) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >() => {throw 1} : () => never >1 : 1 ->() => 1 : () => 1 +>() => x : () => any +>x : any + +const pa4 = p.then(() => {throw 1}, () => undefined); +>pa4 : Promise +>p.then(() => {throw 1}, () => undefined) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => {throw 1} : () => never +>1 : 1 +>() => undefined : () => any +>undefined : undefined + +const pa5 = p.then(() => {throw 1}, () => null); +>pa5 : Promise +>p.then(() => {throw 1}, () => null) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => {throw 1} : () => never >1 : 1 +>() => null : () => any +>null : null -const p62 = p.then(() => {throw 1}, () => {}); ->p62 : Promise ->p.then(() => {throw 1}, () => {}) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const pa6 = p.then(() => {throw 1}, () => {}); +>pa6 : Promise +>p.then(() => {throw 1}, () => {}) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >() => {throw 1} : () => never >1 : 1 >() => {} : () => void -const p63 = p.then(() => {throw 1}, () => {throw 1}); ->p63 : Promise ->p.then(() => {throw 1}, () => {throw 1}) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const pa7 = p.then(() => {throw 1}, () => {throw 1}); +>pa7 : Promise +>p.then(() => {throw 1}, () => {throw 1}) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >() => {throw 1} : () => never >1 : 1 >() => {throw 1} : () => never >1 : 1 -const p64 = p.then(() => {throw 1}, () => Promise.resolve(1)); ->p64 : Promise ->p.then(() => {throw 1}, () => Promise.resolve(1)) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const pa8 = p.then(() => {throw 1}, () => Promise.resolve(1)); +>pa8 : Promise +>p.then(() => {throw 1}, () => Promise.resolve(1)) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >() => {throw 1} : () => never >1 : 1 >() => Promise.resolve(1) : () => Promise @@ -691,12 +1259,12 @@ const p64 = p.then(() => {throw 1}, () => Promise.resolve(1)); >resolve : { (value: T | PromiseLike): Promise; (): Promise; } >1 : 1 -const p65 = p.then(() => {throw 1}, () => Promise.reject(1)); ->p65 : Promise ->p.then(() => {throw 1}, () => Promise.reject(1)) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const pa9 = p.then(() => {throw 1}, () => Promise.reject(1)); +>pa9 : Promise +>p.then(() => {throw 1}, () => Promise.reject(1)) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >() => {throw 1} : () => never >1 : 1 >() => Promise.reject(1) : () => Promise @@ -706,12 +1274,12 @@ const p65 = p.then(() => {throw 1}, () => Promise.reject(1)); >reject : { (reason: any): Promise; (reason: any): Promise; } >1 : 1 -const p70 = p.then(() => Promise.resolve("1"), undefined); ->p70 : Promise +const pb0 = p.then(() => Promise.resolve("1"), undefined); +>pb0 : Promise >p.then(() => Promise.resolve("1"), undefined) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >() => Promise.resolve("1") : () => Promise >Promise.resolve("1") : Promise >Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } @@ -720,12 +1288,26 @@ const p70 = p.then(() => Promise.resolve("1"), undefined); >"1" : "1" >undefined : undefined -const p71 = p.then(() => Promise.resolve("1"), () => 1); ->p71 : Promise +const pb1 = p.then(() => Promise.resolve("1"), null); +>pb1 : Promise +>p.then(() => Promise.resolve("1"), null) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => Promise.resolve("1") : () => Promise +>Promise.resolve("1") : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>"1" : "1" +>null : null + +const pb2 = p.then(() => Promise.resolve("1"), () => 1); +>pb2 : Promise >p.then(() => Promise.resolve("1"), () => 1) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >() => Promise.resolve("1") : () => Promise >Promise.resolve("1") : Promise >Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } @@ -735,12 +1317,57 @@ const p71 = p.then(() => Promise.resolve("1"), () => 1); >() => 1 : () => number >1 : 1 -const p72 = p.then(() => Promise.resolve("1"), () => {}); ->p72 : Promise +const pb3 = p.then(() => Promise.resolve("1"), () => x); +>pb3 : Promise +>p.then(() => Promise.resolve("1"), () => x) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => Promise.resolve("1") : () => Promise +>Promise.resolve("1") : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>"1" : "1" +>() => x : () => any +>x : any + +const pb4 = p.then(() => Promise.resolve("1"), () => undefined); +>pb4 : Promise +>p.then(() => Promise.resolve("1"), () => undefined) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => Promise.resolve("1") : () => Promise +>Promise.resolve("1") : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>"1" : "1" +>() => undefined : () => any +>undefined : undefined + +const pb5 = p.then(() => Promise.resolve("1"), () => null); +>pb5 : Promise +>p.then(() => Promise.resolve("1"), () => null) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => Promise.resolve("1") : () => Promise +>Promise.resolve("1") : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>"1" : "1" +>() => null : () => any +>null : null + +const pb6 = p.then(() => Promise.resolve("1"), () => {}); +>pb6 : Promise >p.then(() => Promise.resolve("1"), () => {}) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >() => Promise.resolve("1") : () => Promise >Promise.resolve("1") : Promise >Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } @@ -749,12 +1376,12 @@ const p72 = p.then(() => Promise.resolve("1"), () => {}); >"1" : "1" >() => {} : () => void -const p73 = p.then(() => Promise.resolve("1"), () => {throw 1}); ->p73 : Promise +const pb7 = p.then(() => Promise.resolve("1"), () => {throw 1}); +>pb7 : Promise >p.then(() => Promise.resolve("1"), () => {throw 1}) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >() => Promise.resolve("1") : () => Promise >Promise.resolve("1") : Promise >Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } @@ -764,12 +1391,12 @@ const p73 = p.then(() => Promise.resolve("1"), () => {throw 1}); >() => {throw 1} : () => never >1 : 1 -const p74 = p.then(() => Promise.resolve("1"), () => Promise.resolve(1)); ->p74 : Promise +const pb8 = p.then(() => Promise.resolve("1"), () => Promise.resolve(1)); +>pb8 : Promise >p.then(() => Promise.resolve("1"), () => Promise.resolve(1)) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >() => Promise.resolve("1") : () => Promise >Promise.resolve("1") : Promise >Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } @@ -783,12 +1410,12 @@ const p74 = p.then(() => Promise.resolve("1"), () => Promise.resolve(1)); >resolve : { (value: T | PromiseLike): Promise; (): Promise; } >1 : 1 -const p75 = p.then(() => Promise.resolve("1"), () => Promise.reject(1)); ->p75 : Promise +const pb9 = p.then(() => Promise.resolve("1"), () => Promise.reject(1)); +>pb9 : Promise >p.then(() => Promise.resolve("1"), () => Promise.reject(1)) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >() => Promise.resolve("1") : () => Promise >Promise.resolve("1") : Promise >Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } @@ -802,76 +1429,135 @@ const p75 = p.then(() => Promise.resolve("1"), () => Promise.reject(1)); >reject : { (reason: any): Promise; (reason: any): Promise; } >1 : 1 -const p80 = p.then(() => Promise.reject(1), undefined); ->p80 : Promise ->p.then(() => Promise.reject(1), undefined) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const pc0 = p.then(() => Promise.reject("1"), undefined); +>pc0 : Promise +>p.then(() => Promise.reject("1"), undefined) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->() => Promise.reject(1) : () => Promise ->Promise.reject(1) : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => Promise.reject("1") : () => Promise +>Promise.reject("1") : Promise >Promise.reject : { (reason: any): Promise; (reason: any): Promise; } >Promise : PromiseConstructor >reject : { (reason: any): Promise; (reason: any): Promise; } ->1 : 1 +>"1" : "1" >undefined : undefined -const p81 = p.then(() => Promise.reject(1), () => 1); ->p81 : Promise ->p.then(() => Promise.reject(1), () => 1) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const pc1 = p.then(() => Promise.reject("1"), null); +>pc1 : Promise +>p.then(() => Promise.reject("1"), null) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->() => Promise.reject(1) : () => Promise ->Promise.reject(1) : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => Promise.reject("1") : () => Promise +>Promise.reject("1") : Promise >Promise.reject : { (reason: any): Promise; (reason: any): Promise; } >Promise : PromiseConstructor >reject : { (reason: any): Promise; (reason: any): Promise; } ->1 : 1 ->() => 1 : () => 1 ->1 : 1 +>"1" : "1" +>null : null -const p82 = p.then(() => Promise.reject(1), () => {}); ->p82 : Promise ->p.then(() => Promise.reject(1), () => {}) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const pc2 = p.then(() => Promise.reject("1"), () => 1); +>pc2 : Promise +>p.then(() => Promise.reject("1"), () => 1) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->() => Promise.reject(1) : () => Promise ->Promise.reject(1) : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => Promise.reject("1") : () => Promise +>Promise.reject("1") : Promise >Promise.reject : { (reason: any): Promise; (reason: any): Promise; } >Promise : PromiseConstructor >reject : { (reason: any): Promise; (reason: any): Promise; } +>"1" : "1" +>() => 1 : () => number >1 : 1 + +const pc3 = p.then(() => Promise.reject("1"), () => x); +>pc3 : Promise +>p.then(() => Promise.reject("1"), () => x) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => Promise.reject("1") : () => Promise +>Promise.reject("1") : Promise +>Promise.reject : { (reason: any): Promise; (reason: any): Promise; } +>Promise : PromiseConstructor +>reject : { (reason: any): Promise; (reason: any): Promise; } +>"1" : "1" +>() => x : () => any +>x : any + +const pc4 = p.then(() => Promise.reject("1"), () => undefined); +>pc4 : Promise +>p.then(() => Promise.reject("1"), () => undefined) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => Promise.reject("1") : () => Promise +>Promise.reject("1") : Promise +>Promise.reject : { (reason: any): Promise; (reason: any): Promise; } +>Promise : PromiseConstructor +>reject : { (reason: any): Promise; (reason: any): Promise; } +>"1" : "1" +>() => undefined : () => any +>undefined : undefined + +const pc5 = p.then(() => Promise.reject("1"), () => null); +>pc5 : Promise +>p.then(() => Promise.reject("1"), () => null) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => Promise.reject("1") : () => Promise +>Promise.reject("1") : Promise +>Promise.reject : { (reason: any): Promise; (reason: any): Promise; } +>Promise : PromiseConstructor +>reject : { (reason: any): Promise; (reason: any): Promise; } +>"1" : "1" +>() => null : () => any +>null : null + +const pc6 = p.then(() => Promise.reject("1"), () => {}); +>pc6 : Promise +>p.then(() => Promise.reject("1"), () => {}) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => Promise.reject("1") : () => Promise +>Promise.reject("1") : Promise +>Promise.reject : { (reason: any): Promise; (reason: any): Promise; } +>Promise : PromiseConstructor +>reject : { (reason: any): Promise; (reason: any): Promise; } +>"1" : "1" >() => {} : () => void -const p83 = p.then(() => Promise.reject(1), () => {throw 1}); ->p83 : Promise ->p.then(() => Promise.reject(1), () => {throw 1}) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const pc7 = p.then(() => Promise.reject("1"), () => {throw 1}); +>pc7 : Promise +>p.then(() => Promise.reject("1"), () => {throw 1}) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->() => Promise.reject(1) : () => Promise ->Promise.reject(1) : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => Promise.reject("1") : () => Promise +>Promise.reject("1") : Promise >Promise.reject : { (reason: any): Promise; (reason: any): Promise; } >Promise : PromiseConstructor >reject : { (reason: any): Promise; (reason: any): Promise; } ->1 : 1 +>"1" : "1" >() => {throw 1} : () => never >1 : 1 -const p84 = p.then(() => Promise.reject(1), () => Promise.resolve(1)); ->p84 : Promise ->p.then(() => Promise.reject(1), () => Promise.resolve(1)) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1)); +>pc8 : Promise +>p.then(() => Promise.reject("1"), () => Promise.resolve(1)) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->() => Promise.reject(1) : () => Promise ->Promise.reject(1) : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => Promise.reject("1") : () => Promise +>Promise.reject("1") : Promise >Promise.reject : { (reason: any): Promise; (reason: any): Promise; } >Promise : PromiseConstructor >reject : { (reason: any): Promise; (reason: any): Promise; } ->1 : 1 +>"1" : "1" >() => Promise.resolve(1) : () => Promise >Promise.resolve(1) : Promise >Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } @@ -879,18 +1565,18 @@ const p84 = p.then(() => Promise.reject(1), () => Promise.resolve(1)); >resolve : { (value: T | PromiseLike): Promise; (): Promise; } >1 : 1 -const p85 = p.then(() => Promise.reject(1), () => Promise.reject(1)); ->p85 : Promise ->p.then(() => Promise.reject(1), () => Promise.reject(1)) : Promise ->p.then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1)); +>pc9 : Promise +>p.then(() => Promise.reject("1"), () => Promise.reject(1)) : Promise +>p.then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >p : Promise ->then : { (onfulfilled?: (value: boolean) => boolean | PromiseLike, onrejected?: (reason: any) => boolean | PromiseLike): Promise; (onfulfilled: (value: boolean) => boolean | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->() => Promise.reject(1) : () => Promise ->Promise.reject(1) : Promise +>then : (onfulfilled?: (value: boolean) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>() => Promise.reject("1") : () => Promise +>Promise.reject("1") : Promise >Promise.reject : { (reason: any): Promise; (reason: any): Promise; } >Promise : PromiseConstructor >reject : { (reason: any): Promise; (reason: any): Promise; } ->1 : 1 +>"1" : "1" >() => Promise.reject(1) : () => Promise >Promise.reject(1) : Promise >Promise.reject : { (reason: any): Promise; (reason: any): Promise; } diff --git a/tests/baselines/reference/promiseTypeStrictNull.js b/tests/baselines/reference/promiseTypeStrictNull.js index 4aefeb3403eb5..60e0b9b61dfa6 100644 --- a/tests/baselines/reference/promiseTypeStrictNull.js +++ b/tests/baselines/reference/promiseTypeStrictNull.js @@ -1,16 +1,6 @@ //// [promiseTypeStrictNull.ts] declare var p: Promise; - -const a = p.then(); -const b = p.then(b => 1); -const c = p.then(b => 1, e => 'error'); -const d = p.then(b => 1, e => { }); -const e = p.then(b => 1, e => { throw Error(); }); -const f = p.then(b => 1, e => Promise.reject(Error())); -const g = p.catch(e => 'error'); -const h = p.catch(e => { }); -const i = p.catch(e => { throw Error(); }); -const j = p.catch(e => Promise.reject(Error())); +declare var x: any; async function A() { const a = await p; @@ -22,17 +12,15 @@ async function B() { return 1; } -// NOTE: This reports a "No best comment type exists among return expressions." error, and is -// ignored to get the types result for the test. -// async function C() { -// try { -// const a = await p; -// return 1; -// } -// catch (e) { -// return 'error'; -// } -// } +async function C() { + try { + const a = await p; + return 1; + } + catch (e) { + return 'error'; + } +} async function D() { try { @@ -96,64 +84,140 @@ async function I() { // addresses github issue #4903: const p00 = p.catch(); -const p01 = p.catch(undefined); -const p07 = p.catch(null); -const p02 = p.catch(() => 1); -const p03 = p.catch(() => {}); -const p04 = p.catch(() => {throw 1}); -const p05 = p.catch(() => Promise.reject(1)); -const p06 = p.catch(() => Promise.resolve(1)); +const p01 = p.then(); -const p10 = p.then(); +const p10 = p.catch(undefined); +const p11 = p.catch(null); +const p12 = p.catch(() => 1); +const p13 = p.catch(() => x); +const p14 = p.catch(() => undefined); +const p15 = p.catch(() => null); +const p16 = p.catch(() => {}); +const p17 = p.catch(() => {throw 1}); +const p18 = p.catch(() => Promise.reject(1)); +const p19 = p.catch(() => Promise.resolve(1)); const p20 = p.then(undefined); -const p21 = p.then(() => 1); -const p22 = p.then(() => {}); -const p23 = p.then(() => {throw 1}); -const p24 = p.then(() => Promise.resolve(1)); -const p25 = p.then(() => Promise.reject(1)); +const p21 = p.then(null); +const p22 = p.then(() => 1); +const p23 = p.then(() => x); +const p24 = p.then(() => undefined); +const p25 = p.then(() => null); +const p26 = p.then(() => {}); +const p27 = p.then(() => {throw 1}); +const p28 = p.then(() => Promise.resolve(1)); +const p29 = p.then(() => Promise.reject(1)); const p30 = p.then(undefined, undefined); -const p31 = p.then(undefined, () => 1); -const p32 = p.then(undefined, () => {}); -const p33 = p.then(undefined, () => {throw 1}); -const p34 = p.then(undefined, () => Promise.resolve(1)); -const p35 = p.then(undefined, () => Promise.reject(1)); +const p31 = p.then(undefined, null); +const p32 = p.then(undefined, () => 1); +const p33 = p.then(undefined, () => x); +const p34 = p.then(undefined, () => undefined); +const p35 = p.then(undefined, () => null); +const p36 = p.then(undefined, () => {}); +const p37 = p.then(undefined, () => {throw 1}); +const p38 = p.then(undefined, () => Promise.resolve(1)); +const p39 = p.then(undefined, () => Promise.reject(1)); + +const p40 = p.then(null, undefined); +const p41 = p.then(null, null); +const p42 = p.then(null, () => 1); +const p43 = p.then(null, () => x); +const p44 = p.then(null, () => undefined); +const p45 = p.then(null, () => null); +const p46 = p.then(null, () => {}); +const p47 = p.then(null, () => {throw 1}); +const p48 = p.then(null, () => Promise.resolve(1)); +const p49 = p.then(null, () => Promise.reject(1)); + +const p50 = p.then(() => "1", undefined); +const p51 = p.then(() => "1", null); +const p52 = p.then(() => "1", () => 1); +const p53 = p.then(() => "1", () => x); +const p54 = p.then(() => "1", () => undefined); +const p55 = p.then(() => "1", () => null); +const p56 = p.then(() => "1", () => {}); +const p57 = p.then(() => "1", () => {throw 1}); +const p58 = p.then(() => "1", () => Promise.resolve(1)); +const p59 = p.then(() => "1", () => Promise.reject(1)); + +const p60 = p.then(() => x, undefined); +const p61 = p.then(() => x, null); +const p62 = p.then(() => x, () => 1); +const p63 = p.then(() => x, () => x); +const p64 = p.then(() => x, () => undefined); +const p65 = p.then(() => x, () => null); +const p66 = p.then(() => x, () => {}); +const p67 = p.then(() => x, () => {throw 1}); +const p68 = p.then(() => x, () => Promise.resolve(1)); +const p69 = p.then(() => x, () => Promise.reject(1)); -const p40 = p.then(() => "1", undefined); -const p41 = p.then(() => "1", () => 1); -const p42 = p.then(() => "1", () => {}); -const p43 = p.then(() => "1", () => {throw 1}); -const p44 = p.then(() => "1", () => Promise.resolve(1)); -const p45 = p.then(() => "1", () => Promise.reject(1)); +const p70 = p.then(() => undefined, undefined); +const p71 = p.then(() => undefined, null); +const p72 = p.then(() => undefined, () => 1); +const p73 = p.then(() => undefined, () => x); +const p74 = p.then(() => undefined, () => undefined); +const p75 = p.then(() => undefined, () => null); +const p76 = p.then(() => undefined, () => {}); +const p77 = p.then(() => undefined, () => {throw 1}); +const p78 = p.then(() => undefined, () => Promise.resolve(1)); +const p79 = p.then(() => undefined, () => Promise.reject(1)); -const p50 = p.then(() => {}, undefined); -const p51 = p.then(() => {}, () => 1); -const p52 = p.then(() => {}, () => {}); -const p53 = p.then(() => {}, () => {throw 1}); -const p54 = p.then(() => {}, () => Promise.resolve(1)); -const p55 = p.then(() => {}, () => Promise.reject(1)); +const p80 = p.then(() => null, undefined); +const p81 = p.then(() => null, null); +const p82 = p.then(() => null, () => 1); +const p83 = p.then(() => null, () => x); +const p84 = p.then(() => null, () => undefined); +const p85 = p.then(() => null, () => null); +const p86 = p.then(() => null, () => {}); +const p87 = p.then(() => null, () => {throw 1}); +const p88 = p.then(() => null, () => Promise.resolve(1)); +const p89 = p.then(() => null, () => Promise.reject(1)); -const p60 = p.then(() => {throw 1}, undefined); -const p61 = p.then(() => {throw 1}, () => 1); -const p62 = p.then(() => {throw 1}, () => {}); -const p63 = p.then(() => {throw 1}, () => {throw 1}); -const p64 = p.then(() => {throw 1}, () => Promise.resolve(1)); -const p65 = p.then(() => {throw 1}, () => Promise.reject(1)); +const p90 = p.then(() => {}, undefined); +const p91 = p.then(() => {}, null); +const p92 = p.then(() => {}, () => 1); +const p93 = p.then(() => {}, () => x); +const p94 = p.then(() => {}, () => undefined); +const p95 = p.then(() => {}, () => null); +const p96 = p.then(() => {}, () => {}); +const p97 = p.then(() => {}, () => {throw 1}); +const p98 = p.then(() => {}, () => Promise.resolve(1)); +const p99 = p.then(() => {}, () => Promise.reject(1)); -const p70 = p.then(() => Promise.resolve("1"), undefined); -const p71 = p.then(() => Promise.resolve("1"), () => 1); -const p72 = p.then(() => Promise.resolve("1"), () => {}); -const p73 = p.then(() => Promise.resolve("1"), () => {throw 1}); -const p74 = p.then(() => Promise.resolve("1"), () => Promise.resolve(1)); -const p75 = p.then(() => Promise.resolve("1"), () => Promise.reject(1)); +const pa0 = p.then(() => {throw 1}, undefined); +const pa1 = p.then(() => {throw 1}, null); +const pa2 = p.then(() => {throw 1}, () => 1); +const pa3 = p.then(() => {throw 1}, () => x); +const pa4 = p.then(() => {throw 1}, () => undefined); +const pa5 = p.then(() => {throw 1}, () => null); +const pa6 = p.then(() => {throw 1}, () => {}); +const pa7 = p.then(() => {throw 1}, () => {throw 1}); +const pa8 = p.then(() => {throw 1}, () => Promise.resolve(1)); +const pa9 = p.then(() => {throw 1}, () => Promise.reject(1)); -const p80 = p.then(() => Promise.reject(1), undefined); -const p81 = p.then(() => Promise.reject(1), () => 1); -const p82 = p.then(() => Promise.reject(1), () => {}); -const p83 = p.then(() => Promise.reject(1), () => {throw 1}); -const p84 = p.then(() => Promise.reject(1), () => Promise.resolve(1)); -const p85 = p.then(() => Promise.reject(1), () => Promise.reject(1)); +const pb0 = p.then(() => Promise.resolve("1"), undefined); +const pb1 = p.then(() => Promise.resolve("1"), null); +const pb2 = p.then(() => Promise.resolve("1"), () => 1); +const pb3 = p.then(() => Promise.resolve("1"), () => x); +const pb4 = p.then(() => Promise.resolve("1"), () => undefined); +const pb5 = p.then(() => Promise.resolve("1"), () => null); +const pb6 = p.then(() => Promise.resolve("1"), () => {}); +const pb7 = p.then(() => Promise.resolve("1"), () => {throw 1}); +const pb8 = p.then(() => Promise.resolve("1"), () => Promise.resolve(1)); +const pb9 = p.then(() => Promise.resolve("1"), () => Promise.reject(1)); + +const pc0 = p.then(() => Promise.reject("1"), undefined); +const pc1 = p.then(() => Promise.reject("1"), null); +const pc2 = p.then(() => Promise.reject("1"), () => 1); +const pc3 = p.then(() => Promise.reject("1"), () => x); +const pc4 = p.then(() => Promise.reject("1"), () => undefined); +const pc5 = p.then(() => Promise.reject("1"), () => null); +const pc6 = p.then(() => Promise.reject("1"), () => {}); +const pc7 = p.then(() => Promise.reject("1"), () => {throw 1}); +const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1)); +const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1)); + //// [promiseTypeStrictNull.js] var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { @@ -164,16 +228,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -const a = p.then(); -const b = p.then(b => 1); -const c = p.then(b => 1, e => 'error'); -const d = p.then(b => 1, e => { }); -const e = p.then(b => 1, e => { throw Error(); }); -const f = p.then(b => 1, e => Promise.reject(Error())); -const g = p.catch(e => 'error'); -const h = p.catch(e => { }); -const i = p.catch(e => { throw Error(); }); -const j = p.catch(e => Promise.reject(Error())); function A() { return __awaiter(this, void 0, void 0, function* () { const a = yield p; @@ -186,17 +240,17 @@ function B() { return 1; }); } -// NOTE: This reports a "No best comment type exists among return expressions." error, and is -// ignored to get the types result for the test. -// async function C() { -// try { -// const a = await p; -// return 1; -// } -// catch (e) { -// return 'error'; -// } -// } +function C() { + return __awaiter(this, void 0, void 0, function* () { + try { + const a = yield p; + return 1; + } + catch (e) { + return 'error'; + } + }); +} function D() { return __awaiter(this, void 0, void 0, function* () { try { @@ -264,53 +318,124 @@ function I() { } // addresses github issue #4903: const p00 = p.catch(); -const p01 = p.catch(undefined); -const p07 = p.catch(null); -const p02 = p.catch(() => 1); -const p03 = p.catch(() => { }); -const p04 = p.catch(() => { throw 1; }); -const p05 = p.catch(() => Promise.reject(1)); -const p06 = p.catch(() => Promise.resolve(1)); -const p10 = p.then(); +const p01 = p.then(); +const p10 = p.catch(undefined); +const p11 = p.catch(null); +const p12 = p.catch(() => 1); +const p13 = p.catch(() => x); +const p14 = p.catch(() => undefined); +const p15 = p.catch(() => null); +const p16 = p.catch(() => { }); +const p17 = p.catch(() => { throw 1; }); +const p18 = p.catch(() => Promise.reject(1)); +const p19 = p.catch(() => Promise.resolve(1)); const p20 = p.then(undefined); -const p21 = p.then(() => 1); -const p22 = p.then(() => { }); -const p23 = p.then(() => { throw 1; }); -const p24 = p.then(() => Promise.resolve(1)); -const p25 = p.then(() => Promise.reject(1)); +const p21 = p.then(null); +const p22 = p.then(() => 1); +const p23 = p.then(() => x); +const p24 = p.then(() => undefined); +const p25 = p.then(() => null); +const p26 = p.then(() => { }); +const p27 = p.then(() => { throw 1; }); +const p28 = p.then(() => Promise.resolve(1)); +const p29 = p.then(() => Promise.reject(1)); const p30 = p.then(undefined, undefined); -const p31 = p.then(undefined, () => 1); -const p32 = p.then(undefined, () => { }); -const p33 = p.then(undefined, () => { throw 1; }); -const p34 = p.then(undefined, () => Promise.resolve(1)); -const p35 = p.then(undefined, () => Promise.reject(1)); -const p40 = p.then(() => "1", undefined); -const p41 = p.then(() => "1", () => 1); -const p42 = p.then(() => "1", () => { }); -const p43 = p.then(() => "1", () => { throw 1; }); -const p44 = p.then(() => "1", () => Promise.resolve(1)); -const p45 = p.then(() => "1", () => Promise.reject(1)); -const p50 = p.then(() => { }, undefined); -const p51 = p.then(() => { }, () => 1); -const p52 = p.then(() => { }, () => { }); -const p53 = p.then(() => { }, () => { throw 1; }); -const p54 = p.then(() => { }, () => Promise.resolve(1)); -const p55 = p.then(() => { }, () => Promise.reject(1)); -const p60 = p.then(() => { throw 1; }, undefined); -const p61 = p.then(() => { throw 1; }, () => 1); -const p62 = p.then(() => { throw 1; }, () => { }); -const p63 = p.then(() => { throw 1; }, () => { throw 1; }); -const p64 = p.then(() => { throw 1; }, () => Promise.resolve(1)); -const p65 = p.then(() => { throw 1; }, () => Promise.reject(1)); -const p70 = p.then(() => Promise.resolve("1"), undefined); -const p71 = p.then(() => Promise.resolve("1"), () => 1); -const p72 = p.then(() => Promise.resolve("1"), () => { }); -const p73 = p.then(() => Promise.resolve("1"), () => { throw 1; }); -const p74 = p.then(() => Promise.resolve("1"), () => Promise.resolve(1)); -const p75 = p.then(() => Promise.resolve("1"), () => Promise.reject(1)); -const p80 = p.then(() => Promise.reject(1), undefined); -const p81 = p.then(() => Promise.reject(1), () => 1); -const p82 = p.then(() => Promise.reject(1), () => { }); -const p83 = p.then(() => Promise.reject(1), () => { throw 1; }); -const p84 = p.then(() => Promise.reject(1), () => Promise.resolve(1)); -const p85 = p.then(() => Promise.reject(1), () => Promise.reject(1)); +const p31 = p.then(undefined, null); +const p32 = p.then(undefined, () => 1); +const p33 = p.then(undefined, () => x); +const p34 = p.then(undefined, () => undefined); +const p35 = p.then(undefined, () => null); +const p36 = p.then(undefined, () => { }); +const p37 = p.then(undefined, () => { throw 1; }); +const p38 = p.then(undefined, () => Promise.resolve(1)); +const p39 = p.then(undefined, () => Promise.reject(1)); +const p40 = p.then(null, undefined); +const p41 = p.then(null, null); +const p42 = p.then(null, () => 1); +const p43 = p.then(null, () => x); +const p44 = p.then(null, () => undefined); +const p45 = p.then(null, () => null); +const p46 = p.then(null, () => { }); +const p47 = p.then(null, () => { throw 1; }); +const p48 = p.then(null, () => Promise.resolve(1)); +const p49 = p.then(null, () => Promise.reject(1)); +const p50 = p.then(() => "1", undefined); +const p51 = p.then(() => "1", null); +const p52 = p.then(() => "1", () => 1); +const p53 = p.then(() => "1", () => x); +const p54 = p.then(() => "1", () => undefined); +const p55 = p.then(() => "1", () => null); +const p56 = p.then(() => "1", () => { }); +const p57 = p.then(() => "1", () => { throw 1; }); +const p58 = p.then(() => "1", () => Promise.resolve(1)); +const p59 = p.then(() => "1", () => Promise.reject(1)); +const p60 = p.then(() => x, undefined); +const p61 = p.then(() => x, null); +const p62 = p.then(() => x, () => 1); +const p63 = p.then(() => x, () => x); +const p64 = p.then(() => x, () => undefined); +const p65 = p.then(() => x, () => null); +const p66 = p.then(() => x, () => { }); +const p67 = p.then(() => x, () => { throw 1; }); +const p68 = p.then(() => x, () => Promise.resolve(1)); +const p69 = p.then(() => x, () => Promise.reject(1)); +const p70 = p.then(() => undefined, undefined); +const p71 = p.then(() => undefined, null); +const p72 = p.then(() => undefined, () => 1); +const p73 = p.then(() => undefined, () => x); +const p74 = p.then(() => undefined, () => undefined); +const p75 = p.then(() => undefined, () => null); +const p76 = p.then(() => undefined, () => { }); +const p77 = p.then(() => undefined, () => { throw 1; }); +const p78 = p.then(() => undefined, () => Promise.resolve(1)); +const p79 = p.then(() => undefined, () => Promise.reject(1)); +const p80 = p.then(() => null, undefined); +const p81 = p.then(() => null, null); +const p82 = p.then(() => null, () => 1); +const p83 = p.then(() => null, () => x); +const p84 = p.then(() => null, () => undefined); +const p85 = p.then(() => null, () => null); +const p86 = p.then(() => null, () => { }); +const p87 = p.then(() => null, () => { throw 1; }); +const p88 = p.then(() => null, () => Promise.resolve(1)); +const p89 = p.then(() => null, () => Promise.reject(1)); +const p90 = p.then(() => { }, undefined); +const p91 = p.then(() => { }, null); +const p92 = p.then(() => { }, () => 1); +const p93 = p.then(() => { }, () => x); +const p94 = p.then(() => { }, () => undefined); +const p95 = p.then(() => { }, () => null); +const p96 = p.then(() => { }, () => { }); +const p97 = p.then(() => { }, () => { throw 1; }); +const p98 = p.then(() => { }, () => Promise.resolve(1)); +const p99 = p.then(() => { }, () => Promise.reject(1)); +const pa0 = p.then(() => { throw 1; }, undefined); +const pa1 = p.then(() => { throw 1; }, null); +const pa2 = p.then(() => { throw 1; }, () => 1); +const pa3 = p.then(() => { throw 1; }, () => x); +const pa4 = p.then(() => { throw 1; }, () => undefined); +const pa5 = p.then(() => { throw 1; }, () => null); +const pa6 = p.then(() => { throw 1; }, () => { }); +const pa7 = p.then(() => { throw 1; }, () => { throw 1; }); +const pa8 = p.then(() => { throw 1; }, () => Promise.resolve(1)); +const pa9 = p.then(() => { throw 1; }, () => Promise.reject(1)); +const pb0 = p.then(() => Promise.resolve("1"), undefined); +const pb1 = p.then(() => Promise.resolve("1"), null); +const pb2 = p.then(() => Promise.resolve("1"), () => 1); +const pb3 = p.then(() => Promise.resolve("1"), () => x); +const pb4 = p.then(() => Promise.resolve("1"), () => undefined); +const pb5 = p.then(() => Promise.resolve("1"), () => null); +const pb6 = p.then(() => Promise.resolve("1"), () => { }); +const pb7 = p.then(() => Promise.resolve("1"), () => { throw 1; }); +const pb8 = p.then(() => Promise.resolve("1"), () => Promise.resolve(1)); +const pb9 = p.then(() => Promise.resolve("1"), () => Promise.reject(1)); +const pc0 = p.then(() => Promise.reject("1"), undefined); +const pc1 = p.then(() => Promise.reject("1"), null); +const pc2 = p.then(() => Promise.reject("1"), () => 1); +const pc3 = p.then(() => Promise.reject("1"), () => x); +const pc4 = p.then(() => Promise.reject("1"), () => undefined); +const pc5 = p.then(() => Promise.reject("1"), () => null); +const pc6 = p.then(() => Promise.reject("1"), () => { }); +const pc7 = p.then(() => Promise.reject("1"), () => { throw 1; }); +const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1)); +const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1)); diff --git a/tests/baselines/reference/promiseTypeStrictNull.symbols b/tests/baselines/reference/promiseTypeStrictNull.symbols index bf14c51656e05..ee8baa5e8d456 100644 --- a/tests/baselines/reference/promiseTypeStrictNull.symbols +++ b/tests/baselines/reference/promiseTypeStrictNull.symbols @@ -3,149 +3,74 @@ declare var p: Promise; >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) -const a = p.then(); ->a : Symbol(a, Decl(promiseTypeStrictNull.ts, 2, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) - -const b = p.then(b => 1); ->b : Symbol(b, Decl(promiseTypeStrictNull.ts, 3, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->b : Symbol(b, Decl(promiseTypeStrictNull.ts, 3, 17)) - -const c = p.then(b => 1, e => 'error'); ->c : Symbol(c, Decl(promiseTypeStrictNull.ts, 4, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->b : Symbol(b, Decl(promiseTypeStrictNull.ts, 4, 17)) ->e : Symbol(e, Decl(promiseTypeStrictNull.ts, 4, 24)) - -const d = p.then(b => 1, e => { }); ->d : Symbol(d, Decl(promiseTypeStrictNull.ts, 5, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->b : Symbol(b, Decl(promiseTypeStrictNull.ts, 5, 17)) ->e : Symbol(e, Decl(promiseTypeStrictNull.ts, 5, 24)) - -const e = p.then(b => 1, e => { throw Error(); }); ->e : Symbol(e, Decl(promiseTypeStrictNull.ts, 6, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->b : Symbol(b, Decl(promiseTypeStrictNull.ts, 6, 17)) ->e : Symbol(e, Decl(promiseTypeStrictNull.ts, 6, 24)) ->Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) - -const f = p.then(b => 1, e => Promise.reject(Error())); ->f : Symbol(f, Decl(promiseTypeStrictNull.ts, 7, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->b : Symbol(b, Decl(promiseTypeStrictNull.ts, 7, 17)) ->e : Symbol(e, Decl(promiseTypeStrictNull.ts, 7, 24)) ->Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) ->reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) - -const g = p.catch(e => 'error'); ->g : Symbol(g, Decl(promiseTypeStrictNull.ts, 8, 5)) ->p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->e : Symbol(e, Decl(promiseTypeStrictNull.ts, 8, 18)) - -const h = p.catch(e => { }); ->h : Symbol(h, Decl(promiseTypeStrictNull.ts, 9, 5)) ->p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->e : Symbol(e, Decl(promiseTypeStrictNull.ts, 9, 18)) - -const i = p.catch(e => { throw Error(); }); ->i : Symbol(i, Decl(promiseTypeStrictNull.ts, 10, 5)) ->p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->e : Symbol(e, Decl(promiseTypeStrictNull.ts, 10, 18)) ->Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) - -const j = p.catch(e => Promise.reject(Error())); ->j : Symbol(j, Decl(promiseTypeStrictNull.ts, 11, 5)) ->p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->e : Symbol(e, Decl(promiseTypeStrictNull.ts, 11, 18)) ->Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) ->reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +declare var x: any; +>x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11)) async function A() { ->A : Symbol(A, Decl(promiseTypeStrictNull.ts, 11, 48)) +>A : Symbol(A, Decl(promiseTypeStrictNull.ts, 1, 19)) const a = await p; ->a : Symbol(a, Decl(promiseTypeStrictNull.ts, 14, 9)) +>a : Symbol(a, Decl(promiseTypeStrictNull.ts, 4, 9)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) return a; ->a : Symbol(a, Decl(promiseTypeStrictNull.ts, 14, 9)) +>a : Symbol(a, Decl(promiseTypeStrictNull.ts, 4, 9)) } async function B() { ->B : Symbol(B, Decl(promiseTypeStrictNull.ts, 16, 1)) +>B : Symbol(B, Decl(promiseTypeStrictNull.ts, 6, 1)) const a = await p; ->a : Symbol(a, Decl(promiseTypeStrictNull.ts, 19, 9)) +>a : Symbol(a, Decl(promiseTypeStrictNull.ts, 9, 9)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) return 1; } -// NOTE: This reports a "No best comment type exists among return expressions." error, and is -// ignored to get the types result for the test. -// async function C() { -// try { -// const a = await p; -// return 1; -// } -// catch (e) { -// return 'error'; -// } -// } +async function C() { +>C : Symbol(C, Decl(promiseTypeStrictNull.ts, 11, 1)) + + try { + const a = await p; +>a : Symbol(a, Decl(promiseTypeStrictNull.ts, 15, 13)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) + + return 1; + } + catch (e) { +>e : Symbol(e, Decl(promiseTypeStrictNull.ts, 18, 11)) + + return 'error'; + } +} async function D() { >D : Symbol(D, Decl(promiseTypeStrictNull.ts, 21, 1)) try { const a = await p; ->a : Symbol(a, Decl(promiseTypeStrictNull.ts, 37, 13)) +>a : Symbol(a, Decl(promiseTypeStrictNull.ts, 25, 13)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) return 1; } catch (e) { ->e : Symbol(e, Decl(promiseTypeStrictNull.ts, 40, 11)) +>e : Symbol(e, Decl(promiseTypeStrictNull.ts, 28, 11)) } } async function E() { ->E : Symbol(E, Decl(promiseTypeStrictNull.ts, 42, 1)) +>E : Symbol(E, Decl(promiseTypeStrictNull.ts, 30, 1)) try { const a = await p; ->a : Symbol(a, Decl(promiseTypeStrictNull.ts, 46, 13)) +>a : Symbol(a, Decl(promiseTypeStrictNull.ts, 34, 13)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) return 1; } catch (e) { ->e : Symbol(e, Decl(promiseTypeStrictNull.ts, 49, 11)) +>e : Symbol(e, Decl(promiseTypeStrictNull.ts, 37, 11)) throw Error(); >Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) @@ -153,17 +78,17 @@ async function E() { } async function F() { ->F : Symbol(F, Decl(promiseTypeStrictNull.ts, 52, 1)) +>F : Symbol(F, Decl(promiseTypeStrictNull.ts, 40, 1)) try { const a = await p; ->a : Symbol(a, Decl(promiseTypeStrictNull.ts, 56, 13)) +>a : Symbol(a, Decl(promiseTypeStrictNull.ts, 44, 13)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) return 1; } catch (e) { ->e : Symbol(e, Decl(promiseTypeStrictNull.ts, 59, 11)) +>e : Symbol(e, Decl(promiseTypeStrictNull.ts, 47, 11)) return Promise.reject(Error()); >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) @@ -174,36 +99,36 @@ async function F() { } async function G() { ->G : Symbol(G, Decl(promiseTypeStrictNull.ts, 62, 1)) +>G : Symbol(G, Decl(promiseTypeStrictNull.ts, 50, 1)) try { const a = await p; ->a : Symbol(a, Decl(promiseTypeStrictNull.ts, 66, 13)) +>a : Symbol(a, Decl(promiseTypeStrictNull.ts, 54, 13)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) return a; ->a : Symbol(a, Decl(promiseTypeStrictNull.ts, 66, 13)) +>a : Symbol(a, Decl(promiseTypeStrictNull.ts, 54, 13)) } catch (e) { ->e : Symbol(e, Decl(promiseTypeStrictNull.ts, 69, 11)) +>e : Symbol(e, Decl(promiseTypeStrictNull.ts, 57, 11)) return; } } async function H() { ->H : Symbol(H, Decl(promiseTypeStrictNull.ts, 72, 1)) +>H : Symbol(H, Decl(promiseTypeStrictNull.ts, 60, 1)) try { const a = await p; ->a : Symbol(a, Decl(promiseTypeStrictNull.ts, 76, 13)) +>a : Symbol(a, Decl(promiseTypeStrictNull.ts, 64, 13)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) return a; ->a : Symbol(a, Decl(promiseTypeStrictNull.ts, 76, 13)) +>a : Symbol(a, Decl(promiseTypeStrictNull.ts, 64, 13)) } catch (e) { ->e : Symbol(e, Decl(promiseTypeStrictNull.ts, 79, 11)) +>e : Symbol(e, Decl(promiseTypeStrictNull.ts, 67, 11)) throw Error(); >Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) @@ -211,18 +136,18 @@ async function H() { } async function I() { ->I : Symbol(I, Decl(promiseTypeStrictNull.ts, 82, 1)) +>I : Symbol(I, Decl(promiseTypeStrictNull.ts, 70, 1)) try { const a = await p; ->a : Symbol(a, Decl(promiseTypeStrictNull.ts, 86, 13)) +>a : Symbol(a, Decl(promiseTypeStrictNull.ts, 74, 13)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) return a; ->a : Symbol(a, Decl(promiseTypeStrictNull.ts, 86, 13)) +>a : Symbol(a, Decl(promiseTypeStrictNull.ts, 74, 13)) } catch (e) { ->e : Symbol(e, Decl(promiseTypeStrictNull.ts, 89, 11)) +>e : Symbol(e, Decl(promiseTypeStrictNull.ts, 77, 11)) return Promise.reject(Error()); >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) @@ -235,390 +160,916 @@ async function I() { // addresses github issue #4903: const p00 = p.catch(); ->p00 : Symbol(p00, Decl(promiseTypeStrictNull.ts, 96, 5)) ->p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>p00 : Symbol(p00, Decl(promiseTypeStrictNull.ts, 84, 5)) +>p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) + +const p01 = p.then(); +>p01 : Symbol(p01, Decl(promiseTypeStrictNull.ts, 85, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) -const p01 = p.catch(undefined); ->p01 : Symbol(p01, Decl(promiseTypeStrictNull.ts, 97, 5)) ->p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p10 = p.catch(undefined); +>p10 : Symbol(p10, Decl(promiseTypeStrictNull.ts, 87, 5)) +>p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) -const p07 = p.catch(null); ->p07 : Symbol(p07, Decl(promiseTypeStrictNull.ts, 98, 5)) ->p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p11 = p.catch(null); +>p11 : Symbol(p11, Decl(promiseTypeStrictNull.ts, 88, 5)) +>p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) -const p02 = p.catch(() => 1); ->p02 : Symbol(p02, Decl(promiseTypeStrictNull.ts, 99, 5)) ->p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p12 = p.catch(() => 1); +>p12 : Symbol(p12, Decl(promiseTypeStrictNull.ts, 89, 5)) +>p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) -const p03 = p.catch(() => {}); ->p03 : Symbol(p03, Decl(promiseTypeStrictNull.ts, 100, 5)) ->p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p13 = p.catch(() => x); +>p13 : Symbol(p13, Decl(promiseTypeStrictNull.ts, 90, 5)) +>p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11)) -const p04 = p.catch(() => {throw 1}); ->p04 : Symbol(p04, Decl(promiseTypeStrictNull.ts, 101, 5)) ->p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p14 = p.catch(() => undefined); +>p14 : Symbol(p14, Decl(promiseTypeStrictNull.ts, 91, 5)) +>p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p15 = p.catch(() => null); +>p15 : Symbol(p15, Decl(promiseTypeStrictNull.ts, 92, 5)) +>p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) + +const p16 = p.catch(() => {}); +>p16 : Symbol(p16, Decl(promiseTypeStrictNull.ts, 93, 5)) +>p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) + +const p17 = p.catch(() => {throw 1}); +>p17 : Symbol(p17, Decl(promiseTypeStrictNull.ts, 94, 5)) +>p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) -const p05 = p.catch(() => Promise.reject(1)); ->p05 : Symbol(p05, Decl(promiseTypeStrictNull.ts, 102, 5)) ->p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p18 = p.catch(() => Promise.reject(1)); +>p18 : Symbol(p18, Decl(promiseTypeStrictNull.ts, 95, 5)) +>p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p06 = p.catch(() => Promise.resolve(1)); ->p06 : Symbol(p06, Decl(promiseTypeStrictNull.ts, 103, 5)) ->p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p19 = p.catch(() => Promise.resolve(1)); +>p19 : Symbol(p19, Decl(promiseTypeStrictNull.ts, 96, 5)) +>p.catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>catch : Symbol(Promise.catch, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p10 = p.then(); ->p10 : Symbol(p10, Decl(promiseTypeStrictNull.ts, 105, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p20 = p.then(undefined); +>p20 : Symbol(p20, Decl(promiseTypeStrictNull.ts, 98, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) -const p20 = p.then(undefined); ->p20 : Symbol(p20, Decl(promiseTypeStrictNull.ts, 107, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p21 = p.then(null); +>p21 : Symbol(p21, Decl(promiseTypeStrictNull.ts, 99, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p22 = p.then(() => 1); +>p22 : Symbol(p22, Decl(promiseTypeStrictNull.ts, 100, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p23 = p.then(() => x); +>p23 : Symbol(p23, Decl(promiseTypeStrictNull.ts, 101, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11)) + +const p24 = p.then(() => undefined); +>p24 : Symbol(p24, Decl(promiseTypeStrictNull.ts, 102, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) -const p21 = p.then(() => 1); ->p21 : Symbol(p21, Decl(promiseTypeStrictNull.ts, 108, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p25 = p.then(() => null); +>p25 : Symbol(p25, Decl(promiseTypeStrictNull.ts, 103, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) -const p22 = p.then(() => {}); ->p22 : Symbol(p22, Decl(promiseTypeStrictNull.ts, 109, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p26 = p.then(() => {}); +>p26 : Symbol(p26, Decl(promiseTypeStrictNull.ts, 104, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) -const p23 = p.then(() => {throw 1}); ->p23 : Symbol(p23, Decl(promiseTypeStrictNull.ts, 110, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p27 = p.then(() => {throw 1}); +>p27 : Symbol(p27, Decl(promiseTypeStrictNull.ts, 105, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) -const p24 = p.then(() => Promise.resolve(1)); ->p24 : Symbol(p24, Decl(promiseTypeStrictNull.ts, 111, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p28 = p.then(() => Promise.resolve(1)); +>p28 : Symbol(p28, Decl(promiseTypeStrictNull.ts, 106, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p25 = p.then(() => Promise.reject(1)); ->p25 : Symbol(p25, Decl(promiseTypeStrictNull.ts, 112, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p29 = p.then(() => Promise.reject(1)); +>p29 : Symbol(p29, Decl(promiseTypeStrictNull.ts, 107, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p30 = p.then(undefined, undefined); ->p30 : Symbol(p30, Decl(promiseTypeStrictNull.ts, 114, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>p30 : Symbol(p30, Decl(promiseTypeStrictNull.ts, 109, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) +>undefined : Symbol(undefined) + +const p31 = p.then(undefined, null); +>p31 : Symbol(p31, Decl(promiseTypeStrictNull.ts, 110, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p32 = p.then(undefined, () => 1); +>p32 : Symbol(p32, Decl(promiseTypeStrictNull.ts, 111, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p33 = p.then(undefined, () => x); +>p33 : Symbol(p33, Decl(promiseTypeStrictNull.ts, 112, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) +>x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11)) + +const p34 = p.then(undefined, () => undefined); +>p34 : Symbol(p34, Decl(promiseTypeStrictNull.ts, 113, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) +>undefined : Symbol(undefined) + +const p35 = p.then(undefined, () => null); +>p35 : Symbol(p35, Decl(promiseTypeStrictNull.ts, 114, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p36 = p.then(undefined, () => {}); +>p36 : Symbol(p36, Decl(promiseTypeStrictNull.ts, 115, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p37 = p.then(undefined, () => {throw 1}); +>p37 : Symbol(p37, Decl(promiseTypeStrictNull.ts, 116, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p38 = p.then(undefined, () => Promise.resolve(1)); +>p38 : Symbol(p38, Decl(promiseTypeStrictNull.ts, 117, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const p39 = p.then(undefined, () => Promise.reject(1)); +>p39 : Symbol(p39, Decl(promiseTypeStrictNull.ts, 118, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) +>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const p40 = p.then(null, undefined); +>p40 : Symbol(p40, Decl(promiseTypeStrictNull.ts, 120, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p41 = p.then(null, null); +>p41 : Symbol(p41, Decl(promiseTypeStrictNull.ts, 121, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p42 = p.then(null, () => 1); +>p42 : Symbol(p42, Decl(promiseTypeStrictNull.ts, 122, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p43 = p.then(null, () => x); +>p43 : Symbol(p43, Decl(promiseTypeStrictNull.ts, 123, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11)) + +const p44 = p.then(null, () => undefined); +>p44 : Symbol(p44, Decl(promiseTypeStrictNull.ts, 124, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p45 = p.then(null, () => null); +>p45 : Symbol(p45, Decl(promiseTypeStrictNull.ts, 125, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p46 = p.then(null, () => {}); +>p46 : Symbol(p46, Decl(promiseTypeStrictNull.ts, 126, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p47 = p.then(null, () => {throw 1}); +>p47 : Symbol(p47, Decl(promiseTypeStrictNull.ts, 127, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p48 = p.then(null, () => Promise.resolve(1)); +>p48 : Symbol(p48, Decl(promiseTypeStrictNull.ts, 128, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const p49 = p.then(null, () => Promise.reject(1)); +>p49 : Symbol(p49, Decl(promiseTypeStrictNull.ts, 129, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const p50 = p.then(() => "1", undefined); +>p50 : Symbol(p50, Decl(promiseTypeStrictNull.ts, 131, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p51 = p.then(() => "1", null); +>p51 : Symbol(p51, Decl(promiseTypeStrictNull.ts, 132, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p52 = p.then(() => "1", () => 1); +>p52 : Symbol(p52, Decl(promiseTypeStrictNull.ts, 133, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p53 = p.then(() => "1", () => x); +>p53 : Symbol(p53, Decl(promiseTypeStrictNull.ts, 134, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11)) + +const p54 = p.then(() => "1", () => undefined); +>p54 : Symbol(p54, Decl(promiseTypeStrictNull.ts, 135, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p55 = p.then(() => "1", () => null); +>p55 : Symbol(p55, Decl(promiseTypeStrictNull.ts, 136, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p56 = p.then(() => "1", () => {}); +>p56 : Symbol(p56, Decl(promiseTypeStrictNull.ts, 137, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p57 = p.then(() => "1", () => {throw 1}); +>p57 : Symbol(p57, Decl(promiseTypeStrictNull.ts, 138, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p58 = p.then(() => "1", () => Promise.resolve(1)); +>p58 : Symbol(p58, Decl(promiseTypeStrictNull.ts, 139, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const p59 = p.then(() => "1", () => Promise.reject(1)); +>p59 : Symbol(p59, Decl(promiseTypeStrictNull.ts, 140, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const p60 = p.then(() => x, undefined); +>p60 : Symbol(p60, Decl(promiseTypeStrictNull.ts, 142, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11)) +>undefined : Symbol(undefined) + +const p61 = p.then(() => x, null); +>p61 : Symbol(p61, Decl(promiseTypeStrictNull.ts, 143, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11)) + +const p62 = p.then(() => x, () => 1); +>p62 : Symbol(p62, Decl(promiseTypeStrictNull.ts, 144, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11)) + +const p63 = p.then(() => x, () => x); +>p63 : Symbol(p63, Decl(promiseTypeStrictNull.ts, 145, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11)) +>x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11)) + +const p64 = p.then(() => x, () => undefined); +>p64 : Symbol(p64, Decl(promiseTypeStrictNull.ts, 146, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11)) +>undefined : Symbol(undefined) + +const p65 = p.then(() => x, () => null); +>p65 : Symbol(p65, Decl(promiseTypeStrictNull.ts, 147, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11)) + +const p66 = p.then(() => x, () => {}); +>p66 : Symbol(p66, Decl(promiseTypeStrictNull.ts, 148, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11)) + +const p67 = p.then(() => x, () => {throw 1}); +>p67 : Symbol(p67, Decl(promiseTypeStrictNull.ts, 149, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11)) + +const p68 = p.then(() => x, () => Promise.resolve(1)); +>p68 : Symbol(p68, Decl(promiseTypeStrictNull.ts, 150, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11)) +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const p69 = p.then(() => x, () => Promise.reject(1)); +>p69 : Symbol(p69, Decl(promiseTypeStrictNull.ts, 151, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11)) +>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const p70 = p.then(() => undefined, undefined); +>p70 : Symbol(p70, Decl(promiseTypeStrictNull.ts, 153, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) >undefined : Symbol(undefined) -const p31 = p.then(undefined, () => 1); ->p31 : Symbol(p31, Decl(promiseTypeStrictNull.ts, 115, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p71 = p.then(() => undefined, null); +>p71 : Symbol(p71, Decl(promiseTypeStrictNull.ts, 154, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) -const p32 = p.then(undefined, () => {}); ->p32 : Symbol(p32, Decl(promiseTypeStrictNull.ts, 116, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p72 = p.then(() => undefined, () => 1); +>p72 : Symbol(p72, Decl(promiseTypeStrictNull.ts, 155, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) -const p33 = p.then(undefined, () => {throw 1}); ->p33 : Symbol(p33, Decl(promiseTypeStrictNull.ts, 117, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p73 = p.then(() => undefined, () => x); +>p73 : Symbol(p73, Decl(promiseTypeStrictNull.ts, 156, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) +>x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11)) -const p34 = p.then(undefined, () => Promise.resolve(1)); ->p34 : Symbol(p34, Decl(promiseTypeStrictNull.ts, 118, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p74 = p.then(() => undefined, () => undefined); +>p74 : Symbol(p74, Decl(promiseTypeStrictNull.ts, 157, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) +>undefined : Symbol(undefined) + +const p75 = p.then(() => undefined, () => null); +>p75 : Symbol(p75, Decl(promiseTypeStrictNull.ts, 158, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p76 = p.then(() => undefined, () => {}); +>p76 : Symbol(p76, Decl(promiseTypeStrictNull.ts, 159, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p77 = p.then(() => undefined, () => {throw 1}); +>p77 : Symbol(p77, Decl(promiseTypeStrictNull.ts, 160, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p78 = p.then(() => undefined, () => Promise.resolve(1)); +>p78 : Symbol(p78, Decl(promiseTypeStrictNull.ts, 161, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p35 = p.then(undefined, () => Promise.reject(1)); ->p35 : Symbol(p35, Decl(promiseTypeStrictNull.ts, 119, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p79 = p.then(() => undefined, () => Promise.reject(1)); +>p79 : Symbol(p79, Decl(promiseTypeStrictNull.ts, 162, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p40 = p.then(() => "1", undefined); ->p40 : Symbol(p40, Decl(promiseTypeStrictNull.ts, 121, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p80 = p.then(() => null, undefined); +>p80 : Symbol(p80, Decl(promiseTypeStrictNull.ts, 164, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) -const p41 = p.then(() => "1", () => 1); ->p41 : Symbol(p41, Decl(promiseTypeStrictNull.ts, 122, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p81 = p.then(() => null, null); +>p81 : Symbol(p81, Decl(promiseTypeStrictNull.ts, 165, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) -const p42 = p.then(() => "1", () => {}); ->p42 : Symbol(p42, Decl(promiseTypeStrictNull.ts, 123, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p82 = p.then(() => null, () => 1); +>p82 : Symbol(p82, Decl(promiseTypeStrictNull.ts, 166, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) -const p43 = p.then(() => "1", () => {throw 1}); ->p43 : Symbol(p43, Decl(promiseTypeStrictNull.ts, 124, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p83 = p.then(() => null, () => x); +>p83 : Symbol(p83, Decl(promiseTypeStrictNull.ts, 167, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11)) -const p44 = p.then(() => "1", () => Promise.resolve(1)); ->p44 : Symbol(p44, Decl(promiseTypeStrictNull.ts, 125, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p84 = p.then(() => null, () => undefined); +>p84 : Symbol(p84, Decl(promiseTypeStrictNull.ts, 168, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p85 = p.then(() => null, () => null); +>p85 : Symbol(p85, Decl(promiseTypeStrictNull.ts, 169, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p86 = p.then(() => null, () => {}); +>p86 : Symbol(p86, Decl(promiseTypeStrictNull.ts, 170, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p87 = p.then(() => null, () => {throw 1}); +>p87 : Symbol(p87, Decl(promiseTypeStrictNull.ts, 171, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p88 = p.then(() => null, () => Promise.resolve(1)); +>p88 : Symbol(p88, Decl(promiseTypeStrictNull.ts, 172, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p45 = p.then(() => "1", () => Promise.reject(1)); ->p45 : Symbol(p45, Decl(promiseTypeStrictNull.ts, 126, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p89 = p.then(() => null, () => Promise.reject(1)); +>p89 : Symbol(p89, Decl(promiseTypeStrictNull.ts, 173, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p50 = p.then(() => {}, undefined); ->p50 : Symbol(p50, Decl(promiseTypeStrictNull.ts, 128, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p90 = p.then(() => {}, undefined); +>p90 : Symbol(p90, Decl(promiseTypeStrictNull.ts, 175, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) -const p51 = p.then(() => {}, () => 1); ->p51 : Symbol(p51, Decl(promiseTypeStrictNull.ts, 129, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p91 = p.then(() => {}, null); +>p91 : Symbol(p91, Decl(promiseTypeStrictNull.ts, 176, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) -const p52 = p.then(() => {}, () => {}); ->p52 : Symbol(p52, Decl(promiseTypeStrictNull.ts, 130, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p92 = p.then(() => {}, () => 1); +>p92 : Symbol(p92, Decl(promiseTypeStrictNull.ts, 177, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) -const p53 = p.then(() => {}, () => {throw 1}); ->p53 : Symbol(p53, Decl(promiseTypeStrictNull.ts, 131, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p93 = p.then(() => {}, () => x); +>p93 : Symbol(p93, Decl(promiseTypeStrictNull.ts, 178, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11)) -const p54 = p.then(() => {}, () => Promise.resolve(1)); ->p54 : Symbol(p54, Decl(promiseTypeStrictNull.ts, 132, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p94 = p.then(() => {}, () => undefined); +>p94 : Symbol(p94, Decl(promiseTypeStrictNull.ts, 179, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const p95 = p.then(() => {}, () => null); +>p95 : Symbol(p95, Decl(promiseTypeStrictNull.ts, 180, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p96 = p.then(() => {}, () => {}); +>p96 : Symbol(p96, Decl(promiseTypeStrictNull.ts, 181, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p97 = p.then(() => {}, () => {throw 1}); +>p97 : Symbol(p97, Decl(promiseTypeStrictNull.ts, 182, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const p98 = p.then(() => {}, () => Promise.resolve(1)); +>p98 : Symbol(p98, Decl(promiseTypeStrictNull.ts, 183, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p55 = p.then(() => {}, () => Promise.reject(1)); ->p55 : Symbol(p55, Decl(promiseTypeStrictNull.ts, 133, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const p99 = p.then(() => {}, () => Promise.reject(1)); +>p99 : Symbol(p99, Decl(promiseTypeStrictNull.ts, 184, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p60 = p.then(() => {throw 1}, undefined); ->p60 : Symbol(p60, Decl(promiseTypeStrictNull.ts, 135, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pa0 = p.then(() => {throw 1}, undefined); +>pa0 : Symbol(pa0, Decl(promiseTypeStrictNull.ts, 186, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) -const p61 = p.then(() => {throw 1}, () => 1); ->p61 : Symbol(p61, Decl(promiseTypeStrictNull.ts, 136, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pa1 = p.then(() => {throw 1}, null); +>pa1 : Symbol(pa1, Decl(promiseTypeStrictNull.ts, 187, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const pa2 = p.then(() => {throw 1}, () => 1); +>pa2 : Symbol(pa2, Decl(promiseTypeStrictNull.ts, 188, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) -const p62 = p.then(() => {throw 1}, () => {}); ->p62 : Symbol(p62, Decl(promiseTypeStrictNull.ts, 137, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pa3 = p.then(() => {throw 1}, () => x); +>pa3 : Symbol(pa3, Decl(promiseTypeStrictNull.ts, 189, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11)) -const p63 = p.then(() => {throw 1}, () => {throw 1}); ->p63 : Symbol(p63, Decl(promiseTypeStrictNull.ts, 138, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pa4 = p.then(() => {throw 1}, () => undefined); +>pa4 : Symbol(pa4, Decl(promiseTypeStrictNull.ts, 190, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) -const p64 = p.then(() => {throw 1}, () => Promise.resolve(1)); ->p64 : Symbol(p64, Decl(promiseTypeStrictNull.ts, 139, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pa5 = p.then(() => {throw 1}, () => null); +>pa5 : Symbol(pa5, Decl(promiseTypeStrictNull.ts, 191, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const pa6 = p.then(() => {throw 1}, () => {}); +>pa6 : Symbol(pa6, Decl(promiseTypeStrictNull.ts, 192, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const pa7 = p.then(() => {throw 1}, () => {throw 1}); +>pa7 : Symbol(pa7, Decl(promiseTypeStrictNull.ts, 193, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) + +const pa8 = p.then(() => {throw 1}, () => Promise.resolve(1)); +>pa8 : Symbol(pa8, Decl(promiseTypeStrictNull.ts, 194, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p65 = p.then(() => {throw 1}, () => Promise.reject(1)); ->p65 : Symbol(p65, Decl(promiseTypeStrictNull.ts, 140, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pa9 = p.then(() => {throw 1}, () => Promise.reject(1)); +>pa9 : Symbol(pa9, Decl(promiseTypeStrictNull.ts, 195, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p70 = p.then(() => Promise.resolve("1"), undefined); ->p70 : Symbol(p70, Decl(promiseTypeStrictNull.ts, 142, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pb0 = p.then(() => Promise.resolve("1"), undefined); +>pb0 : Symbol(pb0, Decl(promiseTypeStrictNull.ts, 197, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) -const p71 = p.then(() => Promise.resolve("1"), () => 1); ->p71 : Symbol(p71, Decl(promiseTypeStrictNull.ts, 143, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pb1 = p.then(() => Promise.resolve("1"), null); +>pb1 : Symbol(pb1, Decl(promiseTypeStrictNull.ts, 198, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const pb2 = p.then(() => Promise.resolve("1"), () => 1); +>pb2 : Symbol(pb2, Decl(promiseTypeStrictNull.ts, 199, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p72 = p.then(() => Promise.resolve("1"), () => {}); ->p72 : Symbol(p72, Decl(promiseTypeStrictNull.ts, 144, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pb3 = p.then(() => Promise.resolve("1"), () => x); +>pb3 : Symbol(pb3, Decl(promiseTypeStrictNull.ts, 200, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11)) -const p73 = p.then(() => Promise.resolve("1"), () => {throw 1}); ->p73 : Symbol(p73, Decl(promiseTypeStrictNull.ts, 145, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pb4 = p.then(() => Promise.resolve("1"), () => undefined); +>pb4 : Symbol(pb4, Decl(promiseTypeStrictNull.ts, 201, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) -const p74 = p.then(() => Promise.resolve("1"), () => Promise.resolve(1)); ->p74 : Symbol(p74, Decl(promiseTypeStrictNull.ts, 146, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pb5 = p.then(() => Promise.resolve("1"), () => null); +>pb5 : Symbol(pb5, Decl(promiseTypeStrictNull.ts, 202, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const pb6 = p.then(() => Promise.resolve("1"), () => {}); +>pb6 : Symbol(pb6, Decl(promiseTypeStrictNull.ts, 203, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p75 = p.then(() => Promise.resolve("1"), () => Promise.reject(1)); ->p75 : Symbol(p75, Decl(promiseTypeStrictNull.ts, 147, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pb7 = p.then(() => Promise.resolve("1"), () => {throw 1}); +>pb7 : Symbol(pb7, Decl(promiseTypeStrictNull.ts, 204, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const pb8 = p.then(() => Promise.resolve("1"), () => Promise.resolve(1)); +>pb8 : Symbol(pb8, Decl(promiseTypeStrictNull.ts, 205, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const pb9 = p.then(() => Promise.resolve("1"), () => Promise.reject(1)); +>pb9 : Symbol(pb9, Decl(promiseTypeStrictNull.ts, 206, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const pc0 = p.then(() => Promise.reject("1"), undefined); +>pc0 : Symbol(pc0, Decl(promiseTypeStrictNull.ts, 208, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>undefined : Symbol(undefined) + +const pc1 = p.then(() => Promise.reject("1"), null); +>pc1 : Symbol(pc1, Decl(promiseTypeStrictNull.ts, 209, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const pc2 = p.then(() => Promise.reject("1"), () => 1); +>pc2 : Symbol(pc2, Decl(promiseTypeStrictNull.ts, 210, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +const pc3 = p.then(() => Promise.reject("1"), () => x); +>pc3 : Symbol(pc3, Decl(promiseTypeStrictNull.ts, 211, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11)) -const p80 = p.then(() => Promise.reject(1), undefined); ->p80 : Symbol(p80, Decl(promiseTypeStrictNull.ts, 149, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pc4 = p.then(() => Promise.reject("1"), () => undefined); +>pc4 : Symbol(pc4, Decl(promiseTypeStrictNull.ts, 212, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) -const p81 = p.then(() => Promise.reject(1), () => 1); ->p81 : Symbol(p81, Decl(promiseTypeStrictNull.ts, 150, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pc5 = p.then(() => Promise.reject("1"), () => null); +>pc5 : Symbol(pc5, Decl(promiseTypeStrictNull.ts, 213, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p82 = p.then(() => Promise.reject(1), () => {}); ->p82 : Symbol(p82, Decl(promiseTypeStrictNull.ts, 151, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pc6 = p.then(() => Promise.reject("1"), () => {}); +>pc6 : Symbol(pc6, Decl(promiseTypeStrictNull.ts, 214, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p83 = p.then(() => Promise.reject(1), () => {throw 1}); ->p83 : Symbol(p83, Decl(promiseTypeStrictNull.ts, 152, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pc7 = p.then(() => Promise.reject("1"), () => {throw 1}); +>pc7 : Symbol(pc7, Decl(promiseTypeStrictNull.ts, 215, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p84 = p.then(() => Promise.reject(1), () => Promise.resolve(1)); ->p84 : Symbol(p84, Decl(promiseTypeStrictNull.ts, 153, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1)); +>pc8 : Symbol(pc8, Decl(promiseTypeStrictNull.ts, 216, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) @@ -626,11 +1077,11 @@ const p84 = p.then(() => Promise.reject(1), () => Promise.resolve(1)); >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) -const p85 = p.then(() => Promise.reject(1), () => Promise.reject(1)); ->p85 : Symbol(p85, Decl(promiseTypeStrictNull.ts, 154, 5)) ->p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1)); +>pc9 : Symbol(pc9, Decl(promiseTypeStrictNull.ts, 217, 5)) +>p.then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) diff --git a/tests/baselines/reference/promiseTypeStrictNull.types b/tests/baselines/reference/promiseTypeStrictNull.types index a65547ec5f3ae..7bb75ec66f234 100644 --- a/tests/baselines/reference/promiseTypeStrictNull.types +++ b/tests/baselines/reference/promiseTypeStrictNull.types @@ -3,124 +3,8 @@ declare var p: Promise; >p : Promise >Promise : Promise -const a = p.then(); ->a : Promise ->p.then() : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } - -const b = p.then(b => 1); ->b : Promise<1> ->p.then(b => 1) : Promise<1> ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->b => 1 : (b: boolean) => 1 ->b : boolean ->1 : 1 - -const c = p.then(b => 1, e => 'error'); ->c : Promise ->p.then(b => 1, e => 'error') : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->b => 1 : (b: boolean) => 1 ->b : boolean ->1 : 1 ->e => 'error' : (e: any) => string ->e : any ->'error' : "error" - -const d = p.then(b => 1, e => { }); ->d : Promise ->p.then(b => 1, e => { }) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->b => 1 : (b: boolean) => 1 ->b : boolean ->1 : 1 ->e => { } : (e: any) => void ->e : any - -const e = p.then(b => 1, e => { throw Error(); }); ->e : Promise<1> ->p.then(b => 1, e => { throw Error(); }) : Promise<1> ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->b => 1 : (b: boolean) => 1 ->b : boolean ->1 : 1 ->e => { throw Error(); } : (e: any) => never ->e : any ->Error() : Error ->Error : ErrorConstructor - -const f = p.then(b => 1, e => Promise.reject(Error())); ->f : Promise<1> ->p.then(b => 1, e => Promise.reject(Error())) : Promise<1> ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->b => 1 : (b: boolean) => 1 ->b : boolean ->1 : 1 ->e => Promise.reject(Error()) : (e: any) => Promise ->e : any ->Promise.reject(Error()) : Promise ->Promise.reject : { (reason: any): Promise; (reason: any): Promise; } ->Promise : PromiseConstructor ->reject : { (reason: any): Promise; (reason: any): Promise; } ->Error() : Error ->Error : ErrorConstructor - -const g = p.catch(e => 'error'); ->g : Promise ->p.catch(e => 'error') : Promise ->p.catch : { (onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } ->p : Promise ->catch : { (onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } ->e => 'error' : (e: any) => "error" ->e : any ->'error' : "error" - -const h = p.catch(e => { }); ->h : Promise ->p.catch(e => { }) : Promise ->p.catch : { (onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } ->p : Promise ->catch : { (onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } ->e => { } : (e: any) => void ->e : any - -const i = p.catch(e => { throw Error(); }); ->i : Promise ->p.catch(e => { throw Error(); }) : Promise ->p.catch : { (onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } ->p : Promise ->catch : { (onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } ->e => { throw Error(); } : (e: any) => never ->e : any ->Error() : Error ->Error : ErrorConstructor - -const j = p.catch(e => Promise.reject(Error())); ->j : Promise ->p.catch(e => Promise.reject(Error())) : Promise ->p.catch : { (onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } ->p : Promise ->catch : { (onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } ->e => Promise.reject(Error()) : (e: any) => Promise ->e : any ->Promise.reject(Error()) : Promise ->Promise.reject : { (reason: any): Promise; (reason: any): Promise; } ->Promise : PromiseConstructor ->reject : { (reason: any): Promise; (reason: any): Promise; } ->Error() : Error ->Error : ErrorConstructor +declare var x: any; +>x : any async function A() { >A : () => Promise @@ -146,17 +30,25 @@ async function B() { >1 : 1 } -// NOTE: This reports a "No best comment type exists among return expressions." error, and is -// ignored to get the types result for the test. -// async function C() { -// try { -// const a = await p; -// return 1; -// } -// catch (e) { -// return 'error'; -// } -// } +async function C() { +>C : () => Promise<1 | "error"> + + try { + const a = await p; +>a : boolean +>await p : boolean +>p : Promise + + return 1; +>1 : 1 + } + catch (e) { +>e : any + + return 'error'; +>'error' : "error" + } +} async function D() { >D : () => Promise<1 | undefined> @@ -291,58 +183,92 @@ async function I() { const p00 = p.catch(); >p00 : Promise >p.catch() : Promise ->p.catch : { (onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +>p.catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise >p : Promise ->catch : { (onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +>catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise -const p01 = p.catch(undefined); +const p01 = p.then(); >p01 : Promise +>p.then() : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise + +const p10 = p.catch(undefined); +>p10 : Promise >p.catch(undefined) : Promise ->p.catch : { (onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +>p.catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise >p : Promise ->catch : { (onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +>catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise >undefined : undefined -const p07 = p.catch(null); ->p07 : Promise +const p11 = p.catch(null); +>p11 : Promise >p.catch(null) : Promise ->p.catch : { (onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +>p.catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise >p : Promise ->catch : { (onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +>catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise >null : null -const p02 = p.catch(() => 1); ->p02 : Promise ->p.catch(() => 1) : Promise ->p.catch : { (onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +const p12 = p.catch(() => 1); +>p12 : Promise +>p.catch(() => 1) : Promise +>p.catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise >p : Promise ->catch : { (onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } ->() => 1 : () => 1 +>catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise +>() => 1 : () => number >1 : 1 -const p03 = p.catch(() => {}); ->p03 : Promise +const p13 = p.catch(() => x); +>p13 : Promise +>p.catch(() => x) : Promise +>p.catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise +>p : Promise +>catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise +>() => x : () => any +>x : any + +const p14 = p.catch(() => undefined); +>p14 : Promise +>p.catch(() => undefined) : Promise +>p.catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise +>p : Promise +>catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise +>() => undefined : () => undefined +>undefined : undefined + +const p15 = p.catch(() => null); +>p15 : Promise +>p.catch(() => null) : Promise +>p.catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise +>p : Promise +>catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise +>() => null : () => null +>null : null + +const p16 = p.catch(() => {}); +>p16 : Promise >p.catch(() => {}) : Promise ->p.catch : { (onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +>p.catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise >p : Promise ->catch : { (onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +>catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise >() => {} : () => void -const p04 = p.catch(() => {throw 1}); ->p04 : Promise +const p17 = p.catch(() => {throw 1}); +>p17 : Promise >p.catch(() => {throw 1}) : Promise ->p.catch : { (onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +>p.catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise >p : Promise ->catch : { (onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +>catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise >() => {throw 1} : () => never >1 : 1 -const p05 = p.catch(() => Promise.reject(1)); ->p05 : Promise +const p18 = p.catch(() => Promise.reject(1)); +>p18 : Promise >p.catch(() => Promise.reject(1)) : Promise ->p.catch : { (onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +>p.catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise >p : Promise ->catch : { (onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +>catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise >() => Promise.reject(1) : () => Promise >Promise.reject(1) : Promise >Promise.reject : { (reason: any): Promise; (reason: any): Promise; } @@ -350,12 +276,12 @@ const p05 = p.catch(() => Promise.reject(1)); >reject : { (reason: any): Promise; (reason: any): Promise; } >1 : 1 -const p06 = p.catch(() => Promise.resolve(1)); ->p06 : Promise +const p19 = p.catch(() => Promise.resolve(1)); +>p19 : Promise >p.catch(() => Promise.resolve(1)) : Promise ->p.catch : { (onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +>p.catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise >p : Promise ->catch : { (onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onrejected: (reason: any) => TResult | PromiseLike): Promise; } +>catch : (onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined) => Promise >() => Promise.resolve(1) : () => Promise >Promise.resolve(1) : Promise >Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } @@ -363,53 +289,81 @@ const p06 = p.catch(() => Promise.resolve(1)); >resolve : { (value: T | PromiseLike): Promise; (): Promise; } >1 : 1 -const p10 = p.then(); ->p10 : Promise ->p.then() : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } - const p20 = p.then(undefined); >p20 : Promise >p.then(undefined) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >undefined : undefined -const p21 = p.then(() => 1); ->p21 : Promise<1> ->p.then(() => 1) : Promise<1> ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const p21 = p.then(null); +>p21 : Promise +>p.then(null) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>null : null + +const p22 = p.then(() => 1); +>p22 : Promise +>p.then(() => 1) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->() => 1 : () => 1 +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => 1 : () => number >1 : 1 -const p22 = p.then(() => {}); ->p22 : Promise +const p23 = p.then(() => x); +>p23 : Promise +>p.then(() => x) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => x : () => any +>x : any + +const p24 = p.then(() => undefined); +>p24 : Promise +>p.then(() => undefined) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => undefined : () => undefined +>undefined : undefined + +const p25 = p.then(() => null); +>p25 : Promise +>p.then(() => null) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => null : () => null +>null : null + +const p26 = p.then(() => {}); +>p26 : Promise >p.then(() => {}) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >() => {} : () => void -const p23 = p.then(() => {throw 1}); ->p23 : Promise ->p.then(() => {throw 1}) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const p27 = p.then(() => {throw 1}); +>p27 : Promise +>p.then(() => {throw 1}) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >() => {throw 1} : () => never >1 : 1 -const p24 = p.then(() => Promise.resolve(1)); ->p24 : Promise +const p28 = p.then(() => Promise.resolve(1)); +>p28 : Promise >p.then(() => Promise.resolve(1)) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >() => Promise.resolve(1) : () => Promise >Promise.resolve(1) : Promise >Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } @@ -417,12 +371,12 @@ const p24 = p.then(() => Promise.resolve(1)); >resolve : { (value: T | PromiseLike): Promise; (): Promise; } >1 : 1 -const p25 = p.then(() => Promise.reject(1)); ->p25 : Promise ->p.then(() => Promise.reject(1)) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const p29 = p.then(() => Promise.reject(1)); +>p29 : Promise +>p.then(() => Promise.reject(1)) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >() => Promise.reject(1) : () => Promise >Promise.reject(1) : Promise >Promise.reject : { (reason: any): Promise; (reason: any): Promise; } @@ -433,47 +387,86 @@ const p25 = p.then(() => Promise.reject(1)); const p30 = p.then(undefined, undefined); >p30 : Promise >p.then(undefined, undefined) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >undefined : undefined >undefined : undefined -const p31 = p.then(undefined, () => 1); ->p31 : Promise ->p.then(undefined, () => 1) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const p31 = p.then(undefined, null); +>p31 : Promise +>p.then(undefined, null) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >undefined : undefined ->() => 1 : () => 1 +>null : null + +const p32 = p.then(undefined, () => 1); +>p32 : Promise +>p.then(undefined, () => 1) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>undefined : undefined +>() => 1 : () => number >1 : 1 -const p32 = p.then(undefined, () => {}); ->p32 : Promise +const p33 = p.then(undefined, () => x); +>p33 : Promise +>p.then(undefined, () => x) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>undefined : undefined +>() => x : () => any +>x : any + +const p34 = p.then(undefined, () => undefined); +>p34 : Promise +>p.then(undefined, () => undefined) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>undefined : undefined +>() => undefined : () => undefined +>undefined : undefined + +const p35 = p.then(undefined, () => null); +>p35 : Promise +>p.then(undefined, () => null) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>undefined : undefined +>() => null : () => null +>null : null + +const p36 = p.then(undefined, () => {}); +>p36 : Promise >p.then(undefined, () => {}) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >undefined : undefined >() => {} : () => void -const p33 = p.then(undefined, () => {throw 1}); ->p33 : Promise +const p37 = p.then(undefined, () => {throw 1}); +>p37 : Promise >p.then(undefined, () => {throw 1}) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >undefined : undefined >() => {throw 1} : () => never >1 : 1 -const p34 = p.then(undefined, () => Promise.resolve(1)); ->p34 : Promise +const p38 = p.then(undefined, () => Promise.resolve(1)); +>p38 : Promise >p.then(undefined, () => Promise.resolve(1)) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >undefined : undefined >() => Promise.resolve(1) : () => Promise >Promise.resolve(1) : Promise @@ -482,12 +475,12 @@ const p34 = p.then(undefined, () => Promise.resolve(1)); >resolve : { (value: T | PromiseLike): Promise; (): Promise; } >1 : 1 -const p35 = p.then(undefined, () => Promise.reject(1)); ->p35 : Promise +const p39 = p.then(undefined, () => Promise.reject(1)); +>p39 : Promise >p.then(undefined, () => Promise.reject(1)) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >undefined : undefined >() => Promise.reject(1) : () => Promise >Promise.reject(1) : Promise @@ -496,55 +489,203 @@ const p35 = p.then(undefined, () => Promise.reject(1)); >reject : { (reason: any): Promise; (reason: any): Promise; } >1 : 1 -const p40 = p.then(() => "1", undefined); ->p40 : Promise<"1"> ->p.then(() => "1", undefined) : Promise<"1"> ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const p40 = p.then(null, undefined); +>p40 : Promise +>p.then(null, undefined) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>null : null +>undefined : undefined + +const p41 = p.then(null, null); +>p41 : Promise +>p.then(null, null) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>null : null +>null : null + +const p42 = p.then(null, () => 1); +>p42 : Promise +>p.then(null, () => 1) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>null : null +>() => 1 : () => number +>1 : 1 + +const p43 = p.then(null, () => x); +>p43 : Promise +>p.then(null, () => x) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>null : null +>() => x : () => any +>x : any + +const p44 = p.then(null, () => undefined); +>p44 : Promise +>p.then(null, () => undefined) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>null : null +>() => undefined : () => undefined +>undefined : undefined + +const p45 = p.then(null, () => null); +>p45 : Promise +>p.then(null, () => null) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->() => "1" : () => "1" +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>null : null +>() => null : () => null +>null : null + +const p46 = p.then(null, () => {}); +>p46 : Promise +>p.then(null, () => {}) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>null : null +>() => {} : () => void + +const p47 = p.then(null, () => {throw 1}); +>p47 : Promise +>p.then(null, () => {throw 1}) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>null : null +>() => {throw 1} : () => never +>1 : 1 + +const p48 = p.then(null, () => Promise.resolve(1)); +>p48 : Promise +>p.then(null, () => Promise.resolve(1)) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>null : null +>() => Promise.resolve(1) : () => Promise +>Promise.resolve(1) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>1 : 1 + +const p49 = p.then(null, () => Promise.reject(1)); +>p49 : Promise +>p.then(null, () => Promise.reject(1)) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>null : null +>() => Promise.reject(1) : () => Promise +>Promise.reject(1) : Promise +>Promise.reject : { (reason: any): Promise; (reason: any): Promise; } +>Promise : PromiseConstructor +>reject : { (reason: any): Promise; (reason: any): Promise; } +>1 : 1 + +const p50 = p.then(() => "1", undefined); +>p50 : Promise +>p.then(() => "1", undefined) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => "1" : () => string >"1" : "1" >undefined : undefined -const p41 = p.then(() => "1", () => 1); ->p41 : Promise ->p.then(() => "1", () => 1) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const p51 = p.then(() => "1", null); +>p51 : Promise +>p.then(() => "1", null) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => "1" : () => string +>"1" : "1" +>null : null + +const p52 = p.then(() => "1", () => 1); +>p52 : Promise +>p.then(() => "1", () => 1) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->() => "1" : () => "1" +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => "1" : () => string >"1" : "1" >() => 1 : () => number >1 : 1 -const p42 = p.then(() => "1", () => {}); ->p42 : Promise ->p.then(() => "1", () => {}) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const p53 = p.then(() => "1", () => x); +>p53 : Promise +>p.then(() => "1", () => x) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => "1" : () => string +>"1" : "1" +>() => x : () => any +>x : any + +const p54 = p.then(() => "1", () => undefined); +>p54 : Promise +>p.then(() => "1", () => undefined) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => "1" : () => string +>"1" : "1" +>() => undefined : () => undefined +>undefined : undefined + +const p55 = p.then(() => "1", () => null); +>p55 : Promise +>p.then(() => "1", () => null) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->() => "1" : () => "1" +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => "1" : () => string +>"1" : "1" +>() => null : () => null +>null : null + +const p56 = p.then(() => "1", () => {}); +>p56 : Promise +>p.then(() => "1", () => {}) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => "1" : () => string >"1" : "1" >() => {} : () => void -const p43 = p.then(() => "1", () => {throw 1}); ->p43 : Promise<"1"> ->p.then(() => "1", () => {throw 1}) : Promise<"1"> ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const p57 = p.then(() => "1", () => {throw 1}); +>p57 : Promise +>p.then(() => "1", () => {throw 1}) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->() => "1" : () => "1" +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => "1" : () => string >"1" : "1" >() => {throw 1} : () => never >1 : 1 -const p44 = p.then(() => "1", () => Promise.resolve(1)); ->p44 : Promise ->p.then(() => "1", () => Promise.resolve(1)) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const p58 = p.then(() => "1", () => Promise.resolve(1)); +>p58 : Promise +>p.then(() => "1", () => Promise.resolve(1)) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->() => "1" : () => "1" +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => "1" : () => string >"1" : "1" >() => Promise.resolve(1) : () => Promise >Promise.resolve(1) : Promise @@ -553,13 +694,13 @@ const p44 = p.then(() => "1", () => Promise.resolve(1)); >resolve : { (value: T | PromiseLike): Promise; (): Promise; } >1 : 1 -const p45 = p.then(() => "1", () => Promise.reject(1)); ->p45 : Promise<"1"> ->p.then(() => "1", () => Promise.reject(1)) : Promise<"1"> ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const p59 = p.then(() => "1", () => Promise.reject(1)); +>p59 : Promise +>p.then(() => "1", () => Promise.reject(1)) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->() => "1" : () => "1" +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => "1" : () => string >"1" : "1" >() => Promise.reject(1) : () => Promise >Promise.reject(1) : Promise @@ -568,50 +709,434 @@ const p45 = p.then(() => "1", () => Promise.reject(1)); >reject : { (reason: any): Promise; (reason: any): Promise; } >1 : 1 -const p50 = p.then(() => {}, undefined); ->p50 : Promise +const p60 = p.then(() => x, undefined); +>p60 : Promise +>p.then(() => x, undefined) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => x : () => any +>x : any +>undefined : undefined + +const p61 = p.then(() => x, null); +>p61 : Promise +>p.then(() => x, null) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => x : () => any +>x : any +>null : null + +const p62 = p.then(() => x, () => 1); +>p62 : Promise +>p.then(() => x, () => 1) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => x : () => any +>x : any +>() => 1 : () => number +>1 : 1 + +const p63 = p.then(() => x, () => x); +>p63 : Promise +>p.then(() => x, () => x) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => x : () => any +>x : any +>() => x : () => any +>x : any + +const p64 = p.then(() => x, () => undefined); +>p64 : Promise +>p.then(() => x, () => undefined) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => x : () => any +>x : any +>() => undefined : () => undefined +>undefined : undefined + +const p65 = p.then(() => x, () => null); +>p65 : Promise +>p.then(() => x, () => null) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => x : () => any +>x : any +>() => null : () => null +>null : null + +const p66 = p.then(() => x, () => {}); +>p66 : Promise +>p.then(() => x, () => {}) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => x : () => any +>x : any +>() => {} : () => void + +const p67 = p.then(() => x, () => {throw 1}); +>p67 : Promise +>p.then(() => x, () => {throw 1}) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => x : () => any +>x : any +>() => {throw 1} : () => never +>1 : 1 + +const p68 = p.then(() => x, () => Promise.resolve(1)); +>p68 : Promise +>p.then(() => x, () => Promise.resolve(1)) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => x : () => any +>x : any +>() => Promise.resolve(1) : () => Promise +>Promise.resolve(1) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>1 : 1 + +const p69 = p.then(() => x, () => Promise.reject(1)); +>p69 : Promise +>p.then(() => x, () => Promise.reject(1)) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => x : () => any +>x : any +>() => Promise.reject(1) : () => Promise +>Promise.reject(1) : Promise +>Promise.reject : { (reason: any): Promise; (reason: any): Promise; } +>Promise : PromiseConstructor +>reject : { (reason: any): Promise; (reason: any): Promise; } +>1 : 1 + +const p70 = p.then(() => undefined, undefined); +>p70 : Promise +>p.then(() => undefined, undefined) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => undefined : () => undefined +>undefined : undefined +>undefined : undefined + +const p71 = p.then(() => undefined, null); +>p71 : Promise +>p.then(() => undefined, null) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => undefined : () => undefined +>undefined : undefined +>null : null + +const p72 = p.then(() => undefined, () => 1); +>p72 : Promise +>p.then(() => undefined, () => 1) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => undefined : () => undefined +>undefined : undefined +>() => 1 : () => number +>1 : 1 + +const p73 = p.then(() => undefined, () => x); +>p73 : Promise +>p.then(() => undefined, () => x) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => undefined : () => undefined +>undefined : undefined +>() => x : () => any +>x : any + +const p74 = p.then(() => undefined, () => undefined); +>p74 : Promise +>p.then(() => undefined, () => undefined) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => undefined : () => undefined +>undefined : undefined +>() => undefined : () => undefined +>undefined : undefined + +const p75 = p.then(() => undefined, () => null); +>p75 : Promise +>p.then(() => undefined, () => null) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => undefined : () => undefined +>undefined : undefined +>() => null : () => null +>null : null + +const p76 = p.then(() => undefined, () => {}); +>p76 : Promise +>p.then(() => undefined, () => {}) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => undefined : () => undefined +>undefined : undefined +>() => {} : () => void + +const p77 = p.then(() => undefined, () => {throw 1}); +>p77 : Promise +>p.then(() => undefined, () => {throw 1}) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => undefined : () => undefined +>undefined : undefined +>() => {throw 1} : () => never +>1 : 1 + +const p78 = p.then(() => undefined, () => Promise.resolve(1)); +>p78 : Promise +>p.then(() => undefined, () => Promise.resolve(1)) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => undefined : () => undefined +>undefined : undefined +>() => Promise.resolve(1) : () => Promise +>Promise.resolve(1) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>1 : 1 + +const p79 = p.then(() => undefined, () => Promise.reject(1)); +>p79 : Promise +>p.then(() => undefined, () => Promise.reject(1)) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => undefined : () => undefined +>undefined : undefined +>() => Promise.reject(1) : () => Promise +>Promise.reject(1) : Promise +>Promise.reject : { (reason: any): Promise; (reason: any): Promise; } +>Promise : PromiseConstructor +>reject : { (reason: any): Promise; (reason: any): Promise; } +>1 : 1 + +const p80 = p.then(() => null, undefined); +>p80 : Promise +>p.then(() => null, undefined) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => null : () => null +>null : null +>undefined : undefined + +const p81 = p.then(() => null, null); +>p81 : Promise +>p.then(() => null, null) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => null : () => null +>null : null +>null : null + +const p82 = p.then(() => null, () => 1); +>p82 : Promise +>p.then(() => null, () => 1) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => null : () => null +>null : null +>() => 1 : () => number +>1 : 1 + +const p83 = p.then(() => null, () => x); +>p83 : Promise +>p.then(() => null, () => x) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => null : () => null +>null : null +>() => x : () => any +>x : any + +const p84 = p.then(() => null, () => undefined); +>p84 : Promise +>p.then(() => null, () => undefined) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => null : () => null +>null : null +>() => undefined : () => undefined +>undefined : undefined + +const p85 = p.then(() => null, () => null); +>p85 : Promise +>p.then(() => null, () => null) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => null : () => null +>null : null +>() => null : () => null +>null : null + +const p86 = p.then(() => null, () => {}); +>p86 : Promise +>p.then(() => null, () => {}) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => null : () => null +>null : null +>() => {} : () => void + +const p87 = p.then(() => null, () => {throw 1}); +>p87 : Promise +>p.then(() => null, () => {throw 1}) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => null : () => null +>null : null +>() => {throw 1} : () => never +>1 : 1 + +const p88 = p.then(() => null, () => Promise.resolve(1)); +>p88 : Promise +>p.then(() => null, () => Promise.resolve(1)) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => null : () => null +>null : null +>() => Promise.resolve(1) : () => Promise +>Promise.resolve(1) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>1 : 1 + +const p89 = p.then(() => null, () => Promise.reject(1)); +>p89 : Promise +>p.then(() => null, () => Promise.reject(1)) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => null : () => null +>null : null +>() => Promise.reject(1) : () => Promise +>Promise.reject(1) : Promise +>Promise.reject : { (reason: any): Promise; (reason: any): Promise; } +>Promise : PromiseConstructor +>reject : { (reason: any): Promise; (reason: any): Promise; } +>1 : 1 + +const p90 = p.then(() => {}, undefined); +>p90 : Promise >p.then(() => {}, undefined) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >() => {} : () => void >undefined : undefined -const p51 = p.then(() => {}, () => 1); ->p51 : Promise +const p91 = p.then(() => {}, null); +>p91 : Promise +>p.then(() => {}, null) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => {} : () => void +>null : null + +const p92 = p.then(() => {}, () => 1); +>p92 : Promise >p.then(() => {}, () => 1) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >() => {} : () => void >() => 1 : () => number >1 : 1 -const p52 = p.then(() => {}, () => {}); ->p52 : Promise +const p93 = p.then(() => {}, () => x); +>p93 : Promise +>p.then(() => {}, () => x) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => {} : () => void +>() => x : () => any +>x : any + +const p94 = p.then(() => {}, () => undefined); +>p94 : Promise +>p.then(() => {}, () => undefined) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => {} : () => void +>() => undefined : () => undefined +>undefined : undefined + +const p95 = p.then(() => {}, () => null); +>p95 : Promise +>p.then(() => {}, () => null) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => {} : () => void +>() => null : () => null +>null : null + +const p96 = p.then(() => {}, () => {}); +>p96 : Promise >p.then(() => {}, () => {}) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >() => {} : () => void >() => {} : () => void -const p53 = p.then(() => {}, () => {throw 1}); ->p53 : Promise +const p97 = p.then(() => {}, () => {throw 1}); +>p97 : Promise >p.then(() => {}, () => {throw 1}) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >() => {} : () => void >() => {throw 1} : () => never >1 : 1 -const p54 = p.then(() => {}, () => Promise.resolve(1)); ->p54 : Promise +const p98 = p.then(() => {}, () => Promise.resolve(1)); +>p98 : Promise >p.then(() => {}, () => Promise.resolve(1)) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >() => {} : () => void >() => Promise.resolve(1) : () => Promise >Promise.resolve(1) : Promise @@ -620,12 +1145,12 @@ const p54 = p.then(() => {}, () => Promise.resolve(1)); >resolve : { (value: T | PromiseLike): Promise; (): Promise; } >1 : 1 -const p55 = p.then(() => {}, () => Promise.reject(1)); ->p55 : Promise +const p99 = p.then(() => {}, () => Promise.reject(1)); +>p99 : Promise >p.then(() => {}, () => Promise.reject(1)) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >() => {} : () => void >() => Promise.reject(1) : () => Promise >Promise.reject(1) : Promise @@ -634,54 +1159,97 @@ const p55 = p.then(() => {}, () => Promise.reject(1)); >reject : { (reason: any): Promise; (reason: any): Promise; } >1 : 1 -const p60 = p.then(() => {throw 1}, undefined); ->p60 : Promise ->p.then(() => {throw 1}, undefined) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const pa0 = p.then(() => {throw 1}, undefined); +>pa0 : Promise +>p.then(() => {throw 1}, undefined) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >() => {throw 1} : () => never >1 : 1 >undefined : undefined -const p61 = p.then(() => {throw 1}, () => 1); ->p61 : Promise ->p.then(() => {throw 1}, () => 1) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const pa1 = p.then(() => {throw 1}, null); +>pa1 : Promise +>p.then(() => {throw 1}, null) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => {throw 1} : () => never +>1 : 1 +>null : null + +const pa2 = p.then(() => {throw 1}, () => 1); +>pa2 : Promise +>p.then(() => {throw 1}, () => 1) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => {throw 1} : () => never +>1 : 1 +>() => 1 : () => number +>1 : 1 + +const pa3 = p.then(() => {throw 1}, () => x); +>pa3 : Promise +>p.then(() => {throw 1}, () => x) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >() => {throw 1} : () => never >1 : 1 ->() => 1 : () => 1 +>() => x : () => any +>x : any + +const pa4 = p.then(() => {throw 1}, () => undefined); +>pa4 : Promise +>p.then(() => {throw 1}, () => undefined) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => {throw 1} : () => never +>1 : 1 +>() => undefined : () => undefined +>undefined : undefined + +const pa5 = p.then(() => {throw 1}, () => null); +>pa5 : Promise +>p.then(() => {throw 1}, () => null) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => {throw 1} : () => never >1 : 1 +>() => null : () => null +>null : null -const p62 = p.then(() => {throw 1}, () => {}); ->p62 : Promise ->p.then(() => {throw 1}, () => {}) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const pa6 = p.then(() => {throw 1}, () => {}); +>pa6 : Promise +>p.then(() => {throw 1}, () => {}) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >() => {throw 1} : () => never >1 : 1 >() => {} : () => void -const p63 = p.then(() => {throw 1}, () => {throw 1}); ->p63 : Promise ->p.then(() => {throw 1}, () => {throw 1}) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const pa7 = p.then(() => {throw 1}, () => {throw 1}); +>pa7 : Promise +>p.then(() => {throw 1}, () => {throw 1}) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >() => {throw 1} : () => never >1 : 1 >() => {throw 1} : () => never >1 : 1 -const p64 = p.then(() => {throw 1}, () => Promise.resolve(1)); ->p64 : Promise ->p.then(() => {throw 1}, () => Promise.resolve(1)) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const pa8 = p.then(() => {throw 1}, () => Promise.resolve(1)); +>pa8 : Promise +>p.then(() => {throw 1}, () => Promise.resolve(1)) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >() => {throw 1} : () => never >1 : 1 >() => Promise.resolve(1) : () => Promise @@ -691,12 +1259,12 @@ const p64 = p.then(() => {throw 1}, () => Promise.resolve(1)); >resolve : { (value: T | PromiseLike): Promise; (): Promise; } >1 : 1 -const p65 = p.then(() => {throw 1}, () => Promise.reject(1)); ->p65 : Promise ->p.then(() => {throw 1}, () => Promise.reject(1)) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const pa9 = p.then(() => {throw 1}, () => Promise.reject(1)); +>pa9 : Promise +>p.then(() => {throw 1}, () => Promise.reject(1)) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >() => {throw 1} : () => never >1 : 1 >() => Promise.reject(1) : () => Promise @@ -706,12 +1274,12 @@ const p65 = p.then(() => {throw 1}, () => Promise.reject(1)); >reject : { (reason: any): Promise; (reason: any): Promise; } >1 : 1 -const p70 = p.then(() => Promise.resolve("1"), undefined); ->p70 : Promise +const pb0 = p.then(() => Promise.resolve("1"), undefined); +>pb0 : Promise >p.then(() => Promise.resolve("1"), undefined) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >() => Promise.resolve("1") : () => Promise >Promise.resolve("1") : Promise >Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } @@ -720,12 +1288,26 @@ const p70 = p.then(() => Promise.resolve("1"), undefined); >"1" : "1" >undefined : undefined -const p71 = p.then(() => Promise.resolve("1"), () => 1); ->p71 : Promise +const pb1 = p.then(() => Promise.resolve("1"), null); +>pb1 : Promise +>p.then(() => Promise.resolve("1"), null) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => Promise.resolve("1") : () => Promise +>Promise.resolve("1") : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>"1" : "1" +>null : null + +const pb2 = p.then(() => Promise.resolve("1"), () => 1); +>pb2 : Promise >p.then(() => Promise.resolve("1"), () => 1) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >() => Promise.resolve("1") : () => Promise >Promise.resolve("1") : Promise >Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } @@ -735,12 +1317,57 @@ const p71 = p.then(() => Promise.resolve("1"), () => 1); >() => 1 : () => number >1 : 1 -const p72 = p.then(() => Promise.resolve("1"), () => {}); ->p72 : Promise +const pb3 = p.then(() => Promise.resolve("1"), () => x); +>pb3 : Promise +>p.then(() => Promise.resolve("1"), () => x) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => Promise.resolve("1") : () => Promise +>Promise.resolve("1") : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>"1" : "1" +>() => x : () => any +>x : any + +const pb4 = p.then(() => Promise.resolve("1"), () => undefined); +>pb4 : Promise +>p.then(() => Promise.resolve("1"), () => undefined) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => Promise.resolve("1") : () => Promise +>Promise.resolve("1") : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>"1" : "1" +>() => undefined : () => undefined +>undefined : undefined + +const pb5 = p.then(() => Promise.resolve("1"), () => null); +>pb5 : Promise +>p.then(() => Promise.resolve("1"), () => null) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => Promise.resolve("1") : () => Promise +>Promise.resolve("1") : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>"1" : "1" +>() => null : () => null +>null : null + +const pb6 = p.then(() => Promise.resolve("1"), () => {}); +>pb6 : Promise >p.then(() => Promise.resolve("1"), () => {}) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >() => Promise.resolve("1") : () => Promise >Promise.resolve("1") : Promise >Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } @@ -749,12 +1376,12 @@ const p72 = p.then(() => Promise.resolve("1"), () => {}); >"1" : "1" >() => {} : () => void -const p73 = p.then(() => Promise.resolve("1"), () => {throw 1}); ->p73 : Promise +const pb7 = p.then(() => Promise.resolve("1"), () => {throw 1}); +>pb7 : Promise >p.then(() => Promise.resolve("1"), () => {throw 1}) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >() => Promise.resolve("1") : () => Promise >Promise.resolve("1") : Promise >Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } @@ -764,12 +1391,12 @@ const p73 = p.then(() => Promise.resolve("1"), () => {throw 1}); >() => {throw 1} : () => never >1 : 1 -const p74 = p.then(() => Promise.resolve("1"), () => Promise.resolve(1)); ->p74 : Promise +const pb8 = p.then(() => Promise.resolve("1"), () => Promise.resolve(1)); +>pb8 : Promise >p.then(() => Promise.resolve("1"), () => Promise.resolve(1)) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >() => Promise.resolve("1") : () => Promise >Promise.resolve("1") : Promise >Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } @@ -783,12 +1410,12 @@ const p74 = p.then(() => Promise.resolve("1"), () => Promise.resolve(1)); >resolve : { (value: T | PromiseLike): Promise; (): Promise; } >1 : 1 -const p75 = p.then(() => Promise.resolve("1"), () => Promise.reject(1)); ->p75 : Promise +const pb9 = p.then(() => Promise.resolve("1"), () => Promise.reject(1)); +>pb9 : Promise >p.then(() => Promise.resolve("1"), () => Promise.reject(1)) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >() => Promise.resolve("1") : () => Promise >Promise.resolve("1") : Promise >Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } @@ -802,76 +1429,135 @@ const p75 = p.then(() => Promise.resolve("1"), () => Promise.reject(1)); >reject : { (reason: any): Promise; (reason: any): Promise; } >1 : 1 -const p80 = p.then(() => Promise.reject(1), undefined); ->p80 : Promise ->p.then(() => Promise.reject(1), undefined) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const pc0 = p.then(() => Promise.reject("1"), undefined); +>pc0 : Promise +>p.then(() => Promise.reject("1"), undefined) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->() => Promise.reject(1) : () => Promise ->Promise.reject(1) : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => Promise.reject("1") : () => Promise +>Promise.reject("1") : Promise >Promise.reject : { (reason: any): Promise; (reason: any): Promise; } >Promise : PromiseConstructor >reject : { (reason: any): Promise; (reason: any): Promise; } ->1 : 1 +>"1" : "1" >undefined : undefined -const p81 = p.then(() => Promise.reject(1), () => 1); ->p81 : Promise ->p.then(() => Promise.reject(1), () => 1) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const pc1 = p.then(() => Promise.reject("1"), null); +>pc1 : Promise +>p.then(() => Promise.reject("1"), null) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->() => Promise.reject(1) : () => Promise ->Promise.reject(1) : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => Promise.reject("1") : () => Promise +>Promise.reject("1") : Promise >Promise.reject : { (reason: any): Promise; (reason: any): Promise; } >Promise : PromiseConstructor >reject : { (reason: any): Promise; (reason: any): Promise; } ->1 : 1 ->() => 1 : () => 1 ->1 : 1 +>"1" : "1" +>null : null -const p82 = p.then(() => Promise.reject(1), () => {}); ->p82 : Promise ->p.then(() => Promise.reject(1), () => {}) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const pc2 = p.then(() => Promise.reject("1"), () => 1); +>pc2 : Promise +>p.then(() => Promise.reject("1"), () => 1) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->() => Promise.reject(1) : () => Promise ->Promise.reject(1) : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => Promise.reject("1") : () => Promise +>Promise.reject("1") : Promise >Promise.reject : { (reason: any): Promise; (reason: any): Promise; } >Promise : PromiseConstructor >reject : { (reason: any): Promise; (reason: any): Promise; } +>"1" : "1" +>() => 1 : () => number >1 : 1 + +const pc3 = p.then(() => Promise.reject("1"), () => x); +>pc3 : Promise +>p.then(() => Promise.reject("1"), () => x) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => Promise.reject("1") : () => Promise +>Promise.reject("1") : Promise +>Promise.reject : { (reason: any): Promise; (reason: any): Promise; } +>Promise : PromiseConstructor +>reject : { (reason: any): Promise; (reason: any): Promise; } +>"1" : "1" +>() => x : () => any +>x : any + +const pc4 = p.then(() => Promise.reject("1"), () => undefined); +>pc4 : Promise +>p.then(() => Promise.reject("1"), () => undefined) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => Promise.reject("1") : () => Promise +>Promise.reject("1") : Promise +>Promise.reject : { (reason: any): Promise; (reason: any): Promise; } +>Promise : PromiseConstructor +>reject : { (reason: any): Promise; (reason: any): Promise; } +>"1" : "1" +>() => undefined : () => undefined +>undefined : undefined + +const pc5 = p.then(() => Promise.reject("1"), () => null); +>pc5 : Promise +>p.then(() => Promise.reject("1"), () => null) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => Promise.reject("1") : () => Promise +>Promise.reject("1") : Promise +>Promise.reject : { (reason: any): Promise; (reason: any): Promise; } +>Promise : PromiseConstructor +>reject : { (reason: any): Promise; (reason: any): Promise; } +>"1" : "1" +>() => null : () => null +>null : null + +const pc6 = p.then(() => Promise.reject("1"), () => {}); +>pc6 : Promise +>p.then(() => Promise.reject("1"), () => {}) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>p : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => Promise.reject("1") : () => Promise +>Promise.reject("1") : Promise +>Promise.reject : { (reason: any): Promise; (reason: any): Promise; } +>Promise : PromiseConstructor +>reject : { (reason: any): Promise; (reason: any): Promise; } +>"1" : "1" >() => {} : () => void -const p83 = p.then(() => Promise.reject(1), () => {throw 1}); ->p83 : Promise ->p.then(() => Promise.reject(1), () => {throw 1}) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const pc7 = p.then(() => Promise.reject("1"), () => {throw 1}); +>pc7 : Promise +>p.then(() => Promise.reject("1"), () => {throw 1}) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->() => Promise.reject(1) : () => Promise ->Promise.reject(1) : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => Promise.reject("1") : () => Promise +>Promise.reject("1") : Promise >Promise.reject : { (reason: any): Promise; (reason: any): Promise; } >Promise : PromiseConstructor >reject : { (reason: any): Promise; (reason: any): Promise; } ->1 : 1 +>"1" : "1" >() => {throw 1} : () => never >1 : 1 -const p84 = p.then(() => Promise.reject(1), () => Promise.resolve(1)); ->p84 : Promise ->p.then(() => Promise.reject(1), () => Promise.resolve(1)) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1)); +>pc8 : Promise +>p.then(() => Promise.reject("1"), () => Promise.resolve(1)) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->() => Promise.reject(1) : () => Promise ->Promise.reject(1) : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => Promise.reject("1") : () => Promise +>Promise.reject("1") : Promise >Promise.reject : { (reason: any): Promise; (reason: any): Promise; } >Promise : PromiseConstructor >reject : { (reason: any): Promise; (reason: any): Promise; } ->1 : 1 +>"1" : "1" >() => Promise.resolve(1) : () => Promise >Promise.resolve(1) : Promise >Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } @@ -879,18 +1565,18 @@ const p84 = p.then(() => Promise.reject(1), () => Promise.resolve(1)); >resolve : { (value: T | PromiseLike): Promise; (): Promise; } >1 : 1 -const p85 = p.then(() => Promise.reject(1), () => Promise.reject(1)); ->p85 : Promise ->p.then(() => Promise.reject(1), () => Promise.reject(1)) : Promise ->p.then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1)); +>pc9 : Promise +>p.then(() => Promise.reject("1"), () => Promise.reject(1)) : Promise +>p.then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise >p : Promise ->then : { (onfulfilled?: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected?: ((reason: any) => boolean | PromiseLike) | null | undefined): Promise; (onfulfilled: ((value: boolean) => boolean | PromiseLike) | null | undefined, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: boolean) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | null | undefined): Promise; (onfulfilled: (value: boolean) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } ->() => Promise.reject(1) : () => Promise ->Promise.reject(1) : Promise +>then : (onfulfilled?: ((value: boolean) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>() => Promise.reject("1") : () => Promise +>Promise.reject("1") : Promise >Promise.reject : { (reason: any): Promise; (reason: any): Promise; } >Promise : PromiseConstructor >reject : { (reason: any): Promise; (reason: any): Promise; } ->1 : 1 +>"1" : "1" >() => Promise.reject(1) : () => Promise >Promise.reject(1) : Promise >Promise.reject : { (reason: any): Promise; (reason: any): Promise; } diff --git a/tests/baselines/reference/promiseVoidErrorCallback.symbols b/tests/baselines/reference/promiseVoidErrorCallback.symbols index 67747f5f1500d..e20cd11a0d6c5 100644 --- a/tests/baselines/reference/promiseVoidErrorCallback.symbols +++ b/tests/baselines/reference/promiseVoidErrorCallback.symbols @@ -47,12 +47,12 @@ function f2(x: T1): T2 { var x3 = f1() >x3 : Symbol(x3, Decl(promiseVoidErrorCallback.ts, 20, 3)) ->f1() .then(f2, (e: Error) => { throw e;}) .then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->f1() .then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>f1() .then(f2, (e: Error) => { throw e;}) .then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) +>f1() .then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >f1 : Symbol(f1, Decl(promiseVoidErrorCallback.ts, 10, 1)) .then(f2, (e: Error) => { ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >f2 : Symbol(f2, Decl(promiseVoidErrorCallback.ts, 14, 1)) >e : Symbol(e, Decl(promiseVoidErrorCallback.ts, 21, 15)) >Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) @@ -62,7 +62,7 @@ var x3 = f1() }) .then((x: T2) => { ->then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --)) >x : Symbol(x, Decl(promiseVoidErrorCallback.ts, 24, 11)) >T2 : Symbol(T2, Decl(promiseVoidErrorCallback.ts, 2, 1)) diff --git a/tests/baselines/reference/promiseVoidErrorCallback.types b/tests/baselines/reference/promiseVoidErrorCallback.types index 65c9fd0b6893c..bd1b3a87c2603 100644 --- a/tests/baselines/reference/promiseVoidErrorCallback.types +++ b/tests/baselines/reference/promiseVoidErrorCallback.types @@ -54,14 +54,14 @@ function f2(x: T1): T2 { var x3 = f1() >x3 : Promise<{ __t3: string; }> >f1() .then(f2, (e: Error) => { throw e;}) .then((x: T2) => { return { __t3: x.__t2 + "bar" };}) : Promise<{ __t3: string; }> ->f1() .then(f2, (e: Error) => { throw e;}) .then : { (onfulfilled?: (value: T2) => T2 | PromiseLike, onrejected?: (reason: any) => T2 | PromiseLike): Promise; (onfulfilled: (value: T2) => T2 | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: T2) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: T2) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>f1() .then(f2, (e: Error) => { throw e;}) .then : (onfulfilled?: (value: T2) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >f1() .then(f2, (e: Error) => { throw e;}) : Promise ->f1() .then : { (onfulfilled?: (value: T1) => T1 | PromiseLike, onrejected?: (reason: any) => T1 | PromiseLike): Promise; (onfulfilled: (value: T1) => T1 | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: T1) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: T1) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>f1() .then : (onfulfilled?: (value: T1) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >f1() : Promise >f1 : () => Promise .then(f2, (e: Error) => { ->then : { (onfulfilled?: (value: T1) => T1 | PromiseLike, onrejected?: (reason: any) => T1 | PromiseLike): Promise; (onfulfilled: (value: T1) => T1 | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: T1) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: T1) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: T1) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >f2 : (x: T1) => T2 >(e: Error) => { throw e;} : (e: Error) => never >e : Error @@ -72,7 +72,7 @@ var x3 = f1() }) .then((x: T2) => { ->then : { (onfulfilled?: (value: T2) => T2 | PromiseLike, onrejected?: (reason: any) => T2 | PromiseLike): Promise; (onfulfilled: (value: T2) => T2 | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: T2) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled: (value: T2) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; } +>then : (onfulfilled?: (value: T2) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >(x: T2) => { return { __t3: x.__t2 + "bar" };} : (x: T2) => { __t3: string; } >x : T2 >T2 : T2 diff --git a/tests/cases/compiler/promiseType.ts b/tests/cases/compiler/promiseType.ts index b105485b2442e..ba4a7f6041396 100644 --- a/tests/cases/compiler/promiseType.ts +++ b/tests/cases/compiler/promiseType.ts @@ -1,16 +1,6 @@ // @target: es6 declare var p: Promise; - -const a = p.then(); -const b = p.then(b => 1); -const c = p.then(b => 1, e => 'error'); -const d = p.then(b => 1, e => { }); -const e = p.then(b => 1, e => { throw Error(); }); -const f = p.then(b => 1, e => Promise.reject(Error())); -const g = p.catch(e => 'error'); -const h = p.catch(e => { }); -const i = p.catch(e => { throw Error(); }); -const j = p.catch(e => Promise.reject(Error())); +declare var x: any; async function A() { const a = await p; @@ -22,17 +12,15 @@ async function B() { return 1; } -// NOTE: This reports a "No best comment type exists among return expressions." error, and is -// ignored to get the types result for the test. -// async function C() { -// try { -// const a = await p; -// return 1; -// } -// catch (e) { -// return 'error'; -// } -// } +async function C() { + try { + const a = await p; + return 1; + } + catch (e) { + return 'error'; + } +} async function D() { try { @@ -96,61 +84,136 @@ async function I() { // addresses github issue #4903: const p00 = p.catch(); -const p01 = p.catch(undefined); -const p07 = p.catch(null); -const p02 = p.catch(() => 1); -const p03 = p.catch(() => {}); -const p04 = p.catch(() => {throw 1}); -const p05 = p.catch(() => Promise.reject(1)); -const p06 = p.catch(() => Promise.resolve(1)); - -const p10 = p.then(); +const p01 = p.then(); + +const p10 = p.catch(undefined); +const p11 = p.catch(null); +const p12 = p.catch(() => 1); +const p13 = p.catch(() => x); +const p14 = p.catch(() => undefined); +const p15 = p.catch(() => null); +const p16 = p.catch(() => {}); +const p17 = p.catch(() => {throw 1}); +const p18 = p.catch(() => Promise.reject(1)); +const p19 = p.catch(() => Promise.resolve(1)); const p20 = p.then(undefined); -const p21 = p.then(() => 1); -const p22 = p.then(() => {}); -const p23 = p.then(() => {throw 1}); -const p24 = p.then(() => Promise.resolve(1)); -const p25 = p.then(() => Promise.reject(1)); +const p21 = p.then(null); +const p22 = p.then(() => 1); +const p23 = p.then(() => x); +const p24 = p.then(() => undefined); +const p25 = p.then(() => null); +const p26 = p.then(() => {}); +const p27 = p.then(() => {throw 1}); +const p28 = p.then(() => Promise.resolve(1)); +const p29 = p.then(() => Promise.reject(1)); const p30 = p.then(undefined, undefined); -const p31 = p.then(undefined, () => 1); -const p32 = p.then(undefined, () => {}); -const p33 = p.then(undefined, () => {throw 1}); -const p34 = p.then(undefined, () => Promise.resolve(1)); -const p35 = p.then(undefined, () => Promise.reject(1)); - -const p40 = p.then(() => "1", undefined); -const p41 = p.then(() => "1", () => 1); -const p42 = p.then(() => "1", () => {}); -const p43 = p.then(() => "1", () => {throw 1}); -const p44 = p.then(() => "1", () => Promise.resolve(1)); -const p45 = p.then(() => "1", () => Promise.reject(1)); - -const p50 = p.then(() => {}, undefined); -const p51 = p.then(() => {}, () => 1); -const p52 = p.then(() => {}, () => {}); -const p53 = p.then(() => {}, () => {throw 1}); -const p54 = p.then(() => {}, () => Promise.resolve(1)); -const p55 = p.then(() => {}, () => Promise.reject(1)); - -const p60 = p.then(() => {throw 1}, undefined); -const p61 = p.then(() => {throw 1}, () => 1); -const p62 = p.then(() => {throw 1}, () => {}); -const p63 = p.then(() => {throw 1}, () => {throw 1}); -const p64 = p.then(() => {throw 1}, () => Promise.resolve(1)); -const p65 = p.then(() => {throw 1}, () => Promise.reject(1)); - -const p70 = p.then(() => Promise.resolve("1"), undefined); -const p71 = p.then(() => Promise.resolve("1"), () => 1); -const p72 = p.then(() => Promise.resolve("1"), () => {}); -const p73 = p.then(() => Promise.resolve("1"), () => {throw 1}); -const p74 = p.then(() => Promise.resolve("1"), () => Promise.resolve(1)); -const p75 = p.then(() => Promise.resolve("1"), () => Promise.reject(1)); - -const p80 = p.then(() => Promise.reject(1), undefined); -const p81 = p.then(() => Promise.reject(1), () => 1); -const p82 = p.then(() => Promise.reject(1), () => {}); -const p83 = p.then(() => Promise.reject(1), () => {throw 1}); -const p84 = p.then(() => Promise.reject(1), () => Promise.resolve(1)); -const p85 = p.then(() => Promise.reject(1), () => Promise.reject(1)); \ No newline at end of file +const p31 = p.then(undefined, null); +const p32 = p.then(undefined, () => 1); +const p33 = p.then(undefined, () => x); +const p34 = p.then(undefined, () => undefined); +const p35 = p.then(undefined, () => null); +const p36 = p.then(undefined, () => {}); +const p37 = p.then(undefined, () => {throw 1}); +const p38 = p.then(undefined, () => Promise.resolve(1)); +const p39 = p.then(undefined, () => Promise.reject(1)); + +const p40 = p.then(null, undefined); +const p41 = p.then(null, null); +const p42 = p.then(null, () => 1); +const p43 = p.then(null, () => x); +const p44 = p.then(null, () => undefined); +const p45 = p.then(null, () => null); +const p46 = p.then(null, () => {}); +const p47 = p.then(null, () => {throw 1}); +const p48 = p.then(null, () => Promise.resolve(1)); +const p49 = p.then(null, () => Promise.reject(1)); + +const p50 = p.then(() => "1", undefined); +const p51 = p.then(() => "1", null); +const p52 = p.then(() => "1", () => 1); +const p53 = p.then(() => "1", () => x); +const p54 = p.then(() => "1", () => undefined); +const p55 = p.then(() => "1", () => null); +const p56 = p.then(() => "1", () => {}); +const p57 = p.then(() => "1", () => {throw 1}); +const p58 = p.then(() => "1", () => Promise.resolve(1)); +const p59 = p.then(() => "1", () => Promise.reject(1)); + +const p60 = p.then(() => x, undefined); +const p61 = p.then(() => x, null); +const p62 = p.then(() => x, () => 1); +const p63 = p.then(() => x, () => x); +const p64 = p.then(() => x, () => undefined); +const p65 = p.then(() => x, () => null); +const p66 = p.then(() => x, () => {}); +const p67 = p.then(() => x, () => {throw 1}); +const p68 = p.then(() => x, () => Promise.resolve(1)); +const p69 = p.then(() => x, () => Promise.reject(1)); + +const p70 = p.then(() => undefined, undefined); +const p71 = p.then(() => undefined, null); +const p72 = p.then(() => undefined, () => 1); +const p73 = p.then(() => undefined, () => x); +const p74 = p.then(() => undefined, () => undefined); +const p75 = p.then(() => undefined, () => null); +const p76 = p.then(() => undefined, () => {}); +const p77 = p.then(() => undefined, () => {throw 1}); +const p78 = p.then(() => undefined, () => Promise.resolve(1)); +const p79 = p.then(() => undefined, () => Promise.reject(1)); + +const p80 = p.then(() => null, undefined); +const p81 = p.then(() => null, null); +const p82 = p.then(() => null, () => 1); +const p83 = p.then(() => null, () => x); +const p84 = p.then(() => null, () => undefined); +const p85 = p.then(() => null, () => null); +const p86 = p.then(() => null, () => {}); +const p87 = p.then(() => null, () => {throw 1}); +const p88 = p.then(() => null, () => Promise.resolve(1)); +const p89 = p.then(() => null, () => Promise.reject(1)); + +const p90 = p.then(() => {}, undefined); +const p91 = p.then(() => {}, null); +const p92 = p.then(() => {}, () => 1); +const p93 = p.then(() => {}, () => x); +const p94 = p.then(() => {}, () => undefined); +const p95 = p.then(() => {}, () => null); +const p96 = p.then(() => {}, () => {}); +const p97 = p.then(() => {}, () => {throw 1}); +const p98 = p.then(() => {}, () => Promise.resolve(1)); +const p99 = p.then(() => {}, () => Promise.reject(1)); + +const pa0 = p.then(() => {throw 1}, undefined); +const pa1 = p.then(() => {throw 1}, null); +const pa2 = p.then(() => {throw 1}, () => 1); +const pa3 = p.then(() => {throw 1}, () => x); +const pa4 = p.then(() => {throw 1}, () => undefined); +const pa5 = p.then(() => {throw 1}, () => null); +const pa6 = p.then(() => {throw 1}, () => {}); +const pa7 = p.then(() => {throw 1}, () => {throw 1}); +const pa8 = p.then(() => {throw 1}, () => Promise.resolve(1)); +const pa9 = p.then(() => {throw 1}, () => Promise.reject(1)); + +const pb0 = p.then(() => Promise.resolve("1"), undefined); +const pb1 = p.then(() => Promise.resolve("1"), null); +const pb2 = p.then(() => Promise.resolve("1"), () => 1); +const pb3 = p.then(() => Promise.resolve("1"), () => x); +const pb4 = p.then(() => Promise.resolve("1"), () => undefined); +const pb5 = p.then(() => Promise.resolve("1"), () => null); +const pb6 = p.then(() => Promise.resolve("1"), () => {}); +const pb7 = p.then(() => Promise.resolve("1"), () => {throw 1}); +const pb8 = p.then(() => Promise.resolve("1"), () => Promise.resolve(1)); +const pb9 = p.then(() => Promise.resolve("1"), () => Promise.reject(1)); + +const pc0 = p.then(() => Promise.reject("1"), undefined); +const pc1 = p.then(() => Promise.reject("1"), null); +const pc2 = p.then(() => Promise.reject("1"), () => 1); +const pc3 = p.then(() => Promise.reject("1"), () => x); +const pc4 = p.then(() => Promise.reject("1"), () => undefined); +const pc5 = p.then(() => Promise.reject("1"), () => null); +const pc6 = p.then(() => Promise.reject("1"), () => {}); +const pc7 = p.then(() => Promise.reject("1"), () => {throw 1}); +const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1)); +const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1)); diff --git a/tests/cases/compiler/promiseTypeStrictNull.ts b/tests/cases/compiler/promiseTypeStrictNull.ts index ce6dcd364618f..fc0125412a43d 100644 --- a/tests/cases/compiler/promiseTypeStrictNull.ts +++ b/tests/cases/compiler/promiseTypeStrictNull.ts @@ -1,17 +1,7 @@ // @target: es6 // @strictNullChecks: true declare var p: Promise; - -const a = p.then(); -const b = p.then(b => 1); -const c = p.then(b => 1, e => 'error'); -const d = p.then(b => 1, e => { }); -const e = p.then(b => 1, e => { throw Error(); }); -const f = p.then(b => 1, e => Promise.reject(Error())); -const g = p.catch(e => 'error'); -const h = p.catch(e => { }); -const i = p.catch(e => { throw Error(); }); -const j = p.catch(e => Promise.reject(Error())); +declare var x: any; async function A() { const a = await p; @@ -23,17 +13,15 @@ async function B() { return 1; } -// NOTE: This reports a "No best comment type exists among return expressions." error, and is -// ignored to get the types result for the test. -// async function C() { -// try { -// const a = await p; -// return 1; -// } -// catch (e) { -// return 'error'; -// } -// } +async function C() { + try { + const a = await p; + return 1; + } + catch (e) { + return 'error'; + } +} async function D() { try { @@ -97,61 +85,136 @@ async function I() { // addresses github issue #4903: const p00 = p.catch(); -const p01 = p.catch(undefined); -const p07 = p.catch(null); -const p02 = p.catch(() => 1); -const p03 = p.catch(() => {}); -const p04 = p.catch(() => {throw 1}); -const p05 = p.catch(() => Promise.reject(1)); -const p06 = p.catch(() => Promise.resolve(1)); - -const p10 = p.then(); +const p01 = p.then(); + +const p10 = p.catch(undefined); +const p11 = p.catch(null); +const p12 = p.catch(() => 1); +const p13 = p.catch(() => x); +const p14 = p.catch(() => undefined); +const p15 = p.catch(() => null); +const p16 = p.catch(() => {}); +const p17 = p.catch(() => {throw 1}); +const p18 = p.catch(() => Promise.reject(1)); +const p19 = p.catch(() => Promise.resolve(1)); const p20 = p.then(undefined); -const p21 = p.then(() => 1); -const p22 = p.then(() => {}); -const p23 = p.then(() => {throw 1}); -const p24 = p.then(() => Promise.resolve(1)); -const p25 = p.then(() => Promise.reject(1)); +const p21 = p.then(null); +const p22 = p.then(() => 1); +const p23 = p.then(() => x); +const p24 = p.then(() => undefined); +const p25 = p.then(() => null); +const p26 = p.then(() => {}); +const p27 = p.then(() => {throw 1}); +const p28 = p.then(() => Promise.resolve(1)); +const p29 = p.then(() => Promise.reject(1)); const p30 = p.then(undefined, undefined); -const p31 = p.then(undefined, () => 1); -const p32 = p.then(undefined, () => {}); -const p33 = p.then(undefined, () => {throw 1}); -const p34 = p.then(undefined, () => Promise.resolve(1)); -const p35 = p.then(undefined, () => Promise.reject(1)); - -const p40 = p.then(() => "1", undefined); -const p41 = p.then(() => "1", () => 1); -const p42 = p.then(() => "1", () => {}); -const p43 = p.then(() => "1", () => {throw 1}); -const p44 = p.then(() => "1", () => Promise.resolve(1)); -const p45 = p.then(() => "1", () => Promise.reject(1)); - -const p50 = p.then(() => {}, undefined); -const p51 = p.then(() => {}, () => 1); -const p52 = p.then(() => {}, () => {}); -const p53 = p.then(() => {}, () => {throw 1}); -const p54 = p.then(() => {}, () => Promise.resolve(1)); -const p55 = p.then(() => {}, () => Promise.reject(1)); - -const p60 = p.then(() => {throw 1}, undefined); -const p61 = p.then(() => {throw 1}, () => 1); -const p62 = p.then(() => {throw 1}, () => {}); -const p63 = p.then(() => {throw 1}, () => {throw 1}); -const p64 = p.then(() => {throw 1}, () => Promise.resolve(1)); -const p65 = p.then(() => {throw 1}, () => Promise.reject(1)); - -const p70 = p.then(() => Promise.resolve("1"), undefined); -const p71 = p.then(() => Promise.resolve("1"), () => 1); -const p72 = p.then(() => Promise.resolve("1"), () => {}); -const p73 = p.then(() => Promise.resolve("1"), () => {throw 1}); -const p74 = p.then(() => Promise.resolve("1"), () => Promise.resolve(1)); -const p75 = p.then(() => Promise.resolve("1"), () => Promise.reject(1)); - -const p80 = p.then(() => Promise.reject(1), undefined); -const p81 = p.then(() => Promise.reject(1), () => 1); -const p82 = p.then(() => Promise.reject(1), () => {}); -const p83 = p.then(() => Promise.reject(1), () => {throw 1}); -const p84 = p.then(() => Promise.reject(1), () => Promise.resolve(1)); -const p85 = p.then(() => Promise.reject(1), () => Promise.reject(1)); \ No newline at end of file +const p31 = p.then(undefined, null); +const p32 = p.then(undefined, () => 1); +const p33 = p.then(undefined, () => x); +const p34 = p.then(undefined, () => undefined); +const p35 = p.then(undefined, () => null); +const p36 = p.then(undefined, () => {}); +const p37 = p.then(undefined, () => {throw 1}); +const p38 = p.then(undefined, () => Promise.resolve(1)); +const p39 = p.then(undefined, () => Promise.reject(1)); + +const p40 = p.then(null, undefined); +const p41 = p.then(null, null); +const p42 = p.then(null, () => 1); +const p43 = p.then(null, () => x); +const p44 = p.then(null, () => undefined); +const p45 = p.then(null, () => null); +const p46 = p.then(null, () => {}); +const p47 = p.then(null, () => {throw 1}); +const p48 = p.then(null, () => Promise.resolve(1)); +const p49 = p.then(null, () => Promise.reject(1)); + +const p50 = p.then(() => "1", undefined); +const p51 = p.then(() => "1", null); +const p52 = p.then(() => "1", () => 1); +const p53 = p.then(() => "1", () => x); +const p54 = p.then(() => "1", () => undefined); +const p55 = p.then(() => "1", () => null); +const p56 = p.then(() => "1", () => {}); +const p57 = p.then(() => "1", () => {throw 1}); +const p58 = p.then(() => "1", () => Promise.resolve(1)); +const p59 = p.then(() => "1", () => Promise.reject(1)); + +const p60 = p.then(() => x, undefined); +const p61 = p.then(() => x, null); +const p62 = p.then(() => x, () => 1); +const p63 = p.then(() => x, () => x); +const p64 = p.then(() => x, () => undefined); +const p65 = p.then(() => x, () => null); +const p66 = p.then(() => x, () => {}); +const p67 = p.then(() => x, () => {throw 1}); +const p68 = p.then(() => x, () => Promise.resolve(1)); +const p69 = p.then(() => x, () => Promise.reject(1)); + +const p70 = p.then(() => undefined, undefined); +const p71 = p.then(() => undefined, null); +const p72 = p.then(() => undefined, () => 1); +const p73 = p.then(() => undefined, () => x); +const p74 = p.then(() => undefined, () => undefined); +const p75 = p.then(() => undefined, () => null); +const p76 = p.then(() => undefined, () => {}); +const p77 = p.then(() => undefined, () => {throw 1}); +const p78 = p.then(() => undefined, () => Promise.resolve(1)); +const p79 = p.then(() => undefined, () => Promise.reject(1)); + +const p80 = p.then(() => null, undefined); +const p81 = p.then(() => null, null); +const p82 = p.then(() => null, () => 1); +const p83 = p.then(() => null, () => x); +const p84 = p.then(() => null, () => undefined); +const p85 = p.then(() => null, () => null); +const p86 = p.then(() => null, () => {}); +const p87 = p.then(() => null, () => {throw 1}); +const p88 = p.then(() => null, () => Promise.resolve(1)); +const p89 = p.then(() => null, () => Promise.reject(1)); + +const p90 = p.then(() => {}, undefined); +const p91 = p.then(() => {}, null); +const p92 = p.then(() => {}, () => 1); +const p93 = p.then(() => {}, () => x); +const p94 = p.then(() => {}, () => undefined); +const p95 = p.then(() => {}, () => null); +const p96 = p.then(() => {}, () => {}); +const p97 = p.then(() => {}, () => {throw 1}); +const p98 = p.then(() => {}, () => Promise.resolve(1)); +const p99 = p.then(() => {}, () => Promise.reject(1)); + +const pa0 = p.then(() => {throw 1}, undefined); +const pa1 = p.then(() => {throw 1}, null); +const pa2 = p.then(() => {throw 1}, () => 1); +const pa3 = p.then(() => {throw 1}, () => x); +const pa4 = p.then(() => {throw 1}, () => undefined); +const pa5 = p.then(() => {throw 1}, () => null); +const pa6 = p.then(() => {throw 1}, () => {}); +const pa7 = p.then(() => {throw 1}, () => {throw 1}); +const pa8 = p.then(() => {throw 1}, () => Promise.resolve(1)); +const pa9 = p.then(() => {throw 1}, () => Promise.reject(1)); + +const pb0 = p.then(() => Promise.resolve("1"), undefined); +const pb1 = p.then(() => Promise.resolve("1"), null); +const pb2 = p.then(() => Promise.resolve("1"), () => 1); +const pb3 = p.then(() => Promise.resolve("1"), () => x); +const pb4 = p.then(() => Promise.resolve("1"), () => undefined); +const pb5 = p.then(() => Promise.resolve("1"), () => null); +const pb6 = p.then(() => Promise.resolve("1"), () => {}); +const pb7 = p.then(() => Promise.resolve("1"), () => {throw 1}); +const pb8 = p.then(() => Promise.resolve("1"), () => Promise.resolve(1)); +const pb9 = p.then(() => Promise.resolve("1"), () => Promise.reject(1)); + +const pc0 = p.then(() => Promise.reject("1"), undefined); +const pc1 = p.then(() => Promise.reject("1"), null); +const pc2 = p.then(() => Promise.reject("1"), () => 1); +const pc3 = p.then(() => Promise.reject("1"), () => x); +const pc4 = p.then(() => Promise.reject("1"), () => undefined); +const pc5 = p.then(() => Promise.reject("1"), () => null); +const pc6 = p.then(() => Promise.reject("1"), () => {}); +const pc7 = p.then(() => Promise.reject("1"), () => {throw 1}); +const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1)); +const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1)); From 25cb02e2678b797a832ba18ff5ff9c3140c055a9 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Sat, 14 Jan 2017 15:09:22 -0800 Subject: [PATCH 03/18] Fix circularity check, simplify default type mapper --- src/compiler/checker.ts | 42 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 96ee4835b9c92..b1d39a4c09161 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4842,8 +4842,6 @@ namespace ts { function getDefaultOfTypeParameter(typeParameter: TypeParameter): Type { return hasNonCircularDefault(typeParameter) ? getDefaultFromTypeParameter(typeParameter) : undefined; - // const defaultType = getResolvedDefault(typeParameter); - // return defaultType !== noConstraintOrDefaultType && defaultType !== circularConstraintOrDefaultType ? defaultType : undefined; } function hasNonCircularDefault(type: TypeParameter) { @@ -4870,11 +4868,9 @@ namespace ts { return getResolvedDefault(type); } if (type.flags & TypeFlags.UnionOrIntersection) { - const types = (type).types; - const defaultTypes = filter(map(types, getResolvedDefaultWorker), x => x !== circularConstraintOrDefaultType); - return type.flags & TypeFlags.Union && defaultTypes.length === types.length ? getUnionType(defaultTypes) : - type.flags & TypeFlags.Intersection && defaultTypes.length ? getIntersectionType(defaultTypes) : - undefined; + const types = map((type).types, getResolvedDefaultWorker); + return some(types, x => x === circularConstraintOrDefaultType) ? circularConstraintOrDefaultType : + type.flags & TypeFlags.Union ? getUnionType(types) : getIntersectionType(types); } return type; } @@ -5178,30 +5174,28 @@ namespace ts { } function fillMissingTypeArguments(typeArguments: Type[] | undefined, typeParameters: TypeParameter[] | undefined, minTypeArgumentCount: number) { - const numTypeArguments = typeArguments ? typeArguments.length : 0; const numTypeParameters = typeParameters ? typeParameters.length : 0; - if (numTypeArguments >= minTypeArgumentCount && numTypeArguments <= numTypeParameters) { - if (numTypeParameters) { + if (numTypeParameters) { + const numTypeArguments = typeArguments ? typeArguments.length : 0; + if (numTypeArguments >= minTypeArgumentCount && numTypeArguments <= numTypeParameters) { if (!typeArguments) { typeArguments = []; } + + // Map an unsatisfied type parameter with a default type to the default type. + // If a type parameter does not have a default type, or if the default type + // is a circular reference, the empty object type is used. const mapper: TypeMapper = t => { - for (let i = 0; i < numTypeParameters; i++) { - if (t === typeParameters[i]) { - if (!typeArguments[i]) { - typeArguments[i] = emptyObjectType; - const defaultType = getDefaultOfTypeParameter(typeParameters[i]); - if (defaultType) { - typeArguments[i] = instantiateType(defaultType, mapper); - } - } - return typeArguments[i]; - } - } - return t; + const i = indexOf(typeParameters, t); + return i >= 0 + ? typeArguments[i] || (typeArguments[i] = + instantiateType(getDefaultOfTypeParameter(typeParameters[i]), mapper) || + emptyObjectType) + : t; }; + for (let i = numTypeArguments; i < numTypeParameters; i++) { - typeArguments[i] = instantiateType(typeParameters[i], mapper); + instantiateType(typeParameters[i], mapper); } } } From ca16ba8fe7b2f2bd482a2141d530c3f6cbd114b4 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Sat, 14 Jan 2017 15:41:40 -0800 Subject: [PATCH 04/18] Added comments and additional circularity tests --- src/compiler/checker.ts | 86 ++++- tests/baselines/reference/genericDefaults.js | 80 ++++ .../reference/genericDefaults.symbols | 350 +++++++++++------- .../baselines/reference/genericDefaults.types | 134 +++++++ .../genericDefaultsErrors.errors.txt | 70 ++-- .../reference/genericDefaultsErrors.js | 40 +- tests/cases/compiler/genericDefaults.ts | 22 ++ tests/cases/compiler/genericDefaultsErrors.ts | 16 +- 8 files changed, 614 insertions(+), 184 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b1d39a4c09161..5da6244b552cb 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4840,15 +4840,60 @@ namespace ts { } } - function getDefaultOfTypeParameter(typeParameter: TypeParameter): Type { + /** + * Gets the default type for a type parameter. + * + * If the type parameter is the result of an instantiation, this gets the instantiated + * default type of its target. If the type parameter has no default type, `undefined` + * is returned. + * + * This function *does not* perform a circularity check. + */ + function getDefaultFromTypeParameter(typeParameter: TypeParameter): Type | undefined { + if (!typeParameter.default) { + if (typeParameter.target) { + const targetDefault = getDefaultFromTypeParameter(typeParameter.target); + typeParameter.default = targetDefault ? instantiateType(targetDefault, typeParameter.mapper) : noConstraintOrDefaultType; + } + else { + const defaultDeclaration = typeParameter.symbol && forEach(typeParameter.symbol.declarations, decl => isTypeParameter(decl) && decl.default); + typeParameter.default = defaultDeclaration ? getTypeFromTypeNode(defaultDeclaration) : noConstraintOrDefaultType; + } + } + return typeParameter.default === noConstraintOrDefaultType ? undefined : typeParameter.default; + } + + /** + * Gets the default type for a type parameter. + * + * If the type parameter is the result of an instantiation, this gets the instantiated + * default type of its target. If the type parameter has no default type, or if the default + * type circularly references the type parameter, `undefined` is returned. + * + * This function *does* perform a circularity check. + */ + function getDefaultOfTypeParameter(typeParameter: TypeParameter): Type | undefined { return hasNonCircularDefault(typeParameter) ? getDefaultFromTypeParameter(typeParameter) : undefined; } - function hasNonCircularDefault(type: TypeParameter) { - return getResolvedDefault(type) !== circularConstraintOrDefaultType; + /** + * Determines whether a type parameter has a non-circular default type. + * + * Note that this function also returns `true` if a type parameter *does not* have a + * default type. + */ + function hasNonCircularDefault(typeParameter: TypeParameter): boolean { + return getResolvedDefault(typeParameter) !== circularConstraintOrDefaultType; } - function getResolvedDefault(typeParameter: TypeParameter) { + /** + * Resolves the default type of a type parameter. + * + * If the type parameter has no default, the `noConstraintOrDefaultType` singleton is + * returned. If the type parameter has a circular default, the + * `circularConstraintOrDefaultType` singleton is returned. + */ + function getResolvedDefault(typeParameter: TypeParameter): Type { if (!typeParameter.resolvedDefault) { if (!pushTypeResolution(typeParameter, TypeSystemPropertyName.ResolvedDefault)) { return circularConstraintOrDefaultType; @@ -4863,6 +4908,12 @@ namespace ts { return typeParameter.resolvedDefault; } + /** + * Recursively resolves the default type for a type. + * + * If the type is a union or intersection type and any of its constituents is a circular + * reference, the `circularConstraintOrDefaultType` singleton is returned. + */ function getResolvedDefaultWorker(type: Type): Type { if (type.flags & TypeFlags.TypeParameter) { return getResolvedDefault(type); @@ -5173,6 +5224,14 @@ namespace ts { return minTypeArgumentCount; } + /** + * Fill in default types for unsupplied type arguments. If `typeArguments` is undefined + * when a default type is supplied, a new array will be created and returned. + * + * @param typeArguments The supplied type arguments. + * @param typeParameters The requested type parameters. + * @param minTypeArgumentCount The minimum number of required type arguments. + */ function fillMissingTypeArguments(typeArguments: Type[] | undefined, typeParameters: TypeParameter[] | undefined, minTypeArgumentCount: number) { const numTypeParameters = typeParameters ? typeParameters.length : 0; if (numTypeParameters) { @@ -5488,20 +5547,6 @@ namespace ts { return typeParameter.constraint === noConstraintOrDefaultType ? undefined : typeParameter.constraint; } - function getDefaultFromTypeParameter(typeParameter: TypeParameter): Type | undefined { - if (!typeParameter.default) { - if (typeParameter.target) { - const targetDefault = getDefaultFromTypeParameter(typeParameter.target); - typeParameter.default = targetDefault ? instantiateType(targetDefault, typeParameter.mapper) : noConstraintOrDefaultType; - } - else { - const defaultDeclaration = typeParameter.symbol && forEach(typeParameter.symbol.declarations, decl => isTypeParameter(decl) && decl.default); - typeParameter.default = defaultDeclaration ? getTypeFromTypeNode(defaultDeclaration) : noConstraintOrDefaultType; - } - } - return typeParameter.default === noConstraintOrDefaultType ? undefined : typeParameter.default; - } - function getParentSymbolOfTypeParameter(typeParameter: TypeParameter): Symbol { return getSymbolOfNode(getDeclarationOfKind(typeParameter.symbol, SyntaxKind.TypeParameter).parent); } @@ -13535,6 +13580,7 @@ namespace ts { ? createInferenceContext(originalCandidate, /*inferUnionTypes*/ false) : undefined; + // fix each supplied type argument in the inference context if (typeArguments) { for (let i = 0; i < typeArguments.length; i++) { inferenceContext.inferredTypes[i] = getTypeFromTypeNode(typeArguments[i]); @@ -13545,8 +13591,10 @@ namespace ts { while (true) { candidate = originalCandidate; if (candidate.typeParameters) { - typeArgumentsAreValid = typeArguments ? checkTypeArguments(candidate, typeArguments, inferenceContext.inferredTypes, /*reportErrors*/ false) : true; + // Check any supplied type arguments against the candidate. + typeArgumentsAreValid = !typeArguments || checkTypeArguments(candidate, typeArguments, inferenceContext.inferredTypes, /*reportErrors*/ false); if (typeArgumentsAreValid) { + // Infer any unsupplied type arguments for the candidate. inferTypeArguments(node, candidate, args, excludeArgument, inferenceContext); typeArgumentsAreValid = inferenceContext.failedTypeParameterIndex === undefined; } diff --git a/tests/baselines/reference/genericDefaults.js b/tests/baselines/reference/genericDefaults.js index aeedbd5d9e162..c61a42c965101 100644 --- a/tests/baselines/reference/genericDefaults.js +++ b/tests/baselines/reference/genericDefaults.js @@ -42,6 +42,28 @@ const f03c06 = f03(); const f03c07 = f03(1); const f03c08 = f03(1, 2); +declare function f04(a?: T, b?: U): [T, U]; +const f04c00 = f04(); +const f04c01 = f04(1); +const f04c02 = f04(1, 1); +const f04c03 = f04(); +const f04c04 = f04(1); +const f04c05 = f04(1, 2); +const f04c06 = f04(); +const f04c07 = f04(1); +const f04c08 = f04(1, 2); + +declare function f05(a?: T, b?: U): [T, U]; +const f05c00 = f05(); +const f05c01 = f05(1); +const f05c02 = f05(1, 1); +const f05c03 = f05(); +const f05c04 = f05(1); +const f05c05 = f05(1, 2); +const f05c06 = f05(); +const f05c07 = f05(1); +const f05c08 = f05(1, 2); + interface i00 { a: T; } const i00c00 = (x).a; const i00c01 = (>x).a; @@ -120,6 +142,24 @@ var f03c05 = f03(1, 2); var f03c06 = f03(); var f03c07 = f03(1); var f03c08 = f03(1, 2); +var f04c00 = f04(); +var f04c01 = f04(1); +var f04c02 = f04(1, 1); +var f04c03 = f04(); +var f04c04 = f04(1); +var f04c05 = f04(1, 2); +var f04c06 = f04(); +var f04c07 = f04(1); +var f04c08 = f04(1, 2); +var f05c00 = f05(); +var f05c01 = f05(1); +var f05c02 = f05(1, 1); +var f05c03 = f05(); +var f05c04 = f05(1); +var f05c05 = f05(1, 2); +var f05c06 = f05(); +var f05c07 = f05(1); +var f05c08 = f05(1, 2); var i00c00 = x.a; var i00c01 = x.a; var i01c00 = x.a; @@ -187,6 +227,46 @@ declare const f03c05: [number, number]; declare const f03c06: [number, number]; declare const f03c07: [number, number]; declare const f03c08: [number, number]; +declare function f04(a?: T, b?: U): [T, U]; +declare const f04c00: [{}, {} | { + a: number; +}]; +declare const f04c01: [number, number | { + a: number; +}]; +declare const f04c02: [number, number]; +declare const f04c03: [number, number | { + a: number; +}]; +declare const f04c04: [number, number | { + a: number; +}]; +declare const f04c05: [number, number]; +declare const f04c06: [number, number]; +declare const f04c07: [number, number]; +declare const f04c08: [number, number]; +declare function f05(a?: T, b?: U): [T, U]; +declare const f05c00: [{}, {} & { + a: number; +}]; +declare const f05c01: [number, number & { + a: number; +}]; +declare const f05c02: [number, number]; +declare const f05c03: [number, number & { + a: number; +}]; +declare const f05c04: [number, number & { + a: number; +}]; +declare const f05c05: [number, number]; +declare const f05c06: [number, number]; +declare const f05c07: [number, number]; +declare const f05c08: [number, number]; interface i00 { a: T; } diff --git a/tests/baselines/reference/genericDefaults.symbols b/tests/baselines/reference/genericDefaults.symbols index fe8dff0412ee6..a43b6fa9f4363 100644 --- a/tests/baselines/reference/genericDefaults.symbols +++ b/tests/baselines/reference/genericDefaults.symbols @@ -178,213 +178,311 @@ const f03c08 = f03(1, 2); >f03c08 : Symbol(f03c08, Decl(genericDefaults.ts, 41, 5)) >f03 : Symbol(f03, Decl(genericDefaults.ts, 30, 43)) +declare function f04(a?: T, b?: U): [T, U]; +>f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41)) +>T : Symbol(T, Decl(genericDefaults.ts, 43, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 43, 23)) +>T : Symbol(T, Decl(genericDefaults.ts, 43, 21)) +>a : Symbol(a, Decl(genericDefaults.ts, 43, 33)) +>a : Symbol(a, Decl(genericDefaults.ts, 43, 47)) +>T : Symbol(T, Decl(genericDefaults.ts, 43, 21)) +>b : Symbol(b, Decl(genericDefaults.ts, 43, 53)) +>U : Symbol(U, Decl(genericDefaults.ts, 43, 23)) +>T : Symbol(T, Decl(genericDefaults.ts, 43, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 43, 23)) + +const f04c00 = f04(); +>f04c00 : Symbol(f04c00, Decl(genericDefaults.ts, 44, 5)) +>f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41)) + +const f04c01 = f04(1); +>f04c01 : Symbol(f04c01, Decl(genericDefaults.ts, 45, 5)) +>f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41)) + +const f04c02 = f04(1, 1); +>f04c02 : Symbol(f04c02, Decl(genericDefaults.ts, 46, 5)) +>f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41)) + +const f04c03 = f04(); +>f04c03 : Symbol(f04c03, Decl(genericDefaults.ts, 47, 5)) +>f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41)) + +const f04c04 = f04(1); +>f04c04 : Symbol(f04c04, Decl(genericDefaults.ts, 48, 5)) +>f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41)) + +const f04c05 = f04(1, 2); +>f04c05 : Symbol(f04c05, Decl(genericDefaults.ts, 49, 5)) +>f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41)) + +const f04c06 = f04(); +>f04c06 : Symbol(f04c06, Decl(genericDefaults.ts, 50, 5)) +>f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41)) + +const f04c07 = f04(1); +>f04c07 : Symbol(f04c07, Decl(genericDefaults.ts, 51, 5)) +>f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41)) + +const f04c08 = f04(1, 2); +>f04c08 : Symbol(f04c08, Decl(genericDefaults.ts, 52, 5)) +>f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41)) + +declare function f05(a?: T, b?: U): [T, U]; +>f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41)) +>T : Symbol(T, Decl(genericDefaults.ts, 54, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 54, 23)) +>T : Symbol(T, Decl(genericDefaults.ts, 54, 21)) +>a : Symbol(a, Decl(genericDefaults.ts, 54, 33)) +>a : Symbol(a, Decl(genericDefaults.ts, 54, 47)) +>T : Symbol(T, Decl(genericDefaults.ts, 54, 21)) +>b : Symbol(b, Decl(genericDefaults.ts, 54, 53)) +>U : Symbol(U, Decl(genericDefaults.ts, 54, 23)) +>T : Symbol(T, Decl(genericDefaults.ts, 54, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 54, 23)) + +const f05c00 = f05(); +>f05c00 : Symbol(f05c00, Decl(genericDefaults.ts, 55, 5)) +>f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41)) + +const f05c01 = f05(1); +>f05c01 : Symbol(f05c01, Decl(genericDefaults.ts, 56, 5)) +>f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41)) + +const f05c02 = f05(1, 1); +>f05c02 : Symbol(f05c02, Decl(genericDefaults.ts, 57, 5)) +>f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41)) + +const f05c03 = f05(); +>f05c03 : Symbol(f05c03, Decl(genericDefaults.ts, 58, 5)) +>f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41)) + +const f05c04 = f05(1); +>f05c04 : Symbol(f05c04, Decl(genericDefaults.ts, 59, 5)) +>f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41)) + +const f05c05 = f05(1, 2); +>f05c05 : Symbol(f05c05, Decl(genericDefaults.ts, 60, 5)) +>f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41)) + +const f05c06 = f05(); +>f05c06 : Symbol(f05c06, Decl(genericDefaults.ts, 61, 5)) +>f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41)) + +const f05c07 = f05(1); +>f05c07 : Symbol(f05c07, Decl(genericDefaults.ts, 62, 5)) +>f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41)) + +const f05c08 = f05(1, 2); +>f05c08 : Symbol(f05c08, Decl(genericDefaults.ts, 63, 5)) +>f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41)) + interface i00 { a: T; } ->i00 : Symbol(i00, Decl(genericDefaults.ts, 41, 41)) ->T : Symbol(T, Decl(genericDefaults.ts, 43, 14)) ->a : Symbol(i00.a, Decl(genericDefaults.ts, 43, 27)) ->T : Symbol(T, Decl(genericDefaults.ts, 43, 14)) +>i00 : Symbol(i00, Decl(genericDefaults.ts, 63, 41)) +>T : Symbol(T, Decl(genericDefaults.ts, 65, 14)) +>a : Symbol(i00.a, Decl(genericDefaults.ts, 65, 27)) +>T : Symbol(T, Decl(genericDefaults.ts, 65, 14)) const i00c00 = (x).a; ->i00c00 : Symbol(i00c00, Decl(genericDefaults.ts, 44, 5)) ->(x).a : Symbol(i00.a, Decl(genericDefaults.ts, 43, 27)) ->i00 : Symbol(i00, Decl(genericDefaults.ts, 41, 41)) +>i00c00 : Symbol(i00c00, Decl(genericDefaults.ts, 66, 5)) +>(x).a : Symbol(i00.a, Decl(genericDefaults.ts, 65, 27)) +>i00 : Symbol(i00, Decl(genericDefaults.ts, 63, 41)) >x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) ->a : Symbol(i00.a, Decl(genericDefaults.ts, 43, 27)) +>a : Symbol(i00.a, Decl(genericDefaults.ts, 65, 27)) const i00c01 = (>x).a; ->i00c01 : Symbol(i00c01, Decl(genericDefaults.ts, 45, 5)) ->(>x).a : Symbol(i00.a, Decl(genericDefaults.ts, 43, 27)) ->i00 : Symbol(i00, Decl(genericDefaults.ts, 41, 41)) +>i00c01 : Symbol(i00c01, Decl(genericDefaults.ts, 67, 5)) +>(>x).a : Symbol(i00.a, Decl(genericDefaults.ts, 65, 27)) +>i00 : Symbol(i00, Decl(genericDefaults.ts, 63, 41)) >x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) ->a : Symbol(i00.a, Decl(genericDefaults.ts, 43, 27)) +>a : Symbol(i00.a, Decl(genericDefaults.ts, 65, 27)) interface i01 { a: [T, U]; } ->i01 : Symbol(i01, Decl(genericDefaults.ts, 45, 34)) ->T : Symbol(T, Decl(genericDefaults.ts, 47, 14)) ->U : Symbol(U, Decl(genericDefaults.ts, 47, 16)) ->T : Symbol(T, Decl(genericDefaults.ts, 47, 14)) ->a : Symbol(i01.a, Decl(genericDefaults.ts, 47, 25)) ->T : Symbol(T, Decl(genericDefaults.ts, 47, 14)) ->U : Symbol(U, Decl(genericDefaults.ts, 47, 16)) +>i01 : Symbol(i01, Decl(genericDefaults.ts, 67, 34)) +>T : Symbol(T, Decl(genericDefaults.ts, 69, 14)) +>U : Symbol(U, Decl(genericDefaults.ts, 69, 16)) +>T : Symbol(T, Decl(genericDefaults.ts, 69, 14)) +>a : Symbol(i01.a, Decl(genericDefaults.ts, 69, 25)) +>T : Symbol(T, Decl(genericDefaults.ts, 69, 14)) +>U : Symbol(U, Decl(genericDefaults.ts, 69, 16)) const i01c00 = (>x).a; ->i01c00 : Symbol(i01c00, Decl(genericDefaults.ts, 48, 5)) ->(>x).a : Symbol(i01.a, Decl(genericDefaults.ts, 47, 25)) ->i01 : Symbol(i01, Decl(genericDefaults.ts, 45, 34)) +>i01c00 : Symbol(i01c00, Decl(genericDefaults.ts, 70, 5)) +>(>x).a : Symbol(i01.a, Decl(genericDefaults.ts, 69, 25)) +>i01 : Symbol(i01, Decl(genericDefaults.ts, 67, 34)) >x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) ->a : Symbol(i01.a, Decl(genericDefaults.ts, 47, 25)) +>a : Symbol(i01.a, Decl(genericDefaults.ts, 69, 25)) const i01c01 = (>x).a; ->i01c01 : Symbol(i01c01, Decl(genericDefaults.ts, 49, 5)) ->(>x).a : Symbol(i01.a, Decl(genericDefaults.ts, 47, 25)) ->i01 : Symbol(i01, Decl(genericDefaults.ts, 45, 34)) +>i01c01 : Symbol(i01c01, Decl(genericDefaults.ts, 71, 5)) +>(>x).a : Symbol(i01.a, Decl(genericDefaults.ts, 69, 25)) +>i01 : Symbol(i01, Decl(genericDefaults.ts, 67, 34)) >x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) ->a : Symbol(i01.a, Decl(genericDefaults.ts, 47, 25)) +>a : Symbol(i01.a, Decl(genericDefaults.ts, 69, 25)) interface i02 { a: [T, U]; } ->i02 : Symbol(i02, Decl(genericDefaults.ts, 49, 42)) ->T : Symbol(T, Decl(genericDefaults.ts, 51, 14)) ->U : Symbol(U, Decl(genericDefaults.ts, 51, 31)) ->T : Symbol(T, Decl(genericDefaults.ts, 51, 14)) ->a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40)) ->T : Symbol(T, Decl(genericDefaults.ts, 51, 14)) ->U : Symbol(U, Decl(genericDefaults.ts, 51, 31)) +>i02 : Symbol(i02, Decl(genericDefaults.ts, 71, 42)) +>T : Symbol(T, Decl(genericDefaults.ts, 73, 14)) +>U : Symbol(U, Decl(genericDefaults.ts, 73, 31)) +>T : Symbol(T, Decl(genericDefaults.ts, 73, 14)) +>a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40)) +>T : Symbol(T, Decl(genericDefaults.ts, 73, 14)) +>U : Symbol(U, Decl(genericDefaults.ts, 73, 31)) const i02c00 = (>x).a; ->i02c00 : Symbol(i02c00, Decl(genericDefaults.ts, 52, 5)) ->(>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40)) ->i02 : Symbol(i02, Decl(genericDefaults.ts, 49, 42)) +>i02c00 : Symbol(i02c00, Decl(genericDefaults.ts, 74, 5)) +>(>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40)) +>i02 : Symbol(i02, Decl(genericDefaults.ts, 71, 42)) >x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) ->a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40)) +>a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40)) const i02c01 = (>x).a; ->i02c01 : Symbol(i02c01, Decl(genericDefaults.ts, 53, 5)) ->(>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40)) ->i02 : Symbol(i02, Decl(genericDefaults.ts, 49, 42)) +>i02c01 : Symbol(i02c01, Decl(genericDefaults.ts, 75, 5)) +>(>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40)) +>i02 : Symbol(i02, Decl(genericDefaults.ts, 71, 42)) >x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) ->a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40)) +>a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40)) const i02c02 = (>x).a; ->i02c02 : Symbol(i02c02, Decl(genericDefaults.ts, 54, 5)) ->(>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40)) ->i02 : Symbol(i02, Decl(genericDefaults.ts, 49, 42)) +>i02c02 : Symbol(i02c02, Decl(genericDefaults.ts, 76, 5)) +>(>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40)) +>i02 : Symbol(i02, Decl(genericDefaults.ts, 71, 42)) >x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) ->a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40)) +>a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40)) const i02c03 = (>x).a; ->i02c03 : Symbol(i02c03, Decl(genericDefaults.ts, 55, 5)) ->(>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40)) ->i02 : Symbol(i02, Decl(genericDefaults.ts, 49, 42)) +>i02c03 : Symbol(i02c03, Decl(genericDefaults.ts, 77, 5)) +>(>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40)) +>i02 : Symbol(i02, Decl(genericDefaults.ts, 71, 42)) >x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) ->a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40)) +>a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40)) const i02c04 = (>x).a; ->i02c04 : Symbol(i02c04, Decl(genericDefaults.ts, 56, 5)) ->(>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40)) ->i02 : Symbol(i02, Decl(genericDefaults.ts, 49, 42)) +>i02c04 : Symbol(i02c04, Decl(genericDefaults.ts, 78, 5)) +>(>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40)) +>i02 : Symbol(i02, Decl(genericDefaults.ts, 71, 42)) >x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) ->a : Symbol(i02.a, Decl(genericDefaults.ts, 51, 40)) +>a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40)) interface i03 { a: [T, U]; } ->i03 : Symbol(i03, Decl(genericDefaults.ts, 56, 37)) ->T : Symbol(T, Decl(genericDefaults.ts, 58, 14)) ->U : Symbol(U, Decl(genericDefaults.ts, 58, 31)) ->T : Symbol(T, Decl(genericDefaults.ts, 58, 14)) ->T : Symbol(T, Decl(genericDefaults.ts, 58, 14)) ->a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50)) ->T : Symbol(T, Decl(genericDefaults.ts, 58, 14)) ->U : Symbol(U, Decl(genericDefaults.ts, 58, 31)) +>i03 : Symbol(i03, Decl(genericDefaults.ts, 78, 37)) +>T : Symbol(T, Decl(genericDefaults.ts, 80, 14)) +>U : Symbol(U, Decl(genericDefaults.ts, 80, 31)) +>T : Symbol(T, Decl(genericDefaults.ts, 80, 14)) +>T : Symbol(T, Decl(genericDefaults.ts, 80, 14)) +>a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50)) +>T : Symbol(T, Decl(genericDefaults.ts, 80, 14)) +>U : Symbol(U, Decl(genericDefaults.ts, 80, 31)) const i03c00 = (>x).a; ->i03c00 : Symbol(i03c00, Decl(genericDefaults.ts, 59, 5)) ->(>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50)) ->i03 : Symbol(i03, Decl(genericDefaults.ts, 56, 37)) +>i03c00 : Symbol(i03c00, Decl(genericDefaults.ts, 81, 5)) +>(>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50)) +>i03 : Symbol(i03, Decl(genericDefaults.ts, 78, 37)) >x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) ->a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50)) +>a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50)) const i03c01 = (>x).a; ->i03c01 : Symbol(i03c01, Decl(genericDefaults.ts, 60, 5)) ->(>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50)) ->i03 : Symbol(i03, Decl(genericDefaults.ts, 56, 37)) +>i03c01 : Symbol(i03c01, Decl(genericDefaults.ts, 82, 5)) +>(>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50)) +>i03 : Symbol(i03, Decl(genericDefaults.ts, 78, 37)) >x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) ->a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50)) +>a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50)) const i03c02 = (>x).a; ->i03c02 : Symbol(i03c02, Decl(genericDefaults.ts, 61, 5)) ->(>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50)) ->i03 : Symbol(i03, Decl(genericDefaults.ts, 56, 37)) +>i03c02 : Symbol(i03c02, Decl(genericDefaults.ts, 83, 5)) +>(>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50)) +>i03 : Symbol(i03, Decl(genericDefaults.ts, 78, 37)) >x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) ->a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50)) +>a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50)) const i03c03 = (>x).a; ->i03c03 : Symbol(i03c03, Decl(genericDefaults.ts, 62, 5)) ->(>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50)) ->i03 : Symbol(i03, Decl(genericDefaults.ts, 56, 37)) +>i03c03 : Symbol(i03c03, Decl(genericDefaults.ts, 84, 5)) +>(>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50)) +>i03 : Symbol(i03, Decl(genericDefaults.ts, 78, 37)) >x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) ->a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50)) +>a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50)) const i03c04 = (>x).a; ->i03c04 : Symbol(i03c04, Decl(genericDefaults.ts, 63, 5)) ->(>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50)) ->i03 : Symbol(i03, Decl(genericDefaults.ts, 56, 37)) +>i03c04 : Symbol(i03c04, Decl(genericDefaults.ts, 85, 5)) +>(>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50)) +>i03 : Symbol(i03, Decl(genericDefaults.ts, 78, 37)) >x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) ->a : Symbol(i03.a, Decl(genericDefaults.ts, 58, 50)) +>a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50)) interface Base01 { a: T; } ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 63, 37), Decl(genericDefaults.ts, 68, 13)) ->T : Symbol(T, Decl(genericDefaults.ts, 65, 17)) ->a : Symbol(Base01.a, Decl(genericDefaults.ts, 65, 21)) ->T : Symbol(T, Decl(genericDefaults.ts, 65, 17)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 90, 13)) +>T : Symbol(T, Decl(genericDefaults.ts, 87, 17)) +>a : Symbol(Base01.a, Decl(genericDefaults.ts, 87, 21)) +>T : Symbol(T, Decl(genericDefaults.ts, 87, 17)) interface Base01Constructor { new (a?: T): Base01; } ->Base01Constructor : Symbol(Base01Constructor, Decl(genericDefaults.ts, 65, 29)) ->T : Symbol(T, Decl(genericDefaults.ts, 66, 35)) ->a : Symbol(a, Decl(genericDefaults.ts, 66, 47)) ->T : Symbol(T, Decl(genericDefaults.ts, 66, 35)) ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 63, 37), Decl(genericDefaults.ts, 68, 13)) ->T : Symbol(T, Decl(genericDefaults.ts, 66, 35)) +>Base01Constructor : Symbol(Base01Constructor, Decl(genericDefaults.ts, 87, 29)) +>T : Symbol(T, Decl(genericDefaults.ts, 88, 35)) +>a : Symbol(a, Decl(genericDefaults.ts, 88, 47)) +>T : Symbol(T, Decl(genericDefaults.ts, 88, 35)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 90, 13)) +>T : Symbol(T, Decl(genericDefaults.ts, 88, 35)) declare const Base01: Base01Constructor; ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 63, 37), Decl(genericDefaults.ts, 68, 13)) ->Base01Constructor : Symbol(Base01Constructor, Decl(genericDefaults.ts, 65, 29)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 90, 13)) +>Base01Constructor : Symbol(Base01Constructor, Decl(genericDefaults.ts, 87, 29)) const Base01c00 = new Base01(); ->Base01c00 : Symbol(Base01c00, Decl(genericDefaults.ts, 69, 5)) ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 63, 37), Decl(genericDefaults.ts, 68, 13)) +>Base01c00 : Symbol(Base01c00, Decl(genericDefaults.ts, 91, 5)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 90, 13)) const Base01c01 = new Base01(1); ->Base01c01 : Symbol(Base01c01, Decl(genericDefaults.ts, 70, 5)) ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 63, 37), Decl(genericDefaults.ts, 68, 13)) +>Base01c01 : Symbol(Base01c01, Decl(genericDefaults.ts, 92, 5)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 90, 13)) const Base01c02 = new Base01(); ->Base01c02 : Symbol(Base01c02, Decl(genericDefaults.ts, 71, 5)) ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 63, 37), Decl(genericDefaults.ts, 68, 13)) +>Base01c02 : Symbol(Base01c02, Decl(genericDefaults.ts, 93, 5)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 90, 13)) const Base01c03 = new Base01(1); ->Base01c03 : Symbol(Base01c03, Decl(genericDefaults.ts, 72, 5)) ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 63, 37), Decl(genericDefaults.ts, 68, 13)) +>Base01c03 : Symbol(Base01c03, Decl(genericDefaults.ts, 94, 5)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 90, 13)) declare class Derived01 extends Base01 { } ->Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 72, 40)) ->T : Symbol(T, Decl(genericDefaults.ts, 74, 24)) ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 63, 37), Decl(genericDefaults.ts, 68, 13)) ->T : Symbol(T, Decl(genericDefaults.ts, 74, 24)) +>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 94, 40)) +>T : Symbol(T, Decl(genericDefaults.ts, 96, 24)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 90, 13)) +>T : Symbol(T, Decl(genericDefaults.ts, 96, 24)) const Derived01c00 = new Derived01(); ->Derived01c00 : Symbol(Derived01c00, Decl(genericDefaults.ts, 75, 5)) ->Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 72, 40)) +>Derived01c00 : Symbol(Derived01c00, Decl(genericDefaults.ts, 97, 5)) +>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 94, 40)) const Derived01c01 = new Derived01(1); ->Derived01c01 : Symbol(Derived01c01, Decl(genericDefaults.ts, 76, 5)) ->Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 72, 40)) +>Derived01c01 : Symbol(Derived01c01, Decl(genericDefaults.ts, 98, 5)) +>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 94, 40)) const Derived01c02 = new Derived01(); ->Derived01c02 : Symbol(Derived01c02, Decl(genericDefaults.ts, 77, 5)) ->Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 72, 40)) +>Derived01c02 : Symbol(Derived01c02, Decl(genericDefaults.ts, 99, 5)) +>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 94, 40)) const Derived01c03 = new Derived01(1); ->Derived01c03 : Symbol(Derived01c03, Decl(genericDefaults.ts, 78, 5)) ->Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 72, 40)) +>Derived01c03 : Symbol(Derived01c03, Decl(genericDefaults.ts, 100, 5)) +>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 94, 40)) declare class Derived02 extends Base01 { } ->Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 78, 46)) ->T : Symbol(T, Decl(genericDefaults.ts, 80, 24)) ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 63, 37), Decl(genericDefaults.ts, 68, 13)) ->T : Symbol(T, Decl(genericDefaults.ts, 80, 24)) +>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 100, 46)) +>T : Symbol(T, Decl(genericDefaults.ts, 102, 24)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 90, 13)) +>T : Symbol(T, Decl(genericDefaults.ts, 102, 24)) const Derived02c00 = new Derived02(); ->Derived02c00 : Symbol(Derived02c00, Decl(genericDefaults.ts, 81, 5)) ->Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 78, 46)) +>Derived02c00 : Symbol(Derived02c00, Decl(genericDefaults.ts, 103, 5)) +>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 100, 46)) const Derived02c01 = new Derived02(1); ->Derived02c01 : Symbol(Derived02c01, Decl(genericDefaults.ts, 82, 5)) ->Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 78, 46)) +>Derived02c01 : Symbol(Derived02c01, Decl(genericDefaults.ts, 104, 5)) +>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 100, 46)) const Derived02c02 = new Derived02(); ->Derived02c02 : Symbol(Derived02c02, Decl(genericDefaults.ts, 83, 5)) ->Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 78, 46)) +>Derived02c02 : Symbol(Derived02c02, Decl(genericDefaults.ts, 105, 5)) +>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 100, 46)) const Derived02c03 = new Derived02(1); ->Derived02c03 : Symbol(Derived02c03, Decl(genericDefaults.ts, 84, 5)) ->Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 78, 46)) +>Derived02c03 : Symbol(Derived02c03, Decl(genericDefaults.ts, 106, 5)) +>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 100, 46)) diff --git a/tests/baselines/reference/genericDefaults.types b/tests/baselines/reference/genericDefaults.types index c693d4e4048d0..7f50e03744c04 100644 --- a/tests/baselines/reference/genericDefaults.types +++ b/tests/baselines/reference/genericDefaults.types @@ -242,6 +242,140 @@ const f03c08 = f03(1, 2); >1 : 1 >2 : 2 +declare function f04(a?: T, b?: U): [T, U]; +>f04 : (a?: T, b?: U) => [T, U] +>T : T +>U : U +>T : T +>a : number +>a : T +>T : T +>b : U +>U : U +>T : T +>U : U + +const f04c00 = f04(); +>f04c00 : [{}, {} | { a: number; }] +>f04() : [{}, {} | { a: number; }] +>f04 : (a?: T, b?: U) => [T, U] + +const f04c01 = f04(1); +>f04c01 : [number, number | { a: number; }] +>f04(1) : [number, number | { a: number; }] +>f04 : (a?: T, b?: U) => [T, U] +>1 : 1 + +const f04c02 = f04(1, 1); +>f04c02 : [number, number] +>f04(1, 1) : [number, number] +>f04 : (a?: T, b?: U) => [T, U] +>1 : 1 +>1 : 1 + +const f04c03 = f04(); +>f04c03 : [number, number | { a: number; }] +>f04() : [number, number | { a: number; }] +>f04 : (a?: T, b?: U) => [T, U] + +const f04c04 = f04(1); +>f04c04 : [number, number | { a: number; }] +>f04(1) : [number, number | { a: number; }] +>f04 : (a?: T, b?: U) => [T, U] +>1 : 1 + +const f04c05 = f04(1, 2); +>f04c05 : [number, number] +>f04(1, 2) : [number, number] +>f04 : (a?: T, b?: U) => [T, U] +>1 : 1 +>2 : 2 + +const f04c06 = f04(); +>f04c06 : [number, number] +>f04() : [number, number] +>f04 : (a?: T, b?: U) => [T, U] + +const f04c07 = f04(1); +>f04c07 : [number, number] +>f04(1) : [number, number] +>f04 : (a?: T, b?: U) => [T, U] +>1 : 1 + +const f04c08 = f04(1, 2); +>f04c08 : [number, number] +>f04(1, 2) : [number, number] +>f04 : (a?: T, b?: U) => [T, U] +>1 : 1 +>2 : 2 + +declare function f05(a?: T, b?: U): [T, U]; +>f05 : (a?: T, b?: U) => [T, U] +>T : T +>U : U +>T : T +>a : number +>a : T +>T : T +>b : U +>U : U +>T : T +>U : U + +const f05c00 = f05(); +>f05c00 : [{}, {} & { a: number; }] +>f05() : [{}, {} & { a: number; }] +>f05 : (a?: T, b?: U) => [T, U] + +const f05c01 = f05(1); +>f05c01 : [number, number & { a: number; }] +>f05(1) : [number, number & { a: number; }] +>f05 : (a?: T, b?: U) => [T, U] +>1 : 1 + +const f05c02 = f05(1, 1); +>f05c02 : [number, number] +>f05(1, 1) : [number, number] +>f05 : (a?: T, b?: U) => [T, U] +>1 : 1 +>1 : 1 + +const f05c03 = f05(); +>f05c03 : [number, number & { a: number; }] +>f05() : [number, number & { a: number; }] +>f05 : (a?: T, b?: U) => [T, U] + +const f05c04 = f05(1); +>f05c04 : [number, number & { a: number; }] +>f05(1) : [number, number & { a: number; }] +>f05 : (a?: T, b?: U) => [T, U] +>1 : 1 + +const f05c05 = f05(1, 2); +>f05c05 : [number, number] +>f05(1, 2) : [number, number] +>f05 : (a?: T, b?: U) => [T, U] +>1 : 1 +>2 : 2 + +const f05c06 = f05(); +>f05c06 : [number, number] +>f05() : [number, number] +>f05 : (a?: T, b?: U) => [T, U] + +const f05c07 = f05(1); +>f05c07 : [number, number] +>f05(1) : [number, number] +>f05 : (a?: T, b?: U) => [T, U] +>1 : 1 + +const f05c08 = f05(1, 2); +>f05c08 : [number, number] +>f05(1, 2) : [number, number] +>f05 : (a?: T, b?: U) => [T, U] +>1 : 1 +>2 : 2 + interface i00 { a: T; } >i00 : i00 >T : T diff --git a/tests/baselines/reference/genericDefaultsErrors.errors.txt b/tests/baselines/reference/genericDefaultsErrors.errors.txt index 5e19e25f270e9..aaf1f0b6cf014 100644 --- a/tests/baselines/reference/genericDefaultsErrors.errors.txt +++ b/tests/baselines/reference/genericDefaultsErrors.errors.txt @@ -7,25 +7,33 @@ tests/cases/compiler/genericDefaultsErrors.ts(8,59): error TS2344: Type 'T' does Type 'string' is not assignable to type 'number'. tests/cases/compiler/genericDefaultsErrors.ts(9,44): error TS2344: Type 'T' does not satisfy the constraint 'number'. tests/cases/compiler/genericDefaultsErrors.ts(10,39): error TS2344: Type 'number' does not satisfy the constraint 'T'. -tests/cases/compiler/genericDefaultsErrors.ts(14,1): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/compiler/genericDefaultsErrors.ts(17,1): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/compiler/genericDefaultsErrors.ts(20,11): error TS2428: All declarations of 'i00' must have identical type parameters. -tests/cases/compiler/genericDefaultsErrors.ts(23,11): error TS2428: All declarations of 'i01' must have identical type parameters. -tests/cases/compiler/genericDefaultsErrors.ts(25,19): error TS2706: Type parameter 'T' has a circular default. -tests/cases/compiler/genericDefaultsErrors.ts(26,19): error TS2706: Type parameter 'T' has a circular default. -tests/cases/compiler/genericDefaultsErrors.ts(26,26): error TS2706: Type parameter 'U' has a circular default. -tests/cases/compiler/genericDefaultsErrors.ts(27,22): error TS2705: Required type parameters may not follow optional type parameters -tests/cases/compiler/genericDefaultsErrors.ts(28,34): error TS2344: Type 'number' does not satisfy the constraint 'string'. -tests/cases/compiler/genericDefaultsErrors.ts(29,52): error TS2344: Type 'T' does not satisfy the constraint 'number'. +tests/cases/compiler/genericDefaultsErrors.ts(11,26): error TS2706: Type parameter 'T' has a circular default. +tests/cases/compiler/genericDefaultsErrors.ts(11,33): error TS2706: Type parameter 'U' has a circular default. +tests/cases/compiler/genericDefaultsErrors.ts(12,26): error TS2706: Type parameter 'T' has a circular default. +tests/cases/compiler/genericDefaultsErrors.ts(12,33): error TS2706: Type parameter 'U' has a circular default. +tests/cases/compiler/genericDefaultsErrors.ts(13,26): error TS2706: Type parameter 'T' has a circular default. +tests/cases/compiler/genericDefaultsErrors.ts(13,33): error TS2706: Type parameter 'U' has a circular default. +tests/cases/compiler/genericDefaultsErrors.ts(14,26): error TS2706: Type parameter 'T' has a circular default. +tests/cases/compiler/genericDefaultsErrors.ts(14,33): error TS2706: Type parameter 'U' has a circular default. +tests/cases/compiler/genericDefaultsErrors.ts(18,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/genericDefaultsErrors.ts(21,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/genericDefaultsErrors.ts(24,11): error TS2428: All declarations of 'i00' must have identical type parameters. +tests/cases/compiler/genericDefaultsErrors.ts(27,11): error TS2428: All declarations of 'i01' must have identical type parameters. +tests/cases/compiler/genericDefaultsErrors.ts(29,19): error TS2706: Type parameter 'T' has a circular default. +tests/cases/compiler/genericDefaultsErrors.ts(30,19): error TS2706: Type parameter 'T' has a circular default. +tests/cases/compiler/genericDefaultsErrors.ts(30,26): error TS2706: Type parameter 'U' has a circular default. +tests/cases/compiler/genericDefaultsErrors.ts(31,22): error TS2705: Required type parameters may not follow optional type parameters +tests/cases/compiler/genericDefaultsErrors.ts(32,34): error TS2344: Type 'number' does not satisfy the constraint 'string'. +tests/cases/compiler/genericDefaultsErrors.ts(33,52): error TS2344: Type 'T' does not satisfy the constraint 'number'. Type 'string' is not assignable to type 'number'. -tests/cases/compiler/genericDefaultsErrors.ts(30,37): error TS2344: Type 'T' does not satisfy the constraint 'number'. -tests/cases/compiler/genericDefaultsErrors.ts(31,32): error TS2344: Type 'number' does not satisfy the constraint 'T'. -tests/cases/compiler/genericDefaultsErrors.ts(34,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments -tests/cases/compiler/genericDefaultsErrors.ts(35,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments +tests/cases/compiler/genericDefaultsErrors.ts(34,37): error TS2344: Type 'T' does not satisfy the constraint 'number'. +tests/cases/compiler/genericDefaultsErrors.ts(35,32): error TS2344: Type 'number' does not satisfy the constraint 'T'. tests/cases/compiler/genericDefaultsErrors.ts(38,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments +tests/cases/compiler/genericDefaultsErrors.ts(39,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments +tests/cases/compiler/genericDefaultsErrors.ts(42,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments -==== tests/cases/compiler/genericDefaultsErrors.ts (23 errors) ==== +==== tests/cases/compiler/genericDefaultsErrors.ts (31 errors) ==== declare const x: any; @@ -53,15 +61,35 @@ tests/cases/compiler/genericDefaultsErrors.ts(38,15): error TS2707: Generic type declare function f06(): void; ~~~~~~ !!! error TS2344: Type 'number' does not satisfy the constraint 'T'. + declare function f07(): void; + ~ +!!! error TS2706: Type parameter 'T' has a circular default. + ~~~~~~~~~~~~~~~~~ +!!! error TS2706: Type parameter 'U' has a circular default. + declare function f08(): void; + ~ +!!! error TS2706: Type parameter 'T' has a circular default. + ~~~~~~~~~~~~~~~~~ +!!! error TS2706: Type parameter 'U' has a circular default. + declare function f09(): void; + ~ +!!! error TS2706: Type parameter 'T' has a circular default. + ~~~~~~~~~~~~~~~~~ +!!! error TS2706: Type parameter 'U' has a circular default. + declare function f10(): void; + ~ +!!! error TS2706: Type parameter 'T' has a circular default. + ~~~~~~~~~~~~~~~~~ +!!! error TS2706: Type parameter 'U' has a circular default. - declare function f07(): void; - f07(); // ok - f07<1>(); // error + declare function f11(): void; + f11(); // ok + f11<1>(); // error ~~~~~~~~ !!! error TS2346: Supplied parameters do not match any signature of call target. - f07<1, 2>(); // ok - f07<1, 2, 3>(); // ok - f07<1, 2, 3, 4>(); // error + f11<1, 2>(); // ok + f11<1, 2, 3>(); // ok + f11<1, 2, 3, 4>(); // error ~~~~~~~~~~~~~~~~~ !!! error TS2346: Supplied parameters do not match any signature of call target. diff --git a/tests/baselines/reference/genericDefaultsErrors.js b/tests/baselines/reference/genericDefaultsErrors.js index 9615ad2e36299..6a624fae4d483 100644 --- a/tests/baselines/reference/genericDefaultsErrors.js +++ b/tests/baselines/reference/genericDefaultsErrors.js @@ -9,13 +9,17 @@ declare function f03(): void; declare function f04(): void; declare function f05(): void; declare function f06(): void; +declare function f07(): void; +declare function f08(): void; +declare function f09(): void; +declare function f10(): void; -declare function f07(): void; -f07(); // ok -f07<1>(); // error -f07<1, 2>(); // ok -f07<1, 2, 3>(); // ok -f07<1, 2, 3, 4>(); // error +declare function f11(): void; +f11(); // ok +f11<1>(); // error +f11<1, 2>(); // ok +f11<1, 2, 3>(); // ok +f11<1, 2, 3, 4>(); // error interface i00 { } interface i00 { } @@ -39,11 +43,11 @@ type i09t03 = i09<1, 2, 3>; // ok type i09t04 = i09<1, 2, 3, 4>; // error //// [genericDefaultsErrors.js] -f07(); // ok -f07(); // error -f07(); // ok -f07(); // ok -f07(); // error +f11(); // ok +f11(); // error +f11(); // ok +f11(); // ok +f11(); // error //// [genericDefaultsErrors.d.ts] @@ -55,7 +59,19 @@ declare function f03(): void; declare function f04(): void; declare function f05(): void; declare function f06(): void; -declare function f07(): void; +declare function f07(): void; +declare function f08(): void; +declare function f09(): void; +declare function f10(): void; +declare function f11(): void; interface i00 { } interface i00 { diff --git a/tests/cases/compiler/genericDefaults.ts b/tests/cases/compiler/genericDefaults.ts index 9ab0ede05b6e8..abba8f2d8d673 100644 --- a/tests/cases/compiler/genericDefaults.ts +++ b/tests/cases/compiler/genericDefaults.ts @@ -42,6 +42,28 @@ const f03c06 = f03(); const f03c07 = f03(1); const f03c08 = f03(1, 2); +declare function f04(a?: T, b?: U): [T, U]; +const f04c00 = f04(); +const f04c01 = f04(1); +const f04c02 = f04(1, 1); +const f04c03 = f04(); +const f04c04 = f04(1); +const f04c05 = f04(1, 2); +const f04c06 = f04(); +const f04c07 = f04(1); +const f04c08 = f04(1, 2); + +declare function f05(a?: T, b?: U): [T, U]; +const f05c00 = f05(); +const f05c01 = f05(1); +const f05c02 = f05(1, 1); +const f05c03 = f05(); +const f05c04 = f05(1); +const f05c05 = f05(1, 2); +const f05c06 = f05(); +const f05c07 = f05(1); +const f05c08 = f05(1, 2); + interface i00 { a: T; } const i00c00 = (x).a; const i00c01 = (>x).a; diff --git a/tests/cases/compiler/genericDefaultsErrors.ts b/tests/cases/compiler/genericDefaultsErrors.ts index 470b4998e926e..e7fb7be81aeed 100644 --- a/tests/cases/compiler/genericDefaultsErrors.ts +++ b/tests/cases/compiler/genericDefaultsErrors.ts @@ -9,13 +9,17 @@ declare function f03(): void; declare function f04(): void; declare function f05(): void; declare function f06(): void; +declare function f07(): void; +declare function f08(): void; +declare function f09(): void; +declare function f10(): void; -declare function f07(): void; -f07(); // ok -f07<1>(); // error -f07<1, 2>(); // ok -f07<1, 2, 3>(); // ok -f07<1, 2, 3, 4>(); // error +declare function f11(): void; +f11(); // ok +f11<1>(); // error +f11<1, 2>(); // ok +f11<1, 2, 3>(); // ok +f11<1, 2, 3, 4>(); // error interface i00 { } interface i00 { } From 0b44a2c74c7e4f3e93a706712a4bf81f9cc0a9c0 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 19 Jan 2017 12:38:56 -0800 Subject: [PATCH 05/18] Flexible declaration merging --- src/compiler/checker.ts | 140 +++++++++++++----- src/compiler/utilities.ts | 14 ++ tests/baselines/reference/genericDefaults.js | 13 ++ .../reference/genericDefaults.symbols | 104 +++++++------ .../baselines/reference/genericDefaults.types | 16 ++ .../genericDefaultsErrors.errors.txt | 22 +-- .../reference/genericDefaultsErrors.js | 24 +-- tests/cases/compiler/genericDefaults.ts | 5 + tests/cases/compiler/genericDefaultsErrors.ts | 22 +-- 9 files changed, 244 insertions(+), 116 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5da6244b552cb..74361a2403ba8 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -18403,16 +18403,110 @@ namespace ts { if (symbol.declarations.length === 1) { return; } - let firstDecl: ClassLikeDeclaration | InterfaceDeclaration; - for (const declaration of symbol.declarations) { - if (declaration.kind === SyntaxKind.ClassDeclaration || declaration.kind === SyntaxKind.InterfaceDeclaration) { - if (!firstDecl) { - firstDecl = declaration; - } - else if (!areTypeParametersIdentical(firstDecl.typeParameters, node.typeParameters)) { - error(node.name, Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, node.name.text); + + // Resolve the type parameters and minimum type argument count for all declarations + resolveTypeParametersOfClassOrInterface(symbol); + + const { typeParameters, minTypeArgumentCount } = getSymbolLinks(symbol); + const maxTypeArgumentCount = typeParameters ? typeParameters.length : 0; + const numTypeParameters = node.typeParameters ? node.typeParameters.length : 0; + + // If this declaration has too few or too many type parameters, we report an error + if (numTypeParameters < minTypeArgumentCount || numTypeParameters > maxTypeArgumentCount) { + error(node.name, Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, node.name.text); + return; + } + + for (let i = 0; i < numTypeParameters; i++) { + const source = node.typeParameters[i]; + const target = typeParameters[i]; + + // If the type parameter node does not have the same name as the resolved type + // parameter at this position, we report an error. + if (source.name.text !== target.symbol.name) { + error(node.name, Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, node.name.text); + return; + } + + // If the type parameter node does not have an identical constraint as the resolved + // type parameter at this position, we report an error. + const sourceConstraint = source.constraint && getTypeFromTypeNode(source.constraint); + const targetConstraint = getConstraintFromTypeParameter(target); + if ((sourceConstraint || targetConstraint) && + (!sourceConstraint || !targetConstraint || !isTypeIdenticalTo(sourceConstraint, targetConstraint))) { + error(node.name, Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, node.name.text); + return; + } + + // If the type parameter node has a default and it is not identical to the default + // for the type parameter at this position, we report an error. + const sourceDefault = source.default && getTypeFromTypeNode(source.default); + const targetDefault = getDefaultFromTypeParameter(target); + if (sourceDefault && targetDefault && !isTypeIdenticalTo(sourceDefault, targetDefault)) { + error(node.name, Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, node.name.text); + return; + } + } + } + + function resolveTypeParametersOfClassOrInterface(symbol: Symbol) { + const links = getSymbolLinks(symbol); + if (!links.typeParameters) { + let typeParameters: TypeParameter[] | undefined; + let minTypeArgumentCount = -1; + let maxTypeArgumentCount = -1; + for (const declaration of symbol.declarations) { + if (declaration.kind === SyntaxKind.ClassDeclaration || declaration.kind === SyntaxKind.InterfaceDeclaration) { + const typeParameterNodes = (declaration).typeParameters; + const numTypeParameters = typeParameterNodes ? typeParameterNodes.length : 0; + if (maxTypeArgumentCount === -1) { + // For the first declaration, establish the initial maximum and + // minimum type argument counts. These only change when we + // encounter default type arguments. + maxTypeArgumentCount = numTypeParameters; + minTypeArgumentCount = numTypeParameters; + } + + if (typeParameterNodes) { + if (!typeParameters) { + typeParameters = []; + } + + for (let i = 0; i < typeParameterNodes.length; i++) { + if (typeParameterNodes[i].default) { + // When we encounter a type parameter with a default, establish + // new minimum and maximum type arguments if necessary. + if (minTypeArgumentCount > i) { + minTypeArgumentCount = i; + } + if (maxTypeArgumentCount < i + 1) { + maxTypeArgumentCount = i + 1; + } + } + if (typeParameters.length <= i) { + // When we encounter a new type parameter at this position, + // get the declared type for the type parameter. If another + // declaration attempts to establish a type parameter with a + // different name or constraint than the first one we find, + // we will report an error when checking the type parameters. + typeParameters[i] = getDeclaredTypeOfTypeParameter(getSymbolOfNode(typeParameterNodes[i])); + } + } + } } } + if (maxTypeArgumentCount === -1) { + maxTypeArgumentCount = 0; + } + if (minTypeArgumentCount === -1) { + minTypeArgumentCount = maxTypeArgumentCount; + } + if (typeParameters && typeParameters.length > maxTypeArgumentCount) { + // Trim the type parameters to the maximum length + typeParameters.length = maxTypeArgumentCount; + } + links.typeParameters = typeParameters || emptyArray; + links.minTypeArgumentCount = minTypeArgumentCount; } } @@ -18654,36 +18748,6 @@ namespace ts { return kind === SyntaxKind.GetAccessor || kind === SyntaxKind.SetAccessor; } - function areTypeParametersIdentical(list1: TypeParameterDeclaration[], list2: TypeParameterDeclaration[]) { - if (!list1 && !list2) { - return true; - } - if (!list1 || !list2 || list1.length !== list2.length) { - return false; - } - // TypeScript 1.0 spec (April 2014): - // When a generic interface has multiple declarations, all declarations must have identical type parameter - // lists, i.e. identical type parameter names with identical constraints in identical order. - for (let i = 0; i < list1.length; i++) { - const tp1 = list1[i]; - const tp2 = list2[i]; - if (tp1.name.text !== tp2.name.text) { - return false; - } - if (tp1.constraint || tp2.constraint) { - if (!tp1.constraint || !tp2.constraint || !isTypeIdenticalTo(getTypeFromTypeNode(tp1.constraint), getTypeFromTypeNode(tp2.constraint))) { - return false; - } - } - if (tp1.default || tp2.default) { - if (!tp1.default || !tp2.default || !isTypeIdenticalTo(getTypeFromTypeNode(tp1.default), getTypeFromTypeNode(tp2.default))) { - return false; - } - } - } - return true; - } - function checkInheritedPropertiesAreIdentical(type: InterfaceType, typeNode: Node): boolean { const baseTypes = getBaseTypes(type); if (baseTypes.length < 2) { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 192ef888b11e9..ae6e1d351d835 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -24,6 +24,20 @@ namespace ts { return undefined; } + export function findDeclaration(symbol: Symbol, predicate: (node: Declaration) => node is T): T | undefined; + export function findDeclaration(symbol: Symbol, predicate: (node: Declaration) => boolean): Declaration | undefined; + export function findDeclaration(symbol: Symbol, predicate: (node: Declaration) => boolean): Declaration | undefined { + const declarations = symbol.declarations; + if (declarations) { + for (const declaration of declarations) { + if (predicate(declaration)) { + return declaration; + } + } + } + return undefined; + } + export interface StringSymbolWriter extends SymbolWriter { string(): string; } diff --git a/tests/baselines/reference/genericDefaults.js b/tests/baselines/reference/genericDefaults.js index c61a42c965101..a2271681e1327 100644 --- a/tests/baselines/reference/genericDefaults.js +++ b/tests/baselines/reference/genericDefaults.js @@ -86,6 +86,11 @@ const i03c02 = (>x).a; const i03c03 = (>x).a; const i03c04 = (>x).a; +interface i04 {} +interface i04 {} +interface i04 {} +interface i04 {} + interface Base01 { a: T; } interface Base01Constructor { new (a?: T): Base01; } @@ -293,6 +298,14 @@ declare const i03c01: [1, 1]; declare const i03c02: [number, number]; declare const i03c03: [1, 1]; declare const i03c04: [number, 1]; +interface i04 { +} +interface i04 { +} +interface i04 { +} +interface i04 { +} interface Base01 { a: T; } diff --git a/tests/baselines/reference/genericDefaults.symbols b/tests/baselines/reference/genericDefaults.symbols index a43b6fa9f4363..67b61a0a252f5 100644 --- a/tests/baselines/reference/genericDefaults.symbols +++ b/tests/baselines/reference/genericDefaults.symbols @@ -408,81 +408,97 @@ const i03c04 = (>x).a; >x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) >a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50)) +interface i04 {} +>i04 : Symbol(i04, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 87, 16), Decl(genericDefaults.ts, 88, 19), Decl(genericDefaults.ts, 89, 28)) + +interface i04 {} +>i04 : Symbol(i04, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 87, 16), Decl(genericDefaults.ts, 88, 19), Decl(genericDefaults.ts, 89, 28)) +>T : Symbol(T, Decl(genericDefaults.ts, 88, 14), Decl(genericDefaults.ts, 89, 14), Decl(genericDefaults.ts, 90, 14)) + +interface i04 {} +>i04 : Symbol(i04, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 87, 16), Decl(genericDefaults.ts, 88, 19), Decl(genericDefaults.ts, 89, 28)) +>T : Symbol(T, Decl(genericDefaults.ts, 88, 14), Decl(genericDefaults.ts, 89, 14), Decl(genericDefaults.ts, 90, 14)) + +interface i04 {} +>i04 : Symbol(i04, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 87, 16), Decl(genericDefaults.ts, 88, 19), Decl(genericDefaults.ts, 89, 28)) +>T : Symbol(T, Decl(genericDefaults.ts, 88, 14), Decl(genericDefaults.ts, 89, 14), Decl(genericDefaults.ts, 90, 14)) +>U : Symbol(U, Decl(genericDefaults.ts, 90, 25)) + interface Base01 { a: T; } ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 90, 13)) ->T : Symbol(T, Decl(genericDefaults.ts, 87, 17)) ->a : Symbol(Base01.a, Decl(genericDefaults.ts, 87, 21)) ->T : Symbol(T, Decl(genericDefaults.ts, 87, 17)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 90, 40), Decl(genericDefaults.ts, 95, 13)) +>T : Symbol(T, Decl(genericDefaults.ts, 92, 17)) +>a : Symbol(Base01.a, Decl(genericDefaults.ts, 92, 21)) +>T : Symbol(T, Decl(genericDefaults.ts, 92, 17)) interface Base01Constructor { new (a?: T): Base01; } ->Base01Constructor : Symbol(Base01Constructor, Decl(genericDefaults.ts, 87, 29)) ->T : Symbol(T, Decl(genericDefaults.ts, 88, 35)) ->a : Symbol(a, Decl(genericDefaults.ts, 88, 47)) ->T : Symbol(T, Decl(genericDefaults.ts, 88, 35)) ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 90, 13)) ->T : Symbol(T, Decl(genericDefaults.ts, 88, 35)) +>Base01Constructor : Symbol(Base01Constructor, Decl(genericDefaults.ts, 92, 29)) +>T : Symbol(T, Decl(genericDefaults.ts, 93, 35)) +>a : Symbol(a, Decl(genericDefaults.ts, 93, 47)) +>T : Symbol(T, Decl(genericDefaults.ts, 93, 35)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 90, 40), Decl(genericDefaults.ts, 95, 13)) +>T : Symbol(T, Decl(genericDefaults.ts, 93, 35)) declare const Base01: Base01Constructor; ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 90, 13)) ->Base01Constructor : Symbol(Base01Constructor, Decl(genericDefaults.ts, 87, 29)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 90, 40), Decl(genericDefaults.ts, 95, 13)) +>Base01Constructor : Symbol(Base01Constructor, Decl(genericDefaults.ts, 92, 29)) const Base01c00 = new Base01(); ->Base01c00 : Symbol(Base01c00, Decl(genericDefaults.ts, 91, 5)) ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 90, 13)) +>Base01c00 : Symbol(Base01c00, Decl(genericDefaults.ts, 96, 5)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 90, 40), Decl(genericDefaults.ts, 95, 13)) const Base01c01 = new Base01(1); ->Base01c01 : Symbol(Base01c01, Decl(genericDefaults.ts, 92, 5)) ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 90, 13)) +>Base01c01 : Symbol(Base01c01, Decl(genericDefaults.ts, 97, 5)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 90, 40), Decl(genericDefaults.ts, 95, 13)) const Base01c02 = new Base01(); ->Base01c02 : Symbol(Base01c02, Decl(genericDefaults.ts, 93, 5)) ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 90, 13)) +>Base01c02 : Symbol(Base01c02, Decl(genericDefaults.ts, 98, 5)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 90, 40), Decl(genericDefaults.ts, 95, 13)) const Base01c03 = new Base01(1); ->Base01c03 : Symbol(Base01c03, Decl(genericDefaults.ts, 94, 5)) ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 90, 13)) +>Base01c03 : Symbol(Base01c03, Decl(genericDefaults.ts, 99, 5)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 90, 40), Decl(genericDefaults.ts, 95, 13)) declare class Derived01 extends Base01 { } ->Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 94, 40)) ->T : Symbol(T, Decl(genericDefaults.ts, 96, 24)) ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 90, 13)) ->T : Symbol(T, Decl(genericDefaults.ts, 96, 24)) +>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 99, 40)) +>T : Symbol(T, Decl(genericDefaults.ts, 101, 24)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 90, 40), Decl(genericDefaults.ts, 95, 13)) +>T : Symbol(T, Decl(genericDefaults.ts, 101, 24)) const Derived01c00 = new Derived01(); ->Derived01c00 : Symbol(Derived01c00, Decl(genericDefaults.ts, 97, 5)) ->Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 94, 40)) +>Derived01c00 : Symbol(Derived01c00, Decl(genericDefaults.ts, 102, 5)) +>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 99, 40)) const Derived01c01 = new Derived01(1); ->Derived01c01 : Symbol(Derived01c01, Decl(genericDefaults.ts, 98, 5)) ->Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 94, 40)) +>Derived01c01 : Symbol(Derived01c01, Decl(genericDefaults.ts, 103, 5)) +>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 99, 40)) const Derived01c02 = new Derived01(); ->Derived01c02 : Symbol(Derived01c02, Decl(genericDefaults.ts, 99, 5)) ->Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 94, 40)) +>Derived01c02 : Symbol(Derived01c02, Decl(genericDefaults.ts, 104, 5)) +>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 99, 40)) const Derived01c03 = new Derived01(1); ->Derived01c03 : Symbol(Derived01c03, Decl(genericDefaults.ts, 100, 5)) ->Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 94, 40)) +>Derived01c03 : Symbol(Derived01c03, Decl(genericDefaults.ts, 105, 5)) +>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 99, 40)) declare class Derived02 extends Base01 { } ->Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 100, 46)) ->T : Symbol(T, Decl(genericDefaults.ts, 102, 24)) ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 90, 13)) ->T : Symbol(T, Decl(genericDefaults.ts, 102, 24)) +>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 105, 46)) +>T : Symbol(T, Decl(genericDefaults.ts, 107, 24)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 90, 40), Decl(genericDefaults.ts, 95, 13)) +>T : Symbol(T, Decl(genericDefaults.ts, 107, 24)) const Derived02c00 = new Derived02(); ->Derived02c00 : Symbol(Derived02c00, Decl(genericDefaults.ts, 103, 5)) ->Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 100, 46)) +>Derived02c00 : Symbol(Derived02c00, Decl(genericDefaults.ts, 108, 5)) +>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 105, 46)) const Derived02c01 = new Derived02(1); ->Derived02c01 : Symbol(Derived02c01, Decl(genericDefaults.ts, 104, 5)) ->Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 100, 46)) +>Derived02c01 : Symbol(Derived02c01, Decl(genericDefaults.ts, 109, 5)) +>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 105, 46)) const Derived02c02 = new Derived02(); ->Derived02c02 : Symbol(Derived02c02, Decl(genericDefaults.ts, 105, 5)) ->Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 100, 46)) +>Derived02c02 : Symbol(Derived02c02, Decl(genericDefaults.ts, 110, 5)) +>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 105, 46)) const Derived02c03 = new Derived02(1); ->Derived02c03 : Symbol(Derived02c03, Decl(genericDefaults.ts, 106, 5)) ->Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 100, 46)) +>Derived02c03 : Symbol(Derived02c03, Decl(genericDefaults.ts, 111, 5)) +>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 105, 46)) diff --git a/tests/baselines/reference/genericDefaults.types b/tests/baselines/reference/genericDefaults.types index 7f50e03744c04..70f67497f21fe 100644 --- a/tests/baselines/reference/genericDefaults.types +++ b/tests/baselines/reference/genericDefaults.types @@ -536,6 +536,22 @@ const i03c04 = (>x).a; >x : any >a : [number, 1] +interface i04 {} +>i04 : i04 + +interface i04 {} +>i04 : i04 +>T : T + +interface i04 {} +>i04 : i04 +>T : T + +interface i04 {} +>i04 : i04 +>T : T +>U : U + interface Base01 { a: T; } >Base01 : Base01 >T : T diff --git a/tests/baselines/reference/genericDefaultsErrors.errors.txt b/tests/baselines/reference/genericDefaultsErrors.errors.txt index aaf1f0b6cf014..a75a17448798d 100644 --- a/tests/baselines/reference/genericDefaultsErrors.errors.txt +++ b/tests/baselines/reference/genericDefaultsErrors.errors.txt @@ -93,38 +93,38 @@ tests/cases/compiler/genericDefaultsErrors.ts(42,15): error TS2707: Generic type ~~~~~~~~~~~~~~~~~ !!! error TS2346: Supplied parameters do not match any signature of call target. - interface i00 { } - interface i00 { } + interface i00 { } // ok + interface i00 { } // error ~~~ !!! error TS2428: All declarations of 'i00' must have identical type parameters. - interface i01 { } - interface i01 { } + interface i01 { } // ok + interface i01 { } // error ~~~ !!! error TS2428: All declarations of 'i01' must have identical type parameters. - interface i02 { } + interface i02 { } // error ~ !!! error TS2706: Type parameter 'T' has a circular default. - interface i03 { } + interface i03 { } // error ~ !!! error TS2706: Type parameter 'T' has a circular default. ~ !!! error TS2706: Type parameter 'U' has a circular default. - interface i04 { } + interface i04 { } // error ~ !!! error TS2705: Required type parameters may not follow optional type parameters - interface i05 { } + interface i05 { } // error ~~~~~~ !!! error TS2344: Type 'number' does not satisfy the constraint 'string'. - interface i06 { } + interface i06 { } // error ~ !!! error TS2344: Type 'T' does not satisfy the constraint 'number'. !!! error TS2344: Type 'string' is not assignable to type 'number'. - interface i07 { } + interface i07 { } // error ~ !!! error TS2344: Type 'T' does not satisfy the constraint 'number'. - interface i08 { } + interface i08 { } // error ~~~~~~ !!! error TS2344: Type 'number' does not satisfy the constraint 'T'. diff --git a/tests/baselines/reference/genericDefaultsErrors.js b/tests/baselines/reference/genericDefaultsErrors.js index 6a624fae4d483..dc0670d5272ae 100644 --- a/tests/baselines/reference/genericDefaultsErrors.js +++ b/tests/baselines/reference/genericDefaultsErrors.js @@ -21,19 +21,19 @@ f11<1, 2>(); // ok f11<1, 2, 3>(); // ok f11<1, 2, 3, 4>(); // error -interface i00 { } -interface i00 { } +interface i00 { } // ok +interface i00 { } // error -interface i01 { } -interface i01 { } +interface i01 { } // ok +interface i01 { } // error -interface i02 { } -interface i03 { } -interface i04 { } -interface i05 { } -interface i06 { } -interface i07 { } -interface i08 { } +interface i02 { } // error +interface i03 { } // error +interface i04 { } // error +interface i05 { } // error +interface i06 { } // error +interface i07 { } // error +interface i08 { } // error interface i09 { } type i09t00 = i09; // error @@ -74,7 +74,7 @@ declare function f10(): void; interface i00 { } -interface i00 { +interface i00 { } interface i01 { } diff --git a/tests/cases/compiler/genericDefaults.ts b/tests/cases/compiler/genericDefaults.ts index abba8f2d8d673..10dbcf1025ec9 100644 --- a/tests/cases/compiler/genericDefaults.ts +++ b/tests/cases/compiler/genericDefaults.ts @@ -86,6 +86,11 @@ const i03c02 = (>x).a; const i03c03 = (>x).a; const i03c04 = (>x).a; +interface i04 {} +interface i04 {} +interface i04 {} +interface i04 {} + interface Base01 { a: T; } interface Base01Constructor { new (a?: T): Base01; } diff --git a/tests/cases/compiler/genericDefaultsErrors.ts b/tests/cases/compiler/genericDefaultsErrors.ts index e7fb7be81aeed..985300f66078e 100644 --- a/tests/cases/compiler/genericDefaultsErrors.ts +++ b/tests/cases/compiler/genericDefaultsErrors.ts @@ -21,19 +21,19 @@ f11<1, 2>(); // ok f11<1, 2, 3>(); // ok f11<1, 2, 3, 4>(); // error -interface i00 { } -interface i00 { } +interface i00 { } // ok +interface i00 { } // error -interface i01 { } -interface i01 { } +interface i01 { } // ok +interface i01 { } // error -interface i02 { } -interface i03 { } -interface i04 { } -interface i05 { } -interface i06 { } -interface i07 { } -interface i08 { } +interface i02 { } // error +interface i03 { } // error +interface i04 { } // error +interface i05 { } // error +interface i06 { } // error +interface i07 { } // error +interface i08 { } // error interface i09 { } type i09t00 = i09; // error From 0500065e8b9a32d61dabe8c2c9e92873c364471b Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 20 Jan 2017 12:56:08 -0800 Subject: [PATCH 06/18] Avoid inference for fully-supplied type arguments --- src/compiler/checker.ts | 32 +++++++++++++++++++------------- src/compiler/types.ts | 1 + 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 74361a2403ba8..4d1f0ad315b52 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -9155,8 +9155,15 @@ namespace ts { return constraint && maybeTypeOfKind(constraint, TypeFlags.Primitive | TypeFlags.Index); } + function getSuppliedType(context: InferenceContext, index: number): Type | undefined { + if (context.suppliedTypes && index < context.suppliedTypes.length) { + return context.inferredTypes[index] = context.suppliedTypes[index]; + } + return undefined; + } + function getInferredType(context: InferenceContext, index: number): Type { - let inferredType = context.inferredTypes[index]; + let inferredType = context.inferredTypes[index] || getSuppliedType(context, index); let inferenceSucceeded: boolean; if (!inferredType) { const inferences = getInferenceCandidates(context, index); @@ -13410,6 +13417,7 @@ namespace ts { } } + const numTypeArguments = typeArguments ? typeArguments.length : 0; const candidates = candidatesOutArray || []; // reorderCandidates fills up the candidates array directly reorderCandidates(signatures, candidates); @@ -13580,28 +13588,26 @@ namespace ts { ? createInferenceContext(originalCandidate, /*inferUnionTypes*/ false) : undefined; - // fix each supplied type argument in the inference context - if (typeArguments) { - for (let i = 0; i < typeArguments.length; i++) { - inferenceContext.inferredTypes[i] = getTypeFromTypeNode(typeArguments[i]); - inferenceContext.inferences[i].isFixed = true; - } - } - while (true) { candidate = originalCandidate; if (candidate.typeParameters) { - // Check any supplied type arguments against the candidate. - typeArgumentsAreValid = !typeArguments || checkTypeArguments(candidate, typeArguments, inferenceContext.inferredTypes, /*reportErrors*/ false); - if (typeArgumentsAreValid) { + let typeArgumentTypes: Type[] | undefined; + if (typeArguments) { + // Check any supplied type arguments against the candidate. + typeArgumentTypes = map(typeArguments, getTypeFromTypeNode) + typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, /*reportErrors*/ false); + } + if ((!typeArguments || typeArgumentsAreValid) && numTypeArguments < candidate.typeParameters.length) { // Infer any unsupplied type arguments for the candidate. + inferenceContext.suppliedTypes = typeArgumentTypes; inferTypeArguments(node, candidate, args, excludeArgument, inferenceContext); typeArgumentsAreValid = inferenceContext.failedTypeParameterIndex === undefined; + typeArgumentTypes = inferenceContext.inferredTypes; } if (!typeArgumentsAreValid) { break; } - candidate = getSignatureInstantiation(candidate, inferenceContext.inferredTypes); + candidate = getSignatureInstantiation(candidate, typeArgumentTypes); } if (!checkApplicableSignature(node, args, candidate, relation, excludeArgument, /*reportErrors*/ false)) { break; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 30a054d481ed9..5a1078ec8efc3 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3095,6 +3095,7 @@ namespace ts { inferUnionTypes: boolean; // Infer union types for disjoint candidates (otherwise undefinedType) inferences: TypeInferences[]; // Inferences made for each type parameter inferredTypes: Type[]; // Inferred type for each type parameter + suppliedTypes?: Type[]; // Supplied types for non-default type parameters mapper?: TypeMapper; // Type mapper for this inference context failedTypeParameterIndex?: number; // Index of type parameter for which inference failed // It is optional because in contextual signature instantiation, nothing fails From 5ff0f8182769be3b9b6b3425db29fe48042cc5ef Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 20 Jan 2017 15:27:02 -0800 Subject: [PATCH 07/18] Diagnostic message punctuation --- src/compiler/diagnosticMessages.json | 4 ++-- .../genericDefaultsErrors.errors.txt | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 0d8479eea9607..062663f3ba84a 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -2035,7 +2035,7 @@ "category": "Error", "code": 2704 }, - "Required type parameters may not follow optional type parameters": { + "Required type parameters may not follow optional type parameters.": { "category": "Error", "code": 2705 }, @@ -2043,7 +2043,7 @@ "category": "Error", "code": 2706 }, - "Generic type '{0}' requires between {1} and {2} type arguments": { + "Generic type '{0}' requires between {1} and {2} type arguments.": { "category": "Error", "code": 2707 }, diff --git a/tests/baselines/reference/genericDefaultsErrors.errors.txt b/tests/baselines/reference/genericDefaultsErrors.errors.txt index a75a17448798d..a21fcec11424d 100644 --- a/tests/baselines/reference/genericDefaultsErrors.errors.txt +++ b/tests/baselines/reference/genericDefaultsErrors.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/genericDefaultsErrors.ts(4,26): error TS2706: Type parameter 'T' has a circular default. tests/cases/compiler/genericDefaultsErrors.ts(5,26): error TS2706: Type parameter 'T' has a circular default. tests/cases/compiler/genericDefaultsErrors.ts(5,33): error TS2706: Type parameter 'U' has a circular default. -tests/cases/compiler/genericDefaultsErrors.ts(6,29): error TS2705: Required type parameters may not follow optional type parameters +tests/cases/compiler/genericDefaultsErrors.ts(6,29): error TS2705: Required type parameters may not follow optional type parameters. tests/cases/compiler/genericDefaultsErrors.ts(7,41): error TS2344: Type 'number' does not satisfy the constraint 'string'. tests/cases/compiler/genericDefaultsErrors.ts(8,59): error TS2344: Type 'T' does not satisfy the constraint 'number'. Type 'string' is not assignable to type 'number'. @@ -22,15 +22,15 @@ tests/cases/compiler/genericDefaultsErrors.ts(27,11): error TS2428: All declarat tests/cases/compiler/genericDefaultsErrors.ts(29,19): error TS2706: Type parameter 'T' has a circular default. tests/cases/compiler/genericDefaultsErrors.ts(30,19): error TS2706: Type parameter 'T' has a circular default. tests/cases/compiler/genericDefaultsErrors.ts(30,26): error TS2706: Type parameter 'U' has a circular default. -tests/cases/compiler/genericDefaultsErrors.ts(31,22): error TS2705: Required type parameters may not follow optional type parameters +tests/cases/compiler/genericDefaultsErrors.ts(31,22): error TS2705: Required type parameters may not follow optional type parameters. tests/cases/compiler/genericDefaultsErrors.ts(32,34): error TS2344: Type 'number' does not satisfy the constraint 'string'. tests/cases/compiler/genericDefaultsErrors.ts(33,52): error TS2344: Type 'T' does not satisfy the constraint 'number'. Type 'string' is not assignable to type 'number'. tests/cases/compiler/genericDefaultsErrors.ts(34,37): error TS2344: Type 'T' does not satisfy the constraint 'number'. tests/cases/compiler/genericDefaultsErrors.ts(35,32): error TS2344: Type 'number' does not satisfy the constraint 'T'. -tests/cases/compiler/genericDefaultsErrors.ts(38,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments -tests/cases/compiler/genericDefaultsErrors.ts(39,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments -tests/cases/compiler/genericDefaultsErrors.ts(42,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments +tests/cases/compiler/genericDefaultsErrors.ts(38,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. +tests/cases/compiler/genericDefaultsErrors.ts(39,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. +tests/cases/compiler/genericDefaultsErrors.ts(42,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. ==== tests/cases/compiler/genericDefaultsErrors.ts (31 errors) ==== @@ -47,7 +47,7 @@ tests/cases/compiler/genericDefaultsErrors.ts(42,15): error TS2707: Generic type !!! error TS2706: Type parameter 'U' has a circular default. declare function f02(); ~ -!!! error TS2705: Required type parameters may not follow optional type parameters +!!! error TS2705: Required type parameters may not follow optional type parameters. declare function f03(): void; ~~~~~~ !!! error TS2344: Type 'number' does not satisfy the constraint 'string'. @@ -113,7 +113,7 @@ tests/cases/compiler/genericDefaultsErrors.ts(42,15): error TS2707: Generic type !!! error TS2706: Type parameter 'U' has a circular default. interface i04 { } // error ~ -!!! error TS2705: Required type parameters may not follow optional type parameters +!!! error TS2705: Required type parameters may not follow optional type parameters. interface i05 { } // error ~~~~~~ !!! error TS2344: Type 'number' does not satisfy the constraint 'string'. @@ -131,12 +131,12 @@ tests/cases/compiler/genericDefaultsErrors.ts(42,15): error TS2707: Generic type interface i09 { } type i09t00 = i09; // error ~~~ -!!! error TS2707: Generic type 'i09' requires between 2 and 3 type arguments +!!! error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. type i09t01 = i09<1>; // error ~~~~~~ -!!! error TS2707: Generic type 'i09' requires between 2 and 3 type arguments +!!! error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. type i09t02 = i09<1, 2>; // ok type i09t03 = i09<1, 2, 3>; // ok type i09t04 = i09<1, 2, 3, 4>; // error ~~~~~~~~~~~~~~~ -!!! error TS2707: Generic type 'i09' requires between 2 and 3 type arguments \ No newline at end of file +!!! error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. \ No newline at end of file From a2be5e263a6d9c0095cec6f2b710588b6b4461bc Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 20 Jan 2017 17:58:28 -0800 Subject: [PATCH 08/18] Report error using type parameter from merged declaration --- src/compiler/checker.ts | 18 ++++++++++++++++++ src/compiler/diagnosticMessages.json | 4 ++++ .../reference/genericDefaultsErrors.errors.txt | 10 ++++++++-- .../reference/genericDefaultsErrors.js | 10 +++++++++- tests/cases/compiler/genericDefaultsErrors.ts | 5 ++++- 5 files changed, 43 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 4d1f0ad315b52..46e6dcb113808 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -17594,6 +17594,11 @@ namespace ts { error(node.name, Diagnostics.All_declarations_of_0_must_have_identical_modifiers, declarationNameToString(node.name)); } } + if (type.flags & TypeFlags.TypeParameter && !(type).isThisType && type.symbol) { + if (!isTypeParameterInScope(type, node)) { + error(node.name, Diagnostics.Type_parameter_0_cannot_be_referenced_outside_of_a_declaration_that_defines_it, symbolToString(type.symbol)); + } + } if (node.kind !== SyntaxKind.PropertyDeclaration && node.kind !== SyntaxKind.PropertySignature) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); @@ -17608,6 +17613,19 @@ namespace ts { } } + function isTypeParameterInScope(typeParameter: TypeParameter, node: Node) { + const parents = map(filter(typeParameter.symbol.declarations, isTypeParameter), node => node.parent); + while (node) { + if (isFunctionLike(node) || isClassLike(node) || node.kind === SyntaxKind.InterfaceDeclaration || node.kind === SyntaxKind.TypeAliasDeclaration) { + if (contains(parents, node)) { + return true; + } + } + node = node.parent; + } + return false; + } + function areDeclarationFlagsIdentical(left: Declaration, right: Declaration) { if ((left.kind === SyntaxKind.Parameter && right.kind === SyntaxKind.VariableDeclaration) || (left.kind === SyntaxKind.VariableDeclaration && right.kind === SyntaxKind.Parameter)) { diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 062663f3ba84a..ca4162804d061 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1127,6 +1127,10 @@ "category": "Error", "code": 2366 }, + "Type parameter '{0}' cannot be referenced outside of a declaration that defines it.": { + "category": "Error", + "code": 2367 + }, "Type parameter name cannot be '{0}'": { "category": "Error", "code": 2368 diff --git a/tests/baselines/reference/genericDefaultsErrors.errors.txt b/tests/baselines/reference/genericDefaultsErrors.errors.txt index a21fcec11424d..ab2eb71e0ea7e 100644 --- a/tests/baselines/reference/genericDefaultsErrors.errors.txt +++ b/tests/baselines/reference/genericDefaultsErrors.errors.txt @@ -31,9 +31,10 @@ tests/cases/compiler/genericDefaultsErrors.ts(35,32): error TS2344: Type 'number tests/cases/compiler/genericDefaultsErrors.ts(38,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. tests/cases/compiler/genericDefaultsErrors.ts(39,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. tests/cases/compiler/genericDefaultsErrors.ts(42,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. +tests/cases/compiler/genericDefaultsErrors.ts(44,17): error TS2367: Type parameter 'T' cannot be referenced outside of a declaration that defines it. -==== tests/cases/compiler/genericDefaultsErrors.ts (31 errors) ==== +==== tests/cases/compiler/genericDefaultsErrors.ts (32 errors) ==== declare const x: any; @@ -139,4 +140,9 @@ tests/cases/compiler/genericDefaultsErrors.ts(42,15): error TS2707: Generic type type i09t03 = i09<1, 2, 3>; // ok type i09t04 = i09<1, 2, 3, 4>; // error ~~~~~~~~~~~~~~~ -!!! error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. \ No newline at end of file +!!! error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. + + interface i10 { x: T; } // error + ~ +!!! error TS2367: Type parameter 'T' cannot be referenced outside of a declaration that defines it. + interface i10 {} \ No newline at end of file diff --git a/tests/baselines/reference/genericDefaultsErrors.js b/tests/baselines/reference/genericDefaultsErrors.js index dc0670d5272ae..12bac1a8ff4ac 100644 --- a/tests/baselines/reference/genericDefaultsErrors.js +++ b/tests/baselines/reference/genericDefaultsErrors.js @@ -40,7 +40,10 @@ type i09t00 = i09; // error type i09t01 = i09<1>; // error type i09t02 = i09<1, 2>; // ok type i09t03 = i09<1, 2, 3>; // ok -type i09t04 = i09<1, 2, 3, 4>; // error +type i09t04 = i09<1, 2, 3, 4>; // error + +interface i10 { x: T; } // error +interface i10 {} //// [genericDefaultsErrors.js] f11(); // ok @@ -101,3 +104,8 @@ declare type i09t01 = i09<1>; declare type i09t02 = i09<1, 2>; declare type i09t03 = i09<1, 2, 3>; declare type i09t04 = i09<1, 2, 3, 4>; +interface i10 { + x: T; +} +interface i10 { +} diff --git a/tests/cases/compiler/genericDefaultsErrors.ts b/tests/cases/compiler/genericDefaultsErrors.ts index 985300f66078e..0e3cf3003b197 100644 --- a/tests/cases/compiler/genericDefaultsErrors.ts +++ b/tests/cases/compiler/genericDefaultsErrors.ts @@ -40,4 +40,7 @@ type i09t00 = i09; // error type i09t01 = i09<1>; // error type i09t02 = i09<1, 2>; // ok type i09t03 = i09<1, 2, 3>; // ok -type i09t04 = i09<1, 2, 3, 4>; // error \ No newline at end of file +type i09t04 = i09<1, 2, 3, 4>; // error + +interface i10 { x: T; } // error +interface i10 {} \ No newline at end of file From fd228a93a7bf4d1d7fb5fe96c7fe7595581d6ee8 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 20 Jan 2017 18:30:06 -0800 Subject: [PATCH 09/18] Remove partial inference --- src/compiler/checker.ts | 19 +---- src/compiler/types.ts | 1 - tests/baselines/reference/genericDefaults.js | 38 ++++++---- .../reference/genericDefaults.symbols | 14 ++-- .../baselines/reference/genericDefaults.types | 73 ++++++++++--------- .../genericDefaultsErrors.errors.txt | 35 +++++---- .../reference/genericDefaultsErrors.js | 7 ++ tests/cases/compiler/genericDefaults.ts | 8 +- tests/cases/compiler/genericDefaultsErrors.ts | 4 + 9 files changed, 112 insertions(+), 87 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 46e6dcb113808..d3194eb8aa958 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -9155,15 +9155,8 @@ namespace ts { return constraint && maybeTypeOfKind(constraint, TypeFlags.Primitive | TypeFlags.Index); } - function getSuppliedType(context: InferenceContext, index: number): Type | undefined { - if (context.suppliedTypes && index < context.suppliedTypes.length) { - return context.inferredTypes[index] = context.suppliedTypes[index]; - } - return undefined; - } - function getInferredType(context: InferenceContext, index: number): Type { - let inferredType = context.inferredTypes[index] || getSuppliedType(context, index); + let inferredType = context.inferredTypes[index]; let inferenceSucceeded: boolean; if (!inferredType) { const inferences = getInferenceCandidates(context, index); @@ -13417,7 +13410,6 @@ namespace ts { } } - const numTypeArguments = typeArguments ? typeArguments.length : 0; const candidates = candidatesOutArray || []; // reorderCandidates fills up the candidates array directly reorderCandidates(signatures, candidates); @@ -13593,16 +13585,13 @@ namespace ts { if (candidate.typeParameters) { let typeArgumentTypes: Type[] | undefined; if (typeArguments) { - // Check any supplied type arguments against the candidate. - typeArgumentTypes = map(typeArguments, getTypeFromTypeNode) + typeArgumentTypes = fillMissingTypeArguments(map(typeArguments, getTypeFromTypeNode), candidate.typeParameters, candidate.minTypeArgumentCount); typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, /*reportErrors*/ false); } - if ((!typeArguments || typeArgumentsAreValid) && numTypeArguments < candidate.typeParameters.length) { - // Infer any unsupplied type arguments for the candidate. - inferenceContext.suppliedTypes = typeArgumentTypes; + else { inferTypeArguments(node, candidate, args, excludeArgument, inferenceContext); - typeArgumentsAreValid = inferenceContext.failedTypeParameterIndex === undefined; typeArgumentTypes = inferenceContext.inferredTypes; + typeArgumentsAreValid = inferenceContext.failedTypeParameterIndex === undefined; } if (!typeArgumentsAreValid) { break; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 5a1078ec8efc3..30a054d481ed9 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3095,7 +3095,6 @@ namespace ts { inferUnionTypes: boolean; // Infer union types for disjoint candidates (otherwise undefinedType) inferences: TypeInferences[]; // Inferences made for each type parameter inferredTypes: Type[]; // Inferred type for each type parameter - suppliedTypes?: Type[]; // Supplied types for non-default type parameters mapper?: TypeMapper; // Type mapper for this inference context failedTypeParameterIndex?: number; // Index of type parameter for which inference failed // It is optional because in contextual signature instantiation, nothing fails diff --git a/tests/baselines/reference/genericDefaults.js b/tests/baselines/reference/genericDefaults.js index a2271681e1327..496c389481752 100644 --- a/tests/baselines/reference/genericDefaults.js +++ b/tests/baselines/reference/genericDefaults.js @@ -15,7 +15,7 @@ const f01c01 = f01(1); const f01c02 = f01(1, "a"); const f01c03 = f01(); const f01c04 = f01(1); -const f01c05 = f01(1, "a"); +const f01c05 = f01(1, 2); const f01c06 = f01(); const f01c07 = f01(1); const f01c08 = f01(1, "a"); @@ -26,7 +26,7 @@ const f02c01 = f02(1); const f02c02 = f02(1, "a"); const f02c03 = f02(); const f02c04 = f02(1); -const f02c05 = f02(1, "a"); +const f02c05 = f02(1, 2); const f02c06 = f02(); const f02c07 = f02(1); const f02c08 = f02(1, "a"); @@ -53,13 +53,13 @@ const f04c06 = f04(); const f04c07 = f04(1); const f04c08 = f04(1, 2); -declare function f05(a?: T, b?: U): [T, U]; +declare function f05(a?: T, b?: U): [T, U]; const f05c00 = f05(); const f05c01 = f05(1); const f05c02 = f05(1, 1); const f05c03 = f05(); const f05c04 = f05(1); -const f05c05 = f05(1, 2); +const f05c05 = f05<{ a: number }>({ a: 1 }, { a: 2, b: 3}); const f05c06 = f05(); const f05c07 = f05(1); const f05c08 = f05(1, 2); @@ -125,7 +125,7 @@ var f01c01 = f01(1); var f01c02 = f01(1, "a"); var f01c03 = f01(); var f01c04 = f01(1); -var f01c05 = f01(1, "a"); +var f01c05 = f01(1, 2); var f01c06 = f01(); var f01c07 = f01(1); var f01c08 = f01(1, "a"); @@ -134,7 +134,7 @@ var f02c01 = f02(1); var f02c02 = f02(1, "a"); var f02c03 = f02(); var f02c04 = f02(1); -var f02c05 = f02(1, "a"); +var f02c05 = f02(1, 2); var f02c06 = f02(); var f02c07 = f02(1); var f02c08 = f02(1, "a"); @@ -161,7 +161,7 @@ var f05c01 = f05(1); var f05c02 = f05(1, 1); var f05c03 = f05(); var f05c04 = f05(1); -var f05c05 = f05(1, 2); +var f05c05 = f05({ a: 1 }, { a: 2, b: 3 }); var f05c06 = f05(); var f05c07 = f05(1); var f05c08 = f05(1, 2); @@ -208,7 +208,7 @@ declare const f01c01: [number, number]; declare const f01c02: [number, string]; declare const f01c03: [number, number]; declare const f01c04: [number, number]; -declare const f01c05: [number, string]; +declare const f01c05: [number, number]; declare const f01c06: [number, string]; declare const f01c07: [number, string]; declare const f01c08: [number, string]; @@ -218,7 +218,7 @@ declare const f02c01: [1, 1]; declare const f02c02: [1, string]; declare const f02c03: [number, number]; declare const f02c04: [number, number]; -declare const f02c05: [number, string]; +declare const f02c05: [number, number]; declare const f02c06: [number, string]; declare const f02c07: [number, string]; declare const f02c08: [number, string]; @@ -248,27 +248,35 @@ declare const f04c03: [number, number | { declare const f04c04: [number, number | { a: number; }]; -declare const f04c05: [number, number]; +declare const f04c05: [number, number | { + a: number; +}]; declare const f04c06: [number, number]; declare const f04c07: [number, number]; declare const f04c08: [number, number]; declare function f05(a?: T, b?: U): [T, U]; declare const f05c00: [{}, {} & { - a: number; + b: number; }]; declare const f05c01: [number, number & { - a: number; + b: number; }]; declare const f05c02: [number, number]; declare const f05c03: [number, number & { - a: number; + b: number; }]; declare const f05c04: [number, number & { + b: number; +}]; +declare const f05c05: [{ + a: number; +}, { a: number; +} & { + b: number; }]; -declare const f05c05: [number, number]; declare const f05c06: [number, number]; declare const f05c07: [number, number]; declare const f05c08: [number, number]; diff --git a/tests/baselines/reference/genericDefaults.symbols b/tests/baselines/reference/genericDefaults.symbols index 67b61a0a252f5..0a633e6061220 100644 --- a/tests/baselines/reference/genericDefaults.symbols +++ b/tests/baselines/reference/genericDefaults.symbols @@ -65,7 +65,7 @@ const f01c04 = f01(1); >f01c04 : Symbol(f01c04, Decl(genericDefaults.ts, 15, 5)) >f01 : Symbol(f01, Decl(genericDefaults.ts, 8, 32)) -const f01c05 = f01(1, "a"); +const f01c05 = f01(1, 2); >f01c05 : Symbol(f01c05, Decl(genericDefaults.ts, 16, 5)) >f01 : Symbol(f01, Decl(genericDefaults.ts, 8, 32)) @@ -113,7 +113,7 @@ const f02c04 = f02(1); >f02c04 : Symbol(f02c04, Decl(genericDefaults.ts, 26, 5)) >f02 : Symbol(f02, Decl(genericDefaults.ts, 19, 43)) -const f02c05 = f02(1, "a"); +const f02c05 = f02(1, 2); >f02c05 : Symbol(f02c05, Decl(genericDefaults.ts, 27, 5)) >f02 : Symbol(f02, Decl(genericDefaults.ts, 19, 43)) @@ -227,12 +227,12 @@ const f04c08 = f04(1, 2); >f04c08 : Symbol(f04c08, Decl(genericDefaults.ts, 52, 5)) >f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41)) -declare function f05(a?: T, b?: U): [T, U]; +declare function f05(a?: T, b?: U): [T, U]; >f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41)) >T : Symbol(T, Decl(genericDefaults.ts, 54, 21)) >U : Symbol(U, Decl(genericDefaults.ts, 54, 23)) >T : Symbol(T, Decl(genericDefaults.ts, 54, 21)) ->a : Symbol(a, Decl(genericDefaults.ts, 54, 33)) +>b : Symbol(b, Decl(genericDefaults.ts, 54, 33)) >a : Symbol(a, Decl(genericDefaults.ts, 54, 47)) >T : Symbol(T, Decl(genericDefaults.ts, 54, 21)) >b : Symbol(b, Decl(genericDefaults.ts, 54, 53)) @@ -260,9 +260,13 @@ const f05c04 = f05(1); >f05c04 : Symbol(f05c04, Decl(genericDefaults.ts, 59, 5)) >f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41)) -const f05c05 = f05(1, 2); +const f05c05 = f05<{ a: number }>({ a: 1 }, { a: 2, b: 3}); >f05c05 : Symbol(f05c05, Decl(genericDefaults.ts, 60, 5)) >f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41)) +>a : Symbol(a, Decl(genericDefaults.ts, 60, 20)) +>a : Symbol(a, Decl(genericDefaults.ts, 60, 35)) +>a : Symbol(a, Decl(genericDefaults.ts, 60, 45)) +>b : Symbol(b, Decl(genericDefaults.ts, 60, 51)) const f05c06 = f05(); >f05c06 : Symbol(f05c06, Decl(genericDefaults.ts, 61, 5)) diff --git a/tests/baselines/reference/genericDefaults.types b/tests/baselines/reference/genericDefaults.types index 70f67497f21fe..4977d2d889601 100644 --- a/tests/baselines/reference/genericDefaults.types +++ b/tests/baselines/reference/genericDefaults.types @@ -84,12 +84,12 @@ const f01c04 = f01(1); >f01 : (a?: T, b?: U) => [T, U] >1 : 1 -const f01c05 = f01(1, "a"); ->f01c05 : [number, string] ->f01(1, "a") : [number, string] +const f01c05 = f01(1, 2); +>f01c05 : [number, number] +>f01(1, 2) : [number, number] >f01 : (a?: T, b?: U) => [T, U] >1 : 1 ->"a" : "a" +>2 : 2 const f01c06 = f01(); >f01c06 : [number, string] @@ -150,12 +150,12 @@ const f02c04 = f02(1); >f02 : (a?: T, b?: U) => [T, U] >1 : 1 -const f02c05 = f02(1, "a"); ->f02c05 : [number, string] ->f02(1, "a") : [number, string] +const f02c05 = f02(1, 2); +>f02c05 : [number, number] +>f02(1, 2) : [number, number] >f02 : (a?: T, b?: U) => [T, U] >1 : 1 ->"a" : "a" +>2 : 2 const f02c06 = f02(); >f02c06 : [number, string] @@ -285,8 +285,8 @@ const f04c04 = f04(1); >1 : 1 const f04c05 = f04(1, 2); ->f04c05 : [number, number] ->f04(1, 2) : [number, number] +>f04c05 : [number, number | { a: number; }] +>f04(1, 2) : [number, number | { a: number; }] >f04 : (a?: T, b?: U) => [T, U] >1 : 1 >2 : 2 @@ -309,12 +309,12 @@ const f04c08 = f04(1, 2); >1 : 1 >2 : 2 -declare function f05(a?: T, b?: U): [T, U]; ->f05 : (a?: T, b?: U) => [T, U] +declare function f05(a?: T, b?: U): [T, U]; +>f05 : (a?: T, b?: U) => [T, U] >T : T >U : U >T : T ->a : number +>b : number >a : T >T : T >b : U @@ -323,56 +323,63 @@ declare function f05(a?: T, b?: U): [T, U]; >U : U const f05c00 = f05(); ->f05c00 : [{}, {} & { a: number; }] ->f05() : [{}, {} & { a: number; }] ->f05 : (a?: T, b?: U) => [T, U] +>f05c00 : [{}, {} & { b: number; }] +>f05() : [{}, {} & { b: number; }] +>f05 : (a?: T, b?: U) => [T, U] const f05c01 = f05(1); ->f05c01 : [number, number & { a: number; }] ->f05(1) : [number, number & { a: number; }] ->f05 : (a?: T, b?: U) => [T, U] +>f05c01 : [number, number & { b: number; }] +>f05(1) : [number, number & { b: number; }] +>f05 : (a?: T, b?: U) => [T, U] >1 : 1 const f05c02 = f05(1, 1); >f05c02 : [number, number] >f05(1, 1) : [number, number] ->f05 : (a?: T, b?: U) => [T, U] +>f05 : (a?: T, b?: U) => [T, U] >1 : 1 >1 : 1 const f05c03 = f05(); ->f05c03 : [number, number & { a: number; }] ->f05() : [number, number & { a: number; }] ->f05 : (a?: T, b?: U) => [T, U] +>f05c03 : [number, number & { b: number; }] +>f05() : [number, number & { b: number; }] +>f05 : (a?: T, b?: U) => [T, U] const f05c04 = f05(1); ->f05c04 : [number, number & { a: number; }] ->f05(1) : [number, number & { a: number; }] ->f05 : (a?: T, b?: U) => [T, U] +>f05c04 : [number, number & { b: number; }] +>f05(1) : [number, number & { b: number; }] +>f05 : (a?: T, b?: U) => [T, U] >1 : 1 -const f05c05 = f05(1, 2); ->f05c05 : [number, number] ->f05(1, 2) : [number, number] ->f05 : (a?: T, b?: U) => [T, U] +const f05c05 = f05<{ a: number }>({ a: 1 }, { a: 2, b: 3}); +>f05c05 : [{ a: number; }, { a: number; } & { b: number; }] +>f05<{ a: number }>({ a: 1 }, { a: 2, b: 3}) : [{ a: number; }, { a: number; } & { b: number; }] +>f05 : (a?: T, b?: U) => [T, U] +>a : number +>{ a: 1 } : { a: number; } +>a : number >1 : 1 +>{ a: 2, b: 3} : { a: number; b: number; } +>a : number >2 : 2 +>b : number +>3 : 3 const f05c06 = f05(); >f05c06 : [number, number] >f05() : [number, number] ->f05 : (a?: T, b?: U) => [T, U] +>f05 : (a?: T, b?: U) => [T, U] const f05c07 = f05(1); >f05c07 : [number, number] >f05(1) : [number, number] ->f05 : (a?: T, b?: U) => [T, U] +>f05 : (a?: T, b?: U) => [T, U] >1 : 1 const f05c08 = f05(1, 2); >f05c08 : [number, number] >f05(1, 2) : [number, number] ->f05 : (a?: T, b?: U) => [T, U] +>f05 : (a?: T, b?: U) => [T, U] >1 : 1 >2 : 2 diff --git a/tests/baselines/reference/genericDefaultsErrors.errors.txt b/tests/baselines/reference/genericDefaultsErrors.errors.txt index ab2eb71e0ea7e..ad2e406859031 100644 --- a/tests/baselines/reference/genericDefaultsErrors.errors.txt +++ b/tests/baselines/reference/genericDefaultsErrors.errors.txt @@ -17,24 +17,25 @@ tests/cases/compiler/genericDefaultsErrors.ts(14,26): error TS2706: Type paramet tests/cases/compiler/genericDefaultsErrors.ts(14,33): error TS2706: Type parameter 'U' has a circular default. tests/cases/compiler/genericDefaultsErrors.ts(18,1): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/compiler/genericDefaultsErrors.ts(21,1): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/compiler/genericDefaultsErrors.ts(24,11): error TS2428: All declarations of 'i00' must have identical type parameters. -tests/cases/compiler/genericDefaultsErrors.ts(27,11): error TS2428: All declarations of 'i01' must have identical type parameters. -tests/cases/compiler/genericDefaultsErrors.ts(29,19): error TS2706: Type parameter 'T' has a circular default. -tests/cases/compiler/genericDefaultsErrors.ts(30,19): error TS2706: Type parameter 'T' has a circular default. -tests/cases/compiler/genericDefaultsErrors.ts(30,26): error TS2706: Type parameter 'U' has a circular default. -tests/cases/compiler/genericDefaultsErrors.ts(31,22): error TS2705: Required type parameters may not follow optional type parameters. -tests/cases/compiler/genericDefaultsErrors.ts(32,34): error TS2344: Type 'number' does not satisfy the constraint 'string'. -tests/cases/compiler/genericDefaultsErrors.ts(33,52): error TS2344: Type 'T' does not satisfy the constraint 'number'. +tests/cases/compiler/genericDefaultsErrors.ts(25,13): error TS2345: Argument of type '"a"' is not assignable to parameter of type 'number'. +tests/cases/compiler/genericDefaultsErrors.ts(28,11): error TS2428: All declarations of 'i00' must have identical type parameters. +tests/cases/compiler/genericDefaultsErrors.ts(31,11): error TS2428: All declarations of 'i01' must have identical type parameters. +tests/cases/compiler/genericDefaultsErrors.ts(33,19): error TS2706: Type parameter 'T' has a circular default. +tests/cases/compiler/genericDefaultsErrors.ts(34,19): error TS2706: Type parameter 'T' has a circular default. +tests/cases/compiler/genericDefaultsErrors.ts(34,26): error TS2706: Type parameter 'U' has a circular default. +tests/cases/compiler/genericDefaultsErrors.ts(35,22): error TS2705: Required type parameters may not follow optional type parameters. +tests/cases/compiler/genericDefaultsErrors.ts(36,34): error TS2344: Type 'number' does not satisfy the constraint 'string'. +tests/cases/compiler/genericDefaultsErrors.ts(37,52): error TS2344: Type 'T' does not satisfy the constraint 'number'. Type 'string' is not assignable to type 'number'. -tests/cases/compiler/genericDefaultsErrors.ts(34,37): error TS2344: Type 'T' does not satisfy the constraint 'number'. -tests/cases/compiler/genericDefaultsErrors.ts(35,32): error TS2344: Type 'number' does not satisfy the constraint 'T'. -tests/cases/compiler/genericDefaultsErrors.ts(38,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. -tests/cases/compiler/genericDefaultsErrors.ts(39,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. +tests/cases/compiler/genericDefaultsErrors.ts(38,37): error TS2344: Type 'T' does not satisfy the constraint 'number'. +tests/cases/compiler/genericDefaultsErrors.ts(39,32): error TS2344: Type 'number' does not satisfy the constraint 'T'. tests/cases/compiler/genericDefaultsErrors.ts(42,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. -tests/cases/compiler/genericDefaultsErrors.ts(44,17): error TS2367: Type parameter 'T' cannot be referenced outside of a declaration that defines it. +tests/cases/compiler/genericDefaultsErrors.ts(43,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. +tests/cases/compiler/genericDefaultsErrors.ts(46,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. +tests/cases/compiler/genericDefaultsErrors.ts(48,17): error TS2367: Type parameter 'T' cannot be referenced outside of a declaration that defines it. -==== tests/cases/compiler/genericDefaultsErrors.ts (32 errors) ==== +==== tests/cases/compiler/genericDefaultsErrors.ts (33 errors) ==== declare const x: any; @@ -94,6 +95,12 @@ tests/cases/compiler/genericDefaultsErrors.ts(44,17): error TS2367: Type paramet ~~~~~~~~~~~~~~~~~ !!! error TS2346: Supplied parameters do not match any signature of call target. + declare function f12(a?: U): void; + f12(); // ok + f12("a"); // error + ~~~ +!!! error TS2345: Argument of type '"a"' is not assignable to parameter of type 'number'. + interface i00 { } // ok interface i00 { } // error ~~~ diff --git a/tests/baselines/reference/genericDefaultsErrors.js b/tests/baselines/reference/genericDefaultsErrors.js index 12bac1a8ff4ac..d8ab04cdadf56 100644 --- a/tests/baselines/reference/genericDefaultsErrors.js +++ b/tests/baselines/reference/genericDefaultsErrors.js @@ -21,6 +21,10 @@ f11<1, 2>(); // ok f11<1, 2, 3>(); // ok f11<1, 2, 3, 4>(); // error +declare function f12(a?: U): void; +f12(); // ok +f12("a"); // error + interface i00 { } // ok interface i00 { } // error @@ -51,6 +55,8 @@ f11(); // error f11(); // ok f11(); // ok f11(); // error +f12(); // ok +f12("a"); // error //// [genericDefaultsErrors.d.ts] @@ -75,6 +81,7 @@ declare function f10(): void; declare function f11(): void; +declare function f12(a?: U): void; interface i00 { } interface i00 { diff --git a/tests/cases/compiler/genericDefaults.ts b/tests/cases/compiler/genericDefaults.ts index 10dbcf1025ec9..df507a32a918e 100644 --- a/tests/cases/compiler/genericDefaults.ts +++ b/tests/cases/compiler/genericDefaults.ts @@ -15,7 +15,7 @@ const f01c01 = f01(1); const f01c02 = f01(1, "a"); const f01c03 = f01(); const f01c04 = f01(1); -const f01c05 = f01(1, "a"); +const f01c05 = f01(1, 2); const f01c06 = f01(); const f01c07 = f01(1); const f01c08 = f01(1, "a"); @@ -26,7 +26,7 @@ const f02c01 = f02(1); const f02c02 = f02(1, "a"); const f02c03 = f02(); const f02c04 = f02(1); -const f02c05 = f02(1, "a"); +const f02c05 = f02(1, 2); const f02c06 = f02(); const f02c07 = f02(1); const f02c08 = f02(1, "a"); @@ -53,13 +53,13 @@ const f04c06 = f04(); const f04c07 = f04(1); const f04c08 = f04(1, 2); -declare function f05(a?: T, b?: U): [T, U]; +declare function f05(a?: T, b?: U): [T, U]; const f05c00 = f05(); const f05c01 = f05(1); const f05c02 = f05(1, 1); const f05c03 = f05(); const f05c04 = f05(1); -const f05c05 = f05(1, 2); +const f05c05 = f05<{ a: number }>({ a: 1 }, { a: 2, b: 3}); const f05c06 = f05(); const f05c07 = f05(1); const f05c08 = f05(1, 2); diff --git a/tests/cases/compiler/genericDefaultsErrors.ts b/tests/cases/compiler/genericDefaultsErrors.ts index 0e3cf3003b197..02b4fce9296d1 100644 --- a/tests/cases/compiler/genericDefaultsErrors.ts +++ b/tests/cases/compiler/genericDefaultsErrors.ts @@ -21,6 +21,10 @@ f11<1, 2>(); // ok f11<1, 2, 3>(); // ok f11<1, 2, 3, 4>(); // error +declare function f12(a?: U): void; +f12(); // ok +f12("a"); // error + interface i00 { } // ok interface i00 { } // error From 6b2c8cb7df20e89b83a882e8071e7df3a41ae0a5 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 20 Jan 2017 20:33:41 -0800 Subject: [PATCH 10/18] Defaults for type aliases --- src/compiler/checker.ts | 16 +- src/compiler/diagnosticMessages.json | 2 +- tests/baselines/reference/genericDefaults.js | 62 +++++++ .../reference/genericDefaults.symbols | 132 +++++++++++++++ .../baselines/reference/genericDefaults.types | 160 ++++++++++++++++++ .../genericDefaultsErrors.errors.txt | 6 +- tests/cases/compiler/genericDefaults.ts | 22 +++ 7 files changed, 389 insertions(+), 11 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d3194eb8aa958..2c9fae622a7cc 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5648,7 +5648,7 @@ namespace ts { const links = getSymbolLinks(symbol); const typeParameters = links.typeParameters; const id = getTypeListId(typeArguments); - return links.instantiations[id] || (links.instantiations[id] = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, typeArguments))); + return links.instantiations[id] || (links.instantiations[id] = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, fillMissingTypeArguments(typeArguments, typeParameters, links.minTypeArgumentCount)))); } // Get type from reference to type alias. When a type alias is generic, the declared type of the type alias may include @@ -16167,6 +16167,9 @@ namespace ts { checkTypeArgumentConstraints(typeParameters, node.typeArguments, minTypeArgumentCount); } } + if (type.flags & TypeFlags.TypeParameter && !(type).isThisType && type.symbol && !isTypeParameterInScope(type, node)) { + error(node, Diagnostics.Type_parameter_0_cannot_be_referenced_outside_of_the_declaration_that_defines_it, symbolToString(type.symbol)); + } if (type.flags & TypeFlags.Enum && !(type).memberTypes && getNodeLinks(node).resolvedSymbol.flags & SymbolFlags.EnumMember) { error(node, Diagnostics.Enum_type_0_has_members_with_initializers_that_are_not_literals, typeToString(type)); } @@ -17583,11 +17586,6 @@ namespace ts { error(node.name, Diagnostics.All_declarations_of_0_must_have_identical_modifiers, declarationNameToString(node.name)); } } - if (type.flags & TypeFlags.TypeParameter && !(type).isThisType && type.symbol) { - if (!isTypeParameterInScope(type, node)) { - error(node.name, Diagnostics.Type_parameter_0_cannot_be_referenced_outside_of_a_declaration_that_defines_it, symbolToString(type.symbol)); - } - } if (node.kind !== SyntaxKind.PropertyDeclaration && node.kind !== SyntaxKind.PropertySignature) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); @@ -17605,7 +17603,11 @@ namespace ts { function isTypeParameterInScope(typeParameter: TypeParameter, node: Node) { const parents = map(filter(typeParameter.symbol.declarations, isTypeParameter), node => node.parent); while (node) { - if (isFunctionLike(node) || isClassLike(node) || node.kind === SyntaxKind.InterfaceDeclaration || node.kind === SyntaxKind.TypeAliasDeclaration) { + if (isFunctionLike(node) || + isClassLike(node) || + node.kind === SyntaxKind.InterfaceDeclaration || + node.kind === SyntaxKind.TypeAliasDeclaration || + node.kind === SyntaxKind.MappedType) { if (contains(parents, node)) { return true; } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index ca4162804d061..7d7f73c85e529 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1127,7 +1127,7 @@ "category": "Error", "code": 2366 }, - "Type parameter '{0}' cannot be referenced outside of a declaration that defines it.": { + "Type parameter '{0}' cannot be referenced outside of the declaration that defines it.": { "category": "Error", "code": 2367 }, diff --git a/tests/baselines/reference/genericDefaults.js b/tests/baselines/reference/genericDefaults.js index 496c389481752..31e861eaa35d2 100644 --- a/tests/baselines/reference/genericDefaults.js +++ b/tests/baselines/reference/genericDefaults.js @@ -111,6 +111,28 @@ const Derived02c00 = new Derived02(); const Derived02c01 = new Derived02(1); const Derived02c02 = new Derived02(); const Derived02c03 = new Derived02(1); + +type t00 = { a: T; } +const t00c00 = (x).a; +const t00c01 = (>x).a; + +type t01 = { a: [T, U]; } +const t01c00 = (>x).a; +const t01c01 = (>x).a; + +type t02 = { a: [T, U]; } +const t02c00 = (>x).a; +const t02c01 = (>x).a; +const t02c02 = (>x).a; +const t02c03 = (>x).a; +const t02c04 = (>x).a; + +type t03 = { a: [T, U]; } +const t03c00 = (>x).a; +const t03c01 = (>x).a; +const t03c02 = (>x).a; +const t03c03 = (>x).a; +const t03c04 = (>x).a; //// [genericDefaults.js] @@ -191,6 +213,20 @@ var Derived02c00 = new Derived02(); var Derived02c01 = new Derived02(1); var Derived02c02 = new Derived02(); var Derived02c03 = new Derived02(1); +var t00c00 = x.a; +var t00c01 = x.a; +var t01c00 = x.a; +var t01c01 = x.a; +var t02c00 = x.a; +var t02c01 = x.a; +var t02c02 = x.a; +var t02c03 = x.a; +var t02c04 = x.a; +var t03c00 = x.a; +var t03c01 = x.a; +var t03c02 = x.a; +var t03c03 = x.a; +var t03c04 = x.a; //// [genericDefaults.d.ts] @@ -337,3 +373,29 @@ declare const Derived02c00: Derived02; declare const Derived02c01: Derived02; declare const Derived02c02: Derived02; declare const Derived02c03: Derived02; +declare type t00 = { + a: T; +}; +declare const t00c00: number; +declare const t00c01: number; +declare type t01 = { + a: [T, U]; +}; +declare const t01c00: [number, number]; +declare const t01c01: [number, string]; +declare type t02 = { + a: [T, U]; +}; +declare const t02c00: [number, number]; +declare const t02c01: [1, 1]; +declare const t02c02: [number, number]; +declare const t02c03: [1, number]; +declare const t02c04: [number, 1]; +declare type t03 = { + a: [T, U]; +}; +declare const t03c00: [number, number]; +declare const t03c01: [1, 1]; +declare const t03c02: [number, number]; +declare const t03c03: [1, 1]; +declare const t03c04: [number, 1]; diff --git a/tests/baselines/reference/genericDefaults.symbols b/tests/baselines/reference/genericDefaults.symbols index 0a633e6061220..736fe3b8cb1a6 100644 --- a/tests/baselines/reference/genericDefaults.symbols +++ b/tests/baselines/reference/genericDefaults.symbols @@ -506,3 +506,135 @@ const Derived02c03 = new Derived02(1); >Derived02c03 : Symbol(Derived02c03, Decl(genericDefaults.ts, 111, 5)) >Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 105, 46)) +type t00 = { a: T; } +>t00 : Symbol(t00, Decl(genericDefaults.ts, 111, 46)) +>T : Symbol(T, Decl(genericDefaults.ts, 113, 9)) +>a : Symbol(a, Decl(genericDefaults.ts, 113, 24)) +>T : Symbol(T, Decl(genericDefaults.ts, 113, 9)) + +const t00c00 = (x).a; +>t00c00 : Symbol(t00c00, Decl(genericDefaults.ts, 114, 5)) +>(x).a : Symbol(a, Decl(genericDefaults.ts, 113, 24)) +>t00 : Symbol(t00, Decl(genericDefaults.ts, 111, 46)) +>x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 113, 24)) + +const t00c01 = (>x).a; +>t00c01 : Symbol(t00c01, Decl(genericDefaults.ts, 115, 5)) +>(>x).a : Symbol(a, Decl(genericDefaults.ts, 113, 24)) +>t00 : Symbol(t00, Decl(genericDefaults.ts, 111, 46)) +>x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 113, 24)) + +type t01 = { a: [T, U]; } +>t01 : Symbol(t01, Decl(genericDefaults.ts, 115, 34)) +>T : Symbol(T, Decl(genericDefaults.ts, 117, 9)) +>U : Symbol(U, Decl(genericDefaults.ts, 117, 11)) +>T : Symbol(T, Decl(genericDefaults.ts, 117, 9)) +>a : Symbol(a, Decl(genericDefaults.ts, 117, 22)) +>T : Symbol(T, Decl(genericDefaults.ts, 117, 9)) +>U : Symbol(U, Decl(genericDefaults.ts, 117, 11)) + +const t01c00 = (>x).a; +>t01c00 : Symbol(t01c00, Decl(genericDefaults.ts, 118, 5)) +>(>x).a : Symbol(a, Decl(genericDefaults.ts, 117, 22)) +>t01 : Symbol(t01, Decl(genericDefaults.ts, 115, 34)) +>x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 117, 22)) + +const t01c01 = (>x).a; +>t01c01 : Symbol(t01c01, Decl(genericDefaults.ts, 119, 5)) +>(>x).a : Symbol(a, Decl(genericDefaults.ts, 117, 22)) +>t01 : Symbol(t01, Decl(genericDefaults.ts, 115, 34)) +>x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 117, 22)) + +type t02 = { a: [T, U]; } +>t02 : Symbol(t02, Decl(genericDefaults.ts, 119, 42)) +>T : Symbol(T, Decl(genericDefaults.ts, 121, 9)) +>U : Symbol(U, Decl(genericDefaults.ts, 121, 26)) +>T : Symbol(T, Decl(genericDefaults.ts, 121, 9)) +>a : Symbol(a, Decl(genericDefaults.ts, 121, 37)) +>T : Symbol(T, Decl(genericDefaults.ts, 121, 9)) +>U : Symbol(U, Decl(genericDefaults.ts, 121, 26)) + +const t02c00 = (>x).a; +>t02c00 : Symbol(t02c00, Decl(genericDefaults.ts, 122, 5)) +>(>x).a : Symbol(a, Decl(genericDefaults.ts, 121, 37)) +>t02 : Symbol(t02, Decl(genericDefaults.ts, 119, 42)) +>x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 121, 37)) + +const t02c01 = (>x).a; +>t02c01 : Symbol(t02c01, Decl(genericDefaults.ts, 123, 5)) +>(>x).a : Symbol(a, Decl(genericDefaults.ts, 121, 37)) +>t02 : Symbol(t02, Decl(genericDefaults.ts, 119, 42)) +>x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 121, 37)) + +const t02c02 = (>x).a; +>t02c02 : Symbol(t02c02, Decl(genericDefaults.ts, 124, 5)) +>(>x).a : Symbol(a, Decl(genericDefaults.ts, 121, 37)) +>t02 : Symbol(t02, Decl(genericDefaults.ts, 119, 42)) +>x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 121, 37)) + +const t02c03 = (>x).a; +>t02c03 : Symbol(t02c03, Decl(genericDefaults.ts, 125, 5)) +>(>x).a : Symbol(a, Decl(genericDefaults.ts, 121, 37)) +>t02 : Symbol(t02, Decl(genericDefaults.ts, 119, 42)) +>x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 121, 37)) + +const t02c04 = (>x).a; +>t02c04 : Symbol(t02c04, Decl(genericDefaults.ts, 126, 5)) +>(>x).a : Symbol(a, Decl(genericDefaults.ts, 121, 37)) +>t02 : Symbol(t02, Decl(genericDefaults.ts, 119, 42)) +>x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 121, 37)) + +type t03 = { a: [T, U]; } +>t03 : Symbol(t03, Decl(genericDefaults.ts, 126, 37)) +>T : Symbol(T, Decl(genericDefaults.ts, 128, 9)) +>U : Symbol(U, Decl(genericDefaults.ts, 128, 26)) +>T : Symbol(T, Decl(genericDefaults.ts, 128, 9)) +>T : Symbol(T, Decl(genericDefaults.ts, 128, 9)) +>a : Symbol(a, Decl(genericDefaults.ts, 128, 47)) +>T : Symbol(T, Decl(genericDefaults.ts, 128, 9)) +>U : Symbol(U, Decl(genericDefaults.ts, 128, 26)) + +const t03c00 = (>x).a; +>t03c00 : Symbol(t03c00, Decl(genericDefaults.ts, 129, 5)) +>(>x).a : Symbol(a, Decl(genericDefaults.ts, 128, 47)) +>t03 : Symbol(t03, Decl(genericDefaults.ts, 126, 37)) +>x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 128, 47)) + +const t03c01 = (>x).a; +>t03c01 : Symbol(t03c01, Decl(genericDefaults.ts, 130, 5)) +>(>x).a : Symbol(a, Decl(genericDefaults.ts, 128, 47)) +>t03 : Symbol(t03, Decl(genericDefaults.ts, 126, 37)) +>x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 128, 47)) + +const t03c02 = (>x).a; +>t03c02 : Symbol(t03c02, Decl(genericDefaults.ts, 131, 5)) +>(>x).a : Symbol(a, Decl(genericDefaults.ts, 128, 47)) +>t03 : Symbol(t03, Decl(genericDefaults.ts, 126, 37)) +>x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 128, 47)) + +const t03c03 = (>x).a; +>t03c03 : Symbol(t03c03, Decl(genericDefaults.ts, 132, 5)) +>(>x).a : Symbol(a, Decl(genericDefaults.ts, 128, 47)) +>t03 : Symbol(t03, Decl(genericDefaults.ts, 126, 37)) +>x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 128, 47)) + +const t03c04 = (>x).a; +>t03c04 : Symbol(t03c04, Decl(genericDefaults.ts, 133, 5)) +>(>x).a : Symbol(a, Decl(genericDefaults.ts, 128, 47)) +>t03 : Symbol(t03, Decl(genericDefaults.ts, 126, 37)) +>x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 128, 47)) + diff --git a/tests/baselines/reference/genericDefaults.types b/tests/baselines/reference/genericDefaults.types index 4977d2d889601..2f12a8e90fdf3 100644 --- a/tests/baselines/reference/genericDefaults.types +++ b/tests/baselines/reference/genericDefaults.types @@ -655,3 +655,163 @@ const Derived02c03 = new Derived02(1); >Derived02 : typeof Derived02 >1 : 1 +type t00 = { a: T; } +>t00 : t00 +>T : T +>a : T +>T : T + +const t00c00 = (x).a; +>t00c00 : number +>(x).a : number +>(x) : t00 +>x : t00 +>t00 : t00 +>x : any +>a : number + +const t00c01 = (>x).a; +>t00c01 : number +>(>x).a : number +>(>x) : t00 +>>x : t00 +>t00 : t00 +>x : any +>a : number + +type t01 = { a: [T, U]; } +>t01 : t01 +>T : T +>U : U +>T : T +>a : [T, U] +>T : T +>U : U + +const t01c00 = (>x).a; +>t01c00 : [number, number] +>(>x).a : [number, number] +>(>x) : t01 +>>x : t01 +>t01 : t01 +>x : any +>a : [number, number] + +const t01c01 = (>x).a; +>t01c01 : [number, string] +>(>x).a : [number, string] +>(>x) : t01 +>>x : t01 +>t01 : t01 +>x : any +>a : [number, string] + +type t02 = { a: [T, U]; } +>t02 : t02 +>T : T +>U : U +>T : T +>a : [T, U] +>T : T +>U : U + +const t02c00 = (>x).a; +>t02c00 : [number, number] +>(>x).a : [number, number] +>(>x) : t02 +>>x : t02 +>t02 : t02 +>x : any +>a : [number, number] + +const t02c01 = (>x).a; +>t02c01 : [1, 1] +>(>x).a : [1, 1] +>(>x) : t02<1, 1> +>>x : t02<1, 1> +>t02 : t02 +>x : any +>a : [1, 1] + +const t02c02 = (>x).a; +>t02c02 : [number, number] +>(>x).a : [number, number] +>(>x) : t02 +>>x : t02 +>t02 : t02 +>x : any +>a : [number, number] + +const t02c03 = (>x).a; +>t02c03 : [1, number] +>(>x).a : [1, number] +>(>x) : t02<1, number> +>>x : t02<1, number> +>t02 : t02 +>x : any +>a : [1, number] + +const t02c04 = (>x).a; +>t02c04 : [number, 1] +>(>x).a : [number, 1] +>(>x) : t02 +>>x : t02 +>t02 : t02 +>x : any +>a : [number, 1] + +type t03 = { a: [T, U]; } +>t03 : t03 +>T : T +>U : U +>T : T +>T : T +>a : [T, U] +>T : T +>U : U + +const t03c00 = (>x).a; +>t03c00 : [number, number] +>(>x).a : [number, number] +>(>x) : t03 +>>x : t03 +>t03 : t03 +>x : any +>a : [number, number] + +const t03c01 = (>x).a; +>t03c01 : [1, 1] +>(>x).a : [1, 1] +>(>x) : t03<1, 1> +>>x : t03<1, 1> +>t03 : t03 +>x : any +>a : [1, 1] + +const t03c02 = (>x).a; +>t03c02 : [number, number] +>(>x).a : [number, number] +>(>x) : t03 +>>x : t03 +>t03 : t03 +>x : any +>a : [number, number] + +const t03c03 = (>x).a; +>t03c03 : [1, 1] +>(>x).a : [1, 1] +>(>x) : t03<1, 1> +>>x : t03<1, 1> +>t03 : t03 +>x : any +>a : [1, 1] + +const t03c04 = (>x).a; +>t03c04 : [number, 1] +>(>x).a : [number, 1] +>(>x) : t03 +>>x : t03 +>t03 : t03 +>x : any +>a : [number, 1] + diff --git a/tests/baselines/reference/genericDefaultsErrors.errors.txt b/tests/baselines/reference/genericDefaultsErrors.errors.txt index ad2e406859031..94945b2b9c53c 100644 --- a/tests/baselines/reference/genericDefaultsErrors.errors.txt +++ b/tests/baselines/reference/genericDefaultsErrors.errors.txt @@ -32,7 +32,7 @@ tests/cases/compiler/genericDefaultsErrors.ts(39,32): error TS2344: Type 'number tests/cases/compiler/genericDefaultsErrors.ts(42,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. tests/cases/compiler/genericDefaultsErrors.ts(43,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. tests/cases/compiler/genericDefaultsErrors.ts(46,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. -tests/cases/compiler/genericDefaultsErrors.ts(48,17): error TS2367: Type parameter 'T' cannot be referenced outside of a declaration that defines it. +tests/cases/compiler/genericDefaultsErrors.ts(48,20): error TS2367: Type parameter 'T' cannot be referenced outside of the declaration that defines it. ==== tests/cases/compiler/genericDefaultsErrors.ts (33 errors) ==== @@ -150,6 +150,6 @@ tests/cases/compiler/genericDefaultsErrors.ts(48,17): error TS2367: Type paramet !!! error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. interface i10 { x: T; } // error - ~ -!!! error TS2367: Type parameter 'T' cannot be referenced outside of a declaration that defines it. + ~ +!!! error TS2367: Type parameter 'T' cannot be referenced outside of the declaration that defines it. interface i10 {} \ No newline at end of file diff --git a/tests/cases/compiler/genericDefaults.ts b/tests/cases/compiler/genericDefaults.ts index df507a32a918e..1fc096398946c 100644 --- a/tests/cases/compiler/genericDefaults.ts +++ b/tests/cases/compiler/genericDefaults.ts @@ -111,3 +111,25 @@ const Derived02c00 = new Derived02(); const Derived02c01 = new Derived02(1); const Derived02c02 = new Derived02(); const Derived02c03 = new Derived02(1); + +type t00 = { a: T; } +const t00c00 = (x).a; +const t00c01 = (>x).a; + +type t01 = { a: [T, U]; } +const t01c00 = (>x).a; +const t01c01 = (>x).a; + +type t02 = { a: [T, U]; } +const t02c00 = (>x).a; +const t02c01 = (>x).a; +const t02c02 = (>x).a; +const t02c03 = (>x).a; +const t02c04 = (>x).a; + +type t03 = { a: [T, U]; } +const t03c00 = (>x).a; +const t03c01 = (>x).a; +const t03c02 = (>x).a; +const t03c03 = (>x).a; +const t03c04 = (>x).a; From 15232fe17cde195f53bacbe2fd8571c189eb337b Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 23 Jan 2017 19:36:02 -0800 Subject: [PATCH 11/18] Remove circular default check --- src/compiler/checker.ts | 105 +- src/compiler/diagnosticMessages.json | 6 +- src/compiler/types.ts | 2 - tests/baselines/reference/genericDefaults.js | 973 +++++-- .../reference/genericDefaults.symbols | 2422 ++++++++++++++--- .../baselines/reference/genericDefaults.types | 2372 +++++++++++++--- .../genericDefaultsErrors.errors.txt | 104 +- .../reference/genericDefaultsErrors.js | 40 +- tests/cases/compiler/genericDefaults.ts | 463 +++- tests/cases/compiler/genericDefaultsErrors.ts | 19 +- 10 files changed, 5295 insertions(+), 1211 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d3194eb8aa958..10a0c499d128b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -375,7 +375,6 @@ namespace ts { ResolvedBaseConstructorType, DeclaredType, ResolvedReturnType, - ResolvedDefault } const builtinGlobals = createMap(); @@ -2651,7 +2650,7 @@ namespace ts { writeSpace(writer); buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, symbolStack); } - const defaultType = getDefaultOfTypeParameter(tp); + const defaultType = getDefaultFromTypeParameter(tp); if (defaultType) { writeSpace(writer); writePunctuation(writer, SyntaxKind.EqualsToken); @@ -3054,9 +3053,6 @@ namespace ts { if (propertyName === TypeSystemPropertyName.ResolvedReturnType) { return (target).resolvedReturnType; } - if (propertyName === TypeSystemPropertyName.ResolvedDefault) { - return (target).resolvedDefault; - } Debug.fail("Unhandled TypeSystemPropertyName " + propertyName); } @@ -4863,69 +4859,6 @@ namespace ts { return typeParameter.default === noConstraintOrDefaultType ? undefined : typeParameter.default; } - /** - * Gets the default type for a type parameter. - * - * If the type parameter is the result of an instantiation, this gets the instantiated - * default type of its target. If the type parameter has no default type, or if the default - * type circularly references the type parameter, `undefined` is returned. - * - * This function *does* perform a circularity check. - */ - function getDefaultOfTypeParameter(typeParameter: TypeParameter): Type | undefined { - return hasNonCircularDefault(typeParameter) ? getDefaultFromTypeParameter(typeParameter) : undefined; - } - - /** - * Determines whether a type parameter has a non-circular default type. - * - * Note that this function also returns `true` if a type parameter *does not* have a - * default type. - */ - function hasNonCircularDefault(typeParameter: TypeParameter): boolean { - return getResolvedDefault(typeParameter) !== circularConstraintOrDefaultType; - } - - /** - * Resolves the default type of a type parameter. - * - * If the type parameter has no default, the `noConstraintOrDefaultType` singleton is - * returned. If the type parameter has a circular default, the - * `circularConstraintOrDefaultType` singleton is returned. - */ - function getResolvedDefault(typeParameter: TypeParameter): Type { - if (!typeParameter.resolvedDefault) { - if (!pushTypeResolution(typeParameter, TypeSystemPropertyName.ResolvedDefault)) { - return circularConstraintOrDefaultType; - } - const defaultType = getDefaultFromTypeParameter(typeParameter); - const type = defaultType && getResolvedDefaultWorker(defaultType); - if (!popTypeResolution()) { - return typeParameter.resolvedDefault = circularConstraintOrDefaultType; - } - typeParameter.resolvedDefault = type || noConstraintOrDefaultType; - } - return typeParameter.resolvedDefault; - } - - /** - * Recursively resolves the default type for a type. - * - * If the type is a union or intersection type and any of its constituents is a circular - * reference, the `circularConstraintOrDefaultType` singleton is returned. - */ - function getResolvedDefaultWorker(type: Type): Type { - if (type.flags & TypeFlags.TypeParameter) { - return getResolvedDefault(type); - } - if (type.flags & TypeFlags.UnionOrIntersection) { - const types = map((type).types, getResolvedDefaultWorker); - return some(types, x => x === circularConstraintOrDefaultType) ? circularConstraintOrDefaultType : - type.flags & TypeFlags.Union ? getUnionType(types) : getIntersectionType(types); - } - return type; - } - /** * For a type parameter, return the base constraint of the type parameter. For the string, number, * boolean, and symbol primitive types, return the corresponding object types. Otherwise return the @@ -5241,20 +5174,23 @@ namespace ts { typeArguments = []; } - // Map an unsatisfied type parameter with a default type to the default type. + // Map an unsatisfied type parameter with a default type. // If a type parameter does not have a default type, or if the default type - // is a circular reference, the empty object type is used. + // is a forward reference, the empty object type is used. const mapper: TypeMapper = t => { const i = indexOf(typeParameters, t); - return i >= 0 - ? typeArguments[i] || (typeArguments[i] = - instantiateType(getDefaultOfTypeParameter(typeParameters[i]), mapper) || - emptyObjectType) - : t; + if (i >= typeArguments.length) { + return emptyObjectType; + } + if (i >= 0) { + return typeArguments[i]; + } + return t; }; for (let i = numTypeArguments; i < numTypeParameters; i++) { - instantiateType(typeParameters[i], mapper); + const defaultType = getDefaultFromTypeParameter(typeParameters[i]); + typeArguments[i] = defaultType ? instantiateType(defaultType, mapper) : emptyObjectType; } } } @@ -9181,8 +9117,16 @@ namespace ts { // succeeds, meaning there is no error for not having inference candidates. An // inference error only occurs when there are *conflicting* candidates, i.e. // candidates with no common supertype. - const defaultType = getDefaultOfTypeParameter(context.signature.typeParameters[index]); - inferredType = defaultType ? instantiateType(defaultType, getInferenceMapper(context)) : emptyObjectType; + const defaultType = getDefaultFromTypeParameter(context.signature.typeParameters[index]); + if (defaultType) { + const backreferenceMapper: TypeMapper = t => indexOf(context.signature.typeParameters, t) >= index ? emptyObjectType : t; + const mapper = combineTypeMappers(backreferenceMapper, getInferenceMapper(context)); + inferredType = instantiateType(defaultType, mapper); + } + else { + inferredType = emptyObjectType; + } + inferenceSucceeded = true; } context.inferredTypes[index] = inferredType; @@ -15574,11 +15518,8 @@ namespace ts { if (!hasNonCircularBaseConstraint(typeParameter)) { error(node.constraint, Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)); } - if (!hasNonCircularDefault(typeParameter)) { - error(node.default, Diagnostics.Type_parameter_0_has_a_circular_default, typeToString(typeParameter)); - } const constraintType = getConstraintOfTypeParameter(typeParameter); - const defaultType = getDefaultOfTypeParameter(typeParameter); + const defaultType = getDefaultFromTypeParameter(typeParameter); if (constraintType && defaultType) { checkTypeAssignableTo(defaultType, getTypeWithThisArgument(constraintType, defaultType), node.default, Diagnostics.Type_0_does_not_satisfy_the_constraint_1); } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index ca4162804d061..eeedac3c1a908 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -2043,11 +2043,7 @@ "category": "Error", "code": 2705 }, - "Type parameter '{0}' has a circular default.": { - "category": "Error", - "code": 2706 - }, - "Generic type '{0}' requires between {1} and {2} type arguments.": { + "Generic type '{0}' requires between {1} and {2} type arguments.": { "category": "Error", "code": 2707 }, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 30a054d481ed9..0e987e53b4fe2 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2990,8 +2990,6 @@ namespace ts { /* @internal */ resolvedBaseConstraint: Type; /* @internal */ - resolvedDefault: Type; - /* @internal */ resolvedIndexType: IndexType; } diff --git a/tests/baselines/reference/genericDefaults.js b/tests/baselines/reference/genericDefaults.js index 496c389481752..0f59bcfd051a0 100644 --- a/tests/baselines/reference/genericDefaults.js +++ b/tests/baselines/reference/genericDefaults.js @@ -1,68 +1,398 @@ //// [genericDefaults.ts] +interface A { a: number; } +interface B { b: number; } +interface C { c: number; } +interface D { d: number; } +interface AB { a: number; b: number; } +interface BC { b: number; c: number; } + +declare const a: A; +declare const b: B; +declare const c: C; +declare const d: D; +declare const ab: AB; +declare const bc: BC; declare const x: any; -declare function f00(a?: T): T; -const f00c00 = f00(); -const f00c01 = f00(1); -const f00c02 = f00("a"); -const f00c03 = f00(); -const f00c04 = f00(1); -const f00c05 = f00("a"); - -declare function f01(a?: T, b?: U): [T, U]; -const f01c00 = f01(); -const f01c01 = f01(1); -const f01c02 = f01(1, "a"); -const f01c03 = f01(); -const f01c04 = f01(1); -const f01c05 = f01(1, 2); -const f01c06 = f01(); -const f01c07 = f01(1); -const f01c08 = f01(1, "a"); - -declare function f02(a?: T, b?: U): [T, U]; -const f02c00 = f02(); -const f02c01 = f02(1); -const f02c02 = f02(1, "a"); -const f02c03 = f02(); -const f02c04 = f02(1); -const f02c05 = f02(1, 2); -const f02c06 = f02(); -const f02c07 = f02(1); -const f02c08 = f02(1, "a"); - -declare function f03(a?: T, b?: U): [T, U]; -const f03c00 = f03(); -const f03c01 = f03(1); -const f03c02 = f03(1, 1); -const f03c03 = f03(); -const f03c04 = f03(1); -const f03c05 = f03(1, 2); -const f03c06 = f03(); -const f03c07 = f03(1); -const f03c08 = f03(1, 2); - -declare function f04(a?: T, b?: U): [T, U]; -const f04c00 = f04(); -const f04c01 = f04(1); -const f04c02 = f04(1, 1); -const f04c03 = f04(); -const f04c04 = f04(1); -const f04c05 = f04(1, 2); -const f04c06 = f04(); -const f04c07 = f04(1); -const f04c08 = f04(1, 2); - -declare function f05(a?: T, b?: U): [T, U]; -const f05c00 = f05(); -const f05c01 = f05(1); -const f05c02 = f05(1, 1); -const f05c03 = f05(); -const f05c04 = f05(1); -const f05c05 = f05<{ a: number }>({ a: 1 }, { a: 2, b: 3}); -const f05c06 = f05(); -const f05c07 = f05(1); -const f05c08 = f05(1, 2); +// function without type parameters +declare function f00(a?: A): A; +// no inference +f00(); +f00(a); + +// function with a type parameter without a default +declare function f01(a?: T): T; +// inference +f01(); +f01(a); +// no inference, fully supplied +f01(); +f01(a); + +// function with a type paramter with a default +declare function f02(a?: T): T; +// inference +f02(); +f02(a); +f02(b); +// no inference, fully supplied +f02(); +f02(a); +f02(); +f02(b); + +// function with a type parameter with a default that refers to itself +declare function f03(a?: T): T; +// inference +f03(); +f03(a); +f03(b); +// no inference, fully supplied +f03(); +f03(a); +f03(); +f03(b); + +// function with a type paramter without a default and a type parameter with a default +declare function f04(a?: T, b?: U): [T, U]; +// inference +f04(); +f04(a); +f04(a, b); +f04(a, c); +// no inference, partially supplied +f04(); +f04(a); +f04(a, b); +// no inference, fully supplied +f04(); +f04(a); +f04(a, b); +f04(); +f04(a); +f04(a, c); + +// function with a type parameter without a default and a type parameter with a default that refers to an earlier type parameter +declare function f05(a?: T, b?: U): [T, U]; +// inference +f05(); +f05(a); +f05(a, a); +f05(a, b); +// no inference, partially supplied +f05(); +f05(a); +f05(a, a); +// no inference, fully supplied +f05(); +f05(a); +f05(a, b); + +// function with a type parameter with a default that refers to an earlier type parameter with a default +declare function f06(a?: T, b?: U): [T, U]; +// inference +f06(); +f06(a); +f06(a, a); +f06(a, b); +f06(b, a); +f06(b, b); +// no inference, partially supplied +f06(); +f06(a); +f06(a, a); +f06(); +f06(b); +f06(b, b); +// no inference, fully supplied +f06(); +f06(a); +f06(a, b); +f06(); +f06(b); +f06(b, c); + +// function with a type parameter without a default and a type parameter with a default that refers to an earlier type parameter with a default +declare function f07(a?: T, b?: U, c?: V): [T, U, V]; +// inference +f07(); +f07(a, b); +f07(a, c); +f07(a, b, b); +f07(a, b, c); +f07(a, c, b); +f07(a, c, c); +// no inference, partially supplied +f07(); +f07(a); +f07(a, b); +f07(a, b, b); +f07(); +f07(a); +f07(a, b); +f07(a, b, b); +f07(); +f07(a); +f07(a, c); +f07(a, c, c); +// no inference, fully supplied +f07(); +f07(a); +f07(a, b); +f07(a, b, c); +f07(); +f07(a); +f07(a, c); +f07(a, c, d); + +// function with a type parameter with a default that refers to an earlier type parameter with a constraint +declare function f08(a?: T, b?: U): [T, U]; +// inference +f08(); +f08(a); +f08(a, a); +f08(a, b); +// no inference, partially supplied +f08(); +f08(a); +f08(a, a); +// no inference, fully supplied +f08(); +f08(a); +f08(a, b); + +// function with a type parameter with a constraint and a default that refers to an earlier type parameter +declare function f09(a?: T, b?: U): [T, U]; +// inference +f09(); +f09(a); +f09(a, a); +f09(a, ab); +// no inference, partially supplied +f09(); +f09(a); +f09(a, a); +f09(a, ab); +// no inference, fully supplied +f09(); +f09(a); +f09(a, ab); + +// function with a type parameter with a constraint and a default that refers to an earlier type parameter with a constraint +declare function f10(a?: T, b?: U): [T, U]; +// inference +f10(); +f10(a); +f10(a, a); +f10(a, ab); +// no inference, partially supplied +f10(); +f10(a); +f10(a, a); +f10(a, ab); +// no inference, fully supplied +f10(); +f10(a); +f10(a, a); +f10(a, ab); +f10(); +f10(a); +f10(a, ab); + +// function with a type parameter with a default that refers to an earier type parameter in a union +declare function f11(a?: T, b?: U): [T, U]; +// inference +f11(); +f11(a); +f11(a, a); +f11(a, b); +f11(a, c); +// no inference, partially supplied +f11(); +f11(a); +f11(a, a); +f11(a, b); +// no inference, fully supplied +f11(); +f11(a); +f11(a, c); + +// function with a type parameter with a default that refers to an earlier type parameter in an intersection +declare function f12(a?: T, b?: U): [T, U]; +// inference +f12(); +f12(a); +f12(a, a); +f12(a, b); +f12(a, c); +// no inference, partially supplied +f12(); +f12(a); +f12(a, ab); +// no inference, fully supplied +f12(); +f12(a); +f12(a, c); + +// function with a type parameter with a default that refers to a later type parameter with a default +declare function f13(a?: T, b?: U): [T, U]; +// inference +f13(); +f13(a); +f13(a, b); +f13(a, c); +// no inference, partially supplied +f13(); +f13(a); +f13(a, b); +// no inference, fully supplied +f13(); +f13(a); +f13(a, c); +f13(a, c); + +// function with a type parameter without a default and a type parameter with a default that refers to a later type parameter with a default +declare function f14(a?: T, b?: U, c?: V): [T, U, V]; +// inference +f14(); +f14(a); +f14(a, b); +f14(a, b, c); +f14(a, b, d); +// no inference, partially supplied +f14(); +f14(a); +f14(a, b); +f14(a, b, c); +f14(); +f14(a); +f14(a, b); +f14(a, b, c); +// no inference fully supplied +f14(); +f14(a); +f14(a, b); +f14(a, b, d); + +// function with two type parameters with defaults that mutually refer to each other +declare function f15(a?: T, b?: U): [T, U]; +// inference +f15(); +f15(a); +f15(a, b); +// no inference, partially supplied +f15(); +f15(a); +f15(a, a); +// no inference, fully supplied +f15(); +f15(a); +f15(a, b); + +// function with a type parameter without a default and two type parameters with defaults that mutually refer to each other +declare function f16(a?: T, b?: U, c?: V): [T, U, V]; +// no inference +f16(); +f16(a); +f16(a, b); +f16(a, b, b); +// no inference, partially supplied +f16(); +f16(a); +f16(a, b); +f16(a, b, b); +f16(); +f16(a); +f16(a, b); +f16(a, b, b); +// no inference, fully supplied +f16(); +f16(a); +f16(a, b); +f16(a, b, d); + +// function with a type parameter with a default that refers to a later type parameter with a default that refers to an earlier type parameter in a union +declare function f17(a?: T, b?: U): [T, U]; +// inference +f17(); +f17(a); +f17(a, a); +f17(a, b); +f17(a, c); +// no inference, partially supplied +f17(); +f17(a); +f17(a, a); +f17(a, b); +// no inference, fully supplied +f17(); +f17(a); +f17(a, c); + +// function with a type parameter without a default and a type parameter with a default that refers to a later type parameter with a default that refers to an earlier type parameter in a union +declare function f18(a?: T, b?: U, c?: V): [T, U, V]; +// inference +f18(); +f18(a); +f18(a, b); +f18(a, b, b); +f18(a, b, c); +// no inference, partially supplied +f18(); +f18(a); +f18(a, b); +f18(a, b, b); +f18(a, b, c); +f18(); +f18(a); +f18(a, b); +f18(a, b, b); +f18(a, b, c); +// no inference, fully supplied +f18(); +f18(a); +f18(a, b); +f18(a, b, d); + +// function with a type parameter with a default that refers to a later type parameter with a default that refers to an earlier type parameter in an intersection +declare function f19(a?: T, b?: U): [T, U]; +// inference +f19(); +f19(a); +f19(a, a); +f19(a, b); +f19(a, ab); +f19(a, c); +// no inference, partially supplied +f19(); +f19(a); +f19(a, ab); +// no inference, fully supplied +f19(); +f19(a); +f19(a, c); + +// function with a type parameter without a default and a type parameter with a default that refers to a later type parameter with a default that refers to an earlier type parameter in an intersection +declare function f20(a?: T, b?: U, c?: V): [T, U, V]; +// inference +f20(); +f20(a); +f20(a, b); +f20(a, b, c); +// no inference, partially supplied +f20(); +f20(a); +f20(a, b); +f20(a, b, bc); +f20(); +f20(a); +f20(a, b); +f20(a, b, bc); +// no inference, fully supplied +f20(); +f20(a); +f20(a, b); +f20(a, b, d); interface i00 { a: T; } const i00c00 = (x).a; @@ -91,6 +421,15 @@ interface i04 {} interface i04 {} interface i04 {} +interface i05 { a: T; } +const i05c00 = (x).a; +const i05c01 = (>x).a; + +interface i06 { a: [T, U]; } +const i06c00 = (x).a; +const i06c01 = (>x).a; +const i06c02 = (>x).a; + interface Base01 { a: T; } interface Base01Constructor { new (a?: T): Base01; } @@ -114,57 +453,323 @@ const Derived02c03 = new Derived02(1); //// [genericDefaults.js] -var f00c00 = f00(); -var f00c01 = f00(1); -var f00c02 = f00("a"); -var f00c03 = f00(); -var f00c04 = f00(1); -var f00c05 = f00("a"); -var f01c00 = f01(); -var f01c01 = f01(1); -var f01c02 = f01(1, "a"); -var f01c03 = f01(); -var f01c04 = f01(1); -var f01c05 = f01(1, 2); -var f01c06 = f01(); -var f01c07 = f01(1); -var f01c08 = f01(1, "a"); -var f02c00 = f02(); -var f02c01 = f02(1); -var f02c02 = f02(1, "a"); -var f02c03 = f02(); -var f02c04 = f02(1); -var f02c05 = f02(1, 2); -var f02c06 = f02(); -var f02c07 = f02(1); -var f02c08 = f02(1, "a"); -var f03c00 = f03(); -var f03c01 = f03(1); -var f03c02 = f03(1, 1); -var f03c03 = f03(); -var f03c04 = f03(1); -var f03c05 = f03(1, 2); -var f03c06 = f03(); -var f03c07 = f03(1); -var f03c08 = f03(1, 2); -var f04c00 = f04(); -var f04c01 = f04(1); -var f04c02 = f04(1, 1); -var f04c03 = f04(); -var f04c04 = f04(1); -var f04c05 = f04(1, 2); -var f04c06 = f04(); -var f04c07 = f04(1); -var f04c08 = f04(1, 2); -var f05c00 = f05(); -var f05c01 = f05(1); -var f05c02 = f05(1, 1); -var f05c03 = f05(); -var f05c04 = f05(1); -var f05c05 = f05({ a: 1 }, { a: 2, b: 3 }); -var f05c06 = f05(); -var f05c07 = f05(1); -var f05c08 = f05(1, 2); +// no inference +f00(); +f00(a); +// inference +f01(); +f01(a); +// no inference, fully supplied +f01(); +f01(a); +// inference +f02(); +f02(a); +f02(b); +// no inference, fully supplied +f02(); +f02(a); +f02(); +f02(b); +// inference +f03(); +f03(a); +f03(b); +// no inference, fully supplied +f03(); +f03(a); +f03(); +f03(b); +// inference +f04(); +f04(a); +f04(a, b); +f04(a, c); +// no inference, partially supplied +f04(); +f04(a); +f04(a, b); +// no inference, fully supplied +f04(); +f04(a); +f04(a, b); +f04(); +f04(a); +f04(a, c); +// inference +f05(); +f05(a); +f05(a, a); +f05(a, b); +// no inference, partially supplied +f05(); +f05(a); +f05(a, a); +// no inference, fully supplied +f05(); +f05(a); +f05(a, b); +// inference +f06(); +f06(a); +f06(a, a); +f06(a, b); +f06(b, a); +f06(b, b); +// no inference, partially supplied +f06(); +f06(a); +f06(a, a); +f06(); +f06(b); +f06(b, b); +// no inference, fully supplied +f06(); +f06(a); +f06(a, b); +f06(); +f06(b); +f06(b, c); +// inference +f07(); +f07(a, b); +f07(a, c); +f07(a, b, b); +f07(a, b, c); +f07(a, c, b); +f07(a, c, c); +// no inference, partially supplied +f07(); +f07(a); +f07(a, b); +f07(a, b, b); +f07(); +f07(a); +f07(a, b); +f07(a, b, b); +f07(); +f07(a); +f07(a, c); +f07(a, c, c); +// no inference, fully supplied +f07(); +f07(a); +f07(a, b); +f07(a, b, c); +f07(); +f07(a); +f07(a, c); +f07(a, c, d); +// inference +f08(); +f08(a); +f08(a, a); +f08(a, b); +// no inference, partially supplied +f08(); +f08(a); +f08(a, a); +// no inference, fully supplied +f08(); +f08(a); +f08(a, b); +// inference +f09(); +f09(a); +f09(a, a); +f09(a, ab); +// no inference, partially supplied +f09(); +f09(a); +f09(a, a); +f09(a, ab); +// no inference, fully supplied +f09(); +f09(a); +f09(a, ab); +// inference +f10(); +f10(a); +f10(a, a); +f10(a, ab); +// no inference, partially supplied +f10(); +f10(a); +f10(a, a); +f10(a, ab); +// no inference, fully supplied +f10(); +f10(a); +f10(a, a); +f10(a, ab); +f10(); +f10(a); +f10(a, ab); +// inference +f11(); +f11(a); +f11(a, a); +f11(a, b); +f11(a, c); +// no inference, partially supplied +f11(); +f11(a); +f11(a, a); +f11(a, b); +// no inference, fully supplied +f11(); +f11(a); +f11(a, c); +// inference +f12(); +f12(a); +f12(a, a); +f12(a, b); +f12(a, c); +// no inference, partially supplied +f12(); +f12(a); +f12(a, ab); +// no inference, fully supplied +f12(); +f12(a); +f12(a, c); +// inference +f13(); +f13(a); +f13(a, b); +f13(a, c); +// no inference, partially supplied +f13(); +f13(a); +f13(a, b); +// no inference, fully supplied +f13(); +f13(a); +f13(a, c); +f13(a, c); +// inference +f14(); +f14(a); +f14(a, b); +f14(a, b, c); +f14(a, b, d); +// no inference, partially supplied +f14(); +f14(a); +f14(a, b); +f14(a, b, c); +f14(); +f14(a); +f14(a, b); +f14(a, b, c); +// no inference fully supplied +f14(); +f14(a); +f14(a, b); +f14(a, b, d); +// inference +f15(); +f15(a); +f15(a, b); +// no inference, partially supplied +f15(); +f15(a); +f15(a, a); +// no inference, fully supplied +f15(); +f15(a); +f15(a, b); +// no inference +f16(); +f16(a); +f16(a, b); +f16(a, b, b); +// no inference, partially supplied +f16(); +f16(a); +f16(a, b); +f16(a, b, b); +f16(); +f16(a); +f16(a, b); +f16(a, b, b); +// no inference, fully supplied +f16(); +f16(a); +f16(a, b); +f16(a, b, d); +// inference +f17(); +f17(a); +f17(a, a); +f17(a, b); +f17(a, c); +// no inference, partially supplied +f17(); +f17(a); +f17(a, a); +f17(a, b); +// no inference, fully supplied +f17(); +f17(a); +f17(a, c); +// inference +f18(); +f18(a); +f18(a, b); +f18(a, b, b); +f18(a, b, c); +// no inference, partially supplied +f18(); +f18(a); +f18(a, b); +f18(a, b, b); +f18(a, b, c); +f18(); +f18(a); +f18(a, b); +f18(a, b, b); +f18(a, b, c); +// no inference, fully supplied +f18(); +f18(a); +f18(a, b); +f18(a, b, d); +// inference +f19(); +f19(a); +f19(a, a); +f19(a, b); +f19(a, ab); +f19(a, c); +// no inference, partially supplied +f19(); +f19(a); +f19(a, ab); +// no inference, fully supplied +f19(); +f19(a); +f19(a, c); +// inference +f20(); +f20(a); +f20(a, b); +f20(a, b, c); +// no inference, partially supplied +f20(); +f20(a); +f20(a, b); +f20(a, b, bc); +f20(); +f20(a); +f20(a, b); +f20(a, b, bc); +// no inference, fully supplied +f20(); +f20(a); +f20(a, b); +f20(a, b, d); var i00c00 = x.a; var i00c01 = x.a; var i01c00 = x.a; @@ -179,6 +784,11 @@ var i03c01 = x.a; var i03c02 = x.a; var i03c03 = x.a; var i03c04 = x.a; +var i05c00 = x.a; +var i05c01 = x.a; +var i06c00 = x.a; +var i06c01 = x.a; +var i06c02 = x.a; var Base01c00 = new Base01(); var Base01c01 = new Base01(1); var Base01c02 = new Base01(); @@ -194,92 +804,54 @@ var Derived02c03 = new Derived02(1); //// [genericDefaults.d.ts] -declare const x: any; -declare function f00(a?: T): T; -declare const f00c00: number; -declare const f00c01 = 1; -declare const f00c02 = "a"; -declare const f00c03: number; -declare const f00c04: number; -declare const f00c05: string; -declare function f01(a?: T, b?: U): [T, U]; -declare const f01c00: [{}, {}]; -declare const f01c01: [number, number]; -declare const f01c02: [number, string]; -declare const f01c03: [number, number]; -declare const f01c04: [number, number]; -declare const f01c05: [number, number]; -declare const f01c06: [number, string]; -declare const f01c07: [number, string]; -declare const f01c08: [number, string]; -declare function f02(a?: T, b?: U): [T, U]; -declare const f02c00: [number, number]; -declare const f02c01: [1, 1]; -declare const f02c02: [1, string]; -declare const f02c03: [number, number]; -declare const f02c04: [number, number]; -declare const f02c05: [number, number]; -declare const f02c06: [number, string]; -declare const f02c07: [number, string]; -declare const f02c08: [number, string]; -declare function f03(a?: T, b?: U): [T, U]; -declare const f03c00: [number, number]; -declare const f03c01: [1, 1]; -declare const f03c02: [1, 1]; -declare const f03c03: [number, number]; -declare const f03c04: [number, number]; -declare const f03c05: [number, number]; -declare const f03c06: [number, number]; -declare const f03c07: [number, number]; -declare const f03c08: [number, number]; -declare function f04(a?: T, b?: U): [T, U]; -declare const f04c00: [{}, {} | { - a: number; -}]; -declare const f04c01: [number, number | { - a: number; -}]; -declare const f04c02: [number, number]; -declare const f04c03: [number, number | { - a: number; -}]; -declare const f04c04: [number, number | { - a: number; -}]; -declare const f04c05: [number, number | { +interface A { a: number; -}]; -declare const f04c06: [number, number]; -declare const f04c07: [number, number]; -declare const f04c08: [number, number]; -declare function f05(a?: T, b?: U): [T, U]; -declare const f05c00: [{}, {} & { - b: number; -}]; -declare const f05c01: [number, number & { - b: number; -}]; -declare const f05c02: [number, number]; -declare const f05c03: [number, number & { - b: number; -}]; -declare const f05c04: [number, number & { +} +interface B { b: number; -}]; -declare const f05c05: [{ - a: number; -}, { +} +interface C { + c: number; +} +interface D { + d: number; +} +interface AB { a: number; -} & { b: number; -}]; -declare const f05c06: [number, number]; -declare const f05c07: [number, number]; -declare const f05c08: [number, number]; +} +interface BC { + b: number; + c: number; +} +declare const a: A; +declare const b: B; +declare const c: C; +declare const d: D; +declare const ab: AB; +declare const bc: BC; +declare const x: any; +declare function f00(a?: A): A; +declare function f01(a?: T): T; +declare function f02(a?: T): T; +declare function f03(a?: T): T; +declare function f04(a?: T, b?: U): [T, U]; +declare function f05(a?: T, b?: U): [T, U]; +declare function f06(a?: T, b?: U): [T, U]; +declare function f07(a?: T, b?: U, c?: V): [T, U, V]; +declare function f08(a?: T, b?: U): [T, U]; +declare function f09(a?: T, b?: U): [T, U]; +declare function f10(a?: T, b?: U): [T, U]; +declare function f11(a?: T, b?: U): [T, U]; +declare function f12(a?: T, b?: U): [T, U]; +declare function f13(a?: T, b?: U): [T, U]; +declare function f14(a?: T, b?: U, c?: V): [T, U, V]; +declare function f15(a?: T, b?: U): [T, U]; +declare function f16(a?: T, b?: U, c?: V): [T, U, V]; +declare function f17(a?: T, b?: U): [T, U]; +declare function f18(a?: T, b?: U, c?: V): [T, U, V]; +declare function f19(a?: T, b?: U): [T, U]; +declare function f20(a?: T, b?: U, c?: V): [T, U, V]; interface i00 { a: T; } @@ -314,6 +886,17 @@ interface i04 { } interface i04 { } +interface i05 { + a: T; +} +declare const i05c00: {}; +declare const i05c01: number; +interface i06 { + a: [T, U]; +} +declare const i06c00: [{}, {}]; +declare const i06c01: [number, number]; +declare const i06c02: [number, string]; interface Base01 { a: T; } diff --git a/tests/baselines/reference/genericDefaults.symbols b/tests/baselines/reference/genericDefaults.symbols index 0a633e6061220..ea0f280a1f15d 100644 --- a/tests/baselines/reference/genericDefaults.symbols +++ b/tests/baselines/reference/genericDefaults.symbols @@ -1,508 +1,2084 @@ === tests/cases/compiler/genericDefaults.ts === +interface A { a: number; } +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(A.a, Decl(genericDefaults.ts, 0, 13)) + +interface B { b: number; } +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>b : Symbol(B.b, Decl(genericDefaults.ts, 1, 13)) + +interface C { c: number; } +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) +>c : Symbol(C.c, Decl(genericDefaults.ts, 2, 13)) + +interface D { d: number; } +>D : Symbol(D, Decl(genericDefaults.ts, 2, 26)) +>d : Symbol(D.d, Decl(genericDefaults.ts, 3, 13)) + +interface AB { a: number; b: number; } +>AB : Symbol(AB, Decl(genericDefaults.ts, 3, 26)) +>a : Symbol(AB.a, Decl(genericDefaults.ts, 4, 14)) +>b : Symbol(AB.b, Decl(genericDefaults.ts, 4, 25)) + +interface BC { b: number; c: number; } +>BC : Symbol(BC, Decl(genericDefaults.ts, 4, 38)) +>b : Symbol(BC.b, Decl(genericDefaults.ts, 5, 14)) +>c : Symbol(BC.c, Decl(genericDefaults.ts, 5, 25)) + +declare const a: A; +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) + +declare const b: B; +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) + +declare const c: C; +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) + +declare const d: D; +>d : Symbol(d, Decl(genericDefaults.ts, 10, 13)) +>D : Symbol(D, Decl(genericDefaults.ts, 2, 26)) + +declare const ab: AB; +>ab : Symbol(ab, Decl(genericDefaults.ts, 11, 13)) +>AB : Symbol(AB, Decl(genericDefaults.ts, 3, 26)) + +declare const bc: BC; +>bc : Symbol(bc, Decl(genericDefaults.ts, 12, 13)) +>BC : Symbol(BC, Decl(genericDefaults.ts, 4, 38)) + declare const x: any; ->x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) - -declare function f00(a?: T): T; ->f00 : Symbol(f00, Decl(genericDefaults.ts, 0, 21)) ->T : Symbol(T, Decl(genericDefaults.ts, 2, 21)) ->a : Symbol(a, Decl(genericDefaults.ts, 2, 33)) ->T : Symbol(T, Decl(genericDefaults.ts, 2, 21)) ->T : Symbol(T, Decl(genericDefaults.ts, 2, 21)) - -const f00c00 = f00(); ->f00c00 : Symbol(f00c00, Decl(genericDefaults.ts, 3, 5)) ->f00 : Symbol(f00, Decl(genericDefaults.ts, 0, 21)) - -const f00c01 = f00(1); ->f00c01 : Symbol(f00c01, Decl(genericDefaults.ts, 4, 5)) ->f00 : Symbol(f00, Decl(genericDefaults.ts, 0, 21)) - -const f00c02 = f00("a"); ->f00c02 : Symbol(f00c02, Decl(genericDefaults.ts, 5, 5)) ->f00 : Symbol(f00, Decl(genericDefaults.ts, 0, 21)) - -const f00c03 = f00(); ->f00c03 : Symbol(f00c03, Decl(genericDefaults.ts, 6, 5)) ->f00 : Symbol(f00, Decl(genericDefaults.ts, 0, 21)) - -const f00c04 = f00(1); ->f00c04 : Symbol(f00c04, Decl(genericDefaults.ts, 7, 5)) ->f00 : Symbol(f00, Decl(genericDefaults.ts, 0, 21)) - -const f00c05 = f00("a"); ->f00c05 : Symbol(f00c05, Decl(genericDefaults.ts, 8, 5)) ->f00 : Symbol(f00, Decl(genericDefaults.ts, 0, 21)) - -declare function f01(a?: T, b?: U): [T, U]; ->f01 : Symbol(f01, Decl(genericDefaults.ts, 8, 32)) ->T : Symbol(T, Decl(genericDefaults.ts, 10, 21)) ->U : Symbol(U, Decl(genericDefaults.ts, 10, 23)) ->T : Symbol(T, Decl(genericDefaults.ts, 10, 21)) ->a : Symbol(a, Decl(genericDefaults.ts, 10, 31)) ->T : Symbol(T, Decl(genericDefaults.ts, 10, 21)) ->b : Symbol(b, Decl(genericDefaults.ts, 10, 37)) ->U : Symbol(U, Decl(genericDefaults.ts, 10, 23)) ->T : Symbol(T, Decl(genericDefaults.ts, 10, 21)) ->U : Symbol(U, Decl(genericDefaults.ts, 10, 23)) - -const f01c00 = f01(); ->f01c00 : Symbol(f01c00, Decl(genericDefaults.ts, 11, 5)) ->f01 : Symbol(f01, Decl(genericDefaults.ts, 8, 32)) - -const f01c01 = f01(1); ->f01c01 : Symbol(f01c01, Decl(genericDefaults.ts, 12, 5)) ->f01 : Symbol(f01, Decl(genericDefaults.ts, 8, 32)) - -const f01c02 = f01(1, "a"); ->f01c02 : Symbol(f01c02, Decl(genericDefaults.ts, 13, 5)) ->f01 : Symbol(f01, Decl(genericDefaults.ts, 8, 32)) - -const f01c03 = f01(); ->f01c03 : Symbol(f01c03, Decl(genericDefaults.ts, 14, 5)) ->f01 : Symbol(f01, Decl(genericDefaults.ts, 8, 32)) - -const f01c04 = f01(1); ->f01c04 : Symbol(f01c04, Decl(genericDefaults.ts, 15, 5)) ->f01 : Symbol(f01, Decl(genericDefaults.ts, 8, 32)) - -const f01c05 = f01(1, 2); ->f01c05 : Symbol(f01c05, Decl(genericDefaults.ts, 16, 5)) ->f01 : Symbol(f01, Decl(genericDefaults.ts, 8, 32)) - -const f01c06 = f01(); ->f01c06 : Symbol(f01c06, Decl(genericDefaults.ts, 17, 5)) ->f01 : Symbol(f01, Decl(genericDefaults.ts, 8, 32)) - -const f01c07 = f01(1); ->f01c07 : Symbol(f01c07, Decl(genericDefaults.ts, 18, 5)) ->f01 : Symbol(f01, Decl(genericDefaults.ts, 8, 32)) - -const f01c08 = f01(1, "a"); ->f01c08 : Symbol(f01c08, Decl(genericDefaults.ts, 19, 5)) ->f01 : Symbol(f01, Decl(genericDefaults.ts, 8, 32)) - -declare function f02(a?: T, b?: U): [T, U]; ->f02 : Symbol(f02, Decl(genericDefaults.ts, 19, 43)) ->T : Symbol(T, Decl(genericDefaults.ts, 21, 21)) ->U : Symbol(U, Decl(genericDefaults.ts, 21, 38)) ->T : Symbol(T, Decl(genericDefaults.ts, 21, 21)) ->a : Symbol(a, Decl(genericDefaults.ts, 21, 46)) ->T : Symbol(T, Decl(genericDefaults.ts, 21, 21)) ->b : Symbol(b, Decl(genericDefaults.ts, 21, 52)) ->U : Symbol(U, Decl(genericDefaults.ts, 21, 38)) ->T : Symbol(T, Decl(genericDefaults.ts, 21, 21)) ->U : Symbol(U, Decl(genericDefaults.ts, 21, 38)) - -const f02c00 = f02(); ->f02c00 : Symbol(f02c00, Decl(genericDefaults.ts, 22, 5)) ->f02 : Symbol(f02, Decl(genericDefaults.ts, 19, 43)) - -const f02c01 = f02(1); ->f02c01 : Symbol(f02c01, Decl(genericDefaults.ts, 23, 5)) ->f02 : Symbol(f02, Decl(genericDefaults.ts, 19, 43)) - -const f02c02 = f02(1, "a"); ->f02c02 : Symbol(f02c02, Decl(genericDefaults.ts, 24, 5)) ->f02 : Symbol(f02, Decl(genericDefaults.ts, 19, 43)) - -const f02c03 = f02(); ->f02c03 : Symbol(f02c03, Decl(genericDefaults.ts, 25, 5)) ->f02 : Symbol(f02, Decl(genericDefaults.ts, 19, 43)) - -const f02c04 = f02(1); ->f02c04 : Symbol(f02c04, Decl(genericDefaults.ts, 26, 5)) ->f02 : Symbol(f02, Decl(genericDefaults.ts, 19, 43)) - -const f02c05 = f02(1, 2); ->f02c05 : Symbol(f02c05, Decl(genericDefaults.ts, 27, 5)) ->f02 : Symbol(f02, Decl(genericDefaults.ts, 19, 43)) - -const f02c06 = f02(); ->f02c06 : Symbol(f02c06, Decl(genericDefaults.ts, 28, 5)) ->f02 : Symbol(f02, Decl(genericDefaults.ts, 19, 43)) - -const f02c07 = f02(1); ->f02c07 : Symbol(f02c07, Decl(genericDefaults.ts, 29, 5)) ->f02 : Symbol(f02, Decl(genericDefaults.ts, 19, 43)) - -const f02c08 = f02(1, "a"); ->f02c08 : Symbol(f02c08, Decl(genericDefaults.ts, 30, 5)) ->f02 : Symbol(f02, Decl(genericDefaults.ts, 19, 43)) - -declare function f03(a?: T, b?: U): [T, U]; ->f03 : Symbol(f03, Decl(genericDefaults.ts, 30, 43)) ->T : Symbol(T, Decl(genericDefaults.ts, 32, 21)) ->U : Symbol(U, Decl(genericDefaults.ts, 32, 38)) ->T : Symbol(T, Decl(genericDefaults.ts, 32, 21)) ->T : Symbol(T, Decl(genericDefaults.ts, 32, 21)) ->a : Symbol(a, Decl(genericDefaults.ts, 32, 56)) ->T : Symbol(T, Decl(genericDefaults.ts, 32, 21)) ->b : Symbol(b, Decl(genericDefaults.ts, 32, 62)) ->U : Symbol(U, Decl(genericDefaults.ts, 32, 38)) ->T : Symbol(T, Decl(genericDefaults.ts, 32, 21)) ->U : Symbol(U, Decl(genericDefaults.ts, 32, 38)) - -const f03c00 = f03(); ->f03c00 : Symbol(f03c00, Decl(genericDefaults.ts, 33, 5)) ->f03 : Symbol(f03, Decl(genericDefaults.ts, 30, 43)) - -const f03c01 = f03(1); ->f03c01 : Symbol(f03c01, Decl(genericDefaults.ts, 34, 5)) ->f03 : Symbol(f03, Decl(genericDefaults.ts, 30, 43)) - -const f03c02 = f03(1, 1); ->f03c02 : Symbol(f03c02, Decl(genericDefaults.ts, 35, 5)) ->f03 : Symbol(f03, Decl(genericDefaults.ts, 30, 43)) - -const f03c03 = f03(); ->f03c03 : Symbol(f03c03, Decl(genericDefaults.ts, 36, 5)) ->f03 : Symbol(f03, Decl(genericDefaults.ts, 30, 43)) - -const f03c04 = f03(1); ->f03c04 : Symbol(f03c04, Decl(genericDefaults.ts, 37, 5)) ->f03 : Symbol(f03, Decl(genericDefaults.ts, 30, 43)) - -const f03c05 = f03(1, 2); ->f03c05 : Symbol(f03c05, Decl(genericDefaults.ts, 38, 5)) ->f03 : Symbol(f03, Decl(genericDefaults.ts, 30, 43)) - -const f03c06 = f03(); ->f03c06 : Symbol(f03c06, Decl(genericDefaults.ts, 39, 5)) ->f03 : Symbol(f03, Decl(genericDefaults.ts, 30, 43)) - -const f03c07 = f03(1); ->f03c07 : Symbol(f03c07, Decl(genericDefaults.ts, 40, 5)) ->f03 : Symbol(f03, Decl(genericDefaults.ts, 30, 43)) - -const f03c08 = f03(1, 2); ->f03c08 : Symbol(f03c08, Decl(genericDefaults.ts, 41, 5)) ->f03 : Symbol(f03, Decl(genericDefaults.ts, 30, 43)) - -declare function f04(a?: T, b?: U): [T, U]; ->f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41)) +>x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) + +// function without type parameters +declare function f00(a?: A): A; +>f00 : Symbol(f00, Decl(genericDefaults.ts, 13, 21)) +>a : Symbol(a, Decl(genericDefaults.ts, 16, 21)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) + +// no inference +f00(); +>f00 : Symbol(f00, Decl(genericDefaults.ts, 13, 21)) + +f00(a); +>f00 : Symbol(f00, Decl(genericDefaults.ts, 13, 21)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +// function with a type parameter without a default +declare function f01(a?: T): T; +>f01 : Symbol(f01, Decl(genericDefaults.ts, 19, 7)) +>T : Symbol(T, Decl(genericDefaults.ts, 22, 21)) +>a : Symbol(a, Decl(genericDefaults.ts, 22, 24)) +>T : Symbol(T, Decl(genericDefaults.ts, 22, 21)) +>T : Symbol(T, Decl(genericDefaults.ts, 22, 21)) + +// inference +f01(); +>f01 : Symbol(f01, Decl(genericDefaults.ts, 19, 7)) + +f01(a); +>f01 : Symbol(f01, Decl(genericDefaults.ts, 19, 7)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +// no inference, fully supplied +f01(); +>f01 : Symbol(f01, Decl(genericDefaults.ts, 19, 7)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) + +f01(a); +>f01 : Symbol(f01, Decl(genericDefaults.ts, 19, 7)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +// function with a type paramter with a default +declare function f02(a?: T): T; +>f02 : Symbol(f02, Decl(genericDefaults.ts, 28, 10)) +>T : Symbol(T, Decl(genericDefaults.ts, 31, 21)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 31, 28)) +>T : Symbol(T, Decl(genericDefaults.ts, 31, 21)) +>T : Symbol(T, Decl(genericDefaults.ts, 31, 21)) + +// inference +f02(); +>f02 : Symbol(f02, Decl(genericDefaults.ts, 28, 10)) + +f02(a); +>f02 : Symbol(f02, Decl(genericDefaults.ts, 28, 10)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f02(b); +>f02 : Symbol(f02, Decl(genericDefaults.ts, 28, 10)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +// no inference, fully supplied +f02(); +>f02 : Symbol(f02, Decl(genericDefaults.ts, 28, 10)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) + +f02(a); +>f02 : Symbol(f02, Decl(genericDefaults.ts, 28, 10)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f02(); +>f02 : Symbol(f02, Decl(genericDefaults.ts, 28, 10)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) + +f02(b); +>f02 : Symbol(f02, Decl(genericDefaults.ts, 28, 10)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +// function with a type parameter with a default that refers to itself +declare function f03(a?: T): T; +>f03 : Symbol(f03, Decl(genericDefaults.ts, 40, 10)) >T : Symbol(T, Decl(genericDefaults.ts, 43, 21)) ->U : Symbol(U, Decl(genericDefaults.ts, 43, 23)) >T : Symbol(T, Decl(genericDefaults.ts, 43, 21)) ->a : Symbol(a, Decl(genericDefaults.ts, 43, 33)) ->a : Symbol(a, Decl(genericDefaults.ts, 43, 47)) +>a : Symbol(a, Decl(genericDefaults.ts, 43, 28)) >T : Symbol(T, Decl(genericDefaults.ts, 43, 21)) ->b : Symbol(b, Decl(genericDefaults.ts, 43, 53)) ->U : Symbol(U, Decl(genericDefaults.ts, 43, 23)) >T : Symbol(T, Decl(genericDefaults.ts, 43, 21)) ->U : Symbol(U, Decl(genericDefaults.ts, 43, 23)) - -const f04c00 = f04(); ->f04c00 : Symbol(f04c00, Decl(genericDefaults.ts, 44, 5)) ->f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41)) - -const f04c01 = f04(1); ->f04c01 : Symbol(f04c01, Decl(genericDefaults.ts, 45, 5)) ->f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41)) - -const f04c02 = f04(1, 1); ->f04c02 : Symbol(f04c02, Decl(genericDefaults.ts, 46, 5)) ->f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41)) - -const f04c03 = f04(); ->f04c03 : Symbol(f04c03, Decl(genericDefaults.ts, 47, 5)) ->f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41)) - -const f04c04 = f04(1); ->f04c04 : Symbol(f04c04, Decl(genericDefaults.ts, 48, 5)) ->f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41)) - -const f04c05 = f04(1, 2); ->f04c05 : Symbol(f04c05, Decl(genericDefaults.ts, 49, 5)) ->f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41)) - -const f04c06 = f04(); ->f04c06 : Symbol(f04c06, Decl(genericDefaults.ts, 50, 5)) ->f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41)) - -const f04c07 = f04(1); ->f04c07 : Symbol(f04c07, Decl(genericDefaults.ts, 51, 5)) ->f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41)) - -const f04c08 = f04(1, 2); ->f04c08 : Symbol(f04c08, Decl(genericDefaults.ts, 52, 5)) ->f04 : Symbol(f04, Decl(genericDefaults.ts, 41, 41)) - -declare function f05(a?: T, b?: U): [T, U]; ->f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41)) ->T : Symbol(T, Decl(genericDefaults.ts, 54, 21)) ->U : Symbol(U, Decl(genericDefaults.ts, 54, 23)) ->T : Symbol(T, Decl(genericDefaults.ts, 54, 21)) ->b : Symbol(b, Decl(genericDefaults.ts, 54, 33)) ->a : Symbol(a, Decl(genericDefaults.ts, 54, 47)) ->T : Symbol(T, Decl(genericDefaults.ts, 54, 21)) ->b : Symbol(b, Decl(genericDefaults.ts, 54, 53)) ->U : Symbol(U, Decl(genericDefaults.ts, 54, 23)) ->T : Symbol(T, Decl(genericDefaults.ts, 54, 21)) ->U : Symbol(U, Decl(genericDefaults.ts, 54, 23)) - -const f05c00 = f05(); ->f05c00 : Symbol(f05c00, Decl(genericDefaults.ts, 55, 5)) ->f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41)) - -const f05c01 = f05(1); ->f05c01 : Symbol(f05c01, Decl(genericDefaults.ts, 56, 5)) ->f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41)) - -const f05c02 = f05(1, 1); ->f05c02 : Symbol(f05c02, Decl(genericDefaults.ts, 57, 5)) ->f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41)) - -const f05c03 = f05(); ->f05c03 : Symbol(f05c03, Decl(genericDefaults.ts, 58, 5)) ->f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41)) - -const f05c04 = f05(1); ->f05c04 : Symbol(f05c04, Decl(genericDefaults.ts, 59, 5)) ->f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41)) - -const f05c05 = f05<{ a: number }>({ a: 1 }, { a: 2, b: 3}); ->f05c05 : Symbol(f05c05, Decl(genericDefaults.ts, 60, 5)) ->f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41)) ->a : Symbol(a, Decl(genericDefaults.ts, 60, 20)) ->a : Symbol(a, Decl(genericDefaults.ts, 60, 35)) ->a : Symbol(a, Decl(genericDefaults.ts, 60, 45)) ->b : Symbol(b, Decl(genericDefaults.ts, 60, 51)) - -const f05c06 = f05(); ->f05c06 : Symbol(f05c06, Decl(genericDefaults.ts, 61, 5)) ->f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41)) - -const f05c07 = f05(1); ->f05c07 : Symbol(f05c07, Decl(genericDefaults.ts, 62, 5)) ->f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41)) - -const f05c08 = f05(1, 2); ->f05c08 : Symbol(f05c08, Decl(genericDefaults.ts, 63, 5)) ->f05 : Symbol(f05, Decl(genericDefaults.ts, 52, 41)) + +// inference +f03(); +>f03 : Symbol(f03, Decl(genericDefaults.ts, 40, 10)) + +f03(a); +>f03 : Symbol(f03, Decl(genericDefaults.ts, 40, 10)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f03(b); +>f03 : Symbol(f03, Decl(genericDefaults.ts, 40, 10)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +// no inference, fully supplied +f03(); +>f03 : Symbol(f03, Decl(genericDefaults.ts, 40, 10)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) + +f03(a); +>f03 : Symbol(f03, Decl(genericDefaults.ts, 40, 10)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f03(); +>f03 : Symbol(f03, Decl(genericDefaults.ts, 40, 10)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) + +f03(b); +>f03 : Symbol(f03, Decl(genericDefaults.ts, 40, 10)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +// function with a type paramter without a default and a type parameter with a default +declare function f04(a?: T, b?: U): [T, U]; +>f04 : Symbol(f04, Decl(genericDefaults.ts, 52, 10)) +>T : Symbol(T, Decl(genericDefaults.ts, 55, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 55, 23)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 55, 31)) +>T : Symbol(T, Decl(genericDefaults.ts, 55, 21)) +>b : Symbol(b, Decl(genericDefaults.ts, 55, 37)) +>U : Symbol(U, Decl(genericDefaults.ts, 55, 23)) +>T : Symbol(T, Decl(genericDefaults.ts, 55, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 55, 23)) + +// inference +f04(); +>f04 : Symbol(f04, Decl(genericDefaults.ts, 52, 10)) + +f04(a); +>f04 : Symbol(f04, Decl(genericDefaults.ts, 52, 10)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f04(a, b); +>f04 : Symbol(f04, Decl(genericDefaults.ts, 52, 10)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f04(a, c); +>f04 : Symbol(f04, Decl(genericDefaults.ts, 52, 10)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) + +// no inference, partially supplied +f04(); +>f04 : Symbol(f04, Decl(genericDefaults.ts, 52, 10)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) + +f04(a); +>f04 : Symbol(f04, Decl(genericDefaults.ts, 52, 10)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f04(a, b); +>f04 : Symbol(f04, Decl(genericDefaults.ts, 52, 10)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +// no inference, fully supplied +f04(); +>f04 : Symbol(f04, Decl(genericDefaults.ts, 52, 10)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) + +f04(a); +>f04 : Symbol(f04, Decl(genericDefaults.ts, 52, 10)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f04(a, b); +>f04 : Symbol(f04, Decl(genericDefaults.ts, 52, 10)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f04(); +>f04 : Symbol(f04, Decl(genericDefaults.ts, 52, 10)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) + +f04(a); +>f04 : Symbol(f04, Decl(genericDefaults.ts, 52, 10)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f04(a, c); +>f04 : Symbol(f04, Decl(genericDefaults.ts, 52, 10)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) + +// function with a type parameter without a default and a type parameter with a default that refers to an earlier type parameter +declare function f05(a?: T, b?: U): [T, U]; +>f05 : Symbol(f05, Decl(genericDefaults.ts, 71, 16)) +>T : Symbol(T, Decl(genericDefaults.ts, 74, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 74, 23)) +>T : Symbol(T, Decl(genericDefaults.ts, 74, 21)) +>a : Symbol(a, Decl(genericDefaults.ts, 74, 31)) +>T : Symbol(T, Decl(genericDefaults.ts, 74, 21)) +>b : Symbol(b, Decl(genericDefaults.ts, 74, 37)) +>U : Symbol(U, Decl(genericDefaults.ts, 74, 23)) +>T : Symbol(T, Decl(genericDefaults.ts, 74, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 74, 23)) + +// inference +f05(); +>f05 : Symbol(f05, Decl(genericDefaults.ts, 71, 16)) + +f05(a); +>f05 : Symbol(f05, Decl(genericDefaults.ts, 71, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f05(a, a); +>f05 : Symbol(f05, Decl(genericDefaults.ts, 71, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f05(a, b); +>f05 : Symbol(f05, Decl(genericDefaults.ts, 71, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +// no inference, partially supplied +f05(); +>f05 : Symbol(f05, Decl(genericDefaults.ts, 71, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) + +f05(a); +>f05 : Symbol(f05, Decl(genericDefaults.ts, 71, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f05(a, a); +>f05 : Symbol(f05, Decl(genericDefaults.ts, 71, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +// no inference, fully supplied +f05(); +>f05 : Symbol(f05, Decl(genericDefaults.ts, 71, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) + +f05(a); +>f05 : Symbol(f05, Decl(genericDefaults.ts, 71, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f05(a, b); +>f05 : Symbol(f05, Decl(genericDefaults.ts, 71, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +// function with a type parameter with a default that refers to an earlier type parameter with a default +declare function f06(a?: T, b?: U): [T, U]; +>f06 : Symbol(f06, Decl(genericDefaults.ts, 87, 16)) +>T : Symbol(T, Decl(genericDefaults.ts, 90, 21)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>U : Symbol(U, Decl(genericDefaults.ts, 90, 27)) +>T : Symbol(T, Decl(genericDefaults.ts, 90, 21)) +>a : Symbol(a, Decl(genericDefaults.ts, 90, 35)) +>T : Symbol(T, Decl(genericDefaults.ts, 90, 21)) +>b : Symbol(b, Decl(genericDefaults.ts, 90, 41)) +>U : Symbol(U, Decl(genericDefaults.ts, 90, 27)) +>T : Symbol(T, Decl(genericDefaults.ts, 90, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 90, 27)) + +// inference +f06(); +>f06 : Symbol(f06, Decl(genericDefaults.ts, 87, 16)) + +f06(a); +>f06 : Symbol(f06, Decl(genericDefaults.ts, 87, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f06(a, a); +>f06 : Symbol(f06, Decl(genericDefaults.ts, 87, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f06(a, b); +>f06 : Symbol(f06, Decl(genericDefaults.ts, 87, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f06(b, a); +>f06 : Symbol(f06, Decl(genericDefaults.ts, 87, 16)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f06(b, b); +>f06 : Symbol(f06, Decl(genericDefaults.ts, 87, 16)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +// no inference, partially supplied +f06(); +>f06 : Symbol(f06, Decl(genericDefaults.ts, 87, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) + +f06(a); +>f06 : Symbol(f06, Decl(genericDefaults.ts, 87, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f06(a, a); +>f06 : Symbol(f06, Decl(genericDefaults.ts, 87, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f06(); +>f06 : Symbol(f06, Decl(genericDefaults.ts, 87, 16)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) + +f06(b); +>f06 : Symbol(f06, Decl(genericDefaults.ts, 87, 16)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f06(b, b); +>f06 : Symbol(f06, Decl(genericDefaults.ts, 87, 16)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +// no inference, fully supplied +f06(); +>f06 : Symbol(f06, Decl(genericDefaults.ts, 87, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) + +f06(a); +>f06 : Symbol(f06, Decl(genericDefaults.ts, 87, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f06(a, b); +>f06 : Symbol(f06, Decl(genericDefaults.ts, 87, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f06(); +>f06 : Symbol(f06, Decl(genericDefaults.ts, 87, 16)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) + +f06(b); +>f06 : Symbol(f06, Decl(genericDefaults.ts, 87, 16)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f06(b, c); +>f06 : Symbol(f06, Decl(genericDefaults.ts, 87, 16)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) + +// function with a type parameter without a default and a type parameter with a default that refers to an earlier type parameter with a default +declare function f07(a?: T, b?: U, c?: V): [T, U, V]; +>f07 : Symbol(f07, Decl(genericDefaults.ts, 111, 16)) +>T : Symbol(T, Decl(genericDefaults.ts, 114, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 114, 23)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>V : Symbol(V, Decl(genericDefaults.ts, 114, 30)) +>U : Symbol(U, Decl(genericDefaults.ts, 114, 23)) +>a : Symbol(a, Decl(genericDefaults.ts, 114, 38)) +>T : Symbol(T, Decl(genericDefaults.ts, 114, 21)) +>b : Symbol(b, Decl(genericDefaults.ts, 114, 44)) +>U : Symbol(U, Decl(genericDefaults.ts, 114, 23)) +>c : Symbol(c, Decl(genericDefaults.ts, 114, 51)) +>V : Symbol(V, Decl(genericDefaults.ts, 114, 30)) +>T : Symbol(T, Decl(genericDefaults.ts, 114, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 114, 23)) +>V : Symbol(V, Decl(genericDefaults.ts, 114, 30)) + +// inference +f07(); +>f07 : Symbol(f07, Decl(genericDefaults.ts, 111, 16)) + +f07(a, b); +>f07 : Symbol(f07, Decl(genericDefaults.ts, 111, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f07(a, c); +>f07 : Symbol(f07, Decl(genericDefaults.ts, 111, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) + +f07(a, b, b); +>f07 : Symbol(f07, Decl(genericDefaults.ts, 111, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f07(a, b, c); +>f07 : Symbol(f07, Decl(genericDefaults.ts, 111, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) + +f07(a, c, b); +>f07 : Symbol(f07, Decl(genericDefaults.ts, 111, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f07(a, c, c); +>f07 : Symbol(f07, Decl(genericDefaults.ts, 111, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) + +// no inference, partially supplied +f07(); +>f07 : Symbol(f07, Decl(genericDefaults.ts, 111, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) + +f07(a); +>f07 : Symbol(f07, Decl(genericDefaults.ts, 111, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f07(a, b); +>f07 : Symbol(f07, Decl(genericDefaults.ts, 111, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f07(a, b, b); +>f07 : Symbol(f07, Decl(genericDefaults.ts, 111, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f07(); +>f07 : Symbol(f07, Decl(genericDefaults.ts, 111, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) + +f07(a); +>f07 : Symbol(f07, Decl(genericDefaults.ts, 111, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f07(a, b); +>f07 : Symbol(f07, Decl(genericDefaults.ts, 111, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f07(a, b, b); +>f07 : Symbol(f07, Decl(genericDefaults.ts, 111, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f07(); +>f07 : Symbol(f07, Decl(genericDefaults.ts, 111, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) + +f07(a); +>f07 : Symbol(f07, Decl(genericDefaults.ts, 111, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f07(a, c); +>f07 : Symbol(f07, Decl(genericDefaults.ts, 111, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) + +f07(a, c, c); +>f07 : Symbol(f07, Decl(genericDefaults.ts, 111, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) + +// no inference, fully supplied +f07(); +>f07 : Symbol(f07, Decl(genericDefaults.ts, 111, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) + +f07(a); +>f07 : Symbol(f07, Decl(genericDefaults.ts, 111, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f07(a, b); +>f07 : Symbol(f07, Decl(genericDefaults.ts, 111, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f07(a, b, c); +>f07 : Symbol(f07, Decl(genericDefaults.ts, 111, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) + +f07(); +>f07 : Symbol(f07, Decl(genericDefaults.ts, 111, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) + +f07(a); +>f07 : Symbol(f07, Decl(genericDefaults.ts, 111, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f07(a, c); +>f07 : Symbol(f07, Decl(genericDefaults.ts, 111, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) +>D : Symbol(D, Decl(genericDefaults.ts, 2, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) + +f07(a, c, d); +>f07 : Symbol(f07, Decl(genericDefaults.ts, 111, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) +>D : Symbol(D, Decl(genericDefaults.ts, 2, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) +>d : Symbol(d, Decl(genericDefaults.ts, 10, 13)) + +// function with a type parameter with a default that refers to an earlier type parameter with a constraint +declare function f08(a?: T, b?: U): [T, U]; +>f08 : Symbol(f08, Decl(genericDefaults.ts, 144, 22)) +>T : Symbol(T, Decl(genericDefaults.ts, 147, 21)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>U : Symbol(U, Decl(genericDefaults.ts, 147, 33)) +>T : Symbol(T, Decl(genericDefaults.ts, 147, 21)) +>a : Symbol(a, Decl(genericDefaults.ts, 147, 41)) +>T : Symbol(T, Decl(genericDefaults.ts, 147, 21)) +>b : Symbol(b, Decl(genericDefaults.ts, 147, 47)) +>U : Symbol(U, Decl(genericDefaults.ts, 147, 33)) +>T : Symbol(T, Decl(genericDefaults.ts, 147, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 147, 33)) + +// inference +f08(); +>f08 : Symbol(f08, Decl(genericDefaults.ts, 144, 22)) + +f08(a); +>f08 : Symbol(f08, Decl(genericDefaults.ts, 144, 22)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f08(a, a); +>f08 : Symbol(f08, Decl(genericDefaults.ts, 144, 22)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f08(a, b); +>f08 : Symbol(f08, Decl(genericDefaults.ts, 144, 22)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +// no inference, partially supplied +f08(); +>f08 : Symbol(f08, Decl(genericDefaults.ts, 144, 22)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) + +f08(a); +>f08 : Symbol(f08, Decl(genericDefaults.ts, 144, 22)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f08(a, a); +>f08 : Symbol(f08, Decl(genericDefaults.ts, 144, 22)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +// no inference, fully supplied +f08(); +>f08 : Symbol(f08, Decl(genericDefaults.ts, 144, 22)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) + +f08(a); +>f08 : Symbol(f08, Decl(genericDefaults.ts, 144, 22)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f08(a, b); +>f08 : Symbol(f08, Decl(genericDefaults.ts, 144, 22)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +// function with a type parameter with a constraint and a default that refers to an earlier type parameter +declare function f09(a?: T, b?: U): [T, U]; +>f09 : Symbol(f09, Decl(genericDefaults.ts, 160, 16)) +>T : Symbol(T, Decl(genericDefaults.ts, 163, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 163, 23)) +>T : Symbol(T, Decl(genericDefaults.ts, 163, 21)) +>T : Symbol(T, Decl(genericDefaults.ts, 163, 21)) +>a : Symbol(a, Decl(genericDefaults.ts, 163, 41)) +>T : Symbol(T, Decl(genericDefaults.ts, 163, 21)) +>b : Symbol(b, Decl(genericDefaults.ts, 163, 47)) +>U : Symbol(U, Decl(genericDefaults.ts, 163, 23)) +>T : Symbol(T, Decl(genericDefaults.ts, 163, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 163, 23)) + +// inference +f09(); +>f09 : Symbol(f09, Decl(genericDefaults.ts, 160, 16)) + +f09(a); +>f09 : Symbol(f09, Decl(genericDefaults.ts, 160, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f09(a, a); +>f09 : Symbol(f09, Decl(genericDefaults.ts, 160, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f09(a, ab); +>f09 : Symbol(f09, Decl(genericDefaults.ts, 160, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>ab : Symbol(ab, Decl(genericDefaults.ts, 11, 13)) + +// no inference, partially supplied +f09(); +>f09 : Symbol(f09, Decl(genericDefaults.ts, 160, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) + +f09(a); +>f09 : Symbol(f09, Decl(genericDefaults.ts, 160, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f09(a, a); +>f09 : Symbol(f09, Decl(genericDefaults.ts, 160, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f09(a, ab); +>f09 : Symbol(f09, Decl(genericDefaults.ts, 160, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>ab : Symbol(ab, Decl(genericDefaults.ts, 11, 13)) + +// no inference, fully supplied +f09(); +>f09 : Symbol(f09, Decl(genericDefaults.ts, 160, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>AB : Symbol(AB, Decl(genericDefaults.ts, 3, 26)) + +f09(a); +>f09 : Symbol(f09, Decl(genericDefaults.ts, 160, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>AB : Symbol(AB, Decl(genericDefaults.ts, 3, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f09(a, ab); +>f09 : Symbol(f09, Decl(genericDefaults.ts, 160, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>AB : Symbol(AB, Decl(genericDefaults.ts, 3, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>ab : Symbol(ab, Decl(genericDefaults.ts, 11, 13)) + +// function with a type parameter with a constraint and a default that refers to an earlier type parameter with a constraint +declare function f10(a?: T, b?: U): [T, U]; +>f10 : Symbol(f10, Decl(genericDefaults.ts, 177, 18)) +>T : Symbol(T, Decl(genericDefaults.ts, 180, 21)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>U : Symbol(U, Decl(genericDefaults.ts, 180, 33)) +>T : Symbol(T, Decl(genericDefaults.ts, 180, 21)) +>T : Symbol(T, Decl(genericDefaults.ts, 180, 21)) +>a : Symbol(a, Decl(genericDefaults.ts, 180, 51)) +>T : Symbol(T, Decl(genericDefaults.ts, 180, 21)) +>b : Symbol(b, Decl(genericDefaults.ts, 180, 57)) +>U : Symbol(U, Decl(genericDefaults.ts, 180, 33)) +>T : Symbol(T, Decl(genericDefaults.ts, 180, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 180, 33)) + +// inference +f10(); +>f10 : Symbol(f10, Decl(genericDefaults.ts, 177, 18)) + +f10(a); +>f10 : Symbol(f10, Decl(genericDefaults.ts, 177, 18)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f10(a, a); +>f10 : Symbol(f10, Decl(genericDefaults.ts, 177, 18)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f10(a, ab); +>f10 : Symbol(f10, Decl(genericDefaults.ts, 177, 18)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>ab : Symbol(ab, Decl(genericDefaults.ts, 11, 13)) + +// no inference, partially supplied +f10(); +>f10 : Symbol(f10, Decl(genericDefaults.ts, 177, 18)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) + +f10(a); +>f10 : Symbol(f10, Decl(genericDefaults.ts, 177, 18)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f10(a, a); +>f10 : Symbol(f10, Decl(genericDefaults.ts, 177, 18)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f10(a, ab); +>f10 : Symbol(f10, Decl(genericDefaults.ts, 177, 18)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>ab : Symbol(ab, Decl(genericDefaults.ts, 11, 13)) + +// no inference, fully supplied +f10(); +>f10 : Symbol(f10, Decl(genericDefaults.ts, 177, 18)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) + +f10(a); +>f10 : Symbol(f10, Decl(genericDefaults.ts, 177, 18)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f10(a, a); +>f10 : Symbol(f10, Decl(genericDefaults.ts, 177, 18)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f10(a, ab); +>f10 : Symbol(f10, Decl(genericDefaults.ts, 177, 18)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>ab : Symbol(ab, Decl(genericDefaults.ts, 11, 13)) + +f10(); +>f10 : Symbol(f10, Decl(genericDefaults.ts, 177, 18)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>AB : Symbol(AB, Decl(genericDefaults.ts, 3, 26)) + +f10(a); +>f10 : Symbol(f10, Decl(genericDefaults.ts, 177, 18)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>AB : Symbol(AB, Decl(genericDefaults.ts, 3, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f10(a, ab); +>f10 : Symbol(f10, Decl(genericDefaults.ts, 177, 18)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>AB : Symbol(AB, Decl(genericDefaults.ts, 3, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>ab : Symbol(ab, Decl(genericDefaults.ts, 11, 13)) + +// function with a type parameter with a default that refers to an earier type parameter in a union +declare function f11(a?: T, b?: U): [T, U]; +>f11 : Symbol(f11, Decl(genericDefaults.ts, 198, 18)) +>T : Symbol(T, Decl(genericDefaults.ts, 201, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 201, 23)) +>T : Symbol(T, Decl(genericDefaults.ts, 201, 21)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 201, 35)) +>T : Symbol(T, Decl(genericDefaults.ts, 201, 21)) +>b : Symbol(b, Decl(genericDefaults.ts, 201, 41)) +>U : Symbol(U, Decl(genericDefaults.ts, 201, 23)) +>T : Symbol(T, Decl(genericDefaults.ts, 201, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 201, 23)) + +// inference +f11(); +>f11 : Symbol(f11, Decl(genericDefaults.ts, 198, 18)) + +f11(a); +>f11 : Symbol(f11, Decl(genericDefaults.ts, 198, 18)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f11(a, a); +>f11 : Symbol(f11, Decl(genericDefaults.ts, 198, 18)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f11(a, b); +>f11 : Symbol(f11, Decl(genericDefaults.ts, 198, 18)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f11(a, c); +>f11 : Symbol(f11, Decl(genericDefaults.ts, 198, 18)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) + +// no inference, partially supplied +f11(); +>f11 : Symbol(f11, Decl(genericDefaults.ts, 198, 18)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) + +f11(a); +>f11 : Symbol(f11, Decl(genericDefaults.ts, 198, 18)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f11(a, a); +>f11 : Symbol(f11, Decl(genericDefaults.ts, 198, 18)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f11(a, b); +>f11 : Symbol(f11, Decl(genericDefaults.ts, 198, 18)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +// no inference, fully supplied +f11(); +>f11 : Symbol(f11, Decl(genericDefaults.ts, 198, 18)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) + +f11(a); +>f11 : Symbol(f11, Decl(genericDefaults.ts, 198, 18)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f11(a, c); +>f11 : Symbol(f11, Decl(genericDefaults.ts, 198, 18)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) + +// function with a type parameter with a default that refers to an earlier type parameter in an intersection +declare function f12(a?: T, b?: U): [T, U]; +>f12 : Symbol(f12, Decl(genericDefaults.ts, 216, 16)) +>T : Symbol(T, Decl(genericDefaults.ts, 219, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 219, 23)) +>T : Symbol(T, Decl(genericDefaults.ts, 219, 21)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 219, 35)) +>T : Symbol(T, Decl(genericDefaults.ts, 219, 21)) +>b : Symbol(b, Decl(genericDefaults.ts, 219, 41)) +>U : Symbol(U, Decl(genericDefaults.ts, 219, 23)) +>T : Symbol(T, Decl(genericDefaults.ts, 219, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 219, 23)) + +// inference +f12(); +>f12 : Symbol(f12, Decl(genericDefaults.ts, 216, 16)) + +f12(a); +>f12 : Symbol(f12, Decl(genericDefaults.ts, 216, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f12(a, a); +>f12 : Symbol(f12, Decl(genericDefaults.ts, 216, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f12(a, b); +>f12 : Symbol(f12, Decl(genericDefaults.ts, 216, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f12(a, c); +>f12 : Symbol(f12, Decl(genericDefaults.ts, 216, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) + +// no inference, partially supplied +f12(); +>f12 : Symbol(f12, Decl(genericDefaults.ts, 216, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) + +f12(a); +>f12 : Symbol(f12, Decl(genericDefaults.ts, 216, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f12(a, ab); +>f12 : Symbol(f12, Decl(genericDefaults.ts, 216, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>ab : Symbol(ab, Decl(genericDefaults.ts, 11, 13)) + +// no inference, fully supplied +f12(); +>f12 : Symbol(f12, Decl(genericDefaults.ts, 216, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) + +f12(a); +>f12 : Symbol(f12, Decl(genericDefaults.ts, 216, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f12(a, c); +>f12 : Symbol(f12, Decl(genericDefaults.ts, 216, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) + +// function with a type parameter with a default that refers to a later type parameter with a default +declare function f13(a?: T, b?: U): [T, U]; +>f13 : Symbol(f13, Decl(genericDefaults.ts, 233, 16)) +>T : Symbol(T, Decl(genericDefaults.ts, 236, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 236, 27)) +>U : Symbol(U, Decl(genericDefaults.ts, 236, 27)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 236, 35)) +>T : Symbol(T, Decl(genericDefaults.ts, 236, 21)) +>b : Symbol(b, Decl(genericDefaults.ts, 236, 41)) +>U : Symbol(U, Decl(genericDefaults.ts, 236, 27)) +>T : Symbol(T, Decl(genericDefaults.ts, 236, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 236, 27)) + +// inference +f13(); +>f13 : Symbol(f13, Decl(genericDefaults.ts, 233, 16)) + +f13(a); +>f13 : Symbol(f13, Decl(genericDefaults.ts, 233, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f13(a, b); +>f13 : Symbol(f13, Decl(genericDefaults.ts, 233, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f13(a, c); +>f13 : Symbol(f13, Decl(genericDefaults.ts, 233, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) + +// no inference, partially supplied +f13(); +>f13 : Symbol(f13, Decl(genericDefaults.ts, 233, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) + +f13(a); +>f13 : Symbol(f13, Decl(genericDefaults.ts, 233, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f13(a, b); +>f13 : Symbol(f13, Decl(genericDefaults.ts, 233, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +// no inference, fully supplied +f13(); +>f13 : Symbol(f13, Decl(genericDefaults.ts, 233, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) + +f13(a); +>f13 : Symbol(f13, Decl(genericDefaults.ts, 233, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f13(a, c); +>f13 : Symbol(f13, Decl(genericDefaults.ts, 233, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) + +f13(a, c); +>f13 : Symbol(f13, Decl(genericDefaults.ts, 233, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) + +// function with a type parameter without a default and a type parameter with a default that refers to a later type parameter with a default +declare function f14(a?: T, b?: U, c?: V): [T, U, V]; +>f14 : Symbol(f14, Decl(genericDefaults.ts, 250, 16)) +>T : Symbol(T, Decl(genericDefaults.ts, 253, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 253, 23)) +>V : Symbol(V, Decl(genericDefaults.ts, 253, 30)) +>V : Symbol(V, Decl(genericDefaults.ts, 253, 30)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 253, 38)) +>T : Symbol(T, Decl(genericDefaults.ts, 253, 21)) +>b : Symbol(b, Decl(genericDefaults.ts, 253, 44)) +>U : Symbol(U, Decl(genericDefaults.ts, 253, 23)) +>c : Symbol(c, Decl(genericDefaults.ts, 253, 51)) +>V : Symbol(V, Decl(genericDefaults.ts, 253, 30)) +>T : Symbol(T, Decl(genericDefaults.ts, 253, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 253, 23)) +>V : Symbol(V, Decl(genericDefaults.ts, 253, 30)) + +// inference +f14(); +>f14 : Symbol(f14, Decl(genericDefaults.ts, 250, 16)) + +f14(a); +>f14 : Symbol(f14, Decl(genericDefaults.ts, 250, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f14(a, b); +>f14 : Symbol(f14, Decl(genericDefaults.ts, 250, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f14(a, b, c); +>f14 : Symbol(f14, Decl(genericDefaults.ts, 250, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) + +f14(a, b, d); +>f14 : Symbol(f14, Decl(genericDefaults.ts, 250, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>d : Symbol(d, Decl(genericDefaults.ts, 10, 13)) + +// no inference, partially supplied +f14(); +>f14 : Symbol(f14, Decl(genericDefaults.ts, 250, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) + +f14(a); +>f14 : Symbol(f14, Decl(genericDefaults.ts, 250, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f14(a, b); +>f14 : Symbol(f14, Decl(genericDefaults.ts, 250, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f14(a, b, c); +>f14 : Symbol(f14, Decl(genericDefaults.ts, 250, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) + +f14(); +>f14 : Symbol(f14, Decl(genericDefaults.ts, 250, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) + +f14(a); +>f14 : Symbol(f14, Decl(genericDefaults.ts, 250, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f14(a, b); +>f14 : Symbol(f14, Decl(genericDefaults.ts, 250, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f14(a, b, c); +>f14 : Symbol(f14, Decl(genericDefaults.ts, 250, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) + +// no inference fully supplied +f14(); +>f14 : Symbol(f14, Decl(genericDefaults.ts, 250, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>D : Symbol(D, Decl(genericDefaults.ts, 2, 26)) + +f14(a); +>f14 : Symbol(f14, Decl(genericDefaults.ts, 250, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>D : Symbol(D, Decl(genericDefaults.ts, 2, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f14(a, b); +>f14 : Symbol(f14, Decl(genericDefaults.ts, 250, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>D : Symbol(D, Decl(genericDefaults.ts, 2, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f14(a, b, d); +>f14 : Symbol(f14, Decl(genericDefaults.ts, 250, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>D : Symbol(D, Decl(genericDefaults.ts, 2, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>d : Symbol(d, Decl(genericDefaults.ts, 10, 13)) + +// function with two type parameters with defaults that mutually refer to each other +declare function f15(a?: T, b?: U): [T, U]; +>f15 : Symbol(f15, Decl(genericDefaults.ts, 273, 22)) +>T : Symbol(T, Decl(genericDefaults.ts, 276, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 276, 27)) +>U : Symbol(U, Decl(genericDefaults.ts, 276, 27)) +>T : Symbol(T, Decl(genericDefaults.ts, 276, 21)) +>a : Symbol(a, Decl(genericDefaults.ts, 276, 35)) +>T : Symbol(T, Decl(genericDefaults.ts, 276, 21)) +>b : Symbol(b, Decl(genericDefaults.ts, 276, 41)) +>U : Symbol(U, Decl(genericDefaults.ts, 276, 27)) +>T : Symbol(T, Decl(genericDefaults.ts, 276, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 276, 27)) + +// inference +f15(); +>f15 : Symbol(f15, Decl(genericDefaults.ts, 273, 22)) + +f15(a); +>f15 : Symbol(f15, Decl(genericDefaults.ts, 273, 22)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f15(a, b); +>f15 : Symbol(f15, Decl(genericDefaults.ts, 273, 22)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +// no inference, partially supplied +f15(); +>f15 : Symbol(f15, Decl(genericDefaults.ts, 273, 22)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) + +f15(a); +>f15 : Symbol(f15, Decl(genericDefaults.ts, 273, 22)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f15(a, a); +>f15 : Symbol(f15, Decl(genericDefaults.ts, 273, 22)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +// no inference, fully supplied +f15(); +>f15 : Symbol(f15, Decl(genericDefaults.ts, 273, 22)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) + +f15(a); +>f15 : Symbol(f15, Decl(genericDefaults.ts, 273, 22)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f15(a, b); +>f15 : Symbol(f15, Decl(genericDefaults.ts, 273, 22)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +// function with a type parameter without a default and two type parameters with defaults that mutually refer to each other +declare function f16(a?: T, b?: U, c?: V): [T, U, V]; +>f16 : Symbol(f16, Decl(genericDefaults.ts, 288, 16)) +>T : Symbol(T, Decl(genericDefaults.ts, 291, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 291, 23)) +>V : Symbol(V, Decl(genericDefaults.ts, 291, 30)) +>V : Symbol(V, Decl(genericDefaults.ts, 291, 30)) +>U : Symbol(U, Decl(genericDefaults.ts, 291, 23)) +>a : Symbol(a, Decl(genericDefaults.ts, 291, 38)) +>T : Symbol(T, Decl(genericDefaults.ts, 291, 21)) +>b : Symbol(b, Decl(genericDefaults.ts, 291, 44)) +>U : Symbol(U, Decl(genericDefaults.ts, 291, 23)) +>c : Symbol(c, Decl(genericDefaults.ts, 291, 51)) +>V : Symbol(V, Decl(genericDefaults.ts, 291, 30)) +>T : Symbol(T, Decl(genericDefaults.ts, 291, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 291, 23)) +>V : Symbol(V, Decl(genericDefaults.ts, 291, 30)) + +// no inference +f16(); +>f16 : Symbol(f16, Decl(genericDefaults.ts, 288, 16)) + +f16(a); +>f16 : Symbol(f16, Decl(genericDefaults.ts, 288, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f16(a, b); +>f16 : Symbol(f16, Decl(genericDefaults.ts, 288, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f16(a, b, b); +>f16 : Symbol(f16, Decl(genericDefaults.ts, 288, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +// no inference, partially supplied +f16(); +>f16 : Symbol(f16, Decl(genericDefaults.ts, 288, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) + +f16(a); +>f16 : Symbol(f16, Decl(genericDefaults.ts, 288, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f16(a, b); +>f16 : Symbol(f16, Decl(genericDefaults.ts, 288, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f16(a, b, b); +>f16 : Symbol(f16, Decl(genericDefaults.ts, 288, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f16(); +>f16 : Symbol(f16, Decl(genericDefaults.ts, 288, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) + +f16(a); +>f16 : Symbol(f16, Decl(genericDefaults.ts, 288, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f16(a, b); +>f16 : Symbol(f16, Decl(genericDefaults.ts, 288, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f16(a, b, b); +>f16 : Symbol(f16, Decl(genericDefaults.ts, 288, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +// no inference, fully supplied +f16(); +>f16 : Symbol(f16, Decl(genericDefaults.ts, 288, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>D : Symbol(D, Decl(genericDefaults.ts, 2, 26)) + +f16(a); +>f16 : Symbol(f16, Decl(genericDefaults.ts, 288, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>D : Symbol(D, Decl(genericDefaults.ts, 2, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f16(a, b); +>f16 : Symbol(f16, Decl(genericDefaults.ts, 288, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>D : Symbol(D, Decl(genericDefaults.ts, 2, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f16(a, b, d); +>f16 : Symbol(f16, Decl(genericDefaults.ts, 288, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>D : Symbol(D, Decl(genericDefaults.ts, 2, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>d : Symbol(d, Decl(genericDefaults.ts, 10, 13)) + +// function with a type parameter with a default that refers to a later type parameter with a default that refers to an earlier type parameter in a union +declare function f17(a?: T, b?: U): [T, U]; +>f17 : Symbol(f17, Decl(genericDefaults.ts, 310, 22)) +>T : Symbol(T, Decl(genericDefaults.ts, 313, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 313, 27)) +>U : Symbol(U, Decl(genericDefaults.ts, 313, 27)) +>T : Symbol(T, Decl(genericDefaults.ts, 313, 21)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 313, 39)) +>T : Symbol(T, Decl(genericDefaults.ts, 313, 21)) +>b : Symbol(b, Decl(genericDefaults.ts, 313, 45)) +>U : Symbol(U, Decl(genericDefaults.ts, 313, 27)) +>T : Symbol(T, Decl(genericDefaults.ts, 313, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 313, 27)) + +// inference +f17(); +>f17 : Symbol(f17, Decl(genericDefaults.ts, 310, 22)) + +f17(a); +>f17 : Symbol(f17, Decl(genericDefaults.ts, 310, 22)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f17(a, a); +>f17 : Symbol(f17, Decl(genericDefaults.ts, 310, 22)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f17(a, b); +>f17 : Symbol(f17, Decl(genericDefaults.ts, 310, 22)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f17(a, c); +>f17 : Symbol(f17, Decl(genericDefaults.ts, 310, 22)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) + +// no inference, partially supplied +f17(); +>f17 : Symbol(f17, Decl(genericDefaults.ts, 310, 22)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) + +f17(a); +>f17 : Symbol(f17, Decl(genericDefaults.ts, 310, 22)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f17(a, a); +>f17 : Symbol(f17, Decl(genericDefaults.ts, 310, 22)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f17(a, b); +>f17 : Symbol(f17, Decl(genericDefaults.ts, 310, 22)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +// no inference, fully supplied +f17(); +>f17 : Symbol(f17, Decl(genericDefaults.ts, 310, 22)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) + +f17(a); +>f17 : Symbol(f17, Decl(genericDefaults.ts, 310, 22)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f17(a, c); +>f17 : Symbol(f17, Decl(genericDefaults.ts, 310, 22)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) + +// function with a type parameter without a default and a type parameter with a default that refers to a later type parameter with a default that refers to an earlier type parameter in a union +declare function f18(a?: T, b?: U, c?: V): [T, U, V]; +>f18 : Symbol(f18, Decl(genericDefaults.ts, 328, 16)) +>T : Symbol(T, Decl(genericDefaults.ts, 331, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 331, 23)) +>V : Symbol(V, Decl(genericDefaults.ts, 331, 30)) +>V : Symbol(V, Decl(genericDefaults.ts, 331, 30)) +>U : Symbol(U, Decl(genericDefaults.ts, 331, 23)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 331, 42)) +>T : Symbol(T, Decl(genericDefaults.ts, 331, 21)) +>b : Symbol(b, Decl(genericDefaults.ts, 331, 48)) +>U : Symbol(U, Decl(genericDefaults.ts, 331, 23)) +>c : Symbol(c, Decl(genericDefaults.ts, 331, 55)) +>V : Symbol(V, Decl(genericDefaults.ts, 331, 30)) +>T : Symbol(T, Decl(genericDefaults.ts, 331, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 331, 23)) +>V : Symbol(V, Decl(genericDefaults.ts, 331, 30)) + +// inference +f18(); +>f18 : Symbol(f18, Decl(genericDefaults.ts, 328, 16)) + +f18(a); +>f18 : Symbol(f18, Decl(genericDefaults.ts, 328, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f18(a, b); +>f18 : Symbol(f18, Decl(genericDefaults.ts, 328, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f18(a, b, b); +>f18 : Symbol(f18, Decl(genericDefaults.ts, 328, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f18(a, b, c); +>f18 : Symbol(f18, Decl(genericDefaults.ts, 328, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) + +// no inference, partially supplied +f18(); +>f18 : Symbol(f18, Decl(genericDefaults.ts, 328, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) + +f18(a); +>f18 : Symbol(f18, Decl(genericDefaults.ts, 328, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f18(a, b); +>f18 : Symbol(f18, Decl(genericDefaults.ts, 328, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f18(a, b, b); +>f18 : Symbol(f18, Decl(genericDefaults.ts, 328, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f18(a, b, c); +>f18 : Symbol(f18, Decl(genericDefaults.ts, 328, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) + +f18(); +>f18 : Symbol(f18, Decl(genericDefaults.ts, 328, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) + +f18(a); +>f18 : Symbol(f18, Decl(genericDefaults.ts, 328, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f18(a, b); +>f18 : Symbol(f18, Decl(genericDefaults.ts, 328, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f18(a, b, b); +>f18 : Symbol(f18, Decl(genericDefaults.ts, 328, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f18(a, b, c); +>f18 : Symbol(f18, Decl(genericDefaults.ts, 328, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) + +// no inference, fully supplied +f18(); +>f18 : Symbol(f18, Decl(genericDefaults.ts, 328, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>D : Symbol(D, Decl(genericDefaults.ts, 2, 26)) + +f18(a); +>f18 : Symbol(f18, Decl(genericDefaults.ts, 328, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>D : Symbol(D, Decl(genericDefaults.ts, 2, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f18(a, b); +>f18 : Symbol(f18, Decl(genericDefaults.ts, 328, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>D : Symbol(D, Decl(genericDefaults.ts, 2, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f18(a, b, d); +>f18 : Symbol(f18, Decl(genericDefaults.ts, 328, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>D : Symbol(D, Decl(genericDefaults.ts, 2, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>d : Symbol(d, Decl(genericDefaults.ts, 10, 13)) + +// function with a type parameter with a default that refers to a later type parameter with a default that refers to an earlier type parameter in an intersection +declare function f19(a?: T, b?: U): [T, U]; +>f19 : Symbol(f19, Decl(genericDefaults.ts, 353, 22)) +>T : Symbol(T, Decl(genericDefaults.ts, 356, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 356, 27)) +>U : Symbol(U, Decl(genericDefaults.ts, 356, 27)) +>T : Symbol(T, Decl(genericDefaults.ts, 356, 21)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 356, 39)) +>T : Symbol(T, Decl(genericDefaults.ts, 356, 21)) +>b : Symbol(b, Decl(genericDefaults.ts, 356, 45)) +>U : Symbol(U, Decl(genericDefaults.ts, 356, 27)) +>T : Symbol(T, Decl(genericDefaults.ts, 356, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 356, 27)) + +// inference +f19(); +>f19 : Symbol(f19, Decl(genericDefaults.ts, 353, 22)) + +f19(a); +>f19 : Symbol(f19, Decl(genericDefaults.ts, 353, 22)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f19(a, a); +>f19 : Symbol(f19, Decl(genericDefaults.ts, 353, 22)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f19(a, b); +>f19 : Symbol(f19, Decl(genericDefaults.ts, 353, 22)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f19(a, ab); +>f19 : Symbol(f19, Decl(genericDefaults.ts, 353, 22)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>ab : Symbol(ab, Decl(genericDefaults.ts, 11, 13)) + +f19(a, c); +>f19 : Symbol(f19, Decl(genericDefaults.ts, 353, 22)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) + +// no inference, partially supplied +f19(); +>f19 : Symbol(f19, Decl(genericDefaults.ts, 353, 22)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) + +f19(a); +>f19 : Symbol(f19, Decl(genericDefaults.ts, 353, 22)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f19(a, ab); +>f19 : Symbol(f19, Decl(genericDefaults.ts, 353, 22)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>ab : Symbol(ab, Decl(genericDefaults.ts, 11, 13)) + +// no inference, fully supplied +f19(); +>f19 : Symbol(f19, Decl(genericDefaults.ts, 353, 22)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) + +f19(a); +>f19 : Symbol(f19, Decl(genericDefaults.ts, 353, 22)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f19(a, c); +>f19 : Symbol(f19, Decl(genericDefaults.ts, 353, 22)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) + +// function with a type parameter without a default and a type parameter with a default that refers to a later type parameter with a default that refers to an earlier type parameter in an intersection +declare function f20(a?: T, b?: U, c?: V): [T, U, V]; +>f20 : Symbol(f20, Decl(genericDefaults.ts, 371, 16)) +>T : Symbol(T, Decl(genericDefaults.ts, 374, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 374, 23)) +>V : Symbol(V, Decl(genericDefaults.ts, 374, 30)) +>V : Symbol(V, Decl(genericDefaults.ts, 374, 30)) +>U : Symbol(U, Decl(genericDefaults.ts, 374, 23)) +>C : Symbol(C, Decl(genericDefaults.ts, 1, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 374, 42)) +>T : Symbol(T, Decl(genericDefaults.ts, 374, 21)) +>b : Symbol(b, Decl(genericDefaults.ts, 374, 48)) +>U : Symbol(U, Decl(genericDefaults.ts, 374, 23)) +>c : Symbol(c, Decl(genericDefaults.ts, 374, 55)) +>V : Symbol(V, Decl(genericDefaults.ts, 374, 30)) +>T : Symbol(T, Decl(genericDefaults.ts, 374, 21)) +>U : Symbol(U, Decl(genericDefaults.ts, 374, 23)) +>V : Symbol(V, Decl(genericDefaults.ts, 374, 30)) + +// inference +f20(); +>f20 : Symbol(f20, Decl(genericDefaults.ts, 371, 16)) + +f20(a); +>f20 : Symbol(f20, Decl(genericDefaults.ts, 371, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f20(a, b); +>f20 : Symbol(f20, Decl(genericDefaults.ts, 371, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f20(a, b, c); +>f20 : Symbol(f20, Decl(genericDefaults.ts, 371, 16)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>c : Symbol(c, Decl(genericDefaults.ts, 9, 13)) + +// no inference, partially supplied +f20(); +>f20 : Symbol(f20, Decl(genericDefaults.ts, 371, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) + +f20(a); +>f20 : Symbol(f20, Decl(genericDefaults.ts, 371, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f20(a, b); +>f20 : Symbol(f20, Decl(genericDefaults.ts, 371, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f20(a, b, bc); +>f20 : Symbol(f20, Decl(genericDefaults.ts, 371, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>bc : Symbol(bc, Decl(genericDefaults.ts, 12, 13)) + +f20(); +>f20 : Symbol(f20, Decl(genericDefaults.ts, 371, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) + +f20(a); +>f20 : Symbol(f20, Decl(genericDefaults.ts, 371, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f20(a, b); +>f20 : Symbol(f20, Decl(genericDefaults.ts, 371, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f20(a, b, bc); +>f20 : Symbol(f20, Decl(genericDefaults.ts, 371, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>bc : Symbol(bc, Decl(genericDefaults.ts, 12, 13)) + +// no inference, fully supplied +f20(); +>f20 : Symbol(f20, Decl(genericDefaults.ts, 371, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>D : Symbol(D, Decl(genericDefaults.ts, 2, 26)) + +f20(a); +>f20 : Symbol(f20, Decl(genericDefaults.ts, 371, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>D : Symbol(D, Decl(genericDefaults.ts, 2, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) + +f20(a, b); +>f20 : Symbol(f20, Decl(genericDefaults.ts, 371, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>D : Symbol(D, Decl(genericDefaults.ts, 2, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) + +f20(a, b, d); +>f20 : Symbol(f20, Decl(genericDefaults.ts, 371, 16)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>D : Symbol(D, Decl(genericDefaults.ts, 2, 26)) +>a : Symbol(a, Decl(genericDefaults.ts, 7, 13)) +>b : Symbol(b, Decl(genericDefaults.ts, 8, 13)) +>d : Symbol(d, Decl(genericDefaults.ts, 10, 13)) interface i00 { a: T; } ->i00 : Symbol(i00, Decl(genericDefaults.ts, 63, 41)) ->T : Symbol(T, Decl(genericDefaults.ts, 65, 14)) ->a : Symbol(i00.a, Decl(genericDefaults.ts, 65, 27)) ->T : Symbol(T, Decl(genericDefaults.ts, 65, 14)) +>i00 : Symbol(i00, Decl(genericDefaults.ts, 393, 22)) +>T : Symbol(T, Decl(genericDefaults.ts, 395, 14)) +>a : Symbol(i00.a, Decl(genericDefaults.ts, 395, 27)) +>T : Symbol(T, Decl(genericDefaults.ts, 395, 14)) const i00c00 = (x).a; ->i00c00 : Symbol(i00c00, Decl(genericDefaults.ts, 66, 5)) ->(x).a : Symbol(i00.a, Decl(genericDefaults.ts, 65, 27)) ->i00 : Symbol(i00, Decl(genericDefaults.ts, 63, 41)) ->x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) ->a : Symbol(i00.a, Decl(genericDefaults.ts, 65, 27)) +>i00c00 : Symbol(i00c00, Decl(genericDefaults.ts, 396, 5)) +>(x).a : Symbol(i00.a, Decl(genericDefaults.ts, 395, 27)) +>i00 : Symbol(i00, Decl(genericDefaults.ts, 393, 22)) +>x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) +>a : Symbol(i00.a, Decl(genericDefaults.ts, 395, 27)) const i00c01 = (>x).a; ->i00c01 : Symbol(i00c01, Decl(genericDefaults.ts, 67, 5)) ->(>x).a : Symbol(i00.a, Decl(genericDefaults.ts, 65, 27)) ->i00 : Symbol(i00, Decl(genericDefaults.ts, 63, 41)) ->x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) ->a : Symbol(i00.a, Decl(genericDefaults.ts, 65, 27)) +>i00c01 : Symbol(i00c01, Decl(genericDefaults.ts, 397, 5)) +>(>x).a : Symbol(i00.a, Decl(genericDefaults.ts, 395, 27)) +>i00 : Symbol(i00, Decl(genericDefaults.ts, 393, 22)) +>x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) +>a : Symbol(i00.a, Decl(genericDefaults.ts, 395, 27)) interface i01 { a: [T, U]; } ->i01 : Symbol(i01, Decl(genericDefaults.ts, 67, 34)) ->T : Symbol(T, Decl(genericDefaults.ts, 69, 14)) ->U : Symbol(U, Decl(genericDefaults.ts, 69, 16)) ->T : Symbol(T, Decl(genericDefaults.ts, 69, 14)) ->a : Symbol(i01.a, Decl(genericDefaults.ts, 69, 25)) ->T : Symbol(T, Decl(genericDefaults.ts, 69, 14)) ->U : Symbol(U, Decl(genericDefaults.ts, 69, 16)) +>i01 : Symbol(i01, Decl(genericDefaults.ts, 397, 34)) +>T : Symbol(T, Decl(genericDefaults.ts, 399, 14)) +>U : Symbol(U, Decl(genericDefaults.ts, 399, 16)) +>T : Symbol(T, Decl(genericDefaults.ts, 399, 14)) +>a : Symbol(i01.a, Decl(genericDefaults.ts, 399, 25)) +>T : Symbol(T, Decl(genericDefaults.ts, 399, 14)) +>U : Symbol(U, Decl(genericDefaults.ts, 399, 16)) const i01c00 = (>x).a; ->i01c00 : Symbol(i01c00, Decl(genericDefaults.ts, 70, 5)) ->(>x).a : Symbol(i01.a, Decl(genericDefaults.ts, 69, 25)) ->i01 : Symbol(i01, Decl(genericDefaults.ts, 67, 34)) ->x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) ->a : Symbol(i01.a, Decl(genericDefaults.ts, 69, 25)) +>i01c00 : Symbol(i01c00, Decl(genericDefaults.ts, 400, 5)) +>(>x).a : Symbol(i01.a, Decl(genericDefaults.ts, 399, 25)) +>i01 : Symbol(i01, Decl(genericDefaults.ts, 397, 34)) +>x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) +>a : Symbol(i01.a, Decl(genericDefaults.ts, 399, 25)) const i01c01 = (>x).a; ->i01c01 : Symbol(i01c01, Decl(genericDefaults.ts, 71, 5)) ->(>x).a : Symbol(i01.a, Decl(genericDefaults.ts, 69, 25)) ->i01 : Symbol(i01, Decl(genericDefaults.ts, 67, 34)) ->x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) ->a : Symbol(i01.a, Decl(genericDefaults.ts, 69, 25)) +>i01c01 : Symbol(i01c01, Decl(genericDefaults.ts, 401, 5)) +>(>x).a : Symbol(i01.a, Decl(genericDefaults.ts, 399, 25)) +>i01 : Symbol(i01, Decl(genericDefaults.ts, 397, 34)) +>x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) +>a : Symbol(i01.a, Decl(genericDefaults.ts, 399, 25)) interface i02 { a: [T, U]; } ->i02 : Symbol(i02, Decl(genericDefaults.ts, 71, 42)) ->T : Symbol(T, Decl(genericDefaults.ts, 73, 14)) ->U : Symbol(U, Decl(genericDefaults.ts, 73, 31)) ->T : Symbol(T, Decl(genericDefaults.ts, 73, 14)) ->a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40)) ->T : Symbol(T, Decl(genericDefaults.ts, 73, 14)) ->U : Symbol(U, Decl(genericDefaults.ts, 73, 31)) +>i02 : Symbol(i02, Decl(genericDefaults.ts, 401, 42)) +>T : Symbol(T, Decl(genericDefaults.ts, 403, 14)) +>U : Symbol(U, Decl(genericDefaults.ts, 403, 31)) +>T : Symbol(T, Decl(genericDefaults.ts, 403, 14)) +>a : Symbol(i02.a, Decl(genericDefaults.ts, 403, 40)) +>T : Symbol(T, Decl(genericDefaults.ts, 403, 14)) +>U : Symbol(U, Decl(genericDefaults.ts, 403, 31)) const i02c00 = (>x).a; ->i02c00 : Symbol(i02c00, Decl(genericDefaults.ts, 74, 5)) ->(>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40)) ->i02 : Symbol(i02, Decl(genericDefaults.ts, 71, 42)) ->x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) ->a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40)) +>i02c00 : Symbol(i02c00, Decl(genericDefaults.ts, 404, 5)) +>(>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 403, 40)) +>i02 : Symbol(i02, Decl(genericDefaults.ts, 401, 42)) +>x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) +>a : Symbol(i02.a, Decl(genericDefaults.ts, 403, 40)) const i02c01 = (>x).a; ->i02c01 : Symbol(i02c01, Decl(genericDefaults.ts, 75, 5)) ->(>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40)) ->i02 : Symbol(i02, Decl(genericDefaults.ts, 71, 42)) ->x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) ->a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40)) +>i02c01 : Symbol(i02c01, Decl(genericDefaults.ts, 405, 5)) +>(>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 403, 40)) +>i02 : Symbol(i02, Decl(genericDefaults.ts, 401, 42)) +>x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) +>a : Symbol(i02.a, Decl(genericDefaults.ts, 403, 40)) const i02c02 = (>x).a; ->i02c02 : Symbol(i02c02, Decl(genericDefaults.ts, 76, 5)) ->(>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40)) ->i02 : Symbol(i02, Decl(genericDefaults.ts, 71, 42)) ->x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) ->a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40)) +>i02c02 : Symbol(i02c02, Decl(genericDefaults.ts, 406, 5)) +>(>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 403, 40)) +>i02 : Symbol(i02, Decl(genericDefaults.ts, 401, 42)) +>x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) +>a : Symbol(i02.a, Decl(genericDefaults.ts, 403, 40)) const i02c03 = (>x).a; ->i02c03 : Symbol(i02c03, Decl(genericDefaults.ts, 77, 5)) ->(>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40)) ->i02 : Symbol(i02, Decl(genericDefaults.ts, 71, 42)) ->x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) ->a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40)) +>i02c03 : Symbol(i02c03, Decl(genericDefaults.ts, 407, 5)) +>(>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 403, 40)) +>i02 : Symbol(i02, Decl(genericDefaults.ts, 401, 42)) +>x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) +>a : Symbol(i02.a, Decl(genericDefaults.ts, 403, 40)) const i02c04 = (>x).a; ->i02c04 : Symbol(i02c04, Decl(genericDefaults.ts, 78, 5)) ->(>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40)) ->i02 : Symbol(i02, Decl(genericDefaults.ts, 71, 42)) ->x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) ->a : Symbol(i02.a, Decl(genericDefaults.ts, 73, 40)) +>i02c04 : Symbol(i02c04, Decl(genericDefaults.ts, 408, 5)) +>(>x).a : Symbol(i02.a, Decl(genericDefaults.ts, 403, 40)) +>i02 : Symbol(i02, Decl(genericDefaults.ts, 401, 42)) +>x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) +>a : Symbol(i02.a, Decl(genericDefaults.ts, 403, 40)) interface i03 { a: [T, U]; } ->i03 : Symbol(i03, Decl(genericDefaults.ts, 78, 37)) ->T : Symbol(T, Decl(genericDefaults.ts, 80, 14)) ->U : Symbol(U, Decl(genericDefaults.ts, 80, 31)) ->T : Symbol(T, Decl(genericDefaults.ts, 80, 14)) ->T : Symbol(T, Decl(genericDefaults.ts, 80, 14)) ->a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50)) ->T : Symbol(T, Decl(genericDefaults.ts, 80, 14)) ->U : Symbol(U, Decl(genericDefaults.ts, 80, 31)) +>i03 : Symbol(i03, Decl(genericDefaults.ts, 408, 37)) +>T : Symbol(T, Decl(genericDefaults.ts, 410, 14)) +>U : Symbol(U, Decl(genericDefaults.ts, 410, 31)) +>T : Symbol(T, Decl(genericDefaults.ts, 410, 14)) +>T : Symbol(T, Decl(genericDefaults.ts, 410, 14)) +>a : Symbol(i03.a, Decl(genericDefaults.ts, 410, 50)) +>T : Symbol(T, Decl(genericDefaults.ts, 410, 14)) +>U : Symbol(U, Decl(genericDefaults.ts, 410, 31)) const i03c00 = (>x).a; ->i03c00 : Symbol(i03c00, Decl(genericDefaults.ts, 81, 5)) ->(>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50)) ->i03 : Symbol(i03, Decl(genericDefaults.ts, 78, 37)) ->x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) ->a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50)) +>i03c00 : Symbol(i03c00, Decl(genericDefaults.ts, 411, 5)) +>(>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 410, 50)) +>i03 : Symbol(i03, Decl(genericDefaults.ts, 408, 37)) +>x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) +>a : Symbol(i03.a, Decl(genericDefaults.ts, 410, 50)) const i03c01 = (>x).a; ->i03c01 : Symbol(i03c01, Decl(genericDefaults.ts, 82, 5)) ->(>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50)) ->i03 : Symbol(i03, Decl(genericDefaults.ts, 78, 37)) ->x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) ->a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50)) +>i03c01 : Symbol(i03c01, Decl(genericDefaults.ts, 412, 5)) +>(>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 410, 50)) +>i03 : Symbol(i03, Decl(genericDefaults.ts, 408, 37)) +>x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) +>a : Symbol(i03.a, Decl(genericDefaults.ts, 410, 50)) const i03c02 = (>x).a; ->i03c02 : Symbol(i03c02, Decl(genericDefaults.ts, 83, 5)) ->(>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50)) ->i03 : Symbol(i03, Decl(genericDefaults.ts, 78, 37)) ->x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) ->a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50)) +>i03c02 : Symbol(i03c02, Decl(genericDefaults.ts, 413, 5)) +>(>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 410, 50)) +>i03 : Symbol(i03, Decl(genericDefaults.ts, 408, 37)) +>x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) +>a : Symbol(i03.a, Decl(genericDefaults.ts, 410, 50)) const i03c03 = (>x).a; ->i03c03 : Symbol(i03c03, Decl(genericDefaults.ts, 84, 5)) ->(>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50)) ->i03 : Symbol(i03, Decl(genericDefaults.ts, 78, 37)) ->x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) ->a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50)) +>i03c03 : Symbol(i03c03, Decl(genericDefaults.ts, 414, 5)) +>(>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 410, 50)) +>i03 : Symbol(i03, Decl(genericDefaults.ts, 408, 37)) +>x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) +>a : Symbol(i03.a, Decl(genericDefaults.ts, 410, 50)) const i03c04 = (>x).a; ->i03c04 : Symbol(i03c04, Decl(genericDefaults.ts, 85, 5)) ->(>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50)) ->i03 : Symbol(i03, Decl(genericDefaults.ts, 78, 37)) ->x : Symbol(x, Decl(genericDefaults.ts, 0, 13)) ->a : Symbol(i03.a, Decl(genericDefaults.ts, 80, 50)) +>i03c04 : Symbol(i03c04, Decl(genericDefaults.ts, 415, 5)) +>(>x).a : Symbol(i03.a, Decl(genericDefaults.ts, 410, 50)) +>i03 : Symbol(i03, Decl(genericDefaults.ts, 408, 37)) +>x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) +>a : Symbol(i03.a, Decl(genericDefaults.ts, 410, 50)) interface i04 {} ->i04 : Symbol(i04, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 87, 16), Decl(genericDefaults.ts, 88, 19), Decl(genericDefaults.ts, 89, 28)) +>i04 : Symbol(i04, Decl(genericDefaults.ts, 415, 37), Decl(genericDefaults.ts, 417, 16), Decl(genericDefaults.ts, 418, 19), Decl(genericDefaults.ts, 419, 28)) interface i04 {} ->i04 : Symbol(i04, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 87, 16), Decl(genericDefaults.ts, 88, 19), Decl(genericDefaults.ts, 89, 28)) ->T : Symbol(T, Decl(genericDefaults.ts, 88, 14), Decl(genericDefaults.ts, 89, 14), Decl(genericDefaults.ts, 90, 14)) +>i04 : Symbol(i04, Decl(genericDefaults.ts, 415, 37), Decl(genericDefaults.ts, 417, 16), Decl(genericDefaults.ts, 418, 19), Decl(genericDefaults.ts, 419, 28)) +>T : Symbol(T, Decl(genericDefaults.ts, 418, 14), Decl(genericDefaults.ts, 419, 14), Decl(genericDefaults.ts, 420, 14)) interface i04 {} ->i04 : Symbol(i04, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 87, 16), Decl(genericDefaults.ts, 88, 19), Decl(genericDefaults.ts, 89, 28)) ->T : Symbol(T, Decl(genericDefaults.ts, 88, 14), Decl(genericDefaults.ts, 89, 14), Decl(genericDefaults.ts, 90, 14)) +>i04 : Symbol(i04, Decl(genericDefaults.ts, 415, 37), Decl(genericDefaults.ts, 417, 16), Decl(genericDefaults.ts, 418, 19), Decl(genericDefaults.ts, 419, 28)) +>T : Symbol(T, Decl(genericDefaults.ts, 418, 14), Decl(genericDefaults.ts, 419, 14), Decl(genericDefaults.ts, 420, 14)) interface i04 {} ->i04 : Symbol(i04, Decl(genericDefaults.ts, 85, 37), Decl(genericDefaults.ts, 87, 16), Decl(genericDefaults.ts, 88, 19), Decl(genericDefaults.ts, 89, 28)) ->T : Symbol(T, Decl(genericDefaults.ts, 88, 14), Decl(genericDefaults.ts, 89, 14), Decl(genericDefaults.ts, 90, 14)) ->U : Symbol(U, Decl(genericDefaults.ts, 90, 25)) +>i04 : Symbol(i04, Decl(genericDefaults.ts, 415, 37), Decl(genericDefaults.ts, 417, 16), Decl(genericDefaults.ts, 418, 19), Decl(genericDefaults.ts, 419, 28)) +>T : Symbol(T, Decl(genericDefaults.ts, 418, 14), Decl(genericDefaults.ts, 419, 14), Decl(genericDefaults.ts, 420, 14)) +>U : Symbol(U, Decl(genericDefaults.ts, 420, 25)) + +interface i05 { a: T; } +>i05 : Symbol(i05, Decl(genericDefaults.ts, 420, 40)) +>T : Symbol(T, Decl(genericDefaults.ts, 422, 14)) +>T : Symbol(T, Decl(genericDefaults.ts, 422, 14)) +>a : Symbol(i05.a, Decl(genericDefaults.ts, 422, 22)) +>T : Symbol(T, Decl(genericDefaults.ts, 422, 14)) + +const i05c00 = (x).a; +>i05c00 : Symbol(i05c00, Decl(genericDefaults.ts, 423, 5)) +>(x).a : Symbol(i05.a, Decl(genericDefaults.ts, 422, 22)) +>i05 : Symbol(i05, Decl(genericDefaults.ts, 420, 40)) +>x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) +>a : Symbol(i05.a, Decl(genericDefaults.ts, 422, 22)) + +const i05c01 = (>x).a; +>i05c01 : Symbol(i05c01, Decl(genericDefaults.ts, 424, 5)) +>(>x).a : Symbol(i05.a, Decl(genericDefaults.ts, 422, 22)) +>i05 : Symbol(i05, Decl(genericDefaults.ts, 420, 40)) +>x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) +>a : Symbol(i05.a, Decl(genericDefaults.ts, 422, 22)) + +interface i06 { a: [T, U]; } +>i06 : Symbol(i06, Decl(genericDefaults.ts, 424, 34)) +>T : Symbol(T, Decl(genericDefaults.ts, 426, 14)) +>U : Symbol(U, Decl(genericDefaults.ts, 426, 20)) +>U : Symbol(U, Decl(genericDefaults.ts, 426, 20)) +>T : Symbol(T, Decl(genericDefaults.ts, 426, 14)) +>a : Symbol(i06.a, Decl(genericDefaults.ts, 426, 29)) +>T : Symbol(T, Decl(genericDefaults.ts, 426, 14)) +>U : Symbol(U, Decl(genericDefaults.ts, 426, 20)) + +const i06c00 = (x).a; +>i06c00 : Symbol(i06c00, Decl(genericDefaults.ts, 427, 5)) +>(x).a : Symbol(i06.a, Decl(genericDefaults.ts, 426, 29)) +>i06 : Symbol(i06, Decl(genericDefaults.ts, 424, 34)) +>x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) +>a : Symbol(i06.a, Decl(genericDefaults.ts, 426, 29)) + +const i06c01 = (>x).a; +>i06c01 : Symbol(i06c01, Decl(genericDefaults.ts, 428, 5)) +>(>x).a : Symbol(i06.a, Decl(genericDefaults.ts, 426, 29)) +>i06 : Symbol(i06, Decl(genericDefaults.ts, 424, 34)) +>x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) +>a : Symbol(i06.a, Decl(genericDefaults.ts, 426, 29)) + +const i06c02 = (>x).a; +>i06c02 : Symbol(i06c02, Decl(genericDefaults.ts, 429, 5)) +>(>x).a : Symbol(i06.a, Decl(genericDefaults.ts, 426, 29)) +>i06 : Symbol(i06, Decl(genericDefaults.ts, 424, 34)) +>x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) +>a : Symbol(i06.a, Decl(genericDefaults.ts, 426, 29)) interface Base01 { a: T; } ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 90, 40), Decl(genericDefaults.ts, 95, 13)) ->T : Symbol(T, Decl(genericDefaults.ts, 92, 17)) ->a : Symbol(Base01.a, Decl(genericDefaults.ts, 92, 21)) ->T : Symbol(T, Decl(genericDefaults.ts, 92, 17)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 429, 42), Decl(genericDefaults.ts, 434, 13)) +>T : Symbol(T, Decl(genericDefaults.ts, 431, 17)) +>a : Symbol(Base01.a, Decl(genericDefaults.ts, 431, 21)) +>T : Symbol(T, Decl(genericDefaults.ts, 431, 17)) interface Base01Constructor { new (a?: T): Base01; } ->Base01Constructor : Symbol(Base01Constructor, Decl(genericDefaults.ts, 92, 29)) ->T : Symbol(T, Decl(genericDefaults.ts, 93, 35)) ->a : Symbol(a, Decl(genericDefaults.ts, 93, 47)) ->T : Symbol(T, Decl(genericDefaults.ts, 93, 35)) ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 90, 40), Decl(genericDefaults.ts, 95, 13)) ->T : Symbol(T, Decl(genericDefaults.ts, 93, 35)) +>Base01Constructor : Symbol(Base01Constructor, Decl(genericDefaults.ts, 431, 29)) +>T : Symbol(T, Decl(genericDefaults.ts, 432, 35)) +>a : Symbol(a, Decl(genericDefaults.ts, 432, 47)) +>T : Symbol(T, Decl(genericDefaults.ts, 432, 35)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 429, 42), Decl(genericDefaults.ts, 434, 13)) +>T : Symbol(T, Decl(genericDefaults.ts, 432, 35)) declare const Base01: Base01Constructor; ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 90, 40), Decl(genericDefaults.ts, 95, 13)) ->Base01Constructor : Symbol(Base01Constructor, Decl(genericDefaults.ts, 92, 29)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 429, 42), Decl(genericDefaults.ts, 434, 13)) +>Base01Constructor : Symbol(Base01Constructor, Decl(genericDefaults.ts, 431, 29)) const Base01c00 = new Base01(); ->Base01c00 : Symbol(Base01c00, Decl(genericDefaults.ts, 96, 5)) ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 90, 40), Decl(genericDefaults.ts, 95, 13)) +>Base01c00 : Symbol(Base01c00, Decl(genericDefaults.ts, 435, 5)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 429, 42), Decl(genericDefaults.ts, 434, 13)) const Base01c01 = new Base01(1); ->Base01c01 : Symbol(Base01c01, Decl(genericDefaults.ts, 97, 5)) ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 90, 40), Decl(genericDefaults.ts, 95, 13)) +>Base01c01 : Symbol(Base01c01, Decl(genericDefaults.ts, 436, 5)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 429, 42), Decl(genericDefaults.ts, 434, 13)) const Base01c02 = new Base01(); ->Base01c02 : Symbol(Base01c02, Decl(genericDefaults.ts, 98, 5)) ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 90, 40), Decl(genericDefaults.ts, 95, 13)) +>Base01c02 : Symbol(Base01c02, Decl(genericDefaults.ts, 437, 5)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 429, 42), Decl(genericDefaults.ts, 434, 13)) const Base01c03 = new Base01(1); ->Base01c03 : Symbol(Base01c03, Decl(genericDefaults.ts, 99, 5)) ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 90, 40), Decl(genericDefaults.ts, 95, 13)) +>Base01c03 : Symbol(Base01c03, Decl(genericDefaults.ts, 438, 5)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 429, 42), Decl(genericDefaults.ts, 434, 13)) declare class Derived01 extends Base01 { } ->Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 99, 40)) ->T : Symbol(T, Decl(genericDefaults.ts, 101, 24)) ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 90, 40), Decl(genericDefaults.ts, 95, 13)) ->T : Symbol(T, Decl(genericDefaults.ts, 101, 24)) +>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 438, 40)) +>T : Symbol(T, Decl(genericDefaults.ts, 440, 24)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 429, 42), Decl(genericDefaults.ts, 434, 13)) +>T : Symbol(T, Decl(genericDefaults.ts, 440, 24)) const Derived01c00 = new Derived01(); ->Derived01c00 : Symbol(Derived01c00, Decl(genericDefaults.ts, 102, 5)) ->Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 99, 40)) +>Derived01c00 : Symbol(Derived01c00, Decl(genericDefaults.ts, 441, 5)) +>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 438, 40)) const Derived01c01 = new Derived01(1); ->Derived01c01 : Symbol(Derived01c01, Decl(genericDefaults.ts, 103, 5)) ->Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 99, 40)) +>Derived01c01 : Symbol(Derived01c01, Decl(genericDefaults.ts, 442, 5)) +>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 438, 40)) const Derived01c02 = new Derived01(); ->Derived01c02 : Symbol(Derived01c02, Decl(genericDefaults.ts, 104, 5)) ->Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 99, 40)) +>Derived01c02 : Symbol(Derived01c02, Decl(genericDefaults.ts, 443, 5)) +>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 438, 40)) const Derived01c03 = new Derived01(1); ->Derived01c03 : Symbol(Derived01c03, Decl(genericDefaults.ts, 105, 5)) ->Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 99, 40)) +>Derived01c03 : Symbol(Derived01c03, Decl(genericDefaults.ts, 444, 5)) +>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 438, 40)) declare class Derived02 extends Base01 { } ->Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 105, 46)) ->T : Symbol(T, Decl(genericDefaults.ts, 107, 24)) ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 90, 40), Decl(genericDefaults.ts, 95, 13)) ->T : Symbol(T, Decl(genericDefaults.ts, 107, 24)) +>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 444, 46)) +>T : Symbol(T, Decl(genericDefaults.ts, 446, 24)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 429, 42), Decl(genericDefaults.ts, 434, 13)) +>T : Symbol(T, Decl(genericDefaults.ts, 446, 24)) const Derived02c00 = new Derived02(); ->Derived02c00 : Symbol(Derived02c00, Decl(genericDefaults.ts, 108, 5)) ->Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 105, 46)) +>Derived02c00 : Symbol(Derived02c00, Decl(genericDefaults.ts, 447, 5)) +>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 444, 46)) const Derived02c01 = new Derived02(1); ->Derived02c01 : Symbol(Derived02c01, Decl(genericDefaults.ts, 109, 5)) ->Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 105, 46)) +>Derived02c01 : Symbol(Derived02c01, Decl(genericDefaults.ts, 448, 5)) +>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 444, 46)) const Derived02c02 = new Derived02(); ->Derived02c02 : Symbol(Derived02c02, Decl(genericDefaults.ts, 110, 5)) ->Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 105, 46)) +>Derived02c02 : Symbol(Derived02c02, Decl(genericDefaults.ts, 449, 5)) +>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 444, 46)) const Derived02c03 = new Derived02(1); ->Derived02c03 : Symbol(Derived02c03, Decl(genericDefaults.ts, 111, 5)) ->Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 105, 46)) +>Derived02c03 : Symbol(Derived02c03, Decl(genericDefaults.ts, 450, 5)) +>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 444, 46)) diff --git a/tests/baselines/reference/genericDefaults.types b/tests/baselines/reference/genericDefaults.types index 4977d2d889601..c8e8655334655 100644 --- a/tests/baselines/reference/genericDefaults.types +++ b/tests/baselines/reference/genericDefaults.types @@ -1,50 +1,298 @@ === tests/cases/compiler/genericDefaults.ts === +interface A { a: number; } +>A : A +>a : number + +interface B { b: number; } +>B : B +>b : number + +interface C { c: number; } +>C : C +>c : number + +interface D { d: number; } +>D : D +>d : number + +interface AB { a: number; b: number; } +>AB : AB +>a : number +>b : number + +interface BC { b: number; c: number; } +>BC : BC +>b : number +>c : number + +declare const a: A; +>a : A +>A : A + +declare const b: B; +>b : B +>B : B + +declare const c: C; +>c : C +>C : C + +declare const d: D; +>d : D +>D : D + +declare const ab: AB; +>ab : AB +>AB : AB + +declare const bc: BC; +>bc : BC +>BC : BC + declare const x: any; >x : any -declare function f00(a?: T): T; ->f00 : (a?: T) => T +// function without type parameters +declare function f00(a?: A): A; +>f00 : (a?: A) => A +>a : A +>A : A +>A : A + +// no inference +f00(); +>f00() : A +>f00 : (a?: A) => A + +f00(a); +>f00(a) : A +>f00 : (a?: A) => A +>a : A + +// function with a type parameter without a default +declare function f01(a?: T): T; +>f01 : (a?: T) => T >T : T >a : T >T : T >T : T -const f00c00 = f00(); ->f00c00 : number ->f00() : number ->f00 : (a?: T) => T - -const f00c01 = f00(1); ->f00c01 : 1 ->f00(1) : 1 ->f00 : (a?: T) => T ->1 : 1 +// inference +f01(); +>f01() : {} +>f01 : (a?: T) => T + +f01(a); +>f01(a) : A +>f01 : (a?: T) => T +>a : A + +// no inference, fully supplied +f01(); +>f01() : A +>f01 : (a?: T) => T +>A : A + +f01(a); +>f01(a) : A +>f01 : (a?: T) => T +>A : A +>a : A + +// function with a type paramter with a default +declare function f02(a?: T): T; +>f02 : (a?: T) => T +>T : T +>A : A +>a : T +>T : T +>T : T -const f00c02 = f00("a"); ->f00c02 : "a" ->f00("a") : "a" ->f00 : (a?: T) => T ->"a" : "a" - -const f00c03 = f00(); ->f00c03 : number ->f00() : number ->f00 : (a?: T) => T - -const f00c04 = f00(1); ->f00c04 : number ->f00(1) : number ->f00 : (a?: T) => T ->1 : 1 +// inference +f02(); +>f02() : A +>f02 : (a?: T) => T + +f02(a); +>f02(a) : A +>f02 : (a?: T) => T +>a : A + +f02(b); +>f02(b) : B +>f02 : (a?: T) => T +>b : B + +// no inference, fully supplied +f02(); +>f02() : A +>f02 : (a?: T) => T +>A : A + +f02(a); +>f02(a) : A +>f02 : (a?: T) => T +>A : A +>a : A + +f02(); +>f02() : B +>f02 : (a?: T) => T +>B : B + +f02(b); +>f02(b) : B +>f02 : (a?: T) => T +>B : B +>b : B + +// function with a type parameter with a default that refers to itself +declare function f03(a?: T): T; +>f03 : (a?: T) => T +>T : T +>T : T +>a : T +>T : T +>T : T -const f00c05 = f00("a"); ->f00c05 : string ->f00("a") : string ->f00 : (a?: T) => T ->"a" : "a" +// inference +f03(); +>f03() : {} +>f03 : (a?: T) => T + +f03(a); +>f03(a) : A +>f03 : (a?: T) => T +>a : A + +f03(b); +>f03(b) : B +>f03 : (a?: T) => T +>b : B + +// no inference, fully supplied +f03(); +>f03() : A +>f03 : (a?: T) => T +>A : A + +f03(a); +>f03(a) : A +>f03 : (a?: T) => T +>A : A +>a : A + +f03(); +>f03() : B +>f03 : (a?: T) => T +>B : B + +f03(b); +>f03(b) : B +>f03 : (a?: T) => T +>B : B +>b : B + +// function with a type paramter without a default and a type parameter with a default +declare function f04(a?: T, b?: U): [T, U]; +>f04 : (a?: T, b?: U) => [T, U] +>T : T +>U : U +>B : B +>a : T +>T : T +>b : U +>U : U +>T : T +>U : U -declare function f01(a?: T, b?: U): [T, U]; ->f01 : (a?: T, b?: U) => [T, U] +// inference +f04(); +>f04() : [{}, B] +>f04 : (a?: T, b?: U) => [T, U] + +f04(a); +>f04(a) : [A, B] +>f04 : (a?: T, b?: U) => [T, U] +>a : A + +f04(a, b); +>f04(a, b) : [A, B] +>f04 : (a?: T, b?: U) => [T, U] +>a : A +>b : B + +f04(a, c); +>f04(a, c) : [A, C] +>f04 : (a?: T, b?: U) => [T, U] +>a : A +>c : C + +// no inference, partially supplied +f04(); +>f04() : [A, B] +>f04 : (a?: T, b?: U) => [T, U] +>A : A + +f04(a); +>f04(a) : [A, B] +>f04 : (a?: T, b?: U) => [T, U] +>A : A +>a : A + +f04(a, b); +>f04(a, b) : [A, B] +>f04 : (a?: T, b?: U) => [T, U] +>A : A +>a : A +>b : B + +// no inference, fully supplied +f04(); +>f04() : [A, B] +>f04 : (a?: T, b?: U) => [T, U] +>A : A +>B : B + +f04(a); +>f04(a) : [A, B] +>f04 : (a?: T, b?: U) => [T, U] +>A : A +>B : B +>a : A + +f04(a, b); +>f04(a, b) : [A, B] +>f04 : (a?: T, b?: U) => [T, U] +>A : A +>B : B +>a : A +>b : B + +f04(); +>f04() : [A, C] +>f04 : (a?: T, b?: U) => [T, U] +>A : A +>C : C + +f04(a); +>f04(a) : [A, C] +>f04 : (a?: T, b?: U) => [T, U] +>A : A +>C : C +>a : A + +f04(a, c); +>f04(a, c) : [A, C] +>f04 : (a?: T, b?: U) => [T, U] +>A : A +>C : C +>a : A +>c : C + +// function with a type parameter without a default and a type parameter with a default that refers to an earlier type parameter +declare function f05(a?: T, b?: U): [T, U]; +>f05 : (a?: T, b?: U) => [T, U] >T : T >U : U >T : T @@ -55,63 +303,74 @@ declare function f01(a?: T, b?: U): [T, U]; >T : T >U : U -const f01c00 = f01(); ->f01c00 : [{}, {}] ->f01() : [{}, {}] ->f01 : (a?: T, b?: U) => [T, U] - -const f01c01 = f01(1); ->f01c01 : [number, number] ->f01(1) : [number, number] ->f01 : (a?: T, b?: U) => [T, U] ->1 : 1 - -const f01c02 = f01(1, "a"); ->f01c02 : [number, string] ->f01(1, "a") : [number, string] ->f01 : (a?: T, b?: U) => [T, U] ->1 : 1 ->"a" : "a" - -const f01c03 = f01(); ->f01c03 : [number, number] ->f01() : [number, number] ->f01 : (a?: T, b?: U) => [T, U] - -const f01c04 = f01(1); ->f01c04 : [number, number] ->f01(1) : [number, number] ->f01 : (a?: T, b?: U) => [T, U] ->1 : 1 - -const f01c05 = f01(1, 2); ->f01c05 : [number, number] ->f01(1, 2) : [number, number] ->f01 : (a?: T, b?: U) => [T, U] ->1 : 1 ->2 : 2 - -const f01c06 = f01(); ->f01c06 : [number, string] ->f01() : [number, string] ->f01 : (a?: T, b?: U) => [T, U] - -const f01c07 = f01(1); ->f01c07 : [number, string] ->f01(1) : [number, string] ->f01 : (a?: T, b?: U) => [T, U] ->1 : 1 - -const f01c08 = f01(1, "a"); ->f01c08 : [number, string] ->f01(1, "a") : [number, string] ->f01 : (a?: T, b?: U) => [T, U] ->1 : 1 ->"a" : "a" - -declare function f02(a?: T, b?: U): [T, U]; ->f02 : (a?: T, b?: U) => [T, U] +// inference +f05(); +>f05() : [{}, {}] +>f05 : (a?: T, b?: U) => [T, U] + +f05(a); +>f05(a) : [A, A] +>f05 : (a?: T, b?: U) => [T, U] +>a : A + +f05(a, a); +>f05(a, a) : [A, A] +>f05 : (a?: T, b?: U) => [T, U] +>a : A +>a : A + +f05(a, b); +>f05(a, b) : [A, B] +>f05 : (a?: T, b?: U) => [T, U] +>a : A +>b : B + +// no inference, partially supplied +f05(); +>f05() : [A, A] +>f05 : (a?: T, b?: U) => [T, U] +>A : A + +f05(a); +>f05(a) : [A, A] +>f05 : (a?: T, b?: U) => [T, U] +>A : A +>a : A + +f05(a, a); +>f05(a, a) : [A, A] +>f05 : (a?: T, b?: U) => [T, U] +>A : A +>a : A +>a : A + +// no inference, fully supplied +f05(); +>f05() : [A, B] +>f05 : (a?: T, b?: U) => [T, U] +>A : A +>B : B + +f05(a); +>f05(a) : [A, B] +>f05 : (a?: T, b?: U) => [T, U] +>A : A +>B : B +>a : A + +f05(a, b); +>f05(a, b) : [A, B] +>f05 : (a?: T, b?: U) => [T, U] +>A : A +>B : B +>a : A +>b : B + +// function with a type parameter with a default that refers to an earlier type parameter with a default +declare function f06(a?: T, b?: U): [T, U]; +>f06 : (a?: T, b?: U) => [T, U] >T : T +>A : A >U : U >T : T >a : T @@ -121,65 +380,345 @@ declare function f02(a?: T, b?: U): [T, U]; >T : T >U : U -const f02c00 = f02(); ->f02c00 : [number, number] ->f02() : [number, number] ->f02 : (a?: T, b?: U) => [T, U] - -const f02c01 = f02(1); ->f02c01 : [1, 1] ->f02(1) : [1, 1] ->f02 : (a?: T, b?: U) => [T, U] ->1 : 1 - -const f02c02 = f02(1, "a"); ->f02c02 : [1, string] ->f02(1, "a") : [1, string] ->f02 : (a?: T, b?: U) => [T, U] ->1 : 1 ->"a" : "a" - -const f02c03 = f02(); ->f02c03 : [number, number] ->f02() : [number, number] ->f02 : (a?: T, b?: U) => [T, U] - -const f02c04 = f02(1); ->f02c04 : [number, number] ->f02(1) : [number, number] ->f02 : (a?: T, b?: U) => [T, U] ->1 : 1 - -const f02c05 = f02(1, 2); ->f02c05 : [number, number] ->f02(1, 2) : [number, number] ->f02 : (a?: T, b?: U) => [T, U] ->1 : 1 ->2 : 2 - -const f02c06 = f02(); ->f02c06 : [number, string] ->f02() : [number, string] ->f02 : (a?: T, b?: U) => [T, U] - -const f02c07 = f02(1); ->f02c07 : [number, string] ->f02(1) : [number, string] ->f02 : (a?: T, b?: U) => [T, U] ->1 : 1 - -const f02c08 = f02(1, "a"); ->f02c08 : [number, string] ->f02(1, "a") : [number, string] ->f02 : (a?: T, b?: U) => [T, U] ->1 : 1 ->"a" : "a" - -declare function f03(a?: T, b?: U): [T, U]; ->f03 : (a?: T, b?: U) => [T, U] +// inference +f06(); +>f06() : [A, A] +>f06 : (a?: T, b?: U) => [T, U] + +f06(a); +>f06(a) : [A, A] +>f06 : (a?: T, b?: U) => [T, U] +>a : A + +f06(a, a); +>f06(a, a) : [A, A] +>f06 : (a?: T, b?: U) => [T, U] +>a : A +>a : A + +f06(a, b); +>f06(a, b) : [A, B] +>f06 : (a?: T, b?: U) => [T, U] +>a : A +>b : B + +f06(b, a); +>f06(b, a) : [B, A] +>f06 : (a?: T, b?: U) => [T, U] +>b : B +>a : A + +f06(b, b); +>f06(b, b) : [B, B] +>f06 : (a?: T, b?: U) => [T, U] +>b : B +>b : B + +// no inference, partially supplied +f06(); +>f06() : [A, A] +>f06 : (a?: T, b?: U) => [T, U] +>A : A + +f06(a); +>f06(a) : [A, A] +>f06 : (a?: T, b?: U) => [T, U] +>A : A +>a : A + +f06(a, a); +>f06(a, a) : [A, A] +>f06 : (a?: T, b?: U) => [T, U] +>A : A +>a : A +>a : A + +f06(); +>f06() : [B, B] +>f06 : (a?: T, b?: U) => [T, U] +>B : B + +f06(b); +>f06(b) : [B, B] +>f06 : (a?: T, b?: U) => [T, U] +>B : B +>b : B + +f06(b, b); +>f06(b, b) : [B, B] +>f06 : (a?: T, b?: U) => [T, U] +>B : B +>b : B +>b : B + +// no inference, fully supplied +f06(); +>f06() : [A, B] +>f06 : (a?: T, b?: U) => [T, U] +>A : A +>B : B + +f06(a); +>f06(a) : [A, B] +>f06 : (a?: T, b?: U) => [T, U] +>A : A +>B : B +>a : A + +f06(a, b); +>f06(a, b) : [A, B] +>f06 : (a?: T, b?: U) => [T, U] +>A : A +>B : B +>a : A +>b : B + +f06(); +>f06() : [B, C] +>f06 : (a?: T, b?: U) => [T, U] +>B : B +>C : C + +f06(b); +>f06(b) : [B, C] +>f06 : (a?: T, b?: U) => [T, U] +>B : B +>C : C +>b : B + +f06(b, c); +>f06(b, c) : [B, C] +>f06 : (a?: T, b?: U) => [T, U] +>B : B +>C : C +>b : B +>c : C + +// function with a type parameter without a default and a type parameter with a default that refers to an earlier type parameter with a default +declare function f07(a?: T, b?: U, c?: V): [T, U, V]; +>f07 : (a?: T, b?: U, c?: V) => [T, U, V] >T : T >U : U +>B : B +>V : V +>U : U +>a : T +>T : T +>b : U +>U : U +>c : V +>V : V >T : T +>U : U +>V : V + +// inference +f07(); +>f07() : [{}, B, B] +>f07 : (a?: T, b?: U, c?: V) => [T, U, V] + +f07(a, b); +>f07(a, b) : [A, B, B] +>f07 : (a?: T, b?: U, c?: V) => [T, U, V] +>a : A +>b : B + +f07(a, c); +>f07(a, c) : [A, C, C] +>f07 : (a?: T, b?: U, c?: V) => [T, U, V] +>a : A +>c : C + +f07(a, b, b); +>f07(a, b, b) : [A, B, B] +>f07 : (a?: T, b?: U, c?: V) => [T, U, V] +>a : A +>b : B +>b : B + +f07(a, b, c); +>f07(a, b, c) : [A, B, C] +>f07 : (a?: T, b?: U, c?: V) => [T, U, V] +>a : A +>b : B +>c : C + +f07(a, c, b); +>f07(a, c, b) : [A, C, B] +>f07 : (a?: T, b?: U, c?: V) => [T, U, V] +>a : A +>c : C +>b : B + +f07(a, c, c); +>f07(a, c, c) : [A, C, C] +>f07 : (a?: T, b?: U, c?: V) => [T, U, V] +>a : A +>c : C +>c : C + +// no inference, partially supplied +f07(); +>f07() : [A, B, B] +>f07 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A + +f07(a); +>f07(a) : [A, B, B] +>f07 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>a : A + +f07(a, b); +>f07(a, b) : [A, B, B] +>f07 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>a : A +>b : B + +f07(a, b, b); +>f07(a, b, b) : [A, B, B] +>f07 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>a : A +>b : B +>b : B + +f07(); +>f07() : [A, B, B] +>f07 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B + +f07(a); +>f07(a) : [A, B, B] +>f07 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>a : A + +f07(a, b); +>f07(a, b) : [A, B, B] +>f07 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>a : A +>b : B + +f07(a, b, b); +>f07(a, b, b) : [A, B, B] +>f07 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>a : A +>b : B +>b : B + +f07(); +>f07() : [A, C, C] +>f07 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>C : C + +f07(a); +>f07(a) : [A, C, C] +>f07 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>C : C +>a : A + +f07(a, c); +>f07(a, c) : [A, C, C] +>f07 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>C : C +>a : A +>c : C + +f07(a, c, c); +>f07(a, c, c) : [A, C, C] +>f07 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>C : C +>a : A +>c : C +>c : C + +// no inference, fully supplied +f07(); +>f07() : [A, B, C] +>f07 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>C : C + +f07(a); +>f07(a) : [A, B, C] +>f07 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>C : C +>a : A + +f07(a, b); +>f07(a, b) : [A, B, C] +>f07 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>C : C +>a : A +>b : B + +f07(a, b, c); +>f07(a, b, c) : [A, B, C] +>f07 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>C : C +>a : A +>b : B +>c : C + +f07(); +>f07() : [A, C, A] +>f07 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>C : C +>A : A + +f07(a); +>f07(a) : [A, C, A] +>f07 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>C : C +>A : A +>a : A + +f07(a, c); +>f07(a, c) : [A, C, D] +>f07 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>C : C +>D : D +>a : A +>c : C + +f07(a, c, d); +>f07(a, c, d) : [A, C, D] +>f07 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>C : C +>D : D +>a : A +>c : C +>d : D + +// function with a type parameter with a default that refers to an earlier type parameter with a constraint +declare function f08(a?: T, b?: U): [T, U]; +>f08 : (a?: T, b?: U) => [T, U] +>T : T +>A : A +>U : U >T : T >a : T >T : T @@ -188,66 +727,76 @@ declare function f03(a?: T, b?: U): [T, U]; >T : T >U : U -const f03c00 = f03(); ->f03c00 : [number, number] ->f03() : [number, number] ->f03 : (a?: T, b?: U) => [T, U] - -const f03c01 = f03(1); ->f03c01 : [1, 1] ->f03(1) : [1, 1] ->f03 : (a?: T, b?: U) => [T, U] ->1 : 1 - -const f03c02 = f03(1, 1); ->f03c02 : [1, 1] ->f03(1, 1) : [1, 1] ->f03 : (a?: T, b?: U) => [T, U] ->1 : 1 ->1 : 1 - -const f03c03 = f03(); ->f03c03 : [number, number] ->f03() : [number, number] ->f03 : (a?: T, b?: U) => [T, U] - -const f03c04 = f03(1); ->f03c04 : [number, number] ->f03(1) : [number, number] ->f03 : (a?: T, b?: U) => [T, U] ->1 : 1 - -const f03c05 = f03(1, 2); ->f03c05 : [number, number] ->f03(1, 2) : [number, number] ->f03 : (a?: T, b?: U) => [T, U] ->1 : 1 ->2 : 2 - -const f03c06 = f03(); ->f03c06 : [number, number] ->f03() : [number, number] ->f03 : (a?: T, b?: U) => [T, U] - -const f03c07 = f03(1); ->f03c07 : [number, number] ->f03(1) : [number, number] ->f03 : (a?: T, b?: U) => [T, U] ->1 : 1 - -const f03c08 = f03(1, 2); ->f03c08 : [number, number] ->f03(1, 2) : [number, number] ->f03 : (a?: T, b?: U) => [T, U] ->1 : 1 ->2 : 2 - -declare function f04(a?: T, b?: U): [T, U]; ->f04 : (a?: T, b?: U) => [T, U] +// inference +f08(); +>f08() : [A, A] +>f08 : (a?: T, b?: U) => [T, U] + +f08(a); +>f08(a) : [A, A] +>f08 : (a?: T, b?: U) => [T, U] +>a : A + +f08(a, a); +>f08(a, a) : [A, A] +>f08 : (a?: T, b?: U) => [T, U] +>a : A +>a : A + +f08(a, b); +>f08(a, b) : [A, B] +>f08 : (a?: T, b?: U) => [T, U] +>a : A +>b : B + +// no inference, partially supplied +f08(); +>f08() : [A, A] +>f08 : (a?: T, b?: U) => [T, U] +>A : A + +f08(a); +>f08(a) : [A, A] +>f08 : (a?: T, b?: U) => [T, U] +>A : A +>a : A + +f08(a, a); +>f08(a, a) : [A, A] +>f08 : (a?: T, b?: U) => [T, U] +>A : A +>a : A +>a : A + +// no inference, fully supplied +f08(); +>f08() : [A, B] +>f08 : (a?: T, b?: U) => [T, U] +>A : A +>B : B + +f08(a); +>f08(a) : [A, B] +>f08 : (a?: T, b?: U) => [T, U] +>A : A +>B : B +>a : A + +f08(a, b); +>f08(a, b) : [A, B] +>f08 : (a?: T, b?: U) => [T, U] +>A : A +>B : B +>a : A +>b : B + +// function with a type parameter with a constraint and a default that refers to an earlier type parameter +declare function f09(a?: T, b?: U): [T, U]; +>f09 : (a?: T, b?: U) => [T, U] >T : T >U : U >T : T ->a : number +>T : T >a : T >T : T >b : U @@ -255,66 +804,84 @@ declare function f04(a?: T, b?: U): [T, U]; >T : T >U : U -const f04c00 = f04(); ->f04c00 : [{}, {} | { a: number; }] ->f04() : [{}, {} | { a: number; }] ->f04 : (a?: T, b?: U) => [T, U] - -const f04c01 = f04(1); ->f04c01 : [number, number | { a: number; }] ->f04(1) : [number, number | { a: number; }] ->f04 : (a?: T, b?: U) => [T, U] ->1 : 1 - -const f04c02 = f04(1, 1); ->f04c02 : [number, number] ->f04(1, 1) : [number, number] ->f04 : (a?: T, b?: U) => [T, U] ->1 : 1 ->1 : 1 - -const f04c03 = f04(); ->f04c03 : [number, number | { a: number; }] ->f04() : [number, number | { a: number; }] ->f04 : (a?: T, b?: U) => [T, U] - -const f04c04 = f04(1); ->f04c04 : [number, number | { a: number; }] ->f04(1) : [number, number | { a: number; }] ->f04 : (a?: T, b?: U) => [T, U] ->1 : 1 - -const f04c05 = f04(1, 2); ->f04c05 : [number, number | { a: number; }] ->f04(1, 2) : [number, number | { a: number; }] ->f04 : (a?: T, b?: U) => [T, U] ->1 : 1 ->2 : 2 - -const f04c06 = f04(); ->f04c06 : [number, number] ->f04() : [number, number] ->f04 : (a?: T, b?: U) => [T, U] - -const f04c07 = f04(1); ->f04c07 : [number, number] ->f04(1) : [number, number] ->f04 : (a?: T, b?: U) => [T, U] ->1 : 1 - -const f04c08 = f04(1, 2); ->f04c08 : [number, number] ->f04(1, 2) : [number, number] ->f04 : (a?: T, b?: U) => [T, U] ->1 : 1 ->2 : 2 - -declare function f05(a?: T, b?: U): [T, U]; ->f05 : (a?: T, b?: U) => [T, U] +// inference +f09(); +>f09() : [{}, {}] +>f09 : (a?: T, b?: U) => [T, U] + +f09(a); +>f09(a) : [A, A] +>f09 : (a?: T, b?: U) => [T, U] +>a : A + +f09(a, a); +>f09(a, a) : [A, A] +>f09 : (a?: T, b?: U) => [T, U] +>a : A +>a : A + +f09(a, ab); +>f09(a, ab) : [A, AB] +>f09 : (a?: T, b?: U) => [T, U] +>a : A +>ab : AB + +// no inference, partially supplied +f09(); +>f09() : [A, A] +>f09 : (a?: T, b?: U) => [T, U] +>A : A + +f09(a); +>f09(a) : [A, A] +>f09 : (a?: T, b?: U) => [T, U] +>A : A +>a : A + +f09(a, a); +>f09(a, a) : [A, A] +>f09 : (a?: T, b?: U) => [T, U] +>A : A +>a : A +>a : A + +f09(a, ab); +>f09(a, ab) : [A, A] +>f09 : (a?: T, b?: U) => [T, U] +>A : A +>a : A +>ab : AB + +// no inference, fully supplied +f09(); +>f09() : [A, AB] +>f09 : (a?: T, b?: U) => [T, U] +>A : A +>AB : AB + +f09(a); +>f09(a) : [A, AB] +>f09 : (a?: T, b?: U) => [T, U] +>A : A +>AB : AB +>a : A + +f09(a, ab); +>f09(a, ab) : [A, AB] +>f09 : (a?: T, b?: U) => [T, U] +>A : A +>AB : AB +>a : A +>ab : AB + +// function with a type parameter with a constraint and a default that refers to an earlier type parameter with a constraint +declare function f10(a?: T, b?: U): [T, U]; +>f10 : (a?: T, b?: U) => [T, U] >T : T +>A : A >U : U >T : T ->b : number +>T : T >a : T >T : T >b : U @@ -322,66 +889,1179 @@ declare function f05(a?: T, b?: U): [T, U]; >T : T >U : U -const f05c00 = f05(); ->f05c00 : [{}, {} & { b: number; }] ->f05() : [{}, {} & { b: number; }] ->f05 : (a?: T, b?: U) => [T, U] - -const f05c01 = f05(1); ->f05c01 : [number, number & { b: number; }] ->f05(1) : [number, number & { b: number; }] ->f05 : (a?: T, b?: U) => [T, U] ->1 : 1 - -const f05c02 = f05(1, 1); ->f05c02 : [number, number] ->f05(1, 1) : [number, number] ->f05 : (a?: T, b?: U) => [T, U] ->1 : 1 ->1 : 1 +// inference +f10(); +>f10() : [A, A] +>f10 : (a?: T, b?: U) => [T, U] + +f10(a); +>f10(a) : [A, A] +>f10 : (a?: T, b?: U) => [T, U] +>a : A + +f10(a, a); +>f10(a, a) : [A, A] +>f10 : (a?: T, b?: U) => [T, U] +>a : A +>a : A + +f10(a, ab); +>f10(a, ab) : [A, AB] +>f10 : (a?: T, b?: U) => [T, U] +>a : A +>ab : AB + +// no inference, partially supplied +f10(); +>f10() : [A, A] +>f10 : (a?: T, b?: U) => [T, U] +>A : A + +f10(a); +>f10(a) : [A, A] +>f10 : (a?: T, b?: U) => [T, U] +>A : A +>a : A + +f10(a, a); +>f10(a, a) : [A, A] +>f10 : (a?: T, b?: U) => [T, U] +>A : A +>a : A +>a : A + +f10(a, ab); +>f10(a, ab) : [A, A] +>f10 : (a?: T, b?: U) => [T, U] +>A : A +>a : A +>ab : AB + +// no inference, fully supplied +f10(); +>f10() : [A, A] +>f10 : (a?: T, b?: U) => [T, U] +>A : A +>A : A + +f10(a); +>f10(a) : [A, A] +>f10 : (a?: T, b?: U) => [T, U] +>A : A +>A : A +>a : A + +f10(a, a); +>f10(a, a) : [A, A] +>f10 : (a?: T, b?: U) => [T, U] +>A : A +>A : A +>a : A +>a : A + +f10(a, ab); +>f10(a, ab) : [A, A] +>f10 : (a?: T, b?: U) => [T, U] +>A : A +>A : A +>a : A +>ab : AB + +f10(); +>f10() : [A, AB] +>f10 : (a?: T, b?: U) => [T, U] +>A : A +>AB : AB + +f10(a); +>f10(a) : [A, AB] +>f10 : (a?: T, b?: U) => [T, U] +>A : A +>AB : AB +>a : A + +f10(a, ab); +>f10(a, ab) : [A, AB] +>f10 : (a?: T, b?: U) => [T, U] +>A : A +>AB : AB +>a : A +>ab : AB + +// function with a type parameter with a default that refers to an earier type parameter in a union +declare function f11(a?: T, b?: U): [T, U]; +>f11 : (a?: T, b?: U) => [T, U] +>T : T +>U : U +>T : T +>B : B +>a : T +>T : T +>b : U +>U : U +>T : T +>U : U -const f05c03 = f05(); ->f05c03 : [number, number & { b: number; }] ->f05() : [number, number & { b: number; }] ->f05 : (a?: T, b?: U) => [T, U] +// inference +f11(); +>f11() : [{}, {} | B] +>f11 : (a?: T, b?: U) => [T, U] + +f11(a); +>f11(a) : [A, A | B] +>f11 : (a?: T, b?: U) => [T, U] +>a : A + +f11(a, a); +>f11(a, a) : [A, A] +>f11 : (a?: T, b?: U) => [T, U] +>a : A +>a : A + +f11(a, b); +>f11(a, b) : [A, B] +>f11 : (a?: T, b?: U) => [T, U] +>a : A +>b : B + +f11(a, c); +>f11(a, c) : [A, C] +>f11 : (a?: T, b?: U) => [T, U] +>a : A +>c : C + +// no inference, partially supplied +f11(); +>f11() : [A, A | B] +>f11 : (a?: T, b?: U) => [T, U] +>A : A + +f11(a); +>f11(a) : [A, A | B] +>f11 : (a?: T, b?: U) => [T, U] +>A : A +>a : A + +f11(a, a); +>f11(a, a) : [A, A | B] +>f11 : (a?: T, b?: U) => [T, U] +>A : A +>a : A +>a : A + +f11(a, b); +>f11(a, b) : [A, A | B] +>f11 : (a?: T, b?: U) => [T, U] +>A : A +>a : A +>b : B + +// no inference, fully supplied +f11(); +>f11() : [A, C] +>f11 : (a?: T, b?: U) => [T, U] +>A : A +>C : C + +f11(a); +>f11(a) : [A, C] +>f11 : (a?: T, b?: U) => [T, U] +>A : A +>C : C +>a : A + +f11(a, c); +>f11(a, c) : [A, C] +>f11 : (a?: T, b?: U) => [T, U] +>A : A +>C : C +>a : A +>c : C + +// function with a type parameter with a default that refers to an earlier type parameter in an intersection +declare function f12(a?: T, b?: U): [T, U]; +>f12 : (a?: T, b?: U) => [T, U] +>T : T +>U : U +>T : T +>B : B +>a : T +>T : T +>b : U +>U : U +>T : T +>U : U -const f05c04 = f05(1); ->f05c04 : [number, number & { b: number; }] ->f05(1) : [number, number & { b: number; }] ->f05 : (a?: T, b?: U) => [T, U] ->1 : 1 +// inference +f12(); +>f12() : [{}, {} & B] +>f12 : (a?: T, b?: U) => [T, U] + +f12(a); +>f12(a) : [A, A & B] +>f12 : (a?: T, b?: U) => [T, U] +>a : A + +f12(a, a); +>f12(a, a) : [A, A] +>f12 : (a?: T, b?: U) => [T, U] +>a : A +>a : A + +f12(a, b); +>f12(a, b) : [A, B] +>f12 : (a?: T, b?: U) => [T, U] +>a : A +>b : B + +f12(a, c); +>f12(a, c) : [A, C] +>f12 : (a?: T, b?: U) => [T, U] +>a : A +>c : C + +// no inference, partially supplied +f12(); +>f12() : [A, A & B] +>f12 : (a?: T, b?: U) => [T, U] +>A : A + +f12(a); +>f12(a) : [A, A & B] +>f12 : (a?: T, b?: U) => [T, U] +>A : A +>a : A + +f12(a, ab); +>f12(a, ab) : [A, A & B] +>f12 : (a?: T, b?: U) => [T, U] +>A : A +>a : A +>ab : AB + +// no inference, fully supplied +f12(); +>f12() : [A, C] +>f12 : (a?: T, b?: U) => [T, U] +>A : A +>C : C + +f12(a); +>f12(a) : [A, C] +>f12 : (a?: T, b?: U) => [T, U] +>A : A +>C : C +>a : A + +f12(a, c); +>f12(a, c) : [A, C] +>f12 : (a?: T, b?: U) => [T, U] +>A : A +>C : C +>a : A +>c : C + +// function with a type parameter with a default that refers to a later type parameter with a default +declare function f13(a?: T, b?: U): [T, U]; +>f13 : (a?: T, b?: U) => [T, U] +>T : T +>U : U +>U : U +>B : B +>a : T +>T : T +>b : U +>U : U +>T : T +>U : U -const f05c05 = f05<{ a: number }>({ a: 1 }, { a: 2, b: 3}); ->f05c05 : [{ a: number; }, { a: number; } & { b: number; }] ->f05<{ a: number }>({ a: 1 }, { a: 2, b: 3}) : [{ a: number; }, { a: number; } & { b: number; }] ->f05 : (a?: T, b?: U) => [T, U] ->a : number ->{ a: 1 } : { a: number; } ->a : number ->1 : 1 ->{ a: 2, b: 3} : { a: number; b: number; } ->a : number ->2 : 2 ->b : number ->3 : 3 +// inference +f13(); +>f13() : [{}, B] +>f13 : (a?: T, b?: U) => [T, U] + +f13(a); +>f13(a) : [A, B] +>f13 : (a?: T, b?: U) => [T, U] +>a : A + +f13(a, b); +>f13(a, b) : [A, B] +>f13 : (a?: T, b?: U) => [T, U] +>a : A +>b : B + +f13(a, c); +>f13(a, c) : [A, C] +>f13 : (a?: T, b?: U) => [T, U] +>a : A +>c : C + +// no inference, partially supplied +f13(); +>f13() : [A, B] +>f13 : (a?: T, b?: U) => [T, U] +>A : A + +f13(a); +>f13(a) : [A, B] +>f13 : (a?: T, b?: U) => [T, U] +>A : A +>a : A + +f13(a, b); +>f13(a, b) : [A, B] +>f13 : (a?: T, b?: U) => [T, U] +>A : A +>a : A +>b : B + +// no inference, fully supplied +f13(); +>f13() : [A, C] +>f13 : (a?: T, b?: U) => [T, U] +>A : A +>C : C + +f13(a); +>f13(a) : [A, C] +>f13 : (a?: T, b?: U) => [T, U] +>A : A +>C : C +>a : A + +f13(a, c); +>f13(a, c) : [A, C] +>f13 : (a?: T, b?: U) => [T, U] +>A : A +>C : C +>a : A +>c : C + +f13(a, c); +>f13(a, c) : [A, C] +>f13 : (a?: T, b?: U) => [T, U] +>A : A +>C : C +>a : A +>c : C + +// function with a type parameter without a default and a type parameter with a default that refers to a later type parameter with a default +declare function f14(a?: T, b?: U, c?: V): [T, U, V]; +>f14 : (a?: T, b?: U, c?: V) => [T, U, V] +>T : T +>U : U +>V : V +>V : V +>C : C +>a : T +>T : T +>b : U +>U : U +>c : V +>V : V +>T : T +>U : U +>V : V + +// inference +f14(); +>f14() : [{}, {}, C] +>f14 : (a?: T, b?: U, c?: V) => [T, U, V] + +f14(a); +>f14(a) : [A, {}, C] +>f14 : (a?: T, b?: U, c?: V) => [T, U, V] +>a : A + +f14(a, b); +>f14(a, b) : [A, B, C] +>f14 : (a?: T, b?: U, c?: V) => [T, U, V] +>a : A +>b : B + +f14(a, b, c); +>f14(a, b, c) : [A, B, C] +>f14 : (a?: T, b?: U, c?: V) => [T, U, V] +>a : A +>b : B +>c : C + +f14(a, b, d); +>f14(a, b, d) : [A, B, D] +>f14 : (a?: T, b?: U, c?: V) => [T, U, V] +>a : A +>b : B +>d : D + +// no inference, partially supplied +f14(); +>f14() : [A, {}, C] +>f14 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A + +f14(a); +>f14(a) : [A, {}, C] +>f14 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>a : A + +f14(a, b); +>f14(a, b) : [A, {}, C] +>f14 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>a : A +>b : B + +f14(a, b, c); +>f14(a, b, c) : [A, {}, C] +>f14 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>a : A +>b : B +>c : C + +f14(); +>f14() : [A, B, C] +>f14 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B + +f14(a); +>f14(a) : [A, B, C] +>f14 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>a : A + +f14(a, b); +>f14(a, b) : [A, B, C] +>f14 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>a : A +>b : B + +f14(a, b, c); +>f14(a, b, c) : [A, B, C] +>f14 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>a : A +>b : B +>c : C + +// no inference fully supplied +f14(); +>f14() : [A, B, D] +>f14 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>D : D + +f14(a); +>f14(a) : [A, B, D] +>f14 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>D : D +>a : A + +f14(a, b); +>f14(a, b) : [A, B, D] +>f14 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>D : D +>a : A +>b : B + +f14(a, b, d); +>f14(a, b, d) : [A, B, D] +>f14 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>D : D +>a : A +>b : B +>d : D + +// function with two type parameters with defaults that mutually refer to each other +declare function f15(a?: T, b?: U): [T, U]; +>f15 : (a?: T, b?: U) => [T, U] +>T : T +>U : U +>U : U +>T : T +>a : T +>T : T +>b : U +>U : U +>T : T +>U : U -const f05c06 = f05(); ->f05c06 : [number, number] ->f05() : [number, number] ->f05 : (a?: T, b?: U) => [T, U] +// inference +f15(); +>f15() : [{}, {}] +>f15 : (a?: T, b?: U) => [T, U] + +f15(a); +>f15(a) : [A, A] +>f15 : (a?: T, b?: U) => [T, U] +>a : A + +f15(a, b); +>f15(a, b) : [A, B] +>f15 : (a?: T, b?: U) => [T, U] +>a : A +>b : B + +// no inference, partially supplied +f15(); +>f15() : [A, A] +>f15 : (a?: T, b?: U) => [T, U] +>A : A + +f15(a); +>f15(a) : [A, A] +>f15 : (a?: T, b?: U) => [T, U] +>A : A +>a : A + +f15(a, a); +>f15(a, a) : [A, A] +>f15 : (a?: T, b?: U) => [T, U] +>A : A +>a : A +>a : A + +// no inference, fully supplied +f15(); +>f15() : [A, B] +>f15 : (a?: T, b?: U) => [T, U] +>A : A +>B : B + +f15(a); +>f15(a) : [A, B] +>f15 : (a?: T, b?: U) => [T, U] +>A : A +>B : B +>a : A + +f15(a, b); +>f15(a, b) : [A, B] +>f15 : (a?: T, b?: U) => [T, U] +>A : A +>B : B +>a : A +>b : B + +// function with a type parameter without a default and two type parameters with defaults that mutually refer to each other +declare function f16(a?: T, b?: U, c?: V): [T, U, V]; +>f16 : (a?: T, b?: U, c?: V) => [T, U, V] +>T : T +>U : U +>V : V +>V : V +>U : U +>a : T +>T : T +>b : U +>U : U +>c : V +>V : V +>T : T +>U : U +>V : V + +// no inference +f16(); +>f16() : [{}, {}, {}] +>f16 : (a?: T, b?: U, c?: V) => [T, U, V] + +f16(a); +>f16(a) : [A, {}, {}] +>f16 : (a?: T, b?: U, c?: V) => [T, U, V] +>a : A + +f16(a, b); +>f16(a, b) : [A, B, B] +>f16 : (a?: T, b?: U, c?: V) => [T, U, V] +>a : A +>b : B + +f16(a, b, b); +>f16(a, b, b) : [A, B, B] +>f16 : (a?: T, b?: U, c?: V) => [T, U, V] +>a : A +>b : B +>b : B + +// no inference, partially supplied +f16(); +>f16() : [A, {}, {}] +>f16 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A + +f16(a); +>f16(a) : [A, {}, {}] +>f16 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>a : A + +f16(a, b); +>f16(a, b) : [A, {}, {}] +>f16 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>a : A +>b : B + +f16(a, b, b); +>f16(a, b, b) : [A, {}, {}] +>f16 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>a : A +>b : B +>b : B + +f16(); +>f16() : [A, B, B] +>f16 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B + +f16(a); +>f16(a) : [A, B, B] +>f16 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>a : A + +f16(a, b); +>f16(a, b) : [A, B, B] +>f16 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>a : A +>b : B + +f16(a, b, b); +>f16(a, b, b) : [A, B, B] +>f16 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>a : A +>b : B +>b : B + +// no inference, fully supplied +f16(); +>f16() : [A, B, D] +>f16 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>D : D + +f16(a); +>f16(a) : [A, B, D] +>f16 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>D : D +>a : A + +f16(a, b); +>f16(a, b) : [A, B, D] +>f16 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>D : D +>a : A +>b : B + +f16(a, b, d); +>f16(a, b, d) : [A, B, D] +>f16 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>D : D +>a : A +>b : B +>d : D + +// function with a type parameter with a default that refers to a later type parameter with a default that refers to an earlier type parameter in a union +declare function f17(a?: T, b?: U): [T, U]; +>f17 : (a?: T, b?: U) => [T, U] +>T : T +>U : U +>U : U +>T : T +>B : B +>a : T +>T : T +>b : U +>U : U +>T : T +>U : U -const f05c07 = f05(1); ->f05c07 : [number, number] ->f05(1) : [number, number] ->f05 : (a?: T, b?: U) => [T, U] ->1 : 1 +// inference +f17(); +>f17() : [{}, {} | B] +>f17 : (a?: T, b?: U) => [T, U] + +f17(a); +>f17(a) : [A, A | B] +>f17 : (a?: T, b?: U) => [T, U] +>a : A + +f17(a, a); +>f17(a, a) : [A, A] +>f17 : (a?: T, b?: U) => [T, U] +>a : A +>a : A + +f17(a, b); +>f17(a, b) : [A, B] +>f17 : (a?: T, b?: U) => [T, U] +>a : A +>b : B + +f17(a, c); +>f17(a, c) : [A, C] +>f17 : (a?: T, b?: U) => [T, U] +>a : A +>c : C + +// no inference, partially supplied +f17(); +>f17() : [A, A | B] +>f17 : (a?: T, b?: U) => [T, U] +>A : A + +f17(a); +>f17(a) : [A, A | B] +>f17 : (a?: T, b?: U) => [T, U] +>A : A +>a : A + +f17(a, a); +>f17(a, a) : [A, A | B] +>f17 : (a?: T, b?: U) => [T, U] +>A : A +>a : A +>a : A + +f17(a, b); +>f17(a, b) : [A, A | B] +>f17 : (a?: T, b?: U) => [T, U] +>A : A +>a : A +>b : B + +// no inference, fully supplied +f17(); +>f17() : [A, C] +>f17 : (a?: T, b?: U) => [T, U] +>A : A +>C : C + +f17(a); +>f17(a) : [A, C] +>f17 : (a?: T, b?: U) => [T, U] +>A : A +>C : C +>a : A + +f17(a, c); +>f17(a, c) : [A, C] +>f17 : (a?: T, b?: U) => [T, U] +>A : A +>C : C +>a : A +>c : C + +// function with a type parameter without a default and a type parameter with a default that refers to a later type parameter with a default that refers to an earlier type parameter in a union +declare function f18(a?: T, b?: U, c?: V): [T, U, V]; +>f18 : (a?: T, b?: U, c?: V) => [T, U, V] +>T : T +>U : U +>V : V +>V : V +>U : U +>C : C +>a : T +>T : T +>b : U +>U : U +>c : V +>V : V +>T : T +>U : U +>V : V + +// inference +f18(); +>f18() : [{}, {}, {} | C] +>f18 : (a?: T, b?: U, c?: V) => [T, U, V] + +f18(a); +>f18(a) : [A, {}, {} | C] +>f18 : (a?: T, b?: U, c?: V) => [T, U, V] +>a : A + +f18(a, b); +>f18(a, b) : [A, B, B | C] +>f18 : (a?: T, b?: U, c?: V) => [T, U, V] +>a : A +>b : B + +f18(a, b, b); +>f18(a, b, b) : [A, B, B] +>f18 : (a?: T, b?: U, c?: V) => [T, U, V] +>a : A +>b : B +>b : B + +f18(a, b, c); +>f18(a, b, c) : [A, B, C] +>f18 : (a?: T, b?: U, c?: V) => [T, U, V] +>a : A +>b : B +>c : C + +// no inference, partially supplied +f18(); +>f18() : [A, {}, {} | C] +>f18 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A + +f18(a); +>f18(a) : [A, {}, {} | C] +>f18 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>a : A + +f18(a, b); +>f18(a, b) : [A, {}, {} | C] +>f18 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>a : A +>b : B + +f18(a, b, b); +>f18(a, b, b) : [A, {}, {} | C] +>f18 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>a : A +>b : B +>b : B + +f18(a, b, c); +>f18(a, b, c) : [A, {}, {} | C] +>f18 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>a : A +>b : B +>c : C + +f18(); +>f18() : [A, B, B | C] +>f18 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B + +f18(a); +>f18(a) : [A, B, B | C] +>f18 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>a : A + +f18(a, b); +>f18(a, b) : [A, B, B | C] +>f18 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>a : A +>b : B + +f18(a, b, b); +>f18(a, b, b) : [A, B, B | C] +>f18 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>a : A +>b : B +>b : B + +f18(a, b, c); +>f18(a, b, c) : [A, B, B | C] +>f18 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>a : A +>b : B +>c : C + +// no inference, fully supplied +f18(); +>f18() : [A, B, D] +>f18 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>D : D + +f18(a); +>f18(a) : [A, B, D] +>f18 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>D : D +>a : A + +f18(a, b); +>f18(a, b) : [A, B, D] +>f18 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>D : D +>a : A +>b : B + +f18(a, b, d); +>f18(a, b, d) : [A, B, D] +>f18 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>D : D +>a : A +>b : B +>d : D + +// function with a type parameter with a default that refers to a later type parameter with a default that refers to an earlier type parameter in an intersection +declare function f19(a?: T, b?: U): [T, U]; +>f19 : (a?: T, b?: U) => [T, U] +>T : T +>U : U +>U : U +>T : T +>B : B +>a : T +>T : T +>b : U +>U : U +>T : T +>U : U -const f05c08 = f05(1, 2); ->f05c08 : [number, number] ->f05(1, 2) : [number, number] ->f05 : (a?: T, b?: U) => [T, U] ->1 : 1 ->2 : 2 +// inference +f19(); +>f19() : [{}, {} & B] +>f19 : (a?: T, b?: U) => [T, U] + +f19(a); +>f19(a) : [A, A & B] +>f19 : (a?: T, b?: U) => [T, U] +>a : A + +f19(a, a); +>f19(a, a) : [A, A] +>f19 : (a?: T, b?: U) => [T, U] +>a : A +>a : A + +f19(a, b); +>f19(a, b) : [A, B] +>f19 : (a?: T, b?: U) => [T, U] +>a : A +>b : B + +f19(a, ab); +>f19(a, ab) : [A, AB] +>f19 : (a?: T, b?: U) => [T, U] +>a : A +>ab : AB + +f19(a, c); +>f19(a, c) : [A, C] +>f19 : (a?: T, b?: U) => [T, U] +>a : A +>c : C + +// no inference, partially supplied +f19(); +>f19() : [A, A & B] +>f19 : (a?: T, b?: U) => [T, U] +>A : A + +f19(a); +>f19(a) : [A, A & B] +>f19 : (a?: T, b?: U) => [T, U] +>A : A +>a : A + +f19(a, ab); +>f19(a, ab) : [A, A & B] +>f19 : (a?: T, b?: U) => [T, U] +>A : A +>a : A +>ab : AB + +// no inference, fully supplied +f19(); +>f19() : [A, C] +>f19 : (a?: T, b?: U) => [T, U] +>A : A +>C : C + +f19(a); +>f19(a) : [A, C] +>f19 : (a?: T, b?: U) => [T, U] +>A : A +>C : C +>a : A + +f19(a, c); +>f19(a, c) : [A, C] +>f19 : (a?: T, b?: U) => [T, U] +>A : A +>C : C +>a : A +>c : C + +// function with a type parameter without a default and a type parameter with a default that refers to a later type parameter with a default that refers to an earlier type parameter in an intersection +declare function f20(a?: T, b?: U, c?: V): [T, U, V]; +>f20 : (a?: T, b?: U, c?: V) => [T, U, V] +>T : T +>U : U +>V : V +>V : V +>U : U +>C : C +>a : T +>T : T +>b : U +>U : U +>c : V +>V : V +>T : T +>U : U +>V : V + +// inference +f20(); +>f20() : [{}, {}, {} & C] +>f20 : (a?: T, b?: U, c?: V) => [T, U, V] + +f20(a); +>f20(a) : [A, {}, {} & C] +>f20 : (a?: T, b?: U, c?: V) => [T, U, V] +>a : A + +f20(a, b); +>f20(a, b) : [A, B, B & C] +>f20 : (a?: T, b?: U, c?: V) => [T, U, V] +>a : A +>b : B + +f20(a, b, c); +>f20(a, b, c) : [A, B, C] +>f20 : (a?: T, b?: U, c?: V) => [T, U, V] +>a : A +>b : B +>c : C + +// no inference, partially supplied +f20(); +>f20() : [A, {}, {} & C] +>f20 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A + +f20(a); +>f20(a) : [A, {}, {} & C] +>f20 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>a : A + +f20(a, b); +>f20(a, b) : [A, {}, {} & C] +>f20 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>a : A +>b : B + +f20(a, b, bc); +>f20(a, b, bc) : [A, {}, {} & C] +>f20 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>a : A +>b : B +>bc : BC + +f20(); +>f20() : [A, B, B & C] +>f20 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B + +f20(a); +>f20(a) : [A, B, B & C] +>f20 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>a : A + +f20(a, b); +>f20(a, b) : [A, B, B & C] +>f20 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>a : A +>b : B + +f20(a, b, bc); +>f20(a, b, bc) : [A, B, B & C] +>f20 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>a : A +>b : B +>bc : BC + +// no inference, fully supplied +f20(); +>f20() : [A, B, D] +>f20 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>D : D + +f20(a); +>f20(a) : [A, B, D] +>f20 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>D : D +>a : A + +f20(a, b); +>f20(a, b) : [A, B, D] +>f20 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>D : D +>a : A +>b : B + +f20(a, b, d); +>f20(a, b, d) : [A, B, D] +>f20 : (a?: T, b?: U, c?: V) => [T, U, V] +>A : A +>B : B +>D : D +>a : A +>b : B +>d : D interface i00 { a: T; } >i00 : i00 @@ -559,6 +2239,68 @@ interface i04 {} >T : T >U : U +interface i05 { a: T; } +>i05 : i05 +>T : T +>T : T +>a : T +>T : T + +const i05c00 = (x).a; +>i05c00 : {} +>(x).a : {} +>(x) : i05<{}> +>x : i05<{}> +>i05 : i05 +>x : any +>a : {} + +const i05c01 = (>x).a; +>i05c01 : number +>(>x).a : number +>(>x) : i05 +>>x : i05 +>i05 : i05 +>x : any +>a : number + +interface i06 { a: [T, U]; } +>i06 : i06 +>T : T +>U : U +>U : U +>T : T +>a : [T, U] +>T : T +>U : U + +const i06c00 = (x).a; +>i06c00 : [{}, {}] +>(x).a : [{}, {}] +>(x) : i06<{}, {}> +>x : i06<{}, {}> +>i06 : i06 +>x : any +>a : [{}, {}] + +const i06c01 = (>x).a; +>i06c01 : [number, number] +>(>x).a : [number, number] +>(>x) : i06 +>>x : i06 +>i06 : i06 +>x : any +>a : [number, number] + +const i06c02 = (>x).a; +>i06c02 : [number, string] +>(>x).a : [number, string] +>(>x) : i06 +>>x : i06 +>i06 : i06 +>x : any +>a : [number, string] + interface Base01 { a: T; } >Base01 : Base01 >T : T diff --git a/tests/baselines/reference/genericDefaultsErrors.errors.txt b/tests/baselines/reference/genericDefaultsErrors.errors.txt index ad2e406859031..2654f98980475 100644 --- a/tests/baselines/reference/genericDefaultsErrors.errors.txt +++ b/tests/baselines/reference/genericDefaultsErrors.errors.txt @@ -1,88 +1,42 @@ -tests/cases/compiler/genericDefaultsErrors.ts(4,26): error TS2706: Type parameter 'T' has a circular default. -tests/cases/compiler/genericDefaultsErrors.ts(5,26): error TS2706: Type parameter 'T' has a circular default. -tests/cases/compiler/genericDefaultsErrors.ts(5,33): error TS2706: Type parameter 'U' has a circular default. -tests/cases/compiler/genericDefaultsErrors.ts(6,29): error TS2705: Required type parameters may not follow optional type parameters. -tests/cases/compiler/genericDefaultsErrors.ts(7,41): error TS2344: Type 'number' does not satisfy the constraint 'string'. -tests/cases/compiler/genericDefaultsErrors.ts(8,59): error TS2344: Type 'T' does not satisfy the constraint 'number'. +tests/cases/compiler/genericDefaultsErrors.ts(4,41): error TS2344: Type 'number' does not satisfy the constraint 'string'. +tests/cases/compiler/genericDefaultsErrors.ts(5,59): error TS2344: Type 'T' does not satisfy the constraint 'number'. Type 'string' is not assignable to type 'number'. -tests/cases/compiler/genericDefaultsErrors.ts(9,44): error TS2344: Type 'T' does not satisfy the constraint 'number'. -tests/cases/compiler/genericDefaultsErrors.ts(10,39): error TS2344: Type 'number' does not satisfy the constraint 'T'. -tests/cases/compiler/genericDefaultsErrors.ts(11,26): error TS2706: Type parameter 'T' has a circular default. -tests/cases/compiler/genericDefaultsErrors.ts(11,33): error TS2706: Type parameter 'U' has a circular default. -tests/cases/compiler/genericDefaultsErrors.ts(12,26): error TS2706: Type parameter 'T' has a circular default. -tests/cases/compiler/genericDefaultsErrors.ts(12,33): error TS2706: Type parameter 'U' has a circular default. -tests/cases/compiler/genericDefaultsErrors.ts(13,26): error TS2706: Type parameter 'T' has a circular default. -tests/cases/compiler/genericDefaultsErrors.ts(13,33): error TS2706: Type parameter 'U' has a circular default. -tests/cases/compiler/genericDefaultsErrors.ts(14,26): error TS2706: Type parameter 'T' has a circular default. -tests/cases/compiler/genericDefaultsErrors.ts(14,33): error TS2706: Type parameter 'U' has a circular default. -tests/cases/compiler/genericDefaultsErrors.ts(18,1): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/compiler/genericDefaultsErrors.ts(21,1): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/compiler/genericDefaultsErrors.ts(25,13): error TS2345: Argument of type '"a"' is not assignable to parameter of type 'number'. -tests/cases/compiler/genericDefaultsErrors.ts(28,11): error TS2428: All declarations of 'i00' must have identical type parameters. -tests/cases/compiler/genericDefaultsErrors.ts(31,11): error TS2428: All declarations of 'i01' must have identical type parameters. -tests/cases/compiler/genericDefaultsErrors.ts(33,19): error TS2706: Type parameter 'T' has a circular default. -tests/cases/compiler/genericDefaultsErrors.ts(34,19): error TS2706: Type parameter 'T' has a circular default. -tests/cases/compiler/genericDefaultsErrors.ts(34,26): error TS2706: Type parameter 'U' has a circular default. -tests/cases/compiler/genericDefaultsErrors.ts(35,22): error TS2705: Required type parameters may not follow optional type parameters. -tests/cases/compiler/genericDefaultsErrors.ts(36,34): error TS2344: Type 'number' does not satisfy the constraint 'string'. -tests/cases/compiler/genericDefaultsErrors.ts(37,52): error TS2344: Type 'T' does not satisfy the constraint 'number'. +tests/cases/compiler/genericDefaultsErrors.ts(6,44): error TS2344: Type 'T' does not satisfy the constraint 'number'. +tests/cases/compiler/genericDefaultsErrors.ts(7,39): error TS2344: Type 'number' does not satisfy the constraint 'T'. +tests/cases/compiler/genericDefaultsErrors.ts(11,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/genericDefaultsErrors.ts(14,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/genericDefaultsErrors.ts(18,13): error TS2345: Argument of type '"a"' is not assignable to parameter of type 'number'. +tests/cases/compiler/genericDefaultsErrors.ts(21,11): error TS2428: All declarations of 'i00' must have identical type parameters. +tests/cases/compiler/genericDefaultsErrors.ts(24,11): error TS2428: All declarations of 'i01' must have identical type parameters. +tests/cases/compiler/genericDefaultsErrors.ts(26,27): error TS2705: Required type parameters may not follow optional type parameters. +tests/cases/compiler/genericDefaultsErrors.ts(27,34): error TS2344: Type 'number' does not satisfy the constraint 'string'. +tests/cases/compiler/genericDefaultsErrors.ts(28,52): error TS2344: Type 'T' does not satisfy the constraint 'number'. Type 'string' is not assignable to type 'number'. -tests/cases/compiler/genericDefaultsErrors.ts(38,37): error TS2344: Type 'T' does not satisfy the constraint 'number'. -tests/cases/compiler/genericDefaultsErrors.ts(39,32): error TS2344: Type 'number' does not satisfy the constraint 'T'. -tests/cases/compiler/genericDefaultsErrors.ts(42,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. -tests/cases/compiler/genericDefaultsErrors.ts(43,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. -tests/cases/compiler/genericDefaultsErrors.ts(46,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. -tests/cases/compiler/genericDefaultsErrors.ts(48,17): error TS2367: Type parameter 'T' cannot be referenced outside of a declaration that defines it. +tests/cases/compiler/genericDefaultsErrors.ts(29,37): error TS2344: Type 'T' does not satisfy the constraint 'number'. +tests/cases/compiler/genericDefaultsErrors.ts(30,32): error TS2344: Type 'number' does not satisfy the constraint 'T'. +tests/cases/compiler/genericDefaultsErrors.ts(33,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. +tests/cases/compiler/genericDefaultsErrors.ts(34,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. +tests/cases/compiler/genericDefaultsErrors.ts(37,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. +tests/cases/compiler/genericDefaultsErrors.ts(39,17): error TS2367: Type parameter 'T' cannot be referenced outside of a declaration that defines it. -==== tests/cases/compiler/genericDefaultsErrors.ts (33 errors) ==== +==== tests/cases/compiler/genericDefaultsErrors.ts (18 errors) ==== declare const x: any; - declare function f00(): void; - ~ -!!! error TS2706: Type parameter 'T' has a circular default. - declare function f01(): void; - ~ -!!! error TS2706: Type parameter 'T' has a circular default. - ~ -!!! error TS2706: Type parameter 'U' has a circular default. - declare function f02(); - ~ -!!! error TS2705: Required type parameters may not follow optional type parameters. - declare function f03(): void; + declare function f03(): void; // error ~~~~~~ !!! error TS2344: Type 'number' does not satisfy the constraint 'string'. - declare function f04(): void; + declare function f04(): void; // error ~ !!! error TS2344: Type 'T' does not satisfy the constraint 'number'. !!! error TS2344: Type 'string' is not assignable to type 'number'. - declare function f05(): void; + declare function f05(): void; // error ~ !!! error TS2344: Type 'T' does not satisfy the constraint 'number'. - declare function f06(): void; + declare function f06(): void; // error ~~~~~~ !!! error TS2344: Type 'number' does not satisfy the constraint 'T'. - declare function f07(): void; - ~ -!!! error TS2706: Type parameter 'T' has a circular default. - ~~~~~~~~~~~~~~~~~ -!!! error TS2706: Type parameter 'U' has a circular default. - declare function f08(): void; - ~ -!!! error TS2706: Type parameter 'T' has a circular default. - ~~~~~~~~~~~~~~~~~ -!!! error TS2706: Type parameter 'U' has a circular default. - declare function f09(): void; - ~ -!!! error TS2706: Type parameter 'T' has a circular default. - ~~~~~~~~~~~~~~~~~ -!!! error TS2706: Type parameter 'U' has a circular default. - declare function f10(): void; - ~ -!!! error TS2706: Type parameter 'T' has a circular default. - ~~~~~~~~~~~~~~~~~ -!!! error TS2706: Type parameter 'U' has a circular default. declare function f11(): void; f11(); // ok @@ -111,16 +65,8 @@ tests/cases/compiler/genericDefaultsErrors.ts(48,17): error TS2367: Type paramet ~~~ !!! error TS2428: All declarations of 'i01' must have identical type parameters. - interface i02 { } // error - ~ -!!! error TS2706: Type parameter 'T' has a circular default. - interface i03 { } // error - ~ -!!! error TS2706: Type parameter 'T' has a circular default. - ~ -!!! error TS2706: Type parameter 'U' has a circular default. - interface i04 { } // error - ~ + interface i04 { } // error + ~ !!! error TS2705: Required type parameters may not follow optional type parameters. interface i05 { } // error ~~~~~~ diff --git a/tests/baselines/reference/genericDefaultsErrors.js b/tests/baselines/reference/genericDefaultsErrors.js index d8ab04cdadf56..7e91d72fb2193 100644 --- a/tests/baselines/reference/genericDefaultsErrors.js +++ b/tests/baselines/reference/genericDefaultsErrors.js @@ -2,17 +2,10 @@ declare const x: any; -declare function f00(): void; -declare function f01(): void; -declare function f02(); -declare function f03(): void; -declare function f04(): void; -declare function f05(): void; -declare function f06(): void; -declare function f07(): void; -declare function f08(): void; -declare function f09(): void; -declare function f10(): void; +declare function f03(): void; // error +declare function f04(): void; // error +declare function f05(): void; // error +declare function f06(): void; // error declare function f11(): void; f11(); // ok @@ -31,9 +24,7 @@ interface i00 { } // error interface i01 { } // ok interface i01 { } // error -interface i02 { } // error -interface i03 { } // error -interface i04 { } // error +interface i04 { } // error interface i05 { } // error interface i06 { } // error interface i07 { } // error @@ -61,25 +52,10 @@ f12("a"); // error //// [genericDefaultsErrors.d.ts] declare const x: any; -declare function f00(): void; -declare function f01(): void; -declare function f02(): any; declare function f03(): void; declare function f04(): void; declare function f05(): void; declare function f06(): void; -declare function f07(): void; -declare function f08(): void; -declare function f09(): void; -declare function f10(): void; declare function f11(): void; declare function f12(a?: U): void; interface i00 { @@ -90,11 +66,7 @@ interface i01 { } interface i01 { } -interface i02 { -} -interface i03 { -} -interface i04 { +interface i04 { } interface i05 { } diff --git a/tests/cases/compiler/genericDefaults.ts b/tests/cases/compiler/genericDefaults.ts index df507a32a918e..3e9db09bfa905 100644 --- a/tests/cases/compiler/genericDefaults.ts +++ b/tests/cases/compiler/genericDefaults.ts @@ -1,68 +1,398 @@ // @declaration: true +interface A { a: number; } +interface B { b: number; } +interface C { c: number; } +interface D { d: number; } +interface AB { a: number; b: number; } +interface BC { b: number; c: number; } + +declare const a: A; +declare const b: B; +declare const c: C; +declare const d: D; +declare const ab: AB; +declare const bc: BC; declare const x: any; -declare function f00(a?: T): T; -const f00c00 = f00(); -const f00c01 = f00(1); -const f00c02 = f00("a"); -const f00c03 = f00(); -const f00c04 = f00(1); -const f00c05 = f00("a"); - -declare function f01(a?: T, b?: U): [T, U]; -const f01c00 = f01(); -const f01c01 = f01(1); -const f01c02 = f01(1, "a"); -const f01c03 = f01(); -const f01c04 = f01(1); -const f01c05 = f01(1, 2); -const f01c06 = f01(); -const f01c07 = f01(1); -const f01c08 = f01(1, "a"); - -declare function f02(a?: T, b?: U): [T, U]; -const f02c00 = f02(); -const f02c01 = f02(1); -const f02c02 = f02(1, "a"); -const f02c03 = f02(); -const f02c04 = f02(1); -const f02c05 = f02(1, 2); -const f02c06 = f02(); -const f02c07 = f02(1); -const f02c08 = f02(1, "a"); - -declare function f03(a?: T, b?: U): [T, U]; -const f03c00 = f03(); -const f03c01 = f03(1); -const f03c02 = f03(1, 1); -const f03c03 = f03(); -const f03c04 = f03(1); -const f03c05 = f03(1, 2); -const f03c06 = f03(); -const f03c07 = f03(1); -const f03c08 = f03(1, 2); - -declare function f04(a?: T, b?: U): [T, U]; -const f04c00 = f04(); -const f04c01 = f04(1); -const f04c02 = f04(1, 1); -const f04c03 = f04(); -const f04c04 = f04(1); -const f04c05 = f04(1, 2); -const f04c06 = f04(); -const f04c07 = f04(1); -const f04c08 = f04(1, 2); - -declare function f05(a?: T, b?: U): [T, U]; -const f05c00 = f05(); -const f05c01 = f05(1); -const f05c02 = f05(1, 1); -const f05c03 = f05(); -const f05c04 = f05(1); -const f05c05 = f05<{ a: number }>({ a: 1 }, { a: 2, b: 3}); -const f05c06 = f05(); -const f05c07 = f05(1); -const f05c08 = f05(1, 2); +// function without type parameters +declare function f00(a?: A): A; +// no inference +f00(); +f00(a); + +// function with a type parameter without a default +declare function f01(a?: T): T; +// inference +f01(); +f01(a); +// no inference, fully supplied +f01(); +f01(a); + +// function with a type paramter with a default +declare function f02(a?: T): T; +// inference +f02(); +f02(a); +f02(b); +// no inference, fully supplied +f02(); +f02(a); +f02(); +f02(b); + +// function with a type parameter with a default that refers to itself +declare function f03(a?: T): T; +// inference +f03(); +f03(a); +f03(b); +// no inference, fully supplied +f03(); +f03(a); +f03(); +f03(b); + +// function with a type paramter without a default and a type parameter with a default +declare function f04(a?: T, b?: U): [T, U]; +// inference +f04(); +f04(a); +f04(a, b); +f04(a, c); +// no inference, partially supplied +f04(); +f04(a); +f04(a, b); +// no inference, fully supplied +f04(); +f04(a); +f04(a, b); +f04(); +f04(a); +f04(a, c); + +// function with a type parameter without a default and a type parameter with a default that refers to an earlier type parameter +declare function f05(a?: T, b?: U): [T, U]; +// inference +f05(); +f05(a); +f05(a, a); +f05(a, b); +// no inference, partially supplied +f05(); +f05(a); +f05(a, a); +// no inference, fully supplied +f05(); +f05(a); +f05(a, b); + +// function with a type parameter with a default that refers to an earlier type parameter with a default +declare function f06(a?: T, b?: U): [T, U]; +// inference +f06(); +f06(a); +f06(a, a); +f06(a, b); +f06(b, a); +f06(b, b); +// no inference, partially supplied +f06(); +f06(a); +f06(a, a); +f06(); +f06(b); +f06(b, b); +// no inference, fully supplied +f06(); +f06(a); +f06(a, b); +f06(); +f06(b); +f06(b, c); + +// function with a type parameter without a default and a type parameter with a default that refers to an earlier type parameter with a default +declare function f07(a?: T, b?: U, c?: V): [T, U, V]; +// inference +f07(); +f07(a, b); +f07(a, c); +f07(a, b, b); +f07(a, b, c); +f07(a, c, b); +f07(a, c, c); +// no inference, partially supplied +f07(); +f07(a); +f07(a, b); +f07(a, b, b); +f07(); +f07(a); +f07(a, b); +f07(a, b, b); +f07(); +f07(a); +f07(a, c); +f07(a, c, c); +// no inference, fully supplied +f07(); +f07(a); +f07(a, b); +f07(a, b, c); +f07(); +f07(a); +f07(a, c); +f07(a, c, d); + +// function with a type parameter with a default that refers to an earlier type parameter with a constraint +declare function f08(a?: T, b?: U): [T, U]; +// inference +f08(); +f08(a); +f08(a, a); +f08(a, b); +// no inference, partially supplied +f08(); +f08(a); +f08(a, a); +// no inference, fully supplied +f08(); +f08(a); +f08(a, b); + +// function with a type parameter with a constraint and a default that refers to an earlier type parameter +declare function f09(a?: T, b?: U): [T, U]; +// inference +f09(); +f09(a); +f09(a, a); +f09(a, ab); +// no inference, partially supplied +f09(); +f09(a); +f09(a, a); +f09(a, ab); +// no inference, fully supplied +f09(); +f09(a); +f09(a, ab); + +// function with a type parameter with a constraint and a default that refers to an earlier type parameter with a constraint +declare function f10(a?: T, b?: U): [T, U]; +// inference +f10(); +f10(a); +f10(a, a); +f10(a, ab); +// no inference, partially supplied +f10(); +f10(a); +f10(a, a); +f10(a, ab); +// no inference, fully supplied +f10(); +f10(a); +f10(a, a); +f10(a, ab); +f10(); +f10(a); +f10(a, ab); + +// function with a type parameter with a default that refers to an earier type parameter in a union +declare function f11(a?: T, b?: U): [T, U]; +// inference +f11(); +f11(a); +f11(a, a); +f11(a, b); +f11(a, c); +// no inference, partially supplied +f11(); +f11(a); +f11(a, a); +f11(a, b); +// no inference, fully supplied +f11(); +f11(a); +f11(a, c); + +// function with a type parameter with a default that refers to an earlier type parameter in an intersection +declare function f12(a?: T, b?: U): [T, U]; +// inference +f12(); +f12(a); +f12(a, a); +f12(a, b); +f12(a, c); +// no inference, partially supplied +f12(); +f12(a); +f12(a, ab); +// no inference, fully supplied +f12(); +f12(a); +f12(a, c); + +// function with a type parameter with a default that refers to a later type parameter with a default +declare function f13(a?: T, b?: U): [T, U]; +// inference +f13(); +f13(a); +f13(a, b); +f13(a, c); +// no inference, partially supplied +f13(); +f13(a); +f13(a, b); +// no inference, fully supplied +f13(); +f13(a); +f13(a, c); +f13(a, c); + +// function with a type parameter without a default and a type parameter with a default that refers to a later type parameter with a default +declare function f14(a?: T, b?: U, c?: V): [T, U, V]; +// inference +f14(); +f14(a); +f14(a, b); +f14(a, b, c); +f14(a, b, d); +// no inference, partially supplied +f14(); +f14(a); +f14(a, b); +f14(a, b, c); +f14(); +f14(a); +f14(a, b); +f14(a, b, c); +// no inference fully supplied +f14(); +f14(a); +f14(a, b); +f14(a, b, d); + +// function with two type parameters with defaults that mutually refer to each other +declare function f15(a?: T, b?: U): [T, U]; +// inference +f15(); +f15(a); +f15(a, b); +// no inference, partially supplied +f15(); +f15(a); +f15(a, a); +// no inference, fully supplied +f15(); +f15(a); +f15(a, b); + +// function with a type parameter without a default and two type parameters with defaults that mutually refer to each other +declare function f16(a?: T, b?: U, c?: V): [T, U, V]; +// no inference +f16(); +f16(a); +f16(a, b); +f16(a, b, b); +// no inference, partially supplied +f16(); +f16(a); +f16(a, b); +f16(a, b, b); +f16(); +f16(a); +f16(a, b); +f16(a, b, b); +// no inference, fully supplied +f16(); +f16(a); +f16(a, b); +f16(a, b, d); + +// function with a type parameter with a default that refers to a later type parameter with a default that refers to an earlier type parameter in a union +declare function f17(a?: T, b?: U): [T, U]; +// inference +f17(); +f17(a); +f17(a, a); +f17(a, b); +f17(a, c); +// no inference, partially supplied +f17(); +f17(a); +f17(a, a); +f17(a, b); +// no inference, fully supplied +f17(); +f17(a); +f17(a, c); + +// function with a type parameter without a default and a type parameter with a default that refers to a later type parameter with a default that refers to an earlier type parameter in a union +declare function f18(a?: T, b?: U, c?: V): [T, U, V]; +// inference +f18(); +f18(a); +f18(a, b); +f18(a, b, b); +f18(a, b, c); +// no inference, partially supplied +f18(); +f18(a); +f18(a, b); +f18(a, b, b); +f18(a, b, c); +f18(); +f18(a); +f18(a, b); +f18(a, b, b); +f18(a, b, c); +// no inference, fully supplied +f18(); +f18(a); +f18(a, b); +f18(a, b, d); + +// function with a type parameter with a default that refers to a later type parameter with a default that refers to an earlier type parameter in an intersection +declare function f19(a?: T, b?: U): [T, U]; +// inference +f19(); +f19(a); +f19(a, a); +f19(a, b); +f19(a, ab); +f19(a, c); +// no inference, partially supplied +f19(); +f19(a); +f19(a, ab); +// no inference, fully supplied +f19(); +f19(a); +f19(a, c); + +// function with a type parameter without a default and a type parameter with a default that refers to a later type parameter with a default that refers to an earlier type parameter in an intersection +declare function f20(a?: T, b?: U, c?: V): [T, U, V]; +// inference +f20(); +f20(a); +f20(a, b); +f20(a, b, c); +// no inference, partially supplied +f20(); +f20(a); +f20(a, b); +f20(a, b, bc); +f20(); +f20(a); +f20(a, b); +f20(a, b, bc); +// no inference, fully supplied +f20(); +f20(a); +f20(a, b); +f20(a, b, d); interface i00 { a: T; } const i00c00 = (x).a; @@ -91,6 +421,15 @@ interface i04 {} interface i04 {} interface i04 {} +interface i05 { a: T; } +const i05c00 = (x).a; +const i05c01 = (>x).a; + +interface i06 { a: [T, U]; } +const i06c00 = (x).a; +const i06c01 = (>x).a; +const i06c02 = (>x).a; + interface Base01 { a: T; } interface Base01Constructor { new (a?: T): Base01; } diff --git a/tests/cases/compiler/genericDefaultsErrors.ts b/tests/cases/compiler/genericDefaultsErrors.ts index 02b4fce9296d1..4ea42beb3da1a 100644 --- a/tests/cases/compiler/genericDefaultsErrors.ts +++ b/tests/cases/compiler/genericDefaultsErrors.ts @@ -2,17 +2,10 @@ declare const x: any; -declare function f00(): void; -declare function f01(): void; -declare function f02(); -declare function f03(): void; -declare function f04(): void; -declare function f05(): void; -declare function f06(): void; -declare function f07(): void; -declare function f08(): void; -declare function f09(): void; -declare function f10(): void; +declare function f03(): void; // error +declare function f04(): void; // error +declare function f05(): void; // error +declare function f06(): void; // error declare function f11(): void; f11(); // ok @@ -31,9 +24,7 @@ interface i00 { } // error interface i01 { } // ok interface i01 { } // error -interface i02 { } // error -interface i03 { } // error -interface i04 { } // error +interface i04 { } // error interface i05 { } // error interface i06 { } // error interface i07 { } // error From febde3fabc14464de9986f8247997839a59397f9 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Tue, 24 Jan 2017 10:58:27 -0800 Subject: [PATCH 12/18] Revert noConstraintType name change --- src/compiler/checker.ts | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index da81710acfacf..918642dc74b74 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -166,8 +166,8 @@ namespace ts { // in getPropagatingFlagsOfTypes, and it is checked in inferFromTypes. anyFunctionType.flags |= TypeFlags.ContainsAnyFunctionType; - const noConstraintOrDefaultType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - const circularConstraintOrDefaultType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + const noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + const circularConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); const anySignature = createSignature(undefined, undefined, 0, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); const unknownSignature = createSignature(undefined, undefined, 0, undefined, emptyArray, unknownType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); @@ -4791,11 +4791,11 @@ namespace ts { function getBaseConstraintOfType(type: TypeVariable | UnionOrIntersectionType): Type { const constraint = getResolvedBaseConstraint(type); - return constraint !== noConstraintOrDefaultType && constraint !== circularConstraintOrDefaultType ? constraint : undefined; + return constraint !== noConstraintType && constraint !== circularConstraintType ? constraint : undefined; } function hasNonCircularBaseConstraint(type: TypeVariable): boolean { - return getResolvedBaseConstraint(type) !== circularConstraintOrDefaultType; + return getResolvedBaseConstraint(type) !== circularConstraintType; } /** @@ -4809,7 +4809,7 @@ namespace ts { if (!type.resolvedBaseConstraint) { typeStack = []; const constraint = getBaseConstraint(type); - type.resolvedBaseConstraint = circular ? circularConstraintOrDefaultType : getTypeWithThisArgument(constraint || noConstraintOrDefaultType, type); + type.resolvedBaseConstraint = circular ? circularConstraintType : getTypeWithThisArgument(constraint || noConstraintType, type); } return type.resolvedBaseConstraint; @@ -4869,14 +4869,14 @@ namespace ts { if (!typeParameter.default) { if (typeParameter.target) { const targetDefault = getDefaultFromTypeParameter(typeParameter.target); - typeParameter.default = targetDefault ? instantiateType(targetDefault, typeParameter.mapper) : noConstraintOrDefaultType; + typeParameter.default = targetDefault ? instantiateType(targetDefault, typeParameter.mapper) : noConstraintType; } else { const defaultDeclaration = typeParameter.symbol && forEach(typeParameter.symbol.declarations, decl => isTypeParameter(decl) && decl.default); - typeParameter.default = defaultDeclaration ? getTypeFromTypeNode(defaultDeclaration) : noConstraintOrDefaultType; + typeParameter.default = defaultDeclaration ? getTypeFromTypeNode(defaultDeclaration) : noConstraintType; } } - return typeParameter.default === noConstraintOrDefaultType ? undefined : typeParameter.default; + return typeParameter.default === noConstraintType ? undefined : typeParameter.default; } /** @@ -5497,14 +5497,14 @@ namespace ts { if (!typeParameter.constraint) { if (typeParameter.target) { const targetConstraint = getConstraintOfTypeParameter(typeParameter.target); - typeParameter.constraint = targetConstraint ? instantiateType(targetConstraint, typeParameter.mapper) : noConstraintOrDefaultType; + typeParameter.constraint = targetConstraint ? instantiateType(targetConstraint, typeParameter.mapper) : noConstraintType; } else { const constraintDeclaration = getConstraintDeclaration(typeParameter); - typeParameter.constraint = constraintDeclaration ? getTypeFromTypeNode(constraintDeclaration) : noConstraintOrDefaultType; + typeParameter.constraint = constraintDeclaration ? getTypeFromTypeNode(constraintDeclaration) : noConstraintType; } } - return typeParameter.constraint === noConstraintOrDefaultType ? undefined : typeParameter.constraint; + return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter: TypeParameter): Symbol { @@ -15846,12 +15846,12 @@ namespace ts { } } - /** + /** * Static members being set on a constructor function may conflict with built-in properties - * of Function. Esp. in ECMAScript 5 there are non-configurable and non-writable - * built-in properties. This check issues a transpile error when a class has a static + * of Function. Esp. in ECMAScript 5 there are non-configurable and non-writable + * built-in properties. This check issues a transpile error when a class has a static * member with the same name as a non-writable built-in property. - * + * * @see http://www.ecma-international.org/ecma-262/5.1/#sec-15.3.3 * @see http://www.ecma-international.org/ecma-262/5.1/#sec-15.3.5 * @see http://www.ecma-international.org/ecma-262/6.0/#sec-properties-of-the-function-constructor From 7616e37b72cfa0e404e1920f1e79c6844a0b1fa9 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 30 Jan 2017 14:36:31 -0800 Subject: [PATCH 13/18] Use length() throught checker --- src/compiler/checker.ts | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 294571bdbf2dd..712108300dff6 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2341,7 +2341,7 @@ namespace ts { else if (!(flags & TypeFormatFlags.InTypeAlias) && type.aliasSymbol && isSymbolAccessible(type.aliasSymbol, enclosingDeclaration, SymbolFlags.Type, /*shouldComputeAliasesToMakeVisible*/ false).accessibility === SymbolAccessibility.Accessible) { const typeArguments = type.aliasTypeArguments; - writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags); + writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, length(typeArguments), nextFlags); } else if (type.flags & TypeFlags.UnionOrIntersection) { writeUnionOrIntersectionType(type, nextFlags); @@ -3828,9 +3828,9 @@ namespace ts { } function getConstructorsForTypeArguments(type: Type, typeArgumentNodes: TypeNode[]): Signature[] { - const typeArgCount = typeArgumentNodes ? typeArgumentNodes.length : 0; + const typeArgCount = length(typeArgumentNodes); return filter(getSignaturesOfType(type, SignatureKind.Construct), - sig => typeArgCount >= sig.minTypeArgumentCount && typeArgCount <= (sig.typeParameters ? sig.typeParameters.length : 0)); + sig => typeArgCount >= sig.minTypeArgumentCount && typeArgCount <= length(sig.typeParameters)); } function getInstantiatedConstructorsForTypeArguments(type: Type, typeArgumentNodes: TypeNode[]): Signature[] { @@ -4431,11 +4431,11 @@ namespace ts { } const baseTypeNode = getBaseTypeNodeOfClass(classType); const typeArguments = map(baseTypeNode.typeArguments, getTypeFromTypeNode); - const typeArgCount = typeArguments ? typeArguments.length : 0; + const typeArgCount = length(typeArguments); const result: Signature[] = []; for (const baseSig of baseSignatures) { const minTypeArgumentCount = baseSig.minTypeArgumentCount; - const typeParamCount = baseSig.typeParameters ? baseSig.typeParameters.length : 0; + const typeParamCount = length(baseSig.typeParameters); if (typeArgCount >= minTypeArgumentCount && typeArgCount <= typeParamCount) { const sig = typeParamCount ? createSignatureInstantiation(baseSig, fillMissingTypeArguments(typeArguments, baseSig.typeParameters, minTypeArgumentCount)) : cloneSignature(baseSig); sig.typeParameters = classType.localTypeParameters; @@ -5215,9 +5215,9 @@ namespace ts { * @param minTypeArgumentCount The minimum number of required type arguments. */ function fillMissingTypeArguments(typeArguments: Type[] | undefined, typeParameters: TypeParameter[] | undefined, minTypeArgumentCount: number) { - const numTypeParameters = typeParameters ? typeParameters.length : 0; + const numTypeParameters = length(typeParameters); if (numTypeParameters) { - const numTypeArguments = typeArguments ? typeArguments.length : 0; + const numTypeArguments = length(typeArguments); if (numTypeArguments >= minTypeArgumentCount && numTypeArguments <= numTypeParameters) { if (!typeArguments) { typeArguments = []; @@ -5601,7 +5601,7 @@ namespace ts { } function getTypeReferenceArity(type: TypeReference): number { - return type.target.typeParameters ? type.target.typeParameters.length : 0; + return length(type.target.typeParameters); } // Get type from reference to class or interface @@ -5609,7 +5609,7 @@ namespace ts { const type = getDeclaredTypeOfSymbol(getMergedSymbol(symbol)); const typeParameters = type.localTypeParameters; if (typeParameters) { - const numTypeArguments = node.typeArguments ? node.typeArguments.length : 0; + const numTypeArguments = length(node.typeArguments); if (numTypeArguments < type.minTypeArgumentCount || numTypeArguments > typeParameters.length) { error(node, type.minTypeArgumentCount === typeParameters.length @@ -5652,7 +5652,7 @@ namespace ts { const type = getDeclaredTypeOfSymbol(symbol); const { typeParameters, minTypeArgumentCount } = getSymbolLinks(symbol); if (typeParameters) { - const numTypeArguments = node.typeArguments ? node.typeArguments.length : 0; + const numTypeArguments = length(node.typeArguments); if (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length) { error(node, minTypeArgumentCount === typeParameters.length @@ -5798,7 +5798,7 @@ namespace ts { error(getTypeDeclaration(symbol), Diagnostics.Global_type_0_must_be_a_class_or_interface_type, symbol.name); return arity ? emptyGenericType : emptyObjectType; } - if (((type).typeParameters ? (type).typeParameters.length : 0) !== arity) { + if (length((type).typeParameters) !== arity) { error(getTypeDeclaration(symbol), Diagnostics.Global_type_0_must_have_1_type_parameter_s, symbol.name, arity); return arity ? emptyGenericType : emptyObjectType; } @@ -8364,7 +8364,7 @@ namespace ts { // the constraints with a common set of type arguments to get relatable entities in places where // type parameters occur in the constraints. The complexity of doing that doesn't seem worthwhile, // particularly as we're comparing erased versions of the signatures below. - if ((source.typeParameters ? source.typeParameters.length : 0) !== (target.typeParameters ? target.typeParameters.length : 0)) { + if (length(source.typeParameters) !== length(target.typeParameters)) { return Ternary.False; } // Spec 1.0 Section 3.8.3 & 3.8.4: @@ -12915,7 +12915,7 @@ namespace ts { // If the user supplied type arguments, but the number of type arguments does not match // the declared number of type parameters, the call has an incorrect arity. - const numTypeParameters = signature.typeParameters ? signature.typeParameters.length : 0; + const numTypeParameters = length(signature.typeParameters); const hasRightNumberOfTypeArgs = !typeArguments || (typeArguments.length >= signature.minTypeArgumentCount && typeArguments.length <= numTypeParameters); if (!hasRightNumberOfTypeArgs) { @@ -18482,8 +18482,8 @@ namespace ts { resolveTypeParametersOfClassOrInterface(symbol); const { typeParameters, minTypeArgumentCount } = getSymbolLinks(symbol); - const maxTypeArgumentCount = typeParameters ? typeParameters.length : 0; - const numTypeParameters = node.typeParameters ? node.typeParameters.length : 0; + const maxTypeArgumentCount = length(typeParameters); + const numTypeParameters = length(node.typeParameters); // If this declaration has too few or too many type parameters, we report an error if (numTypeParameters < minTypeArgumentCount || numTypeParameters > maxTypeArgumentCount) { @@ -18532,7 +18532,7 @@ namespace ts { for (const declaration of symbol.declarations) { if (declaration.kind === SyntaxKind.ClassDeclaration || declaration.kind === SyntaxKind.InterfaceDeclaration) { const typeParameterNodes = (declaration).typeParameters; - const numTypeParameters = typeParameterNodes ? typeParameterNodes.length : 0; + const numTypeParameters = length(typeParameterNodes); if (maxTypeArgumentCount === -1) { // For the first declaration, establish the initial maximum and // minimum type argument counts. These only change when we From e0012587f5abca75d386e4e6f48a3a02a986fed5 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 30 Jan 2017 15:21:08 -0800 Subject: [PATCH 14/18] Move non-local type parameter check to resolveName --- src/compiler/checker.ts | 69 +++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 712108300dff6..f101ff1492365 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -865,6 +865,11 @@ namespace ts { error(errorLocation, Diagnostics.Static_members_cannot_reference_class_type_parameters); return undefined; } + // Only perform additional check if error reporting was requested + if (nameNotFoundMessage && !isTypeParameterSymbolDeclaredInContainer(result, location)) { + error(errorLocation, Diagnostics.Type_parameter_0_cannot_be_referenced_outside_of_the_declaration_that_defines_it, symbolToString(result)); + return undefined; + } break loop; } if (location.kind === SyntaxKind.ClassExpression && meaning & SymbolFlags.Class) { @@ -1008,6 +1013,16 @@ namespace ts { return result; } + function isTypeParameterSymbolDeclaredInContainer(symbol: Symbol, container: Node) { + for (const decl of symbol.declarations) { + if (decl.kind === SyntaxKind.TypeParameter && decl.parent === container) { + return true; + } + } + + return false; + } + function checkAndReportErrorForMissingPrefix(errorLocation: Node, name: string, nameArg: string | Identifier): boolean { if ((errorLocation.kind === SyntaxKind.Identifier && (isTypeReferenceIdentifier(errorLocation)) || isInTypeQuery(errorLocation))) { return false; @@ -5226,18 +5241,11 @@ namespace ts { // Map an unsatisfied type parameter with a default type. // If a type parameter does not have a default type, or if the default type // is a forward reference, the empty object type is used. - const mapper: TypeMapper = t => { - const i = indexOf(typeParameters, t); - if (i >= typeArguments.length) { - return emptyObjectType; - } - if (i >= 0) { - return typeArguments[i]; - } - return t; - }; - for (let i = numTypeArguments; i < numTypeParameters; i++) { + typeArguments[i] = emptyObjectType; + } + for (let i = numTypeArguments; i < numTypeParameters; i++) { + const mapper = createTypeMapper(typeParameters, typeArguments); const defaultType = getDefaultFromTypeParameter(typeParameters[i]); typeArguments[i] = defaultType ? instantiateType(defaultType, mapper) : emptyObjectType; } @@ -6712,6 +6720,16 @@ namespace ts { return createTypeMapper(sources, undefined); } + /** + * Maps forward-references to later types parameters to the empty object type. + * This is used during inference when instantiating type parameter defaults. + */ + function createBackreferenceMapper(typeParameters: TypeParameter[], index: number) { + const mapper: TypeMapper = t => indexOf(typeParameters, t) >= index ? emptyObjectType : t; + mapper.mappedTypes = typeParameters; + return mapper; + } + function getInferenceMapper(context: InferenceContext): TypeMapper { if (!context.mapper) { const mapper: TypeMapper = t => { @@ -9194,9 +9212,12 @@ namespace ts { // candidates with no common supertype. const defaultType = getDefaultFromTypeParameter(context.signature.typeParameters[index]); if (defaultType) { - const backreferenceMapper: TypeMapper = t => indexOf(context.signature.typeParameters, t) >= index ? emptyObjectType : t; - const mapper = combineTypeMappers(backreferenceMapper, getInferenceMapper(context)); - inferredType = instantiateType(defaultType, mapper); + // Instantiate the default type. Any forward reference to a type + // parameter should be instantiated to the empty object type. + inferredType = instantiateType(defaultType, + combineTypeMappers( + createBackreferenceMapper(context.signature.typeParameters, index), + getInferenceMapper(context))); } else { inferredType = emptyObjectType; @@ -16216,9 +16237,6 @@ namespace ts { checkTypeArgumentConstraints(typeParameters, node.typeArguments, minTypeArgumentCount); } } - if (type.flags & TypeFlags.TypeParameter && !(type).isThisType && type.symbol && !isTypeParameterInScope(type, node)) { - error(node, Diagnostics.Type_parameter_0_cannot_be_referenced_outside_of_the_declaration_that_defines_it, symbolToString(type.symbol)); - } if (type.flags & TypeFlags.Enum && !(type).memberTypes && getNodeLinks(node).resolvedSymbol.flags & SymbolFlags.EnumMember) { error(node, Diagnostics.Enum_type_0_has_members_with_initializers_that_are_not_literals, typeToString(type)); } @@ -17657,23 +17675,6 @@ namespace ts { } } - function isTypeParameterInScope(typeParameter: TypeParameter, node: Node) { - const parents = map(filter(typeParameter.symbol.declarations, isTypeParameter), node => node.parent); - while (node) { - if (isFunctionLike(node) || - isClassLike(node) || - node.kind === SyntaxKind.InterfaceDeclaration || - node.kind === SyntaxKind.TypeAliasDeclaration || - node.kind === SyntaxKind.MappedType) { - if (contains(parents, node)) { - return true; - } - } - node = node.parent; - } - return false; - } - function areDeclarationFlagsIdentical(left: Declaration, right: Declaration) { if ((left.kind === SyntaxKind.Parameter && right.kind === SyntaxKind.VariableDeclaration) || (left.kind === SyntaxKind.VariableDeclaration && right.kind === SyntaxKind.Parameter)) { From 9ba2a6b14a1b9a109208b810f27b498c097332ad Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 1 Feb 2017 01:24:28 -0800 Subject: [PATCH 15/18] Skip type parameters. --- src/compiler/checker.ts | 10 +- src/compiler/diagnosticMessages.json | 4 - tests/baselines/reference/genericDefaults.js | 21 ++ .../reference/genericDefaults.symbols | 293 ++++++++++-------- .../baselines/reference/genericDefaults.types | 49 +++ .../genericDefaultsErrors.errors.txt | 9 +- .../reference/genericDefaultsErrors.js | 40 --- tests/cases/compiler/genericDefaults.ts | 7 + 8 files changed, 255 insertions(+), 178 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f101ff1492365..f0e60a18d443f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -858,6 +858,11 @@ namespace ts { case SyntaxKind.ClassExpression: case SyntaxKind.InterfaceDeclaration: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & SymbolFlags.Type)) { + if (!isTypeParameterSymbolDeclaredInContainer(result, location)) { + // ignore type parameters not declared in this container + result = undefined; + break; + } if (lastLocation && getModifierFlags(lastLocation) & ModifierFlags.Static) { // TypeScript 1.0 spec (April 2014): 3.4.1 // The scope of a type parameter extends over the entire declaration with which the type @@ -865,11 +870,6 @@ namespace ts { error(errorLocation, Diagnostics.Static_members_cannot_reference_class_type_parameters); return undefined; } - // Only perform additional check if error reporting was requested - if (nameNotFoundMessage && !isTypeParameterSymbolDeclaredInContainer(result, location)) { - error(errorLocation, Diagnostics.Type_parameter_0_cannot_be_referenced_outside_of_the_declaration_that_defines_it, symbolToString(result)); - return undefined; - } break loop; } if (location.kind === SyntaxKind.ClassExpression && meaning & SymbolFlags.Class) { diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 22c31b3089378..f831f181f4709 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1127,10 +1127,6 @@ "category": "Error", "code": 2366 }, - "Type parameter '{0}' cannot be referenced outside of the declaration that defines it.": { - "category": "Error", - "code": 2367 - }, "Type parameter name cannot be '{0}'": { "category": "Error", "code": 2368 diff --git a/tests/baselines/reference/genericDefaults.js b/tests/baselines/reference/genericDefaults.js index 07276db8d45cc..45d889fc49c5a 100644 --- a/tests/baselines/reference/genericDefaults.js +++ b/tests/baselines/reference/genericDefaults.js @@ -430,6 +430,13 @@ const i06c00 = (x).a; const i06c01 = (>x).a; const i06c02 = (>x).a; +interface i07 { a: A; } +interface i07 { b: A; } +const i07c00 = (x).a; +const i07c01 = (x).b; +const i07c02 = (>x).a; +const i07c03 = (>x).b; + interface Base01 { a: T; } interface Base01Constructor { new (a?: T): Base01; } @@ -811,6 +818,10 @@ var i05c01 = x.a; var i06c00 = x.a; var i06c01 = x.a; var i06c02 = x.a; +var i07c00 = x.a; +var i07c01 = x.b; +var i07c02 = x.a; +var i07c03 = x.b; var Base01c00 = new Base01(); var Base01c01 = new Base01(1); var Base01c02 = new Base01(); @@ -933,6 +944,16 @@ interface i06 { declare const i06c00: [{}, {}]; declare const i06c01: [number, number]; declare const i06c02: [number, string]; +interface i07 { + a: A; +} +interface i07 { + b: A; +} +declare const i07c00: A; +declare const i07c01: number; +declare const i07c02: A; +declare const i07c03: B; interface Base01 { a: T; } diff --git a/tests/baselines/reference/genericDefaults.symbols b/tests/baselines/reference/genericDefaults.symbols index 56972a31b68c7..2250e9ea95a8a 100644 --- a/tests/baselines/reference/genericDefaults.symbols +++ b/tests/baselines/reference/genericDefaults.symbols @@ -2004,213 +2004,254 @@ const i06c02 = (>x).a; >x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) >a : Symbol(i06.a, Decl(genericDefaults.ts, 426, 29)) +interface i07 { a: A; } +>i07 : Symbol(i07, Decl(genericDefaults.ts, 429, 42), Decl(genericDefaults.ts, 431, 23)) +>a : Symbol(i07.a, Decl(genericDefaults.ts, 431, 15)) +>A : Symbol(A, Decl(genericDefaults.ts, 0, 0)) + +interface i07 { b: A; } +>i07 : Symbol(i07, Decl(genericDefaults.ts, 429, 42), Decl(genericDefaults.ts, 431, 23)) +>A : Symbol(A, Decl(genericDefaults.ts, 432, 14)) +>b : Symbol(i07.b, Decl(genericDefaults.ts, 432, 27)) +>A : Symbol(A, Decl(genericDefaults.ts, 432, 14)) + +const i07c00 = (x).a; +>i07c00 : Symbol(i07c00, Decl(genericDefaults.ts, 433, 5)) +>(x).a : Symbol(i07.a, Decl(genericDefaults.ts, 431, 15)) +>i07 : Symbol(i07, Decl(genericDefaults.ts, 429, 42), Decl(genericDefaults.ts, 431, 23)) +>x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) +>a : Symbol(i07.a, Decl(genericDefaults.ts, 431, 15)) + +const i07c01 = (x).b; +>i07c01 : Symbol(i07c01, Decl(genericDefaults.ts, 434, 5)) +>(x).b : Symbol(i07.b, Decl(genericDefaults.ts, 432, 27)) +>i07 : Symbol(i07, Decl(genericDefaults.ts, 429, 42), Decl(genericDefaults.ts, 431, 23)) +>x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) +>b : Symbol(i07.b, Decl(genericDefaults.ts, 432, 27)) + +const i07c02 = (>x).a; +>i07c02 : Symbol(i07c02, Decl(genericDefaults.ts, 435, 5)) +>(>x).a : Symbol(i07.a, Decl(genericDefaults.ts, 431, 15)) +>i07 : Symbol(i07, Decl(genericDefaults.ts, 429, 42), Decl(genericDefaults.ts, 431, 23)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) +>a : Symbol(i07.a, Decl(genericDefaults.ts, 431, 15)) + +const i07c03 = (>x).b; +>i07c03 : Symbol(i07c03, Decl(genericDefaults.ts, 436, 5)) +>(>x).b : Symbol(i07.b, Decl(genericDefaults.ts, 432, 27)) +>i07 : Symbol(i07, Decl(genericDefaults.ts, 429, 42), Decl(genericDefaults.ts, 431, 23)) +>B : Symbol(B, Decl(genericDefaults.ts, 0, 26)) +>x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) +>b : Symbol(i07.b, Decl(genericDefaults.ts, 432, 27)) + interface Base01 { a: T; } ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 429, 42), Decl(genericDefaults.ts, 434, 13)) ->T : Symbol(T, Decl(genericDefaults.ts, 431, 17)) ->a : Symbol(Base01.a, Decl(genericDefaults.ts, 431, 21)) ->T : Symbol(T, Decl(genericDefaults.ts, 431, 17)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 436, 29), Decl(genericDefaults.ts, 441, 13)) +>T : Symbol(T, Decl(genericDefaults.ts, 438, 17)) +>a : Symbol(Base01.a, Decl(genericDefaults.ts, 438, 21)) +>T : Symbol(T, Decl(genericDefaults.ts, 438, 17)) interface Base01Constructor { new (a?: T): Base01; } ->Base01Constructor : Symbol(Base01Constructor, Decl(genericDefaults.ts, 431, 29)) ->T : Symbol(T, Decl(genericDefaults.ts, 432, 35)) ->a : Symbol(a, Decl(genericDefaults.ts, 432, 47)) ->T : Symbol(T, Decl(genericDefaults.ts, 432, 35)) ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 429, 42), Decl(genericDefaults.ts, 434, 13)) ->T : Symbol(T, Decl(genericDefaults.ts, 432, 35)) +>Base01Constructor : Symbol(Base01Constructor, Decl(genericDefaults.ts, 438, 29)) +>T : Symbol(T, Decl(genericDefaults.ts, 439, 35)) +>a : Symbol(a, Decl(genericDefaults.ts, 439, 47)) +>T : Symbol(T, Decl(genericDefaults.ts, 439, 35)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 436, 29), Decl(genericDefaults.ts, 441, 13)) +>T : Symbol(T, Decl(genericDefaults.ts, 439, 35)) declare const Base01: Base01Constructor; ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 429, 42), Decl(genericDefaults.ts, 434, 13)) ->Base01Constructor : Symbol(Base01Constructor, Decl(genericDefaults.ts, 431, 29)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 436, 29), Decl(genericDefaults.ts, 441, 13)) +>Base01Constructor : Symbol(Base01Constructor, Decl(genericDefaults.ts, 438, 29)) const Base01c00 = new Base01(); ->Base01c00 : Symbol(Base01c00, Decl(genericDefaults.ts, 435, 5)) ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 429, 42), Decl(genericDefaults.ts, 434, 13)) +>Base01c00 : Symbol(Base01c00, Decl(genericDefaults.ts, 442, 5)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 436, 29), Decl(genericDefaults.ts, 441, 13)) const Base01c01 = new Base01(1); ->Base01c01 : Symbol(Base01c01, Decl(genericDefaults.ts, 436, 5)) ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 429, 42), Decl(genericDefaults.ts, 434, 13)) +>Base01c01 : Symbol(Base01c01, Decl(genericDefaults.ts, 443, 5)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 436, 29), Decl(genericDefaults.ts, 441, 13)) const Base01c02 = new Base01(); ->Base01c02 : Symbol(Base01c02, Decl(genericDefaults.ts, 437, 5)) ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 429, 42), Decl(genericDefaults.ts, 434, 13)) +>Base01c02 : Symbol(Base01c02, Decl(genericDefaults.ts, 444, 5)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 436, 29), Decl(genericDefaults.ts, 441, 13)) const Base01c03 = new Base01(1); ->Base01c03 : Symbol(Base01c03, Decl(genericDefaults.ts, 438, 5)) ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 429, 42), Decl(genericDefaults.ts, 434, 13)) +>Base01c03 : Symbol(Base01c03, Decl(genericDefaults.ts, 445, 5)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 436, 29), Decl(genericDefaults.ts, 441, 13)) declare class Derived01 extends Base01 { } ->Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 438, 40)) ->T : Symbol(T, Decl(genericDefaults.ts, 440, 24)) ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 429, 42), Decl(genericDefaults.ts, 434, 13)) ->T : Symbol(T, Decl(genericDefaults.ts, 440, 24)) +>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 445, 40)) +>T : Symbol(T, Decl(genericDefaults.ts, 447, 24)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 436, 29), Decl(genericDefaults.ts, 441, 13)) +>T : Symbol(T, Decl(genericDefaults.ts, 447, 24)) const Derived01c00 = new Derived01(); ->Derived01c00 : Symbol(Derived01c00, Decl(genericDefaults.ts, 441, 5)) ->Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 438, 40)) +>Derived01c00 : Symbol(Derived01c00, Decl(genericDefaults.ts, 448, 5)) +>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 445, 40)) const Derived01c01 = new Derived01(1); ->Derived01c01 : Symbol(Derived01c01, Decl(genericDefaults.ts, 442, 5)) ->Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 438, 40)) +>Derived01c01 : Symbol(Derived01c01, Decl(genericDefaults.ts, 449, 5)) +>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 445, 40)) const Derived01c02 = new Derived01(); ->Derived01c02 : Symbol(Derived01c02, Decl(genericDefaults.ts, 443, 5)) ->Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 438, 40)) +>Derived01c02 : Symbol(Derived01c02, Decl(genericDefaults.ts, 450, 5)) +>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 445, 40)) const Derived01c03 = new Derived01(1); ->Derived01c03 : Symbol(Derived01c03, Decl(genericDefaults.ts, 444, 5)) ->Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 438, 40)) +>Derived01c03 : Symbol(Derived01c03, Decl(genericDefaults.ts, 451, 5)) +>Derived01 : Symbol(Derived01, Decl(genericDefaults.ts, 445, 40)) declare class Derived02 extends Base01 { } ->Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 444, 46)) ->T : Symbol(T, Decl(genericDefaults.ts, 446, 24)) ->Base01 : Symbol(Base01, Decl(genericDefaults.ts, 429, 42), Decl(genericDefaults.ts, 434, 13)) ->T : Symbol(T, Decl(genericDefaults.ts, 446, 24)) +>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 451, 46)) +>T : Symbol(T, Decl(genericDefaults.ts, 453, 24)) +>Base01 : Symbol(Base01, Decl(genericDefaults.ts, 436, 29), Decl(genericDefaults.ts, 441, 13)) +>T : Symbol(T, Decl(genericDefaults.ts, 453, 24)) const Derived02c00 = new Derived02(); ->Derived02c00 : Symbol(Derived02c00, Decl(genericDefaults.ts, 447, 5)) ->Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 444, 46)) +>Derived02c00 : Symbol(Derived02c00, Decl(genericDefaults.ts, 454, 5)) +>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 451, 46)) const Derived02c01 = new Derived02(1); ->Derived02c01 : Symbol(Derived02c01, Decl(genericDefaults.ts, 448, 5)) ->Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 444, 46)) +>Derived02c01 : Symbol(Derived02c01, Decl(genericDefaults.ts, 455, 5)) +>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 451, 46)) const Derived02c02 = new Derived02(); ->Derived02c02 : Symbol(Derived02c02, Decl(genericDefaults.ts, 449, 5)) ->Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 444, 46)) +>Derived02c02 : Symbol(Derived02c02, Decl(genericDefaults.ts, 456, 5)) +>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 451, 46)) const Derived02c03 = new Derived02(1); ->Derived02c03 : Symbol(Derived02c03, Decl(genericDefaults.ts, 450, 5)) ->Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 444, 46)) +>Derived02c03 : Symbol(Derived02c03, Decl(genericDefaults.ts, 457, 5)) +>Derived02 : Symbol(Derived02, Decl(genericDefaults.ts, 451, 46)) type t00 = { a: T; } ->t00 : Symbol(t00, Decl(genericDefaults.ts, 450, 46)) ->T : Symbol(T, Decl(genericDefaults.ts, 452, 9)) ->a : Symbol(a, Decl(genericDefaults.ts, 452, 24)) ->T : Symbol(T, Decl(genericDefaults.ts, 452, 9)) +>t00 : Symbol(t00, Decl(genericDefaults.ts, 457, 46)) +>T : Symbol(T, Decl(genericDefaults.ts, 459, 9)) +>a : Symbol(a, Decl(genericDefaults.ts, 459, 24)) +>T : Symbol(T, Decl(genericDefaults.ts, 459, 9)) const t00c00 = (x).a; ->t00c00 : Symbol(t00c00, Decl(genericDefaults.ts, 453, 5)) ->(x).a : Symbol(a, Decl(genericDefaults.ts, 452, 24)) ->t00 : Symbol(t00, Decl(genericDefaults.ts, 450, 46)) +>t00c00 : Symbol(t00c00, Decl(genericDefaults.ts, 460, 5)) +>(x).a : Symbol(a, Decl(genericDefaults.ts, 459, 24)) +>t00 : Symbol(t00, Decl(genericDefaults.ts, 457, 46)) >x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) ->a : Symbol(a, Decl(genericDefaults.ts, 452, 24)) +>a : Symbol(a, Decl(genericDefaults.ts, 459, 24)) const t00c01 = (>x).a; ->t00c01 : Symbol(t00c01, Decl(genericDefaults.ts, 454, 5)) ->(>x).a : Symbol(a, Decl(genericDefaults.ts, 452, 24)) ->t00 : Symbol(t00, Decl(genericDefaults.ts, 450, 46)) +>t00c01 : Symbol(t00c01, Decl(genericDefaults.ts, 461, 5)) +>(>x).a : Symbol(a, Decl(genericDefaults.ts, 459, 24)) +>t00 : Symbol(t00, Decl(genericDefaults.ts, 457, 46)) >x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) ->a : Symbol(a, Decl(genericDefaults.ts, 452, 24)) +>a : Symbol(a, Decl(genericDefaults.ts, 459, 24)) type t01 = { a: [T, U]; } ->t01 : Symbol(t01, Decl(genericDefaults.ts, 454, 34)) ->T : Symbol(T, Decl(genericDefaults.ts, 456, 9)) ->U : Symbol(U, Decl(genericDefaults.ts, 456, 11)) ->T : Symbol(T, Decl(genericDefaults.ts, 456, 9)) ->a : Symbol(a, Decl(genericDefaults.ts, 456, 22)) ->T : Symbol(T, Decl(genericDefaults.ts, 456, 9)) ->U : Symbol(U, Decl(genericDefaults.ts, 456, 11)) +>t01 : Symbol(t01, Decl(genericDefaults.ts, 461, 34)) +>T : Symbol(T, Decl(genericDefaults.ts, 463, 9)) +>U : Symbol(U, Decl(genericDefaults.ts, 463, 11)) +>T : Symbol(T, Decl(genericDefaults.ts, 463, 9)) +>a : Symbol(a, Decl(genericDefaults.ts, 463, 22)) +>T : Symbol(T, Decl(genericDefaults.ts, 463, 9)) +>U : Symbol(U, Decl(genericDefaults.ts, 463, 11)) const t01c00 = (>x).a; ->t01c00 : Symbol(t01c00, Decl(genericDefaults.ts, 457, 5)) ->(>x).a : Symbol(a, Decl(genericDefaults.ts, 456, 22)) ->t01 : Symbol(t01, Decl(genericDefaults.ts, 454, 34)) +>t01c00 : Symbol(t01c00, Decl(genericDefaults.ts, 464, 5)) +>(>x).a : Symbol(a, Decl(genericDefaults.ts, 463, 22)) +>t01 : Symbol(t01, Decl(genericDefaults.ts, 461, 34)) >x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) ->a : Symbol(a, Decl(genericDefaults.ts, 456, 22)) +>a : Symbol(a, Decl(genericDefaults.ts, 463, 22)) const t01c01 = (>x).a; ->t01c01 : Symbol(t01c01, Decl(genericDefaults.ts, 458, 5)) ->(>x).a : Symbol(a, Decl(genericDefaults.ts, 456, 22)) ->t01 : Symbol(t01, Decl(genericDefaults.ts, 454, 34)) +>t01c01 : Symbol(t01c01, Decl(genericDefaults.ts, 465, 5)) +>(>x).a : Symbol(a, Decl(genericDefaults.ts, 463, 22)) +>t01 : Symbol(t01, Decl(genericDefaults.ts, 461, 34)) >x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) ->a : Symbol(a, Decl(genericDefaults.ts, 456, 22)) +>a : Symbol(a, Decl(genericDefaults.ts, 463, 22)) type t02 = { a: [T, U]; } ->t02 : Symbol(t02, Decl(genericDefaults.ts, 458, 42)) ->T : Symbol(T, Decl(genericDefaults.ts, 460, 9)) ->U : Symbol(U, Decl(genericDefaults.ts, 460, 26)) ->T : Symbol(T, Decl(genericDefaults.ts, 460, 9)) ->a : Symbol(a, Decl(genericDefaults.ts, 460, 37)) ->T : Symbol(T, Decl(genericDefaults.ts, 460, 9)) ->U : Symbol(U, Decl(genericDefaults.ts, 460, 26)) +>t02 : Symbol(t02, Decl(genericDefaults.ts, 465, 42)) +>T : Symbol(T, Decl(genericDefaults.ts, 467, 9)) +>U : Symbol(U, Decl(genericDefaults.ts, 467, 26)) +>T : Symbol(T, Decl(genericDefaults.ts, 467, 9)) +>a : Symbol(a, Decl(genericDefaults.ts, 467, 37)) +>T : Symbol(T, Decl(genericDefaults.ts, 467, 9)) +>U : Symbol(U, Decl(genericDefaults.ts, 467, 26)) const t02c00 = (>x).a; ->t02c00 : Symbol(t02c00, Decl(genericDefaults.ts, 461, 5)) ->(>x).a : Symbol(a, Decl(genericDefaults.ts, 460, 37)) ->t02 : Symbol(t02, Decl(genericDefaults.ts, 458, 42)) +>t02c00 : Symbol(t02c00, Decl(genericDefaults.ts, 468, 5)) +>(>x).a : Symbol(a, Decl(genericDefaults.ts, 467, 37)) +>t02 : Symbol(t02, Decl(genericDefaults.ts, 465, 42)) >x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) ->a : Symbol(a, Decl(genericDefaults.ts, 460, 37)) +>a : Symbol(a, Decl(genericDefaults.ts, 467, 37)) const t02c01 = (>x).a; ->t02c01 : Symbol(t02c01, Decl(genericDefaults.ts, 462, 5)) ->(>x).a : Symbol(a, Decl(genericDefaults.ts, 460, 37)) ->t02 : Symbol(t02, Decl(genericDefaults.ts, 458, 42)) +>t02c01 : Symbol(t02c01, Decl(genericDefaults.ts, 469, 5)) +>(>x).a : Symbol(a, Decl(genericDefaults.ts, 467, 37)) +>t02 : Symbol(t02, Decl(genericDefaults.ts, 465, 42)) >x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) ->a : Symbol(a, Decl(genericDefaults.ts, 460, 37)) +>a : Symbol(a, Decl(genericDefaults.ts, 467, 37)) const t02c02 = (>x).a; ->t02c02 : Symbol(t02c02, Decl(genericDefaults.ts, 463, 5)) ->(>x).a : Symbol(a, Decl(genericDefaults.ts, 460, 37)) ->t02 : Symbol(t02, Decl(genericDefaults.ts, 458, 42)) +>t02c02 : Symbol(t02c02, Decl(genericDefaults.ts, 470, 5)) +>(>x).a : Symbol(a, Decl(genericDefaults.ts, 467, 37)) +>t02 : Symbol(t02, Decl(genericDefaults.ts, 465, 42)) >x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) ->a : Symbol(a, Decl(genericDefaults.ts, 460, 37)) +>a : Symbol(a, Decl(genericDefaults.ts, 467, 37)) const t02c03 = (>x).a; ->t02c03 : Symbol(t02c03, Decl(genericDefaults.ts, 464, 5)) ->(>x).a : Symbol(a, Decl(genericDefaults.ts, 460, 37)) ->t02 : Symbol(t02, Decl(genericDefaults.ts, 458, 42)) +>t02c03 : Symbol(t02c03, Decl(genericDefaults.ts, 471, 5)) +>(>x).a : Symbol(a, Decl(genericDefaults.ts, 467, 37)) +>t02 : Symbol(t02, Decl(genericDefaults.ts, 465, 42)) >x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) ->a : Symbol(a, Decl(genericDefaults.ts, 460, 37)) +>a : Symbol(a, Decl(genericDefaults.ts, 467, 37)) const t02c04 = (>x).a; ->t02c04 : Symbol(t02c04, Decl(genericDefaults.ts, 465, 5)) ->(>x).a : Symbol(a, Decl(genericDefaults.ts, 460, 37)) ->t02 : Symbol(t02, Decl(genericDefaults.ts, 458, 42)) +>t02c04 : Symbol(t02c04, Decl(genericDefaults.ts, 472, 5)) +>(>x).a : Symbol(a, Decl(genericDefaults.ts, 467, 37)) +>t02 : Symbol(t02, Decl(genericDefaults.ts, 465, 42)) >x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) ->a : Symbol(a, Decl(genericDefaults.ts, 460, 37)) +>a : Symbol(a, Decl(genericDefaults.ts, 467, 37)) type t03 = { a: [T, U]; } ->t03 : Symbol(t03, Decl(genericDefaults.ts, 465, 37)) ->T : Symbol(T, Decl(genericDefaults.ts, 467, 9)) ->U : Symbol(U, Decl(genericDefaults.ts, 467, 26)) ->T : Symbol(T, Decl(genericDefaults.ts, 467, 9)) ->T : Symbol(T, Decl(genericDefaults.ts, 467, 9)) ->a : Symbol(a, Decl(genericDefaults.ts, 467, 47)) ->T : Symbol(T, Decl(genericDefaults.ts, 467, 9)) ->U : Symbol(U, Decl(genericDefaults.ts, 467, 26)) +>t03 : Symbol(t03, Decl(genericDefaults.ts, 472, 37)) +>T : Symbol(T, Decl(genericDefaults.ts, 474, 9)) +>U : Symbol(U, Decl(genericDefaults.ts, 474, 26)) +>T : Symbol(T, Decl(genericDefaults.ts, 474, 9)) +>T : Symbol(T, Decl(genericDefaults.ts, 474, 9)) +>a : Symbol(a, Decl(genericDefaults.ts, 474, 47)) +>T : Symbol(T, Decl(genericDefaults.ts, 474, 9)) +>U : Symbol(U, Decl(genericDefaults.ts, 474, 26)) const t03c00 = (>x).a; ->t03c00 : Symbol(t03c00, Decl(genericDefaults.ts, 468, 5)) ->(>x).a : Symbol(a, Decl(genericDefaults.ts, 467, 47)) ->t03 : Symbol(t03, Decl(genericDefaults.ts, 465, 37)) +>t03c00 : Symbol(t03c00, Decl(genericDefaults.ts, 475, 5)) +>(>x).a : Symbol(a, Decl(genericDefaults.ts, 474, 47)) +>t03 : Symbol(t03, Decl(genericDefaults.ts, 472, 37)) >x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) ->a : Symbol(a, Decl(genericDefaults.ts, 467, 47)) +>a : Symbol(a, Decl(genericDefaults.ts, 474, 47)) const t03c01 = (>x).a; ->t03c01 : Symbol(t03c01, Decl(genericDefaults.ts, 469, 5)) ->(>x).a : Symbol(a, Decl(genericDefaults.ts, 467, 47)) ->t03 : Symbol(t03, Decl(genericDefaults.ts, 465, 37)) +>t03c01 : Symbol(t03c01, Decl(genericDefaults.ts, 476, 5)) +>(>x).a : Symbol(a, Decl(genericDefaults.ts, 474, 47)) +>t03 : Symbol(t03, Decl(genericDefaults.ts, 472, 37)) >x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) ->a : Symbol(a, Decl(genericDefaults.ts, 467, 47)) +>a : Symbol(a, Decl(genericDefaults.ts, 474, 47)) const t03c02 = (>x).a; ->t03c02 : Symbol(t03c02, Decl(genericDefaults.ts, 470, 5)) ->(>x).a : Symbol(a, Decl(genericDefaults.ts, 467, 47)) ->t03 : Symbol(t03, Decl(genericDefaults.ts, 465, 37)) +>t03c02 : Symbol(t03c02, Decl(genericDefaults.ts, 477, 5)) +>(>x).a : Symbol(a, Decl(genericDefaults.ts, 474, 47)) +>t03 : Symbol(t03, Decl(genericDefaults.ts, 472, 37)) >x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) ->a : Symbol(a, Decl(genericDefaults.ts, 467, 47)) +>a : Symbol(a, Decl(genericDefaults.ts, 474, 47)) const t03c03 = (>x).a; ->t03c03 : Symbol(t03c03, Decl(genericDefaults.ts, 471, 5)) ->(>x).a : Symbol(a, Decl(genericDefaults.ts, 467, 47)) ->t03 : Symbol(t03, Decl(genericDefaults.ts, 465, 37)) +>t03c03 : Symbol(t03c03, Decl(genericDefaults.ts, 478, 5)) +>(>x).a : Symbol(a, Decl(genericDefaults.ts, 474, 47)) +>t03 : Symbol(t03, Decl(genericDefaults.ts, 472, 37)) >x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) ->a : Symbol(a, Decl(genericDefaults.ts, 467, 47)) +>a : Symbol(a, Decl(genericDefaults.ts, 474, 47)) const t03c04 = (>x).a; ->t03c04 : Symbol(t03c04, Decl(genericDefaults.ts, 472, 5)) ->(>x).a : Symbol(a, Decl(genericDefaults.ts, 467, 47)) ->t03 : Symbol(t03, Decl(genericDefaults.ts, 465, 37)) +>t03c04 : Symbol(t03c04, Decl(genericDefaults.ts, 479, 5)) +>(>x).a : Symbol(a, Decl(genericDefaults.ts, 474, 47)) +>t03 : Symbol(t03, Decl(genericDefaults.ts, 472, 37)) >x : Symbol(x, Decl(genericDefaults.ts, 13, 13)) ->a : Symbol(a, Decl(genericDefaults.ts, 467, 47)) +>a : Symbol(a, Decl(genericDefaults.ts, 474, 47)) diff --git a/tests/baselines/reference/genericDefaults.types b/tests/baselines/reference/genericDefaults.types index 8be6f31185607..cd6c2d58e4acf 100644 --- a/tests/baselines/reference/genericDefaults.types +++ b/tests/baselines/reference/genericDefaults.types @@ -2301,6 +2301,55 @@ const i06c02 = (>x).a; >x : any >a : [number, string] +interface i07 { a: A; } +>i07 : i07 +>a : A +>A : A + +interface i07 { b: A; } +>i07 : i07 +>A : A +>b : A +>A : A + +const i07c00 = (x).a; +>i07c00 : A +>(x).a : A +>(x) : i07 +>x : i07 +>i07 : i07 +>x : any +>a : A + +const i07c01 = (x).b; +>i07c01 : number +>(x).b : number +>(x) : i07 +>x : i07 +>i07 : i07 +>x : any +>b : number + +const i07c02 = (>x).a; +>i07c02 : A +>(>x).a : A +>(>x) : i07 +>>x : i07 +>i07 : i07 +>B : B +>x : any +>a : A + +const i07c03 = (>x).b; +>i07c03 : B +>(>x).b : B +>(>x) : i07 +>>x : i07 +>i07 : i07 +>B : B +>x : any +>b : B + interface Base01 { a: T; } >Base01 : Base01 >T : T diff --git a/tests/baselines/reference/genericDefaultsErrors.errors.txt b/tests/baselines/reference/genericDefaultsErrors.errors.txt index e18baf8e4e97e..0347c547e084d 100644 --- a/tests/baselines/reference/genericDefaultsErrors.errors.txt +++ b/tests/baselines/reference/genericDefaultsErrors.errors.txt @@ -17,10 +17,11 @@ tests/cases/compiler/genericDefaultsErrors.ts(30,32): error TS2344: Type 'number tests/cases/compiler/genericDefaultsErrors.ts(33,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. tests/cases/compiler/genericDefaultsErrors.ts(34,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. tests/cases/compiler/genericDefaultsErrors.ts(37,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. -tests/cases/compiler/genericDefaultsErrors.ts(39,20): error TS2367: Type parameter 'T' cannot be referenced outside of the declaration that defines it. +tests/cases/compiler/genericDefaultsErrors.ts(39,20): error TS2304: Cannot find name 'T'. +tests/cases/compiler/genericDefaultsErrors.ts(39,20): error TS4033: Property 'x' of exported interface has or is using private name 'T'. -==== tests/cases/compiler/genericDefaultsErrors.ts (18 errors) ==== +==== tests/cases/compiler/genericDefaultsErrors.ts (19 errors) ==== declare const x: any; @@ -97,5 +98,7 @@ tests/cases/compiler/genericDefaultsErrors.ts(39,20): error TS2367: Type paramet interface i10 { x: T; } // error ~ -!!! error TS2367: Type parameter 'T' cannot be referenced outside of the declaration that defines it. +!!! error TS2304: Cannot find name 'T'. + ~ +!!! error TS4033: Property 'x' of exported interface has or is using private name 'T'. interface i10 {} \ No newline at end of file diff --git a/tests/baselines/reference/genericDefaultsErrors.js b/tests/baselines/reference/genericDefaultsErrors.js index 7e91d72fb2193..6309b01cab3fc 100644 --- a/tests/baselines/reference/genericDefaultsErrors.js +++ b/tests/baselines/reference/genericDefaultsErrors.js @@ -48,43 +48,3 @@ f11(); // ok f11(); // error f12(); // ok f12("a"); // error - - -//// [genericDefaultsErrors.d.ts] -declare const x: any; -declare function f03(): void; -declare function f04(): void; -declare function f05(): void; -declare function f06(): void; -declare function f11(): void; -declare function f12(a?: U): void; -interface i00 { -} -interface i00 { -} -interface i01 { -} -interface i01 { -} -interface i04 { -} -interface i05 { -} -interface i06 { -} -interface i07 { -} -interface i08 { -} -interface i09 { -} -declare type i09t00 = i09; -declare type i09t01 = i09<1>; -declare type i09t02 = i09<1, 2>; -declare type i09t03 = i09<1, 2, 3>; -declare type i09t04 = i09<1, 2, 3, 4>; -interface i10 { - x: T; -} -interface i10 { -} diff --git a/tests/cases/compiler/genericDefaults.ts b/tests/cases/compiler/genericDefaults.ts index a0675410143e9..bba6549cfc196 100644 --- a/tests/cases/compiler/genericDefaults.ts +++ b/tests/cases/compiler/genericDefaults.ts @@ -430,6 +430,13 @@ const i06c00 = (x).a; const i06c01 = (>x).a; const i06c02 = (>x).a; +interface i07 { a: A; } +interface i07 { b: A; } +const i07c00 = (x).a; +const i07c01 = (x).b; +const i07c02 = (>x).a; +const i07c03 = (>x).b; + interface Base01 { a: T; } interface Base01Constructor { new (a?: T): Base01; } From 6091050bec80088c56bb335b856173de59369be1 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 3 Feb 2017 14:01:42 -0800 Subject: [PATCH 16/18] Remove pre-computation of minTypeArgumentCount --- src/compiler/checker.ts | 60 ++++++++++++++++++++--------------------- src/compiler/types.ts | 5 ---- 2 files changed, 29 insertions(+), 36 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f0e60a18d443f..8ba48f38c8003 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -169,10 +169,10 @@ namespace ts { const noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); const circularConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - const anySignature = createSignature(undefined, undefined, 0, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); - const unknownSignature = createSignature(undefined, undefined, 0, undefined, emptyArray, unknownType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); - const resolvingSignature = createSignature(undefined, undefined, 0, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); - const silentNeverSignature = createSignature(undefined, undefined, 0, undefined, emptyArray, silentNeverType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); + const anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); + const unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); + const resolvingSignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); + const silentNeverSignature = createSignature(undefined, undefined, undefined, emptyArray, silentNeverType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); const enumNumberIndexInfo = createIndexInfo(stringType, /*isReadonly*/ true); @@ -3845,7 +3845,7 @@ namespace ts { function getConstructorsForTypeArguments(type: Type, typeArgumentNodes: TypeNode[]): Signature[] { const typeArgCount = length(typeArgumentNodes); return filter(getSignaturesOfType(type, SignatureKind.Construct), - sig => typeArgCount >= sig.minTypeArgumentCount && typeArgCount <= length(sig.typeParameters)); + sig => typeArgCount >= getMinTypeArgumentCount(sig.typeParameters) && typeArgCount <= length(sig.typeParameters)); } function getInstantiatedConstructorsForTypeArguments(type: Type, typeArgumentNodes: TypeNode[]): Signature[] { @@ -4059,7 +4059,6 @@ namespace ts { type.typeParameters = concatenate(outerTypeParameters, localTypeParameters); type.outerTypeParameters = outerTypeParameters; type.localTypeParameters = localTypeParameters; - type.minTypeArgumentCount = getMinTypeArgumentCount(localTypeParameters); (type).instantiations = createMap(); (type).instantiations.set(getTypeListId(type.typeParameters), type); (type).target = type; @@ -4103,7 +4102,6 @@ namespace ts { // Initialize the instantiation cache for generic type aliases. The declared type corresponds to // an instantiation of the type alias with the type parameters supplied as type arguments. links.typeParameters = typeParameters; - links.minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); links.instantiations = createMap(); links.instantiations.set(getTypeListId(typeParameters), type); } @@ -4417,12 +4415,11 @@ namespace ts { resolveObjectTypeMembers(type, source, typeParameters, typeArguments); } - function createSignature(declaration: SignatureDeclaration, typeParameters: TypeParameter[], minTypeArgumentCount: number, thisParameter: Symbol | undefined, parameters: Symbol[], + function createSignature(declaration: SignatureDeclaration, typeParameters: TypeParameter[], thisParameter: Symbol | undefined, parameters: Symbol[], resolvedReturnType: Type, typePredicate: TypePredicate, minArgumentCount: number, hasRestParameter: boolean, hasLiteralTypes: boolean): Signature { const sig = new Signature(checker); sig.declaration = declaration; sig.typeParameters = typeParameters; - sig.minTypeArgumentCount = minTypeArgumentCount; sig.parameters = parameters; sig.thisParameter = thisParameter; sig.resolvedReturnType = resolvedReturnType; @@ -4434,7 +4431,7 @@ namespace ts { } function cloneSignature(sig: Signature): Signature { - return createSignature(sig.declaration, sig.typeParameters, sig.minTypeArgumentCount, sig.thisParameter, sig.parameters, sig.resolvedReturnType, + return createSignature(sig.declaration, sig.typeParameters, sig.thisParameter, sig.parameters, sig.resolvedReturnType, sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasLiteralTypes); } @@ -4442,19 +4439,18 @@ namespace ts { const baseConstructorType = getBaseConstructorTypeOfClass(classType); const baseSignatures = getSignaturesOfType(baseConstructorType, SignatureKind.Construct); if (baseSignatures.length === 0) { - return [createSignature(undefined, classType.localTypeParameters, classType.minTypeArgumentCount, undefined, emptyArray, classType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false)]; + return [createSignature(undefined, classType.localTypeParameters, undefined, emptyArray, classType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false)]; } const baseTypeNode = getBaseTypeNodeOfClass(classType); const typeArguments = map(baseTypeNode.typeArguments, getTypeFromTypeNode); const typeArgCount = length(typeArguments); const result: Signature[] = []; for (const baseSig of baseSignatures) { - const minTypeArgumentCount = baseSig.minTypeArgumentCount; + const minTypeArgumentCount = getMinTypeArgumentCount(baseSig.typeParameters); const typeParamCount = length(baseSig.typeParameters); if (typeArgCount >= minTypeArgumentCount && typeArgCount <= typeParamCount) { const sig = typeParamCount ? createSignatureInstantiation(baseSig, fillMissingTypeArguments(typeArguments, baseSig.typeParameters, minTypeArgumentCount)) : cloneSignature(baseSig); sig.typeParameters = classType.localTypeParameters; - sig.minTypeArgumentCount = classType.minTypeArgumentCount; sig.resolvedReturnType = classType; result.push(sig); } @@ -5320,7 +5316,7 @@ namespace ts { createTypePredicateFromTypePredicateNode(declaration.type as TypePredicateNode) : undefined; - links.resolvedSignature = createSignature(declaration, typeParameters, getMinTypeArgumentCount(typeParameters), thisParameter, parameters, returnType, typePredicate, minArgumentCount, hasRestParameter(declaration), hasLiteralTypes); + links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, returnType, typePredicate, minArgumentCount, hasRestParameter(declaration), hasLiteralTypes); } return links.resolvedSignature; } @@ -5451,7 +5447,7 @@ namespace ts { } function getSignatureInstantiation(signature: Signature, typeArguments: Type[]): Signature { - typeArguments = fillMissingTypeArguments(typeArguments, signature.typeParameters, signature.minTypeArgumentCount); + typeArguments = fillMissingTypeArguments(typeArguments, signature.typeParameters, getMinTypeArgumentCount(signature.typeParameters)); const instantiations = signature.instantiations || (signature.instantiations = createMap()); const id = getTypeListId(typeArguments); let instantiation = instantiations.get(id); @@ -5618,20 +5614,21 @@ namespace ts { const typeParameters = type.localTypeParameters; if (typeParameters) { const numTypeArguments = length(node.typeArguments); - if (numTypeArguments < type.minTypeArgumentCount || numTypeArguments > typeParameters.length) { + const minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); + if (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length) { error(node, - type.minTypeArgumentCount === typeParameters.length + minTypeArgumentCount === typeParameters.length ? Diagnostics.Generic_type_0_requires_1_type_argument_s : Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments, typeToString(type, /*enclosingDeclaration*/ undefined, TypeFormatFlags.WriteArrayAsGenericType), - type.minTypeArgumentCount, + minTypeArgumentCount, typeParameters.length); return unknownType; } // In a type reference, the outer type parameters of the referenced class or interface are automatically // supplied as type arguments and the type reference only specifies arguments for the local type parameters // of the class or interface. - const typeArguments = concatenate(type.outerTypeParameters, fillMissingTypeArguments(map(node.typeArguments, getTypeFromTypeNode), typeParameters, type.minTypeArgumentCount)); + const typeArguments = concatenate(type.outerTypeParameters, fillMissingTypeArguments(map(node.typeArguments, getTypeFromTypeNode), typeParameters, minTypeArgumentCount)); return createTypeReference(type, typeArguments); } if (node.typeArguments) { @@ -5648,7 +5645,7 @@ namespace ts { const id = getTypeListId(typeArguments); let instantiation = links.instantiations.get(id); if (!instantiation) { - links.instantiations.set(id, instantiation = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, fillMissingTypeArguments(typeArguments, typeParameters, links.minTypeArgumentCount)))); + links.instantiations.set(id, instantiation = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, fillMissingTypeArguments(typeArguments, typeParameters, getMinTypeArgumentCount(typeParameters))))); } return instantiation; } @@ -5658,9 +5655,10 @@ namespace ts { // declared type. Instantiations are cached using the type identities of the type arguments as the key. function getTypeFromTypeAliasReference(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference, symbol: Symbol): Type { const type = getDeclaredTypeOfSymbol(symbol); - const { typeParameters, minTypeArgumentCount } = getSymbolLinks(symbol); + const typeParameters = getSymbolLinks(symbol).typeParameters; if (typeParameters) { const numTypeArguments = length(node.typeArguments); + const minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); if (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length) { error(node, minTypeArgumentCount === typeParameters.length @@ -5897,7 +5895,6 @@ namespace ts { type.typeParameters = typeParameters; type.outerTypeParameters = undefined; type.localTypeParameters = typeParameters; - type.minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); type.instantiations = createMap(); type.instantiations.set(getTypeListId(type.typeParameters), type); type.target = type; @@ -6805,7 +6802,7 @@ namespace ts { if (signature.typePredicate) { freshTypePredicate = cloneTypePredicate(signature.typePredicate, mapper); } - const result = createSignature(signature.declaration, freshTypeParameters, signature.minTypeArgumentCount, + const result = createSignature(signature.declaration, freshTypeParameters, signature.thisParameter && instantiateSymbol(signature.thisParameter, mapper), instantiateList(signature.parameters, mapper, instantiateSymbol), instantiateType(signature.resolvedReturnType, mapper), @@ -12937,8 +12934,9 @@ namespace ts { // If the user supplied type arguments, but the number of type arguments does not match // the declared number of type parameters, the call has an incorrect arity. const numTypeParameters = length(signature.typeParameters); + const minTypeArgumentCount = getMinTypeArgumentCount(signature.typeParameters); const hasRightNumberOfTypeArgs = !typeArguments || - (typeArguments.length >= signature.minTypeArgumentCount && typeArguments.length <= numTypeParameters); + (typeArguments.length >= minTypeArgumentCount && typeArguments.length <= numTypeParameters); if (!hasRightNumberOfTypeArgs) { return false; } @@ -13637,7 +13635,7 @@ namespace ts { if (candidate.typeParameters) { let typeArgumentTypes: Type[] | undefined; if (typeArguments) { - typeArgumentTypes = fillMissingTypeArguments(map(typeArguments, getTypeFromTypeNode), candidate.typeParameters, candidate.minTypeArgumentCount); + typeArgumentTypes = fillMissingTypeArguments(map(typeArguments, getTypeFromTypeNode), candidate.typeParameters, getMinTypeArgumentCount(candidate.typeParameters)); typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, /*reportErrors*/ false); } else { @@ -16201,7 +16199,8 @@ namespace ts { checkDecorators(node); } - function checkTypeArgumentConstraints(typeParameters: TypeParameter[], typeArgumentNodes: TypeNode[], minTypeArgumentCount: number): boolean { + function checkTypeArgumentConstraints(typeParameters: TypeParameter[], typeArgumentNodes: TypeNode[]): boolean { + const minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); let typeArguments: Type[]; let mapper: TypeMapper; let result = true; @@ -16233,8 +16232,7 @@ namespace ts { if (produceDiagnostics) { const symbol = getNodeLinks(node).resolvedSymbol; const typeParameters = symbol.flags & SymbolFlags.TypeAlias ? getSymbolLinks(symbol).typeParameters : (type).target.localTypeParameters; - const minTypeArgumentCount = symbol.flags & SymbolFlags.TypeAlias ? getSymbolLinks(symbol).minTypeArgumentCount : (type).target.minTypeArgumentCount; - checkTypeArgumentConstraints(typeParameters, node.typeArguments, minTypeArgumentCount); + checkTypeArgumentConstraints(typeParameters, node.typeArguments); } } if (type.flags & TypeFlags.Enum && !(type).memberTypes && getNodeLinks(node).resolvedSymbol.flags & SymbolFlags.EnumMember) { @@ -18482,8 +18480,9 @@ namespace ts { // Resolve the type parameters and minimum type argument count for all declarations resolveTypeParametersOfClassOrInterface(symbol); - const { typeParameters, minTypeArgumentCount } = getSymbolLinks(symbol); + const typeParameters = getSymbolLinks(symbol).typeParameters; const maxTypeArgumentCount = length(typeParameters); + const minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); const numTypeParameters = length(node.typeParameters); // If this declaration has too few or too many type parameters, we report an error @@ -18581,7 +18580,6 @@ namespace ts { typeParameters.length = maxTypeArgumentCount; } links.typeParameters = typeParameters || emptyArray; - links.minTypeArgumentCount = minTypeArgumentCount; } } @@ -18645,7 +18643,7 @@ namespace ts { if (baseTypeNode.typeArguments) { forEach(baseTypeNode.typeArguments, checkSourceElement); for (const constructor of getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments)) { - if (!checkTypeArgumentConstraints(constructor.typeParameters, baseTypeNode.typeArguments, constructor.minTypeArgumentCount)) { + if (!checkTypeArgumentConstraints(constructor.typeParameters, baseTypeNode.typeArguments)) { break; } } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index bd17b844d381b..754393b66b0a2 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2706,7 +2706,6 @@ type?: Type; // Type of value symbol declaredType?: Type; // Type of class, interface, enum, type alias, or type parameter typeParameters?: TypeParameter[]; // Type parameters of type alias (undefined if non-generic) - minTypeArgumentCount?: number; inferredClassType?: Type; // Type of an inferred ES5 class instantiations?: Map; // Instantiations of generic type alias (undefined if non-generic) mapper?: TypeMapper; // Type mapper for instantiation alias @@ -2909,8 +2908,6 @@ typeParameters: TypeParameter[]; // Type parameters (undefined if non-generic) outerTypeParameters: TypeParameter[]; // Outer type parameters (undefined if none) localTypeParameters: TypeParameter[]; // Local type parameters (undefined if none) - /* @internal */ - minTypeArgumentCount: number; thisType: TypeParameter; // The "this" type (undefined if none) /* @internal */ resolvedBaseConstructorType?: Type; // Resolved base constructor type of class @@ -3063,8 +3060,6 @@ export interface Signature { declaration: SignatureDeclaration; // Originating declaration typeParameters: TypeParameter[]; // Type parameters (undefined if non-generic) - /* @internal */ - minTypeArgumentCount: number; // Number of non-optional type parameters parameters: Symbol[]; // Parameters /* @internal */ thisParameter?: Symbol; // symbol of this-type parameter From 5bb2fe03eabe31af76018d9ef68124c01d540aae Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 3 Feb 2017 16:34:42 -0800 Subject: [PATCH 17/18] Simplify checkTypeParameterListsIdentical --- src/compiler/checker.ts | 149 +++++++----------- src/compiler/types.ts | 1 + ...nstructSignaturesWithOverloads2.errors.txt | 5 +- ...acesWithDuplicateTypeParameters.errors.txt | 5 +- ...GenericInterfaceWithTheSameName.errors.txt | 11 +- .../genericDefaultsErrors.errors.txt | 8 +- ...terfaceWithMultipleDeclarations.errors.txt | 11 +- .../multipleNumericIndexers.errors.txt | 5 +- .../nonIdenticalTypeConstraints.errors.txt | 11 +- ...cesDifferingByTypeParameterName.errors.txt | 17 +- ...esDifferingByTypeParameterName2.errors.txt | 11 +- ...erfacesWithDifferentConstraints.errors.txt | 11 +- ...ithTheSameNameButDifferentArity.errors.txt | 11 +- 13 files changed, 149 insertions(+), 107 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 8f847daa6794b..e1db046d0d0f0 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -376,7 +376,7 @@ namespace ts { Type, ResolvedBaseConstructorType, DeclaredType, - ResolvedReturnType, + ResolvedReturnType } const builtinGlobals = createMap(); @@ -18549,115 +18549,67 @@ namespace ts { } /** Check that type parameter lists are identical across multiple declarations */ - function checkTypeParameterListsIdentical(node: ClassLikeDeclaration | InterfaceDeclaration, symbol: Symbol) { + function checkTypeParameterListsIdentical(symbol: Symbol) { if (symbol.declarations.length === 1) { return; } - // Resolve the type parameters and minimum type argument count for all declarations - resolveTypeParametersOfClassOrInterface(symbol); + const links = getSymbolLinks(symbol); + if (!links.typeParametersChecked) { + links.typeParametersChecked = true; + const type = getDeclaredTypeOfSymbol(symbol); + const declarations = getClassOrInterfaceDeclarationsOfSymbol(symbol); + if (!areTypeParametersIdentical(declarations, type.localTypeParameters)) { + // Report an error on every conflicting declaration. + const name = symbolToString(symbol); + for (const declaration of declarations) { + error(declaration.name, Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, name); + } + } + } + } - const typeParameters = getSymbolLinks(symbol).typeParameters; + function areTypeParametersIdentical(declarations: (ClassDeclaration | InterfaceDeclaration)[], typeParameters: TypeParameter[]) { const maxTypeArgumentCount = length(typeParameters); const minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); - const numTypeParameters = length(node.typeParameters); - - // If this declaration has too few or too many type parameters, we report an error - if (numTypeParameters < minTypeArgumentCount || numTypeParameters > maxTypeArgumentCount) { - error(node.name, Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, node.name.text); - return; - } - - for (let i = 0; i < numTypeParameters; i++) { - const source = node.typeParameters[i]; - const target = typeParameters[i]; - // If the type parameter node does not have the same name as the resolved type - // parameter at this position, we report an error. - if (source.name.text !== target.symbol.name) { - error(node.name, Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, node.name.text); - return; + for (const declaration of declarations) { + // If this declaration has too few or too many type parameters, we report an error + const numTypeParameters = length(declaration.typeParameters); + if (numTypeParameters < minTypeArgumentCount || numTypeParameters > maxTypeArgumentCount) { + return false; } - // If the type parameter node does not have an identical constraint as the resolved - // type parameter at this position, we report an error. - const sourceConstraint = source.constraint && getTypeFromTypeNode(source.constraint); - const targetConstraint = getConstraintFromTypeParameter(target); - if ((sourceConstraint || targetConstraint) && - (!sourceConstraint || !targetConstraint || !isTypeIdenticalTo(sourceConstraint, targetConstraint))) { - error(node.name, Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, node.name.text); - return; - } + for (let i = 0; i < numTypeParameters; i++) { + const source = declaration.typeParameters[i]; + const target = typeParameters[i]; - // If the type parameter node has a default and it is not identical to the default - // for the type parameter at this position, we report an error. - const sourceDefault = source.default && getTypeFromTypeNode(source.default); - const targetDefault = getDefaultFromTypeParameter(target); - if (sourceDefault && targetDefault && !isTypeIdenticalTo(sourceDefault, targetDefault)) { - error(node.name, Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, node.name.text); - return; - } - } - } + // If the type parameter node does not have the same as the resolved type + // parameter at this position, we report an error. + if (source.name.text !== target.symbol.name) { + return false; + } - function resolveTypeParametersOfClassOrInterface(symbol: Symbol) { - const links = getSymbolLinks(symbol); - if (!links.typeParameters) { - let typeParameters: TypeParameter[] | undefined; - let minTypeArgumentCount = -1; - let maxTypeArgumentCount = -1; - for (const declaration of symbol.declarations) { - if (declaration.kind === SyntaxKind.ClassDeclaration || declaration.kind === SyntaxKind.InterfaceDeclaration) { - const typeParameterNodes = (declaration).typeParameters; - const numTypeParameters = length(typeParameterNodes); - if (maxTypeArgumentCount === -1) { - // For the first declaration, establish the initial maximum and - // minimum type argument counts. These only change when we - // encounter default type arguments. - maxTypeArgumentCount = numTypeParameters; - minTypeArgumentCount = numTypeParameters; - } - - if (typeParameterNodes) { - if (!typeParameters) { - typeParameters = []; - } + // If the type parameter node does not have an identical constraint as the resolved + // type parameter at this position, we report an error. + const sourceConstraint = source.constraint && getTypeFromTypeNode(source.constraint); + const targetConstraint = getConstraintFromTypeParameter(target); + if ((sourceConstraint || targetConstraint) && + (!sourceConstraint || !targetConstraint || !isTypeIdenticalTo(sourceConstraint, targetConstraint))) { + return false; + } - for (let i = 0; i < typeParameterNodes.length; i++) { - if (typeParameterNodes[i].default) { - // When we encounter a type parameter with a default, establish - // new minimum and maximum type arguments if necessary. - if (minTypeArgumentCount > i) { - minTypeArgumentCount = i; - } - if (maxTypeArgumentCount < i + 1) { - maxTypeArgumentCount = i + 1; - } - } - if (typeParameters.length <= i) { - // When we encounter a new type parameter at this position, - // get the declared type for the type parameter. If another - // declaration attempts to establish a type parameter with a - // different name or constraint than the first one we find, - // we will report an error when checking the type parameters. - typeParameters[i] = getDeclaredTypeOfTypeParameter(getSymbolOfNode(typeParameterNodes[i])); - } - } - } + // If the type parameter node has a default and it is not identical to the default + // for the type parameter at this position, we report an error. + const sourceDefault = source.default && getTypeFromTypeNode(source.default); + const targetDefault = getDefaultFromTypeParameter(target); + if (sourceDefault && targetDefault && !isTypeIdenticalTo(sourceDefault, targetDefault)) { + return false; } } - if (maxTypeArgumentCount === -1) { - maxTypeArgumentCount = 0; - } - if (minTypeArgumentCount === -1) { - minTypeArgumentCount = maxTypeArgumentCount; - } - if (typeParameters && typeParameters.length > maxTypeArgumentCount) { - // Trim the type parameters to the maximum length - typeParameters.length = maxTypeArgumentCount; - } - links.typeParameters = typeParameters || emptyArray; } + + return true; } function checkClassExpression(node: ClassExpression): Type { @@ -18697,7 +18649,7 @@ namespace ts { const type = getDeclaredTypeOfSymbol(symbol); const typeWithThis = getTypeWithThisArgument(type); const staticType = getTypeOfSymbol(symbol); - checkTypeParameterListsIdentical(node, symbol); + checkTypeParameterListsIdentical(symbol); checkClassForDuplicateDeclarations(node); // Only check for reserved static identifiers on non-ambient context. @@ -18805,6 +18757,11 @@ namespace ts { return forEach(symbol.declarations, d => isClassLike(d) ? d : undefined); } + function getClassOrInterfaceDeclarationsOfSymbol(symbol: Symbol) { + return filter(symbol.declarations, (d: Declaration): d is ClassDeclaration | InterfaceDeclaration => + d.kind === SyntaxKind.ClassDeclaration || d.kind === SyntaxKind.InterfaceDeclaration); + } + function checkKindsOfPropertyMemberOverrides(type: InterfaceType, baseType: BaseType): void { // TypeScript 1.0 spec (April 2014): 8.2.3 @@ -18952,7 +18909,7 @@ namespace ts { checkExportsOnMergedDeclarations(node); const symbol = getSymbolOfNode(node); - checkTypeParameterListsIdentical(node, symbol); + checkTypeParameterListsIdentical(symbol); // Only check this symbol once const firstInterfaceDecl = getDeclarationOfKind(symbol, SyntaxKind.InterfaceDeclaration); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index b416f26324f49..8010cc7dcb01f 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2725,6 +2725,7 @@ isDiscriminantProperty?: boolean; // True if discriminant synthetic property resolvedExports?: SymbolTable; // Resolved exports of module exportsChecked?: boolean; // True if exports of external module have been checked + typeParametersChecked?: boolean; // True if type parameters of merged class and interface declarations have been checked. isDeclarationWithCollidingName?: boolean; // True if symbol is block scoped redeclaration bindingElement?: BindingElement; // Binding element associated with property symbol exportsSomeValue?: boolean; // True if module exports some value (not just types) diff --git a/tests/baselines/reference/constructSignaturesWithOverloads2.errors.txt b/tests/baselines/reference/constructSignaturesWithOverloads2.errors.txt index 617f7b1502f64..35b130f7d6ccb 100644 --- a/tests/baselines/reference/constructSignaturesWithOverloads2.errors.txt +++ b/tests/baselines/reference/constructSignaturesWithOverloads2.errors.txt @@ -1,7 +1,8 @@ +tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSignaturesWithOverloads2.ts(27,11): error TS2428: All declarations of 'I' must have identical type parameters. tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSignaturesWithOverloads2.ts(32,11): error TS2428: All declarations of 'I' must have identical type parameters. -==== tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSignaturesWithOverloads2.ts (1 errors) ==== +==== tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSignaturesWithOverloads2.ts (2 errors) ==== // No errors expected for basic overloads of construct signatures with merged declarations // clodules @@ -29,6 +30,8 @@ tests/cases/conformance/types/objectTypeLiteral/constructSignatures/constructSig // merged interfaces interface I { + ~ +!!! error TS2428: All declarations of 'I' must have identical type parameters. new (x: number, y?: string): C; new (x: number, y: string): C; } diff --git a/tests/baselines/reference/extendedInterfacesWithDuplicateTypeParameters.errors.txt b/tests/baselines/reference/extendedInterfacesWithDuplicateTypeParameters.errors.txt index 7b47fee05afda..942ead52be39f 100644 --- a/tests/baselines/reference/extendedInterfacesWithDuplicateTypeParameters.errors.txt +++ b/tests/baselines/reference/extendedInterfacesWithDuplicateTypeParameters.errors.txt @@ -1,9 +1,10 @@ tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts(1,42): error TS2300: Duplicate identifier 'A'. +tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts(5,11): error TS2428: All declarations of 'InterfaceWithSomeTypars' must have identical type parameters. tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts(9,11): error TS2428: All declarations of 'InterfaceWithSomeTypars' must have identical type parameters. tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts(9,38): error TS2300: Duplicate identifier 'C'. -==== tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts (3 errors) ==== +==== tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts (4 errors) ==== interface InterfaceWithMultipleTypars { // should error ~ !!! error TS2300: Duplicate identifier 'A'. @@ -11,6 +12,8 @@ tests/cases/compiler/extendedInterfacesWithDuplicateTypeParameters.ts(9,38): err } interface InterfaceWithSomeTypars { // should not error + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2428: All declarations of 'InterfaceWithSomeTypars' must have identical type parameters. bar(): void; } diff --git a/tests/baselines/reference/genericAndNonGenericInterfaceWithTheSameName.errors.txt b/tests/baselines/reference/genericAndNonGenericInterfaceWithTheSameName.errors.txt index 8d9ebb8d276a5..963613b9c2dd2 100644 --- a/tests/baselines/reference/genericAndNonGenericInterfaceWithTheSameName.errors.txt +++ b/tests/baselines/reference/genericAndNonGenericInterfaceWithTheSameName.errors.txt @@ -1,12 +1,17 @@ +tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(3,11): error TS2428: All declarations of 'A' must have identical type parameters. tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(7,11): error TS2428: All declarations of 'A' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(12,15): error TS2428: All declarations of 'A' must have identical type parameters. tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(16,15): error TS2428: All declarations of 'A' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(34,22): error TS2428: All declarations of 'A' must have identical type parameters. tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts(40,22): error TS2428: All declarations of 'A' must have identical type parameters. -==== tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts (3 errors) ==== +==== tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterfaceWithTheSameName.ts (6 errors) ==== // generic and non-generic interfaces with the same name do not merge interface A { + ~ +!!! error TS2428: All declarations of 'A' must have identical type parameters. foo: string; } @@ -18,6 +23,8 @@ tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterf module M { interface A { + ~ +!!! error TS2428: All declarations of 'A' must have identical type parameters. bar: T; } @@ -42,6 +49,8 @@ tests/cases/conformance/interfaces/declarationMerging/genericAndNonGenericInterf module M3 { export interface A { + ~ +!!! error TS2428: All declarations of 'A' must have identical type parameters. foo: string; } } diff --git a/tests/baselines/reference/genericDefaultsErrors.errors.txt b/tests/baselines/reference/genericDefaultsErrors.errors.txt index 0347c547e084d..46a43136b2b56 100644 --- a/tests/baselines/reference/genericDefaultsErrors.errors.txt +++ b/tests/baselines/reference/genericDefaultsErrors.errors.txt @@ -6,7 +6,9 @@ tests/cases/compiler/genericDefaultsErrors.ts(7,39): error TS2344: Type 'number' tests/cases/compiler/genericDefaultsErrors.ts(11,1): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/compiler/genericDefaultsErrors.ts(14,1): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/compiler/genericDefaultsErrors.ts(18,13): error TS2345: Argument of type '"a"' is not assignable to parameter of type 'number'. +tests/cases/compiler/genericDefaultsErrors.ts(20,11): error TS2428: All declarations of 'i00' must have identical type parameters. tests/cases/compiler/genericDefaultsErrors.ts(21,11): error TS2428: All declarations of 'i00' must have identical type parameters. +tests/cases/compiler/genericDefaultsErrors.ts(23,11): error TS2428: All declarations of 'i01' must have identical type parameters. tests/cases/compiler/genericDefaultsErrors.ts(24,11): error TS2428: All declarations of 'i01' must have identical type parameters. tests/cases/compiler/genericDefaultsErrors.ts(26,27): error TS2705: Required type parameters may not follow optional type parameters. tests/cases/compiler/genericDefaultsErrors.ts(27,34): error TS2344: Type 'number' does not satisfy the constraint 'string'. @@ -21,7 +23,7 @@ tests/cases/compiler/genericDefaultsErrors.ts(39,20): error TS2304: Cannot find tests/cases/compiler/genericDefaultsErrors.ts(39,20): error TS4033: Property 'x' of exported interface has or is using private name 'T'. -==== tests/cases/compiler/genericDefaultsErrors.ts (19 errors) ==== +==== tests/cases/compiler/genericDefaultsErrors.ts (21 errors) ==== declare const x: any; @@ -57,11 +59,15 @@ tests/cases/compiler/genericDefaultsErrors.ts(39,20): error TS4033: Property 'x' !!! error TS2345: Argument of type '"a"' is not assignable to parameter of type 'number'. interface i00 { } // ok + ~~~ +!!! error TS2428: All declarations of 'i00' must have identical type parameters. interface i00 { } // error ~~~ !!! error TS2428: All declarations of 'i00' must have identical type parameters. interface i01 { } // ok + ~~~ +!!! error TS2428: All declarations of 'i01' must have identical type parameters. interface i01 { } // error ~~~ !!! error TS2428: All declarations of 'i01' must have identical type parameters. diff --git a/tests/baselines/reference/interfaceWithMultipleDeclarations.errors.txt b/tests/baselines/reference/interfaceWithMultipleDeclarations.errors.txt index 79d8b4a509a90..cabc329df7e4b 100644 --- a/tests/baselines/reference/interfaceWithMultipleDeclarations.errors.txt +++ b/tests/baselines/reference/interfaceWithMultipleDeclarations.errors.txt @@ -1,18 +1,23 @@ +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(1,11): error TS2428: All declarations of 'I1' must have identical type parameters. tests/cases/compiler/interfaceWithMultipleDeclarations.ts(3,11): error TS2428: All declarations of 'I1' must have identical type parameters. tests/cases/compiler/interfaceWithMultipleDeclarations.ts(5,11): error TS2428: All declarations of 'I1' must have identical type parameters. tests/cases/compiler/interfaceWithMultipleDeclarations.ts(7,11): error TS2428: All declarations of 'I1' must have identical type parameters. tests/cases/compiler/interfaceWithMultipleDeclarations.ts(9,11): error TS2428: All declarations of 'I1' must have identical type parameters. tests/cases/compiler/interfaceWithMultipleDeclarations.ts(11,11): error TS2428: All declarations of 'I1' must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(14,11): error TS2428: All declarations of 'I2' must have identical type parameters. tests/cases/compiler/interfaceWithMultipleDeclarations.ts(16,11): error TS2428: All declarations of 'I2' must have identical type parameters. tests/cases/compiler/interfaceWithMultipleDeclarations.ts(18,11): error TS2428: All declarations of 'I2' must have identical type parameters. tests/cases/compiler/interfaceWithMultipleDeclarations.ts(20,11): error TS2428: All declarations of 'I2' must have identical type parameters. tests/cases/compiler/interfaceWithMultipleDeclarations.ts(22,11): error TS2428: All declarations of 'I2' must have identical type parameters. tests/cases/compiler/interfaceWithMultipleDeclarations.ts(24,11): error TS2428: All declarations of 'I2' must have identical type parameters. +tests/cases/compiler/interfaceWithMultipleDeclarations.ts(27,11): error TS2428: All declarations of 'I3' must have identical type parameters. tests/cases/compiler/interfaceWithMultipleDeclarations.ts(29,11): error TS2428: All declarations of 'I3' must have identical type parameters. -==== tests/cases/compiler/interfaceWithMultipleDeclarations.ts (11 errors) ==== +==== tests/cases/compiler/interfaceWithMultipleDeclarations.ts (14 errors) ==== interface I1 { + ~~ +!!! error TS2428: All declarations of 'I1' must have identical type parameters. } interface I1 { // Name mismatch ~~ @@ -36,6 +41,8 @@ tests/cases/compiler/interfaceWithMultipleDeclarations.ts(29,11): error TS2428: } interface I2 { + ~~ +!!! error TS2428: All declarations of 'I2' must have identical type parameters. } interface I2 string> { // constraint mismatch ~~ @@ -59,6 +66,8 @@ tests/cases/compiler/interfaceWithMultipleDeclarations.ts(29,11): error TS2428: } interface I3 { + ~~ +!!! error TS2428: All declarations of 'I3' must have identical type parameters. } interface I3 { // length mismatch ~~ diff --git a/tests/baselines/reference/multipleNumericIndexers.errors.txt b/tests/baselines/reference/multipleNumericIndexers.errors.txt index 82fc444ac650b..e3eaa94fa5281 100644 --- a/tests/baselines/reference/multipleNumericIndexers.errors.txt +++ b/tests/baselines/reference/multipleNumericIndexers.errors.txt @@ -1,4 +1,5 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(5,5): error TS2375: Duplicate number index signature. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(8,11): error TS2428: All declarations of 'I' must have identical type parameters. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(10,5): error TS2375: Duplicate number index signature. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(15,5): error TS2375: Duplicate number index signature. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(20,5): error TS2375: Duplicate number index signature. @@ -8,7 +9,7 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericI tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts(30,5): error TS2375: Duplicate number index signature. -==== tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts (8 errors) ==== +==== tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts (9 errors) ==== // Multiple indexers of the same type are an error class C { @@ -19,6 +20,8 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericI } interface I { + ~ +!!! error TS2428: All declarations of 'I' must have identical type parameters. [x: number]: string; [x: number]: string; ~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/nonIdenticalTypeConstraints.errors.txt b/tests/baselines/reference/nonIdenticalTypeConstraints.errors.txt index 627b38579a2d7..6070c97cf289b 100644 --- a/tests/baselines/reference/nonIdenticalTypeConstraints.errors.txt +++ b/tests/baselines/reference/nonIdenticalTypeConstraints.errors.txt @@ -1,9 +1,12 @@ +tests/cases/compiler/nonIdenticalTypeConstraints.ts(7,7): error TS2428: All declarations of 'Foo' must have identical type parameters. tests/cases/compiler/nonIdenticalTypeConstraints.ts(10,11): error TS2428: All declarations of 'Foo' must have identical type parameters. +tests/cases/compiler/nonIdenticalTypeConstraints.ts(13,11): error TS2428: All declarations of 'Qux' must have identical type parameters. tests/cases/compiler/nonIdenticalTypeConstraints.ts(16,7): error TS2428: All declarations of 'Qux' must have identical type parameters. +tests/cases/compiler/nonIdenticalTypeConstraints.ts(33,7): error TS2428: All declarations of 'Quux' must have identical type parameters. tests/cases/compiler/nonIdenticalTypeConstraints.ts(36,11): error TS2428: All declarations of 'Quux' must have identical type parameters. -==== tests/cases/compiler/nonIdenticalTypeConstraints.ts (3 errors) ==== +==== tests/cases/compiler/nonIdenticalTypeConstraints.ts (6 errors) ==== class Different { a: number; b: string; @@ -11,6 +14,8 @@ tests/cases/compiler/nonIdenticalTypeConstraints.ts(36,11): error TS2428: All de } class Foo { + ~~~ +!!! error TS2428: All declarations of 'Foo' must have identical type parameters. n: T; } interface Foo { @@ -19,6 +24,8 @@ tests/cases/compiler/nonIdenticalTypeConstraints.ts(36,11): error TS2428: All de y: T; } interface Qux { + ~~~ +!!! error TS2428: All declarations of 'Qux' must have identical type parameters. y: T; } class Qux { @@ -41,6 +48,8 @@ tests/cases/compiler/nonIdenticalTypeConstraints.ts(36,11): error TS2428: All de } class Quux { + ~~~~ +!!! error TS2428: All declarations of 'Quux' must have identical type parameters. n: T; } interface Quux { diff --git a/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName.errors.txt b/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName.errors.txt index 6c0f562ac64d6..09d181ed959f7 100644 --- a/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName.errors.txt +++ b/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName.errors.txt @@ -1,14 +1,21 @@ +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(3,11): error TS2428: All declarations of 'A' must have identical type parameters. tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(7,11): error TS2428: All declarations of 'A' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(11,11): error TS2428: All declarations of 'B' must have identical type parameters. tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(15,11): error TS2428: All declarations of 'B' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(20,15): error TS2428: All declarations of 'A' must have identical type parameters. tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(24,15): error TS2428: All declarations of 'A' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(28,15): error TS2428: All declarations of 'B' must have identical type parameters. tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(32,15): error TS2428: All declarations of 'B' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(50,22): error TS2428: All declarations of 'B' must have identical type parameters. tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts(56,22): error TS2428: All declarations of 'B' must have identical type parameters. -==== tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts (5 errors) ==== +==== tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName.ts (10 errors) ==== // type parameter names are relevant when choosing whether to merge interface declarations interface A { + ~ +!!! error TS2428: All declarations of 'A' must have identical type parameters. x: T; } @@ -19,6 +26,8 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer } interface B { + ~ +!!! error TS2428: All declarations of 'B' must have identical type parameters. x: U; } @@ -30,6 +39,8 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer module M { interface A { + ~ +!!! error TS2428: All declarations of 'A' must have identical type parameters. x: T; } @@ -40,6 +51,8 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer } interface B { + ~ +!!! error TS2428: All declarations of 'B' must have identical type parameters. x: U; } @@ -64,6 +77,8 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer module M3 { export interface B { + ~ +!!! error TS2428: All declarations of 'B' must have identical type parameters. x: U; } } diff --git a/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName2.errors.txt b/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName2.errors.txt index f2a0063c23018..863f77cad1b53 100644 --- a/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName2.errors.txt +++ b/tests/baselines/reference/twoGenericInterfacesDifferingByTypeParameterName2.errors.txt @@ -1,13 +1,18 @@ +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts(3,11): error TS2428: All declarations of 'B' must have identical type parameters. tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts(7,11): error TS2428: All declarations of 'B' must have identical type parameters. tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts(8,8): error TS2304: Cannot find name 'V'. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts(12,15): error TS2428: All declarations of 'B' must have identical type parameters. tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts(16,15): error TS2428: All declarations of 'B' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts(34,22): error TS2428: All declarations of 'B' must have identical type parameters. tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts(40,22): error TS2428: All declarations of 'B' must have identical type parameters. -==== tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts (4 errors) ==== +==== tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDifferingByTypeParameterName2.ts (7 errors) ==== // type parameter names are relevant when choosing whether to merge interface declarations interface B { + ~ +!!! error TS2428: All declarations of 'B' must have identical type parameters. x: U; } @@ -21,6 +26,8 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer module M { interface B { + ~ +!!! error TS2428: All declarations of 'B' must have identical type parameters. x: U; } @@ -45,6 +52,8 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesDiffer module M3 { export interface B { + ~ +!!! error TS2428: All declarations of 'B' must have identical type parameters. x: U; } } diff --git a/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.errors.txt b/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.errors.txt index 4b2455773f58c..71d6f73d864ad 100644 --- a/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.errors.txt +++ b/tests/baselines/reference/twoGenericInterfacesWithDifferentConstraints.errors.txt @@ -1,10 +1,15 @@ +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts(1,11): error TS2428: All declarations of 'A' must have identical type parameters. tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts(5,11): error TS2428: All declarations of 'A' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts(10,15): error TS2428: All declarations of 'B' must have identical type parameters. tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts(14,15): error TS2428: All declarations of 'B' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts(32,22): error TS2428: All declarations of 'A' must have identical type parameters. tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts(38,22): error TS2428: All declarations of 'A' must have identical type parameters. -==== tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts (3 errors) ==== +==== tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts (6 errors) ==== interface A { + ~ +!!! error TS2428: All declarations of 'A' must have identical type parameters. x: T; } @@ -16,6 +21,8 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDi module M { interface B> { + ~ +!!! error TS2428: All declarations of 'B' must have identical type parameters. x: T; } @@ -40,6 +47,8 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDi module M3 { export interface A { + ~ +!!! error TS2428: All declarations of 'A' must have identical type parameters. x: T; } } diff --git a/tests/baselines/reference/twoGenericInterfacesWithTheSameNameButDifferentArity.errors.txt b/tests/baselines/reference/twoGenericInterfacesWithTheSameNameButDifferentArity.errors.txt index de4c4d8e1c33e..5f1b401e2a95f 100644 --- a/tests/baselines/reference/twoGenericInterfacesWithTheSameNameButDifferentArity.errors.txt +++ b/tests/baselines/reference/twoGenericInterfacesWithTheSameNameButDifferentArity.errors.txt @@ -1,10 +1,15 @@ +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTheSameNameButDifferentArity.ts(1,11): error TS2428: All declarations of 'A' must have identical type parameters. tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTheSameNameButDifferentArity.ts(5,11): error TS2428: All declarations of 'A' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTheSameNameButDifferentArity.ts(10,15): error TS2428: All declarations of 'A' must have identical type parameters. tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTheSameNameButDifferentArity.ts(14,15): error TS2428: All declarations of 'A' must have identical type parameters. +tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTheSameNameButDifferentArity.ts(32,22): error TS2428: All declarations of 'A' must have identical type parameters. tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTheSameNameButDifferentArity.ts(38,22): error TS2428: All declarations of 'A' must have identical type parameters. -==== tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTheSameNameButDifferentArity.ts (3 errors) ==== +==== tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTheSameNameButDifferentArity.ts (6 errors) ==== interface A { + ~ +!!! error TS2428: All declarations of 'A' must have identical type parameters. x: T; } @@ -16,6 +21,8 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTh module M { interface A { + ~ +!!! error TS2428: All declarations of 'A' must have identical type parameters. x: T; } @@ -40,6 +47,8 @@ tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithTh module M3 { export interface A { + ~ +!!! error TS2428: All declarations of 'A' must have identical type parameters. x: T; } } From 96181c023b98e6feede6e8b7477abb3709215051 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 3 Feb 2017 16:36:48 -0800 Subject: [PATCH 18/18] Shortcut for class/namespace merge --- src/compiler/checker.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e1db046d0d0f0..e17144c7878ea 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -18557,8 +18557,12 @@ namespace ts { const links = getSymbolLinks(symbol); if (!links.typeParametersChecked) { links.typeParametersChecked = true; - const type = getDeclaredTypeOfSymbol(symbol); const declarations = getClassOrInterfaceDeclarationsOfSymbol(symbol); + if (declarations.length <= 1) { + return; + } + + const type = getDeclaredTypeOfSymbol(symbol); if (!areTypeParametersIdentical(declarations, type.localTypeParameters)) { // Report an error on every conflicting declaration. const name = symbolToString(symbol);