@@ -2386,7 +2386,7 @@ namespace ts {
23862386 if (isBindingPattern(declaration.parent)) {
23872387 return getTypeForBindingElement(<BindingElement>declaration);
23882388 }
2389-
2389+
23902390 // Use type from type annotation if one is present
23912391 if (declaration.type) {
23922392 return getTypeFromTypeNode(declaration.type);
@@ -2407,12 +2407,12 @@ namespace ts {
24072407 return type;
24082408 }
24092409 }
2410-
2410+
24112411 // Use the type of the initializer expression if one is present
24122412 if (declaration.initializer) {
24132413 return checkExpressionCached(declaration.initializer);
24142414 }
2415-
2415+
24162416 // If it is a short-hand property assignment, use the type of the identifier
24172417 if (declaration.kind === SyntaxKind.ShorthandPropertyAssignment) {
24182418 return checkIdentifier(<Identifier>declaration.name);
@@ -2507,10 +2507,10 @@ namespace ts {
25072507 // tools see the actual type.
25082508 return declaration.kind !== SyntaxKind.PropertyAssignment ? getWidenedType(type) : type;
25092509 }
2510-
2510+
25112511 // Rest parameters default to type any[], other parameters default to type any
25122512 type = declaration.dotDotDotToken ? anyArrayType : anyType;
2513-
2513+
25142514 // Report implicit any errors unless this is a private property within an ambient declaration
25152515 if (reportErrors && compilerOptions.noImplicitAny) {
25162516 let root = getRootDeclaration(declaration);
@@ -4501,7 +4501,7 @@ namespace ts {
45014501 }
45024502 return t;
45034503 };
4504-
4504+
45054505 mapper.context = context;
45064506 return mapper;
45074507 }
@@ -4935,7 +4935,7 @@ namespace ts {
49354935 // We know *exactly* where things went wrong when comparing the types.
49364936 // Use this property as the error node as this will be more helpful in
49374937 // reasoning about what went wrong.
4938- errorNode = prop.valueDeclaration
4938+ errorNode = prop.valueDeclaration;
49394939 reportError(Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1,
49404940 symbolToString(prop),
49414941 typeToString(target));
@@ -5240,7 +5240,7 @@ namespace ts {
52405240
52415241 if (kind === SignatureKind.Construct) {
52425242 // Only want to compare the construct signatures for abstractness guarantees.
5243-
5243+
52445244 // Because the "abstractness" of a class is the same across all construct signatures
52455245 // (internally we are checking the corresponding declaration), it is enough to perform
52465246 // the check and report an error once over all pairs of source and target construct signatures.
@@ -6410,7 +6410,7 @@ namespace ts {
64106410 return getUnionType(assignableConstituents);
64116411 }
64126412 }
6413-
6413+
64146414 if (isTypeAssignableTo(narrowedTypeCandidate, originalType)) {
64156415 // Narrow to the target type if it's assignable to the current type
64166416 return narrowedTypeCandidate;
@@ -6637,46 +6637,46 @@ namespace ts {
66376637 let classType = classDeclaration && <InterfaceType>getDeclaredTypeOfSymbol(getSymbolOfNode(classDeclaration));
66386638 let baseClassType = classType && getBaseTypes(classType)[0];
66396639
6640- let container = getSuperContainer(node, /*includeFunctions*/ true);
6640+ let container = getSuperContainer(node, /*includeFunctions*/ true);
66416641 let needToCaptureLexicalThis = false;
66426642
6643- if (!isCallExpression) {
6643+ if (!isCallExpression) {
66446644 // adjust the container reference in case if super is used inside arrow functions with arbitrary deep nesting
66456645 while (container && container.kind === SyntaxKind.ArrowFunction) {
66466646 container = getSuperContainer(container, /*includeFunctions*/ true);
66476647 needToCaptureLexicalThis = languageVersion < ScriptTarget.ES6;
66486648 }
66496649 }
6650-
6650+
66516651 let canUseSuperExpression = isLegalUsageOfSuperExpression(container);
66526652 let nodeCheckFlag: NodeCheckFlags = 0;
6653-
6653+
66546654 // always set NodeCheckFlags for 'super' expression node
6655- if (canUseSuperExpression) {
6655+ if (canUseSuperExpression) {
66566656 if ((container.flags & NodeFlags.Static) || isCallExpression) {
66576657 nodeCheckFlag = NodeCheckFlags.SuperStatic;
66586658 }
66596659 else {
66606660 nodeCheckFlag = NodeCheckFlags.SuperInstance;
66616661 }
6662-
6662+
66636663 getNodeLinks(node).flags |= nodeCheckFlag;
6664-
6664+
66656665 if (needToCaptureLexicalThis) {
66666666 // call expressions are allowed only in constructors so they should always capture correct 'this'
66676667 // super property access expressions can also appear in arrow functions -
66686668 // in this case they should also use correct lexical this
66696669 captureLexicalThis(node.parent, container);
6670- }
6670+ }
66716671 }
6672-
6672+
66736673 if (!baseClassType) {
66746674 if (!classDeclaration || !getClassExtendsHeritageClauseElement(classDeclaration)) {
66756675 error(node, Diagnostics.super_can_only_be_referenced_in_a_derived_class);
66766676 }
6677- return unknownType;
6677+ return unknownType;
66786678 }
6679-
6679+
66806680 if (!canUseSuperExpression) {
66816681 if (container && container.kind === SyntaxKind.ComputedPropertyName) {
66826682 error(node, Diagnostics.super_cannot_be_referenced_in_a_computed_property_name);
@@ -6687,20 +6687,20 @@ namespace ts {
66876687 else {
66886688 error(node, Diagnostics.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class);
66896689 }
6690-
6690+
66916691 return unknownType;
66926692 }
6693-
6693+
66946694 if (container.kind === SyntaxKind.Constructor && isInConstructorArgumentInitializer(node, container)) {
66956695 // issue custom error message for super property access in constructor arguments (to be aligned with old compiler)
66966696 error(node, Diagnostics.super_cannot_be_referenced_in_constructor_arguments);
66976697 return unknownType;
66986698 }
6699-
6699+
67006700 return nodeCheckFlag === NodeCheckFlags.SuperStatic
67016701 ? getBaseConstructorTypeOfClass(classType)
67026702 : baseClassType;
6703-
6703+
67046704 function isLegalUsageOfSuperExpression(container: Node): boolean {
67056705 if (!container) {
67066706 return false;
@@ -6736,9 +6736,9 @@ namespace ts {
67366736 }
67376737 }
67386738 }
6739-
6739+
67406740 return false;
6741- }
6741+ }
67426742 }
67436743
67446744 // Return contextual type of parameter or undefined if no contextual type is available
@@ -7251,7 +7251,7 @@ namespace ts {
72517251 }
72527252 }
72537253 }
7254- return createArrayType(elementTypes.length ? getUnionType(elementTypes) : undefinedType)
7254+ return createArrayType(elementTypes.length ? getUnionType(elementTypes) : undefinedType);
72557255 }
72567256
72577257 function isNumericName(name: DeclarationName): boolean {
@@ -7522,7 +7522,7 @@ namespace ts {
75227522 // Maybe there's a string indexer?
75237523 let indexerType = getIndexTypeOfType(elementAttributesType, IndexKind.String);
75247524 if (indexerType) {
7525- correspondingPropType = indexerType
7525+ correspondingPropType = indexerType;
75267526 }
75277527 else {
75287528 // If there's no corresponding property with this name, error
@@ -7590,7 +7590,8 @@ namespace ts {
75907590 if (!links.resolvedSymbol) {
75917591 if (isJsxIntrinsicIdentifier(node.tagName)) {
75927592 links.resolvedSymbol = lookupIntrinsicTag(node);
7593- } else {
7593+ }
7594+ else {
75947595 links.resolvedSymbol = lookupClassTag(node);
75957596 }
75967597 }
@@ -8214,9 +8215,9 @@ namespace ts {
82148215 function reorderCandidates(signatures: Signature[], result: Signature[]): void {
82158216 let lastParent: Node;
82168217 let lastSymbol: Symbol;
8217- let cutoffIndex: number = 0;
8218+ let cutoffIndex = 0;
82188219 let index: number;
8219- let specializedIndex: number = -1;
8220+ let specializedIndex = -1;
82208221 let spliceIndex: number;
82218222 Debug.assert(!result.length);
82228223 for (let signature of signatures) {
@@ -10815,7 +10816,7 @@ namespace ts {
1081510816 }
1081610817 if (!superCallStatement) {
1081710818 error(node, Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties);
10818- }
10819+ }
1081910820 else {
1082010821 // In such a required super call, it is a compile-time error for argument expressions to reference this.
1082110822 markThisReferencesAsErrors(superCallStatement.expression);
@@ -11254,15 +11255,15 @@ namespace ts {
1125411255
1125511256 // Spaces for anyting not declared a 'default export'.
1125611257 let nonDefaultExportedDeclarationSpaces = exportedDeclarationSpaces | nonExportedDeclarationSpaces;
11257-
11258+
1125811259 let commonDeclarationSpacesForExportsAndLocals = exportedDeclarationSpaces & nonExportedDeclarationSpaces;
1125911260 let commonDeclarationSpacesForDefaultAndNonDefault = defaultExportedDeclarationSpaces & nonDefaultExportedDeclarationSpaces;
1126011261
1126111262 if (commonDeclarationSpacesForExportsAndLocals || commonDeclarationSpacesForDefaultAndNonDefault) {
1126211263 // declaration spaces for exported and non-exported declarations intersect
1126311264 for (let d of symbol.declarations) {
1126411265 let declarationSpaces = getDeclarationSpaces(d);
11265-
11266+
1126611267 // Only error on the declarations that conributed to the intersecting spaces.
1126711268 if (declarationSpaces & commonDeclarationSpacesForDefaultAndNonDefault) {
1126811269 error(d.name, Diagnostics.Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead, declarationNameToString(d.name));
@@ -12089,7 +12090,7 @@ namespace ts {
1208912090
1209012091 function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node: Node) {
1209112092 // We only disallow modifier on a method declaration if it is a property of object-literal-expression
12092- if (node.modifiers && node.parent.kind === SyntaxKind.ObjectLiteralExpression){
12093+ if (node.modifiers && node.parent.kind === SyntaxKind.ObjectLiteralExpression) {
1209312094 if (isAsyncFunctionLike(node)) {
1209412095 if (node.modifiers.length > 1) {
1209512096 return grammarErrorOnFirstToken(node, Diagnostics.Modifiers_cannot_appear_here);
@@ -13138,7 +13139,7 @@ namespace ts {
1313813139 }
1313913140
1314013141 const previousEnumMemberIsNonConstant = autoValue === undefined;
13141-
13142+
1314213143 let initializer = member.initializer;
1314313144 if (initializer) {
1314413145 autoValue = computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient);
@@ -13177,7 +13178,7 @@ namespace ts {
1317713178 }
1317813179 else if (ambient) {
1317913180 error(initializer, Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression);
13180- }
13181+ }
1318113182 else {
1318213183 // Only here do we need to check that the initializer is assignable to the enum type.
1318313184 checkTypeAssignableTo(checkExpression(initializer), enumType, initializer, /*headMessage*/ undefined);
@@ -13477,7 +13478,7 @@ namespace ts {
1347713478 Debug.assert(node.kind === SyntaxKind.Identifier);
1347813479 return <Identifier>node;
1347913480 }
13480-
13481+
1348113482 function checkExternalImportOrExportDeclaration(node: ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration): boolean {
1348213483 let moduleName = getExternalModuleName(node);
1348313484 if (!nodeIsMissing(moduleName) && moduleName.kind !== SyntaxKind.StringLiteral) {
@@ -14104,11 +14105,11 @@ namespace ts {
1410414105 }
1410514106 break;
1410614107 }
14107-
14108+
1410814109 if (introducesArgumentsExoticObject(location)) {
1410914110 copySymbol(argumentsSymbol, meaning);
1411014111 }
14111-
14112+
1411214113 memberFlags = location.flags;
1411314114 location = location.parent;
1411414115 }
@@ -14580,9 +14581,9 @@ namespace ts {
1458014581 }
1458114582 // const enums and modules that contain only const enums are not considered values from the emit perespective
1458214583 // unless 'preserveConstEnums' option is set to true
14583- return target !== unknownSymbol &&
14584- target &&
14585- target.flags & SymbolFlags.Value &&
14584+ return target !== unknownSymbol &&
14585+ target &&
14586+ target.flags & SymbolFlags.Value &&
1458614587 (compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target));
1458714588 }
1458814589
@@ -14653,7 +14654,7 @@ namespace ts {
1465314654 function isFunctionType(type: Type): boolean {
1465414655 return type.flags & TypeFlags.ObjectType && getSignaturesOfType(type, SignatureKind.Call).length > 0;
1465514656 }
14656-
14657+
1465714658 function getTypeReferenceSerializationKind(typeName: EntityName): TypeReferenceSerializationKind {
1465814659 // Resolve the symbol as a value to ensure the type can be reached at runtime during emit.
1465914660 let valueSymbol = resolveEntityName(typeName, SymbolFlags.Value, /*ignoreErrors*/ true);
@@ -14666,7 +14667,7 @@ namespace ts {
1466614667 let typeSymbol = resolveEntityName(typeName, SymbolFlags.Type, /*ignoreErrors*/ true);
1466714668 // We might not be able to resolve type symbol so use unknown type in that case (eg error case)
1466814669 if (!typeSymbol) {
14669- return TypeReferenceSerializationKind.ObjectType;
14670+ return TypeReferenceSerializationKind.ObjectType;
1467014671 }
1467114672 let type = getDeclaredTypeOfSymbol(typeSymbol);
1467214673 if (type === unknownType) {
0 commit comments