@@ -2209,7 +2209,7 @@ namespace ts {
22092209
22102210 /**
22112211 * Push an entry on the type resolution stack. If an entry with the given target and the given property name
2212- * is already on the stack, and no entries in between already have a type, then a circularity has occurred.
2212+ * is already on the stack, and no entries in between already have a type, then a circularity has occurred.
22132213 * In this case, the result values of the existing entry and all entries pushed after it are changed to false,
22142214 * and the value false is returned. Otherwise, the new entry is just pushed onto the stack, and true is returned.
22152215 * In order to see if the same query has already been done before, the target object and the propertyName both
@@ -5243,7 +5243,7 @@ namespace ts {
52435243 // Only want to compare the construct signatures for abstractness guarantees.
52445244
52455245 // Because the "abstractness" of a class is the same across all construct signatures
5246- // (internally we are checking the corresponding declaration), it is enough to perform
5246+ // (internally we are checking the corresponding declaration), it is enough to perform
52475247 // the check and report an error once over all pairs of source and target construct signatures.
52485248 //
52495249 // sourceSig and targetSig are (possibly) undefined.
@@ -6642,7 +6642,7 @@ namespace ts {
66426642 let needToCaptureLexicalThis = false;
66436643
66446644 if (!isCallExpression) {
6645- // adjust the container reference in case if super is used inside arrow functions with arbitrary deep nesting
6645+ // adjust the container reference in case if super is used inside arrow functions with arbitrary deep nesting
66466646 while (container && container.kind === SyntaxKind.ArrowFunction) {
66476647 container = getSuperContainer(container, /*includeFunctions*/ true);
66486648 needToCaptureLexicalThis = languageVersion < ScriptTarget.ES6;
@@ -6652,7 +6652,7 @@ namespace ts {
66526652 let canUseSuperExpression = isLegalUsageOfSuperExpression(container);
66536653 let nodeCheckFlag: NodeCheckFlags = 0;
66546654
6655- // always set NodeCheckFlags for 'super' expression node
6655+ // always set NodeCheckFlags for 'super' expression node
66566656 if (canUseSuperExpression) {
66576657 if ((container.flags & NodeFlags.Static) || isCallExpression) {
66586658 nodeCheckFlag = NodeCheckFlags.SuperStatic;
@@ -8568,7 +8568,7 @@ namespace ts {
85688568 // A method or accessor declaration decorator will have two or three arguments (see
85698569 // `PropertyDecorator` and `MethodDecorator` in core.d.ts)
85708570
8571- // If we are emitting decorators for ES3, we will only pass two arguments.
8571+ // If we are emitting decorators for ES3, we will only pass two arguments.
85728572 if (languageVersion === ScriptTarget.ES3) {
85738573 return 2;
85748574 }
@@ -11306,7 +11306,8 @@ namespace ts {
1130611306 }
1130711307
1130811308 function checkNonThenableType(type: Type, location?: Node, message?: DiagnosticMessage) {
11309- if (!(type.flags & TypeFlags.Any) && isTypeAssignableTo(type, getGlobalThenableType())) {
11309+ type = getWidenedType(type);
11310+ if (!isTypeAny(type) && isTypeAssignableTo(type, getGlobalThenableType())) {
1131011311 if (location) {
1131111312 if (!message) {
1131211313 message = Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member;
@@ -12544,7 +12545,12 @@ namespace ts {
1254412545 if (isAsyncFunctionLike(func)) {
1254512546 let promisedType = getPromisedType(returnType);
1254612547 let awaitedType = checkAwaitedType(exprType, node.expression, Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member);
12547- checkTypeAssignableTo(awaitedType, promisedType, node.expression);
12548+ if (promisedType) {
12549+ // If the function has a return type, but promisedType is
12550+ // undefined, an error will be reported in checkAsyncFunctionReturnType
12551+ // so we don't need to report one here.
12552+ checkTypeAssignableTo(awaitedType, promisedType, node.expression);
12553+ }
1254812554 }
1254912555 else {
1255012556 checkTypeAssignableTo(exprType, returnType, node.expression);
@@ -13154,13 +13160,13 @@ namespace ts {
1315413160 autoValue = computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient);
1315513161 }
1315613162 else if (ambient && !enumIsConst) {
13157- // In ambient enum declarations that specify no const modifier, enum member declarations
13163+ // In ambient enum declarations that specify no const modifier, enum member declarations
1315813164 // that omit a value are considered computed members (as opposed to having auto-incremented values assigned).
1315913165 autoValue = undefined;
1316013166 }
1316113167 else if (previousEnumMemberIsNonConstant) {
13162- // If the member declaration specifies no value, the member is considered a constant enum member.
13163- // If the member is the first member in the enum declaration, it is assigned the value zero.
13168+ // If the member declaration specifies no value, the member is considered a constant enum member.
13169+ // If the member is the first member in the enum declaration, it is assigned the value zero.
1316413170 // Otherwise, it is assigned the value of the immediately preceding member plus one,
1316513171 // and an error occurs if the immediately preceding member is not a constant enum member
1316613172 error(member.name, Diagnostics.Enum_member_must_have_initializer);
@@ -14100,7 +14106,7 @@ namespace ts {
1410014106 case SyntaxKind.ClassDeclaration:
1410114107 case SyntaxKind.InterfaceDeclaration:
1410214108 // If we didn't come from static member of class or interface,
14103- // add the type parameters into the symbol table
14109+ // add the type parameters into the symbol table
1410414110 // (type parameters of classDeclaration/classExpression and interface are in member property of the symbol.
1410514111 // Note: that the memberFlags come from previous iteration.
1410614112 if (!(memberFlags & NodeFlags.Static)) {
@@ -14764,31 +14770,6 @@ namespace ts {
1476414770 return symbol && getExportSymbolOfValueSymbolIfExported(symbol).valueDeclaration;
1476514771 }
1476614772
14767- function getBlockScopedVariableId(n: Identifier): number {
14768- Debug.assert(!nodeIsSynthesized(n));
14769-
14770- let isVariableDeclarationOrBindingElement =
14771- n.parent.kind === SyntaxKind.BindingElement || (n.parent.kind === SyntaxKind.VariableDeclaration && (<VariableDeclaration>n.parent).name === n);
14772-
14773- let symbol =
14774- (isVariableDeclarationOrBindingElement ? getSymbolOfNode(n.parent) : undefined) ||
14775- getNodeLinks(n).resolvedSymbol ||
14776- resolveName(n, n.text, SymbolFlags.Value | SymbolFlags.Alias, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined);
14777-
14778- let isLetOrConst =
14779- symbol &&
14780- (symbol.flags & SymbolFlags.BlockScopedVariable) &&
14781- symbol.valueDeclaration.parent.kind !== SyntaxKind.CatchClause;
14782-
14783- if (isLetOrConst) {
14784- // side-effect of calling this method:
14785- // assign id to symbol if it was not yet set
14786- getSymbolLinks(symbol);
14787- return symbol.id;
14788- }
14789- return undefined;
14790- }
14791-
1479214773 function instantiateSingleCallFunctionType(functionType: Type, typeArguments: Type[]): Type {
1479314774 if (functionType === unknownType) {
1479414775 return unknownType;
@@ -14823,7 +14804,6 @@ namespace ts {
1482314804 isEntityNameVisible,
1482414805 getConstantValue,
1482514806 collectLinkedAliases,
14826- getBlockScopedVariableId,
1482714807 getReferencedValueDeclaration,
1482814808 getTypeReferenceSerializationKind,
1482914809 isOptionalParameter
0 commit comments