From e8dff5718f3f1935f683f2cc53247d9e61f20234 Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Fri, 26 Jul 2019 19:00:04 +0100 Subject: [PATCH] build: update to TS 3.5 --- package.json | 6 +- .../angular/cli/utilities/package-metadata.ts | 2 +- .../angular_devkit/build_angular/package.json | 23 +- .../build_ng_packagr/package.json | 8 +- .../build_optimizer/package.json | 2 +- .../schematics/tools/fallback-engine-host.ts | 2 +- .../tools/file-system-engine-host-base.ts | 2 +- packages/ngtools/webpack/package.json | 8 +- .../Microsoft/TypeScript/lib/typescript.d.ts | 655 +- .../Microsoft/TypeScript/lib/typescript.js | 20927 ++++++++-------- .../angular/utility/latest-versions.ts | 10 +- .../blank/project-files/package.json.template | 2 +- .../schematics/schematic/files/package.json | 2 +- .../webpack/test-app-weird/package.json | 2 +- .../e2e/assets/webpack/test-app/package.json | 18 +- .../webpack/test-server-app/package.json | 2 +- yarn.lock | 584 +- 17 files changed, 11722 insertions(+), 10533 deletions(-) diff --git a/package.json b/package.json index 9d6cbc5772..30c0eca393 100644 --- a/package.json +++ b/package.json @@ -77,11 +77,11 @@ "quicktype-core": "^6.0.15", "temp": "^0.9.0", "tslint": "^5.15.0", - "typescript": "3.4.5" + "typescript": "3.5.3" }, "devDependencies": { - "@angular/compiler": "~8.1.0", - "@angular/compiler-cli": "~8.1.0", + "@angular/compiler": "~8.2.0-rc.0", + "@angular/compiler-cli": "~8.2.0-rc.0", "@bazel/bazel": "0.24.1", "@bazel/buildifier": "^0.22.0", "@bazel/jasmine": "~0.26.0", diff --git a/packages/angular/cli/utilities/package-metadata.ts b/packages/angular/cli/utilities/package-metadata.ts index 0775c55792..26b3f446b1 100644 --- a/packages/angular/cli/utilities/package-metadata.ts +++ b/packages/angular/cli/utilities/package-metadata.ts @@ -191,7 +191,7 @@ export async function fetchPackageMetadata( if (response.versions) { for (const [version, manifest] of Object.entries(response.versions)) { - metadata.versions.set(version, normalizeManifest(manifest)); + metadata.versions.set(version, normalizeManifest(manifest as {})); } } diff --git a/packages/angular_devkit/build_angular/package.json b/packages/angular_devkit/build_angular/package.json index 1bc308c435..a731d93773 100644 --- a/packages/angular_devkit/build_angular/package.json +++ b/packages/angular_devkit/build_angular/package.json @@ -57,18 +57,19 @@ "worker-plugin": "3.1.0" }, "devDependencies": { - "@angular/animations": "~8.1.0", + "@angular/animations": "~8.2.0-rc.0", "@angular/cdk": "^8.0.0", - "@angular/common": "~8.1.0", - "@angular/compiler": "~8.1.0", - "@angular/compiler-cli": "~8.1.0", - "@angular/core": "~8.1.0", + "@angular/common": "~8.2.0-rc.0", + "@angular/compiler": "~8.2.0-rc.0", + "@angular/compiler-cli": "~8.2.0-rc.0", + "@angular/core": "~8.2.0-rc.0", + "@angular/forms": "~8.2.0-rc.0", "@angular/material": "^8.0.0", - "@angular/platform-browser": "~8.1.0", - "@angular/platform-browser-dynamic": "~8.1.0", - "@angular/platform-server": "~8.1.0", - "@angular/router": "~8.1.0", - "@angular/service-worker": "~8.1.0", + "@angular/platform-browser": "~8.2.0-rc.0", + "@angular/platform-browser-dynamic": "~8.2.0-rc.0", + "@angular/platform-server": "~8.2.0-rc.0", + "@angular/router": "~8.2.0-rc.0", + "@angular/service-worker": "~8.2.0-rc.0", "codelyzer": "^5.0.0", "bootstrap": "^4.0.0", "font-awesome": "^4.7.0", @@ -86,6 +87,6 @@ }, "peerDependencies": { "@angular/compiler-cli": "^8.0.0-beta.0 || ^8.1.0-beta.0 || ^8.2.0-beta.0 || ^8.3.0-beta.0 || ^8.4.0-beta.0 || >=9.0.0-beta < 9", - "typescript": ">=3.1 < 3.5" + "typescript": ">=3.1 < 3.6" } } diff --git a/packages/angular_devkit/build_ng_packagr/package.json b/packages/angular_devkit/build_ng_packagr/package.json index 68f06ca6f3..4e0e0627a8 100644 --- a/packages/angular_devkit/build_ng_packagr/package.json +++ b/packages/angular_devkit/build_ng_packagr/package.json @@ -14,10 +14,10 @@ "ng-packagr": "^4.0.0 || ^5.0.0" }, "devDependencies": { - "@angular/compiler": "~8.1.0", - "@angular/compiler-cli": "~8.1.0", + "@angular/compiler": "~8.2.0-rc.0", + "@angular/compiler-cli": "~8.2.0-rc.0", "@angular-devkit/core": "0.0.0", - "ng-packagr": "^5.1.0", - "tslib": "^1.9.0" + "ng-packagr": "^5.3.0", + "tslib": "^1.10.0" } } diff --git a/packages/angular_devkit/build_optimizer/package.json b/packages/angular_devkit/build_optimizer/package.json index 5755fdc9af..b0b73cc0d1 100644 --- a/packages/angular_devkit/build_optimizer/package.json +++ b/packages/angular_devkit/build_optimizer/package.json @@ -11,7 +11,7 @@ "dependencies": { "loader-utils": "1.2.3", "source-map": "0.5.6", - "typescript": "3.4.5", + "typescript": "3.5.3", "webpack-sources": "1.3.0" } } diff --git a/packages/angular_devkit/schematics/tools/fallback-engine-host.ts b/packages/angular_devkit/schematics/tools/fallback-engine-host.ts index 3e9f882452..c8e8d3a374 100644 --- a/packages/angular_devkit/schematics/tools/fallback-engine-host.ts +++ b/packages/angular_devkit/schematics/tools/fallback-engine-host.ts @@ -94,7 +94,7 @@ export class FallbackEngineHost implements EngineHost<{}, {}> { // tslint:disable-next-line:no-any https://github.com/ReactiveX/rxjs/issues/3989 return ((observableOf(options) as any) .pipe(...this._hosts - .map(host => mergeMap(opt => host.transformOptions(schematic, opt, context))), + .map(host => mergeMap((opt: {}) => host.transformOptions(schematic, opt, context))), ) ) as {} as Observable; } diff --git a/packages/angular_devkit/schematics/tools/file-system-engine-host-base.ts b/packages/angular_devkit/schematics/tools/file-system-engine-host-base.ts index 5c823fa3ec..8c5e560fb6 100644 --- a/packages/angular_devkit/schematics/tools/file-system-engine-host-base.ts +++ b/packages/angular_devkit/schematics/tools/file-system-engine-host-base.ts @@ -301,7 +301,7 @@ export abstract class FileSystemEngineHostBase implements FileSystemEngineHost { // tslint:disable-next-line:no-any https://github.com/ReactiveX/rxjs/issues/3989 return ((observableOf(options) as any) .pipe( - ...this._transforms.map(tFn => mergeMap(opt => { + ...this._transforms.map(tFn => mergeMap((opt: {}) => { const newOptions = tFn(schematic, opt, context); if (isObservable(newOptions)) { return newOptions; diff --git a/packages/ngtools/webpack/package.json b/packages/ngtools/webpack/package.json index 3d063ffe57..1b5b042370 100644 --- a/packages/ngtools/webpack/package.json +++ b/packages/ngtools/webpack/package.json @@ -29,13 +29,13 @@ }, "peerDependencies": { "@angular/compiler-cli": "^8.0.0-beta.0 || ^8.1.0-beta.0 || ^8.2.0-beta.0 || ^8.3.0-beta.0 || ^8.4.0-beta.0 || >=9.0.0-beta < 9", - "typescript": ">=3.4 < 3.5", + "typescript": ">=3.4 < 3.6", "webpack": "^4.0.0" }, "devDependencies": { - "@angular/compiler": "~8.1.0", - "@angular/compiler-cli": "~8.1.0", - "typescript": "3.4.5", + "@angular/compiler": "~8.2.0-rc.0", + "@angular/compiler-cli": "~8.2.0-rc.0", + "typescript": "3.5.3", "webpack": "4.38.0" } } diff --git a/packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript.d.ts b/packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript.d.ts index 314ccf298c..58ccd42344 100644 --- a/packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript.d.ts +++ b/packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript.d.ts @@ -14,7 +14,7 @@ and limitations under the License. ***************************************************************************** */ declare namespace ts { - const versionMajorMinor = "3.4"; + const versionMajorMinor = "3.5"; /** The version of the TypeScript compiler release */ const version: string; } @@ -72,7 +72,7 @@ declare namespace ts { pos: number; end: number; } - type JsDocSyntaxKind = SyntaxKind.EndOfFileToken | SyntaxKind.WhitespaceTrivia | SyntaxKind.AtToken | SyntaxKind.NewLineTrivia | SyntaxKind.AsteriskToken | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.LessThanToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.EqualsToken | SyntaxKind.CommaToken | SyntaxKind.DotToken | SyntaxKind.Identifier | SyntaxKind.NoSubstitutionTemplateLiteral | SyntaxKind.Unknown | KeywordSyntaxKind; + type JSDocSyntaxKind = SyntaxKind.EndOfFileToken | SyntaxKind.WhitespaceTrivia | SyntaxKind.AtToken | SyntaxKind.NewLineTrivia | SyntaxKind.AsteriskToken | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.LessThanToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.EqualsToken | SyntaxKind.CommaToken | SyntaxKind.DotToken | SyntaxKind.Identifier | SyntaxKind.BacktickToken | SyntaxKind.Unknown | KeywordSyntaxKind; type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InKeyword | SyntaxKind.InferKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.RequireKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.OfKeyword; type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken; enum SyntaxKind { @@ -135,281 +135,283 @@ declare namespace ts { QuestionToken = 56, ColonToken = 57, AtToken = 58, - EqualsToken = 59, - PlusEqualsToken = 60, - MinusEqualsToken = 61, - AsteriskEqualsToken = 62, - AsteriskAsteriskEqualsToken = 63, - SlashEqualsToken = 64, - PercentEqualsToken = 65, - LessThanLessThanEqualsToken = 66, - GreaterThanGreaterThanEqualsToken = 67, - GreaterThanGreaterThanGreaterThanEqualsToken = 68, - AmpersandEqualsToken = 69, - BarEqualsToken = 70, - CaretEqualsToken = 71, - Identifier = 72, - BreakKeyword = 73, - CaseKeyword = 74, - CatchKeyword = 75, - ClassKeyword = 76, - ConstKeyword = 77, - ContinueKeyword = 78, - DebuggerKeyword = 79, - DefaultKeyword = 80, - DeleteKeyword = 81, - DoKeyword = 82, - ElseKeyword = 83, - EnumKeyword = 84, - ExportKeyword = 85, - ExtendsKeyword = 86, - FalseKeyword = 87, - FinallyKeyword = 88, - ForKeyword = 89, - FunctionKeyword = 90, - IfKeyword = 91, - ImportKeyword = 92, - InKeyword = 93, - InstanceOfKeyword = 94, - NewKeyword = 95, - NullKeyword = 96, - ReturnKeyword = 97, - SuperKeyword = 98, - SwitchKeyword = 99, - ThisKeyword = 100, - ThrowKeyword = 101, - TrueKeyword = 102, - TryKeyword = 103, - TypeOfKeyword = 104, - VarKeyword = 105, - VoidKeyword = 106, - WhileKeyword = 107, - WithKeyword = 108, - ImplementsKeyword = 109, - InterfaceKeyword = 110, - LetKeyword = 111, - PackageKeyword = 112, - PrivateKeyword = 113, - ProtectedKeyword = 114, - PublicKeyword = 115, - StaticKeyword = 116, - YieldKeyword = 117, - AbstractKeyword = 118, - AsKeyword = 119, - AnyKeyword = 120, - AsyncKeyword = 121, - AwaitKeyword = 122, - BooleanKeyword = 123, - ConstructorKeyword = 124, - DeclareKeyword = 125, - GetKeyword = 126, - InferKeyword = 127, - IsKeyword = 128, - KeyOfKeyword = 129, - ModuleKeyword = 130, - NamespaceKeyword = 131, - NeverKeyword = 132, - ReadonlyKeyword = 133, - RequireKeyword = 134, - NumberKeyword = 135, - ObjectKeyword = 136, - SetKeyword = 137, - StringKeyword = 138, - SymbolKeyword = 139, - TypeKeyword = 140, - UndefinedKeyword = 141, - UniqueKeyword = 142, - UnknownKeyword = 143, - FromKeyword = 144, - GlobalKeyword = 145, - BigIntKeyword = 146, - OfKeyword = 147, - QualifiedName = 148, - ComputedPropertyName = 149, - TypeParameter = 150, - Parameter = 151, - Decorator = 152, - PropertySignature = 153, - PropertyDeclaration = 154, - MethodSignature = 155, - MethodDeclaration = 156, - Constructor = 157, - GetAccessor = 158, - SetAccessor = 159, - CallSignature = 160, - ConstructSignature = 161, - IndexSignature = 162, - TypePredicate = 163, - TypeReference = 164, - FunctionType = 165, - ConstructorType = 166, - TypeQuery = 167, - TypeLiteral = 168, - ArrayType = 169, - TupleType = 170, - OptionalType = 171, - RestType = 172, - UnionType = 173, - IntersectionType = 174, - ConditionalType = 175, - InferType = 176, - ParenthesizedType = 177, - ThisType = 178, - TypeOperator = 179, - IndexedAccessType = 180, - MappedType = 181, - LiteralType = 182, - ImportType = 183, - ObjectBindingPattern = 184, - ArrayBindingPattern = 185, - BindingElement = 186, - ArrayLiteralExpression = 187, - ObjectLiteralExpression = 188, - PropertyAccessExpression = 189, - ElementAccessExpression = 190, - CallExpression = 191, - NewExpression = 192, - TaggedTemplateExpression = 193, - TypeAssertionExpression = 194, - ParenthesizedExpression = 195, - FunctionExpression = 196, - ArrowFunction = 197, - DeleteExpression = 198, - TypeOfExpression = 199, - VoidExpression = 200, - AwaitExpression = 201, - PrefixUnaryExpression = 202, - PostfixUnaryExpression = 203, - BinaryExpression = 204, - ConditionalExpression = 205, - TemplateExpression = 206, - YieldExpression = 207, - SpreadElement = 208, - ClassExpression = 209, - OmittedExpression = 210, - ExpressionWithTypeArguments = 211, - AsExpression = 212, - NonNullExpression = 213, - MetaProperty = 214, - SyntheticExpression = 215, - TemplateSpan = 216, - SemicolonClassElement = 217, - Block = 218, - VariableStatement = 219, - EmptyStatement = 220, - ExpressionStatement = 221, - IfStatement = 222, - DoStatement = 223, - WhileStatement = 224, - ForStatement = 225, - ForInStatement = 226, - ForOfStatement = 227, - ContinueStatement = 228, - BreakStatement = 229, - ReturnStatement = 230, - WithStatement = 231, - SwitchStatement = 232, - LabeledStatement = 233, - ThrowStatement = 234, - TryStatement = 235, - DebuggerStatement = 236, - VariableDeclaration = 237, - VariableDeclarationList = 238, - FunctionDeclaration = 239, - ClassDeclaration = 240, - InterfaceDeclaration = 241, - TypeAliasDeclaration = 242, - EnumDeclaration = 243, - ModuleDeclaration = 244, - ModuleBlock = 245, - CaseBlock = 246, - NamespaceExportDeclaration = 247, - ImportEqualsDeclaration = 248, - ImportDeclaration = 249, - ImportClause = 250, - NamespaceImport = 251, - NamedImports = 252, - ImportSpecifier = 253, - ExportAssignment = 254, - ExportDeclaration = 255, - NamedExports = 256, - ExportSpecifier = 257, - MissingDeclaration = 258, - ExternalModuleReference = 259, - JsxElement = 260, - JsxSelfClosingElement = 261, - JsxOpeningElement = 262, - JsxClosingElement = 263, - JsxFragment = 264, - JsxOpeningFragment = 265, - JsxClosingFragment = 266, - JsxAttribute = 267, - JsxAttributes = 268, - JsxSpreadAttribute = 269, - JsxExpression = 270, - CaseClause = 271, - DefaultClause = 272, - HeritageClause = 273, - CatchClause = 274, - PropertyAssignment = 275, - ShorthandPropertyAssignment = 276, - SpreadAssignment = 277, - EnumMember = 278, - UnparsedPrologue = 279, - UnparsedPrepend = 280, - UnparsedText = 281, - UnparsedInternalText = 282, - UnparsedSyntheticReference = 283, - SourceFile = 284, - Bundle = 285, - UnparsedSource = 286, - InputFiles = 287, - JSDocTypeExpression = 288, - JSDocAllType = 289, - JSDocUnknownType = 290, - JSDocNullableType = 291, - JSDocNonNullableType = 292, - JSDocOptionalType = 293, - JSDocFunctionType = 294, - JSDocVariadicType = 295, - JSDocComment = 296, - JSDocTypeLiteral = 297, - JSDocSignature = 298, - JSDocTag = 299, - JSDocAugmentsTag = 300, - JSDocClassTag = 301, - JSDocCallbackTag = 302, - JSDocEnumTag = 303, - JSDocParameterTag = 304, - JSDocReturnTag = 305, - JSDocThisTag = 306, - JSDocTypeTag = 307, - JSDocTemplateTag = 308, - JSDocTypedefTag = 309, - JSDocPropertyTag = 310, - SyntaxList = 311, - NotEmittedStatement = 312, - PartiallyEmittedExpression = 313, - CommaListExpression = 314, - MergeDeclarationMarker = 315, - EndOfDeclarationMarker = 316, - Count = 317, - FirstAssignment = 59, - LastAssignment = 71, - FirstCompoundAssignment = 60, - LastCompoundAssignment = 71, - FirstReservedWord = 73, - LastReservedWord = 108, - FirstKeyword = 73, - LastKeyword = 147, - FirstFutureReservedWord = 109, - LastFutureReservedWord = 117, - FirstTypeNode = 163, - LastTypeNode = 183, + /** Only the JSDoc scanner produces BacktickToken. The normal scanner produces NoSubstitutionTemplateLiteral and related kinds. */ + BacktickToken = 59, + EqualsToken = 60, + PlusEqualsToken = 61, + MinusEqualsToken = 62, + AsteriskEqualsToken = 63, + AsteriskAsteriskEqualsToken = 64, + SlashEqualsToken = 65, + PercentEqualsToken = 66, + LessThanLessThanEqualsToken = 67, + GreaterThanGreaterThanEqualsToken = 68, + GreaterThanGreaterThanGreaterThanEqualsToken = 69, + AmpersandEqualsToken = 70, + BarEqualsToken = 71, + CaretEqualsToken = 72, + Identifier = 73, + BreakKeyword = 74, + CaseKeyword = 75, + CatchKeyword = 76, + ClassKeyword = 77, + ConstKeyword = 78, + ContinueKeyword = 79, + DebuggerKeyword = 80, + DefaultKeyword = 81, + DeleteKeyword = 82, + DoKeyword = 83, + ElseKeyword = 84, + EnumKeyword = 85, + ExportKeyword = 86, + ExtendsKeyword = 87, + FalseKeyword = 88, + FinallyKeyword = 89, + ForKeyword = 90, + FunctionKeyword = 91, + IfKeyword = 92, + ImportKeyword = 93, + InKeyword = 94, + InstanceOfKeyword = 95, + NewKeyword = 96, + NullKeyword = 97, + ReturnKeyword = 98, + SuperKeyword = 99, + SwitchKeyword = 100, + ThisKeyword = 101, + ThrowKeyword = 102, + TrueKeyword = 103, + TryKeyword = 104, + TypeOfKeyword = 105, + VarKeyword = 106, + VoidKeyword = 107, + WhileKeyword = 108, + WithKeyword = 109, + ImplementsKeyword = 110, + InterfaceKeyword = 111, + LetKeyword = 112, + PackageKeyword = 113, + PrivateKeyword = 114, + ProtectedKeyword = 115, + PublicKeyword = 116, + StaticKeyword = 117, + YieldKeyword = 118, + AbstractKeyword = 119, + AsKeyword = 120, + AnyKeyword = 121, + AsyncKeyword = 122, + AwaitKeyword = 123, + BooleanKeyword = 124, + ConstructorKeyword = 125, + DeclareKeyword = 126, + GetKeyword = 127, + InferKeyword = 128, + IsKeyword = 129, + KeyOfKeyword = 130, + ModuleKeyword = 131, + NamespaceKeyword = 132, + NeverKeyword = 133, + ReadonlyKeyword = 134, + RequireKeyword = 135, + NumberKeyword = 136, + ObjectKeyword = 137, + SetKeyword = 138, + StringKeyword = 139, + SymbolKeyword = 140, + TypeKeyword = 141, + UndefinedKeyword = 142, + UniqueKeyword = 143, + UnknownKeyword = 144, + FromKeyword = 145, + GlobalKeyword = 146, + BigIntKeyword = 147, + OfKeyword = 148, + QualifiedName = 149, + ComputedPropertyName = 150, + TypeParameter = 151, + Parameter = 152, + Decorator = 153, + PropertySignature = 154, + PropertyDeclaration = 155, + MethodSignature = 156, + MethodDeclaration = 157, + Constructor = 158, + GetAccessor = 159, + SetAccessor = 160, + CallSignature = 161, + ConstructSignature = 162, + IndexSignature = 163, + TypePredicate = 164, + TypeReference = 165, + FunctionType = 166, + ConstructorType = 167, + TypeQuery = 168, + TypeLiteral = 169, + ArrayType = 170, + TupleType = 171, + OptionalType = 172, + RestType = 173, + UnionType = 174, + IntersectionType = 175, + ConditionalType = 176, + InferType = 177, + ParenthesizedType = 178, + ThisType = 179, + TypeOperator = 180, + IndexedAccessType = 181, + MappedType = 182, + LiteralType = 183, + ImportType = 184, + ObjectBindingPattern = 185, + ArrayBindingPattern = 186, + BindingElement = 187, + ArrayLiteralExpression = 188, + ObjectLiteralExpression = 189, + PropertyAccessExpression = 190, + ElementAccessExpression = 191, + CallExpression = 192, + NewExpression = 193, + TaggedTemplateExpression = 194, + TypeAssertionExpression = 195, + ParenthesizedExpression = 196, + FunctionExpression = 197, + ArrowFunction = 198, + DeleteExpression = 199, + TypeOfExpression = 200, + VoidExpression = 201, + AwaitExpression = 202, + PrefixUnaryExpression = 203, + PostfixUnaryExpression = 204, + BinaryExpression = 205, + ConditionalExpression = 206, + TemplateExpression = 207, + YieldExpression = 208, + SpreadElement = 209, + ClassExpression = 210, + OmittedExpression = 211, + ExpressionWithTypeArguments = 212, + AsExpression = 213, + NonNullExpression = 214, + MetaProperty = 215, + SyntheticExpression = 216, + TemplateSpan = 217, + SemicolonClassElement = 218, + Block = 219, + VariableStatement = 220, + EmptyStatement = 221, + ExpressionStatement = 222, + IfStatement = 223, + DoStatement = 224, + WhileStatement = 225, + ForStatement = 226, + ForInStatement = 227, + ForOfStatement = 228, + ContinueStatement = 229, + BreakStatement = 230, + ReturnStatement = 231, + WithStatement = 232, + SwitchStatement = 233, + LabeledStatement = 234, + ThrowStatement = 235, + TryStatement = 236, + DebuggerStatement = 237, + VariableDeclaration = 238, + VariableDeclarationList = 239, + FunctionDeclaration = 240, + ClassDeclaration = 241, + InterfaceDeclaration = 242, + TypeAliasDeclaration = 243, + EnumDeclaration = 244, + ModuleDeclaration = 245, + ModuleBlock = 246, + CaseBlock = 247, + NamespaceExportDeclaration = 248, + ImportEqualsDeclaration = 249, + ImportDeclaration = 250, + ImportClause = 251, + NamespaceImport = 252, + NamedImports = 253, + ImportSpecifier = 254, + ExportAssignment = 255, + ExportDeclaration = 256, + NamedExports = 257, + ExportSpecifier = 258, + MissingDeclaration = 259, + ExternalModuleReference = 260, + JsxElement = 261, + JsxSelfClosingElement = 262, + JsxOpeningElement = 263, + JsxClosingElement = 264, + JsxFragment = 265, + JsxOpeningFragment = 266, + JsxClosingFragment = 267, + JsxAttribute = 268, + JsxAttributes = 269, + JsxSpreadAttribute = 270, + JsxExpression = 271, + CaseClause = 272, + DefaultClause = 273, + HeritageClause = 274, + CatchClause = 275, + PropertyAssignment = 276, + ShorthandPropertyAssignment = 277, + SpreadAssignment = 278, + EnumMember = 279, + UnparsedPrologue = 280, + UnparsedPrepend = 281, + UnparsedText = 282, + UnparsedInternalText = 283, + UnparsedSyntheticReference = 284, + SourceFile = 285, + Bundle = 286, + UnparsedSource = 287, + InputFiles = 288, + JSDocTypeExpression = 289, + JSDocAllType = 290, + JSDocUnknownType = 291, + JSDocNullableType = 292, + JSDocNonNullableType = 293, + JSDocOptionalType = 294, + JSDocFunctionType = 295, + JSDocVariadicType = 296, + JSDocComment = 297, + JSDocTypeLiteral = 298, + JSDocSignature = 299, + JSDocTag = 300, + JSDocAugmentsTag = 301, + JSDocClassTag = 302, + JSDocCallbackTag = 303, + JSDocEnumTag = 304, + JSDocParameterTag = 305, + JSDocReturnTag = 306, + JSDocThisTag = 307, + JSDocTypeTag = 308, + JSDocTemplateTag = 309, + JSDocTypedefTag = 310, + JSDocPropertyTag = 311, + SyntaxList = 312, + NotEmittedStatement = 313, + PartiallyEmittedExpression = 314, + CommaListExpression = 315, + MergeDeclarationMarker = 316, + EndOfDeclarationMarker = 317, + Count = 318, + FirstAssignment = 60, + LastAssignment = 72, + FirstCompoundAssignment = 61, + LastCompoundAssignment = 72, + FirstReservedWord = 74, + LastReservedWord = 109, + FirstKeyword = 74, + LastKeyword = 148, + FirstFutureReservedWord = 110, + LastFutureReservedWord = 118, + FirstTypeNode = 164, + LastTypeNode = 184, FirstPunctuation = 18, - LastPunctuation = 71, + LastPunctuation = 72, FirstToken = 0, - LastToken = 147, + LastToken = 148, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -417,12 +419,12 @@ declare namespace ts { FirstTemplateToken = 14, LastTemplateToken = 17, FirstBinaryOperator = 28, - LastBinaryOperator = 71, - FirstNode = 148, - FirstJSDocNode = 288, - LastJSDocNode = 310, - FirstJSDocTagNode = 299, - LastJSDocTagNode = 310, + LastBinaryOperator = 72, + FirstNode = 149, + FirstJSDocNode = 289, + LastJSDocNode = 311, + FirstJSDocTagNode = 300, + LastJSDocTagNode = 311, } enum NodeFlags { None = 0, @@ -626,7 +628,7 @@ declare namespace ts { initializer?: Expression; } interface ObjectLiteralElement extends NamedDeclaration { - _objectLiteralBrandBrand: any; + _objectLiteralBrand: any; name?: PropertyName; } /** Unlike ObjectLiteralElement, excludes JSXAttribute and JSXSpreadAttribute. */ @@ -1601,7 +1603,7 @@ declare namespace ts { } interface JSDocTypeTag extends JSDocTag { kind: SyntaxKind.JSDocTypeTag; - typeExpression?: JSDocTypeExpression; + typeExpression: JSDocTypeExpression; } interface JSDocTypedefTag extends JSDocTag, NamedDeclaration { parent: JSDoc; @@ -1877,13 +1879,18 @@ declare namespace ts { sourceFile: SourceFile; references?: ReadonlyArray; } + type CustomTransformerFactory = (context: TransformationContext) => CustomTransformer; + interface CustomTransformer { + transformSourceFile(node: SourceFile): SourceFile; + transformBundle(node: Bundle): Bundle; + } interface CustomTransformers { /** Custom transformers to evaluate before built-in .js transformations. */ - before?: TransformerFactory[]; + before?: (TransformerFactory | CustomTransformerFactory)[]; /** Custom transformers to evaluate after built-in .js transformations. */ - after?: TransformerFactory[]; + after?: (TransformerFactory | CustomTransformerFactory)[]; /** Custom transformers to evaluate after built-in .d.ts transformations. */ - afterDeclarations?: TransformerFactory[]; + afterDeclarations?: (TransformerFactory | CustomTransformerFactory)[]; } interface SourceMapSpan { /** Line number in the .js file. */ @@ -1962,6 +1969,7 @@ declare namespace ts { */ getExportSymbolOfSymbol(symbol: Symbol): Symbol; getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol | undefined; + getTypeOfAssignmentPattern(pattern: AssignmentPattern): Type; getTypeAtLocation(node: Node): Type; getTypeFromTypeNode(node: TypeNode): Type; signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string; @@ -2359,7 +2367,8 @@ declare namespace ts { objectType: Type; indexType: Type; constraint?: Type; - simplified?: Type; + simplifiedForReading?: Type; + simplifiedForWriting?: Type; } type TypeVariable = TypeParameter | IndexedAccessType; interface IndexType extends InstantiableType { @@ -2382,8 +2391,8 @@ declare namespace ts { root: ConditionalRoot; checkType: Type; extendsType: Type; - trueType: Type; - falseType: Type; + resolvedTrueType: Type; + resolvedFalseType: Type; } interface SubstitutionType extends InstantiableType { typeVariable: TypeVariable; @@ -2410,12 +2419,13 @@ declare namespace ts { enum InferencePriority { NakedTypeVariable = 1, HomomorphicMappedType = 2, - MappedTypeConstraint = 4, - ReturnType = 8, - LiteralKeyof = 16, - NoConstraints = 32, - AlwaysStrict = 64, - PriorityImpliesCombination = 28 + PartialHomomorphicMappedType = 4, + MappedTypeConstraint = 8, + ReturnType = 16, + LiteralKeyof = 32, + NoConstraints = 64, + AlwaysStrict = 128, + PriorityImpliesCombination = 56 } /** @deprecated Use FileExtensionInfo instead. */ type JsFileExtensionInfo = FileExtensionInfo; @@ -2489,6 +2499,7 @@ declare namespace ts { interface CompilerOptions { allowJs?: boolean; allowSyntheticDefaultImports?: boolean; + allowUmdGlobalAccess?: boolean; allowUnreachableCode?: boolean; allowUnusedLabels?: boolean; alwaysStrict?: boolean; @@ -2621,9 +2632,10 @@ declare namespace ts { ES2017 = 4, ES2018 = 5, ES2019 = 6, - ESNext = 7, + ES2020 = 7, + ESNext = 8, JSON = 100, - Latest = 7 + Latest = 8 } enum LanguageVariant { Standard = 0, @@ -2756,6 +2768,7 @@ declare namespace ts { resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string, redirectedReference?: ResolvedProjectReference): (ResolvedTypeReferenceDirective | undefined)[]; getEnvironmentVariable?(name: string): string | undefined; createHash?(data: string): string; + getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined; } interface SourceMapRange extends TextRange { source?: SourceMapSource; @@ -3159,7 +3172,7 @@ declare namespace ts { reScanJsxToken(): JsxTokenSyntaxKind; reScanLessThanToken(): SyntaxKind; scanJsxToken(): JsxTokenSyntaxKind; - scanJSDocToken(): JsDocSyntaxKind; + scanJsDocToken(): JSDocSyntaxKind; scan(): SyntaxKind; getText(): string; setText(text: string | undefined, start?: number, length?: number): void; @@ -3627,7 +3640,7 @@ declare namespace ts { /** * Reads the config file, reports errors if any and exits if the config file cannot be found */ - function getParsedCommandLineOfConfigFile(configFileName: string, optionsToExtend: CompilerOptions, host: ParseConfigFileHost): ParsedCommandLine | undefined; + function getParsedCommandLineOfConfigFile(configFileName: string, optionsToExtend: CompilerOptions, host: ParseConfigFileHost, extendedConfigCache?: Map): ParsedCommandLine | undefined; /** * Read tsconfig.json file * @param fileName The path to the config file @@ -3661,7 +3674,7 @@ declare namespace ts { * @param basePath A root directory to resolve relative path entries in the config * file to. e.g. outDir */ - function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray): ParsedCommandLine; + function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray, extendedConfigCache?: Map): ParsedCommandLine; /** * Parse the contents of a config file (tsconfig.json). * @param jsonNode The contents of the config file to parse @@ -3669,7 +3682,20 @@ declare namespace ts { * @param basePath A root directory to resolve relative path entries in the config * file to. e.g. outDir */ - function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray): ParsedCommandLine; + function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray, extendedConfigCache?: Map): ParsedCommandLine; + interface ParsedTsconfig { + raw: any; + options?: CompilerOptions; + typeAcquisition?: TypeAcquisition; + /** + * Note that the case of the config path has not yet been normalized, as no files have been imported into the project yet + */ + extendedConfigPath?: string; + } + interface ExtendedConfigCacheEntry { + extendedResult: TsConfigSourceFile; + extendedConfig: ParsedTsconfig | undefined; + } function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { options: CompilerOptions; errors: Diagnostic[]; @@ -3714,7 +3740,7 @@ declare namespace ts { get(directory: string): ResolvedModuleWithFailedLookupLocations | undefined; set(directory: string, result: ResolvedModuleWithFailedLookupLocations): void; } - function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string): ModuleResolutionCache; + function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string, options?: CompilerOptions): ModuleResolutionCache; function resolveModuleNameFromCache(moduleName: string, containingFile: string, cache: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations | undefined; function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations; function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations; @@ -3837,7 +3863,7 @@ declare namespace ts { function updateArrayLiteral(node: ArrayLiteralExpression, elements: ReadonlyArray): ArrayLiteralExpression; function createObjectLiteral(properties?: ReadonlyArray, multiLine?: boolean): ObjectLiteralExpression; function updateObjectLiteral(node: ObjectLiteralExpression, properties: ReadonlyArray): ObjectLiteralExpression; - function createPropertyAccess(expression: Expression, name: string | Identifier | undefined): PropertyAccessExpression; + function createPropertyAccess(expression: Expression, name: string | Identifier): PropertyAccessExpression; function updatePropertyAccess(node: PropertyAccessExpression, expression: Expression, name: Identifier): PropertyAccessExpression; function createElementAccess(expression: Expression, index: number | Expression): ElementAccessExpression; function updateElementAccess(node: ElementAccessExpression, expression: Expression, argumentExpression: Expression): ElementAccessExpression; @@ -4052,7 +4078,7 @@ declare namespace ts { function createInputFiles(javascriptText: string, declarationText: string): InputFiles; function createInputFiles(readFileText: (path: string) => string | undefined, javascriptPath: string, javascriptMapPath: string | undefined, declarationPath: string, declarationMapPath: string | undefined, buildInfoPath: string | undefined): InputFiles; function createInputFiles(javascriptText: string, declarationText: string, javascriptMapPath: string | undefined, javascriptMapText: string | undefined, declarationMapPath: string | undefined, declarationMapText: string | undefined): InputFiles; - function updateBundle(node: Bundle, sourceFiles: ReadonlyArray, prepends?: ReadonlyArray): Bundle; + function updateBundle(node: Bundle, sourceFiles: ReadonlyArray, prepends?: ReadonlyArray): Bundle; function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray): CallExpression; function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray, param: ParameterDeclaration, paramValue: Expression): CallExpression; function createImmediatelyInvokedArrowFunction(statements: ReadonlyArray): CallExpression; @@ -4540,13 +4566,12 @@ declare namespace ts.server { type ActionSet = "action::set"; type ActionInvalidate = "action::invalidate"; type ActionPackageInstalled = "action::packageInstalled"; - type ActionValueInspected = "action::valueInspected"; type EventTypesRegistry = "event::typesRegistry"; type EventBeginInstallTypes = "event::beginInstallTypes"; type EventEndInstallTypes = "event::endInstallTypes"; type EventInitializationFailed = "event::initializationFailed"; interface TypingInstallerResponse { - readonly kind: ActionSet | ActionInvalidate | EventTypesRegistry | ActionPackageInstalled | ActionValueInspected | EventBeginInstallTypes | EventEndInstallTypes | EventInitializationFailed; + readonly kind: ActionSet | ActionInvalidate | EventTypesRegistry | ActionPackageInstalled | EventBeginInstallTypes | EventEndInstallTypes | EventInitializationFailed; } interface TypingInstallerRequestWithProjectName { readonly projectName: string; @@ -4785,6 +4810,7 @@ declare namespace ts { getSignatureHelpItems(fileName: string, position: number, options: SignatureHelpItemsOptions | undefined): SignatureHelpItems | undefined; getRenameInfo(fileName: string, position: number, options?: RenameInfoOptions): RenameInfo; findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean, providePrefixAndSuffixTextForRename?: boolean): ReadonlyArray | undefined; + getSmartSelectionRange(fileName: string, position: number): SelectionRange; getDefinitionAtPosition(fileName: string, position: number): ReadonlyArray | undefined; getDefinitionAndBoundSpan(fileName: string, position: number): DefinitionInfoAndBoundSpan | undefined; getTypeDefinitionAtPosition(fileName: string, position: number): ReadonlyArray | undefined; @@ -4979,16 +5005,9 @@ declare namespace ts { changes: ReadonlyArray; commands?: ReadonlyArray; } - type CodeActionCommand = InstallPackageAction | GenerateTypesAction; + type CodeActionCommand = InstallPackageAction; interface InstallPackageAction { } - interface GenerateTypesAction extends GenerateTypesOptions { - } - interface GenerateTypesOptions { - readonly file: string; - readonly fileToGenerateTypesFor: string; - readonly outputFileName: string; - } /** * A set of one or more available refactoring actions, grouped under a parent refactoring. */ @@ -5236,6 +5255,10 @@ declare namespace ts { displayParts: SymbolDisplayPart[]; isOptional: boolean; } + interface SelectionRange { + textSpan: TextSpan; + parent?: SelectionRange; + } /** * Represents a single signature to show in signature help. * The id is used for subsequent calls into the language service to ask questions about the @@ -5612,10 +5635,6 @@ declare namespace ts { function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput; function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string; } -declare namespace ts { - function generateTypesForModule(name: string, moduleValue: unknown, formatSettings: FormatCodeSettings): string; - function generateTypesForGlobal(name: string, globalValue: unknown, formatSettings: FormatCodeSettings): string; -} declare namespace ts { /** The version of the language service API */ const servicesVersion = "0.8"; diff --git a/packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript.js b/packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript.js index da4767072f..56ae492c34 100644 --- a/packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript.js +++ b/packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript.js @@ -73,7 +73,7 @@ var ts; (function (ts) { // WARNING: The script `configureNightly.ts` uses a regexp to parse out these values. // If changing the text in this section, be sure to test `configureNightly` too. - ts.versionMajorMinor = "3.4"; + ts.versionMajorMinor = "3.5"; /** The version of the TypeScript compiler release */ ts.version = ts.versionMajorMinor + ".3"; })(ts || (ts = {})); @@ -205,7 +205,7 @@ var ts; entry.nextEntry.previousEntry = previousEntry; } // When the deleted entry was the last one, we need to - // adust the lastEntry reference. + // adjust the lastEntry reference. if (this.lastEntry === entry) { this.lastEntry = previousEntry; } @@ -315,7 +315,7 @@ var ts; ts.firstDefinedIterator = firstDefinedIterator; function zipWith(arrayA, arrayB, callback) { var result = []; - Debug.assertEqual(arrayA.length, arrayB.length); + ts.Debug.assertEqual(arrayA.length, arrayB.length); for (var i = 0; i < arrayA.length; i++) { result.push(callback(arrayA[i], arrayB[i], i)); } @@ -323,7 +323,7 @@ var ts; } ts.zipWith = zipWith; function zipToIterator(arrayA, arrayB) { - Debug.assertEqual(arrayA.length, arrayB.length); + ts.Debug.assertEqual(arrayA.length, arrayB.length); var i = 0; return { next: function () { @@ -337,7 +337,7 @@ var ts; } ts.zipToIterator = zipToIterator; function zipToMap(keys, values) { - Debug.assert(keys.length === values.length); + ts.Debug.assert(keys.length === values.length); var map = createMap(); for (var i = 0; i < keys.length; ++i) { map.set(keys[i], values[i]); @@ -411,7 +411,7 @@ var ts; return result; } } - return Debug.fail(); + return ts.Debug.fail(); } ts.findMap = findMap; function contains(array, value, equalityComparer) { @@ -841,7 +841,7 @@ var ts; continue; case -1 /* LessThan */: // If `array` is sorted, `next` should **never** be less than `last`. - return Debug.fail("Array is unsorted."); + return ts.Debug.fail("Array is unsorted."); } deduplicated.push(last = next); } @@ -908,13 +908,13 @@ var ts; loopB: for (var offsetA = 0, offsetB = 0; offsetB < arrayB.length; offsetB++) { if (offsetB > 0) { // Ensure `arrayB` is properly sorted. - Debug.assertGreaterThanOrEqual(comparer(arrayB[offsetB], arrayB[offsetB - 1]), 0 /* EqualTo */); + ts.Debug.assertGreaterThanOrEqual(comparer(arrayB[offsetB], arrayB[offsetB - 1]), 0 /* EqualTo */); } loopA: for (var startA = offsetA; offsetA < arrayA.length; offsetA++) { if (offsetA > startA) { // Ensure `arrayA` is properly sorted. We only need to perform this check if // `offsetA` has changed since we entered the loop. - Debug.assertGreaterThanOrEqual(comparer(arrayA[offsetA], arrayA[offsetA - 1]), 0 /* EqualTo */); + ts.Debug.assertGreaterThanOrEqual(comparer(arrayA[offsetA], arrayA[offsetA - 1]), 0 /* EqualTo */); } switch (comparer(arrayB[offsetB], arrayA[offsetA])) { case -1 /* LessThan */: @@ -1084,7 +1084,7 @@ var ts; } ts.firstOrUndefined = firstOrUndefined; function first(array) { - Debug.assert(array.length !== 0); + ts.Debug.assert(array.length !== 0); return array[0]; } ts.first = first; @@ -1096,7 +1096,7 @@ var ts; } ts.lastOrUndefined = lastOrUndefined; function last(array) { - Debug.assert(array.length !== 0); + ts.Debug.assert(array.length !== 0); return array[array.length - 1]; } ts.last = last; @@ -1421,7 +1421,7 @@ var ts; function cast(value, test) { if (value !== undefined && test(value)) return value; - return Debug.fail("Invalid cast. The supplied value " + value + " did not pass the test '" + Debug.getFunctionName(test) + "'."); + return ts.Debug.fail("Invalid cast. The supplied value " + value + " did not pass the test '" + ts.Debug.getFunctionName(test) + "'."); } ts.cast = cast; /** Does nothing. */ @@ -1458,38 +1458,13 @@ var ts; }; } ts.memoize = memoize; - function chain(a, b, c, d, e) { + function compose(a, b, c, d, e) { if (e) { var args_2 = []; for (var i = 0; i < arguments.length; i++) { args_2[i] = arguments[i]; } - return function (t) { return compose.apply(void 0, map(args_2, function (f) { return f(t); })); }; - } - else if (d) { - return function (t) { return compose(a(t), b(t), c(t), d(t)); }; - } - else if (c) { - return function (t) { return compose(a(t), b(t), c(t)); }; - } - else if (b) { - return function (t) { return compose(a(t), b(t)); }; - } - else if (a) { - return function (t) { return compose(a(t)); }; - } - else { - return function (_) { return function (u) { return u; }; }; - } - } - ts.chain = chain; - function compose(a, b, c, d, e) { - if (e) { - var args_3 = []; - for (var i = 0; i < arguments.length; i++) { - args_3[i] = arguments[i]; - } - return function (t) { return reduceLeft(args_3, function (u, f) { return f(u); }, t); }; + return function (t) { return reduceLeft(args_2, function (u, f) { return f(u); }, t); }; } else if (d) { return function (t) { return d(c(b(a(t)))); }; @@ -1515,92 +1490,6 @@ var ts; AssertionLevel[AssertionLevel["Aggressive"] = 2] = "Aggressive"; AssertionLevel[AssertionLevel["VeryAggressive"] = 3] = "VeryAggressive"; })(AssertionLevel = ts.AssertionLevel || (ts.AssertionLevel = {})); - var Debug; - (function (Debug) { - Debug.currentAssertionLevel = 0 /* None */; - Debug.isDebugging = false; - function shouldAssert(level) { - return Debug.currentAssertionLevel >= level; - } - Debug.shouldAssert = shouldAssert; - function assert(expression, message, verboseDebugInfo, stackCrawlMark) { - if (!expression) { - if (verboseDebugInfo) { - message += "\r\nVerbose Debug Information: " + (typeof verboseDebugInfo === "string" ? verboseDebugInfo : verboseDebugInfo()); - } - fail(message ? "False expression: " + message : "False expression.", stackCrawlMark || assert); - } - } - Debug.assert = assert; - function assertEqual(a, b, msg, msg2) { - if (a !== b) { - var message = msg ? msg2 ? msg + " " + msg2 : msg : ""; - fail("Expected " + a + " === " + b + ". " + message); - } - } - Debug.assertEqual = assertEqual; - function assertLessThan(a, b, msg) { - if (a >= b) { - fail("Expected " + a + " < " + b + ". " + (msg || "")); - } - } - Debug.assertLessThan = assertLessThan; - function assertLessThanOrEqual(a, b) { - if (a > b) { - fail("Expected " + a + " <= " + b); - } - } - Debug.assertLessThanOrEqual = assertLessThanOrEqual; - function assertGreaterThanOrEqual(a, b) { - if (a < b) { - fail("Expected " + a + " >= " + b); - } - } - Debug.assertGreaterThanOrEqual = assertGreaterThanOrEqual; - function fail(message, stackCrawlMark) { - debugger; - var e = new Error(message ? "Debug Failure. " + message : "Debug Failure."); - if (Error.captureStackTrace) { - Error.captureStackTrace(e, stackCrawlMark || fail); - } - throw e; - } - Debug.fail = fail; - function assertDefined(value, message) { - if (value === undefined || value === null) - return fail(message); - return value; - } - Debug.assertDefined = assertDefined; - function assertEachDefined(value, message) { - for (var _i = 0, value_1 = value; _i < value_1.length; _i++) { - var v = value_1[_i]; - assertDefined(v, message); - } - return value; - } - Debug.assertEachDefined = assertEachDefined; - function assertNever(member, message, stackCrawlMark) { - if (message === void 0) { message = "Illegal value:"; } - var detail = typeof member === "object" && "kind" in member && "pos" in member ? "SyntaxKind: " + Debug.showSyntaxKind(member) : JSON.stringify(member); - return fail(message + " " + detail, stackCrawlMark || assertNever); - } - Debug.assertNever = assertNever; - function getFunctionName(func) { - if (typeof func !== "function") { - return ""; - } - else if (func.hasOwnProperty("name")) { - return func.name; - } - else { - var text = Function.prototype.toString.call(func); - var match = /^function\s+([\w\$]+)\s*\(/.exec(text); - return match ? match[1] : ""; - } - } - Debug.getFunctionName = getFunctionName; - })(Debug = ts.Debug || (ts.Debug = {})); function equateValues(a, b) { return a === b; } @@ -1857,7 +1746,7 @@ var ts; bestCandidate = candidate; } else { - Debug.assert(distance < bestDistance); // Else `levenshteinWithMax` should return undefined + ts.Debug.assert(distance < bestDistance); // Else `levenshteinWithMax` should return undefined bestDistance = distance; bestCandidate = candidate; } @@ -2001,7 +1890,7 @@ var ts; * E.g.: matchedText(tryParsePattern("foo*baz"), "foobarbaz") === "bar" */ function matchedText(pattern, candidate) { - Debug.assert(isPatternMatch(pattern, candidate)); + ts.Debug.assert(isPatternMatch(pattern, candidate)); return candidate.substring(pattern.prefix.length, candidate.length - pattern.suffix.length); } ts.matchedText = matchedText; @@ -2094,6 +1983,267 @@ var ts; return result; } ts.fill = fill; + function cartesianProduct(arrays) { + var result = []; + cartesianProductWorker(arrays, result, /*outer*/ undefined, 0); + return result; + } + ts.cartesianProduct = cartesianProduct; + function cartesianProductWorker(arrays, result, outer, index) { + for (var _i = 0, _a = arrays[index]; _i < _a.length; _i++) { + var element = _a[_i]; + var inner = void 0; + if (outer) { + inner = outer.slice(); + inner.push(element); + } + else { + inner = [element]; + } + if (index === arrays.length - 1) { + result.push(inner); + } + else { + cartesianProductWorker(arrays, result, inner, index + 1); + } + } + } +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var Debug; + (function (Debug) { + Debug.currentAssertionLevel = 0 /* None */; + Debug.isDebugging = false; + function shouldAssert(level) { + return Debug.currentAssertionLevel >= level; + } + Debug.shouldAssert = shouldAssert; + function assert(expression, message, verboseDebugInfo, stackCrawlMark) { + if (!expression) { + if (verboseDebugInfo) { + message += "\r\nVerbose Debug Information: " + (typeof verboseDebugInfo === "string" ? verboseDebugInfo : verboseDebugInfo()); + } + fail(message ? "False expression: " + message : "False expression.", stackCrawlMark || assert); + } + } + Debug.assert = assert; + function assertEqual(a, b, msg, msg2) { + if (a !== b) { + var message = msg ? msg2 ? msg + " " + msg2 : msg : ""; + fail("Expected " + a + " === " + b + ". " + message); + } + } + Debug.assertEqual = assertEqual; + function assertLessThan(a, b, msg) { + if (a >= b) { + fail("Expected " + a + " < " + b + ". " + (msg || "")); + } + } + Debug.assertLessThan = assertLessThan; + function assertLessThanOrEqual(a, b) { + if (a > b) { + fail("Expected " + a + " <= " + b); + } + } + Debug.assertLessThanOrEqual = assertLessThanOrEqual; + function assertGreaterThanOrEqual(a, b) { + if (a < b) { + fail("Expected " + a + " >= " + b); + } + } + Debug.assertGreaterThanOrEqual = assertGreaterThanOrEqual; + function fail(message, stackCrawlMark) { + debugger; + var e = new Error(message ? "Debug Failure. " + message : "Debug Failure."); + if (Error.captureStackTrace) { + Error.captureStackTrace(e, stackCrawlMark || fail); + } + throw e; + } + Debug.fail = fail; + function assertDefined(value, message) { + if (value === undefined || value === null) + return fail(message); + return value; + } + Debug.assertDefined = assertDefined; + function assertEachDefined(value, message) { + for (var _i = 0, value_1 = value; _i < value_1.length; _i++) { + var v = value_1[_i]; + assertDefined(v, message); + } + return value; + } + Debug.assertEachDefined = assertEachDefined; + function assertNever(member, message, stackCrawlMark) { + if (message === void 0) { message = "Illegal value:"; } + var detail = typeof member === "object" && "kind" in member && "pos" in member && formatSyntaxKind ? "SyntaxKind: " + formatSyntaxKind(member.kind) : JSON.stringify(member); + return fail(message + " " + detail, stackCrawlMark || assertNever); + } + Debug.assertNever = assertNever; + function getFunctionName(func) { + if (typeof func !== "function") { + return ""; + } + else if (func.hasOwnProperty("name")) { + return func.name; + } + else { + var text = Function.prototype.toString.call(func); + var match = /^function\s+([\w\$]+)\s*\(/.exec(text); + return match ? match[1] : ""; + } + } + Debug.getFunctionName = getFunctionName; + function formatSymbol(symbol) { + return "{ name: " + ts.unescapeLeadingUnderscores(symbol.escapedName) + "; flags: " + formatSymbolFlags(symbol.flags) + "; declarations: " + ts.map(symbol.declarations, function (node) { return formatSyntaxKind(node.kind); }) + " }"; + } + Debug.formatSymbol = formatSymbol; + /** + * Formats an enum value as a string for debugging and debug assertions. + */ + function formatEnum(value, enumObject, isFlags) { + if (value === void 0) { value = 0; } + var members = getEnumMembers(enumObject); + if (value === 0) { + return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0"; + } + if (isFlags) { + var result = ""; + var remainingFlags = value; + for (var i = members.length - 1; i >= 0 && remainingFlags !== 0; i--) { + var _a = members[i], enumValue = _a[0], enumName = _a[1]; + if (enumValue !== 0 && (remainingFlags & enumValue) === enumValue) { + remainingFlags &= ~enumValue; + result = "" + enumName + (result ? "|" : "") + result; + } + } + if (remainingFlags === 0) { + return result; + } + } + else { + for (var _i = 0, members_1 = members; _i < members_1.length; _i++) { + var _b = members_1[_i], enumValue = _b[0], enumName = _b[1]; + if (enumValue === value) { + return enumName; + } + } + } + return value.toString(); + } + Debug.formatEnum = formatEnum; + function getEnumMembers(enumObject) { + var result = []; + for (var name in enumObject) { + var value = enumObject[name]; + if (typeof value === "number") { + result.push([value, name]); + } + } + return ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); }); + } + function formatSyntaxKind(kind) { + return formatEnum(kind, ts.SyntaxKind, /*isFlags*/ false); + } + Debug.formatSyntaxKind = formatSyntaxKind; + function formatNodeFlags(flags) { + return formatEnum(flags, ts.NodeFlags, /*isFlags*/ true); + } + Debug.formatNodeFlags = formatNodeFlags; + function formatModifierFlags(flags) { + return formatEnum(flags, ts.ModifierFlags, /*isFlags*/ true); + } + Debug.formatModifierFlags = formatModifierFlags; + function formatTransformFlags(flags) { + return formatEnum(flags, ts.TransformFlags, /*isFlags*/ true); + } + Debug.formatTransformFlags = formatTransformFlags; + function formatEmitFlags(flags) { + return formatEnum(flags, ts.EmitFlags, /*isFlags*/ true); + } + Debug.formatEmitFlags = formatEmitFlags; + function formatSymbolFlags(flags) { + return formatEnum(flags, ts.SymbolFlags, /*isFlags*/ true); + } + Debug.formatSymbolFlags = formatSymbolFlags; + function formatTypeFlags(flags) { + return formatEnum(flags, ts.TypeFlags, /*isFlags*/ true); + } + Debug.formatTypeFlags = formatTypeFlags; + function formatObjectFlags(flags) { + return formatEnum(flags, ts.ObjectFlags, /*isFlags*/ true); + } + Debug.formatObjectFlags = formatObjectFlags; + function failBadSyntaxKind(node, message) { + return fail((message || "Unexpected node.") + "\r\nNode " + formatSyntaxKind(node.kind) + " was unexpected.", failBadSyntaxKind); + } + Debug.failBadSyntaxKind = failBadSyntaxKind; + Debug.assertEachNode = shouldAssert(1 /* Normal */) + ? function (nodes, test, message) { return assert(test === undefined || ts.every(nodes, test), message || "Unexpected node.", function () { return "Node array did not pass test '" + getFunctionName(test) + "'."; }, Debug.assertEachNode); } + : ts.noop; + Debug.assertNode = shouldAssert(1 /* Normal */) + ? function (node, test, message) { return assert(test === undefined || test(node), message || "Unexpected node.", function () { return "Node " + formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }, Debug.assertNode); } + : ts.noop; + Debug.assertOptionalNode = shouldAssert(1 /* Normal */) + ? function (node, test, message) { return assert(test === undefined || node === undefined || test(node), message || "Unexpected node.", function () { return "Node " + formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }, Debug.assertOptionalNode); } + : ts.noop; + Debug.assertOptionalToken = shouldAssert(1 /* Normal */) + ? function (node, kind, message) { return assert(kind === undefined || node === undefined || node.kind === kind, message || "Unexpected node.", function () { return "Node " + formatSyntaxKind(node.kind) + " was not a '" + formatSyntaxKind(kind) + "' token."; }, Debug.assertOptionalToken); } + : ts.noop; + Debug.assertMissingNode = shouldAssert(1 /* Normal */) + ? function (node, message) { return assert(node === undefined, message || "Unexpected node.", function () { return "Node " + formatSyntaxKind(node.kind) + " was unexpected'."; }, Debug.assertMissingNode); } + : ts.noop; + var isDebugInfoEnabled = false; + /** + * Injects debug information into frequently used types. + */ + function enableDebugInfo() { + if (isDebugInfoEnabled) + return; + // Add additional properties in debug mode to assist with debugging. + Object.defineProperties(ts.objectAllocator.getSymbolConstructor().prototype, { + __debugFlags: { get: function () { return formatSymbolFlags(this.flags); } } + }); + Object.defineProperties(ts.objectAllocator.getTypeConstructor().prototype, { + __debugFlags: { get: function () { return formatTypeFlags(this.flags); } }, + __debugObjectFlags: { get: function () { return this.flags & 524288 /* Object */ ? formatObjectFlags(this.objectFlags) : ""; } }, + __debugTypeToString: { value: function () { return this.checker.typeToString(this); } }, + }); + var nodeConstructors = [ + ts.objectAllocator.getNodeConstructor(), + ts.objectAllocator.getIdentifierConstructor(), + ts.objectAllocator.getTokenConstructor(), + ts.objectAllocator.getSourceFileConstructor() + ]; + for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) { + var ctor = nodeConstructors_1[_i]; + if (!ctor.prototype.hasOwnProperty("__debugKind")) { + Object.defineProperties(ctor.prototype, { + __debugKind: { get: function () { return formatSyntaxKind(this.kind); } }, + __debugNodeFlags: { get: function () { return formatNodeFlags(this.flags); } }, + __debugModifierFlags: { get: function () { return formatModifierFlags(ts.getModifierFlagsNoCache(this)); } }, + __debugTransformFlags: { get: function () { return formatTransformFlags(this.transformFlags); } }, + __debugIsParseTreeNode: { get: function () { return ts.isParseTreeNode(this); } }, + __debugEmitFlags: { get: function () { return formatEmitFlags(ts.getEmitFlags(this)); } }, + __debugGetText: { + value: function (includeTrivia) { + if (ts.nodeIsSynthesized(this)) + return ""; + var parseNode = ts.getParseTreeNode(this); + var sourceFile = parseNode && ts.getSourceFileOfNode(parseNode); + return sourceFile ? ts.getSourceTextOfNodeFromSourceFile(sourceFile, parseNode, includeTrivia) : ""; + } + } + }); + } + } + isDebugInfoEnabled = true; + } + Debug.enableDebugInfo = enableDebugInfo; + })(Debug = ts.Debug || (ts.Debug = {})); })(ts || (ts = {})); /*@internal*/ var ts; @@ -2646,309 +2796,311 @@ var ts; SyntaxKind[SyntaxKind["QuestionToken"] = 56] = "QuestionToken"; SyntaxKind[SyntaxKind["ColonToken"] = 57] = "ColonToken"; SyntaxKind[SyntaxKind["AtToken"] = 58] = "AtToken"; + /** Only the JSDoc scanner produces BacktickToken. The normal scanner produces NoSubstitutionTemplateLiteral and related kinds. */ + SyntaxKind[SyntaxKind["BacktickToken"] = 59] = "BacktickToken"; // Assignments - SyntaxKind[SyntaxKind["EqualsToken"] = 59] = "EqualsToken"; - SyntaxKind[SyntaxKind["PlusEqualsToken"] = 60] = "PlusEqualsToken"; - SyntaxKind[SyntaxKind["MinusEqualsToken"] = 61] = "MinusEqualsToken"; - SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 62] = "AsteriskEqualsToken"; - SyntaxKind[SyntaxKind["AsteriskAsteriskEqualsToken"] = 63] = "AsteriskAsteriskEqualsToken"; - SyntaxKind[SyntaxKind["SlashEqualsToken"] = 64] = "SlashEqualsToken"; - SyntaxKind[SyntaxKind["PercentEqualsToken"] = 65] = "PercentEqualsToken"; - SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 66] = "LessThanLessThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 67] = "GreaterThanGreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 68] = "GreaterThanGreaterThanGreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 69] = "AmpersandEqualsToken"; - SyntaxKind[SyntaxKind["BarEqualsToken"] = 70] = "BarEqualsToken"; - SyntaxKind[SyntaxKind["CaretEqualsToken"] = 71] = "CaretEqualsToken"; + SyntaxKind[SyntaxKind["EqualsToken"] = 60] = "EqualsToken"; + SyntaxKind[SyntaxKind["PlusEqualsToken"] = 61] = "PlusEqualsToken"; + SyntaxKind[SyntaxKind["MinusEqualsToken"] = 62] = "MinusEqualsToken"; + SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 63] = "AsteriskEqualsToken"; + SyntaxKind[SyntaxKind["AsteriskAsteriskEqualsToken"] = 64] = "AsteriskAsteriskEqualsToken"; + SyntaxKind[SyntaxKind["SlashEqualsToken"] = 65] = "SlashEqualsToken"; + SyntaxKind[SyntaxKind["PercentEqualsToken"] = 66] = "PercentEqualsToken"; + SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 67] = "LessThanLessThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 68] = "GreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 69] = "GreaterThanGreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 70] = "AmpersandEqualsToken"; + SyntaxKind[SyntaxKind["BarEqualsToken"] = 71] = "BarEqualsToken"; + SyntaxKind[SyntaxKind["CaretEqualsToken"] = 72] = "CaretEqualsToken"; // Identifiers - SyntaxKind[SyntaxKind["Identifier"] = 72] = "Identifier"; + SyntaxKind[SyntaxKind["Identifier"] = 73] = "Identifier"; // Reserved words - SyntaxKind[SyntaxKind["BreakKeyword"] = 73] = "BreakKeyword"; - SyntaxKind[SyntaxKind["CaseKeyword"] = 74] = "CaseKeyword"; - SyntaxKind[SyntaxKind["CatchKeyword"] = 75] = "CatchKeyword"; - SyntaxKind[SyntaxKind["ClassKeyword"] = 76] = "ClassKeyword"; - SyntaxKind[SyntaxKind["ConstKeyword"] = 77] = "ConstKeyword"; - SyntaxKind[SyntaxKind["ContinueKeyword"] = 78] = "ContinueKeyword"; - SyntaxKind[SyntaxKind["DebuggerKeyword"] = 79] = "DebuggerKeyword"; - SyntaxKind[SyntaxKind["DefaultKeyword"] = 80] = "DefaultKeyword"; - SyntaxKind[SyntaxKind["DeleteKeyword"] = 81] = "DeleteKeyword"; - SyntaxKind[SyntaxKind["DoKeyword"] = 82] = "DoKeyword"; - SyntaxKind[SyntaxKind["ElseKeyword"] = 83] = "ElseKeyword"; - SyntaxKind[SyntaxKind["EnumKeyword"] = 84] = "EnumKeyword"; - SyntaxKind[SyntaxKind["ExportKeyword"] = 85] = "ExportKeyword"; - SyntaxKind[SyntaxKind["ExtendsKeyword"] = 86] = "ExtendsKeyword"; - SyntaxKind[SyntaxKind["FalseKeyword"] = 87] = "FalseKeyword"; - SyntaxKind[SyntaxKind["FinallyKeyword"] = 88] = "FinallyKeyword"; - SyntaxKind[SyntaxKind["ForKeyword"] = 89] = "ForKeyword"; - SyntaxKind[SyntaxKind["FunctionKeyword"] = 90] = "FunctionKeyword"; - SyntaxKind[SyntaxKind["IfKeyword"] = 91] = "IfKeyword"; - SyntaxKind[SyntaxKind["ImportKeyword"] = 92] = "ImportKeyword"; - SyntaxKind[SyntaxKind["InKeyword"] = 93] = "InKeyword"; - SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 94] = "InstanceOfKeyword"; - SyntaxKind[SyntaxKind["NewKeyword"] = 95] = "NewKeyword"; - SyntaxKind[SyntaxKind["NullKeyword"] = 96] = "NullKeyword"; - SyntaxKind[SyntaxKind["ReturnKeyword"] = 97] = "ReturnKeyword"; - SyntaxKind[SyntaxKind["SuperKeyword"] = 98] = "SuperKeyword"; - SyntaxKind[SyntaxKind["SwitchKeyword"] = 99] = "SwitchKeyword"; - SyntaxKind[SyntaxKind["ThisKeyword"] = 100] = "ThisKeyword"; - SyntaxKind[SyntaxKind["ThrowKeyword"] = 101] = "ThrowKeyword"; - SyntaxKind[SyntaxKind["TrueKeyword"] = 102] = "TrueKeyword"; - SyntaxKind[SyntaxKind["TryKeyword"] = 103] = "TryKeyword"; - SyntaxKind[SyntaxKind["TypeOfKeyword"] = 104] = "TypeOfKeyword"; - SyntaxKind[SyntaxKind["VarKeyword"] = 105] = "VarKeyword"; - SyntaxKind[SyntaxKind["VoidKeyword"] = 106] = "VoidKeyword"; - SyntaxKind[SyntaxKind["WhileKeyword"] = 107] = "WhileKeyword"; - SyntaxKind[SyntaxKind["WithKeyword"] = 108] = "WithKeyword"; + SyntaxKind[SyntaxKind["BreakKeyword"] = 74] = "BreakKeyword"; + SyntaxKind[SyntaxKind["CaseKeyword"] = 75] = "CaseKeyword"; + SyntaxKind[SyntaxKind["CatchKeyword"] = 76] = "CatchKeyword"; + SyntaxKind[SyntaxKind["ClassKeyword"] = 77] = "ClassKeyword"; + SyntaxKind[SyntaxKind["ConstKeyword"] = 78] = "ConstKeyword"; + SyntaxKind[SyntaxKind["ContinueKeyword"] = 79] = "ContinueKeyword"; + SyntaxKind[SyntaxKind["DebuggerKeyword"] = 80] = "DebuggerKeyword"; + SyntaxKind[SyntaxKind["DefaultKeyword"] = 81] = "DefaultKeyword"; + SyntaxKind[SyntaxKind["DeleteKeyword"] = 82] = "DeleteKeyword"; + SyntaxKind[SyntaxKind["DoKeyword"] = 83] = "DoKeyword"; + SyntaxKind[SyntaxKind["ElseKeyword"] = 84] = "ElseKeyword"; + SyntaxKind[SyntaxKind["EnumKeyword"] = 85] = "EnumKeyword"; + SyntaxKind[SyntaxKind["ExportKeyword"] = 86] = "ExportKeyword"; + SyntaxKind[SyntaxKind["ExtendsKeyword"] = 87] = "ExtendsKeyword"; + SyntaxKind[SyntaxKind["FalseKeyword"] = 88] = "FalseKeyword"; + SyntaxKind[SyntaxKind["FinallyKeyword"] = 89] = "FinallyKeyword"; + SyntaxKind[SyntaxKind["ForKeyword"] = 90] = "ForKeyword"; + SyntaxKind[SyntaxKind["FunctionKeyword"] = 91] = "FunctionKeyword"; + SyntaxKind[SyntaxKind["IfKeyword"] = 92] = "IfKeyword"; + SyntaxKind[SyntaxKind["ImportKeyword"] = 93] = "ImportKeyword"; + SyntaxKind[SyntaxKind["InKeyword"] = 94] = "InKeyword"; + SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 95] = "InstanceOfKeyword"; + SyntaxKind[SyntaxKind["NewKeyword"] = 96] = "NewKeyword"; + SyntaxKind[SyntaxKind["NullKeyword"] = 97] = "NullKeyword"; + SyntaxKind[SyntaxKind["ReturnKeyword"] = 98] = "ReturnKeyword"; + SyntaxKind[SyntaxKind["SuperKeyword"] = 99] = "SuperKeyword"; + SyntaxKind[SyntaxKind["SwitchKeyword"] = 100] = "SwitchKeyword"; + SyntaxKind[SyntaxKind["ThisKeyword"] = 101] = "ThisKeyword"; + SyntaxKind[SyntaxKind["ThrowKeyword"] = 102] = "ThrowKeyword"; + SyntaxKind[SyntaxKind["TrueKeyword"] = 103] = "TrueKeyword"; + SyntaxKind[SyntaxKind["TryKeyword"] = 104] = "TryKeyword"; + SyntaxKind[SyntaxKind["TypeOfKeyword"] = 105] = "TypeOfKeyword"; + SyntaxKind[SyntaxKind["VarKeyword"] = 106] = "VarKeyword"; + SyntaxKind[SyntaxKind["VoidKeyword"] = 107] = "VoidKeyword"; + SyntaxKind[SyntaxKind["WhileKeyword"] = 108] = "WhileKeyword"; + SyntaxKind[SyntaxKind["WithKeyword"] = 109] = "WithKeyword"; // Strict mode reserved words - SyntaxKind[SyntaxKind["ImplementsKeyword"] = 109] = "ImplementsKeyword"; - SyntaxKind[SyntaxKind["InterfaceKeyword"] = 110] = "InterfaceKeyword"; - SyntaxKind[SyntaxKind["LetKeyword"] = 111] = "LetKeyword"; - SyntaxKind[SyntaxKind["PackageKeyword"] = 112] = "PackageKeyword"; - SyntaxKind[SyntaxKind["PrivateKeyword"] = 113] = "PrivateKeyword"; - SyntaxKind[SyntaxKind["ProtectedKeyword"] = 114] = "ProtectedKeyword"; - SyntaxKind[SyntaxKind["PublicKeyword"] = 115] = "PublicKeyword"; - SyntaxKind[SyntaxKind["StaticKeyword"] = 116] = "StaticKeyword"; - SyntaxKind[SyntaxKind["YieldKeyword"] = 117] = "YieldKeyword"; + SyntaxKind[SyntaxKind["ImplementsKeyword"] = 110] = "ImplementsKeyword"; + SyntaxKind[SyntaxKind["InterfaceKeyword"] = 111] = "InterfaceKeyword"; + SyntaxKind[SyntaxKind["LetKeyword"] = 112] = "LetKeyword"; + SyntaxKind[SyntaxKind["PackageKeyword"] = 113] = "PackageKeyword"; + SyntaxKind[SyntaxKind["PrivateKeyword"] = 114] = "PrivateKeyword"; + SyntaxKind[SyntaxKind["ProtectedKeyword"] = 115] = "ProtectedKeyword"; + SyntaxKind[SyntaxKind["PublicKeyword"] = 116] = "PublicKeyword"; + SyntaxKind[SyntaxKind["StaticKeyword"] = 117] = "StaticKeyword"; + SyntaxKind[SyntaxKind["YieldKeyword"] = 118] = "YieldKeyword"; // Contextual keywords - SyntaxKind[SyntaxKind["AbstractKeyword"] = 118] = "AbstractKeyword"; - SyntaxKind[SyntaxKind["AsKeyword"] = 119] = "AsKeyword"; - SyntaxKind[SyntaxKind["AnyKeyword"] = 120] = "AnyKeyword"; - SyntaxKind[SyntaxKind["AsyncKeyword"] = 121] = "AsyncKeyword"; - SyntaxKind[SyntaxKind["AwaitKeyword"] = 122] = "AwaitKeyword"; - SyntaxKind[SyntaxKind["BooleanKeyword"] = 123] = "BooleanKeyword"; - SyntaxKind[SyntaxKind["ConstructorKeyword"] = 124] = "ConstructorKeyword"; - SyntaxKind[SyntaxKind["DeclareKeyword"] = 125] = "DeclareKeyword"; - SyntaxKind[SyntaxKind["GetKeyword"] = 126] = "GetKeyword"; - SyntaxKind[SyntaxKind["InferKeyword"] = 127] = "InferKeyword"; - SyntaxKind[SyntaxKind["IsKeyword"] = 128] = "IsKeyword"; - SyntaxKind[SyntaxKind["KeyOfKeyword"] = 129] = "KeyOfKeyword"; - SyntaxKind[SyntaxKind["ModuleKeyword"] = 130] = "ModuleKeyword"; - SyntaxKind[SyntaxKind["NamespaceKeyword"] = 131] = "NamespaceKeyword"; - SyntaxKind[SyntaxKind["NeverKeyword"] = 132] = "NeverKeyword"; - SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 133] = "ReadonlyKeyword"; - SyntaxKind[SyntaxKind["RequireKeyword"] = 134] = "RequireKeyword"; - SyntaxKind[SyntaxKind["NumberKeyword"] = 135] = "NumberKeyword"; - SyntaxKind[SyntaxKind["ObjectKeyword"] = 136] = "ObjectKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 137] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 138] = "StringKeyword"; - SyntaxKind[SyntaxKind["SymbolKeyword"] = 139] = "SymbolKeyword"; - SyntaxKind[SyntaxKind["TypeKeyword"] = 140] = "TypeKeyword"; - SyntaxKind[SyntaxKind["UndefinedKeyword"] = 141] = "UndefinedKeyword"; - SyntaxKind[SyntaxKind["UniqueKeyword"] = 142] = "UniqueKeyword"; - SyntaxKind[SyntaxKind["UnknownKeyword"] = 143] = "UnknownKeyword"; - SyntaxKind[SyntaxKind["FromKeyword"] = 144] = "FromKeyword"; - SyntaxKind[SyntaxKind["GlobalKeyword"] = 145] = "GlobalKeyword"; - SyntaxKind[SyntaxKind["BigIntKeyword"] = 146] = "BigIntKeyword"; - SyntaxKind[SyntaxKind["OfKeyword"] = 147] = "OfKeyword"; + SyntaxKind[SyntaxKind["AbstractKeyword"] = 119] = "AbstractKeyword"; + SyntaxKind[SyntaxKind["AsKeyword"] = 120] = "AsKeyword"; + SyntaxKind[SyntaxKind["AnyKeyword"] = 121] = "AnyKeyword"; + SyntaxKind[SyntaxKind["AsyncKeyword"] = 122] = "AsyncKeyword"; + SyntaxKind[SyntaxKind["AwaitKeyword"] = 123] = "AwaitKeyword"; + SyntaxKind[SyntaxKind["BooleanKeyword"] = 124] = "BooleanKeyword"; + SyntaxKind[SyntaxKind["ConstructorKeyword"] = 125] = "ConstructorKeyword"; + SyntaxKind[SyntaxKind["DeclareKeyword"] = 126] = "DeclareKeyword"; + SyntaxKind[SyntaxKind["GetKeyword"] = 127] = "GetKeyword"; + SyntaxKind[SyntaxKind["InferKeyword"] = 128] = "InferKeyword"; + SyntaxKind[SyntaxKind["IsKeyword"] = 129] = "IsKeyword"; + SyntaxKind[SyntaxKind["KeyOfKeyword"] = 130] = "KeyOfKeyword"; + SyntaxKind[SyntaxKind["ModuleKeyword"] = 131] = "ModuleKeyword"; + SyntaxKind[SyntaxKind["NamespaceKeyword"] = 132] = "NamespaceKeyword"; + SyntaxKind[SyntaxKind["NeverKeyword"] = 133] = "NeverKeyword"; + SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 134] = "ReadonlyKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 135] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 136] = "NumberKeyword"; + SyntaxKind[SyntaxKind["ObjectKeyword"] = 137] = "ObjectKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 138] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 139] = "StringKeyword"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 140] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 141] = "TypeKeyword"; + SyntaxKind[SyntaxKind["UndefinedKeyword"] = 142] = "UndefinedKeyword"; + SyntaxKind[SyntaxKind["UniqueKeyword"] = 143] = "UniqueKeyword"; + SyntaxKind[SyntaxKind["UnknownKeyword"] = 144] = "UnknownKeyword"; + SyntaxKind[SyntaxKind["FromKeyword"] = 145] = "FromKeyword"; + SyntaxKind[SyntaxKind["GlobalKeyword"] = 146] = "GlobalKeyword"; + SyntaxKind[SyntaxKind["BigIntKeyword"] = 147] = "BigIntKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 148] = "OfKeyword"; // Parse tree nodes // Names - SyntaxKind[SyntaxKind["QualifiedName"] = 148] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 149] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["QualifiedName"] = 149] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 150] = "ComputedPropertyName"; // Signature elements - SyntaxKind[SyntaxKind["TypeParameter"] = 150] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 151] = "Parameter"; - SyntaxKind[SyntaxKind["Decorator"] = 152] = "Decorator"; + SyntaxKind[SyntaxKind["TypeParameter"] = 151] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 152] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 153] = "Decorator"; // TypeMember - SyntaxKind[SyntaxKind["PropertySignature"] = 153] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 154] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 155] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 156] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 157] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 158] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 159] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 160] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 161] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 162] = "IndexSignature"; + SyntaxKind[SyntaxKind["PropertySignature"] = 154] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 155] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 156] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 157] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 158] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 159] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 160] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 161] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 162] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 163] = "IndexSignature"; // Type - SyntaxKind[SyntaxKind["TypePredicate"] = 163] = "TypePredicate"; - SyntaxKind[SyntaxKind["TypeReference"] = 164] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 165] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 166] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 167] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 168] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 169] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 170] = "TupleType"; - SyntaxKind[SyntaxKind["OptionalType"] = 171] = "OptionalType"; - SyntaxKind[SyntaxKind["RestType"] = 172] = "RestType"; - SyntaxKind[SyntaxKind["UnionType"] = 173] = "UnionType"; - SyntaxKind[SyntaxKind["IntersectionType"] = 174] = "IntersectionType"; - SyntaxKind[SyntaxKind["ConditionalType"] = 175] = "ConditionalType"; - SyntaxKind[SyntaxKind["InferType"] = 176] = "InferType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 177] = "ParenthesizedType"; - SyntaxKind[SyntaxKind["ThisType"] = 178] = "ThisType"; - SyntaxKind[SyntaxKind["TypeOperator"] = 179] = "TypeOperator"; - SyntaxKind[SyntaxKind["IndexedAccessType"] = 180] = "IndexedAccessType"; - SyntaxKind[SyntaxKind["MappedType"] = 181] = "MappedType"; - SyntaxKind[SyntaxKind["LiteralType"] = 182] = "LiteralType"; - SyntaxKind[SyntaxKind["ImportType"] = 183] = "ImportType"; + SyntaxKind[SyntaxKind["TypePredicate"] = 164] = "TypePredicate"; + SyntaxKind[SyntaxKind["TypeReference"] = 165] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 166] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 167] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 168] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 169] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 170] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 171] = "TupleType"; + SyntaxKind[SyntaxKind["OptionalType"] = 172] = "OptionalType"; + SyntaxKind[SyntaxKind["RestType"] = 173] = "RestType"; + SyntaxKind[SyntaxKind["UnionType"] = 174] = "UnionType"; + SyntaxKind[SyntaxKind["IntersectionType"] = 175] = "IntersectionType"; + SyntaxKind[SyntaxKind["ConditionalType"] = 176] = "ConditionalType"; + SyntaxKind[SyntaxKind["InferType"] = 177] = "InferType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 178] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["ThisType"] = 179] = "ThisType"; + SyntaxKind[SyntaxKind["TypeOperator"] = 180] = "TypeOperator"; + SyntaxKind[SyntaxKind["IndexedAccessType"] = 181] = "IndexedAccessType"; + SyntaxKind[SyntaxKind["MappedType"] = 182] = "MappedType"; + SyntaxKind[SyntaxKind["LiteralType"] = 183] = "LiteralType"; + SyntaxKind[SyntaxKind["ImportType"] = 184] = "ImportType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 184] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 185] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 186] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 185] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 186] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 187] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 187] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 188] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 189] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 190] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 191] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 192] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 193] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 194] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 195] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 196] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 197] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 198] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 199] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 200] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 201] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 202] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 203] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 204] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 205] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 206] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 207] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElement"] = 208] = "SpreadElement"; - SyntaxKind[SyntaxKind["ClassExpression"] = 209] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 210] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 211] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 212] = "AsExpression"; - SyntaxKind[SyntaxKind["NonNullExpression"] = 213] = "NonNullExpression"; - SyntaxKind[SyntaxKind["MetaProperty"] = 214] = "MetaProperty"; - SyntaxKind[SyntaxKind["SyntheticExpression"] = 215] = "SyntheticExpression"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 188] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 189] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 190] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 191] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 192] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 193] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 194] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 195] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 196] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 197] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 198] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 199] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 200] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 201] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 202] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 203] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 204] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 205] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 206] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 207] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 208] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElement"] = 209] = "SpreadElement"; + SyntaxKind[SyntaxKind["ClassExpression"] = 210] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 211] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 212] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 213] = "AsExpression"; + SyntaxKind[SyntaxKind["NonNullExpression"] = 214] = "NonNullExpression"; + SyntaxKind[SyntaxKind["MetaProperty"] = 215] = "MetaProperty"; + SyntaxKind[SyntaxKind["SyntheticExpression"] = 216] = "SyntheticExpression"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 216] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 217] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 217] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 218] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 218] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 219] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 220] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 221] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 222] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 223] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 224] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 225] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 226] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 227] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 228] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 229] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 230] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 231] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 232] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 233] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 234] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 235] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 236] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 237] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 238] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 239] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 240] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 241] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 242] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 243] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 244] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 245] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 246] = "CaseBlock"; - SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 247] = "NamespaceExportDeclaration"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 248] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 249] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 250] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 251] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 252] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 253] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 254] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 255] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 256] = "NamedExports"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 257] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 258] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 219] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 220] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 221] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 222] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 223] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 224] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 225] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 226] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 227] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 228] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 229] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 230] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 231] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 232] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 233] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 234] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 235] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 236] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 237] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 238] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 239] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 240] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 241] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 242] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 243] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 244] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 245] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 246] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 247] = "CaseBlock"; + SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 248] = "NamespaceExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 249] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 250] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 251] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 252] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 253] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 254] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 255] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 256] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 257] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 258] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 259] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 259] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 260] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 260] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 261] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 262] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 263] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxFragment"] = 264] = "JsxFragment"; - SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 265] = "JsxOpeningFragment"; - SyntaxKind[SyntaxKind["JsxClosingFragment"] = 266] = "JsxClosingFragment"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 267] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxAttributes"] = 268] = "JsxAttributes"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 269] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 270] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 261] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 262] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 263] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 264] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxFragment"] = 265] = "JsxFragment"; + SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 266] = "JsxOpeningFragment"; + SyntaxKind[SyntaxKind["JsxClosingFragment"] = 267] = "JsxClosingFragment"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 268] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxAttributes"] = 269] = "JsxAttributes"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 270] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 271] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 271] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 272] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 273] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 274] = "CatchClause"; + SyntaxKind[SyntaxKind["CaseClause"] = 272] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 273] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 274] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 275] = "CatchClause"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 275] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 276] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["SpreadAssignment"] = 277] = "SpreadAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 276] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 277] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 278] = "SpreadAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 278] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 279] = "EnumMember"; // Unparsed - SyntaxKind[SyntaxKind["UnparsedPrologue"] = 279] = "UnparsedPrologue"; - SyntaxKind[SyntaxKind["UnparsedPrepend"] = 280] = "UnparsedPrepend"; - SyntaxKind[SyntaxKind["UnparsedText"] = 281] = "UnparsedText"; - SyntaxKind[SyntaxKind["UnparsedInternalText"] = 282] = "UnparsedInternalText"; - SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 283] = "UnparsedSyntheticReference"; + SyntaxKind[SyntaxKind["UnparsedPrologue"] = 280] = "UnparsedPrologue"; + SyntaxKind[SyntaxKind["UnparsedPrepend"] = 281] = "UnparsedPrepend"; + SyntaxKind[SyntaxKind["UnparsedText"] = 282] = "UnparsedText"; + SyntaxKind[SyntaxKind["UnparsedInternalText"] = 283] = "UnparsedInternalText"; + SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 284] = "UnparsedSyntheticReference"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 284] = "SourceFile"; - SyntaxKind[SyntaxKind["Bundle"] = 285] = "Bundle"; - SyntaxKind[SyntaxKind["UnparsedSource"] = 286] = "UnparsedSource"; - SyntaxKind[SyntaxKind["InputFiles"] = 287] = "InputFiles"; + SyntaxKind[SyntaxKind["SourceFile"] = 285] = "SourceFile"; + SyntaxKind[SyntaxKind["Bundle"] = 286] = "Bundle"; + SyntaxKind[SyntaxKind["UnparsedSource"] = 287] = "UnparsedSource"; + SyntaxKind[SyntaxKind["InputFiles"] = 288] = "InputFiles"; // JSDoc nodes - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 288] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 289] = "JSDocTypeExpression"; // The * type - SyntaxKind[SyntaxKind["JSDocAllType"] = 289] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 290] = "JSDocAllType"; // The ? type - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 290] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 291] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 292] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 293] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 294] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 295] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocComment"] = 296] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 297] = "JSDocTypeLiteral"; - SyntaxKind[SyntaxKind["JSDocSignature"] = 298] = "JSDocSignature"; - SyntaxKind[SyntaxKind["JSDocTag"] = 299] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 300] = "JSDocAugmentsTag"; - SyntaxKind[SyntaxKind["JSDocClassTag"] = 301] = "JSDocClassTag"; - SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 302] = "JSDocCallbackTag"; - SyntaxKind[SyntaxKind["JSDocEnumTag"] = 303] = "JSDocEnumTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 304] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 305] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocThisTag"] = 306] = "JSDocThisTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 307] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 308] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 309] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 310] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 291] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 292] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 293] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 294] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 295] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 296] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocComment"] = 297] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 298] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocSignature"] = 299] = "JSDocSignature"; + SyntaxKind[SyntaxKind["JSDocTag"] = 300] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 301] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocClassTag"] = 302] = "JSDocClassTag"; + SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 303] = "JSDocCallbackTag"; + SyntaxKind[SyntaxKind["JSDocEnumTag"] = 304] = "JSDocEnumTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 305] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 306] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocThisTag"] = 307] = "JSDocThisTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 308] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 309] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 310] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 311] = "JSDocPropertyTag"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 311] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 312] = "SyntaxList"; // Transformation nodes - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 312] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 313] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["CommaListExpression"] = 314] = "CommaListExpression"; - SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 315] = "MergeDeclarationMarker"; - SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 316] = "EndOfDeclarationMarker"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 313] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 314] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["CommaListExpression"] = 315] = "CommaListExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 316] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 317] = "EndOfDeclarationMarker"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 317] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 318] = "Count"; // Markers - SyntaxKind[SyntaxKind["FirstAssignment"] = 59] = "FirstAssignment"; - SyntaxKind[SyntaxKind["LastAssignment"] = 71] = "LastAssignment"; - SyntaxKind[SyntaxKind["FirstCompoundAssignment"] = 60] = "FirstCompoundAssignment"; - SyntaxKind[SyntaxKind["LastCompoundAssignment"] = 71] = "LastCompoundAssignment"; - SyntaxKind[SyntaxKind["FirstReservedWord"] = 73] = "FirstReservedWord"; - SyntaxKind[SyntaxKind["LastReservedWord"] = 108] = "LastReservedWord"; - SyntaxKind[SyntaxKind["FirstKeyword"] = 73] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = 147] = "LastKeyword"; - SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 109] = "FirstFutureReservedWord"; - SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 117] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 163] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 183] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstAssignment"] = 60] = "FirstAssignment"; + SyntaxKind[SyntaxKind["LastAssignment"] = 72] = "LastAssignment"; + SyntaxKind[SyntaxKind["FirstCompoundAssignment"] = 61] = "FirstCompoundAssignment"; + SyntaxKind[SyntaxKind["LastCompoundAssignment"] = 72] = "LastCompoundAssignment"; + SyntaxKind[SyntaxKind["FirstReservedWord"] = 74] = "FirstReservedWord"; + SyntaxKind[SyntaxKind["LastReservedWord"] = 109] = "LastReservedWord"; + SyntaxKind[SyntaxKind["FirstKeyword"] = 74] = "FirstKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 148] = "LastKeyword"; + SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 110] = "FirstFutureReservedWord"; + SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 118] = "LastFutureReservedWord"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 164] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 184] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 18] = "FirstPunctuation"; - SyntaxKind[SyntaxKind["LastPunctuation"] = 71] = "LastPunctuation"; + SyntaxKind[SyntaxKind["LastPunctuation"] = 72] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 147] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 148] = "LastToken"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken"; SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken"; @@ -2956,14 +3108,14 @@ var ts; SyntaxKind[SyntaxKind["FirstTemplateToken"] = 14] = "FirstTemplateToken"; SyntaxKind[SyntaxKind["LastTemplateToken"] = 17] = "LastTemplateToken"; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 28] = "FirstBinaryOperator"; - SyntaxKind[SyntaxKind["LastBinaryOperator"] = 71] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstNode"] = 148] = "FirstNode"; - SyntaxKind[SyntaxKind["FirstJSDocNode"] = 288] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 310] = "LastJSDocNode"; - SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 299] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 310] = "LastJSDocTagNode"; - /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 118] = "FirstContextualKeyword"; - /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 147] = "LastContextualKeyword"; + SyntaxKind[SyntaxKind["LastBinaryOperator"] = 72] = "LastBinaryOperator"; + SyntaxKind[SyntaxKind["FirstNode"] = 149] = "FirstNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 289] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 311] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 300] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 311] = "LastJSDocTagNode"; + /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 119] = "FirstContextualKeyword"; + /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 148] = "LastContextualKeyword"; })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); var NodeFlags; (function (NodeFlags) { @@ -3106,6 +3258,8 @@ var ts; FlowFlags[FlowFlags["Shared"] = 1024] = "Shared"; FlowFlags[FlowFlags["PreFinally"] = 2048] = "PreFinally"; FlowFlags[FlowFlags["AfterFinally"] = 4096] = "AfterFinally"; + /** @internal */ + FlowFlags[FlowFlags["Cached"] = 8192] = "Cached"; FlowFlags[FlowFlags["Label"] = 12] = "Label"; FlowFlags[FlowFlags["Condition"] = 96] = "Condition"; })(FlowFlags = ts.FlowFlags || (ts.FlowFlags = {})); @@ -3358,19 +3512,22 @@ var ts; CheckFlags[CheckFlags["SyntheticProperty"] = 2] = "SyntheticProperty"; CheckFlags[CheckFlags["SyntheticMethod"] = 4] = "SyntheticMethod"; CheckFlags[CheckFlags["Readonly"] = 8] = "Readonly"; - CheckFlags[CheckFlags["Partial"] = 16] = "Partial"; - CheckFlags[CheckFlags["HasNonUniformType"] = 32] = "HasNonUniformType"; - CheckFlags[CheckFlags["HasLiteralType"] = 64] = "HasLiteralType"; - CheckFlags[CheckFlags["ContainsPublic"] = 128] = "ContainsPublic"; - CheckFlags[CheckFlags["ContainsProtected"] = 256] = "ContainsProtected"; - CheckFlags[CheckFlags["ContainsPrivate"] = 512] = "ContainsPrivate"; - CheckFlags[CheckFlags["ContainsStatic"] = 1024] = "ContainsStatic"; - CheckFlags[CheckFlags["Late"] = 2048] = "Late"; - CheckFlags[CheckFlags["ReverseMapped"] = 4096] = "ReverseMapped"; - CheckFlags[CheckFlags["OptionalParameter"] = 8192] = "OptionalParameter"; - CheckFlags[CheckFlags["RestParameter"] = 16384] = "RestParameter"; + CheckFlags[CheckFlags["ReadPartial"] = 16] = "ReadPartial"; + CheckFlags[CheckFlags["WritePartial"] = 32] = "WritePartial"; + CheckFlags[CheckFlags["HasNonUniformType"] = 64] = "HasNonUniformType"; + CheckFlags[CheckFlags["HasLiteralType"] = 128] = "HasLiteralType"; + CheckFlags[CheckFlags["ContainsPublic"] = 256] = "ContainsPublic"; + CheckFlags[CheckFlags["ContainsProtected"] = 512] = "ContainsProtected"; + CheckFlags[CheckFlags["ContainsPrivate"] = 1024] = "ContainsPrivate"; + CheckFlags[CheckFlags["ContainsStatic"] = 2048] = "ContainsStatic"; + CheckFlags[CheckFlags["Late"] = 4096] = "Late"; + CheckFlags[CheckFlags["ReverseMapped"] = 8192] = "ReverseMapped"; + CheckFlags[CheckFlags["OptionalParameter"] = 16384] = "OptionalParameter"; + CheckFlags[CheckFlags["RestParameter"] = 32768] = "RestParameter"; + CheckFlags[CheckFlags["DeferredType"] = 65536] = "DeferredType"; CheckFlags[CheckFlags["Synthetic"] = 6] = "Synthetic"; - CheckFlags[CheckFlags["Discriminant"] = 96] = "Discriminant"; + CheckFlags[CheckFlags["Discriminant"] = 192] = "Discriminant"; + CheckFlags[CheckFlags["Partial"] = 48] = "Partial"; })(CheckFlags = ts.CheckFlags || (ts.CheckFlags = {})); var InternalSymbolName; (function (InternalSymbolName) { @@ -3480,7 +3637,9 @@ var ts; TypeFlags[TypeFlags["Instantiable"] = 63176704] = "Instantiable"; TypeFlags[TypeFlags["StructuredOrInstantiable"] = 66846720] = "StructuredOrInstantiable"; /* @internal */ - TypeFlags[TypeFlags["ObjectFlagsType"] = 3768320] = "ObjectFlagsType"; + TypeFlags[TypeFlags["ObjectFlagsType"] = 3899392] = "ObjectFlagsType"; + /* @internal */ + TypeFlags[TypeFlags["Simplifiable"] = 25165824] = "Simplifiable"; // 'Narrowable' types are types where narrowing actually narrows. // This *should* be every type other than null, undefined, void, and never TypeFlags[TypeFlags["Narrowable"] = 133970943] = "Narrowable"; @@ -3528,7 +3687,7 @@ var ts; /* @internal */ ObjectFlags[ObjectFlags["ContainsObjectLiteral"] = 262144] = "ContainsObjectLiteral"; /* @internal */ - ObjectFlags[ObjectFlags["ContainsAnyFunctionType"] = 524288] = "ContainsAnyFunctionType"; + ObjectFlags[ObjectFlags["NonInferrableType"] = 524288] = "NonInferrableType"; ObjectFlags[ObjectFlags["ClassOrInterface"] = 3] = "ClassOrInterface"; /* @internal */ ObjectFlags[ObjectFlags["RequiresWidening"] = 393216] = "RequiresWidening"; @@ -3536,14 +3695,18 @@ var ts; ObjectFlags[ObjectFlags["PropagatingFlags"] = 917504] = "PropagatingFlags"; })(ObjectFlags = ts.ObjectFlags || (ts.ObjectFlags = {})); /* @internal */ - var Variance; - (function (Variance) { - Variance[Variance["Invariant"] = 0] = "Invariant"; - Variance[Variance["Covariant"] = 1] = "Covariant"; - Variance[Variance["Contravariant"] = 2] = "Contravariant"; - Variance[Variance["Bivariant"] = 3] = "Bivariant"; - Variance[Variance["Independent"] = 4] = "Independent"; - })(Variance = ts.Variance || (ts.Variance = {})); + var VarianceFlags; + (function (VarianceFlags) { + VarianceFlags[VarianceFlags["Invariant"] = 0] = "Invariant"; + VarianceFlags[VarianceFlags["Covariant"] = 1] = "Covariant"; + VarianceFlags[VarianceFlags["Contravariant"] = 2] = "Contravariant"; + VarianceFlags[VarianceFlags["Bivariant"] = 3] = "Bivariant"; + VarianceFlags[VarianceFlags["Independent"] = 4] = "Independent"; + VarianceFlags[VarianceFlags["VarianceMask"] = 7] = "VarianceMask"; + VarianceFlags[VarianceFlags["Unmeasurable"] = 8] = "Unmeasurable"; + VarianceFlags[VarianceFlags["Unreliable"] = 16] = "Unreliable"; + VarianceFlags[VarianceFlags["AllowsStructuralFallback"] = 24] = "AllowsStructuralFallback"; + })(VarianceFlags = ts.VarianceFlags || (ts.VarianceFlags = {})); /* @internal */ var JsxReferenceKind; (function (JsxReferenceKind) { @@ -3565,12 +3728,13 @@ var ts; (function (InferencePriority) { InferencePriority[InferencePriority["NakedTypeVariable"] = 1] = "NakedTypeVariable"; InferencePriority[InferencePriority["HomomorphicMappedType"] = 2] = "HomomorphicMappedType"; - InferencePriority[InferencePriority["MappedTypeConstraint"] = 4] = "MappedTypeConstraint"; - InferencePriority[InferencePriority["ReturnType"] = 8] = "ReturnType"; - InferencePriority[InferencePriority["LiteralKeyof"] = 16] = "LiteralKeyof"; - InferencePriority[InferencePriority["NoConstraints"] = 32] = "NoConstraints"; - InferencePriority[InferencePriority["AlwaysStrict"] = 64] = "AlwaysStrict"; - InferencePriority[InferencePriority["PriorityImpliesCombination"] = 28] = "PriorityImpliesCombination"; + InferencePriority[InferencePriority["PartialHomomorphicMappedType"] = 4] = "PartialHomomorphicMappedType"; + InferencePriority[InferencePriority["MappedTypeConstraint"] = 8] = "MappedTypeConstraint"; + InferencePriority[InferencePriority["ReturnType"] = 16] = "ReturnType"; + InferencePriority[InferencePriority["LiteralKeyof"] = 32] = "LiteralKeyof"; + InferencePriority[InferencePriority["NoConstraints"] = 64] = "NoConstraints"; + InferencePriority[InferencePriority["AlwaysStrict"] = 128] = "AlwaysStrict"; + InferencePriority[InferencePriority["PriorityImpliesCombination"] = 56] = "PriorityImpliesCombination"; })(InferencePriority = ts.InferencePriority || (ts.InferencePriority = {})); /* @internal */ var InferenceFlags; @@ -3687,9 +3851,10 @@ var ts; ScriptTarget[ScriptTarget["ES2017"] = 4] = "ES2017"; ScriptTarget[ScriptTarget["ES2018"] = 5] = "ES2018"; ScriptTarget[ScriptTarget["ES2019"] = 6] = "ES2019"; - ScriptTarget[ScriptTarget["ESNext"] = 7] = "ESNext"; + ScriptTarget[ScriptTarget["ES2020"] = 7] = "ES2020"; + ScriptTarget[ScriptTarget["ESNext"] = 8] = "ESNext"; ScriptTarget[ScriptTarget["JSON"] = 100] = "JSON"; - ScriptTarget[ScriptTarget["Latest"] = 7] = "Latest"; + ScriptTarget[ScriptTarget["Latest"] = 8] = "Latest"; })(ScriptTarget = ts.ScriptTarget || (ts.ScriptTarget = {})); var LanguageVariant; (function (LanguageVariant) { @@ -4102,17 +4267,10 @@ var ts; PragmaKindFlags[PragmaKindFlags["All"] = 7] = "All"; PragmaKindFlags[PragmaKindFlags["Default"] = 7] = "Default"; })(PragmaKindFlags = ts.PragmaKindFlags || (ts.PragmaKindFlags = {})); - /** - * This function only exists to cause exact types to be inferred for all the literals within `commentPragmas` - */ - /* @internal */ - function _contextuallyTypePragmas(args) { - return args; - } // While not strictly a type, this is here because `PragmaMap` needs to be here to be used with `SourceFile`, and we don't // fancy effectively defining it twice, once in value-space and once in type-space /* @internal */ - ts.commentPragmas = _contextuallyTypePragmas({ + ts.commentPragmas = { "reference": { args: [ { name: "types", optional: true, captureSpan: true }, @@ -4140,7 +4298,7 @@ var ts; args: [{ name: "factory" }], kind: 4 /* MultiLine */ }, - }); + }; })(ts || (ts = {})); var ts; (function (ts) { @@ -5187,7 +5345,7 @@ var ts; _0_modifier_cannot_appear_on_a_data_property: diag(1043, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_data_property_1043", "'{0}' modifier cannot appear on a data property."), _0_modifier_cannot_appear_on_a_module_or_namespace_element: diag(1044, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_module_or_namespace_element_1044", "'{0}' modifier cannot appear on a module or namespace element."), A_0_modifier_cannot_be_used_with_an_interface_declaration: diag(1045, ts.DiagnosticCategory.Error, "A_0_modifier_cannot_be_used_with_an_interface_declaration_1045", "A '{0}' modifier cannot be used with an interface declaration."), - A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: diag(1046, ts.DiagnosticCategory.Error, "A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file_1046", "A 'declare' modifier is required for a top level declaration in a .d.ts file."), + Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier: diag(1046, ts.DiagnosticCategory.Error, "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046", "Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier."), A_rest_parameter_cannot_be_optional: diag(1047, ts.DiagnosticCategory.Error, "A_rest_parameter_cannot_be_optional_1047", "A rest parameter cannot be optional."), A_rest_parameter_cannot_have_an_initializer: diag(1048, ts.DiagnosticCategory.Error, "A_rest_parameter_cannot_have_an_initializer_1048", "A rest parameter cannot have an initializer."), A_set_accessor_must_have_exactly_one_parameter: diag(1049, ts.DiagnosticCategory.Error, "A_set_accessor_must_have_exactly_one_parameter_1049", "A 'set' accessor must have exactly one parameter."), @@ -5316,7 +5474,7 @@ var ts; Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided: diag(1205, ts.DiagnosticCategory.Error, "Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided_1205", "Cannot re-export a type when the '--isolatedModules' flag is provided."), Decorators_are_not_valid_here: diag(1206, ts.DiagnosticCategory.Error, "Decorators_are_not_valid_here_1206", "Decorators are not valid here."), Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: diag(1207, ts.DiagnosticCategory.Error, "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207", "Decorators cannot be applied to multiple get/set accessors of the same name."), - Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: diag(1208, ts.DiagnosticCategory.Error, "Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided_1208", "Cannot compile namespaces when the '--isolatedModules' flag is provided."), + All_files_must_be_modules_when_the_isolatedModules_flag_is_provided: diag(1208, ts.DiagnosticCategory.Error, "All_files_must_be_modules_when_the_isolatedModules_flag_is_provided_1208", "All files must be modules when the '--isolatedModules' flag is provided."), Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: diag(1210, ts.DiagnosticCategory.Error, "Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode_1210", "Invalid use of '{0}'. Class definitions are automatically in strict mode."), A_class_declaration_without_the_default_modifier_must_have_a_name: diag(1211, ts.DiagnosticCategory.Error, "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", "A class declaration without the 'default' modifier must have a name."), Identifier_expected_0_is_a_reserved_word_in_strict_mode: diag(1212, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", "Identifier expected. '{0}' is a reserved word in strict mode."), @@ -5325,7 +5483,7 @@ var ts; Invalid_use_of_0_Modules_are_automatically_in_strict_mode: diag(1215, ts.DiagnosticCategory.Error, "Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215", "Invalid use of '{0}'. Modules are automatically in strict mode."), Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules: diag(1216, ts.DiagnosticCategory.Error, "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216", "Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules."), Export_assignment_is_not_supported_when_module_flag_is_system: diag(1218, ts.DiagnosticCategory.Error, "Export_assignment_is_not_supported_when_module_flag_is_system_1218", "Export assignment is not supported when '--module' flag is 'system'."), - Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning: diag(1219, ts.DiagnosticCategory.Error, "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning."), + Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning: diag(1219, ts.DiagnosticCategory.Error, "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning."), Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher: diag(1220, ts.DiagnosticCategory.Error, "Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher_1220", "Generators are only available when targeting ECMAScript 2015 or higher."), Generators_are_not_allowed_in_an_ambient_context: diag(1221, ts.DiagnosticCategory.Error, "Generators_are_not_allowed_in_an_ambient_context_1221", "Generators are not allowed in an ambient context."), An_overload_signature_cannot_be_declared_as_a_generator: diag(1222, ts.DiagnosticCategory.Error, "An_overload_signature_cannot_be_declared_as_a_generator_1222", "An overload signature cannot be declared as a generator."), @@ -5364,6 +5522,8 @@ var ts; A_definite_assignment_assertion_is_not_permitted_in_this_context: diag(1255, ts.DiagnosticCategory.Error, "A_definite_assignment_assertion_is_not_permitted_in_this_context_1255", "A definite assignment assertion '!' is not permitted in this context."), A_rest_element_must_be_last_in_a_tuple_type: diag(1256, ts.DiagnosticCategory.Error, "A_rest_element_must_be_last_in_a_tuple_type_1256", "A rest element must be last in a tuple type."), A_required_element_cannot_follow_an_optional_element: diag(1257, ts.DiagnosticCategory.Error, "A_required_element_cannot_follow_an_optional_element_1257", "A required element cannot follow an optional element."), + Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation: diag(1258, ts.DiagnosticCategory.Error, "Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation_1258", "Definite assignment assertions can only be used along with a type annotation."), + Module_0_can_only_be_default_imported_using_the_1_flag: diag(1259, ts.DiagnosticCategory.Error, "Module_0_can_only_be_default_imported_using_the_1_flag_1259", "Module '{0}' can only be default-imported using the '{1}' flag"), with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."), await_expression_is_only_allowed_within_an_async_function: diag(1308, ts.DiagnosticCategory.Error, "await_expression_is_only_allowed_within_an_async_function_1308", "'await' expression is only allowed within an async function."), can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: diag(1312, ts.DiagnosticCategory.Error, "can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312", "'=' can only be used in an object literal property inside a destructuring assignment."), @@ -5408,7 +5568,8 @@ var ts; A_bigint_literal_cannot_use_exponential_notation: diag(1352, ts.DiagnosticCategory.Error, "A_bigint_literal_cannot_use_exponential_notation_1352", "A bigint literal cannot use exponential notation."), A_bigint_literal_must_be_an_integer: diag(1353, ts.DiagnosticCategory.Error, "A_bigint_literal_must_be_an_integer_1353", "A bigint literal must be an integer."), readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types: diag(1354, ts.DiagnosticCategory.Error, "readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types_1354", "'readonly' type modifier is only permitted on array and tuple literal types."), - A_const_assertion_can_only_be_applied_to_a_string_number_boolean_array_or_object_literal: diag(1355, ts.DiagnosticCategory.Error, "A_const_assertion_can_only_be_applied_to_a_string_number_boolean_array_or_object_literal_1355", "A 'const' assertion can only be applied to a string, number, boolean, array, or object literal."), + A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals: diag(1355, ts.DiagnosticCategory.Error, "A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array__1355", "A 'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals."), + Did_you_mean_to_mark_this_function_as_async: diag(1356, ts.DiagnosticCategory.Error, "Did_you_mean_to_mark_this_function_as_async_1356", "Did you mean to mark this function as 'async'?"), Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."), Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."), Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."), @@ -5690,6 +5851,7 @@ var ts; Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig: diag(2591, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_types_Slashnode_and_th_2591", "Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i @types/node` and then add `node` to the types field in your tsconfig."), Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_types_Slashjquery_and_then_add_jquery_to_the_types_field_in_your_tsconfig: diag(2592, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_types_Slashjquery_an_2592", "Cannot find name '{0}'. Do you need to install type definitions for jQuery? Try `npm i @types/jquery` and then add `jquery` to the types field in your tsconfig."), Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_types_Slashjest_or_npm_i_types_Slashmocha_and_then_add_jest_or_mocha_to_the_types_field_in_your_tsconfig: diag(2593, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_types_Slashje_2593", "Cannot find name '{0}'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig."), + This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag: diag(2594, ts.DiagnosticCategory.Error, "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594", "This module is declared with using 'export =', and can only be used with a default import when using the '{0}' flag."), JSX_element_attributes_type_0_may_not_be_a_union_type: diag(2600, ts.DiagnosticCategory.Error, "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", "JSX element attributes type '{0}' may not be a union type."), The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: diag(2601, ts.DiagnosticCategory.Error, "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", "The return type of a JSX element constructor must return an object type."), JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: diag(2602, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist."), @@ -5802,6 +5964,7 @@ var ts; Circularity_originates_in_type_at_this_location: diag(2751, ts.DiagnosticCategory.Error, "Circularity_originates_in_type_at_this_location_2751", "Circularity originates in type at this location."), The_first_export_default_is_here: diag(2752, ts.DiagnosticCategory.Error, "The_first_export_default_is_here_2752", "The first export default is here."), Another_export_default_is_here: diag(2753, ts.DiagnosticCategory.Error, "Another_export_default_is_here_2753", "Another export default is here."), + super_may_not_use_type_arguments: diag(2754, ts.DiagnosticCategory.Error, "super_may_not_use_type_arguments_2754", "'super' may not use type arguments."), Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."), Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."), Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."), @@ -5886,6 +6049,7 @@ var ts; Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4101, ts.DiagnosticCategory.Error, "Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4101", "Method '{0}' of exported interface has or is using name '{1}' from private module '{2}'."), Method_0_of_exported_interface_has_or_is_using_private_name_1: diag(4102, ts.DiagnosticCategory.Error, "Method_0_of_exported_interface_has_or_is_using_private_name_1_4102", "Method '{0}' of exported interface has or is using private name '{1}'."), Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1: diag(4103, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1_4103", "Type parameter '{0}' of exported mapped object type is using private name '{1}'."), + The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1: diag(4104, ts.DiagnosticCategory.Error, "The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1_4104", "The type '{0}' is 'readonly' and cannot be assigned to the mutable type '{1}'."), The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."), Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."), File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."), @@ -5919,6 +6083,8 @@ var ts; Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_esNext: diag(5071, ts.DiagnosticCategory.Error, "Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_5071", "Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs', 'amd', 'es2015' or 'esNext'."), Unknown_build_option_0: diag(5072, ts.DiagnosticCategory.Error, "Unknown_build_option_0_5072", "Unknown build option '{0}'."), Build_option_0_requires_a_value_of_type_1: diag(5073, ts.DiagnosticCategory.Error, "Build_option_0_requires_a_value_of_type_1_5073", "Build option '{0}' requires a value of type {1}."), + Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified: diag(5074, ts.DiagnosticCategory.Error, "Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBui_5074", "Option '--incremental' can only be specified using tsconfig, emitting to single file or when option `--tsBuildInfoFile` is specified."), + _0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2: diag(5075, ts.DiagnosticCategory.Error, "_0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_5075", "'{0}' is assignable to the constraint of type '{1}', but '{1}' could be instantiated with a different subtype of constraint '{2}'."), Generates_a_sourcemap_for_each_corresponding_d_ts_file: diag(6000, ts.DiagnosticCategory.Message, "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000", "Generates a sourcemap for each corresponding '.d.ts' file."), Concatenate_and_emit_output_to_single_file: diag(6001, ts.DiagnosticCategory.Message, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."), Generates_corresponding_d_ts_file: diag(6002, ts.DiagnosticCategory.Message, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."), @@ -6095,7 +6261,6 @@ var ts; Enable_strict_checking_of_property_initialization_in_classes: diag(6187, ts.DiagnosticCategory.Message, "Enable_strict_checking_of_property_initialization_in_classes_6187", "Enable strict checking of property initialization in classes."), Numeric_separators_are_not_allowed_here: diag(6188, ts.DiagnosticCategory.Error, "Numeric_separators_are_not_allowed_here_6188", "Numeric separators are not allowed here."), Multiple_consecutive_numeric_separators_are_not_permitted: diag(6189, ts.DiagnosticCategory.Error, "Multiple_consecutive_numeric_separators_are_not_permitted_6189", "Multiple consecutive numeric separators are not permitted."), - Found_package_json_at_0_Package_ID_is_1: diag(6190, ts.DiagnosticCategory.Message, "Found_package_json_at_0_Package_ID_is_1_6190", "Found 'package.json' at '{0}'. Package ID is '{1}'."), Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen: diag(6191, ts.DiagnosticCategory.Message, "Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191", "Whether to keep outdated console output in watch mode instead of clearing the screen."), All_imports_in_import_declaration_are_unused: diag(6192, ts.DiagnosticCategory.Error, "All_imports_in_import_declaration_are_unused_6192", "All imports in import declaration are unused.", /*reportsUnnecessary*/ true), Found_1_error_Watching_for_file_changes: diag(6193, ts.DiagnosticCategory.Message, "Found_1_error_Watching_for_file_changes_6193", "Found 1 error. Watching for file changes."), @@ -6122,6 +6287,9 @@ var ts; Using_compiler_options_of_project_reference_redirect_0: diag(6215, ts.DiagnosticCategory.Message, "Using_compiler_options_of_project_reference_redirect_0_6215", "Using compiler options of project reference redirect '{0}'."), Found_1_error: diag(6216, ts.DiagnosticCategory.Message, "Found_1_error_6216", "Found 1 error."), Found_0_errors: diag(6217, ts.DiagnosticCategory.Message, "Found_0_errors_6217", "Found {0} errors."), + Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2: diag(6218, ts.DiagnosticCategory.Message, "Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2_6218", "======== Module name '{0}' was successfully resolved to '{1}' with Package ID '{2}'. ========"), + Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3: diag(6219, ts.DiagnosticCategory.Message, "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219", "======== Type reference directive '{0}' was successfully resolved to '{1}' with Package ID '{2}', primary: {3}. ========"), + package_json_had_a_falsy_0_field: diag(6220, ts.DiagnosticCategory.Message, "package_json_had_a_falsy_0_field_6220", "'package.json' had a falsy '{0}' field."), Projects_to_reference: diag(6300, ts.DiagnosticCategory.Message, "Projects_to_reference_6300", "Projects to reference"), Enable_project_compilation: diag(6302, ts.DiagnosticCategory.Message, "Enable_project_compilation_6302", "Enable project compilation"), Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0: diag(6202, ts.DiagnosticCategory.Error, "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202", "Project references may not form a circular graph. Cycle detected: {0}"), @@ -6210,6 +6378,9 @@ var ts; Property_0_implicitly_has_type_any_but_a_better_type_for_its_set_accessor_may_be_inferred_from_usage: diag(7049, ts.DiagnosticCategory.Suggestion, "Property_0_implicitly_has_type_any_but_a_better_type_for_its_set_accessor_may_be_inferred_from_usage_7049", "Property '{0}' implicitly has type 'any', but a better type for its set accessor may be inferred from usage."), _0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage: diag(7050, ts.DiagnosticCategory.Suggestion, "_0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage_7050", "'{0}' implicitly has an '{1}' return type, but a better type may be inferred from usage."), Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1: diag(7051, ts.DiagnosticCategory.Error, "Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1_7051", "Parameter has a name but no type. Did you mean '{0}: {1}'?"), + Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1: diag(7052, ts.DiagnosticCategory.Error, "Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1_7052", "Element implicitly has an 'any' type because type '{0}' has no index signature. Did you mean to call '{1}' ?"), + Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1: diag(7053, ts.DiagnosticCategory.Error, "Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1_7053", "Element implicitly has an 'any' type because expression of type '{0}' can't be used to index type '{1}'."), + No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1: diag(7054, ts.DiagnosticCategory.Error, "No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1_7054", "No index signature with a parameter of type '{0}' was found on type '{1}'."), You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."), You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: diag(8001, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", "You cannot rename elements that are defined in the standard TypeScript library."), import_can_only_be_used_in_a_ts_file: diag(8002, ts.DiagnosticCategory.Error, "import_can_only_be_used_in_a_ts_file_8002", "'import ... =' can only be used in a .ts file."), @@ -6371,8 +6542,6 @@ var ts; Add_all_missing_imports: diag(95064, ts.DiagnosticCategory.Message, "Add_all_missing_imports_95064", "Add all missing imports"), Convert_to_async_function: diag(95065, ts.DiagnosticCategory.Message, "Convert_to_async_function_95065", "Convert to async function"), Convert_all_to_async_functions: diag(95066, ts.DiagnosticCategory.Message, "Convert_all_to_async_functions_95066", "Convert all to async functions"), - Generate_types_for_0: diag(95067, ts.DiagnosticCategory.Message, "Generate_types_for_0_95067", "Generate types for '{0}'"), - Generate_types_for_all_packages_without_types: diag(95068, ts.DiagnosticCategory.Message, "Generate_types_for_all_packages_without_types_95068", "Generate types for all packages without types"), Add_unknown_conversion_for_non_overlapping_types: diag(95069, ts.DiagnosticCategory.Message, "Add_unknown_conversion_for_non_overlapping_types_95069", "Add 'unknown' conversion for non-overlapping types"), Add_unknown_to_all_conversions_of_non_overlapping_types: diag(95070, ts.DiagnosticCategory.Message, "Add_unknown_to_all_conversions_of_non_overlapping_types_95070", "Add 'unknown' to all conversions of non-overlapping types"), Add_missing_new_operator_to_call: diag(95071, ts.DiagnosticCategory.Message, "Add_missing_new_operator_to_call_95071", "Add missing 'new' operator to call"), @@ -6380,6 +6549,13 @@ var ts; Add_names_to_all_parameters_without_names: diag(95073, ts.DiagnosticCategory.Message, "Add_names_to_all_parameters_without_names_95073", "Add names to all parameters without names"), Enable_the_experimentalDecorators_option_in_your_configuration_file: diag(95074, ts.DiagnosticCategory.Message, "Enable_the_experimentalDecorators_option_in_your_configuration_file_95074", "Enable the 'experimentalDecorators' option in your configuration file"), Convert_parameters_to_destructured_object: diag(95075, ts.DiagnosticCategory.Message, "Convert_parameters_to_destructured_object_95075", "Convert parameters to destructured object"), + Allow_accessing_UMD_globals_from_modules: diag(95076, ts.DiagnosticCategory.Message, "Allow_accessing_UMD_globals_from_modules_95076", "Allow accessing UMD globals from modules."), + Extract_type: diag(95077, ts.DiagnosticCategory.Message, "Extract_type_95077", "Extract type"), + Extract_to_type_alias: diag(95078, ts.DiagnosticCategory.Message, "Extract_to_type_alias_95078", "Extract to type alias"), + Extract_to_typedef: diag(95079, ts.DiagnosticCategory.Message, "Extract_to_typedef_95079", "Extract to typedef"), + No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts.DiagnosticCategory.Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."), + Quoted_constructors_have_previously_been_interpreted_as_methods_which_is_incorrect_In_TypeScript_3_6_they_will_be_correctly_parsed_as_constructors_In_the_meantime_consider_using_constructor_to_write_a_constructor_or_constructor_to_write_a_method: diag(18005, ts.DiagnosticCategory.Error, "Quoted_constructors_have_previously_been_interpreted_as_methods_which_is_incorrect_In_TypeScript_3_6_18005", "Quoted constructors have previously been interpreted as methods, which is incorrect. In TypeScript 3.6, they will be correctly parsed as constructors. In the meantime, consider using 'constructor()' to write a constructor, or '[\"constructor\"]()' to write a method."), + Classes_may_not_have_a_field_named_constructor: diag(18006, ts.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."), }; })(ts || (ts = {})); var ts; @@ -6387,7 +6563,7 @@ var ts; var _a; /* @internal */ function tokenIsIdentifierOrKeyword(token) { - return token >= 72 /* Identifier */; + return token >= 73 /* Identifier */; } ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; /* @internal */ @@ -6396,85 +6572,85 @@ var ts; } ts.tokenIsIdentifierOrKeywordOrGreaterThan = tokenIsIdentifierOrKeywordOrGreaterThan; var textToKeywordObj = (_a = { - abstract: 118 /* AbstractKeyword */, - any: 120 /* AnyKeyword */, - as: 119 /* AsKeyword */, - bigint: 146 /* BigIntKeyword */, - boolean: 123 /* BooleanKeyword */, - break: 73 /* BreakKeyword */, - case: 74 /* CaseKeyword */, - catch: 75 /* CatchKeyword */, - class: 76 /* ClassKeyword */, - continue: 78 /* ContinueKeyword */, - const: 77 /* ConstKeyword */ + abstract: 119 /* AbstractKeyword */, + any: 121 /* AnyKeyword */, + as: 120 /* AsKeyword */, + bigint: 147 /* BigIntKeyword */, + boolean: 124 /* BooleanKeyword */, + break: 74 /* BreakKeyword */, + case: 75 /* CaseKeyword */, + catch: 76 /* CatchKeyword */, + class: 77 /* ClassKeyword */, + continue: 79 /* ContinueKeyword */, + const: 78 /* ConstKeyword */ }, - _a["" + "constructor"] = 124 /* ConstructorKeyword */, - _a.debugger = 79 /* DebuggerKeyword */, - _a.declare = 125 /* DeclareKeyword */, - _a.default = 80 /* DefaultKeyword */, - _a.delete = 81 /* DeleteKeyword */, - _a.do = 82 /* DoKeyword */, - _a.else = 83 /* ElseKeyword */, - _a.enum = 84 /* EnumKeyword */, - _a.export = 85 /* ExportKeyword */, - _a.extends = 86 /* ExtendsKeyword */, - _a.false = 87 /* FalseKeyword */, - _a.finally = 88 /* FinallyKeyword */, - _a.for = 89 /* ForKeyword */, - _a.from = 144 /* FromKeyword */, - _a.function = 90 /* FunctionKeyword */, - _a.get = 126 /* GetKeyword */, - _a.if = 91 /* IfKeyword */, - _a.implements = 109 /* ImplementsKeyword */, - _a.import = 92 /* ImportKeyword */, - _a.in = 93 /* InKeyword */, - _a.infer = 127 /* InferKeyword */, - _a.instanceof = 94 /* InstanceOfKeyword */, - _a.interface = 110 /* InterfaceKeyword */, - _a.is = 128 /* IsKeyword */, - _a.keyof = 129 /* KeyOfKeyword */, - _a.let = 111 /* LetKeyword */, - _a.module = 130 /* ModuleKeyword */, - _a.namespace = 131 /* NamespaceKeyword */, - _a.never = 132 /* NeverKeyword */, - _a.new = 95 /* NewKeyword */, - _a.null = 96 /* NullKeyword */, - _a.number = 135 /* NumberKeyword */, - _a.object = 136 /* ObjectKeyword */, - _a.package = 112 /* PackageKeyword */, - _a.private = 113 /* PrivateKeyword */, - _a.protected = 114 /* ProtectedKeyword */, - _a.public = 115 /* PublicKeyword */, - _a.readonly = 133 /* ReadonlyKeyword */, - _a.require = 134 /* RequireKeyword */, - _a.global = 145 /* GlobalKeyword */, - _a.return = 97 /* ReturnKeyword */, - _a.set = 137 /* SetKeyword */, - _a.static = 116 /* StaticKeyword */, - _a.string = 138 /* StringKeyword */, - _a.super = 98 /* SuperKeyword */, - _a.switch = 99 /* SwitchKeyword */, - _a.symbol = 139 /* SymbolKeyword */, - _a.this = 100 /* ThisKeyword */, - _a.throw = 101 /* ThrowKeyword */, - _a.true = 102 /* TrueKeyword */, - _a.try = 103 /* TryKeyword */, - _a.type = 140 /* TypeKeyword */, - _a.typeof = 104 /* TypeOfKeyword */, - _a.undefined = 141 /* UndefinedKeyword */, - _a.unique = 142 /* UniqueKeyword */, - _a.unknown = 143 /* UnknownKeyword */, - _a.var = 105 /* VarKeyword */, - _a.void = 106 /* VoidKeyword */, - _a.while = 107 /* WhileKeyword */, - _a.with = 108 /* WithKeyword */, - _a.yield = 117 /* YieldKeyword */, - _a.async = 121 /* AsyncKeyword */, - _a.await = 122 /* AwaitKeyword */, - _a.of = 147 /* OfKeyword */, + _a["" + "constructor"] = 125 /* ConstructorKeyword */, + _a.debugger = 80 /* DebuggerKeyword */, + _a.declare = 126 /* DeclareKeyword */, + _a.default = 81 /* DefaultKeyword */, + _a.delete = 82 /* DeleteKeyword */, + _a.do = 83 /* DoKeyword */, + _a.else = 84 /* ElseKeyword */, + _a.enum = 85 /* EnumKeyword */, + _a.export = 86 /* ExportKeyword */, + _a.extends = 87 /* ExtendsKeyword */, + _a.false = 88 /* FalseKeyword */, + _a.finally = 89 /* FinallyKeyword */, + _a.for = 90 /* ForKeyword */, + _a.from = 145 /* FromKeyword */, + _a.function = 91 /* FunctionKeyword */, + _a.get = 127 /* GetKeyword */, + _a.if = 92 /* IfKeyword */, + _a.implements = 110 /* ImplementsKeyword */, + _a.import = 93 /* ImportKeyword */, + _a.in = 94 /* InKeyword */, + _a.infer = 128 /* InferKeyword */, + _a.instanceof = 95 /* InstanceOfKeyword */, + _a.interface = 111 /* InterfaceKeyword */, + _a.is = 129 /* IsKeyword */, + _a.keyof = 130 /* KeyOfKeyword */, + _a.let = 112 /* LetKeyword */, + _a.module = 131 /* ModuleKeyword */, + _a.namespace = 132 /* NamespaceKeyword */, + _a.never = 133 /* NeverKeyword */, + _a.new = 96 /* NewKeyword */, + _a.null = 97 /* NullKeyword */, + _a.number = 136 /* NumberKeyword */, + _a.object = 137 /* ObjectKeyword */, + _a.package = 113 /* PackageKeyword */, + _a.private = 114 /* PrivateKeyword */, + _a.protected = 115 /* ProtectedKeyword */, + _a.public = 116 /* PublicKeyword */, + _a.readonly = 134 /* ReadonlyKeyword */, + _a.require = 135 /* RequireKeyword */, + _a.global = 146 /* GlobalKeyword */, + _a.return = 98 /* ReturnKeyword */, + _a.set = 138 /* SetKeyword */, + _a.static = 117 /* StaticKeyword */, + _a.string = 139 /* StringKeyword */, + _a.super = 99 /* SuperKeyword */, + _a.switch = 100 /* SwitchKeyword */, + _a.symbol = 140 /* SymbolKeyword */, + _a.this = 101 /* ThisKeyword */, + _a.throw = 102 /* ThrowKeyword */, + _a.true = 103 /* TrueKeyword */, + _a.try = 104 /* TryKeyword */, + _a.type = 141 /* TypeKeyword */, + _a.typeof = 105 /* TypeOfKeyword */, + _a.undefined = 142 /* UndefinedKeyword */, + _a.unique = 143 /* UniqueKeyword */, + _a.unknown = 144 /* UnknownKeyword */, + _a.var = 106 /* VarKeyword */, + _a.void = 107 /* VoidKeyword */, + _a.while = 108 /* WhileKeyword */, + _a.with = 109 /* WithKeyword */, + _a.yield = 118 /* YieldKeyword */, + _a.async = 122 /* AsyncKeyword */, + _a.await = 123 /* AwaitKeyword */, + _a.of = 148 /* OfKeyword */, _a); var textToKeyword = ts.createMapFromTemplate(textToKeywordObj); - var textToToken = ts.createMapFromTemplate(__assign({}, textToKeywordObj, { "{": 18 /* OpenBraceToken */, "}": 19 /* CloseBraceToken */, "(": 20 /* OpenParenToken */, ")": 21 /* CloseParenToken */, "[": 22 /* OpenBracketToken */, "]": 23 /* CloseBracketToken */, ".": 24 /* DotToken */, "...": 25 /* DotDotDotToken */, ";": 26 /* SemicolonToken */, ",": 27 /* CommaToken */, "<": 28 /* LessThanToken */, ">": 30 /* GreaterThanToken */, "<=": 31 /* LessThanEqualsToken */, ">=": 32 /* GreaterThanEqualsToken */, "==": 33 /* EqualsEqualsToken */, "!=": 34 /* ExclamationEqualsToken */, "===": 35 /* EqualsEqualsEqualsToken */, "!==": 36 /* ExclamationEqualsEqualsToken */, "=>": 37 /* EqualsGreaterThanToken */, "+": 38 /* PlusToken */, "-": 39 /* MinusToken */, "**": 41 /* AsteriskAsteriskToken */, "*": 40 /* AsteriskToken */, "/": 42 /* SlashToken */, "%": 43 /* PercentToken */, "++": 44 /* PlusPlusToken */, "--": 45 /* MinusMinusToken */, "<<": 46 /* LessThanLessThanToken */, ">": 47 /* GreaterThanGreaterThanToken */, ">>>": 48 /* GreaterThanGreaterThanGreaterThanToken */, "&": 49 /* AmpersandToken */, "|": 50 /* BarToken */, "^": 51 /* CaretToken */, "!": 52 /* ExclamationToken */, "~": 53 /* TildeToken */, "&&": 54 /* AmpersandAmpersandToken */, "||": 55 /* BarBarToken */, "?": 56 /* QuestionToken */, ":": 57 /* ColonToken */, "=": 59 /* EqualsToken */, "+=": 60 /* PlusEqualsToken */, "-=": 61 /* MinusEqualsToken */, "*=": 62 /* AsteriskEqualsToken */, "**=": 63 /* AsteriskAsteriskEqualsToken */, "/=": 64 /* SlashEqualsToken */, "%=": 65 /* PercentEqualsToken */, "<<=": 66 /* LessThanLessThanEqualsToken */, ">>=": 67 /* GreaterThanGreaterThanEqualsToken */, ">>>=": 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 69 /* AmpersandEqualsToken */, "|=": 70 /* BarEqualsToken */, "^=": 71 /* CaretEqualsToken */, "@": 58 /* AtToken */ })); + var textToToken = ts.createMapFromTemplate(__assign({}, textToKeywordObj, { "{": 18 /* OpenBraceToken */, "}": 19 /* CloseBraceToken */, "(": 20 /* OpenParenToken */, ")": 21 /* CloseParenToken */, "[": 22 /* OpenBracketToken */, "]": 23 /* CloseBracketToken */, ".": 24 /* DotToken */, "...": 25 /* DotDotDotToken */, ";": 26 /* SemicolonToken */, ",": 27 /* CommaToken */, "<": 28 /* LessThanToken */, ">": 30 /* GreaterThanToken */, "<=": 31 /* LessThanEqualsToken */, ">=": 32 /* GreaterThanEqualsToken */, "==": 33 /* EqualsEqualsToken */, "!=": 34 /* ExclamationEqualsToken */, "===": 35 /* EqualsEqualsEqualsToken */, "!==": 36 /* ExclamationEqualsEqualsToken */, "=>": 37 /* EqualsGreaterThanToken */, "+": 38 /* PlusToken */, "-": 39 /* MinusToken */, "**": 41 /* AsteriskAsteriskToken */, "*": 40 /* AsteriskToken */, "/": 42 /* SlashToken */, "%": 43 /* PercentToken */, "++": 44 /* PlusPlusToken */, "--": 45 /* MinusMinusToken */, "<<": 46 /* LessThanLessThanToken */, ">": 47 /* GreaterThanGreaterThanToken */, ">>>": 48 /* GreaterThanGreaterThanGreaterThanToken */, "&": 49 /* AmpersandToken */, "|": 50 /* BarToken */, "^": 51 /* CaretToken */, "!": 52 /* ExclamationToken */, "~": 53 /* TildeToken */, "&&": 54 /* AmpersandAmpersandToken */, "||": 55 /* BarBarToken */, "?": 56 /* QuestionToken */, ":": 57 /* ColonToken */, "=": 60 /* EqualsToken */, "+=": 61 /* PlusEqualsToken */, "-=": 62 /* MinusEqualsToken */, "*=": 63 /* AsteriskEqualsToken */, "**=": 64 /* AsteriskAsteriskEqualsToken */, "/=": 65 /* SlashEqualsToken */, "%=": 66 /* PercentEqualsToken */, "<<=": 67 /* LessThanLessThanEqualsToken */, ">>=": 68 /* GreaterThanGreaterThanEqualsToken */, ">>>=": 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 70 /* AmpersandEqualsToken */, "|=": 71 /* BarEqualsToken */, "^=": 72 /* CaretEqualsToken */, "@": 58 /* AtToken */ })); /* As per ECMAScript Language Specification 3th Edition, Section 7.6: Identifiers IdentifierStart :: @@ -7088,8 +7264,8 @@ var ts; getTokenValue: function () { return tokenValue; }, hasExtendedUnicodeEscape: function () { return (tokenFlags & 8 /* ExtendedUnicodeEscape */) !== 0; }, hasPrecedingLineBreak: function () { return (tokenFlags & 1 /* PrecedingLineBreak */) !== 0; }, - isIdentifier: function () { return token === 72 /* Identifier */ || token > 108 /* LastReservedWord */; }, - isReservedWord: function () { return token >= 73 /* FirstReservedWord */ && token <= 108 /* LastReservedWord */; }, + isIdentifier: function () { return token === 73 /* Identifier */ || token > 109 /* LastReservedWord */; }, + isReservedWord: function () { return token >= 74 /* FirstReservedWord */ && token <= 109 /* LastReservedWord */; }, isUnterminated: function () { return (tokenFlags & 4 /* Unterminated */) !== 0; }, getTokenFlags: function () { return tokenFlags; }, reScanGreaterToken: reScanGreaterToken, @@ -7100,7 +7276,7 @@ var ts; reScanJsxToken: reScanJsxToken, reScanLessThanToken: reScanLessThanToken, scanJsxToken: scanJsxToken, - scanJSDocToken: scanJSDocToken, + scanJsDocToken: scanJsDocToken, scan: scan, getText: getText, setText: setText, @@ -7540,7 +7716,7 @@ var ts; } } } - return token = 72 /* Identifier */; + return token = 73 /* Identifier */; } function scanBinaryOrOctalDigits(base) { var value = ""; @@ -7689,7 +7865,7 @@ var ts; return token = scanTemplateAndSetTokenValue(); case 37 /* percent */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 65 /* PercentEqualsToken */; + return pos += 2, token = 66 /* PercentEqualsToken */; } pos++; return token = 43 /* PercentToken */; @@ -7698,7 +7874,7 @@ var ts; return pos += 2, token = 54 /* AmpersandAmpersandToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 69 /* AmpersandEqualsToken */; + return pos += 2, token = 70 /* AmpersandEqualsToken */; } pos++; return token = 49 /* AmpersandToken */; @@ -7710,11 +7886,11 @@ var ts; return token = 21 /* CloseParenToken */; case 42 /* asterisk */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 62 /* AsteriskEqualsToken */; + return pos += 2, token = 63 /* AsteriskEqualsToken */; } if (text.charCodeAt(pos + 1) === 42 /* asterisk */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 63 /* AsteriskAsteriskEqualsToken */; + return pos += 3, token = 64 /* AsteriskAsteriskEqualsToken */; } return pos += 2, token = 41 /* AsteriskAsteriskToken */; } @@ -7730,7 +7906,7 @@ var ts; return pos += 2, token = 44 /* PlusPlusToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 60 /* PlusEqualsToken */; + return pos += 2, token = 61 /* PlusEqualsToken */; } pos++; return token = 38 /* PlusToken */; @@ -7742,7 +7918,7 @@ var ts; return pos += 2, token = 45 /* MinusMinusToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 61 /* MinusEqualsToken */; + return pos += 2, token = 62 /* MinusEqualsToken */; } pos++; return token = 39 /* MinusToken */; @@ -7806,7 +7982,7 @@ var ts; } } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 64 /* SlashEqualsToken */; + return pos += 2, token = 65 /* SlashEqualsToken */; } pos++; return token = 42 /* SlashToken */; @@ -7883,7 +8059,7 @@ var ts; } if (text.charCodeAt(pos + 1) === 60 /* lessThan */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 66 /* LessThanLessThanEqualsToken */; + return pos += 3, token = 67 /* LessThanLessThanEqualsToken */; } return pos += 2, token = 46 /* LessThanLessThanToken */; } @@ -7917,7 +8093,7 @@ var ts; return pos += 2, token = 37 /* EqualsGreaterThanToken */; } pos++; - return token = 59 /* EqualsToken */; + return token = 60 /* EqualsToken */; case 62 /* greaterThan */: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -7941,7 +8117,7 @@ var ts; return token = 23 /* CloseBracketToken */; case 94 /* caret */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 71 /* CaretEqualsToken */; + return pos += 2, token = 72 /* CaretEqualsToken */; } pos++; return token = 51 /* CaretToken */; @@ -7962,7 +8138,7 @@ var ts; return pos += 2, token = 55 /* BarBarToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 70 /* BarEqualsToken */; + return pos += 2, token = 71 /* BarEqualsToken */; } pos++; return token = 50 /* BarToken */; @@ -8016,12 +8192,12 @@ var ts; if (text.charCodeAt(pos) === 62 /* greaterThan */) { if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */; + return pos += 3, token = 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */; } return pos += 2, token = 48 /* GreaterThanGreaterThanGreaterThanToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 67 /* GreaterThanGreaterThanEqualsToken */; + return pos += 2, token = 68 /* GreaterThanGreaterThanEqualsToken */; } pos++; return token = 47 /* GreaterThanGreaterThanToken */; @@ -8034,7 +8210,7 @@ var ts; return token; } function reScanSlashToken() { - if (token === 42 /* SlashToken */ || token === 64 /* SlashEqualsToken */) { + if (token === 42 /* SlashToken */ || token === 65 /* SlashEqualsToken */) { var p = tokenPos + 1; var inEscape = false; var inCharacterClass = false; @@ -8183,7 +8359,7 @@ var ts; return scan(); } } - function scanJSDocToken() { + function scanJsDocToken() { startPos = tokenPos = pos; tokenFlags = 0; if (pos >= end) { @@ -8219,21 +8395,16 @@ var ts; case 60 /* lessThan */: return token = 28 /* LessThanToken */; case 61 /* equals */: - return token = 59 /* EqualsToken */; + return token = 60 /* EqualsToken */; case 44 /* comma */: return token = 27 /* CommaToken */; case 46 /* dot */: return token = 24 /* DotToken */; case 96 /* backtick */: - while (pos < end && text.charCodeAt(pos) !== 96 /* backtick */) { - pos++; - } - tokenValue = text.substring(tokenPos + 1, pos); - pos++; - return token = 14 /* NoSubstitutionTemplateLiteral */; + return token = 59 /* BacktickToken */; } - if (isIdentifierStart(ch, 7 /* Latest */)) { - while (isIdentifierPart(text.charCodeAt(pos), 7 /* Latest */) && pos < end) { + if (isIdentifierStart(ch, 8 /* Latest */)) { + while (isIdentifierPart(text.charCodeAt(pos), 8 /* Latest */) && pos < end) { pos++; } tokenValue = text.substring(tokenPos, pos); @@ -8418,11 +8589,16 @@ var ts; } ts.toPath = toPath; function changesAffectModuleResolution(oldOptions, newOptions) { - return oldOptions.configFilePath !== newOptions.configFilePath || ts.moduleResolutionOptionDeclarations.some(function (o) { + return oldOptions.configFilePath !== newOptions.configFilePath || + optionsHaveModuleResolutionChanges(oldOptions, newOptions); + } + ts.changesAffectModuleResolution = changesAffectModuleResolution; + function optionsHaveModuleResolutionChanges(oldOptions, newOptions) { + return ts.moduleResolutionOptionDeclarations.some(function (o) { return !ts.isJsonEqual(ts.getCompilerOptionValue(oldOptions, o), ts.getCompilerOptionValue(newOptions, o)); }); } - ts.changesAffectModuleResolution = changesAffectModuleResolution; + ts.optionsHaveModuleResolutionChanges = optionsHaveModuleResolutionChanges; function findAncestor(node, callback) { while (node) { var result = callback(node); @@ -8591,7 +8767,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 284 /* SourceFile */) { + while (node && node.kind !== 285 /* SourceFile */) { node = node.parent; } return node; @@ -8599,11 +8775,11 @@ var ts; ts.getSourceFileOfNode = getSourceFileOfNode; function isStatementWithLocals(node) { switch (node.kind) { - case 218 /* Block */: - case 246 /* CaseBlock */: - case 225 /* ForStatement */: - case 226 /* ForInStatement */: - case 227 /* ForOfStatement */: + case 219 /* Block */: + case 247 /* CaseBlock */: + case 226 /* ForStatement */: + case 227 /* ForInStatement */: + case 228 /* ForOfStatement */: return true; } return false; @@ -8771,7 +8947,7 @@ var ts; // the syntax list itself considers them as normal trivia. Therefore if we simply skip // trivia for the list, we may have skipped the JSDocComment as well. So we should process its // first child to determine the actual position of its first token. - if (node.kind === 311 /* SyntaxList */ && node._children.length > 0) { + if (node.kind === 312 /* SyntaxList */ && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); @@ -8790,7 +8966,7 @@ var ts; } ts.getSourceTextOfNodeFromSourceFile = getSourceTextOfNodeFromSourceFile; function isJSDocTypeExpressionOrChild(node) { - return node.kind === 288 /* JSDocTypeExpression */ || (node.parent && isJSDocTypeExpressionOrChild(node.parent)); + return node.kind === 289 /* JSDocTypeExpression */ || (node.parent && isJSDocTypeExpressionOrChild(node.parent)); } function getTextOfNodeFromSourceText(sourceText, node, includeTrivia) { if (includeTrivia === void 0) { includeTrivia = false; } @@ -8882,7 +9058,7 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 237 /* VariableDeclaration */ && node.parent.kind === 274 /* CatchClause */; + return node.kind === 238 /* VariableDeclaration */ && node.parent.kind === 275 /* CatchClause */; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { @@ -8914,11 +9090,11 @@ var ts; ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { // The only kind of module that can be missing a body is a shorthand ambient module. - return node && node.kind === 244 /* ModuleDeclaration */ && (!node.body); + return node && node.kind === 245 /* ModuleDeclaration */ && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 284 /* SourceFile */ || - node.kind === 244 /* ModuleDeclaration */ || + return node.kind === 285 /* SourceFile */ || + node.kind === 245 /* ModuleDeclaration */ || ts.isFunctionLike(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -8935,9 +9111,9 @@ var ts; // - defined in the top level scope and source file is an external module // - defined inside ambient module declaration located in the top level scope and source file not an external module switch (node.parent.kind) { - case 284 /* SourceFile */: + case 285 /* SourceFile */: return ts.isExternalModule(node.parent); - case 245 /* ModuleBlock */: + case 246 /* ModuleBlock */: return isAmbientModule(node.parent.parent) && ts.isSourceFile(node.parent.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -8953,22 +9129,22 @@ var ts; ts.isEffectiveExternalModule = isEffectiveExternalModule; function isBlockScope(node, parentNode) { switch (node.kind) { - case 284 /* SourceFile */: - case 246 /* CaseBlock */: - case 274 /* CatchClause */: - case 244 /* ModuleDeclaration */: - case 225 /* ForStatement */: - case 226 /* ForInStatement */: - case 227 /* ForOfStatement */: - case 157 /* Constructor */: - case 156 /* MethodDeclaration */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: + case 285 /* SourceFile */: + case 247 /* CaseBlock */: + case 275 /* CatchClause */: + case 245 /* ModuleDeclaration */: + case 226 /* ForStatement */: + case 227 /* ForInStatement */: + case 228 /* ForOfStatement */: + case 158 /* Constructor */: + case 157 /* MethodDeclaration */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: return true; - case 218 /* Block */: + case 219 /* Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block return !ts.isFunctionLike(parentNode); @@ -8978,9 +9154,9 @@ var ts; ts.isBlockScope = isBlockScope; function isDeclarationWithTypeParameters(node) { switch (node.kind) { - case 302 /* JSDocCallbackTag */: - case 309 /* JSDocTypedefTag */: - case 298 /* JSDocSignature */: + case 303 /* JSDocCallbackTag */: + case 310 /* JSDocTypedefTag */: + case 299 /* JSDocSignature */: return true; default: ts.assertType(node); @@ -8990,25 +9166,25 @@ var ts; ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters; function isDeclarationWithTypeParameterChildren(node) { switch (node.kind) { - case 160 /* CallSignature */: - case 161 /* ConstructSignature */: - case 155 /* MethodSignature */: - case 162 /* IndexSignature */: - case 165 /* FunctionType */: - case 166 /* ConstructorType */: - case 294 /* JSDocFunctionType */: - case 240 /* ClassDeclaration */: - case 209 /* ClassExpression */: - case 241 /* InterfaceDeclaration */: - case 242 /* TypeAliasDeclaration */: - case 308 /* JSDocTemplateTag */: - case 239 /* FunctionDeclaration */: - case 156 /* MethodDeclaration */: - case 157 /* Constructor */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: + case 161 /* CallSignature */: + case 162 /* ConstructSignature */: + case 156 /* MethodSignature */: + case 163 /* IndexSignature */: + case 166 /* FunctionType */: + case 167 /* ConstructorType */: + case 295 /* JSDocFunctionType */: + case 241 /* ClassDeclaration */: + case 210 /* ClassExpression */: + case 242 /* InterfaceDeclaration */: + case 243 /* TypeAliasDeclaration */: + case 309 /* JSDocTemplateTag */: + case 240 /* FunctionDeclaration */: + case 157 /* MethodDeclaration */: + case 158 /* Constructor */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: return true; default: ts.assertType(node); @@ -9018,8 +9194,8 @@ var ts; ts.isDeclarationWithTypeParameterChildren = isDeclarationWithTypeParameterChildren; function isAnyImportSyntax(node) { switch (node.kind) { - case 249 /* ImportDeclaration */: - case 248 /* ImportEqualsDeclaration */: + case 250 /* ImportDeclaration */: + case 249 /* ImportEqualsDeclaration */: return true; default: return false; @@ -9028,15 +9204,15 @@ var ts; ts.isAnyImportSyntax = isAnyImportSyntax; function isLateVisibilityPaintedStatement(node) { switch (node.kind) { - case 249 /* ImportDeclaration */: - case 248 /* ImportEqualsDeclaration */: - case 219 /* VariableStatement */: - case 240 /* ClassDeclaration */: - case 239 /* FunctionDeclaration */: - case 244 /* ModuleDeclaration */: - case 242 /* TypeAliasDeclaration */: - case 241 /* InterfaceDeclaration */: - case 243 /* EnumDeclaration */: + case 250 /* ImportDeclaration */: + case 249 /* ImportEqualsDeclaration */: + case 220 /* VariableStatement */: + case 241 /* ClassDeclaration */: + case 240 /* FunctionDeclaration */: + case 245 /* ModuleDeclaration */: + case 243 /* TypeAliasDeclaration */: + case 242 /* InterfaceDeclaration */: + case 244 /* EnumDeclaration */: return true; default: return false; @@ -9066,13 +9242,13 @@ var ts; ts.getNameFromIndexInfo = getNameFromIndexInfo; function getTextOfPropertyName(name) { switch (name.kind) { - case 72 /* Identifier */: + case 73 /* Identifier */: return name.escapedText; case 10 /* StringLiteral */: case 8 /* NumericLiteral */: case 14 /* NoSubstitutionTemplateLiteral */: return ts.escapeLeadingUnderscores(name.text); - case 149 /* ComputedPropertyName */: + case 150 /* ComputedPropertyName */: if (isStringOrNumericLiteralLike(name.expression)) return ts.escapeLeadingUnderscores(name.expression.text); return ts.Debug.fail("Text of property name cannot be read from non-literal-valued ComputedPropertyNames"); @@ -9083,11 +9259,11 @@ var ts; ts.getTextOfPropertyName = getTextOfPropertyName; function entityNameToString(name) { switch (name.kind) { - case 72 /* Identifier */: + case 73 /* Identifier */: return getFullWidth(name) === 0 ? ts.idText(name) : getTextOfNode(name); - case 148 /* QualifiedName */: + case 149 /* QualifiedName */: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 189 /* PropertyAccessExpression */: + case 190 /* PropertyAccessExpression */: return entityNameToString(name.expression) + "." + entityNameToString(name.name); default: throw ts.Debug.assertNever(name); @@ -9132,7 +9308,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 218 /* Block */) { + if (node.body && node.body.kind === 219 /* Block */) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -9146,7 +9322,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 284 /* SourceFile */: + case 285 /* SourceFile */: var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); if (pos_1 === sourceFile.text.length) { // file is empty - return span for the beginning of the file @@ -9155,25 +9331,25 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 237 /* VariableDeclaration */: - case 186 /* BindingElement */: - case 240 /* ClassDeclaration */: - case 209 /* ClassExpression */: - case 241 /* InterfaceDeclaration */: - case 244 /* ModuleDeclaration */: - case 243 /* EnumDeclaration */: - case 278 /* EnumMember */: - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: - case 156 /* MethodDeclaration */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 242 /* TypeAliasDeclaration */: - case 154 /* PropertyDeclaration */: - case 153 /* PropertySignature */: + case 238 /* VariableDeclaration */: + case 187 /* BindingElement */: + case 241 /* ClassDeclaration */: + case 210 /* ClassExpression */: + case 242 /* InterfaceDeclaration */: + case 245 /* ModuleDeclaration */: + case 244 /* EnumDeclaration */: + case 279 /* EnumMember */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: + case 157 /* MethodDeclaration */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 243 /* TypeAliasDeclaration */: + case 155 /* PropertyDeclaration */: + case 154 /* PropertySignature */: errorNode = node.name; break; - case 197 /* ArrowFunction */: + case 198 /* ArrowFunction */: return getErrorSpanForArrowFunction(sourceFile, node); } if (errorNode === undefined) { @@ -9222,11 +9398,11 @@ var ts; } ts.isLet = isLet; function isSuperCall(n) { - return n.kind === 191 /* CallExpression */ && n.expression.kind === 98 /* SuperKeyword */; + return n.kind === 192 /* CallExpression */ && n.expression.kind === 99 /* SuperKeyword */; } ts.isSuperCall = isSuperCall; function isImportCall(n) { - return n.kind === 191 /* CallExpression */ && n.expression.kind === 92 /* ImportKeyword */; + return n.kind === 192 /* CallExpression */ && n.expression.kind === 93 /* ImportKeyword */; } ts.isImportCall = isImportCall; function isLiteralImportTypeNode(n) { @@ -9234,7 +9410,7 @@ var ts; } ts.isLiteralImportTypeNode = isLiteralImportTypeNode; function isPrologueDirective(node) { - return node.kind === 221 /* ExpressionStatement */ + return node.kind === 222 /* ExpressionStatement */ && node.expression.kind === 10 /* StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; @@ -9243,11 +9419,11 @@ var ts; } ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; function getJSDocCommentRanges(node, text) { - var commentRanges = (node.kind === 151 /* Parameter */ || - node.kind === 150 /* TypeParameter */ || - node.kind === 196 /* FunctionExpression */ || - node.kind === 197 /* ArrowFunction */ || - node.kind === 195 /* ParenthesizedExpression */) ? + var commentRanges = (node.kind === 152 /* Parameter */ || + node.kind === 151 /* TypeParameter */ || + node.kind === 197 /* FunctionExpression */ || + node.kind === 198 /* ArrowFunction */ || + node.kind === 196 /* ParenthesizedExpression */) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : ts.getLeadingCommentRanges(text, node.pos); // True if the comment starts with '/**' but not if it is '/**/' @@ -9263,48 +9439,48 @@ var ts; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; var defaultLibReferenceRegEx = /^(\/\/\/\s*/; function isPartOfTypeNode(node) { - if (163 /* FirstTypeNode */ <= node.kind && node.kind <= 183 /* LastTypeNode */) { + if (164 /* FirstTypeNode */ <= node.kind && node.kind <= 184 /* LastTypeNode */) { return true; } switch (node.kind) { - case 120 /* AnyKeyword */: - case 143 /* UnknownKeyword */: - case 135 /* NumberKeyword */: - case 146 /* BigIntKeyword */: - case 138 /* StringKeyword */: - case 123 /* BooleanKeyword */: - case 139 /* SymbolKeyword */: - case 136 /* ObjectKeyword */: - case 141 /* UndefinedKeyword */: - case 132 /* NeverKeyword */: + case 121 /* AnyKeyword */: + case 144 /* UnknownKeyword */: + case 136 /* NumberKeyword */: + case 147 /* BigIntKeyword */: + case 139 /* StringKeyword */: + case 124 /* BooleanKeyword */: + case 140 /* SymbolKeyword */: + case 137 /* ObjectKeyword */: + case 142 /* UndefinedKeyword */: + case 133 /* NeverKeyword */: return true; - case 106 /* VoidKeyword */: - return node.parent.kind !== 200 /* VoidExpression */; - case 211 /* ExpressionWithTypeArguments */: + case 107 /* VoidKeyword */: + return node.parent.kind !== 201 /* VoidExpression */; + case 212 /* ExpressionWithTypeArguments */: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); - case 150 /* TypeParameter */: - return node.parent.kind === 181 /* MappedType */ || node.parent.kind === 176 /* InferType */; + case 151 /* TypeParameter */: + return node.parent.kind === 182 /* MappedType */ || node.parent.kind === 177 /* InferType */; // Identifiers and qualified names may be type nodes, depending on their context. Climb // above them to find the lowest container - case 72 /* Identifier */: + case 73 /* Identifier */: // If the identifier is the RHS of a qualified name, then it's a type iff its parent is. - if (node.parent.kind === 148 /* QualifiedName */ && node.parent.right === node) { + if (node.parent.kind === 149 /* QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 189 /* PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.name === node) { node = node.parent; } // At this point, node is either a qualified name or an identifier - ts.Debug.assert(node.kind === 72 /* Identifier */ || node.kind === 148 /* QualifiedName */ || node.kind === 189 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + ts.Debug.assert(node.kind === 73 /* Identifier */ || node.kind === 149 /* QualifiedName */ || node.kind === 190 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); // falls through - case 148 /* QualifiedName */: - case 189 /* PropertyAccessExpression */: - case 100 /* ThisKeyword */: { + case 149 /* QualifiedName */: + case 190 /* PropertyAccessExpression */: + case 101 /* ThisKeyword */: { var parent = node.parent; - if (parent.kind === 167 /* TypeQuery */) { + if (parent.kind === 168 /* TypeQuery */) { return false; } - if (parent.kind === 183 /* ImportType */) { + if (parent.kind === 184 /* ImportType */) { return !parent.isTypeOf; } // Do not recursively call isPartOfTypeNode on the parent. In the example: @@ -9313,40 +9489,40 @@ var ts; // // Calling isPartOfTypeNode would consider the qualified name A.B a type node. // Only C and A.B.C are type nodes. - if (163 /* FirstTypeNode */ <= parent.kind && parent.kind <= 183 /* LastTypeNode */) { + if (164 /* FirstTypeNode */ <= parent.kind && parent.kind <= 184 /* LastTypeNode */) { return true; } switch (parent.kind) { - case 211 /* ExpressionWithTypeArguments */: + case 212 /* ExpressionWithTypeArguments */: return !isExpressionWithTypeArgumentsInClassExtendsClause(parent); - case 150 /* TypeParameter */: + case 151 /* TypeParameter */: return node === parent.constraint; - case 308 /* JSDocTemplateTag */: + case 309 /* JSDocTemplateTag */: return node === parent.constraint; - case 154 /* PropertyDeclaration */: - case 153 /* PropertySignature */: - case 151 /* Parameter */: - case 237 /* VariableDeclaration */: + case 155 /* PropertyDeclaration */: + case 154 /* PropertySignature */: + case 152 /* Parameter */: + case 238 /* VariableDeclaration */: return node === parent.type; - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: - case 157 /* Constructor */: - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: + case 158 /* Constructor */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: return node === parent.type; - case 160 /* CallSignature */: - case 161 /* ConstructSignature */: - case 162 /* IndexSignature */: + case 161 /* CallSignature */: + case 162 /* ConstructSignature */: + case 163 /* IndexSignature */: return node === parent.type; - case 194 /* TypeAssertionExpression */: + case 195 /* TypeAssertionExpression */: return node === parent.type; - case 191 /* CallExpression */: - case 192 /* NewExpression */: + case 192 /* CallExpression */: + case 193 /* NewExpression */: return ts.contains(parent.typeArguments, node); - case 193 /* TaggedTemplateExpression */: + case 194 /* TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } @@ -9371,23 +9547,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 230 /* ReturnStatement */: + case 231 /* ReturnStatement */: return visitor(node); - case 246 /* CaseBlock */: - case 218 /* Block */: - case 222 /* IfStatement */: - case 223 /* DoStatement */: - case 224 /* WhileStatement */: - case 225 /* ForStatement */: - case 226 /* ForInStatement */: - case 227 /* ForOfStatement */: - case 231 /* WithStatement */: - case 232 /* SwitchStatement */: - case 271 /* CaseClause */: - case 272 /* DefaultClause */: - case 233 /* LabeledStatement */: - case 235 /* TryStatement */: - case 274 /* CatchClause */: + case 247 /* CaseBlock */: + case 219 /* Block */: + case 223 /* IfStatement */: + case 224 /* DoStatement */: + case 225 /* WhileStatement */: + case 226 /* ForStatement */: + case 227 /* ForInStatement */: + case 228 /* ForOfStatement */: + case 232 /* WithStatement */: + case 233 /* SwitchStatement */: + case 272 /* CaseClause */: + case 273 /* DefaultClause */: + case 234 /* LabeledStatement */: + case 236 /* TryStatement */: + case 275 /* CatchClause */: return ts.forEachChild(node, traverse); } } @@ -9397,26 +9573,26 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 207 /* YieldExpression */: + case 208 /* YieldExpression */: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } return; - case 243 /* EnumDeclaration */: - case 241 /* InterfaceDeclaration */: - case 244 /* ModuleDeclaration */: - case 242 /* TypeAliasDeclaration */: - case 240 /* ClassDeclaration */: - case 209 /* ClassExpression */: + case 244 /* EnumDeclaration */: + case 242 /* InterfaceDeclaration */: + case 245 /* ModuleDeclaration */: + case 243 /* TypeAliasDeclaration */: + case 241 /* ClassDeclaration */: + case 210 /* ClassExpression */: // These are not allowed inside a generator now, but eventually they may be allowed // as local types. Regardless, any yield statements contained within them should be // skipped in this traversal. return; default: if (ts.isFunctionLike(node)) { - if (node.name && node.name.kind === 149 /* ComputedPropertyName */) { + if (node.name && node.name.kind === 150 /* ComputedPropertyName */) { // Note that we will not include methods/accessors of a class because they would require // first descending into the class. This is by design. traverse(node.name.expression); @@ -9439,10 +9615,10 @@ var ts; * @param node The type node. */ function getRestParameterElementType(node) { - if (node && node.kind === 169 /* ArrayType */) { + if (node && node.kind === 170 /* ArrayType */) { return node.elementType; } - else if (node && node.kind === 164 /* TypeReference */) { + else if (node && node.kind === 165 /* TypeReference */) { return ts.singleOrUndefined(node.typeArguments); } else { @@ -9452,12 +9628,12 @@ var ts; ts.getRestParameterElementType = getRestParameterElementType; function getMembersOfDeclaration(node) { switch (node.kind) { - case 241 /* InterfaceDeclaration */: - case 240 /* ClassDeclaration */: - case 209 /* ClassExpression */: - case 168 /* TypeLiteral */: + case 242 /* InterfaceDeclaration */: + case 241 /* ClassDeclaration */: + case 210 /* ClassExpression */: + case 169 /* TypeLiteral */: return node.members; - case 188 /* ObjectLiteralExpression */: + case 189 /* ObjectLiteralExpression */: return node.properties; } } @@ -9465,14 +9641,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 186 /* BindingElement */: - case 278 /* EnumMember */: - case 151 /* Parameter */: - case 275 /* PropertyAssignment */: - case 154 /* PropertyDeclaration */: - case 153 /* PropertySignature */: - case 276 /* ShorthandPropertyAssignment */: - case 237 /* VariableDeclaration */: + case 187 /* BindingElement */: + case 279 /* EnumMember */: + case 152 /* Parameter */: + case 276 /* PropertyAssignment */: + case 155 /* PropertyDeclaration */: + case 154 /* PropertySignature */: + case 277 /* ShorthandPropertyAssignment */: + case 238 /* VariableDeclaration */: return true; } } @@ -9484,8 +9660,8 @@ var ts; } ts.isVariableLikeOrAccessor = isVariableLikeOrAccessor; function isVariableDeclarationInVariableStatement(node) { - return node.parent.kind === 238 /* VariableDeclarationList */ - && node.parent.parent.kind === 219 /* VariableStatement */; + return node.parent.kind === 239 /* VariableDeclarationList */ + && node.parent.parent.kind === 220 /* VariableStatement */; } ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement; function isValidESSymbolDeclaration(node) { @@ -9496,13 +9672,13 @@ var ts; ts.isValidESSymbolDeclaration = isValidESSymbolDeclaration; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: - case 157 /* Constructor */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: + case 158 /* Constructor */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: return true; } return false; @@ -9513,7 +9689,7 @@ var ts; if (beforeUnwrapLabelCallback) { beforeUnwrapLabelCallback(node); } - if (node.statement.kind !== 233 /* LabeledStatement */) { + if (node.statement.kind !== 234 /* LabeledStatement */) { return node.statement; } node = node.statement; @@ -9521,17 +9697,17 @@ var ts; } ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel; function isFunctionBlock(node) { - return node && node.kind === 218 /* Block */ && ts.isFunctionLike(node.parent); + return node && node.kind === 219 /* Block */ && ts.isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 156 /* MethodDeclaration */ && node.parent.kind === 188 /* ObjectLiteralExpression */; + return node && node.kind === 157 /* MethodDeclaration */ && node.parent.kind === 189 /* ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isObjectLiteralOrClassExpressionMethod(node) { - return node.kind === 156 /* MethodDeclaration */ && - (node.parent.kind === 188 /* ObjectLiteralExpression */ || - node.parent.kind === 209 /* ClassExpression */); + return node.kind === 157 /* MethodDeclaration */ && + (node.parent.kind === 189 /* ObjectLiteralExpression */ || + node.parent.kind === 210 /* ClassExpression */); } ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod; function isIdentifierTypePredicate(predicate) { @@ -9544,7 +9720,7 @@ var ts; ts.isThisTypePredicate = isThisTypePredicate; function getPropertyAssignment(objectLiteral, key, key2) { return objectLiteral.properties.filter(function (property) { - if (property.kind === 275 /* PropertyAssignment */) { + if (property.kind === 276 /* PropertyAssignment */) { var propName = getTextOfPropertyName(property.name); return key === propName || (!!key2 && key2 === propName); } @@ -9576,19 +9752,23 @@ var ts; return findAncestor(node.parent, ts.isFunctionLike); } ts.getContainingFunction = getContainingFunction; + function getContainingFunctionDeclaration(node) { + return findAncestor(node.parent, ts.isFunctionLikeDeclaration); + } + ts.getContainingFunctionDeclaration = getContainingFunctionDeclaration; function getContainingClass(node) { return findAncestor(node.parent, ts.isClassLike); } ts.getContainingClass = getContainingClass; function getThisContainer(node, includeArrowFunctions) { - ts.Debug.assert(node.kind !== 284 /* SourceFile */); + ts.Debug.assert(node.kind !== 285 /* SourceFile */); while (true) { node = node.parent; if (!node) { return ts.Debug.fail(); // If we never pass in a SourceFile, this should be unreachable, since we'll stop when we reach that. } switch (node.kind) { - case 149 /* ComputedPropertyName */: + case 150 /* ComputedPropertyName */: // If the grandparent node is an object literal (as opposed to a class), // then the computed property is not a 'this' container. // A computed property name in a class needs to be a this container @@ -9603,9 +9783,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 152 /* Decorator */: + case 153 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 151 /* Parameter */ && ts.isClassElement(node.parent.parent)) { + if (node.parent.kind === 152 /* Parameter */ && ts.isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -9616,26 +9796,26 @@ var ts; node = node.parent; } break; - case 197 /* ArrowFunction */: + case 198 /* ArrowFunction */: if (!includeArrowFunctions) { continue; } // falls through - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: - case 244 /* ModuleDeclaration */: - case 154 /* PropertyDeclaration */: - case 153 /* PropertySignature */: - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: - case 157 /* Constructor */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 160 /* CallSignature */: - case 161 /* ConstructSignature */: - case 162 /* IndexSignature */: - case 243 /* EnumDeclaration */: - case 284 /* SourceFile */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: + case 245 /* ModuleDeclaration */: + case 155 /* PropertyDeclaration */: + case 154 /* PropertySignature */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: + case 158 /* Constructor */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 161 /* CallSignature */: + case 162 /* ConstructSignature */: + case 163 /* IndexSignature */: + case 244 /* EnumDeclaration */: + case 285 /* SourceFile */: return node; } } @@ -9645,9 +9825,9 @@ var ts; var container = getThisContainer(node, /*includeArrowFunctions*/ false); if (container) { switch (container.kind) { - case 157 /* Constructor */: - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: + case 158 /* Constructor */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: return container; } } @@ -9669,27 +9849,27 @@ var ts; return node; } switch (node.kind) { - case 149 /* ComputedPropertyName */: + case 150 /* ComputedPropertyName */: node = node.parent; break; - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: if (!stopOnFunctions) { continue; } // falls through - case 154 /* PropertyDeclaration */: - case 153 /* PropertySignature */: - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: - case 157 /* Constructor */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 155 /* PropertyDeclaration */: + case 154 /* PropertySignature */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: + case 158 /* Constructor */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: return node; - case 152 /* Decorator */: + case 153 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 151 /* Parameter */ && ts.isClassElement(node.parent.parent)) { + if (node.parent.kind === 152 /* Parameter */ && ts.isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -9705,21 +9885,21 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 196 /* FunctionExpression */ || func.kind === 197 /* ArrowFunction */) { + if (func.kind === 197 /* FunctionExpression */ || func.kind === 198 /* ArrowFunction */) { var prev = func; var parent = func.parent; - while (parent.kind === 195 /* ParenthesizedExpression */) { + while (parent.kind === 196 /* ParenthesizedExpression */) { prev = parent; parent = parent.parent; } - if (parent.kind === 191 /* CallExpression */ && parent.expression === prev) { + if (parent.kind === 192 /* CallExpression */ && parent.expression === prev) { return parent; } } } ts.getImmediatelyInvokedFunctionExpression = getImmediatelyInvokedFunctionExpression; function isSuperOrSuperProperty(node) { - return node.kind === 98 /* SuperKeyword */ + return node.kind === 99 /* SuperKeyword */ || isSuperProperty(node); } ts.isSuperOrSuperProperty = isSuperOrSuperProperty; @@ -9728,8 +9908,8 @@ var ts; */ function isSuperProperty(node) { var kind = node.kind; - return (kind === 189 /* PropertyAccessExpression */ || kind === 190 /* ElementAccessExpression */) - && node.expression.kind === 98 /* SuperKeyword */; + return (kind === 190 /* PropertyAccessExpression */ || kind === 191 /* ElementAccessExpression */) + && node.expression.kind === 99 /* SuperKeyword */; } ts.isSuperProperty = isSuperProperty; /** @@ -9737,20 +9917,20 @@ var ts; */ function isThisProperty(node) { var kind = node.kind; - return (kind === 189 /* PropertyAccessExpression */ || kind === 190 /* ElementAccessExpression */) - && node.expression.kind === 100 /* ThisKeyword */; + return (kind === 190 /* PropertyAccessExpression */ || kind === 191 /* ElementAccessExpression */) + && node.expression.kind === 101 /* ThisKeyword */; } ts.isThisProperty = isThisProperty; function getEntityNameFromTypeNode(node) { switch (node.kind) { - case 164 /* TypeReference */: + case 165 /* TypeReference */: return node.typeName; - case 211 /* ExpressionWithTypeArguments */: + case 212 /* ExpressionWithTypeArguments */: return isEntityNameExpression(node.expression) ? node.expression : undefined; - case 72 /* Identifier */: - case 148 /* QualifiedName */: + case 73 /* Identifier */: + case 149 /* QualifiedName */: return node; } return undefined; @@ -9758,10 +9938,10 @@ var ts; ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { switch (node.kind) { - case 193 /* TaggedTemplateExpression */: + case 194 /* TaggedTemplateExpression */: return node.tag; - case 262 /* JsxOpeningElement */: - case 261 /* JsxSelfClosingElement */: + case 263 /* JsxOpeningElement */: + case 262 /* JsxSelfClosingElement */: return node.tagName; default: return node.expression; @@ -9770,25 +9950,25 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node, parent, grandparent) { switch (node.kind) { - case 240 /* ClassDeclaration */: + case 241 /* ClassDeclaration */: // classes are valid targets return true; - case 154 /* PropertyDeclaration */: + case 155 /* PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return parent.kind === 240 /* ClassDeclaration */; - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 156 /* MethodDeclaration */: + return parent.kind === 241 /* ClassDeclaration */; + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 157 /* MethodDeclaration */: // if this method has a body and its parent is a class declaration, this is a valid target. return node.body !== undefined - && parent.kind === 240 /* ClassDeclaration */; - case 151 /* Parameter */: + && parent.kind === 241 /* ClassDeclaration */; + case 152 /* Parameter */: // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target; return parent.body !== undefined - && (parent.kind === 157 /* Constructor */ - || parent.kind === 156 /* MethodDeclaration */ - || parent.kind === 159 /* SetAccessor */) - && grandparent.kind === 240 /* ClassDeclaration */; + && (parent.kind === 158 /* Constructor */ + || parent.kind === 157 /* MethodDeclaration */ + || parent.kind === 160 /* SetAccessor */) + && grandparent.kind === 241 /* ClassDeclaration */; } return false; } @@ -9804,10 +9984,10 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node, parent) { switch (node.kind) { - case 240 /* ClassDeclaration */: + case 241 /* ClassDeclaration */: return ts.some(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent); }); // TODO: GH#18217 - case 156 /* MethodDeclaration */: - case 159 /* SetAccessor */: + case 157 /* MethodDeclaration */: + case 160 /* SetAccessor */: return ts.some(node.parameters, function (p) { return nodeIsDecorated(p, node, parent); }); // TODO: GH#18217 default: return false; @@ -9816,9 +9996,9 @@ var ts; ts.childIsDecorated = childIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 262 /* JsxOpeningElement */ || - parent.kind === 261 /* JsxSelfClosingElement */ || - parent.kind === 263 /* JsxClosingElement */) { + if (parent.kind === 263 /* JsxOpeningElement */ || + parent.kind === 262 /* JsxSelfClosingElement */ || + parent.kind === 264 /* JsxClosingElement */) { return parent.tagName === node; } return false; @@ -9826,57 +10006,57 @@ var ts; ts.isJSXTagName = isJSXTagName; function isExpressionNode(node) { switch (node.kind) { - case 98 /* SuperKeyword */: - case 96 /* NullKeyword */: - case 102 /* TrueKeyword */: - case 87 /* FalseKeyword */: + case 99 /* SuperKeyword */: + case 97 /* NullKeyword */: + case 103 /* TrueKeyword */: + case 88 /* FalseKeyword */: case 13 /* RegularExpressionLiteral */: - case 187 /* ArrayLiteralExpression */: - case 188 /* ObjectLiteralExpression */: - case 189 /* PropertyAccessExpression */: - case 190 /* ElementAccessExpression */: - case 191 /* CallExpression */: - case 192 /* NewExpression */: - case 193 /* TaggedTemplateExpression */: - case 212 /* AsExpression */: - case 194 /* TypeAssertionExpression */: - case 213 /* NonNullExpression */: - case 195 /* ParenthesizedExpression */: - case 196 /* FunctionExpression */: - case 209 /* ClassExpression */: - case 197 /* ArrowFunction */: - case 200 /* VoidExpression */: - case 198 /* DeleteExpression */: - case 199 /* TypeOfExpression */: - case 202 /* PrefixUnaryExpression */: - case 203 /* PostfixUnaryExpression */: - case 204 /* BinaryExpression */: - case 205 /* ConditionalExpression */: - case 208 /* SpreadElement */: - case 206 /* TemplateExpression */: + case 188 /* ArrayLiteralExpression */: + case 189 /* ObjectLiteralExpression */: + case 190 /* PropertyAccessExpression */: + case 191 /* ElementAccessExpression */: + case 192 /* CallExpression */: + case 193 /* NewExpression */: + case 194 /* TaggedTemplateExpression */: + case 213 /* AsExpression */: + case 195 /* TypeAssertionExpression */: + case 214 /* NonNullExpression */: + case 196 /* ParenthesizedExpression */: + case 197 /* FunctionExpression */: + case 210 /* ClassExpression */: + case 198 /* ArrowFunction */: + case 201 /* VoidExpression */: + case 199 /* DeleteExpression */: + case 200 /* TypeOfExpression */: + case 203 /* PrefixUnaryExpression */: + case 204 /* PostfixUnaryExpression */: + case 205 /* BinaryExpression */: + case 206 /* ConditionalExpression */: + case 209 /* SpreadElement */: + case 207 /* TemplateExpression */: case 14 /* NoSubstitutionTemplateLiteral */: - case 210 /* OmittedExpression */: - case 260 /* JsxElement */: - case 261 /* JsxSelfClosingElement */: - case 264 /* JsxFragment */: - case 207 /* YieldExpression */: - case 201 /* AwaitExpression */: - case 214 /* MetaProperty */: + case 211 /* OmittedExpression */: + case 261 /* JsxElement */: + case 262 /* JsxSelfClosingElement */: + case 265 /* JsxFragment */: + case 208 /* YieldExpression */: + case 202 /* AwaitExpression */: + case 215 /* MetaProperty */: return true; - case 148 /* QualifiedName */: - while (node.parent.kind === 148 /* QualifiedName */) { + case 149 /* QualifiedName */: + while (node.parent.kind === 149 /* QualifiedName */) { node = node.parent; } - return node.parent.kind === 167 /* TypeQuery */ || isJSXTagName(node); - case 72 /* Identifier */: - if (node.parent.kind === 167 /* TypeQuery */ || isJSXTagName(node)) { + return node.parent.kind === 168 /* TypeQuery */ || isJSXTagName(node); + case 73 /* Identifier */: + if (node.parent.kind === 168 /* TypeQuery */ || isJSXTagName(node)) { return true; } // falls through case 8 /* NumericLiteral */: case 9 /* BigIntLiteral */: case 10 /* StringLiteral */: - case 100 /* ThisKeyword */: + case 101 /* ThisKeyword */: return isInExpressionContext(node); default: return false; @@ -9886,49 +10066,49 @@ var ts; function isInExpressionContext(node) { var parent = node.parent; switch (parent.kind) { - case 237 /* VariableDeclaration */: - case 151 /* Parameter */: - case 154 /* PropertyDeclaration */: - case 153 /* PropertySignature */: - case 278 /* EnumMember */: - case 275 /* PropertyAssignment */: - case 186 /* BindingElement */: + case 238 /* VariableDeclaration */: + case 152 /* Parameter */: + case 155 /* PropertyDeclaration */: + case 154 /* PropertySignature */: + case 279 /* EnumMember */: + case 276 /* PropertyAssignment */: + case 187 /* BindingElement */: return parent.initializer === node; - case 221 /* ExpressionStatement */: - case 222 /* IfStatement */: - case 223 /* DoStatement */: - case 224 /* WhileStatement */: - case 230 /* ReturnStatement */: - case 231 /* WithStatement */: - case 232 /* SwitchStatement */: - case 271 /* CaseClause */: - case 234 /* ThrowStatement */: + case 222 /* ExpressionStatement */: + case 223 /* IfStatement */: + case 224 /* DoStatement */: + case 225 /* WhileStatement */: + case 231 /* ReturnStatement */: + case 232 /* WithStatement */: + case 233 /* SwitchStatement */: + case 272 /* CaseClause */: + case 235 /* ThrowStatement */: return parent.expression === node; - case 225 /* ForStatement */: + case 226 /* ForStatement */: var forStatement = parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 238 /* VariableDeclarationList */) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 239 /* VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 226 /* ForInStatement */: - case 227 /* ForOfStatement */: + case 227 /* ForInStatement */: + case 228 /* ForOfStatement */: var forInStatement = parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 238 /* VariableDeclarationList */) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 239 /* VariableDeclarationList */) || forInStatement.expression === node; - case 194 /* TypeAssertionExpression */: - case 212 /* AsExpression */: + case 195 /* TypeAssertionExpression */: + case 213 /* AsExpression */: return node === parent.expression; - case 216 /* TemplateSpan */: + case 217 /* TemplateSpan */: return node === parent.expression; - case 149 /* ComputedPropertyName */: + case 150 /* ComputedPropertyName */: return node === parent.expression; - case 152 /* Decorator */: - case 270 /* JsxExpression */: - case 269 /* JsxSpreadAttribute */: - case 277 /* SpreadAssignment */: + case 153 /* Decorator */: + case 271 /* JsxExpression */: + case 270 /* JsxSpreadAttribute */: + case 278 /* SpreadAssignment */: return true; - case 211 /* ExpressionWithTypeArguments */: + case 212 /* ExpressionWithTypeArguments */: return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent); - case 276 /* ShorthandPropertyAssignment */: + case 277 /* ShorthandPropertyAssignment */: return parent.objectAssignmentInitializer === node; default: return isExpressionNode(parent); @@ -9936,7 +10116,7 @@ var ts; } ts.isInExpressionContext = isInExpressionContext; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 248 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 259 /* ExternalModuleReference */; + return node.kind === 249 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 260 /* ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -9945,7 +10125,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 248 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 259 /* ExternalModuleReference */; + return node.kind === 249 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 260 /* ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJS(file) { @@ -9973,15 +10153,15 @@ var ts; ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && node.typeArguments && node.typeArguments.length === 2 && - (node.typeArguments[0].kind === 138 /* StringKeyword */ || node.typeArguments[0].kind === 135 /* NumberKeyword */); + (node.typeArguments[0].kind === 139 /* StringKeyword */ || node.typeArguments[0].kind === 136 /* NumberKeyword */); } ts.isJSDocIndexSignature = isJSDocIndexSignature; function isRequireCall(callExpression, checkArgumentIsStringLiteralLike) { - if (callExpression.kind !== 191 /* CallExpression */) { + if (callExpression.kind !== 192 /* CallExpression */) { return false; } var _a = callExpression, expression = _a.expression, args = _a.arguments; - if (expression.kind !== 72 /* Identifier */ || expression.escapedText !== "require") { + if (expression.kind !== 73 /* Identifier */ || expression.escapedText !== "require") { return false; } if (args.length !== 1) { @@ -10012,7 +10192,7 @@ var ts; name = node.parent.name; decl = node.parent; } - else if (ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 59 /* EqualsToken */ && node.parent.right === node) { + else if (ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 60 /* EqualsToken */ && node.parent.right === node) { name = node.parent.left; decl = name; } @@ -10021,7 +10201,7 @@ var ts; name = node.parent.parent.name; decl = node.parent.parent; } - else if (ts.isBinaryExpression(node.parent.parent) && node.parent.parent.operatorToken.kind === 59 /* EqualsToken */ && node.parent.parent.right === node.parent) { + else if (ts.isBinaryExpression(node.parent.parent) && node.parent.parent.operatorToken.kind === 60 /* EqualsToken */ && node.parent.parent.right === node.parent) { name = node.parent.parent.left; decl = name; } @@ -10063,7 +10243,7 @@ var ts; * We treat the right hand side of assignments with container-like initalizers as declarations. */ function getAssignedExpandoInitializer(node) { - if (node && node.parent && ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 59 /* EqualsToken */) { + if (node && node.parent && ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 60 /* EqualsToken */) { var isPrototypeAssignment = isPrototypeAccess(node.parent.left); return getExpandoInitializer(node.parent.right, isPrototypeAssignment) || getDefaultedExpandoInitializer(node.parent.left, node.parent.right, isPrototypeAssignment); @@ -10089,11 +10269,11 @@ var ts; function getExpandoInitializer(initializer, isPrototypeAssignment) { if (ts.isCallExpression(initializer)) { var e = skipParentheses(initializer.expression); - return e.kind === 196 /* FunctionExpression */ || e.kind === 197 /* ArrowFunction */ ? initializer : undefined; + return e.kind === 197 /* FunctionExpression */ || e.kind === 198 /* ArrowFunction */ ? initializer : undefined; } - if (initializer.kind === 196 /* FunctionExpression */ || - initializer.kind === 209 /* ClassExpression */ || - initializer.kind === 197 /* ArrowFunction */) { + if (initializer.kind === 197 /* FunctionExpression */ || + initializer.kind === 210 /* ClassExpression */ || + initializer.kind === 198 /* ArrowFunction */) { return initializer; } if (ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) { @@ -10117,7 +10297,7 @@ var ts; } function isDefaultedExpandoInitializer(node) { var name = ts.isVariableDeclaration(node.parent) ? node.parent.name : - ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 59 /* EqualsToken */ ? node.parent.left : + ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 60 /* EqualsToken */ ? node.parent.left : undefined; return name && getExpandoInitializer(node.right, isPrototypeAccess(name)) && isEntityNameExpression(name) && isSameEntityName(name, node.left); } @@ -10126,7 +10306,7 @@ var ts; function getNameOfExpando(node) { if (ts.isBinaryExpression(node.parent)) { var parent = (node.parent.operatorToken.kind === 55 /* BarBarToken */ && ts.isBinaryExpression(node.parent.parent)) ? node.parent.parent : node.parent; - if (parent.operatorToken.kind === 59 /* EqualsToken */ && ts.isIdentifier(parent.left)) { + if (parent.operatorToken.kind === 60 /* EqualsToken */ && ts.isIdentifier(parent.left)) { return parent.left; } } @@ -10149,7 +10329,7 @@ var ts; return name.escapedText === initializer.escapedText; } if (ts.isIdentifier(name) && ts.isPropertyAccessExpression(initializer)) { - return (initializer.expression.kind === 100 /* ThisKeyword */ || + return (initializer.expression.kind === 101 /* ThisKeyword */ || ts.isIdentifier(initializer.expression) && (initializer.expression.escapedText === "window" || initializer.expression.escapedText === "self" || @@ -10207,7 +10387,7 @@ var ts; } return 7 /* ObjectDefinePropertyValue */; } - if (expr.operatorToken.kind !== 59 /* EqualsToken */ || + if (expr.operatorToken.kind !== 60 /* EqualsToken */ || !ts.isPropertyAccessExpression(expr.left)) { return 0 /* None */; } @@ -10219,7 +10399,7 @@ var ts; return getAssignmentDeclarationPropertyAccessKind(lhs); } function getAssignmentDeclarationPropertyAccessKind(lhs) { - if (lhs.expression.kind === 100 /* ThisKeyword */) { + if (lhs.expression.kind === 101 /* ThisKeyword */) { return 4 /* ThisProperty */; } else if (isModuleExportsPropertyAccessExpression(lhs)) { @@ -10261,7 +10441,7 @@ var ts; ts.isPrototypePropertyAssignment = isPrototypePropertyAssignment; function isSpecialPropertyDeclaration(expr) { return isInJSFile(expr) && - expr.parent && expr.parent.kind === 221 /* ExpressionStatement */ && + expr.parent && expr.parent.kind === 222 /* ExpressionStatement */ && !!ts.getJSDocTypeTag(expr.parent); } ts.isSpecialPropertyDeclaration = isSpecialPropertyDeclaration; @@ -10270,23 +10450,23 @@ var ts; return false; } var decl = symbol.valueDeclaration; - return decl.kind === 239 /* FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer); + return decl.kind === 240 /* FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer); } ts.isFunctionSymbol = isFunctionSymbol; function importFromModuleSpecifier(node) { - return tryGetImportFromModuleSpecifier(node) || ts.Debug.fail(ts.Debug.showSyntaxKind(node.parent)); + return tryGetImportFromModuleSpecifier(node) || ts.Debug.failBadSyntaxKind(node.parent); } ts.importFromModuleSpecifier = importFromModuleSpecifier; function tryGetImportFromModuleSpecifier(node) { switch (node.parent.kind) { - case 249 /* ImportDeclaration */: - case 255 /* ExportDeclaration */: + case 250 /* ImportDeclaration */: + case 256 /* ExportDeclaration */: return node.parent; - case 259 /* ExternalModuleReference */: + case 260 /* ExternalModuleReference */: return node.parent.parent; - case 191 /* CallExpression */: + case 192 /* CallExpression */: return isImportCall(node.parent) || isRequireCall(node.parent, /*checkArg*/ false) ? node.parent : undefined; - case 182 /* LiteralType */: + case 183 /* LiteralType */: ts.Debug.assert(ts.isStringLiteral(node)); return ts.tryCast(node.parent.parent, ts.isImportTypeNode); default: @@ -10296,12 +10476,12 @@ var ts; ts.tryGetImportFromModuleSpecifier = tryGetImportFromModuleSpecifier; function getExternalModuleName(node) { switch (node.kind) { - case 249 /* ImportDeclaration */: - case 255 /* ExportDeclaration */: + case 250 /* ImportDeclaration */: + case 256 /* ExportDeclaration */: return node.moduleSpecifier; - case 248 /* ImportEqualsDeclaration */: - return node.moduleReference.kind === 259 /* ExternalModuleReference */ ? node.moduleReference.expression : undefined; - case 183 /* ImportType */: + case 249 /* ImportEqualsDeclaration */: + return node.moduleReference.kind === 260 /* ExternalModuleReference */ ? node.moduleReference.expression : undefined; + case 184 /* ImportType */: return isLiteralImportTypeNode(node) ? node.argument.literal : undefined; default: return ts.Debug.assertNever(node); @@ -10310,11 +10490,11 @@ var ts; ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { switch (node.kind) { - case 249 /* ImportDeclaration */: + case 250 /* ImportDeclaration */: return node.importClause && ts.tryCast(node.importClause.namedBindings, ts.isNamespaceImport); - case 248 /* ImportEqualsDeclaration */: + case 249 /* ImportEqualsDeclaration */: return node; - case 255 /* ExportDeclaration */: + case 256 /* ExportDeclaration */: return undefined; default: return ts.Debug.assertNever(node); @@ -10322,19 +10502,19 @@ var ts; } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 249 /* ImportDeclaration */ && !!node.importClause && !!node.importClause.name; + return node.kind === 250 /* ImportDeclaration */ && !!node.importClause && !!node.importClause.name; } ts.isDefaultImport = isDefaultImport; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 151 /* Parameter */: - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: - case 276 /* ShorthandPropertyAssignment */: - case 275 /* PropertyAssignment */: - case 154 /* PropertyDeclaration */: - case 153 /* PropertySignature */: + case 152 /* Parameter */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: + case 277 /* ShorthandPropertyAssignment */: + case 276 /* PropertyAssignment */: + case 155 /* PropertyDeclaration */: + case 154 /* PropertySignature */: return node.questionToken !== undefined; } } @@ -10348,7 +10528,7 @@ var ts; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function isJSDocTypeAlias(node) { - return node.kind === 309 /* JSDocTypedefTag */ || node.kind === 302 /* JSDocCallbackTag */; + return node.kind === 310 /* JSDocTypedefTag */ || node.kind === 303 /* JSDocCallbackTag */; } ts.isJSDocTypeAlias = isJSDocTypeAlias; function isTypeAlias(node) { @@ -10358,7 +10538,7 @@ var ts; function getSourceOfAssignment(node) { return ts.isExpressionStatement(node) && node.expression && ts.isBinaryExpression(node.expression) && - node.expression.operatorToken.kind === 59 /* EqualsToken */ + node.expression.operatorToken.kind === 60 /* EqualsToken */ ? node.expression.right : undefined; } @@ -10373,12 +10553,12 @@ var ts; } function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) { switch (node.kind) { - case 219 /* VariableStatement */: + case 220 /* VariableStatement */: var v = getSingleVariableOfVariableStatement(node); return v && v.initializer; - case 154 /* PropertyDeclaration */: + case 155 /* PropertyDeclaration */: return node.initializer; - case 275 /* PropertyAssignment */: + case 276 /* PropertyAssignment */: return node.initializer; } } @@ -10389,7 +10569,7 @@ var ts; function getNestedModuleDeclaration(node) { return ts.isModuleDeclaration(node) && node.body && - node.body.kind === 244 /* ModuleDeclaration */ + node.body.kind === 245 /* ModuleDeclaration */ ? node.body : undefined; } @@ -10404,11 +10584,11 @@ var ts; if (ts.hasJSDocNodes(node)) { result = ts.addRange(result, node.jsDoc); } - if (node.kind === 151 /* Parameter */) { + if (node.kind === 152 /* Parameter */) { result = ts.addRange(result, ts.getJSDocParameterTags(node)); break; } - if (node.kind === 150 /* TypeParameter */) { + if (node.kind === 151 /* TypeParameter */) { result = ts.addRange(result, ts.getJSDocTypeParameterTags(node)); break; } @@ -10419,11 +10599,12 @@ var ts; ts.getJSDocCommentsAndTags = getJSDocCommentsAndTags; function getNextJSDocCommentLocation(node) { var parent = node.parent; - if (parent.kind === 275 /* PropertyAssignment */ || - parent.kind === 154 /* PropertyDeclaration */ || - parent.kind === 221 /* ExpressionStatement */ && node.kind === 189 /* PropertyAccessExpression */ || + if (parent.kind === 276 /* PropertyAssignment */ || + parent.kind === 255 /* ExportAssignment */ || + parent.kind === 155 /* PropertyDeclaration */ || + parent.kind === 222 /* ExpressionStatement */ && node.kind === 190 /* PropertyAccessExpression */ || getNestedModuleDeclaration(parent) || - ts.isBinaryExpression(node) && node.operatorToken.kind === 59 /* EqualsToken */) { + ts.isBinaryExpression(node) && node.operatorToken.kind === 60 /* EqualsToken */) { return parent; } // Try to recognize this pattern when node is initializer of variable declaration and JSDoc comments are on containing variable statement. @@ -10434,7 +10615,7 @@ var ts; // var x = function(name) { return name.length; } else if (parent.parent && (getSingleVariableOfVariableStatement(parent.parent) === node || - ts.isBinaryExpression(parent) && parent.operatorToken.kind === 59 /* EqualsToken */)) { + ts.isBinaryExpression(parent) && parent.operatorToken.kind === 60 /* EqualsToken */)) { return parent.parent; } else if (parent.parent && parent.parent.parent && @@ -10457,7 +10638,7 @@ var ts; if (!decl) { return undefined; } - var parameter = ts.find(decl.parameters, function (p) { return p.name.kind === 72 /* Identifier */ && p.name.escapedText === name; }); + var parameter = ts.find(decl.parameters, function (p) { return p.name.kind === 73 /* Identifier */ && p.name.escapedText === name; }); return parameter && parameter.symbol; } ts.getParameterSymbolFromJSDoc = getParameterSymbolFromJSDoc; @@ -10492,7 +10673,7 @@ var ts; ts.hasRestParameter = hasRestParameter; function isRestParameter(node) { var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type; - return node.dotDotDotToken !== undefined || !!type && type.kind === 295 /* JSDocVariadicType */; + return node.dotDotDotToken !== undefined || !!type && type.kind === 296 /* JSDocVariadicType */; } ts.isRestParameter = isRestParameter; var AssignmentKind; @@ -10505,31 +10686,31 @@ var ts; var parent = node.parent; while (true) { switch (parent.kind) { - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? - binaryOperator === 59 /* EqualsToken */ ? 1 /* Definite */ : 2 /* Compound */ : + binaryOperator === 60 /* EqualsToken */ ? 1 /* Definite */ : 2 /* Compound */ : 0 /* None */; - case 202 /* PrefixUnaryExpression */: - case 203 /* PostfixUnaryExpression */: + case 203 /* PrefixUnaryExpression */: + case 204 /* PostfixUnaryExpression */: var unaryOperator = parent.operator; return unaryOperator === 44 /* PlusPlusToken */ || unaryOperator === 45 /* MinusMinusToken */ ? 2 /* Compound */ : 0 /* None */; - case 226 /* ForInStatement */: - case 227 /* ForOfStatement */: + case 227 /* ForInStatement */: + case 228 /* ForOfStatement */: return parent.initializer === node ? 1 /* Definite */ : 0 /* None */; - case 195 /* ParenthesizedExpression */: - case 187 /* ArrayLiteralExpression */: - case 208 /* SpreadElement */: - case 213 /* NonNullExpression */: + case 196 /* ParenthesizedExpression */: + case 188 /* ArrayLiteralExpression */: + case 209 /* SpreadElement */: + case 214 /* NonNullExpression */: node = parent; break; - case 276 /* ShorthandPropertyAssignment */: + case 277 /* ShorthandPropertyAssignment */: if (parent.name !== node) { return 0 /* None */; } node = parent.parent; break; - case 275 /* PropertyAssignment */: + case 276 /* PropertyAssignment */: if (parent.name === node) { return 0 /* None */; } @@ -10556,22 +10737,22 @@ var ts; */ function isNodeWithPossibleHoistedDeclaration(node) { switch (node.kind) { - case 218 /* Block */: - case 219 /* VariableStatement */: - case 231 /* WithStatement */: - case 222 /* IfStatement */: - case 232 /* SwitchStatement */: - case 246 /* CaseBlock */: - case 271 /* CaseClause */: - case 272 /* DefaultClause */: - case 233 /* LabeledStatement */: - case 225 /* ForStatement */: - case 226 /* ForInStatement */: - case 227 /* ForOfStatement */: - case 223 /* DoStatement */: - case 224 /* WhileStatement */: - case 235 /* TryStatement */: - case 274 /* CatchClause */: + case 219 /* Block */: + case 220 /* VariableStatement */: + case 232 /* WithStatement */: + case 223 /* IfStatement */: + case 233 /* SwitchStatement */: + case 247 /* CaseBlock */: + case 272 /* CaseClause */: + case 273 /* DefaultClause */: + case 234 /* LabeledStatement */: + case 226 /* ForStatement */: + case 227 /* ForInStatement */: + case 228 /* ForOfStatement */: + case 224 /* DoStatement */: + case 225 /* WhileStatement */: + case 236 /* TryStatement */: + case 275 /* CatchClause */: return true; } return false; @@ -10588,33 +10769,33 @@ var ts; return node; } function walkUpParenthesizedTypes(node) { - return walkUp(node, 177 /* ParenthesizedType */); + return walkUp(node, 178 /* ParenthesizedType */); } ts.walkUpParenthesizedTypes = walkUpParenthesizedTypes; function walkUpParenthesizedExpressions(node) { - return walkUp(node, 195 /* ParenthesizedExpression */); + return walkUp(node, 196 /* ParenthesizedExpression */); } ts.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions; function skipParentheses(node) { - while (node.kind === 195 /* ParenthesizedExpression */) { + while (node.kind === 196 /* ParenthesizedExpression */) { node = node.expression; } return node; } ts.skipParentheses = skipParentheses; function skipParenthesesUp(node) { - while (node.kind === 195 /* ParenthesizedExpression */) { + while (node.kind === 196 /* ParenthesizedExpression */) { node = node.parent; } return node; } // a node is delete target iff. it is PropertyAccessExpression/ElementAccessExpression with parentheses skipped function isDeleteTarget(node) { - if (node.kind !== 189 /* PropertyAccessExpression */ && node.kind !== 190 /* ElementAccessExpression */) { + if (node.kind !== 190 /* PropertyAccessExpression */ && node.kind !== 191 /* ElementAccessExpression */) { return false; } node = walkUpParenthesizedExpressions(node.parent); - return node && node.kind === 198 /* DeleteExpression */; + return node && node.kind === 199 /* DeleteExpression */; } ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { @@ -10640,7 +10821,7 @@ var ts; if (ts.isComputedPropertyName(parent)) return parent.parent; // falls through - case 72 /* Identifier */: + case 73 /* Identifier */: if (ts.isDeclaration(parent)) { return parent.name === name ? parent : undefined; } @@ -10664,7 +10845,7 @@ var ts; ts.getDeclarationFromName = getDeclarationFromName; function isLiteralComputedPropertyDeclarationName(node) { return (node.kind === 10 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) && - node.parent.kind === 149 /* ComputedPropertyName */ && + node.parent.kind === 150 /* ComputedPropertyName */ && ts.isDeclaration(node.parent.parent); } ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; @@ -10672,32 +10853,32 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 154 /* PropertyDeclaration */: - case 153 /* PropertySignature */: - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 278 /* EnumMember */: - case 275 /* PropertyAssignment */: - case 189 /* PropertyAccessExpression */: + case 155 /* PropertyDeclaration */: + case 154 /* PropertySignature */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 279 /* EnumMember */: + case 276 /* PropertyAssignment */: + case 190 /* PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; - case 148 /* QualifiedName */: + case 149 /* QualifiedName */: // Name on right hand side of dot in a type query or type reference if (parent.right === node) { - while (parent.kind === 148 /* QualifiedName */) { + while (parent.kind === 149 /* QualifiedName */) { parent = parent.parent; } - return parent.kind === 167 /* TypeQuery */ || parent.kind === 164 /* TypeReference */; + return parent.kind === 168 /* TypeQuery */ || parent.kind === 165 /* TypeReference */; } return false; - case 186 /* BindingElement */: - case 253 /* ImportSpecifier */: + case 187 /* BindingElement */: + case 254 /* ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 257 /* ExportSpecifier */: - case 267 /* JsxAttribute */: + case 258 /* ExportSpecifier */: + case 268 /* JsxAttribute */: // Any name in an export specifier or JSX Attribute return true; } @@ -10714,13 +10895,13 @@ var ts; // export default // module.exports = function isAliasSymbolDeclaration(node) { - return node.kind === 248 /* ImportEqualsDeclaration */ || - node.kind === 247 /* NamespaceExportDeclaration */ || - node.kind === 250 /* ImportClause */ && !!node.name || - node.kind === 251 /* NamespaceImport */ || - node.kind === 253 /* ImportSpecifier */ || - node.kind === 257 /* ExportSpecifier */ || - node.kind === 254 /* ExportAssignment */ && exportAssignmentIsAlias(node) || + return node.kind === 249 /* ImportEqualsDeclaration */ || + node.kind === 248 /* NamespaceExportDeclaration */ || + node.kind === 251 /* ImportClause */ && !!node.name || + node.kind === 252 /* NamespaceImport */ || + node.kind === 254 /* ImportSpecifier */ || + node.kind === 258 /* ExportSpecifier */ || + node.kind === 255 /* ExportAssignment */ && exportAssignmentIsAlias(node) || ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node); } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; @@ -10742,12 +10923,12 @@ var ts; } ts.getEffectiveBaseTypeNode = getEffectiveBaseTypeNode; function getClassExtendsHeritageElement(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 86 /* ExtendsKeyword */); + var heritageClause = getHeritageClause(node.heritageClauses, 87 /* ExtendsKeyword */); return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; } ts.getClassExtendsHeritageElement = getClassExtendsHeritageElement; function getClassImplementsHeritageClauseElements(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 109 /* ImplementsKeyword */); + var heritageClause = getHeritageClause(node.heritageClauses, 110 /* ImplementsKeyword */); return heritageClause ? heritageClause.types : undefined; } ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements; @@ -10759,7 +10940,7 @@ var ts; } ts.getAllSuperTypeNodes = getAllSuperTypeNodes; function getInterfaceBaseTypeNodes(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 86 /* ExtendsKeyword */); + var heritageClause = getHeritageClause(node.heritageClauses, 87 /* ExtendsKeyword */); return heritageClause ? heritageClause.types : undefined; } ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; @@ -10793,11 +10974,11 @@ var ts; } ts.getAncestor = getAncestor; function isKeyword(token) { - return 73 /* FirstKeyword */ <= token && token <= 147 /* LastKeyword */; + return 74 /* FirstKeyword */ <= token && token <= 148 /* LastKeyword */; } ts.isKeyword = isKeyword; function isContextualKeyword(token) { - return 118 /* FirstContextualKeyword */ <= token && token <= 147 /* LastContextualKeyword */; + return 119 /* FirstContextualKeyword */ <= token && token <= 148 /* LastContextualKeyword */; } ts.isContextualKeyword = isContextualKeyword; function isNonContextualKeyword(token) { @@ -10832,14 +11013,14 @@ var ts; } var flags = 0 /* Normal */; switch (node.kind) { - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: - case 156 /* MethodDeclaration */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: + case 157 /* MethodDeclaration */: if (node.asteriskToken) { flags |= 1 /* Generator */; } // falls through - case 197 /* ArrowFunction */: + case 198 /* ArrowFunction */: if (hasModifier(node, 256 /* Async */)) { flags |= 2 /* Async */; } @@ -10853,10 +11034,10 @@ var ts; ts.getFunctionFlags = getFunctionFlags; function isAsyncFunction(node) { switch (node.kind) { - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: - case 156 /* MethodDeclaration */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: + case 157 /* MethodDeclaration */: return node.body !== undefined && node.asteriskToken === undefined && hasModifier(node, 256 /* Async */); @@ -10881,7 +11062,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - return name.kind === 149 /* ComputedPropertyName */ && + return name.kind === 150 /* ComputedPropertyName */ && !isStringOrNumericLiteralLike(name.expression) && !isWellKnownSymbolSyntactically(name.expression); } @@ -10897,12 +11078,12 @@ var ts; ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; function getPropertyNameForPropertyNameNode(name) { switch (name.kind) { - case 72 /* Identifier */: + case 73 /* Identifier */: return name.escapedText; case 10 /* StringLiteral */: case 8 /* NumericLiteral */: return ts.escapeLeadingUnderscores(name.text); - case 149 /* ComputedPropertyName */: + case 150 /* ComputedPropertyName */: var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { return getPropertyNameForKnownSymbolName(ts.idText(nameExpression.name)); @@ -10918,7 +11099,7 @@ var ts; ts.getPropertyNameForPropertyNameNode = getPropertyNameForPropertyNameNode; function isPropertyNameLiteral(node) { switch (node.kind) { - case 72 /* Identifier */: + case 73 /* Identifier */: case 10 /* StringLiteral */: case 14 /* NoSubstitutionTemplateLiteral */: case 8 /* NumericLiteral */: @@ -10929,11 +11110,11 @@ var ts; } ts.isPropertyNameLiteral = isPropertyNameLiteral; function getTextOfIdentifierOrLiteral(node) { - return node.kind === 72 /* Identifier */ ? ts.idText(node) : node.text; + return node.kind === 73 /* Identifier */ ? ts.idText(node) : node.text; } ts.getTextOfIdentifierOrLiteral = getTextOfIdentifierOrLiteral; function getEscapedTextOfIdentifierOrLiteral(node) { - return node.kind === 72 /* Identifier */ ? node.escapedText : ts.escapeLeadingUnderscores(node.text); + return node.kind === 73 /* Identifier */ ? node.escapedText : ts.escapeLeadingUnderscores(node.text); } ts.getEscapedTextOfIdentifierOrLiteral = getEscapedTextOfIdentifierOrLiteral; function getPropertyNameForKnownSymbolName(symbolName) { @@ -10948,7 +11129,7 @@ var ts; * Includes the word "Symbol" with unicode escapes */ function isESSymbolIdentifier(node) { - return node.kind === 72 /* Identifier */ && node.escapedText === "Symbol"; + return node.kind === 73 /* Identifier */ && node.escapedText === "Symbol"; } ts.isESSymbolIdentifier = isESSymbolIdentifier; function isPushOrUnshiftIdentifier(node) { @@ -10957,11 +11138,11 @@ var ts; ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 151 /* Parameter */; + return root.kind === 152 /* Parameter */; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 186 /* BindingElement */) { + while (node.kind === 187 /* BindingElement */) { node = node.parent.parent; } return node; @@ -10969,15 +11150,15 @@ var ts; ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; - return kind === 157 /* Constructor */ - || kind === 196 /* FunctionExpression */ - || kind === 239 /* FunctionDeclaration */ - || kind === 197 /* ArrowFunction */ - || kind === 156 /* MethodDeclaration */ - || kind === 158 /* GetAccessor */ - || kind === 159 /* SetAccessor */ - || kind === 244 /* ModuleDeclaration */ - || kind === 284 /* SourceFile */; + return kind === 158 /* Constructor */ + || kind === 197 /* FunctionExpression */ + || kind === 240 /* FunctionDeclaration */ + || kind === 198 /* ArrowFunction */ + || kind === 157 /* MethodDeclaration */ + || kind === 159 /* GetAccessor */ + || kind === 160 /* SetAccessor */ + || kind === 245 /* ModuleDeclaration */ + || kind === 285 /* SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(range) { @@ -10996,38 +11177,38 @@ var ts; })(Associativity = ts.Associativity || (ts.Associativity = {})); function getExpressionAssociativity(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 192 /* NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 193 /* NewExpression */ && expression.arguments !== undefined; return getOperatorAssociativity(expression.kind, operator, hasArguments); } ts.getExpressionAssociativity = getExpressionAssociativity; function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 192 /* NewExpression */: + case 193 /* NewExpression */: return hasArguments ? 0 /* Left */ : 1 /* Right */; - case 202 /* PrefixUnaryExpression */: - case 199 /* TypeOfExpression */: - case 200 /* VoidExpression */: - case 198 /* DeleteExpression */: - case 201 /* AwaitExpression */: - case 205 /* ConditionalExpression */: - case 207 /* YieldExpression */: + case 203 /* PrefixUnaryExpression */: + case 200 /* TypeOfExpression */: + case 201 /* VoidExpression */: + case 199 /* DeleteExpression */: + case 202 /* AwaitExpression */: + case 206 /* ConditionalExpression */: + case 208 /* YieldExpression */: return 1 /* Right */; - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: switch (operator) { case 41 /* AsteriskAsteriskToken */: - case 59 /* EqualsToken */: - case 60 /* PlusEqualsToken */: - case 61 /* MinusEqualsToken */: - case 63 /* AsteriskAsteriskEqualsToken */: - case 62 /* AsteriskEqualsToken */: - case 64 /* SlashEqualsToken */: - case 65 /* PercentEqualsToken */: - case 66 /* LessThanLessThanEqualsToken */: - case 67 /* GreaterThanGreaterThanEqualsToken */: - case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 69 /* AmpersandEqualsToken */: - case 71 /* CaretEqualsToken */: - case 70 /* BarEqualsToken */: + case 60 /* EqualsToken */: + case 61 /* PlusEqualsToken */: + case 62 /* MinusEqualsToken */: + case 64 /* AsteriskAsteriskEqualsToken */: + case 63 /* AsteriskEqualsToken */: + case 65 /* SlashEqualsToken */: + case 66 /* PercentEqualsToken */: + case 67 /* LessThanLessThanEqualsToken */: + case 68 /* GreaterThanGreaterThanEqualsToken */: + case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 70 /* AmpersandEqualsToken */: + case 72 /* CaretEqualsToken */: + case 71 /* BarEqualsToken */: return 1 /* Right */; } } @@ -11036,15 +11217,15 @@ var ts; ts.getOperatorAssociativity = getOperatorAssociativity; function getExpressionPrecedence(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 192 /* NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 193 /* NewExpression */ && expression.arguments !== undefined; return getOperatorPrecedence(expression.kind, operator, hasArguments); } ts.getExpressionPrecedence = getExpressionPrecedence; function getOperator(expression) { - if (expression.kind === 204 /* BinaryExpression */) { + if (expression.kind === 205 /* BinaryExpression */) { return expression.operatorToken.kind; } - else if (expression.kind === 202 /* PrefixUnaryExpression */ || expression.kind === 203 /* PostfixUnaryExpression */) { + else if (expression.kind === 203 /* PrefixUnaryExpression */ || expression.kind === 204 /* PostfixUnaryExpression */) { return expression.operator; } else { @@ -11054,73 +11235,73 @@ var ts; ts.getOperator = getOperator; function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) { switch (nodeKind) { - case 314 /* CommaListExpression */: + case 315 /* CommaListExpression */: return 0; - case 208 /* SpreadElement */: + case 209 /* SpreadElement */: return 1; - case 207 /* YieldExpression */: + case 208 /* YieldExpression */: return 2; - case 205 /* ConditionalExpression */: + case 206 /* ConditionalExpression */: return 4; - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: switch (operatorKind) { case 27 /* CommaToken */: return 0; - case 59 /* EqualsToken */: - case 60 /* PlusEqualsToken */: - case 61 /* MinusEqualsToken */: - case 63 /* AsteriskAsteriskEqualsToken */: - case 62 /* AsteriskEqualsToken */: - case 64 /* SlashEqualsToken */: - case 65 /* PercentEqualsToken */: - case 66 /* LessThanLessThanEqualsToken */: - case 67 /* GreaterThanGreaterThanEqualsToken */: - case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 69 /* AmpersandEqualsToken */: - case 71 /* CaretEqualsToken */: - case 70 /* BarEqualsToken */: + case 60 /* EqualsToken */: + case 61 /* PlusEqualsToken */: + case 62 /* MinusEqualsToken */: + case 64 /* AsteriskAsteriskEqualsToken */: + case 63 /* AsteriskEqualsToken */: + case 65 /* SlashEqualsToken */: + case 66 /* PercentEqualsToken */: + case 67 /* LessThanLessThanEqualsToken */: + case 68 /* GreaterThanGreaterThanEqualsToken */: + case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 70 /* AmpersandEqualsToken */: + case 72 /* CaretEqualsToken */: + case 71 /* BarEqualsToken */: return 3; default: return getBinaryOperatorPrecedence(operatorKind); } - case 202 /* PrefixUnaryExpression */: - case 199 /* TypeOfExpression */: - case 200 /* VoidExpression */: - case 198 /* DeleteExpression */: - case 201 /* AwaitExpression */: + case 203 /* PrefixUnaryExpression */: + case 200 /* TypeOfExpression */: + case 201 /* VoidExpression */: + case 199 /* DeleteExpression */: + case 202 /* AwaitExpression */: return 16; - case 203 /* PostfixUnaryExpression */: + case 204 /* PostfixUnaryExpression */: return 17; - case 191 /* CallExpression */: + case 192 /* CallExpression */: return 18; - case 192 /* NewExpression */: + case 193 /* NewExpression */: return hasArguments ? 19 : 18; - case 193 /* TaggedTemplateExpression */: - case 189 /* PropertyAccessExpression */: - case 190 /* ElementAccessExpression */: + case 194 /* TaggedTemplateExpression */: + case 190 /* PropertyAccessExpression */: + case 191 /* ElementAccessExpression */: return 19; - case 100 /* ThisKeyword */: - case 98 /* SuperKeyword */: - case 72 /* Identifier */: - case 96 /* NullKeyword */: - case 102 /* TrueKeyword */: - case 87 /* FalseKeyword */: + case 101 /* ThisKeyword */: + case 99 /* SuperKeyword */: + case 73 /* Identifier */: + case 97 /* NullKeyword */: + case 103 /* TrueKeyword */: + case 88 /* FalseKeyword */: case 8 /* NumericLiteral */: case 9 /* BigIntLiteral */: case 10 /* StringLiteral */: - case 187 /* ArrayLiteralExpression */: - case 188 /* ObjectLiteralExpression */: - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: - case 209 /* ClassExpression */: - case 260 /* JsxElement */: - case 261 /* JsxSelfClosingElement */: - case 264 /* JsxFragment */: + case 188 /* ArrayLiteralExpression */: + case 189 /* ObjectLiteralExpression */: + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: + case 210 /* ClassExpression */: + case 261 /* JsxElement */: + case 262 /* JsxSelfClosingElement */: + case 265 /* JsxFragment */: case 13 /* RegularExpressionLiteral */: case 14 /* NoSubstitutionTemplateLiteral */: - case 206 /* TemplateExpression */: - case 195 /* ParenthesizedExpression */: - case 210 /* OmittedExpression */: + case 207 /* TemplateExpression */: + case 196 /* ParenthesizedExpression */: + case 211 /* OmittedExpression */: return 20; default: return -1; @@ -11148,9 +11329,9 @@ var ts; case 30 /* GreaterThanToken */: case 31 /* LessThanEqualsToken */: case 32 /* GreaterThanEqualsToken */: - case 94 /* InstanceOfKeyword */: - case 93 /* InKeyword */: - case 119 /* AsKeyword */: + case 95 /* InstanceOfKeyword */: + case 94 /* InKeyword */: + case 120 /* AsKeyword */: return 11; case 46 /* LessThanLessThanToken */: case 47 /* GreaterThanGreaterThanToken */: @@ -11612,11 +11793,11 @@ var ts; } ts.parameterIsThisKeyword = parameterIsThisKeyword; function isThisIdentifier(node) { - return !!node && node.kind === 72 /* Identifier */ && identifierIsThisKeyword(node); + return !!node && node.kind === 73 /* Identifier */ && identifierIsThisKeyword(node); } ts.isThisIdentifier = isThisIdentifier; function identifierIsThisKeyword(id) { - return id.originalKeywordKind === 100 /* ThisKeyword */; + return id.originalKeywordKind === 101 /* ThisKeyword */; } ts.identifierIsThisKeyword = identifierIsThisKeyword; function getAllAccessorDeclarations(declarations, accessor) { @@ -11627,10 +11808,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 158 /* GetAccessor */) { + if (accessor.kind === 159 /* GetAccessor */) { getAccessor = accessor; } - else if (accessor.kind === 159 /* SetAccessor */) { + else if (accessor.kind === 160 /* SetAccessor */) { setAccessor = accessor; } else { @@ -11650,10 +11831,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 158 /* GetAccessor */ && !getAccessor) { + if (member.kind === 159 /* GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 159 /* SetAccessor */ && !setAccessor) { + if (member.kind === 160 /* SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -11699,7 +11880,7 @@ var ts; ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations; /** template tags are only available when a typedef isn't already using them */ function isNonTypeAliasTemplate(tag) { - return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 296 /* JSDocComment */ && tag.parent.tags.some(isJSDocTypeAlias)); + return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 297 /* JSDocComment */ && tag.parent.tags.some(isJSDocTypeAlias)); } /** * Gets the effective type annotation of the value parameter of a set accessor. If the node @@ -11939,7 +12120,7 @@ var ts; flags |= modifierToFlag(modifier.kind); } } - if (node.flags & 4 /* NestedNamespace */ || (node.kind === 72 /* Identifier */ && node.isInJSDocNamespace)) { + if (node.flags & 4 /* NestedNamespace */ || (node.kind === 73 /* Identifier */ && node.isInJSDocNamespace)) { flags |= 1 /* Export */; } return flags; @@ -11947,17 +12128,17 @@ var ts; ts.getModifierFlagsNoCache = getModifierFlagsNoCache; function modifierToFlag(token) { switch (token) { - case 116 /* StaticKeyword */: return 32 /* Static */; - case 115 /* PublicKeyword */: return 4 /* Public */; - case 114 /* ProtectedKeyword */: return 16 /* Protected */; - case 113 /* PrivateKeyword */: return 8 /* Private */; - case 118 /* AbstractKeyword */: return 128 /* Abstract */; - case 85 /* ExportKeyword */: return 1 /* Export */; - case 125 /* DeclareKeyword */: return 2 /* Ambient */; - case 77 /* ConstKeyword */: return 2048 /* Const */; - case 80 /* DefaultKeyword */: return 512 /* Default */; - case 121 /* AsyncKeyword */: return 256 /* Async */; - case 133 /* ReadonlyKeyword */: return 64 /* Readonly */; + case 117 /* StaticKeyword */: return 32 /* Static */; + case 116 /* PublicKeyword */: return 4 /* Public */; + case 115 /* ProtectedKeyword */: return 16 /* Protected */; + case 114 /* PrivateKeyword */: return 8 /* Private */; + case 119 /* AbstractKeyword */: return 128 /* Abstract */; + case 86 /* ExportKeyword */: return 1 /* Export */; + case 126 /* DeclareKeyword */: return 2 /* Ambient */; + case 78 /* ConstKeyword */: return 2048 /* Const */; + case 81 /* DefaultKeyword */: return 512 /* Default */; + case 122 /* AsyncKeyword */: return 256 /* Async */; + case 134 /* ReadonlyKeyword */: return 64 /* Readonly */; } return 0 /* None */; } @@ -11969,7 +12150,7 @@ var ts; } ts.isLogicalOperator = isLogicalOperator; function isAssignmentOperator(token) { - return token >= 59 /* FirstAssignment */ && token <= 71 /* LastAssignment */; + return token >= 60 /* FirstAssignment */ && token <= 72 /* LastAssignment */; } ts.isAssignmentOperator = isAssignmentOperator; /** Get `C` given `N` if `N` is in the position `class C extends N` where `N` is an ExpressionWithTypeArguments. */ @@ -11982,14 +12163,14 @@ var ts; return ts.isExpressionWithTypeArguments(node) && ts.isHeritageClause(node.parent) && ts.isClassLike(node.parent.parent) - ? { class: node.parent.parent, isImplements: node.parent.token === 109 /* ImplementsKeyword */ } + ? { class: node.parent.parent, isImplements: node.parent.token === 110 /* ImplementsKeyword */ } : undefined; } ts.tryGetClassImplementingOrExtendingExpressionWithTypeArguments = tryGetClassImplementingOrExtendingExpressionWithTypeArguments; function isAssignmentExpression(node, excludeCompoundAssignment) { return ts.isBinaryExpression(node) && (excludeCompoundAssignment - ? node.operatorToken.kind === 59 /* EqualsToken */ + ? node.operatorToken.kind === 60 /* EqualsToken */ : isAssignmentOperator(node.operatorToken.kind)) && ts.isLeftHandSideExpression(node.left); } @@ -11997,8 +12178,8 @@ var ts; function isDestructuringAssignment(node) { if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { var kind = node.left.kind; - return kind === 188 /* ObjectLiteralExpression */ - || kind === 187 /* ArrayLiteralExpression */; + return kind === 189 /* ObjectLiteralExpression */ + || kind === 188 /* ArrayLiteralExpression */; } return false; } @@ -12008,29 +12189,39 @@ var ts; } ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; function isEntityNameExpression(node) { - return node.kind === 72 /* Identifier */ || isPropertyAccessEntityNameExpression(node); + return node.kind === 73 /* Identifier */ || isPropertyAccessEntityNameExpression(node); } ts.isEntityNameExpression = isEntityNameExpression; function isPropertyAccessEntityNameExpression(node) { return ts.isPropertyAccessExpression(node) && isEntityNameExpression(node.expression); } ts.isPropertyAccessEntityNameExpression = isPropertyAccessEntityNameExpression; + function tryGetPropertyAccessOrIdentifierToString(expr) { + if (ts.isPropertyAccessExpression(expr)) { + return tryGetPropertyAccessOrIdentifierToString(expr.expression) + "." + expr.name; + } + if (ts.isIdentifier(expr)) { + return ts.unescapeLeadingUnderscores(expr.escapedText); + } + return undefined; + } + ts.tryGetPropertyAccessOrIdentifierToString = tryGetPropertyAccessOrIdentifierToString; function isPrototypeAccess(node) { return ts.isPropertyAccessExpression(node) && node.name.escapedText === "prototype"; } ts.isPrototypeAccess = isPrototypeAccess; function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 148 /* QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 189 /* PropertyAccessExpression */ && node.parent.name === node); + return (node.parent.kind === 149 /* QualifiedName */ && node.parent.right === node) || + (node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isEmptyObjectLiteral(expression) { - return expression.kind === 188 /* ObjectLiteralExpression */ && + return expression.kind === 189 /* ObjectLiteralExpression */ && expression.properties.length === 0; } ts.isEmptyObjectLiteral = isEmptyObjectLiteral; function isEmptyArrayLiteral(expression) { - return expression.kind === 187 /* ArrayLiteralExpression */ && + return expression.kind === 188 /* ArrayLiteralExpression */ && expression.elements.length === 0; } ts.isEmptyArrayLiteral = isEmptyArrayLiteral; @@ -12218,77 +12409,6 @@ var ts; return getNewLine ? getNewLine() : ts.sys ? ts.sys.newLine : carriageReturnLineFeed; } ts.getNewLineCharacter = getNewLineCharacter; - /** - * Formats an enum value as a string for debugging and debug assertions. - */ - function formatEnum(value, enumObject, isFlags) { - if (value === void 0) { value = 0; } - var members = getEnumMembers(enumObject); - if (value === 0) { - return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0"; - } - if (isFlags) { - var result = ""; - var remainingFlags = value; - for (var i = members.length - 1; i >= 0 && remainingFlags !== 0; i--) { - var _a = members[i], enumValue = _a[0], enumName = _a[1]; - if (enumValue !== 0 && (remainingFlags & enumValue) === enumValue) { - remainingFlags &= ~enumValue; - result = "" + enumName + (result ? ", " : "") + result; - } - } - if (remainingFlags === 0) { - return result; - } - } - else { - for (var _i = 0, members_1 = members; _i < members_1.length; _i++) { - var _b = members_1[_i], enumValue = _b[0], enumName = _b[1]; - if (enumValue === value) { - return enumName; - } - } - } - return value.toString(); - } - function getEnumMembers(enumObject) { - var result = []; - for (var name in enumObject) { - var value = enumObject[name]; - if (typeof value === "number") { - result.push([value, name]); - } - } - return ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); }); - } - function formatSyntaxKind(kind) { - return formatEnum(kind, ts.SyntaxKind, /*isFlags*/ false); - } - ts.formatSyntaxKind = formatSyntaxKind; - function formatModifierFlags(flags) { - return formatEnum(flags, ts.ModifierFlags, /*isFlags*/ true); - } - ts.formatModifierFlags = formatModifierFlags; - function formatTransformFlags(flags) { - return formatEnum(flags, ts.TransformFlags, /*isFlags*/ true); - } - ts.formatTransformFlags = formatTransformFlags; - function formatEmitFlags(flags) { - return formatEnum(flags, ts.EmitFlags, /*isFlags*/ true); - } - ts.formatEmitFlags = formatEmitFlags; - function formatSymbolFlags(flags) { - return formatEnum(flags, ts.SymbolFlags, /*isFlags*/ true); - } - ts.formatSymbolFlags = formatSymbolFlags; - function formatTypeFlags(flags) { - return formatEnum(flags, ts.TypeFlags, /*isFlags*/ true); - } - ts.formatTypeFlags = formatTypeFlags; - function formatObjectFlags(flags) { - return formatEnum(flags, ts.ObjectFlags, /*isFlags*/ true); - } - ts.formatObjectFlags = formatObjectFlags; /** * Creates a new TextRange from the provided pos and end. * @@ -12378,6 +12498,10 @@ var ts; return positionsAreOnSameLine(range1.end, getStartPositionOfRange(range2, sourceFile), sourceFile); } ts.rangeEndIsOnSameLineAsRangeStart = rangeEndIsOnSameLineAsRangeStart; + function isNodeArrayMultiLine(list, sourceFile) { + return !positionsAreOnSameLine(list.pos, list.end, sourceFile); + } + ts.isNodeArrayMultiLine = isNodeArrayMultiLine; function positionsAreOnSameLine(pos1, pos2, sourceFile) { return pos1 === pos2 || getLineOfLocalPosition(sourceFile, pos1) === getLineOfLocalPosition(sourceFile, pos2); @@ -12395,8 +12519,8 @@ var ts; var parseNode = ts.getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 243 /* EnumDeclaration */: - case 244 /* ModuleDeclaration */: + case 244 /* EnumDeclaration */: + case 245 /* ModuleDeclaration */: return parseNode === parseNode.parent.name; } } @@ -12430,10 +12554,10 @@ var ts; } if (getCheckFlags(s) & 6 /* Synthetic */) { var checkFlags = s.checkFlags; - var accessModifier = checkFlags & 512 /* ContainsPrivate */ ? 8 /* Private */ : - checkFlags & 128 /* ContainsPublic */ ? 4 /* Public */ : + var accessModifier = checkFlags & 1024 /* ContainsPrivate */ ? 8 /* Private */ : + checkFlags & 256 /* ContainsPublic */ ? 4 /* Public */ : 16 /* Protected */; - var staticModifier = checkFlags & 1024 /* ContainsStatic */ ? 32 /* Static */ : 0; + var staticModifier = checkFlags & 2048 /* ContainsStatic */ ? 32 /* Static */ : 0; return accessModifier | staticModifier; } if (s.flags & 4194304 /* Prototype */) { @@ -12473,35 +12597,35 @@ var ts; if (!parent) return 0 /* Read */; switch (parent.kind) { - case 195 /* ParenthesizedExpression */: + case 196 /* ParenthesizedExpression */: return accessKind(parent); - case 203 /* PostfixUnaryExpression */: - case 202 /* PrefixUnaryExpression */: + case 204 /* PostfixUnaryExpression */: + case 203 /* PrefixUnaryExpression */: var operator = parent.operator; return operator === 44 /* PlusPlusToken */ || operator === 45 /* MinusMinusToken */ ? writeOrReadWrite() : 0 /* Read */; - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: var _a = parent, left = _a.left, operatorToken = _a.operatorToken; return left === node && isAssignmentOperator(operatorToken.kind) ? - operatorToken.kind === 59 /* EqualsToken */ ? 1 /* Write */ : writeOrReadWrite() + operatorToken.kind === 60 /* EqualsToken */ ? 1 /* Write */ : writeOrReadWrite() : 0 /* Read */; - case 189 /* PropertyAccessExpression */: + case 190 /* PropertyAccessExpression */: return parent.name !== node ? 0 /* Read */ : accessKind(parent); - case 275 /* PropertyAssignment */: { + case 276 /* PropertyAssignment */: { var parentAccess = accessKind(parent.parent); // In `({ x: varname }) = { x: 1 }`, the left `x` is a read, the right `x` is a write. return node === parent.name ? reverseAccessKind(parentAccess) : parentAccess; } - case 276 /* ShorthandPropertyAssignment */: + case 277 /* ShorthandPropertyAssignment */: // Assume it's the local variable being accessed, since we don't check public properties for --noUnusedLocals. return node === parent.objectAssignmentInitializer ? 0 /* Read */ : accessKind(parent.parent); - case 187 /* ArrayLiteralExpression */: + case 188 /* ArrayLiteralExpression */: return accessKind(parent); default: return 0 /* Read */; } function writeOrReadWrite() { // If grandparent is not an ExpressionStatement, this is used as an expression in addition to having a side effect. - return parent.parent && skipParenthesesUp(parent.parent).kind === 221 /* ExpressionStatement */ ? 1 /* Write */ : 2 /* ReadWrite */; + return parent.parent && skipParenthesesUp(parent.parent).kind === 222 /* ExpressionStatement */ ? 1 /* Write */ : 2 /* ReadWrite */; } } function reverseAccessKind(a) { @@ -12604,7 +12728,7 @@ var ts; } ts.getClassLikeDeclarationOfSymbol = getClassLikeDeclarationOfSymbol; function getObjectFlags(type) { - return type.flags & 3768320 /* ObjectFlagsType */ ? type.objectFlags : 0; + return type.flags & 3899392 /* ObjectFlagsType */ ? type.objectFlags : 0; } ts.getObjectFlags = getObjectFlags; function typeHasCallOrConstructSignatures(type, checker) { @@ -12656,32 +12780,32 @@ var ts; } ts.isObjectTypeDeclaration = isObjectTypeDeclaration; function isTypeNodeKind(kind) { - return (kind >= 163 /* FirstTypeNode */ && kind <= 183 /* LastTypeNode */) - || kind === 120 /* AnyKeyword */ - || kind === 143 /* UnknownKeyword */ - || kind === 135 /* NumberKeyword */ - || kind === 146 /* BigIntKeyword */ - || kind === 136 /* ObjectKeyword */ - || kind === 123 /* BooleanKeyword */ - || kind === 138 /* StringKeyword */ - || kind === 139 /* SymbolKeyword */ - || kind === 100 /* ThisKeyword */ - || kind === 106 /* VoidKeyword */ - || kind === 141 /* UndefinedKeyword */ - || kind === 96 /* NullKeyword */ - || kind === 132 /* NeverKeyword */ - || kind === 211 /* ExpressionWithTypeArguments */ - || kind === 289 /* JSDocAllType */ - || kind === 290 /* JSDocUnknownType */ - || kind === 291 /* JSDocNullableType */ - || kind === 292 /* JSDocNonNullableType */ - || kind === 293 /* JSDocOptionalType */ - || kind === 294 /* JSDocFunctionType */ - || kind === 295 /* JSDocVariadicType */; + return (kind >= 164 /* FirstTypeNode */ && kind <= 184 /* LastTypeNode */) + || kind === 121 /* AnyKeyword */ + || kind === 144 /* UnknownKeyword */ + || kind === 136 /* NumberKeyword */ + || kind === 147 /* BigIntKeyword */ + || kind === 137 /* ObjectKeyword */ + || kind === 124 /* BooleanKeyword */ + || kind === 139 /* StringKeyword */ + || kind === 140 /* SymbolKeyword */ + || kind === 101 /* ThisKeyword */ + || kind === 107 /* VoidKeyword */ + || kind === 142 /* UndefinedKeyword */ + || kind === 97 /* NullKeyword */ + || kind === 133 /* NeverKeyword */ + || kind === 212 /* ExpressionWithTypeArguments */ + || kind === 290 /* JSDocAllType */ + || kind === 291 /* JSDocUnknownType */ + || kind === 292 /* JSDocNullableType */ + || kind === 293 /* JSDocNonNullableType */ + || kind === 294 /* JSDocOptionalType */ + || kind === 295 /* JSDocFunctionType */ + || kind === 296 /* JSDocVariadicType */; } ts.isTypeNodeKind = isTypeNodeKind; function isAccessExpression(node) { - return node.kind === 189 /* PropertyAccessExpression */ || node.kind === 190 /* ElementAccessExpression */; + return node.kind === 190 /* PropertyAccessExpression */ || node.kind === 191 /* ElementAccessExpression */; } ts.isAccessExpression = isAccessExpression; function isBundleFileTextLike(section) { @@ -12698,8 +12822,10 @@ var ts; (function (ts) { function getDefaultLibFileName(options) { switch (options.target) { - case 7 /* ESNext */: + case 8 /* ESNext */: return "lib.esnext.full.d.ts"; + case 7 /* ES2020 */: + return "lib.es2020.full.d.ts"; case 6 /* ES2019 */: return "lib.es2019.full.d.ts"; case 5 /* ES2018 */: @@ -12916,9 +13042,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 150 /* TypeParameter */) { + if (d && d.kind === 151 /* TypeParameter */) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 241 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 242 /* InterfaceDeclaration */) { return current; } } @@ -12926,7 +13052,7 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; function isParameterPropertyDeclaration(node) { - return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) && node.parent.kind === 157 /* Constructor */; + return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) && node.parent.kind === 158 /* Constructor */; } ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; function isEmptyBindingPattern(node) { @@ -12956,14 +13082,14 @@ var ts; node = walkUpBindingElementsAndPatterns(node); } var flags = getFlags(node); - if (node.kind === 237 /* VariableDeclaration */) { + if (node.kind === 238 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 238 /* VariableDeclarationList */) { + if (node && node.kind === 239 /* VariableDeclarationList */) { flags |= getFlags(node); node = node.parent; } - if (node && node.kind === 219 /* VariableStatement */) { + if (node && node.kind === 220 /* VariableStatement */) { flags |= getFlags(node); } return flags; @@ -13109,27 +13235,27 @@ var ts; } // Covers remaining cases (returning undefined if none match). switch (hostNode.kind) { - case 219 /* VariableStatement */: + case 220 /* VariableStatement */: if (hostNode.declarationList && hostNode.declarationList.declarations[0]) { return getDeclarationIdentifier(hostNode.declarationList.declarations[0]); } break; - case 221 /* ExpressionStatement */: + case 222 /* ExpressionStatement */: var expr = hostNode.expression; switch (expr.kind) { - case 189 /* PropertyAccessExpression */: + case 190 /* PropertyAccessExpression */: return expr.name; - case 190 /* ElementAccessExpression */: + case 191 /* ElementAccessExpression */: var arg = expr.argumentExpression; if (ts.isIdentifier(arg)) { return arg; } } break; - case 195 /* ParenthesizedExpression */: { + case 196 /* ParenthesizedExpression */: { return getDeclarationIdentifier(hostNode.expression); } - case 233 /* LabeledStatement */: { + case 234 /* LabeledStatement */: { if (ts.isDeclaration(hostNode.statement) || ts.isExpression(hostNode.statement)) { return getDeclarationIdentifier(hostNode.statement); } @@ -13153,18 +13279,18 @@ var ts; /** @internal */ function getNonAssignedNameOfDeclaration(declaration) { switch (declaration.kind) { - case 72 /* Identifier */: + case 73 /* Identifier */: return declaration; - case 310 /* JSDocPropertyTag */: - case 304 /* JSDocParameterTag */: { + case 311 /* JSDocPropertyTag */: + case 305 /* JSDocParameterTag */: { var name = declaration.name; - if (name.kind === 148 /* QualifiedName */) { + if (name.kind === 149 /* QualifiedName */) { return name.right; } break; } - case 191 /* CallExpression */: - case 204 /* BinaryExpression */: { + case 192 /* CallExpression */: + case 205 /* BinaryExpression */: { var expr = declaration; switch (ts.getAssignmentDeclarationKind(expr)) { case 1 /* ExportsProperty */: @@ -13180,9 +13306,9 @@ var ts; return undefined; } } - case 309 /* JSDocTypedefTag */: + case 310 /* JSDocTypedefTag */: return getNameOfJSDocTypedef(declaration); - case 254 /* ExportAssignment */: { + case 255 /* ExportAssignment */: { var expression = declaration.expression; return ts.isIdentifier(expression) ? expression : undefined; } @@ -13384,7 +13510,7 @@ var ts; return ts.emptyArray; } if (ts.isJSDocTypeAlias(node)) { - ts.Debug.assert(node.parent.kind === 296 /* JSDocComment */); + ts.Debug.assert(node.parent.kind === 297 /* JSDocComment */); return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; }); } if (node.typeParameters) { @@ -13452,198 +13578,198 @@ var ts; } ts.isTemplateTail = isTemplateTail; function isIdentifier(node) { - return node.kind === 72 /* Identifier */; + return node.kind === 73 /* Identifier */; } ts.isIdentifier = isIdentifier; // Names function isQualifiedName(node) { - return node.kind === 148 /* QualifiedName */; + return node.kind === 149 /* QualifiedName */; } ts.isQualifiedName = isQualifiedName; function isComputedPropertyName(node) { - return node.kind === 149 /* ComputedPropertyName */; + return node.kind === 150 /* ComputedPropertyName */; } ts.isComputedPropertyName = isComputedPropertyName; // Signature elements function isTypeParameterDeclaration(node) { - return node.kind === 150 /* TypeParameter */; + return node.kind === 151 /* TypeParameter */; } ts.isTypeParameterDeclaration = isTypeParameterDeclaration; function isParameter(node) { - return node.kind === 151 /* Parameter */; + return node.kind === 152 /* Parameter */; } ts.isParameter = isParameter; function isDecorator(node) { - return node.kind === 152 /* Decorator */; + return node.kind === 153 /* Decorator */; } ts.isDecorator = isDecorator; // TypeMember function isPropertySignature(node) { - return node.kind === 153 /* PropertySignature */; + return node.kind === 154 /* PropertySignature */; } ts.isPropertySignature = isPropertySignature; function isPropertyDeclaration(node) { - return node.kind === 154 /* PropertyDeclaration */; + return node.kind === 155 /* PropertyDeclaration */; } ts.isPropertyDeclaration = isPropertyDeclaration; function isMethodSignature(node) { - return node.kind === 155 /* MethodSignature */; + return node.kind === 156 /* MethodSignature */; } ts.isMethodSignature = isMethodSignature; function isMethodDeclaration(node) { - return node.kind === 156 /* MethodDeclaration */; + return node.kind === 157 /* MethodDeclaration */; } ts.isMethodDeclaration = isMethodDeclaration; function isConstructorDeclaration(node) { - return node.kind === 157 /* Constructor */; + return node.kind === 158 /* Constructor */; } ts.isConstructorDeclaration = isConstructorDeclaration; function isGetAccessorDeclaration(node) { - return node.kind === 158 /* GetAccessor */; + return node.kind === 159 /* GetAccessor */; } ts.isGetAccessorDeclaration = isGetAccessorDeclaration; function isSetAccessorDeclaration(node) { - return node.kind === 159 /* SetAccessor */; + return node.kind === 160 /* SetAccessor */; } ts.isSetAccessorDeclaration = isSetAccessorDeclaration; function isCallSignatureDeclaration(node) { - return node.kind === 160 /* CallSignature */; + return node.kind === 161 /* CallSignature */; } ts.isCallSignatureDeclaration = isCallSignatureDeclaration; function isConstructSignatureDeclaration(node) { - return node.kind === 161 /* ConstructSignature */; + return node.kind === 162 /* ConstructSignature */; } ts.isConstructSignatureDeclaration = isConstructSignatureDeclaration; function isIndexSignatureDeclaration(node) { - return node.kind === 162 /* IndexSignature */; + return node.kind === 163 /* IndexSignature */; } ts.isIndexSignatureDeclaration = isIndexSignatureDeclaration; /* @internal */ function isGetOrSetAccessorDeclaration(node) { - return node.kind === 159 /* SetAccessor */ || node.kind === 158 /* GetAccessor */; + return node.kind === 160 /* SetAccessor */ || node.kind === 159 /* GetAccessor */; } ts.isGetOrSetAccessorDeclaration = isGetOrSetAccessorDeclaration; // Type function isTypePredicateNode(node) { - return node.kind === 163 /* TypePredicate */; + return node.kind === 164 /* TypePredicate */; } ts.isTypePredicateNode = isTypePredicateNode; function isTypeReferenceNode(node) { - return node.kind === 164 /* TypeReference */; + return node.kind === 165 /* TypeReference */; } ts.isTypeReferenceNode = isTypeReferenceNode; function isFunctionTypeNode(node) { - return node.kind === 165 /* FunctionType */; + return node.kind === 166 /* FunctionType */; } ts.isFunctionTypeNode = isFunctionTypeNode; function isConstructorTypeNode(node) { - return node.kind === 166 /* ConstructorType */; + return node.kind === 167 /* ConstructorType */; } ts.isConstructorTypeNode = isConstructorTypeNode; function isTypeQueryNode(node) { - return node.kind === 167 /* TypeQuery */; + return node.kind === 168 /* TypeQuery */; } ts.isTypeQueryNode = isTypeQueryNode; function isTypeLiteralNode(node) { - return node.kind === 168 /* TypeLiteral */; + return node.kind === 169 /* TypeLiteral */; } ts.isTypeLiteralNode = isTypeLiteralNode; function isArrayTypeNode(node) { - return node.kind === 169 /* ArrayType */; + return node.kind === 170 /* ArrayType */; } ts.isArrayTypeNode = isArrayTypeNode; function isTupleTypeNode(node) { - return node.kind === 170 /* TupleType */; + return node.kind === 171 /* TupleType */; } ts.isTupleTypeNode = isTupleTypeNode; function isUnionTypeNode(node) { - return node.kind === 173 /* UnionType */; + return node.kind === 174 /* UnionType */; } ts.isUnionTypeNode = isUnionTypeNode; function isIntersectionTypeNode(node) { - return node.kind === 174 /* IntersectionType */; + return node.kind === 175 /* IntersectionType */; } ts.isIntersectionTypeNode = isIntersectionTypeNode; function isConditionalTypeNode(node) { - return node.kind === 175 /* ConditionalType */; + return node.kind === 176 /* ConditionalType */; } ts.isConditionalTypeNode = isConditionalTypeNode; function isInferTypeNode(node) { - return node.kind === 176 /* InferType */; + return node.kind === 177 /* InferType */; } ts.isInferTypeNode = isInferTypeNode; function isParenthesizedTypeNode(node) { - return node.kind === 177 /* ParenthesizedType */; + return node.kind === 178 /* ParenthesizedType */; } ts.isParenthesizedTypeNode = isParenthesizedTypeNode; function isThisTypeNode(node) { - return node.kind === 178 /* ThisType */; + return node.kind === 179 /* ThisType */; } ts.isThisTypeNode = isThisTypeNode; function isTypeOperatorNode(node) { - return node.kind === 179 /* TypeOperator */; + return node.kind === 180 /* TypeOperator */; } ts.isTypeOperatorNode = isTypeOperatorNode; function isIndexedAccessTypeNode(node) { - return node.kind === 180 /* IndexedAccessType */; + return node.kind === 181 /* IndexedAccessType */; } ts.isIndexedAccessTypeNode = isIndexedAccessTypeNode; function isMappedTypeNode(node) { - return node.kind === 181 /* MappedType */; + return node.kind === 182 /* MappedType */; } ts.isMappedTypeNode = isMappedTypeNode; function isLiteralTypeNode(node) { - return node.kind === 182 /* LiteralType */; + return node.kind === 183 /* LiteralType */; } ts.isLiteralTypeNode = isLiteralTypeNode; function isImportTypeNode(node) { - return node.kind === 183 /* ImportType */; + return node.kind === 184 /* ImportType */; } ts.isImportTypeNode = isImportTypeNode; // Binding patterns function isObjectBindingPattern(node) { - return node.kind === 184 /* ObjectBindingPattern */; + return node.kind === 185 /* ObjectBindingPattern */; } ts.isObjectBindingPattern = isObjectBindingPattern; function isArrayBindingPattern(node) { - return node.kind === 185 /* ArrayBindingPattern */; + return node.kind === 186 /* ArrayBindingPattern */; } ts.isArrayBindingPattern = isArrayBindingPattern; function isBindingElement(node) { - return node.kind === 186 /* BindingElement */; + return node.kind === 187 /* BindingElement */; } ts.isBindingElement = isBindingElement; // Expression function isArrayLiteralExpression(node) { - return node.kind === 187 /* ArrayLiteralExpression */; + return node.kind === 188 /* ArrayLiteralExpression */; } ts.isArrayLiteralExpression = isArrayLiteralExpression; function isObjectLiteralExpression(node) { - return node.kind === 188 /* ObjectLiteralExpression */; + return node.kind === 189 /* ObjectLiteralExpression */; } ts.isObjectLiteralExpression = isObjectLiteralExpression; function isPropertyAccessExpression(node) { - return node.kind === 189 /* PropertyAccessExpression */; + return node.kind === 190 /* PropertyAccessExpression */; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 190 /* ElementAccessExpression */; + return node.kind === 191 /* ElementAccessExpression */; } ts.isElementAccessExpression = isElementAccessExpression; function isCallExpression(node) { - return node.kind === 191 /* CallExpression */; + return node.kind === 192 /* CallExpression */; } ts.isCallExpression = isCallExpression; function isNewExpression(node) { - return node.kind === 192 /* NewExpression */; + return node.kind === 193 /* NewExpression */; } ts.isNewExpression = isNewExpression; function isTaggedTemplateExpression(node) { - return node.kind === 193 /* TaggedTemplateExpression */; + return node.kind === 194 /* TaggedTemplateExpression */; } ts.isTaggedTemplateExpression = isTaggedTemplateExpression; function isTypeAssertion(node) { - return node.kind === 194 /* TypeAssertionExpression */; + return node.kind === 195 /* TypeAssertionExpression */; } ts.isTypeAssertion = isTypeAssertion; function isConstTypeReference(node) { @@ -13652,376 +13778,376 @@ var ts; } ts.isConstTypeReference = isConstTypeReference; function isParenthesizedExpression(node) { - return node.kind === 195 /* ParenthesizedExpression */; + return node.kind === 196 /* ParenthesizedExpression */; } ts.isParenthesizedExpression = isParenthesizedExpression; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 313 /* PartiallyEmittedExpression */) { + while (node.kind === 314 /* PartiallyEmittedExpression */) { node = node.expression; } return node; } ts.skipPartiallyEmittedExpressions = skipPartiallyEmittedExpressions; function isFunctionExpression(node) { - return node.kind === 196 /* FunctionExpression */; + return node.kind === 197 /* FunctionExpression */; } ts.isFunctionExpression = isFunctionExpression; function isArrowFunction(node) { - return node.kind === 197 /* ArrowFunction */; + return node.kind === 198 /* ArrowFunction */; } ts.isArrowFunction = isArrowFunction; function isDeleteExpression(node) { - return node.kind === 198 /* DeleteExpression */; + return node.kind === 199 /* DeleteExpression */; } ts.isDeleteExpression = isDeleteExpression; function isTypeOfExpression(node) { - return node.kind === 199 /* TypeOfExpression */; + return node.kind === 200 /* TypeOfExpression */; } ts.isTypeOfExpression = isTypeOfExpression; function isVoidExpression(node) { - return node.kind === 200 /* VoidExpression */; + return node.kind === 201 /* VoidExpression */; } ts.isVoidExpression = isVoidExpression; function isAwaitExpression(node) { - return node.kind === 201 /* AwaitExpression */; + return node.kind === 202 /* AwaitExpression */; } ts.isAwaitExpression = isAwaitExpression; function isPrefixUnaryExpression(node) { - return node.kind === 202 /* PrefixUnaryExpression */; + return node.kind === 203 /* PrefixUnaryExpression */; } ts.isPrefixUnaryExpression = isPrefixUnaryExpression; function isPostfixUnaryExpression(node) { - return node.kind === 203 /* PostfixUnaryExpression */; + return node.kind === 204 /* PostfixUnaryExpression */; } ts.isPostfixUnaryExpression = isPostfixUnaryExpression; function isBinaryExpression(node) { - return node.kind === 204 /* BinaryExpression */; + return node.kind === 205 /* BinaryExpression */; } ts.isBinaryExpression = isBinaryExpression; function isConditionalExpression(node) { - return node.kind === 205 /* ConditionalExpression */; + return node.kind === 206 /* ConditionalExpression */; } ts.isConditionalExpression = isConditionalExpression; function isTemplateExpression(node) { - return node.kind === 206 /* TemplateExpression */; + return node.kind === 207 /* TemplateExpression */; } ts.isTemplateExpression = isTemplateExpression; function isYieldExpression(node) { - return node.kind === 207 /* YieldExpression */; + return node.kind === 208 /* YieldExpression */; } ts.isYieldExpression = isYieldExpression; function isSpreadElement(node) { - return node.kind === 208 /* SpreadElement */; + return node.kind === 209 /* SpreadElement */; } ts.isSpreadElement = isSpreadElement; function isClassExpression(node) { - return node.kind === 209 /* ClassExpression */; + return node.kind === 210 /* ClassExpression */; } ts.isClassExpression = isClassExpression; function isOmittedExpression(node) { - return node.kind === 210 /* OmittedExpression */; + return node.kind === 211 /* OmittedExpression */; } ts.isOmittedExpression = isOmittedExpression; function isExpressionWithTypeArguments(node) { - return node.kind === 211 /* ExpressionWithTypeArguments */; + return node.kind === 212 /* ExpressionWithTypeArguments */; } ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; function isAsExpression(node) { - return node.kind === 212 /* AsExpression */; + return node.kind === 213 /* AsExpression */; } ts.isAsExpression = isAsExpression; function isNonNullExpression(node) { - return node.kind === 213 /* NonNullExpression */; + return node.kind === 214 /* NonNullExpression */; } ts.isNonNullExpression = isNonNullExpression; function isMetaProperty(node) { - return node.kind === 214 /* MetaProperty */; + return node.kind === 215 /* MetaProperty */; } ts.isMetaProperty = isMetaProperty; // Misc function isTemplateSpan(node) { - return node.kind === 216 /* TemplateSpan */; + return node.kind === 217 /* TemplateSpan */; } ts.isTemplateSpan = isTemplateSpan; function isSemicolonClassElement(node) { - return node.kind === 217 /* SemicolonClassElement */; + return node.kind === 218 /* SemicolonClassElement */; } ts.isSemicolonClassElement = isSemicolonClassElement; // Block function isBlock(node) { - return node.kind === 218 /* Block */; + return node.kind === 219 /* Block */; } ts.isBlock = isBlock; function isVariableStatement(node) { - return node.kind === 219 /* VariableStatement */; + return node.kind === 220 /* VariableStatement */; } ts.isVariableStatement = isVariableStatement; function isEmptyStatement(node) { - return node.kind === 220 /* EmptyStatement */; + return node.kind === 221 /* EmptyStatement */; } ts.isEmptyStatement = isEmptyStatement; function isExpressionStatement(node) { - return node.kind === 221 /* ExpressionStatement */; + return node.kind === 222 /* ExpressionStatement */; } ts.isExpressionStatement = isExpressionStatement; function isIfStatement(node) { - return node.kind === 222 /* IfStatement */; + return node.kind === 223 /* IfStatement */; } ts.isIfStatement = isIfStatement; function isDoStatement(node) { - return node.kind === 223 /* DoStatement */; + return node.kind === 224 /* DoStatement */; } ts.isDoStatement = isDoStatement; function isWhileStatement(node) { - return node.kind === 224 /* WhileStatement */; + return node.kind === 225 /* WhileStatement */; } ts.isWhileStatement = isWhileStatement; function isForStatement(node) { - return node.kind === 225 /* ForStatement */; + return node.kind === 226 /* ForStatement */; } ts.isForStatement = isForStatement; function isForInStatement(node) { - return node.kind === 226 /* ForInStatement */; + return node.kind === 227 /* ForInStatement */; } ts.isForInStatement = isForInStatement; function isForOfStatement(node) { - return node.kind === 227 /* ForOfStatement */; + return node.kind === 228 /* ForOfStatement */; } ts.isForOfStatement = isForOfStatement; function isContinueStatement(node) { - return node.kind === 228 /* ContinueStatement */; + return node.kind === 229 /* ContinueStatement */; } ts.isContinueStatement = isContinueStatement; function isBreakStatement(node) { - return node.kind === 229 /* BreakStatement */; + return node.kind === 230 /* BreakStatement */; } ts.isBreakStatement = isBreakStatement; function isBreakOrContinueStatement(node) { - return node.kind === 229 /* BreakStatement */ || node.kind === 228 /* ContinueStatement */; + return node.kind === 230 /* BreakStatement */ || node.kind === 229 /* ContinueStatement */; } ts.isBreakOrContinueStatement = isBreakOrContinueStatement; function isReturnStatement(node) { - return node.kind === 230 /* ReturnStatement */; + return node.kind === 231 /* ReturnStatement */; } ts.isReturnStatement = isReturnStatement; function isWithStatement(node) { - return node.kind === 231 /* WithStatement */; + return node.kind === 232 /* WithStatement */; } ts.isWithStatement = isWithStatement; function isSwitchStatement(node) { - return node.kind === 232 /* SwitchStatement */; + return node.kind === 233 /* SwitchStatement */; } ts.isSwitchStatement = isSwitchStatement; function isLabeledStatement(node) { - return node.kind === 233 /* LabeledStatement */; + return node.kind === 234 /* LabeledStatement */; } ts.isLabeledStatement = isLabeledStatement; function isThrowStatement(node) { - return node.kind === 234 /* ThrowStatement */; + return node.kind === 235 /* ThrowStatement */; } ts.isThrowStatement = isThrowStatement; function isTryStatement(node) { - return node.kind === 235 /* TryStatement */; + return node.kind === 236 /* TryStatement */; } ts.isTryStatement = isTryStatement; function isDebuggerStatement(node) { - return node.kind === 236 /* DebuggerStatement */; + return node.kind === 237 /* DebuggerStatement */; } ts.isDebuggerStatement = isDebuggerStatement; function isVariableDeclaration(node) { - return node.kind === 237 /* VariableDeclaration */; + return node.kind === 238 /* VariableDeclaration */; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 238 /* VariableDeclarationList */; + return node.kind === 239 /* VariableDeclarationList */; } ts.isVariableDeclarationList = isVariableDeclarationList; function isFunctionDeclaration(node) { - return node.kind === 239 /* FunctionDeclaration */; + return node.kind === 240 /* FunctionDeclaration */; } ts.isFunctionDeclaration = isFunctionDeclaration; function isClassDeclaration(node) { - return node.kind === 240 /* ClassDeclaration */; + return node.kind === 241 /* ClassDeclaration */; } ts.isClassDeclaration = isClassDeclaration; function isInterfaceDeclaration(node) { - return node.kind === 241 /* InterfaceDeclaration */; + return node.kind === 242 /* InterfaceDeclaration */; } ts.isInterfaceDeclaration = isInterfaceDeclaration; function isTypeAliasDeclaration(node) { - return node.kind === 242 /* TypeAliasDeclaration */; + return node.kind === 243 /* TypeAliasDeclaration */; } ts.isTypeAliasDeclaration = isTypeAliasDeclaration; function isEnumDeclaration(node) { - return node.kind === 243 /* EnumDeclaration */; + return node.kind === 244 /* EnumDeclaration */; } ts.isEnumDeclaration = isEnumDeclaration; function isModuleDeclaration(node) { - return node.kind === 244 /* ModuleDeclaration */; + return node.kind === 245 /* ModuleDeclaration */; } ts.isModuleDeclaration = isModuleDeclaration; function isModuleBlock(node) { - return node.kind === 245 /* ModuleBlock */; + return node.kind === 246 /* ModuleBlock */; } ts.isModuleBlock = isModuleBlock; function isCaseBlock(node) { - return node.kind === 246 /* CaseBlock */; + return node.kind === 247 /* CaseBlock */; } ts.isCaseBlock = isCaseBlock; function isNamespaceExportDeclaration(node) { - return node.kind === 247 /* NamespaceExportDeclaration */; + return node.kind === 248 /* NamespaceExportDeclaration */; } ts.isNamespaceExportDeclaration = isNamespaceExportDeclaration; function isImportEqualsDeclaration(node) { - return node.kind === 248 /* ImportEqualsDeclaration */; + return node.kind === 249 /* ImportEqualsDeclaration */; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportDeclaration(node) { - return node.kind === 249 /* ImportDeclaration */; + return node.kind === 250 /* ImportDeclaration */; } ts.isImportDeclaration = isImportDeclaration; function isImportClause(node) { - return node.kind === 250 /* ImportClause */; + return node.kind === 251 /* ImportClause */; } ts.isImportClause = isImportClause; function isNamespaceImport(node) { - return node.kind === 251 /* NamespaceImport */; + return node.kind === 252 /* NamespaceImport */; } ts.isNamespaceImport = isNamespaceImport; function isNamedImports(node) { - return node.kind === 252 /* NamedImports */; + return node.kind === 253 /* NamedImports */; } ts.isNamedImports = isNamedImports; function isImportSpecifier(node) { - return node.kind === 253 /* ImportSpecifier */; + return node.kind === 254 /* ImportSpecifier */; } ts.isImportSpecifier = isImportSpecifier; function isExportAssignment(node) { - return node.kind === 254 /* ExportAssignment */; + return node.kind === 255 /* ExportAssignment */; } ts.isExportAssignment = isExportAssignment; function isExportDeclaration(node) { - return node.kind === 255 /* ExportDeclaration */; + return node.kind === 256 /* ExportDeclaration */; } ts.isExportDeclaration = isExportDeclaration; function isNamedExports(node) { - return node.kind === 256 /* NamedExports */; + return node.kind === 257 /* NamedExports */; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 257 /* ExportSpecifier */; + return node.kind === 258 /* ExportSpecifier */; } ts.isExportSpecifier = isExportSpecifier; function isMissingDeclaration(node) { - return node.kind === 258 /* MissingDeclaration */; + return node.kind === 259 /* MissingDeclaration */; } ts.isMissingDeclaration = isMissingDeclaration; // Module References function isExternalModuleReference(node) { - return node.kind === 259 /* ExternalModuleReference */; + return node.kind === 260 /* ExternalModuleReference */; } ts.isExternalModuleReference = isExternalModuleReference; // JSX function isJsxElement(node) { - return node.kind === 260 /* JsxElement */; + return node.kind === 261 /* JsxElement */; } ts.isJsxElement = isJsxElement; function isJsxSelfClosingElement(node) { - return node.kind === 261 /* JsxSelfClosingElement */; + return node.kind === 262 /* JsxSelfClosingElement */; } ts.isJsxSelfClosingElement = isJsxSelfClosingElement; function isJsxOpeningElement(node) { - return node.kind === 262 /* JsxOpeningElement */; + return node.kind === 263 /* JsxOpeningElement */; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 263 /* JsxClosingElement */; + return node.kind === 264 /* JsxClosingElement */; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxFragment(node) { - return node.kind === 264 /* JsxFragment */; + return node.kind === 265 /* JsxFragment */; } ts.isJsxFragment = isJsxFragment; function isJsxOpeningFragment(node) { - return node.kind === 265 /* JsxOpeningFragment */; + return node.kind === 266 /* JsxOpeningFragment */; } ts.isJsxOpeningFragment = isJsxOpeningFragment; function isJsxClosingFragment(node) { - return node.kind === 266 /* JsxClosingFragment */; + return node.kind === 267 /* JsxClosingFragment */; } ts.isJsxClosingFragment = isJsxClosingFragment; function isJsxAttribute(node) { - return node.kind === 267 /* JsxAttribute */; + return node.kind === 268 /* JsxAttribute */; } ts.isJsxAttribute = isJsxAttribute; function isJsxAttributes(node) { - return node.kind === 268 /* JsxAttributes */; + return node.kind === 269 /* JsxAttributes */; } ts.isJsxAttributes = isJsxAttributes; function isJsxSpreadAttribute(node) { - return node.kind === 269 /* JsxSpreadAttribute */; + return node.kind === 270 /* JsxSpreadAttribute */; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxExpression(node) { - return node.kind === 270 /* JsxExpression */; + return node.kind === 271 /* JsxExpression */; } ts.isJsxExpression = isJsxExpression; // Clauses function isCaseClause(node) { - return node.kind === 271 /* CaseClause */; + return node.kind === 272 /* CaseClause */; } ts.isCaseClause = isCaseClause; function isDefaultClause(node) { - return node.kind === 272 /* DefaultClause */; + return node.kind === 273 /* DefaultClause */; } ts.isDefaultClause = isDefaultClause; function isHeritageClause(node) { - return node.kind === 273 /* HeritageClause */; + return node.kind === 274 /* HeritageClause */; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 274 /* CatchClause */; + return node.kind === 275 /* CatchClause */; } ts.isCatchClause = isCatchClause; // Property assignments function isPropertyAssignment(node) { - return node.kind === 275 /* PropertyAssignment */; + return node.kind === 276 /* PropertyAssignment */; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 276 /* ShorthandPropertyAssignment */; + return node.kind === 277 /* ShorthandPropertyAssignment */; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isSpreadAssignment(node) { - return node.kind === 277 /* SpreadAssignment */; + return node.kind === 278 /* SpreadAssignment */; } ts.isSpreadAssignment = isSpreadAssignment; // Enum function isEnumMember(node) { - return node.kind === 278 /* EnumMember */; + return node.kind === 279 /* EnumMember */; } ts.isEnumMember = isEnumMember; // Top-level nodes function isSourceFile(node) { - return node.kind === 284 /* SourceFile */; + return node.kind === 285 /* SourceFile */; } ts.isSourceFile = isSourceFile; function isBundle(node) { - return node.kind === 285 /* Bundle */; + return node.kind === 286 /* Bundle */; } ts.isBundle = isBundle; function isUnparsedSource(node) { - return node.kind === 286 /* UnparsedSource */; + return node.kind === 287 /* UnparsedSource */; } ts.isUnparsedSource = isUnparsedSource; function isUnparsedPrepend(node) { - return node.kind === 280 /* UnparsedPrepend */; + return node.kind === 281 /* UnparsedPrepend */; } ts.isUnparsedPrepend = isUnparsedPrepend; function isUnparsedTextLike(node) { switch (node.kind) { - case 281 /* UnparsedText */: - case 282 /* UnparsedInternalText */: + case 282 /* UnparsedText */: + case 283 /* UnparsedInternalText */: return true; default: return false; @@ -14030,101 +14156,101 @@ var ts; ts.isUnparsedTextLike = isUnparsedTextLike; function isUnparsedNode(node) { return isUnparsedTextLike(node) || - node.kind === 279 /* UnparsedPrologue */ || - node.kind === 283 /* UnparsedSyntheticReference */; + node.kind === 280 /* UnparsedPrologue */ || + node.kind === 284 /* UnparsedSyntheticReference */; } ts.isUnparsedNode = isUnparsedNode; // JSDoc function isJSDocTypeExpression(node) { - return node.kind === 288 /* JSDocTypeExpression */; + return node.kind === 289 /* JSDocTypeExpression */; } ts.isJSDocTypeExpression = isJSDocTypeExpression; function isJSDocAllType(node) { - return node.kind === 289 /* JSDocAllType */; + return node.kind === 290 /* JSDocAllType */; } ts.isJSDocAllType = isJSDocAllType; function isJSDocUnknownType(node) { - return node.kind === 290 /* JSDocUnknownType */; + return node.kind === 291 /* JSDocUnknownType */; } ts.isJSDocUnknownType = isJSDocUnknownType; function isJSDocNullableType(node) { - return node.kind === 291 /* JSDocNullableType */; + return node.kind === 292 /* JSDocNullableType */; } ts.isJSDocNullableType = isJSDocNullableType; function isJSDocNonNullableType(node) { - return node.kind === 292 /* JSDocNonNullableType */; + return node.kind === 293 /* JSDocNonNullableType */; } ts.isJSDocNonNullableType = isJSDocNonNullableType; function isJSDocOptionalType(node) { - return node.kind === 293 /* JSDocOptionalType */; + return node.kind === 294 /* JSDocOptionalType */; } ts.isJSDocOptionalType = isJSDocOptionalType; function isJSDocFunctionType(node) { - return node.kind === 294 /* JSDocFunctionType */; + return node.kind === 295 /* JSDocFunctionType */; } ts.isJSDocFunctionType = isJSDocFunctionType; function isJSDocVariadicType(node) { - return node.kind === 295 /* JSDocVariadicType */; + return node.kind === 296 /* JSDocVariadicType */; } ts.isJSDocVariadicType = isJSDocVariadicType; function isJSDoc(node) { - return node.kind === 296 /* JSDocComment */; + return node.kind === 297 /* JSDocComment */; } ts.isJSDoc = isJSDoc; function isJSDocAugmentsTag(node) { - return node.kind === 300 /* JSDocAugmentsTag */; + return node.kind === 301 /* JSDocAugmentsTag */; } ts.isJSDocAugmentsTag = isJSDocAugmentsTag; function isJSDocClassTag(node) { - return node.kind === 301 /* JSDocClassTag */; + return node.kind === 302 /* JSDocClassTag */; } ts.isJSDocClassTag = isJSDocClassTag; function isJSDocEnumTag(node) { - return node.kind === 303 /* JSDocEnumTag */; + return node.kind === 304 /* JSDocEnumTag */; } ts.isJSDocEnumTag = isJSDocEnumTag; function isJSDocThisTag(node) { - return node.kind === 306 /* JSDocThisTag */; + return node.kind === 307 /* JSDocThisTag */; } ts.isJSDocThisTag = isJSDocThisTag; function isJSDocParameterTag(node) { - return node.kind === 304 /* JSDocParameterTag */; + return node.kind === 305 /* JSDocParameterTag */; } ts.isJSDocParameterTag = isJSDocParameterTag; function isJSDocReturnTag(node) { - return node.kind === 305 /* JSDocReturnTag */; + return node.kind === 306 /* JSDocReturnTag */; } ts.isJSDocReturnTag = isJSDocReturnTag; function isJSDocTypeTag(node) { - return node.kind === 307 /* JSDocTypeTag */; + return node.kind === 308 /* JSDocTypeTag */; } ts.isJSDocTypeTag = isJSDocTypeTag; function isJSDocTemplateTag(node) { - return node.kind === 308 /* JSDocTemplateTag */; + return node.kind === 309 /* JSDocTemplateTag */; } ts.isJSDocTemplateTag = isJSDocTemplateTag; function isJSDocTypedefTag(node) { - return node.kind === 309 /* JSDocTypedefTag */; + return node.kind === 310 /* JSDocTypedefTag */; } ts.isJSDocTypedefTag = isJSDocTypedefTag; function isJSDocPropertyTag(node) { - return node.kind === 310 /* JSDocPropertyTag */; + return node.kind === 311 /* JSDocPropertyTag */; } ts.isJSDocPropertyTag = isJSDocPropertyTag; function isJSDocPropertyLikeTag(node) { - return node.kind === 310 /* JSDocPropertyTag */ || node.kind === 304 /* JSDocParameterTag */; + return node.kind === 311 /* JSDocPropertyTag */ || node.kind === 305 /* JSDocParameterTag */; } ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag; function isJSDocTypeLiteral(node) { - return node.kind === 297 /* JSDocTypeLiteral */; + return node.kind === 298 /* JSDocTypeLiteral */; } ts.isJSDocTypeLiteral = isJSDocTypeLiteral; function isJSDocCallbackTag(node) { - return node.kind === 302 /* JSDocCallbackTag */; + return node.kind === 303 /* JSDocCallbackTag */; } ts.isJSDocCallbackTag = isJSDocCallbackTag; function isJSDocSignature(node) { - return node.kind === 298 /* JSDocSignature */; + return node.kind === 299 /* JSDocSignature */; } ts.isJSDocSignature = isJSDocSignature; })(ts || (ts = {})); @@ -14135,7 +14261,7 @@ var ts; (function (ts) { /* @internal */ function isSyntaxList(n) { - return n.kind === 311 /* SyntaxList */; + return n.kind === 312 /* SyntaxList */; } ts.isSyntaxList = isSyntaxList; /* @internal */ @@ -14145,7 +14271,7 @@ var ts; ts.isNode = isNode; /* @internal */ function isNodeKind(kind) { - return kind >= 148 /* FirstNode */; + return kind >= 149 /* FirstNode */; } ts.isNodeKind = isNodeKind; /** @@ -14154,7 +14280,7 @@ var ts; * Literals are considered tokens, except TemplateLiteral, but does include TemplateHead/Middle/Tail. */ function isToken(n) { - return n.kind >= 0 /* FirstToken */ && n.kind <= 147 /* LastToken */; + return n.kind >= 0 /* FirstToken */ && n.kind <= 148 /* LastToken */; } ts.isToken = isToken; // Node Arrays @@ -14207,17 +14333,17 @@ var ts; /* @internal */ function isModifierKind(token) { switch (token) { - case 118 /* AbstractKeyword */: - case 121 /* AsyncKeyword */: - case 77 /* ConstKeyword */: - case 125 /* DeclareKeyword */: - case 80 /* DefaultKeyword */: - case 85 /* ExportKeyword */: - case 115 /* PublicKeyword */: - case 113 /* PrivateKeyword */: - case 114 /* ProtectedKeyword */: - case 133 /* ReadonlyKeyword */: - case 116 /* StaticKeyword */: + case 119 /* AbstractKeyword */: + case 122 /* AsyncKeyword */: + case 78 /* ConstKeyword */: + case 126 /* DeclareKeyword */: + case 81 /* DefaultKeyword */: + case 86 /* ExportKeyword */: + case 116 /* PublicKeyword */: + case 114 /* PrivateKeyword */: + case 115 /* ProtectedKeyword */: + case 134 /* ReadonlyKeyword */: + case 117 /* StaticKeyword */: return true; } return false; @@ -14230,7 +14356,7 @@ var ts; ts.isParameterPropertyModifier = isParameterPropertyModifier; /* @internal */ function isClassMemberModifier(idToken) { - return isParameterPropertyModifier(idToken) || idToken === 116 /* StaticKeyword */; + return isParameterPropertyModifier(idToken) || idToken === 117 /* StaticKeyword */; } ts.isClassMemberModifier = isClassMemberModifier; function isModifier(node) { @@ -14239,23 +14365,23 @@ var ts; ts.isModifier = isModifier; function isEntityName(node) { var kind = node.kind; - return kind === 148 /* QualifiedName */ - || kind === 72 /* Identifier */; + return kind === 149 /* QualifiedName */ + || kind === 73 /* Identifier */; } ts.isEntityName = isEntityName; function isPropertyName(node) { var kind = node.kind; - return kind === 72 /* Identifier */ + return kind === 73 /* Identifier */ || kind === 10 /* StringLiteral */ || kind === 8 /* NumericLiteral */ - || kind === 149 /* ComputedPropertyName */; + || kind === 150 /* ComputedPropertyName */; } ts.isPropertyName = isPropertyName; function isBindingName(node) { var kind = node.kind; - return kind === 72 /* Identifier */ - || kind === 184 /* ObjectBindingPattern */ - || kind === 185 /* ArrayBindingPattern */; + return kind === 73 /* Identifier */ + || kind === 185 /* ObjectBindingPattern */ + || kind === 186 /* ArrayBindingPattern */; } ts.isBindingName = isBindingName; // Functions @@ -14270,13 +14396,13 @@ var ts; ts.isFunctionLikeDeclaration = isFunctionLikeDeclaration; function isFunctionLikeDeclarationKind(kind) { switch (kind) { - case 239 /* FunctionDeclaration */: - case 156 /* MethodDeclaration */: - case 157 /* Constructor */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: + case 240 /* FunctionDeclaration */: + case 157 /* MethodDeclaration */: + case 158 /* Constructor */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: return true; default: return false; @@ -14285,14 +14411,14 @@ var ts; /* @internal */ function isFunctionLikeKind(kind) { switch (kind) { - case 155 /* MethodSignature */: - case 160 /* CallSignature */: - case 298 /* JSDocSignature */: - case 161 /* ConstructSignature */: - case 162 /* IndexSignature */: - case 165 /* FunctionType */: - case 294 /* JSDocFunctionType */: - case 166 /* ConstructorType */: + case 156 /* MethodSignature */: + case 161 /* CallSignature */: + case 299 /* JSDocSignature */: + case 162 /* ConstructSignature */: + case 163 /* IndexSignature */: + case 166 /* FunctionType */: + case 295 /* JSDocFunctionType */: + case 167 /* ConstructorType */: return true; default: return isFunctionLikeDeclarationKind(kind); @@ -14307,29 +14433,29 @@ var ts; // Classes function isClassElement(node) { var kind = node.kind; - return kind === 157 /* Constructor */ - || kind === 154 /* PropertyDeclaration */ - || kind === 156 /* MethodDeclaration */ - || kind === 158 /* GetAccessor */ - || kind === 159 /* SetAccessor */ - || kind === 162 /* IndexSignature */ - || kind === 217 /* SemicolonClassElement */; + return kind === 158 /* Constructor */ + || kind === 155 /* PropertyDeclaration */ + || kind === 157 /* MethodDeclaration */ + || kind === 159 /* GetAccessor */ + || kind === 160 /* SetAccessor */ + || kind === 163 /* IndexSignature */ + || kind === 218 /* SemicolonClassElement */; } ts.isClassElement = isClassElement; function isClassLike(node) { - return node && (node.kind === 240 /* ClassDeclaration */ || node.kind === 209 /* ClassExpression */); + return node && (node.kind === 241 /* ClassDeclaration */ || node.kind === 210 /* ClassExpression */); } ts.isClassLike = isClassLike; function isAccessor(node) { - return node && (node.kind === 158 /* GetAccessor */ || node.kind === 159 /* SetAccessor */); + return node && (node.kind === 159 /* GetAccessor */ || node.kind === 160 /* SetAccessor */); } ts.isAccessor = isAccessor; /* @internal */ function isMethodOrAccessor(node) { switch (node.kind) { - case 156 /* MethodDeclaration */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 157 /* MethodDeclaration */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: return true; default: return false; @@ -14339,11 +14465,11 @@ var ts; // Type members function isTypeElement(node) { var kind = node.kind; - return kind === 161 /* ConstructSignature */ - || kind === 160 /* CallSignature */ - || kind === 153 /* PropertySignature */ - || kind === 155 /* MethodSignature */ - || kind === 162 /* IndexSignature */; + return kind === 162 /* ConstructSignature */ + || kind === 161 /* CallSignature */ + || kind === 154 /* PropertySignature */ + || kind === 156 /* MethodSignature */ + || kind === 163 /* IndexSignature */; } ts.isTypeElement = isTypeElement; function isClassOrTypeElement(node) { @@ -14352,12 +14478,12 @@ var ts; ts.isClassOrTypeElement = isClassOrTypeElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 275 /* PropertyAssignment */ - || kind === 276 /* ShorthandPropertyAssignment */ - || kind === 277 /* SpreadAssignment */ - || kind === 156 /* MethodDeclaration */ - || kind === 158 /* GetAccessor */ - || kind === 159 /* SetAccessor */; + return kind === 276 /* PropertyAssignment */ + || kind === 277 /* ShorthandPropertyAssignment */ + || kind === 278 /* SpreadAssignment */ + || kind === 157 /* MethodDeclaration */ + || kind === 159 /* GetAccessor */ + || kind === 160 /* SetAccessor */; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; // Type @@ -14372,8 +14498,8 @@ var ts; ts.isTypeNode = isTypeNode; function isFunctionOrConstructorTypeNode(node) { switch (node.kind) { - case 165 /* FunctionType */: - case 166 /* ConstructorType */: + case 166 /* FunctionType */: + case 167 /* ConstructorType */: return true; } return false; @@ -14384,8 +14510,8 @@ var ts; function isBindingPattern(node) { if (node) { var kind = node.kind; - return kind === 185 /* ArrayBindingPattern */ - || kind === 184 /* ObjectBindingPattern */; + return kind === 186 /* ArrayBindingPattern */ + || kind === 185 /* ObjectBindingPattern */; } return false; } @@ -14393,15 +14519,15 @@ var ts; /* @internal */ function isAssignmentPattern(node) { var kind = node.kind; - return kind === 187 /* ArrayLiteralExpression */ - || kind === 188 /* ObjectLiteralExpression */; + return kind === 188 /* ArrayLiteralExpression */ + || kind === 189 /* ObjectLiteralExpression */; } ts.isAssignmentPattern = isAssignmentPattern; /* @internal */ function isArrayBindingElement(node) { var kind = node.kind; - return kind === 186 /* BindingElement */ - || kind === 210 /* OmittedExpression */; + return kind === 187 /* BindingElement */ + || kind === 211 /* OmittedExpression */; } ts.isArrayBindingElement = isArrayBindingElement; /** @@ -14410,9 +14536,9 @@ var ts; /* @internal */ function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 237 /* VariableDeclaration */: - case 151 /* Parameter */: - case 186 /* BindingElement */: + case 238 /* VariableDeclaration */: + case 152 /* Parameter */: + case 187 /* BindingElement */: return true; } return false; @@ -14433,8 +14559,8 @@ var ts; /* @internal */ function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 184 /* ObjectBindingPattern */: - case 188 /* ObjectLiteralExpression */: + case 185 /* ObjectBindingPattern */: + case 189 /* ObjectLiteralExpression */: return true; } return false; @@ -14446,8 +14572,8 @@ var ts; /* @internal */ function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 185 /* ArrayBindingPattern */: - case 187 /* ArrayLiteralExpression */: + case 186 /* ArrayBindingPattern */: + case 188 /* ArrayLiteralExpression */: return true; } return false; @@ -14456,26 +14582,26 @@ var ts; /* @internal */ function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) { var kind = node.kind; - return kind === 189 /* PropertyAccessExpression */ - || kind === 148 /* QualifiedName */ - || kind === 183 /* ImportType */; + return kind === 190 /* PropertyAccessExpression */ + || kind === 149 /* QualifiedName */ + || kind === 184 /* ImportType */; } ts.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode; // Expression function isPropertyAccessOrQualifiedName(node) { var kind = node.kind; - return kind === 189 /* PropertyAccessExpression */ - || kind === 148 /* QualifiedName */; + return kind === 190 /* PropertyAccessExpression */ + || kind === 149 /* QualifiedName */; } ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName; function isCallLikeExpression(node) { switch (node.kind) { - case 262 /* JsxOpeningElement */: - case 261 /* JsxSelfClosingElement */: - case 191 /* CallExpression */: - case 192 /* NewExpression */: - case 193 /* TaggedTemplateExpression */: - case 152 /* Decorator */: + case 263 /* JsxOpeningElement */: + case 262 /* JsxSelfClosingElement */: + case 192 /* CallExpression */: + case 193 /* NewExpression */: + case 194 /* TaggedTemplateExpression */: + case 153 /* Decorator */: return true; default: return false; @@ -14483,12 +14609,12 @@ var ts; } ts.isCallLikeExpression = isCallLikeExpression; function isCallOrNewExpression(node) { - return node.kind === 191 /* CallExpression */ || node.kind === 192 /* NewExpression */; + return node.kind === 192 /* CallExpression */ || node.kind === 193 /* NewExpression */; } ts.isCallOrNewExpression = isCallOrNewExpression; function isTemplateLiteral(node) { var kind = node.kind; - return kind === 206 /* TemplateExpression */ + return kind === 207 /* TemplateExpression */ || kind === 14 /* NoSubstitutionTemplateLiteral */; } ts.isTemplateLiteral = isTemplateLiteral; @@ -14499,34 +14625,34 @@ var ts; ts.isLeftHandSideExpression = isLeftHandSideExpression; function isLeftHandSideExpressionKind(kind) { switch (kind) { - case 189 /* PropertyAccessExpression */: - case 190 /* ElementAccessExpression */: - case 192 /* NewExpression */: - case 191 /* CallExpression */: - case 260 /* JsxElement */: - case 261 /* JsxSelfClosingElement */: - case 264 /* JsxFragment */: - case 193 /* TaggedTemplateExpression */: - case 187 /* ArrayLiteralExpression */: - case 195 /* ParenthesizedExpression */: - case 188 /* ObjectLiteralExpression */: - case 209 /* ClassExpression */: - case 196 /* FunctionExpression */: - case 72 /* Identifier */: + case 190 /* PropertyAccessExpression */: + case 191 /* ElementAccessExpression */: + case 193 /* NewExpression */: + case 192 /* CallExpression */: + case 261 /* JsxElement */: + case 262 /* JsxSelfClosingElement */: + case 265 /* JsxFragment */: + case 194 /* TaggedTemplateExpression */: + case 188 /* ArrayLiteralExpression */: + case 196 /* ParenthesizedExpression */: + case 189 /* ObjectLiteralExpression */: + case 210 /* ClassExpression */: + case 197 /* FunctionExpression */: + case 73 /* Identifier */: case 13 /* RegularExpressionLiteral */: case 8 /* NumericLiteral */: case 9 /* BigIntLiteral */: case 10 /* StringLiteral */: case 14 /* NoSubstitutionTemplateLiteral */: - case 206 /* TemplateExpression */: - case 87 /* FalseKeyword */: - case 96 /* NullKeyword */: - case 100 /* ThisKeyword */: - case 102 /* TrueKeyword */: - case 98 /* SuperKeyword */: - case 213 /* NonNullExpression */: - case 214 /* MetaProperty */: - case 92 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression + case 207 /* TemplateExpression */: + case 88 /* FalseKeyword */: + case 97 /* NullKeyword */: + case 101 /* ThisKeyword */: + case 103 /* TrueKeyword */: + case 99 /* SuperKeyword */: + case 214 /* NonNullExpression */: + case 215 /* MetaProperty */: + case 93 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression return true; default: return false; @@ -14539,13 +14665,13 @@ var ts; ts.isUnaryExpression = isUnaryExpression; function isUnaryExpressionKind(kind) { switch (kind) { - case 202 /* PrefixUnaryExpression */: - case 203 /* PostfixUnaryExpression */: - case 198 /* DeleteExpression */: - case 199 /* TypeOfExpression */: - case 200 /* VoidExpression */: - case 201 /* AwaitExpression */: - case 194 /* TypeAssertionExpression */: + case 203 /* PrefixUnaryExpression */: + case 204 /* PostfixUnaryExpression */: + case 199 /* DeleteExpression */: + case 200 /* TypeOfExpression */: + case 201 /* VoidExpression */: + case 202 /* AwaitExpression */: + case 195 /* TypeAssertionExpression */: return true; default: return isLeftHandSideExpressionKind(kind); @@ -14554,9 +14680,9 @@ var ts; /* @internal */ function isUnaryExpressionWithWrite(expr) { switch (expr.kind) { - case 203 /* PostfixUnaryExpression */: + case 204 /* PostfixUnaryExpression */: return true; - case 202 /* PrefixUnaryExpression */: + case 203 /* PrefixUnaryExpression */: return expr.operator === 44 /* PlusPlusToken */ || expr.operator === 45 /* MinusMinusToken */; default: @@ -14575,15 +14701,15 @@ var ts; ts.isExpression = isExpression; function isExpressionKind(kind) { switch (kind) { - case 205 /* ConditionalExpression */: - case 207 /* YieldExpression */: - case 197 /* ArrowFunction */: - case 204 /* BinaryExpression */: - case 208 /* SpreadElement */: - case 212 /* AsExpression */: - case 210 /* OmittedExpression */: - case 314 /* CommaListExpression */: - case 313 /* PartiallyEmittedExpression */: + case 206 /* ConditionalExpression */: + case 208 /* YieldExpression */: + case 198 /* ArrowFunction */: + case 205 /* BinaryExpression */: + case 209 /* SpreadElement */: + case 213 /* AsExpression */: + case 211 /* OmittedExpression */: + case 315 /* CommaListExpression */: + case 314 /* PartiallyEmittedExpression */: return true; default: return isUnaryExpressionKind(kind); @@ -14591,18 +14717,18 @@ var ts; } function isAssertionExpression(node) { var kind = node.kind; - return kind === 194 /* TypeAssertionExpression */ - || kind === 212 /* AsExpression */; + return kind === 195 /* TypeAssertionExpression */ + || kind === 213 /* AsExpression */; } ts.isAssertionExpression = isAssertionExpression; /* @internal */ function isPartiallyEmittedExpression(node) { - return node.kind === 313 /* PartiallyEmittedExpression */; + return node.kind === 314 /* PartiallyEmittedExpression */; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; /* @internal */ function isNotEmittedStatement(node) { - return node.kind === 312 /* NotEmittedStatement */; + return node.kind === 313 /* NotEmittedStatement */; } ts.isNotEmittedStatement = isNotEmittedStatement; /* @internal */ @@ -14613,13 +14739,13 @@ var ts; ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 225 /* ForStatement */: - case 226 /* ForInStatement */: - case 227 /* ForOfStatement */: - case 223 /* DoStatement */: - case 224 /* WhileStatement */: + case 226 /* ForStatement */: + case 227 /* ForInStatement */: + case 228 /* ForOfStatement */: + case 224 /* DoStatement */: + case 225 /* WhileStatement */: return true; - case 233 /* LabeledStatement */: + case 234 /* LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -14627,7 +14753,7 @@ var ts; ts.isIterationStatement = isIterationStatement; /* @internal */ function isForInOrOfStatement(node) { - return node.kind === 226 /* ForInStatement */ || node.kind === 227 /* ForOfStatement */; + return node.kind === 227 /* ForInStatement */ || node.kind === 228 /* ForOfStatement */; } ts.isForInOrOfStatement = isForInOrOfStatement; // Element @@ -14651,113 +14777,113 @@ var ts; /* @internal */ function isModuleBody(node) { var kind = node.kind; - return kind === 245 /* ModuleBlock */ - || kind === 244 /* ModuleDeclaration */ - || kind === 72 /* Identifier */; + return kind === 246 /* ModuleBlock */ + || kind === 245 /* ModuleDeclaration */ + || kind === 73 /* Identifier */; } ts.isModuleBody = isModuleBody; /* @internal */ function isNamespaceBody(node) { var kind = node.kind; - return kind === 245 /* ModuleBlock */ - || kind === 244 /* ModuleDeclaration */; + return kind === 246 /* ModuleBlock */ + || kind === 245 /* ModuleDeclaration */; } ts.isNamespaceBody = isNamespaceBody; /* @internal */ function isJSDocNamespaceBody(node) { var kind = node.kind; - return kind === 72 /* Identifier */ - || kind === 244 /* ModuleDeclaration */; + return kind === 73 /* Identifier */ + || kind === 245 /* ModuleDeclaration */; } ts.isJSDocNamespaceBody = isJSDocNamespaceBody; /* @internal */ function isNamedImportBindings(node) { var kind = node.kind; - return kind === 252 /* NamedImports */ - || kind === 251 /* NamespaceImport */; + return kind === 253 /* NamedImports */ + || kind === 252 /* NamespaceImport */; } ts.isNamedImportBindings = isNamedImportBindings; /* @internal */ function isModuleOrEnumDeclaration(node) { - return node.kind === 244 /* ModuleDeclaration */ || node.kind === 243 /* EnumDeclaration */; + return node.kind === 245 /* ModuleDeclaration */ || node.kind === 244 /* EnumDeclaration */; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { - return kind === 197 /* ArrowFunction */ - || kind === 186 /* BindingElement */ - || kind === 240 /* ClassDeclaration */ - || kind === 209 /* ClassExpression */ - || kind === 157 /* Constructor */ - || kind === 243 /* EnumDeclaration */ - || kind === 278 /* EnumMember */ - || kind === 257 /* ExportSpecifier */ - || kind === 239 /* FunctionDeclaration */ - || kind === 196 /* FunctionExpression */ - || kind === 158 /* GetAccessor */ - || kind === 250 /* ImportClause */ - || kind === 248 /* ImportEqualsDeclaration */ - || kind === 253 /* ImportSpecifier */ - || kind === 241 /* InterfaceDeclaration */ - || kind === 267 /* JsxAttribute */ - || kind === 156 /* MethodDeclaration */ - || kind === 155 /* MethodSignature */ - || kind === 244 /* ModuleDeclaration */ - || kind === 247 /* NamespaceExportDeclaration */ - || kind === 251 /* NamespaceImport */ - || kind === 151 /* Parameter */ - || kind === 275 /* PropertyAssignment */ - || kind === 154 /* PropertyDeclaration */ - || kind === 153 /* PropertySignature */ - || kind === 159 /* SetAccessor */ - || kind === 276 /* ShorthandPropertyAssignment */ - || kind === 242 /* TypeAliasDeclaration */ - || kind === 150 /* TypeParameter */ - || kind === 237 /* VariableDeclaration */ - || kind === 309 /* JSDocTypedefTag */ - || kind === 302 /* JSDocCallbackTag */ - || kind === 310 /* JSDocPropertyTag */; + return kind === 198 /* ArrowFunction */ + || kind === 187 /* BindingElement */ + || kind === 241 /* ClassDeclaration */ + || kind === 210 /* ClassExpression */ + || kind === 158 /* Constructor */ + || kind === 244 /* EnumDeclaration */ + || kind === 279 /* EnumMember */ + || kind === 258 /* ExportSpecifier */ + || kind === 240 /* FunctionDeclaration */ + || kind === 197 /* FunctionExpression */ + || kind === 159 /* GetAccessor */ + || kind === 251 /* ImportClause */ + || kind === 249 /* ImportEqualsDeclaration */ + || kind === 254 /* ImportSpecifier */ + || kind === 242 /* InterfaceDeclaration */ + || kind === 268 /* JsxAttribute */ + || kind === 157 /* MethodDeclaration */ + || kind === 156 /* MethodSignature */ + || kind === 245 /* ModuleDeclaration */ + || kind === 248 /* NamespaceExportDeclaration */ + || kind === 252 /* NamespaceImport */ + || kind === 152 /* Parameter */ + || kind === 276 /* PropertyAssignment */ + || kind === 155 /* PropertyDeclaration */ + || kind === 154 /* PropertySignature */ + || kind === 160 /* SetAccessor */ + || kind === 277 /* ShorthandPropertyAssignment */ + || kind === 243 /* TypeAliasDeclaration */ + || kind === 151 /* TypeParameter */ + || kind === 238 /* VariableDeclaration */ + || kind === 310 /* JSDocTypedefTag */ + || kind === 303 /* JSDocCallbackTag */ + || kind === 311 /* JSDocPropertyTag */; } function isDeclarationStatementKind(kind) { - return kind === 239 /* FunctionDeclaration */ - || kind === 258 /* MissingDeclaration */ - || kind === 240 /* ClassDeclaration */ - || kind === 241 /* InterfaceDeclaration */ - || kind === 242 /* TypeAliasDeclaration */ - || kind === 243 /* EnumDeclaration */ - || kind === 244 /* ModuleDeclaration */ - || kind === 249 /* ImportDeclaration */ - || kind === 248 /* ImportEqualsDeclaration */ - || kind === 255 /* ExportDeclaration */ - || kind === 254 /* ExportAssignment */ - || kind === 247 /* NamespaceExportDeclaration */; + return kind === 240 /* FunctionDeclaration */ + || kind === 259 /* MissingDeclaration */ + || kind === 241 /* ClassDeclaration */ + || kind === 242 /* InterfaceDeclaration */ + || kind === 243 /* TypeAliasDeclaration */ + || kind === 244 /* EnumDeclaration */ + || kind === 245 /* ModuleDeclaration */ + || kind === 250 /* ImportDeclaration */ + || kind === 249 /* ImportEqualsDeclaration */ + || kind === 256 /* ExportDeclaration */ + || kind === 255 /* ExportAssignment */ + || kind === 248 /* NamespaceExportDeclaration */; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 229 /* BreakStatement */ - || kind === 228 /* ContinueStatement */ - || kind === 236 /* DebuggerStatement */ - || kind === 223 /* DoStatement */ - || kind === 221 /* ExpressionStatement */ - || kind === 220 /* EmptyStatement */ - || kind === 226 /* ForInStatement */ - || kind === 227 /* ForOfStatement */ - || kind === 225 /* ForStatement */ - || kind === 222 /* IfStatement */ - || kind === 233 /* LabeledStatement */ - || kind === 230 /* ReturnStatement */ - || kind === 232 /* SwitchStatement */ - || kind === 234 /* ThrowStatement */ - || kind === 235 /* TryStatement */ - || kind === 219 /* VariableStatement */ - || kind === 224 /* WhileStatement */ - || kind === 231 /* WithStatement */ - || kind === 312 /* NotEmittedStatement */ - || kind === 316 /* EndOfDeclarationMarker */ - || kind === 315 /* MergeDeclarationMarker */; + return kind === 230 /* BreakStatement */ + || kind === 229 /* ContinueStatement */ + || kind === 237 /* DebuggerStatement */ + || kind === 224 /* DoStatement */ + || kind === 222 /* ExpressionStatement */ + || kind === 221 /* EmptyStatement */ + || kind === 227 /* ForInStatement */ + || kind === 228 /* ForOfStatement */ + || kind === 226 /* ForStatement */ + || kind === 223 /* IfStatement */ + || kind === 234 /* LabeledStatement */ + || kind === 231 /* ReturnStatement */ + || kind === 233 /* SwitchStatement */ + || kind === 235 /* ThrowStatement */ + || kind === 236 /* TryStatement */ + || kind === 220 /* VariableStatement */ + || kind === 225 /* WhileStatement */ + || kind === 232 /* WithStatement */ + || kind === 313 /* NotEmittedStatement */ + || kind === 317 /* EndOfDeclarationMarker */ + || kind === 316 /* MergeDeclarationMarker */; } /* @internal */ function isDeclaration(node) { - if (node.kind === 150 /* TypeParameter */) { - return (node.parent && node.parent.kind !== 308 /* JSDocTemplateTag */) || ts.isInJSFile(node); + if (node.kind === 151 /* TypeParameter */) { + return (node.parent && node.parent.kind !== 309 /* JSDocTemplateTag */) || ts.isInJSFile(node); } return isDeclarationKind(node.kind); } @@ -14784,10 +14910,10 @@ var ts; } ts.isStatement = isStatement; function isBlockStatement(node) { - if (node.kind !== 218 /* Block */) + if (node.kind !== 219 /* Block */) return false; if (node.parent !== undefined) { - if (node.parent.kind === 235 /* TryStatement */ || node.parent.kind === 274 /* CatchClause */) { + if (node.parent.kind === 236 /* TryStatement */ || node.parent.kind === 275 /* CatchClause */) { return false; } } @@ -14797,81 +14923,81 @@ var ts; /* @internal */ function isModuleReference(node) { var kind = node.kind; - return kind === 259 /* ExternalModuleReference */ - || kind === 148 /* QualifiedName */ - || kind === 72 /* Identifier */; + return kind === 260 /* ExternalModuleReference */ + || kind === 149 /* QualifiedName */ + || kind === 73 /* Identifier */; } ts.isModuleReference = isModuleReference; // JSX /* @internal */ function isJsxTagNameExpression(node) { var kind = node.kind; - return kind === 100 /* ThisKeyword */ - || kind === 72 /* Identifier */ - || kind === 189 /* PropertyAccessExpression */; + return kind === 101 /* ThisKeyword */ + || kind === 73 /* Identifier */ + || kind === 190 /* PropertyAccessExpression */; } ts.isJsxTagNameExpression = isJsxTagNameExpression; /* @internal */ function isJsxChild(node) { var kind = node.kind; - return kind === 260 /* JsxElement */ - || kind === 270 /* JsxExpression */ - || kind === 261 /* JsxSelfClosingElement */ + return kind === 261 /* JsxElement */ + || kind === 271 /* JsxExpression */ + || kind === 262 /* JsxSelfClosingElement */ || kind === 11 /* JsxText */ - || kind === 264 /* JsxFragment */; + || kind === 265 /* JsxFragment */; } ts.isJsxChild = isJsxChild; /* @internal */ function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 267 /* JsxAttribute */ - || kind === 269 /* JsxSpreadAttribute */; + return kind === 268 /* JsxAttribute */ + || kind === 270 /* JsxSpreadAttribute */; } ts.isJsxAttributeLike = isJsxAttributeLike; /* @internal */ function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 10 /* StringLiteral */ - || kind === 270 /* JsxExpression */; + || kind === 271 /* JsxExpression */; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isJsxOpeningLikeElement(node) { var kind = node.kind; - return kind === 262 /* JsxOpeningElement */ - || kind === 261 /* JsxSelfClosingElement */; + return kind === 263 /* JsxOpeningElement */ + || kind === 262 /* JsxSelfClosingElement */; } ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement; // Clauses function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 271 /* CaseClause */ - || kind === 272 /* DefaultClause */; + return kind === 272 /* CaseClause */ + || kind === 273 /* DefaultClause */; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; // JSDoc /** True if node is of some JSDoc syntax kind. */ /* @internal */ function isJSDocNode(node) { - return node.kind >= 288 /* FirstJSDocNode */ && node.kind <= 310 /* LastJSDocNode */; + return node.kind >= 289 /* FirstJSDocNode */ && node.kind <= 311 /* LastJSDocNode */; } ts.isJSDocNode = isJSDocNode; /** True if node is of a kind that may contain comment text. */ function isJSDocCommentContainingNode(node) { - return node.kind === 296 /* JSDocComment */ || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) || ts.isJSDocSignature(node); + return node.kind === 297 /* JSDocComment */ || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) || ts.isJSDocSignature(node); } ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode; // TODO: determine what this does before making it public. /* @internal */ function isJSDocTag(node) { - return node.kind >= 299 /* FirstJSDocTagNode */ && node.kind <= 310 /* LastJSDocTagNode */; + return node.kind >= 300 /* FirstJSDocTagNode */ && node.kind <= 311 /* LastJSDocTagNode */; } ts.isJSDocTag = isJSDocTag; function isSetAccessor(node) { - return node.kind === 159 /* SetAccessor */; + return node.kind === 160 /* SetAccessor */; } ts.isSetAccessor = isSetAccessor; function isGetAccessor(node) { - return node.kind === 158 /* GetAccessor */; + return node.kind === 159 /* GetAccessor */; } ts.isGetAccessor = isGetAccessor; /** True if has jsdoc nodes attached to it. */ @@ -14901,12 +15027,12 @@ var ts; } ts.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer; function isObjectLiteralElement(node) { - return node.kind === 267 /* JsxAttribute */ || node.kind === 269 /* JsxSpreadAttribute */ || isObjectLiteralElementLike(node); + return node.kind === 268 /* JsxAttribute */ || node.kind === 270 /* JsxSpreadAttribute */ || isObjectLiteralElementLike(node); } ts.isObjectLiteralElement = isObjectLiteralElement; /* @internal */ function isTypeReferenceType(node) { - return node.kind === 164 /* TypeReference */ || node.kind === 211 /* ExpressionWithTypeArguments */; + return node.kind === 165 /* TypeReference */ || node.kind === 212 /* ExpressionWithTypeArguments */; } ts.isTypeReferenceType = isTypeReferenceType; var MAX_SMI_X86 = 1073741823; @@ -14942,7 +15068,7 @@ var ts; /* @internal */ (function (ts) { function isNamedImportsOrExports(node) { - return node.kind === 252 /* NamedImports */ || node.kind === 256 /* NamedExports */; + return node.kind === 253 /* NamedImports */ || node.kind === 257 /* NamedExports */; } ts.isNamedImportsOrExports = isNamedImportsOrExports; function Symbol(flags, name) { @@ -15193,6 +15319,11 @@ var ts; ts.semanticDiagnosticsOptionDeclarations.some(function (option) { return !ts.isJsonEqual(getCompilerOptionValue(oldOptions, option), getCompilerOptionValue(newOptions, option)); }); } ts.compilerOptionsAffectSemanticDiagnostics = compilerOptionsAffectSemanticDiagnostics; + function compilerOptionsAffectEmit(newOptions, oldOptions) { + return oldOptions !== newOptions && + ts.affectsEmitOptionDeclarations.some(function (option) { return !ts.isJsonEqual(getCompilerOptionValue(oldOptions, option), getCompilerOptionValue(newOptions, option)); }); + } + ts.compilerOptionsAffectEmit = compilerOptionsAffectEmit; function getCompilerOptionValue(options, option) { return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name]; } @@ -15471,6 +15602,15 @@ var ts; return root + pathComponents.slice(1).join(ts.directorySeparator); } ts.getPathFromPathComponents = getPathFromPathComponents; + function getNormalizedAbsolutePathWithoutRoot(fileName, currentDirectory) { + return getPathWithoutRoot(getNormalizedPathComponents(fileName, currentDirectory)); + } + ts.getNormalizedAbsolutePathWithoutRoot = getNormalizedAbsolutePathWithoutRoot; + function getPathWithoutRoot(pathComponents) { + if (pathComponents.length === 0) + return ""; + return pathComponents.slice(1).join(ts.directorySeparator); + } })(ts || (ts = {})); /* @internal */ (function (ts) { @@ -15501,7 +15641,7 @@ var ts; } ts.getRelativePathFromFile = getRelativePathFromFile; function getRelativePathFromDirectory(fromDirectory, to, getCanonicalFileNameOrIgnoreCase) { - Debug.assert((ts.getRootLength(fromDirectory) > 0) === (ts.getRootLength(to) > 0), "Paths must either both be absolute or both be relative"); + ts.Debug.assert((ts.getRootLength(fromDirectory) > 0) === (ts.getRootLength(to) > 0), "Paths must either both be absolute or both be relative"); var getCanonicalFileName = typeof getCanonicalFileNameOrIgnoreCase === "function" ? getCanonicalFileNameOrIgnoreCase : ts.identity; var ignoreCase = typeof getCanonicalFileNameOrIgnoreCase === "boolean" ? getCanonicalFileNameOrIgnoreCase : false; var pathComponents = getPathComponentsRelativeTo(fromDirectory, to, ignoreCase ? ts.equateStringsCaseInsensitive : ts.equateStringsCaseSensitive, getCanonicalFileName); @@ -16145,32 +16285,9 @@ var ts; return pathext ? path.slice(0, path.length - pathext.length) + (ts.startsWith(ext, ".") ? ext : "." + ext) : path; } ts.changeAnyExtension = changeAnyExtension; - var Debug; - (function (Debug) { - function showSymbol(symbol) { - var symbolFlags = ts.SymbolFlags; - return "{ flags: " + (symbolFlags ? showFlags(symbol.flags, symbolFlags) : symbol.flags) + "; declarations: " + ts.map(symbol.declarations, showSyntaxKind) + " }"; - } - Debug.showSymbol = showSymbol; - function showFlags(flags, flagsEnum) { - var out = []; - for (var pow = 0; pow <= 30; pow++) { - var n = 1 << pow; - if (flags & n) { - out.push(flagsEnum[n]); - } - } - return out.join("|"); - } - function showSyntaxKind(node) { - var syntaxKind = ts.SyntaxKind; - return syntaxKind ? syntaxKind[node.kind] : node.kind.toString(); - } - Debug.showSyntaxKind = showSyntaxKind; - })(Debug = ts.Debug || (ts.Debug = {})); function tryParsePattern(pattern) { // This should be verified outside of here and a proper error thrown. - Debug.assert(ts.hasZeroOrOneAsteriskCharacter(pattern)); + ts.Debug.assert(ts.hasZeroOrOneAsteriskCharacter(pattern)); var indexOfStar = pattern.indexOf("*"); return indexOfStar === -1 ? undefined : { prefix: pattern.substr(0, indexOfStar), @@ -16199,7 +16316,7 @@ var ts; */ function extensionFromPath(path) { var ext = tryGetExtensionFromPath(path); - return ext !== undefined ? ext : Debug.fail("File " + path + " has unknown extension."); + return ext !== undefined ? ext : ts.Debug.fail("File " + path + " has unknown extension."); } ts.extensionFromPath = extensionFromPath; function isAnySupportedFileExtension(path) { @@ -16271,7 +16388,7 @@ var ts; ts.matchPatternOrExact = matchPatternOrExact; function sliceAfter(arr, value) { var index = arr.indexOf(value); - Debug.assert(index !== -1); + ts.Debug.assert(index !== -1); return arr.slice(index); } ts.sliceAfter = sliceAfter; @@ -16289,7 +16406,7 @@ var ts; } ts.addRelatedInfo = addRelatedInfo; function minAndMax(arr, getValue) { - Debug.assert(arr.length !== 0); + ts.Debug.assert(arr.length !== 0); var min = getValue(arr[0]); var max = min; for (var i = 1; i < arr.length; i++) { @@ -16487,10 +16604,10 @@ var ts; var SourceFileConstructor; // tslint:enable variable-name function createNode(kind, pos, end) { - if (kind === 284 /* SourceFile */) { + if (kind === 285 /* SourceFile */) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } - else if (kind === 72 /* Identifier */) { + else if (kind === 73 /* Identifier */) { return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end); } else if (!ts.isNodeKind(kind)) { @@ -16539,19 +16656,19 @@ var ts; * that they appear in the source code. The language service depends on this property to locate nodes by position. */ function forEachChild(node, cbNode, cbNodes) { - if (!node || node.kind <= 147 /* LastToken */) { + if (!node || node.kind <= 148 /* LastToken */) { return; } switch (node.kind) { - case 148 /* QualifiedName */: + case 149 /* QualifiedName */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 150 /* TypeParameter */: + case 151 /* TypeParameter */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.default) || visitNode(cbNode, node.expression); - case 276 /* ShorthandPropertyAssignment */: + case 277 /* ShorthandPropertyAssignment */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || @@ -16559,9 +16676,9 @@ var ts; visitNode(cbNode, node.exclamationToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 277 /* SpreadAssignment */: + case 278 /* SpreadAssignment */: return visitNode(cbNode, node.expression); - case 151 /* Parameter */: + case 152 /* Parameter */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.dotDotDotToken) || @@ -16569,7 +16686,7 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 154 /* PropertyDeclaration */: + case 155 /* PropertyDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || @@ -16577,51 +16694,51 @@ var ts; visitNode(cbNode, node.exclamationToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 153 /* PropertySignature */: + case 154 /* PropertySignature */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 275 /* PropertyAssignment */: + case 276 /* PropertyAssignment */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.initializer); - case 237 /* VariableDeclaration */: + case 238 /* VariableDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.exclamationToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 186 /* BindingElement */: + case 187 /* BindingElement */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 165 /* FunctionType */: - case 166 /* ConstructorType */: - case 160 /* CallSignature */: - case 161 /* ConstructSignature */: - case 162 /* IndexSignature */: + case 166 /* FunctionType */: + case 167 /* ConstructorType */: + case 161 /* CallSignature */: + case 162 /* ConstructSignature */: + case 163 /* IndexSignature */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: - case 157 /* Constructor */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 196 /* FunctionExpression */: - case 239 /* FunctionDeclaration */: - case 197 /* ArrowFunction */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: + case 158 /* Constructor */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 197 /* FunctionExpression */: + case 240 /* FunctionDeclaration */: + case 198 /* ArrowFunction */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -16633,343 +16750,343 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 164 /* TypeReference */: + case 165 /* TypeReference */: return visitNode(cbNode, node.typeName) || visitNodes(cbNode, cbNodes, node.typeArguments); - case 163 /* TypePredicate */: + case 164 /* TypePredicate */: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); - case 167 /* TypeQuery */: + case 168 /* TypeQuery */: return visitNode(cbNode, node.exprName); - case 168 /* TypeLiteral */: + case 169 /* TypeLiteral */: return visitNodes(cbNode, cbNodes, node.members); - case 169 /* ArrayType */: + case 170 /* ArrayType */: return visitNode(cbNode, node.elementType); - case 170 /* TupleType */: + case 171 /* TupleType */: return visitNodes(cbNode, cbNodes, node.elementTypes); - case 173 /* UnionType */: - case 174 /* IntersectionType */: + case 174 /* UnionType */: + case 175 /* IntersectionType */: return visitNodes(cbNode, cbNodes, node.types); - case 175 /* ConditionalType */: + case 176 /* ConditionalType */: return visitNode(cbNode, node.checkType) || visitNode(cbNode, node.extendsType) || visitNode(cbNode, node.trueType) || visitNode(cbNode, node.falseType); - case 176 /* InferType */: + case 177 /* InferType */: return visitNode(cbNode, node.typeParameter); - case 183 /* ImportType */: + case 184 /* ImportType */: return visitNode(cbNode, node.argument) || visitNode(cbNode, node.qualifier) || visitNodes(cbNode, cbNodes, node.typeArguments); - case 177 /* ParenthesizedType */: - case 179 /* TypeOperator */: + case 178 /* ParenthesizedType */: + case 180 /* TypeOperator */: return visitNode(cbNode, node.type); - case 180 /* IndexedAccessType */: + case 181 /* IndexedAccessType */: return visitNode(cbNode, node.objectType) || visitNode(cbNode, node.indexType); - case 181 /* MappedType */: + case 182 /* MappedType */: return visitNode(cbNode, node.readonlyToken) || visitNode(cbNode, node.typeParameter) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type); - case 182 /* LiteralType */: + case 183 /* LiteralType */: return visitNode(cbNode, node.literal); - case 184 /* ObjectBindingPattern */: - case 185 /* ArrayBindingPattern */: + case 185 /* ObjectBindingPattern */: + case 186 /* ArrayBindingPattern */: return visitNodes(cbNode, cbNodes, node.elements); - case 187 /* ArrayLiteralExpression */: + case 188 /* ArrayLiteralExpression */: return visitNodes(cbNode, cbNodes, node.elements); - case 188 /* ObjectLiteralExpression */: + case 189 /* ObjectLiteralExpression */: return visitNodes(cbNode, cbNodes, node.properties); - case 189 /* PropertyAccessExpression */: + case 190 /* PropertyAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.name); - case 190 /* ElementAccessExpression */: + case 191 /* ElementAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 191 /* CallExpression */: - case 192 /* NewExpression */: + case 192 /* CallExpression */: + case 193 /* NewExpression */: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.typeArguments) || visitNodes(cbNode, cbNodes, node.arguments); - case 193 /* TaggedTemplateExpression */: + case 194 /* TaggedTemplateExpression */: return visitNode(cbNode, node.tag) || visitNodes(cbNode, cbNodes, node.typeArguments) || visitNode(cbNode, node.template); - case 194 /* TypeAssertionExpression */: + case 195 /* TypeAssertionExpression */: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 195 /* ParenthesizedExpression */: + case 196 /* ParenthesizedExpression */: return visitNode(cbNode, node.expression); - case 198 /* DeleteExpression */: + case 199 /* DeleteExpression */: return visitNode(cbNode, node.expression); - case 199 /* TypeOfExpression */: + case 200 /* TypeOfExpression */: return visitNode(cbNode, node.expression); - case 200 /* VoidExpression */: + case 201 /* VoidExpression */: return visitNode(cbNode, node.expression); - case 202 /* PrefixUnaryExpression */: + case 203 /* PrefixUnaryExpression */: return visitNode(cbNode, node.operand); - case 207 /* YieldExpression */: + case 208 /* YieldExpression */: return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); - case 201 /* AwaitExpression */: + case 202 /* AwaitExpression */: return visitNode(cbNode, node.expression); - case 203 /* PostfixUnaryExpression */: + case 204 /* PostfixUnaryExpression */: return visitNode(cbNode, node.operand); - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 212 /* AsExpression */: + case 213 /* AsExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 213 /* NonNullExpression */: + case 214 /* NonNullExpression */: return visitNode(cbNode, node.expression); - case 214 /* MetaProperty */: + case 215 /* MetaProperty */: return visitNode(cbNode, node.name); - case 205 /* ConditionalExpression */: + case 206 /* ConditionalExpression */: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 208 /* SpreadElement */: + case 209 /* SpreadElement */: return visitNode(cbNode, node.expression); - case 218 /* Block */: - case 245 /* ModuleBlock */: + case 219 /* Block */: + case 246 /* ModuleBlock */: return visitNodes(cbNode, cbNodes, node.statements); - case 284 /* SourceFile */: + case 285 /* SourceFile */: return visitNodes(cbNode, cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 219 /* VariableStatement */: + case 220 /* VariableStatement */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 238 /* VariableDeclarationList */: + case 239 /* VariableDeclarationList */: return visitNodes(cbNode, cbNodes, node.declarations); - case 221 /* ExpressionStatement */: + case 222 /* ExpressionStatement */: return visitNode(cbNode, node.expression); - case 222 /* IfStatement */: + case 223 /* IfStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 223 /* DoStatement */: + case 224 /* DoStatement */: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 224 /* WhileStatement */: + case 225 /* WhileStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 225 /* ForStatement */: + case 226 /* ForStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 226 /* ForInStatement */: + case 227 /* ForInStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 227 /* ForOfStatement */: + case 228 /* ForOfStatement */: return visitNode(cbNode, node.awaitModifier) || visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 228 /* ContinueStatement */: - case 229 /* BreakStatement */: + case 229 /* ContinueStatement */: + case 230 /* BreakStatement */: return visitNode(cbNode, node.label); - case 230 /* ReturnStatement */: + case 231 /* ReturnStatement */: return visitNode(cbNode, node.expression); - case 231 /* WithStatement */: + case 232 /* WithStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 232 /* SwitchStatement */: + case 233 /* SwitchStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 246 /* CaseBlock */: + case 247 /* CaseBlock */: return visitNodes(cbNode, cbNodes, node.clauses); - case 271 /* CaseClause */: + case 272 /* CaseClause */: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.statements); - case 272 /* DefaultClause */: + case 273 /* DefaultClause */: return visitNodes(cbNode, cbNodes, node.statements); - case 233 /* LabeledStatement */: + case 234 /* LabeledStatement */: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 234 /* ThrowStatement */: + case 235 /* ThrowStatement */: return visitNode(cbNode, node.expression); - case 235 /* TryStatement */: + case 236 /* TryStatement */: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 274 /* CatchClause */: + case 275 /* CatchClause */: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 152 /* Decorator */: + case 153 /* Decorator */: return visitNode(cbNode, node.expression); - case 240 /* ClassDeclaration */: - case 209 /* ClassExpression */: + case 241 /* ClassDeclaration */: + case 210 /* ClassExpression */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.heritageClauses) || visitNodes(cbNode, cbNodes, node.members); - case 241 /* InterfaceDeclaration */: + case 242 /* InterfaceDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.heritageClauses) || visitNodes(cbNode, cbNodes, node.members); - case 242 /* TypeAliasDeclaration */: + case 243 /* TypeAliasDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNode(cbNode, node.type); - case 243 /* EnumDeclaration */: + case 244 /* EnumDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.members); - case 278 /* EnumMember */: + case 279 /* EnumMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 248 /* ImportEqualsDeclaration */: + case 249 /* ImportEqualsDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 249 /* ImportDeclaration */: + case 250 /* ImportDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 250 /* ImportClause */: + case 251 /* ImportClause */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 247 /* NamespaceExportDeclaration */: + case 248 /* NamespaceExportDeclaration */: return visitNode(cbNode, node.name); - case 251 /* NamespaceImport */: + case 252 /* NamespaceImport */: return visitNode(cbNode, node.name); - case 252 /* NamedImports */: - case 256 /* NamedExports */: + case 253 /* NamedImports */: + case 257 /* NamedExports */: return visitNodes(cbNode, cbNodes, node.elements); - case 255 /* ExportDeclaration */: + case 256 /* ExportDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 253 /* ImportSpecifier */: - case 257 /* ExportSpecifier */: + case 254 /* ImportSpecifier */: + case 258 /* ExportSpecifier */: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 254 /* ExportAssignment */: + case 255 /* ExportAssignment */: return visitNodes(cbNode, cbNodes, node.decorators) || visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 206 /* TemplateExpression */: + case 207 /* TemplateExpression */: return visitNode(cbNode, node.head) || visitNodes(cbNode, cbNodes, node.templateSpans); - case 216 /* TemplateSpan */: + case 217 /* TemplateSpan */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 149 /* ComputedPropertyName */: + case 150 /* ComputedPropertyName */: return visitNode(cbNode, node.expression); - case 273 /* HeritageClause */: + case 274 /* HeritageClause */: return visitNodes(cbNode, cbNodes, node.types); - case 211 /* ExpressionWithTypeArguments */: + case 212 /* ExpressionWithTypeArguments */: return visitNode(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.typeArguments); - case 259 /* ExternalModuleReference */: + case 260 /* ExternalModuleReference */: return visitNode(cbNode, node.expression); - case 258 /* MissingDeclaration */: + case 259 /* MissingDeclaration */: return visitNodes(cbNode, cbNodes, node.decorators); - case 314 /* CommaListExpression */: + case 315 /* CommaListExpression */: return visitNodes(cbNode, cbNodes, node.elements); - case 260 /* JsxElement */: + case 261 /* JsxElement */: return visitNode(cbNode, node.openingElement) || visitNodes(cbNode, cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 264 /* JsxFragment */: + case 265 /* JsxFragment */: return visitNode(cbNode, node.openingFragment) || visitNodes(cbNode, cbNodes, node.children) || visitNode(cbNode, node.closingFragment); - case 261 /* JsxSelfClosingElement */: - case 262 /* JsxOpeningElement */: + case 262 /* JsxSelfClosingElement */: + case 263 /* JsxOpeningElement */: return visitNode(cbNode, node.tagName) || visitNodes(cbNode, cbNodes, node.typeArguments) || visitNode(cbNode, node.attributes); - case 268 /* JsxAttributes */: + case 269 /* JsxAttributes */: return visitNodes(cbNode, cbNodes, node.properties); - case 267 /* JsxAttribute */: + case 268 /* JsxAttribute */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 269 /* JsxSpreadAttribute */: + case 270 /* JsxSpreadAttribute */: return visitNode(cbNode, node.expression); - case 270 /* JsxExpression */: + case 271 /* JsxExpression */: return visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.expression); - case 263 /* JsxClosingElement */: + case 264 /* JsxClosingElement */: return visitNode(cbNode, node.tagName); - case 171 /* OptionalType */: - case 172 /* RestType */: - case 288 /* JSDocTypeExpression */: - case 292 /* JSDocNonNullableType */: - case 291 /* JSDocNullableType */: - case 293 /* JSDocOptionalType */: - case 295 /* JSDocVariadicType */: + case 172 /* OptionalType */: + case 173 /* RestType */: + case 289 /* JSDocTypeExpression */: + case 293 /* JSDocNonNullableType */: + case 292 /* JSDocNullableType */: + case 294 /* JSDocOptionalType */: + case 296 /* JSDocVariadicType */: return visitNode(cbNode, node.type); - case 294 /* JSDocFunctionType */: + case 295 /* JSDocFunctionType */: return visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 296 /* JSDocComment */: + case 297 /* JSDocComment */: return visitNodes(cbNode, cbNodes, node.tags); - case 304 /* JSDocParameterTag */: - case 310 /* JSDocPropertyTag */: + case 305 /* JSDocParameterTag */: + case 311 /* JSDocPropertyTag */: return visitNode(cbNode, node.tagName) || (node.isNameFirst ? visitNode(cbNode, node.name) || visitNode(cbNode, node.typeExpression) : visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name)); - case 300 /* JSDocAugmentsTag */: + case 301 /* JSDocAugmentsTag */: return visitNode(cbNode, node.tagName) || visitNode(cbNode, node.class); - case 308 /* JSDocTemplateTag */: + case 309 /* JSDocTemplateTag */: return visitNode(cbNode, node.tagName) || visitNode(cbNode, node.constraint) || visitNodes(cbNode, cbNodes, node.typeParameters); - case 309 /* JSDocTypedefTag */: + case 310 /* JSDocTypedefTag */: return visitNode(cbNode, node.tagName) || (node.typeExpression && - node.typeExpression.kind === 288 /* JSDocTypeExpression */ + node.typeExpression.kind === 289 /* JSDocTypeExpression */ ? visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName) : visitNode(cbNode, node.fullName) || visitNode(cbNode, node.typeExpression)); - case 302 /* JSDocCallbackTag */: + case 303 /* JSDocCallbackTag */: return visitNode(cbNode, node.tagName) || visitNode(cbNode, node.fullName) || visitNode(cbNode, node.typeExpression); - case 305 /* JSDocReturnTag */: - case 307 /* JSDocTypeTag */: - case 306 /* JSDocThisTag */: - case 303 /* JSDocEnumTag */: + case 306 /* JSDocReturnTag */: + case 308 /* JSDocTypeTag */: + case 307 /* JSDocThisTag */: + case 304 /* JSDocEnumTag */: return visitNode(cbNode, node.tagName) || visitNode(cbNode, node.typeExpression); - case 298 /* JSDocSignature */: + case 299 /* JSDocSignature */: return ts.forEach(node.typeParameters, cbNode) || ts.forEach(node.parameters, cbNode) || visitNode(cbNode, node.type); - case 297 /* JSDocTypeLiteral */: + case 298 /* JSDocTypeLiteral */: return ts.forEach(node.jsDocPropertyTags, cbNode); - case 299 /* JSDocTag */: - case 301 /* JSDocClassTag */: + case 300 /* JSDocTag */: + case 302 /* JSDocClassTag */: return visitNode(cbNode, node.tagName); - case 313 /* PartiallyEmittedExpression */: + case 314 /* PartiallyEmittedExpression */: return visitNode(cbNode, node.expression); } } @@ -17049,7 +17166,7 @@ var ts; (function (Parser) { // Share a single scanner across all calls to parse a source file. This helps speed things // up by avoiding the cost of creating/compiling scanners over and over again. - var scanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ true); + var scanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ true); var disallowInAndDecoratorContext = 2048 /* DisallowInContext */ | 8192 /* DecoratorContext */; // capture constructors in 'initializeState' to avoid null checks // tslint:disable variable-name @@ -17187,14 +17304,14 @@ var ts; sourceFile.endOfFileToken = parseTokenNode(); } else { - var statement = createNode(221 /* ExpressionStatement */); + var statement = createNode(222 /* ExpressionStatement */); switch (token()) { case 22 /* OpenBracketToken */: statement.expression = parseArrayLiteralExpression(); break; - case 102 /* TrueKeyword */: - case 87 /* FalseKeyword */: - case 96 /* NullKeyword */: + case 103 /* TrueKeyword */: + case 88 /* FalseKeyword */: + case 97 /* NullKeyword */: statement.expression = parseTokenNode(); break; case 39 /* MinusToken */: @@ -17343,7 +17460,7 @@ var ts; function createSourceFile(fileName, languageVersion, scriptKind, isDeclarationFile) { // code from createNode is inlined here so createNode won't have to deal with special case of creating source files // this is quite rare comparing to other nodes and createNode should be as fast as possible - var sourceFile = new SourceFileConstructor(284 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); + var sourceFile = new SourceFileConstructor(285 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -17486,6 +17603,9 @@ var ts; function nextToken() { return currentToken = scanner.scan(); } + function nextTokenJSDoc() { + return currentToken = scanner.scanJsDocToken(); + } function reScanGreaterToken() { return currentToken = scanner.reScanGreaterToken(); } @@ -17551,20 +17671,20 @@ var ts; } // Ignore strict mode flag because we will report an error in type checker instead. function isIdentifier() { - if (token() === 72 /* Identifier */) { + if (token() === 73 /* Identifier */) { return true; } // If we have a 'yield' keyword, and we're in the [yield] context, then 'yield' is // considered a keyword and is not an identifier. - if (token() === 117 /* YieldKeyword */ && inYieldContext()) { + if (token() === 118 /* YieldKeyword */ && inYieldContext()) { return false; } // If we have a 'await' keyword, and we're in the [Await] context, then 'await' is // considered a keyword and is not an identifier. - if (token() === 122 /* AwaitKeyword */ && inAwaitContext()) { + if (token() === 123 /* AwaitKeyword */ && inAwaitContext()) { return false; } - return token() > 108 /* LastReservedWord */; + return token() > 109 /* LastReservedWord */; } function parseExpected(kind, diagnosticMessage, shouldAdvance) { if (shouldAdvance === void 0) { shouldAdvance = true; } @@ -17583,6 +17703,14 @@ var ts; } return false; } + function parseExpectedJSDoc(kind) { + if (token() === kind) { + nextTokenJSDoc(); + return true; + } + parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind)); + return false; + } function parseOptional(t) { if (token() === t) { nextToken(); @@ -17596,15 +17724,30 @@ var ts; } return undefined; } + function parseOptionalTokenJSDoc(t) { + if (token() === t) { + return parseTokenNodeJSDoc(); + } + return undefined; + } function parseExpectedToken(t, diagnosticMessage, arg0) { return parseOptionalToken(t) || createMissingNode(t, /*reportAtCurrentPosition*/ false, diagnosticMessage || ts.Diagnostics._0_expected, arg0 || ts.tokenToString(t)); } + function parseExpectedTokenJSDoc(t) { + return parseOptionalTokenJSDoc(t) || + createMissingNode(t, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(t)); + } function parseTokenNode() { var node = createNode(token()); nextToken(); return finishNode(node); } + function parseTokenNodeJSDoc() { + var node = createNode(token()); + nextTokenJSDoc(); + return finishNode(node); + } function canParseSemicolon() { // If there's a real semicolon, then we can always parse it out. if (token() === 26 /* SemicolonToken */) { @@ -17629,7 +17772,7 @@ var ts; nodeCount++; var p = pos >= 0 ? pos : scanner.getStartPos(); return ts.isNodeKind(kind) || kind === 0 /* Unknown */ ? new NodeConstructor(kind, p, p) : - kind === 72 /* Identifier */ ? new IdentifierConstructor(kind, p, p) : + kind === 73 /* Identifier */ ? new IdentifierConstructor(kind, p, p) : new TokenConstructor(kind, p, p); } function createNodeWithJSDoc(kind, pos) { @@ -17671,7 +17814,7 @@ var ts; parseErrorAtCurrentToken(diagnosticMessage, arg0); } var result = createNode(kind); - if (kind === 72 /* Identifier */) { + if (kind === 73 /* Identifier */) { result.escapedText = ""; } else if (ts.isLiteralKind(kind) || ts.isTemplateLiteralKind(kind)) { @@ -17692,9 +17835,9 @@ var ts; function createIdentifier(isIdentifier, diagnosticMessage) { identifierCount++; if (isIdentifier) { - var node = createNode(72 /* Identifier */); + var node = createNode(73 /* Identifier */); // Store original token kind if it is not just an Identifier so we can report appropriate error later in type checker - if (token() !== 72 /* Identifier */) { + if (token() !== 73 /* Identifier */) { node.originalKeywordKind = token(); } node.escapedText = ts.escapeLeadingUnderscores(internIdentifier(scanner.getTokenValue())); @@ -17703,7 +17846,7 @@ var ts; } // Only for end of file because the error gets reported incorrectly on embedded script tags. var reportAtCurrentPosition = token() === 1 /* EndOfFileToken */; - return createMissingNode(72 /* Identifier */, reportAtCurrentPosition, diagnosticMessage || ts.Diagnostics.Identifier_expected); + return createMissingNode(73 /* Identifier */, reportAtCurrentPosition, diagnosticMessage || ts.Diagnostics.Identifier_expected); } function parseIdentifier(diagnosticMessage) { return createIdentifier(isIdentifier(), diagnosticMessage); @@ -17734,7 +17877,7 @@ var ts; // PropertyName [Yield]: // LiteralPropertyName // ComputedPropertyName[?Yield] - var node = createNode(149 /* ComputedPropertyName */); + var node = createNode(150 /* ComputedPropertyName */); parseExpected(22 /* OpenBracketToken */); // We parse any expression (including a comma expression). But the grammar // says that only an assignment expression is allowed, so the grammar checker @@ -17755,20 +17898,20 @@ var ts; } function nextTokenCanFollowModifier() { switch (token()) { - case 77 /* ConstKeyword */: + case 78 /* ConstKeyword */: // 'const' is only a modifier if followed by 'enum'. - return nextToken() === 84 /* EnumKeyword */; - case 85 /* ExportKeyword */: + return nextToken() === 85 /* EnumKeyword */; + case 86 /* ExportKeyword */: nextToken(); - if (token() === 80 /* DefaultKeyword */) { + if (token() === 81 /* DefaultKeyword */) { return lookAhead(nextTokenCanFollowDefaultKeyword); } - return token() !== 40 /* AsteriskToken */ && token() !== 119 /* AsKeyword */ && token() !== 18 /* OpenBraceToken */ && canFollowModifier(); - case 80 /* DefaultKeyword */: + return token() !== 40 /* AsteriskToken */ && token() !== 120 /* AsKeyword */ && token() !== 18 /* OpenBraceToken */ && canFollowModifier(); + case 81 /* DefaultKeyword */: return nextTokenCanFollowDefaultKeyword(); - case 116 /* StaticKeyword */: - case 126 /* GetKeyword */: - case 137 /* SetKeyword */: + case 117 /* StaticKeyword */: + case 127 /* GetKeyword */: + case 138 /* SetKeyword */: nextToken(); return canFollowModifier(); default: @@ -17787,10 +17930,10 @@ var ts; } function nextTokenCanFollowDefaultKeyword() { nextToken(); - return token() === 76 /* ClassKeyword */ || token() === 90 /* FunctionKeyword */ || - token() === 110 /* InterfaceKeyword */ || - (token() === 118 /* AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine)) || - (token() === 121 /* AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); + return token() === 77 /* ClassKeyword */ || token() === 91 /* FunctionKeyword */ || + token() === 111 /* InterfaceKeyword */ || + (token() === 119 /* AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine)) || + (token() === 122 /* AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); } // True if positioned at the start of a list element function isListElement(parsingContext, inErrorRecovery) { @@ -17810,7 +17953,7 @@ var ts; // outer module. We just want to consume and move on. return !(token() === 26 /* SemicolonToken */ && inErrorRecovery) && isStartOfStatement(); case 2 /* SwitchClauses */: - return token() === 74 /* CaseKeyword */ || token() === 80 /* DefaultKeyword */; + return token() === 75 /* CaseKeyword */ || token() === 81 /* DefaultKeyword */; case 4 /* TypeMembers */: return lookAhead(isTypeMemberStart); case 5 /* ClassMembers */: @@ -17896,7 +18039,7 @@ var ts; // extends {} extends // extends {} implements var next = nextToken(); - return next === 27 /* CommaToken */ || next === 18 /* OpenBraceToken */ || next === 86 /* ExtendsKeyword */ || next === 109 /* ImplementsKeyword */; + return next === 27 /* CommaToken */ || next === 18 /* OpenBraceToken */ || next === 87 /* ExtendsKeyword */ || next === 110 /* ImplementsKeyword */; } return true; } @@ -17913,8 +18056,8 @@ var ts; return ts.tokenIsIdentifierOrKeywordOrGreaterThan(token()); } function isHeritageClauseExtendsOrImplementsKeyword() { - if (token() === 109 /* ImplementsKeyword */ || - token() === 86 /* ExtendsKeyword */) { + if (token() === 110 /* ImplementsKeyword */ || + token() === 87 /* ExtendsKeyword */) { return lookAhead(nextTokenIsStartOfExpression); } return false; @@ -17944,14 +18087,14 @@ var ts; case 23 /* ImportOrExportSpecifiers */: return token() === 19 /* CloseBraceToken */; case 3 /* SwitchClauseStatements */: - return token() === 19 /* CloseBraceToken */ || token() === 74 /* CaseKeyword */ || token() === 80 /* DefaultKeyword */; + return token() === 19 /* CloseBraceToken */ || token() === 75 /* CaseKeyword */ || token() === 81 /* DefaultKeyword */; case 7 /* HeritageClauseElement */: - return token() === 18 /* OpenBraceToken */ || token() === 86 /* ExtendsKeyword */ || token() === 109 /* ImplementsKeyword */; + return token() === 18 /* OpenBraceToken */ || token() === 87 /* ExtendsKeyword */ || token() === 110 /* ImplementsKeyword */; case 8 /* VariableDeclarations */: return isVariableDeclaratorListTerminator(); case 19 /* TypeParameters */: // Tokens other than '>' are here for better error recovery - return token() === 30 /* GreaterThanToken */ || token() === 20 /* OpenParenToken */ || token() === 18 /* OpenBraceToken */ || token() === 86 /* ExtendsKeyword */ || token() === 109 /* ImplementsKeyword */; + return token() === 30 /* GreaterThanToken */ || token() === 20 /* OpenParenToken */ || token() === 18 /* OpenBraceToken */ || token() === 87 /* ExtendsKeyword */ || token() === 110 /* ImplementsKeyword */; case 11 /* ArgumentExpressions */: // Tokens other than ')' are here for better error recovery return token() === 21 /* CloseParenToken */ || token() === 26 /* SemicolonToken */; @@ -18168,20 +18311,20 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 157 /* Constructor */: - case 162 /* IndexSignature */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 154 /* PropertyDeclaration */: - case 217 /* SemicolonClassElement */: + case 158 /* Constructor */: + case 163 /* IndexSignature */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 155 /* PropertyDeclaration */: + case 218 /* SemicolonClassElement */: return true; - case 156 /* MethodDeclaration */: + case 157 /* MethodDeclaration */: // Method declarations are not necessarily reusable. An object-literal // may have a method calls "constructor(...)" and we must reparse that // into an actual .ConstructorDeclaration. var methodDeclaration = node; - var nameIsConstructor = methodDeclaration.name.kind === 72 /* Identifier */ && - methodDeclaration.name.originalKeywordKind === 124 /* ConstructorKeyword */; + var nameIsConstructor = methodDeclaration.name.kind === 73 /* Identifier */ && + methodDeclaration.name.originalKeywordKind === 125 /* ConstructorKeyword */; return !nameIsConstructor; } } @@ -18190,8 +18333,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 271 /* CaseClause */: - case 272 /* DefaultClause */: + case 272 /* CaseClause */: + case 273 /* DefaultClause */: return true; } } @@ -18200,58 +18343,58 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 239 /* FunctionDeclaration */: - case 219 /* VariableStatement */: - case 218 /* Block */: - case 222 /* IfStatement */: - case 221 /* ExpressionStatement */: - case 234 /* ThrowStatement */: - case 230 /* ReturnStatement */: - case 232 /* SwitchStatement */: - case 229 /* BreakStatement */: - case 228 /* ContinueStatement */: - case 226 /* ForInStatement */: - case 227 /* ForOfStatement */: - case 225 /* ForStatement */: - case 224 /* WhileStatement */: - case 231 /* WithStatement */: - case 220 /* EmptyStatement */: - case 235 /* TryStatement */: - case 233 /* LabeledStatement */: - case 223 /* DoStatement */: - case 236 /* DebuggerStatement */: - case 249 /* ImportDeclaration */: - case 248 /* ImportEqualsDeclaration */: - case 255 /* ExportDeclaration */: - case 254 /* ExportAssignment */: - case 244 /* ModuleDeclaration */: - case 240 /* ClassDeclaration */: - case 241 /* InterfaceDeclaration */: - case 243 /* EnumDeclaration */: - case 242 /* TypeAliasDeclaration */: + case 240 /* FunctionDeclaration */: + case 220 /* VariableStatement */: + case 219 /* Block */: + case 223 /* IfStatement */: + case 222 /* ExpressionStatement */: + case 235 /* ThrowStatement */: + case 231 /* ReturnStatement */: + case 233 /* SwitchStatement */: + case 230 /* BreakStatement */: + case 229 /* ContinueStatement */: + case 227 /* ForInStatement */: + case 228 /* ForOfStatement */: + case 226 /* ForStatement */: + case 225 /* WhileStatement */: + case 232 /* WithStatement */: + case 221 /* EmptyStatement */: + case 236 /* TryStatement */: + case 234 /* LabeledStatement */: + case 224 /* DoStatement */: + case 237 /* DebuggerStatement */: + case 250 /* ImportDeclaration */: + case 249 /* ImportEqualsDeclaration */: + case 256 /* ExportDeclaration */: + case 255 /* ExportAssignment */: + case 245 /* ModuleDeclaration */: + case 241 /* ClassDeclaration */: + case 242 /* InterfaceDeclaration */: + case 244 /* EnumDeclaration */: + case 243 /* TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 278 /* EnumMember */; + return node.kind === 279 /* EnumMember */; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 161 /* ConstructSignature */: - case 155 /* MethodSignature */: - case 162 /* IndexSignature */: - case 153 /* PropertySignature */: - case 160 /* CallSignature */: + case 162 /* ConstructSignature */: + case 156 /* MethodSignature */: + case 163 /* IndexSignature */: + case 154 /* PropertySignature */: + case 161 /* CallSignature */: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 237 /* VariableDeclaration */) { + if (node.kind !== 238 /* VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -18272,7 +18415,7 @@ var ts; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 151 /* Parameter */) { + if (node.kind !== 152 /* Parameter */) { return false; } // See the comment in isReusableVariableDeclaration for why we do this. @@ -18408,7 +18551,7 @@ var ts; return entity; } function createQualifiedName(entity, name) { - var node = createNode(148 /* QualifiedName */, entity.pos); + var node = createNode(149 /* QualifiedName */, entity.pos); node.left = entity; node.right = name; return finishNode(node); @@ -18439,13 +18582,13 @@ var ts; // Report that we need an identifier. However, report it right after the dot, // and not on the next token. This is because the next token might actually // be an identifier and the error would be quite confusing. - return createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Identifier_expected); + return createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Identifier_expected); } } return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(206 /* TemplateExpression */); + var template = createNode(207 /* TemplateExpression */); template.head = parseTemplateHead(); ts.Debug.assert(template.head.kind === 15 /* TemplateHead */, "Template head has wrong token kind"); var list = []; @@ -18457,7 +18600,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(216 /* TemplateSpan */); + var span = createNode(217 /* TemplateSpan */); span.expression = allowInAnd(parseExpression); var literal; if (token() === 19 /* CloseBraceToken */) { @@ -18507,7 +18650,7 @@ var ts; } // TYPES function parseTypeReference() { - var node = createNode(164 /* TypeReference */); + var node = createNode(165 /* TypeReference */); node.typeName = parseEntityName(/*allowReservedWords*/ true, ts.Diagnostics.Type_expected); if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === 28 /* LessThanToken */) { node.typeArguments = parseBracketedList(20 /* TypeArguments */, parseType, 28 /* LessThanToken */, 30 /* GreaterThanToken */); @@ -18517,14 +18660,14 @@ var ts; // If true, we should abort parsing an error function. function typeHasArrowFunctionBlockingParseError(node) { switch (node.kind) { - case 164 /* TypeReference */: + case 165 /* TypeReference */: return ts.nodeIsMissing(node.typeName); - case 165 /* FunctionType */: - case 166 /* ConstructorType */: { + case 166 /* FunctionType */: + case 167 /* ConstructorType */: { var _a = node, parameters = _a.parameters, type = _a.type; return isMissingList(parameters) || typeHasArrowFunctionBlockingParseError(type); } - case 177 /* ParenthesizedType */: + case 178 /* ParenthesizedType */: return typeHasArrowFunctionBlockingParseError(node.type); default: return false; @@ -18532,20 +18675,20 @@ var ts; } function parseThisTypePredicate(lhs) { nextToken(); - var node = createNode(163 /* TypePredicate */, lhs.pos); + var node = createNode(164 /* TypePredicate */, lhs.pos); node.parameterName = lhs; node.type = parseType(); return finishNode(node); } function parseThisTypeNode() { - var node = createNode(178 /* ThisType */); + var node = createNode(179 /* ThisType */); nextToken(); return finishNode(node); } function parseJSDocAllType(postFixEquals) { - var result = createNode(289 /* JSDocAllType */); + var result = createNode(290 /* JSDocAllType */); if (postFixEquals) { - return createPostfixType(293 /* JSDocOptionalType */, result); + return createPostfixType(294 /* JSDocOptionalType */, result); } else { nextToken(); @@ -18553,7 +18696,7 @@ var ts; return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(292 /* JSDocNonNullableType */); + var result = createNode(293 /* JSDocNonNullableType */); nextToken(); result.type = parseNonArrayType(); return finishNode(result); @@ -18575,31 +18718,31 @@ var ts; token() === 19 /* CloseBraceToken */ || token() === 21 /* CloseParenToken */ || token() === 30 /* GreaterThanToken */ || - token() === 59 /* EqualsToken */ || + token() === 60 /* EqualsToken */ || token() === 50 /* BarToken */) { - var result = createNode(290 /* JSDocUnknownType */, pos); + var result = createNode(291 /* JSDocUnknownType */, pos); return finishNode(result); } else { - var result = createNode(291 /* JSDocNullableType */, pos); + var result = createNode(292 /* JSDocNullableType */, pos); result.type = parseType(); return finishNode(result); } } function parseJSDocFunctionType() { if (lookAhead(nextTokenIsOpenParen)) { - var result = createNodeWithJSDoc(294 /* JSDocFunctionType */); + var result = createNodeWithJSDoc(295 /* JSDocFunctionType */); nextToken(); fillSignature(57 /* ColonToken */, 4 /* Type */ | 32 /* JSDoc */, result); return finishNode(result); } - var node = createNode(164 /* TypeReference */); + var node = createNode(165 /* TypeReference */); node.typeName = parseIdentifierName(); return finishNode(node); } function parseJSDocParameter() { - var parameter = createNode(151 /* Parameter */); - if (token() === 100 /* ThisKeyword */ || token() === 95 /* NewKeyword */) { + var parameter = createNode(152 /* Parameter */); + if (token() === 101 /* ThisKeyword */ || token() === 96 /* NewKeyword */) { parameter.name = parseIdentifierName(); parseExpected(57 /* ColonToken */); } @@ -18612,25 +18755,25 @@ var ts; var type = parseTypeOrTypePredicate(); scanner.setInJSDocType(false); if (dotdotdot) { - var variadic = createNode(295 /* JSDocVariadicType */, dotdotdot.pos); + var variadic = createNode(296 /* JSDocVariadicType */, dotdotdot.pos); variadic.type = type; type = finishNode(variadic); } - if (token() === 59 /* EqualsToken */) { - return createPostfixType(293 /* JSDocOptionalType */, type); + if (token() === 60 /* EqualsToken */) { + return createPostfixType(294 /* JSDocOptionalType */, type); } return type; } function parseTypeQuery() { - var node = createNode(167 /* TypeQuery */); - parseExpected(104 /* TypeOfKeyword */); + var node = createNode(168 /* TypeQuery */); + parseExpected(105 /* TypeOfKeyword */); node.exprName = parseEntityName(/*allowReservedWords*/ true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(150 /* TypeParameter */); + var node = createNode(151 /* TypeParameter */); node.name = parseIdentifier(); - if (parseOptional(86 /* ExtendsKeyword */)) { + if (parseOptional(87 /* ExtendsKeyword */)) { // It's not uncommon for people to write improper constraints to a generic. If the // user writes a constraint that is an expression and not an actual type, then parse // it out as an expression (so we can recover well), but report that a type is needed @@ -18649,7 +18792,7 @@ var ts; node.expression = parseUnaryExpressionOrHigher(); } } - if (parseOptional(59 /* EqualsToken */)) { + if (parseOptional(60 /* EqualsToken */)) { node.default = parseType(); } return finishNode(node); @@ -18673,8 +18816,8 @@ var ts; isStartOfType(/*inStartOfParameter*/ !isJSDocParameter); } function parseParameter() { - var node = createNodeWithJSDoc(151 /* Parameter */); - if (token() === 100 /* ThisKeyword */) { + var node = createNodeWithJSDoc(152 /* Parameter */); + if (token() === 101 /* ThisKeyword */) { node.name = createIdentifier(/*isIdentifier*/ true); node.type = parseParameterType(); return finishNode(node); @@ -18774,8 +18917,8 @@ var ts; } function parseSignatureMember(kind) { var node = createNodeWithJSDoc(kind); - if (kind === 161 /* ConstructSignature */) { - parseExpected(95 /* NewKeyword */); + if (kind === 162 /* ConstructSignature */) { + parseExpected(96 /* NewKeyword */); } fillSignature(57 /* ColonToken */, 4 /* Type */, node); parseTypeMemberSemicolon(); @@ -18835,7 +18978,7 @@ var ts; return token() === 57 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 23 /* CloseBracketToken */; } function parseIndexSignatureDeclaration(node) { - node.kind = 162 /* IndexSignature */; + node.kind = 163 /* IndexSignature */; node.parameters = parseBracketedList(16 /* Parameters */, parseParameter, 22 /* OpenBracketToken */, 23 /* CloseBracketToken */); node.type = parseTypeAnnotation(); parseTypeMemberSemicolon(); @@ -18845,15 +18988,15 @@ var ts; node.name = parsePropertyName(); node.questionToken = parseOptionalToken(56 /* QuestionToken */); if (token() === 20 /* OpenParenToken */ || token() === 28 /* LessThanToken */) { - node.kind = 155 /* MethodSignature */; + node.kind = 156 /* MethodSignature */; // Method signatures don't exist in expression contexts. So they have neither // [Yield] nor [Await] fillSignature(57 /* ColonToken */, 4 /* Type */, node); } else { - node.kind = 153 /* PropertySignature */; + node.kind = 154 /* PropertySignature */; node.type = parseTypeAnnotation(); - if (token() === 59 /* EqualsToken */) { + if (token() === 60 /* EqualsToken */) { // Although type literal properties cannot not have initializers, we attempt // to parse an initializer so we can report in the checker that an interface // property or type literal property cannot have an initializer. @@ -18897,10 +19040,10 @@ var ts; } function parseTypeMember() { if (token() === 20 /* OpenParenToken */ || token() === 28 /* LessThanToken */) { - return parseSignatureMember(160 /* CallSignature */); + return parseSignatureMember(161 /* CallSignature */); } - if (token() === 95 /* NewKeyword */ && lookAhead(nextTokenIsOpenParenOrLessThan)) { - return parseSignatureMember(161 /* ConstructSignature */); + if (token() === 96 /* NewKeyword */ && lookAhead(nextTokenIsOpenParenOrLessThan)) { + return parseSignatureMember(162 /* ConstructSignature */); } var node = createNodeWithJSDoc(0 /* Unknown */); node.modifiers = parseModifiers(); @@ -18926,7 +19069,7 @@ var ts; return false; } function parseTypeLiteral() { - var node = createNode(168 /* TypeLiteral */); + var node = createNode(169 /* TypeLiteral */); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -18944,27 +19087,27 @@ var ts; function isStartOfMappedType() { nextToken(); if (token() === 38 /* PlusToken */ || token() === 39 /* MinusToken */) { - return nextToken() === 133 /* ReadonlyKeyword */; + return nextToken() === 134 /* ReadonlyKeyword */; } - if (token() === 133 /* ReadonlyKeyword */) { + if (token() === 134 /* ReadonlyKeyword */) { nextToken(); } - return token() === 22 /* OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 93 /* InKeyword */; + return token() === 22 /* OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 94 /* InKeyword */; } function parseMappedTypeParameter() { - var node = createNode(150 /* TypeParameter */); + var node = createNode(151 /* TypeParameter */); node.name = parseIdentifier(); - parseExpected(93 /* InKeyword */); + parseExpected(94 /* InKeyword */); node.constraint = parseType(); return finishNode(node); } function parseMappedType() { - var node = createNode(181 /* MappedType */); + var node = createNode(182 /* MappedType */); parseExpected(18 /* OpenBraceToken */); - if (token() === 133 /* ReadonlyKeyword */ || token() === 38 /* PlusToken */ || token() === 39 /* MinusToken */) { + if (token() === 134 /* ReadonlyKeyword */ || token() === 38 /* PlusToken */ || token() === 39 /* MinusToken */) { node.readonlyToken = parseTokenNode(); - if (node.readonlyToken.kind !== 133 /* ReadonlyKeyword */) { - parseExpectedToken(133 /* ReadonlyKeyword */); + if (node.readonlyToken.kind !== 134 /* ReadonlyKeyword */) { + parseExpectedToken(134 /* ReadonlyKeyword */); } } parseExpected(22 /* OpenBracketToken */); @@ -18984,23 +19127,23 @@ var ts; function parseTupleElementType() { var pos = getNodePos(); if (parseOptional(25 /* DotDotDotToken */)) { - var node = createNode(172 /* RestType */, pos); + var node = createNode(173 /* RestType */, pos); node.type = parseType(); return finishNode(node); } var type = parseType(); - if (!(contextFlags & 2097152 /* JSDoc */) && type.kind === 291 /* JSDocNullableType */ && type.pos === type.type.pos) { - type.kind = 171 /* OptionalType */; + if (!(contextFlags & 2097152 /* JSDoc */) && type.kind === 292 /* JSDocNullableType */ && type.pos === type.type.pos) { + type.kind = 172 /* OptionalType */; } return type; } function parseTupleType() { - var node = createNode(170 /* TupleType */); + var node = createNode(171 /* TupleType */); node.elementTypes = parseBracketedList(21 /* TupleElementTypes */, parseTupleElementType, 22 /* OpenBracketToken */, 23 /* CloseBracketToken */); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(177 /* ParenthesizedType */); + var node = createNode(178 /* ParenthesizedType */); parseExpected(20 /* OpenParenToken */); node.type = parseType(); parseExpected(21 /* CloseParenToken */); @@ -19008,7 +19151,7 @@ var ts; } function parseFunctionOrConstructorType() { var pos = getNodePos(); - var kind = parseOptional(95 /* NewKeyword */) ? 166 /* ConstructorType */ : 165 /* FunctionType */; + var kind = parseOptional(96 /* NewKeyword */) ? 167 /* ConstructorType */ : 166 /* FunctionType */; var node = createNodeWithJSDoc(kind, pos); fillSignature(37 /* EqualsGreaterThanToken */, 4 /* Type */, node); return finishNode(node); @@ -19018,14 +19161,14 @@ var ts; return token() === 24 /* DotToken */ ? undefined : node; } function parseLiteralTypeNode(negative) { - var node = createNode(182 /* LiteralType */); + var node = createNode(183 /* LiteralType */); var unaryMinusExpression; if (negative) { - unaryMinusExpression = createNode(202 /* PrefixUnaryExpression */); + unaryMinusExpression = createNode(203 /* PrefixUnaryExpression */); unaryMinusExpression.operator = 39 /* MinusToken */; nextToken(); } - var expression = token() === 102 /* TrueKeyword */ || token() === 87 /* FalseKeyword */ + var expression = token() === 103 /* TrueKeyword */ || token() === 88 /* FalseKeyword */ ? parseTokenNode() : parseLiteralLikeNode(token()); if (negative) { @@ -19038,22 +19181,24 @@ var ts; } function isStartOfTypeOfImportType() { nextToken(); - return token() === 92 /* ImportKeyword */; + return token() === 93 /* ImportKeyword */; } function parseImportType() { sourceFile.flags |= 524288 /* PossiblyContainsDynamicImport */; - var node = createNode(183 /* ImportType */); - if (parseOptional(104 /* TypeOfKeyword */)) { + var node = createNode(184 /* ImportType */); + if (parseOptional(105 /* TypeOfKeyword */)) { node.isTypeOf = true; } - parseExpected(92 /* ImportKeyword */); + parseExpected(93 /* ImportKeyword */); parseExpected(20 /* OpenParenToken */); node.argument = parseType(); parseExpected(21 /* CloseParenToken */); if (parseOptional(24 /* DotToken */)) { node.qualifier = parseEntityName(/*allowReservedWords*/ true, ts.Diagnostics.Type_expected); } - node.typeArguments = tryParseTypeArguments(); + if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === 28 /* LessThanToken */) { + node.typeArguments = parseBracketedList(20 /* TypeArguments */, parseType, 28 /* LessThanToken */, 30 /* GreaterThanToken */); + } return finishNode(node); } function nextTokenIsNumericOrBigIntLiteral() { @@ -19062,25 +19207,25 @@ var ts; } function parseNonArrayType() { switch (token()) { - case 120 /* AnyKeyword */: - case 143 /* UnknownKeyword */: - case 138 /* StringKeyword */: - case 135 /* NumberKeyword */: - case 146 /* BigIntKeyword */: - case 139 /* SymbolKeyword */: - case 123 /* BooleanKeyword */: - case 141 /* UndefinedKeyword */: - case 132 /* NeverKeyword */: - case 136 /* ObjectKeyword */: + case 121 /* AnyKeyword */: + case 144 /* UnknownKeyword */: + case 139 /* StringKeyword */: + case 136 /* NumberKeyword */: + case 147 /* BigIntKeyword */: + case 140 /* SymbolKeyword */: + case 124 /* BooleanKeyword */: + case 142 /* UndefinedKeyword */: + case 133 /* NeverKeyword */: + case 137 /* ObjectKeyword */: // If these are followed by a dot, then parse these out as a dotted type reference instead. return tryParse(parseKeywordAndNoDot) || parseTypeReference(); case 40 /* AsteriskToken */: return parseJSDocAllType(/*postfixEquals*/ false); - case 62 /* AsteriskEqualsToken */: + case 63 /* AsteriskEqualsToken */: return parseJSDocAllType(/*postfixEquals*/ true); case 56 /* QuestionToken */: return parseJSDocUnknownOrNullableType(); - case 90 /* FunctionKeyword */: + case 91 /* FunctionKeyword */: return parseJSDocFunctionType(); case 52 /* ExclamationToken */: return parseJSDocNonNullableType(); @@ -19088,24 +19233,24 @@ var ts; case 10 /* StringLiteral */: case 8 /* NumericLiteral */: case 9 /* BigIntLiteral */: - case 102 /* TrueKeyword */: - case 87 /* FalseKeyword */: + case 103 /* TrueKeyword */: + case 88 /* FalseKeyword */: return parseLiteralTypeNode(); case 39 /* MinusToken */: return lookAhead(nextTokenIsNumericOrBigIntLiteral) ? parseLiteralTypeNode(/*negative*/ true) : parseTypeReference(); - case 106 /* VoidKeyword */: - case 96 /* NullKeyword */: + case 107 /* VoidKeyword */: + case 97 /* NullKeyword */: return parseTokenNode(); - case 100 /* ThisKeyword */: { + case 101 /* ThisKeyword */: { var thisKeyword = parseThisTypeNode(); - if (token() === 128 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 129 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) { return parseThisTypePredicate(thisKeyword); } else { return thisKeyword; } } - case 104 /* TypeOfKeyword */: + case 105 /* TypeOfKeyword */: return lookAhead(isStartOfTypeOfImportType) ? parseImportType() : parseTypeQuery(); case 18 /* OpenBraceToken */: return lookAhead(isStartOfMappedType) ? parseMappedType() : parseTypeLiteral(); @@ -19113,7 +19258,7 @@ var ts; return parseTupleType(); case 20 /* OpenParenToken */: return parseParenthesizedType(); - case 92 /* ImportKeyword */: + case 93 /* ImportKeyword */: return parseImportType(); default: return parseTypeReference(); @@ -19121,41 +19266,41 @@ var ts; } function isStartOfType(inStartOfParameter) { switch (token()) { - case 120 /* AnyKeyword */: - case 143 /* UnknownKeyword */: - case 138 /* StringKeyword */: - case 135 /* NumberKeyword */: - case 146 /* BigIntKeyword */: - case 123 /* BooleanKeyword */: - case 133 /* ReadonlyKeyword */: - case 139 /* SymbolKeyword */: - case 142 /* UniqueKeyword */: - case 106 /* VoidKeyword */: - case 141 /* UndefinedKeyword */: - case 96 /* NullKeyword */: - case 100 /* ThisKeyword */: - case 104 /* TypeOfKeyword */: - case 132 /* NeverKeyword */: + case 121 /* AnyKeyword */: + case 144 /* UnknownKeyword */: + case 139 /* StringKeyword */: + case 136 /* NumberKeyword */: + case 147 /* BigIntKeyword */: + case 124 /* BooleanKeyword */: + case 134 /* ReadonlyKeyword */: + case 140 /* SymbolKeyword */: + case 143 /* UniqueKeyword */: + case 107 /* VoidKeyword */: + case 142 /* UndefinedKeyword */: + case 97 /* NullKeyword */: + case 101 /* ThisKeyword */: + case 105 /* TypeOfKeyword */: + case 133 /* NeverKeyword */: case 18 /* OpenBraceToken */: case 22 /* OpenBracketToken */: case 28 /* LessThanToken */: case 50 /* BarToken */: case 49 /* AmpersandToken */: - case 95 /* NewKeyword */: + case 96 /* NewKeyword */: case 10 /* StringLiteral */: case 8 /* NumericLiteral */: case 9 /* BigIntLiteral */: - case 102 /* TrueKeyword */: - case 87 /* FalseKeyword */: - case 136 /* ObjectKeyword */: + case 103 /* TrueKeyword */: + case 88 /* FalseKeyword */: + case 137 /* ObjectKeyword */: case 40 /* AsteriskToken */: case 56 /* QuestionToken */: case 52 /* ExclamationToken */: case 25 /* DotDotDotToken */: - case 127 /* InferKeyword */: - case 92 /* ImportKeyword */: + case 128 /* InferKeyword */: + case 93 /* ImportKeyword */: return true; - case 90 /* FunctionKeyword */: + case 91 /* FunctionKeyword */: return !inStartOfParameter; case 39 /* MinusToken */: return !inStartOfParameter && lookAhead(nextTokenIsNumericOrBigIntLiteral); @@ -19176,26 +19321,26 @@ var ts; while (!scanner.hasPrecedingLineBreak()) { switch (token()) { case 52 /* ExclamationToken */: - type = createPostfixType(292 /* JSDocNonNullableType */, type); + type = createPostfixType(293 /* JSDocNonNullableType */, type); break; case 56 /* QuestionToken */: // If not in JSDoc and next token is start of a type we have a conditional type if (!(contextFlags & 2097152 /* JSDoc */) && lookAhead(nextTokenIsStartOfType)) { return type; } - type = createPostfixType(291 /* JSDocNullableType */, type); + type = createPostfixType(292 /* JSDocNullableType */, type); break; case 22 /* OpenBracketToken */: parseExpected(22 /* OpenBracketToken */); if (isStartOfType()) { - var node = createNode(180 /* IndexedAccessType */, type.pos); + var node = createNode(181 /* IndexedAccessType */, type.pos); node.objectType = type; node.indexType = parseType(); parseExpected(23 /* CloseBracketToken */); type = finishNode(node); } else { - var node = createNode(169 /* ArrayType */, type.pos); + var node = createNode(170 /* ArrayType */, type.pos); node.elementType = type; parseExpected(23 /* CloseBracketToken */); type = finishNode(node); @@ -19214,16 +19359,16 @@ var ts; return finishNode(postfix); } function parseTypeOperator(operator) { - var node = createNode(179 /* TypeOperator */); + var node = createNode(180 /* TypeOperator */); parseExpected(operator); node.operator = operator; node.type = parseTypeOperatorOrHigher(); return finishNode(node); } function parseInferType() { - var node = createNode(176 /* InferType */); - parseExpected(127 /* InferKeyword */); - var typeParameter = createNode(150 /* TypeParameter */); + var node = createNode(177 /* InferType */); + parseExpected(128 /* InferKeyword */); + var typeParameter = createNode(151 /* TypeParameter */); typeParameter.name = parseIdentifier(); node.typeParameter = finishNode(typeParameter); return finishNode(node); @@ -19231,34 +19376,35 @@ var ts; function parseTypeOperatorOrHigher() { var operator = token(); switch (operator) { - case 129 /* KeyOfKeyword */: - case 142 /* UniqueKeyword */: - case 133 /* ReadonlyKeyword */: + case 130 /* KeyOfKeyword */: + case 143 /* UniqueKeyword */: + case 134 /* ReadonlyKeyword */: return parseTypeOperator(operator); - case 127 /* InferKeyword */: + case 128 /* InferKeyword */: return parseInferType(); } return parsePostfixTypeOrHigher(); } function parseUnionOrIntersectionType(kind, parseConstituentType, operator) { - parseOptional(operator); + var start = scanner.getStartPos(); + var hasLeadingOperator = parseOptional(operator); var type = parseConstituentType(); - if (token() === operator) { + if (token() === operator || hasLeadingOperator) { var types = [type]; while (parseOptional(operator)) { types.push(parseConstituentType()); } - var node = createNode(kind, type.pos); - node.types = createNodeArray(types, type.pos); + var node = createNode(kind, start); + node.types = createNodeArray(types, start); type = finishNode(node); } return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(174 /* IntersectionType */, parseTypeOperatorOrHigher, 49 /* AmpersandToken */); + return parseUnionOrIntersectionType(175 /* IntersectionType */, parseTypeOperatorOrHigher, 49 /* AmpersandToken */); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(173 /* UnionType */, parseIntersectionTypeOrHigher, 50 /* BarToken */); + return parseUnionOrIntersectionType(174 /* UnionType */, parseIntersectionTypeOrHigher, 50 /* BarToken */); } function isStartOfFunctionType() { if (token() === 28 /* LessThanToken */) { @@ -19271,7 +19417,7 @@ var ts; // Skip modifiers parseModifiers(); } - if (isIdentifier() || token() === 100 /* ThisKeyword */) { + if (isIdentifier() || token() === 101 /* ThisKeyword */) { nextToken(); return true; } @@ -19294,7 +19440,7 @@ var ts; // We successfully skipped modifiers (if any) and an identifier or binding pattern, // now see if we have something that indicates a parameter declaration if (token() === 57 /* ColonToken */ || token() === 27 /* CommaToken */ || - token() === 56 /* QuestionToken */ || token() === 59 /* EqualsToken */) { + token() === 56 /* QuestionToken */ || token() === 60 /* EqualsToken */) { // ( xxx : // ( xxx , // ( xxx ? @@ -19315,7 +19461,7 @@ var ts; var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix); var type = parseType(); if (typePredicateVariable) { - var node = createNode(163 /* TypePredicate */, typePredicateVariable.pos); + var node = createNode(164 /* TypePredicate */, typePredicateVariable.pos); node.parameterName = typePredicateVariable; node.type = type; return finishNode(node); @@ -19326,7 +19472,7 @@ var ts; } function parseTypePredicatePrefix() { var id = parseIdentifier(); - if (token() === 128 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 129 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) { nextToken(); return id; } @@ -19337,12 +19483,12 @@ var ts; return doOutsideOfContext(20480 /* TypeExcludesFlags */, parseTypeWorker); } function parseTypeWorker(noConditionalTypes) { - if (isStartOfFunctionType() || token() === 95 /* NewKeyword */) { + if (isStartOfFunctionType() || token() === 96 /* NewKeyword */) { return parseFunctionOrConstructorType(); } var type = parseUnionTypeOrHigher(); - if (!noConditionalTypes && !scanner.hasPrecedingLineBreak() && parseOptional(86 /* ExtendsKeyword */)) { - var node = createNode(175 /* ConditionalType */, type.pos); + if (!noConditionalTypes && !scanner.hasPrecedingLineBreak() && parseOptional(87 /* ExtendsKeyword */)) { + var node = createNode(176 /* ConditionalType */, type.pos); node.checkType = type; // The type following 'extends' is not permitted to be another conditional type node.extendsType = parseTypeWorker(/*noConditionalTypes*/ true); @@ -19360,11 +19506,11 @@ var ts; // EXPRESSIONS function isStartOfLeftHandSideExpression() { switch (token()) { - case 100 /* ThisKeyword */: - case 98 /* SuperKeyword */: - case 96 /* NullKeyword */: - case 102 /* TrueKeyword */: - case 87 /* FalseKeyword */: + case 101 /* ThisKeyword */: + case 99 /* SuperKeyword */: + case 97 /* NullKeyword */: + case 103 /* TrueKeyword */: + case 88 /* FalseKeyword */: case 8 /* NumericLiteral */: case 9 /* BigIntLiteral */: case 10 /* StringLiteral */: @@ -19373,14 +19519,14 @@ var ts; case 20 /* OpenParenToken */: case 22 /* OpenBracketToken */: case 18 /* OpenBraceToken */: - case 90 /* FunctionKeyword */: - case 76 /* ClassKeyword */: - case 95 /* NewKeyword */: + case 91 /* FunctionKeyword */: + case 77 /* ClassKeyword */: + case 96 /* NewKeyword */: case 42 /* SlashToken */: - case 64 /* SlashEqualsToken */: - case 72 /* Identifier */: + case 65 /* SlashEqualsToken */: + case 73 /* Identifier */: return true; - case 92 /* ImportKeyword */: + case 93 /* ImportKeyword */: return lookAhead(nextTokenIsOpenParenOrLessThanOrDot); default: return isIdentifier(); @@ -19395,14 +19541,14 @@ var ts; case 39 /* MinusToken */: case 53 /* TildeToken */: case 52 /* ExclamationToken */: - case 81 /* DeleteKeyword */: - case 104 /* TypeOfKeyword */: - case 106 /* VoidKeyword */: + case 82 /* DeleteKeyword */: + case 105 /* TypeOfKeyword */: + case 107 /* VoidKeyword */: case 44 /* PlusPlusToken */: case 45 /* MinusMinusToken */: case 28 /* LessThanToken */: - case 122 /* AwaitKeyword */: - case 117 /* YieldKeyword */: + case 123 /* AwaitKeyword */: + case 118 /* YieldKeyword */: // Yield/await always starts an expression. Either it is an identifier (in which case // it is definitely an expression). Or it's a keyword (either because we're in // a generator or async function, or in strict mode (or both)) and it started a yield or await expression. @@ -19421,8 +19567,8 @@ var ts; function isStartOfExpressionStatement() { // As per the grammar, none of '{' or 'function' or 'class' can start an expression statement. return token() !== 18 /* OpenBraceToken */ && - token() !== 90 /* FunctionKeyword */ && - token() !== 76 /* ClassKeyword */ && + token() !== 91 /* FunctionKeyword */ && + token() !== 77 /* ClassKeyword */ && token() !== 58 /* AtToken */ && isStartOfExpression(); } @@ -19446,7 +19592,7 @@ var ts; return expr; } function parseInitializer() { - return parseOptional(59 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined; + return parseOptional(60 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined; } function parseAssignmentExpressionOrHigher() { // AssignmentExpression[in,yield]: @@ -19491,7 +19637,7 @@ var ts; // To avoid a look-ahead, we did not handle the case of an arrow function with a single un-parenthesized // parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single // identifier and the current token is an arrow. - if (expr.kind === 72 /* Identifier */ && token() === 37 /* EqualsGreaterThanToken */) { + if (expr.kind === 73 /* Identifier */ && token() === 37 /* EqualsGreaterThanToken */) { return parseSimpleArrowFunctionExpression(expr); } // Now see if we might be in cases '2' or '3'. @@ -19507,7 +19653,7 @@ var ts; return parseConditionalExpressionRest(expr); } function isYieldExpression() { - if (token() === 117 /* YieldKeyword */) { + if (token() === 118 /* YieldKeyword */) { // If we have a 'yield' keyword, and this is a context where yield expressions are // allowed, then definitely parse out a yield expression. if (inYieldContext()) { @@ -19536,7 +19682,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(207 /* YieldExpression */); + var node = createNode(208 /* YieldExpression */); // YieldExpression[In] : // yield // yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield] @@ -19558,13 +19704,13 @@ var ts; ts.Debug.assert(token() === 37 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); var node; if (asyncModifier) { - node = createNode(197 /* ArrowFunction */, asyncModifier.pos); + node = createNode(198 /* ArrowFunction */, asyncModifier.pos); node.modifiers = asyncModifier; } else { - node = createNode(197 /* ArrowFunction */, identifier.pos); + node = createNode(198 /* ArrowFunction */, identifier.pos); } - var parameter = createNode(151 /* Parameter */, identifier.pos); + var parameter = createNode(152 /* Parameter */, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = createNodeArray([parameter], parameter.pos, parameter.end); @@ -19604,7 +19750,7 @@ var ts; // Unknown -> There *might* be a parenthesized arrow function here. // Speculatively look ahead to be sure, and rollback if not. function isParenthesizedArrowFunctionExpression() { - if (token() === 20 /* OpenParenToken */ || token() === 28 /* LessThanToken */ || token() === 121 /* AsyncKeyword */) { + if (token() === 20 /* OpenParenToken */ || token() === 28 /* LessThanToken */ || token() === 122 /* AsyncKeyword */) { return lookAhead(isParenthesizedArrowFunctionExpressionWorker); } if (token() === 37 /* EqualsGreaterThanToken */) { @@ -19617,7 +19763,7 @@ var ts; return 0 /* False */; } function isParenthesizedArrowFunctionExpressionWorker() { - if (token() === 121 /* AsyncKeyword */) { + if (token() === 122 /* AsyncKeyword */) { nextToken(); if (scanner.hasPrecedingLineBreak()) { return 0 /* False */; @@ -19661,13 +19807,13 @@ var ts; // Check for "(xxx yyy", where xxx is a modifier and yyy is an identifier. This // isn't actually allowed, but we want to treat it as a lambda so we can provide // a good error message. - if (ts.isModifierKind(second) && second !== 121 /* AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) { + if (ts.isModifierKind(second) && second !== 122 /* AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) { return 1 /* True */; } // If we had "(" followed by something that's not an identifier, // then this definitely doesn't look like a lambda. "this" is not // valid, but we want to parse it and then give a semantic error. - if (!isIdentifier() && second !== 100 /* ThisKeyword */) { + if (!isIdentifier() && second !== 101 /* ThisKeyword */) { return 0 /* False */; } switch (nextToken()) { @@ -19678,13 +19824,13 @@ var ts; case 56 /* QuestionToken */: nextToken(); // If we have "(a?:" or "(a?," or "(a?=" or "(a?)" then it is definitely a lambda. - if (token() === 57 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 59 /* EqualsToken */ || token() === 21 /* CloseParenToken */) { + if (token() === 57 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 60 /* EqualsToken */ || token() === 21 /* CloseParenToken */) { return 1 /* True */; } // Otherwise it is definitely not a lambda. return 0 /* False */; case 27 /* CommaToken */: - case 59 /* EqualsToken */: + case 60 /* EqualsToken */: case 21 /* CloseParenToken */: // If we have "(a," or "(a=" or "(a)" this *could* be an arrow function return 2 /* Unknown */; @@ -19703,10 +19849,10 @@ var ts; if (sourceFile.languageVariant === 1 /* JSX */) { var isArrowFunctionInJsx = lookAhead(function () { var third = nextToken(); - if (third === 86 /* ExtendsKeyword */) { + if (third === 87 /* ExtendsKeyword */) { var fourth = nextToken(); switch (fourth) { - case 59 /* EqualsToken */: + case 60 /* EqualsToken */: case 30 /* GreaterThanToken */: return false; default: @@ -19732,7 +19878,7 @@ var ts; } function tryParseAsyncSimpleArrowFunctionExpression() { // We do a check here so that we won't be doing unnecessarily call to "lookAhead" - if (token() === 121 /* AsyncKeyword */) { + if (token() === 122 /* AsyncKeyword */) { if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) { var asyncModifier = parseModifiersForArrowFunction(); var expr = parseBinaryExpressionOrHigher(/*precedence*/ 0); @@ -19745,7 +19891,7 @@ var ts; // AsyncArrowFunctionExpression: // 1) async[no LineTerminator here]AsyncArrowBindingIdentifier[?Yield][no LineTerminator here]=>AsyncConciseBody[?In] // 2) CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await][no LineTerminator here]=>AsyncConciseBody[?In] - if (token() === 121 /* AsyncKeyword */) { + if (token() === 122 /* AsyncKeyword */) { nextToken(); // If the "async" is followed by "=>" token then it is not a beginning of an async arrow-function // but instead a simple arrow-function which will be parsed inside "parseAssignmentExpressionOrHigher" @@ -19754,14 +19900,14 @@ var ts; } // Check for un-parenthesized AsyncArrowFunction var expr = parseBinaryExpressionOrHigher(/*precedence*/ 0); - if (!scanner.hasPrecedingLineBreak() && expr.kind === 72 /* Identifier */ && token() === 37 /* EqualsGreaterThanToken */) { + if (!scanner.hasPrecedingLineBreak() && expr.kind === 73 /* Identifier */ && token() === 37 /* EqualsGreaterThanToken */) { return 1 /* True */; } } return 0 /* False */; } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNodeWithJSDoc(197 /* ArrowFunction */); + var node = createNodeWithJSDoc(198 /* ArrowFunction */); node.modifiers = parseModifiersForArrowFunction(); var isAsync = ts.hasModifier(node, 256 /* Async */) ? 2 /* Await */ : 0 /* None */; // Arrow functions are never generators. @@ -19780,9 +19926,11 @@ var ts; // - "(x = 10)" is an assignment expression parsed as a signature with a default parameter value. // - "(x,y)" is a comma expression parsed as a signature with two parameters. // - "a ? (b): c" will have "(b):" parsed as a signature with a return type annotation. + // - "a ? (b): function() {}" will too, since function() is a valid JSDoc function type. // // So we need just a bit of lookahead to ensure that it can only be a signature. - if (!allowAmbiguity && token() !== 37 /* EqualsGreaterThanToken */ && token() !== 18 /* OpenBraceToken */) { + var hasJSDocFunctionType = node.type && ts.isJSDocFunctionType(node.type); + if (!allowAmbiguity && token() !== 37 /* EqualsGreaterThanToken */ && (hasJSDocFunctionType || token() !== 18 /* OpenBraceToken */)) { // Returning undefined here will cause our caller to rewind to where we started from. return undefined; } @@ -19793,8 +19941,8 @@ var ts; return parseFunctionBlock(isAsync ? 2 /* Await */ : 0 /* None */); } if (token() !== 26 /* SemicolonToken */ && - token() !== 90 /* FunctionKeyword */ && - token() !== 76 /* ClassKeyword */ && + token() !== 91 /* FunctionKeyword */ && + token() !== 77 /* ClassKeyword */ && isStartOfStatement() && !isStartOfExpressionStatement()) { // Check if we got a plain statement (i.e. no expression-statements, no function/class expressions/declarations) @@ -19825,14 +19973,14 @@ var ts; } // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and // we do not that for the 'whenFalse' part. - var node = createNode(205 /* ConditionalExpression */, leftOperand.pos); + var node = createNode(206 /* ConditionalExpression */, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); node.colonToken = parseExpectedToken(57 /* ColonToken */); node.whenFalse = ts.nodeIsPresent(node.colonToken) ? parseAssignmentExpressionOrHigher() - : createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(57 /* ColonToken */)); + : createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(57 /* ColonToken */)); return finishNode(node); } function parseBinaryExpressionOrHigher(precedence) { @@ -19840,7 +19988,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 93 /* InKeyword */ || t === 147 /* OfKeyword */; + return t === 94 /* InKeyword */ || t === 148 /* OfKeyword */; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -19875,10 +20023,10 @@ var ts; if (!consumeCurrentOperator) { break; } - if (token() === 93 /* InKeyword */ && inDisallowInContext()) { + if (token() === 94 /* InKeyword */ && inDisallowInContext()) { break; } - if (token() === 119 /* AsKeyword */) { + if (token() === 120 /* AsKeyword */) { // Make sure we *do* perform ASI for constructs like this: // var x = foo // as (Bar) @@ -19899,51 +20047,51 @@ var ts; return leftOperand; } function isBinaryOperator() { - if (inDisallowInContext() && token() === 93 /* InKeyword */) { + if (inDisallowInContext() && token() === 94 /* InKeyword */) { return false; } return ts.getBinaryOperatorPrecedence(token()) > 0; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(204 /* BinaryExpression */, left.pos); + var node = createNode(205 /* BinaryExpression */, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(212 /* AsExpression */, left.pos); + var node = createNode(213 /* AsExpression */, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(202 /* PrefixUnaryExpression */); + var node = createNode(203 /* PrefixUnaryExpression */); node.operator = token(); nextToken(); node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(198 /* DeleteExpression */); + var node = createNode(199 /* DeleteExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(199 /* TypeOfExpression */); + var node = createNode(200 /* TypeOfExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(200 /* VoidExpression */); + var node = createNode(201 /* VoidExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function isAwaitExpression() { - if (token() === 122 /* AwaitKeyword */) { + if (token() === 123 /* AwaitKeyword */) { if (inAwaitContext()) { return true; } @@ -19953,7 +20101,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(201 /* AwaitExpression */); + var node = createNode(202 /* AwaitExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -19997,7 +20145,7 @@ var ts; if (token() === 41 /* AsteriskAsteriskToken */) { var pos = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); var end = simpleUnaryExpression.end; - if (simpleUnaryExpression.kind === 194 /* TypeAssertionExpression */) { + if (simpleUnaryExpression.kind === 195 /* TypeAssertionExpression */) { parseErrorAt(pos, end, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); } else { @@ -20027,18 +20175,18 @@ var ts; case 53 /* TildeToken */: case 52 /* ExclamationToken */: return parsePrefixUnaryExpression(); - case 81 /* DeleteKeyword */: + case 82 /* DeleteKeyword */: return parseDeleteExpression(); - case 104 /* TypeOfKeyword */: + case 105 /* TypeOfKeyword */: return parseTypeOfExpression(); - case 106 /* VoidKeyword */: + case 107 /* VoidKeyword */: return parseVoidExpression(); case 28 /* LessThanToken */: // This is modified UnaryExpression grammar in TypeScript // UnaryExpression (modified): // < type > UnaryExpression return parseTypeAssertion(); - case 122 /* AwaitKeyword */: + case 123 /* AwaitKeyword */: if (isAwaitExpression()) { return parseAwaitExpression(); } @@ -20065,10 +20213,10 @@ var ts; case 39 /* MinusToken */: case 53 /* TildeToken */: case 52 /* ExclamationToken */: - case 81 /* DeleteKeyword */: - case 104 /* TypeOfKeyword */: - case 106 /* VoidKeyword */: - case 122 /* AwaitKeyword */: + case 82 /* DeleteKeyword */: + case 105 /* TypeOfKeyword */: + case 107 /* VoidKeyword */: + case 123 /* AwaitKeyword */: return false; case 28 /* LessThanToken */: // If we are not in JSX context, we are parsing TypeAssertion which is an UnaryExpression @@ -20094,7 +20242,7 @@ var ts; */ function parseUpdateExpression() { if (token() === 44 /* PlusPlusToken */ || token() === 45 /* MinusMinusToken */) { - var node = createNode(202 /* PrefixUnaryExpression */); + var node = createNode(203 /* PrefixUnaryExpression */); node.operator = token(); nextToken(); node.operand = parseLeftHandSideExpressionOrHigher(); @@ -20107,7 +20255,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); if ((token() === 44 /* PlusPlusToken */ || token() === 45 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(203 /* PostfixUnaryExpression */, expression.pos); + var node = createNode(204 /* PostfixUnaryExpression */, expression.pos); node.operand = expression; node.operator = token(); nextToken(); @@ -20148,7 +20296,7 @@ var ts; // 3)we have a MemberExpression which either completes the LeftHandSideExpression, // or starts the beginning of the first four CallExpression productions. var expression; - if (token() === 92 /* ImportKeyword */) { + if (token() === 93 /* ImportKeyword */) { if (lookAhead(nextTokenIsOpenParenOrLessThan)) { // We don't want to eagerly consume all import keyword as import call expression so we look ahead to find "(" // For example: @@ -20163,8 +20311,8 @@ var ts; var fullStart = scanner.getStartPos(); nextToken(); // advance past the 'import' nextToken(); // advance past the dot - var node = createNode(214 /* MetaProperty */, fullStart); - node.keywordToken = 92 /* ImportKeyword */; + var node = createNode(215 /* MetaProperty */, fullStart); + node.keywordToken = 93 /* ImportKeyword */; node.name = parseIdentifierName(); expression = finishNode(node); sourceFile.flags |= 1048576 /* PossiblyContainsImportMeta */; @@ -20174,7 +20322,7 @@ var ts; } } else { - expression = token() === 98 /* SuperKeyword */ ? parseSuperExpression() : parseMemberExpressionOrHigher(); + expression = token() === 99 /* SuperKeyword */ ? parseSuperExpression() : parseMemberExpressionOrHigher(); } // Now, we *may* be complete. However, we might have consumed the start of a // CallExpression. As such, we need to consume the rest of it here to be complete. @@ -20233,12 +20381,19 @@ var ts; } function parseSuperExpression() { var expression = parseTokenNode(); + if (token() === 28 /* LessThanToken */) { + var startPos = getNodePos(); + var typeArguments = tryParse(parseTypeArgumentsInExpression); + if (typeArguments !== undefined) { + parseErrorAt(startPos, getNodePos(), ts.Diagnostics.super_may_not_use_type_arguments); + } + } if (token() === 20 /* OpenParenToken */ || token() === 24 /* DotToken */ || token() === 22 /* OpenBracketToken */) { return expression; } // If we have seen "super" it must be followed by '(' or '.'. // If it wasn't then just try to parse out a '.' and report an error. - var node = createNode(189 /* PropertyAccessExpression */, expression.pos); + var node = createNode(190 /* PropertyAccessExpression */, expression.pos); node.expression = expression; parseExpectedToken(24 /* DotToken */, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); @@ -20247,8 +20402,8 @@ var ts; function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); var result; - if (opening.kind === 262 /* JsxOpeningElement */) { - var node = createNode(260 /* JsxElement */, opening.pos); + if (opening.kind === 263 /* JsxOpeningElement */) { + var node = createNode(261 /* JsxElement */, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement); node.closingElement = parseJsxClosingElement(inExpressionContext); @@ -20257,15 +20412,15 @@ var ts; } result = finishNode(node); } - else if (opening.kind === 265 /* JsxOpeningFragment */) { - var node = createNode(264 /* JsxFragment */, opening.pos); + else if (opening.kind === 266 /* JsxOpeningFragment */) { + var node = createNode(265 /* JsxFragment */, opening.pos); node.openingFragment = opening; node.children = parseJsxChildren(node.openingFragment); node.closingFragment = parseJsxClosingFragment(inExpressionContext); result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 261 /* JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 262 /* JsxSelfClosingElement */); // Nothing else to do for self-closing elements result = opening; } @@ -20280,11 +20435,11 @@ var ts; var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); - var badNode = createNode(204 /* BinaryExpression */, result.pos); + var badNode = createNode(205 /* BinaryExpression */, result.pos); badNode.end = invalidElement.end; badNode.left = result; badNode.right = invalidElement; - badNode.operatorToken = createMissingNode(27 /* CommaToken */, /*reportAtCurrentPosition*/ false, /*diagnosticMessage*/ undefined); // TODO: GH#18217 + badNode.operatorToken = createMissingNode(27 /* CommaToken */, /*reportAtCurrentPosition*/ false); badNode.operatorToken.pos = badNode.operatorToken.end = badNode.right.pos; return badNode; } @@ -20339,7 +20494,7 @@ var ts; return createNodeArray(list, listPos); } function parseJsxAttributes() { - var jsxAttributes = createNode(268 /* JsxAttributes */); + var jsxAttributes = createNode(269 /* JsxAttributes */); jsxAttributes.properties = parseList(13 /* JsxAttributes */, parseJsxAttribute); return finishNode(jsxAttributes); } @@ -20348,7 +20503,7 @@ var ts; parseExpected(28 /* LessThanToken */); if (token() === 30 /* GreaterThanToken */) { // See below for explanation of scanJsxText - var node_1 = createNode(265 /* JsxOpeningFragment */, fullStart); + var node_1 = createNode(266 /* JsxOpeningFragment */, fullStart); scanJsxText(); return finishNode(node_1); } @@ -20360,7 +20515,7 @@ var ts; // Closing tag, so scan the immediately-following text with the JSX scanning instead // of regular scanning to avoid treating illegal characters (e.g. '#') as immediate // scanning errors - node = createNode(262 /* JsxOpeningElement */, fullStart); + node = createNode(263 /* JsxOpeningElement */, fullStart); scanJsxText(); } else { @@ -20372,7 +20527,7 @@ var ts; parseExpected(30 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false); scanJsxText(); } - node = createNode(261 /* JsxSelfClosingElement */, fullStart); + node = createNode(262 /* JsxSelfClosingElement */, fullStart); } node.tagName = tagName; node.typeArguments = typeArguments; @@ -20386,10 +20541,10 @@ var ts; // primaryExpression in the form of an identifier and "this" keyword // We can't just simply use parseLeftHandSideExpressionOrHigher because then we will start consider class,function etc as a keyword // We only want to consider "this" as a primaryExpression - var expression = token() === 100 /* ThisKeyword */ ? + var expression = token() === 101 /* ThisKeyword */ ? parseTokenNode() : parseIdentifierName(); while (parseOptional(24 /* DotToken */)) { - var propertyAccess = createNode(189 /* PropertyAccessExpression */, expression.pos); + var propertyAccess = createNode(190 /* PropertyAccessExpression */, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); expression = finishNode(propertyAccess); @@ -20397,7 +20552,7 @@ var ts; return expression; } function parseJsxExpression(inExpressionContext) { - var node = createNode(270 /* JsxExpression */); + var node = createNode(271 /* JsxExpression */); if (!parseExpected(18 /* OpenBraceToken */)) { return undefined; } @@ -20419,9 +20574,9 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(267 /* JsxAttribute */); + var node = createNode(268 /* JsxAttribute */); node.name = parseIdentifierName(); - if (token() === 59 /* EqualsToken */) { + if (token() === 60 /* EqualsToken */) { switch (scanJsxAttributeValue()) { case 10 /* StringLiteral */: node.initializer = parseLiteralNode(); @@ -20434,7 +20589,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(269 /* JsxSpreadAttribute */); + var node = createNode(270 /* JsxSpreadAttribute */); parseExpected(18 /* OpenBraceToken */); parseExpected(25 /* DotDotDotToken */); node.expression = parseExpression(); @@ -20442,7 +20597,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(263 /* JsxClosingElement */); + var node = createNode(264 /* JsxClosingElement */); parseExpected(29 /* LessThanSlashToken */); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -20455,7 +20610,7 @@ var ts; return finishNode(node); } function parseJsxClosingFragment(inExpressionContext) { - var node = createNode(266 /* JsxClosingFragment */); + var node = createNode(267 /* JsxClosingFragment */); parseExpected(29 /* LessThanSlashToken */); if (ts.tokenIsIdentifierOrKeyword(token())) { parseErrorAtRange(parseJsxElementName(), ts.Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment); @@ -20470,7 +20625,7 @@ var ts; return finishNode(node); } function parseTypeAssertion() { - var node = createNode(194 /* TypeAssertionExpression */); + var node = createNode(195 /* TypeAssertionExpression */); parseExpected(28 /* LessThanToken */); node.type = parseType(); parseExpected(30 /* GreaterThanToken */); @@ -20481,7 +20636,7 @@ var ts; while (true) { var dotToken = parseOptionalToken(24 /* DotToken */); if (dotToken) { - var propertyAccess = createNode(189 /* PropertyAccessExpression */, expression.pos); + var propertyAccess = createNode(190 /* PropertyAccessExpression */, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); expression = finishNode(propertyAccess); @@ -20489,17 +20644,17 @@ var ts; } if (token() === 52 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) { nextToken(); - var nonNullExpression = createNode(213 /* NonNullExpression */, expression.pos); + var nonNullExpression = createNode(214 /* NonNullExpression */, expression.pos); nonNullExpression.expression = expression; expression = finishNode(nonNullExpression); continue; } // when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName if (!inDecoratorContext() && parseOptional(22 /* OpenBracketToken */)) { - var indexedAccess = createNode(190 /* ElementAccessExpression */, expression.pos); + var indexedAccess = createNode(191 /* ElementAccessExpression */, expression.pos); indexedAccess.expression = expression; if (token() === 23 /* CloseBracketToken */) { - indexedAccess.argumentExpression = createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.An_element_access_expression_should_take_an_argument); + indexedAccess.argumentExpression = createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.An_element_access_expression_should_take_an_argument); } else { var argument = allowInAnd(parseExpression); @@ -20523,7 +20678,7 @@ var ts; return token() === 14 /* NoSubstitutionTemplateLiteral */ || token() === 15 /* TemplateHead */; } function parseTaggedTemplateRest(tag, typeArguments) { - var tagExpression = createNode(193 /* TaggedTemplateExpression */, tag.pos); + var tagExpression = createNode(194 /* TaggedTemplateExpression */, tag.pos); tagExpression.tag = tag; tagExpression.typeArguments = typeArguments; tagExpression.template = token() === 14 /* NoSubstitutionTemplateLiteral */ @@ -20548,7 +20703,7 @@ var ts; expression = parseTaggedTemplateRest(expression, typeArguments); continue; } - var callExpr = createNode(191 /* CallExpression */, expression.pos); + var callExpr = createNode(192 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -20556,7 +20711,7 @@ var ts; continue; } else if (token() === 20 /* OpenParenToken */) { - var callExpr = createNode(191 /* CallExpression */, expression.pos); + var callExpr = createNode(192 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -20632,11 +20787,11 @@ var ts; case 10 /* StringLiteral */: case 14 /* NoSubstitutionTemplateLiteral */: return parseLiteralNode(); - case 100 /* ThisKeyword */: - case 98 /* SuperKeyword */: - case 96 /* NullKeyword */: - case 102 /* TrueKeyword */: - case 87 /* FalseKeyword */: + case 101 /* ThisKeyword */: + case 99 /* SuperKeyword */: + case 97 /* NullKeyword */: + case 103 /* TrueKeyword */: + case 88 /* FalseKeyword */: return parseTokenNode(); case 20 /* OpenParenToken */: return parseParenthesizedExpression(); @@ -20644,7 +20799,7 @@ var ts; return parseArrayLiteralExpression(); case 18 /* OpenBraceToken */: return parseObjectLiteralExpression(); - case 121 /* AsyncKeyword */: + case 122 /* AsyncKeyword */: // Async arrow functions are parsed earlier in parseAssignmentExpressionOrHigher. // If we encounter `async [no LineTerminator here] function` then this is an async // function; otherwise, its an identifier. @@ -20652,14 +20807,14 @@ var ts; break; } return parseFunctionExpression(); - case 76 /* ClassKeyword */: + case 77 /* ClassKeyword */: return parseClassExpression(); - case 90 /* FunctionKeyword */: + case 91 /* FunctionKeyword */: return parseFunctionExpression(); - case 95 /* NewKeyword */: + case 96 /* NewKeyword */: return parseNewExpressionOrNewDotTarget(); case 42 /* SlashToken */: - case 64 /* SlashEqualsToken */: + case 65 /* SlashEqualsToken */: if (reScanSlashToken() === 13 /* RegularExpressionLiteral */) { return parseLiteralNode(); } @@ -20670,28 +20825,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNodeWithJSDoc(195 /* ParenthesizedExpression */); + var node = createNodeWithJSDoc(196 /* ParenthesizedExpression */); parseExpected(20 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(21 /* CloseParenToken */); return finishNode(node); } function parseSpreadElement() { - var node = createNode(208 /* SpreadElement */); + var node = createNode(209 /* SpreadElement */); parseExpected(25 /* DotDotDotToken */); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token() === 25 /* DotDotDotToken */ ? parseSpreadElement() : - token() === 27 /* CommaToken */ ? createNode(210 /* OmittedExpression */) : + token() === 27 /* CommaToken */ ? createNode(211 /* OmittedExpression */) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(187 /* ArrayLiteralExpression */); + var node = createNode(188 /* ArrayLiteralExpression */); parseExpected(22 /* OpenBracketToken */); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -20703,17 +20858,17 @@ var ts; function parseObjectLiteralElement() { var node = createNodeWithJSDoc(0 /* Unknown */); if (parseOptionalToken(25 /* DotDotDotToken */)) { - node.kind = 277 /* SpreadAssignment */; + node.kind = 278 /* SpreadAssignment */; node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } node.decorators = parseDecorators(); node.modifiers = parseModifiers(); - if (parseContextualModifier(126 /* GetKeyword */)) { - return parseAccessorDeclaration(node, 158 /* GetAccessor */); + if (parseContextualModifier(127 /* GetKeyword */)) { + return parseAccessorDeclaration(node, 159 /* GetAccessor */); } - if (parseContextualModifier(137 /* SetKeyword */)) { - return parseAccessorDeclaration(node, 159 /* SetAccessor */); + if (parseContextualModifier(138 /* SetKeyword */)) { + return parseAccessorDeclaration(node, 160 /* SetAccessor */); } var asteriskToken = parseOptionalToken(40 /* AsteriskToken */); var tokenIsIdentifier = isIdentifier(); @@ -20731,22 +20886,22 @@ var ts; // this is necessary because ObjectLiteral productions are also used to cover grammar for ObjectAssignmentPattern var isShorthandPropertyAssignment = tokenIsIdentifier && (token() !== 57 /* ColonToken */); if (isShorthandPropertyAssignment) { - node.kind = 276 /* ShorthandPropertyAssignment */; - var equalsToken = parseOptionalToken(59 /* EqualsToken */); + node.kind = 277 /* ShorthandPropertyAssignment */; + var equalsToken = parseOptionalToken(60 /* EqualsToken */); if (equalsToken) { node.equalsToken = equalsToken; node.objectAssignmentInitializer = allowInAnd(parseAssignmentExpressionOrHigher); } } else { - node.kind = 275 /* PropertyAssignment */; + node.kind = 276 /* PropertyAssignment */; parseExpected(57 /* ColonToken */); node.initializer = allowInAnd(parseAssignmentExpressionOrHigher); } return finishNode(node); } function parseObjectLiteralExpression() { - var node = createNode(188 /* ObjectLiteralExpression */); + var node = createNode(189 /* ObjectLiteralExpression */); parseExpected(18 /* OpenBraceToken */); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -20765,9 +20920,9 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(/*val*/ false); } - var node = createNodeWithJSDoc(196 /* FunctionExpression */); + var node = createNodeWithJSDoc(197 /* FunctionExpression */); node.modifiers = parseModifiers(); - parseExpected(90 /* FunctionKeyword */); + parseExpected(91 /* FunctionKeyword */); node.asteriskToken = parseOptionalToken(40 /* AsteriskToken */); var isGenerator = node.asteriskToken ? 1 /* Yield */ : 0 /* None */; var isAsync = ts.hasModifier(node, 256 /* Async */) ? 2 /* Await */ : 0 /* None */; @@ -20788,10 +20943,10 @@ var ts; } function parseNewExpressionOrNewDotTarget() { var fullStart = scanner.getStartPos(); - parseExpected(95 /* NewKeyword */); + parseExpected(96 /* NewKeyword */); if (parseOptional(24 /* DotToken */)) { - var node_2 = createNode(214 /* MetaProperty */, fullStart); - node_2.keywordToken = 95 /* NewKeyword */; + var node_2 = createNode(215 /* MetaProperty */, fullStart); + node_2.keywordToken = 96 /* NewKeyword */; node_2.name = parseIdentifierName(); return finishNode(node_2); } @@ -20807,7 +20962,7 @@ var ts; } break; } - var node = createNode(192 /* NewExpression */, fullStart); + var node = createNode(193 /* NewExpression */, fullStart); node.expression = expression; node.typeArguments = typeArguments; if (node.typeArguments || token() === 20 /* OpenParenToken */) { @@ -20817,7 +20972,7 @@ var ts; } // STATEMENTS function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(218 /* Block */); + var node = createNode(219 /* Block */); if (parseExpected(18 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -20850,25 +21005,25 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(220 /* EmptyStatement */); + var node = createNode(221 /* EmptyStatement */); parseExpected(26 /* SemicolonToken */); return finishNode(node); } function parseIfStatement() { - var node = createNode(222 /* IfStatement */); - parseExpected(91 /* IfKeyword */); + var node = createNode(223 /* IfStatement */); + parseExpected(92 /* IfKeyword */); parseExpected(20 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(21 /* CloseParenToken */); node.thenStatement = parseStatement(); - node.elseStatement = parseOptional(83 /* ElseKeyword */) ? parseStatement() : undefined; + node.elseStatement = parseOptional(84 /* ElseKeyword */) ? parseStatement() : undefined; return finishNode(node); } function parseDoStatement() { - var node = createNode(223 /* DoStatement */); - parseExpected(82 /* DoKeyword */); + var node = createNode(224 /* DoStatement */); + parseExpected(83 /* DoKeyword */); node.statement = parseStatement(); - parseExpected(107 /* WhileKeyword */); + parseExpected(108 /* WhileKeyword */); parseExpected(20 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(21 /* CloseParenToken */); @@ -20880,8 +21035,8 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(224 /* WhileStatement */); - parseExpected(107 /* WhileKeyword */); + var node = createNode(225 /* WhileStatement */); + parseExpected(108 /* WhileKeyword */); parseExpected(20 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(21 /* CloseParenToken */); @@ -20890,12 +21045,12 @@ var ts; } function parseForOrForInOrForOfStatement() { var pos = getNodePos(); - parseExpected(89 /* ForKeyword */); - var awaitToken = parseOptionalToken(122 /* AwaitKeyword */); + parseExpected(90 /* ForKeyword */); + var awaitToken = parseOptionalToken(123 /* AwaitKeyword */); parseExpected(20 /* OpenParenToken */); var initializer; if (token() !== 26 /* SemicolonToken */) { - if (token() === 105 /* VarKeyword */ || token() === 111 /* LetKeyword */ || token() === 77 /* ConstKeyword */) { + if (token() === 106 /* VarKeyword */ || token() === 112 /* LetKeyword */ || token() === 78 /* ConstKeyword */) { initializer = parseVariableDeclarationList(/*inForStatementInitializer*/ true); } else { @@ -20903,23 +21058,23 @@ var ts; } } var forOrForInOrForOfStatement; - if (awaitToken ? parseExpected(147 /* OfKeyword */) : parseOptional(147 /* OfKeyword */)) { - var forOfStatement = createNode(227 /* ForOfStatement */, pos); + if (awaitToken ? parseExpected(148 /* OfKeyword */) : parseOptional(148 /* OfKeyword */)) { + var forOfStatement = createNode(228 /* ForOfStatement */, pos); forOfStatement.awaitModifier = awaitToken; forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(21 /* CloseParenToken */); forOrForInOrForOfStatement = forOfStatement; } - else if (parseOptional(93 /* InKeyword */)) { - var forInStatement = createNode(226 /* ForInStatement */, pos); + else if (parseOptional(94 /* InKeyword */)) { + var forInStatement = createNode(227 /* ForInStatement */, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(21 /* CloseParenToken */); forOrForInOrForOfStatement = forInStatement; } else { - var forStatement = createNode(225 /* ForStatement */, pos); + var forStatement = createNode(226 /* ForStatement */, pos); forStatement.initializer = initializer; parseExpected(26 /* SemicolonToken */); if (token() !== 26 /* SemicolonToken */ && token() !== 21 /* CloseParenToken */) { @@ -20937,7 +21092,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 229 /* BreakStatement */ ? 73 /* BreakKeyword */ : 78 /* ContinueKeyword */); + parseExpected(kind === 230 /* BreakStatement */ ? 74 /* BreakKeyword */ : 79 /* ContinueKeyword */); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -20945,8 +21100,8 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(230 /* ReturnStatement */); - parseExpected(97 /* ReturnKeyword */); + var node = createNode(231 /* ReturnStatement */); + parseExpected(98 /* ReturnKeyword */); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); } @@ -20954,8 +21109,8 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(231 /* WithStatement */); - parseExpected(108 /* WithKeyword */); + var node = createNode(232 /* WithStatement */); + parseExpected(109 /* WithKeyword */); parseExpected(20 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(21 /* CloseParenToken */); @@ -20963,30 +21118,30 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(271 /* CaseClause */); - parseExpected(74 /* CaseKeyword */); + var node = createNode(272 /* CaseClause */); + parseExpected(75 /* CaseKeyword */); node.expression = allowInAnd(parseExpression); parseExpected(57 /* ColonToken */); node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement); return finishNode(node); } function parseDefaultClause() { - var node = createNode(272 /* DefaultClause */); - parseExpected(80 /* DefaultKeyword */); + var node = createNode(273 /* DefaultClause */); + parseExpected(81 /* DefaultKeyword */); parseExpected(57 /* ColonToken */); node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement); return finishNode(node); } function parseCaseOrDefaultClause() { - return token() === 74 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); + return token() === 75 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(232 /* SwitchStatement */); - parseExpected(99 /* SwitchKeyword */); + var node = createNode(233 /* SwitchStatement */); + parseExpected(100 /* SwitchKeyword */); parseExpected(20 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(21 /* CloseParenToken */); - var caseBlock = createNode(246 /* CaseBlock */); + var caseBlock = createNode(247 /* CaseBlock */); parseExpected(18 /* OpenBraceToken */); caseBlock.clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause); parseExpected(19 /* CloseBraceToken */); @@ -21001,29 +21156,29 @@ var ts; // directly as that might consume an expression on the following line. // We just return 'undefined' in that case. The actual error will be reported in the // grammar walker. - var node = createNode(234 /* ThrowStatement */); - parseExpected(101 /* ThrowKeyword */); + var node = createNode(235 /* ThrowStatement */); + parseExpected(102 /* ThrowKeyword */); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } // TODO: Review for error recovery function parseTryStatement() { - var node = createNode(235 /* TryStatement */); - parseExpected(103 /* TryKeyword */); + var node = createNode(236 /* TryStatement */); + parseExpected(104 /* TryKeyword */); node.tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false); - node.catchClause = token() === 75 /* CatchKeyword */ ? parseCatchClause() : undefined; + node.catchClause = token() === 76 /* CatchKeyword */ ? parseCatchClause() : undefined; // If we don't have a catch clause, then we must have a finally clause. Try to parse // one out no matter what. - if (!node.catchClause || token() === 88 /* FinallyKeyword */) { - parseExpected(88 /* FinallyKeyword */); + if (!node.catchClause || token() === 89 /* FinallyKeyword */) { + parseExpected(89 /* FinallyKeyword */); node.finallyBlock = parseBlock(/*ignoreMissingOpenBrace*/ false); } return finishNode(node); } function parseCatchClause() { - var result = createNode(274 /* CatchClause */); - parseExpected(75 /* CatchKeyword */); + var result = createNode(275 /* CatchClause */); + parseExpected(76 /* CatchKeyword */); if (parseOptional(20 /* OpenParenToken */)) { result.variableDeclaration = parseVariableDeclaration(); parseExpected(21 /* CloseParenToken */); @@ -21036,8 +21191,8 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(236 /* DebuggerStatement */); - parseExpected(79 /* DebuggerKeyword */); + var node = createNode(237 /* DebuggerStatement */); + parseExpected(80 /* DebuggerKeyword */); parseSemicolon(); return finishNode(node); } @@ -21047,13 +21202,13 @@ var ts; // a colon. var node = createNodeWithJSDoc(0 /* Unknown */); var expression = allowInAnd(parseExpression); - if (expression.kind === 72 /* Identifier */ && parseOptional(57 /* ColonToken */)) { - node.kind = 233 /* LabeledStatement */; + if (expression.kind === 73 /* Identifier */ && parseOptional(57 /* ColonToken */)) { + node.kind = 234 /* LabeledStatement */; node.label = expression; node.statement = parseStatement(); } else { - node.kind = 221 /* ExpressionStatement */; + node.kind = 222 /* ExpressionStatement */; node.expression = expression; parseSemicolon(); } @@ -21065,11 +21220,11 @@ var ts; } function nextTokenIsClassKeywordOnSameLine() { nextToken(); - return token() === 76 /* ClassKeyword */ && !scanner.hasPrecedingLineBreak(); + return token() === 77 /* ClassKeyword */ && !scanner.hasPrecedingLineBreak(); } function nextTokenIsFunctionKeywordOnSameLine() { nextToken(); - return token() === 90 /* FunctionKeyword */ && !scanner.hasPrecedingLineBreak(); + return token() === 91 /* FunctionKeyword */ && !scanner.hasPrecedingLineBreak(); } function nextTokenIsIdentifierOrKeywordOrLiteralOnSameLine() { nextToken(); @@ -21078,12 +21233,12 @@ var ts; function isDeclaration() { while (true) { switch (token()) { - case 105 /* VarKeyword */: - case 111 /* LetKeyword */: - case 77 /* ConstKeyword */: - case 90 /* FunctionKeyword */: - case 76 /* ClassKeyword */: - case 84 /* EnumKeyword */: + case 106 /* VarKeyword */: + case 112 /* LetKeyword */: + case 78 /* ConstKeyword */: + case 91 /* FunctionKeyword */: + case 77 /* ClassKeyword */: + case 85 /* EnumKeyword */: return true; // 'declare', 'module', 'namespace', 'interface'* and 'type' are all legal JavaScript identifiers; // however, an identifier cannot be followed by another identifier on the same line. This is what we @@ -21106,41 +21261,41 @@ var ts; // I {} // // could be legal, it would add complexity for very little gain. - case 110 /* InterfaceKeyword */: - case 140 /* TypeKeyword */: + case 111 /* InterfaceKeyword */: + case 141 /* TypeKeyword */: return nextTokenIsIdentifierOnSameLine(); - case 130 /* ModuleKeyword */: - case 131 /* NamespaceKeyword */: + case 131 /* ModuleKeyword */: + case 132 /* NamespaceKeyword */: return nextTokenIsIdentifierOrStringLiteralOnSameLine(); - case 118 /* AbstractKeyword */: - case 121 /* AsyncKeyword */: - case 125 /* DeclareKeyword */: - case 113 /* PrivateKeyword */: - case 114 /* ProtectedKeyword */: - case 115 /* PublicKeyword */: - case 133 /* ReadonlyKeyword */: + case 119 /* AbstractKeyword */: + case 122 /* AsyncKeyword */: + case 126 /* DeclareKeyword */: + case 114 /* PrivateKeyword */: + case 115 /* ProtectedKeyword */: + case 116 /* PublicKeyword */: + case 134 /* ReadonlyKeyword */: nextToken(); // ASI takes effect for this modifier. if (scanner.hasPrecedingLineBreak()) { return false; } continue; - case 145 /* GlobalKeyword */: + case 146 /* GlobalKeyword */: nextToken(); - return token() === 18 /* OpenBraceToken */ || token() === 72 /* Identifier */ || token() === 85 /* ExportKeyword */; - case 92 /* ImportKeyword */: + return token() === 18 /* OpenBraceToken */ || token() === 73 /* Identifier */ || token() === 86 /* ExportKeyword */; + case 93 /* ImportKeyword */: nextToken(); return token() === 10 /* StringLiteral */ || token() === 40 /* AsteriskToken */ || token() === 18 /* OpenBraceToken */ || ts.tokenIsIdentifierOrKeyword(token()); - case 85 /* ExportKeyword */: + case 86 /* ExportKeyword */: nextToken(); - if (token() === 59 /* EqualsToken */ || token() === 40 /* AsteriskToken */ || - token() === 18 /* OpenBraceToken */ || token() === 80 /* DefaultKeyword */ || - token() === 119 /* AsKeyword */) { + if (token() === 60 /* EqualsToken */ || token() === 40 /* AsteriskToken */ || + token() === 18 /* OpenBraceToken */ || token() === 81 /* DefaultKeyword */ || + token() === 120 /* AsKeyword */) { return true; } continue; - case 116 /* StaticKeyword */: + case 117 /* StaticKeyword */: nextToken(); continue; default: @@ -21156,47 +21311,47 @@ var ts; case 58 /* AtToken */: case 26 /* SemicolonToken */: case 18 /* OpenBraceToken */: - case 105 /* VarKeyword */: - case 111 /* LetKeyword */: - case 90 /* FunctionKeyword */: - case 76 /* ClassKeyword */: - case 84 /* EnumKeyword */: - case 91 /* IfKeyword */: - case 82 /* DoKeyword */: - case 107 /* WhileKeyword */: - case 89 /* ForKeyword */: - case 78 /* ContinueKeyword */: - case 73 /* BreakKeyword */: - case 97 /* ReturnKeyword */: - case 108 /* WithKeyword */: - case 99 /* SwitchKeyword */: - case 101 /* ThrowKeyword */: - case 103 /* TryKeyword */: - case 79 /* DebuggerKeyword */: + case 106 /* VarKeyword */: + case 112 /* LetKeyword */: + case 91 /* FunctionKeyword */: + case 77 /* ClassKeyword */: + case 85 /* EnumKeyword */: + case 92 /* IfKeyword */: + case 83 /* DoKeyword */: + case 108 /* WhileKeyword */: + case 90 /* ForKeyword */: + case 79 /* ContinueKeyword */: + case 74 /* BreakKeyword */: + case 98 /* ReturnKeyword */: + case 109 /* WithKeyword */: + case 100 /* SwitchKeyword */: + case 102 /* ThrowKeyword */: + case 104 /* TryKeyword */: + case 80 /* DebuggerKeyword */: // 'catch' and 'finally' do not actually indicate that the code is part of a statement, // however, we say they are here so that we may gracefully parse them and error later. - case 75 /* CatchKeyword */: - case 88 /* FinallyKeyword */: + case 76 /* CatchKeyword */: + case 89 /* FinallyKeyword */: return true; - case 92 /* ImportKeyword */: + case 93 /* ImportKeyword */: return isStartOfDeclaration() || lookAhead(nextTokenIsOpenParenOrLessThanOrDot); - case 77 /* ConstKeyword */: - case 85 /* ExportKeyword */: + case 78 /* ConstKeyword */: + case 86 /* ExportKeyword */: return isStartOfDeclaration(); - case 121 /* AsyncKeyword */: - case 125 /* DeclareKeyword */: - case 110 /* InterfaceKeyword */: - case 130 /* ModuleKeyword */: - case 131 /* NamespaceKeyword */: - case 140 /* TypeKeyword */: - case 145 /* GlobalKeyword */: + case 122 /* AsyncKeyword */: + case 126 /* DeclareKeyword */: + case 111 /* InterfaceKeyword */: + case 131 /* ModuleKeyword */: + case 132 /* NamespaceKeyword */: + case 141 /* TypeKeyword */: + case 146 /* GlobalKeyword */: // When these don't start a declaration, they're an identifier in an expression statement return true; - case 115 /* PublicKeyword */: - case 113 /* PrivateKeyword */: - case 114 /* ProtectedKeyword */: - case 116 /* StaticKeyword */: - case 133 /* ReadonlyKeyword */: + case 116 /* PublicKeyword */: + case 114 /* PrivateKeyword */: + case 115 /* ProtectedKeyword */: + case 117 /* StaticKeyword */: + case 134 /* ReadonlyKeyword */: // When these don't start a declaration, they may be the start of a class member if an identifier // immediately follows. Otherwise they're an identifier in an expression statement. return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); @@ -21219,63 +21374,63 @@ var ts; return parseEmptyStatement(); case 18 /* OpenBraceToken */: return parseBlock(/*ignoreMissingOpenBrace*/ false); - case 105 /* VarKeyword */: - return parseVariableStatement(createNodeWithJSDoc(237 /* VariableDeclaration */)); - case 111 /* LetKeyword */: + case 106 /* VarKeyword */: + return parseVariableStatement(createNodeWithJSDoc(238 /* VariableDeclaration */)); + case 112 /* LetKeyword */: if (isLetDeclaration()) { - return parseVariableStatement(createNodeWithJSDoc(237 /* VariableDeclaration */)); + return parseVariableStatement(createNodeWithJSDoc(238 /* VariableDeclaration */)); } break; - case 90 /* FunctionKeyword */: - return parseFunctionDeclaration(createNodeWithJSDoc(239 /* FunctionDeclaration */)); - case 76 /* ClassKeyword */: - return parseClassDeclaration(createNodeWithJSDoc(240 /* ClassDeclaration */)); - case 91 /* IfKeyword */: + case 91 /* FunctionKeyword */: + return parseFunctionDeclaration(createNodeWithJSDoc(240 /* FunctionDeclaration */)); + case 77 /* ClassKeyword */: + return parseClassDeclaration(createNodeWithJSDoc(241 /* ClassDeclaration */)); + case 92 /* IfKeyword */: return parseIfStatement(); - case 82 /* DoKeyword */: + case 83 /* DoKeyword */: return parseDoStatement(); - case 107 /* WhileKeyword */: + case 108 /* WhileKeyword */: return parseWhileStatement(); - case 89 /* ForKeyword */: + case 90 /* ForKeyword */: return parseForOrForInOrForOfStatement(); - case 78 /* ContinueKeyword */: - return parseBreakOrContinueStatement(228 /* ContinueStatement */); - case 73 /* BreakKeyword */: - return parseBreakOrContinueStatement(229 /* BreakStatement */); - case 97 /* ReturnKeyword */: + case 79 /* ContinueKeyword */: + return parseBreakOrContinueStatement(229 /* ContinueStatement */); + case 74 /* BreakKeyword */: + return parseBreakOrContinueStatement(230 /* BreakStatement */); + case 98 /* ReturnKeyword */: return parseReturnStatement(); - case 108 /* WithKeyword */: + case 109 /* WithKeyword */: return parseWithStatement(); - case 99 /* SwitchKeyword */: + case 100 /* SwitchKeyword */: return parseSwitchStatement(); - case 101 /* ThrowKeyword */: + case 102 /* ThrowKeyword */: return parseThrowStatement(); - case 103 /* TryKeyword */: + case 104 /* TryKeyword */: // Include 'catch' and 'finally' for error recovery. - case 75 /* CatchKeyword */: - case 88 /* FinallyKeyword */: + case 76 /* CatchKeyword */: + case 89 /* FinallyKeyword */: return parseTryStatement(); - case 79 /* DebuggerKeyword */: + case 80 /* DebuggerKeyword */: return parseDebuggerStatement(); case 58 /* AtToken */: return parseDeclaration(); - case 121 /* AsyncKeyword */: - case 110 /* InterfaceKeyword */: - case 140 /* TypeKeyword */: - case 130 /* ModuleKeyword */: - case 131 /* NamespaceKeyword */: - case 125 /* DeclareKeyword */: - case 77 /* ConstKeyword */: - case 84 /* EnumKeyword */: - case 85 /* ExportKeyword */: - case 92 /* ImportKeyword */: - case 113 /* PrivateKeyword */: - case 114 /* ProtectedKeyword */: - case 115 /* PublicKeyword */: - case 118 /* AbstractKeyword */: - case 116 /* StaticKeyword */: - case 133 /* ReadonlyKeyword */: - case 145 /* GlobalKeyword */: + case 122 /* AsyncKeyword */: + case 111 /* InterfaceKeyword */: + case 141 /* TypeKeyword */: + case 131 /* ModuleKeyword */: + case 132 /* NamespaceKeyword */: + case 126 /* DeclareKeyword */: + case 78 /* ConstKeyword */: + case 85 /* EnumKeyword */: + case 86 /* ExportKeyword */: + case 93 /* ImportKeyword */: + case 114 /* PrivateKeyword */: + case 115 /* ProtectedKeyword */: + case 116 /* PublicKeyword */: + case 119 /* AbstractKeyword */: + case 117 /* StaticKeyword */: + case 134 /* ReadonlyKeyword */: + case 146 /* GlobalKeyword */: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -21284,7 +21439,7 @@ var ts; return parseExpressionOrLabeledStatement(); } function isDeclareModifier(modifier) { - return modifier.kind === 125 /* DeclareKeyword */; + return modifier.kind === 126 /* DeclareKeyword */; } function parseDeclaration() { var node = createNodeWithJSDoc(0 /* Unknown */); @@ -21303,33 +21458,33 @@ var ts; } function parseDeclarationWorker(node) { switch (token()) { - case 105 /* VarKeyword */: - case 111 /* LetKeyword */: - case 77 /* ConstKeyword */: + case 106 /* VarKeyword */: + case 112 /* LetKeyword */: + case 78 /* ConstKeyword */: return parseVariableStatement(node); - case 90 /* FunctionKeyword */: + case 91 /* FunctionKeyword */: return parseFunctionDeclaration(node); - case 76 /* ClassKeyword */: + case 77 /* ClassKeyword */: return parseClassDeclaration(node); - case 110 /* InterfaceKeyword */: + case 111 /* InterfaceKeyword */: return parseInterfaceDeclaration(node); - case 140 /* TypeKeyword */: + case 141 /* TypeKeyword */: return parseTypeAliasDeclaration(node); - case 84 /* EnumKeyword */: + case 85 /* EnumKeyword */: return parseEnumDeclaration(node); - case 145 /* GlobalKeyword */: - case 130 /* ModuleKeyword */: - case 131 /* NamespaceKeyword */: + case 146 /* GlobalKeyword */: + case 131 /* ModuleKeyword */: + case 132 /* NamespaceKeyword */: return parseModuleDeclaration(node); - case 92 /* ImportKeyword */: + case 93 /* ImportKeyword */: return parseImportDeclarationOrImportEqualsDeclaration(node); - case 85 /* ExportKeyword */: + case 86 /* ExportKeyword */: nextToken(); switch (token()) { - case 80 /* DefaultKeyword */: - case 59 /* EqualsToken */: + case 81 /* DefaultKeyword */: + case 60 /* EqualsToken */: return parseExportAssignment(node); - case 119 /* AsKeyword */: + case 120 /* AsKeyword */: return parseNamespaceExportDeclaration(node); default: return parseExportDeclaration(node); @@ -21338,7 +21493,7 @@ var ts; if (node.decorators || node.modifiers) { // We reached this point because we encountered decorators and/or modifiers and assumed a declaration // would follow. For recovery and error reporting purposes, return an incomplete declaration. - var missing = createMissingNode(258 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var missing = createMissingNode(259 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); missing.pos = node.pos; missing.decorators = node.decorators; missing.modifiers = node.modifiers; @@ -21361,16 +21516,16 @@ var ts; // DECLARATIONS function parseArrayBindingElement() { if (token() === 27 /* CommaToken */) { - return createNode(210 /* OmittedExpression */); + return createNode(211 /* OmittedExpression */); } - var node = createNode(186 /* BindingElement */); + var node = createNode(187 /* BindingElement */); node.dotDotDotToken = parseOptionalToken(25 /* DotDotDotToken */); node.name = parseIdentifierOrPattern(); node.initializer = parseInitializer(); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(186 /* BindingElement */); + var node = createNode(187 /* BindingElement */); node.dotDotDotToken = parseOptionalToken(25 /* DotDotDotToken */); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); @@ -21386,14 +21541,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(184 /* ObjectBindingPattern */); + var node = createNode(185 /* ObjectBindingPattern */); parseExpected(18 /* OpenBraceToken */); node.elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement); parseExpected(19 /* CloseBraceToken */); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(185 /* ArrayBindingPattern */); + var node = createNode(186 /* ArrayBindingPattern */); parseExpected(22 /* OpenBracketToken */); node.elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement); parseExpected(23 /* CloseBracketToken */); @@ -21415,9 +21570,9 @@ var ts; return parseVariableDeclaration(/*allowExclamation*/ true); } function parseVariableDeclaration(allowExclamation) { - var node = createNode(237 /* VariableDeclaration */); + var node = createNode(238 /* VariableDeclaration */); node.name = parseIdentifierOrPattern(); - if (allowExclamation && node.name.kind === 72 /* Identifier */ && + if (allowExclamation && node.name.kind === 73 /* Identifier */ && token() === 52 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) { node.exclamationToken = parseTokenNode(); } @@ -21428,14 +21583,14 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(238 /* VariableDeclarationList */); + var node = createNode(239 /* VariableDeclarationList */); switch (token()) { - case 105 /* VarKeyword */: + case 106 /* VarKeyword */: break; - case 111 /* LetKeyword */: + case 112 /* LetKeyword */: node.flags |= 1 /* Let */; break; - case 77 /* ConstKeyword */: + case 78 /* ConstKeyword */: node.flags |= 2 /* Const */; break; default: @@ -21451,7 +21606,7 @@ var ts; // So we need to look ahead to determine if 'of' should be treated as a keyword in // this context. // The checker will then give an error that there is an empty declaration list. - if (token() === 147 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { + if (token() === 148 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -21466,14 +21621,14 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 21 /* CloseParenToken */; } function parseVariableStatement(node) { - node.kind = 219 /* VariableStatement */; + node.kind = 220 /* VariableStatement */; node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false); parseSemicolon(); return finishNode(node); } function parseFunctionDeclaration(node) { - node.kind = 239 /* FunctionDeclaration */; - parseExpected(90 /* FunctionKeyword */); + node.kind = 240 /* FunctionDeclaration */; + parseExpected(91 /* FunctionKeyword */); node.asteriskToken = parseOptionalToken(40 /* AsteriskToken */); node.name = ts.hasModifier(node, 512 /* Default */) ? parseOptionalIdentifier() : parseIdentifier(); var isGenerator = node.asteriskToken ? 1 /* Yield */ : 0 /* None */; @@ -21483,14 +21638,14 @@ var ts; return finishNode(node); } function parseConstructorDeclaration(node) { - node.kind = 157 /* Constructor */; - parseExpected(124 /* ConstructorKeyword */); + node.kind = 158 /* Constructor */; + parseExpected(125 /* ConstructorKeyword */); fillSignature(57 /* ColonToken */, 0 /* None */, node); node.body = parseFunctionBlockOrSemicolon(0 /* None */, ts.Diagnostics.or_expected); return finishNode(node); } function parseMethodDeclaration(node, asteriskToken, diagnosticMessage) { - node.kind = 156 /* MethodDeclaration */; + node.kind = 157 /* MethodDeclaration */; node.asteriskToken = asteriskToken; var isGenerator = asteriskToken ? 1 /* Yield */ : 0 /* None */; var isAsync = ts.hasModifier(node, 256 /* Async */) ? 2 /* Await */ : 0 /* None */; @@ -21499,7 +21654,7 @@ var ts; return finishNode(node); } function parsePropertyDeclaration(node) { - node.kind = 154 /* PropertyDeclaration */; + node.kind = 155 /* PropertyDeclaration */; if (!node.questionToken && token() === 52 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) { node.exclamationToken = parseTokenNode(); } @@ -21572,7 +21727,7 @@ var ts; // If we were able to get any potential identifier... if (idToken !== undefined) { // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse. - if (!ts.isKeyword(idToken) || idToken === 137 /* SetKeyword */ || idToken === 126 /* GetKeyword */) { + if (!ts.isKeyword(idToken) || idToken === 138 /* SetKeyword */ || idToken === 127 /* GetKeyword */) { return true; } // If it *is* a keyword, but not an accessor, check a little farther along @@ -21582,7 +21737,7 @@ var ts; case 28 /* LessThanToken */: // Generic Method declaration case 52 /* ExclamationToken */: // Non-null assertion on property name case 57 /* ColonToken */: // Type Annotation for declaration - case 59 /* EqualsToken */: // Initializer for declaration + case 60 /* EqualsToken */: // Initializer for declaration case 56 /* QuestionToken */: // Not valid, but permitted so that it gets caught later on. return true; default: @@ -21604,7 +21759,7 @@ var ts; if (!parseOptional(58 /* AtToken */)) { break; } - var decorator = createNode(152 /* Decorator */, decoratorStart); + var decorator = createNode(153 /* Decorator */, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); finishNode(decorator); (list || (list = [])).push(decorator); @@ -21624,7 +21779,7 @@ var ts; while (true) { var modifierStart = scanner.getStartPos(); var modifierKind = token(); - if (token() === 77 /* ConstKeyword */ && permitInvalidConstAsModifier) { + if (token() === 78 /* ConstKeyword */ && permitInvalidConstAsModifier) { // We need to ensure that any subsequent modifiers appear on the same line // so that when 'const' is a standalone declaration, we don't issue an error. if (!tryParse(nextTokenIsOnSameLineAndCanFollowModifier)) { @@ -21643,7 +21798,7 @@ var ts; } function parseModifiersForArrowFunction() { var modifiers; - if (token() === 121 /* AsyncKeyword */) { + if (token() === 122 /* AsyncKeyword */) { var modifierStart = scanner.getStartPos(); var modifierKind = token(); nextToken(); @@ -21654,20 +21809,20 @@ var ts; } function parseClassElement() { if (token() === 26 /* SemicolonToken */) { - var result = createNode(217 /* SemicolonClassElement */); + var result = createNode(218 /* SemicolonClassElement */); nextToken(); return finishNode(result); } var node = createNodeWithJSDoc(0 /* Unknown */); node.decorators = parseDecorators(); node.modifiers = parseModifiers(/*permitInvalidConstAsModifier*/ true); - if (parseContextualModifier(126 /* GetKeyword */)) { - return parseAccessorDeclaration(node, 158 /* GetAccessor */); + if (parseContextualModifier(127 /* GetKeyword */)) { + return parseAccessorDeclaration(node, 159 /* GetAccessor */); } - if (parseContextualModifier(137 /* SetKeyword */)) { - return parseAccessorDeclaration(node, 159 /* SetAccessor */); + if (parseContextualModifier(138 /* SetKeyword */)) { + return parseAccessorDeclaration(node, 160 /* SetAccessor */); } - if (token() === 124 /* ConstructorKeyword */) { + if (token() === 125 /* ConstructorKeyword */) { return parseConstructorDeclaration(node); } if (isIndexSignature()) { @@ -21684,21 +21839,21 @@ var ts; } if (node.decorators || node.modifiers) { // treat this as a property declaration with a missing name. - node.name = createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + node.name = createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); return parsePropertyDeclaration(node); } // 'isClassMemberStart' should have hinted not to attempt parsing. return ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(createNodeWithJSDoc(0 /* Unknown */), 209 /* ClassExpression */); + return parseClassDeclarationOrExpression(createNodeWithJSDoc(0 /* Unknown */), 210 /* ClassExpression */); } function parseClassDeclaration(node) { - return parseClassDeclarationOrExpression(node, 240 /* ClassDeclaration */); + return parseClassDeclarationOrExpression(node, 241 /* ClassDeclaration */); } function parseClassDeclarationOrExpression(node, kind) { node.kind = kind; - parseExpected(76 /* ClassKeyword */); + parseExpected(77 /* ClassKeyword */); node.name = parseNameOfClassDeclarationOrExpression(); node.typeParameters = parseTypeParameters(); node.heritageClauses = parseHeritageClauses(); @@ -21724,7 +21879,7 @@ var ts; : undefined; } function isImplementsClause() { - return token() === 109 /* ImplementsKeyword */ && lookAhead(nextTokenIsIdentifierOrKeyword); + return token() === 110 /* ImplementsKeyword */ && lookAhead(nextTokenIsIdentifierOrKeyword); } function parseHeritageClauses() { // ClassTail[Yield,Await] : (Modified) See 14.5 @@ -21736,15 +21891,15 @@ var ts; } function parseHeritageClause() { var tok = token(); - ts.Debug.assert(tok === 86 /* ExtendsKeyword */ || tok === 109 /* ImplementsKeyword */); // isListElement() should ensure this. - var node = createNode(273 /* HeritageClause */); + ts.Debug.assert(tok === 87 /* ExtendsKeyword */ || tok === 110 /* ImplementsKeyword */); // isListElement() should ensure this. + var node = createNode(274 /* HeritageClause */); node.token = tok; nextToken(); node.types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments); return finishNode(node); } function parseExpressionWithTypeArguments() { - var node = createNode(211 /* ExpressionWithTypeArguments */); + var node = createNode(212 /* ExpressionWithTypeArguments */); node.expression = parseLeftHandSideExpressionOrHigher(); node.typeArguments = tryParseTypeArguments(); return finishNode(node); @@ -21755,14 +21910,14 @@ var ts; : undefined; } function isHeritageClause() { - return token() === 86 /* ExtendsKeyword */ || token() === 109 /* ImplementsKeyword */; + return token() === 87 /* ExtendsKeyword */ || token() === 110 /* ImplementsKeyword */; } function parseClassMembers() { return parseList(5 /* ClassMembers */, parseClassElement); } function parseInterfaceDeclaration(node) { - node.kind = 241 /* InterfaceDeclaration */; - parseExpected(110 /* InterfaceKeyword */); + node.kind = 242 /* InterfaceDeclaration */; + parseExpected(111 /* InterfaceKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); node.heritageClauses = parseHeritageClauses(); @@ -21770,11 +21925,11 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(node) { - node.kind = 242 /* TypeAliasDeclaration */; - parseExpected(140 /* TypeKeyword */); + node.kind = 243 /* TypeAliasDeclaration */; + parseExpected(141 /* TypeKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); - parseExpected(59 /* EqualsToken */); + parseExpected(60 /* EqualsToken */); node.type = parseType(); parseSemicolon(); return finishNode(node); @@ -21784,14 +21939,14 @@ var ts; // ConstantEnumMemberSection, which starts at the beginning of an enum declaration // or any time an integer literal initializer is encountered. function parseEnumMember() { - var node = createNodeWithJSDoc(278 /* EnumMember */); + var node = createNodeWithJSDoc(279 /* EnumMember */); node.name = parsePropertyName(); node.initializer = allowInAnd(parseInitializer); return finishNode(node); } function parseEnumDeclaration(node) { - node.kind = 243 /* EnumDeclaration */; - parseExpected(84 /* EnumKeyword */); + node.kind = 244 /* EnumDeclaration */; + parseExpected(85 /* EnumKeyword */); node.name = parseIdentifier(); if (parseExpected(18 /* OpenBraceToken */)) { node.members = parseDelimitedList(6 /* EnumMembers */, parseEnumMember); @@ -21803,7 +21958,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(245 /* ModuleBlock */); + var node = createNode(246 /* ModuleBlock */); if (parseExpected(18 /* OpenBraceToken */)) { node.statements = parseList(1 /* BlockStatements */, parseStatement); parseExpected(19 /* CloseBraceToken */); @@ -21814,7 +21969,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(node, flags) { - node.kind = 244 /* ModuleDeclaration */; + node.kind = 245 /* ModuleDeclaration */; // If we are parsing a dotted namespace name, we want to // propagate the 'Namespace' flag across the names if set. var namespaceFlag = flags & 16 /* Namespace */; @@ -21826,8 +21981,8 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(node) { - node.kind = 244 /* ModuleDeclaration */; - if (token() === 145 /* GlobalKeyword */) { + node.kind = 245 /* ModuleDeclaration */; + if (token() === 146 /* GlobalKeyword */) { // parse 'global' as name of global scope augmentation node.name = parseIdentifier(); node.flags |= 512 /* GlobalAugmentation */; @@ -21846,15 +22001,15 @@ var ts; } function parseModuleDeclaration(node) { var flags = 0; - if (token() === 145 /* GlobalKeyword */) { + if (token() === 146 /* GlobalKeyword */) { // global augmentation return parseAmbientExternalModuleDeclaration(node); } - else if (parseOptional(131 /* NamespaceKeyword */)) { + else if (parseOptional(132 /* NamespaceKeyword */)) { flags |= 16 /* Namespace */; } else { - parseExpected(130 /* ModuleKeyword */); + parseExpected(131 /* ModuleKeyword */); if (token() === 10 /* StringLiteral */) { return parseAmbientExternalModuleDeclaration(node); } @@ -21862,7 +22017,7 @@ var ts; return parseModuleOrNamespaceDeclaration(node, flags); } function isExternalModuleReference() { - return token() === 134 /* RequireKeyword */ && + return token() === 135 /* RequireKeyword */ && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { @@ -21872,25 +22027,25 @@ var ts; return nextToken() === 42 /* SlashToken */; } function parseNamespaceExportDeclaration(node) { - node.kind = 247 /* NamespaceExportDeclaration */; - parseExpected(119 /* AsKeyword */); - parseExpected(131 /* NamespaceKeyword */); + node.kind = 248 /* NamespaceExportDeclaration */; + parseExpected(120 /* AsKeyword */); + parseExpected(132 /* NamespaceKeyword */); node.name = parseIdentifier(); parseSemicolon(); return finishNode(node); } function parseImportDeclarationOrImportEqualsDeclaration(node) { - parseExpected(92 /* ImportKeyword */); + parseExpected(93 /* ImportKeyword */); var afterImportPos = scanner.getStartPos(); var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token() !== 27 /* CommaToken */ && token() !== 144 /* FromKeyword */) { + if (token() !== 27 /* CommaToken */ && token() !== 145 /* FromKeyword */) { return parseImportEqualsDeclaration(node, identifier); } } // Import statement - node.kind = 249 /* ImportDeclaration */; + node.kind = 250 /* ImportDeclaration */; // ImportDeclaration: // import ImportClause from ModuleSpecifier ; // import ModuleSpecifier; @@ -21898,16 +22053,16 @@ var ts; token() === 40 /* AsteriskToken */ || // import * token() === 18 /* OpenBraceToken */) { // import { node.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(144 /* FromKeyword */); + parseExpected(145 /* FromKeyword */); } node.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); return finishNode(node); } function parseImportEqualsDeclaration(node, identifier) { - node.kind = 248 /* ImportEqualsDeclaration */; + node.kind = 249 /* ImportEqualsDeclaration */; node.name = identifier; - parseExpected(59 /* EqualsToken */); + parseExpected(60 /* EqualsToken */); node.moduleReference = parseModuleReference(); parseSemicolon(); return finishNode(node); @@ -21919,7 +22074,7 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(250 /* ImportClause */, fullStart); + var importClause = createNode(251 /* ImportClause */, fullStart); if (identifier) { // ImportedDefaultBinding: // ImportedBinding @@ -21929,7 +22084,7 @@ var ts; // parse namespace or named imports if (!importClause.name || parseOptional(27 /* CommaToken */)) { - importClause.namedBindings = token() === 40 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(252 /* NamedImports */); + importClause.namedBindings = token() === 40 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(253 /* NamedImports */); } return finishNode(importClause); } @@ -21939,8 +22094,8 @@ var ts; : parseEntityName(/*allowReservedWords*/ false); } function parseExternalModuleReference() { - var node = createNode(259 /* ExternalModuleReference */); - parseExpected(134 /* RequireKeyword */); + var node = createNode(260 /* ExternalModuleReference */); + parseExpected(135 /* RequireKeyword */); parseExpected(20 /* OpenParenToken */); node.expression = parseModuleSpecifier(); parseExpected(21 /* CloseParenToken */); @@ -21962,9 +22117,9 @@ var ts; function parseNamespaceImport() { // NameSpaceImport: // * as ImportedBinding - var namespaceImport = createNode(251 /* NamespaceImport */); + var namespaceImport = createNode(252 /* NamespaceImport */); parseExpected(40 /* AsteriskToken */); - parseExpected(119 /* AsKeyword */); + parseExpected(120 /* AsKeyword */); namespaceImport.name = parseIdentifier(); return finishNode(namespaceImport); } @@ -21977,14 +22132,14 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - node.elements = parseBracketedList(23 /* ImportOrExportSpecifiers */, kind === 252 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */); + node.elements = parseBracketedList(23 /* ImportOrExportSpecifiers */, kind === 253 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(257 /* ExportSpecifier */); + return parseImportOrExportSpecifier(258 /* ExportSpecifier */); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(253 /* ImportSpecifier */); + return parseImportOrExportSpecifier(254 /* ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -21998,9 +22153,9 @@ var ts; var checkIdentifierStart = scanner.getTokenPos(); var checkIdentifierEnd = scanner.getTextPos(); var identifierName = parseIdentifierName(); - if (token() === 119 /* AsKeyword */) { + if (token() === 120 /* AsKeyword */) { node.propertyName = identifierName; - parseExpected(119 /* AsKeyword */); + parseExpected(120 /* AsKeyword */); checkIdentifierIsKeyword = ts.isKeyword(token()) && !isIdentifier(); checkIdentifierStart = scanner.getTokenPos(); checkIdentifierEnd = scanner.getTextPos(); @@ -22009,24 +22164,24 @@ var ts; else { node.name = identifierName; } - if (kind === 253 /* ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 254 /* ImportSpecifier */ && checkIdentifierIsKeyword) { parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(node) { - node.kind = 255 /* ExportDeclaration */; + node.kind = 256 /* ExportDeclaration */; if (parseOptional(40 /* AsteriskToken */)) { - parseExpected(144 /* FromKeyword */); + parseExpected(145 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(256 /* NamedExports */); + node.exportClause = parseNamedImportsOrExports(257 /* NamedExports */); // It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios, // the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`) // If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect. - if (token() === 144 /* FromKeyword */ || (token() === 10 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) { - parseExpected(144 /* FromKeyword */); + if (token() === 145 /* FromKeyword */ || (token() === 10 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) { + parseExpected(145 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } } @@ -22034,12 +22189,12 @@ var ts; return finishNode(node); } function parseExportAssignment(node) { - node.kind = 254 /* ExportAssignment */; - if (parseOptional(59 /* EqualsToken */)) { + node.kind = 255 /* ExportAssignment */; + if (parseOptional(60 /* EqualsToken */)) { node.isExportEquals = true; } else { - parseExpected(80 /* DefaultKeyword */); + parseExpected(81 /* DefaultKeyword */); } node.expression = parseAssignmentExpressionOrHigher(); parseSemicolon(); @@ -22054,10 +22209,10 @@ var ts; } function isAnExternalModuleIndicatorNode(node) { return ts.hasModifier(node, 1 /* Export */) - || node.kind === 248 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 259 /* ExternalModuleReference */ - || node.kind === 249 /* ImportDeclaration */ - || node.kind === 254 /* ExportAssignment */ - || node.kind === 255 /* ExportDeclaration */ + || node.kind === 249 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 260 /* ExternalModuleReference */ + || node.kind === 250 /* ImportDeclaration */ + || node.kind === 255 /* ExportAssignment */ + || node.kind === 256 /* ExportDeclaration */ ? node : undefined; } @@ -22070,7 +22225,7 @@ var ts; return isImportMeta(node) ? node : forEachChild(node, walkTreeForExternalModuleIndicators); } function isImportMeta(node) { - return ts.isMetaProperty(node) && node.keywordToken === 92 /* ImportKeyword */ && node.name.escapedText === "meta"; + return ts.isMetaProperty(node) && node.keywordToken === 93 /* ImportKeyword */ && node.name.escapedText === "meta"; } var ParsingContext; (function (ParsingContext) { @@ -22109,8 +22264,8 @@ var ts; var JSDocParser; (function (JSDocParser) { function parseJSDocTypeExpressionForTests(content, start, length) { - initializeState(content, 7 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */); - sourceFile = createSourceFile("file.js", 7 /* Latest */, 1 /* JS */, /*isDeclarationFile*/ false); + initializeState(content, 8 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */); + sourceFile = createSourceFile("file.js", 8 /* Latest */, 1 /* JS */, /*isDeclarationFile*/ false); scanner.setText(content, start, length); currentToken = scanner.scan(); var jsDocTypeExpression = parseJSDocTypeExpression(); @@ -22121,18 +22276,18 @@ var ts; JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; // Parses out a JSDoc type expression. function parseJSDocTypeExpression(mayOmitBraces) { - var result = createNode(288 /* JSDocTypeExpression */); + var result = createNode(289 /* JSDocTypeExpression */); var hasBrace = (mayOmitBraces ? parseOptional : parseExpected)(18 /* OpenBraceToken */); result.type = doInsideOfContext(2097152 /* JSDoc */, parseJSDocType); if (!mayOmitBraces || hasBrace) { - parseExpected(19 /* CloseBraceToken */); + parseExpectedJSDoc(19 /* CloseBraceToken */); } fixupParentReferences(result); return finishNode(result); } JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression; function parseIsolatedJSDocComment(content, start, length) { - initializeState(content, 7 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */); + initializeState(content, 8 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */); sourceFile = { languageVariant: 0 /* Standard */, text: content }; // tslint:disable-line no-object-literal-type-assertion var jsDoc = parseJSDocCommentWorker(start, length); var diagnostics = parseDiagnostics; @@ -22204,7 +22359,7 @@ var ts; comments.push(text); indent += text.length; } - nextJSDocToken(); + nextTokenJSDoc(); while (parseOptionalJsdoc(5 /* WhitespaceTrivia */)) ; if (parseOptionalJsdoc(4 /* NewLineTrivia */)) { @@ -22222,7 +22377,6 @@ var ts; // for malformed examples like `/** @param {string} x @returns {number} the length */` state = 0 /* BeginningOfLine */; margin = undefined; - indent++; } else { pushComment(scanner.getTokenText()); @@ -22267,7 +22421,7 @@ var ts; pushComment(scanner.getTokenText()); break; } - nextJSDocToken(); + nextTokenJSDoc(); } removeLeadingNewlines(comments); removeTrailingWhitespace(comments); @@ -22284,7 +22438,7 @@ var ts; } } function createJSDocComment() { - var result = createNode(296 /* JSDocComment */, start); + var result = createNode(297 /* JSDocComment */, start); result.tags = tags && createNodeArray(tags, tagsPos, tagsEnd); result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); @@ -22292,7 +22446,7 @@ var ts; function isNextNonwhitespaceTokenEndOfFile() { // We must use infinite lookahead, as there could be any number of newlines :( while (true) { - nextJSDocToken(); + nextTokenJSDoc(); if (token() === 1 /* EndOfFileToken */) { return true; } @@ -22308,32 +22462,38 @@ var ts; } } while (token() === 5 /* WhitespaceTrivia */ || token() === 4 /* NewLineTrivia */) { - nextJSDocToken(); + nextTokenJSDoc(); } } function skipWhitespaceOrAsterisk() { if (token() === 5 /* WhitespaceTrivia */ || token() === 4 /* NewLineTrivia */) { if (lookAhead(isNextNonwhitespaceTokenEndOfFile)) { - return; // Don't skip whitespace prior to EoF (or end of comment) - that shouldn't be included in any node's range + return ""; // Don't skip whitespace prior to EoF (or end of comment) - that shouldn't be included in any node's range } } var precedingLineBreak = scanner.hasPrecedingLineBreak(); + var seenLineBreak = false; + var indentText = ""; while ((precedingLineBreak && token() === 40 /* AsteriskToken */) || token() === 5 /* WhitespaceTrivia */ || token() === 4 /* NewLineTrivia */) { + indentText += scanner.getTokenText(); if (token() === 4 /* NewLineTrivia */) { precedingLineBreak = true; + seenLineBreak = true; + indentText = ""; } else if (token() === 40 /* AsteriskToken */) { precedingLineBreak = false; } - nextJSDocToken(); + nextTokenJSDoc(); } + return seenLineBreak ? indentText : ""; } - function parseTag(indent) { + function parseTag(margin) { ts.Debug.assert(token() === 58 /* AtToken */); var start = scanner.getTokenPos(); - nextJSDocToken(); + nextTokenJSDoc(); var tagName = parseJSDocIdentifierName(/*message*/ undefined); - skipWhitespaceOrAsterisk(); + var indentText = skipWhitespaceOrAsterisk(); var tag; switch (tagName.escapedText) { case "augments": @@ -22353,7 +22513,7 @@ var ts; case "arg": case "argument": case "param": - return parseParameterOrPropertyTag(start, tagName, 2 /* Parameter */, indent); + return parseParameterOrPropertyTag(start, tagName, 2 /* Parameter */, margin); case "return": case "returns": tag = parseReturnTag(start, tagName); @@ -22365,10 +22525,10 @@ var ts; tag = parseTypeTag(start, tagName); break; case "typedef": - tag = parseTypedefTag(start, tagName, indent); + tag = parseTypedefTag(start, tagName, margin); break; case "callback": - tag = parseCallbackTag(start, tagName, indent); + tag = parseCallbackTag(start, tagName, margin); break; default: tag = parseUnknownTag(start, tagName); @@ -22376,11 +22536,14 @@ var ts; } if (!tag.comment) { // some tags, like typedef and callback, have already parsed their comments earlier - tag.comment = parseTagComments(indent + tag.end - tag.pos); + if (!indentText) { + margin += tag.end - tag.pos; + } + tag.comment = parseTagComments(margin, indentText.slice(margin)); } return tag; } - function parseTagComments(indent) { + function parseTagComments(indent, initialMargin) { var comments = []; var state = 0 /* BeginningOfLine */; var margin; @@ -22391,6 +22554,11 @@ var ts; comments.push(text); indent += text.length; } + if (initialMargin) { + // jump straight to saving comments if there is some initial indentation + pushComment(initialMargin); + state = 2 /* SavingComments */; + } var tok = token(); loop: while (true) { switch (tok) { @@ -22415,18 +22583,18 @@ var ts; var whitespace = scanner.getTokenText(); // if the whitespace crosses the margin, take only the whitespace that passes the margin if (margin !== undefined && indent + whitespace.length > margin) { - comments.push(whitespace.slice(margin - indent - 1)); + comments.push(whitespace.slice(margin - indent)); } indent += whitespace.length; } break; case 18 /* OpenBraceToken */: state = 2 /* SavingComments */; - if (lookAhead(function () { return nextJSDocToken() === 58 /* AtToken */ && ts.tokenIsIdentifierOrKeyword(nextJSDocToken()) && scanner.getTokenText() === "link"; })) { + if (lookAhead(function () { return nextTokenJSDoc() === 58 /* AtToken */ && ts.tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && scanner.getTokenText() === "link"; })) { pushComment(scanner.getTokenText()); - nextJSDocToken(); + nextTokenJSDoc(); pushComment(scanner.getTokenText()); - nextJSDocToken(); + nextTokenJSDoc(); } pushComment(scanner.getTokenText()); break; @@ -22444,14 +22612,14 @@ var ts; pushComment(scanner.getTokenText()); break; } - tok = nextJSDocToken(); + tok = nextTokenJSDoc(); } removeLeadingNewlines(comments); removeTrailingWhitespace(comments); return comments.length === 0 ? undefined : comments.join(""); } function parseUnknownTag(start, tagName) { - var result = createNode(299 /* JSDocTag */, start); + var result = createNode(300 /* JSDocTag */, start); result.tagName = tagName; return finishNode(result); } @@ -22473,17 +22641,21 @@ var ts; return token() === 18 /* OpenBraceToken */ ? parseJSDocTypeExpression() : undefined; } function parseBracketNameInPropertyAndParamTag() { - if (token() === 14 /* NoSubstitutionTemplateLiteral */) { - // a markdown-quoted name: `arg` is not legal jsdoc, but occurs in the wild - return { name: createIdentifier(/*isIdentifier*/ true), isBracketed: false }; - } // Looking for something like '[foo]', 'foo', '[foo.bar]' or 'foo.bar' - var isBracketed = parseOptional(22 /* OpenBracketToken */); + var isBracketed = parseOptionalJsdoc(22 /* OpenBracketToken */); + if (isBracketed) { + skipWhitespace(); + } + // a markdown-quoted name: `arg` is not legal jsdoc, but occurs in the wild + var isBackquoted = parseOptionalJsdoc(59 /* BacktickToken */); var name = parseJSDocEntityName(); + if (isBackquoted) { + parseExpectedTokenJSDoc(59 /* BacktickToken */); + } if (isBracketed) { skipWhitespace(); // May have an optional default, e.g. '[foo = 42]' - if (parseOptionalToken(59 /* EqualsToken */)) { + if (parseOptionalToken(60 /* EqualsToken */)) { parseExpression(); } parseExpected(23 /* CloseBracketToken */); @@ -22492,9 +22664,9 @@ var ts; } function isObjectOrObjectArrayTypeReference(node) { switch (node.kind) { - case 136 /* ObjectKeyword */: + case 137 /* ObjectKeyword */: return true; - case 169 /* ArrayType */: + case 170 /* ArrayType */: return isObjectOrObjectArrayTypeReference(node.elementType); default: return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object"; @@ -22510,8 +22682,8 @@ var ts; typeExpression = tryParseTypeExpression(); } var result = target === 1 /* Property */ ? - createNode(310 /* JSDocPropertyTag */, start) : - createNode(304 /* JSDocParameterTag */, start); + createNode(311 /* JSDocPropertyTag */, start) : + createNode(305 /* JSDocParameterTag */, start); var comment = parseTagComments(indent + scanner.getStartPos() - start); var nestedTypeLiteral = target !== 4 /* CallbackParameter */ && parseNestedTypeLiteral(typeExpression, name, target, indent); if (nestedTypeLiteral) { @@ -22528,20 +22700,20 @@ var ts; } function parseNestedTypeLiteral(typeExpression, name, target, indent) { if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) { - var typeLiteralExpression = createNode(288 /* JSDocTypeExpression */, scanner.getTokenPos()); + var typeLiteralExpression = createNode(289 /* JSDocTypeExpression */, scanner.getTokenPos()); var child = void 0; var jsdocTypeLiteral = void 0; var start_2 = scanner.getStartPos(); var children = void 0; while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, indent, name); })) { - if (child.kind === 304 /* JSDocParameterTag */ || child.kind === 310 /* JSDocPropertyTag */) { + if (child.kind === 305 /* JSDocParameterTag */ || child.kind === 311 /* JSDocPropertyTag */) { children = ts.append(children, child); } } if (children) { - jsdocTypeLiteral = createNode(297 /* JSDocTypeLiteral */, start_2); + jsdocTypeLiteral = createNode(298 /* JSDocTypeLiteral */, start_2); jsdocTypeLiteral.jsDocPropertyTags = children; - if (typeExpression.type.kind === 169 /* ArrayType */) { + if (typeExpression.type.kind === 170 /* ArrayType */) { jsdocTypeLiteral.isArrayType = true; } typeLiteralExpression.type = finishNode(jsdocTypeLiteral); @@ -22550,32 +22722,32 @@ var ts; } } function parseReturnTag(start, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 305 /* JSDocReturnTag */; })) { + if (ts.some(tags, ts.isJSDocReturnTag)) { parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } - var result = createNode(305 /* JSDocReturnTag */, start); + var result = createNode(306 /* JSDocReturnTag */, start); result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(start, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 307 /* JSDocTypeTag */; })) { + if (ts.some(tags, ts.isJSDocTypeTag)) { parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } - var result = createNode(307 /* JSDocTypeTag */, start); + var result = createNode(308 /* JSDocTypeTag */, start); result.tagName = tagName; result.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true); return finishNode(result); } function parseAugmentsTag(start, tagName) { - var result = createNode(300 /* JSDocAugmentsTag */, start); + var result = createNode(301 /* JSDocAugmentsTag */, start); result.tagName = tagName; result.class = parseExpressionWithTypeArgumentsForAugments(); return finishNode(result); } function parseExpressionWithTypeArgumentsForAugments() { var usedBrace = parseOptional(18 /* OpenBraceToken */); - var node = createNode(211 /* ExpressionWithTypeArguments */); + var node = createNode(212 /* ExpressionWithTypeArguments */); node.expression = parsePropertyAccessEntityNameExpression(); node.typeArguments = tryParseTypeArguments(); var res = finishNode(node); @@ -22587,7 +22759,7 @@ var ts; function parsePropertyAccessEntityNameExpression() { var node = parseJSDocIdentifierName(); while (parseOptional(24 /* DotToken */)) { - var prop = createNode(189 /* PropertyAccessExpression */, node.pos); + var prop = createNode(190 /* PropertyAccessExpression */, node.pos); prop.expression = node; prop.name = parseJSDocIdentifierName(); node = finishNode(prop); @@ -22595,19 +22767,19 @@ var ts; return node; } function parseClassTag(start, tagName) { - var tag = createNode(301 /* JSDocClassTag */, start); + var tag = createNode(302 /* JSDocClassTag */, start); tag.tagName = tagName; return finishNode(tag); } function parseThisTag(start, tagName) { - var tag = createNode(306 /* JSDocThisTag */, start); + var tag = createNode(307 /* JSDocThisTag */, start); tag.tagName = tagName; tag.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true); skipWhitespace(); return finishNode(tag); } function parseEnumTag(start, tagName) { - var tag = createNode(303 /* JSDocEnumTag */, start); + var tag = createNode(304 /* JSDocEnumTag */, start); tag.tagName = tagName; tag.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true); skipWhitespace(); @@ -22616,7 +22788,7 @@ var ts; function parseTypedefTag(start, tagName, indent) { var typeExpression = tryParseTypeExpression(); skipWhitespaceOrAsterisk(); - var typedefTag = createNode(309 /* JSDocTypedefTag */, start); + var typedefTag = createNode(310 /* JSDocTypedefTag */, start); typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(); typedefTag.name = getJSDocTypeAliasName(typedefTag.fullName); @@ -22630,9 +22802,9 @@ var ts; var childTypeTag = void 0; while (child = tryParse(function () { return parseChildPropertyTag(indent); })) { if (!jsdocTypeLiteral) { - jsdocTypeLiteral = createNode(297 /* JSDocTypeLiteral */, start); + jsdocTypeLiteral = createNode(298 /* JSDocTypeLiteral */, start); } - if (child.kind === 307 /* JSDocTypeTag */) { + if (child.kind === 308 /* JSDocTypeTag */) { if (childTypeTag) { break; } @@ -22645,7 +22817,7 @@ var ts; } } if (jsdocTypeLiteral) { - if (typeExpression && typeExpression.type.kind === 169 /* ArrayType */) { + if (typeExpression && typeExpression.type.kind === 170 /* ArrayType */) { jsdocTypeLiteral.isArrayType = true; } typedefTag.typeExpression = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ? @@ -22664,7 +22836,7 @@ var ts; } var typeNameOrNamespaceName = parseJSDocIdentifierName(); if (parseOptional(24 /* DotToken */)) { - var jsDocNamespaceNode = createNode(244 /* ModuleDeclaration */, pos); + var jsDocNamespaceNode = createNode(245 /* ModuleDeclaration */, pos); if (nested) { jsDocNamespaceNode.flags |= 4 /* NestedNamespace */; } @@ -22678,14 +22850,14 @@ var ts; return typeNameOrNamespaceName; } function parseCallbackTag(start, tagName, indent) { - var callbackTag = createNode(302 /* JSDocCallbackTag */, start); + var callbackTag = createNode(303 /* JSDocCallbackTag */, start); callbackTag.tagName = tagName; callbackTag.fullName = parseJSDocTypeNameWithNamespace(); callbackTag.name = getJSDocTypeAliasName(callbackTag.fullName); skipWhitespace(); callbackTag.comment = parseTagComments(indent); var child; - var jsdocSignature = createNode(298 /* JSDocSignature */, start); + var jsdocSignature = createNode(299 /* JSDocSignature */, start); jsdocSignature.parameters = []; while (child = tryParse(function () { return parseChildParameterOrPropertyTag(4 /* CallbackParameter */, indent); })) { jsdocSignature.parameters = ts.append(jsdocSignature.parameters, child); @@ -22693,7 +22865,7 @@ var ts; var returnTag = tryParse(function () { if (parseOptionalJsdoc(58 /* AtToken */)) { var tag = parseTag(indent); - if (tag && tag.kind === 305 /* JSDocReturnTag */) { + if (tag && tag.kind === 306 /* JSDocReturnTag */) { return tag; } } @@ -22734,11 +22906,11 @@ var ts; var canParseTag = true; var seenAsterisk = false; while (true) { - switch (nextJSDocToken()) { + switch (nextTokenJSDoc()) { case 58 /* AtToken */: if (canParseTag) { var child = tryParseChildTag(target, indent); - if (child && (child.kind === 304 /* JSDocParameterTag */ || child.kind === 310 /* JSDocPropertyTag */) && + if (child && (child.kind === 305 /* JSDocParameterTag */ || child.kind === 311 /* JSDocPropertyTag */) && target !== 4 /* CallbackParameter */ && name && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; @@ -22757,7 +22929,7 @@ var ts; } seenAsterisk = true; break; - case 72 /* Identifier */: + case 73 /* Identifier */: canParseTag = false; break; case 1 /* EndOfFileToken */: @@ -22768,7 +22940,7 @@ var ts; function tryParseChildTag(target, indent) { ts.Debug.assert(token() === 58 /* AtToken */); var start = scanner.getStartPos(); - nextJSDocToken(); + nextTokenJSDoc(); var tagName = parseJSDocIdentifierName(); skipWhitespace(); var t; @@ -22802,25 +22974,22 @@ var ts; var typeParametersPos = getNodePos(); do { skipWhitespace(); - var typeParameter = createNode(150 /* TypeParameter */); + var typeParameter = createNode(151 /* TypeParameter */); typeParameter.name = parseJSDocIdentifierName(ts.Diagnostics.Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces); finishNode(typeParameter); skipWhitespace(); typeParameters.push(typeParameter); } while (parseOptionalJsdoc(27 /* CommaToken */)); - var result = createNode(308 /* JSDocTemplateTag */, start); + var result = createNode(309 /* JSDocTemplateTag */, start); result.tagName = tagName; result.constraint = constraint; result.typeParameters = createNodeArray(typeParameters, typeParametersPos); finishNode(result); return result; } - function nextJSDocToken() { - return currentToken = scanner.scanJSDocToken(); - } function parseOptionalJsdoc(t) { if (token() === t) { - nextJSDocToken(); + nextTokenJSDoc(); return true; } return false; @@ -22844,14 +23013,14 @@ var ts; } function parseJSDocIdentifierName(message) { if (!ts.tokenIsIdentifierOrKeyword(token())) { - return createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ !message, message || ts.Diagnostics.Identifier_expected); + return createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ !message, message || ts.Diagnostics.Identifier_expected); } var pos = scanner.getTokenPos(); var end = scanner.getTextPos(); - var result = createNode(72 /* Identifier */, pos); + var result = createNode(73 /* Identifier */, pos); result.escapedText = ts.escapeLeadingUnderscores(scanner.getTokenText()); finishNode(result, end); - nextJSDocToken(); + nextTokenJSDoc(); return result; } } @@ -22976,7 +23145,7 @@ var ts; switch (node.kind) { case 10 /* StringLiteral */: case 8 /* NumericLiteral */: - case 72 /* Identifier */: + case 73 /* Identifier */: return true; } return false; @@ -23343,28 +23512,16 @@ var ts; ts.isDeclarationFileName = isDeclarationFileName; /*@internal*/ function processCommentPragmas(context, sourceText) { - var triviaScanner = ts.createScanner(context.languageVersion, /*skipTrivia*/ false, 0 /* Standard */, sourceText); var pragmas = []; - // Keep scanning all the leading trivia in the file until we get to something that - // isn't trivia. Any single line comment will be analyzed to see if it is a - // reference comment. - while (true) { - var kind = triviaScanner.scan(); - if (!ts.isTrivia(kind)) { - break; - } - var range = { - kind: triviaScanner.getToken(), - pos: triviaScanner.getTokenPos(), - end: triviaScanner.getTextPos(), - }; + for (var _i = 0, _a = ts.getLeadingCommentRanges(sourceText, 0) || ts.emptyArray; _i < _a.length; _i++) { + var range = _a[_i]; var comment = sourceText.substring(range.pos, range.end); extractPragmas(pragmas, range, comment); } context.pragmas = ts.createMap(); - for (var _i = 0, pragmas_1 = pragmas; _i < pragmas_1.length; _i++) { - var pragma = pragmas_1[_i]; - if (context.pragmas.has(pragma.name)) { // TODO: GH#18217 + for (var _b = 0, pragmas_1 = pragmas; _b < pragmas_1.length; _b++) { + var pragma = pragmas_1[_b]; + if (context.pragmas.has(pragma.name)) { var currentValue = context.pragmas.get(pragma.name); if (currentValue instanceof Array) { currentValue.push(pragma.args); @@ -23395,7 +23552,6 @@ var ts; var typeReferenceDirectives_1 = context.typeReferenceDirectives; var libReferenceDirectives_1 = context.libReferenceDirectives; ts.forEach(ts.toArray(entryOrList), function (arg) { - // TODO: GH#18217 var _a = arg.arguments, types = _a.types, lib = _a.lib, path = _a.path; if (arg.arguments["no-default-lib"]) { context.hasNoDefaultLib = true; @@ -23416,7 +23572,7 @@ var ts; break; } case "amd-dependency": { - context.amdDependencies = ts.map(ts.toArray(entryOrList), function (x) { return ({ name: x.arguments.name, path: x.arguments.path }); }); // TODO: GH#18217 + context.amdDependencies = ts.map(ts.toArray(entryOrList), function (x) { return ({ name: x.arguments.name, path: x.arguments.path }); }); break; } case "amd-module": { @@ -23439,7 +23595,7 @@ var ts; case "ts-check": { // _last_ of either nocheck or check in a file is the "winner" ts.forEach(ts.toArray(entryOrList), function (entry) { - if (!context.checkJsDirective || entry.range.pos > context.checkJsDirective.pos) { // TODO: GH#18217 + if (!context.checkJsDirective || entry.range.pos > context.checkJsDirective.pos) { context.checkJsDirective = { enabled: key === "ts-check", end: entry.range.end, @@ -23555,10 +23711,10 @@ var ts; if (lhs.kind !== rhs.kind) { return false; } - if (lhs.kind === 72 /* Identifier */) { + if (lhs.kind === 73 /* Identifier */) { return lhs.escapedText === rhs.escapedText; } - if (lhs.kind === 100 /* ThisKeyword */) { + if (lhs.kind === 101 /* ThisKeyword */) { return true; } // If we are at this statement then we must have PropertyAccessExpression and because tag name in Jsx element can only @@ -23587,6 +23743,7 @@ var ts; ["es2017", "lib.es2017.d.ts"], ["es2018", "lib.es2018.d.ts"], ["es2019", "lib.es2019.d.ts"], + ["es2020", "lib.es2020.d.ts"], ["esnext", "lib.esnext.d.ts"], // Host only ["dom", "lib.dom.d.ts"], @@ -23615,8 +23772,11 @@ var ts; ["es2018.promise", "lib.es2018.promise.d.ts"], ["es2018.regexp", "lib.es2018.regexp.d.ts"], ["es2019.array", "lib.es2019.array.d.ts"], + ["es2019.object", "lib.es2019.object.d.ts"], ["es2019.string", "lib.es2019.string.d.ts"], ["es2019.symbol", "lib.es2019.symbol.d.ts"], + ["es2020.string", "lib.es2020.string.d.ts"], + ["es2020.symbol.wellknown", "lib.es2020.symbol.wellknown.d.ts"], ["esnext.array", "lib.es2019.array.d.ts"], ["esnext.symbol", "lib.es2019.symbol.d.ts"], ["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"], @@ -23703,6 +23863,13 @@ var ts; category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Show_verbose_diagnostic_information }, + { + name: "incremental", + shortName: "i", + type: "boolean", + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Enable_incremental_compilation, + }, ]; /* @internal */ ts.optionDeclarations = ts.commonOptionsWithBuild.concat([ @@ -23766,10 +23933,12 @@ var ts; es2017: 4 /* ES2017 */, es2018: 5 /* ES2018 */, es2019: 6 /* ES2019 */, - esnext: 7 /* ESNext */, + es2020: 7 /* ES2020 */, + esnext: 8 /* ESNext */, }), affectsSourceFile: true, affectsModuleResolution: true, + affectsEmit: true, paramType: ts.Diagnostics.VERSION, showInSimplifiedHelpView: true, category: ts.Diagnostics.Basic_Options, @@ -23837,6 +24006,7 @@ var ts; name: "declaration", shortName: "d", type: "boolean", + affectsEmit: true, showInSimplifiedHelpView: true, category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Generates_corresponding_d_ts_file, @@ -23844,6 +24014,7 @@ var ts; { name: "declarationMap", type: "boolean", + affectsEmit: true, showInSimplifiedHelpView: true, category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Generates_a_sourcemap_for_each_corresponding_d_ts_file, @@ -23851,12 +24022,14 @@ var ts; { name: "emitDeclarationOnly", type: "boolean", + affectsEmit: true, category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Only_emit_d_ts_declaration_files, }, { name: "sourceMap", type: "boolean", + affectsEmit: true, showInSimplifiedHelpView: true, category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Generates_corresponding_map_file, @@ -23864,6 +24037,7 @@ var ts; { name: "outFile", type: "string", + affectsEmit: true, isFilePath: true, paramType: ts.Diagnostics.FILE, showInSimplifiedHelpView: true, @@ -23873,6 +24047,7 @@ var ts; { name: "outDir", type: "string", + affectsEmit: true, isFilePath: true, paramType: ts.Diagnostics.DIRECTORY, showInSimplifiedHelpView: true, @@ -23882,6 +24057,7 @@ var ts; { name: "rootDir", type: "string", + affectsEmit: true, isFilePath: true, paramType: ts.Diagnostics.LOCATION, category: ts.Diagnostics.Basic_Options, @@ -23890,29 +24066,24 @@ var ts; { name: "composite", type: "boolean", + affectsEmit: true, isTSConfigOnly: true, category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Enable_project_compilation, }, - { - name: "incremental", - type: "boolean", - isTSConfigOnly: true, - category: ts.Diagnostics.Basic_Options, - description: ts.Diagnostics.Enable_incremental_compilation, - }, { name: "tsBuildInfoFile", type: "string", + affectsEmit: true, isFilePath: true, paramType: ts.Diagnostics.FILE, - isTSConfigOnly: true, category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Specify_file_to_store_incremental_compilation_information, }, { name: "removeComments", type: "boolean", + affectsEmit: true, showInSimplifiedHelpView: true, category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Do_not_emit_comments_to_output, @@ -23920,6 +24091,7 @@ var ts; { name: "noEmit", type: "boolean", + affectsEmit: true, showInSimplifiedHelpView: true, category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Do_not_emit_outputs, @@ -23927,12 +24099,14 @@ var ts; { name: "importHelpers", type: "boolean", + affectsEmit: true, category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Import_emit_helpers_from_tslib }, { name: "downlevelIteration", type: "boolean", + affectsEmit: true, category: ts.Diagnostics.Basic_Options, description: ts.Diagnostics.Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3 }, @@ -24136,10 +24310,18 @@ var ts; category: ts.Diagnostics.Module_Resolution_Options, description: ts.Diagnostics.Do_not_resolve_the_real_path_of_symlinks, }, + { + name: "allowUmdGlobalAccess", + type: "boolean", + affectsSemanticDiagnostics: true, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules, + }, // Source Maps { name: "sourceRoot", type: "string", + affectsEmit: true, paramType: ts.Diagnostics.LOCATION, category: ts.Diagnostics.Source_Map_Options, description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, @@ -24147,6 +24329,7 @@ var ts; { name: "mapRoot", type: "string", + affectsEmit: true, paramType: ts.Diagnostics.LOCATION, category: ts.Diagnostics.Source_Map_Options, description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, @@ -24154,12 +24337,14 @@ var ts; { name: "inlineSourceMap", type: "boolean", + affectsEmit: true, category: ts.Diagnostics.Source_Map_Options, description: ts.Diagnostics.Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file }, { name: "inlineSources", type: "boolean", + affectsEmit: true, category: ts.Diagnostics.Source_Map_Options, description: ts.Diagnostics.Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set }, @@ -24192,6 +24377,7 @@ var ts; { name: "out", type: "string", + affectsEmit: true, isFilePath: false, // for correct behaviour, please use outFile category: ts.Diagnostics.Advanced_Options, @@ -24201,6 +24387,7 @@ var ts; { name: "reactNamespace", type: "string", + affectsEmit: true, category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit }, @@ -24219,6 +24406,7 @@ var ts; { name: "emitBOM", type: "boolean", + affectsEmit: true, category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files }, @@ -24234,6 +24422,7 @@ var ts; crlf: 0 /* CarriageReturnLineFeed */, lf: 1 /* LineFeed */ }), + affectsEmit: true, paramType: ts.Diagnostics.NEWLINE, category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, @@ -24261,6 +24450,7 @@ var ts; { name: "stripInternal", type: "boolean", + affectsEmit: true, category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, }, @@ -24281,24 +24471,28 @@ var ts; { name: "noEmitHelpers", type: "boolean", + affectsEmit: true, category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Do_not_generate_custom_helper_functions_like_extends_in_compiled_output }, { name: "noEmitOnError", type: "boolean", + affectsEmit: true, category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported, }, { name: "preserveConstEnums", type: "boolean", + affectsEmit: true, category: ts.Diagnostics.Advanced_Options, description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code }, { name: "declarationDir", type: "string", + affectsEmit: true, isFilePath: true, paramType: ts.Diagnostics.DIRECTORY, category: ts.Diagnostics.Advanced_Options, @@ -24381,6 +24575,8 @@ var ts; /* @internal */ ts.semanticDiagnosticsOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsSemanticDiagnostics; }); /* @internal */ + ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; }); + /* @internal */ ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; }); /* @internal */ ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) { @@ -24788,7 +24984,7 @@ var ts; /** * Reads the config file, reports errors if any and exits if the config file cannot be found */ - function getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host) { + function getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host, extendedConfigCache) { var configFileText; try { configFileText = host.readFile(configFileName); @@ -24808,7 +25004,9 @@ var ts; result.path = ts.toPath(configFileName, cwd, ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames)); result.resolvedPath = result.path; result.originalFileName = result.fileName; - return parseJsonSourceFileConfigFileContent(result, host, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), cwd), optionsToExtend, ts.getNormalizedAbsolutePath(configFileName, cwd)); + return parseJsonSourceFileConfigFileContent(result, host, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), cwd), optionsToExtend, ts.getNormalizedAbsolutePath(configFileName, cwd), + /*resolutionStack*/ undefined, + /*extraFileExtension*/ undefined, extendedConfigCache); } ts.getParsedCommandLineOfConfigFile = getParsedCommandLineOfConfigFile; /** @@ -24947,7 +25145,7 @@ var ts; var result = returnValue ? {} : undefined; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 275 /* PropertyAssignment */) { + if (element.kind !== 276 /* PropertyAssignment */) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected)); continue; } @@ -25003,13 +25201,13 @@ var ts; } function convertPropertyValueToJson(valueExpression, option) { switch (valueExpression.kind) { - case 102 /* TrueKeyword */: + case 103 /* TrueKeyword */: reportInvalidOptionValue(option && option.type !== "boolean"); return true; - case 87 /* FalseKeyword */: + case 88 /* FalseKeyword */: reportInvalidOptionValue(option && option.type !== "boolean"); return false; - case 96 /* NullKeyword */: + case 97 /* NullKeyword */: reportInvalidOptionValue(option && option.name === "extends"); // "extends" is the only option we don't allow null/undefined for return null; // tslint:disable-line:no-null-keyword case 10 /* StringLiteral */: @@ -25029,13 +25227,13 @@ var ts; case 8 /* NumericLiteral */: reportInvalidOptionValue(option && option.type !== "number"); return Number(valueExpression.text); - case 202 /* PrefixUnaryExpression */: + case 203 /* PrefixUnaryExpression */: if (valueExpression.operator !== 39 /* MinusToken */ || valueExpression.operand.kind !== 8 /* NumericLiteral */) { break; // not valid JSON syntax } reportInvalidOptionValue(option && option.type !== "number"); return -Number(valueExpression.operand.text); - case 188 /* ObjectLiteralExpression */: + case 189 /* ObjectLiteralExpression */: reportInvalidOptionValue(option && option.type !== "object"); var objectLiteralExpression = valueExpression; // Currently having element option declaration in the tsconfig with type "object" @@ -25052,7 +25250,7 @@ var ts; return convertObjectLiteralExpressionToJson(objectLiteralExpression, /* knownOptions*/ undefined, /*extraKeyDiagnosticMessage */ undefined, /*parentOption*/ undefined); } - case 187 /* ArrayLiteralExpression */: + case 188 /* ArrayLiteralExpression */: reportInvalidOptionValue(option && option.type !== "list"); return convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element); } @@ -25308,8 +25506,8 @@ var ts; * @param basePath A root directory to resolve relative path entries in the config * file to. e.g. outDir */ - function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) { - return parseJsonConfigFileContentWorker(json, /*sourceFile*/ undefined, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions); + function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache) { + return parseJsonConfigFileContentWorker(json, /*sourceFile*/ undefined, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache); } ts.parseJsonConfigFileContent = parseJsonConfigFileContent; /** @@ -25319,8 +25517,8 @@ var ts; * @param basePath A root directory to resolve relative path entries in the config * file to. e.g. outDir */ - function parseJsonSourceFileConfigFileContent(sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) { - return parseJsonConfigFileContentWorker(/*json*/ undefined, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions); + function parseJsonSourceFileConfigFileContent(sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache) { + return parseJsonConfigFileContentWorker(/*json*/ undefined, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache); } ts.parseJsonSourceFileConfigFileContent = parseJsonSourceFileConfigFileContent; /*@internal*/ @@ -25348,13 +25546,13 @@ var ts; * file to. e.g. outDir * @param resolutionStack Only present for backwards-compatibility. Should be empty. */ - function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) { + function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache) { if (existingOptions === void 0) { existingOptions = {}; } if (resolutionStack === void 0) { resolutionStack = []; } if (extraFileExtensions === void 0) { extraFileExtensions = []; } ts.Debug.assert((json === undefined && sourceFile !== undefined) || (json !== undefined && sourceFile === undefined)); var errors = []; - var parsedConfig = parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors); + var parsedConfig = parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors, extendedConfigCache); var raw = parsedConfig.raw; var options = ts.extend(existingOptions, parsedConfig.options || {}); options.configFilePath = configFileName && ts.normalizeSlashes(configFileName); @@ -25494,7 +25692,7 @@ var ts; * This *just* extracts options/include/exclude/files out of a config file. * It does *not* resolve the included files. */ - function parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors) { + function parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors, extendedConfigCache) { basePath = ts.normalizeSlashes(basePath); var resolvedPath = ts.getNormalizedAbsolutePath(configFileName || "", basePath); if (resolutionStack.indexOf(resolvedPath) >= 0) { @@ -25507,7 +25705,7 @@ var ts; if (ownConfig.extendedConfigPath) { // copy the resolution stack so it is never reused between branches in potential diamond-problem scenarios. resolutionStack = resolutionStack.concat([resolvedPath]); - var extendedConfig = getExtendedConfig(sourceFile, ownConfig.extendedConfigPath, host, basePath, resolutionStack, errors); + var extendedConfig = getExtendedConfig(sourceFile, ownConfig.extendedConfigPath, host, basePath, resolutionStack, errors, extendedConfigCache); if (extendedConfig && isSuccessfulParsedTsconfig(extendedConfig)) { var baseRaw_1 = extendedConfig.raw; var raw_1 = ownConfig.raw; @@ -25604,7 +25802,7 @@ var ts; if (!host.fileExists(extendedConfigPath) && !ts.endsWith(extendedConfigPath, ".json" /* Json */)) { extendedConfigPath = extendedConfigPath + ".json"; if (!host.fileExists(extendedConfigPath)) { - errors.push(createDiagnostic(ts.Diagnostics.File_0_does_not_exist, extendedConfig)); + errors.push(createDiagnostic(ts.Diagnostics.File_0_not_found, extendedConfig)); return undefined; } } @@ -25615,38 +25813,52 @@ var ts; if (resolved.resolvedModule) { return resolved.resolvedModule.resolvedFileName; } - errors.push(createDiagnostic(ts.Diagnostics.File_0_does_not_exist, extendedConfig)); + errors.push(createDiagnostic(ts.Diagnostics.File_0_not_found, extendedConfig)); return undefined; } - function getExtendedConfig(sourceFile, extendedConfigPath, host, basePath, resolutionStack, errors) { + function getExtendedConfig(sourceFile, extendedConfigPath, host, basePath, resolutionStack, errors, extendedConfigCache) { var _a; - var extendedResult = readJsonConfigFile(extendedConfigPath, function (path) { return host.readFile(path); }); + var path = host.useCaseSensitiveFileNames ? extendedConfigPath : ts.toLowerCase(extendedConfigPath); + var value; + var extendedResult; + var extendedConfig; + if (extendedConfigCache && (value = extendedConfigCache.get(path))) { + (extendedResult = value.extendedResult, extendedConfig = value.extendedConfig); + } + else { + extendedResult = readJsonConfigFile(extendedConfigPath, function (path) { return host.readFile(path); }); + if (!extendedResult.parseDiagnostics.length) { + var extendedDirname = ts.getDirectoryPath(extendedConfigPath); + extendedConfig = parseConfig(/*json*/ undefined, extendedResult, host, extendedDirname, ts.getBaseFileName(extendedConfigPath), resolutionStack, errors, extendedConfigCache); + if (isSuccessfulParsedTsconfig(extendedConfig)) { + // Update the paths to reflect base path + var relativeDifference_1 = ts.convertToRelativePath(extendedDirname, basePath, ts.identity); + var updatePath_1 = function (path) { return ts.isRootedDiskPath(path) ? path : ts.combinePaths(relativeDifference_1, path); }; + var mapPropertiesInRawIfNotUndefined = function (propertyName) { + if (raw_2[propertyName]) { + raw_2[propertyName] = ts.map(raw_2[propertyName], updatePath_1); + } + }; + var raw_2 = extendedConfig.raw; + mapPropertiesInRawIfNotUndefined("include"); + mapPropertiesInRawIfNotUndefined("exclude"); + mapPropertiesInRawIfNotUndefined("files"); + } + } + if (extendedConfigCache) { + extendedConfigCache.set(path, { extendedResult: extendedResult, extendedConfig: extendedConfig }); + } + } if (sourceFile) { sourceFile.extendedSourceFiles = [extendedResult.fileName]; + if (extendedResult.extendedSourceFiles) { + (_a = sourceFile.extendedSourceFiles).push.apply(_a, extendedResult.extendedSourceFiles); + } } if (extendedResult.parseDiagnostics.length) { errors.push.apply(errors, extendedResult.parseDiagnostics); return undefined; } - var extendedDirname = ts.getDirectoryPath(extendedConfigPath); - var extendedConfig = parseConfig(/*json*/ undefined, extendedResult, host, extendedDirname, ts.getBaseFileName(extendedConfigPath), resolutionStack, errors); - if (sourceFile && extendedResult.extendedSourceFiles) { - (_a = sourceFile.extendedSourceFiles).push.apply(_a, extendedResult.extendedSourceFiles); - } - if (isSuccessfulParsedTsconfig(extendedConfig)) { - // Update the paths to reflect base path - var relativeDifference_1 = ts.convertToRelativePath(extendedDirname, basePath, ts.identity); - var updatePath_1 = function (path) { return ts.isRootedDiskPath(path) ? path : ts.combinePaths(relativeDifference_1, path); }; - var mapPropertiesInRawIfNotUndefined = function (propertyName) { - if (raw_2[propertyName]) { - raw_2[propertyName] = ts.map(raw_2[propertyName], updatePath_1); - } - }; - var raw_2 = extendedConfig.raw; - mapPropertiesInRawIfNotUndefined("include"); - mapPropertiesInRawIfNotUndefined("exclude"); - mapPropertiesInRawIfNotUndefined("files"); - } return extendedConfig; } function convertCompileOnSaveOptionFromJson(jsonOption, basePath, errors) { @@ -26116,11 +26328,22 @@ var ts; return !!compilerOptions.traceResolution && host.trace !== undefined; } ts.isTraceEnabled = isTraceEnabled; - function withPackageId(packageId, r) { + function withPackageId(packageInfo, r) { + var packageId; + if (r && packageInfo) { + var packageJsonContent = packageInfo.packageJsonContent; + if (typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string") { + packageId = { + name: packageJsonContent.name, + subModuleName: r.path.slice(packageInfo.packageDirectory.length + ts.directorySeparator.length), + version: packageJsonContent.version + }; + } + } return r && { path: r.path, extension: r.ext, packageId: packageId }; } function noPackageId(r) { - return withPackageId(/*packageId*/ undefined, r); + return withPackageId(/*packageInfo*/ undefined, r); } function removeIgnoredPackageId(r) { if (r) { @@ -26172,8 +26395,15 @@ var ts; } function readPackageJsonPathField(jsonContent, fieldName, baseDirectory, state) { var fileName = readPackageJsonField(jsonContent, fieldName, "string", state); - if (fileName === undefined) + if (fileName === undefined) { return; + } + if (!fileName) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_had_a_falsy_0_field, fieldName); + } + return; + } var path = ts.normalizePath(ts.combinePaths(baseDirectory, fileName)); if (state.traceEnabled) { trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, fileName, path); @@ -26326,7 +26556,12 @@ var ts; var fileName = resolved.fileName, packageId = resolved.packageId; var resolvedFileName = options.preserveSymlinks ? fileName : realPath(fileName, host, traceEnabled); if (traceEnabled) { - trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFileName, primary); + if (packageId) { + trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3, typeReferenceDirectiveName, resolvedFileName, ts.packageIdToString(packageId), primary); + } + else { + trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFileName, primary); + } } resolvedTypeReferenceDirective = { primary: primary, resolvedFileName: resolvedFileName, packageId: packageId, isExternalLibraryImport: pathContainsNodeModules(fileName) }; } @@ -26428,20 +26663,28 @@ var ts; return result; } ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames; - function createModuleResolutionCache(currentDirectory, getCanonicalFileName) { - return createModuleResolutionCacheWithMaps(createCacheWithRedirects(), createCacheWithRedirects(), currentDirectory, getCanonicalFileName); + function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options) { + return createModuleResolutionCacheWithMaps(createCacheWithRedirects(options), createCacheWithRedirects(options), currentDirectory, getCanonicalFileName); } ts.createModuleResolutionCache = createModuleResolutionCache; /*@internal*/ - function createCacheWithRedirects() { + function createCacheWithRedirects(options) { var ownMap = ts.createMap(); var redirectsMap = ts.createMap(); return { ownMap: ownMap, redirectsMap: redirectsMap, getOrCreateMapOfCacheRedirects: getOrCreateMapOfCacheRedirects, - clear: clear + clear: clear, + setOwnOptions: setOwnOptions, + setOwnMap: setOwnMap }; + function setOwnOptions(newOptions) { + options = newOptions; + } + function setOwnMap(newOwnMap) { + ownMap = newOwnMap; + } function getOrCreateMapOfCacheRedirects(redirectedReference) { if (!redirectedReference) { return ownMap; @@ -26449,7 +26692,8 @@ var ts; var path = redirectedReference.sourceFile.path; var redirects = redirectsMap.get(path); if (!redirects) { - redirects = ts.createMap(); + // Reuse map if redirected reference map uses same resolution + redirects = !options || ts.optionsHaveModuleResolutionChanges(options, redirectedReference.commandLine.options) ? ts.createMap() : ownMap; redirectsMap.set(path, redirects); } return redirects; @@ -26462,7 +26706,7 @@ var ts; ts.createCacheWithRedirects = createCacheWithRedirects; /*@internal*/ function createModuleResolutionCacheWithMaps(directoryToModuleNameMap, moduleNameToDirectoryMap, currentDirectory, getCanonicalFileName) { - return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName }; + return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName, directoryToModuleNameMap: directoryToModuleNameMap, moduleNameToDirectoryMap: moduleNameToDirectoryMap }; function getOrCreateCacheForDirectory(directoryName, redirectedReference) { var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName); return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, ts.createMap); @@ -26605,7 +26849,12 @@ var ts; } if (traceEnabled) { if (result.resolvedModule) { - trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName); + if (result.resolvedModule.packageId) { + trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2, moduleName, result.resolvedModule.resolvedFileName, ts.packageIdToString(result.resolvedModule.packageId)); + } + else { + trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName); + } } else { trace(host, ts.Diagnostics.Module_name_0_was_not_resolved, moduleName); @@ -26875,10 +27124,9 @@ var ts; } var resolvedFromFile = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state); if (resolvedFromFile) { - var nm = considerPackageJson ? parseNodeModuleFromPath(resolvedFromFile) : undefined; - var packageInfo = nm && getPackageJsonInfo(nm.packageDirectory, nm.subModuleName, /*onlyRecordFailures*/ false, state); - var packageId = packageInfo && packageInfo.packageId; - return withPackageId(packageId, resolvedFromFile); + var packageDirectory = considerPackageJson ? parseNodeModuleFromPath(resolvedFromFile) : undefined; + var packageInfo = packageDirectory ? getPackageJsonInfo(packageDirectory, /*onlyRecordFailures*/ false, state) : undefined; + return withPackageId(packageInfo, resolvedFromFile); } } if (!onlyRecordFailures) { @@ -26904,11 +27152,10 @@ var ts; * (Not neeeded for `loadModuleFromNodeModules` as that looks up the `package.json` as part of resolution.) * * packageDirectory is the directory of the package itself. - * subModuleName is the path within the package. - * For `blah/node_modules/foo/index.d.ts` this is { packageDirectory: "foo", subModuleName: "index.d.ts" }. (Part before "/node_modules/" is ignored.) - * For `/node_modules/foo/bar.d.ts` this is { packageDirectory: "foo", subModuleName": "bar/index.d.ts" }. - * For `/node_modules/@types/foo/bar/index.d.ts` this is { packageDirectory: "@types/foo", subModuleName: "bar/index.d.ts" }. - * For `/node_modules/foo/bar/index.d.ts` this is { packageDirectory: "foo", subModuleName": "bar/index.d.ts" }. + * For `blah/node_modules/foo/index.d.ts` this is packageDirectory: "foo" + * For `/node_modules/foo/bar.d.ts` this is packageDirectory: "foo" + * For `/node_modules/@types/foo/bar/index.d.ts` this is packageDirectory: "@types/foo" + * For `/node_modules/foo/bar/index.d.ts` this is packageDirectory: "foo" */ function parseNodeModuleFromPath(resolved) { var path = ts.normalizePath(resolved.path); @@ -26921,26 +27168,12 @@ var ts; if (path.charCodeAt(indexAfterNodeModules) === 64 /* at */) { indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterPackageName); } - var packageDirectory = path.slice(0, indexAfterPackageName); - var subModuleName = ts.removeExtension(path.slice(indexAfterPackageName + 1), resolved.ext) + ".d.ts" /* Dts */; - return { packageDirectory: packageDirectory, subModuleName: subModuleName }; + return path.slice(0, indexAfterPackageName); } function moveToNextDirectorySeparatorIfAvailable(path, prevSeparatorIndex) { var nextSeparatorIndex = path.indexOf(ts.directorySeparator, prevSeparatorIndex + 1); return nextSeparatorIndex === -1 ? prevSeparatorIndex : nextSeparatorIndex; } - function addExtensionAndIndex(path) { - if (path === "") { - return "index.d.ts"; - } - if (ts.endsWith(path, ".d.ts")) { - return path; - } - if (path === "index" || ts.endsWith(path, "/index")) { - return path + ".d.ts"; - } - return path + "/index.d.ts"; - } function loadModuleFromFileNoPackageId(extensions, candidate, onlyRecordFailures, state) { return noPackageId(loadModuleFromFile(extensions, candidate, onlyRecordFailures, state)); } @@ -27014,52 +27247,22 @@ var ts; } function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson) { if (considerPackageJson === void 0) { considerPackageJson = true; } - var packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, "", onlyRecordFailures, state) : undefined; - var packageId = packageInfo && packageInfo.packageId; + var packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : undefined; var packageJsonContent = packageInfo && packageInfo.packageJsonContent; - var versionPaths = packageJsonContent && readPackageJsonTypesVersionPaths(packageJsonContent, state); - return withPackageId(packageId, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths)); + var versionPaths = packageInfo && packageInfo.versionPaths; + return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths)); } - function getPackageJsonInfo(packageDirectory, subModuleName, onlyRecordFailures, state) { + function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) { var host = state.host, traceEnabled = state.traceEnabled; var directoryExists = !onlyRecordFailures && ts.directoryProbablyExists(packageDirectory, host); var packageJsonPath = ts.combinePaths(packageDirectory, "package.json"); if (directoryExists && host.fileExists(packageJsonPath)) { var packageJsonContent = ts.readJson(packageJsonPath, host); - if (subModuleName === "") { // looking up the root - need to handle types/typings/main redirects for subModuleName - var path = readPackageJsonTypesFields(packageJsonContent, packageDirectory, state); - if (typeof path === "string") { - subModuleName = addExtensionAndIndex(path.substring(packageDirectory.length + 1)); - } - else { - var jsPath = readPackageJsonMainField(packageJsonContent, packageDirectory, state); - if (typeof jsPath === "string" && jsPath.length > packageDirectory.length) { - var potentialSubModule_1 = jsPath.substring(packageDirectory.length + 1); - subModuleName = (ts.forEach(ts.supportedJSExtensions, function (extension) { - return ts.tryRemoveExtension(potentialSubModule_1, extension); - }) || potentialSubModule_1) + ".d.ts" /* Dts */; - } - else { - subModuleName = "index.d.ts"; - } - } - } - if (!ts.endsWith(subModuleName, ".d.ts" /* Dts */)) { - subModuleName = addExtensionAndIndex(subModuleName); + if (traceEnabled) { + trace(host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); } var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state); - var packageId = typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string" - ? { name: packageJsonContent.name, subModuleName: subModuleName, version: packageJsonContent.version } - : undefined; - if (traceEnabled) { - if (packageId) { - trace(host, ts.Diagnostics.Found_package_json_at_0_Package_ID_is_1, packageJsonPath, ts.packageIdToString(packageId)); - } - else { - trace(host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); - } - } - return { packageJsonContent: packageJsonContent, packageId: packageId, versionPaths: versionPaths }; + return { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths }; } else { if (directoryExists && traceEnabled) { @@ -27198,37 +27401,31 @@ var ts; function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state) { var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName)); // First look for a nested package.json, as in `node_modules/foo/bar/package.json`. - var packageJsonContent; - var packageId; - var versionPaths; - var packageInfo = getPackageJsonInfo(candidate, "", !nodeModulesDirectoryExists, state); + var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state); if (packageInfo) { - (packageJsonContent = packageInfo.packageJsonContent, packageId = packageInfo.packageId, versionPaths = packageInfo.versionPaths); var fromFile = loadModuleFromFile(extensions, candidate, !nodeModulesDirectoryExists, state); if (fromFile) { return noPackageId(fromFile); } - var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageJsonContent, versionPaths); - return withPackageId(packageId, fromDirectory); + var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.packageJsonContent, packageInfo.versionPaths); + return withPackageId(packageInfo, fromDirectory); } var loader = function (extensions, candidate, onlyRecordFailures, state) { var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) || - loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths); - return withPackageId(packageId, pathAndExtension); + loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths); + return withPackageId(packageInfo, pathAndExtension); }; var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest; if (rest !== "") { // If "rest" is empty, we just did this search above. var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName); // Don't use a "types" or "main" from here because we're not loading the root, but a subdirectory -- just here for the packageId and path mappings. - var packageInfo_1 = getPackageJsonInfo(packageDirectory, rest, !nodeModulesDirectoryExists, state); - if (packageInfo_1) - (packageId = packageInfo_1.packageId, versionPaths = packageInfo_1.versionPaths); - if (versionPaths) { + packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state); + if (packageInfo && packageInfo.versionPaths) { if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, versionPaths.version, ts.version, rest); + trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.versionPaths.version, ts.version, rest); } var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host); - var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, versionPaths.paths, loader, !packageDirectoryExists, state); + var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.versionPaths.paths, loader, !packageDirectoryExists, state); if (fromPaths) { return fromPaths.value; } @@ -27396,24 +27593,24 @@ var ts; // A module is uninstantiated if it contains only switch (node.kind) { // 1. interface declarations, type alias declarations - case 241 /* InterfaceDeclaration */: - case 242 /* TypeAliasDeclaration */: + case 242 /* InterfaceDeclaration */: + case 243 /* TypeAliasDeclaration */: return 0 /* NonInstantiated */; // 2. const enum declarations - case 243 /* EnumDeclaration */: + case 244 /* EnumDeclaration */: if (ts.isEnumConst(node)) { return 2 /* ConstEnumOnly */; } break; // 3. non-exported import declarations - case 249 /* ImportDeclaration */: - case 248 /* ImportEqualsDeclaration */: + case 250 /* ImportDeclaration */: + case 249 /* ImportEqualsDeclaration */: if (!(ts.hasModifier(node, 1 /* Export */))) { return 0 /* NonInstantiated */; } break; // 4. other uninstantiated module declarations. - case 245 /* ModuleBlock */: { + case 246 /* ModuleBlock */: { var state_1 = 0 /* NonInstantiated */; ts.forEachChild(node, function (n) { var childState = getModuleInstanceStateWorker(n); @@ -27435,9 +27632,9 @@ var ts; }); return state_1; } - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: return getModuleInstanceState(node); - case 72 /* Identifier */: + case 73 /* Identifier */: // Only jsdoc typedef definition can exist in jsdoc namespace, and it should // be considered the same as type alias if (node.isInJSDocNamespace) { @@ -27603,7 +27800,7 @@ var ts; // Should not be called on a declaration with a computed property name, // unless it is a well known Symbol. function getDeclarationName(node) { - if (node.kind === 254 /* ExportAssignment */) { + if (node.kind === 255 /* ExportAssignment */) { return node.isExportEquals ? "export=" /* ExportEquals */ : "default" /* Default */; } var name = ts.getNameOfDeclaration(node); @@ -27612,7 +27809,7 @@ var ts; var moduleName = ts.getTextOfIdentifierOrLiteral(name); return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + moduleName + "\""); } - if (name.kind === 149 /* ComputedPropertyName */) { + if (name.kind === 150 /* ComputedPropertyName */) { var nameExpression = name.expression; // treat computed property names where expression is string/numeric literal as just string/numeric literal if (ts.isStringOrNumericLiteralLike(nameExpression)) { @@ -27624,36 +27821,36 @@ var ts; return ts.isPropertyNameLiteral(name) ? ts.getEscapedTextOfIdentifierOrLiteral(name) : undefined; } switch (node.kind) { - case 157 /* Constructor */: + case 158 /* Constructor */: return "__constructor" /* Constructor */; - case 165 /* FunctionType */: - case 160 /* CallSignature */: - case 298 /* JSDocSignature */: + case 166 /* FunctionType */: + case 161 /* CallSignature */: + case 299 /* JSDocSignature */: return "__call" /* Call */; - case 166 /* ConstructorType */: - case 161 /* ConstructSignature */: + case 167 /* ConstructorType */: + case 162 /* ConstructSignature */: return "__new" /* New */; - case 162 /* IndexSignature */: + case 163 /* IndexSignature */: return "__index" /* Index */; - case 255 /* ExportDeclaration */: + case 256 /* ExportDeclaration */: return "__export" /* ExportStar */; - case 284 /* SourceFile */: + case 285 /* SourceFile */: // json file should behave as // module.exports = ... return "export=" /* ExportEquals */; - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: if (ts.getAssignmentDeclarationKind(node) === 2 /* ModuleExports */) { // module.exports = ... return "export=" /* ExportEquals */; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 294 /* JSDocFunctionType */: + case 295 /* JSDocFunctionType */: return (ts.isJSDocConstructSignature(node) ? "__new" /* New */ : "__call" /* Call */); - case 151 /* Parameter */: + case 152 /* Parameter */: // Parameters with names are handled at the top of this function. Parameters // without names can only come from JSDocFunctionTypes. - ts.Debug.assert(node.parent.kind === 294 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; }); + ts.Debug.assert(node.parent.kind === 295 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; }); var functionType = node.parent; var index = functionType.parameters.indexOf(node); return "arg" + index; @@ -27753,7 +27950,7 @@ var ts; // 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default // 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers) if (symbol.declarations && symbol.declarations.length && - (node.kind === 254 /* ExportAssignment */ && !node.isExportEquals)) { + (node.kind === 255 /* ExportAssignment */ && !node.isExportEquals)) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; messageNeedsName_1 = false; multipleDefaultExports_1 = true; @@ -27788,7 +27985,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedModifierFlags(node) & 1 /* Export */; if (symbolFlags & 2097152 /* Alias */) { - if (node.kind === 257 /* ExportSpecifier */ || (node.kind === 248 /* ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 258 /* ExportSpecifier */ || (node.kind === 249 /* ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -27855,7 +28052,7 @@ var ts; // for it. We must clear this so we don't accidentally move any stale data forward from // a previous compilation. if (containerFlags & 1 /* IsContainer */) { - if (node.kind !== 197 /* ArrowFunction */) { + if (node.kind !== 198 /* ArrowFunction */) { thisParentContainer = container; } container = blockScopeContainer = node; @@ -27888,7 +28085,7 @@ var ts; } // We create a return control flow graph for IIFEs and constructors. For constructors // we use the return control flow graph in strict property initialization checks. - currentReturnTarget = isIIFE || node.kind === 157 /* Constructor */ ? createBranchLabel() : undefined; + currentReturnTarget = isIIFE || node.kind === 158 /* Constructor */ ? createBranchLabel() : undefined; currentBreakTarget = undefined; currentContinueTarget = undefined; activeLabels = undefined; @@ -27902,13 +28099,13 @@ var ts; if (hasExplicitReturn) node.flags |= 256 /* HasExplicitReturn */; } - if (node.kind === 284 /* SourceFile */) { + if (node.kind === 285 /* SourceFile */) { node.flags |= emitFlags; } if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); currentFlow = finishFlowLabel(currentReturnTarget); - if (node.kind === 157 /* Constructor */) { + if (node.kind === 158 /* Constructor */) { node.returnFlowNode = currentFlow; } } @@ -27952,8 +28149,8 @@ var ts; } } function bindEachFunctionsFirst(nodes) { - bindEach(nodes, function (n) { return n.kind === 239 /* FunctionDeclaration */ ? bind(n) : undefined; }); - bindEach(nodes, function (n) { return n.kind !== 239 /* FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind === 240 /* FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind !== 240 /* FunctionDeclaration */ ? bind(n) : undefined; }); } function bindEach(nodes, bindFunction) { if (bindFunction === void 0) { bindFunction = bind; } @@ -27986,78 +28183,78 @@ var ts; return; } switch (node.kind) { - case 224 /* WhileStatement */: + case 225 /* WhileStatement */: bindWhileStatement(node); break; - case 223 /* DoStatement */: + case 224 /* DoStatement */: bindDoStatement(node); break; - case 225 /* ForStatement */: + case 226 /* ForStatement */: bindForStatement(node); break; - case 226 /* ForInStatement */: - case 227 /* ForOfStatement */: + case 227 /* ForInStatement */: + case 228 /* ForOfStatement */: bindForInOrForOfStatement(node); break; - case 222 /* IfStatement */: + case 223 /* IfStatement */: bindIfStatement(node); break; - case 230 /* ReturnStatement */: - case 234 /* ThrowStatement */: + case 231 /* ReturnStatement */: + case 235 /* ThrowStatement */: bindReturnOrThrow(node); break; - case 229 /* BreakStatement */: - case 228 /* ContinueStatement */: + case 230 /* BreakStatement */: + case 229 /* ContinueStatement */: bindBreakOrContinueStatement(node); break; - case 235 /* TryStatement */: + case 236 /* TryStatement */: bindTryStatement(node); break; - case 232 /* SwitchStatement */: + case 233 /* SwitchStatement */: bindSwitchStatement(node); break; - case 246 /* CaseBlock */: + case 247 /* CaseBlock */: bindCaseBlock(node); break; - case 271 /* CaseClause */: + case 272 /* CaseClause */: bindCaseClause(node); break; - case 233 /* LabeledStatement */: + case 234 /* LabeledStatement */: bindLabeledStatement(node); break; - case 202 /* PrefixUnaryExpression */: + case 203 /* PrefixUnaryExpression */: bindPrefixUnaryExpressionFlow(node); break; - case 203 /* PostfixUnaryExpression */: + case 204 /* PostfixUnaryExpression */: bindPostfixUnaryExpressionFlow(node); break; - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: bindBinaryExpressionFlow(node); break; - case 198 /* DeleteExpression */: + case 199 /* DeleteExpression */: bindDeleteExpressionFlow(node); break; - case 205 /* ConditionalExpression */: + case 206 /* ConditionalExpression */: bindConditionalExpressionFlow(node); break; - case 237 /* VariableDeclaration */: + case 238 /* VariableDeclaration */: bindVariableDeclarationFlow(node); break; - case 191 /* CallExpression */: + case 192 /* CallExpression */: bindCallExpressionFlow(node); break; - case 309 /* JSDocTypedefTag */: - case 302 /* JSDocCallbackTag */: + case 310 /* JSDocTypedefTag */: + case 303 /* JSDocCallbackTag */: bindJSDocTypeAlias(node); break; // In source files and blocks, bind functions first to match hoisting that occurs at runtime - case 284 /* SourceFile */: { + case 285 /* SourceFile */: { bindEachFunctionsFirst(node.statements); bind(node.endOfFileToken); break; } - case 218 /* Block */: - case 245 /* ModuleBlock */: + case 219 /* Block */: + case 246 /* ModuleBlock */: bindEachFunctionsFirst(node.statements); break; default: @@ -28068,26 +28265,26 @@ var ts; } function isNarrowingExpression(expr) { switch (expr.kind) { - case 72 /* Identifier */: - case 100 /* ThisKeyword */: - case 189 /* PropertyAccessExpression */: - case 190 /* ElementAccessExpression */: + case 73 /* Identifier */: + case 101 /* ThisKeyword */: + case 190 /* PropertyAccessExpression */: + case 191 /* ElementAccessExpression */: return isNarrowableReference(expr); - case 191 /* CallExpression */: + case 192 /* CallExpression */: return hasNarrowableArgument(expr); - case 195 /* ParenthesizedExpression */: + case 196 /* ParenthesizedExpression */: return isNarrowingExpression(expr.expression); - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: return isNarrowingBinaryExpression(expr); - case 202 /* PrefixUnaryExpression */: + case 203 /* PrefixUnaryExpression */: return expr.operator === 52 /* ExclamationToken */ && isNarrowingExpression(expr.operand); - case 199 /* TypeOfExpression */: + case 200 /* TypeOfExpression */: return isNarrowingExpression(expr.expression); } return false; } function isNarrowableReference(expr) { - return expr.kind === 72 /* Identifier */ || expr.kind === 100 /* ThisKeyword */ || expr.kind === 98 /* SuperKeyword */ || + return expr.kind === 73 /* Identifier */ || expr.kind === 101 /* ThisKeyword */ || expr.kind === 99 /* SuperKeyword */ || (ts.isPropertyAccessExpression(expr) || ts.isNonNullExpression(expr) || ts.isParenthesizedExpression(expr)) && isNarrowableReference(expr.expression) || ts.isElementAccessExpression(expr) && expr.argumentExpression && (ts.isStringLiteral(expr.argumentExpression) || ts.isNumericLiteral(expr.argumentExpression)) && @@ -28102,7 +28299,7 @@ var ts; } } } - if (expr.expression.kind === 189 /* PropertyAccessExpression */ && + if (expr.expression.kind === 190 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression.expression)) { return true; } @@ -28116,7 +28313,7 @@ var ts; } function isNarrowingBinaryExpression(expr) { switch (expr.operatorToken.kind) { - case 59 /* EqualsToken */: + case 60 /* EqualsToken */: return isNarrowableReference(expr.left); case 33 /* EqualsEqualsToken */: case 34 /* ExclamationEqualsToken */: @@ -28124,9 +28321,9 @@ var ts; case 36 /* ExclamationEqualsEqualsToken */: return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) || isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right); - case 94 /* InstanceOfKeyword */: + case 95 /* InstanceOfKeyword */: return isNarrowableOperand(expr.left); - case 93 /* InKeyword */: + case 94 /* InKeyword */: return isNarrowableInOperands(expr.left, expr.right); case 27 /* CommaToken */: return isNarrowingExpression(expr.right); @@ -28135,11 +28332,11 @@ var ts; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 195 /* ParenthesizedExpression */: + case 196 /* ParenthesizedExpression */: return isNarrowableOperand(expr.expression); - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: switch (expr.operatorToken.kind) { - case 59 /* EqualsToken */: + case 60 /* EqualsToken */: return isNarrowableOperand(expr.left); case 27 /* CommaToken */: return isNarrowableOperand(expr.right); @@ -28176,8 +28373,8 @@ var ts; if (!expression) { return flags & 32 /* TrueCondition */ ? antecedent : unreachableFlow; } - if (expression.kind === 102 /* TrueKeyword */ && flags & 64 /* FalseCondition */ || - expression.kind === 87 /* FalseKeyword */ && flags & 32 /* TrueCondition */) { + if (expression.kind === 103 /* TrueKeyword */ && flags & 64 /* FalseCondition */ || + expression.kind === 88 /* FalseKeyword */ && flags & 32 /* TrueCondition */) { return unreachableFlow; } if (!isNarrowingExpression(expression)) { @@ -28215,33 +28412,33 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 222 /* IfStatement */: - case 224 /* WhileStatement */: - case 223 /* DoStatement */: + case 223 /* IfStatement */: + case 225 /* WhileStatement */: + case 224 /* DoStatement */: return parent.expression === node; - case 225 /* ForStatement */: - case 205 /* ConditionalExpression */: + case 226 /* ForStatement */: + case 206 /* ConditionalExpression */: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 195 /* ParenthesizedExpression */) { + if (node.kind === 196 /* ParenthesizedExpression */) { node = node.expression; } - else if (node.kind === 202 /* PrefixUnaryExpression */ && node.operator === 52 /* ExclamationToken */) { + else if (node.kind === 203 /* PrefixUnaryExpression */ && node.operator === 52 /* ExclamationToken */) { node = node.operand; } else { - return node.kind === 204 /* BinaryExpression */ && (node.operatorToken.kind === 54 /* AmpersandAmpersandToken */ || + return node.kind === 205 /* BinaryExpression */ && (node.operatorToken.kind === 54 /* AmpersandAmpersandToken */ || node.operatorToken.kind === 55 /* BarBarToken */); } } } function isTopLevelLogicalExpression(node) { - while (node.parent.kind === 195 /* ParenthesizedExpression */ || - node.parent.kind === 202 /* PrefixUnaryExpression */ && + while (node.parent.kind === 196 /* ParenthesizedExpression */ || + node.parent.kind === 203 /* PrefixUnaryExpression */ && node.parent.operator === 52 /* ExclamationToken */) { node = node.parent; } @@ -28283,7 +28480,7 @@ var ts; } function bindDoStatement(node) { var preDoLabel = createLoopLabel(); - var enclosingLabeledStatement = node.parent.kind === 233 /* LabeledStatement */ + var enclosingLabeledStatement = node.parent.kind === 234 /* LabeledStatement */ ? ts.lastOrUndefined(activeLabels) : undefined; // if do statement is wrapped in labeled statement then target labels for break/continue with or without @@ -28317,13 +28514,13 @@ var ts; var postLoopLabel = createBranchLabel(); addAntecedent(preLoopLabel, currentFlow); currentFlow = preLoopLabel; - if (node.kind === 227 /* ForOfStatement */) { + if (node.kind === 228 /* ForOfStatement */) { bind(node.awaitModifier); } bind(node.expression); addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 238 /* VariableDeclarationList */) { + if (node.initializer.kind !== 239 /* VariableDeclarationList */) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -28345,7 +28542,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 230 /* ReturnStatement */) { + if (node.kind === 231 /* ReturnStatement */) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -28365,7 +28562,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 229 /* BreakStatement */ ? breakTarget : continueTarget; + var flowLabel = node.kind === 230 /* BreakStatement */ ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -28493,7 +28690,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 272 /* DefaultClause */; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 273 /* DefaultClause */; }); // We mark a switch statement as possibly exhaustive if it has no default clause and if all // case clauses have unreachable end points (e.g. they all return). node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; @@ -28560,14 +28757,14 @@ var ts; if (!activeLabel.referenced && !options.allowUnusedLabels) { errorOrSuggestionOnNode(ts.unusedLabelIsError(options), node.label, ts.Diagnostics.Unused_label); } - if (!node.statement || node.statement.kind !== 223 /* DoStatement */) { + if (!node.statement || node.statement.kind !== 224 /* DoStatement */) { // do statement sets current flow inside bindDoStatement addAntecedent(postStatementLabel, currentFlow); currentFlow = finishFlowLabel(postStatementLabel); } } function bindDestructuringTargetFlow(node) { - if (node.kind === 204 /* BinaryExpression */ && node.operatorToken.kind === 59 /* EqualsToken */) { + if (node.kind === 205 /* BinaryExpression */ && node.operatorToken.kind === 60 /* EqualsToken */) { bindAssignmentTargetFlow(node.left); } else { @@ -28578,10 +28775,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowAssignment(currentFlow, node); } - else if (node.kind === 187 /* ArrayLiteralExpression */) { + else if (node.kind === 188 /* ArrayLiteralExpression */) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 208 /* SpreadElement */) { + if (e.kind === 209 /* SpreadElement */) { bindAssignmentTargetFlow(e.expression); } else { @@ -28589,16 +28786,16 @@ var ts; } } } - else if (node.kind === 188 /* ObjectLiteralExpression */) { + else if (node.kind === 189 /* ObjectLiteralExpression */) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 275 /* PropertyAssignment */) { + if (p.kind === 276 /* PropertyAssignment */) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 276 /* ShorthandPropertyAssignment */) { + else if (p.kind === 277 /* ShorthandPropertyAssignment */) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 277 /* SpreadAssignment */) { + else if (p.kind === 278 /* SpreadAssignment */) { bindAssignmentTargetFlow(p.expression); } } @@ -28654,7 +28851,7 @@ var ts; bindEachChild(node); if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 59 /* EqualsToken */ && node.left.kind === 190 /* ElementAccessExpression */) { + if (operator === 60 /* EqualsToken */ && node.left.kind === 191 /* ElementAccessExpression */) { var elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -28665,7 +28862,7 @@ var ts; } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 189 /* PropertyAccessExpression */) { + if (node.expression.kind === 190 /* PropertyAccessExpression */) { bindAssignmentTargetFlow(node.expression); } } @@ -28713,10 +28910,10 @@ var ts; // an immediately invoked function expression (IIFE). Initialize the flowNode property to // the current control flow (which includes evaluation of the IIFE arguments). var expr = node.expression; - while (expr.kind === 195 /* ParenthesizedExpression */) { + while (expr.kind === 196 /* ParenthesizedExpression */) { expr = expr.expression; } - if (expr.kind === 196 /* FunctionExpression */ || expr.kind === 197 /* ArrowFunction */) { + if (expr.kind === 197 /* FunctionExpression */ || expr.kind === 198 /* ArrowFunction */) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -28724,7 +28921,7 @@ var ts; else { bindEachChild(node); } - if (node.expression.kind === 189 /* PropertyAccessExpression */) { + if (node.expression.kind === 190 /* PropertyAccessExpression */) { var propertyAccess = node.expression; if (isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowArrayMutation(currentFlow, node); @@ -28733,54 +28930,54 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 209 /* ClassExpression */: - case 240 /* ClassDeclaration */: - case 243 /* EnumDeclaration */: - case 188 /* ObjectLiteralExpression */: - case 168 /* TypeLiteral */: - case 297 /* JSDocTypeLiteral */: - case 268 /* JsxAttributes */: + case 210 /* ClassExpression */: + case 241 /* ClassDeclaration */: + case 244 /* EnumDeclaration */: + case 189 /* ObjectLiteralExpression */: + case 169 /* TypeLiteral */: + case 298 /* JSDocTypeLiteral */: + case 269 /* JsxAttributes */: return 1 /* IsContainer */; - case 241 /* InterfaceDeclaration */: + case 242 /* InterfaceDeclaration */: return 1 /* IsContainer */ | 64 /* IsInterface */; - case 244 /* ModuleDeclaration */: - case 242 /* TypeAliasDeclaration */: - case 181 /* MappedType */: + case 245 /* ModuleDeclaration */: + case 243 /* TypeAliasDeclaration */: + case 182 /* MappedType */: return 1 /* IsContainer */ | 32 /* HasLocals */; - case 284 /* SourceFile */: + case 285 /* SourceFile */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */; - case 156 /* MethodDeclaration */: + case 157 /* MethodDeclaration */: if (ts.isObjectLiteralOrClassExpressionMethod(node)) { return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 128 /* IsObjectLiteralOrClassExpressionMethod */; } // falls through - case 157 /* Constructor */: - case 239 /* FunctionDeclaration */: - case 155 /* MethodSignature */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 160 /* CallSignature */: - case 298 /* JSDocSignature */: - case 294 /* JSDocFunctionType */: - case 165 /* FunctionType */: - case 161 /* ConstructSignature */: - case 162 /* IndexSignature */: - case 166 /* ConstructorType */: + case 158 /* Constructor */: + case 240 /* FunctionDeclaration */: + case 156 /* MethodSignature */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 161 /* CallSignature */: + case 299 /* JSDocSignature */: + case 295 /* JSDocFunctionType */: + case 166 /* FunctionType */: + case 162 /* ConstructSignature */: + case 163 /* IndexSignature */: + case 167 /* ConstructorType */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */; - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 16 /* IsFunctionExpression */; - case 245 /* ModuleBlock */: + case 246 /* ModuleBlock */: return 4 /* IsControlFlowContainer */; - case 154 /* PropertyDeclaration */: + case 155 /* PropertyDeclaration */: return node.initializer ? 4 /* IsControlFlowContainer */ : 0; - case 274 /* CatchClause */: - case 225 /* ForStatement */: - case 226 /* ForInStatement */: - case 227 /* ForOfStatement */: - case 246 /* CaseBlock */: + case 275 /* CatchClause */: + case 226 /* ForStatement */: + case 227 /* ForInStatement */: + case 228 /* ForOfStatement */: + case 247 /* CaseBlock */: return 2 /* IsBlockScopedContainer */; - case 218 /* Block */: + case 219 /* Block */: // do not treat blocks directly inside a function as a block-scoped-container. // Locals that reside in this block should go to the function locals. Otherwise 'x' // would not appear to be a redeclaration of a block scoped local in the following @@ -28813,45 +29010,45 @@ var ts; // members are declared (for example, a member of a class will go into a specific // symbol table depending on if it is static or not). We defer to specialized // handlers to take care of declaring these child members. - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 284 /* SourceFile */: + case 285 /* SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 209 /* ClassExpression */: - case 240 /* ClassDeclaration */: + case 210 /* ClassExpression */: + case 241 /* ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 243 /* EnumDeclaration */: + case 244 /* EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 168 /* TypeLiteral */: - case 297 /* JSDocTypeLiteral */: - case 188 /* ObjectLiteralExpression */: - case 241 /* InterfaceDeclaration */: - case 268 /* JsxAttributes */: + case 169 /* TypeLiteral */: + case 298 /* JSDocTypeLiteral */: + case 189 /* ObjectLiteralExpression */: + case 242 /* InterfaceDeclaration */: + case 269 /* JsxAttributes */: // Interface/Object-types always have their children added to the 'members' of // their container. They are only accessible through an instance of their // container, and are never in scope otherwise (even inside the body of the // object / type / interface declaring them). An exception is type parameters, // which are in scope without qualification (similar to 'locals'). return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 165 /* FunctionType */: - case 166 /* ConstructorType */: - case 160 /* CallSignature */: - case 161 /* ConstructSignature */: - case 298 /* JSDocSignature */: - case 162 /* IndexSignature */: - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: - case 157 /* Constructor */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: - case 294 /* JSDocFunctionType */: - case 309 /* JSDocTypedefTag */: - case 302 /* JSDocCallbackTag */: - case 242 /* TypeAliasDeclaration */: - case 181 /* MappedType */: + case 166 /* FunctionType */: + case 167 /* ConstructorType */: + case 161 /* CallSignature */: + case 162 /* ConstructSignature */: + case 299 /* JSDocSignature */: + case 163 /* IndexSignature */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: + case 158 /* Constructor */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: + case 295 /* JSDocFunctionType */: + case 310 /* JSDocTypedefTag */: + case 303 /* JSDocCallbackTag */: + case 243 /* TypeAliasDeclaration */: + case 182 /* MappedType */: // All the children of these container types are never visible through another // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, // they're only accessed 'lexically' (i.e. from code that exists underneath @@ -28872,16 +29069,8 @@ var ts; : declareSymbol(file.locals, /*parent*/ undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 284 /* SourceFile */ ? node : node.body; - if (body && (body.kind === 284 /* SourceFile */ || body.kind === 245 /* ModuleBlock */)) { - for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { - var stat = _a[_i]; - if (stat.kind === 255 /* ExportDeclaration */ || stat.kind === 254 /* ExportAssignment */) { - return true; - } - } - } - return false; + var body = ts.isSourceFile(node) ? node : ts.tryCast(node.body, ts.isModuleBlock); + return !!body && body.statements.some(function (s) { return ts.isExportDeclaration(s) || ts.isExportAssignment(s); }); } function setExportContextFlag(node) { // A declaration source file or ambient module declaration that contains no export declarations (but possibly regular @@ -28960,7 +29149,7 @@ var ts; var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 277 /* SpreadAssignment */ || prop.name.kind !== 72 /* Identifier */) { + if (prop.kind === 278 /* SpreadAssignment */ || prop.name.kind !== 73 /* Identifier */) { continue; } var identifier = prop.name; @@ -28972,7 +29161,7 @@ var ts; // c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true. // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields - var currentKind = prop.kind === 275 /* PropertyAssignment */ || prop.kind === 276 /* ShorthandPropertyAssignment */ || prop.kind === 156 /* MethodDeclaration */ + var currentKind = prop.kind === 276 /* PropertyAssignment */ || prop.kind === 277 /* ShorthandPropertyAssignment */ || prop.kind === 157 /* MethodDeclaration */ ? 1 /* Property */ : 2 /* Accessor */; var existingKind = seen.get(identifier.escapedText); @@ -29004,10 +29193,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 284 /* SourceFile */: + case 285 /* SourceFile */: if (ts.isExternalOrCommonJsModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -29038,7 +29227,7 @@ var ts; currentFlow = { flags: 2 /* Start */ }; parent = typeAlias; bind(typeAlias.typeExpression); - if (!typeAlias.fullName || typeAlias.fullName.kind === 72 /* Identifier */) { + if (!typeAlias.fullName || typeAlias.fullName.kind === 73 /* Identifier */) { parent = typeAlias.parent; bindBlockScopedDeclaration(typeAlias, 524288 /* TypeAlias */, 67897832 /* TypeAliasExcludes */); } @@ -29056,8 +29245,8 @@ var ts; // check for reserved words used as identifiers in strict mode code. function checkStrictModeIdentifier(node) { if (inStrictMode && - node.originalKeywordKind >= 109 /* FirstFutureReservedWord */ && - node.originalKeywordKind <= 117 /* LastFutureReservedWord */ && + node.originalKeywordKind >= 110 /* FirstFutureReservedWord */ && + node.originalKeywordKind <= 118 /* LastFutureReservedWord */ && !ts.isIdentifierName(node) && !(node.flags & 4194304 /* Ambient */)) { // Report error only if there are no parse errors in file @@ -29093,7 +29282,7 @@ var ts; } function checkStrictModeDeleteExpression(node) { // Grammar checking - if (inStrictMode && node.expression.kind === 72 /* Identifier */) { + if (inStrictMode && node.expression.kind === 73 /* Identifier */) { // When a delete operator occurs within strict mode code, a SyntaxError is thrown if its // UnaryExpression is a direct reference to a variable, function argument, or function name var span = ts.getErrorSpanForNode(file, node.expression); @@ -29104,7 +29293,7 @@ var ts; return ts.isIdentifier(node) && (node.escapedText === "eval" || node.escapedText === "arguments"); } function checkStrictModeEvalOrArguments(contextNode, name) { - if (name && name.kind === 72 /* Identifier */) { + if (name && name.kind === 73 /* Identifier */) { var identifier = name; if (isEvalOrArgumentsIdentifier(identifier)) { // We check first if the name is inside class declaration or class expression; if so give explicit message @@ -29145,8 +29334,8 @@ var ts; function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2 /* ES2015 */) { // Report error if function is not top level function declaration - if (blockScopeContainer.kind !== 284 /* SourceFile */ && - blockScopeContainer.kind !== 244 /* ModuleDeclaration */ && + if (blockScopeContainer.kind !== 285 /* SourceFile */ && + blockScopeContainer.kind !== 245 /* ModuleDeclaration */ && !ts.isFunctionLike(blockScopeContainer)) { // We check first if the name is inside class declaration or class expression; if so give explicit message // otherwise report generic error message. @@ -29241,7 +29430,7 @@ var ts; // the current 'container' node when it changes. This helps us know which symbol table // a local should go into for example. Since terminal nodes are known not to have // children, as an optimization we don't process those. - if (node.kind > 147 /* LastToken */) { + if (node.kind > 148 /* LastToken */) { var saveParent = parent; parent = node; var containerFlags = getContainerFlags(node); @@ -29303,7 +29492,7 @@ var ts; function bindWorker(node) { switch (node.kind) { /* Strict mode checks */ - case 72 /* Identifier */: + case 73 /* Identifier */: // for typedef type names with namespaces, bind the new jsdoc type symbol here // because it requires all containing namespaces to be in effect, namely the // current "blockScopeContainer" needs to be set to its immediate namespace parent. @@ -29316,13 +29505,13 @@ var ts; break; } // falls through - case 100 /* ThisKeyword */: - if (currentFlow && (ts.isExpression(node) || parent.kind === 276 /* ShorthandPropertyAssignment */)) { + case 101 /* ThisKeyword */: + if (currentFlow && (ts.isExpression(node) || parent.kind === 277 /* ShorthandPropertyAssignment */)) { node.flowNode = currentFlow; } return checkStrictModeIdentifier(node); - case 189 /* PropertyAccessExpression */: - case 190 /* ElementAccessExpression */: + case 190 /* PropertyAccessExpression */: + case 191 /* ElementAccessExpression */: if (currentFlow && isNarrowableReference(node)) { node.flowNode = currentFlow; } @@ -29336,7 +29525,7 @@ var ts; declareSymbol(file.locals, /*parent*/ undefined, node.expression, 1 /* FunctionScopedVariable */ | 134217728 /* ModuleExports */, 67220414 /* FunctionScopedVariableExcludes */); } break; - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: var specialKind = ts.getAssignmentDeclarationKind(node); switch (specialKind) { case 1 /* ExportsProperty */: @@ -29364,76 +29553,76 @@ var ts; ts.Debug.fail("Unknown binary expression special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 274 /* CatchClause */: + case 275 /* CatchClause */: return checkStrictModeCatchClause(node); - case 198 /* DeleteExpression */: + case 199 /* DeleteExpression */: return checkStrictModeDeleteExpression(node); case 8 /* NumericLiteral */: return checkStrictModeNumericLiteral(node); - case 203 /* PostfixUnaryExpression */: + case 204 /* PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 202 /* PrefixUnaryExpression */: + case 203 /* PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 231 /* WithStatement */: + case 232 /* WithStatement */: return checkStrictModeWithStatement(node); - case 233 /* LabeledStatement */: + case 234 /* LabeledStatement */: return checkStrictModeLabeledStatement(node); - case 178 /* ThisType */: + case 179 /* ThisType */: seenThisKeyword = true; return; - case 163 /* TypePredicate */: + case 164 /* TypePredicate */: break; // Binding the children will handle everything - case 150 /* TypeParameter */: + case 151 /* TypeParameter */: return bindTypeParameter(node); - case 151 /* Parameter */: + case 152 /* Parameter */: return bindParameter(node); - case 237 /* VariableDeclaration */: + case 238 /* VariableDeclaration */: return bindVariableDeclarationOrBindingElement(node); - case 186 /* BindingElement */: + case 187 /* BindingElement */: node.flowNode = currentFlow; return bindVariableDeclarationOrBindingElement(node); - case 154 /* PropertyDeclaration */: - case 153 /* PropertySignature */: + case 155 /* PropertyDeclaration */: + case 154 /* PropertySignature */: return bindPropertyWorker(node); - case 275 /* PropertyAssignment */: - case 276 /* ShorthandPropertyAssignment */: + case 276 /* PropertyAssignment */: + case 277 /* ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */); - case 278 /* EnumMember */: + case 279 /* EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 68008959 /* EnumMemberExcludes */); - case 160 /* CallSignature */: - case 161 /* ConstructSignature */: - case 162 /* IndexSignature */: + case 161 /* CallSignature */: + case 162 /* ConstructSignature */: + case 163 /* IndexSignature */: return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */); - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: // If this is an ObjectLiteralExpression method, then it sits in the same space // as other properties in the object literal. So we use SymbolFlags.PropertyExcludes // so that it will conflict with any other object literal members with the same // name. return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 16777216 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 67212223 /* MethodExcludes */); - case 239 /* FunctionDeclaration */: + case 240 /* FunctionDeclaration */: return bindFunctionDeclaration(node); - case 157 /* Constructor */: + case 158 /* Constructor */: return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */); - case 158 /* GetAccessor */: + case 159 /* GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 67154879 /* GetAccessorExcludes */); - case 159 /* SetAccessor */: + case 160 /* SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 67187647 /* SetAccessorExcludes */); - case 165 /* FunctionType */: - case 294 /* JSDocFunctionType */: - case 298 /* JSDocSignature */: - case 166 /* ConstructorType */: + case 166 /* FunctionType */: + case 295 /* JSDocFunctionType */: + case 299 /* JSDocSignature */: + case 167 /* ConstructorType */: return bindFunctionOrConstructorType(node); - case 168 /* TypeLiteral */: - case 297 /* JSDocTypeLiteral */: - case 181 /* MappedType */: + case 169 /* TypeLiteral */: + case 298 /* JSDocTypeLiteral */: + case 182 /* MappedType */: return bindAnonymousTypeWorker(node); - case 188 /* ObjectLiteralExpression */: + case 189 /* ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: return bindFunctionExpression(node); - case 191 /* CallExpression */: + case 192 /* CallExpression */: var assignmentKind = ts.getAssignmentDeclarationKind(node); switch (assignmentKind) { case 7 /* ObjectDefinePropertyValue */: @@ -29452,64 +29641,64 @@ var ts; } break; // Members of classes, interfaces, and modules - case 209 /* ClassExpression */: - case 240 /* ClassDeclaration */: + case 210 /* ClassExpression */: + case 241 /* ClassDeclaration */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return bindClassLikeDeclaration(node); - case 241 /* InterfaceDeclaration */: + case 242 /* InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* Interface */, 67897736 /* InterfaceExcludes */); - case 242 /* TypeAliasDeclaration */: + case 243 /* TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 67897832 /* TypeAliasExcludes */); - case 243 /* EnumDeclaration */: + case 244 /* EnumDeclaration */: return bindEnumDeclaration(node); - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: return bindModuleDeclaration(node); // Jsx-attributes - case 268 /* JsxAttributes */: + case 269 /* JsxAttributes */: return bindJsxAttributes(node); - case 267 /* JsxAttribute */: + case 268 /* JsxAttribute */: return bindJsxAttribute(node, 4 /* Property */, 0 /* PropertyExcludes */); // Imports and exports - case 248 /* ImportEqualsDeclaration */: - case 251 /* NamespaceImport */: - case 253 /* ImportSpecifier */: - case 257 /* ExportSpecifier */: + case 249 /* ImportEqualsDeclaration */: + case 252 /* NamespaceImport */: + case 254 /* ImportSpecifier */: + case 258 /* ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */); - case 247 /* NamespaceExportDeclaration */: + case 248 /* NamespaceExportDeclaration */: return bindNamespaceExportDeclaration(node); - case 250 /* ImportClause */: + case 251 /* ImportClause */: return bindImportClause(node); - case 255 /* ExportDeclaration */: + case 256 /* ExportDeclaration */: return bindExportDeclaration(node); - case 254 /* ExportAssignment */: + case 255 /* ExportAssignment */: return bindExportAssignment(node); - case 284 /* SourceFile */: + case 285 /* SourceFile */: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 218 /* Block */: + case 219 /* Block */: if (!ts.isFunctionLike(node.parent)) { return; } // falls through - case 245 /* ModuleBlock */: + case 246 /* ModuleBlock */: return updateStrictModeStatementList(node.statements); - case 304 /* JSDocParameterTag */: - if (node.parent.kind === 298 /* JSDocSignature */) { + case 305 /* JSDocParameterTag */: + if (node.parent.kind === 299 /* JSDocSignature */) { return bindParameter(node); } - if (node.parent.kind !== 297 /* JSDocTypeLiteral */) { + if (node.parent.kind !== 298 /* JSDocTypeLiteral */) { break; } // falls through - case 310 /* JSDocPropertyTag */: + case 311 /* JSDocPropertyTag */: var propTag = node; - var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 293 /* JSDocOptionalType */ ? + var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 294 /* JSDocOptionalType */ ? 4 /* Property */ | 16777216 /* Optional */ : 4 /* Property */; return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* PropertyExcludes */); - case 309 /* JSDocTypedefTag */: - case 302 /* JSDocCallbackTag */: + case 310 /* JSDocTypedefTag */: + case 303 /* JSDocCallbackTag */: return (delayedTypeAliases || (delayedTypeAliases = [])).push(node); } } @@ -29653,11 +29842,11 @@ var ts; ts.Debug.assert(ts.isInJSFile(node)); var thisContainer = ts.getThisContainer(node, /*includeArrowFunctions*/ false); switch (thisContainer.kind) { - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: var constructorSymbol = thisContainer.symbol; // For `f.prototype.m = function() { this.x = 0; }`, `this.x = 0` should modify `f`'s members, not the function expression. - if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 59 /* EqualsToken */) { + if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 60 /* EqualsToken */) { var l = thisContainer.parent.left; if (ts.isPropertyAccessEntityNameExpression(l) && ts.isPrototypeAccess(l.expression)) { constructorSymbol = lookupSymbolForPropertyAccess(l.expression.expression, thisParentContainer); @@ -29670,18 +29859,18 @@ var ts; declareSymbol(constructorSymbol.members, constructorSymbol, node, 4 /* Property */, 0 /* PropertyExcludes */ & ~4 /* Property */); } break; - case 157 /* Constructor */: - case 154 /* PropertyDeclaration */: - case 156 /* MethodDeclaration */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 158 /* Constructor */: + case 155 /* PropertyDeclaration */: + case 157 /* MethodDeclaration */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: // this.foo assignment in a JavaScript class // Bind this property to the containing class var containingClass = thisContainer.parent; var symbolTable = ts.hasModifier(thisContainer, 32 /* Static */) ? containingClass.symbol.exports : containingClass.symbol.members; declareSymbol(symbolTable, containingClass.symbol, node, 4 /* Property */, 0 /* None */, /*isReplaceableByMethod*/ true); break; - case 284 /* SourceFile */: + case 285 /* SourceFile */: // this.property = assignment in a source file -- declare symbol in exports for a module, in locals for a script if (thisContainer.commonJsModuleIndicator) { declareSymbol(thisContainer.symbol.exports, thisContainer.symbol, node, 4 /* Property */ | 1048576 /* ExportValue */, 0 /* None */); @@ -29691,14 +29880,14 @@ var ts; } break; default: - ts.Debug.fail(ts.Debug.showSyntaxKind(thisContainer)); + ts.Debug.failBadSyntaxKind(thisContainer); } } function bindSpecialPropertyDeclaration(node) { - if (node.expression.kind === 100 /* ThisKeyword */) { + if (node.expression.kind === 101 /* ThisKeyword */) { bindThisPropertyAssignment(node); } - else if (ts.isPropertyAccessEntityNameExpression(node) && node.parent.parent.kind === 284 /* SourceFile */) { + else if (ts.isPropertyAccessEntityNameExpression(node) && node.parent.parent.kind === 285 /* SourceFile */) { if (ts.isPrototypeAccess(node.expression)) { bindPrototypePropertyAssignment(node, node.parent); } @@ -29735,7 +29924,7 @@ var ts; } function bindObjectDefinePropertyAssignment(node) { var namespaceSymbol = lookupSymbolForPropertyAccess(node.arguments[0]); - var isToplevel = node.parent.parent.kind === 284 /* SourceFile */; + var isToplevel = node.parent.parent.kind === 285 /* SourceFile */; namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, node.arguments[0], isToplevel, /*isPrototypeProperty*/ false); bindPotentiallyNewExpandoMemberToNamespace(node, namespaceSymbol, /*isPrototypeProperty*/ false); } @@ -29749,7 +29938,7 @@ var ts; // Fix up parent pointers since we're going to use these nodes before we bind into them node.left.parent = node; node.right.parent = node; - if (ts.isIdentifier(lhs.expression) && container === file && isNameOfExportsOrModuleExportsAliasDeclaration(file, lhs.expression)) { + if (ts.isIdentifier(lhs.expression) && container === file && isExportsOrModuleExportsOrAlias(file, lhs.expression)) { // This can be an alias for the 'exports' or 'module.exports' names, e.g. // var util = module.exports; // util.property = function ... @@ -29802,8 +29991,8 @@ var ts; function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty) { var namespaceSymbol = lookupSymbolForPropertyAccess(name); var isToplevel = ts.isBinaryExpression(propertyAccess.parent) - ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 284 /* SourceFile */ - : propertyAccess.parent.parent.kind === 284 /* SourceFile */; + ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 285 /* SourceFile */ + : propertyAccess.parent.parent.kind === 285 /* SourceFile */; namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, propertyAccess.expression, isToplevel, isPrototypeProperty); bindPotentiallyNewExpandoMemberToNamespace(propertyAccess, namespaceSymbol, isPrototypeProperty); } @@ -29862,9 +30051,7 @@ var ts; } else { var s = forEachIdentifierInEntityName(e.expression, parent, action); - if (!s || !s.exports) - return ts.Debug.fail(); - return action(e.name, s.exports.get(e.name.escapedText), s); + return action(e.name, s && s.exports && s.exports.get(e.name.escapedText), s); } } function bindCallExpression(node) { @@ -29875,7 +30062,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 240 /* ClassDeclaration */) { + if (node.kind === 241 /* ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* Class */, 68008383 /* ClassExcludes */); } else { @@ -29941,7 +30128,7 @@ var ts; } } function bindParameter(node) { - if (node.kind === 304 /* JSDocParameterTag */ && container.kind !== 298 /* JSDocSignature */) { + if (node.kind === 305 /* JSDocParameterTag */ && container.kind !== 299 /* JSDocSignature */) { return; } if (inStrictMode && !(node.flags & 4194304 /* Ambient */)) { @@ -30018,7 +30205,7 @@ var ts; declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 67635688 /* TypeParameterExcludes */); } } - else if (node.parent.kind === 176 /* InferType */) { + else if (node.parent.kind === 177 /* InferType */) { var container_2 = getInferTypeContainer(node.parent); if (container_2) { if (!container_2.locals) { @@ -30046,11 +30233,11 @@ var ts; if (currentFlow === unreachableFlow) { var reportError = // report error on all statements except empty ones - (ts.isStatementButNotDeclaration(node) && node.kind !== 220 /* EmptyStatement */) || + (ts.isStatementButNotDeclaration(node) && node.kind !== 221 /* EmptyStatement */) || // report error on class declarations - node.kind === 240 /* ClassDeclaration */ || + node.kind === 241 /* ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - (node.kind === 244 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)); + (node.kind === 245 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)); if (reportError) { currentFlow = reportedUnreachableFlow; if (!options.allowUnreachableCode) { @@ -30094,32 +30281,41 @@ var ts; } function isPurelyTypeDeclaration(s) { switch (s.kind) { - case 241 /* InterfaceDeclaration */: - case 242 /* TypeAliasDeclaration */: + case 242 /* InterfaceDeclaration */: + case 243 /* TypeAliasDeclaration */: return true; - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: return getModuleInstanceState(s) !== 1 /* Instantiated */; - case 243 /* EnumDeclaration */: + case 244 /* EnumDeclaration */: return ts.hasModifier(s, 2048 /* Const */); default: return false; } } function isExportsOrModuleExportsOrAlias(sourceFile, node) { - return ts.isExportsIdentifier(node) || - ts.isModuleExportsPropertyAccessExpression(node) || - ts.isIdentifier(node) && isNameOfExportsOrModuleExportsAliasDeclaration(sourceFile, node); + var i = 0; + var q = [node]; + while (q.length && i < 100) { + i++; + node = q.shift(); + if (ts.isExportsIdentifier(node) || ts.isModuleExportsPropertyAccessExpression(node)) { + return true; + } + else if (ts.isIdentifier(node)) { + var symbol = lookupSymbolForNameWorker(sourceFile, node.escapedText); + if (!!symbol && !!symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) && !!symbol.valueDeclaration.initializer) { + var init = symbol.valueDeclaration.initializer; + q.push(init); + if (ts.isAssignmentExpression(init, /*excludeCompoundAssignment*/ true)) { + q.push(init.left); + q.push(init.right); + } + } + } + } + return false; } ts.isExportsOrModuleExportsOrAlias = isExportsOrModuleExportsOrAlias; - function isNameOfExportsOrModuleExportsAliasDeclaration(sourceFile, node) { - var symbol = lookupSymbolForNameWorker(sourceFile, node.escapedText); - return !!symbol && !!symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) && - !!symbol.valueDeclaration.initializer && isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, symbol.valueDeclaration.initializer); - } - function isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, node) { - return isExportsOrModuleExportsOrAlias(sourceFile, node) || - (ts.isAssignmentExpression(node, /*excludeCompoundAssignment*/ true) && (isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, node.left) || isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, node.right))); - } function lookupSymbolForNameWorker(container, name) { var local = container.locals && container.locals.get(name); if (local) { @@ -30139,58 +30335,58 @@ var ts; function computeTransformFlagsForNode(node, subtreeFlags) { var kind = node.kind; switch (kind) { - case 191 /* CallExpression */: + case 192 /* CallExpression */: return computeCallExpression(node, subtreeFlags); - case 192 /* NewExpression */: + case 193 /* NewExpression */: return computeNewExpression(node, subtreeFlags); - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: return computeModuleDeclaration(node, subtreeFlags); - case 195 /* ParenthesizedExpression */: + case 196 /* ParenthesizedExpression */: return computeParenthesizedExpression(node, subtreeFlags); - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: return computeBinaryExpression(node, subtreeFlags); - case 221 /* ExpressionStatement */: + case 222 /* ExpressionStatement */: return computeExpressionStatement(node, subtreeFlags); - case 151 /* Parameter */: + case 152 /* Parameter */: return computeParameter(node, subtreeFlags); - case 197 /* ArrowFunction */: + case 198 /* ArrowFunction */: return computeArrowFunction(node, subtreeFlags); - case 196 /* FunctionExpression */: + case 197 /* FunctionExpression */: return computeFunctionExpression(node, subtreeFlags); - case 239 /* FunctionDeclaration */: + case 240 /* FunctionDeclaration */: return computeFunctionDeclaration(node, subtreeFlags); - case 237 /* VariableDeclaration */: + case 238 /* VariableDeclaration */: return computeVariableDeclaration(node, subtreeFlags); - case 238 /* VariableDeclarationList */: + case 239 /* VariableDeclarationList */: return computeVariableDeclarationList(node, subtreeFlags); - case 219 /* VariableStatement */: + case 220 /* VariableStatement */: return computeVariableStatement(node, subtreeFlags); - case 233 /* LabeledStatement */: + case 234 /* LabeledStatement */: return computeLabeledStatement(node, subtreeFlags); - case 240 /* ClassDeclaration */: + case 241 /* ClassDeclaration */: return computeClassDeclaration(node, subtreeFlags); - case 209 /* ClassExpression */: + case 210 /* ClassExpression */: return computeClassExpression(node, subtreeFlags); - case 273 /* HeritageClause */: + case 274 /* HeritageClause */: return computeHeritageClause(node, subtreeFlags); - case 274 /* CatchClause */: + case 275 /* CatchClause */: return computeCatchClause(node, subtreeFlags); - case 211 /* ExpressionWithTypeArguments */: + case 212 /* ExpressionWithTypeArguments */: return computeExpressionWithTypeArguments(node, subtreeFlags); - case 157 /* Constructor */: + case 158 /* Constructor */: return computeConstructor(node, subtreeFlags); - case 154 /* PropertyDeclaration */: + case 155 /* PropertyDeclaration */: return computePropertyDeclaration(node, subtreeFlags); - case 156 /* MethodDeclaration */: + case 157 /* MethodDeclaration */: return computeMethod(node, subtreeFlags); - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: return computeAccessor(node, subtreeFlags); - case 248 /* ImportEqualsDeclaration */: + case 249 /* ImportEqualsDeclaration */: return computeImportEquals(node, subtreeFlags); - case 189 /* PropertyAccessExpression */: + case 190 /* PropertyAccessExpression */: return computePropertyAccess(node, subtreeFlags); - case 190 /* ElementAccessExpression */: + case 191 /* ElementAccessExpression */: return computeElementAccess(node, subtreeFlags); default: return computeOther(node, kind, subtreeFlags); @@ -30212,7 +30408,7 @@ var ts; transformFlags |= 2048 /* ContainsLexicalThis */; } } - if (expression.kind === 92 /* ImportKeyword */) { + if (expression.kind === 93 /* ImportKeyword */) { transformFlags |= 524288 /* ContainsDynamicImport */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; @@ -30235,17 +30431,17 @@ var ts; var transformFlags = subtreeFlags; var operatorTokenKind = node.operatorToken.kind; var leftKind = node.left.kind; - if (operatorTokenKind === 59 /* EqualsToken */ && leftKind === 188 /* ObjectLiteralExpression */) { + if (operatorTokenKind === 60 /* EqualsToken */ && leftKind === 189 /* ObjectLiteralExpression */) { // Destructuring object assignments with are ES2015 syntax // and possibly ES2018 if they contain rest transformFlags |= 16 /* AssertES2018 */ | 128 /* AssertES2015 */ | 512 /* AssertDestructuringAssignment */; } - else if (operatorTokenKind === 59 /* EqualsToken */ && leftKind === 187 /* ArrayLiteralExpression */) { + else if (operatorTokenKind === 60 /* EqualsToken */ && leftKind === 188 /* ArrayLiteralExpression */) { // Destructuring assignments are ES2015 syntax. transformFlags |= 128 /* AssertES2015 */ | 512 /* AssertDestructuringAssignment */; } else if (operatorTokenKind === 41 /* AsteriskAsteriskToken */ - || operatorTokenKind === 63 /* AsteriskAsteriskEqualsToken */) { + || operatorTokenKind === 64 /* AsteriskAsteriskEqualsToken */) { // Exponentiation is ES2016 syntax. transformFlags |= 64 /* AssertES2016 */; } @@ -30288,8 +30484,8 @@ var ts; // If the node is synthesized, it means the emitter put the parentheses there, // not the user. If we didn't want them, the emitter would not have put them // there. - if (expressionKind === 212 /* AsExpression */ - || expressionKind === 194 /* TypeAssertionExpression */) { + if (expressionKind === 213 /* AsExpression */ + || expressionKind === 195 /* TypeAssertionExpression */) { transformFlags |= 1 /* AssertTypeScript */; } node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; @@ -30331,11 +30527,11 @@ var ts; function computeHeritageClause(node, subtreeFlags) { var transformFlags = subtreeFlags; switch (node.token) { - case 86 /* ExtendsKeyword */: + case 87 /* ExtendsKeyword */: // An `extends` HeritageClause is ES6 syntax. transformFlags |= 128 /* AssertES2015 */; break; - case 109 /* ImplementsKeyword */: + case 110 /* ImplementsKeyword */: // An `implements` HeritageClause is TypeScript syntax. transformFlags |= 1 /* AssertTypeScript */; break; @@ -30528,7 +30724,7 @@ var ts; var transformFlags = subtreeFlags; // If a PropertyAccessExpression starts with a super keyword, then it is // ES6 syntax, and requires a lexical `this` binding. - if (node.expression.kind === 98 /* SuperKeyword */) { + if (node.expression.kind === 99 /* SuperKeyword */) { // super inside of an async function requires hoisting the super access (ES2017). // same for super inside of an async generator, which is ES2018. transformFlags |= 32 /* ContainsES2017 */ | 16 /* ContainsES2018 */; @@ -30540,7 +30736,7 @@ var ts; var transformFlags = subtreeFlags; // If an ElementAccessExpression starts with a super keyword, then it is // ES6 syntax, and requires a lexical `this` binding. - if (node.expression.kind === 98 /* SuperKeyword */) { + if (node.expression.kind === 99 /* SuperKeyword */) { // super inside of an async function requires hoisting the super access (ES2017). // same for super inside of an async generator, which is ES2018. transformFlags |= 32 /* ContainsES2017 */ | 16 /* ContainsES2018 */; @@ -30628,43 +30824,43 @@ var ts; var transformFlags = subtreeFlags; var excludeFlags = 536870912 /* NodeExcludes */; switch (kind) { - case 121 /* AsyncKeyword */: - case 201 /* AwaitExpression */: + case 122 /* AsyncKeyword */: + case 202 /* AwaitExpression */: // async/await is ES2017 syntax, but may be ES2018 syntax (for async generators) transformFlags |= 16 /* AssertES2018 */ | 32 /* AssertES2017 */; break; - case 194 /* TypeAssertionExpression */: - case 212 /* AsExpression */: - case 313 /* PartiallyEmittedExpression */: + case 195 /* TypeAssertionExpression */: + case 213 /* AsExpression */: + case 314 /* PartiallyEmittedExpression */: // These nodes are TypeScript syntax. transformFlags |= 1 /* AssertTypeScript */; excludeFlags = 536870912 /* OuterExpressionExcludes */; break; - case 115 /* PublicKeyword */: - case 113 /* PrivateKeyword */: - case 114 /* ProtectedKeyword */: - case 118 /* AbstractKeyword */: - case 125 /* DeclareKeyword */: - case 77 /* ConstKeyword */: - case 243 /* EnumDeclaration */: - case 278 /* EnumMember */: - case 213 /* NonNullExpression */: - case 133 /* ReadonlyKeyword */: + case 116 /* PublicKeyword */: + case 114 /* PrivateKeyword */: + case 115 /* ProtectedKeyword */: + case 119 /* AbstractKeyword */: + case 126 /* DeclareKeyword */: + case 78 /* ConstKeyword */: + case 244 /* EnumDeclaration */: + case 279 /* EnumMember */: + case 214 /* NonNullExpression */: + case 134 /* ReadonlyKeyword */: // These nodes are TypeScript syntax. transformFlags |= 1 /* AssertTypeScript */; break; - case 260 /* JsxElement */: - case 261 /* JsxSelfClosingElement */: - case 262 /* JsxOpeningElement */: + case 261 /* JsxElement */: + case 262 /* JsxSelfClosingElement */: + case 263 /* JsxOpeningElement */: case 11 /* JsxText */: - case 263 /* JsxClosingElement */: - case 264 /* JsxFragment */: - case 265 /* JsxOpeningFragment */: - case 266 /* JsxClosingFragment */: - case 267 /* JsxAttribute */: - case 268 /* JsxAttributes */: - case 269 /* JsxSpreadAttribute */: - case 270 /* JsxExpression */: + case 264 /* JsxClosingElement */: + case 265 /* JsxFragment */: + case 266 /* JsxOpeningFragment */: + case 267 /* JsxClosingFragment */: + case 268 /* JsxAttribute */: + case 269 /* JsxAttributes */: + case 270 /* JsxSpreadAttribute */: + case 271 /* JsxExpression */: // These nodes are Jsx syntax. transformFlags |= 2 /* AssertJsx */; break; @@ -30672,11 +30868,11 @@ var ts; case 15 /* TemplateHead */: case 16 /* TemplateMiddle */: case 17 /* TemplateTail */: - case 206 /* TemplateExpression */: - case 193 /* TaggedTemplateExpression */: - case 276 /* ShorthandPropertyAssignment */: - case 116 /* StaticKeyword */: - case 214 /* MetaProperty */: + case 207 /* TemplateExpression */: + case 194 /* TaggedTemplateExpression */: + case 277 /* ShorthandPropertyAssignment */: + case 117 /* StaticKeyword */: + case 215 /* MetaProperty */: // These nodes are ES6 syntax. transformFlags |= 128 /* AssertES2015 */; break; @@ -30693,103 +30889,103 @@ var ts; case 9 /* BigIntLiteral */: transformFlags |= 4 /* AssertESNext */; break; - case 227 /* ForOfStatement */: + case 228 /* ForOfStatement */: // This node is either ES2015 syntax or ES2017 syntax (if it is a for-await-of). if (node.awaitModifier) { transformFlags |= 16 /* AssertES2018 */; } transformFlags |= 128 /* AssertES2015 */; break; - case 207 /* YieldExpression */: + case 208 /* YieldExpression */: // This node is either ES2015 syntax (in a generator) or ES2017 syntax (in an async // generator). transformFlags |= 16 /* AssertES2018 */ | 128 /* AssertES2015 */ | 131072 /* ContainsYield */; break; - case 120 /* AnyKeyword */: - case 135 /* NumberKeyword */: - case 146 /* BigIntKeyword */: - case 132 /* NeverKeyword */: - case 136 /* ObjectKeyword */: - case 138 /* StringKeyword */: - case 123 /* BooleanKeyword */: - case 139 /* SymbolKeyword */: - case 106 /* VoidKeyword */: - case 150 /* TypeParameter */: - case 153 /* PropertySignature */: - case 155 /* MethodSignature */: - case 160 /* CallSignature */: - case 161 /* ConstructSignature */: - case 162 /* IndexSignature */: - case 163 /* TypePredicate */: - case 164 /* TypeReference */: - case 165 /* FunctionType */: - case 166 /* ConstructorType */: - case 167 /* TypeQuery */: - case 168 /* TypeLiteral */: - case 169 /* ArrayType */: - case 170 /* TupleType */: - case 171 /* OptionalType */: - case 172 /* RestType */: - case 173 /* UnionType */: - case 174 /* IntersectionType */: - case 175 /* ConditionalType */: - case 176 /* InferType */: - case 177 /* ParenthesizedType */: - case 241 /* InterfaceDeclaration */: - case 242 /* TypeAliasDeclaration */: - case 178 /* ThisType */: - case 179 /* TypeOperator */: - case 180 /* IndexedAccessType */: - case 181 /* MappedType */: - case 182 /* LiteralType */: - case 247 /* NamespaceExportDeclaration */: + case 121 /* AnyKeyword */: + case 136 /* NumberKeyword */: + case 147 /* BigIntKeyword */: + case 133 /* NeverKeyword */: + case 137 /* ObjectKeyword */: + case 139 /* StringKeyword */: + case 124 /* BooleanKeyword */: + case 140 /* SymbolKeyword */: + case 107 /* VoidKeyword */: + case 151 /* TypeParameter */: + case 154 /* PropertySignature */: + case 156 /* MethodSignature */: + case 161 /* CallSignature */: + case 162 /* ConstructSignature */: + case 163 /* IndexSignature */: + case 164 /* TypePredicate */: + case 165 /* TypeReference */: + case 166 /* FunctionType */: + case 167 /* ConstructorType */: + case 168 /* TypeQuery */: + case 169 /* TypeLiteral */: + case 170 /* ArrayType */: + case 171 /* TupleType */: + case 172 /* OptionalType */: + case 173 /* RestType */: + case 174 /* UnionType */: + case 175 /* IntersectionType */: + case 176 /* ConditionalType */: + case 177 /* InferType */: + case 178 /* ParenthesizedType */: + case 242 /* InterfaceDeclaration */: + case 243 /* TypeAliasDeclaration */: + case 179 /* ThisType */: + case 180 /* TypeOperator */: + case 181 /* IndexedAccessType */: + case 182 /* MappedType */: + case 183 /* LiteralType */: + case 248 /* NamespaceExportDeclaration */: // Types and signatures are TypeScript syntax, and exclude all other facts. transformFlags = 1 /* AssertTypeScript */; excludeFlags = -2 /* TypeExcludes */; break; - case 149 /* ComputedPropertyName */: + case 150 /* ComputedPropertyName */: // Even though computed property names are ES6, we don't treat them as such. // This is so that they can flow through PropertyName transforms unaffected. // Instead, we mark the container as ES6, so that it can properly handle the transform. transformFlags |= 16384 /* ContainsComputedPropertyName */; break; - case 208 /* SpreadElement */: + case 209 /* SpreadElement */: transformFlags |= 128 /* AssertES2015 */ | 4096 /* ContainsRestOrSpread */; break; - case 277 /* SpreadAssignment */: + case 278 /* SpreadAssignment */: transformFlags |= 16 /* AssertES2018 */ | 8192 /* ContainsObjectRestOrSpread */; break; - case 98 /* SuperKeyword */: + case 99 /* SuperKeyword */: // This node is ES6 syntax. transformFlags |= 128 /* AssertES2015 */; excludeFlags = 536870912 /* OuterExpressionExcludes */; // must be set to persist `Super` break; - case 100 /* ThisKeyword */: + case 101 /* ThisKeyword */: // Mark this node and its ancestors as containing a lexical `this` keyword. transformFlags |= 2048 /* ContainsLexicalThis */; break; - case 184 /* ObjectBindingPattern */: + case 185 /* ObjectBindingPattern */: transformFlags |= 128 /* AssertES2015 */ | 65536 /* ContainsBindingPattern */; if (subtreeFlags & 4096 /* ContainsRestOrSpread */) { transformFlags |= 16 /* AssertES2018 */ | 8192 /* ContainsObjectRestOrSpread */; } excludeFlags = 536875008 /* BindingPatternExcludes */; break; - case 185 /* ArrayBindingPattern */: + case 186 /* ArrayBindingPattern */: transformFlags |= 128 /* AssertES2015 */ | 65536 /* ContainsBindingPattern */; excludeFlags = 536875008 /* BindingPatternExcludes */; break; - case 186 /* BindingElement */: + case 187 /* BindingElement */: transformFlags |= 128 /* AssertES2015 */; if (node.dotDotDotToken) { transformFlags |= 4096 /* ContainsRestOrSpread */; } break; - case 152 /* Decorator */: + case 153 /* Decorator */: // This node is TypeScript syntax, and marks its container as also being TypeScript syntax. transformFlags |= 1 /* AssertTypeScript */ | 1024 /* ContainsTypeScriptClassSyntax */; break; - case 188 /* ObjectLiteralExpression */: + case 189 /* ObjectLiteralExpression */: excludeFlags = 536896512 /* ObjectLiteralExcludes */; if (subtreeFlags & 16384 /* ContainsComputedPropertyName */) { // If an ObjectLiteralExpression contains a ComputedPropertyName, then it @@ -30802,26 +30998,26 @@ var ts; transformFlags |= 16 /* AssertES2018 */; } break; - case 187 /* ArrayLiteralExpression */: + case 188 /* ArrayLiteralExpression */: excludeFlags = 536875008 /* ArrayLiteralOrCallOrNewExcludes */; break; - case 223 /* DoStatement */: - case 224 /* WhileStatement */: - case 225 /* ForStatement */: - case 226 /* ForInStatement */: + case 224 /* DoStatement */: + case 225 /* WhileStatement */: + case 226 /* ForStatement */: + case 227 /* ForInStatement */: // A loop containing a block scoped binding *may* need to be transformed from ES6. if (subtreeFlags & 32768 /* ContainsBlockScopedBinding */) { transformFlags |= 128 /* AssertES2015 */; } break; - case 284 /* SourceFile */: + case 285 /* SourceFile */: break; - case 230 /* ReturnStatement */: + case 231 /* ReturnStatement */: // Return statements may require an `await` in ES2018. transformFlags |= 262144 /* ContainsHoistedDeclarationOrCompletion */ | 16 /* AssertES2018 */; break; - case 228 /* ContinueStatement */: - case 229 /* BreakStatement */: + case 229 /* ContinueStatement */: + case 230 /* BreakStatement */: transformFlags |= 262144 /* ContainsHoistedDeclarationOrCompletion */; break; } @@ -30839,67 +31035,67 @@ var ts; * than calling this function. */ function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 163 /* FirstTypeNode */ && kind <= 183 /* LastTypeNode */) { + if (kind >= 164 /* FirstTypeNode */ && kind <= 184 /* LastTypeNode */) { return -2 /* TypeExcludes */; } switch (kind) { - case 191 /* CallExpression */: - case 192 /* NewExpression */: - case 187 /* ArrayLiteralExpression */: + case 192 /* CallExpression */: + case 193 /* NewExpression */: + case 188 /* ArrayLiteralExpression */: return 536875008 /* ArrayLiteralOrCallOrNewExcludes */; - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: return 537168896 /* ModuleExcludes */; - case 151 /* Parameter */: + case 152 /* Parameter */: return 536870912 /* ParameterExcludes */; - case 197 /* ArrowFunction */: + case 198 /* ArrowFunction */: return 537371648 /* ArrowFunctionExcludes */; - case 196 /* FunctionExpression */: - case 239 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: + case 240 /* FunctionDeclaration */: return 537373696 /* FunctionExcludes */; - case 238 /* VariableDeclarationList */: + case 239 /* VariableDeclarationList */: return 536944640 /* VariableDeclarationListExcludes */; - case 240 /* ClassDeclaration */: - case 209 /* ClassExpression */: + case 241 /* ClassDeclaration */: + case 210 /* ClassExpression */: return 536888320 /* ClassExcludes */; - case 157 /* Constructor */: + case 158 /* Constructor */: return 537372672 /* ConstructorExcludes */; - case 156 /* MethodDeclaration */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 157 /* MethodDeclaration */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: return 537372672 /* MethodOrAccessorExcludes */; - case 120 /* AnyKeyword */: - case 135 /* NumberKeyword */: - case 146 /* BigIntKeyword */: - case 132 /* NeverKeyword */: - case 138 /* StringKeyword */: - case 136 /* ObjectKeyword */: - case 123 /* BooleanKeyword */: - case 139 /* SymbolKeyword */: - case 106 /* VoidKeyword */: - case 150 /* TypeParameter */: - case 153 /* PropertySignature */: - case 155 /* MethodSignature */: - case 160 /* CallSignature */: - case 161 /* ConstructSignature */: - case 162 /* IndexSignature */: - case 241 /* InterfaceDeclaration */: - case 242 /* TypeAliasDeclaration */: + case 121 /* AnyKeyword */: + case 136 /* NumberKeyword */: + case 147 /* BigIntKeyword */: + case 133 /* NeverKeyword */: + case 139 /* StringKeyword */: + case 137 /* ObjectKeyword */: + case 124 /* BooleanKeyword */: + case 140 /* SymbolKeyword */: + case 107 /* VoidKeyword */: + case 151 /* TypeParameter */: + case 154 /* PropertySignature */: + case 156 /* MethodSignature */: + case 161 /* CallSignature */: + case 162 /* ConstructSignature */: + case 163 /* IndexSignature */: + case 242 /* InterfaceDeclaration */: + case 243 /* TypeAliasDeclaration */: return -2 /* TypeExcludes */; - case 188 /* ObjectLiteralExpression */: + case 189 /* ObjectLiteralExpression */: return 536896512 /* ObjectLiteralExcludes */; - case 274 /* CatchClause */: + case 275 /* CatchClause */: return 536879104 /* CatchClauseExcludes */; - case 184 /* ObjectBindingPattern */: - case 185 /* ArrayBindingPattern */: + case 185 /* ObjectBindingPattern */: + case 186 /* ArrayBindingPattern */: return 536875008 /* BindingPatternExcludes */; - case 194 /* TypeAssertionExpression */: - case 212 /* AsExpression */: - case 313 /* PartiallyEmittedExpression */: - case 195 /* ParenthesizedExpression */: - case 98 /* SuperKeyword */: + case 195 /* TypeAssertionExpression */: + case 213 /* AsExpression */: + case 314 /* PartiallyEmittedExpression */: + case 196 /* ParenthesizedExpression */: + case 99 /* SuperKeyword */: return 536870912 /* OuterExpressionExcludes */; - case 189 /* PropertyAccessExpression */: - case 190 /* ElementAccessExpression */: + case 190 /* PropertyAccessExpression */: + case 191 /* ElementAccessExpression */: return 536870912 /* PropertyAccessExcludes */; default: return 536870912 /* NodeExcludes */; @@ -31074,7 +31270,7 @@ var ts; // (their type resolved directly to the member deeply referenced) // So to get the intervening symbols, we need to check if there's a type // query node on any of the symbol's declarations and get symbols there - if (d.type && d.type.kind === 167 /* TypeQuery */) { + if (d.type && d.type.kind === 168 /* TypeQuery */) { var query = d.type; var entity = getResolvedSymbol(getFirstIdentifier(query.exprName)); visitSymbol(entity); @@ -31173,8 +31369,6 @@ var ts; undefinedSymbol.declarations = []; var globalThisSymbol = createSymbol(1536 /* Module */, "globalThis", 8 /* Readonly */); globalThisSymbol.exports = globals; - globalThisSymbol.valueDeclaration = ts.createNode(72 /* Identifier */); - globalThisSymbol.valueDeclaration.escapedText = "globalThis"; globals.set(globalThisSymbol.escapedName, globalThisSymbol); var argumentsSymbol = createSymbol(4 /* Property */, "arguments"); var requireSymbol = createSymbol(4 /* Property */, "require"); @@ -31190,6 +31384,11 @@ var ts; getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); }, getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount") + symbolCount; }, getTypeCount: function () { return typeCount; }, + getRelationCacheSizes: function () { return ({ + assignable: assignableRelation.size, + identity: identityRelation.size, + subtype: subtypeRelation.size, + }); }, isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, isUnknownSymbol: function (symbol) { return symbol === unknownSymbol; }, @@ -31256,6 +31455,10 @@ var ts; node = ts.getParseTreeNode(node); return node ? getTypeOfNode(node) : errorType; }, + getTypeOfAssignmentPattern: function (nodeIn) { + var node = ts.getParseTreeNode(nodeIn, ts.isAssignmentPattern); + return node && getTypeOfAssignmentPattern(node) || errorType; + }, getPropertySymbolOfDestructuringAssignment: function (locationIn) { var location = ts.getParseTreeNode(locationIn, ts.isIdentifier); return location ? getPropertySymbolOfDestructuringAssignment(location) : undefined; @@ -31304,11 +31507,11 @@ var ts; }, isContextSensitive: isContextSensitive, getFullyQualifiedName: getFullyQualifiedName, - getResolvedSignature: function (node, candidatesOutArray, agumentCount) { - return getResolvedSignatureWorker(node, candidatesOutArray, agumentCount, 0 /* Normal */); + getResolvedSignature: function (node, candidatesOutArray, argumentCount) { + return getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */); }, - getResolvedSignatureForSignatureHelp: function (node, candidatesOutArray, agumentCount) { - return getResolvedSignatureWorker(node, candidatesOutArray, agumentCount, 16 /* IsForSignatureHelp */); + getResolvedSignatureForSignatureHelp: function (node, candidatesOutArray, argumentCount) { + return getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */); }, getExpandedParameters: getExpandedParameters, hasEffectiveRestParameter: hasEffectiveRestParameter, @@ -31451,7 +31654,7 @@ var ts; var intersectionTypes = ts.createMap(); var literalTypes = ts.createMap(); var indexedAccessTypes = ts.createMap(); - var conditionalTypes = ts.createMap(); + var substitutionTypes = ts.createMap(); var evolvingArrayTypes = []; var undefinedProperties = ts.createMap(); var unknownSymbol = createSymbol(4 /* Property */, "unknown"); @@ -31461,10 +31664,10 @@ var ts; var wildcardType = createIntrinsicType(1 /* Any */, "any"); var errorType = createIntrinsicType(1 /* Any */, "error"); var unknownType = createIntrinsicType(2 /* Unknown */, "unknown"); - var undefinedType = createNullableType(32768 /* Undefined */, "undefined", 0); - var undefinedWideningType = strictNullChecks ? undefinedType : createNullableType(32768 /* Undefined */, "undefined", 131072 /* ContainsWideningType */); - var nullType = createNullableType(65536 /* Null */, "null", 0); - var nullWideningType = strictNullChecks ? nullType : createNullableType(65536 /* Null */, "null", 131072 /* ContainsWideningType */); + var undefinedType = createIntrinsicType(32768 /* Undefined */, "undefined"); + var undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(32768 /* Undefined */, "undefined", 131072 /* ContainsWideningType */); + var nullType = createIntrinsicType(65536 /* Null */, "null"); + var nullWideningType = strictNullChecks ? nullType : createIntrinsicType(65536 /* Null */, "null", 131072 /* ContainsWideningType */); var stringType = createIntrinsicType(4 /* String */, "string"); var numberType = createIntrinsicType(8 /* Number */, "number"); var bigintType = createIntrinsicType(64 /* BigInt */, "bigint"); @@ -31490,6 +31693,7 @@ var ts; var voidType = createIntrinsicType(16384 /* Void */, "void"); var neverType = createIntrinsicType(131072 /* Never */, "never"); var silentNeverType = createIntrinsicType(131072 /* Never */, "never"); + var nonInferrableType = createIntrinsicType(131072 /* Never */, "never", 524288 /* NonInferrableType */); var implicitNeverType = createIntrinsicType(131072 /* Never */, "never"); var nonPrimitiveType = createIntrinsicType(67108864 /* NonPrimitive */, "object"); var stringNumberSymbolType = getUnionType([stringType, numberType, esSymbolType]); @@ -31506,7 +31710,7 @@ var ts; var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, undefined, undefined); // The anyFunctionType contains the anyFunctionType by definition. The flag is further propagated // in getPropagatingFlagsOfTypes, and it is checked in inferFromTypes. - anyFunctionType.objectFlags |= 524288 /* ContainsAnyFunctionType */; + anyFunctionType.objectFlags |= 524288 /* NonInferrableType */; var noConstraintType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, undefined, undefined); var circularConstraintType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, undefined, undefined); var resolvingDefaultType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, undefined, undefined); @@ -31530,6 +31734,7 @@ var ts; * This is only used if there is no exact match. */ var patternAmbientModules; + var patternAmbientModuleAugmentations; var globalObjectType; var globalFunctionType; var globalCallableFunctionType; @@ -31564,8 +31769,7 @@ var ts; var deferredGlobalTemplateStringsArrayType; var deferredGlobalImportMetaType; var deferredGlobalExtractSymbol; - var deferredGlobalExcludeSymbol; - var deferredGlobalPickSymbol; + var deferredGlobalOmitSymbol; var deferredGlobalBigIntType; var allPotentiallyUnusedIdentifiers = ts.createMap(); // key is file name var flowLoopStart = 0; @@ -31584,6 +31788,8 @@ var ts; var symbolLinks = []; var nodeLinks = []; var flowLoopCaches = []; + var flowAssignmentKeys = []; + var flowAssignmentTypes = []; var flowLoopNodes = []; var flowLoopKeys = []; var flowLoopTypes = []; @@ -31700,6 +31906,7 @@ var ts; var typeofType = createTypeofType(); var _jsxNamespace; var _jsxFactoryEntity; + var outofbandVarianceMarkerHandler; var subtypeRelation = ts.createMap(); var assignableRelation = ts.createMap(); var comparableRelation = ts.createMap(); @@ -31724,6 +31931,18 @@ var ts; CheckMode[CheckMode["SkipGenericFunctions"] = 8] = "SkipGenericFunctions"; CheckMode[CheckMode["IsForSignatureHelp"] = 16] = "IsForSignatureHelp"; })(CheckMode || (CheckMode = {})); + var ContextFlags; + (function (ContextFlags) { + ContextFlags[ContextFlags["None"] = 0] = "None"; + ContextFlags[ContextFlags["Signature"] = 1] = "Signature"; + })(ContextFlags || (ContextFlags = {})); + var AccessFlags; + (function (AccessFlags) { + AccessFlags[AccessFlags["None"] = 0] = "None"; + AccessFlags[AccessFlags["NoIndexSignatures"] = 1] = "NoIndexSignatures"; + AccessFlags[AccessFlags["Writing"] = 2] = "Writing"; + AccessFlags[AccessFlags["CacheSymbol"] = 4] = "CacheSymbol"; + })(AccessFlags || (AccessFlags = {})); var CallbackCheck; (function (CallbackCheck) { CallbackCheck[CallbackCheck["None"] = 0] = "None"; @@ -31898,7 +32117,8 @@ var ts; * Note: if target is transient, then it is mutable, and mergeSymbol with both mutate and return it. * If target is not transient, mergeSymbol will produce a transient clone, mutate that and return it. */ - function mergeSymbol(target, source) { + function mergeSymbol(target, source, unidirectional) { + if (unidirectional === void 0) { unidirectional = false; } if (!(target.flags & getExcludedSymbolFlags(source.flags)) || (source.flags | target.flags) & 67108864 /* Assignment */) { ts.Debug.assert(source !== target); @@ -31926,17 +32146,24 @@ var ts; if (source.members) { if (!target.members) target.members = ts.createSymbolTable(); - mergeSymbolTable(target.members, source.members); + mergeSymbolTable(target.members, source.members, unidirectional); } if (source.exports) { if (!target.exports) target.exports = ts.createSymbolTable(); - mergeSymbolTable(target.exports, source.exports); + mergeSymbolTable(target.exports, source.exports, unidirectional); + } + if (!unidirectional) { + recordMergedSymbol(target, source); } - recordMergedSymbol(target, source); } else if (target.flags & 1024 /* NamespaceModule */) { - error(ts.getNameOfDeclaration(source.declarations[0]), ts.Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity, symbolToString(target)); + // Do not report an error when merging `var globalThis` with the built-in `globalThis`, + // as we will already report a "Declaration name conflicts..." error, and this error + // won't make much sense. + if (target !== globalThisSymbol) { + error(ts.getNameOfDeclaration(source.declarations[0]), ts.Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity, symbolToString(target)); + } } else { // error var isEitherEnum = !!(target.flags & 384 /* Enum */ || source.flags & 384 /* Enum */); @@ -32001,10 +32228,11 @@ var ts; mergeSymbolTable(combined, second); return combined; } - function mergeSymbolTable(target, source) { + function mergeSymbolTable(target, source, unidirectional) { + if (unidirectional === void 0) { unidirectional = false; } source.forEach(function (sourceSymbol, id) { var targetSymbol = target.get(id); - target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol) : sourceSymbol); + target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol); }); } function mergeModuleAugmentation(moduleName) { @@ -32025,14 +32253,29 @@ var ts; var moduleNotFoundError = !(moduleName.parent.parent.flags & 4194304 /* Ambient */) ? ts.Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found : undefined; - var mainModule = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError, /*isForAugmentation*/ true); - if (!mainModule) { + var mainModule_1 = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError, /*isForAugmentation*/ true); + if (!mainModule_1) { return; } // obtain item referenced by 'export=' - mainModule = resolveExternalModuleSymbol(mainModule); - if (mainModule.flags & 1920 /* Namespace */) { - mainModule = mergeSymbol(mainModule, moduleAugmentation.symbol); + mainModule_1 = resolveExternalModuleSymbol(mainModule_1); + if (mainModule_1.flags & 1920 /* Namespace */) { + // If we’re merging an augmentation to a pattern ambient module, we want to + // perform the merge unidirectionally from the augmentation ('a.foo') to + // the pattern ('*.foo'), so that 'getMergedSymbol()' on a.foo gives you + // all the exports both from the pattern and from the augmentation, but + // 'getMergedSymbol()' on *.foo only gives you exports from *.foo. + if (ts.some(patternAmbientModules, function (module) { return mainModule_1 === module.symbol; })) { + var merged = mergeSymbol(moduleAugmentation.symbol, mainModule_1, /*unidirectional*/ true); + if (!patternAmbientModuleAugmentations) { + patternAmbientModuleAugmentations = ts.createMap(); + } + // moduleName will be a StringLiteral since this is not `declare global`. + patternAmbientModuleAugmentations.set(moduleName.text, merged); + } + else { + mergeSymbol(mainModule_1, moduleAugmentation.symbol); + } } else { // moduleName will be a StringLiteral since this is not `declare global`. @@ -32066,7 +32309,7 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = { flags: 0 }); } function isGlobalSourceFile(node) { - return node.kind === 284 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); + return node.kind === 285 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -32124,17 +32367,17 @@ var ts; } if (declaration.pos <= usage.pos) { // declaration is before usage - if (declaration.kind === 186 /* BindingElement */) { + if (declaration.kind === 187 /* BindingElement */) { // still might be illegal if declaration and usage are both binding elements (eg var [a = b, b = b] = [1, 2]) - var errorBindingElement = ts.getAncestor(usage, 186 /* BindingElement */); + var errorBindingElement = ts.getAncestor(usage, 187 /* BindingElement */); if (errorBindingElement) { return ts.findAncestor(errorBindingElement, ts.isBindingElement) !== ts.findAncestor(declaration, ts.isBindingElement) || declaration.pos < errorBindingElement.pos; } // or it might be illegal if usage happens before parent variable is declared (eg var [a] = a) - return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 237 /* VariableDeclaration */), usage); + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 238 /* VariableDeclaration */), usage); } - else if (declaration.kind === 237 /* VariableDeclaration */) { + else if (declaration.kind === 238 /* VariableDeclaration */) { // still might be illegal if usage is in the initializer of the variable declaration (eg var a = a) return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } @@ -32142,6 +32385,10 @@ var ts; // still might be illegal if the usage is within a computed property name in the class (eg class A { static p = "a"; [A.p]() {} }) return !ts.findAncestor(usage, function (n) { return ts.isComputedPropertyName(n) && n.parent.parent === declaration; }); } + else if (ts.isPropertyDeclaration(declaration)) { + // still might be illegal if a self-referencing property initializer (eg private x = this.x) + return !isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage); + } return true; } // declaration is after usage, but it can still be legal if usage is deferred: @@ -32153,12 +32400,12 @@ var ts; // or if usage is in a type context: // 1. inside a type query (typeof in type position) // 2. inside a jsdoc comment - if (usage.parent.kind === 257 /* ExportSpecifier */ || (usage.parent.kind === 254 /* ExportAssignment */ && usage.parent.isExportEquals)) { + if (usage.parent.kind === 258 /* ExportSpecifier */ || (usage.parent.kind === 255 /* ExportAssignment */ && usage.parent.isExportEquals)) { // export specifiers do not use the variable, they only make it available for use return true; } // When resolving symbols for exports, the `usage` location passed in can be the export site directly - if (usage.kind === 254 /* ExportAssignment */ && usage.isExportEquals) { + if (usage.kind === 255 /* ExportAssignment */ && usage.isExportEquals) { return true; } var container = ts.getEnclosingBlockScopeContainer(declaration); @@ -32166,9 +32413,9 @@ var ts; function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); switch (declaration.parent.parent.kind) { - case 219 /* VariableStatement */: - case 225 /* ForStatement */: - case 227 /* ForOfStatement */: + case 220 /* VariableStatement */: + case 226 /* ForStatement */: + case 228 /* ForOfStatement */: // variable statement/for/for-of statement case, // use site should not be inside variable declaration (initializer of declaration or binding element) if (isSameScopeDescendentOf(usage, declaration, container)) { @@ -32189,16 +32436,16 @@ var ts; return true; } var initializerOfProperty = current.parent && - current.parent.kind === 154 /* PropertyDeclaration */ && + current.parent.kind === 155 /* PropertyDeclaration */ && current.parent.initializer === current; if (initializerOfProperty) { if (ts.hasModifier(current.parent, 32 /* Static */)) { - if (declaration.kind === 156 /* MethodDeclaration */) { + if (declaration.kind === 157 /* MethodDeclaration */) { return true; } } else { - var isDeclarationInstanceProperty = declaration.kind === 154 /* PropertyDeclaration */ && !ts.hasModifier(declaration, 32 /* Static */); + var isDeclarationInstanceProperty = declaration.kind === 155 /* PropertyDeclaration */ && !ts.hasModifier(declaration, 32 /* Static */); if (!isDeclarationInstanceProperty || ts.getContainingClass(usage) !== ts.getContainingClass(declaration)) { return true; } @@ -32207,6 +32454,36 @@ var ts; return false; }); } + function isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage) { + // always legal if usage is after declaration + if (usage.end > declaration.end) { + return false; + } + // still might be legal if usage is deferred (e.g. x: any = () => this.x) + // otherwise illegal if immediately referenced within the declaration (e.g. x: any = this.x) + var ancestorChangingReferenceScope = ts.findAncestor(usage, function (node) { + if (node === declaration) { + return "quit"; + } + switch (node.kind) { + case 198 /* ArrowFunction */: + case 155 /* PropertyDeclaration */: + return true; + case 219 /* Block */: + switch (node.parent.kind) { + case 159 /* GetAccessor */: + case 157 /* MethodDeclaration */: + case 160 /* SetAccessor */: + return true; + default: + return false; + } + default: + return false; + } + }); + return ancestorChangingReferenceScope === undefined; + } } /** * Resolve a given name for a given meaning at a given location. An error is reported if the name was not found and @@ -32225,6 +32502,8 @@ var ts; var lastLocation; var lastSelfReferenceLocation; var propertyWithInvalidInitializer; + var associatedDeclarationForContainingInitializer; + var withinDeferredContext = false; var errorLocation = location; var grandparent; var isInExternalModule = false; @@ -32240,12 +32519,12 @@ var ts; // - parameters are only in the scope of function body // This restriction does not apply to JSDoc comment types because they are parented // at a higher level than type parameters would normally be - if (meaning & result.flags & 67897832 /* Type */ && lastLocation.kind !== 296 /* JSDocComment */) { + if (meaning & result.flags & 67897832 /* Type */ && lastLocation.kind !== 297 /* JSDocComment */) { useResult = result.flags & 262144 /* TypeParameter */ // type parameters are visible in parameter list, return type and type parameter list ? lastLocation === location.type || - lastLocation.kind === 151 /* Parameter */ || - lastLocation.kind === 150 /* TypeParameter */ + lastLocation.kind === 152 /* Parameter */ || + lastLocation.kind === 151 /* TypeParameter */ // local types not visible outside the function body : false; } @@ -32262,13 +32541,13 @@ var ts; // however it is detected separately when checking initializers of parameters // to make sure that they reference no variables declared after them. useResult = - lastLocation.kind === 151 /* Parameter */ || + lastLocation.kind === 152 /* Parameter */ || (lastLocation === location.type && !!ts.findAncestor(result.valueDeclaration, ts.isParameter)); } } } - else if (location.kind === 175 /* ConditionalType */) { + else if (location.kind === 176 /* ConditionalType */) { // A type parameter declared using 'infer T' in a conditional type is visible only in // the true branch of the conditional type. useResult = lastLocation === location.trueType; @@ -32281,15 +32560,16 @@ var ts; } } } + withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation); switch (location.kind) { - case 284 /* SourceFile */: + case 285 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; // falls through - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 284 /* SourceFile */ || ts.isAmbientModule(location)) { + if (location.kind === 285 /* SourceFile */ || ts.isAmbientModule(location)) { // It's an external module. First see if the module has an export default and if the local // name of that export default matches. if (result = moduleExports.get("default" /* Default */)) { @@ -32313,7 +32593,7 @@ var ts; var moduleExport = moduleExports.get(name); if (moduleExport && moduleExport.flags === 2097152 /* Alias */ && - ts.getDeclarationOfKind(moduleExport, 257 /* ExportSpecifier */)) { + ts.getDeclarationOfKind(moduleExport, 258 /* ExportSpecifier */)) { break; } } @@ -32327,20 +32607,19 @@ var ts; } } break; - case 243 /* EnumDeclaration */: + case 244 /* EnumDeclaration */: if (result = lookup(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) { break loop; } break; - case 154 /* PropertyDeclaration */: - case 153 /* PropertySignature */: + case 155 /* PropertyDeclaration */: // TypeScript 1.0 spec (April 2014): 8.4.1 // Initializer expressions for instance member variables are evaluated in the scope // of the class constructor body but are not permitted to reference parameters or // local variables of the constructor. This effectively means that entities from outer scopes // by the same name as a constructor parameter or local variable are inaccessible // in initializer expressions for instance member variables. - if (ts.isClassLike(location.parent) && !ts.hasModifier(location, 32 /* Static */)) { + if (!ts.hasModifier(location, 32 /* Static */)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (lookup(ctor.locals, name, meaning & 67220415 /* Value */)) { @@ -32350,9 +32629,9 @@ var ts; } } break; - case 240 /* ClassDeclaration */: - case 209 /* ClassExpression */: - case 241 /* InterfaceDeclaration */: + case 241 /* ClassDeclaration */: + case 210 /* ClassExpression */: + case 242 /* InterfaceDeclaration */: // The below is used to lookup type parameters within a class or interface, as they are added to the class/interface locals // These can never be latebound, so the symbol's raw members are sufficient. `getMembersOfNode` cannot be used, as it would // trigger resolving late-bound names, which we may already be in the process of doing while we're here! @@ -32371,7 +32650,7 @@ var ts; } break loop; } - if (location.kind === 209 /* ClassExpression */ && meaning & 32 /* Class */) { + if (location.kind === 210 /* ClassExpression */ && meaning & 32 /* Class */) { var className = location.name; if (className && name === className.escapedText) { result = location.symbol; @@ -32379,9 +32658,9 @@ var ts; } } break; - case 211 /* ExpressionWithTypeArguments */: + case 212 /* ExpressionWithTypeArguments */: // The type parameters of a class are not in scope in the base class expression. - if (lastLocation === location.expression && location.parent.token === 86 /* ExtendsKeyword */) { + if (lastLocation === location.expression && location.parent.token === 87 /* ExtendsKeyword */) { var container = location.parent.parent; if (ts.isClassLike(container) && (result = lookup(getSymbolOfNode(container).members, name, meaning & 67897832 /* Type */))) { if (nameNotFoundMessage) { @@ -32399,9 +32678,9 @@ var ts; // [foo()]() { } // <-- Reference to T from class's own computed property // } // - case 149 /* ComputedPropertyName */: + case 150 /* ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 241 /* InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 242 /* InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 67897832 /* Type */)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); @@ -32409,24 +32688,24 @@ var ts; } } break; - case 197 /* ArrowFunction */: + case 198 /* ArrowFunction */: // when targeting ES6 or higher there is no 'arguments' in an arrow function // for lower compile targets the resolved symbol is used to emit an error if (compilerOptions.target >= 2 /* ES2015 */) { break; } // falls through - case 156 /* MethodDeclaration */: - case 157 /* Constructor */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 239 /* FunctionDeclaration */: + case 157 /* MethodDeclaration */: + case 158 /* Constructor */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 240 /* FunctionDeclaration */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 196 /* FunctionExpression */: + case 197 /* FunctionExpression */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -32439,7 +32718,7 @@ var ts; } } break; - case 152 /* Decorator */: + case 153 /* Decorator */: // Decorators are resolved at the class declaration. Resolving at the parameter // or member would result in looking up locals in the method. // @@ -32448,7 +32727,7 @@ var ts; // method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter. // } // - if (location.parent && location.parent.kind === 151 /* Parameter */) { + if (location.parent && location.parent.kind === 152 /* Parameter */) { location = location.parent; } // @@ -32463,15 +32742,28 @@ var ts; // declare function y(x: T): any; // @param(1 as T) // <-- T should resolve to the type alias outside of class C // class C {} - if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 240 /* ClassDeclaration */)) { + if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 241 /* ClassDeclaration */)) { location = location.parent; } break; - case 309 /* JSDocTypedefTag */: - case 302 /* JSDocCallbackTag */: + case 310 /* JSDocTypedefTag */: + case 303 /* JSDocCallbackTag */: // js type aliases do not resolve names from their host, so skip past it location = ts.getJSDocHost(location); break; + case 152 /* Parameter */: + if (lastLocation && lastLocation === location.initializer) { + associatedDeclarationForContainingInitializer = location; + } + break; + case 187 /* BindingElement */: + if (lastLocation && lastLocation === location.initializer) { + var root = ts.getRootDeclaration(location); + if (root.kind === 152 /* Parameter */) { + associatedDeclarationForContainingInitializer = location; + } + } + break; } if (isSelfReferenceLocation(location)) { lastSelfReferenceLocation = location; @@ -32487,7 +32779,7 @@ var ts; } if (!result) { if (lastLocation) { - ts.Debug.assert(lastLocation.kind === 284 /* SourceFile */); + ts.Debug.assert(lastLocation.kind === 285 /* SourceFile */); if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) { return lastLocation.symbol; } @@ -32563,20 +32855,48 @@ var ts; if (result && isInExternalModule && (meaning & 67220415 /* Value */) === 67220415 /* Value */ && !(originalLocation.flags & 2097152 /* JSDoc */)) { var merged = getMergedSymbol(result); if (ts.length(merged.declarations) && ts.every(merged.declarations, function (d) { return ts.isNamespaceExportDeclaration(d) || ts.isSourceFile(d) && !!d.symbol.globalExports; })) { - error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name)); // TODO: GH#18217 + errorOrSuggestion(!compilerOptions.allowUmdGlobalAccess, errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name)); + } + } + // If we're in a parameter initializer, we can't reference the values of the parameter whose initializer we're within or parameters to the right + if (result && associatedDeclarationForContainingInitializer && !withinDeferredContext && (meaning & 67220415 /* Value */) === 67220415 /* Value */) { + var candidate = getMergedSymbol(getLateBoundSymbol(result)); + var root = ts.getRootDeclaration(associatedDeclarationForContainingInitializer); + // A parameter initializer or binding pattern initializer within a parameter cannot refer to itself + if (candidate === getSymbolOfNode(associatedDeclarationForContainingInitializer)) { + error(errorLocation, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(associatedDeclarationForContainingInitializer.name)); + } + // And it cannot refer to any declarations which come after it + else if (candidate.valueDeclaration && candidate.valueDeclaration.pos > associatedDeclarationForContainingInitializer.pos && root.parent.locals && lookup(root.parent.locals, candidate.escapedName, meaning) === candidate) { + error(errorLocation, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(associatedDeclarationForContainingInitializer.name), ts.declarationNameToString(errorLocation)); } } } return result; } + function getIsDeferredContext(location, lastLocation) { + if (location.kind !== 198 /* ArrowFunction */ && location.kind !== 197 /* FunctionExpression */) { + // initializers in instance property declaration of class like entities are executed in constructor and thus deferred + return ts.isTypeQueryNode(location) || ((ts.isFunctionLikeDeclaration(location) || + (location.kind === 155 /* PropertyDeclaration */ && !ts.hasModifier(location, 32 /* Static */))) && (!lastLocation || lastLocation !== location.name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred + } + if (lastLocation && lastLocation === location.name) { + return false; + } + // generator functions and async functions are not inlined in control flow when immediately invoked + if (location.asteriskToken || ts.hasModifier(location, 256 /* Async */)) { + return true; + } + return !ts.getImmediatelyInvokedFunctionExpression(location); + } function isSelfReferenceLocation(node) { switch (node.kind) { - case 239 /* FunctionDeclaration */: - case 240 /* ClassDeclaration */: - case 241 /* InterfaceDeclaration */: - case 243 /* EnumDeclaration */: - case 242 /* TypeAliasDeclaration */: - case 244 /* ModuleDeclaration */: // For `namespace N { N; }` + case 240 /* FunctionDeclaration */: + case 241 /* ClassDeclaration */: + case 242 /* InterfaceDeclaration */: + case 244 /* EnumDeclaration */: + case 243 /* TypeAliasDeclaration */: + case 245 /* ModuleDeclaration */: // For `namespace N { N; }` return true; default: return false; @@ -32588,7 +32908,7 @@ var ts; function isTypeParameterSymbolDeclaredInContainer(symbol, container) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - if (decl.kind === 150 /* TypeParameter */) { + if (decl.kind === 151 /* TypeParameter */) { var parent = ts.isJSDocTemplateTag(decl.parent) ? ts.getJSDocHost(decl.parent) : decl.parent; if (parent === container) { return !(ts.isJSDocTemplateTag(decl.parent) && ts.find(decl.parent.parent.tags, ts.isJSDocTypeAlias)); // TODO: GH#18217 @@ -32643,10 +32963,10 @@ var ts; */ function getEntityNameForExtendingInterface(node) { switch (node.kind) { - case 72 /* Identifier */: - case 189 /* PropertyAccessExpression */: + case 73 /* Identifier */: + case 190 /* PropertyAccessExpression */: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 211 /* ExpressionWithTypeArguments */: + case 212 /* ExpressionWithTypeArguments */: if (ts.isEntityNameExpression(node.expression)) { return node.expression; } @@ -32735,7 +33055,7 @@ var ts; function checkResolvedBlockScopedVariable(result, errorLocation) { ts.Debug.assert(!!(result.flags & 2 /* BlockScopedVariable */ || result.flags & 32 /* Class */ || result.flags & 384 /* Enum */)); // Block-scoped variables cannot be used before their definition - var declaration = ts.find(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 243 /* EnumDeclaration */) || ts.isInJSFile(d) && !!ts.getJSDocEnumTag(d); }); + var declaration = ts.find(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 244 /* EnumDeclaration */) || ts.isInJSFile(d) && !!ts.getJSDocEnumTag(d); }); if (declaration === undefined) return ts.Debug.fail("Declaration to checkResolvedBlockScopedVariable is undefined"); if (!(declaration.flags & 4194304 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { @@ -32770,13 +33090,13 @@ var ts; } function getAnyImportSyntax(node) { switch (node.kind) { - case 248 /* ImportEqualsDeclaration */: + case 249 /* ImportEqualsDeclaration */: return node; - case 250 /* ImportClause */: + case 251 /* ImportClause */: return node.parent; - case 251 /* NamespaceImport */: + case 252 /* NamespaceImport */: return node.parent.parent; - case 253 /* ImportSpecifier */: + case 254 /* ImportSpecifier */: return node.parent.parent.parent; default: return undefined; @@ -32786,7 +33106,7 @@ var ts; return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration); } function getTargetOfImportEqualsDeclaration(node, dontResolveAlias) { - if (node.moduleReference.kind === 259 /* ExternalModuleReference */) { + if (node.moduleReference.kind === 260 /* ExternalModuleReference */) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, dontResolveAlias); @@ -32843,7 +33163,16 @@ var ts; var file = ts.find(moduleSymbol.declarations, ts.isSourceFile); var hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias); if (!exportDefaultSymbol && !hasSyntheticDefault) { - error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); + if (hasExportAssignmentSymbol(moduleSymbol)) { + var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop"; + var exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */); + var exportAssignment = exportEqualsSymbol.valueDeclaration; + var err = error(node.name, ts.Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName); + ts.addRelatedInfo(err, ts.createDiagnosticForNode(exportAssignment, ts.Diagnostics.This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag, compilerOptionName)); + } + else { + error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); + } } else if (hasSyntheticDefault) { // per emit behavior, a synthetic default overrides a "real" .default member if `__esModule` is not present @@ -32978,20 +33307,20 @@ var ts; function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) { if (dontRecursivelyResolve === void 0) { dontRecursivelyResolve = false; } switch (node.kind) { - case 248 /* ImportEqualsDeclaration */: + case 249 /* ImportEqualsDeclaration */: return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve); - case 250 /* ImportClause */: + case 251 /* ImportClause */: return getTargetOfImportClause(node, dontRecursivelyResolve); - case 251 /* NamespaceImport */: + case 252 /* NamespaceImport */: return getTargetOfNamespaceImport(node, dontRecursivelyResolve); - case 253 /* ImportSpecifier */: + case 254 /* ImportSpecifier */: return getTargetOfImportSpecifier(node, dontRecursivelyResolve); - case 257 /* ExportSpecifier */: + case 258 /* ExportSpecifier */: return getTargetOfExportSpecifier(node, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, dontRecursivelyResolve); - case 254 /* ExportAssignment */: - case 204 /* BinaryExpression */: + case 255 /* ExportAssignment */: + case 205 /* BinaryExpression */: return getTargetOfExportAssignment(node, dontRecursivelyResolve); - case 247 /* NamespaceExportDeclaration */: + case 248 /* NamespaceExportDeclaration */: return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve); default: return ts.Debug.fail(); @@ -33052,11 +33381,11 @@ var ts; var node = getDeclarationOfAliasSymbol(symbol); if (!node) return ts.Debug.fail(); - if (node.kind === 254 /* ExportAssignment */) { + if (node.kind === 255 /* ExportAssignment */) { // export default checkExpressionCached(node.expression); } - else if (node.kind === 257 /* ExportSpecifier */) { + else if (node.kind === 258 /* ExportSpecifier */) { // export { } or export { as foo } checkExpressionCached(node.propertyName || node.name); } @@ -33074,17 +33403,17 @@ var ts; // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - if (entityName.kind === 72 /* Identifier */ && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (entityName.kind === 73 /* Identifier */ && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } // Check for case 1 and 3 in the above example - if (entityName.kind === 72 /* Identifier */ || entityName.parent.kind === 148 /* QualifiedName */) { + if (entityName.kind === 73 /* Identifier */ || entityName.parent.kind === 149 /* QualifiedName */) { return resolveEntityName(entityName, 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 248 /* ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 249 /* ImportEqualsDeclaration */); return resolveEntityName(entityName, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } } @@ -33100,17 +33429,17 @@ var ts; } var namespaceMeaning = 1920 /* Namespace */ | (ts.isInJSFile(name) ? meaning & 67220415 /* Value */ : 0); var symbol; - if (name.kind === 72 /* Identifier */) { - var message = meaning === namespaceMeaning ? ts.Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(getFirstIdentifier(name).escapedText); + if (name.kind === 73 /* Identifier */) { + var message = meaning === namespaceMeaning ? ts.Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(getFirstIdentifier(name)); var symbolFromJSPrototype = ts.isInJSFile(name) ? resolveEntityNameFromAssignmentDeclaration(name, meaning) : undefined; symbol = resolveName(location || name, name.escapedText, meaning, ignoreErrors || symbolFromJSPrototype ? undefined : message, name, /*isUse*/ true); if (!symbol) { return symbolFromJSPrototype; } } - else if (name.kind === 148 /* QualifiedName */ || name.kind === 189 /* PropertyAccessExpression */) { - var left = name.kind === 148 /* QualifiedName */ ? name.left : name.expression; - var right = name.kind === 148 /* QualifiedName */ ? name.right : name.name; + else if (name.kind === 149 /* QualifiedName */ || name.kind === 190 /* PropertyAccessExpression */) { + var left = name.kind === 149 /* QualifiedName */ ? name.left : name.expression; + var right = name.kind === 149 /* QualifiedName */ ? name.right : name.name; var namespace = resolveEntityName(left, namespaceMeaning, ignoreErrors, /*dontResolveAlias*/ false, location); if (!namespace || ts.nodeIsMissing(right)) { return undefined; @@ -33245,6 +33574,14 @@ var ts; if (patternAmbientModules) { var pattern = ts.findBestPatternMatch(patternAmbientModules, function (_) { return _.pattern; }, moduleReference); if (pattern) { + // If the module reference matched a pattern ambient module ('*.foo') but there’s also a + // module augmentation by the specific name requested ('a.foo'), we store the merged symbol + // by the augmentation name ('a.foo'), because asking for *.foo should not give you exports + // from a.foo. + var augmentation = patternAmbientModuleAugmentations && patternAmbientModuleAugmentations.get(moduleReference); + if (augmentation) { + return getMergedSymbol(augmentation); + } return getMergedSymbol(pattern.symbol); } } @@ -33335,7 +33672,7 @@ var ts; function resolveESModuleSymbol(moduleSymbol, referencingLocation, dontResolveAlias) { var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias); if (!dontResolveAlias && symbol) { - if (!(symbol.flags & (1536 /* Module */ | 3 /* Variable */)) && !ts.getDeclarationOfKind(symbol, 284 /* SourceFile */)) { + if (!(symbol.flags & (1536 /* Module */ | 3 /* Variable */)) && !ts.getDeclarationOfKind(symbol, 285 /* SourceFile */)) { var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop"; @@ -33597,7 +33934,7 @@ var ts; var members = node.members; for (var _i = 0, members_2 = members; _i < members_2.length; _i++) { var member = members_2[_i]; - if (member.kind === 157 /* Constructor */ && ts.nodeIsPresent(member.body)) { + if (member.kind === 158 /* Constructor */ && ts.nodeIsPresent(member.body)) { return member; } } @@ -33608,13 +33945,10 @@ var ts; result.id = typeCount; return result; } - function createIntrinsicType(kind, intrinsicName) { + function createIntrinsicType(kind, intrinsicName, objectFlags) { + if (objectFlags === void 0) { objectFlags = 0; } var type = createType(kind); type.intrinsicName = intrinsicName; - return type; - } - function createNullableType(kind, intrinsicName, objectFlags) { - var type = createIntrinsicType(kind, intrinsicName); type.objectFlags = objectFlags; return type; } @@ -33646,7 +33980,7 @@ var ts; return type; } // A reserved member name starts with two underscores, but the third character cannot be an underscore - // or the @ symbol. A third underscore indicates an escaped form of an identifer that started + // or the @ symbol. A third underscore indicates an escaped form of an identifier that started // with at least two underscores. The @ character indicates that the name is denoted by a well known ES // Symbol instance. function isReservedMemberName(name) { @@ -33686,12 +34020,12 @@ var ts; } } switch (location.kind) { - case 284 /* SourceFile */: + case 285 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) { break; } // falls through - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: if (result = callback(getSymbolOfNode(location).exports)) { return result; } @@ -33755,7 +34089,7 @@ var ts; && (!useOnlyExternalAliasing || ts.some(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) // While exports are generally considered to be in scope, export-specifier declared symbols are _not_ // See similar comment in `resolveName` for details - && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 257 /* ExportSpecifier */))) { + && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 258 /* ExportSpecifier */))) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); if (isAccessible(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification)) { return [symbolFromSymbolTable]; @@ -33791,7 +34125,7 @@ var ts; return true; } // Qualify if the symbol from symbol table has same meaning as expected - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 257 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 258 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -33806,10 +34140,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; switch (declaration.kind) { - case 154 /* PropertyDeclaration */: - case 156 /* MethodDeclaration */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 155 /* PropertyDeclaration */: + case 157 /* MethodDeclaration */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: continue; default: return false; @@ -33865,7 +34199,7 @@ var ts; var containers = getContainersOfSymbol(symbol, enclosingDeclaration); // If we're trying to reference some object literal in, eg `var a = { x: 1 }`, the symbol for the literal, `__object`, is distinct // from the symbol of the declaration it is being assigned to. Since we can use the declaration to refer to the literal, however, - // we'd like to make that connection here - potentially causing us to paint the declararation's visibiility, and therefore the literal. + // we'd like to make that connection here - potentially causing us to paint the declaration's visibility, and therefore the literal. var firstDecl = ts.first(symbol.declarations); if (!ts.length(containers) && meaning & 67220415 /* Value */ && firstDecl && ts.isObjectLiteralExpression(firstDecl)) { if (firstDecl.parent && ts.isVariableDeclaration(firstDecl.parent) && firstDecl === firstDecl.parent.initializer) { @@ -33926,10 +34260,10 @@ var ts; return node && getSymbolOfNode(node); } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 284 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 285 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasNonGlobalAugmentationExternalModuleSymbol(declaration) { - return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 284 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 285 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -33976,14 +34310,14 @@ var ts; function isEntityNameVisible(entityName, enclosingDeclaration) { // get symbol of the first identifier of the entityName var meaning; - if (entityName.parent.kind === 167 /* TypeQuery */ || + if (entityName.parent.kind === 168 /* TypeQuery */ || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent) || - entityName.parent.kind === 149 /* ComputedPropertyName */) { + entityName.parent.kind === 150 /* ComputedPropertyName */) { // Typeof value meaning = 67220415 /* Value */ | 1048576 /* ExportValue */; } - else if (entityName.kind === 148 /* QualifiedName */ || entityName.kind === 189 /* PropertyAccessExpression */ || - entityName.parent.kind === 248 /* ImportEqualsDeclaration */) { + else if (entityName.kind === 149 /* QualifiedName */ || entityName.kind === 190 /* PropertyAccessExpression */ || + entityName.parent.kind === 249 /* ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1920 /* Namespace */; @@ -34032,10 +34366,10 @@ var ts; function signatureToStringWorker(writer) { var sigOutput; if (flags & 262144 /* WriteArrowStyleSignature */) { - sigOutput = kind === 1 /* Construct */ ? 166 /* ConstructorType */ : 165 /* FunctionType */; + sigOutput = kind === 1 /* Construct */ ? 167 /* ConstructorType */ : 166 /* FunctionType */; } else { - sigOutput = kind === 1 /* Construct */ ? 161 /* ConstructSignature */ : 160 /* CallSignature */; + sigOutput = kind === 1 /* Construct */ ? 162 /* ConstructSignature */ : 161 /* CallSignature */; } var sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | 512 /* WriteTypeParametersInQualifiedName */); var printer = ts.createPrinter({ removeComments: true, omitTrailingSemicolon: true }); @@ -34062,6 +34396,15 @@ var ts; } return result; } + function getTypeNamesForErrorDisplay(left, right) { + var leftStr = typeToString(left); + var rightStr = typeToString(right); + if (leftStr === rightStr) { + leftStr = typeToString(left, /*enclosingDeclaration*/ undefined, 64 /* UseFullyQualifiedType */); + rightStr = typeToString(right, /*enclosingDeclaration*/ undefined, 64 /* UseFullyQualifiedType */); + } + return [leftStr, rightStr]; + } function toNodeBuilderFlags(flags) { if (flags === void 0) { flags = 0 /* None */; } return flags & 9469291 /* NodeBuilderFlagsMask */; @@ -34130,26 +34473,26 @@ var ts; } if (type.flags & 1 /* Any */) { context.approximateLength += 3; - return ts.createKeywordTypeNode(120 /* AnyKeyword */); + return ts.createKeywordTypeNode(121 /* AnyKeyword */); } if (type.flags & 2 /* Unknown */) { - return ts.createKeywordTypeNode(143 /* UnknownKeyword */); + return ts.createKeywordTypeNode(144 /* UnknownKeyword */); } if (type.flags & 4 /* String */) { context.approximateLength += 6; - return ts.createKeywordTypeNode(138 /* StringKeyword */); + return ts.createKeywordTypeNode(139 /* StringKeyword */); } if (type.flags & 8 /* Number */) { context.approximateLength += 6; - return ts.createKeywordTypeNode(135 /* NumberKeyword */); + return ts.createKeywordTypeNode(136 /* NumberKeyword */); } if (type.flags & 64 /* BigInt */) { context.approximateLength += 6; - return ts.createKeywordTypeNode(146 /* BigIntKeyword */); + return ts.createKeywordTypeNode(147 /* BigIntKeyword */); } if (type.flags & 16 /* Boolean */) { context.approximateLength += 7; - return ts.createKeywordTypeNode(123 /* BooleanKeyword */); + return ts.createKeywordTypeNode(124 /* BooleanKeyword */); } if (type.flags & 1024 /* EnumLiteral */ && !(type.flags & 1048576 /* Union */)) { var parentSymbol = getParentOfSymbol(type.symbol); @@ -34167,8 +34510,9 @@ var ts; return ts.createLiteralTypeNode(ts.setEmitFlags(ts.createLiteral(type.value), 16777216 /* NoAsciiEscaping */)); } if (type.flags & 256 /* NumberLiteral */) { - context.approximateLength += (("" + type.value).length); - return ts.createLiteralTypeNode((ts.createLiteral(type.value))); + var value = type.value; + context.approximateLength += ("" + value).length; + return ts.createLiteralTypeNode(value < 0 ? ts.createPrefix(39 /* MinusToken */, ts.createLiteral(-value)) : ts.createLiteral(value)); } if (type.flags & 2048 /* BigIntLiteral */) { context.approximateLength += (ts.pseudoBigIntToString(type.value).length) + 1; @@ -34189,33 +34533,33 @@ var ts; } } context.approximateLength += 13; - return ts.createTypeOperatorNode(142 /* UniqueKeyword */, ts.createKeywordTypeNode(139 /* SymbolKeyword */)); + return ts.createTypeOperatorNode(143 /* UniqueKeyword */, ts.createKeywordTypeNode(140 /* SymbolKeyword */)); } if (type.flags & 16384 /* Void */) { context.approximateLength += 4; - return ts.createKeywordTypeNode(106 /* VoidKeyword */); + return ts.createKeywordTypeNode(107 /* VoidKeyword */); } if (type.flags & 32768 /* Undefined */) { context.approximateLength += 9; - return ts.createKeywordTypeNode(141 /* UndefinedKeyword */); + return ts.createKeywordTypeNode(142 /* UndefinedKeyword */); } if (type.flags & 65536 /* Null */) { context.approximateLength += 4; - return ts.createKeywordTypeNode(96 /* NullKeyword */); + return ts.createKeywordTypeNode(97 /* NullKeyword */); } if (type.flags & 131072 /* Never */) { context.approximateLength += 5; - return ts.createKeywordTypeNode(132 /* NeverKeyword */); + return ts.createKeywordTypeNode(133 /* NeverKeyword */); } if (type.flags & 4096 /* ESSymbol */) { context.approximateLength += 6; - return ts.createKeywordTypeNode(139 /* SymbolKeyword */); + return ts.createKeywordTypeNode(140 /* SymbolKeyword */); } if (type.flags & 67108864 /* NonPrimitive */) { context.approximateLength += 6; - return ts.createKeywordTypeNode(136 /* ObjectKeyword */); + return ts.createKeywordTypeNode(137 /* ObjectKeyword */); } - if (type.flags & 262144 /* TypeParameter */ && type.isThisType) { + if (isThisTypeParameter(type)) { if (context.flags & 4194304 /* InObjectTypeLiteral */) { if (!context.encounteredError && !(context.flags & 32768 /* AllowThisInObjectLiteral */)) { context.encounteredError = true; @@ -34265,7 +34609,7 @@ var ts; } var typeNodes = mapToTypeNodes(types, context, /*isBareList*/ true); if (typeNodes && typeNodes.length > 0) { - var unionOrIntersectionTypeNode = ts.createUnionOrIntersectionTypeNode(type.flags & 1048576 /* Union */ ? 173 /* UnionType */ : 174 /* IntersectionType */, typeNodes); + var unionOrIntersectionTypeNode = ts.createUnionOrIntersectionTypeNode(type.flags & 1048576 /* Union */ ? 174 /* UnionType */ : 175 /* IntersectionType */, typeNodes); return unionOrIntersectionTypeNode; } else { @@ -34298,8 +34642,8 @@ var ts; context.inferTypeParameters = type.root.inferTypeParameters; var extendsTypeNode = typeToTypeNodeHelper(type.extendsType, context); context.inferTypeParameters = saveInferTypeParameters; - var trueTypeNode = typeToTypeNodeHelper(type.trueType, context); - var falseTypeNode = typeToTypeNodeHelper(type.falseType, context); + var trueTypeNode = typeToTypeNodeHelper(getTrueTypeFromConditionalType(type), context); + var falseTypeNode = typeToTypeNodeHelper(getFalseTypeFromConditionalType(type), context); context.approximateLength += 15; return ts.createConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode); } @@ -34339,7 +34683,7 @@ var ts; return symbolToTypeNode(symbol, context, isInstanceType); } // Always use 'typeof T' for type of class, enum, and module objects - else if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 209 /* ClassExpression */ && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */) || + else if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 210 /* ClassExpression */ && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */) || symbol.flags & (384 /* Enum */ | 512 /* ValueModule */) || shouldWriteTypeOfFunctionSymbol()) { return symbolToTypeNode(symbol, context, 67220415 /* Value */); @@ -34386,7 +34730,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || // is exported function symbol ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 284 /* SourceFile */ || declaration.parent.kind === 245 /* ModuleBlock */; + return declaration.parent.kind === 285 /* SourceFile */ || declaration.parent.kind === 246 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -34407,12 +34751,12 @@ var ts; } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { var signature = resolved.callSignatures[0]; - var signatureNode = signatureToSignatureDeclarationHelper(signature, 165 /* FunctionType */, context); + var signatureNode = signatureToSignatureDeclarationHelper(signature, 166 /* FunctionType */, context); return signatureNode; } if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { var signature = resolved.constructSignatures[0]; - var signatureNode = signatureToSignatureDeclarationHelper(signature, 166 /* ConstructorType */, context); + var signatureNode = signatureToSignatureDeclarationHelper(signature, 167 /* ConstructorType */, context); return signatureNode; } } @@ -34433,7 +34777,7 @@ var ts; } var elementType = typeToTypeNodeHelper(typeArguments[0], context); var arrayType = ts.createArrayTypeNode(elementType); - return type.target === globalArrayType ? arrayType : ts.createTypeOperatorNode(133 /* ReadonlyKeyword */, arrayType); + return type.target === globalArrayType ? arrayType : ts.createTypeOperatorNode(134 /* ReadonlyKeyword */, arrayType); } else if (type.target.objectFlags & 8 /* Tuple */) { if (typeArguments.length > 0) { @@ -34447,12 +34791,12 @@ var ts; ts.createOptionalTypeNode(tupleConstituentNodes[i]); } var tupleTypeNode = ts.createTupleTypeNode(tupleConstituentNodes); - return type.target.readonly ? ts.createTypeOperatorNode(133 /* ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; + return type.target.readonly ? ts.createTypeOperatorNode(134 /* ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; } } if (context.encounteredError || (context.flags & 524288 /* AllowEmptyTuple */)) { var tupleTypeNode = ts.createTupleTypeNode([]); - return type.target.readonly ? ts.createTypeOperatorNode(133 /* ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; + return type.target.readonly ? ts.createTypeOperatorNode(134 /* ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; } context.encounteredError = true; return undefined; // TODO: GH#18217 @@ -34547,11 +34891,11 @@ var ts; var typeElements = []; for (var _i = 0, _a = resolvedType.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 160 /* CallSignature */, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 161 /* CallSignature */, context)); } for (var _b = 0, _c = resolvedType.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 161 /* ConstructSignature */, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 162 /* ConstructSignature */, context)); } if (resolvedType.stringIndexInfo) { var indexSignature = void 0; @@ -34598,15 +34942,15 @@ var ts; if (!(context.flags & 1 /* NoTruncation */)) { return ts.createTypeReferenceNode(ts.createIdentifier("..."), /*typeArguments*/ undefined); } - return ts.createKeywordTypeNode(120 /* AnyKeyword */); + return ts.createKeywordTypeNode(121 /* AnyKeyword */); } function addPropertyToElementList(propertySymbol, context, typeElements) { - var propertyIsReverseMapped = !!(ts.getCheckFlags(propertySymbol) & 4096 /* ReverseMapped */); + var propertyIsReverseMapped = !!(ts.getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */); var propertyType = propertyIsReverseMapped && context.flags & 33554432 /* InReverseMappedType */ ? anyType : getTypeOfSymbol(propertySymbol); var saveEnclosingDeclaration = context.enclosingDeclaration; context.enclosingDeclaration = undefined; - if (context.tracker.trackSymbol && ts.getCheckFlags(propertySymbol) & 2048 /* Late */) { + if (context.tracker.trackSymbol && ts.getCheckFlags(propertySymbol) & 4096 /* Late */) { var decl = ts.first(propertySymbol.declarations); if (hasLateBindableName(decl)) { trackComputedName(decl.name, saveEnclosingDeclaration, context); @@ -34620,7 +34964,7 @@ var ts; var signatures = getSignaturesOfType(propertyType, 0 /* Call */); for (var _i = 0, signatures_1 = signatures; _i < signatures_1.length; _i++) { var signature = signatures_1[_i]; - var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 155 /* MethodSignature */, context); + var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 156 /* MethodSignature */, context); methodDeclaration.name = propertyName; methodDeclaration.questionToken = optionalToken; if (propertySymbol.valueDeclaration) { @@ -34638,10 +34982,10 @@ var ts; propertyTypeNode = createElidedInformationPlaceholder(context); } else { - propertyTypeNode = propertyType ? typeToTypeNodeHelper(propertyType, context) : ts.createKeywordTypeNode(120 /* AnyKeyword */); + propertyTypeNode = propertyType ? typeToTypeNodeHelper(propertyType, context) : ts.createKeywordTypeNode(121 /* AnyKeyword */); } context.flags = savedFlags; - var modifiers = isReadonlySymbol(propertySymbol) ? [ts.createToken(133 /* ReadonlyKeyword */)] : undefined; + var modifiers = isReadonlySymbol(propertySymbol) ? [ts.createToken(134 /* ReadonlyKeyword */)] : undefined; if (modifiers) { context.approximateLength += 9; } @@ -34692,7 +35036,7 @@ var ts; } function indexInfoToIndexSignatureDeclarationHelper(indexInfo, kind, context) { var name = ts.getNameFromIndexInfo(indexInfo) || "x"; - var indexerTypeNode = ts.createKeywordTypeNode(kind === 0 /* String */ ? 138 /* StringKeyword */ : 135 /* NumberKeyword */); + var indexerTypeNode = ts.createKeywordTypeNode(kind === 0 /* String */ ? 139 /* StringKeyword */ : 136 /* NumberKeyword */); var indexingParameter = ts.createParameter( /*decorators*/ undefined, /*modifiers*/ undefined, @@ -34705,7 +35049,7 @@ var ts; } context.approximateLength += (name.length + 4); return ts.createIndexSignature( - /*decorators*/ undefined, indexInfo.isReadonly ? [ts.createToken(133 /* ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode); + /*decorators*/ undefined, indexInfo.isReadonly ? [ts.createToken(134 /* ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode); } function signatureToSignatureDeclarationHelper(signature, kind, context) { var typeParameters; @@ -34716,7 +35060,7 @@ var ts; else { typeParameters = signature.typeParameters && signature.typeParameters.map(function (parameter) { return typeParameterToDeclaration(parameter, context); }); } - var parameters = getExpandedParameters(signature).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 157 /* Constructor */); }); + var parameters = getExpandedParameters(signature).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 158 /* Constructor */); }); if (signature.thisParameter) { var thisParameter = symbolToParameterDeclaration(signature.thisParameter, context); parameters.unshift(thisParameter); @@ -34735,12 +35079,12 @@ var ts; returnTypeNode = returnType && typeToTypeNodeHelper(returnType, context); } if (context.flags & 256 /* SuppressAnyReturnType */) { - if (returnTypeNode && returnTypeNode.kind === 120 /* AnyKeyword */) { + if (returnTypeNode && returnTypeNode.kind === 121 /* AnyKeyword */) { returnTypeNode = undefined; } } else if (!returnTypeNode) { - returnTypeNode = ts.createKeywordTypeNode(120 /* AnyKeyword */); + returnTypeNode = ts.createKeywordTypeNode(121 /* AnyKeyword */); } context.approximateLength += 3; // Usually a signature contributes a few more characters than this, but 3 is the minimum return ts.createSignatureDeclaration(kind, typeParameters, parameters, returnTypeNode, typeArguments); @@ -34769,9 +35113,9 @@ var ts; return typeParameterToDeclarationWithConstraint(type, context, constraintNode); } function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags) { - var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 151 /* Parameter */); + var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 152 /* Parameter */); if (!parameterDeclaration && !isTransientSymbol(parameterSymbol)) { - parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 304 /* JSDocParameterTag */); + parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 305 /* JSDocParameterTag */); } var parameterType = getTypeOfSymbol(parameterSymbol); if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) { @@ -34779,16 +35123,16 @@ var ts; } var parameterTypeNode = typeToTypeNodeHelper(parameterType, context); var modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && parameterDeclaration.modifiers ? parameterDeclaration.modifiers.map(ts.getSynthesizedClone) : undefined; - var isRest = parameterDeclaration && ts.isRestParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 16384 /* RestParameter */; + var isRest = parameterDeclaration && ts.isRestParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 32768 /* RestParameter */; var dotDotDotToken = isRest ? ts.createToken(25 /* DotDotDotToken */) : undefined; var name = parameterDeclaration ? parameterDeclaration.name ? - parameterDeclaration.name.kind === 72 /* Identifier */ ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name), 16777216 /* NoAsciiEscaping */) : - parameterDeclaration.name.kind === 148 /* QualifiedName */ ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name.right), 16777216 /* NoAsciiEscaping */) : + parameterDeclaration.name.kind === 73 /* Identifier */ ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name), 16777216 /* NoAsciiEscaping */) : + parameterDeclaration.name.kind === 149 /* QualifiedName */ ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name.right), 16777216 /* NoAsciiEscaping */) : cloneBindingName(parameterDeclaration.name) : ts.symbolName(parameterSymbol) : ts.symbolName(parameterSymbol); - var isOptional = parameterDeclaration && isOptionalParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 8192 /* OptionalParameter */; + var isOptional = parameterDeclaration && isOptionalParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 16384 /* OptionalParameter */; var questionToken = isOptional ? ts.createToken(56 /* QuestionToken */) : undefined; var parameterNode = ts.createParameter( /*decorators*/ undefined, modifiers, dotDotDotToken, name, questionToken, parameterTypeNode, @@ -34803,7 +35147,7 @@ var ts; } var visited = ts.visitEachChild(node, elideInitializerAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndSetEmitFlags); var clone = ts.nodeIsSynthesized(visited) ? visited : ts.getSynthesizedClone(visited); - if (clone.kind === 186 /* BindingElement */) { + if (clone.kind === 187 /* BindingElement */) { clone.initializer = undefined; } return ts.setEmitFlags(clone, 1 /* SingleLine */ | 16777216 /* NoAsciiEscaping */); @@ -34905,6 +35249,11 @@ var ts; function lookupTypeParameterNodes(chain, index, context) { ts.Debug.assert(chain && 0 <= index && index < chain.length); var symbol = chain[index]; + var symbolId = "" + getSymbolId(symbol); + if (context.typeParameterSymbolList && context.typeParameterSymbolList.get(symbolId)) { + return undefined; + } + (context.typeParameterSymbolList || (context.typeParameterSymbolList = ts.createMap())).set(symbolId, true); var typeParameterNodes; if (context.flags & 512 /* WriteTypeParametersInQualifiedName */ && index < (chain.length - 1)) { var parentSymbol = symbol; @@ -34929,7 +35278,7 @@ var ts; return top; } function getSpecifierForModuleSymbol(symbol, context) { - var file = ts.getDeclarationOfKind(symbol, 284 /* SourceFile */); + var file = ts.getDeclarationOfKind(symbol, 285 /* SourceFile */); if (file && file.moduleName !== undefined) { // Use the amd name if it is available return file.moduleName; @@ -35169,8 +35518,8 @@ var ts; } function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) { - var node = ts.findAncestor(type.symbol.declarations[0].parent, function (n) { return n.kind !== 177 /* ParenthesizedType */; }); - if (node.kind === 242 /* TypeAliasDeclaration */) { + var node = ts.findAncestor(type.symbol.declarations[0].parent, function (n) { return n.kind !== 178 /* ParenthesizedType */; }); + if (node.kind === 243 /* TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -35178,11 +35527,11 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 245 /* ModuleBlock */ && + node.parent.kind === 246 /* ModuleBlock */ && ts.isExternalModuleAugmentation(node.parent.parent); } function isDefaultBindingContext(location) { - return location.kind === 284 /* SourceFile */ || ts.isAmbientModule(location); + return location.kind === 285 /* SourceFile */ || ts.isAmbientModule(location); } function getNameOfSymbolFromNameType(symbol, context) { var nameType = symbol.nameType; @@ -35223,7 +35572,7 @@ var ts; if (ts.isCallExpression(declaration) && ts.isBindableObjectDefinePropertyCall(declaration)) { return ts.symbolName(symbol); } - if (ts.isComputedPropertyName(name_2) && !(ts.getCheckFlags(symbol) & 2048 /* Late */) && symbol.nameType && symbol.nameType.flags & 384 /* StringOrNumberLiteral */) { + if (ts.isComputedPropertyName(name_2) && !(ts.getCheckFlags(symbol) & 4096 /* Late */) && symbol.nameType && symbol.nameType.flags & 384 /* StringOrNumberLiteral */) { // Computed property name isn't late bound, but has a well-known name type - use name type to generate a symbol name var result = getNameOfSymbolFromNameType(symbol, context); if (result !== undefined) { @@ -35232,17 +35581,17 @@ var ts; } return ts.declarationNameToString(name_2); } - if (declaration.parent && declaration.parent.kind === 237 /* VariableDeclaration */) { + if (declaration.parent && declaration.parent.kind === 238 /* VariableDeclaration */) { return ts.declarationNameToString(declaration.parent.name); } switch (declaration.kind) { - case 209 /* ClassExpression */: - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: + case 210 /* ClassExpression */: + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: if (context && !context.encounteredError && !(context.flags & 131072 /* AllowAnonymousIdentifier */)) { context.encounteredError = true; } - return declaration.kind === 209 /* ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)"; + return declaration.kind === 210 /* ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)"; } } var name = getNameOfSymbolFromNameType(symbol, context); @@ -35259,27 +35608,27 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 302 /* JSDocCallbackTag */: - case 309 /* JSDocTypedefTag */: + case 303 /* JSDocCallbackTag */: + case 310 /* JSDocTypedefTag */: // Top-level jsdoc type aliases are considered exported // First parent is comment node, second is hosting declaration or token; we only care about those tokens or declarations whose parent is a source file return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent)); - case 186 /* BindingElement */: + case 187 /* BindingElement */: return isDeclarationVisible(node.parent.parent); - case 237 /* VariableDeclaration */: + case 238 /* VariableDeclaration */: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { // If the binding pattern is empty, this variable declaration is not visible return false; } // falls through - case 244 /* ModuleDeclaration */: - case 240 /* ClassDeclaration */: - case 241 /* InterfaceDeclaration */: - case 242 /* TypeAliasDeclaration */: - case 239 /* FunctionDeclaration */: - case 243 /* EnumDeclaration */: - case 248 /* ImportEqualsDeclaration */: + case 245 /* ModuleDeclaration */: + case 241 /* ClassDeclaration */: + case 242 /* InterfaceDeclaration */: + case 243 /* TypeAliasDeclaration */: + case 240 /* FunctionDeclaration */: + case 244 /* EnumDeclaration */: + case 249 /* ImportEqualsDeclaration */: // external module augmentation is always visible if (ts.isExternalModuleAugmentation(node)) { return true; @@ -35287,53 +35636,53 @@ var ts; var parent = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(ts.getCombinedModifierFlags(node) & 1 /* Export */) && - !(node.kind !== 248 /* ImportEqualsDeclaration */ && parent.kind !== 284 /* SourceFile */ && parent.flags & 4194304 /* Ambient */)) { + !(node.kind !== 249 /* ImportEqualsDeclaration */ && parent.kind !== 285 /* SourceFile */ && parent.flags & 4194304 /* Ambient */)) { return isGlobalSourceFile(parent); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible return isDeclarationVisible(parent); - case 154 /* PropertyDeclaration */: - case 153 /* PropertySignature */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: + case 155 /* PropertyDeclaration */: + case 154 /* PropertySignature */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: if (ts.hasModifier(node, 8 /* Private */ | 16 /* Protected */)) { // Private/protected properties/methods are not visible return false; } // Public properties/methods are visible if its parents are visible, so: // falls through - case 157 /* Constructor */: - case 161 /* ConstructSignature */: - case 160 /* CallSignature */: - case 162 /* IndexSignature */: - case 151 /* Parameter */: - case 245 /* ModuleBlock */: - case 165 /* FunctionType */: - case 166 /* ConstructorType */: - case 168 /* TypeLiteral */: - case 164 /* TypeReference */: - case 169 /* ArrayType */: - case 170 /* TupleType */: - case 173 /* UnionType */: - case 174 /* IntersectionType */: - case 177 /* ParenthesizedType */: + case 158 /* Constructor */: + case 162 /* ConstructSignature */: + case 161 /* CallSignature */: + case 163 /* IndexSignature */: + case 152 /* Parameter */: + case 246 /* ModuleBlock */: + case 166 /* FunctionType */: + case 167 /* ConstructorType */: + case 169 /* TypeLiteral */: + case 165 /* TypeReference */: + case 170 /* ArrayType */: + case 171 /* TupleType */: + case 174 /* UnionType */: + case 175 /* IntersectionType */: + case 178 /* ParenthesizedType */: return isDeclarationVisible(node.parent); // Default binding, import specifier and namespace import is visible // only on demand so by default it is not visible - case 250 /* ImportClause */: - case 251 /* NamespaceImport */: - case 253 /* ImportSpecifier */: + case 251 /* ImportClause */: + case 252 /* NamespaceImport */: + case 254 /* ImportSpecifier */: return false; // Type parameters are always visible - case 150 /* TypeParameter */: + case 151 /* TypeParameter */: // Source file and namespace export are always visible - case 284 /* SourceFile */: - case 247 /* NamespaceExportDeclaration */: + case 285 /* SourceFile */: + case 248 /* NamespaceExportDeclaration */: return true; // Export assignments do not create name bindings outside the module - case 254 /* ExportAssignment */: + case 255 /* ExportAssignment */: return false; default: return false; @@ -35342,10 +35691,10 @@ var ts; } function collectLinkedAliases(node, setVisibility) { var exportSymbol; - if (node.parent && node.parent.kind === 254 /* ExportAssignment */) { + if (node.parent && node.parent.kind === 255 /* ExportAssignment */) { exportSymbol = resolveName(node, node.escapedText, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false); } - else if (node.parent.kind === 257 /* ExportSpecifier */) { + else if (node.parent.kind === 258 /* ExportSpecifier */) { exportSymbol = getTargetOfExportSpecifier(node.parent, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */); } var result; @@ -35441,12 +35790,12 @@ var ts; function getDeclarationContainer(node) { return ts.findAncestor(ts.getRootDeclaration(node), function (node) { switch (node.kind) { - case 237 /* VariableDeclaration */: - case 238 /* VariableDeclarationList */: - case 253 /* ImportSpecifier */: - case 252 /* NamedImports */: - case 251 /* NamespaceImport */: - case 250 /* ImportClause */: + case 238 /* VariableDeclaration */: + case 239 /* VariableDeclarationList */: + case 254 /* ImportSpecifier */: + case 253 /* NamedImports */: + case 252 /* NamespaceImport */: + case 251 /* ImportClause */: return false; default: return true; @@ -35479,7 +35828,7 @@ var ts; return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false); } function isComputedNonLiteralName(name) { - return name.kind === 149 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteralLike(name.expression); + return name.kind === 150 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteralLike(name.expression); } function getRestType(source, properties, symbol) { source = filterType(source, function (t) { return !(t.flags & 98304 /* Nullable */); }); @@ -35494,13 +35843,11 @@ var ts; if (omitKeyType.flags & 131072 /* Never */) { return source; } - var pickTypeAlias = getGlobalPickSymbol(); - var excludeTypeAlias = getGlobalExcludeSymbol(); - if (!pickTypeAlias || !excludeTypeAlias) { + var omitTypeAlias = getGlobalOmitSymbol(); + if (!omitTypeAlias) { return errorType; } - var pickKeys = getTypeAliasInstantiation(excludeTypeAlias, [getIndexType(source), omitKeyType]); - return getTypeAliasInstantiation(pickTypeAlias, [source, pickKeys]); + return getTypeAliasInstantiation(omitTypeAlias, [source, omitKeyType]); } var members = ts.createSymbolTable(); for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) { @@ -35533,7 +35880,7 @@ var ts; if (parentAccess && parentAccess.flowNode) { var propName = getDestructuringPropertyName(node); if (propName) { - var result = ts.createNode(190 /* ElementAccessExpression */, node.pos, node.end); + var result = ts.createNode(191 /* ElementAccessExpression */, node.pos, node.end); result.parent = node; result.expression = parentAccess; var literal = ts.createNode(10 /* StringLiteral */, node.pos, node.end); @@ -35548,23 +35895,23 @@ var ts; function getParentElementAccess(node) { var ancestor = node.parent.parent; switch (ancestor.kind) { - case 186 /* BindingElement */: - case 275 /* PropertyAssignment */: + case 187 /* BindingElement */: + case 276 /* PropertyAssignment */: return getSyntheticElementAccess(ancestor); - case 187 /* ArrayLiteralExpression */: + case 188 /* ArrayLiteralExpression */: return getSyntheticElementAccess(node.parent); - case 237 /* VariableDeclaration */: + case 238 /* VariableDeclaration */: return ancestor.initializer; - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: return ancestor.right; } } function getDestructuringPropertyName(node) { var parent = node.parent; - if (node.kind === 186 /* BindingElement */ && parent.kind === 184 /* ObjectBindingPattern */) { + if (node.kind === 187 /* BindingElement */ && parent.kind === 185 /* ObjectBindingPattern */) { return getLiteralPropertyNameText(node.propertyName || node.name); } - if (node.kind === 275 /* PropertyAssignment */ || node.kind === 276 /* ShorthandPropertyAssignment */) { + if (node.kind === 276 /* PropertyAssignment */ || node.kind === 277 /* ShorthandPropertyAssignment */) { return getLiteralPropertyNameText(node.name); } return "" + parent.elements.indexOf(node); @@ -35586,7 +35933,7 @@ var ts; parentType = getNonNullableType(parentType); } var type; - if (pattern.kind === 184 /* ObjectBindingPattern */) { + if (pattern.kind === 185 /* ObjectBindingPattern */) { if (declaration.dotDotDotToken) { if (parentType.flags & 2 /* Unknown */ || !isValidSpreadType(parentType)) { error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types); @@ -35650,30 +35997,30 @@ var ts; } function isNullOrUndefined(node) { var expr = ts.skipParentheses(node); - return expr.kind === 96 /* NullKeyword */ || expr.kind === 72 /* Identifier */ && getResolvedSymbol(expr) === undefinedSymbol; + return expr.kind === 97 /* NullKeyword */ || expr.kind === 73 /* Identifier */ && getResolvedSymbol(expr) === undefinedSymbol; } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node); - return expr.kind === 187 /* ArrayLiteralExpression */ && expr.elements.length === 0; + return expr.kind === 188 /* ArrayLiteralExpression */ && expr.elements.length === 0; } function addOptionality(type, optional) { if (optional === void 0) { optional = true; } return strictNullChecks && optional ? getOptionalType(type) : type; } function isParameterOfContextuallyTypedFunction(node) { - return node.kind === 151 /* Parameter */ && - (node.parent.kind === 196 /* FunctionExpression */ || node.parent.kind === 197 /* ArrowFunction */) && + return node.kind === 152 /* Parameter */ && + (node.parent.kind === 197 /* FunctionExpression */ || node.parent.kind === 198 /* ArrowFunction */) && !!getContextualType(node.parent); } // Return the inferred type for a variable, parameter, or property declaration function getTypeForVariableLikeDeclaration(declaration, includeOptionality) { // A variable declared in a for..in statement is of type string, or of type keyof T when the // right hand expression is of a type parameter type. - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 226 /* ForInStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 227 /* ForInStatement */) { var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression))); return indexType.flags & (262144 /* TypeParameter */ | 4194304 /* Index */) ? getExtractStringType(indexType) : stringType; } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 227 /* ForOfStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 228 /* ForOfStatement */) { // checkRightHandSideOfForOf will return undefined if the for-of expression type was // missing properties/signatures required to get its iteratedType (like // [Symbol.iterator] or next). This may be because we accessed properties from anyType, @@ -35692,7 +36039,7 @@ var ts; return addOptionality(declaredType, isOptional); } if ((noImplicitAny || ts.isInJSFile(declaration)) && - declaration.kind === 237 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) && + declaration.kind === 238 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) && !(ts.getCombinedModifierFlags(declaration) & 1 /* Export */) && !(declaration.flags & 4194304 /* Ambient */)) { // If --noImplicitAny is on or the declaration is in a Javascript file, // use control flow tracked 'any' type for non-ambient, non-exported var or let variables with no @@ -35706,11 +36053,11 @@ var ts; return autoArrayType; } } - if (declaration.kind === 151 /* Parameter */) { + if (declaration.kind === 152 /* Parameter */) { var func = declaration.parent; // For a parameter of a set accessor, use the type of the get accessor if one is present - if (func.kind === 159 /* SetAccessor */ && !hasNonBindableDynamicName(func)) { - var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 158 /* GetAccessor */); + if (func.kind === 160 /* SetAccessor */ && !hasNonBindableDynamicName(func)) { + var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 159 /* GetAccessor */); if (getter) { var getterSignature = getSignatureFromDeclaration(getter); var thisParameter = getAccessorThisParameter(func); @@ -35847,7 +36194,7 @@ var ts; return type; } else if (declaredType !== errorType && type !== errorType && !isTypeIdenticalTo(declaredType, type)) { - errorNextVariableOrPropertyDeclarationMustHaveSameType(declaredType, declaration, type); + errorNextVariableOrPropertyDeclarationMustHaveSameType(/*firstDeclaration*/ undefined, declaredType, declaration, type); } } return declaredType; @@ -35914,9 +36261,9 @@ var ts; var thisContainer = ts.getThisContainer(expression, /*includeArrowFunctions*/ false); // Properties defined in a constructor (or base constructor, or javascript constructor function) don't get undefined added. // Function expressions that are assigned to the prototype count as methods. - return thisContainer.kind === 157 /* Constructor */ || - thisContainer.kind === 239 /* FunctionDeclaration */ || - (thisContainer.kind === 196 /* FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); + return thisContainer.kind === 158 /* Constructor */ || + thisContainer.kind === 240 /* FunctionDeclaration */ || + (thisContainer.kind === 197 /* FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); } function getConstructorDefinedThisAssignmentTypes(types, declarations) { ts.Debug.assert(types.length === declarations.length); @@ -35991,7 +36338,7 @@ var ts; function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors) { var elements = pattern.elements; var lastElement = ts.lastOrUndefined(elements); - var hasRestElement = !!(lastElement && lastElement.kind === 186 /* BindingElement */ && lastElement.dotDotDotToken); + var hasRestElement = !!(lastElement && lastElement.kind === 187 /* BindingElement */ && lastElement.dotDotDotToken); if (elements.length === 0 || elements.length === 1 && hasRestElement) { return languageVersion >= 2 /* ES2015 */ ? createIterableType(anyType) : anyArrayType; } @@ -36014,7 +36361,7 @@ var ts; function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { if (includePatternInType === void 0) { includePatternInType = false; } if (reportErrors === void 0) { reportErrors = false; } - return pattern.kind === 184 /* ObjectBindingPattern */ + return pattern.kind === 185 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -36053,7 +36400,7 @@ var ts; } function declarationBelongsToPrivateAmbientMember(declaration) { var root = ts.getRootDeclaration(declaration); - var memberDeclaration = root.kind === 151 /* Parameter */ ? root.parent : root; + var memberDeclaration = root.kind === 152 /* Parameter */ ? root.parent : root; return isPrivateWithinAmbient(memberDeclaration); } function tryGetTypeFromEffectiveTypeNode(declaration) { @@ -36115,7 +36462,7 @@ var ts; return reportCircularityError(symbol); } var type; - if (declaration.kind === 254 /* ExportAssignment */) { + if (declaration.kind === 255 /* ExportAssignment */) { type = widenTypeForVariableLikeDeclaration(checkExpressionCached(declaration.expression), declaration); } else if (ts.isInJSFile(declaration) && @@ -36166,7 +36513,7 @@ var ts; type = getTypeOfEnumMember(symbol); } else { - return ts.Debug.fail("Unhandled declaration kind! " + ts.Debug.showSyntaxKind(declaration) + " for " + ts.Debug.showSymbol(symbol)); + return ts.Debug.fail("Unhandled declaration kind! " + ts.Debug.formatSyntaxKind(declaration.kind) + " for " + ts.Debug.formatSymbol(symbol)); } if (!popTypeResolution()) { // Symbol is property of some kind that is merged with something - should use `getTypeOfFuncClassEnumModule` and not `getTypeOfVariableOrParameterOrProperty` @@ -36179,7 +36526,7 @@ var ts; } function getAnnotatedAccessorTypeNode(accessor) { if (accessor) { - if (accessor.kind === 158 /* GetAccessor */) { + if (accessor.kind === 159 /* GetAccessor */) { var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); return getterTypeAnnotation; } @@ -36206,8 +36553,8 @@ var ts; return links.type || (links.type = getTypeOfAccessorsWorker(symbol)); } function getTypeOfAccessorsWorker(symbol) { - var getter = ts.getDeclarationOfKind(symbol, 158 /* GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 159 /* SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 159 /* GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 160 /* SetAccessor */); if (getter && ts.isInJSFile(getter)) { var jsDocType = getTypeForDeclarationFromJSDocComment(getter); if (jsDocType) { @@ -36250,7 +36597,7 @@ var ts; if (!popTypeResolution()) { type = anyType; if (noImplicitAny) { - var getter_1 = ts.getDeclarationOfKind(symbol, 158 /* GetAccessor */); + var getter_1 = ts.getDeclarationOfKind(symbol, 159 /* GetAccessor */); error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } @@ -36290,8 +36637,8 @@ var ts; if (symbol.flags & 1536 /* Module */ && ts.isShorthandAmbientModuleSymbol(symbol)) { return anyType; } - else if (declaration.kind === 204 /* BinaryExpression */ || - declaration.kind === 189 /* PropertyAccessExpression */ && declaration.parent.kind === 204 /* BinaryExpression */) { + else if (declaration.kind === 205 /* BinaryExpression */ || + declaration.kind === 190 /* PropertyAccessExpression */ && declaration.parent.kind === 205 /* BinaryExpression */) { return getWidenedTypeFromAssignmentDeclaration(symbol); } else if (symbol.flags & 512 /* ValueModule */ && declaration && ts.isSourceFile(declaration) && declaration.commonJsModuleIndicator) { @@ -36358,7 +36705,7 @@ var ts; return errorType; } // Check if variable has initializer that circularly references the variable itself - if (noImplicitAny && (declaration.kind !== 151 /* Parameter */ || declaration.initializer)) { + if (noImplicitAny && (declaration.kind !== 152 /* Parameter */ || declaration.initializer)) { error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); } // Circularities could also result from parameters in function expressions that end up @@ -36366,11 +36713,23 @@ var ts; // we have already reported an implicit any error so we don't report anything here. return anyType; } + function getTypeOfSymbolWithDeferredType(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + ts.Debug.assertDefined(links.deferralParent); + ts.Debug.assertDefined(links.deferralConstituents); + links.type = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType(links.deferralConstituents) : getIntersectionType(links.deferralConstituents); + } + return links.type; + } function getTypeOfSymbol(symbol) { + if (ts.getCheckFlags(symbol) & 65536 /* DeferredType */) { + return getTypeOfSymbolWithDeferredType(symbol); + } if (ts.getCheckFlags(symbol) & 1 /* Instantiated */) { return getTypeOfInstantiatedSymbol(symbol); } - if (ts.getCheckFlags(symbol) & 4096 /* ReverseMapped */) { + if (ts.getCheckFlags(symbol) & 8192 /* ReverseMapped */) { return getTypeOfReverseMappedSymbol(symbol); } if (symbol.flags & (3 /* Variable */ | 4 /* Property */)) { @@ -36431,35 +36790,35 @@ var ts; return undefined; } switch (node.kind) { - case 240 /* ClassDeclaration */: - case 209 /* ClassExpression */: - case 241 /* InterfaceDeclaration */: - case 160 /* CallSignature */: - case 161 /* ConstructSignature */: - case 155 /* MethodSignature */: - case 165 /* FunctionType */: - case 166 /* ConstructorType */: - case 294 /* JSDocFunctionType */: - case 239 /* FunctionDeclaration */: - case 156 /* MethodDeclaration */: - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: - case 242 /* TypeAliasDeclaration */: - case 308 /* JSDocTemplateTag */: - case 309 /* JSDocTypedefTag */: - case 302 /* JSDocCallbackTag */: - case 181 /* MappedType */: - case 175 /* ConditionalType */: + case 241 /* ClassDeclaration */: + case 210 /* ClassExpression */: + case 242 /* InterfaceDeclaration */: + case 161 /* CallSignature */: + case 162 /* ConstructSignature */: + case 156 /* MethodSignature */: + case 166 /* FunctionType */: + case 167 /* ConstructorType */: + case 295 /* JSDocFunctionType */: + case 240 /* FunctionDeclaration */: + case 157 /* MethodDeclaration */: + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: + case 243 /* TypeAliasDeclaration */: + case 309 /* JSDocTemplateTag */: + case 310 /* JSDocTypedefTag */: + case 303 /* JSDocCallbackTag */: + case 182 /* MappedType */: + case 176 /* ConditionalType */: var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); - if (node.kind === 181 /* MappedType */) { + if (node.kind === 182 /* MappedType */) { return ts.append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter))); } - else if (node.kind === 175 /* ConditionalType */) { + else if (node.kind === 176 /* ConditionalType */) { return ts.concatenate(outerTypeParameters, getInferTypeParameters(node)); } var outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, ts.getEffectiveTypeParameterDeclarations(node)); var thisType = includeThisTypes && - (node.kind === 240 /* ClassDeclaration */ || node.kind === 209 /* ClassExpression */ || node.kind === 241 /* InterfaceDeclaration */) && + (node.kind === 241 /* ClassDeclaration */ || node.kind === 210 /* ClassExpression */ || node.kind === 242 /* InterfaceDeclaration */) && getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; return thisType ? ts.append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters; } @@ -36467,7 +36826,7 @@ var ts; } // The outer type parameters are those defined by enclosing generic classes, methods, or functions. function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 241 /* InterfaceDeclaration */); + var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 242 /* InterfaceDeclaration */); return getOuterTypeParameters(declaration); } // The local type parameters are the combined set of type parameters from all declarations of the class, @@ -36476,9 +36835,9 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 241 /* InterfaceDeclaration */ || - node.kind === 240 /* ClassDeclaration */ || - node.kind === 209 /* ClassExpression */ || + if (node.kind === 242 /* InterfaceDeclaration */ || + node.kind === 241 /* ClassDeclaration */ || + node.kind === 210 /* ClassExpression */ || ts.isTypeAlias(node)) { var declaration = node; result = appendTypeParameters(result, ts.getEffectiveTypeParameterDeclarations(declaration)); @@ -36672,7 +37031,7 @@ var ts; type.resolvedBaseTypes = type.resolvedBaseTypes || ts.emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 241 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 242 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); @@ -36708,7 +37067,7 @@ var ts; function isThislessInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 241 /* InterfaceDeclaration */) { + if (declaration.kind === 242 /* InterfaceDeclaration */) { if (declaration.flags & 64 /* ContainsThis */) { return false; } @@ -36765,7 +37124,7 @@ var ts; return errorType; } var declaration = ts.find(symbol.declarations, function (d) { - return ts.isJSDocTypeAlias(d) || d.kind === 242 /* TypeAliasDeclaration */; + return ts.isJSDocTypeAlias(d) || d.kind === 243 /* TypeAliasDeclaration */; }); var typeNode = ts.isJSDocTypeAlias(declaration) ? declaration.typeExpression : declaration.type; // If typeNode is missing, we will error in checkJSDocTypedefTag. @@ -36792,7 +37151,7 @@ var ts; if (expr.kind === 10 /* StringLiteral */) { return true; } - else if (expr.kind === 204 /* BinaryExpression */) { + else if (expr.kind === 205 /* BinaryExpression */) { return isStringConcatExpression(expr.left) && isStringConcatExpression(expr.right); } return false; @@ -36806,12 +37165,12 @@ var ts; case 10 /* StringLiteral */: case 8 /* NumericLiteral */: return true; - case 202 /* PrefixUnaryExpression */: + case 203 /* PrefixUnaryExpression */: return expr.operator === 39 /* MinusToken */ && expr.operand.kind === 8 /* NumericLiteral */; - case 72 /* Identifier */: + case 73 /* Identifier */: return ts.nodeIsMissing(expr) || !!getSymbolOfNode(member.parent).exports.get(expr.escapedText); - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: return isStringConcatExpression(expr); default: return false; @@ -36825,7 +37184,7 @@ var ts; var hasNonLiteralMember = false; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 243 /* EnumDeclaration */) { + if (declaration.kind === 244 /* EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (member.initializer && member.initializer.kind === 10 /* StringLiteral */) { @@ -36852,7 +37211,7 @@ var ts; var memberTypeList = []; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 243 /* EnumDeclaration */) { + if (declaration.kind === 244 /* EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; var memberType = getFreshTypeOfLiteralType(getLiteralType(getEnumMemberValue(member), enumCount, getSymbolOfNode(member))); // TODO: GH#18217 @@ -36923,23 +37282,23 @@ var ts; */ function isThislessType(node) { switch (node.kind) { - case 120 /* AnyKeyword */: - case 143 /* UnknownKeyword */: - case 138 /* StringKeyword */: - case 135 /* NumberKeyword */: - case 146 /* BigIntKeyword */: - case 123 /* BooleanKeyword */: - case 139 /* SymbolKeyword */: - case 136 /* ObjectKeyword */: - case 106 /* VoidKeyword */: - case 141 /* UndefinedKeyword */: - case 96 /* NullKeyword */: - case 132 /* NeverKeyword */: - case 182 /* LiteralType */: + case 121 /* AnyKeyword */: + case 144 /* UnknownKeyword */: + case 139 /* StringKeyword */: + case 136 /* NumberKeyword */: + case 147 /* BigIntKeyword */: + case 124 /* BooleanKeyword */: + case 140 /* SymbolKeyword */: + case 137 /* ObjectKeyword */: + case 107 /* VoidKeyword */: + case 142 /* UndefinedKeyword */: + case 97 /* NullKeyword */: + case 133 /* NeverKeyword */: + case 183 /* LiteralType */: return true; - case 169 /* ArrayType */: + case 170 /* ArrayType */: return isThislessType(node.elementType); - case 164 /* TypeReference */: + case 165 /* TypeReference */: return !node.typeArguments || node.typeArguments.every(isThislessType); } return false; @@ -36965,7 +37324,7 @@ var ts; function isThislessFunctionLikeDeclaration(node) { var returnType = ts.getEffectiveReturnTypeNode(node); var typeParameters = ts.getEffectiveTypeParameterDeclarations(node); - return (node.kind === 157 /* Constructor */ || (!!returnType && isThislessType(returnType))) && + return (node.kind === 158 /* Constructor */ || (!!returnType && isThislessType(returnType))) && node.parameters.every(isThislessVariableLikeDeclaration) && typeParameters.every(isThislessTypeParameter); } @@ -36981,14 +37340,14 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { - case 154 /* PropertyDeclaration */: - case 153 /* PropertySignature */: + case 155 /* PropertyDeclaration */: + case 154 /* PropertySignature */: return isThislessVariableLikeDeclaration(declaration); - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: - case 157 /* Constructor */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: + case 158 /* Constructor */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: return isThislessFunctionLikeDeclaration(declaration); } } @@ -37089,7 +37448,7 @@ var ts; * members. */ function addDeclarationToLateBoundSymbol(symbol, member, symbolFlags) { - ts.Debug.assert(!!(ts.getCheckFlags(symbol) & 2048 /* Late */), "Expected a late-bound symbol."); + ts.Debug.assert(!!(ts.getCheckFlags(symbol) & 4096 /* Late */), "Expected a late-bound symbol."); symbol.flags |= symbolFlags; getSymbolLinks(member.symbol).lateSymbol = symbol; if (!symbol.declarations) { @@ -37146,7 +37505,7 @@ var ts; // Get or add a late-bound symbol for the member. This allows us to merge late-bound accessor declarations. var lateSymbol = lateSymbols.get(memberName); if (!lateSymbol) - lateSymbols.set(memberName, lateSymbol = createSymbol(0 /* None */, memberName, 2048 /* Late */)); + lateSymbols.set(memberName, lateSymbol = createSymbol(0 /* None */, memberName, 4096 /* Late */)); // Report an error if a late-bound member has the same name as an early-bound member, // or if we have another early-bound symbol declaration with the same name and // conflicting flags. @@ -37158,7 +37517,7 @@ var ts; var name_3 = !(type.flags & 8192 /* UniqueESSymbol */) && ts.unescapeLeadingUnderscores(memberName) || ts.declarationNameToString(decl.name); ts.forEach(declarations, function (declaration) { return error(ts.getNameOfDeclaration(declaration) || declaration, ts.Diagnostics.Property_0_was_also_declared_here, name_3); }); error(decl.name || decl, ts.Diagnostics.Duplicate_property_0, name_3); - lateSymbol = createSymbol(0 /* None */, memberName, 2048 /* Late */); + lateSymbol = createSymbol(0 /* None */, memberName, 4096 /* Late */); } lateSymbol.nameType = type; addDeclarationToLateBoundSymbol(lateSymbol, decl, symbolFlags); @@ -37223,11 +37582,12 @@ var ts; var links = getSymbolLinks(symbol); if (!links.lateSymbol && ts.some(symbol.declarations, hasLateBindableName)) { // force late binding of members/exports. This will set the late-bound symbol + var parent = getMergedSymbol(symbol.parent); if (ts.some(symbol.declarations, ts.hasStaticModifier)) { - getExportsOfSymbol(symbol.parent); + getExportsOfSymbol(parent); } else { - getMembersOfSymbol(symbol.parent); + getMembersOfSymbol(parent); } } return links.lateSymbol || (links.lateSymbol = symbol); @@ -37344,8 +37704,8 @@ var ts; var tupleRestIndex_1 = restType.target.hasRestElement ? elementTypes.length - 1 : -1; var restParams = ts.map(elementTypes, function (t, i) { var name = getParameterNameAtPosition(sig, restIndex_1 + i); - var checkFlags = i === tupleRestIndex_1 ? 16384 /* RestParameter */ : - i >= minLength_1 ? 8192 /* OptionalParameter */ : 0; + var checkFlags = i === tupleRestIndex_1 ? 32768 /* RestParameter */ : + i >= minLength_1 ? 16384 /* OptionalParameter */ : 0; var symbol = createSymbol(1 /* FunctionScopedVariable */, name, checkFlags); symbol.type = i === tupleRestIndex_1 ? createArrayType(t) : t; return symbol; @@ -37435,10 +37795,10 @@ var ts; // Union the result types when more than one signature matches if (unionSignatures.length > 1) { var thisParameter = signature.thisParameter; - if (ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; })) { - // TODO: GH#18217 We tested that *some* has thisParameter and now act as if *all* do + var firstThisParameterOfUnionSignatures = ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; }); + if (firstThisParameterOfUnionSignatures) { var thisType = getUnionType(ts.map(unionSignatures, function (sig) { return sig.thisParameter ? getTypeOfSymbol(sig.thisParameter) : anyType; }), 2 /* Subtype */); - thisParameter = createSymbolWithType(signature.thisParameter, thisType); + thisParameter = createSymbolWithType(firstThisParameterOfUnionSignatures, thisType); } s = createUnionSignature(signature, unionSignatures); s.thisParameter = thisParameter; @@ -37695,7 +38055,7 @@ var ts; var members = ts.createSymbolTable(); for (var _i = 0, _a = getPropertiesOfType(type.source); _i < _a.length; _i++) { var prop = _a[_i]; - var checkFlags = 4096 /* ReverseMapped */ | (readonlyMask && isReadonlySymbol(prop) ? 8 /* Readonly */ : 0); + var checkFlags = 8192 /* ReverseMapped */ | (readonlyMask && isReadonlySymbol(prop) ? 8 /* Readonly */ : 0); var inferredProp = createSymbol(4 /* Property */ | prop.flags & optionalMask, prop.escapedName, checkFlags); inferredProp.declarations = prop.declarations; inferredProp.nameType = prop.nameType; @@ -37717,7 +38077,15 @@ var ts; return getIndexType(getApparentType(type.type)); } if (type.flags & 16777216 /* Conditional */) { - return getLowerBoundOfConditionalType(type); + if (type.root.isDistributive) { + var checkType = type.checkType; + var constraint = getLowerBoundOfKeyType(checkType); + if (constraint !== checkType) { + var mapper = makeUnaryTypeMapper(type.root.checkType, constraint); + return getConditionalTypeInstantiation(type, combineTypeMappers(mapper, type.mapper)); + } + } + return type; } if (type.flags & 1048576 /* Union */) { return getUnionType(ts.sameMap(type.types, getLowerBoundOfKeyType)); @@ -37727,16 +38095,6 @@ var ts; } return neverType; } - function getLowerBoundOfConditionalType(type) { - if (type.root.isDistributive) { - var constraint = getLowerBoundOfKeyType(type.checkType); - if (constraint !== type.checkType) { - var mapper = makeUnaryTypeMapper(type.root.checkType, constraint); - return getConditionalTypeInstantiation(type, combineTypeMappers(mapper, type.mapper)); - } - } - return type; - } /** Resolve the members of a mapped type { [P in K]: T } */ function resolveMappedTypeMembers(type) { var members = ts.createSymbolTable(); @@ -37825,8 +38183,8 @@ var ts; } function isMappedTypeWithKeyofConstraintDeclaration(type) { var constraintDeclaration = getConstraintDeclarationForMappedType(type); // TODO: GH#18217 - return constraintDeclaration.kind === 179 /* TypeOperator */ && - constraintDeclaration.operator === 129 /* KeyOfKeyword */; + return constraintDeclaration.kind === 180 /* TypeOperator */ && + constraintDeclaration.operator === 130 /* KeyOfKeyword */; } function getModifiersTypeFromMappedType(type) { if (!type.modifiersType) { @@ -37843,7 +38201,7 @@ var ts; var declaredType = getTypeFromMappedTypeNode(type.declaration); var constraint = getConstraintTypeFromMappedType(declaredType); var extendedConstraint = constraint && constraint.flags & 262144 /* TypeParameter */ ? getConstraintOfTypeParameter(constraint) : constraint; - type.modifiersType = extendedConstraint && extendedConstraint.flags & 4194304 /* Index */ ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType; + type.modifiersType = extendedConstraint && extendedConstraint.flags & 4194304 /* Index */ ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : unknownType; } } return type.modifiersType; @@ -37939,6 +38297,26 @@ var ts; } return type.resolvedProperties; } + function getPossiblePropertiesOfUnionType(type) { + if (type.possiblePropertyCache) { + return type.possiblePropertyCache.size ? ts.arrayFrom(type.possiblePropertyCache.values()) : ts.emptyArray; + } + type.possiblePropertyCache = ts.createSymbolTable(); + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + for (var _b = 0, _c = getPropertiesOfType(t); _b < _c.length; _b++) { + var p = _c[_b]; + if (!type.possiblePropertyCache.has(p.escapedName)) { + var prop = getUnionOrIntersectionProperty(type, p.escapedName); + if (prop) { + type.possiblePropertyCache.set(p.escapedName, prop); + } + } + } + } + // We can't simply use the normal property cache here, since that will contain cached apparent type members :( + return type.possiblePropertyCache.size ? ts.arrayFrom(type.possiblePropertyCache.values()) : ts.emptyArray; + } function getPropertiesOfType(type) { type = getApparentType(type); return type.flags & 3145728 /* UnionOrIntersection */ ? @@ -37986,16 +38364,23 @@ var ts; function getConstraintOfIndexedAccess(type) { return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : undefined; } + function getSimplifiedTypeOrConstraint(type) { + var simplified = getSimplifiedType(type, /*writing*/ false); + return simplified !== type ? simplified : getConstraintOfType(type); + } function getConstraintFromIndexedAccess(type) { - var objectType = getConstraintOfType(type.objectType) || type.objectType; - if (objectType !== type.objectType) { - var constraint = getIndexedAccessType(objectType, type.indexType, /*accessNode*/ undefined, errorType); - if (constraint && constraint !== errorType) { - return constraint; + var indexConstraint = getSimplifiedTypeOrConstraint(type.indexType); + if (indexConstraint && indexConstraint !== type.indexType) { + var indexedAccess = getIndexedAccessTypeOrUndefined(type.objectType, indexConstraint); + if (indexedAccess) { + return indexedAccess; } } - var baseConstraint = getBaseConstraintOfType(type); - return baseConstraint && baseConstraint !== type ? baseConstraint : undefined; + var objectConstraint = getSimplifiedTypeOrConstraint(type.objectType); + if (objectConstraint && objectConstraint !== type.objectType) { + return getIndexedAccessTypeOrUndefined(objectConstraint, type.indexType); + } + return undefined; } function getDefaultConstraintOfConditionalType(type) { if (!type.resolvedDefaultConstraint) { @@ -38004,7 +38389,7 @@ var ts; // just `any`. This result is _usually_ unwanted - so instead here we elide an `any` branch from the constraint type, // in effect treating `any` like `never` rather than `unknown` in this location. var trueConstraint = getInferredTrueTypeFromConditionalType(type); - var falseConstraint = type.falseType; + var falseConstraint = getFalseTypeFromConditionalType(type); type.resolvedDefaultConstraint = isTypeAny(trueConstraint) ? falseConstraint : isTypeAny(falseConstraint) ? trueConstraint : getUnionType([trueConstraint, falseConstraint]); } return type.resolvedDefaultConstraint; @@ -38022,7 +38407,7 @@ var ts; // a union - once negated types exist and are applied to the conditional false branch, this "constraint" // likely doesn't need to exist. if (type.root.isDistributive && type.restrictiveInstantiation !== type) { - var simplified = getSimplifiedType(type.checkType); + var simplified = getSimplifiedType(type.checkType, /*writing*/ false); var constraint = simplified === type.checkType ? getConstraintOfType(simplified) : simplified; if (constraint && constraint !== type.checkType) { var mapper = makeUnaryTypeMapper(type.root.checkType, constraint); @@ -38053,11 +38438,6 @@ var ts; constraint = getConstraintOfType(constraint); } if (constraint) { - // A constraint that isn't a union type implies that the final type would be a non-union - // type as well. Since non-union constraints are of no interest, we can exit here. - if (!(constraint.flags & 1048576 /* Union */)) { - return undefined; - } constraints = ts.append(constraints, constraint); } } @@ -38066,10 +38446,10 @@ var ts; } } // If the target is a union type or if we are intersecting with types belonging to one of the - // disjoint domans, we may end up producing a constraint that hasn't been examined before. + // disjoint domains, we may end up producing a constraint that hasn't been examined before. if (constraints && (targetIsUnion || hasDisjointDomainType)) { if (hasDisjointDomainType) { - // We add any types belong to one of the disjoint domans because they might cause the final + // We add any types belong to one of the disjoint domains because they might cause the final // intersection operation to reduce the union constraints. for (var _b = 0, _c = type.types; _b < _c.length; _b++) { var t = _c[_b]; @@ -38115,7 +38495,7 @@ var ts; } if (constraintDepth >= 50) { // We have reached 50 recursive invocations of getImmediateBaseConstraint and there is a - // very high likelyhood we're dealing with an infinite generic type that perpetually generates + // very high likelihood we're dealing with an infinite generic type that perpetually generates // new type identities as we descend into it. We stop the recursion here and mark this type // and the outer types as having circular constraints. error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite); @@ -38123,7 +38503,7 @@ var ts; return t.immediateBaseConstraint = noConstraintType; } constraintDepth++; - var result = computeBaseConstraint(getSimplifiedType(t)); + var result = computeBaseConstraint(getSimplifiedType(t, /*writing*/ false)); constraintDepth--; if (!popTypeResolution()) { if (t.flags & 262144 /* TypeParameter */) { @@ -38175,8 +38555,8 @@ var ts; if (t.flags & 8388608 /* IndexedAccess */) { var baseObjectType = getBaseConstraint(t.objectType); var baseIndexType = getBaseConstraint(t.indexType); - var baseIndexedAccess = baseObjectType && baseIndexType ? getIndexedAccessType(baseObjectType, baseIndexType, /*accessNode*/ undefined, errorType) : undefined; - return baseIndexedAccess && baseIndexedAccess !== errorType ? getBaseConstraint(baseIndexedAccess) : undefined; + var baseIndexedAccess = baseObjectType && baseIndexType && getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType); + return baseIndexedAccess && getBaseConstraint(baseIndexedAccess); } if (t.flags & 16777216 /* Conditional */) { var constraint = getConstraintFromConditionalType(t); @@ -38257,17 +38637,18 @@ var ts; * type itself. Note that the apparent type of a union type is the union type itself. */ function getApparentType(type) { - var t = type.flags & 63176704 /* Instantiable */ ? getBaseConstraintOfType(type) || emptyObjectType : type; + var t = type.flags & 63176704 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type; return ts.getObjectFlags(t) & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t) : t.flags & 132 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : - t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType(/*reportErrors*/ languageVersion >= 7 /* ESNext */) : + t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType(/*reportErrors*/ languageVersion >= 8 /* ESNext */) : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType(/*reportErrors*/ languageVersion >= 2 /* ES2015 */) : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? keyofConstraintType : - t; + t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : + t; } function createUnionOrIntersectionProperty(containingType, name) { var propSet = ts.createMap(); @@ -38275,7 +38656,7 @@ var ts; var isUnion = containingType.flags & 1048576 /* Union */; var excludeModifiers = isUnion ? 24 /* NonPublicAccessibilityModifier */ : 0; // Flags we want to propagate to the result if they exist in all source symbols - var commonFlags = isUnion ? 0 /* None */ : 16777216 /* Optional */; + var optionalFlag = isUnion ? 0 /* None */ : 16777216 /* Optional */; var syntheticFlag = 4 /* SyntheticMethod */; var checkFlags = 0; for (var _i = 0, _a = containingType.types; _i < _a.length; _i++) { @@ -38285,16 +38666,21 @@ var ts; var prop = getPropertyOfType(type, name); var modifiers = prop ? ts.getDeclarationModifierFlagsFromSymbol(prop) : 0; if (prop && !(modifiers & excludeModifiers)) { - commonFlags &= prop.flags; + if (isUnion) { + optionalFlag |= (prop.flags & 16777216 /* Optional */); + } + else { + optionalFlag &= prop.flags; + } var id = "" + getSymbolId(prop); if (!propSet.has(id)) { propSet.set(id, prop); } checkFlags |= (isReadonlySymbol(prop) ? 8 /* Readonly */ : 0) | - (!(modifiers & 24 /* NonPublicAccessibilityModifier */) ? 128 /* ContainsPublic */ : 0) | - (modifiers & 16 /* Protected */ ? 256 /* ContainsProtected */ : 0) | - (modifiers & 8 /* Private */ ? 512 /* ContainsPrivate */ : 0) | - (modifiers & 32 /* Static */ ? 1024 /* ContainsStatic */ : 0); + (!(modifiers & 24 /* NonPublicAccessibilityModifier */) ? 256 /* ContainsPublic */ : 0) | + (modifiers & 16 /* Protected */ ? 512 /* ContainsProtected */ : 0) | + (modifiers & 8 /* Private */ ? 1024 /* ContainsPrivate */ : 0) | + (modifiers & 32 /* Static */ ? 2048 /* ContainsStatic */ : 0); if (!isPrototypeProperty(prop)) { syntheticFlag = 2 /* SyntheticProperty */; } @@ -38303,10 +38689,11 @@ var ts; var indexInfo = !isLateBoundName(name) && (isNumericLiteralName(name) && getIndexInfoOfType(type, 1 /* Number */) || getIndexInfoOfType(type, 0 /* String */)); if (indexInfo) { checkFlags |= indexInfo.isReadonly ? 8 /* Readonly */ : 0; + checkFlags |= 32 /* WritePartial */; indexTypes = ts.append(indexTypes, isTupleType(type) ? getRestTypeOfTupleType(type) || undefinedType : indexInfo.type); } else { - checkFlags |= 16 /* Partial */; + checkFlags |= 16 /* ReadPartial */; } } } @@ -38315,7 +38702,7 @@ var ts; return undefined; } var props = ts.arrayFrom(propSet.values()); - if (props.length === 1 && !(checkFlags & 16 /* Partial */) && !indexTypes) { + if (props.length === 1 && !(checkFlags & 16 /* ReadPartial */) && !indexTypes) { return props[0]; } var declarations; @@ -38339,15 +38726,15 @@ var ts; nameType = prop.nameType; } else if (type !== firstType) { - checkFlags |= 32 /* HasNonUniformType */; + checkFlags |= 64 /* HasNonUniformType */; } if (isLiteralType(type)) { - checkFlags |= 64 /* HasLiteralType */; + checkFlags |= 128 /* HasLiteralType */; } propTypes.push(type); } ts.addRange(propTypes, indexTypes); - var result = createSymbol(4 /* Property */ | commonFlags, name, syntheticFlag | checkFlags); + var result = createSymbol(4 /* Property */ | optionalFlag, name, syntheticFlag | checkFlags); result.containingType = containingType; if (!hasNonUniformValueDeclaration && firstValueDeclaration) { result.valueDeclaration = firstValueDeclaration; @@ -38358,7 +38745,15 @@ var ts; } result.declarations = declarations; result.nameType = nameType; - result.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes); + if (propTypes.length > 2) { + // When `propTypes` has the potential to explode in size when normalized, defer normalization until absolutely needed + result.checkFlags |= 65536 /* DeferredType */; + result.deferralParent = containingType; + result.deferralConstituents = propTypes; + } + else { + result.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes); + } return result; } // Return the symbol for a given property in a union or intersection type, or undefined if the property @@ -38380,7 +38775,7 @@ var ts; function getPropertyOfUnionOrIntersectionType(type, name) { var property = getUnionOrIntersectionProperty(type, name); // We need to filter out partial properties in union types - return property && !(ts.getCheckFlags(property) & 16 /* Partial */) ? property : undefined; + return property && !(ts.getCheckFlags(property) & 16 /* ReadPartial */) ? property : undefined; } /** * Return the symbol for the property with the given name in the given type. Creates synthetic union properties when @@ -38486,10 +38881,10 @@ var ts; function isJSDocOptionalParameter(node) { return ts.isInJSFile(node) && ( // node.type should only be a JSDocOptionalType when node is a parameter of a JSDocFunctionType - node.type && node.type.kind === 293 /* JSDocOptionalType */ + node.type && node.type.kind === 294 /* JSDocOptionalType */ || ts.getJSDocParameterTags(node).some(function (_a) { var isBracketed = _a.isBracketed, typeExpression = _a.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 293 /* JSDocOptionalType */; + return isBracketed || !!typeExpression && typeExpression.type.kind === 294 /* JSDocOptionalType */; })); } function tryFindAmbientModule(moduleName, withAugmentations) { @@ -38523,7 +38918,7 @@ var ts; return false; } var isBracketed = node.isBracketed, typeExpression = node.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 293 /* JSDocOptionalType */; + return isBracketed || !!typeExpression && typeExpression.type.kind === 294 /* JSDocOptionalType */; } function createIdentifierTypePredicate(parameterName, parameterIndex, type) { return { kind: 1 /* Identifier */, parameterName: parameterName, parameterIndex: parameterIndex, type: type }; @@ -38561,7 +38956,7 @@ var ts; var baseDefaultType = getDefaultTypeArgumentType(isJavaScriptImplicitAny); for (var i = numTypeArguments; i < numTypeParameters; i++) { var defaultType = getDefaultFromTypeParameter(typeParameters[i]); - if (isJavaScriptImplicitAny && defaultType && isTypeIdenticalTo(defaultType, emptyObjectType)) { + if (isJavaScriptImplicitAny && defaultType && (isTypeIdenticalTo(defaultType, unknownType) || isTypeIdenticalTo(defaultType, emptyObjectType))) { defaultType = anyType; } result[i] = defaultType ? instantiateType(defaultType, createTypeMapper(typeParameters, result)) : baseDefaultType; @@ -38605,7 +39000,7 @@ var ts; else { parameters.push(paramSymbol); } - if (type && type.kind === 182 /* LiteralType */) { + if (type && type.kind === 183 /* LiteralType */) { hasLiteralTypes = true; } // Record a new minimum argument count if this is not an optional parameter @@ -38619,16 +39014,16 @@ var ts; } } // If only one accessor includes a this-type annotation, the other behaves as if it had the same type annotation - if ((declaration.kind === 158 /* GetAccessor */ || declaration.kind === 159 /* SetAccessor */) && + if ((declaration.kind === 159 /* GetAccessor */ || declaration.kind === 160 /* SetAccessor */) && !hasNonBindableDynamicName(declaration) && (!hasThisParameter || !thisParameter)) { - var otherKind = declaration.kind === 158 /* GetAccessor */ ? 159 /* SetAccessor */ : 158 /* GetAccessor */; + var otherKind = declaration.kind === 159 /* GetAccessor */ ? 160 /* SetAccessor */ : 159 /* GetAccessor */; var other = ts.getDeclarationOfKind(getSymbolOfNode(declaration), otherKind); if (other) { thisParameter = getAnnotatedAccessorThisParameter(other); } } - var classType = declaration.kind === 157 /* Constructor */ ? + var classType = declaration.kind === 158 /* Constructor */ ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : undefined; var typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration); @@ -38653,7 +39048,7 @@ var ts; var lastParamVariadicType = ts.firstDefined(lastParamTags, function (p) { return p.typeExpression && ts.isJSDocVariadicType(p.typeExpression.type) ? p.typeExpression.type : undefined; }); - var syntheticArgsSymbol = createSymbol(3 /* Variable */, "args", 16384 /* RestParameter */); + var syntheticArgsSymbol = createSymbol(3 /* Variable */, "args", 32768 /* RestParameter */); syntheticArgsSymbol.type = lastParamVariadicType ? createArrayType(getTypeFromTypeNode(lastParamVariadicType.type)) : anyArrayType; if (lastParamVariadicType) { // Replace the last parameter with a rest parameter. @@ -38686,13 +39081,13 @@ var ts; if (!node) return false; switch (node.kind) { - case 72 /* Identifier */: + case 73 /* Identifier */: return node.escapedText === "arguments" && ts.isExpressionNode(node); - case 154 /* PropertyDeclaration */: - case 156 /* MethodDeclaration */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - return node.name.kind === 149 /* ComputedPropertyName */ + case 155 /* PropertyDeclaration */: + case 157 /* MethodDeclaration */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + return node.name.kind === 150 /* ComputedPropertyName */ && traverse(node.name); default: return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && !!ts.forEachChild(node, traverse); @@ -38767,7 +39162,7 @@ var ts; function createTypePredicateFromTypePredicateNode(node, signature) { var parameterName = node.parameterName; var type = getTypeFromTypeNode(node.type); - if (parameterName.kind === 72 /* Identifier */) { + if (parameterName.kind === 73 /* Identifier */) { return createIdentifierTypePredicate(parameterName.escapedText, ts.findIndex(signature.parameters, function (p) { return p.escapedName === parameterName.escapedText; }), type); } else { @@ -38808,7 +39203,7 @@ var ts; return signature.resolvedReturnType; } function getReturnTypeFromAnnotation(declaration) { - if (declaration.kind === 157 /* Constructor */) { + if (declaration.kind === 158 /* Constructor */) { return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)); } if (ts.isJSDocConstructSignature(declaration)) { @@ -38818,12 +39213,12 @@ var ts; if (typeNode) { return getTypeFromTypeNode(typeNode); } - if (declaration.kind === 158 /* GetAccessor */ && !hasNonBindableDynamicName(declaration)) { + if (declaration.kind === 159 /* GetAccessor */ && !hasNonBindableDynamicName(declaration)) { var jsDocType = ts.isInJSFile(declaration) && getTypeForDeclarationFromJSDocComment(declaration); if (jsDocType) { return jsDocType; } - var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 159 /* SetAccessor */); + var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 160 /* SetAccessor */); var setterType = getAnnotatedAccessorType(setter); if (setterType) { return setterType; @@ -38848,7 +39243,7 @@ var ts; function getSignatureInstantiation(signature, typeArguments, isJavascript, inferredTypeParameters) { var instantiatedSignature = getSignatureInstantiationWithoutFillingInTypeArguments(signature, fillMissingTypeArguments(typeArguments, signature.typeParameters, getMinTypeArgumentCount(signature.typeParameters), isJavascript)); if (inferredTypeParameters) { - var returnSignature = getSingleCallSignature(getReturnTypeOfSignature(instantiatedSignature)); + var returnSignature = getSingleCallOrConstructSignature(getReturnTypeOfSignature(instantiatedSignature)); if (returnSignature) { var newReturnSignature = cloneSignature(returnSignature); newReturnSignature.typeParameters = inferredTypeParameters; @@ -38901,7 +39296,7 @@ var ts; var typeParameters = signature.typeParameters; if (typeParameters) { var typeEraser_1 = createTypeEraser(typeParameters); - var baseConstraints = ts.map(typeParameters, function (tp) { return instantiateType(getBaseConstraintOfType(tp), typeEraser_1) || emptyObjectType; }); + var baseConstraints = ts.map(typeParameters, function (tp) { return instantiateType(getBaseConstraintOfType(tp), typeEraser_1) || unknownType; }); return instantiateSignature(signature, createTypeMapper(typeParameters, baseConstraints), /*eraseTypeParameters*/ true); } return signature; @@ -38912,7 +39307,8 @@ var ts; // object type literal or interface (using the new keyword). Each way of declaring a constructor // will result in a different declaration kind. if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 157 /* Constructor */ || signature.declaration.kind === 161 /* ConstructSignature */; // TODO: GH#18217 + var kind = signature.declaration ? signature.declaration.kind : 0 /* Unknown */; + var isConstructor = kind === 158 /* Constructor */ || kind === 162 /* ConstructSignature */ || kind === 167 /* ConstructorType */; var type = createObjectType(16 /* Anonymous */); type.members = emptySymbols; type.properties = ts.emptyArray; @@ -38926,7 +39322,7 @@ var ts; return symbol.members.get("__index" /* Index */); } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 /* Number */ ? 135 /* NumberKeyword */ : 138 /* StringKeyword */; + var syntaxKind = kind === 1 /* Number */ ? 136 /* NumberKeyword */ : 139 /* StringKeyword */; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { @@ -38953,7 +39349,7 @@ var ts; return undefined; } function getConstraintDeclaration(type) { - var decl = type.symbol && ts.getDeclarationOfKind(type.symbol, 150 /* TypeParameter */); + var decl = type.symbol && ts.getDeclarationOfKind(type.symbol, 151 /* TypeParameter */); return decl && ts.getEffectiveConstraintOfTypeParameter(decl); } function getInferredTypeParameterConstraint(typeParameter) { @@ -38961,13 +39357,13 @@ var ts; if (typeParameter.symbol) { for (var _i = 0, _a = typeParameter.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.parent.kind === 176 /* InferType */) { + if (declaration.parent.kind === 177 /* InferType */) { // When an 'infer T' declaration is immediately contained in a type reference node // (such as 'Foo'), T's constraint is inferred from the constraint of the // corresponding type parameter in 'Foo'. When multiple 'infer T' declarations are // present, we form an intersection of the inferred constraint types. var grandParent = declaration.parent.parent; - if (grandParent.kind === 164 /* TypeReference */) { + if (grandParent.kind === 165 /* TypeReference */) { var typeReference = grandParent; var typeParameters = getTypeParametersForTypeReference(typeReference); if (typeParameters) { @@ -38992,7 +39388,7 @@ var ts; } // When an 'infer T' declaration is immediately contained in a rest parameter // declaration, we infer an 'unknown[]' constraint. - else if (grandParent.kind === 151 /* Parameter */ && grandParent.dotDotDotToken) { + else if (grandParent.kind === 152 /* Parameter */ && grandParent.dotDotDotToken) { inferences = ts.append(inferences, createArrayType(unknownType)); } } @@ -39016,7 +39412,7 @@ var ts; return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - var tp = ts.getDeclarationOfKind(typeParameter.symbol, 150 /* TypeParameter */); + var tp = ts.getDeclarationOfKind(typeParameter.symbol, 151 /* TypeParameter */); var host = ts.isJSDocTemplateTag(tp.parent) ? ts.getHostSignatureFromJSDoc(tp.parent) : tp.parent; return host && getSymbolOfNode(host); } @@ -39149,9 +39545,9 @@ var ts; } function getTypeReferenceName(node) { switch (node.kind) { - case 164 /* TypeReference */: + case 165 /* TypeReference */: return node.typeName; - case 211 /* ExpressionWithTypeArguments */: + case 212 /* ExpressionWithTypeArguments */: // We only support expressions that are simple qualified names. For other // expressions this produces undefined. var expr = node.expression; @@ -39250,16 +39646,22 @@ var ts; } } function getSubstitutionType(typeVariable, substitute) { - if (substitute.flags & 3 /* AnyOrUnknown */) { + if (substitute.flags & 3 /* AnyOrUnknown */ || substitute === typeVariable) { return typeVariable; } + var id = getTypeId(typeVariable) + ">" + getTypeId(substitute); + var cached = substitutionTypes.get(id); + if (cached) { + return cached; + } var result = createType(33554432 /* Substitution */); result.typeVariable = typeVariable; result.substitute = substitute; + substitutionTypes.set(id, result); return result; } function isUnaryTupleTypeNode(node) { - return node.kind === 170 /* TupleType */ && node.elementTypes.length === 1; + return node.kind === 171 /* TupleType */ && node.elementTypes.length === 1; } function getImpliedConstraint(typeVariable, checkNode, extendsNode) { return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(typeVariable, checkNode.elementTypes[0], extendsNode.elementTypes[0]) : @@ -39268,9 +39670,9 @@ var ts; } function getConstrainedTypeVariable(typeVariable, node) { var constraints; - while (node && !ts.isStatement(node) && node.kind !== 296 /* JSDocComment */) { + while (node && !ts.isStatement(node) && node.kind !== 297 /* JSDocComment */) { var parent = node.parent; - if (parent.kind === 175 /* ConditionalType */ && node === parent.trueType) { + if (parent.kind === 176 /* ConditionalType */ && node === parent.trueType) { var constraint = getImpliedConstraint(typeVariable, parent.checkType, parent.extendsType); if (constraint) { constraints = ts.append(constraints, constraint); @@ -39281,7 +39683,7 @@ var ts; return constraints ? getSubstitutionType(typeVariable, getIntersectionType(ts.append(constraints, typeVariable))) : typeVariable; } function isJSDocTypeReference(node) { - return !!(node.flags & 2097152 /* JSDoc */) && (node.kind === 164 /* TypeReference */ || node.kind === 183 /* ImportType */); + return !!(node.flags & 2097152 /* JSDoc */) && (node.kind === 165 /* TypeReference */ || node.kind === 184 /* ImportType */); } function checkNoTypeArguments(node, symbol) { if (node.typeArguments) { @@ -39382,9 +39784,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 240 /* ClassDeclaration */: - case 241 /* InterfaceDeclaration */: - case 243 /* EnumDeclaration */: + case 241 /* ClassDeclaration */: + case 242 /* InterfaceDeclaration */: + case 244 /* EnumDeclaration */: return declaration; } } @@ -39470,11 +39872,8 @@ var ts; function getGlobalExtractSymbol() { return deferredGlobalExtractSymbol || (deferredGlobalExtractSymbol = getGlobalSymbol("Extract", 524288 /* TypeAlias */, ts.Diagnostics.Cannot_find_global_type_0)); // TODO: GH#18217 } - function getGlobalExcludeSymbol() { - return deferredGlobalExcludeSymbol || (deferredGlobalExcludeSymbol = getGlobalSymbol("Exclude", 524288 /* TypeAlias */, ts.Diagnostics.Cannot_find_global_type_0)); // TODO: GH#18217 - } - function getGlobalPickSymbol() { - return deferredGlobalPickSymbol || (deferredGlobalPickSymbol = getGlobalSymbol("Pick", 524288 /* TypeAlias */, ts.Diagnostics.Cannot_find_global_type_0)); // TODO: GH#18217 + function getGlobalOmitSymbol() { + return deferredGlobalOmitSymbol || (deferredGlobalOmitSymbol = getGlobalSymbol("Omit", 524288 /* TypeAlias */, ts.Diagnostics.Cannot_find_global_type_0)); // TODO: GH#18217 } function getGlobalBigIntType(reportErrors) { return deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, reportErrors)) || emptyObjectType; @@ -39511,7 +39910,7 @@ var ts; return links.resolvedType; } function isReadonlyTypeOperator(node) { - return ts.isTypeOperatorNode(node) && node.operator === 133 /* ReadonlyKeyword */; + return ts.isTypeOperatorNode(node) && node.operator === 134 /* ReadonlyKeyword */; } // We represent tuple types as type references to synthesized generic interface types created by // this function. The types are of the form: @@ -39586,8 +39985,8 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedType) { var lastElement = ts.lastOrUndefined(node.elementTypes); - var restElement_1 = lastElement && lastElement.kind === 172 /* RestType */ ? lastElement : undefined; - var minLength = ts.findLastIndex(node.elementTypes, function (n) { return n.kind !== 171 /* OptionalType */ && n !== restElement_1; }) + 1; + var restElement_1 = lastElement && lastElement.kind === 173 /* RestType */ ? lastElement : undefined; + var minLength = ts.findLastIndex(node.elementTypes, function (n) { return n.kind !== 172 /* OptionalType */ && n !== restElement_1; }) + 1; var elementTypes = ts.map(node.elementTypes, function (n) { var type = getTypeFromTypeNode(n); return n === restElement_1 && getIndexTypeOfType(type, 1 /* Number */) || type; @@ -39974,6 +40373,14 @@ var ts; types[index] = getUnionTypeFromSortedList(result, 65536 /* PrimitiveUnion */); return true; } + function createIntersectionType(types, aliasSymbol, aliasTypeArguments) { + var result = createType(2097152 /* Intersection */); + result.objectFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ 98304 /* Nullable */); + result.types = types; + result.aliasSymbol = aliasSymbol; // See comment in `getUnionTypeFromSortedList`. + result.aliasTypeArguments = aliasTypeArguments; + return result; + } // We normalize combinations of intersection and union types based on the distributive property of the '&' // operator. Specifically, because X & (A | B) is equivalent to X & A | X & B, we can transform intersection // types with union type constituents into equivalent union types with intersection type constituents and @@ -40011,30 +40418,36 @@ var ts; if (typeSet.length === 1) { return typeSet[0]; } - if (includes & 1048576 /* Union */) { - if (intersectUnionsOfPrimitiveTypes(typeSet)) { - // When the intersection creates a reduced set (which might mean that *all* union types have - // disappeared), we restart the operation to get a new set of combined flags. Once we have - // reduced we'll never reduce again, so this occurs at most once. - return getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments); - } - // We are attempting to construct a type of the form X & (A | B) & Y. Transform this into a type of - // the form X & A & Y | X & B & Y and recursively reduce until no union type constituents remain. - var unionIndex_1 = ts.findIndex(typeSet, function (t) { return (t.flags & 1048576 /* Union */) !== 0; }); - var unionType = typeSet[unionIndex_1]; - return getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex_1, t)); }), 1 /* Literal */, aliasSymbol, aliasTypeArguments); - } var id = getTypeListId(typeSet); - var type = intersectionTypes.get(id); - if (!type) { - type = createType(2097152 /* Intersection */); - intersectionTypes.set(id, type); - type.objectFlags = getPropagatingFlagsOfTypes(typeSet, /*excludeKinds*/ 98304 /* Nullable */); - type.types = typeSet; - type.aliasSymbol = aliasSymbol; // See comment in `getUnionTypeFromSortedList`. - type.aliasTypeArguments = aliasTypeArguments; + var result = intersectionTypes.get(id); + if (!result) { + if (includes & 1048576 /* Union */) { + if (intersectUnionsOfPrimitiveTypes(typeSet)) { + // When the intersection creates a reduced set (which might mean that *all* union types have + // disappeared), we restart the operation to get a new set of combined flags. Once we have + // reduced we'll never reduce again, so this occurs at most once. + result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments); + } + else { + // We are attempting to construct a type of the form X & (A | B) & Y. Transform this into a type of + // the form X & A & Y | X & B & Y and recursively reduce until no union type constituents remain. + // If the estimated size of the resulting union type exceeds 100000 constituents, report an error. + var size = ts.reduceLeft(typeSet, function (n, t) { return n * (t.flags & 1048576 /* Union */ ? t.types.length : 1); }, 1); + if (size >= 100000) { + error(currentNode, ts.Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent); + return errorType; + } + var unionIndex_1 = ts.findIndex(typeSet, function (t) { return (t.flags & 1048576 /* Union */) !== 0; }); + var unionType = typeSet[unionIndex_1]; + result = getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex_1, t)); }), 1 /* Literal */, aliasSymbol, aliasTypeArguments); + } + } + else { + result = createIntersectionType(typeSet, aliasSymbol, aliasTypeArguments); + } + intersectionTypes.set(id, result); } - return type; + return result; } function getTypeFromIntersectionTypeNode(node) { var links = getNodeLinks(node); @@ -40090,18 +40503,19 @@ var ts; var numberIndexInfo = getIndexInfoOfType(type, 1 /* Number */); return numberIndexInfo !== enumNumberIndexInfo ? numberIndexInfo : undefined; } - function getIndexType(type, stringsOnly) { + function getIndexType(type, stringsOnly, noIndexSignatures) { if (stringsOnly === void 0) { stringsOnly = keyofStringsOnly; } - return type.flags & 1048576 /* Union */ ? getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly); })) : - type.flags & 2097152 /* Intersection */ ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly); })) : + return type.flags & 1048576 /* Union */ ? getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) : + type.flags & 2097152 /* Intersection */ ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) : maybeTypeOfKind(type, 58982400 /* InstantiableNonPrimitive */) ? getIndexTypeForGenericType(type, stringsOnly) : - ts.getObjectFlags(type) & 32 /* Mapped */ ? getConstraintTypeFromMappedType(type) : + ts.getObjectFlags(type) & 32 /* Mapped */ ? filterType(getConstraintTypeFromMappedType(type), function (t) { return !(noIndexSignatures && t.flags & (1 /* Any */ | 4 /* String */)); }) : type === wildcardType ? wildcardType : - type.flags & 1 /* Any */ ? keyofConstraintType : - stringsOnly ? getIndexInfoOfType(type, 0 /* String */) ? stringType : getLiteralTypeFromProperties(type, 128 /* StringLiteral */) : - getIndexInfoOfType(type, 0 /* String */) ? getUnionType([stringType, numberType, getLiteralTypeFromProperties(type, 8192 /* UniqueESSymbol */)]) : - getNonEnumNumberIndexInfo(type) ? getUnionType([numberType, getLiteralTypeFromProperties(type, 128 /* StringLiteral */ | 8192 /* UniqueESSymbol */)]) : - getLiteralTypeFromProperties(type, 8576 /* StringOrNumberLiteralOrUnique */); + type.flags & 2 /* Unknown */ ? neverType : + type.flags & (1 /* Any */ | 131072 /* Never */) ? keyofConstraintType : + stringsOnly ? !noIndexSignatures && getIndexInfoOfType(type, 0 /* String */) ? stringType : getLiteralTypeFromProperties(type, 128 /* StringLiteral */) : + !noIndexSignatures && getIndexInfoOfType(type, 0 /* String */) ? getUnionType([stringType, numberType, getLiteralTypeFromProperties(type, 8192 /* UniqueESSymbol */)]) : + getNonEnumNumberIndexInfo(type) ? getUnionType([numberType, getLiteralTypeFromProperties(type, 128 /* StringLiteral */ | 8192 /* UniqueESSymbol */)]) : + getLiteralTypeFromProperties(type, 8576 /* StringOrNumberLiteralOrUnique */); } function getExtractStringType(type) { if (keyofStringsOnly) { @@ -40118,15 +40532,15 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedType) { switch (node.operator) { - case 129 /* KeyOfKeyword */: + case 130 /* KeyOfKeyword */: links.resolvedType = getIndexType(getTypeFromTypeNode(node.type)); break; - case 142 /* UniqueKeyword */: - links.resolvedType = node.type.kind === 139 /* SymbolKeyword */ + case 143 /* UniqueKeyword */: + links.resolvedType = node.type.kind === 140 /* SymbolKeyword */ ? getESSymbolLikeTypeForNode(ts.walkUpParenthesizedTypes(node.parent)) : errorType; break; - case 133 /* ReadonlyKeyword */: + case 134 /* ReadonlyKeyword */: links.resolvedType = getTypeFromTypeNode(node.type); break; } @@ -40166,8 +40580,8 @@ var ts; } return false; } - function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol, missingType) { - var accessExpression = accessNode && accessNode.kind === 190 /* ElementAccessExpression */ ? accessNode : undefined; + function getPropertyTypeForIndexType(originalObjectType, objectType, indexType, fullIndexType, suppressNoImplicitAnyError, accessNode, accessFlags) { + var accessExpression = accessNode && accessNode.kind === 191 /* ElementAccessExpression */ ? accessNode : undefined; var propName = isTypeUsableAsPropertyName(indexType) ? getPropertyNameFromType(indexType) : accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, /*reportError*/ false) ? @@ -40180,12 +40594,12 @@ var ts; var prop = getPropertyOfType(objectType, propName); if (prop) { if (accessExpression) { - markPropertyAsReferenced(prop, accessExpression, /*isThisAccess*/ accessExpression.expression.kind === 100 /* ThisKeyword */); + markPropertyAsReferenced(prop, accessExpression, /*isThisAccess*/ accessExpression.expression.kind === 101 /* ThisKeyword */); if (ts.isAssignmentTarget(accessExpression) && (isReferenceToReadonlyEntity(accessExpression, prop) || isReferenceThroughNamespaceImport(accessExpression))) { error(accessExpression.argumentExpression, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(prop)); - return missingType; + return undefined; } - if (cacheSymbol) { + if (accessFlags & 4 /* CacheSymbol */) { getNodeLinks(accessNode).resolvedSymbol = prop; } } @@ -40204,6 +40618,7 @@ var ts; error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(propName), typeToString(objectType)); } } + errorIfWritingToReadonlyIndex(getIndexInfoOfType(objectType, 1 /* Number */)); return mapType(objectType, function (t) { return getRestTypeOfTupleType(t) || undefinedType; }); } } @@ -40211,17 +40626,21 @@ var ts; if (objectType.flags & (1 /* Any */ | 131072 /* Never */)) { return objectType; } - var indexInfo = isTypeAssignableToKind(indexType, 296 /* NumberLike */) && getIndexInfoOfType(objectType, 1 /* Number */) || - getIndexInfoOfType(objectType, 0 /* String */) || - undefined; + var stringIndexInfo = getIndexInfoOfType(objectType, 0 /* String */); + var indexInfo = isTypeAssignableToKind(indexType, 296 /* NumberLike */) && getIndexInfoOfType(objectType, 1 /* Number */) || stringIndexInfo; if (indexInfo) { + if (accessFlags & 1 /* NoIndexSignatures */ && indexInfo === stringIndexInfo) { + if (accessExpression) { + error(accessExpression, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(originalObjectType)); + } + return undefined; + } if (accessNode && !isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) { var indexNode = getIndexNodeForAccessExpression(accessNode); error(indexNode, ts.Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType)); + return indexInfo.type; } - else if (accessExpression && indexInfo.isReadonly && (ts.isAssignmentTarget(accessExpression) || ts.isDeleteTarget(accessExpression))) { - error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); - } + errorIfWritingToReadonlyIndex(indexInfo); return indexInfo.type; } if (indexType.flags & 131072 /* Never */) { @@ -40234,7 +40653,7 @@ var ts; if (objectType.symbol === globalThisSymbol && propName !== undefined && globalThisSymbol.exports.has(propName) && (globalThisSymbol.exports.get(propName).flags & 418 /* BlockScoped */)) { error(accessExpression, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(propName), typeToString(objectType)); } - else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors) { + else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !suppressNoImplicitAnyError) { if (propName !== undefined && typeHasStaticProperty(propName, objectType)) { error(accessExpression, ts.Diagnostics.Property_0_is_a_static_member_of_type_1, propName, typeToString(objectType)); } @@ -40249,11 +40668,35 @@ var ts; } } else { - error(accessExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature, typeToString(objectType)); + var suggestion_1 = getSuggestionForNonexistentIndexSignature(objectType, accessExpression); + if (suggestion_1 !== undefined) { + error(accessExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1, typeToString(objectType), suggestion_1); + } + else { + var errorInfo = void 0; + if (indexType.flags & 1024 /* EnumLiteral */) { + errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, "[" + typeToString(indexType) + "]", typeToString(objectType)); + } + else if (indexType.flags & 8192 /* UniqueESSymbol */) { + var symbolName_2 = getFullyQualifiedName(indexType.symbol, accessExpression); + errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, "[" + symbolName_2 + "]", typeToString(objectType)); + } + else if (indexType.flags & 128 /* StringLiteral */) { + errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.value, typeToString(objectType)); + } + else if (indexType.flags & 256 /* NumberLiteral */) { + errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.value, typeToString(objectType)); + } + else if (indexType.flags & (8 /* Number */ | 4 /* String */)) { + errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1, typeToString(indexType), typeToString(objectType)); + } + errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1, typeToString(fullIndexType), typeToString(objectType)); + diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(accessExpression, errorInfo)); + } } } } - return missingType; + return undefined; } } if (isJSLiteralType(objectType)) { @@ -40274,14 +40717,19 @@ var ts; if (isTypeAny(indexType)) { return indexType; } - return missingType; + return undefined; + function errorIfWritingToReadonlyIndex(indexInfo) { + if (indexInfo && indexInfo.isReadonly && accessExpression && (ts.isAssignmentTarget(accessExpression) || ts.isDeleteTarget(accessExpression))) { + error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); + } + } } function getIndexNodeForAccessExpression(accessNode) { - return accessNode.kind === 190 /* ElementAccessExpression */ + return accessNode.kind === 191 /* ElementAccessExpression */ ? accessNode.argumentExpression - : accessNode.kind === 180 /* IndexedAccessType */ + : accessNode.kind === 181 /* IndexedAccessType */ ? accessNode.indexType - : accessNode.kind === 149 /* ComputedPropertyName */ + : accessNode.kind === 150 /* ComputedPropertyName */ ? accessNode.expression : accessNode; } @@ -40291,67 +40739,124 @@ var ts; function isGenericIndexType(type) { return maybeTypeOfKind(type, 58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */); } - function getSimplifiedType(type) { - return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type) : type; + function isThisTypeParameter(type) { + return !!(type.flags & 262144 /* TypeParameter */ && type.isThisType); } - function distributeIndexOverObjectType(objectType, indexType) { - // (T | U)[K] -> T[K] | U[K] - if (objectType.flags & 1048576 /* Union */) { - return mapType(objectType, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType)); }); - } + function getSimplifiedType(type, writing) { + return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : + type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : + type; + } + function distributeIndexOverObjectType(objectType, indexType, writing) { + // (T | U)[K] -> T[K] | U[K] (reading) + // (T | U)[K] -> T[K] & U[K] (writing) // (T & U)[K] -> T[K] & U[K] - if (objectType.flags & 2097152 /* Intersection */) { - return getIntersectionType(ts.map(objectType.types, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType)); })); + if (objectType.flags & 3145728 /* UnionOrIntersection */) { + var types = ts.map(objectType.types, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType), writing); }); + return objectType.flags & 2097152 /* Intersection */ || writing ? getIntersectionType(types) : getUnionType(types); + } + } + function distributeObjectOverIndexType(objectType, indexType, writing) { + // T[A | B] -> T[A] | T[B] (reading) + // T[A | B] -> T[A] & T[B] (writing) + if (indexType.flags & 1048576 /* Union */) { + var types = ts.map(indexType.types, function (t) { return getSimplifiedType(getIndexedAccessType(objectType, t), writing); }); + return writing ? getIntersectionType(types) : getUnionType(types); } } // Transform an indexed access to a simpler form, if possible. Return the simpler form, or return - // the type itself if no transformation is possible. - function getSimplifiedIndexedAccessType(type) { - if (type.simplified) { - return type.simplified === circularConstraintType ? type : type.simplified; + // the type itself if no transformation is possible. The writing flag indicates that the type is + // the target of an assignment. + function getSimplifiedIndexedAccessType(type, writing) { + var cache = writing ? "simplifiedForWriting" : "simplifiedForReading"; + if (type[cache]) { + return type[cache] === circularConstraintType ? type : type[cache]; } - type.simplified = circularConstraintType; + type[cache] = circularConstraintType; // We recursively simplify the object type as it may in turn be an indexed access type. For example, with // '{ [P in T]: { [Q in U]: number } }[T][U]' we want to first simplify the inner indexed access type. - var objectType = getSimplifiedType(type.objectType); - var indexType = getSimplifiedType(type.indexType); - // T[A | B] -> T[A] | T[B] - if (indexType.flags & 1048576 /* Union */) { - return type.simplified = mapType(indexType, function (t) { return getSimplifiedType(getIndexedAccessType(objectType, t)); }); + var objectType = getSimplifiedType(type.objectType, writing); + var indexType = getSimplifiedType(type.indexType, writing); + // T[A | B] -> T[A] | T[B] (reading) + // T[A | B] -> T[A] & T[B] (writing) + var distributedOverIndex = distributeObjectOverIndexType(objectType, indexType, writing); + if (distributedOverIndex) { + return type[cache] = distributedOverIndex; } // Only do the inner distributions if the index can no longer be instantiated to cause index distribution again if (!(indexType.flags & 63176704 /* Instantiable */)) { - var simplified = distributeIndexOverObjectType(objectType, indexType); - if (simplified) { - return type.simplified = simplified; + // (T | U)[K] -> T[K] | U[K] (reading) + // (T | U)[K] -> T[K] & U[K] (writing) + // (T & U)[K] -> T[K] & U[K] + var distributedOverObject = distributeIndexOverObjectType(objectType, indexType, writing); + if (distributedOverObject) { + return type[cache] = distributedOverObject; } } - // So ultimately: + // So ultimately (reading): // ((A & B) | C)[K1 | K2] -> ((A & B) | C)[K1] | ((A & B) | C)[K2] -> (A & B)[K1] | C[K1] | (A & B)[K2] | C[K2] -> (A[K1] & B[K1]) | C[K1] | (A[K2] & B[K2]) | C[K2] // If the object type is a mapped type { [P in K]: E }, where K is generic, instantiate E using a mapper // that substitutes the index type for P. For example, for an index access { [P in K]: Box }[X], we // construct the type Box. if (isGenericMappedType(objectType)) { - return type.simplified = mapType(substituteIndexedMappedType(objectType, type.indexType), getSimplifiedType); + return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); }); } - return type.simplified = type; + return type[cache] = type; + } + function getSimplifiedConditionalType(type, writing) { + var checkType = type.checkType; + var extendsType = type.extendsType; + var trueType = getTrueTypeFromConditionalType(type); + var falseType = getFalseTypeFromConditionalType(type); + // Simplifications for types of the form `T extends U ? T : never` and `T extends U ? never : T`. + if (falseType.flags & 131072 /* Never */ && getActualTypeVariable(trueType) === getActualTypeVariable(checkType)) { + if (checkType.flags & 1 /* Any */ || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true + return getSimplifiedType(trueType, writing); + } + else if (isIntersectionEmpty(checkType, extendsType)) { // Always false + return neverType; + } + } + else if (trueType.flags & 131072 /* Never */ && getActualTypeVariable(falseType) === getActualTypeVariable(checkType)) { + if (!(checkType.flags & 1 /* Any */) && isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true + return neverType; + } + else if (checkType.flags & 1 /* Any */ || isIntersectionEmpty(checkType, extendsType)) { // Always false + return getSimplifiedType(falseType, writing); + } + } + return type; + } + /** + * Invokes union simplification logic to determine if an intersection is considered empty as a union constituent + */ + function isIntersectionEmpty(type1, type2) { + return !!(getUnionType([intersectTypes(type1, type2), neverType]).flags & 131072 /* Never */); } function substituteIndexedMappedType(objectType, index) { var mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]); var templateMapper = combineTypeMappers(objectType.mapper, mapper); return instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper); } - function getIndexedAccessType(objectType, indexType, accessNode, missingType) { - if (missingType === void 0) { missingType = accessNode ? errorType : unknownType; } + function getIndexedAccessType(objectType, indexType, accessNode) { + return getIndexedAccessTypeOrUndefined(objectType, indexType, accessNode, 0 /* None */) || (accessNode ? errorType : unknownType); + } + function getIndexedAccessTypeOrUndefined(objectType, indexType, accessNode, accessFlags) { + if (accessFlags === void 0) { accessFlags = 0 /* None */; } if (objectType === wildcardType || indexType === wildcardType) { return wildcardType; } + // If the object type has a string index signature and no other members we know that the result will + // always be the type of that index signature and we can simplify accordingly. + if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) { + indexType = stringType; + } // If the index type is generic, or if the object type is generic and doesn't originate in an expression, // we are performing a higher-order index access where we cannot meaningfully access the properties of the // object type. Note that for a generic T and a non-generic K, we eagerly resolve T[K] if it originates in // an expression. This is to preserve backwards compatibility. For example, an element access 'this["foo"]' // has always been resolved eagerly using the constraint type of 'this' at the given location. - if (isGenericIndexType(indexType) || !(accessNode && accessNode.kind !== 180 /* IndexedAccessType */) && isGenericObjectType(objectType)) { + if (isGenericIndexType(indexType) || !(accessNode && accessNode.kind !== 181 /* IndexedAccessType */) && isGenericObjectType(objectType)) { if (objectType.flags & 3 /* AnyOrUnknown */) { return objectType; } @@ -40372,25 +40877,25 @@ var ts; var wasMissingProp = false; for (var _i = 0, _a = indexType.types; _i < _a.length; _i++) { var t = _a[_i]; - var propType = getPropertyTypeForIndexType(apparentObjectType, t, accessNode, /*cacheSymbol*/ false, missingType); - if (propType === missingType) { - if (!accessNode) { - // If there's no error node, we can immeditely stop, since error reporting is off - return missingType; - } - else { - // Otherwise we set a flag and return at the end of the loop so we still mark all errors - wasMissingProp = true; - } + var propType = getPropertyTypeForIndexType(objectType, apparentObjectType, t, indexType, wasMissingProp, accessNode, accessFlags); + if (propType) { + propTypes.push(propType); + } + else if (!accessNode) { + // If there's no error node, we can immeditely stop, since error reporting is off + return undefined; + } + else { + // Otherwise we set a flag and return at the end of the loop so we still mark all errors + wasMissingProp = true; } - propTypes.push(propType); } if (wasMissingProp) { - return missingType; + return undefined; } - return getUnionType(propTypes); + return accessFlags & 2 /* Writing */ ? getIntersectionType(propTypes) : getUnionType(propTypes); } - return getPropertyTypeForIndexType(apparentObjectType, indexType, accessNode, /*cacheSymbol*/ true, missingType); + return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, /* supressNoImplicitAnyError */ false, accessNode, accessFlags | 4 /* CacheSymbol */); } function getTypeFromIndexedAccessTypeNode(node) { var links = getNodeLinks(node); @@ -40420,13 +40925,14 @@ var ts; return links.resolvedType; } function getActualTypeVariable(type) { - return type.flags & 33554432 /* Substitution */ ? type.typeVariable : type; - } - /** - * Invokes union simplification logic to determine if an intersection is considered empty as a union constituent - */ - function isIntersectionEmpty(type1, type2) { - return !!(getUnionType([intersectTypes(type1, type2), neverType]).flags & 131072 /* Never */); + if (type.flags & 33554432 /* Substitution */) { + return type.typeVariable; + } + if (type.flags & 8388608 /* IndexedAccess */ && (type.objectType.flags & 33554432 /* Substitution */ || + type.indexType.flags & 33554432 /* Substitution */)) { + return getIndexedAccessType(getActualTypeVariable(type.objectType), getActualTypeVariable(type.indexType)); + } + return type; } function getConditionalType(root, mapper) { var checkType = instantiateType(root.checkType, mapper); @@ -40434,35 +40940,6 @@ var ts; if (checkType === wildcardType || extendsType === wildcardType) { return wildcardType; } - var trueType = instantiateType(root.trueType, mapper); - var falseType = instantiateType(root.falseType, mapper); - var instantiationId = "" + (root.isDistributive ? "d" : "") + getTypeId(checkType) + ">" + getTypeId(extendsType) + "?" + getTypeId(trueType) + ":" + getTypeId(falseType); - var result = conditionalTypes.get(instantiationId); - if (result) { - return result; - } - var newResult = getConditionalTypeWorker(root, mapper, checkType, extendsType, trueType, falseType); - conditionalTypes.set(instantiationId, newResult); - return newResult; - } - function getConditionalTypeWorker(root, mapper, checkType, extendsType, trueType, falseType) { - // Simplifications for types of the form `T extends U ? T : never` and `T extends U ? never : T`. - if (falseType.flags & 131072 /* Never */ && isTypeIdenticalTo(getActualTypeVariable(trueType), getActualTypeVariable(checkType))) { - if (checkType.flags & 1 /* Any */ || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true - return trueType; - } - else if (isIntersectionEmpty(checkType, extendsType)) { // Always false - return neverType; - } - } - else if (trueType.flags & 131072 /* Never */ && isTypeIdenticalTo(getActualTypeVariable(falseType), getActualTypeVariable(checkType))) { - if (!(checkType.flags & 1 /* Any */) && isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true - return neverType; - } - else if (checkType.flags & 1 /* Any */ || isIntersectionEmpty(checkType, extendsType)) { // Always false - return falseType; - } - } var checkTypeInstantiable = maybeTypeOfKind(checkType, 63176704 /* Instantiable */ | 131072 /* GenericMappedType */); var combinedMapper; if (root.inferTypeParameters) { @@ -40471,7 +40948,7 @@ var ts; // We don't want inferences from constraints as they may cause us to eagerly resolve the // conditional type instead of deferring resolution. Also, we always want strict function // types rules (i.e. proper contravariance) for inferences. - inferTypes(context.inferences, checkType, extendsType, 32 /* NoConstraints */ | 64 /* AlwaysStrict */); + inferTypes(context.inferences, checkType, extendsType, 64 /* NoConstraints */ | 128 /* AlwaysStrict */); } combinedMapper = combineTypeMappers(mapper, context.mapper); } @@ -40480,18 +40957,18 @@ var ts; // We attempt to resolve the conditional type only when the check and extends types are non-generic if (!checkTypeInstantiable && !maybeTypeOfKind(inferredExtendsType, 63176704 /* Instantiable */ | 131072 /* GenericMappedType */)) { if (inferredExtendsType.flags & 3 /* AnyOrUnknown */) { - return trueType; + return instantiateType(root.trueType, combinedMapper || mapper); } // Return union of trueType and falseType for 'any' since it matches anything if (checkType.flags & 1 /* Any */) { - return getUnionType([instantiateType(root.trueType, combinedMapper || mapper), falseType]); + return getUnionType([instantiateType(root.trueType, combinedMapper || mapper), instantiateType(root.falseType, mapper)]); } // Return falseType for a definitely false extends check. We check an instantiations of the two // types with type parameters mapped to the wildcard type, the most permissive instantiations // possible (the wildcard type is assignable to and from all types). If those are not related, // then no instantiations will be and we can just return the false branch type. if (!isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType))) { - return falseType; + return instantiateType(root.falseType, mapper); } // Return trueType for a definitely true extends check. We check instantiations of the two // types with type parameters mapped to their restrictive form, i.e. a form of the type parameter @@ -40503,9 +40980,6 @@ var ts; } } // Return a deferred type for a check that is neither definitely true nor definitely false - return getDeferredConditionalType(root, mapper, combinedMapper, checkType, extendsType, trueType, falseType); - } - function getDeferredConditionalType(root, mapper, combinedMapper, checkType, extendsType, trueType, falseType) { var erasedCheckType = getActualTypeVariable(checkType); var result = createType(16777216 /* Conditional */); result.root = root; @@ -40513,14 +40987,18 @@ var ts; result.extendsType = extendsType; result.mapper = mapper; result.combinedMapper = combinedMapper; - result.trueType = trueType; - result.falseType = falseType; result.aliasSymbol = root.aliasSymbol; result.aliasTypeArguments = instantiateTypes(root.aliasTypeArguments, mapper); // TODO: GH#18217 return result; } + function getTrueTypeFromConditionalType(type) { + return type.resolvedTrueType || (type.resolvedTrueType = instantiateType(type.root.trueType, type.mapper)); + } + function getFalseTypeFromConditionalType(type) { + return type.resolvedFalseType || (type.resolvedFalseType = instantiateType(type.root.falseType, type.mapper)); + } function getInferredTrueTypeFromConditionalType(type) { - return type.resolvedInferredTrueType || (type.resolvedInferredTrueType = instantiateType(type.root.trueType, type.combinedMapper || type.mapper)); + return type.resolvedInferredTrueType || (type.resolvedInferredTrueType = type.combinedMapper ? instantiateType(type.root.trueType, type.combinedMapper) : getTrueTypeFromConditionalType(type)); } function getInferTypeParameters(node) { var result; @@ -40533,20 +41011,6 @@ var ts; } return result; } - function isPossiblyReferencedInConditionalType(tp, node) { - if (isTypeParameterPossiblyReferenced(tp, node)) { - return true; - } - while (node) { - if (node.kind === 175 /* ConditionalType */) { - if (isTypeParameterPossiblyReferenced(tp, node.extendsType)) { - return true; - } - } - node = node.parent; - } - return false; - } function getTypeFromConditionalTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { @@ -40554,7 +41018,7 @@ var ts; var aliasSymbol = getAliasSymbolForTypeNode(node); var aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol); var allOuterTypeParameters = getOuterTypeParameters(node, /*includeThisTypes*/ true); - var outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : ts.filter(allOuterTypeParameters, function (tp) { return isPossiblyReferencedInConditionalType(tp, node); }); + var outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : ts.filter(allOuterTypeParameters, function (tp) { return isTypeParameterPossiblyReferenced(tp, node); }); var root = { node: node, checkType: checkType, @@ -40865,9 +41329,9 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 241 /* InterfaceDeclaration */)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 242 /* InterfaceDeclaration */)) { if (!ts.hasModifier(container, 32 /* Static */) && - (container.kind !== 157 /* Constructor */ || ts.isNodeDescendantOf(node, container.body))) { + (container.kind !== 158 /* Constructor */ || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; } } @@ -40883,89 +41347,89 @@ var ts; } function getTypeFromTypeNode(node) { switch (node.kind) { - case 120 /* AnyKeyword */: - case 289 /* JSDocAllType */: - case 290 /* JSDocUnknownType */: + case 121 /* AnyKeyword */: + case 290 /* JSDocAllType */: + case 291 /* JSDocUnknownType */: return anyType; - case 143 /* UnknownKeyword */: + case 144 /* UnknownKeyword */: return unknownType; - case 138 /* StringKeyword */: + case 139 /* StringKeyword */: return stringType; - case 135 /* NumberKeyword */: + case 136 /* NumberKeyword */: return numberType; - case 146 /* BigIntKeyword */: + case 147 /* BigIntKeyword */: return bigintType; - case 123 /* BooleanKeyword */: + case 124 /* BooleanKeyword */: return booleanType; - case 139 /* SymbolKeyword */: + case 140 /* SymbolKeyword */: return esSymbolType; - case 106 /* VoidKeyword */: + case 107 /* VoidKeyword */: return voidType; - case 141 /* UndefinedKeyword */: + case 142 /* UndefinedKeyword */: return undefinedType; - case 96 /* NullKeyword */: + case 97 /* NullKeyword */: return nullType; - case 132 /* NeverKeyword */: + case 133 /* NeverKeyword */: return neverType; - case 136 /* ObjectKeyword */: + case 137 /* ObjectKeyword */: return node.flags & 65536 /* JavaScriptFile */ ? anyType : nonPrimitiveType; - case 178 /* ThisType */: - case 100 /* ThisKeyword */: + case 179 /* ThisType */: + case 101 /* ThisKeyword */: return getTypeFromThisTypeNode(node); - case 182 /* LiteralType */: + case 183 /* LiteralType */: return getTypeFromLiteralTypeNode(node); - case 164 /* TypeReference */: + case 165 /* TypeReference */: return getTypeFromTypeReference(node); - case 163 /* TypePredicate */: + case 164 /* TypePredicate */: return booleanType; - case 211 /* ExpressionWithTypeArguments */: + case 212 /* ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); - case 167 /* TypeQuery */: + case 168 /* TypeQuery */: return getTypeFromTypeQueryNode(node); - case 169 /* ArrayType */: + case 170 /* ArrayType */: return getTypeFromArrayTypeNode(node); - case 170 /* TupleType */: + case 171 /* TupleType */: return getTypeFromTupleTypeNode(node); - case 171 /* OptionalType */: + case 172 /* OptionalType */: return getTypeFromOptionalTypeNode(node); - case 173 /* UnionType */: + case 174 /* UnionType */: return getTypeFromUnionTypeNode(node); - case 174 /* IntersectionType */: + case 175 /* IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 291 /* JSDocNullableType */: + case 292 /* JSDocNullableType */: return getTypeFromJSDocNullableTypeNode(node); - case 293 /* JSDocOptionalType */: + case 294 /* JSDocOptionalType */: return addOptionality(getTypeFromTypeNode(node.type)); - case 177 /* ParenthesizedType */: - case 172 /* RestType */: - case 292 /* JSDocNonNullableType */: - case 288 /* JSDocTypeExpression */: + case 178 /* ParenthesizedType */: + case 173 /* RestType */: + case 293 /* JSDocNonNullableType */: + case 289 /* JSDocTypeExpression */: return getTypeFromTypeNode(node.type); - case 295 /* JSDocVariadicType */: + case 296 /* JSDocVariadicType */: return getTypeFromJSDocVariadicType(node); - case 165 /* FunctionType */: - case 166 /* ConstructorType */: - case 168 /* TypeLiteral */: - case 297 /* JSDocTypeLiteral */: - case 294 /* JSDocFunctionType */: - case 298 /* JSDocSignature */: + case 166 /* FunctionType */: + case 167 /* ConstructorType */: + case 169 /* TypeLiteral */: + case 298 /* JSDocTypeLiteral */: + case 295 /* JSDocFunctionType */: + case 299 /* JSDocSignature */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 179 /* TypeOperator */: + case 180 /* TypeOperator */: return getTypeFromTypeOperatorNode(node); - case 180 /* IndexedAccessType */: + case 181 /* IndexedAccessType */: return getTypeFromIndexedAccessTypeNode(node); - case 181 /* MappedType */: + case 182 /* MappedType */: return getTypeFromMappedTypeNode(node); - case 175 /* ConditionalType */: + case 176 /* ConditionalType */: return getTypeFromConditionalTypeNode(node); - case 176 /* InferType */: + case 177 /* InferType */: return getTypeFromInferTypeNode(node); - case 183 /* ImportType */: + case 184 /* ImportType */: return getTypeFromImportTypeNode(node); // This function assumes that an identifier or qualified name is a type expression // Callers should first ensure this by calling isTypeNode - case 72 /* Identifier */: - case 148 /* QualifiedName */: + case 73 /* Identifier */: + case 149 /* QualifiedName */: var symbol = getSymbolAtLocation(node); return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType; default: @@ -41025,7 +41489,7 @@ var ts; * This is used during inference when instantiating type parameter defaults. */ function createBackreferenceMapper(context, index) { - return function (t) { return ts.findIndex(context.inferences, function (info) { return info.typeParameter === t; }) >= index ? emptyObjectType : t; }; + return function (t) { return ts.findIndex(context.inferences, function (info) { return info.typeParameter === t; }) >= index ? unknownType : t; }; } function combineTypeMappers(mapper1, mapper2) { if (!mapper1) @@ -41108,7 +41572,7 @@ var ts; } // Keep the flags from the symbol we're instantiating. Mark that is instantiated, and // also transient so that we can just store data on it directly. - var result = createSymbol(symbol.flags, symbol.escapedName, 1 /* Instantiated */ | ts.getCheckFlags(symbol) & (8 /* Readonly */ | 2048 /* Late */ | 8192 /* OptionalParameter */ | 16384 /* RestParameter */)); + var result = createSymbol(symbol.flags, symbol.escapedName, 1 /* Instantiated */ | ts.getCheckFlags(symbol) & (8 /* Readonly */ | 4096 /* Late */ | 16384 /* OptionalParameter */ | 32768 /* RestParameter */)); result.declarations = symbol.declarations; result.parent = symbol.parent; result.target = symbol; @@ -41174,28 +41638,31 @@ var ts; return type; } function maybeTypeParameterReference(node) { - return !(node.kind === 148 /* QualifiedName */ || - node.parent.kind === 164 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName); + return !(node.kind === 149 /* QualifiedName */ || + node.parent.kind === 165 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName); } function isTypeParameterPossiblyReferenced(tp, node) { // If the type parameter doesn't have exactly one declaration, if there are invening statement blocks // between the node and the type parameter declaration, if the node contains actual references to the // type parameter, or if the node contains type queries, we consider the type parameter possibly referenced. if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) { - var container_3 = tp.symbol.declarations[0].parent; - if (ts.findAncestor(node, function (n) { return n.kind === 218 /* Block */ ? "quit" : n === container_3; })) { - return !!ts.forEachChild(node, containsReference); + var container = tp.symbol.declarations[0].parent; + for (var n = node; n !== container; n = n.parent) { + if (!n || n.kind === 219 /* Block */ || n.kind === 176 /* ConditionalType */ && ts.forEachChild(n.extendsType, containsReference)) { + return true; + } } + return !!ts.forEachChild(node, containsReference); } return true; function containsReference(node) { switch (node.kind) { - case 178 /* ThisType */: + case 179 /* ThisType */: return !!tp.isThisType; - case 72 /* Identifier */: + case 73 /* Identifier */: return !tp.isThisType && ts.isPartOfTypeNode(node) && maybeTypeParameterReference(node) && getTypeFromTypeNode(node) === tp; - case 167 /* TypeQuery */: + case 168 /* TypeQuery */: return true; } return !!ts.forEachChild(node, containsReference); @@ -41343,7 +41810,7 @@ var ts; // If the anonymous type originates in a declaration of a function, method, class, or // interface, in an object type literal, or in an object literal expression, we may need // to instantiate the type because it might reference a type parameter. - return type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations ? + return couldContainTypeVariables(type) ? getAnonymousTypeInstantiation(type, mapper) : type; } if (objectFlags & 32 /* Mapped */) { @@ -41382,7 +41849,7 @@ var ts; } else { var sub = instantiateType(type.substitute, mapper); - if (sub.flags & 3 /* AnyOrUnknown */ || isTypeSubtypeOf(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) { + if (sub.flags & 3 /* AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) { return maybeVariable; } return sub; @@ -41416,34 +41883,34 @@ var ts; // Returns true if the given expression contains (at any level of nesting) a function or arrow expression // that is subject to contextual typing. function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 156 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 157 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: - case 156 /* MethodDeclaration */: + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: + case 157 /* MethodDeclaration */: return isContextSensitiveFunctionLikeDeclaration(node); - case 188 /* ObjectLiteralExpression */: + case 189 /* ObjectLiteralExpression */: return ts.some(node.properties, isContextSensitive); - case 187 /* ArrayLiteralExpression */: + case 188 /* ArrayLiteralExpression */: return ts.some(node.elements, isContextSensitive); - case 205 /* ConditionalExpression */: + case 206 /* ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: return node.operatorToken.kind === 55 /* BarBarToken */ && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 275 /* PropertyAssignment */: + case 276 /* PropertyAssignment */: return isContextSensitive(node.initializer); - case 195 /* ParenthesizedExpression */: + case 196 /* ParenthesizedExpression */: return isContextSensitive(node.expression); - case 268 /* JsxAttributes */: + case 269 /* JsxAttributes */: return ts.some(node.properties, isContextSensitive) || ts.isJsxOpeningElement(node.parent) && ts.some(node.parent.parent.children, isContextSensitive); - case 267 /* JsxAttribute */: { + case 268 /* JsxAttribute */: { // If there is no initializer, JSX attribute has a boolean value of true which is not context sensitive. var initializer = node.initializer; return !!initializer && isContextSensitive(initializer); } - case 270 /* JsxExpression */: { + case 271 /* JsxExpression */: { // It is possible to that node.expression is undefined (e.g
) var expression = node.expression; return !!expression && isContextSensitive(expression); @@ -41460,7 +41927,7 @@ var ts; if (ts.some(node.parameters, function (p) { return !ts.getEffectiveTypeAnnotationNode(p); })) { return true; } - if (node.kind !== 197 /* ArrowFunction */) { + if (node.kind !== 198 /* ArrowFunction */) { // If the first parameter is not an explicit 'this' parameter, then the function has // an implicit 'this' parameter which is subject to contextual typing. var parameter = ts.firstOrUndefined(node.parameters); @@ -41472,7 +41939,7 @@ var ts; } function hasContextSensitiveReturnExpression(node) { // TODO(anhans): A block should be context-sensitive if it has a context-sensitive return value. - return !!node.body && node.body.kind !== 218 /* Block */ && isContextSensitive(node.body); + return !!node.body && node.body.kind !== 219 /* Block */ && isContextSensitive(node.body); } function isContextSensitiveFunctionOrObjectLiteralMethod(func) { return (ts.isInJSFile(func) && ts.isFunctionDeclaration(func) || isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && @@ -41525,7 +41992,7 @@ var ts; function isTypeDerivedFrom(source, target) { return source.flags & 1048576 /* Union */ ? ts.every(source.types, function (t) { return isTypeDerivedFrom(t, target); }) : target.flags & 1048576 /* Union */ ? ts.some(target.types, function (t) { return isTypeDerivedFrom(source, t); }) : - source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || emptyObjectType, target) : + source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) : target === globalObjectType ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) : target === globalFunctionType ? !!(source.flags & 524288 /* Object */) && isFunctionObjectType(source) : hasBaseType(source, getTargetType(target)); @@ -41574,23 +42041,23 @@ var ts; return true; } switch (node.kind) { - case 270 /* JsxExpression */: - case 195 /* ParenthesizedExpression */: + case 271 /* JsxExpression */: + case 196 /* ParenthesizedExpression */: return elaborateError(node.expression, source, target, relation, headMessage); - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: switch (node.operatorToken.kind) { - case 59 /* EqualsToken */: + case 60 /* EqualsToken */: case 27 /* CommaToken */: return elaborateError(node.right, source, target, relation, headMessage); } break; - case 188 /* ObjectLiteralExpression */: + case 189 /* ObjectLiteralExpression */: return elaborateObjectLiteral(node, source, target, relation); - case 187 /* ArrayLiteralExpression */: + case 188 /* ArrayLiteralExpression */: return elaborateArrayLiteral(node, source, target, relation); - case 268 /* JsxAttributes */: + case 269 /* JsxAttributes */: return elaborateJsxComponents(node, source, target, relation); - case 197 /* ArrowFunction */: + case 198 /* ArrowFunction */: return elaborateArrowFunction(node, source, target, relation); } return false; @@ -41659,11 +42126,11 @@ var ts; var reportedError = false; for (var status = iterator.next(); !status.done; status = iterator.next()) { var _a = status.value, prop = _a.errorNode, next = _a.innerExpression, nameType = _a.nameType, errorMessage = _a.errorMessage; - var targetPropType = getIndexedAccessType(target, nameType, /*accessNode*/ undefined, errorType); - if (targetPropType === errorType || targetPropType.flags & 8388608 /* IndexedAccess */) + var targetPropType = getIndexedAccessTypeOrUndefined(target, nameType); + if (!targetPropType || targetPropType.flags & 8388608 /* IndexedAccess */) continue; // Don't elaborate on indexes on generic variables - var sourcePropType = getIndexedAccessType(source, nameType, /*accessNode*/ undefined, errorType); - if (sourcePropType !== errorType && targetPropType !== errorType && !checkTypeRelatedTo(sourcePropType, targetPropType, relation, /*errorNode*/ undefined)) { + var sourcePropType = getIndexedAccessTypeOrUndefined(source, nameType); + if (sourcePropType && !checkTypeRelatedTo(sourcePropType, targetPropType, relation, /*errorNode*/ undefined)) { var elaborated = next && elaborateError(next, sourcePropType, targetPropType, relation, /*headMessage*/ undefined); if (elaborated) { reportedError = true; @@ -41762,7 +42229,7 @@ var ts; } function getElaborationElementForJsxChild(child, nameType, getInvalidTextDiagnostic) { switch (child.kind) { - case 270 /* JsxExpression */: + case 271 /* JsxExpression */: // child is of the type of the expression return { errorNode: child, innerExpression: child.expression, nameType: nameType }; case 11 /* JsxText */: @@ -41771,15 +42238,18 @@ var ts; } // child is a string return { errorNode: child, innerExpression: undefined, nameType: nameType, errorMessage: getInvalidTextDiagnostic() }; - case 260 /* JsxElement */: - case 261 /* JsxSelfClosingElement */: - case 264 /* JsxFragment */: + case 261 /* JsxElement */: + case 262 /* JsxSelfClosingElement */: + case 265 /* JsxFragment */: // child is of type JSX.Element return { errorNode: child, innerExpression: child, nameType: nameType }; default: return ts.Debug.assertNever(child, "Found invalid jsx child"); } } + function getSemanticJsxChildren(children) { + return ts.filter(children, function (i) { return !ts.isJsxText(i) || !i.containsOnlyTriviaWhiteSpaces; }); + } function elaborateJsxComponents(node, source, target, relation) { var result = elaborateElementwise(generateJsxAttributes(node), source, target, relation); var invalidTextDiagnostic; @@ -41789,7 +42259,7 @@ var ts; var childrenPropName = childPropName === undefined ? "children" : ts.unescapeLeadingUnderscores(childPropName); var childrenNameType = getLiteralType(childrenPropName); var childrenTargetType = getIndexedAccessType(target, childrenNameType); - var validChildren = ts.filter(containingElement.children, function (i) { return !ts.isJsxText(i) || !i.containsOnlyTriviaWhiteSpaces; }); + var validChildren = getSemanticJsxChildren(containingElement.children); if (!ts.length(validChildren)) { return result; } @@ -41873,6 +42343,8 @@ var ts; }); } function elaborateArrayLiteral(node, source, target, relation) { + if (target.flags & 131068 /* Primitive */) + return false; if (isTupleLikeType(source)) { return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation); } @@ -41903,11 +42375,11 @@ var ts; } _b = prop.kind; switch (_b) { - case 159 /* SetAccessor */: return [3 /*break*/, 2]; - case 158 /* GetAccessor */: return [3 /*break*/, 2]; - case 156 /* MethodDeclaration */: return [3 /*break*/, 2]; - case 276 /* ShorthandPropertyAssignment */: return [3 /*break*/, 2]; - case 275 /* PropertyAssignment */: return [3 /*break*/, 4]; + case 160 /* SetAccessor */: return [3 /*break*/, 2]; + case 159 /* GetAccessor */: return [3 /*break*/, 2]; + case 157 /* MethodDeclaration */: return [3 /*break*/, 2]; + case 277 /* ShorthandPropertyAssignment */: return [3 /*break*/, 2]; + case 276 /* PropertyAssignment */: return [3 /*break*/, 4]; } return [3 /*break*/, 6]; case 2: return [4 /*yield*/, { errorNode: prop.name, innerExpression: undefined, nameType: type }]; @@ -41929,6 +42401,8 @@ var ts; }); } function elaborateObjectLiteral(node, source, target, relation) { + if (target.flags & 131068 /* Primitive */) + return false; return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation); } /** @@ -41977,8 +42451,8 @@ var ts; return 0 /* False */; } var kind = target.declaration ? target.declaration.kind : 0 /* Unknown */; - var strictVariance = !callbackCheck && strictFunctionTypes && kind !== 156 /* MethodDeclaration */ && - kind !== 155 /* MethodSignature */ && kind !== 157 /* Constructor */; + var strictVariance = !callbackCheck && strictFunctionTypes && kind !== 157 /* MethodDeclaration */ && + kind !== 156 /* MethodSignature */ && kind !== 158 /* Constructor */; var result = -1 /* True */; var sourceThisType = getThisTypeOfSignature(source); if (sourceThisType && sourceThisType !== voidType) { @@ -42026,12 +42500,14 @@ var ts; result &= related; } if (!ignoreReturnTypes) { - var targetReturnType = (target.declaration && isJSConstructor(target.declaration)) ? + // If a signature reolution is already in-flight, skip issuing a circularity error + // here and just use the `any` type directly + var targetReturnType = isResolvingReturnTypeOfSignature(target) ? anyType : (target.declaration && isJSConstructor(target.declaration)) ? getJSClassType(target.declaration.symbol) : getReturnTypeOfSignature(target); if (targetReturnType === voidType) { return result; } - var sourceReturnType = (source.declaration && isJSConstructor(source.declaration)) ? + var sourceReturnType = isResolvingReturnTypeOfSignature(source) ? anyType : (source.declaration && isJSConstructor(source.declaration)) ? getJSClassType(source.declaration.symbol) : getReturnTypeOfSignature(source); // The following block preserves behavior forbidding boolean returning functions from being assignable to type guard returning functions var targetTypePredicate = getTypePredicateOfSignature(target); @@ -42110,6 +42586,11 @@ var ts; function isEmptyAnonymousObjectType(type) { return !!(ts.getObjectFlags(type) & 16 /* Anonymous */) && isEmptyObjectType(type); } + function isStringIndexSignatureOnlyType(type) { + return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfoOfType(type, 0 /* String */) && !getIndexInfoOfType(type, 1 /* Number */) || + type.flags & 3145728 /* UnionOrIntersection */ && ts.every(type.types, isStringIndexSignatureOnlyType) || + false; + } function isEnumTypeRelatedTo(sourceSymbol, targetSymbol, errorReporter) { if (sourceSymbol === targetSymbol) { return true; @@ -42218,8 +42699,8 @@ var ts; } return false; } - function isIgnoredJsxProperty(source, sourceProp, targetMemberType) { - return ts.getObjectFlags(source) & 4096 /* JsxAttributes */ && !(isUnhyphenatedJsxName(sourceProp.escapedName) || targetMemberType); + function isIgnoredJsxProperty(source, sourceProp) { + return ts.getObjectFlags(source) & 4096 /* JsxAttributes */ && !isUnhyphenatedJsxName(sourceProp.escapedName); } /** * Checks if 'source' is related to 'target' (e.g.: is a assignable to). @@ -42241,7 +42722,7 @@ var ts; var depth = 0; var expandingFlags = 0 /* None */; var overflow = false; - var suppressNextError = false; + var overrideNextErrorInfo; ts.Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking"); var result = isRelatedTo(source, target, /*reportErrors*/ !!errorNode, headMessage); if (overflow) { @@ -42249,9 +42730,9 @@ var ts; } else if (errorInfo) { if (containingMessageChain) { - var chain_1 = containingMessageChain(); - if (chain_1) { - errorInfo = ts.concatenateDiagnosticMessageChains(chain_1, errorInfo); + var chain = containingMessageChain(); + if (chain) { + errorInfo = ts.concatenateDiagnosticMessageChains(chain, errorInfo); } } var relatedInformation = void 0; @@ -42291,11 +42772,9 @@ var ts; } } function reportRelationError(message, source, target) { - var sourceType = typeToString(source); - var targetType = typeToString(target); - if (sourceType === targetType) { - sourceType = typeToString(source, /*enclosingDeclaration*/ undefined, 64 /* UseFullyQualifiedType */); - targetType = typeToString(target, /*enclosingDeclaration*/ undefined, 64 /* UseFullyQualifiedType */); + var _a = getTypeNamesForErrorDisplay(source, target), sourceType = _a[0], targetType = _a[1]; + if (target.flags & 262144 /* TypeParameter */ && target.immediateBaseConstraint !== undefined && isTypeAssignableTo(source, target.immediateBaseConstraint)) { + reportError(ts.Diagnostics._0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2, sourceType, targetType, typeToString(target.immediateBaseConstraint)); } if (!message) { if (relation === comparableRelation) { @@ -42320,24 +42799,38 @@ var ts; reportError(ts.Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType); } } - function isUnionOrIntersectionTypeWithoutNullableConstituents(type) { - if (!(type.flags & 3145728 /* UnionOrIntersection */)) { + /** + * Try and elaborate array and tuple errors. Returns false + * if we have found an elaboration, or we should ignore + * any other elaborations when relating the `source` and + * `target` types. + * + * @param source + * @param target + * @param reportErrors + */ + function tryElaborateArrayLikeErrors(source, target, reportErrors) { + if (isTupleLikeType(source)) { + var sourceTuple = source.target; + if (sourceTuple && sourceTuple.readonly && isArrayOrTupleLikeType(target) && + (!isReadonlyArrayType(target) || isTupleType(target) && !target.target.readonly)) { + if (reportErrors) { + reportError(ts.Diagnostics.The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1, typeToString(source), typeToString(target)); + } + return false; + } + return isArrayLikeType(target); + } + if (isTupleLikeType(target)) { + return isArrayLikeType(source); + } + if (isReadonlyArrayType(source) && isArrayType(target) && !isReadonlyArrayType(target)) { + if (reportErrors) { + reportError(ts.Diagnostics.The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1, typeToString(source), typeToString(target)); + } return false; } - // at this point we know that this is union or intersection type possibly with nullable constituents. - // check if we still will have compound type if we ignore nullable components. - var seenNonNullable = false; - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var t = _a[_i]; - if (t.flags & 98304 /* Nullable */) { - continue; - } - if (seenNonNullable) { - return true; - } - seenNonNullable = true; - } - return false; + return true; } /** * Compare two types and return @@ -42359,11 +42852,11 @@ var ts; if (target.flags & 33554432 /* Substitution */) { target = target.typeVariable; } - if (source.flags & 8388608 /* IndexedAccess */) { - source = getSimplifiedType(source); + if (source.flags & 25165824 /* Simplifiable */) { + source = getSimplifiedType(source, /*writing*/ false); } - if (target.flags & 8388608 /* IndexedAccess */) { - target = getSimplifiedType(target); + if (target.flags & 25165824 /* Simplifiable */) { + target = getSimplifiedType(target, /*writing*/ true); } // Try to see if we're relating something like `Foo` -> `Bar | null | undefined`. // If so, reporting the `null` and `undefined` in the type is hardly useful. @@ -42391,7 +42884,8 @@ var ts; isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined)) return -1 /* True */; var isComparingJsxAttributes = !!(ts.getObjectFlags(source) & 4096 /* JsxAttributes */); - if (isObjectLiteralType(source) && ts.getObjectFlags(source) & 32768 /* FreshLiteral */) { + var isPerformingExcessPropertyChecks = (isObjectLiteralType(source) && ts.getObjectFlags(source) & 32768 /* FreshLiteral */); + if (isPerformingExcessPropertyChecks) { var discriminantType = target.flags & 1048576 /* Union */ ? findMatchingDiscriminantType(source, target) : undefined; if (hasExcessProperties(source, target, discriminantType, reportErrors)) { if (reportErrors) { @@ -42399,13 +42893,6 @@ var ts; } return 0 /* False */; } - // Above we check for excess properties with respect to the entire target type. When union - // and intersection types are further deconstructed on the target side, we don't want to - // make the check again (as it might fail for a partial target type). Therefore we obtain - // the regular source type and proceed with that. - if (isUnionOrIntersectionTypeWithoutNullableConstituents(target) && !discriminantType) { - source = getRegularTypeOfObjectLiteral(source); - } } if (relation !== comparableRelation && !isApparentIntersectionConstituent && source.flags & (131068 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source !== globalObjectType && @@ -42438,11 +42925,24 @@ var ts; } else { if (target.flags & 1048576 /* Union */) { - result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */) && !(target.flags & 131068 /* Primitive */)); + result = typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source), target, reportErrors && !(source.flags & 131068 /* Primitive */) && !(target.flags & 131068 /* Primitive */)); + if (result && isPerformingExcessPropertyChecks) { + // Validate against excess props using the original `source` + var discriminantType = target.flags & 1048576 /* Union */ ? findMatchingDiscriminantType(source, target) : undefined; + if (!propertiesRelatedTo(source, discriminantType || target, reportErrors, /*excludedProperties*/ undefined)) { + return 0 /* False */; + } + } } else if (target.flags & 2097152 /* Intersection */) { isIntersectionConstituent = true; // set here to affect the following trio of checks - result = typeRelatedToEachType(source, target, reportErrors); + result = typeRelatedToEachType(getRegularTypeOfObjectLiteral(source), target, reportErrors); + if (result && isPerformingExcessPropertyChecks) { + // Validate against excess props using the original `source` + if (!propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined)) { + return 0 /* False */; + } + } } else if (source.flags & 2097152 /* Intersection */) { // Check to see if any constituents of the intersection are immediately related to the target. @@ -42484,8 +42984,15 @@ var ts; } } if (!result && reportErrors) { - var maybeSuppress = suppressNextError; - suppressNextError = false; + var maybeSuppress = overrideNextErrorInfo; + overrideNextErrorInfo = undefined; + if (source.flags & 524288 /* Object */ && target.flags & 524288 /* Object */) { + var currentError = errorInfo; + tryElaborateArrayLikeErrors(source, target, reportErrors); + if (errorInfo !== currentError) { + maybeSuppress = errorInfo; + } + } if (source.flags & 524288 /* Object */ && target.flags & 131068 /* Primitive */) { tryElaborateErrorsForPrimitivesAndObjects(source, target); } @@ -42580,7 +43087,7 @@ var ts; return { value: true }; } }; - for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { + for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) { var prop = _a[_i]; var state_3 = _loop_7(prop); if (typeof state_3 === "object") @@ -42687,8 +43194,8 @@ var ts; } // Keep this up-to-date with the same logic within `getApparentTypeOfContextualType`, since they should behave similarly function findMatchingDiscriminantType(source, target) { - if (target.flags & 1048576 /* Union */) { - var sourceProperties = getPropertiesOfObjectType(source); + if (target.flags & 1048576 /* Union */ && source.flags & (2097152 /* Intersection */ | 524288 /* Object */)) { + var sourceProperties = getPropertiesOfType(source); if (sourceProperties) { var sourcePropertiesFiltered = findDiscriminantProperties(sourceProperties, target); if (sourcePropertiesFiltered) { @@ -42751,13 +43258,20 @@ var ts; // When variance information isn't available we default to covariance. This happens // in the process of computing variance information for recursive types and when // comparing 'this' type arguments. - var variance = i < variances.length ? variances[i] : 1 /* Covariant */; + var varianceFlags = i < variances.length ? variances[i] : 1 /* Covariant */; + var variance = varianceFlags & 7 /* VarianceMask */; // We ignore arguments for independent type parameters (because they're never witnessed). if (variance !== 4 /* Independent */) { var s = sources[i]; var t = targets[i]; var related = -1 /* True */; - if (variance === 1 /* Covariant */) { + if (varianceFlags & 8 /* Unmeasurable */) { + // Even an `Unmeasurable` variance works out without a structural check if the source and target are _identical_. + // We can't simply assume invariance, because `Unmeasurable` marks nonlinear relations, for example, a relation tained by + // the `-?` modifier in a mapped type (where, no matter how the inputs are related, the outputs still might not be) + related = relation === identityRelation ? isRelatedTo(s, t, /*reportErrors*/ false) : compareTypesIdentical(s, t); + } + else if (variance === 1 /* Covariant */) { related = isRelatedTo(s, t, reportErrors); } else if (variance === 2 /* Contravariant */) { @@ -42790,6 +43304,17 @@ var ts; } return result; } + function propagateSidebandVarianceFlags(typeArguments, variances) { + for (var i = 0; i < variances.length; i++) { + var v = variances[i]; + if (v & 8 /* Unmeasurable */) { + instantiateType(typeArguments[i], reportUnmeasurableMarkers); + } + if (v & 16 /* Unreliable */) { + instantiateType(typeArguments[i], reportUnreliableMarkers); + } + } + } // Determine if possibly recursive types are related. First, check if the result is already available in the global cache. // Second, check if we have already started a comparison of the given two types in which case we assume the result to be true. // Third, check if both types are part of deeply nested chains of generic type instantiations and if so assume the types are @@ -42807,6 +43332,16 @@ var ts; // as a failure, and should be updated as a reported failure by the bottom of this function. } else { + if (outofbandVarianceMarkerHandler) { + // We're in the middle of variance checking - integrate any unmeasurable/unreliable flags from this cached component + if (source.flags & (524288 /* Object */ | 16777216 /* Conditional */) && source.aliasSymbol && + source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol) { + propagateSidebandVarianceFlags(source.aliasTypeArguments, getAliasVariances(source.aliasSymbol)); + } + if (ts.getObjectFlags(source) & 4 /* Reference */ && ts.getObjectFlags(target) & 4 /* Reference */ && source.target === target.target && ts.length(source.typeArguments)) { + propagateSidebandVarianceFlags(source.typeArguments, getVariances(source.target)); + } + } return related === 1 /* Succeeded */ ? -1 /* True */ : 0 /* False */; } } @@ -42876,8 +43411,8 @@ var ts; if (source.root.isDistributive === target.root.isDistributive) { if (result_3 = isRelatedTo(source.checkType, target.checkType, /*reportErrors*/ false)) { if (result_3 &= isRelatedTo(source.extendsType, target.extendsType, /*reportErrors*/ false)) { - if (result_3 &= isRelatedTo(source.trueType, target.trueType, /*reportErrors*/ false)) { - if (result_3 &= isRelatedTo(source.falseType, target.falseType, /*reportErrors*/ false)) { + if (result_3 &= isRelatedTo(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target), /*reportErrors*/ false)) { + if (result_3 &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), /*reportErrors*/ false)) { return result_3; } } @@ -42927,8 +43462,7 @@ var ts; } // A type S is assignable to keyof T if S is assignable to keyof C, where C is the // simplified form of T or, if T doesn't simplify, the constraint of T. - var simplified = getSimplifiedType(target.type); - var constraint = simplified !== target.type ? simplified : getConstraintOfType(target.type); + var constraint = getSimplifiedTypeOrConstraint(target.type); if (constraint) { // We require Ternary.True here such that circular constraints don't cause // false positives. For example, given 'T extends { [K in keyof T]: string }', @@ -42940,13 +43474,17 @@ var ts; } } else if (target.flags & 8388608 /* IndexedAccess */) { - // A type S is related to a type T[K], where T and K aren't both type variables, if S is related to C, - // where C is the base constraint of T[K] - if (relation !== identityRelation && - !(isGenericObjectType(target.objectType) && isGenericIndexType(target.indexType))) { - var constraint = getBaseConstraintOfType(target); - if (constraint && constraint !== target) { - if (result = isRelatedTo(source, constraint, reportErrors)) { + // A type S is related to a type T[K] if S is related to C, where C is the base + // constraint of T[K] for writing. + if (relation !== identityRelation) { + var objectType = target.objectType; + var indexType = target.indexType; + var baseObjectType = getBaseConstraintOfType(objectType) || objectType; + var baseIndexType = getBaseConstraintOfType(indexType) || indexType; + if (!isGenericObjectType(baseObjectType) && !isGenericIndexType(baseIndexType)) { + var accessFlags = 2 /* Writing */ | (baseObjectType !== objectType ? 1 /* NoIndexSignatures */ : 0); + var constraint = getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType, /*accessNode*/ undefined, accessFlags); + if (constraint && (result = isRelatedTo(source, constraint, reportErrors))) { return result; } } @@ -42963,7 +43501,7 @@ var ts; } if (!isGenericMappedType(source)) { var targetConstraint = getConstraintTypeFromMappedType(target); - var sourceKeys_1 = getIndexType(source); + var sourceKeys_1 = getIndexType(source, /*stringsOnly*/ undefined, /*noIndexSignatures*/ true); var hasOptionalUnionKeys = modifiers & 4 /* IncludeOptional */ && targetConstraint.flags & 1048576 /* Union */; var filteredByApplicability = hasOptionalUnionKeys ? filterType(targetConstraint, function (t) { return !!isRelatedTo(t, sourceKeys_1); }) : undefined; // A source type T is related to a target type { [P in Q]: X } if Q is related to keyof T and T[Q] is related to X. @@ -42994,23 +43532,25 @@ var ts; return result; } } - var constraint = getConstraintOfType(source); - if (!constraint || (source.flags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */)) { - // A type variable with no constraint is not related to the non-primitive object type. - if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */))) { + else { + var constraint = getConstraintOfType(source); + if (!constraint || (source.flags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */)) { + // A type variable with no constraint is not related to the non-primitive object type. + if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */))) { + errorInfo = saveErrorInfo; + return result; + } + } + // hi-speed no-this-instantiation check (less accurate, but avoids costly `this`-instantiation when the constraint will suffice), see #28231 for report on why this is needed + else if (result = isRelatedTo(constraint, target, /*reportErrors*/ false, /*headMessage*/ undefined, isIntersectionConstituent)) { + errorInfo = saveErrorInfo; + return result; + } + // slower, fuller, this-instantiated check (necessary when comparing raw `this` types from base classes), see `subclassWithPolymorphicThisIsAssignable.ts` test for example + else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent)) { errorInfo = saveErrorInfo; return result; } - } - // hi-speed no-this-instantiation check (less accurate, but avoids costly `this`-instantiation when the constraint will suffice), see #28231 for report on why this is needed - else if (result = isRelatedTo(constraint, target, /*reportErrors*/ false, /*headMessage*/ undefined, isIntersectionConstituent)) { - errorInfo = saveErrorInfo; - return result; - } - // slower, fuller, this-instantiated check (necessary when comparing raw `this` types from base classes), see `subclassWithPolymorphicThisIsAssignable.ts` test for example - else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, reportErrors, /*headMessage*/ undefined, isIntersectionConstituent)) { - errorInfo = saveErrorInfo; - return result; } } else if (source.flags & 4194304 /* Index */) { @@ -43026,8 +43566,8 @@ var ts; // and Y1 is related to Y2. if (isTypeIdenticalTo(source.extendsType, target.extendsType) && (isRelatedTo(source.checkType, target.checkType) || isRelatedTo(target.checkType, source.checkType))) { - if (result = isRelatedTo(source.trueType, target.trueType, reportErrors)) { - result &= isRelatedTo(source.falseType, target.falseType, reportErrors); + if (result = isRelatedTo(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target), reportErrors)) { + result &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), reportErrors); } if (result) { errorInfo = saveErrorInfo; @@ -43097,7 +43637,7 @@ var ts; if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */) && target.flags & 524288 /* Object */) { // Report structural errors only if we haven't reported any errors yet var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !sourceIsPrimitive; - result = propertiesRelatedTo(source, target, reportStructuralErrors); + result = propertiesRelatedTo(source, target, reportStructuralErrors, /*excludedProperties*/ undefined); if (result) { result &= signaturesRelatedTo(source, target, 0 /* Call */, reportStructuralErrors); if (result) { @@ -43117,22 +43657,35 @@ var ts; return result; } } + // If S is an object type and T is a discriminated union, S may be related to T if + // there exists a constituent of T for every combination of the discriminants of S + // with respect to T. We do not report errors here, as we will use the existing + // error result from checking each constituent of the union. + if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */) && target.flags & 1048576 /* Union */) { + var objectOnlyTarget = extractTypesOfKind(target, 524288 /* Object */); + if (objectOnlyTarget.flags & 1048576 /* Union */) { + var result_4 = typeRelatedToDiscriminatedType(source, objectOnlyTarget); + if (result_4) { + return result_4; + } + } + } } return 0 /* False */; - function isNonGeneric(type) { - // If we're already in identity relationship checking, we should use `isRelatedTo` - // to catch the `Maybe` from an excessively deep type (which we then assume means - // that the type could possibly contain a generic) - if (relation === identityRelation) { - return isRelatedTo(type, getPermissiveInstantiation(type)) === -1 /* True */; - } - return isTypeIdenticalTo(type, getPermissiveInstantiation(type)); - } function relateVariances(sourceTypeArguments, targetTypeArguments, variances) { if (result = typeArgumentsRelatedTo(sourceTypeArguments, targetTypeArguments, variances, reportErrors)) { return result; } - var allowStructuralFallback = (targetTypeArguments && hasCovariantVoidArgument(targetTypeArguments, variances)) || isNonGeneric(source) || isNonGeneric(target); + if (ts.some(variances, function (v) { return !!(v & 24 /* AllowsStructuralFallback */); })) { + // If some type parameter was `Unmeasurable` or `Unreliable`, and we couldn't pass by assuming it was identical, then we + // have to allow a structural fallback check + // We elide the variance-based error elaborations, since those might not be too helpful, since we'll potentially + // be assuming identity of the type parameter. + originalErrorInfo = undefined; + errorInfo = saveErrorInfo; + return undefined; + } + var allowStructuralFallback = targetTypeArguments && hasCovariantVoidArgument(targetTypeArguments, variances); varianceCheckFailed = !allowStructuralFallback; // The type arguments did not relate appropriately, but it may be because we have no variance // information (in which case typeArgumentsRelatedTo defaulted to covariance for all type @@ -43150,7 +43703,7 @@ var ts; // reveal the reason). // We can switch on `reportErrors` here, since varianceCheckFailed guarantees we return `False`, // we can return `False` early here to skip calculating the structural error message we don't need. - if (varianceCheckFailed && !(reportErrors && ts.some(variances, function (v) { return v === 0 /* Invariant */; }))) { + if (varianceCheckFailed && !(reportErrors && ts.some(variances, function (v) { return (v & 7 /* VarianceMask */) === 0 /* Invariant */; }))) { return 0 /* False */; } // We remember the original error information so we can restore it in case the structural @@ -43161,6 +43714,18 @@ var ts; } } } + function reportUnmeasurableMarkers(p) { + if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) { + outofbandVarianceMarkerHandler(/*onlyUnreliable*/ false); + } + return p; + } + function reportUnreliableMarkers(p) { + if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) { + outofbandVarianceMarkerHandler(/*onlyUnreliable*/ true); + } + return p; + } // A type [P in S]: X is related to a type [Q in T]: Y if T is related to S and X' is // related to Y, where X' is an instantiation of X in which P is replaced with Q. Notice // that S and T are contra-variant whereas X and Y are co-variant. @@ -43168,45 +43733,281 @@ var ts; var modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source) === getMappedTypeModifiers(target) : getCombinedMappedTypeOptionality(source) <= getCombinedMappedTypeOptionality(target)); if (modifiersRelated) { - var result_4; - if (result_4 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { + var result_5; + var targetConstraint = getConstraintTypeFromMappedType(target); + var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMarkers : reportUnreliableMarkers); + if (result_5 = isRelatedTo(targetConstraint, sourceConstraint, reportErrors)) { var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]); - return result_4 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), reportErrors); + return result_5 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), reportErrors); } } return 0 /* False */; } - function propertiesRelatedTo(source, target, reportErrors) { + function typeRelatedToDiscriminatedType(source, target) { + // 1. Generate the combinations of discriminant properties & types 'source' can satisfy. + // a. If the number of combinations is above a set limit, the comparison is too complex. + // 2. Filter 'target' to the subset of types whose discriminants exist in the matrix. + // a. If 'target' does not satisfy all discriminants in the matrix, 'source' is not related. + // 3. For each type in the filtered 'target', determine if all non-discriminant properties of + // 'target' are related to a property in 'source'. + // + // NOTE: See ~/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithDiscriminatedUnion.ts + // for examples. + var sourceProperties = getPropertiesOfObjectType(source); + var sourcePropertiesFiltered = findDiscriminantProperties(sourceProperties, target); + if (!sourcePropertiesFiltered) + return 0 /* False */; + // Though we could compute the number of combinations as we generate + // the matrix, this would incur additional memory overhead due to + // array allocations. To reduce this overhead, we first compute + // the number of combinations to ensure we will not surpass our + // fixed limit before incurring the cost of any allocations: + var numCombinations = 1; + for (var _i = 0, sourcePropertiesFiltered_1 = sourcePropertiesFiltered; _i < sourcePropertiesFiltered_1.length; _i++) { + var sourceProperty = sourcePropertiesFiltered_1[_i]; + numCombinations *= countTypes(getTypeOfSymbol(sourceProperty)); + if (numCombinations > 25) { + // We've reached the complexity limit. + return 0 /* False */; + } + } + // Compute the set of types for each discriminant property. + var sourceDiscriminantTypes = new Array(sourcePropertiesFiltered.length); + var excludedProperties = ts.createUnderscoreEscapedMap(); + for (var i = 0; i < sourcePropertiesFiltered.length; i++) { + var sourceProperty = sourcePropertiesFiltered[i]; + var sourcePropertyType = getTypeOfSymbol(sourceProperty); + sourceDiscriminantTypes[i] = sourcePropertyType.flags & 1048576 /* Union */ + ? sourcePropertyType.types + : [sourcePropertyType]; + excludedProperties.set(sourceProperty.escapedName, true); + } + // Match each combination of the cartesian product of discriminant properties to one or more + // constituents of 'target'. If any combination does not have a match then 'source' is not relatable. + var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes); + var matchingTypes = []; + var _loop_8 = function (combination) { + var hasMatch = false; + outer: for (var _i = 0, _a = target.types; _i < _a.length; _i++) { + var type = _a[_i]; + var _loop_9 = function (i) { + var sourceProperty = sourcePropertiesFiltered[i]; + var targetProperty = getPropertyOfObjectType(type, sourceProperty.escapedName); + if (!targetProperty) + return "continue-outer"; + if (sourceProperty === targetProperty) + return "continue"; + // We compare the source property to the target in the context of a single discriminant type. + var related = propertyRelatedTo(source, target, sourceProperty, targetProperty, function (_) { return combination[i]; }, /*reportErrors*/ false); + // If the target property could not be found, or if the properties were not related, + // then this constituent is not a match. + if (!related) { + return "continue-outer"; + } + }; + for (var i = 0; i < sourcePropertiesFiltered.length; i++) { + var state_5 = _loop_9(i); + switch (state_5) { + case "continue-outer": continue outer; + } + } + ts.pushIfUnique(matchingTypes, type, ts.equateValues); + hasMatch = true; + } + if (!hasMatch) { + return { value: 0 /* False */ }; + } + }; + for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) { + var combination = discriminantCombinations_1[_a]; + var state_4 = _loop_8(combination); + if (typeof state_4 === "object") + return state_4.value; + } + // Compare the remaining non-discriminant properties of each match. + var result = -1 /* True */; + for (var _b = 0, matchingTypes_1 = matchingTypes; _b < matchingTypes_1.length; _b++) { + var type = matchingTypes_1[_b]; + result &= propertiesRelatedTo(source, type, /*reportErrors*/ false, excludedProperties); + if (result) { + result &= signaturesRelatedTo(source, type, 0 /* Call */, /*reportStructuralErrors*/ false); + if (result) { + result &= signaturesRelatedTo(source, type, 1 /* Construct */, /*reportStructuralErrors*/ false); + if (result) { + result &= indexTypesRelatedTo(source, type, 0 /* String */, /*sourceIsPrimitive*/ false, /*reportStructuralErrors*/ false); + if (result) { + result &= indexTypesRelatedTo(source, type, 1 /* Number */, /*sourceIsPrimitive*/ false, /*reportStructuralErrors*/ false); + } + } + } + } + if (!result) { + return result; + } + } + return result; + } + function excludeProperties(properties, excludedProperties) { + if (!excludedProperties || properties.length === 0) + return properties; + var result; + for (var i = 0; i < properties.length; i++) { + if (!excludedProperties.has(properties[i].escapedName)) { + if (result) { + result.push(properties[i]); + } + } + else if (!result) { + result = properties.slice(0, i); + } + } + return result || properties; + } + function isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors) { + var targetIsOptional = strictNullChecks && !!(ts.getCheckFlags(targetProp) & 48 /* Partial */); + var source = getTypeOfSourceProperty(sourceProp); + if (ts.getCheckFlags(targetProp) & 65536 /* DeferredType */ && !getSymbolLinks(targetProp).type) { + // Rather than resolving (and normalizing) the type, relate constituent-by-constituent without performing normalization or seconadary passes + var links = getSymbolLinks(targetProp); + ts.Debug.assertDefined(links.deferralParent); + ts.Debug.assertDefined(links.deferralConstituents); + var unionParent = !!(links.deferralParent.flags & 1048576 /* Union */); + var result_6 = unionParent ? 0 /* False */ : -1 /* True */; + var targetTypes = links.deferralConstituents; + for (var _i = 0, targetTypes_3 = targetTypes; _i < targetTypes_3.length; _i++) { + var targetType = targetTypes_3[_i]; + var related = isRelatedTo(source, targetType, /*reportErrors*/ false, /*headMessage*/ undefined, /*isIntersectionConstituent*/ !unionParent); + if (!unionParent) { + if (!related) { + // Can't assign to a target individually - have to fallback to assigning to the _whole_ intersection (which forces normalization) + return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors); + } + result_6 &= related; + } + else { + if (related) { + return related; + } + } + } + if (unionParent && !result_6 && targetIsOptional) { + result_6 = isRelatedTo(source, undefinedType); + } + if (unionParent && !result_6 && reportErrors) { + // The easiest way to get the right errors here is to un-defer (which may be costly) + // If it turns out this is too costly too often, we can replicate the error handling logic within + // typeRelatedToSomeType without the discriminatable type branch (as that requires a manifest union + // type on which to hand discriminable properties, which we are expressly trying to avoid here) + return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors); + } + return result_6; + } + else { + return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors); + } + } + function propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSourceProperty, reportErrors) { + var sourcePropFlags = ts.getDeclarationModifierFlagsFromSymbol(sourceProp); + var targetPropFlags = ts.getDeclarationModifierFlagsFromSymbol(targetProp); + if (sourcePropFlags & 8 /* Private */ || targetPropFlags & 8 /* Private */) { + var hasDifferingDeclarations = sourceProp.valueDeclaration !== targetProp.valueDeclaration; + if (ts.getCheckFlags(sourceProp) & 1024 /* ContainsPrivate */ && hasDifferingDeclarations) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(sourceProp), typeToString(source)); + } + return 0 /* False */; + } + if (hasDifferingDeclarations) { + if (reportErrors) { + if (sourcePropFlags & 8 /* Private */ && targetPropFlags & 8 /* Private */) { + reportError(ts.Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp)); + } + else { + reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourcePropFlags & 8 /* Private */ ? source : target), typeToString(sourcePropFlags & 8 /* Private */ ? target : source)); + } + } + return 0 /* False */; + } + } + else if (targetPropFlags & 16 /* Protected */) { + if (!isValidOverrideOf(sourceProp, targetProp)) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(getDeclaringClass(sourceProp) || source), typeToString(getDeclaringClass(targetProp) || target)); + } + return 0 /* False */; + } + } + else if (sourcePropFlags & 16 /* Protected */) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); + } + return 0 /* False */; + } + // If the target comes from a partial union prop, allow `undefined` in the target type + var related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors); + if (!related) { + if (reportErrors) { + reportError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp)); + } + return 0 /* False */; + } + // When checking for comparability, be more lenient with optional properties. + if (relation !== comparableRelation && sourceProp.flags & 16777216 /* Optional */ && !(targetProp.flags & 16777216 /* Optional */)) { + // TypeScript 1.0 spec (April 2014): 3.8.3 + // S is a subtype of a type T, and T is a supertype of S if ... + // S' and T are object types and, for each member M in T.. + // M is a property and S' contains a property N where + // if M is a required property, N is also a required property + // (M - property in T) + // (N - property in S) + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); + } + return 0 /* False */; + } + return related; + } + function propertiesRelatedTo(source, target, reportErrors, excludedProperties) { if (relation === identityRelation) { - return propertiesIdenticalTo(source, target); + return propertiesIdenticalTo(source, target, excludedProperties); } var requireOptionalProperties = relation === subtypeRelation && !isObjectLiteralType(source) && !isEmptyArrayLiteralType(source) && !isTupleType(source); var unmatchedProperty = getUnmatchedProperty(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false); if (unmatchedProperty) { if (reportErrors) { var props = ts.arrayFrom(getUnmatchedProperties(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false)); + var shouldSkipElaboration = false; if (!headMessage || (headMessage.code !== ts.Diagnostics.Class_0_incorrectly_implements_interface_1.code && headMessage.code !== ts.Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code)) { - suppressNextError = true; // Retain top-level error for interface implementing issues, otherwise omit it + shouldSkipElaboration = true; // Retain top-level error for interface implementing issues, otherwise omit it } if (props.length === 1) { var propName = symbolToString(unmatchedProperty); - reportError(ts.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName, typeToString(source), typeToString(target)); + reportError.apply(void 0, [ts.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName].concat(getTypeNamesForErrorDisplay(source, target))); if (ts.length(unmatchedProperty.declarations)) { associateRelatedInfo(ts.createDiagnosticForNode(unmatchedProperty.declarations[0], ts.Diagnostics._0_is_declared_here, propName)); } + if (shouldSkipElaboration) { + overrideNextErrorInfo = errorInfo; + } } - else if (props.length > 5) { // arbitrary cutoff for too-long list form - reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more, typeToString(source), typeToString(target), ts.map(props.slice(0, 4), function (p) { return symbolToString(p); }).join(", "), props.length - 4); - } - else { - reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2, typeToString(source), typeToString(target), ts.map(props, function (p) { return symbolToString(p); }).join(", ")); + else if (tryElaborateArrayLikeErrors(source, target, /*reportErrors*/ false)) { + if (props.length > 5) { // arbitrary cutoff for too-long list form + reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more, typeToString(source), typeToString(target), ts.map(props.slice(0, 4), function (p) { return symbolToString(p); }).join(", "), props.length - 4); + } + else { + reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2, typeToString(source), typeToString(target), ts.map(props, function (p) { return symbolToString(p); }).join(", ")); + } + if (shouldSkipElaboration) { + overrideNextErrorInfo = errorInfo; + } } + // ELSE: No array like or unmatched property error - just issue top level error (errorInfo = undefined) } return 0 /* False */; } if (isObjectLiteralType(target)) { - for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) { + for (var _i = 0, _a = excludeProperties(getPropertiesOfType(source), excludedProperties); _i < _a.length; _i++) { var sourceProp = _a[_i]; if (!getPropertyOfObjectType(target, sourceProp.escapedName)) { var sourceType = getTypeOfSymbol(sourceProp); @@ -43247,84 +44048,30 @@ var ts; } } } - var properties = getPropertiesOfObjectType(target); - for (var _b = 0, properties_2 = properties; _b < properties_2.length; _b++) { - var targetProp = properties_2[_b]; + // We only call this for union target types when we're attempting to do excess property checking - in those cases, we want to get _all possible props_ + // from the target union, across all members + var properties = target.flags & 1048576 /* Union */ ? getPossiblePropertiesOfUnionType(target) : getPropertiesOfType(target); + for (var _b = 0, _c = excludeProperties(properties, excludedProperties); _b < _c.length; _b++) { + var targetProp = _c[_b]; if (!(targetProp.flags & 4194304 /* Prototype */)) { var sourceProp = getPropertyOfType(source, targetProp.escapedName); if (sourceProp && sourceProp !== targetProp) { - if (isIgnoredJsxProperty(source, sourceProp, getTypeOfSymbol(targetProp))) { - continue; - } - var sourcePropFlags = ts.getDeclarationModifierFlagsFromSymbol(sourceProp); - var targetPropFlags = ts.getDeclarationModifierFlagsFromSymbol(targetProp); - if (sourcePropFlags & 8 /* Private */ || targetPropFlags & 8 /* Private */) { - var hasDifferingDeclarations = sourceProp.valueDeclaration !== targetProp.valueDeclaration; - if (ts.getCheckFlags(sourceProp) & 512 /* ContainsPrivate */ && hasDifferingDeclarations) { - if (reportErrors) { - reportError(ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(sourceProp), typeToString(source)); - } - return 0 /* False */; - } - if (hasDifferingDeclarations) { - if (reportErrors) { - if (sourcePropFlags & 8 /* Private */ && targetPropFlags & 8 /* Private */) { - reportError(ts.Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp)); - } - else { - reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourcePropFlags & 8 /* Private */ ? source : target), typeToString(sourcePropFlags & 8 /* Private */ ? target : source)); - } - } - return 0 /* False */; - } - } - else if (targetPropFlags & 16 /* Protected */) { - if (!isValidOverrideOf(sourceProp, targetProp)) { - if (reportErrors) { - reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(getDeclaringClass(sourceProp) || source), typeToString(getDeclaringClass(targetProp) || target)); - } - return 0 /* False */; - } - } - else if (sourcePropFlags & 16 /* Protected */) { - if (reportErrors) { - reportError(ts.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); - } - return 0 /* False */; - } - var related = isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors); + var related = propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSymbol, reportErrors); if (!related) { - if (reportErrors) { - reportError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp)); - } return 0 /* False */; } result &= related; - // When checking for comparability, be more lenient with optional properties. - if (relation !== comparableRelation && sourceProp.flags & 16777216 /* Optional */ && !(targetProp.flags & 16777216 /* Optional */)) { - // TypeScript 1.0 spec (April 2014): 3.8.3 - // S is a subtype of a type T, and T is a supertype of S if ... - // S' and T are object types and, for each member M in T.. - // M is a property and S' contains a property N where - // if M is a required property, N is also a required property - // (M - property in T) - // (N - property in S) - if (reportErrors) { - reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); - } - return 0 /* False */; - } } } } return result; } - function propertiesIdenticalTo(source, target) { + function propertiesIdenticalTo(source, target, excludedProperties) { if (!(source.flags & 524288 /* Object */ && target.flags & 524288 /* Object */)) { return 0 /* False */; } - var sourceProperties = getPropertiesOfObjectType(source); - var targetProperties = getPropertiesOfObjectType(target); + var sourceProperties = excludeProperties(getPropertiesOfObjectType(source), excludedProperties); + var targetProperties = excludeProperties(getPropertiesOfObjectType(target), excludedProperties); if (sourceProperties.length !== targetProperties.length) { return 0 /* False */; } @@ -43444,7 +44191,7 @@ var ts; var result = -1 /* True */; for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { var prop = _a[_i]; - if (isIgnoredJsxProperty(source, prop, /*targetMemberType*/ undefined)) { + if (isIgnoredJsxProperty(source, prop)) { continue; } // Skip over symbol-named members @@ -43476,7 +44223,7 @@ var ts; return indexTypesIdenticalTo(source, target, kind); } var targetInfo = getIndexInfoOfType(target, kind); - if (!targetInfo || targetInfo.type.flags & 3 /* AnyOrUnknown */ && !sourceIsPrimitive) { + if (!targetInfo || targetInfo.type.flags & 1 /* Any */ && !sourceIsPrimitive) { // Index signature of type any permits assignment from everything but primitives return -1 /* True */; } @@ -43616,8 +44363,11 @@ var ts; // The emptyArray singleton is used to signal a recursive invocation. cache.variances = ts.emptyArray; variances = []; - for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) { - var tp = typeParameters_1[_i]; + var _loop_10 = function (tp) { + var unmeasurable = false; + var unreliable = false; + var oldHandler = outofbandVarianceMarkerHandler; + outofbandVarianceMarkerHandler = function (onlyUnreliable) { return onlyUnreliable ? unreliable = true : unmeasurable = true; }; // We first compare instantiations where the type parameter is replaced with // marker types that have a known subtype relationship. From this we can infer // invariance, covariance, contravariance or bivariance. @@ -43632,7 +44382,20 @@ var ts; if (variance === 3 /* Bivariant */ && isTypeAssignableTo(createMarkerType(cache, tp, markerOtherType), typeWithSuper)) { variance = 4 /* Independent */; } + outofbandVarianceMarkerHandler = oldHandler; + if (unmeasurable || unreliable) { + if (unmeasurable) { + variance |= 8 /* Unmeasurable */; + } + if (unreliable) { + variance |= 16 /* Unreliable */; + } + } variances.push(variance); + }; + for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) { + var tp = typeParameters_1[_i]; + _loop_10(tp); } cache.variances = variances; } @@ -43649,7 +44412,7 @@ var ts; // See comment at call in recursiveTypeRelatedTo for when this case matters. function hasCovariantVoidArgument(typeArguments, variances) { for (var i = 0; i < variances.length; i++) { - if (variances[i] === 1 /* Covariant */ && typeArguments[i].flags & 16384 /* Void */) { + if ((variances[i] & 7 /* VarianceMask */) === 1 /* Covariant */ && typeArguments[i].flags & 16384 /* Void */) { return true; } } @@ -44074,6 +44837,30 @@ var ts; function getNonNullableType(type) { return strictNullChecks ? getGlobalNonNullableTypeInstantiation(type) : type; } + /** + * Is source potentially coercible to target type under `==`. + * Assumes that `source` is a constituent of a union, hence + * the boolean literal flag on the LHS, but not on the RHS. + * + * This does not fully replicate the semantics of `==`. The + * intention is to catch cases that are clearly not right. + * + * Comparing (string | number) to number should not remove the + * string element. + * + * Comparing (string | number) to 1 will remove the string + * element, though this is not sound. This is a pragmatic + * choice. + * + * @see narrowTypeByEquality + * + * @param source + * @param target + */ + function isCoercibleUnderDoubleEquals(source, target) { + return ((source.flags & (8 /* Number */ | 4 /* String */ | 512 /* BooleanLiteral */)) !== 0) + && ((target.flags & (8 /* Number */ | 4 /* String */ | 16 /* Boolean */)) !== 0); + } /** * Return true if type was inferred from an object literal, written as an object type literal, or is the shape of a module * with no call or construct signatures. @@ -44202,7 +44989,7 @@ var ts; var stringIndexInfo = getIndexInfoOfType(type, 0 /* String */); var numberIndexInfo = getIndexInfoOfType(type, 1 /* Number */); var result = createAnonymousType(type.symbol, members, ts.emptyArray, ts.emptyArray, stringIndexInfo && createIndexInfo(getWidenedType(stringIndexInfo.type), stringIndexInfo.isReadonly), numberIndexInfo && createIndexInfo(getWidenedType(numberIndexInfo.type), numberIndexInfo.isReadonly)); - result.objectFlags |= (ts.getObjectFlags(type) & 16384 /* JSLiteral */); // Retain js literal flag through widening + result.objectFlags |= (ts.getObjectFlags(type) & (16384 /* JSLiteral */ | 524288 /* NonInferrableType */)); // Retain js literal flag through widening return result; } function getWidenedType(type) { @@ -44210,26 +44997,34 @@ var ts; } function getWidenedTypeWithContext(type, context) { if (ts.getObjectFlags(type) & 393216 /* RequiresWidening */) { + if (context === undefined && type.widened) { + return type.widened; + } + var result = void 0; if (type.flags & 98304 /* Nullable */) { - return anyType; + result = anyType; } - if (isObjectLiteralType(type)) { - return getWidenedTypeOfObjectLiteral(type, context); + else if (isObjectLiteralType(type)) { + result = getWidenedTypeOfObjectLiteral(type, context); } - if (type.flags & 1048576 /* Union */) { + else if (type.flags & 1048576 /* Union */) { var unionContext_1 = context || createWideningContext(/*parent*/ undefined, /*propertyName*/ undefined, type.types); var widenedTypes = ts.sameMap(type.types, function (t) { return t.flags & 98304 /* Nullable */ ? t : getWidenedTypeWithContext(t, unionContext_1); }); // Widening an empty object literal transitions from a highly restrictive type to // a highly inclusive one. For that reason we perform subtype reduction here if the // union includes empty object types (e.g. reducing {} | string to just {}). - return getUnionType(widenedTypes, ts.some(widenedTypes, isEmptyObjectType) ? 2 /* Subtype */ : 1 /* Literal */); + result = getUnionType(widenedTypes, ts.some(widenedTypes, isEmptyObjectType) ? 2 /* Subtype */ : 1 /* Literal */); } - if (type.flags & 2097152 /* Intersection */) { - return getIntersectionType(ts.sameMap(type.types, getWidenedType)); + else if (type.flags & 2097152 /* Intersection */) { + result = getIntersectionType(ts.sameMap(type.types, getWidenedType)); } - if (isArrayType(type) || isTupleType(type)) { - return createTypeReference(type.target, ts.sameMap(type.typeArguments, getWidenedType)); + else if (isArrayType(type) || isTupleType(type)) { + result = createTypeReference(type.target, ts.sameMap(type.typeArguments, getWidenedType)); } + if (result && context === undefined) { + type.widened = result; + } + return result || type; } return type; } @@ -44291,12 +45086,12 @@ var ts; } var diagnostic; switch (declaration.kind) { - case 204 /* BinaryExpression */: - case 154 /* PropertyDeclaration */: - case 153 /* PropertySignature */: + case 205 /* BinaryExpression */: + case 155 /* PropertyDeclaration */: + case 154 /* PropertySignature */: diagnostic = noImplicitAny ? ts.Diagnostics.Member_0_implicitly_has_an_1_type : ts.Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 151 /* Parameter */: + case 152 /* Parameter */: var param = declaration; if (ts.isIdentifier(param.name) && (ts.isCallSignatureDeclaration(param.parent) || ts.isMethodSignature(param.parent) || ts.isFunctionTypeNode(param.parent)) && @@ -44311,30 +45106,30 @@ var ts; noImplicitAny ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage : noImplicitAny ? ts.Diagnostics.Parameter_0_implicitly_has_an_1_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 186 /* BindingElement */: + case 187 /* BindingElement */: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; if (!noImplicitAny) { // Don't issue a suggestion for binding elements since the codefix doesn't yet support them. return; } break; - case 294 /* JSDocFunctionType */: + case 295 /* JSDocFunctionType */: error(declaration, ts.Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; - case 239 /* FunctionDeclaration */: - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: + case 240 /* FunctionDeclaration */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: if (noImplicitAny && !declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; } diagnostic = noImplicitAny ? ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type : ts.Diagnostics._0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage; break; - case 181 /* MappedType */: + case 182 /* MappedType */: if (noImplicitAny) { error(declaration, ts.Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type); } @@ -44454,7 +45249,7 @@ var ts; var objectFlags = ts.getObjectFlags(type); return !!(type.flags & 63176704 /* Instantiable */ || objectFlags & 4 /* Reference */ && ts.forEach(type.typeArguments, couldContainTypeVariables) || - objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 2048 /* TypeLiteral */ | 32 /* Class */) || + objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & 32 /* Mapped */ || type.flags & 3145728 /* UnionOrIntersection */ && couldUnionOrIntersectionContainTypeVariables(type)); } @@ -44502,19 +45297,20 @@ var ts; reverseMappedCache.set(key, type); return type; } + // We consider a type to be partially inferable if it isn't marked non-inferable or if it is + // an object literal type with at least one property of an inferable type. For example, an object + // literal { a: 123, b: x => true } is marked non-inferable because it contains a context sensitive + // arrow function, but is considered partially inferable because property 'a' has an inferable type. + function isPartiallyInferableType(type) { + return !(ts.getObjectFlags(type) & 524288 /* NonInferrableType */) || + isObjectLiteralType(type) && ts.some(getPropertiesOfType(type), function (prop) { return isPartiallyInferableType(getTypeOfSymbol(prop)); }); + } function createReverseMappedType(source, target, constraint) { - var properties = getPropertiesOfType(source); - if (properties.length === 0 && !getIndexInfoOfType(source, 0 /* String */)) { + // We consider a source type reverse mappable if it has a string index signature or if + // it has one or more properties and is of a partially inferable type. + if (!(getIndexInfoOfType(source, 0 /* String */) || getPropertiesOfType(source).length !== 0 && isPartiallyInferableType(source))) { return undefined; } - // If any property contains context sensitive functions that have been skipped, the source type - // is incomplete and we can't infer a meaningful input type. - for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { - var prop = properties_3[_i]; - if (ts.getObjectFlags(getTypeOfSymbol(prop)) & 524288 /* ContainsAnyFunctionType */) { - return undefined; - } - } // For arrays and tuples we infer new arrays and tuples where the reverse mapping has been // applied to the element type(s). if (isArrayType(source)) { @@ -44542,20 +45338,20 @@ var ts; var templateType = getTemplateTypeFromMappedType(target); var inference = createInferenceInfo(typeParameter); inferTypes([inference], sourceType, templateType); - return getTypeFromInference(inference); + return getTypeFromInference(inference) || unknownType; } function getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties) { - var properties, _i, properties_4, targetProp, sourceProp, targetType, sourceType; + var properties, _i, properties_2, targetProp, sourceProp, targetType, sourceType; return __generator(this, function (_a) { switch (_a.label) { case 0: - properties = target.flags & 2097152 /* Intersection */ ? getPropertiesOfUnionOrIntersectionType(target) : getPropertiesOfObjectType(target); - _i = 0, properties_4 = properties; + properties = target.flags & 1048576 /* Union */ ? getPossiblePropertiesOfUnionType(target) : getPropertiesOfType(target); + _i = 0, properties_2 = properties; _a.label = 1; case 1: - if (!(_i < properties_4.length)) return [3 /*break*/, 6]; - targetProp = properties_4[_i]; - if (!(requireOptionalProperties || !(targetProp.flags & 16777216 /* Optional */))) return [3 /*break*/, 5]; + if (!(_i < properties_2.length)) return [3 /*break*/, 6]; + targetProp = properties_2[_i]; + if (!(requireOptionalProperties || !(targetProp.flags & 16777216 /* Optional */ || ts.getCheckFlags(targetProp) & 48 /* Partial */))) return [3 /*break*/, 5]; sourceProp = getPropertyOfType(source, targetProp.escapedName); if (!!sourceProp) return [3 /*break*/, 3]; return [4 /*yield*/, targetProp]; @@ -44596,7 +45392,7 @@ var ts; function getTypeFromInference(inference) { return inference.candidates ? getUnionType(inference.candidates, 2 /* Subtype */) : inference.contraCandidates ? getIntersectionType(inference.contraCandidates) : - emptyObjectType; + undefined; } function inferTypes(inferences, originalSource, originalTarget, priority, contravariant) { if (priority === void 0) { priority = 0; } @@ -44670,6 +45466,9 @@ var ts; target = removeTypesFromUnionOrIntersection(target, matchingTypes); } } + else if (target.flags & (8388608 /* IndexedAccess */ | 33554432 /* Substitution */)) { + target = getActualTypeVariable(target); + } if (target.flags & 8650752 /* TypeVariable */) { // If target is a type parameter, make an inference, unless the source type contains // the anyFunctionType (the wildcard type that's used to avoid contextually typing functions). @@ -44678,7 +45477,7 @@ var ts; // not contain anyFunctionType when we come back to this argument for its second round // of inference. Also, we exclude inferences for silentNeverType (which is used as a wildcard // when constructing types from type parameters that had no inference candidates). - if (ts.getObjectFlags(source) & 524288 /* ContainsAnyFunctionType */ || source === silentNeverType || (priority & 8 /* ReturnType */ && (source === autoType || source === autoArrayType))) { + if (ts.getObjectFlags(source) & 524288 /* NonInferrableType */ || source === silentNeverType || (priority & 16 /* ReturnType */ && (source === autoType || source === autoArrayType))) { return; } var inference = getInferenceInfoForType(target); @@ -44705,7 +45504,7 @@ var ts; inference.inferredType = undefined; } } - if (!(priority & 8 /* ReturnType */) && target.flags & 262144 /* TypeParameter */ && inference.topLevel && !isTypeParameterAtTopLevel(originalTarget, target)) { + if (!(priority & 16 /* ReturnType */) && target.flags & 262144 /* TypeParameter */ && inference.topLevel && !isTypeParameterAtTopLevel(originalTarget, target)) { inference.topLevel = false; inference.inferredType = undefined; } @@ -44714,16 +45513,16 @@ var ts; } else { // Infer to the simplified version of an indexed access, if possible, to (hopefully) expose more bare type parameters to the inference engine - var simplified = getSimplifiedType(target); + var simplified = getSimplifiedType(target, /*writing*/ false); if (simplified !== target) { inferFromTypesOnce(source, simplified); } else if (target.flags & 8388608 /* IndexedAccess */) { - var indexType = getSimplifiedType(target.indexType); + var indexType = getSimplifiedType(target.indexType, /*writing*/ false); // Generally simplifications of instantiable indexes are avoided to keep relationship checking correct, however if our target is an access, we can consider // that key of that access to be "instantiated", since we're looking to find the infernce goal in any way we can. if (indexType.flags & 63176704 /* Instantiable */) { - var simplified_1 = distributeIndexOverObjectType(getSimplifiedType(target.objectType), indexType); + var simplified_1 = distributeIndexOverObjectType(getSimplifiedType(target.objectType, /*writing*/ false), indexType, /*writing*/ false); if (simplified_1 && simplified_1 !== target) { inferFromTypesOnce(source, simplified_1); } @@ -44731,9 +45530,6 @@ var ts; } } } - else if (target.flags & 33554432 /* Substitution */) { - inferFromTypes(source, target.typeVariable); - } if (ts.getObjectFlags(source) & 4 /* Reference */ && ts.getObjectFlags(target) & 4 /* Reference */ && source.target === target.target) { // If source and target are references to the same generic type, infer from type arguments var sourceTypes = source.typeArguments || ts.emptyArray; @@ -44741,7 +45537,7 @@ var ts; var count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length; var variances = getVariances(source.target); for (var i = 0; i < count; i++) { - if (i < variances.length && variances[i] === 2 /* Contravariant */) { + if (i < variances.length && (variances[i] & 7 /* VarianceMask */) === 2 /* Contravariant */) { inferFromContravariantTypes(sourceTypes[i], targetTypes[i]); } else { @@ -44758,7 +45554,7 @@ var ts; var empty = createEmptyObjectTypeFromStringLiteral(source); contravariant = !contravariant; var savePriority = priority; - priority |= 16 /* LiteralKeyof */; + priority |= 32 /* LiteralKeyof */; inferFromTypes(empty, target.type); priority = savePriority; contravariant = !contravariant; @@ -44770,37 +45566,53 @@ var ts; else if (source.flags & 16777216 /* Conditional */ && target.flags & 16777216 /* Conditional */) { inferFromTypes(source.checkType, target.checkType); inferFromTypes(source.extendsType, target.extendsType); - inferFromTypes(source.trueType, target.trueType); - inferFromTypes(source.falseType, target.falseType); + inferFromTypes(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target)); + inferFromTypes(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target)); } else if (target.flags & 16777216 /* Conditional */ && !contravariant) { - inferFromTypes(source, target.trueType); - inferFromTypes(source, target.falseType); + inferFromTypes(source, getTrueTypeFromConditionalType(target)); + inferFromTypes(source, getFalseTypeFromConditionalType(target)); } else if (target.flags & 3145728 /* UnionOrIntersection */) { + // We infer from types that are not naked type variables first so that inferences we + // make from nested naked type variables and given slightly higher priority by virtue + // of being first in the candidates array. + var typeVariableCount = 0; for (var _d = 0, _e = target.types; _d < _e.length; _d++) { var t = _e[_d]; - var savePriority = priority; - // Inferences directly to naked type variables are given lower priority as they are - // less specific. For example, when inferring from Promise to T | Promise, - // we want to infer string for T, not Promise | string. if (getInferenceInfoForType(t)) { - priority |= 1 /* NakedTypeVariable */; + typeVariableCount++; + } + else { + inferFromTypes(source, t); + } + } + // Inferences directly to naked type variables are given lower priority as they are + // less specific. For example, when inferring from Promise to T | Promise, + // we want to infer string for T, not Promise | string. For intersection types + // we only infer to single naked type variables. + if (target.flags & 1048576 /* Union */ ? typeVariableCount !== 0 : typeVariableCount === 1) { + var savePriority = priority; + priority |= 1 /* NakedTypeVariable */; + for (var _f = 0, _g = target.types; _f < _g.length; _f++) { + var t = _g[_f]; + if (getInferenceInfoForType(t)) { + inferFromTypes(source, t); + } } - inferFromTypes(source, t); priority = savePriority; } } else if (source.flags & 1048576 /* Union */) { // Source is a union or intersection type, infer from each constituent type var sourceTypes = source.types; - for (var _f = 0, sourceTypes_3 = sourceTypes; _f < sourceTypes_3.length; _f++) { - var sourceType = sourceTypes_3[_f]; + for (var _h = 0, sourceTypes_3 = sourceTypes; _h < sourceTypes_3.length; _h++) { + var sourceType = sourceTypes_3[_h]; inferFromTypes(sourceType, target); } } else { - if (!(priority & 32 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ | 63176704 /* Instantiable */))) { + if (!(priority & 64 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ | 63176704 /* Instantiable */))) { var apparentSource = getApparentType(source); // getApparentType can return _any_ type, since an indexed access or conditional may simplify to any other type. // If that occurs and it doesn't simplify to an object or intersection, we'll need to restart `inferFromTypes` @@ -44853,7 +45665,7 @@ var ts; } } function inferFromContravariantTypes(source, target) { - if (strictFunctionTypes || priority & 64 /* AlwaysStrict */) { + if (strictFunctionTypes || priority & 128 /* AlwaysStrict */) { contravariant = !contravariant; inferFromTypes(source, target); contravariant = !contravariant; @@ -44892,7 +45704,11 @@ var ts; var inferredType = inferTypeForHomomorphicMappedType(source, target, constraintType); if (inferredType) { var savePriority = priority; - priority |= 2 /* HomomorphicMappedType */; + // We assign a lower priority to inferences made from types containing non-inferrable + // types because we may only have a partial result (i.e. we may have failed to make + // reverse inferences for some properties). + priority |= ts.getObjectFlags(source) & 524288 /* NonInferrableType */ ? + 4 /* PartialHomomorphicMappedType */ : 2 /* HomomorphicMappedType */; inferFromTypes(inferredType, inference.typeParameter); priority = savePriority; } @@ -44903,7 +45719,7 @@ var ts; // We're inferring from some source type S to a mapped type { [P in K]: X }, where K is a type // parameter. First infer from 'keyof S' to K. var savePriority = priority; - priority |= 4 /* MappedTypeConstraint */; + priority |= 8 /* MappedTypeConstraint */; inferFromTypes(getIndexType(source), constraintType); priority = savePriority; // If K is constrained to a type C, also infer to C. Thus, for a mapped type { [P in K]: X }, @@ -44916,11 +45732,11 @@ var ts; } // If no inferences can be made to K's constraint, infer from a union of the property types // in the source to the template type X. - var valueTypes = ts.compact([ - getIndexTypeOfType(source, 0 /* String */), - getIndexTypeOfType(source, 1 /* Number */) - ].concat(ts.map(getPropertiesOfType(source), getTypeOfSymbol))); - inferFromTypes(getUnionType(valueTypes), getTemplateTypeFromMappedType(target)); + var propTypes = ts.map(getPropertiesOfType(source), getTypeOfSymbol); + var stringIndexType = getIndexTypeOfType(source, 0 /* String */); + var numberIndexInfo = getNonEnumNumberIndexInfo(source); + var numberIndexType = numberIndexInfo && numberIndexInfo.type; + inferFromTypes(getUnionType(ts.append(ts.append(propTypes, stringIndexType), numberIndexType)), getTemplateTypeFromMappedType(target)); return true; } return false; @@ -44974,8 +45790,8 @@ var ts; } } var properties = getPropertiesOfObjectType(target); - for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) { - var targetProp = properties_5[_i]; + for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { + var targetProp = properties_3[_i]; var sourceProp = getPropertyOfType(source, targetProp.escapedName); if (sourceProp) { inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); @@ -44988,7 +45804,7 @@ var ts; var sourceLen = sourceSignatures.length; var targetLen = targetSignatures.length; var len = sourceLen < targetLen ? sourceLen : targetLen; - var skipParameters = !!(ts.getObjectFlags(source) & 524288 /* ContainsAnyFunctionType */); + var skipParameters = !!(ts.getObjectFlags(source) & 524288 /* NonInferrableType */); for (var i = 0; i < len; i++) { inferFromSignature(getBaseSignature(sourceSignatures[sourceLen - len + i]), getBaseSignature(targetSignatures[targetLen - len + i]), skipParameters); } @@ -44998,7 +45814,7 @@ var ts; var saveBivariant = bivariant; var kind = target.declaration ? target.declaration.kind : 0 /* Unknown */; // Once we descend into a bivariant signature we remain bivariant for all nested inferences - bivariant = bivariant || kind === 156 /* MethodDeclaration */ || kind === 155 /* MethodSignature */ || kind === 157 /* Constructor */; + bivariant = bivariant || kind === 157 /* MethodDeclaration */ || kind === 156 /* MethodSignature */ || kind === 158 /* Constructor */; applyToParameterTypes(source, target, inferFromContravariantTypes); bivariant = saveBivariant; } @@ -45065,7 +45881,7 @@ var ts; return candidates; } function getContravariantInference(inference) { - return inference.priority & 28 /* PriorityImpliesCombination */ ? getIntersectionType(inference.contraCandidates) : getCommonSubtype(inference.contraCandidates); + return inference.priority & 56 /* PriorityImpliesCombination */ ? getIntersectionType(inference.contraCandidates) : getCommonSubtype(inference.contraCandidates); } function getCovariantInference(inference, signature) { // Extract all object literal types and replace them with a single widened and normalized type. @@ -45082,15 +45898,15 @@ var ts; candidates; // If all inferences were made from a position that implies a combined result, infer a union type. // Otherwise, infer a common supertype. - var unwidenedType = inference.priority & 28 /* PriorityImpliesCombination */ ? + var unwidenedType = inference.priority & 56 /* PriorityImpliesCombination */ ? getUnionType(baseCandidates, 2 /* Subtype */) : getCommonSupertype(baseCandidates); return getWidenedType(unwidenedType); } function getInferredType(context, index) { var inference = context.inferences[index]; - var inferredType = inference.inferredType; - if (!inferredType) { + if (!inference.inferredType) { + var inferredType = void 0; var signature = context.signature; if (signature) { var inferredCovariantType = inference.candidates ? getCovariantInference(inference, signature) : undefined; @@ -45121,27 +45937,24 @@ var ts; // parameter should be instantiated to the empty object type. inferredType = instantiateType(defaultType, combineTypeMappers(createBackreferenceMapper(context, index), context.nonFixingMapper)); } - else { - inferredType = getDefaultTypeArgumentType(!!(context.flags & 2 /* AnyDefault */)); - } } } else { inferredType = getTypeFromInference(inference); } - inference.inferredType = inferredType; + inference.inferredType = inferredType || getDefaultTypeArgumentType(!!(context.flags & 2 /* AnyDefault */)); var constraint = getConstraintOfTypeParameter(inference.typeParameter); if (constraint) { var instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper); - if (!context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) { + if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) { inference.inferredType = inferredType = instantiatedConstraint; } } } - return inferredType; + return inference.inferredType; } function getDefaultTypeArgumentType(isInJavaScriptFile) { - return isInJavaScriptFile ? anyType : emptyObjectType; + return isInJavaScriptFile ? anyType : unknownType; } function getInferredTypes(context) { var result = []; @@ -45151,8 +45964,8 @@ var ts; return result; } // EXPRESSION TYPE CHECKING - function getCannotFindNameDiagnosticForName(name) { - switch (name) { + function getCannotFindNameDiagnosticForName(node) { + switch (node.escapedText) { case "document": case "console": return ts.Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom; @@ -45183,14 +45996,20 @@ var ts; case "Iterator": case "AsyncIterator": return ts.Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later; - default: return ts.Diagnostics.Cannot_find_name_0; + default: + if (node.parent.kind === 277 /* ShorthandPropertyAssignment */) { + return ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer; + } + else { + return ts.Diagnostics.Cannot_find_name_0; + } } } function getResolvedSymbol(node) { var links = getNodeLinks(node); if (!links.resolvedSymbol) { links.resolvedSymbol = !ts.nodeIsMissing(node) && - resolveName(node, node.escapedText, 67220415 /* Value */ | 1048576 /* ExportValue */, getCannotFindNameDiagnosticForName(node.escapedText), node, !ts.isWriteOnlyAccess(node), + resolveName(node, node.escapedText, 67220415 /* Value */ | 1048576 /* ExportValue */, getCannotFindNameDiagnosticForName(node), node, !ts.isWriteOnlyAccess(node), /*excludeGlobals*/ false, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1) || unknownSymbol; } return links.resolvedSymbol; @@ -45199,7 +46018,7 @@ var ts; // TypeScript 1.0 spec (April 2014): 3.6.3 // A type query consists of the keyword typeof followed by an expression. // The expression is restricted to a single identifier or a sequence of identifiers separated by periods - return !!ts.findAncestor(node, function (n) { return n.kind === 167 /* TypeQuery */ ? true : n.kind === 72 /* Identifier */ || n.kind === 148 /* QualifiedName */ ? false : "quit"; }); + return !!ts.findAncestor(node, function (n) { return n.kind === 168 /* TypeQuery */ ? true : n.kind === 73 /* Identifier */ || n.kind === 149 /* QualifiedName */ ? false : "quit"; }); } // Return the flow cache key for a "dotted name" (i.e. a sequence of identifiers // separated by dots). The key consists of the id of the symbol referenced by the @@ -45207,21 +46026,21 @@ var ts; // The result is undefined if the reference isn't a dotted name. We prefix nodes // occurring in an apparent type position with '@' because the control flow type // of such nodes may be based on the apparent type instead of the declared type. - function getFlowCacheKey(node) { + function getFlowCacheKey(node, declaredType, initialType, flowContainer) { switch (node.kind) { - case 72 /* Identifier */: + case 73 /* Identifier */: var symbol = getResolvedSymbol(node); - return symbol !== unknownSymbol ? (isConstraintPosition(node) ? "@" : "") + getSymbolId(symbol) : undefined; - case 100 /* ThisKeyword */: + return symbol !== unknownSymbol ? (flowContainer ? getNodeId(flowContainer) : "-1") + "|" + getTypeId(declaredType) + "|" + getTypeId(initialType) + "|" + (isConstraintPosition(node) ? "@" : "") + getSymbolId(symbol) : undefined; + case 101 /* ThisKeyword */: return "0"; - case 213 /* NonNullExpression */: - case 195 /* ParenthesizedExpression */: - return getFlowCacheKey(node.expression); - case 189 /* PropertyAccessExpression */: - case 190 /* ElementAccessExpression */: + case 214 /* NonNullExpression */: + case 196 /* ParenthesizedExpression */: + return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); + case 190 /* PropertyAccessExpression */: + case 191 /* ElementAccessExpression */: var propName = getAccessedPropertyName(node); if (propName !== undefined) { - var key = getFlowCacheKey(node.expression); + var key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); return key && key + "." + propName; } } @@ -45229,24 +46048,24 @@ var ts; } function isMatchingReference(source, target) { switch (target.kind) { - case 195 /* ParenthesizedExpression */: - case 213 /* NonNullExpression */: + case 196 /* ParenthesizedExpression */: + case 214 /* NonNullExpression */: return isMatchingReference(source, target.expression); } switch (source.kind) { - case 72 /* Identifier */: - return target.kind === 72 /* Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 237 /* VariableDeclaration */ || target.kind === 186 /* BindingElement */) && + case 73 /* Identifier */: + return target.kind === 73 /* Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) || + (target.kind === 238 /* VariableDeclaration */ || target.kind === 187 /* BindingElement */) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); - case 100 /* ThisKeyword */: - return target.kind === 100 /* ThisKeyword */; - case 98 /* SuperKeyword */: - return target.kind === 98 /* SuperKeyword */; - case 213 /* NonNullExpression */: - case 195 /* ParenthesizedExpression */: + case 101 /* ThisKeyword */: + return target.kind === 101 /* ThisKeyword */; + case 99 /* SuperKeyword */: + return target.kind === 99 /* SuperKeyword */; + case 214 /* NonNullExpression */: + case 196 /* ParenthesizedExpression */: return isMatchingReference(source.expression, target); - case 189 /* PropertyAccessExpression */: - case 190 /* ElementAccessExpression */: + case 190 /* PropertyAccessExpression */: + case 191 /* ElementAccessExpression */: return ts.isAccessExpression(target) && getAccessedPropertyName(source) === getAccessedPropertyName(target) && isMatchingReference(source.expression, target.expression); @@ -45254,7 +46073,7 @@ var ts; return false; } function getAccessedPropertyName(access) { - return access.kind === 189 /* PropertyAccessExpression */ ? access.name.escapedText : + return access.kind === 190 /* PropertyAccessExpression */ ? access.name.escapedText : ts.isStringLiteral(access.argumentExpression) || ts.isNumericLiteral(access.argumentExpression) ? ts.escapeLeadingUnderscores(access.argumentExpression.text) : undefined; } @@ -45279,7 +46098,7 @@ var ts; isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), name); } function getDeclaredTypeOfReference(expr) { - if (expr.kind === 72 /* Identifier */) { + if (expr.kind === 73 /* Identifier */) { return getTypeOfSymbol(getResolvedSymbol(expr)); } if (ts.isAccessExpression(expr)) { @@ -45301,7 +46120,7 @@ var ts; if (prop && ts.getCheckFlags(prop) & 2 /* SyntheticProperty */) { if (prop.isDiscriminantProperty === undefined) { prop.isDiscriminantProperty = - (prop.checkFlags & 96 /* Discriminant */) === 96 /* Discriminant */ && + (prop.checkFlags & 192 /* Discriminant */) === 192 /* Discriminant */ && isDiscriminantType(getTypeOfSymbol(prop)); } return !!prop.isDiscriminantProperty; @@ -45310,7 +46129,7 @@ var ts; return false; } function isSyntheticThisPropertyAccess(expr) { - return ts.isAccessExpression(expr) && expr.expression.kind === 100 /* ThisKeyword */ && !!(expr.expression.flags & 8 /* Synthesized */); + return ts.isAccessExpression(expr) && expr.expression.kind === 101 /* ThisKeyword */ && !!(expr.expression.flags & 8 /* Synthesized */); } function findDiscriminantProperties(sourceProperties, target) { var result; @@ -45338,7 +46157,7 @@ var ts; } } } - if (callExpression.expression.kind === 189 /* PropertyAccessExpression */ && + if (callExpression.expression.kind === 190 /* PropertyAccessExpression */ && isOrContainsMatchingReference(reference, callExpression.expression.expression)) { return true; } @@ -45457,7 +46276,7 @@ var ts; return strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */; } if (flags & 63176704 /* Instantiable */) { - return getTypeFacts(getBaseConstraintOfType(type) || emptyObjectType); + return getTypeFacts(getBaseConstraintOfType(type) || unknownType); } if (flags & 3145728 /* UnionOrIntersection */) { return getTypeFactsOfTypes(type.types); @@ -45493,15 +46312,15 @@ var ts; return createArrayType(checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || errorType); } function getAssignedTypeOfBinaryExpression(node) { - var isDestructuringDefaultAssignment = node.parent.kind === 187 /* ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || - node.parent.kind === 275 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); + var isDestructuringDefaultAssignment = node.parent.kind === 188 /* ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || + node.parent.kind === 276 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } function isDestructuringAssignmentTarget(parent) { - return parent.parent.kind === 204 /* BinaryExpression */ && parent.parent.left === parent || - parent.parent.kind === 227 /* ForOfStatement */ && parent.parent.initializer === parent; + return parent.parent.kind === 205 /* BinaryExpression */ && parent.parent.left === parent || + parent.parent.kind === 228 /* ForOfStatement */ && parent.parent.initializer === parent; } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element)); @@ -45518,21 +46337,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 226 /* ForInStatement */: + case 227 /* ForInStatement */: return stringType; - case 227 /* ForOfStatement */: + case 228 /* ForOfStatement */: return checkRightHandSideOfForOf(parent.expression, parent.awaitModifier) || errorType; - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: return getAssignedTypeOfBinaryExpression(parent); - case 198 /* DeleteExpression */: + case 199 /* DeleteExpression */: return undefinedType; - case 187 /* ArrayLiteralExpression */: + case 188 /* ArrayLiteralExpression */: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 208 /* SpreadElement */: + case 209 /* SpreadElement */: return getAssignedTypeOfSpreadExpression(parent); - case 275 /* PropertyAssignment */: + case 276 /* PropertyAssignment */: return getAssignedTypeOfPropertyAssignment(parent); - case 276 /* ShorthandPropertyAssignment */: + case 277 /* ShorthandPropertyAssignment */: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return errorType; @@ -45540,7 +46359,7 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 184 /* ObjectBindingPattern */ ? + var type = pattern.kind === 185 /* ObjectBindingPattern */ ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) : @@ -45558,37 +46377,37 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 226 /* ForInStatement */) { + if (node.parent.parent.kind === 227 /* ForInStatement */) { return stringType; } - if (node.parent.parent.kind === 227 /* ForOfStatement */) { + if (node.parent.parent.kind === 228 /* ForOfStatement */) { return checkRightHandSideOfForOf(node.parent.parent.expression, node.parent.parent.awaitModifier) || errorType; } return errorType; } function getInitialType(node) { - return node.kind === 237 /* VariableDeclaration */ ? + return node.kind === 238 /* VariableDeclaration */ ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function getInitialOrAssignedType(node, reference) { - return getConstraintForLocation(node.kind === 237 /* VariableDeclaration */ || node.kind === 186 /* BindingElement */ ? + return getConstraintForLocation(node.kind === 238 /* VariableDeclaration */ || node.kind === 187 /* BindingElement */ ? getInitialType(node) : getAssignedType(node), reference); } function isEmptyArrayAssignment(node) { - return node.kind === 237 /* VariableDeclaration */ && node.initializer && + return node.kind === 238 /* VariableDeclaration */ && node.initializer && isEmptyArrayLiteral(node.initializer) || - node.kind !== 186 /* BindingElement */ && node.parent.kind === 204 /* BinaryExpression */ && + node.kind !== 187 /* BindingElement */ && node.parent.kind === 205 /* BinaryExpression */ && isEmptyArrayLiteral(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 195 /* ParenthesizedExpression */: + case 196 /* ParenthesizedExpression */: return getReferenceCandidate(node.expression); - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: switch (node.operatorToken.kind) { - case 59 /* EqualsToken */: + case 60 /* EqualsToken */: return getReferenceCandidate(node.left); case 27 /* CommaToken */: return getReferenceCandidate(node.right); @@ -45598,13 +46417,13 @@ var ts; } function getReferenceRoot(node) { var parent = node.parent; - return parent.kind === 195 /* ParenthesizedExpression */ || - parent.kind === 204 /* BinaryExpression */ && parent.operatorToken.kind === 59 /* EqualsToken */ && parent.left === node || - parent.kind === 204 /* BinaryExpression */ && parent.operatorToken.kind === 27 /* CommaToken */ && parent.right === node ? + return parent.kind === 196 /* ParenthesizedExpression */ || + parent.kind === 205 /* BinaryExpression */ && parent.operatorToken.kind === 60 /* EqualsToken */ && parent.left === node || + parent.kind === 205 /* BinaryExpression */ && parent.operatorToken.kind === 27 /* CommaToken */ && parent.right === node ? getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 271 /* CaseClause */) { + if (clause.kind === 272 /* CaseClause */) { return getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); } return neverType; @@ -45626,7 +46445,7 @@ var ts; var witnesses = []; for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) { var clause = _a[_i]; - if (clause.kind === 271 /* CaseClause */) { + if (clause.kind === 272 /* CaseClause */) { if (clause.expression.kind === 10 /* StringLiteral */) { witnesses.push(clause.expression.text); continue; @@ -45672,6 +46491,9 @@ var ts; } return f(type) ? type : neverType; } + function countTypes(type) { + return type.flags & 1048576 /* Union */ ? type.types.length : 1; + } function mapType(type, mapper, noReductions) { if (type.flags & 131072 /* Never */) { return type; @@ -45679,25 +46501,20 @@ var ts; if (!(type.flags & 1048576 /* Union */)) { return mapper(type); } - var types = type.types; - var mappedType; var mappedTypes; - for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { - var current = types_13[_i]; - var t = mapper(current); - if (t) { - if (!mappedType) { - mappedType = t; - } - else if (!mappedTypes) { - mappedTypes = [mappedType, t]; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + var mapped = mapper(t); + if (mapped) { + if (!mappedTypes) { + mappedTypes = [mapped]; } else { - mappedTypes.push(t); + mappedTypes.push(mapped); } } } - return mappedTypes ? getUnionType(mappedTypes, noReductions ? 0 /* None */ : 1 /* Literal */) : mappedType; + return mappedTypes && getUnionType(mappedTypes, noReductions ? 0 /* None */ : 1 /* Literal */); } function extractTypesOfKind(type, kind) { return filterType(type, function (t) { return (t.flags & kind) !== 0; }); @@ -45765,8 +46582,8 @@ var ts; } function isEvolvingArrayTypeList(types) { var hasEvolvingArrayType = false; - for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { - var t = types_14[_i]; + for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { + var t = types_13[_i]; if (!(t.flags & 131072 /* Never */)) { if (!(ts.getObjectFlags(t) & 256 /* EvolvingArray */)) { return false; @@ -45789,12 +46606,12 @@ var ts; function isEvolvingArrayOperationTarget(node) { var root = getReferenceRoot(node); var parent = root.parent; - var isLengthPushOrUnshift = parent.kind === 189 /* PropertyAccessExpression */ && (parent.name.escapedText === "length" || - parent.parent.kind === 191 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name)); - var isElementAssignment = parent.kind === 190 /* ElementAccessExpression */ && + var isLengthPushOrUnshift = parent.kind === 190 /* PropertyAccessExpression */ && (parent.name.escapedText === "length" || + parent.parent.kind === 192 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name)); + var isElementAssignment = parent.kind === 191 /* ElementAccessExpression */ && parent.expression === root && - parent.parent.kind === 204 /* BinaryExpression */ && - parent.parent.operatorToken.kind === 59 /* EqualsToken */ && + parent.parent.kind === 205 /* BinaryExpression */ && + parent.parent.operatorToken.kind === 60 /* EqualsToken */ && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && isTypeAssignableToKind(getTypeOfExpression(parent.argumentExpression), 296 /* NumberLike */); @@ -45808,7 +46625,7 @@ var ts; return links.maybeTypePredicate; } function getMaybeTypePredicate(node) { - if (node.expression.kind !== 98 /* SuperKeyword */) { + if (node.expression.kind !== 99 /* SuperKeyword */) { var funcType = checkNonNullExpression(node.expression); if (funcType !== silentNeverType) { var apparentType = getApparentType(funcType); @@ -45826,6 +46643,7 @@ var ts; function getFlowTypeOfReference(reference, declaredType, initialType, flowContainer, couldBeUninitialized) { if (initialType === void 0) { initialType = declaredType; } var key; + var keySet = false; var flowDepth = 0; if (flowAnalysisDisabled) { return errorType; @@ -45841,10 +46659,17 @@ var ts; // on empty arrays are possible without implicit any errors and new element types can be inferred without // type mismatch errors. var resultType = ts.getObjectFlags(evolvedType) & 256 /* EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType); - if (reference.parent && reference.parent.kind === 213 /* NonNullExpression */ && getTypeWithFacts(resultType, 2097152 /* NEUndefinedOrNull */).flags & 131072 /* Never */) { + if (reference.parent && reference.parent.kind === 214 /* NonNullExpression */ && getTypeWithFacts(resultType, 2097152 /* NEUndefinedOrNull */).flags & 131072 /* Never */) { return declaredType; } return resultType; + function getOrSetCacheKey() { + if (keySet) { + return key; + } + keySet = true; + return key = getFlowCacheKey(reference, declaredType, initialType, flowContainer); + } function getTypeAtFlowNode(flow) { if (flowDepth === 2000) { // We have made 2000 recursive invocations. To avoid overflowing the call stack we report an error @@ -45856,6 +46681,15 @@ var ts; flowDepth++; while (true) { var flags = flow.flags; + if (flags & 8192 /* Cached */) { + var key_2 = getOrSetCacheKey(); + if (key_2) { + var id = getFlowNodeId(flow); + if (flowAssignmentKeys[id] === key_2) { + return flowAssignmentTypes[id]; + } + } + } if (flags & 1024 /* Shared */) { // We cache results of flow type resolution for shared nodes that were previously visited in // the same getFlowTypeOfReference invocation. A node is considered shared when it is the @@ -45886,6 +46720,15 @@ var ts; flow = flow.antecedent; continue; } + else if (flowLoopCount === flowLoopStart) { // Only cache assignments when not within loop analysis + var key_3 = getOrSetCacheKey(); + if (key_3 && !isIncomplete(type)) { + flow.flags |= 8192 /* Cached */; + var id = getFlowNodeId(flow); + flowAssignmentKeys[id] = key_3; + flowAssignmentTypes[id] = type; + } + } } else if (flags & 96 /* Condition */) { type = getTypeAtFlowCondition(flow); @@ -45913,9 +46756,9 @@ var ts; // Check if we should continue with the control flow of the containing function. var container = flow.container; if (container && container !== flowContainer && - reference.kind !== 189 /* PropertyAccessExpression */ && - reference.kind !== 190 /* ElementAccessExpression */ && - reference.kind !== 100 /* ThisKeyword */) { + reference.kind !== 190 /* PropertyAccessExpression */ && + reference.kind !== 191 /* ElementAccessExpression */ && + reference.kind !== 101 /* ThisKeyword */) { flow = container.flowNode; continue; } @@ -45967,14 +46810,14 @@ var ts; // in which case we continue control flow analysis back to the function's declaration if (ts.isVariableDeclaration(node) && (ts.isInJSFile(node) || ts.isVarConst(node))) { var init = ts.getDeclaredExpandoInitializer(node); - if (init && (init.kind === 196 /* FunctionExpression */ || init.kind === 197 /* ArrowFunction */)) { + if (init && (init.kind === 197 /* FunctionExpression */ || init.kind === 198 /* ArrowFunction */)) { return getTypeAtFlowNode(flow.antecedent); } } return declaredType; } // for (const _ in ref) acts as a nonnull on ref - if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 226 /* ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) { + if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 227 /* ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) { return getNonNullableTypeIfNeeded(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent))); } // Assignment doesn't affect reference @@ -45983,7 +46826,7 @@ var ts; function getTypeAtFlowArrayMutation(flow) { if (declaredType === autoType || declaredType === autoArrayType) { var node = flow.node; - var expr = node.kind === 191 /* CallExpression */ ? + var expr = node.kind === 192 /* CallExpression */ ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { @@ -45991,7 +46834,7 @@ var ts; var type = getTypeFromFlowType(flowType); if (ts.getObjectFlags(type) & 256 /* EvolvingArray */) { var evolvedType_1 = type; - if (node.kind === 191 /* CallExpression */) { + if (node.kind === 192 /* CallExpression */) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); @@ -46044,7 +46887,7 @@ var ts; else if (isMatchingReferenceDiscriminant(expr, type)) { type = narrowTypeByDiscriminant(type, expr, function (t) { return narrowTypeBySwitchOnDiscriminant(t, flow.switchStatement, flow.clauseStart, flow.clauseEnd); }); } - else if (expr.kind === 199 /* TypeOfExpression */ && isMatchingReference(reference, expr.expression)) { + else if (expr.kind === 200 /* TypeOfExpression */ && isMatchingReference(reference, expr.expression)) { type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } else if (containsMatchingReferenceDiscriminant(reference, expr)) { @@ -46091,12 +46934,10 @@ var ts; // this flow loop junction, return the cached type. var id = getFlowNodeId(flow); var cache = flowLoopCaches[id] || (flowLoopCaches[id] = ts.createMap()); + var key = getOrSetCacheKey(); if (!key) { - key = getFlowCacheKey(reference); // No cache key is generated when binding patterns are in unnarrowable situations - if (!key) { - return declaredType; - } + return declaredType; } var cached = cache.get(key); if (cached) { @@ -46204,7 +47045,7 @@ var ts; return !assumeTrue; } function narrowByInKeyword(type, literal, assumeTrue) { - if ((type.flags & (1048576 /* Union */ | 524288 /* Object */)) || (type.flags & 262144 /* TypeParameter */ && type.isThisType)) { + if (type.flags & (1048576 /* Union */ | 524288 /* Object */) || isThisTypeParameter(type)) { var propName_1 = ts.escapeLeadingUnderscores(literal.text); return filterType(type, function (t) { return isTypePresencePossible(t, propName_1, assumeTrue); }); } @@ -46212,8 +47053,8 @@ var ts; } function narrowTypeByBinaryExpression(type, expr, assumeTrue) { switch (expr.operatorToken.kind) { - case 59 /* EqualsToken */: - return narrowTypeByTruthiness(type, expr.left, assumeTrue); + case 60 /* EqualsToken */: + return narrowTypeByTruthiness(narrowType(type, expr.right, assumeTrue), expr.left, assumeTrue); case 33 /* EqualsEqualsToken */: case 34 /* ExclamationEqualsToken */: case 35 /* EqualsEqualsEqualsToken */: @@ -46221,10 +47062,10 @@ var ts; var operator_1 = expr.operatorToken.kind; var left_1 = getReferenceCandidate(expr.left); var right_1 = getReferenceCandidate(expr.right); - if (left_1.kind === 199 /* TypeOfExpression */ && ts.isStringLiteralLike(right_1)) { + if (left_1.kind === 200 /* TypeOfExpression */ && ts.isStringLiteralLike(right_1)) { return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue); } - if (right_1.kind === 199 /* TypeOfExpression */ && ts.isStringLiteralLike(left_1)) { + if (right_1.kind === 200 /* TypeOfExpression */ && ts.isStringLiteralLike(left_1)) { return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue); } if (isMatchingReference(reference, left_1)) { @@ -46243,9 +47084,9 @@ var ts; return declaredType; } break; - case 94 /* InstanceOfKeyword */: + case 95 /* InstanceOfKeyword */: return narrowTypeByInstanceof(type, expr, assumeTrue); - case 93 /* InKeyword */: + case 94 /* InKeyword */: var target = getReferenceCandidate(expr.right); if (ts.isStringLiteralLike(expr.left) && isMatchingReference(reference, target)) { return narrowByInKeyword(type, expr.left, assumeTrue); @@ -46289,7 +47130,10 @@ var ts; return type; } if (assumeTrue) { - var narrowedType = filterType(type, function (t) { return areTypesComparable(t, valueType); }); + var filterFn = operator === 33 /* EqualsEqualsToken */ ? + (function (t) { return areTypesComparable(t, valueType) || isCoercibleUnderDoubleEquals(t, valueType); }) : + function (t) { return areTypesComparable(t, valueType); }; + var narrowedType = filterType(type, filterFn); return narrowedType.flags & 131072 /* Never */ ? type : replacePrimitivesWithLiterals(narrowedType, valueType); } if (isUnitType(valueType)) { @@ -46578,19 +47422,19 @@ var ts; // will be a subtype or the same type as the argument. function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 72 /* Identifier */: - case 100 /* ThisKeyword */: - case 98 /* SuperKeyword */: - case 189 /* PropertyAccessExpression */: - case 190 /* ElementAccessExpression */: + case 73 /* Identifier */: + case 101 /* ThisKeyword */: + case 99 /* SuperKeyword */: + case 190 /* PropertyAccessExpression */: + case 191 /* ElementAccessExpression */: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 191 /* CallExpression */: + case 192 /* CallExpression */: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 195 /* ParenthesizedExpression */: + case 196 /* ParenthesizedExpression */: return narrowType(type, expr.expression, assumeTrue); - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 202 /* PrefixUnaryExpression */: + case 203 /* PrefixUnaryExpression */: if (expr.operator === 52 /* ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } @@ -46605,7 +47449,7 @@ var ts; // an dotted name expression, and if the location is not an assignment target, obtain the type // of the expression (which will reflect control flow analysis). If the expression indeed // resolved to the given symbol, return the narrowed type. - if (location.kind === 72 /* Identifier */) { + if (location.kind === 73 /* Identifier */) { if (ts.isRightSideOfQualifiedNameOrPropertyAccess(location)) { location = location.parent; } @@ -46626,9 +47470,9 @@ var ts; function getControlFlowContainer(node) { return ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 245 /* ModuleBlock */ || - node.kind === 284 /* SourceFile */ || - node.kind === 154 /* PropertyDeclaration */; + node.kind === 246 /* ModuleBlock */ || + node.kind === 285 /* SourceFile */ || + node.kind === 155 /* PropertyDeclaration */; }); } // Check if a parameter is assigned anywhere within its declaring function. @@ -46647,10 +47491,10 @@ var ts; return !!ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !!(getNodeLinks(node).flags & 8388608 /* AssignmentsMarked */); }); } function markParameterAssignments(node) { - if (node.kind === 72 /* Identifier */) { + if (node.kind === 73 /* Identifier */) { if (ts.isAssignmentTarget(node)) { var symbol = getResolvedSymbol(node); - if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 151 /* Parameter */) { + if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 152 /* Parameter */) { symbol.isAssigned = true; } } @@ -46665,7 +47509,7 @@ var ts; /** remove undefined from the annotated type of a parameter when there is an initializer (that doesn't include undefined) */ function removeOptionalityFromDeclaredType(declaredType, declaration) { var annotationIncludesUndefined = strictNullChecks && - declaration.kind === 151 /* Parameter */ && + declaration.kind === 152 /* Parameter */ && declaration.initializer && getFalsyFlags(declaredType) & 32768 /* Undefined */ && !(getFalsyFlags(checkExpression(declaration.initializer)) & 32768 /* Undefined */); @@ -46673,13 +47517,13 @@ var ts; } function isConstraintPosition(node) { var parent = node.parent; - return parent.kind === 189 /* PropertyAccessExpression */ || - parent.kind === 191 /* CallExpression */ && parent.expression === node || - parent.kind === 190 /* ElementAccessExpression */ && parent.expression === node || - parent.kind === 186 /* BindingElement */ && parent.name === node && !!parent.initializer; + return parent.kind === 190 /* PropertyAccessExpression */ || + parent.kind === 192 /* CallExpression */ && parent.expression === node || + parent.kind === 191 /* ElementAccessExpression */ && parent.expression === node || + parent.kind === 187 /* BindingElement */ && parent.name === node && !!parent.initializer; } function typeHasNullableConstraint(type) { - return type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || emptyObjectType, 98304 /* Nullable */); + return type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 98304 /* Nullable */); } function getConstraintForLocation(type, node) { // When a node is the left hand expression of a property access, element access, or call expression, @@ -46710,7 +47554,7 @@ var ts; if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); if (languageVersion < 2 /* ES2015 */) { - if (container.kind === 197 /* ArrowFunction */) { + if (container.kind === 198 /* ArrowFunction */) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } else if (ts.hasModifier(container, 256 /* Async */)) { @@ -46731,7 +47575,7 @@ var ts; // Due to the emit for class decorators, any reference to the class from inside of the class body // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind // behavior of class names in ES6. - if (declaration.kind === 240 /* ClassDeclaration */ + if (declaration.kind === 241 /* ClassDeclaration */ && ts.nodeIsDecorated(declaration)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -46743,14 +47587,14 @@ var ts; container = ts.getContainingClass(container); } } - else if (declaration.kind === 209 /* ClassExpression */) { + else if (declaration.kind === 210 /* ClassExpression */) { // When we emit a class expression with static members that contain a reference // to the constructor in the initializer, we will need to substitute that // binding with an alias as the class name is not in scope. var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); - while (container.kind !== 284 /* SourceFile */) { + while (container.kind !== 285 /* SourceFile */) { if (container.parent === declaration) { - if (container.kind === 154 /* PropertyDeclaration */ && ts.hasModifier(container, 32 /* Static */)) { + if (container.kind === 155 /* PropertyDeclaration */ && ts.hasModifier(container, 32 /* Static */)) { getNodeLinks(declaration).flags |= 16777216 /* ClassWithConstructorReference */; getNodeLinks(node).flags |= 33554432 /* ConstructorReferenceInClass */; } @@ -46799,7 +47643,7 @@ var ts; // The declaration container is the innermost function that encloses the declaration of the variable // or parameter. The flow container is the innermost function starting with which we analyze the control // flow graph to determine the control flow based type. - var isParameter = ts.getRootDeclaration(declaration).kind === 151 /* Parameter */; + var isParameter = ts.getRootDeclaration(declaration).kind === 152 /* Parameter */; var declarationContainer = getControlFlowContainer(declaration); var flowContainer = getControlFlowContainer(node); var isOuterVariable = flowContainer !== declarationContainer; @@ -46808,19 +47652,19 @@ var ts; // When the control flow originates in a function expression or arrow function and we are referencing // a const variable or parameter from an outer function, we extend the origin of the control flow // analysis to include the immediately enclosing function. - while (flowContainer !== declarationContainer && (flowContainer.kind === 196 /* FunctionExpression */ || - flowContainer.kind === 197 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && + while (flowContainer !== declarationContainer && (flowContainer.kind === 197 /* FunctionExpression */ || + flowContainer.kind === 198 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && (isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } // We only look for uninitialized variables in strict null checking mode, and only when we can analyze // the entire control flow graph from the variable's declaration (i.e. when the flow container and // declaration container are the same). - var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || + var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || ts.isBindingElement(declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 3 /* AnyOrUnknown */) !== 0 || - isInTypeQuery(node) || node.parent.kind === 257 /* ExportSpecifier */) || - node.parent.kind === 213 /* NonNullExpression */ || - declaration.kind === 237 /* VariableDeclaration */ && declaration.exclamationToken || + isInTypeQuery(node) || node.parent.kind === 258 /* ExportSpecifier */) || + node.parent.kind === 214 /* NonNullExpression */ || + declaration.kind === 238 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 4194304 /* Ambient */; var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) : type === autoType || type === autoArrayType ? undefinedType : @@ -46855,7 +47699,7 @@ var ts; if (languageVersion >= 2 /* ES2015 */ || (symbol.flags & (2 /* BlockScopedVariable */ | 32 /* Class */)) === 0 || ts.isSourceFile(symbol.valueDeclaration) || - symbol.valueDeclaration.parent.kind === 274 /* CatchClause */) { + symbol.valueDeclaration.parent.kind === 275 /* CatchClause */) { return; } // 1. walk from the use site up to the declaration and check @@ -46878,7 +47722,7 @@ var ts; // mark iteration statement as containing block-scoped binding captured in some function var capturesBlockScopeBindingInLoopBody = true; if (ts.isForStatement(container) && - ts.getAncestor(symbol.valueDeclaration, 238 /* VariableDeclarationList */).parent === container) { + ts.getAncestor(symbol.valueDeclaration, 239 /* VariableDeclarationList */).parent === container) { var part = getPartOfForStatementContainingNode(node.parent, container); if (part) { var links = getNodeLinks(part); @@ -46896,8 +47740,8 @@ var ts; } // mark variables that are declared in loop initializer and reassigned inside the body of ForStatement. // if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back. - if (container.kind === 225 /* ForStatement */ && - ts.getAncestor(symbol.valueDeclaration, 238 /* VariableDeclarationList */).parent === container && + if (container.kind === 226 /* ForStatement */ && + ts.getAncestor(symbol.valueDeclaration, 239 /* VariableDeclarationList */).parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 4194304 /* NeedsLoopOutParameter */; } @@ -46915,7 +47759,7 @@ var ts; function isAssignedInBodyOfForStatement(node, container) { // skip parenthesized nodes var current = node; - while (current.parent.kind === 195 /* ParenthesizedExpression */) { + while (current.parent.kind === 196 /* ParenthesizedExpression */) { current = current.parent; } // check if node is used as LHS in some assignment expression @@ -46923,7 +47767,7 @@ var ts; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 202 /* PrefixUnaryExpression */ || current.parent.kind === 203 /* PostfixUnaryExpression */)) { + else if ((current.parent.kind === 203 /* PrefixUnaryExpression */ || current.parent.kind === 204 /* PostfixUnaryExpression */)) { var expr = current.parent; isAssigned = expr.operator === 44 /* PlusPlusToken */ || expr.operator === 45 /* MinusMinusToken */; } @@ -46936,7 +47780,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2 /* LexicalThis */; - if (container.kind === 154 /* PropertyDeclaration */ || container.kind === 157 /* Constructor */) { + if (container.kind === 155 /* PropertyDeclaration */ || container.kind === 158 /* Constructor */) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4 /* CaptureThis */; } @@ -47004,37 +47848,37 @@ var ts; // tell whether 'this' needs to be captured. var container = ts.getThisContainer(node, /* includeArrowFunctions */ true); var capturedByArrowFunction = false; - if (container.kind === 157 /* Constructor */) { + if (container.kind === 158 /* Constructor */) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } // Now skip arrow functions to get the "real" owner of 'this'. - if (container.kind === 197 /* ArrowFunction */) { + if (container.kind === 198 /* ArrowFunction */) { container = ts.getThisContainer(container, /* includeArrowFunctions */ false); capturedByArrowFunction = true; } switch (container.kind) { - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 243 /* EnumDeclaration */: + case 244 /* EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 157 /* Constructor */: + case 158 /* Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks } break; - case 154 /* PropertyDeclaration */: - case 153 /* PropertySignature */: + case 155 /* PropertyDeclaration */: + case 154 /* PropertySignature */: if (ts.hasModifier(container, 32 /* Static */)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks } break; - case 149 /* ComputedPropertyName */: + case 150 /* ComputedPropertyName */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -47084,7 +47928,7 @@ var ts; // * /** @constructor */ function [name]() { ... } // * /** @constructor */ var x = function() { ... } else if (isInJS && - (container.kind === 196 /* FunctionExpression */ || container.kind === 239 /* FunctionDeclaration */) && + (container.kind === 197 /* FunctionExpression */ || container.kind === 240 /* FunctionDeclaration */) && ts.getJSDocClassTag(container)) { var classType = getJSClassType(getMergedSymbol(container.symbol)); if (classType) { @@ -47120,7 +47964,7 @@ var ts; } function getClassNameFromPrototypeMethod(container) { // Check if it's the RHS of a x.prototype.y = function [name]() { .... } - if (container.kind === 196 /* FunctionExpression */ && + if (container.kind === 197 /* FunctionExpression */ && ts.isBinaryExpression(container.parent) && ts.getAssignmentDeclarationKind(container.parent) === 3 /* PrototypeProperty */) { // Get the 'x' of 'x.prototype.y = container' @@ -47130,16 +47974,16 @@ var ts; .expression; // x } // x.prototype = { method() { } } - else if (container.kind === 156 /* MethodDeclaration */ && - container.parent.kind === 188 /* ObjectLiteralExpression */ && + else if (container.kind === 157 /* MethodDeclaration */ && + container.parent.kind === 189 /* ObjectLiteralExpression */ && ts.isBinaryExpression(container.parent.parent) && ts.getAssignmentDeclarationKind(container.parent.parent) === 6 /* Prototype */) { return container.parent.parent.left.expression; } // x.prototype = { method: function() { } } - else if (container.kind === 196 /* FunctionExpression */ && - container.parent.kind === 275 /* PropertyAssignment */ && - container.parent.parent.kind === 188 /* ObjectLiteralExpression */ && + else if (container.kind === 197 /* FunctionExpression */ && + container.parent.kind === 276 /* PropertyAssignment */ && + container.parent.parent.kind === 189 /* ObjectLiteralExpression */ && ts.isBinaryExpression(container.parent.parent.parent) && ts.getAssignmentDeclarationKind(container.parent.parent.parent) === 6 /* Prototype */) { return container.parent.parent.parent.left.expression; @@ -47147,7 +47991,7 @@ var ts; // Object.defineProperty(x, "method", { value: function() { } }); // Object.defineProperty(x, "method", { set: (x: () => void) => void }); // Object.defineProperty(x, "method", { get: () => function() { }) }); - else if (container.kind === 196 /* FunctionExpression */ && + else if (container.kind === 197 /* FunctionExpression */ && ts.isPropertyAssignment(container.parent) && ts.isIdentifier(container.parent.name) && (container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") && @@ -47172,7 +48016,7 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 294 /* JSDocFunctionType */) { + if (jsdocType && jsdocType.kind === 295 /* JSDocFunctionType */) { var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && @@ -47186,15 +48030,15 @@ var ts; } } function isInConstructorArgumentInitializer(node, constructorDecl) { - return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 151 /* Parameter */ && n.parent === constructorDecl; }); + return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 152 /* Parameter */ && n.parent === constructorDecl; }); } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 191 /* CallExpression */ && node.parent.expression === node; + var isCallExpression = node.parent.kind === 192 /* CallExpression */ && node.parent.expression === node; var container = ts.getSuperContainer(node, /*stopOnFunctions*/ true); var needToCaptureLexicalThis = false; // adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting if (!isCallExpression) { - while (container && container.kind === 197 /* ArrowFunction */) { + while (container && container.kind === 198 /* ArrowFunction */) { container = ts.getSuperContainer(container, /*stopOnFunctions*/ true); needToCaptureLexicalThis = languageVersion < 2 /* ES2015 */; } @@ -47207,14 +48051,14 @@ var ts; // class B { // [super.foo()]() {} // } - var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 149 /* ComputedPropertyName */; }); - if (current && current.kind === 149 /* ComputedPropertyName */) { + var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 150 /* ComputedPropertyName */; }); + if (current && current.kind === 150 /* ComputedPropertyName */) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); } - else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 188 /* ObjectLiteralExpression */)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 189 /* ObjectLiteralExpression */)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -47222,7 +48066,7 @@ var ts; } return errorType; } - if (!isCallExpression && container.kind === 157 /* Constructor */) { + if (!isCallExpression && container.kind === 158 /* Constructor */) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); } if (ts.hasModifier(container, 32 /* Static */) || isCallExpression) { @@ -47291,7 +48135,7 @@ var ts; // as a call expression cannot be used as the target of a destructuring assignment while a property access can. // // For element access expressions (`super[x]`), we emit a generic helper that forwards the element access in both situations. - if (container.kind === 156 /* MethodDeclaration */ && ts.hasModifier(container, 256 /* Async */)) { + if (container.kind === 157 /* MethodDeclaration */ && ts.hasModifier(container, 256 /* Async */)) { if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) { getNodeLinks(container).flags |= 4096 /* AsyncMethodWithSuperBinding */; } @@ -47305,7 +48149,7 @@ var ts; // in this case they should also use correct lexical this captureLexicalThis(node.parent, container); } - if (container.parent.kind === 188 /* ObjectLiteralExpression */) { + if (container.parent.kind === 189 /* ObjectLiteralExpression */) { if (languageVersion < 2 /* ES2015 */) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return errorType; @@ -47326,7 +48170,7 @@ var ts; if (!baseClassType) { return errorType; } - if (container.kind === 157 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 158 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { // issue custom error message for super property access in constructor arguments (to be aligned with old compiler) error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return errorType; @@ -47341,7 +48185,7 @@ var ts; if (isCallExpression) { // TS 1.0 SPEC (April 2014): 4.8.1 // Super calls are only permitted in constructors of derived classes - return container.kind === 157 /* Constructor */; + return container.kind === 158 /* Constructor */; } else { // TS 1.0 SPEC (April 2014) @@ -47349,21 +48193,21 @@ var ts; // - In a constructor, instance member function, instance member accessor, or instance member variable initializer where this references a derived class instance // - In a static member function or static member accessor // topmost container must be something that is directly nested in the class declaration\object literal expression - if (ts.isClassLike(container.parent) || container.parent.kind === 188 /* ObjectLiteralExpression */) { + if (ts.isClassLike(container.parent) || container.parent.kind === 189 /* ObjectLiteralExpression */) { if (ts.hasModifier(container, 32 /* Static */)) { - return container.kind === 156 /* MethodDeclaration */ || - container.kind === 155 /* MethodSignature */ || - container.kind === 158 /* GetAccessor */ || - container.kind === 159 /* SetAccessor */; + return container.kind === 157 /* MethodDeclaration */ || + container.kind === 156 /* MethodSignature */ || + container.kind === 159 /* GetAccessor */ || + container.kind === 160 /* SetAccessor */; } else { - return container.kind === 156 /* MethodDeclaration */ || - container.kind === 155 /* MethodSignature */ || - container.kind === 158 /* GetAccessor */ || - container.kind === 159 /* SetAccessor */ || - container.kind === 154 /* PropertyDeclaration */ || - container.kind === 153 /* PropertySignature */ || - container.kind === 157 /* Constructor */; + return container.kind === 157 /* MethodDeclaration */ || + container.kind === 156 /* MethodSignature */ || + container.kind === 159 /* GetAccessor */ || + container.kind === 160 /* SetAccessor */ || + container.kind === 155 /* PropertyDeclaration */ || + container.kind === 154 /* PropertySignature */ || + container.kind === 158 /* Constructor */; } } } @@ -47371,10 +48215,10 @@ var ts; } } function getContainingObjectLiteral(func) { - return (func.kind === 156 /* MethodDeclaration */ || - func.kind === 158 /* GetAccessor */ || - func.kind === 159 /* SetAccessor */) && func.parent.kind === 188 /* ObjectLiteralExpression */ ? func.parent : - func.kind === 196 /* FunctionExpression */ && func.parent.kind === 275 /* PropertyAssignment */ ? func.parent.parent : + return (func.kind === 157 /* MethodDeclaration */ || + func.kind === 159 /* GetAccessor */ || + func.kind === 160 /* SetAccessor */) && func.parent.kind === 189 /* ObjectLiteralExpression */ ? func.parent : + func.kind === 197 /* FunctionExpression */ && func.parent.kind === 276 /* PropertyAssignment */ ? func.parent.parent : undefined; } function getThisTypeArgument(type) { @@ -47386,7 +48230,7 @@ var ts; }); } function getContextualThisParameterType(func) { - if (func.kind === 197 /* ArrowFunction */) { + if (func.kind === 198 /* ArrowFunction */) { return undefined; } if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { @@ -47413,7 +48257,7 @@ var ts; if (thisType) { return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral))); } - if (literal.parent.kind !== 275 /* PropertyAssignment */) { + if (literal.parent.kind !== 276 /* PropertyAssignment */) { break; } literal = literal.parent.parent; @@ -47427,9 +48271,9 @@ var ts; // In an assignment of the form 'obj.xxx = function(...)' or 'obj[xxx] = function(...)', the // contextual type for 'this' is 'obj'. var parent = func.parent; - if (parent.kind === 204 /* BinaryExpression */ && parent.operatorToken.kind === 59 /* EqualsToken */) { + if (parent.kind === 205 /* BinaryExpression */ && parent.operatorToken.kind === 60 /* EqualsToken */) { var target = parent.left; - if (target.kind === 189 /* PropertyAccessExpression */ || target.kind === 190 /* ElementAccessExpression */) { + if (target.kind === 190 /* PropertyAccessExpression */ || target.kind === 191 /* ElementAccessExpression */) { var expression = target.expression; // Don't contextually type `this` as `exports` in `exports.Point = function(x, y) { this.x = x; this.y = y; }` if (inJs && ts.isIdentifier(expression)) { @@ -47480,9 +48324,9 @@ var ts; return getTypeFromTypeNode(typeNode); } switch (declaration.kind) { - case 151 /* Parameter */: + case 152 /* Parameter */: return getContextuallyTypedParameterType(declaration); - case 186 /* BindingElement */: + case 187 /* BindingElement */: return getContextualTypeForBindingElement(declaration); // By default, do nothing and return undefined - only parameters and binding elements have context implied by a parent } @@ -47603,16 +48447,16 @@ var ts; return getTypeAtPosition(signature, argIndex); } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 193 /* TaggedTemplateExpression */) { + if (template.parent.kind === 194 /* TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; } - function getContextualTypeForBinaryOperand(node) { + function getContextualTypeForBinaryOperand(node, contextFlags) { var binaryExpression = node.parent; var left = binaryExpression.left, operatorToken = binaryExpression.operatorToken, right = binaryExpression.right; switch (operatorToken.kind) { - case 59 /* EqualsToken */: + case 60 /* EqualsToken */: if (node !== right) { return undefined; } @@ -47625,12 +48469,12 @@ var ts; // When an || expression has a contextual type, the operands are contextually typed by that type. When an || // expression has no contextual type, the right operand is contextually typed by the type of the left operand, // except for the special case of Javascript declarations of the form `namespace.prop = namespace.prop || {}` - var type = getContextualType(binaryExpression); + var type = getContextualType(binaryExpression, contextFlags); return !type && node === right && !ts.isDefaultedExpandoInitializer(binaryExpression) ? getTypeOfExpression(left) : type; case 54 /* AmpersandAmpersandToken */: case 27 /* CommaToken */: - return node === right ? getContextualType(binaryExpression) : undefined; + return node === right ? getContextualType(binaryExpression, contextFlags) : undefined; default: return undefined; } @@ -47737,24 +48581,24 @@ var ts; // In an object literal contextually typed by a type T, the contextual type of a property assignment is the type of // the matching property in T, if one exists. Otherwise, it is the type of the numeric index signature in T, if one // exists. Otherwise, it is the type of the string index signature in T, if one exists. - function getContextualTypeForObjectLiteralMethod(node) { + function getContextualTypeForObjectLiteralMethod(node, contextFlags) { ts.Debug.assert(ts.isObjectLiteralMethod(node)); if (node.flags & 8388608 /* InWithStatement */) { // We cannot answer semantic questions within a with block, do not proceed any further return undefined; } - return getContextualTypeForObjectLiteralElement(node); + return getContextualTypeForObjectLiteralElement(node, contextFlags); } - function getContextualTypeForObjectLiteralElement(element) { + function getContextualTypeForObjectLiteralElement(element, contextFlags) { var objectLiteral = element.parent; - var type = getApparentTypeOfContextualType(objectLiteral); + var type = getApparentTypeOfContextualType(objectLiteral, contextFlags); if (type) { if (!hasNonBindableDynamicName(element)) { // For a (non-symbol) computed property, there is no reason to look up the name // in the type. It will just be "__computed", which does not appear in any // SymbolTable. - var symbolName_2 = getSymbolOfNode(element).escapedName; - var propertyType = getTypeOfPropertyOfContextualType(type, symbolName_2); + var symbolName_3 = getSymbolOfNode(element).escapedName; + var propertyType = getTypeOfPropertyOfContextualType(type, symbolName_3); if (propertyType) { return propertyType; } @@ -47773,9 +48617,9 @@ var ts; || getIteratedTypeOrElementType(arrayContextualType, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterables*/ false, /*checkAssignability*/ false)); } // In a contextually typed conditional expression, the true/false expressions are contextually typed by the same type. - function getContextualTypeForConditionalOperand(node) { + function getContextualTypeForConditionalOperand(node, contextFlags) { var conditional = node.parent; - return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined; + return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional, contextFlags) : undefined; } function getContextualTypeForChildJsxExpression(node, child) { var attributesType = getApparentTypeOfContextualType(node.openingElement.tagName); @@ -47784,16 +48628,17 @@ var ts; if (!(attributesType && !isTypeAny(attributesType) && jsxChildrenPropertyName && jsxChildrenPropertyName !== "")) { return undefined; } - var childIndex = node.children.indexOf(child); + var realChildren = getSemanticJsxChildren(node.children); + var childIndex = realChildren.indexOf(child); var childFieldType = getTypeOfPropertyOfContextualType(attributesType, jsxChildrenPropertyName); - return childFieldType && mapType(childFieldType, function (t) { + return childFieldType && (realChildren.length === 1 ? childFieldType : mapType(childFieldType, function (t) { if (isArrayLikeType(t)) { return getIndexedAccessType(t, getLiteralType(childIndex)); } else { return t; } - }, /*noReductions*/ true); + }, /*noReductions*/ true)); } function getContextualTypeForJsxExpression(node) { var exprParent = node.parent; @@ -47827,30 +48672,30 @@ var ts; case 8 /* NumericLiteral */: case 9 /* BigIntLiteral */: case 14 /* NoSubstitutionTemplateLiteral */: - case 102 /* TrueKeyword */: - case 87 /* FalseKeyword */: - case 96 /* NullKeyword */: - case 72 /* Identifier */: - case 141 /* UndefinedKeyword */: + case 103 /* TrueKeyword */: + case 88 /* FalseKeyword */: + case 97 /* NullKeyword */: + case 73 /* Identifier */: + case 142 /* UndefinedKeyword */: return true; - case 189 /* PropertyAccessExpression */: - case 195 /* ParenthesizedExpression */: + case 190 /* PropertyAccessExpression */: + case 196 /* ParenthesizedExpression */: return isPossiblyDiscriminantValue(node.expression); - case 270 /* JsxExpression */: + case 271 /* JsxExpression */: return !node.expression || isPossiblyDiscriminantValue(node.expression); } return false; } function discriminateContextualTypeByObjectMembers(node, contextualType) { - return discriminateTypeByDiscriminableItems(contextualType, ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 275 /* PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return checkExpression(prop.initializer); }, prop.symbol.escapedName]; }), isTypeAssignableTo, contextualType); + return discriminateTypeByDiscriminableItems(contextualType, ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 276 /* PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return checkExpression(prop.initializer); }, prop.symbol.escapedName]; }), isTypeAssignableTo, contextualType); } function discriminateContextualTypeByJSXAttributes(node, contextualType) { - return discriminateTypeByDiscriminableItems(contextualType, ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 267 /* JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return checkExpression(prop.initializer); }), prop.symbol.escapedName]; }), isTypeAssignableTo, contextualType); + return discriminateTypeByDiscriminableItems(contextualType, ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 268 /* JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return checkExpression(prop.initializer); }), prop.symbol.escapedName]; }), isTypeAssignableTo, contextualType); } // Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily // be "pushed" onto a node using the contextualType property. - function getApparentTypeOfContextualType(node) { - var contextualType = instantiateContextualType(getContextualType(node), node); + function getApparentTypeOfContextualType(node, contextFlags) { + var contextualType = instantiateContextualType(getContextualType(node, contextFlags), node, contextFlags); if (contextualType) { var apparentType = mapType(contextualType, getApparentType, /*noReductions*/ true); if (apparentType.flags & 1048576 /* Union */) { @@ -47866,11 +48711,22 @@ var ts; } // If the given contextual type contains instantiable types and if a mapper representing // return type inferences is available, instantiate those types using that mapper. - function instantiateContextualType(contextualType, node) { + function instantiateContextualType(contextualType, node, contextFlags) { if (contextualType && maybeTypeOfKind(contextualType, 63176704 /* Instantiable */)) { var inferenceContext = getInferenceContext(node); - if (inferenceContext && inferenceContext.returnMapper) { - return instantiateInstantiableTypes(contextualType, inferenceContext.returnMapper); + // If no inferences have been made, nothing is gained from instantiating as type parameters + // would just be replaced with their defaults similar to the apparent type. + if (inferenceContext && ts.some(inferenceContext.inferences, hasInferenceCandidates)) { + // For contextual signatures we incorporate all inferences made so far, e.g. from return + // types as well as arguments to the left in a function call. + if (contextFlags && contextFlags & 1 /* Signature */) { + return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper); + } + // For other purposes (e.g. determining whether to produce literal types) we only + // incorporate inferences made from the return type in a function call. + if (inferenceContext.returnMapper) { + return instantiateInstantiableTypes(contextualType, inferenceContext.returnMapper); + } } } return contextualType; @@ -47907,7 +48763,7 @@ var ts; * @param node the expression whose contextual type will be returned. * @returns the contextual type of an expression. */ - function getContextualType(node) { + function getContextualType(node, contextFlags) { if (node.flags & 8388608 /* InWithStatement */) { // We cannot answer semantic questions within a with block, do not proceed any further return undefined; @@ -47917,54 +48773,54 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 237 /* VariableDeclaration */: - case 151 /* Parameter */: - case 154 /* PropertyDeclaration */: - case 153 /* PropertySignature */: - case 186 /* BindingElement */: + case 238 /* VariableDeclaration */: + case 152 /* Parameter */: + case 155 /* PropertyDeclaration */: + case 154 /* PropertySignature */: + case 187 /* BindingElement */: return getContextualTypeForInitializerExpression(node); - case 197 /* ArrowFunction */: - case 230 /* ReturnStatement */: + case 198 /* ArrowFunction */: + case 231 /* ReturnStatement */: return getContextualTypeForReturnExpression(node); - case 207 /* YieldExpression */: + case 208 /* YieldExpression */: return getContextualTypeForYieldOperand(parent); - case 201 /* AwaitExpression */: + case 202 /* AwaitExpression */: return getContextualTypeForAwaitOperand(parent); - case 191 /* CallExpression */: - case 192 /* NewExpression */: + case 192 /* CallExpression */: + case 193 /* NewExpression */: return getContextualTypeForArgument(parent, node); - case 194 /* TypeAssertionExpression */: - case 212 /* AsExpression */: + case 195 /* TypeAssertionExpression */: + case 213 /* AsExpression */: return ts.isConstTypeReference(parent.type) ? undefined : getTypeFromTypeNode(parent.type); - case 204 /* BinaryExpression */: - return getContextualTypeForBinaryOperand(node); - case 275 /* PropertyAssignment */: - case 276 /* ShorthandPropertyAssignment */: - return getContextualTypeForObjectLiteralElement(parent); - case 277 /* SpreadAssignment */: - return getApparentTypeOfContextualType(parent.parent); - case 187 /* ArrayLiteralExpression */: { + case 205 /* BinaryExpression */: + return getContextualTypeForBinaryOperand(node, contextFlags); + case 276 /* PropertyAssignment */: + case 277 /* ShorthandPropertyAssignment */: + return getContextualTypeForObjectLiteralElement(parent, contextFlags); + case 278 /* SpreadAssignment */: + return getApparentTypeOfContextualType(parent.parent, contextFlags); + case 188 /* ArrayLiteralExpression */: { var arrayLiteral = parent; - var type = getApparentTypeOfContextualType(arrayLiteral); + var type = getApparentTypeOfContextualType(arrayLiteral, contextFlags); return getContextualTypeForElementExpression(type, ts.indexOfNode(arrayLiteral.elements, node)); } - case 205 /* ConditionalExpression */: - return getContextualTypeForConditionalOperand(node); - case 216 /* TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 206 /* TemplateExpression */); + case 206 /* ConditionalExpression */: + return getContextualTypeForConditionalOperand(node, contextFlags); + case 217 /* TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 207 /* TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 195 /* ParenthesizedExpression */: { + case 196 /* ParenthesizedExpression */: { // Like in `checkParenthesizedExpression`, an `/** @type {xyz} */` comment before a parenthesized expression acts as a type cast. var tag = ts.isInJSFile(parent) ? ts.getJSDocTypeTag(parent) : undefined; - return tag ? getTypeFromTypeNode(tag.typeExpression.type) : getContextualType(parent); + return tag ? getTypeFromTypeNode(tag.typeExpression.type) : getContextualType(parent, contextFlags); } - case 270 /* JsxExpression */: + case 271 /* JsxExpression */: return getContextualTypeForJsxExpression(parent); - case 267 /* JsxAttribute */: - case 269 /* JsxSpreadAttribute */: + case 268 /* JsxAttribute */: + case 270 /* JsxSpreadAttribute */: return getContextualTypeForJsxAttribute(parent); - case 262 /* JsxOpeningElement */: - case 261 /* JsxSelfClosingElement */: + case 263 /* JsxOpeningElement */: + case 262 /* JsxSelfClosingElement */: return getContextualJsxElementAttributesType(parent); } return undefined; @@ -47986,7 +48842,7 @@ var ts; return getJsxReferenceKind(node) !== 0 /* Component */ ? getJsxPropsTypeFromCallSignature(signature, node) : getJsxPropsTypeFromClassType(signature, node); } function getJsxPropsTypeFromCallSignature(sig, context) { - var propsType = getTypeOfFirstParameterOfSignatureWithFallback(sig, emptyObjectType); + var propsType = getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType); propsType = getJsxManagedAttributesFromLocatedAttributes(context, getJsxNamespaceAt(context), propsType); var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); if (intrinsicAttribs !== errorType) { @@ -48057,7 +48913,7 @@ var ts; var forcedLookupLocation = getJsxElementPropertiesName(ns); var attributesType = forcedLookupLocation === undefined // If there is no type ElementAttributesProperty, return the type of the first parameter of the signature, which should be the props type - ? getTypeOfFirstParameterOfSignatureWithFallback(sig, emptyObjectType) + ? getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType) : forcedLookupLocation === "" // If there is no e.g. 'props' member in ElementAttributesProperty, use the element class type instead ? getReturnTypeOfSignature(sig) @@ -48068,7 +48924,7 @@ var ts; if (!!forcedLookupLocation && !!ts.length(context.attributes.properties)) { error(context, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, ts.unescapeLeadingUnderscores(forcedLookupLocation)); } - return emptyObjectType; + return unknownType; } attributesType = getJsxManagedAttributesFromLocatedAttributes(context, ns, attributesType); if (isTypeAny(attributesType)) { @@ -48119,7 +48975,7 @@ var ts; return !hasEffectiveRestParameter(signature) && getParameterCount(signature) < targetParameterCount; } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 196 /* FunctionExpression */ || node.kind === 197 /* ArrowFunction */; + return node.kind === 197 /* FunctionExpression */ || node.kind === 198 /* ArrowFunction */; } function getContextualSignatureForFunctionLikeDeclaration(node) { // Only function expressions, arrow functions, and object literal methods are contextually typed. @@ -48127,23 +48983,20 @@ var ts; ? getContextualSignature(node) : undefined; } - function getContextualTypeForFunctionLikeDeclaration(node) { - return ts.isObjectLiteralMethod(node) ? - getContextualTypeForObjectLiteralMethod(node) : - getApparentTypeOfContextualType(node); - } // Return the contextual signature for a given expression node. A contextual type provides a // contextual signature if it has a single call signature and if that call signature is non-generic. // If the contextual type is a union type, get the signature from each type possible and if they are // all identical ignoring their return type, the result is same signature but with return type as // union type of return types from these signatures function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 156 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 157 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var typeTagSignature = getSignatureOfTypeTag(node); if (typeTagSignature) { return typeTagSignature; } - var type = getContextualTypeForFunctionLikeDeclaration(node); + var type = ts.isObjectLiteralMethod(node) ? + getContextualTypeForObjectLiteralMethod(node, 1 /* Signature */) : + getApparentTypeOfContextualType(node, 1 /* Signature */); if (!type) { return undefined; } @@ -48152,8 +49005,8 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { - var current = types_15[_i]; + for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { + var current = types_14[_i]; var signature = getContextualCallSignature(current, node); if (signature) { if (!signatureList) { @@ -48181,8 +49034,8 @@ var ts; return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false, /*allowAsyncIterables*/ false); } function hasDefaultValue(node) { - return (node.kind === 186 /* BindingElement */ && !!node.initializer) || - (node.kind === 204 /* BinaryExpression */ && node.operatorToken.kind === 59 /* EqualsToken */); + return (node.kind === 187 /* BindingElement */ && !!node.initializer) || + (node.kind === 205 /* BinaryExpression */ && node.operatorToken.kind === 60 /* EqualsToken */); } function checkArrayLiteral(node, checkMode, forceTuple) { var elements = node.elements; @@ -48194,7 +49047,7 @@ var ts; var inConstContext = isConstContext(node); for (var index = 0; index < elementCount; index++) { var e = elements[index]; - if (inDestructuringPattern && e.kind === 208 /* SpreadElement */) { + if (inDestructuringPattern && e.kind === 209 /* SpreadElement */) { // Given the following situation: // var c: {}; // [...c] = ["", 0]; @@ -48219,12 +49072,12 @@ var ts; var type = checkExpressionForMutableLocation(e, checkMode, elementContextualType, forceTuple); elementTypes.push(type); } - if (index < elementCount - 1 && e.kind === 208 /* SpreadElement */) { + if (index < elementCount - 1 && e.kind === 209 /* SpreadElement */) { hasNonEndingSpreadElement = true; } } if (!hasNonEndingSpreadElement) { - var hasRestElement = elementCount > 0 && elements[elementCount - 1].kind === 208 /* SpreadElement */; + var hasRestElement = elementCount > 0 && elements[elementCount - 1].kind === 209 /* SpreadElement */; var minLength = elementCount - (hasRestElement ? 1 : 0); // If array literal is actually a destructuring pattern, mark it as an implied type. We do this such // that we get the same behavior for "var [x, y] = []" and "[x, y] = []". @@ -48254,15 +49107,15 @@ var ts; var pattern = contextualType && contextualType.pattern; // If array literal is contextually typed by a binding pattern or an assignment pattern, pad the resulting // tuple type with the corresponding binding or assignment element types to make the lengths equal. - if (!hasRestElement && pattern && (pattern.kind === 185 /* ArrayBindingPattern */ || pattern.kind === 187 /* ArrayLiteralExpression */)) { + if (!hasRestElement && pattern && (pattern.kind === 186 /* ArrayBindingPattern */ || pattern.kind === 188 /* ArrayLiteralExpression */)) { var patternElements = pattern.elements; for (var i = elementCount; i < patternElements.length; i++) { var e = patternElements[i]; if (hasDefaultValue(e)) { elementTypes.push(contextualType.typeArguments[i]); } - else if (i < patternElements.length - 1 || !(e.kind === 186 /* BindingElement */ && e.dotDotDotToken || e.kind === 208 /* SpreadElement */)) { - if (e.kind !== 210 /* OmittedExpression */) { + else if (i < patternElements.length - 1 || !(e.kind === 187 /* BindingElement */ && e.dotDotDotToken || e.kind === 209 /* SpreadElement */)) { + if (e.kind !== 211 /* OmittedExpression */) { error(e, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } elementTypes.push(strictNullChecks ? implicitNeverType : undefinedWideningType); @@ -48274,9 +49127,9 @@ var ts; } function isNumericName(name) { switch (name.kind) { - case 149 /* ComputedPropertyName */: + case 150 /* ComputedPropertyName */: return isNumericComputedName(name); - case 72 /* Identifier */: + case 73 /* Identifier */: return isNumericLiteralName(name.escapedText); case 8 /* NumericLiteral */: case 10 /* StringLiteral */: @@ -48364,7 +49217,7 @@ var ts; var spread = emptyObjectType; var contextualType = getApparentTypeOfContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 184 /* ObjectBindingPattern */ || contextualType.pattern.kind === 188 /* ObjectLiteralExpression */); + (contextualType.pattern.kind === 185 /* ObjectBindingPattern */ || contextualType.pattern.kind === 189 /* ObjectLiteralExpression */); var inConstContext = isConstContext(node); var checkFlags = inConstContext ? 8 /* Readonly */ : 0; var isInJavascript = ts.isInJSFile(node) && !ts.isInJsonFile(node); @@ -48379,13 +49232,13 @@ var ts; for (var i = 0; i < node.properties.length; i++) { var memberDecl = node.properties[i]; var member = getSymbolOfNode(memberDecl); - var computedNameType = memberDecl.name && memberDecl.name.kind === 149 /* ComputedPropertyName */ && !ts.isWellKnownSymbolSyntactically(memberDecl.name.expression) ? + var computedNameType = memberDecl.name && memberDecl.name.kind === 150 /* ComputedPropertyName */ && !ts.isWellKnownSymbolSyntactically(memberDecl.name.expression) ? checkComputedPropertyName(memberDecl.name) : undefined; - if (memberDecl.kind === 275 /* PropertyAssignment */ || - memberDecl.kind === 276 /* ShorthandPropertyAssignment */ || + if (memberDecl.kind === 276 /* PropertyAssignment */ || + memberDecl.kind === 277 /* ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { - var type = memberDecl.kind === 275 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : - memberDecl.kind === 276 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(memberDecl.name, checkMode) : + var type = memberDecl.kind === 276 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : + memberDecl.kind === 277 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode); if (isInJavascript) { var jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl); @@ -48400,7 +49253,7 @@ var ts; objectFlags |= ts.getObjectFlags(type) & 917504 /* PropagatingFlags */; var nameType = computedNameType && isTypeUsableAsPropertyName(computedNameType) ? computedNameType : undefined; var prop = nameType ? - createSymbol(4 /* Property */ | member.flags, getPropertyNameFromType(nameType), checkFlags | 2048 /* Late */) : + createSymbol(4 /* Property */ | member.flags, getPropertyNameFromType(nameType), checkFlags | 4096 /* Late */) : createSymbol(4 /* Property */ | member.flags, member.escapedName, checkFlags); if (nameType) { prop.nameType = nameType; @@ -48408,8 +49261,8 @@ var ts; if (inDestructuringPattern) { // If object literal is an assignment pattern and if the assignment pattern specifies a default value // for the property, make the property optional. - var isOptional = (memberDecl.kind === 275 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 276 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 276 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 277 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 16777216 /* Optional */; } @@ -48434,7 +49287,7 @@ var ts; prop.target = member; member = prop; } - else if (memberDecl.kind === 277 /* SpreadAssignment */) { + else if (memberDecl.kind === 278 /* SpreadAssignment */) { if (languageVersion < 2 /* ES2015 */) { checkExternalEmitHelpers(memberDecl, 2 /* Assign */); } @@ -48460,7 +49313,7 @@ var ts; // an ordinary function declaration(section 6.1) with no parameters. // A set accessor declaration is processed in the same manner // as an ordinary function declaration with a single parameter and a Void return type. - ts.Debug.assert(memberDecl.kind === 158 /* GetAccessor */ || memberDecl.kind === 159 /* SetAccessor */); + ts.Debug.assert(memberDecl.kind === 159 /* GetAccessor */ || memberDecl.kind === 160 /* SetAccessor */); checkNodeDeferred(memberDecl); } if (computedNameType && !(computedNameType.flags & 8576 /* StringOrNumberLiteralOrUnique */)) { @@ -48568,7 +49421,7 @@ var ts; * Returns true iff React would emit this tag name as a string rather than an identifier or qualified name */ function isJsxIntrinsicIdentifier(tagName) { - return tagName.kind === 72 /* Identifier */ && ts.isIntrinsicJsxName(tagName.escapedText); + return tagName.kind === 73 /* Identifier */ && ts.isIntrinsicJsxName(tagName.escapedText); } function checkJsxAttribute(node, checkMode) { return node.initializer @@ -48613,7 +49466,7 @@ var ts; } } else { - ts.Debug.assert(attributeDecl.kind === 269 /* JsxSpreadAttribute */); + ts.Debug.assert(attributeDecl.kind === 270 /* JsxSpreadAttribute */); if (attributesTable.size > 0) { spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, objectFlags, /*readonly*/ false); attributesTable = ts.createSymbolTable(); @@ -48636,7 +49489,7 @@ var ts; } } // Handle children attribute - var parent = openingLikeElement.parent.kind === 260 /* JsxElement */ ? openingLikeElement.parent : undefined; + var parent = openingLikeElement.parent.kind === 261 /* JsxElement */ ? openingLikeElement.parent : undefined; // We have to check that openingElement of the parent is the one we are visiting as this may not be true for selfClosingElement if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) { var childrenTypes = checkJsxChildren(parent, checkMode); @@ -49054,8 +49907,8 @@ var ts; */ function checkPropertyAccessibility(node, isSuper, type, prop) { var flags = ts.getDeclarationModifierFlagsFromSymbol(prop); - var errorNode = node.kind === 148 /* QualifiedName */ ? node.right : node.kind === 183 /* ImportType */ ? node : node.name; - if (ts.getCheckFlags(prop) & 512 /* ContainsPrivate */) { + var errorNode = node.kind === 149 /* QualifiedName */ ? node.right : node.kind === 184 /* ImportType */ ? node : node.name; + if (ts.getCheckFlags(prop) & 1024 /* ContainsPrivate */) { // Synthetic property with private constituent property error(errorNode, ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(prop), typeToString(type)); return false; @@ -49160,7 +50013,7 @@ var ts; return type; } function checkNonNullType(type, node, nullDiagnostic, undefinedDiagnostic, nullOrUndefinedDiagnostic) { - if (type.flags & 2 /* Unknown */) { + if (strictNullChecks && type.flags & 2 /* Unknown */) { error(node, ts.Diagnostics.Object_is_of_type_unknown); return errorType; } @@ -49175,6 +50028,13 @@ var ts; } return type; } + function checkNonNullNonVoidType(type, node) { + var nonNullType = checkNonNullType(type, node); + if (nonNullType !== errorType && nonNullType.flags & 16384 /* Void */) { + error(node, ts.Diagnostics.Object_is_possibly_undefined); + } + return nonNullType; + } function checkPropertyAccessExpression(node) { return checkPropertyAccessExpressionOrQualifiedName(node, node.expression, node.name); } @@ -49198,7 +50058,7 @@ var ts; markAliasReferenced(parentSymbol, node); } if (!prop) { - var indexInfo = getIndexInfoOfType(apparentType, 0 /* String */); + var indexInfo = assignmentKind === 0 /* None */ || !isGenericObjectType(leftType) ? getIndexInfoOfType(apparentType, 0 /* String */) : undefined; if (!(indexInfo && indexInfo.type)) { if (isJSLiteralType(leftType)) { return anyType; @@ -49213,7 +50073,7 @@ var ts; return anyType; } if (right.escapedText && !checkAndReportErrorForExtendingInterface(node)) { - reportNonexistentProperty(right, leftType.flags & 262144 /* TypeParameter */ && leftType.isThisType ? apparentType : leftType); + reportNonexistentProperty(right, isThisTypeParameter(leftType) ? apparentType : leftType); } return errorType; } @@ -49224,9 +50084,9 @@ var ts; } else { checkPropertyNotUsedBeforeDeclaration(prop, node, right); - markPropertyAsReferenced(prop, node, left.kind === 100 /* ThisKeyword */); + markPropertyAsReferenced(prop, node, left.kind === 101 /* ThisKeyword */); getNodeLinks(node).resolvedSymbol = prop; - checkPropertyAccessibility(node, left.kind === 98 /* SuperKeyword */, apparentType, prop); + checkPropertyAccessibility(node, left.kind === 99 /* SuperKeyword */, apparentType, prop); if (assignmentKind) { if (isReferenceToReadonlyEntity(node, prop) || isReferenceThroughNamespaceImport(node)) { error(right, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, ts.idText(right)); @@ -49238,7 +50098,7 @@ var ts; // Only compute control flow type if this is a property access expression that isn't an // assignment target, and the referenced property was declared as a variable, property, // accessor, or optional method. - if (node.kind !== 189 /* PropertyAccessExpression */ || + if (node.kind !== 190 /* PropertyAccessExpression */ || assignmentKind === 1 /* Definite */ || prop && !(prop.flags & (3 /* Variable */ | 4 /* Property */ | 98304 /* Accessor */)) && !(prop.flags & 8192 /* Method */ && propType.flags & 1048576 /* Union */)) { return propType; @@ -49248,11 +50108,11 @@ var ts; // and if we are in a constructor of the same class as the property declaration, assume that // the property is uninitialized at the top of the control flow. var assumeUninitialized = false; - if (strictNullChecks && strictPropertyInitialization && left.kind === 100 /* ThisKeyword */) { + if (strictNullChecks && strictPropertyInitialization && left.kind === 101 /* ThisKeyword */) { var declaration = prop && prop.valueDeclaration; if (declaration && isInstancePropertyWithoutInitializer(declaration)) { var flowContainer = getControlFlowContainer(node); - if (flowContainer.kind === 157 /* Constructor */ && flowContainer.parent === declaration.parent) { + if (flowContainer.kind === 158 /* Constructor */ && flowContainer.parent === declaration.parent) { assumeUninitialized = true; } } @@ -49283,8 +50143,8 @@ var ts; && !isPropertyDeclaredInAncestorClass(prop)) { diagnosticMessage = error(right, ts.Diagnostics.Property_0_is_used_before_its_initialization, declarationName); } - else if (valueDeclaration.kind === 240 /* ClassDeclaration */ && - node.parent.kind !== 164 /* TypeReference */ && + else if (valueDeclaration.kind === 241 /* ClassDeclaration */ && + node.parent.kind !== 165 /* TypeReference */ && !(valueDeclaration.flags & 4194304 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) { diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName); @@ -49296,22 +50156,22 @@ var ts; function isInPropertyInitializer(node) { return !!ts.findAncestor(node, function (node) { switch (node.kind) { - case 154 /* PropertyDeclaration */: + case 155 /* PropertyDeclaration */: return true; - case 275 /* PropertyAssignment */: - case 156 /* MethodDeclaration */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 277 /* SpreadAssignment */: - case 149 /* ComputedPropertyName */: - case 216 /* TemplateSpan */: - case 270 /* JsxExpression */: - case 267 /* JsxAttribute */: - case 268 /* JsxAttributes */: - case 269 /* JsxSpreadAttribute */: - case 262 /* JsxOpeningElement */: - case 211 /* ExpressionWithTypeArguments */: - case 273 /* HeritageClause */: + case 276 /* PropertyAssignment */: + case 157 /* MethodDeclaration */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 278 /* SpreadAssignment */: + case 150 /* ComputedPropertyName */: + case 217 /* TemplateSpan */: + case 271 /* JsxExpression */: + case 268 /* JsxAttribute */: + case 269 /* JsxAttributes */: + case 270 /* JsxSpreadAttribute */: + case 263 /* JsxOpeningElement */: + case 212 /* ExpressionWithTypeArguments */: + case 274 /* HeritageClause */: return false; default: return ts.isExpressionNode(node) ? false : "quit"; @@ -49417,6 +50277,32 @@ var ts; var suggestion = getSuggestedSymbolForNonexistentModule(name, targetModule); return suggestion && ts.symbolName(suggestion); } + function getSuggestionForNonexistentIndexSignature(objectType, expr) { + // check if object type has setter or getter + var hasProp = function (name, argCount) { + if (argCount === void 0) { argCount = 1; } + var prop = getPropertyOfObjectType(objectType, name); + if (prop) { + var s = getSingleCallSignature(getTypeOfSymbol(prop)); + if (s && getMinArgumentCount(s) === argCount && typeToString(getTypeAtPosition(s, 0)) === "string") { + return true; + } + } + return false; + }; + var suggestedMethod = ts.isAssignmentTarget(expr) ? "set" : "get"; + if (!hasProp(suggestedMethod)) { + return undefined; + } + var suggestion = ts.tryGetPropertyAccessOrIdentifierToString(expr); + if (suggestion === undefined) { + suggestion = suggestedMethod; + } + else { + suggestion += "." + suggestedMethod; + } + return suggestion; + } /** * Given a name and a list of symbols whose names are *not* equal to the name, return a spelling suggestion if there is one that is close enough. * Names less than length 3 only check for case-insensitive equality, not levenshtein distance. @@ -49457,34 +50343,17 @@ var ts; } function isValidPropertyAccess(node, propertyName) { switch (node.kind) { - case 189 /* PropertyAccessExpression */: - return isValidPropertyAccessWithType(node, node.expression.kind === 98 /* SuperKeyword */, propertyName, getWidenedType(checkExpression(node.expression))); - case 148 /* QualifiedName */: + case 190 /* PropertyAccessExpression */: + return isValidPropertyAccessWithType(node, node.expression.kind === 99 /* SuperKeyword */, propertyName, getWidenedType(checkExpression(node.expression))); + case 149 /* QualifiedName */: return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getWidenedType(checkExpression(node.left))); - case 183 /* ImportType */: + case 184 /* ImportType */: return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getTypeFromTypeNode(node)); } } function isValidPropertyAccessForCompletions(node, type, property) { - return isValidPropertyAccessWithType(node, node.kind === 189 /* PropertyAccessExpression */ && node.expression.kind === 98 /* SuperKeyword */, property.escapedName, type) - && (!(property.flags & 8192 /* Method */) || isValidMethodAccess(property, type)); - } - function isValidMethodAccess(method, actualThisType) { - var propType = getTypeOfPropertyOfType(actualThisType, method.escapedName); - var signatures = getSignaturesOfType(getNonNullableType(propType), 0 /* Call */); - ts.Debug.assert(signatures.length !== 0); - return signatures.some(function (sig) { - var signatureThisType = getThisTypeOfSignature(sig); - return !signatureThisType || isTypeAssignableTo(actualThisType, getInstantiatedSignatureThisType(sig, signatureThisType, actualThisType)); - }); - } - function getInstantiatedSignatureThisType(sig, signatureThisType, actualThisType) { - if (!sig.typeParameters) { - return signatureThisType; - } - var context = createInferenceContext(sig.typeParameters, sig, 0 /* None */); - inferTypes(context.inferences, actualThisType, signatureThisType); - return instantiateType(signatureThisType, createSignatureTypeMapper(sig, getInferredTypes(context))); + return isValidPropertyAccessWithType(node, node.kind === 190 /* PropertyAccessExpression */ && node.expression.kind === 99 /* SuperKeyword */, property.escapedName, type); + // Previously we validated the 'this' type of methods but this adversely affected performance. See #31377 for more context. } function isValidPropertyAccessWithType(node, isSuper, propertyName, type) { if (type === errorType || isTypeAny(type)) { @@ -49500,13 +50369,13 @@ var ts; */ function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 238 /* VariableDeclarationList */) { + if (initializer.kind === 239 /* VariableDeclarationList */) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); } } - else if (initializer.kind === 72 /* Identifier */) { + else if (initializer.kind === 73 /* Identifier */) { return getResolvedSymbol(initializer); } return undefined; @@ -49523,13 +50392,13 @@ var ts; */ function isForInVariableForNumericPropertyNames(expr) { var e = ts.skipParentheses(expr); - if (e.kind === 72 /* Identifier */) { + if (e.kind === 73 /* Identifier */) { var symbol = getResolvedSymbol(e); if (symbol.flags & 3 /* Variable */) { var child = expr; var node = expr.parent; while (node) { - if (node.kind === 226 /* ForInStatement */ && + if (node.kind === 227 /* ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -49547,7 +50416,7 @@ var ts; var indexExpression = node.argumentExpression; if (!indexExpression) { var sourceFile = ts.getSourceFileOfNode(node); - if (node.parent.kind === 192 /* NewExpression */ && node.parent.expression === node) { + if (node.parent.kind === 193 /* NewExpression */ && node.parent.expression === node) { var start = ts.skipTrivia(sourceFile.text, node.expression.end); var end = node.end; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); @@ -49567,7 +50436,12 @@ var ts; error(indexExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return errorType; } - return checkIndexedAccessIndexType(getIndexedAccessType(objectType, isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType, node), node); + var effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType; + var accessFlags = ts.isAssignmentTarget(node) ? + 2 /* Writing */ | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 1 /* NoIndexSignatures */ : 0) : + 0 /* None */; + var indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, node, accessFlags) || errorType; + return checkIndexedAccessIndexType(indexedAccessType, node); } function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) { if (expressionType === errorType) { @@ -49613,13 +50487,13 @@ var ts; // This gets us diagnostics for the type arguments and marks them as referenced. ts.forEach(node.typeArguments, checkSourceElement); } - if (node.kind === 193 /* TaggedTemplateExpression */) { + if (node.kind === 194 /* TaggedTemplateExpression */) { checkExpression(node.template); } else if (ts.isJsxOpeningLikeElement(node)) { checkExpression(node.attributes); } - else if (node.kind !== 152 /* Decorator */) { + else if (node.kind !== 153 /* Decorator */) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -49683,7 +50557,7 @@ var ts; } } function isSpreadArgument(arg) { - return !!arg && (arg.kind === 208 /* SpreadElement */ || arg.kind === 215 /* SyntheticExpression */ && arg.isSpread); + return !!arg && (arg.kind === 209 /* SpreadElement */ || arg.kind === 216 /* SyntheticExpression */ && arg.isSpread); } function getSpreadArgumentIndex(args) { return ts.findIndex(args, isSpreadArgument); @@ -49697,9 +50571,9 @@ var ts; var callIsIncomplete = false; // In incomplete call we want to be lenient when we have too few arguments var effectiveParameterCount = getParameterCount(signature); var effectiveMinimumArguments = getMinArgumentCount(signature); - if (node.kind === 193 /* TaggedTemplateExpression */) { + if (node.kind === 194 /* TaggedTemplateExpression */) { argCount = args.length; - if (node.template.kind === 206 /* TemplateExpression */) { + if (node.template.kind === 207 /* TemplateExpression */) { // If a tagged template expression lacks a tail literal, the call is incomplete. // Specifically, a template only can end in a TemplateTail or a Missing literal. var lastSpan = ts.last(node.template.templateSpans); // we should always have at least one span. @@ -49714,7 +50588,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 152 /* Decorator */) { + else if (node.kind === 153 /* Decorator */) { argCount = getDecoratorArgumentCount(node, signature); } else if (ts.isJsxOpeningLikeElement(node)) { @@ -49729,7 +50603,7 @@ var ts; else { if (!node.arguments) { // This only happens when we have something of the form: 'new C' - ts.Debug.assert(node.kind === 192 /* NewExpression */); + ts.Debug.assert(node.kind === 193 /* NewExpression */); return getMinArgumentCount(signature) === 0; } argCount = signatureHelpTrailingComma ? args.length + 1 : args.length; @@ -49768,11 +50642,22 @@ var ts; } // If type has a single call signature and no other members, return that signature. Otherwise, return undefined. function getSingleCallSignature(type) { + return getSingleSignature(type, 0 /* Call */, /*allowMembers*/ false); + } + function getSingleCallOrConstructSignature(type) { + return getSingleSignature(type, 0 /* Call */, /*allowMembers*/ false) || + getSingleSignature(type, 1 /* Construct */, /*allowMembers*/ false); + } + function getSingleSignature(type, kind, allowMembers) { if (type.flags & 524288 /* Object */) { var resolved = resolveStructuredTypeMembers(type); - if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && - resolved.properties.length === 0 && !resolved.stringIndexInfo && !resolved.numberIndexInfo) { - return resolved.callSignatures[0]; + if (allowMembers || resolved.properties.length === 0 && !resolved.stringIndexInfo && !resolved.numberIndexInfo) { + if (kind === 0 /* Call */ && resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0) { + return resolved.callSignatures[0]; + } + if (kind === 1 /* Construct */ && resolved.constructSignatures.length === 1 && resolved.callSignatures.length === 0) { + return resolved.constructSignatures[0]; + } } } return undefined; @@ -49792,7 +50677,7 @@ var ts; }); if (!inferenceContext) { applyToReturnTypes(contextualSignature, signature, function (source, target) { - inferTypes(context.inferences, source, target, 8 /* ReturnType */); + inferTypes(context.inferences, source, target, 16 /* ReturnType */); }); } return getSignatureInstantiation(signature, getInferredTypes(context), ts.isInJSFile(contextualSignature.declaration)); @@ -49811,7 +50696,7 @@ var ts; // example, given a 'function wrap(cb: (x: T) => U): (x: T) => U' and a call expression // 'let f: (x: string) => number = wrap(s => s.length)', we infer from the declared type of 'f' to the // return type of 'wrap'. - if (node.kind !== 152 /* Decorator */) { + if (node.kind !== 153 /* Decorator */) { var contextualType = getContextualType(node); if (contextualType) { // We clone the inference context to avoid disturbing a resolution in progress for an @@ -49832,7 +50717,7 @@ var ts; instantiatedType; var inferenceTargetType = getReturnTypeOfSignature(signature); // Inferences made from return types have lower priority than all other inferences. - inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 8 /* ReturnType */); + inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 16 /* ReturnType */); // Create a type mapper for instantiating generic contextual types using the inferences made // from the return type. context.returnMapper = getMapperFromContext(cloneInferredPartOfContext(context)); @@ -49848,7 +50733,7 @@ var ts; var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length; for (var i = 0; i < argCount; i++) { var arg = args[i]; - if (arg.kind !== 210 /* OmittedExpression */) { + if (arg.kind !== 211 /* OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode); inferTypes(context.inferences, argType, paramType); @@ -49862,7 +50747,7 @@ var ts; } function getArrayifiedType(type) { if (forEachType(type, function (t) { return !(t.flags & (1 /* Any */ | 63176704 /* Instantiable */) || isArrayType(t) || isTupleType(t)); })) { - return createArrayType(getIndexTypeOfType(type, 1 /* Number */) || errorType); + return createArrayType(getIndexedAccessType(type, numberType)); } return type; } @@ -49872,20 +50757,20 @@ var ts; if (isSpreadArgument(arg)) { // We are inferring from a spread expression in the last argument position, i.e. both the parameter // and the argument are ...x forms. - return arg.kind === 215 /* SyntheticExpression */ ? + return arg.kind === 216 /* SyntheticExpression */ ? createArrayType(arg.type) : getArrayifiedType(checkExpressionWithContextualType(arg.expression, restType, context, 0 /* Normal */)); } } - var contextualType = getIndexTypeOfType(restType, 1 /* Number */) || anyType; - var hasPrimitiveContextualType = maybeTypeOfKind(contextualType, 131068 /* Primitive */ | 4194304 /* Index */); var types = []; var spreadIndex = -1; for (var i = index; i < argCount; i++) { + var contextualType = getIndexedAccessType(restType, getLiteralType(i - index)); var argType = checkExpressionWithContextualType(args[i], contextualType, context, 0 /* Normal */); if (spreadIndex < 0 && isSpreadArgument(args[i])) { spreadIndex = i - index; } + var hasPrimitiveContextualType = maybeTypeOfKind(contextualType, 131068 /* Primitive */ | 4194304 /* Index */); types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType)); } return spreadIndex < 0 ? @@ -49946,7 +50831,7 @@ var ts; return checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors); } var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 192 /* NewExpression */) { + if (thisType && thisType !== voidType && node.kind !== 193 /* NewExpression */) { // If the called expression is not of the form `x.f` or `x["f"]`, then sourceType = voidType // If the signature's 'this' type is voidType, then the check is skipped -- anything is compatible. // If the expression is a new expression, then the check is skipped. @@ -49963,7 +50848,7 @@ var ts; var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length; for (var i = 0; i < argCount; i++) { var arg = args[i]; - if (arg.kind !== 210 /* OmittedExpression */) { + if (arg.kind !== 211 /* OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = checkExpressionWithContextualType(arg, paramType, /*inferenceContext*/ undefined, checkMode); // If one or more arguments are still excluded (as indicated by CheckMode.SkipContextSensitive), @@ -49986,15 +50871,15 @@ var ts; * Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise. */ function getThisArgumentOfCall(node) { - if (node.kind === 191 /* CallExpression */) { + if (node.kind === 192 /* CallExpression */) { var callee = ts.skipOuterExpressions(node.expression); - if (callee.kind === 189 /* PropertyAccessExpression */ || callee.kind === 190 /* ElementAccessExpression */) { + if (callee.kind === 190 /* PropertyAccessExpression */ || callee.kind === 191 /* ElementAccessExpression */) { return callee.expression; } } } function createSyntheticExpression(parent, type, isSpread) { - var result = ts.createNode(215 /* SyntheticExpression */, parent.pos, parent.end); + var result = ts.createNode(216 /* SyntheticExpression */, parent.pos, parent.end); result.parent = parent; result.type = type; result.isSpread = isSpread || false; @@ -50004,17 +50889,17 @@ var ts; * Returns the effective arguments for an expression that works like a function invocation. */ function getEffectiveCallArguments(node) { - if (node.kind === 193 /* TaggedTemplateExpression */) { + if (node.kind === 194 /* TaggedTemplateExpression */) { var template = node.template; - var args_4 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())]; - if (template.kind === 206 /* TemplateExpression */) { + var args_3 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())]; + if (template.kind === 207 /* TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { - args_4.push(span.expression); + args_3.push(span.expression); }); } - return args_4; + return args_3; } - if (node.kind === 152 /* Decorator */) { + if (node.kind === 153 /* Decorator */) { return getEffectiveDecoratorArguments(node); } if (ts.isJsxOpeningLikeElement(node)) { @@ -50027,7 +50912,7 @@ var ts; // of the argument is a tuple type, spread the tuple elements into the argument list. We can // call checkExpressionCached because spread expressions never have a contextual type. var spreadArgument_1 = args[length - 1]; - var type = checkExpressionCached(spreadArgument_1.expression); + var type = flowLoopCount ? checkExpression(spreadArgument_1.expression) : checkExpressionCached(spreadArgument_1.expression); if (isTupleType(type)) { var typeArguments = type.typeArguments || ts.emptyArray; var restIndex_2 = type.target.hasRestElement ? typeArguments.length - 1 : -1; @@ -50044,30 +50929,30 @@ var ts; var parent = node.parent; var expr = node.expression; switch (parent.kind) { - case 240 /* ClassDeclaration */: - case 209 /* ClassExpression */: + case 241 /* ClassDeclaration */: + case 210 /* ClassExpression */: // For a class decorator, the `target` is the type of the class (e.g. the // "static" or "constructor" side of the class). return [ createSyntheticExpression(expr, getTypeOfSymbol(getSymbolOfNode(parent))) ]; - case 151 /* Parameter */: + case 152 /* Parameter */: // A parameter declaration decorator will have three arguments (see // `ParameterDecorator` in core.d.ts). var func = parent.parent; return [ - createSyntheticExpression(expr, parent.parent.kind === 157 /* Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), + createSyntheticExpression(expr, parent.parent.kind === 158 /* Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), createSyntheticExpression(expr, anyType), createSyntheticExpression(expr, numberType) ]; - case 154 /* PropertyDeclaration */: - case 156 /* MethodDeclaration */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 155 /* PropertyDeclaration */: + case 157 /* MethodDeclaration */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: // A method or accessor declaration decorator will have two or three arguments (see // `PropertyDecorator` and `MethodDecorator` in core.d.ts). If we are emitting decorators // for ES3, we will only pass two arguments. - var hasPropDesc = parent.kind !== 154 /* PropertyDeclaration */ && languageVersion !== 0 /* ES3 */; + var hasPropDesc = parent.kind !== 155 /* PropertyDeclaration */ && languageVersion !== 0 /* ES3 */; return [ createSyntheticExpression(expr, getParentTypeOfClassElement(parent)), createSyntheticExpression(expr, getClassElementPropertyKeyType(parent)), @@ -50081,17 +50966,17 @@ var ts; */ function getDecoratorArgumentCount(node, signature) { switch (node.parent.kind) { - case 240 /* ClassDeclaration */: - case 209 /* ClassExpression */: + case 241 /* ClassDeclaration */: + case 210 /* ClassExpression */: return 1; - case 154 /* PropertyDeclaration */: + case 155 /* PropertyDeclaration */: return 2; - case 156 /* MethodDeclaration */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 157 /* MethodDeclaration */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: // For ES3 or decorators with only two parameters we supply only two arguments return languageVersion === 0 /* ES3 */ || signature.parameters.length <= 2 ? 2 : 3; - case 151 /* Parameter */: + case 152 /* Parameter */: return 3; default: return ts.Debug.fail(); @@ -50148,7 +51033,7 @@ var ts; spanArray = ts.createNodeArray(args); if (hasSpreadArgument && argCount) { var nextArg = ts.elementAt(args, getSpreadArgumentIndex(args) + 1) || undefined; - spanArray = ts.createNodeArray(args.slice(max > argCount && nextArg ? args.indexOf(nextArg) : max)); + spanArray = ts.createNodeArray(args.slice(max > argCount && nextArg ? args.indexOf(nextArg) : Math.min(max, args.length - 1))); } } else { @@ -50191,15 +51076,15 @@ var ts; return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount); } function resolveCall(node, signatures, candidatesOutArray, checkMode, fallbackError) { - var isTaggedTemplate = node.kind === 193 /* TaggedTemplateExpression */; - var isDecorator = node.kind === 152 /* Decorator */; + var isTaggedTemplate = node.kind === 194 /* TaggedTemplateExpression */; + var isDecorator = node.kind === 153 /* Decorator */; var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node); var reportErrors = !candidatesOutArray; var typeArguments; if (!isDecorator) { typeArguments = node.typeArguments; // We already perform checking on the type arguments on the class declaration itself. - if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 98 /* SuperKeyword */) { + if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 99 /* SuperKeyword */) { ts.forEach(typeArguments, checkSourceElement); } } @@ -50254,7 +51139,7 @@ var ts; var result; // If we are in signature help, a trailing comma indicates that we intend to provide another argument, // so we will only accept overloads with arity at least 1 higher than the current number of provided arguments. - var signatureHelpTrailingComma = !!(checkMode & 16 /* IsForSignatureHelp */) && node.kind === 191 /* CallExpression */ && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = !!(checkMode & 16 /* IsForSignatureHelp */) && node.kind === 192 /* CallExpression */ && node.arguments.hasTrailingComma; // Section 4.12.1: // if the candidate list contains one or more signatures for which the type of each argument // expression is a subtype of each corresponding parameter type, the return type of the first @@ -50405,7 +51290,7 @@ var ts; } var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max; var parameters = []; - var _loop_8 = function (i) { + var _loop_11 = function (i) { var symbols = ts.mapDefined(candidates, function (_a) { var parameters = _a.parameters, hasRestParameter = _a.hasRestParameter; return hasRestParameter ? @@ -50416,7 +51301,7 @@ var ts; parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); }))); }; for (var i = 0; i < maxNonRestParam; i++) { - _loop_8(i); + _loop_11(i); } var restParameterSymbols = ts.mapDefined(candidates, function (c) { return c.hasRestParameter ? ts.last(c.parameters) : undefined; }); var hasRestParameter = restParameterSymbols.length !== 0; @@ -50494,7 +51379,7 @@ var ts; return maxParamsIndex; } function resolveCallExpression(node, candidatesOutArray, checkMode) { - if (node.expression.kind === 98 /* SuperKeyword */) { + if (node.expression.kind === 99 /* SuperKeyword */) { var superType = checkSuperExpression(node.expression); if (isTypeAny(superType)) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { @@ -50569,7 +51454,7 @@ var ts; // returns a function type, we choose to defer processing. This narrowly permits function composition // operators to flow inferences through return types, but otherwise processes calls right away. We // use the resolvingSignature singleton to indicate that we deferred processing. This result will be - // propagated out and eventually turned into silentNeverType (a type that is assignable to anything and + // propagated out and eventually turned into nonInferrableType (a type that is assignable to anything and // from which we never make inferences). if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunction)) { skippedGenericFunction(node, checkMode); @@ -50771,16 +51656,16 @@ var ts; */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 240 /* ClassDeclaration */: - case 209 /* ClassExpression */: + case 241 /* ClassDeclaration */: + case 210 /* ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 151 /* Parameter */: + case 152 /* Parameter */: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 154 /* PropertyDeclaration */: + case 155 /* PropertyDeclaration */: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 156 /* MethodDeclaration */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 157 /* MethodDeclaration */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; default: return ts.Debug.fail(); @@ -50823,7 +51708,7 @@ var ts; // file would probably be preferable. var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 67897832 /* Type */); var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 67897832 /* Type */, node); - var declaration = ts.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.createKeywordTypeNode(120 /* AnyKeyword */)); + var declaration = ts.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.createKeywordTypeNode(121 /* AnyKeyword */)); var parameterSymbol = createSymbol(1 /* FunctionScopedVariable */, "props"); parameterSymbol.type = result; return createSignature(declaration, @@ -50870,16 +51755,16 @@ var ts; } function resolveSignature(node, candidatesOutArray, checkMode) { switch (node.kind) { - case 191 /* CallExpression */: + case 192 /* CallExpression */: return resolveCallExpression(node, candidatesOutArray, checkMode); - case 192 /* NewExpression */: + case 193 /* NewExpression */: return resolveNewExpression(node, candidatesOutArray, checkMode); - case 193 /* TaggedTemplateExpression */: + case 194 /* TaggedTemplateExpression */: return resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode); - case 152 /* Decorator */: + case 153 /* Decorator */: return resolveDecorator(node, candidatesOutArray, checkMode); - case 262 /* JsxOpeningElement */: - case 261 /* JsxSelfClosingElement */: + case 263 /* JsxOpeningElement */: + case 262 /* JsxSelfClosingElement */: return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode); } throw ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable."); @@ -50966,10 +51851,10 @@ var ts; return false; } var parent = node.parent; - while (parent && parent.kind === 189 /* PropertyAccessExpression */) { + while (parent && parent.kind === 190 /* PropertyAccessExpression */) { parent = parent.parent; } - if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 59 /* EqualsToken */) { + if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 60 /* EqualsToken */) { var right = ts.getInitializerOfBinaryExpression(parent); return ts.isObjectLiteralExpression(right) && right; } @@ -50992,18 +51877,18 @@ var ts; var signature = getResolvedSignature(node, /*candidatesOutArray*/ undefined, checkMode); if (signature === resolvingSignature) { // CheckMode.SkipGenericFunctions is enabled and this is a call to a generic function that - // returns a function type. We defer checking and return anyFunctionType. - return silentNeverType; + // returns a function type. We defer checking and return nonInferrableType. + return nonInferrableType; } - if (node.expression.kind === 98 /* SuperKeyword */) { + if (node.expression.kind === 99 /* SuperKeyword */) { return voidType; } - if (node.kind === 192 /* NewExpression */) { + if (node.kind === 193 /* NewExpression */) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 157 /* Constructor */ && - declaration.kind !== 161 /* ConstructSignature */ && - declaration.kind !== 166 /* ConstructorType */ && + declaration.kind !== 158 /* Constructor */ && + declaration.kind !== 162 /* ConstructSignature */ && + declaration.kind !== 167 /* ConstructorType */ && !ts.isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) { // When resolved signature is a call signature (and not a construct signature) the result type is any @@ -51120,9 +52005,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 /* Function */ - ? 239 /* FunctionDeclaration */ + ? 240 /* FunctionDeclaration */ : resolvedRequire.flags & 3 /* Variable */ - ? 237 /* VariableDeclaration */ + ? 238 /* VariableDeclaration */ : 0 /* Unknown */; if (targetDeclarationKind !== 0 /* Unknown */) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -51147,18 +52032,25 @@ var ts; case 14 /* NoSubstitutionTemplateLiteral */: case 8 /* NumericLiteral */: case 9 /* BigIntLiteral */: - case 102 /* TrueKeyword */: - case 87 /* FalseKeyword */: - case 187 /* ArrayLiteralExpression */: - case 188 /* ObjectLiteralExpression */: + case 103 /* TrueKeyword */: + case 88 /* FalseKeyword */: + case 188 /* ArrayLiteralExpression */: + case 189 /* ObjectLiteralExpression */: return true; - case 195 /* ParenthesizedExpression */: + case 196 /* ParenthesizedExpression */: return isValidConstAssertionArgument(node.expression); - case 202 /* PrefixUnaryExpression */: + case 203 /* PrefixUnaryExpression */: var op = node.operator; var arg = node.operand; return op === 39 /* MinusToken */ && (arg.kind === 8 /* NumericLiteral */ || arg.kind === 9 /* BigIntLiteral */) || op === 38 /* PlusToken */ && arg.kind === 8 /* NumericLiteral */; + case 190 /* PropertyAccessExpression */: + case 191 /* ElementAccessExpression */: + var expr = node.expression; + if (ts.isIdentifier(expr)) { + var symbol = getSymbolAtLocation(expr); + return !!(symbol && (symbol.flags & 384 /* Enum */) && getEnumKind(symbol) === 1 /* Literal */); + } } return false; } @@ -51166,7 +52058,7 @@ var ts; var exprType = checkExpression(expression, checkMode); if (ts.isConstTypeReference(type)) { if (!isValidConstAssertionArgument(expression)) { - error(expression, ts.Diagnostics.A_const_assertion_can_only_be_applied_to_a_string_number_boolean_array_or_object_literal); + error(expression, ts.Diagnostics.A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals); } return getRegularTypeOfLiteralType(exprType); } @@ -51186,10 +52078,10 @@ var ts; } function checkMetaProperty(node) { checkGrammarMetaProperty(node); - if (node.keywordToken === 95 /* NewKeyword */) { + if (node.keywordToken === 96 /* NewKeyword */) { return checkNewTargetMetaProperty(node); } - if (node.keywordToken === 92 /* ImportKeyword */) { + if (node.keywordToken === 93 /* ImportKeyword */) { return checkImportMetaProperty(node); } return ts.Debug.assertNever(node.keywordToken); @@ -51200,7 +52092,7 @@ var ts; error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); return errorType; } - else if (container.kind === 157 /* Constructor */) { + else if (container.kind === 158 /* Constructor */) { var symbol = getSymbolOfNode(container.parent); return getTypeOfSymbol(symbol); } @@ -51210,7 +52102,7 @@ var ts; } } function checkImportMetaProperty(node) { - if (languageVersion < 7 /* ESNext */ || moduleKind < ts.ModuleKind.ESNext) { + if (languageVersion < 8 /* ESNext */ || moduleKind < ts.ModuleKind.ESNext) { error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_options); } var file = ts.getSourceFileOfNode(node); @@ -51386,7 +52278,7 @@ var ts; for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { var element = _a[_i]; if (!ts.isOmittedExpression(element)) { - if (element.name.kind === 72 /* Identifier */) { + if (element.name.kind === 73 /* Identifier */) { getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element); } else { @@ -51400,9 +52292,9 @@ var ts; if (!links.type) { links.type = contextualType; var decl = parameter.valueDeclaration; - if (decl.name.kind !== 72 /* Identifier */) { + if (decl.name.kind !== 73 /* Identifier */) { // if inference didn't come up with anything but {}, fall back to the binding pattern if present. - if (links.type === emptyObjectType) { + if (links.type === unknownType) { links.type = getTypeFromBindingPattern(decl.name); } assignBindingElementTypes(decl.name); @@ -51414,24 +52306,24 @@ var ts; var globalPromiseType = getGlobalPromiseType(/*reportErrors*/ true); if (globalPromiseType !== emptyGenericType) { // if the promised type is itself a promise, get the underlying type; otherwise, fallback to the promised type - promisedType = getAwaitedType(promisedType) || emptyObjectType; + promisedType = getAwaitedType(promisedType) || unknownType; return createTypeReference(globalPromiseType, [promisedType]); } - return emptyObjectType; + return unknownType; } function createPromiseLikeType(promisedType) { // creates a `PromiseLike` type where `T` is the promisedType argument var globalPromiseLikeType = getGlobalPromiseLikeType(/*reportErrors*/ true); if (globalPromiseLikeType !== emptyGenericType) { // if the promised type is itself a promise, get the underlying type; otherwise, fallback to the promised type - promisedType = getAwaitedType(promisedType) || emptyObjectType; + promisedType = getAwaitedType(promisedType) || unknownType; return createTypeReference(globalPromiseLikeType, [promisedType]); } - return emptyObjectType; + return unknownType; } function createPromiseReturnType(func, promisedType) { var promiseType = createPromiseType(promisedType); - if (promiseType === emptyObjectType) { + if (promiseType === unknownType) { error(func, ts.isImportCall(func) ? ts.Diagnostics.A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option : ts.Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option); @@ -51450,7 +52342,7 @@ var ts; } var functionFlags = ts.getFunctionFlags(func); var type; - if (func.body.kind !== 218 /* Block */) { + if (func.body.kind !== 219 /* Block */) { type = checkExpressionCached(func.body, checkMode && checkMode & ~8 /* SkipGenericFunctions */); if (functionFlags & 2 /* Async */) { // From within an async function you can return either a non-promise value or a promise. Any @@ -51592,7 +52484,7 @@ var ts; if (!node.possiblyExhaustive) { return false; } - if (node.expression.kind === 199 /* TypeOfExpression */) { + if (node.expression.kind === 200 /* TypeOfExpression */) { var operandType = getTypeOfExpression(node.expression.expression); // This cast is safe because the switch is possibly exhaustive and does not contain a default case, so there can be no undefined. var witnesses = getSwitchClauseTypeOfWitnesses(node); @@ -51615,7 +52507,7 @@ var ts; if (!(func.flags & 128 /* HasImplicitReturn */)) { return false; } - if (ts.some(func.body.statements, function (statement) { return statement.kind === 232 /* SwitchStatement */ && isExhaustiveSwitchStatement(statement); })) { + if (ts.some(func.body.statements, function (statement) { return statement.kind === 233 /* SwitchStatement */ && isExhaustiveSwitchStatement(statement); })) { return false; } return true; @@ -51658,11 +52550,11 @@ var ts; } function mayReturnNever(func) { switch (func.kind) { - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: return true; - case 156 /* MethodDeclaration */: - return func.parent.kind === 188 /* ObjectLiteralExpression */; + case 157 /* MethodDeclaration */: + return func.parent.kind === 189 /* ObjectLiteralExpression */; default: return false; } @@ -51686,7 +52578,7 @@ var ts; } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. // also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw - if (func.kind === 155 /* MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 218 /* Block */ || !functionHasImplicitReturn(func)) { + if (func.kind === 156 /* MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 219 /* Block */ || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 256 /* HasExplicitReturn */; @@ -51719,7 +52611,7 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) { - ts.Debug.assert(node.kind !== 156 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 157 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); checkNodeDeferred(node); // The identityMapper object is used to indicate that function expressions are wildcards if (checkMode && checkMode & 4 /* SkipContextSensitive */ && isContextSensitive(node)) { @@ -51732,14 +52624,14 @@ var ts; var returnType = getReturnTypeFromBody(node, checkMode); var returnOnlySignature = createSignature(undefined, undefined, undefined, ts.emptyArray, returnType, /*resolvedTypePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); var returnOnlyType = createAnonymousType(node.symbol, emptySymbols, [returnOnlySignature], ts.emptyArray, undefined, undefined); - returnOnlyType.objectFlags |= 524288 /* ContainsAnyFunctionType */; + returnOnlyType.objectFlags |= 524288 /* NonInferrableType */; return links_1.contextFreeType = returnOnlyType; } return anyFunctionType; } // Grammar checking var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 196 /* FunctionExpression */) { + if (!hasGrammarError && node.kind === 197 /* FunctionExpression */) { checkGrammarForGenerator(node); } var links = getNodeLinks(node); @@ -51784,7 +52676,7 @@ var ts; getAwaitedType(type) || errorType : type; } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - ts.Debug.assert(node.kind !== 156 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 157 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var functionFlags = ts.getFunctionFlags(node); var returnOrPromisedType = getReturnOrPromisedType(node, functionFlags); if ((functionFlags & 1 /* Generator */) === 0) { // Async function or normal function @@ -51800,7 +52692,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 218 /* Block */) { + if (node.body.kind === 219 /* Block */) { checkSourceElement(node.body); } else { @@ -51878,11 +52770,11 @@ var ts; if (isReadonlySymbol(symbol)) { // Allow assignments to readonly properties within constructors of the same class declaration. if (symbol.flags & 4 /* Property */ && - (expr.kind === 189 /* PropertyAccessExpression */ || expr.kind === 190 /* ElementAccessExpression */) && - expr.expression.kind === 100 /* ThisKeyword */) { + (expr.kind === 190 /* PropertyAccessExpression */ || expr.kind === 191 /* ElementAccessExpression */) && + expr.expression.kind === 101 /* ThisKeyword */) { // Look for if this is the constructor for the class that `symbol` is a property of. var func = ts.getContainingFunction(expr); - if (!(func && func.kind === 157 /* Constructor */)) { + if (!(func && func.kind === 158 /* Constructor */)) { return true; } // If func.parent is a class and symbol is a (readonly) property of that class, or @@ -51895,13 +52787,13 @@ var ts; return false; } function isReferenceThroughNamespaceImport(expr) { - if (expr.kind === 189 /* PropertyAccessExpression */ || expr.kind === 190 /* ElementAccessExpression */) { + if (expr.kind === 190 /* PropertyAccessExpression */ || expr.kind === 191 /* ElementAccessExpression */) { var node = ts.skipParentheses(expr.expression); - if (node.kind === 72 /* Identifier */) { + if (node.kind === 73 /* Identifier */) { var symbol = getNodeLinks(node).resolvedSymbol; if (symbol.flags & 2097152 /* Alias */) { var declaration = getDeclarationOfAliasSymbol(symbol); - return !!declaration && declaration.kind === 251 /* NamespaceImport */; + return !!declaration && declaration.kind === 252 /* NamespaceImport */; } } } @@ -51910,7 +52802,7 @@ var ts; function checkReferenceExpression(expr, invalidReferenceMessage) { // References are combinations of identifiers, parentheses, and property accesses. var node = ts.skipOuterExpressions(expr, 2 /* Assertions */ | 1 /* Parentheses */); - if (node.kind !== 72 /* Identifier */ && node.kind !== 189 /* PropertyAccessExpression */ && node.kind !== 190 /* ElementAccessExpression */) { + if (node.kind !== 73 /* Identifier */ && node.kind !== 190 /* PropertyAccessExpression */ && node.kind !== 191 /* ElementAccessExpression */) { error(expr, invalidReferenceMessage); return false; } @@ -51919,7 +52811,7 @@ var ts; function checkDeleteExpression(node) { checkExpression(node.expression); var expr = ts.skipParentheses(node.expression); - if (expr.kind !== 189 /* PropertyAccessExpression */ && expr.kind !== 190 /* ElementAccessExpression */) { + if (expr.kind !== 190 /* PropertyAccessExpression */ && expr.kind !== 191 /* ElementAccessExpression */) { error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference); return booleanType; } @@ -51942,7 +52834,19 @@ var ts; // Grammar checking if (produceDiagnostics) { if (!(node.flags & 16384 /* AwaitContext */)) { - grammarErrorOnFirstToken(node, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function); + // use of 'await' in non-async function + var sourceFile = ts.getSourceFileOfNode(node); + if (!hasParseDiagnostics(sourceFile)) { + var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos); + var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function); + var func = ts.getContainingFunction(node); + if (func && func.kind !== 158 /* Constructor */) { + ts.Debug.assert((ts.getFunctionFlags(func) & 2 /* Async */) === 0, "Enclosing function should never be an async function."); + var relatedInfo = ts.createDiagnosticForNode(func, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async); + ts.addRelatedInfo(diagnostic, relatedInfo); + } + diagnostics.add(diagnostic); + } } if (isInParameterInitializerBeforeContainingFunction(node)) { error(node, ts.Diagnostics.await_expressions_cannot_be_used_in_a_parameter_initializer); @@ -52034,8 +52938,8 @@ var ts; } if (type.flags & 3145728 /* UnionOrIntersection */) { var types = type.types; - for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { - var t = types_16[_i]; + for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { + var t = types_15[_i]; if (maybeTypeOfKind(t, kind)) { return true; } @@ -52114,16 +53018,17 @@ var ts; if (strictNullChecks && properties.length === 0) { return checkNonNullType(sourceType, node); } - for (var _i = 0, properties_6 = properties; _i < properties_6.length; _i++) { - var p = properties_6[_i]; - checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, properties, rightIsThis); + for (var i = 0; i < properties.length; i++) { + checkObjectLiteralDestructuringPropertyAssignment(node, sourceType, i, properties, rightIsThis); } return sourceType; } /** Note: If property cannot be a SpreadAssignment, then allProperties does not need to be provided */ - function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties, rightIsThis) { + function checkObjectLiteralDestructuringPropertyAssignment(node, objectLiteralType, propertyIndex, allProperties, rightIsThis) { if (rightIsThis === void 0) { rightIsThis = false; } - if (property.kind === 275 /* PropertyAssignment */ || property.kind === 276 /* ShorthandPropertyAssignment */) { + var properties = node.properties; + var property = properties[propertyIndex]; + if (property.kind === 276 /* PropertyAssignment */ || property.kind === 277 /* ShorthandPropertyAssignment */) { var name = property.name; var exprType = getLiteralTypeFromPropertyName(name); if (isTypeUsableAsPropertyName(exprType)) { @@ -52136,21 +53041,29 @@ var ts; } var elementType = getIndexedAccessType(objectLiteralType, exprType, name); var type = getFlowTypeOfDestructuring(property, elementType); - return checkDestructuringAssignment(property.kind === 276 /* ShorthandPropertyAssignment */ ? property : property.initializer, type); + return checkDestructuringAssignment(property.kind === 277 /* ShorthandPropertyAssignment */ ? property : property.initializer, type); } - else if (property.kind === 277 /* SpreadAssignment */) { - if (languageVersion < 7 /* ESNext */) { - checkExternalEmitHelpers(property, 4 /* Rest */); + else if (property.kind === 278 /* SpreadAssignment */) { + if (propertyIndex < properties.length - 1) { + error(property, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } - var nonRestNames = []; - if (allProperties) { - for (var i = 0; i < allProperties.length - 1; i++) { - nonRestNames.push(allProperties[i].name); + else { + if (languageVersion < 8 /* ESNext */) { + checkExternalEmitHelpers(property, 4 /* Rest */); } + var nonRestNames = []; + if (allProperties) { + for (var _i = 0, allProperties_1 = allProperties; _i < allProperties_1.length; _i++) { + var otherProperty = allProperties_1[_i]; + if (!ts.isSpreadAssignment(otherProperty)) { + nonRestNames.push(otherProperty.name); + } + } + } + var type = getRestType(objectLiteralType, nonRestNames, objectLiteralType.symbol); + checkGrammarForDisallowedTrailingComma(allProperties, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); + return checkDestructuringAssignment(property.expression, type); } - var type = getRestType(objectLiteralType, nonRestNames, objectLiteralType.symbol); - checkGrammarForDisallowedTrailingComma(allProperties, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); - return checkDestructuringAssignment(property.expression, type); } else { error(property, ts.Diagnostics.Property_assignment_expected); @@ -52173,8 +53086,8 @@ var ts; function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 210 /* OmittedExpression */) { - if (element.kind !== 208 /* SpreadElement */) { + if (element.kind !== 211 /* OmittedExpression */) { + if (element.kind !== 209 /* SpreadElement */) { var indexType = getLiteralType(elementIndex); if (isArrayLikeType(sourceType)) { // We create a synthetic expression so that getIndexedAccessType doesn't get confused @@ -52190,7 +53103,7 @@ var ts; } else { var restExpression = element.expression; - if (restExpression.kind === 204 /* BinaryExpression */ && restExpression.operatorToken.kind === 59 /* EqualsToken */) { + if (restExpression.kind === 205 /* BinaryExpression */ && restExpression.operatorToken.kind === 60 /* EqualsToken */) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -52206,7 +53119,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode, rightIsThis) { var target; - if (exprOrAssignment.kind === 276 /* ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 277 /* ShorthandPropertyAssignment */) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { // In strict null checking mode, if a default value of a non-undefined type is specified, remove @@ -52222,21 +53135,21 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 204 /* BinaryExpression */ && target.operatorToken.kind === 59 /* EqualsToken */) { + if (target.kind === 205 /* BinaryExpression */ && target.operatorToken.kind === 60 /* EqualsToken */) { checkBinaryExpression(target, checkMode); target = target.left; } - if (target.kind === 188 /* ObjectLiteralExpression */) { + if (target.kind === 189 /* ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType, rightIsThis); } - if (target.kind === 187 /* ArrayLiteralExpression */) { + if (target.kind === 188 /* ArrayLiteralExpression */) { return checkArrayLiteralAssignment(target, sourceType, checkMode); } return checkReferenceAssignment(target, sourceType, checkMode); } function checkReferenceAssignment(target, sourceType, checkMode) { var targetType = checkExpression(target, checkMode); - var error = target.parent.kind === 277 /* SpreadAssignment */ ? + var error = target.parent.kind === 278 /* SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; if (checkReferenceExpression(target, error)) { @@ -52255,39 +53168,39 @@ var ts; function isSideEffectFree(node) { node = ts.skipParentheses(node); switch (node.kind) { - case 72 /* Identifier */: + case 73 /* Identifier */: case 10 /* StringLiteral */: case 13 /* RegularExpressionLiteral */: - case 193 /* TaggedTemplateExpression */: - case 206 /* TemplateExpression */: + case 194 /* TaggedTemplateExpression */: + case 207 /* TemplateExpression */: case 14 /* NoSubstitutionTemplateLiteral */: case 8 /* NumericLiteral */: case 9 /* BigIntLiteral */: - case 102 /* TrueKeyword */: - case 87 /* FalseKeyword */: - case 96 /* NullKeyword */: - case 141 /* UndefinedKeyword */: - case 196 /* FunctionExpression */: - case 209 /* ClassExpression */: - case 197 /* ArrowFunction */: - case 187 /* ArrayLiteralExpression */: - case 188 /* ObjectLiteralExpression */: - case 199 /* TypeOfExpression */: - case 213 /* NonNullExpression */: - case 261 /* JsxSelfClosingElement */: - case 260 /* JsxElement */: + case 103 /* TrueKeyword */: + case 88 /* FalseKeyword */: + case 97 /* NullKeyword */: + case 142 /* UndefinedKeyword */: + case 197 /* FunctionExpression */: + case 210 /* ClassExpression */: + case 198 /* ArrowFunction */: + case 188 /* ArrayLiteralExpression */: + case 189 /* ObjectLiteralExpression */: + case 200 /* TypeOfExpression */: + case 214 /* NonNullExpression */: + case 262 /* JsxSelfClosingElement */: + case 261 /* JsxElement */: return true; - case 205 /* ConditionalExpression */: + case 206 /* ConditionalExpression */: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: if (ts.isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 202 /* PrefixUnaryExpression */: - case 203 /* PostfixUnaryExpression */: + case 203 /* PrefixUnaryExpression */: + case 204 /* PostfixUnaryExpression */: // Unary operators ~, !, +, and - have no side effects. // The rest do. switch (node.operator) { @@ -52299,9 +53212,9 @@ var ts; } return false; // Some forms listed here for clarity - case 200 /* VoidExpression */: // Explicit opt-out - case 194 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings - case 212 /* AsExpression */: // Not SEF, but can produce useful type warnings + case 201 /* VoidExpression */: // Explicit opt-out + case 195 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings + case 213 /* AsExpression */: // Not SEF, but can produce useful type warnings default: return false; } @@ -52317,8 +53230,8 @@ var ts; } function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) { var operator = operatorToken.kind; - if (operator === 59 /* EqualsToken */ && (left.kind === 188 /* ObjectLiteralExpression */ || left.kind === 187 /* ArrayLiteralExpression */)) { - return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 100 /* ThisKeyword */); + if (operator === 60 /* EqualsToken */ && (left.kind === 189 /* ObjectLiteralExpression */ || left.kind === 188 /* ArrayLiteralExpression */)) { + return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 101 /* ThisKeyword */); } var leftType; if (operator === 54 /* AmpersandAmpersandToken */ || operator === 55 /* BarBarToken */) { @@ -52331,26 +53244,26 @@ var ts; switch (operator) { case 40 /* AsteriskToken */: case 41 /* AsteriskAsteriskToken */: - case 62 /* AsteriskEqualsToken */: - case 63 /* AsteriskAsteriskEqualsToken */: + case 63 /* AsteriskEqualsToken */: + case 64 /* AsteriskAsteriskEqualsToken */: case 42 /* SlashToken */: - case 64 /* SlashEqualsToken */: + case 65 /* SlashEqualsToken */: case 43 /* PercentToken */: - case 65 /* PercentEqualsToken */: + case 66 /* PercentEqualsToken */: case 39 /* MinusToken */: - case 61 /* MinusEqualsToken */: + case 62 /* MinusEqualsToken */: case 46 /* LessThanLessThanToken */: - case 66 /* LessThanLessThanEqualsToken */: + case 67 /* LessThanLessThanEqualsToken */: case 47 /* GreaterThanGreaterThanToken */: - case 67 /* GreaterThanGreaterThanEqualsToken */: + case 68 /* GreaterThanGreaterThanEqualsToken */: case 48 /* GreaterThanGreaterThanGreaterThanToken */: - case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */: case 50 /* BarToken */: - case 70 /* BarEqualsToken */: + case 71 /* BarEqualsToken */: case 51 /* CaretToken */: - case 71 /* CaretEqualsToken */: + case 72 /* CaretEqualsToken */: case 49 /* AmpersandToken */: - case 69 /* AmpersandEqualsToken */: + case 70 /* AmpersandEqualsToken */: if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } @@ -52380,7 +53293,7 @@ var ts; else if (isTypeAssignableToKind(leftType, 2112 /* BigIntLike */) && isTypeAssignableToKind(rightType, 2112 /* BigIntLike */)) { switch (operator) { case 48 /* GreaterThanGreaterThanGreaterThanToken */: - case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */: reportOperatorError(); } resultType_1 = bigintType; @@ -52395,7 +53308,7 @@ var ts; return resultType_1; } case 38 /* PlusToken */: - case 60 /* PlusEqualsToken */: + case 61 /* PlusEqualsToken */: if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } @@ -52430,7 +53343,7 @@ var ts; reportOperatorError(); return anyType; } - if (operator === 60 /* PlusEqualsToken */) { + if (operator === 61 /* PlusEqualsToken */) { checkAssignmentOperator(resultType); } return resultType; @@ -52451,19 +53364,13 @@ var ts; case 34 /* ExclamationEqualsToken */: case 35 /* EqualsEqualsEqualsToken */: case 36 /* ExclamationEqualsEqualsToken */: - var leftIsLiteral = isLiteralType(leftType); - var rightIsLiteral = isLiteralType(rightType); - if (!leftIsLiteral || !rightIsLiteral) { - leftType = leftIsLiteral ? getBaseTypeOfLiteralType(leftType) : leftType; - rightType = rightIsLiteral ? getBaseTypeOfLiteralType(rightType) : rightType; - } if (!isTypeEqualityComparableTo(leftType, rightType) && !isTypeEqualityComparableTo(rightType, leftType)) { reportOperatorError(); } return booleanType; - case 94 /* InstanceOfKeyword */: + case 95 /* InstanceOfKeyword */: return checkInstanceOfExpression(left, right, leftType, rightType); - case 93 /* InKeyword */: + case 94 /* InKeyword */: return checkInExpression(left, right, leftType, rightType); case 54 /* AmpersandAmpersandToken */: return getTypeFacts(leftType) & 4194304 /* Truthy */ ? @@ -52473,7 +53380,7 @@ var ts; return getTypeFacts(leftType) & 8388608 /* Falsy */ ? getUnionType([removeDefinitelyFalsyTypes(leftType), rightType], 2 /* Subtype */) : leftType; - case 59 /* EqualsToken */: + case 60 /* EqualsToken */: var declKind = ts.isBinaryExpression(left.parent) ? ts.getAssignmentDeclarationKind(left.parent) : 0 /* None */; checkAssignmentDeclaration(declKind, rightType); if (isAssignmentDeclaration(declKind)) { @@ -52517,7 +53424,7 @@ var ts; } } function isEvalNode(node) { - return node.kind === 72 /* Identifier */ && node.escapedText === "eval"; + return node.kind === 73 /* Identifier */ && node.escapedText === "eval"; } // Return true if there was no error, false if there was an error. function checkForDisallowedESSymbolOperand(operator) { @@ -52533,13 +53440,13 @@ var ts; function getSuggestedBooleanOperator(operator) { switch (operator) { case 50 /* BarToken */: - case 70 /* BarEqualsToken */: + case 71 /* BarEqualsToken */: return 55 /* BarBarToken */; case 51 /* CaretToken */: - case 71 /* CaretEqualsToken */: + case 72 /* CaretEqualsToken */: return 36 /* ExclamationEqualsEqualsToken */; case 49 /* AmpersandToken */: - case 69 /* AmpersandEqualsToken */: + case 70 /* AmpersandEqualsToken */: return 54 /* AmpersandAmpersandToken */; default: return undefined; @@ -52578,8 +53485,7 @@ var ts; } } function reportOperatorError() { - var leftStr = typeToString(leftType); - var rightStr = typeToString(rightType); + var _a = getTypeNamesForErrorDisplay(leftType, rightType), leftStr = _a[0], rightStr = _a[1]; var errNode = errorNode || operatorToken; if (!tryGiveBetterPrimaryError(errNode, leftStr, rightStr)) { error(errNode, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(operatorToken.kind), leftStr, rightStr); @@ -52634,7 +53540,7 @@ var ts; // Async generator functions prior to ESNext require the __await, __asyncDelegator, // and __asyncValues helpers if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && - languageVersion < 7 /* ESNext */) { + languageVersion < 8 /* ESNext */) { checkExternalEmitHelpers(node, 26624 /* AsyncDelegatorIncludes */); } // Generator functions prior to ES2015 require the __values helper @@ -52676,7 +53582,7 @@ var ts; return stringType; } function getContextNode(node) { - if (node.kind === 268 /* JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) { + if (node.kind === 269 /* JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) { return node.parent.parent; // Needs to be the root JsxElement, so it encompasses the attributes _and_ the children (which are essentially part of the attributes) } return node; @@ -52715,7 +53621,7 @@ var ts; } function isTypeAssertion(node) { node = ts.skipParentheses(node); - return node.kind === 194 /* TypeAssertionExpression */ || node.kind === 212 /* AsExpression */; + return node.kind === 195 /* TypeAssertionExpression */ || node.kind === 213 /* AsExpression */; } function checkDeclarationInitializer(declaration) { var initializer = ts.getEffectiveInitializer(declaration); @@ -52746,7 +53652,7 @@ var ts; // If the contextual type is a type variable constrained to a primitive type, consider // this a literal context for literals of that primitive type. For example, given a // type parameter 'T extends string', infer string literal types for T. - var constraint = getBaseConstraintOfType(contextualType) || emptyObjectType; + var constraint = getBaseConstraintOfType(contextualType) || unknownType; return maybeTypeOfKind(constraint, 4 /* String */) && maybeTypeOfKind(candidateType, 128 /* StringLiteral */) || maybeTypeOfKind(constraint, 8 /* Number */) && maybeTypeOfKind(candidateType, 256 /* NumberLiteral */) || maybeTypeOfKind(constraint, 64 /* BigInt */) && maybeTypeOfKind(candidateType, 2048 /* BigIntLiteral */) || @@ -52779,7 +53685,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 149 /* ComputedPropertyName */) { + if (node.name.kind === 150 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } return checkExpressionForMutableLocation(node.initializer, checkMode); @@ -52790,7 +53696,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 149 /* ComputedPropertyName */) { + if (node.name.kind === 150 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -52798,16 +53704,18 @@ var ts; } function instantiateTypeWithSingleGenericCallSignature(node, type, checkMode) { if (checkMode && checkMode & (2 /* Inferential */ | 8 /* SkipGenericFunctions */)) { - var signature = getSingleCallSignature(type); + var callSignature = getSingleSignature(type, 0 /* Call */, /*allowMembers*/ true); + var constructSignature = getSingleSignature(type, 1 /* Construct */, /*allowMembers*/ true); + var signature = callSignature || constructSignature; if (signature && signature.typeParameters) { - if (checkMode & 8 /* SkipGenericFunctions */) { - skippedGenericFunction(node, checkMode); - return anyFunctionType; - } var contextualType = getApparentTypeOfContextualType(node); - if (contextualType) { - var contextualSignature = getSingleCallSignature(getNonNullableType(contextualType)); + if (contextualType && !isMixinConstructorType(contextualType)) { + var contextualSignature = getSingleSignature(getNonNullableType(contextualType), callSignature ? 0 /* Call */ : 1 /* Construct */, /*allowMembers*/ false); if (contextualSignature && !contextualSignature.typeParameters) { + if (checkMode & 8 /* SkipGenericFunctions */) { + skippedGenericFunction(node, checkMode); + return anyFunctionType; + } var context = getInferenceContext(node); // We have an expression that is an argument of a generic function for which we are performing // type argument inference. The expression is of a function type with a single generic call @@ -52815,7 +53723,8 @@ var ts; // if the outer function returns a function type with a single non-generic call signature and // if some of the outer function type parameters have no inferences so far. If so, we can // potentially add inferred type parameters to the outer function return type. - var returnSignature = context.signature && getSingleCallSignature(getReturnTypeOfSignature(context.signature)); + var returnType = context.signature && getReturnTypeOfSignature(context.signature); + var returnSignature = returnType && getSingleCallOrConstructSignature(returnType); if (returnSignature && !returnSignature.typeParameters && !ts.every(context.inferences, hasInferenceCandidates)) { // Instantiate the signature with its own type parameters as type arguments, possibly // renaming the type parameters to ensure they have unique names. @@ -52930,7 +53839,7 @@ var ts; var expr = ts.skipParentheses(node); // Optimize for the common case of a call to a function with a single non-generic call // signature where we can just fetch the return type without checking the arguments. - if (expr.kind === 191 /* CallExpression */ && expr.expression.kind !== 98 /* SuperKeyword */ && !ts.isRequireCall(expr, /*checkArgumentIsStringLiteralLike*/ true) && !isSymbolOrSymbolForCall(expr)) { + if (expr.kind === 192 /* CallExpression */ && expr.expression.kind !== 99 /* SuperKeyword */ && !ts.isRequireCall(expr, /*checkArgumentIsStringLiteralLike*/ true) && !isSymbolOrSymbolForCall(expr)) { var funcType = checkNonNullExpression(expr.expression); var signature = getSingleCallSignature(funcType); if (signature && !signature.typeParameters) { @@ -52979,10 +53888,10 @@ var ts; // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 189 /* PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 190 /* ElementAccessExpression */ && node.parent.expression === node) || - ((node.kind === 72 /* Identifier */ || node.kind === 148 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || - (node.parent.kind === 167 /* TypeQuery */ && node.parent.exprName === node)); + var ok = (node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 191 /* ElementAccessExpression */ && node.parent.expression === node) || + ((node.kind === 73 /* Identifier */ || node.kind === 149 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || + (node.parent.kind === 168 /* TypeQuery */ && node.parent.exprName === node)); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query); } @@ -53003,13 +53912,13 @@ var ts; } function checkExpressionWorker(node, checkMode, forceTuple) { switch (node.kind) { - case 72 /* Identifier */: + case 73 /* Identifier */: return checkIdentifier(node); - case 100 /* ThisKeyword */: + case 101 /* ThisKeyword */: return checkThisExpression(node); - case 98 /* SuperKeyword */: + case 99 /* SuperKeyword */: return checkSuperExpression(node); - case 96 /* NullKeyword */: + case 97 /* NullKeyword */: return nullWideningType; case 14 /* NoSubstitutionTemplateLiteral */: case 10 /* StringLiteral */: @@ -53020,82 +53929,82 @@ var ts; case 9 /* BigIntLiteral */: checkGrammarBigIntLiteral(node); return getFreshTypeOfLiteralType(getBigIntLiteralType(node)); - case 102 /* TrueKeyword */: + case 103 /* TrueKeyword */: return trueType; - case 87 /* FalseKeyword */: + case 88 /* FalseKeyword */: return falseType; - case 206 /* TemplateExpression */: + case 207 /* TemplateExpression */: return checkTemplateExpression(node); case 13 /* RegularExpressionLiteral */: return globalRegExpType; - case 187 /* ArrayLiteralExpression */: + case 188 /* ArrayLiteralExpression */: return checkArrayLiteral(node, checkMode, forceTuple); - case 188 /* ObjectLiteralExpression */: + case 189 /* ObjectLiteralExpression */: return checkObjectLiteral(node, checkMode); - case 189 /* PropertyAccessExpression */: + case 190 /* PropertyAccessExpression */: return checkPropertyAccessExpression(node); - case 148 /* QualifiedName */: + case 149 /* QualifiedName */: return checkQualifiedName(node); - case 190 /* ElementAccessExpression */: + case 191 /* ElementAccessExpression */: return checkIndexedAccess(node); - case 191 /* CallExpression */: - if (node.expression.kind === 92 /* ImportKeyword */) { + case 192 /* CallExpression */: + if (node.expression.kind === 93 /* ImportKeyword */) { return checkImportCallExpression(node); } /* falls through */ - case 192 /* NewExpression */: + case 193 /* NewExpression */: return checkCallExpression(node, checkMode); - case 193 /* TaggedTemplateExpression */: + case 194 /* TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 195 /* ParenthesizedExpression */: + case 196 /* ParenthesizedExpression */: return checkParenthesizedExpression(node, checkMode); - case 209 /* ClassExpression */: + case 210 /* ClassExpression */: return checkClassExpression(node); - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); - case 199 /* TypeOfExpression */: + case 200 /* TypeOfExpression */: return checkTypeOfExpression(node); - case 194 /* TypeAssertionExpression */: - case 212 /* AsExpression */: + case 195 /* TypeAssertionExpression */: + case 213 /* AsExpression */: return checkAssertion(node); - case 213 /* NonNullExpression */: + case 214 /* NonNullExpression */: return checkNonNullAssertion(node); - case 214 /* MetaProperty */: + case 215 /* MetaProperty */: return checkMetaProperty(node); - case 198 /* DeleteExpression */: + case 199 /* DeleteExpression */: return checkDeleteExpression(node); - case 200 /* VoidExpression */: + case 201 /* VoidExpression */: return checkVoidExpression(node); - case 201 /* AwaitExpression */: + case 202 /* AwaitExpression */: return checkAwaitExpression(node); - case 202 /* PrefixUnaryExpression */: + case 203 /* PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 203 /* PostfixUnaryExpression */: + case 204 /* PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: return checkBinaryExpression(node, checkMode); - case 205 /* ConditionalExpression */: + case 206 /* ConditionalExpression */: return checkConditionalExpression(node, checkMode); - case 208 /* SpreadElement */: + case 209 /* SpreadElement */: return checkSpreadExpression(node, checkMode); - case 210 /* OmittedExpression */: + case 211 /* OmittedExpression */: return undefinedWideningType; - case 207 /* YieldExpression */: + case 208 /* YieldExpression */: return checkYieldExpression(node); - case 215 /* SyntheticExpression */: + case 216 /* SyntheticExpression */: return node.type; - case 270 /* JsxExpression */: + case 271 /* JsxExpression */: return checkJsxExpression(node, checkMode); - case 260 /* JsxElement */: + case 261 /* JsxElement */: return checkJsxElement(node, checkMode); - case 261 /* JsxSelfClosingElement */: + case 262 /* JsxSelfClosingElement */: return checkJsxSelfClosingElement(node, checkMode); - case 264 /* JsxFragment */: + case 265 /* JsxFragment */: return checkJsxFragment(node); - case 268 /* JsxAttributes */: + case 269 /* JsxAttributes */: return checkJsxAttributes(node, checkMode); - case 262 /* JsxOpeningElement */: + case 263 /* JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return errorType; @@ -53117,7 +54026,7 @@ var ts; var constraintType = getConstraintOfTypeParameter(typeParameter); var defaultType = getDefaultFromTypeParameter(typeParameter); if (constraintType && defaultType) { - checkTypeAssignableTo(defaultType, getTypeWithThisArgument(constraintType, defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1); + checkTypeAssignableTo(defaultType, getTypeWithThisArgument(instantiateType(constraintType, makeUnaryTypeMapper(typeParameter, defaultType)), defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1); } if (produceDiagnostics) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); @@ -53132,7 +54041,7 @@ var ts; checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); if (ts.hasModifier(node, 92 /* ParameterPropertyModifier */)) { - if (!(func.kind === 157 /* Constructor */ && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 158 /* Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } @@ -53143,10 +54052,10 @@ var ts; if (func.parameters.indexOf(node) !== 0) { error(node, ts.Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText); } - if (func.kind === 157 /* Constructor */ || func.kind === 161 /* ConstructSignature */ || func.kind === 166 /* ConstructorType */) { + if (func.kind === 158 /* Constructor */ || func.kind === 162 /* ConstructSignature */ || func.kind === 167 /* ConstructorType */) { error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); } - if (func.kind === 197 /* ArrowFunction */) { + if (func.kind === 198 /* ArrowFunction */) { error(node, ts.Diagnostics.An_arrow_function_cannot_have_a_this_parameter); } } @@ -53202,13 +54111,13 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { - case 197 /* ArrowFunction */: - case 160 /* CallSignature */: - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: - case 165 /* FunctionType */: - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: + case 198 /* ArrowFunction */: + case 161 /* CallSignature */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: + case 166 /* FunctionType */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: var parent = node.parent; if (node === parent.type) { return parent; @@ -53222,11 +54131,11 @@ var ts; continue; } var name = element.name; - if (name.kind === 72 /* Identifier */ && name.escapedText === predicateVariableName) { + if (name.kind === 73 /* Identifier */ && name.escapedText === predicateVariableName) { error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name.kind === 185 /* ArrayBindingPattern */ || name.kind === 184 /* ObjectBindingPattern */) { + else if (name.kind === 186 /* ArrayBindingPattern */ || name.kind === 185 /* ObjectBindingPattern */) { if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } @@ -53235,19 +54144,19 @@ var ts; } function checkSignatureDeclaration(node) { // Grammar checking - if (node.kind === 162 /* IndexSignature */) { + if (node.kind === 163 /* IndexSignature */) { checkGrammarIndexSignature(node); } // TODO (yuisu): Remove this check in else-if when SyntaxKind.Construct is moved and ambient context is handled - else if (node.kind === 165 /* FunctionType */ || node.kind === 239 /* FunctionDeclaration */ || node.kind === 166 /* ConstructorType */ || - node.kind === 160 /* CallSignature */ || node.kind === 157 /* Constructor */ || - node.kind === 161 /* ConstructSignature */) { + else if (node.kind === 166 /* FunctionType */ || node.kind === 240 /* FunctionDeclaration */ || node.kind === 167 /* ConstructorType */ || + node.kind === 161 /* CallSignature */ || node.kind === 158 /* Constructor */ || + node.kind === 162 /* ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } var functionFlags = ts.getFunctionFlags(node); if (!(functionFlags & 4 /* Invalid */)) { // Async generators prior to ESNext require the __await and __asyncGenerator helpers - if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion < 7 /* ESNext */) { + if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion < 8 /* ESNext */) { checkExternalEmitHelpers(node, 6144 /* AsyncGeneratorIncludes */); } // Async functions prior to ES2017 require the __awaiter helper @@ -53271,10 +54180,10 @@ var ts; var returnTypeNode = ts.getEffectiveReturnTypeNode(node); if (noImplicitAny && !returnTypeNode) { switch (node.kind) { - case 161 /* ConstructSignature */: + case 162 /* ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 160 /* CallSignature */: + case 161 /* CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -53304,7 +54213,7 @@ var ts; checkAsyncFunctionReturnType(node, returnTypeNode); } } - if (node.kind !== 162 /* IndexSignature */ && node.kind !== 294 /* JSDocFunctionType */) { + if (node.kind !== 163 /* IndexSignature */ && node.kind !== 295 /* JSDocFunctionType */) { registerForUnusedIdentifiersCheck(node); } } @@ -53321,7 +54230,7 @@ var ts; var staticNames = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 157 /* Constructor */) { + if (member.kind === 158 /* Constructor */) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var param = _c[_b]; if (ts.isParameterPropertyDeclaration(param) && !ts.isBindingPattern(param.name)) { @@ -53336,16 +54245,16 @@ var ts; var memberName = name && ts.getPropertyNameForPropertyNameNode(name); if (name && memberName) { switch (member.kind) { - case 158 /* GetAccessor */: + case 159 /* GetAccessor */: addName(names, name, memberName, 1 /* Getter */); break; - case 159 /* SetAccessor */: + case 160 /* SetAccessor */: addName(names, name, memberName, 2 /* Setter */); break; - case 154 /* PropertyDeclaration */: + case 155 /* PropertyDeclaration */: addName(names, name, memberName, 3 /* Property */); break; - case 156 /* MethodDeclaration */: + case 157 /* MethodDeclaration */: addName(names, name, memberName, 4 /* Method */); break; } @@ -53408,7 +54317,7 @@ var ts; var names = ts.createMap(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 153 /* PropertySignature */) { + if (member.kind === 154 /* PropertySignature */) { var memberName = void 0; var name = member.name; switch (name.kind) { @@ -53416,7 +54325,7 @@ var ts; case 8 /* NumericLiteral */: memberName = name.text; break; - case 72 /* Identifier */: + case 73 /* Identifier */: memberName = ts.idText(name); break; default: @@ -53433,7 +54342,7 @@ var ts; } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 241 /* InterfaceDeclaration */) { + if (node.kind === 242 /* InterfaceDeclaration */) { var nodeSymbol = getSymbolOfNode(node); // in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration // to prevent this run check only for the first declaration of a given kind @@ -53453,7 +54362,7 @@ var ts; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 138 /* StringKeyword */: + case 139 /* StringKeyword */: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -53461,7 +54370,7 @@ var ts; error(declaration, ts.Diagnostics.Duplicate_string_index_signature); } break; - case 135 /* NumberKeyword */: + case 136 /* NumberKeyword */: if (!seenNumericIndexer) { seenNumericIndexer = true; } @@ -53488,7 +54397,7 @@ var ts; checkFunctionOrMethodDeclaration(node); // Abstract methods cannot have an implementation. // Extra checks are to avoid reporting multiple errors relating to the "abstractness" of the node. - if (ts.hasModifier(node, 128 /* Abstract */) && node.kind === 156 /* MethodDeclaration */ && node.body) { + if (ts.hasModifier(node, 128 /* Abstract */) && node.kind === 157 /* MethodDeclaration */ && node.body) { error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } } @@ -53513,7 +54422,7 @@ var ts; return; } function isInstancePropertyWithInitializer(n) { - return n.kind === 154 /* PropertyDeclaration */ && + return n.kind === 155 /* PropertyDeclaration */ && !ts.hasModifier(n, 32 /* Static */) && !!n.initializer; } @@ -53543,7 +54452,7 @@ var ts; var superCallStatement = void 0; for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { var statement = statements_2[_i]; - if (statement.kind === 221 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { + if (statement.kind === 222 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { superCallStatement = statement; break; } @@ -53568,7 +54477,7 @@ var ts; checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 158 /* GetAccessor */) { + if (node.kind === 159 /* GetAccessor */) { if (!(node.flags & 4194304 /* Ambient */) && ts.nodeIsPresent(node.body) && (node.flags & 128 /* HasImplicitReturn */)) { if (!(node.flags & 256 /* HasExplicitReturn */)) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); @@ -53578,13 +54487,13 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 149 /* ComputedPropertyName */) { + if (node.name.kind === 150 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } if (!hasNonBindableDynamicName(node)) { // TypeScript 1.0 spec (April 2014): 8.4.3 // Accessors for the same member name must specify the same accessibility. - var otherKind = node.kind === 158 /* GetAccessor */ ? 159 /* SetAccessor */ : 158 /* GetAccessor */; + var otherKind = node.kind === 159 /* GetAccessor */ ? 160 /* SetAccessor */ : 159 /* GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind); if (otherAccessor) { var nodeFlags = ts.getModifierFlags(node); @@ -53602,7 +54511,7 @@ var ts; } } var returnType = getTypeOfAccessors(getSymbolOfNode(node)); - if (node.kind === 158 /* GetAccessor */) { + if (node.kind === 159 /* GetAccessor */) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); } } @@ -53650,7 +54559,7 @@ var ts; } function checkTypeReferenceNode(node) { checkGrammarTypeArguments(node, node.typeArguments); - if (node.kind === 164 /* TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) { + if (node.kind === 165 /* TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) { grammarErrorAtPos(node, node.typeName.jsdocDotPos, 1, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments); } var type = getTypeFromTypeReference(node); @@ -53698,7 +54607,7 @@ var ts; var seenOptionalElement = false; for (var i = 0; i < elementTypes.length; i++) { var e = elementTypes[i]; - if (e.kind === 172 /* RestType */) { + if (e.kind === 173 /* RestType */) { if (i !== elementTypes.length - 1) { grammarErrorOnNode(e, ts.Diagnostics.A_rest_element_must_be_last_in_a_tuple_type); break; @@ -53707,7 +54616,7 @@ var ts; error(e, ts.Diagnostics.A_rest_element_type_must_be_an_array_type); } } - else if (e.kind === 171 /* OptionalType */) { + else if (e.kind === 172 /* OptionalType */) { seenOptionalElement = true; } else if (seenOptionalElement) { @@ -53728,7 +54637,7 @@ var ts; var objectType = type.objectType; var indexType = type.indexType; if (isTypeAssignableTo(indexType, getIndexType(objectType, /*stringsOnly*/ false))) { - if (accessNode.kind === 190 /* ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && + if (accessNode.kind === 191 /* ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && ts.getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) { error(accessNode, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); } @@ -53740,7 +54649,7 @@ var ts; return type; } error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); - return type; + return errorType; } function checkIndexedAccessType(node) { checkSourceElement(node.objectType); @@ -53768,7 +54677,7 @@ var ts; ts.forEachChild(node, checkSourceElement); } function checkInferType(node) { - if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 175 /* ConditionalType */ && n.parent.extendsType === n; })) { + if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 176 /* ConditionalType */ && n.parent.extendsType === n; })) { grammarErrorOnNode(node, ts.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type); } checkSourceElement(node.typeParameter); @@ -53785,9 +54694,9 @@ var ts; var flags = ts.getCombinedModifierFlags(n); // children of classes (even ambient classes) should not be marked as ambient or export // because those flags have no useful semantics there. - if (n.parent.kind !== 241 /* InterfaceDeclaration */ && - n.parent.kind !== 240 /* ClassDeclaration */ && - n.parent.kind !== 209 /* ClassExpression */ && + if (n.parent.kind !== 242 /* InterfaceDeclaration */ && + n.parent.kind !== 241 /* ClassDeclaration */ && + n.parent.kind !== 210 /* ClassExpression */ && n.flags & 4194304 /* Ambient */) { if (!(flags & 2 /* Ambient */) && !(ts.isModuleBlock(n.parent) && ts.isModuleDeclaration(n.parent.parent) && ts.isGlobalScopeAugmentation(n.parent.parent))) { // It is nested in an ambient context, which means it is automatically exported @@ -53878,7 +54787,7 @@ var ts; if (node.name && subsequentName && (ts.isComputedPropertyName(node.name) && ts.isComputedPropertyName(subsequentName) || !ts.isComputedPropertyName(node.name) && !ts.isComputedPropertyName(subsequentName) && ts.getEscapedTextOfIdentifierOrLiteral(node.name) === ts.getEscapedTextOfIdentifierOrLiteral(subsequentName))) { - var reportError = (node.kind === 156 /* MethodDeclaration */ || node.kind === 155 /* MethodSignature */) && + var reportError = (node.kind === 157 /* MethodDeclaration */ || node.kind === 156 /* MethodSignature */) && ts.hasModifier(node, 32 /* Static */) !== ts.hasModifier(subsequentNode, 32 /* Static */); // we can get here in two cases // 1. mixed static and instance class members @@ -53917,7 +54826,7 @@ var ts; var current = declarations_4[_i]; var node = current; var inAmbientContext = node.flags & 4194304 /* Ambient */; - var inAmbientContextOrInterface = node.parent.kind === 241 /* InterfaceDeclaration */ || node.parent.kind === 168 /* TypeLiteral */ || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 242 /* InterfaceDeclaration */ || node.parent.kind === 169 /* TypeLiteral */ || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -53928,7 +54837,7 @@ var ts; // 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one previousDeclaration = undefined; } - if (node.kind === 239 /* FunctionDeclaration */ || node.kind === 156 /* MethodDeclaration */ || node.kind === 155 /* MethodSignature */ || node.kind === 157 /* Constructor */) { + if (node.kind === 240 /* FunctionDeclaration */ || node.kind === 157 /* MethodDeclaration */ || node.kind === 156 /* MethodSignature */ || node.kind === 158 /* Constructor */) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -54057,22 +54966,22 @@ var ts; function getDeclarationSpaces(decl) { var d = decl; switch (d.kind) { - case 241 /* InterfaceDeclaration */: - case 242 /* TypeAliasDeclaration */: + case 242 /* InterfaceDeclaration */: + case 243 /* TypeAliasDeclaration */: // A jsdoc typedef and callback are, by definition, type aliases - case 309 /* JSDocTypedefTag */: - case 302 /* JSDocCallbackTag */: + case 310 /* JSDocTypedefTag */: + case 303 /* JSDocCallbackTag */: return 2 /* ExportType */; - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 4 /* ExportNamespace */ | 1 /* ExportValue */ : 4 /* ExportNamespace */; - case 240 /* ClassDeclaration */: - case 243 /* EnumDeclaration */: + case 241 /* ClassDeclaration */: + case 244 /* EnumDeclaration */: return 2 /* ExportType */ | 1 /* ExportValue */; - case 284 /* SourceFile */: + case 285 /* SourceFile */: return 2 /* ExportType */ | 1 /* ExportValue */ | 4 /* ExportNamespace */; - case 254 /* ExportAssignment */: + case 255 /* ExportAssignment */: // Export assigned entity name expressions act as aliases and should fall through, otherwise they export values if (!ts.isEntityNameExpression(d.expression)) { return 1 /* ExportValue */; @@ -54080,20 +54989,20 @@ var ts; d = d.expression; /* falls through */ // The below options all declare an Alias, which is allowed to merge with other values within the importing module - case 248 /* ImportEqualsDeclaration */: - case 251 /* NamespaceImport */: - case 250 /* ImportClause */: - var result_5 = 0 /* None */; + case 249 /* ImportEqualsDeclaration */: + case 252 /* NamespaceImport */: + case 251 /* ImportClause */: + var result_7 = 0 /* None */; var target = resolveAlias(getSymbolOfNode(d)); - ts.forEach(target.declarations, function (d) { result_5 |= getDeclarationSpaces(d); }); - return result_5; - case 237 /* VariableDeclaration */: - case 186 /* BindingElement */: - case 239 /* FunctionDeclaration */: - case 253 /* ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 + ts.forEach(target.declarations, function (d) { result_7 |= getDeclarationSpaces(d); }); + return result_7; + case 238 /* VariableDeclaration */: + case 187 /* BindingElement */: + case 240 /* FunctionDeclaration */: + case 254 /* ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 return 1 /* ExportValue */; default: - return ts.Debug.fail(ts.Debug.showSyntaxKind(d)); + return ts.Debug.failBadSyntaxKind(d); } } } @@ -54319,7 +55228,7 @@ var ts; var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 67220415 /* Value */, /*ignoreErrors*/ true); var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : errorType; if (promiseConstructorType === errorType) { - if (promiseConstructorName.kind === 72 /* Identifier */ && promiseConstructorName.escapedText === "Promise" && getTargetType(returnType) === getGlobalPromiseType(/*reportErrors*/ false)) { + if (promiseConstructorName.kind === 73 /* Identifier */ && promiseConstructorName.escapedText === "Promise" && getTargetType(returnType) === getGlobalPromiseType(/*reportErrors*/ false)) { error(returnTypeNode, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option); } else { @@ -54358,24 +55267,24 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 240 /* ClassDeclaration */: + case 241 /* ClassDeclaration */: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 151 /* Parameter */: + case 152 /* Parameter */: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages( /*details*/ undefined, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any); break; - case 154 /* PropertyDeclaration */: + case 155 /* PropertyDeclaration */: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages( /*details*/ undefined, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any); break; - case 156 /* MethodDeclaration */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 157 /* MethodDeclaration */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]); @@ -54396,7 +55305,7 @@ var ts; if (!typeName) return; var rootName = getFirstIdentifier(typeName); - var meaning = (typeName.kind === 72 /* Identifier */ ? 67897832 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */; + var meaning = (typeName.kind === 73 /* Identifier */ ? 67897832 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */; var rootSymbol = resolveName(rootName, rootName.escapedText, meaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isRefernce*/ true); if (rootSymbol && rootSymbol.flags & 2097152 /* Alias */ @@ -54421,29 +55330,29 @@ var ts; function getEntityNameForDecoratorMetadata(node) { if (node) { switch (node.kind) { - case 174 /* IntersectionType */: - case 173 /* UnionType */: + case 175 /* IntersectionType */: + case 174 /* UnionType */: return getEntityNameForDecoratorMetadataFromTypeList(node.types); - case 175 /* ConditionalType */: + case 176 /* ConditionalType */: return getEntityNameForDecoratorMetadataFromTypeList([node.trueType, node.falseType]); - case 177 /* ParenthesizedType */: + case 178 /* ParenthesizedType */: return getEntityNameForDecoratorMetadata(node.type); - case 164 /* TypeReference */: + case 165 /* TypeReference */: return node.typeName; } } } function getEntityNameForDecoratorMetadataFromTypeList(types) { var commonEntityName; - for (var _i = 0, types_17 = types; _i < types_17.length; _i++) { - var typeNode = types_17[_i]; - while (typeNode.kind === 177 /* ParenthesizedType */) { + for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { + var typeNode = types_16[_i]; + while (typeNode.kind === 178 /* ParenthesizedType */) { typeNode = typeNode.type; // Skip parens if need be } - if (typeNode.kind === 132 /* NeverKeyword */) { + if (typeNode.kind === 133 /* NeverKeyword */) { continue; // Always elide `never` from the union/intersection if possible } - if (!strictNullChecks && (typeNode.kind === 96 /* NullKeyword */ || typeNode.kind === 141 /* UndefinedKeyword */)) { + if (!strictNullChecks && (typeNode.kind === 97 /* NullKeyword */ || typeNode.kind === 142 /* UndefinedKeyword */)) { continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks } var individualEntityName = getEntityNameForDecoratorMetadata(typeNode); @@ -54485,18 +55394,18 @@ var ts; return; } if (!compilerOptions.experimentalDecorators) { - error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning); + error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning); } var firstDecorator = node.decorators[0]; checkExternalEmitHelpers(firstDecorator, 8 /* Decorate */); - if (node.kind === 151 /* Parameter */) { + if (node.kind === 152 /* Parameter */) { checkExternalEmitHelpers(firstDecorator, 32 /* Param */); } if (compilerOptions.emitDecoratorMetadata) { checkExternalEmitHelpers(firstDecorator, 16 /* Metadata */); // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { - case 240 /* ClassDeclaration */: + case 241 /* ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { @@ -54505,23 +55414,23 @@ var ts; } } break; - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - var otherKind = node.kind === 158 /* GetAccessor */ ? 159 /* SetAccessor */ : 158 /* GetAccessor */; + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + var otherKind = node.kind === 159 /* GetAccessor */ ? 160 /* SetAccessor */ : 159 /* GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind); markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor)); break; - case 156 /* MethodDeclaration */: + case 157 /* MethodDeclaration */: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveReturnTypeNode(node)); break; - case 154 /* PropertyDeclaration */: + case 155 /* PropertyDeclaration */: markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveTypeAnnotationNode(node)); break; - case 151 /* Parameter */: + case 152 /* Parameter */: markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); var containingSignature = node.parent; for (var _d = 0, _e = containingSignature.parameters; _d < _e.length; _d++) { @@ -54584,7 +55493,7 @@ var ts; else if (ts.findLast(ts.getJSDocTags(decl), ts.isJSDocParameterTag) === node && node.typeExpression && node.typeExpression.type && !isArrayType(getTypeFromTypeNode(node.typeExpression.type))) { - error(node.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type, ts.idText(node.name.kind === 148 /* QualifiedName */ ? node.name.right : node.name)); + error(node.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type, ts.idText(node.name.kind === 149 /* QualifiedName */ ? node.name.right : node.name)); } } } @@ -54617,9 +55526,9 @@ var ts; } function getIdentifierFromEntityNameExpression(node) { switch (node.kind) { - case 72 /* Identifier */: + case 73 /* Identifier */: return node; - case 189 /* PropertyAccessExpression */: + case 190 /* PropertyAccessExpression */: return node.name; default: return undefined; @@ -54632,7 +55541,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name && node.name.kind === 149 /* ComputedPropertyName */) { + if (node.name && node.name.kind === 150 /* ComputedPropertyName */) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); @@ -54661,7 +55570,7 @@ var ts; } } } - var body = node.kind === 155 /* MethodSignature */ ? undefined : node.body; + var body = node.kind === 156 /* MethodSignature */ ? undefined : node.body; checkSourceElement(body); if ((functionFlags & 1 /* Generator */) === 0) { // Async function or normal function var returnOrPromisedType = getReturnOrPromisedType(node, functionFlags); @@ -54706,42 +55615,42 @@ var ts; for (var _i = 0, potentiallyUnusedIdentifiers_1 = potentiallyUnusedIdentifiers; _i < potentiallyUnusedIdentifiers_1.length; _i++) { var node = potentiallyUnusedIdentifiers_1[_i]; switch (node.kind) { - case 240 /* ClassDeclaration */: - case 209 /* ClassExpression */: + case 241 /* ClassDeclaration */: + case 210 /* ClassExpression */: checkUnusedClassMembers(node, addDiagnostic); checkUnusedTypeParameters(node, addDiagnostic); break; - case 284 /* SourceFile */: - case 244 /* ModuleDeclaration */: - case 218 /* Block */: - case 246 /* CaseBlock */: - case 225 /* ForStatement */: - case 226 /* ForInStatement */: - case 227 /* ForOfStatement */: + case 285 /* SourceFile */: + case 245 /* ModuleDeclaration */: + case 219 /* Block */: + case 247 /* CaseBlock */: + case 226 /* ForStatement */: + case 227 /* ForInStatement */: + case 228 /* ForOfStatement */: checkUnusedLocalsAndParameters(node, addDiagnostic); break; - case 157 /* Constructor */: - case 196 /* FunctionExpression */: - case 239 /* FunctionDeclaration */: - case 197 /* ArrowFunction */: - case 156 /* MethodDeclaration */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 158 /* Constructor */: + case 197 /* FunctionExpression */: + case 240 /* FunctionDeclaration */: + case 198 /* ArrowFunction */: + case 157 /* MethodDeclaration */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: if (node.body) { // Don't report unused parameters in overloads checkUnusedLocalsAndParameters(node, addDiagnostic); } checkUnusedTypeParameters(node, addDiagnostic); break; - case 155 /* MethodSignature */: - case 160 /* CallSignature */: - case 161 /* ConstructSignature */: - case 165 /* FunctionType */: - case 166 /* ConstructorType */: - case 242 /* TypeAliasDeclaration */: - case 241 /* InterfaceDeclaration */: + case 156 /* MethodSignature */: + case 161 /* CallSignature */: + case 162 /* ConstructSignature */: + case 166 /* FunctionType */: + case 167 /* ConstructorType */: + case 243 /* TypeAliasDeclaration */: + case 242 /* InterfaceDeclaration */: checkUnusedTypeParameters(node, addDiagnostic); break; - case 176 /* InferType */: + case 177 /* InferType */: checkUnusedInferTypeParameter(node, addDiagnostic); break; default: @@ -54761,11 +55670,11 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 156 /* MethodDeclaration */: - case 154 /* PropertyDeclaration */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - if (member.kind === 159 /* SetAccessor */ && member.symbol.flags & 32768 /* GetAccessor */) { + case 157 /* MethodDeclaration */: + case 155 /* PropertyDeclaration */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + if (member.kind === 160 /* SetAccessor */ && member.symbol.flags & 32768 /* GetAccessor */) { // Already would have reported an error on the getter. break; } @@ -54774,7 +55683,7 @@ var ts; addDiagnostic(member, 0 /* Local */, ts.createDiagnosticForNode(member.name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol))); } break; - case 157 /* Constructor */: + case 158 /* Constructor */: for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; if (!parameter.symbol.isReferenced && ts.hasModifier(parameter, 8 /* Private */)) { @@ -54782,8 +55691,8 @@ var ts; } } break; - case 162 /* IndexSignature */: - case 217 /* SemicolonClassElement */: + case 163 /* IndexSignature */: + case 218 /* SemicolonClassElement */: // Can't be private break; default: @@ -54810,7 +55719,7 @@ var ts; continue; var name = ts.idText(typeParameter.name); var parent = typeParameter.parent; - if (parent.kind !== 176 /* InferType */ && parent.typeParameters.every(isTypeParameterUnused)) { + if (parent.kind !== 177 /* InferType */ && parent.typeParameters.every(isTypeParameterUnused)) { if (seenParentsWithEveryUnused.tryAdd(parent)) { var range = ts.isJSDocTemplateTag(parent) // Whole @template tag @@ -54895,7 +55804,7 @@ var ts; var importDecl = importClause.parent; var nDeclarations = (importClause.name ? 1 : 0) + (importClause.namedBindings ? - (importClause.namedBindings.kind === 251 /* NamespaceImport */ ? 1 : importClause.namedBindings.elements.length) + (importClause.namedBindings.kind === 252 /* NamespaceImport */ ? 1 : importClause.namedBindings.elements.length) : 0); if (nDeclarations === unuseds.length) { addDiagnostic(importDecl, 0 /* Local */, unuseds.length === 1 @@ -54913,7 +55822,7 @@ var ts; var bindingPattern = _a[0], bindingElements = _a[1]; var kind = tryGetRootParameterDeclaration(bindingPattern.parent) ? 1 /* Parameter */ : 0 /* Local */; if (bindingPattern.elements.length === bindingElements.length) { - if (bindingElements.length === 1 && bindingPattern.parent.kind === 237 /* VariableDeclaration */ && bindingPattern.parent.parent.kind === 238 /* VariableDeclarationList */) { + if (bindingElements.length === 1 && bindingPattern.parent.kind === 238 /* VariableDeclaration */ && bindingPattern.parent.parent.kind === 239 /* VariableDeclarationList */) { addToGroup(unusedVariables, bindingPattern.parent.parent, bindingPattern.parent, getNodeId); } else { @@ -54934,7 +55843,7 @@ var ts; if (declarationList.declarations.length === declarations.length) { addDiagnostic(declarationList, 0 /* Local */, declarations.length === 1 ? ts.createDiagnosticForNode(ts.first(declarations).name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(ts.first(declarations).name)) - : ts.createDiagnosticForNode(declarationList.parent.kind === 219 /* VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused)); + : ts.createDiagnosticForNode(declarationList.parent.kind === 220 /* VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused)); } else { for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { @@ -54946,24 +55855,24 @@ var ts; } function bindingNameText(name) { switch (name.kind) { - case 72 /* Identifier */: + case 73 /* Identifier */: return ts.idText(name); - case 185 /* ArrayBindingPattern */: - case 184 /* ObjectBindingPattern */: + case 186 /* ArrayBindingPattern */: + case 185 /* ObjectBindingPattern */: return bindingNameText(ts.cast(ts.first(name.elements), ts.isBindingElement).name); default: return ts.Debug.assertNever(name); } } function isImportedDeclaration(node) { - return node.kind === 250 /* ImportClause */ || node.kind === 253 /* ImportSpecifier */ || node.kind === 251 /* NamespaceImport */; + return node.kind === 251 /* ImportClause */ || node.kind === 254 /* ImportSpecifier */ || node.kind === 252 /* NamespaceImport */; } function importClauseFromImported(decl) { - return decl.kind === 250 /* ImportClause */ ? decl : decl.kind === 251 /* NamespaceImport */ ? decl.parent : decl.parent.parent; + return decl.kind === 251 /* ImportClause */ ? decl : decl.kind === 252 /* NamespaceImport */ ? decl.parent : decl.parent.parent; } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 218 /* Block */) { + if (node.kind === 219 /* Block */) { checkGrammarStatementInAmbientContext(node); } if (ts.isFunctionOrModuleBlock(node)) { @@ -54993,12 +55902,12 @@ var ts; if (!(identifier && identifier.escapedText === name)) { return false; } - if (node.kind === 154 /* PropertyDeclaration */ || - node.kind === 153 /* PropertySignature */ || - node.kind === 156 /* MethodDeclaration */ || - node.kind === 155 /* MethodSignature */ || - node.kind === 158 /* GetAccessor */ || - node.kind === 159 /* SetAccessor */) { + if (node.kind === 155 /* PropertyDeclaration */ || + node.kind === 154 /* PropertySignature */ || + node.kind === 157 /* MethodDeclaration */ || + node.kind === 156 /* MethodSignature */ || + node.kind === 159 /* GetAccessor */ || + node.kind === 160 /* SetAccessor */) { // it is ok to have member named '_super' or '_this' - member access is always qualified return false; } @@ -55007,7 +55916,7 @@ var ts; return false; } var root = ts.getRootDeclaration(node); - if (root.kind === 151 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 152 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { // just an overload - no codegen impact return false; } @@ -55017,7 +55926,7 @@ var ts; function checkIfThisIsCapturedInEnclosingScope(node) { ts.findAncestor(node, function (current) { if (getNodeCheckFlags(current) & 4 /* CaptureThis */) { - var isDeclaration_1 = node.kind !== 72 /* Identifier */; + var isDeclaration_1 = node.kind !== 73 /* Identifier */; if (isDeclaration_1) { error(ts.getNameOfDeclaration(node), ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); } @@ -55032,7 +55941,7 @@ var ts; function checkIfNewTargetIsCapturedInEnclosingScope(node) { ts.findAncestor(node, function (current) { if (getNodeCheckFlags(current) & 8 /* CaptureNewTarget */) { - var isDeclaration_2 = node.kind !== 72 /* Identifier */; + var isDeclaration_2 = node.kind !== 73 /* Identifier */; if (isDeclaration_2) { error(ts.getNameOfDeclaration(node), ts.Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference); } @@ -55058,7 +55967,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 284 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 285 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -55073,7 +55982,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 284 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) { + if (parent.kind === 285 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) { // If the declaration happens to be in external module, report error that Promise is a reserved identifier. error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -55108,7 +56017,7 @@ var ts; // skip variable declarations that don't have initializers // NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern // so we'll always treat binding elements as initialized - if (node.kind === 237 /* VariableDeclaration */ && !node.initializer) { + if (node.kind === 238 /* VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -55120,17 +56029,17 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 238 /* VariableDeclarationList */); - var container = varDeclList.parent.kind === 219 /* VariableStatement */ && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 239 /* VariableDeclarationList */); + var container = varDeclList.parent.kind === 220 /* VariableStatement */ && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; // names of block-scoped and function scoped variables can collide only // if block scoped variable is defined in the function\module\source file scope (because of variable hoisting) var namesShareScope = container && - (container.kind === 218 /* Block */ && ts.isFunctionLike(container.parent) || - container.kind === 245 /* ModuleBlock */ || - container.kind === 244 /* ModuleDeclaration */ || - container.kind === 284 /* SourceFile */); + (container.kind === 219 /* Block */ && ts.isFunctionLike(container.parent) || + container.kind === 246 /* ModuleBlock */ || + container.kind === 245 /* ModuleDeclaration */ || + container.kind === 285 /* SourceFile */); // here we know that function scoped variable is shadowed by block scoped one // if they are defined in the same scope - binder has already reported redeclaration error // otherwise if variable has an initializer - show error that initialization will fail @@ -55143,69 +56052,6 @@ var ts; } } } - // Check that a parameter initializer contains no references to parameters declared to the right of itself - function checkParameterInitializer(node) { - if (ts.getRootDeclaration(node).kind !== 151 /* Parameter */) { - return; - } - var func = ts.getContainingFunction(node); - visit(node.initializer); - function visit(n) { - if (ts.isTypeNode(n) || ts.isDeclarationName(n)) { - // do not dive in types - // skip declaration names (i.e. in object literal expressions) - return; - } - if (n.kind === 189 /* PropertyAccessExpression */) { - // skip property names in property access expression - return visit(n.expression); - } - else if (n.kind === 72 /* Identifier */) { - // check FunctionLikeDeclaration.locals (stores parameters\function local variable) - // if it contains entry with a specified name - var symbol = resolveName(n, n.escapedText, 67220415 /* Value */ | 2097152 /* Alias */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false); - if (!symbol || symbol === unknownSymbol || !symbol.valueDeclaration) { - return; - } - if (symbol.valueDeclaration === node) { - error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); - return; - } - // locals map for function contain both parameters and function locals - // so we need to do a bit of extra work to check if reference is legal - var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); - if (enclosingContainer === func) { - if (symbol.valueDeclaration.kind === 151 /* Parameter */ || - symbol.valueDeclaration.kind === 186 /* BindingElement */) { - // it is ok to reference parameter in initializer if either - // - parameter is located strictly on the left of current parameter declaration - if (symbol.valueDeclaration.pos < node.pos) { - return; - } - // - parameter is wrapped in function-like entity - if (ts.findAncestor(n, function (current) { - if (current === node.initializer) { - return "quit"; - } - return ts.isFunctionLike(current.parent) || - // computed property names/initializers in instance property declaration of class like entities - // are executed in constructor and thus deferred - (current.parent.kind === 154 /* PropertyDeclaration */ && - !(ts.hasModifier(current.parent, 32 /* Static */)) && - ts.isClassLike(current.parent.parent)); - })) { - return; - } - // fall through to report error - } - error(n, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(node.name), ts.declarationNameToString(n)); - } - } - else { - return ts.forEachChild(n, visit); - } - } - } function convertAutoToAny(type) { return type === autoType ? anyType : type === autoArrayType ? anyArrayType : type; } @@ -55223,18 +56069,18 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 149 /* ComputedPropertyName */) { + if (node.name.kind === 150 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } } - if (node.kind === 186 /* BindingElement */) { - if (node.parent.kind === 184 /* ObjectBindingPattern */ && languageVersion < 7 /* ESNext */) { + if (node.kind === 187 /* BindingElement */) { + if (node.parent.kind === 185 /* ObjectBindingPattern */ && languageVersion < 8 /* ESNext */) { checkExternalEmitHelpers(node, 4 /* Rest */); } // check computed properties inside property names of binding elements - if (node.propertyName && node.propertyName.kind === 149 /* ComputedPropertyName */) { + if (node.propertyName && node.propertyName.kind === 150 /* ComputedPropertyName */) { checkComputedPropertyName(node.propertyName); } // check private/protected variable access @@ -55248,35 +56094,48 @@ var ts; var property = getPropertyOfType(parentType, nameText); if (property) { markPropertyAsReferenced(property, /*nodeForCheckWriteOnly*/ undefined, /*isThisAccess*/ false); // A destructuring is never a write-only reference. - checkPropertyAccessibility(parent, !!parent.initializer && parent.initializer.kind === 98 /* SuperKeyword */, parentType, property); + checkPropertyAccessibility(parent, !!parent.initializer && parent.initializer.kind === 99 /* SuperKeyword */, parentType, property); } } } } // For a binding pattern, check contained binding elements if (ts.isBindingPattern(node.name)) { - if (node.name.kind === 185 /* ArrayBindingPattern */ && languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) { + if (node.name.kind === 186 /* ArrayBindingPattern */ && languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) { checkExternalEmitHelpers(node, 512 /* Read */); } ts.forEach(node.name.elements, checkSourceElement); } // For a parameter declaration with an initializer, error and exit if the containing function doesn't have a body - if (node.initializer && ts.getRootDeclaration(node).kind === 151 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 152 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } // For a binding pattern, validate the initializer and exit if (ts.isBindingPattern(node.name)) { - // Don't validate for-in initializer as it is already an error - if (node.initializer && node.parent.parent.kind !== 226 /* ForInStatement */) { - var initializerType = checkExpressionCached(node.initializer); - if (strictNullChecks && node.name.elements.length === 0) { - checkNonNullType(initializerType, node); + var needCheckInitializer = node.initializer && node.parent.parent.kind !== 227 /* ForInStatement */; + var needCheckWidenedType = node.name.elements.length === 0; + if (needCheckInitializer || needCheckWidenedType) { + // Don't validate for-in initializer as it is already an error + var widenedType = getWidenedTypeForVariableLikeDeclaration(node); + if (needCheckInitializer) { + var initializerType = checkExpressionCached(node.initializer); + if (strictNullChecks && needCheckWidenedType) { + checkNonNullNonVoidType(initializerType, node); + } + else { + checkTypeAssignableToAndOptionallyElaborate(initializerType, getWidenedTypeForVariableLikeDeclaration(node), node, node.initializer); + } } - else { - checkTypeAssignableToAndOptionallyElaborate(initializerType, getWidenedTypeForVariableLikeDeclaration(node), node, node.initializer); + // check the binding pattern with empty elements + if (needCheckWidenedType) { + if (ts.isArrayBindingPattern(node.name)) { + checkIteratedTypeOrElementType(widenedType, node, /* allowStringInput */ false, /* allowAsyncIterables */ false); + } + else if (strictNullChecks) { + checkNonNullNonVoidType(widenedType, node); + } } - checkParameterInitializer(node); } return; } @@ -55291,9 +56150,8 @@ var ts; ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || ts.isPrototypeAccess(node.name)) && ts.hasEntries(symbol.exports); - if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 226 /* ForInStatement */) { + if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 227 /* ForInStatement */) { checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(initializer), type, node, initializer, /*headMessage*/ undefined); - checkParameterInitializer(node); } } if (symbol.declarations.length > 1) { @@ -55309,7 +56167,7 @@ var ts; if (type !== errorType && declarationType !== errorType && !isTypeIdenticalTo(type, declarationType) && !(symbol.flags & 67108864 /* Assignment */)) { - errorNextVariableOrPropertyDeclarationMustHaveSameType(type, node, declarationType); + errorNextVariableOrPropertyDeclarationMustHaveSameType(symbol.valueDeclaration, type, node, declarationType); } if (node.initializer) { checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(node.initializer), declarationType, node, node.initializer, /*headMessage*/ undefined); @@ -55318,26 +56176,30 @@ var ts; error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name)); } } - if (node.kind !== 154 /* PropertyDeclaration */ && node.kind !== 153 /* PropertySignature */) { + if (node.kind !== 155 /* PropertyDeclaration */ && node.kind !== 154 /* PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 237 /* VariableDeclaration */ || node.kind === 186 /* BindingElement */) { + if (node.kind === 238 /* VariableDeclaration */ || node.kind === 187 /* BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } } - function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstType, nextDeclaration, nextType) { + function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration, firstType, nextDeclaration, nextType) { var nextDeclarationName = ts.getNameOfDeclaration(nextDeclaration); - var message = nextDeclaration.kind === 154 /* PropertyDeclaration */ || nextDeclaration.kind === 153 /* PropertySignature */ + var message = nextDeclaration.kind === 155 /* PropertyDeclaration */ || nextDeclaration.kind === 154 /* PropertySignature */ ? ts.Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2 : ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2; - error(nextDeclarationName, message, ts.declarationNameToString(nextDeclarationName), typeToString(firstType), typeToString(nextType)); + var declName = ts.declarationNameToString(nextDeclarationName); + var err = error(nextDeclarationName, message, declName, typeToString(firstType), typeToString(nextType)); + if (firstDeclaration) { + ts.addRelatedInfo(err, ts.createDiagnosticForNode(firstDeclaration, ts.Diagnostics._0_was_also_declared_here, declName)); + } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 151 /* Parameter */ && right.kind === 237 /* VariableDeclaration */) || - (left.kind === 237 /* VariableDeclaration */ && right.kind === 151 /* Parameter */)) { + if ((left.kind === 152 /* Parameter */ && right.kind === 238 /* VariableDeclaration */) || + (left.kind === 238 /* VariableDeclaration */ && right.kind === 152 /* Parameter */)) { // Differences in optionality between parameters and variables are allowed. return true; } @@ -55376,7 +56238,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkTruthinessExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 220 /* EmptyStatement */) { + if (node.thenStatement.kind === 221 /* EmptyStatement */) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -55403,12 +56265,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 238 /* VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 239 /* VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 238 /* VariableDeclarationList */) { + if (node.initializer.kind === 239 /* VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -55428,7 +56290,7 @@ var ts; checkGrammarForInOrForOfStatement(node); if (node.awaitModifier) { var functionFlags = ts.getFunctionFlags(ts.getContainingFunction(node)); - if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 7 /* ESNext */) { + if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 8 /* ESNext */) { // for..await..of in an async function or async generator function prior to ESNext requires the __asyncValues helper checkExternalEmitHelpers(node, 16384 /* ForAwaitOfIncludes */); } @@ -55442,14 +56304,14 @@ var ts; // via checkRightHandSideOfForOf. // If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference. // Then check that the RHS is assignable to it. - if (node.initializer.kind === 238 /* VariableDeclarationList */) { + if (node.initializer.kind === 239 /* VariableDeclarationList */) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node.expression, node.awaitModifier); // There may be a destructuring assignment on the left side - if (varExpr.kind === 187 /* ArrayLiteralExpression */ || varExpr.kind === 188 /* ObjectLiteralExpression */) { + if (varExpr.kind === 188 /* ArrayLiteralExpression */ || varExpr.kind === 189 /* ObjectLiteralExpression */) { // iteratedType may be undefined. In this case, we still want to check the structure of // varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like // to short circuit the type relation checking as much as possible, so we pass the unknownType. @@ -55481,7 +56343,7 @@ var ts; // for (let VarDecl in Expr) Statement // VarDecl must be a variable declaration without a type annotation that declares a variable of type Any, // and Expr must be an expression of type Any, an object type, or a type parameter type. - if (node.initializer.kind === 238 /* VariableDeclarationList */) { + if (node.initializer.kind === 239 /* VariableDeclarationList */) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -55495,7 +56357,7 @@ var ts; // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 187 /* ArrayLiteralExpression */ || varExpr.kind === 188 /* ObjectLiteralExpression */) { + if (varExpr.kind === 188 /* ArrayLiteralExpression */ || varExpr.kind === 189 /* ObjectLiteralExpression */) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { @@ -55855,12 +56717,12 @@ var ts; // for generators. return; } - else if (func.kind === 159 /* SetAccessor */) { + else if (func.kind === 160 /* SetAccessor */) { if (node.expression) { error(node, ts.Diagnostics.Setters_cannot_return_a_value); } } - else if (func.kind === 157 /* Constructor */) { + else if (func.kind === 158 /* Constructor */) { if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) { error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -55881,7 +56743,7 @@ var ts; } } } - else if (func.kind !== 157 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType) && !isGenerator) { + else if (func.kind !== 158 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType) && !isGenerator) { // The function has a return type, but the return statement doesn't have an expression. error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); } @@ -55910,7 +56772,7 @@ var ts; var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 272 /* DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 273 /* DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -55922,7 +56784,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 271 /* CaseClause */) { + if (produceDiagnostics && clause.kind === 272 /* CaseClause */) { // TypeScript 1.0 spec (April 2014): 5.9 // In a 'switch' statement, each 'case' expression must be of a type that is comparable // to or from the type of the 'switch' expression. @@ -55951,7 +56813,7 @@ var ts; if (ts.isFunctionLike(current)) { return "quit"; } - if (current.kind === 233 /* LabeledStatement */ && current.label.escapedText === node.label.escapedText) { + if (current.kind === 234 /* LabeledStatement */ && current.label.escapedText === node.label.escapedText) { grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNode(node.label)); return true; } @@ -56058,8 +56920,8 @@ var ts; // this allows us to rule out cases when both property and indexer are inherited from the base class var errorNode; if (propDeclaration && name && - (propDeclaration.kind === 204 /* BinaryExpression */ || - name.kind === 149 /* ComputedPropertyName */ || + (propDeclaration.kind === 205 /* BinaryExpression */ || + name.kind === 150 /* ComputedPropertyName */ || prop.parent === containingType.symbol)) { errorNode = propDeclaration; } @@ -56136,7 +56998,7 @@ var ts; function checkTypeParametersNotReferenced(root, typeParameters, index) { visit(root); function visit(node) { - if (node.kind === 164 /* TypeReference */) { + if (node.kind === 165 /* TypeReference */) { var type = getTypeFromTypeReference(node); if (type.flags & 262144 /* TypeParameter */) { for (var i = index; i < typeParameters.length; i++) { @@ -56258,6 +57120,11 @@ var ts; if (languageVersion < 2 /* ES2015 */) { checkExternalEmitHelpers(baseTypeNode.parent, 1 /* Extends */); } + // check both @extends and extends if both are specified. + var extendsNode = ts.getClassExtendsHeritageElement(node); + if (extendsNode && extendsNode !== baseTypeNode) { + checkExpression(extendsNode.expression); + } var baseTypes = getBaseTypes(type); if (baseTypes.length && produceDiagnostics) { var baseType_1 = baseTypes[0]; @@ -56265,10 +57132,6 @@ var ts; var staticBaseType = getApparentType(baseConstructorType); checkBaseTypeAccessibility(staticBaseType, baseTypeNode); checkSourceElement(baseTypeNode.expression); - var extendsNode = ts.getClassExtendsHeritageElement(node); - if (extendsNode && extendsNode !== baseTypeNode) { - checkExpression(extendsNode.expression); - } if (ts.some(baseTypeNode.typeArguments)) { ts.forEach(baseTypeNode.typeArguments, checkSourceElement); for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode); _i < _a.length; _i++) { @@ -56339,7 +57202,7 @@ var ts; function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) { // iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible var issuedMemberError = false; - var _loop_9 = function (member) { + var _loop_12 = function (member) { if (ts.hasStaticModifier(member)) { return "continue"; } @@ -56358,7 +57221,7 @@ var ts; }; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - _loop_9(member); + _loop_12(member); } if (!issuedMemberError) { // check again with diagnostics to generate a less-specific error @@ -56384,7 +57247,7 @@ var ts; } function getClassOrInterfaceDeclarationsOfSymbol(symbol) { return ts.filter(symbol.declarations, function (d) { - return d.kind === 240 /* ClassDeclaration */ || d.kind === 241 /* InterfaceDeclaration */; + return d.kind === 241 /* ClassDeclaration */ || d.kind === 242 /* InterfaceDeclaration */; }); } function checkKindsOfPropertyMemberOverrides(type, baseType) { @@ -56423,7 +57286,7 @@ var ts; // If there is no declaration for the derived class (as in the case of class expressions), // then the class cannot be declared abstract. if (baseDeclarationFlags & 128 /* Abstract */ && (!derivedClassDecl || !ts.hasModifier(derivedClassDecl, 128 /* Abstract */))) { - if (derivedClassDecl.kind === 209 /* ClassExpression */) { + if (derivedClassDecl.kind === 210 /* ClassExpression */) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -56473,8 +57336,8 @@ var ts; for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) { var base = baseTypes_2[_i]; var properties = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType)); - for (var _a = 0, properties_7 = properties; _a < properties_7.length; _a++) { - var prop = properties_7[_a]; + for (var _a = 0, properties_4 = properties; _a < properties_4.length; _a++) { + var prop = properties_4[_a]; var existing = seen.get(prop.escapedName); if (!existing) { seen.set(prop.escapedName, { prop: prop, containingType: base }); @@ -56515,7 +57378,7 @@ var ts; } } function isInstancePropertyWithoutInitializer(node) { - return node.kind === 154 /* PropertyDeclaration */ && + return node.kind === 155 /* PropertyDeclaration */ && !ts.hasModifier(node, 32 /* Static */ | 128 /* Abstract */) && !node.exclamationToken && !node.initializer; @@ -56539,7 +57402,7 @@ var ts; var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(symbol); // Only check this symbol once - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 241 /* InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 242 /* InterfaceDeclaration */); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -56644,7 +57507,7 @@ var ts; return value; function evaluate(expr) { switch (expr.kind) { - case 202 /* PrefixUnaryExpression */: + case 203 /* PrefixUnaryExpression */: var value_2 = evaluate(expr.operand); if (typeof value_2 === "number") { switch (expr.operator) { @@ -56654,7 +57517,7 @@ var ts; } } break; - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: var left = evaluate(expr.left); var right = evaluate(expr.right); if (typeof left === "number" && typeof right === "number") { @@ -56682,22 +57545,22 @@ var ts; case 8 /* NumericLiteral */: checkGrammarNumericLiteral(expr); return +expr.text; - case 195 /* ParenthesizedExpression */: + case 196 /* ParenthesizedExpression */: return evaluate(expr.expression); - case 72 /* Identifier */: + case 73 /* Identifier */: var identifier = expr; if (isInfinityOrNaNString(identifier.escapedText)) { return +(identifier.escapedText); } return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText); - case 190 /* ElementAccessExpression */: - case 189 /* PropertyAccessExpression */: + case 191 /* ElementAccessExpression */: + case 190 /* PropertyAccessExpression */: var ex = expr; if (isConstantMemberAccess(ex)) { var type = getTypeOfExpression(ex.expression); if (type.symbol && type.symbol.flags & 384 /* Enum */) { var name = void 0; - if (ex.kind === 189 /* PropertyAccessExpression */) { + if (ex.kind === 190 /* PropertyAccessExpression */) { name = ex.name.escapedText; } else { @@ -56728,9 +57591,9 @@ var ts; } } function isConstantMemberAccess(node) { - return node.kind === 72 /* Identifier */ || - node.kind === 189 /* PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || - node.kind === 190 /* ElementAccessExpression */ && isConstantMemberAccess(node.expression) && + return node.kind === 73 /* Identifier */ || + node.kind === 190 /* PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || + node.kind === 191 /* ElementAccessExpression */ && isConstantMemberAccess(node.expression) && node.argumentExpression.kind === 10 /* StringLiteral */; } function checkEnumDeclaration(node) { @@ -56765,7 +57628,7 @@ var ts; var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { // return true if we hit a violation of the rule, false otherwise - if (declaration.kind !== 243 /* EnumDeclaration */) { + if (declaration.kind !== 244 /* EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -56788,8 +57651,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { var declaration = declarations_8[_i]; - if ((declaration.kind === 240 /* ClassDeclaration */ || - (declaration.kind === 239 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 241 /* ClassDeclaration */ || + (declaration.kind === 240 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !(declaration.flags & 4194304 /* Ambient */)) { return declaration; } @@ -56852,7 +57715,7 @@ var ts; } // if the module merges with a class declaration in the same lexical scope, // we need to track this to ensure the correct emit. - var mergedClass = ts.getDeclarationOfKind(symbol, 240 /* ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 241 /* ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* LexicalModuleMergesWithClass */; @@ -56902,23 +57765,23 @@ var ts; } function checkModuleAugmentationElement(node, isGlobalAugmentation) { switch (node.kind) { - case 219 /* VariableStatement */: + case 220 /* VariableStatement */: // error each individual name in variable statement instead of marking the entire variable statement for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 254 /* ExportAssignment */: - case 255 /* ExportDeclaration */: + case 255 /* ExportAssignment */: + case 256 /* ExportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 248 /* ImportEqualsDeclaration */: - case 249 /* ImportDeclaration */: + case 249 /* ImportEqualsDeclaration */: + case 250 /* ImportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 186 /* BindingElement */: - case 237 /* VariableDeclaration */: + case 187 /* BindingElement */: + case 238 /* VariableDeclaration */: var name = node.name; if (ts.isBindingPattern(name)) { for (var _b = 0, _c = name.elements; _b < _c.length; _b++) { @@ -56929,12 +57792,12 @@ var ts; break; } // falls through - case 240 /* ClassDeclaration */: - case 243 /* EnumDeclaration */: - case 239 /* FunctionDeclaration */: - case 241 /* InterfaceDeclaration */: - case 244 /* ModuleDeclaration */: - case 242 /* TypeAliasDeclaration */: + case 241 /* ClassDeclaration */: + case 244 /* EnumDeclaration */: + case 240 /* FunctionDeclaration */: + case 242 /* InterfaceDeclaration */: + case 245 /* ModuleDeclaration */: + case 243 /* TypeAliasDeclaration */: if (isGlobalAugmentation) { return; } @@ -56955,17 +57818,17 @@ var ts; } function getFirstIdentifier(node) { switch (node.kind) { - case 72 /* Identifier */: + case 73 /* Identifier */: return node; - case 148 /* QualifiedName */: + case 149 /* QualifiedName */: do { node = node.left; - } while (node.kind !== 72 /* Identifier */); + } while (node.kind !== 73 /* Identifier */); return node; - case 189 /* PropertyAccessExpression */: + case 190 /* PropertyAccessExpression */: do { node = node.expression; - } while (node.kind !== 72 /* Identifier */); + } while (node.kind !== 73 /* Identifier */); return node; } } @@ -56979,9 +57842,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 245 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 284 /* SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 255 /* ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 246 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 285 /* SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 256 /* ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -57014,14 +57877,14 @@ var ts; (symbol.flags & 67897832 /* Type */ ? 67897832 /* Type */ : 0) | (symbol.flags & 1920 /* Namespace */ ? 1920 /* Namespace */ : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 257 /* ExportSpecifier */ ? + var message = node.kind === 258 /* ExportSpecifier */ ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); } // Don't allow to re-export something with no value side when `--isolatedModules` is set. if (compilerOptions.isolatedModules - && node.kind === 257 /* ExportSpecifier */ + && node.kind === 258 /* ExportSpecifier */ && !(target.flags & 67220415 /* Value */) && !(node.flags & 4194304 /* Ambient */)) { error(node, ts.Diagnostics.Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided); @@ -57048,7 +57911,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 251 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 252 /* NamespaceImport */) { checkImportBinding(importClause.namedBindings); } else { @@ -57072,7 +57935,7 @@ var ts; if (ts.hasModifier(node, 1 /* Export */)) { markExportAsReferenced(node); } - if (node.moduleReference.kind !== 259 /* ExternalModuleReference */) { + if (node.moduleReference.kind !== 260 /* ExternalModuleReference */) { var target = resolveAlias(getSymbolOfNode(node)); if (target !== unknownSymbol) { if (target.flags & 67220415 /* Value */) { @@ -57108,10 +57971,10 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 245 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 245 /* ModuleBlock */ && + var inAmbientExternalModule = node.parent.kind === 246 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 246 /* ModuleBlock */ && !node.moduleSpecifier && node.flags & 4194304 /* Ambient */; - if (node.parent.kind !== 284 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { + if (node.parent.kind !== 285 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -57128,7 +57991,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 284 /* SourceFile */ || node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 244 /* ModuleDeclaration */; + var isInAppropriateContext = node.parent.kind === 285 /* SourceFile */ || node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 245 /* ModuleDeclaration */; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -57157,8 +58020,8 @@ var ts; // If we hit an export assignment in an illegal context, just bail out to avoid cascading errors. return; } - var container = node.parent.kind === 284 /* SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 244 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 285 /* SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 245 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { if (node.isExportEquals) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); } @@ -57171,7 +58034,7 @@ var ts; if (!checkGrammarDecoratorsAndModifiers(node) && ts.hasModifiers(node)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers); } - if (node.expression.kind === 72 /* Identifier */) { + if (node.expression.kind === 73 /* Identifier */) { markExportAsReferenced(node); if (ts.getEmitDeclarations(compilerOptions)) { collectLinkedAliases(node.expression, /*setVisibility*/ true); @@ -57246,7 +58109,7 @@ var ts; return !ts.isAccessor(declaration); } function isNotOverload(declaration) { - return (declaration.kind !== 239 /* FunctionDeclaration */ && declaration.kind !== 156 /* MethodDeclaration */) || + return (declaration.kind !== 240 /* FunctionDeclaration */ && declaration.kind !== 157 /* MethodDeclaration */) || !!declaration.body; } function checkSourceElement(node) { @@ -57269,158 +58132,158 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 244 /* ModuleDeclaration */: - case 240 /* ClassDeclaration */: - case 241 /* InterfaceDeclaration */: - case 239 /* FunctionDeclaration */: + case 245 /* ModuleDeclaration */: + case 241 /* ClassDeclaration */: + case 242 /* InterfaceDeclaration */: + case 240 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 150 /* TypeParameter */: + case 151 /* TypeParameter */: return checkTypeParameter(node); - case 151 /* Parameter */: + case 152 /* Parameter */: return checkParameter(node); - case 154 /* PropertyDeclaration */: - case 153 /* PropertySignature */: + case 155 /* PropertyDeclaration */: + case 154 /* PropertySignature */: return checkPropertyDeclaration(node); - case 165 /* FunctionType */: - case 166 /* ConstructorType */: - case 160 /* CallSignature */: - case 161 /* ConstructSignature */: - case 162 /* IndexSignature */: + case 166 /* FunctionType */: + case 167 /* ConstructorType */: + case 161 /* CallSignature */: + case 162 /* ConstructSignature */: + case 163 /* IndexSignature */: return checkSignatureDeclaration(node); - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: return checkMethodDeclaration(node); - case 157 /* Constructor */: + case 158 /* Constructor */: return checkConstructorDeclaration(node); - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: return checkAccessorDeclaration(node); - case 164 /* TypeReference */: + case 165 /* TypeReference */: return checkTypeReferenceNode(node); - case 163 /* TypePredicate */: + case 164 /* TypePredicate */: return checkTypePredicate(node); - case 167 /* TypeQuery */: + case 168 /* TypeQuery */: return checkTypeQuery(node); - case 168 /* TypeLiteral */: + case 169 /* TypeLiteral */: return checkTypeLiteral(node); - case 169 /* ArrayType */: + case 170 /* ArrayType */: return checkArrayType(node); - case 170 /* TupleType */: + case 171 /* TupleType */: return checkTupleType(node); - case 173 /* UnionType */: - case 174 /* IntersectionType */: + case 174 /* UnionType */: + case 175 /* IntersectionType */: return checkUnionOrIntersectionType(node); - case 177 /* ParenthesizedType */: - case 171 /* OptionalType */: - case 172 /* RestType */: + case 178 /* ParenthesizedType */: + case 172 /* OptionalType */: + case 173 /* RestType */: return checkSourceElement(node.type); - case 178 /* ThisType */: + case 179 /* ThisType */: return checkThisType(node); - case 179 /* TypeOperator */: + case 180 /* TypeOperator */: return checkTypeOperator(node); - case 175 /* ConditionalType */: + case 176 /* ConditionalType */: return checkConditionalType(node); - case 176 /* InferType */: + case 177 /* InferType */: return checkInferType(node); - case 183 /* ImportType */: + case 184 /* ImportType */: return checkImportType(node); - case 300 /* JSDocAugmentsTag */: + case 301 /* JSDocAugmentsTag */: return checkJSDocAugmentsTag(node); - case 309 /* JSDocTypedefTag */: - case 302 /* JSDocCallbackTag */: + case 310 /* JSDocTypedefTag */: + case 303 /* JSDocCallbackTag */: return checkJSDocTypeAliasTag(node); - case 308 /* JSDocTemplateTag */: + case 309 /* JSDocTemplateTag */: return checkJSDocTemplateTag(node); - case 307 /* JSDocTypeTag */: + case 308 /* JSDocTypeTag */: return checkJSDocTypeTag(node); - case 304 /* JSDocParameterTag */: + case 305 /* JSDocParameterTag */: return checkJSDocParameterTag(node); - case 294 /* JSDocFunctionType */: + case 295 /* JSDocFunctionType */: checkJSDocFunctionType(node); // falls through - case 292 /* JSDocNonNullableType */: - case 291 /* JSDocNullableType */: - case 289 /* JSDocAllType */: - case 290 /* JSDocUnknownType */: - case 297 /* JSDocTypeLiteral */: + case 293 /* JSDocNonNullableType */: + case 292 /* JSDocNullableType */: + case 290 /* JSDocAllType */: + case 291 /* JSDocUnknownType */: + case 298 /* JSDocTypeLiteral */: checkJSDocTypeIsInJsFile(node); ts.forEachChild(node, checkSourceElement); return; - case 295 /* JSDocVariadicType */: + case 296 /* JSDocVariadicType */: checkJSDocVariadicType(node); return; - case 288 /* JSDocTypeExpression */: + case 289 /* JSDocTypeExpression */: return checkSourceElement(node.type); - case 180 /* IndexedAccessType */: + case 181 /* IndexedAccessType */: return checkIndexedAccessType(node); - case 181 /* MappedType */: + case 182 /* MappedType */: return checkMappedType(node); - case 239 /* FunctionDeclaration */: + case 240 /* FunctionDeclaration */: return checkFunctionDeclaration(node); - case 218 /* Block */: - case 245 /* ModuleBlock */: + case 219 /* Block */: + case 246 /* ModuleBlock */: return checkBlock(node); - case 219 /* VariableStatement */: + case 220 /* VariableStatement */: return checkVariableStatement(node); - case 221 /* ExpressionStatement */: + case 222 /* ExpressionStatement */: return checkExpressionStatement(node); - case 222 /* IfStatement */: + case 223 /* IfStatement */: return checkIfStatement(node); - case 223 /* DoStatement */: + case 224 /* DoStatement */: return checkDoStatement(node); - case 224 /* WhileStatement */: + case 225 /* WhileStatement */: return checkWhileStatement(node); - case 225 /* ForStatement */: + case 226 /* ForStatement */: return checkForStatement(node); - case 226 /* ForInStatement */: + case 227 /* ForInStatement */: return checkForInStatement(node); - case 227 /* ForOfStatement */: + case 228 /* ForOfStatement */: return checkForOfStatement(node); - case 228 /* ContinueStatement */: - case 229 /* BreakStatement */: + case 229 /* ContinueStatement */: + case 230 /* BreakStatement */: return checkBreakOrContinueStatement(node); - case 230 /* ReturnStatement */: + case 231 /* ReturnStatement */: return checkReturnStatement(node); - case 231 /* WithStatement */: + case 232 /* WithStatement */: return checkWithStatement(node); - case 232 /* SwitchStatement */: + case 233 /* SwitchStatement */: return checkSwitchStatement(node); - case 233 /* LabeledStatement */: + case 234 /* LabeledStatement */: return checkLabeledStatement(node); - case 234 /* ThrowStatement */: + case 235 /* ThrowStatement */: return checkThrowStatement(node); - case 235 /* TryStatement */: + case 236 /* TryStatement */: return checkTryStatement(node); - case 237 /* VariableDeclaration */: + case 238 /* VariableDeclaration */: return checkVariableDeclaration(node); - case 186 /* BindingElement */: + case 187 /* BindingElement */: return checkBindingElement(node); - case 240 /* ClassDeclaration */: + case 241 /* ClassDeclaration */: return checkClassDeclaration(node); - case 241 /* InterfaceDeclaration */: + case 242 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 242 /* TypeAliasDeclaration */: + case 243 /* TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 243 /* EnumDeclaration */: + case 244 /* EnumDeclaration */: return checkEnumDeclaration(node); - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: return checkModuleDeclaration(node); - case 249 /* ImportDeclaration */: + case 250 /* ImportDeclaration */: return checkImportDeclaration(node); - case 248 /* ImportEqualsDeclaration */: + case 249 /* ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 255 /* ExportDeclaration */: + case 256 /* ExportDeclaration */: return checkExportDeclaration(node); - case 254 /* ExportAssignment */: + case 255 /* ExportAssignment */: return checkExportAssignment(node); - case 220 /* EmptyStatement */: - case 236 /* DebuggerStatement */: + case 221 /* EmptyStatement */: + case 237 /* DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 258 /* MissingDeclaration */: + case 259 /* MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -57514,23 +58377,23 @@ var ts; var saveCurrentNode = currentNode; currentNode = node; switch (node.kind) { - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: checkAccessorDeclaration(node); break; - case 209 /* ClassExpression */: + case 210 /* ClassExpression */: checkClassExpressionDeferred(node); break; - case 261 /* JsxSelfClosingElement */: + case 262 /* JsxSelfClosingElement */: checkJsxSelfClosingElementDeferred(node); break; - case 260 /* JsxElement */: + case 261 /* JsxElement */: checkJsxElementDeferred(node); break; } @@ -57660,17 +58523,17 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 284 /* SourceFile */: + case 285 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; // falls through - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 2623475 /* ModuleMember */); break; - case 243 /* EnumDeclaration */: + case 244 /* EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); break; - case 209 /* ClassExpression */: + case 210 /* ClassExpression */: var className = location.name; if (className) { copySymbol(location.symbol, meaning); @@ -57678,8 +58541,8 @@ var ts; // falls through // this fall-through is necessary because we would like to handle // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration - case 240 /* ClassDeclaration */: - case 241 /* InterfaceDeclaration */: + case 241 /* ClassDeclaration */: + case 242 /* InterfaceDeclaration */: // If we didn't come from static member of class or interface, // add the type parameters into the symbol table // (type parameters of classDeclaration/classExpression and interface are in member property of the symbol. @@ -57688,7 +58551,7 @@ var ts; copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 67897832 /* Type */); } break; - case 196 /* FunctionExpression */: + case 197 /* FunctionExpression */: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -57730,17 +58593,17 @@ var ts; } } function isTypeDeclarationName(name) { - return name.kind === 72 /* Identifier */ && + return name.kind === 73 /* Identifier */ && isTypeDeclaration(name.parent) && name.parent.name === name; } function isTypeDeclaration(node) { switch (node.kind) { - case 150 /* TypeParameter */: - case 240 /* ClassDeclaration */: - case 241 /* InterfaceDeclaration */: - case 242 /* TypeAliasDeclaration */: - case 243 /* EnumDeclaration */: + case 151 /* TypeParameter */: + case 241 /* ClassDeclaration */: + case 242 /* InterfaceDeclaration */: + case 243 /* TypeAliasDeclaration */: + case 244 /* EnumDeclaration */: return true; default: return false; @@ -57748,16 +58611,16 @@ var ts; } // True if the given identifier is part of a type reference function isTypeReferenceIdentifier(node) { - while (node.parent.kind === 148 /* QualifiedName */) { + while (node.parent.kind === 149 /* QualifiedName */) { node = node.parent; } - return node.parent.kind === 164 /* TypeReference */; + return node.parent.kind === 165 /* TypeReference */; } function isHeritageClauseElementIdentifier(node) { - while (node.parent.kind === 189 /* PropertyAccessExpression */) { + while (node.parent.kind === 190 /* PropertyAccessExpression */) { node = node.parent; } - return node.parent.kind === 211 /* ExpressionWithTypeArguments */; + return node.parent.kind === 212 /* ExpressionWithTypeArguments */; } function forEachEnclosingClass(node, callback) { var result; @@ -57785,13 +58648,13 @@ var ts; return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 148 /* QualifiedName */) { + while (nodeOnRightSide.parent.kind === 149 /* QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 248 /* ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 249 /* ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide ? nodeOnRightSide.parent : undefined; } - if (nodeOnRightSide.parent.kind === 254 /* ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 255 /* ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide ? nodeOnRightSide.parent : undefined; } return undefined; @@ -57817,7 +58680,7 @@ var ts; node = parent; parent = parent.parent; } - if (parent && parent.kind === 183 /* ImportType */ && parent.qualifier === node) { + if (parent && parent.kind === 184 /* ImportType */ && parent.qualifier === node) { return parent; } return undefined; @@ -57827,7 +58690,7 @@ var ts; return getSymbolOfNode(entityName.parent); } if (ts.isInJSFile(entityName) && - entityName.parent.kind === 189 /* PropertyAccessExpression */ && + entityName.parent.kind === 190 /* PropertyAccessExpression */ && entityName.parent === entityName.parent.parent.left) { // Check if this is a special property assignment var specialPropertyAssignmentSymbol = getSpecialPropertyAssignmentSymbolFromEntityName(entityName); @@ -57835,7 +58698,7 @@ var ts; return specialPropertyAssignmentSymbol; } } - if (entityName.parent.kind === 254 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) { + if (entityName.parent.kind === 255 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) { // Even an entity name expression that doesn't resolve as an entityname may still typecheck as a property access expression var success = resolveEntityName(entityName, /*all meanings*/ 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*ignoreErrors*/ true); @@ -57845,7 +58708,7 @@ var ts; } else if (!ts.isPropertyAccessExpression(entityName) && isInRightSideOfImportOrExportAssignment(entityName)) { // Since we already checked for ExportAssignment, this really could only be an Import - var importEqualsDeclaration = ts.getAncestor(entityName, 248 /* ImportEqualsDeclaration */); + var importEqualsDeclaration = ts.getAncestor(entityName, 249 /* ImportEqualsDeclaration */); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, /*dontResolveAlias*/ true); } @@ -57863,7 +58726,7 @@ var ts; if (isHeritageClauseElementIdentifier(entityName)) { var meaning = 0 /* None */; // In an interface or class, we're definitely interested in a type. - if (entityName.parent.kind === 211 /* ExpressionWithTypeArguments */) { + if (entityName.parent.kind === 212 /* ExpressionWithTypeArguments */) { meaning = 67897832 /* Type */; // In a class 'extends' clause we are also looking for a value. if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { @@ -57879,10 +58742,10 @@ var ts; return entityNameSymbol; } } - if (entityName.parent.kind === 304 /* JSDocParameterTag */) { + if (entityName.parent.kind === 305 /* JSDocParameterTag */) { return ts.getParameterSymbolFromJSDoc(entityName.parent); } - if (entityName.parent.kind === 150 /* TypeParameter */ && entityName.parent.parent.kind === 308 /* JSDocTemplateTag */) { + if (entityName.parent.kind === 151 /* TypeParameter */ && entityName.parent.parent.kind === 309 /* JSDocTemplateTag */) { ts.Debug.assert(!ts.isInJSFile(entityName)); // Otherwise `isDeclarationName` would have been true. var typeParameter = ts.getTypeParameterFromJsDoc(entityName.parent); return typeParameter && typeParameter.symbol; @@ -57892,19 +58755,19 @@ var ts; // Missing entity name. return undefined; } - if (entityName.kind === 72 /* Identifier */) { + if (entityName.kind === 73 /* Identifier */) { if (ts.isJSXTagName(entityName) && isJsxIntrinsicIdentifier(entityName)) { var symbol = getIntrinsicTagSymbol(entityName.parent); return symbol === unknownSymbol ? undefined : symbol; } return resolveEntityName(entityName, 67220415 /* Value */, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); } - else if (entityName.kind === 189 /* PropertyAccessExpression */ || entityName.kind === 148 /* QualifiedName */) { + else if (entityName.kind === 190 /* PropertyAccessExpression */ || entityName.kind === 149 /* QualifiedName */) { var links = getNodeLinks(entityName); if (links.resolvedSymbol) { return links.resolvedSymbol; } - if (entityName.kind === 189 /* PropertyAccessExpression */) { + if (entityName.kind === 190 /* PropertyAccessExpression */) { checkPropertyAccessExpression(entityName); } else { @@ -57914,17 +58777,17 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 164 /* TypeReference */ ? 67897832 /* Type */ : 1920 /* Namespace */; + var meaning = entityName.parent.kind === 165 /* TypeReference */ ? 67897832 /* Type */ : 1920 /* Namespace */; return resolveEntityName(entityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); } - if (entityName.parent.kind === 163 /* TypePredicate */) { + if (entityName.parent.kind === 164 /* TypePredicate */) { return resolveEntityName(entityName, /*meaning*/ 1 /* FunctionScopedVariable */); } // Do we want to return undefined here? return undefined; } function getSymbolAtLocation(node) { - if (node.kind === 284 /* SourceFile */) { + if (node.kind === 285 /* SourceFile */) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } var parent = node.parent; @@ -57943,12 +58806,12 @@ var ts; else if (ts.isLiteralComputedPropertyDeclarationName(node)) { return getSymbolOfNode(parent.parent); } - if (node.kind === 72 /* Identifier */) { + if (node.kind === 73 /* Identifier */) { if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfEntityNameOrPropertyAccessExpression(node); } - else if (parent.kind === 186 /* BindingElement */ && - grandParent.kind === 184 /* ObjectBindingPattern */ && + else if (parent.kind === 187 /* BindingElement */ && + grandParent.kind === 185 /* ObjectBindingPattern */ && node === parent.propertyName) { var typeOfPattern = getTypeOfNode(grandParent); var propertyDeclaration = getPropertyOfType(typeOfPattern, node.escapedText); @@ -57958,11 +58821,11 @@ var ts; } } switch (node.kind) { - case 72 /* Identifier */: - case 189 /* PropertyAccessExpression */: - case 148 /* QualifiedName */: + case 73 /* Identifier */: + case 190 /* PropertyAccessExpression */: + case 149 /* QualifiedName */: return getSymbolOfEntityNameOrPropertyAccessExpression(node); - case 100 /* ThisKeyword */: + case 101 /* ThisKeyword */: var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); if (ts.isFunctionLike(container)) { var sig = getSignatureFromDeclaration(container); @@ -57974,14 +58837,14 @@ var ts; return checkExpression(node).symbol; } // falls through - case 178 /* ThisType */: + case 179 /* ThisType */: return getTypeFromThisTypeNode(node).symbol; - case 98 /* SuperKeyword */: + case 99 /* SuperKeyword */: return checkExpression(node).symbol; - case 124 /* ConstructorKeyword */: + case 125 /* ConstructorKeyword */: // constructor keyword for an overload, should take us to the definition if it exist var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 157 /* Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 158 /* Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; @@ -57992,7 +58855,7 @@ var ts; // 3). Dynamic import call or require in javascript // 4). type A = import("./f/*gotToDefinitionHere*/oo") if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 249 /* ImportDeclaration */ || node.parent.kind === 255 /* ExportDeclaration */) && node.parent.moduleSpecifier === node) || + ((node.parent.kind === 250 /* ImportDeclaration */ || node.parent.kind === 256 /* ExportDeclaration */) && node.parent.moduleSpecifier === node) || ((ts.isInJSFile(node) && ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false)) || ts.isImportCall(node.parent)) || (ts.isLiteralTypeNode(node.parent) && ts.isLiteralImportTypeNode(node.parent.parent) && node.parent.parent.argument === node.parent)) { return resolveExternalModuleName(node, node); @@ -58009,21 +58872,21 @@ var ts; ? getTypeFromTypeNode(grandParent.objectType) : undefined; return objectType && getPropertyOfType(objectType, ts.escapeLeadingUnderscores(node.text)); - case 80 /* DefaultKeyword */: - case 90 /* FunctionKeyword */: + case 81 /* DefaultKeyword */: + case 91 /* FunctionKeyword */: case 37 /* EqualsGreaterThanToken */: - case 76 /* ClassKeyword */: + case 77 /* ClassKeyword */: return getSymbolOfNode(node.parent); - case 183 /* ImportType */: + case 184 /* ImportType */: return ts.isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal) : undefined; - case 85 /* ExportKeyword */: + case 86 /* ExportKeyword */: return ts.isExportAssignment(node.parent) ? ts.Debug.assertDefined(node.parent.symbol) : undefined; default: return undefined; } } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 276 /* ShorthandPropertyAssignment */) { + if (location && location.kind === 277 /* ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 67220415 /* Value */ | 2097152 /* Alias */); } return undefined; @@ -58090,33 +58953,35 @@ var ts; // } // [ a ] from // [a] = [ some array ...] - function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) { - ts.Debug.assert(expr.kind === 188 /* ObjectLiteralExpression */ || expr.kind === 187 /* ArrayLiteralExpression */); + function getTypeOfAssignmentPattern(expr) { + ts.Debug.assert(expr.kind === 189 /* ObjectLiteralExpression */ || expr.kind === 188 /* ArrayLiteralExpression */); // If this is from "for of" // for ( { a } of elems) { // } - if (expr.parent.kind === 227 /* ForOfStatement */) { + if (expr.parent.kind === 228 /* ForOfStatement */) { var iteratedType = checkRightHandSideOfForOf(expr.parent.expression, expr.parent.awaitModifier); return checkDestructuringAssignment(expr, iteratedType || errorType); } // If this is from "for" initializer // for ({a } = elems[0];.....) { } - if (expr.parent.kind === 204 /* BinaryExpression */) { + if (expr.parent.kind === 205 /* BinaryExpression */) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || errorType); } // If this is from nested object binding pattern // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { - if (expr.parent.kind === 275 /* PropertyAssignment */) { - var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); - return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || errorType, expr.parent); // TODO: GH#18217 + if (expr.parent.kind === 276 /* PropertyAssignment */) { + var node_3 = ts.cast(expr.parent.parent, ts.isObjectLiteralExpression); + var typeOfParentObjectLiteral = getTypeOfAssignmentPattern(node_3) || errorType; + var propertyIndex = ts.indexOfNode(node_3.properties, expr.parent); + return checkObjectLiteralDestructuringPropertyAssignment(node_3, typeOfParentObjectLiteral, propertyIndex); } // Array literal assignment - array destructuring pattern - ts.Debug.assert(expr.parent.kind === 187 /* ArrayLiteralExpression */); + var node = ts.cast(expr.parent, ts.isArrayLiteralExpression); // [{ property1: p1, property2 }] = elems; - var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent); - var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || errorType, expr.parent, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || errorType; - return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, expr.parent.elements.indexOf(expr), elementType || errorType); // TODO: GH#18217 + var typeOfArrayLiteral = getTypeOfAssignmentPattern(node) || errorType; + var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral, expr.parent, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || errorType; + return checkArrayLiteralDestructuringElementAssignment(node, typeOfArrayLiteral, node.elements.indexOf(expr), elementType); } // Gets the property symbol corresponding to the property in destructuring assignment // 'property1' from @@ -58126,7 +58991,7 @@ var ts; // [a] = [ property1, property2 ] function getPropertySymbolOfDestructuringAssignment(location) { // Get the type of the object or array literal and then look for property of given name in the type - var typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent); + var typeOfObjectLiteral = getTypeOfAssignmentPattern(ts.cast(location.parent.parent, ts.isAssignmentPattern)); return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.escapedText); } function getRegularTypeOfExpression(expr) { @@ -58148,12 +59013,12 @@ var ts; function getClassElementPropertyKeyType(element) { var name = element.name; switch (name.kind) { - case 72 /* Identifier */: + case 73 /* Identifier */: return getLiteralType(ts.idText(name)); case 8 /* NumericLiteral */: case 10 /* StringLiteral */: return getLiteralType(name.text); - case 149 /* ComputedPropertyName */: + case 150 /* ComputedPropertyName */: var nameType = checkComputedPropertyName(name); return isTypeAssignableToKind(nameType, 12288 /* ESSymbolLike */) ? nameType : stringType; default: @@ -58210,7 +59075,7 @@ var ts; if (!ts.isGeneratedIdentifier(nodeIn)) { var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier); if (node) { - var isPropertyName_1 = node.parent.kind === 189 /* PropertyAccessExpression */ && node.parent.name === node; + var isPropertyName_1 = node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.name === node; return !isPropertyName_1 && getReferencedValueSymbol(node) === argumentsSymbol; } } @@ -58266,7 +59131,7 @@ var ts; } var parentSymbol_1 = getParentOfSymbol(symbol); if (parentSymbol_1) { - if (parentSymbol_1.flags & 512 /* ValueModule */ && parentSymbol_1.valueDeclaration.kind === 284 /* SourceFile */) { + if (parentSymbol_1.flags & 512 /* ValueModule */ && parentSymbol_1.valueDeclaration.kind === 285 /* SourceFile */) { var symbolFile = parentSymbol_1.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); // If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined. @@ -58292,12 +59157,16 @@ var ts; } return undefined; } + function isSymbolOfDestructuredElementOfCatchBinding(symbol) { + return ts.isBindingElement(symbol.valueDeclaration) + && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 275 /* CatchClause */; + } function isSymbolOfDeclarationWithCollidingName(symbol) { if (symbol.flags & 418 /* BlockScoped */ && !ts.isSourceFile(symbol.valueDeclaration)) { var links = getSymbolLinks(symbol); if (links.isDeclarationWithCollidingName === undefined) { var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); - if (ts.isStatementWithLocals(container)) { + if (ts.isStatementWithLocals(container) || isSymbolOfDestructuredElementOfCatchBinding(symbol)) { var nodeLinks_1 = getNodeLinks(symbol.valueDeclaration); if (resolveName(container.parent, symbol.escapedName, 67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)) { // redeclaration - always should be renamed @@ -58321,7 +59190,7 @@ var ts; // they will not collide with anything var isDeclaredInLoop = nodeLinks_1.flags & 524288 /* BlockScopedBindingInLoop */; var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false); - var inLoopBodyBlock = container.kind === 218 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); + var inLoopBodyBlock = container.kind === 219 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -58362,18 +59231,18 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 248 /* ImportEqualsDeclaration */: - case 250 /* ImportClause */: - case 251 /* NamespaceImport */: - case 253 /* ImportSpecifier */: - case 257 /* ExportSpecifier */: + case 249 /* ImportEqualsDeclaration */: + case 251 /* ImportClause */: + case 252 /* NamespaceImport */: + case 254 /* ImportSpecifier */: + case 258 /* ExportSpecifier */: return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol); - case 255 /* ExportDeclaration */: + case 256 /* ExportDeclaration */: var exportClause = node.exportClause; return !!exportClause && ts.some(exportClause.elements, isValueAliasDeclaration); - case 254 /* ExportAssignment */: + case 255 /* ExportAssignment */: return node.expression - && node.expression.kind === 72 /* Identifier */ + && node.expression.kind === 73 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol) : true; } @@ -58381,7 +59250,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(nodeIn) { var node = ts.getParseTreeNode(nodeIn, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 284 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 285 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -58482,15 +59351,15 @@ var ts; } function canHaveConstantValue(node) { switch (node.kind) { - case 278 /* EnumMember */: - case 189 /* PropertyAccessExpression */: - case 190 /* ElementAccessExpression */: + case 279 /* EnumMember */: + case 190 /* PropertyAccessExpression */: + case 191 /* ElementAccessExpression */: return true; } return false; } function getConstantValue(node) { - if (node.kind === 278 /* EnumMember */) { + if (node.kind === 279 /* EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -58575,7 +59444,7 @@ var ts; function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker, addUndefined) { var declaration = ts.getParseTreeNode(declarationIn, ts.isVariableLikeOrAccessor); if (!declaration) { - return ts.createToken(120 /* AnyKeyword */); + return ts.createToken(121 /* AnyKeyword */); } // Get type of the symbol if this is the valid symbol otherwise get type at location var symbol = getSymbolOfNode(declaration); @@ -58594,7 +59463,7 @@ var ts; function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) { var signatureDeclaration = ts.getParseTreeNode(signatureDeclarationIn, ts.isFunctionLike); if (!signatureDeclaration) { - return ts.createToken(120 /* AnyKeyword */); + return ts.createToken(121 /* AnyKeyword */); } var signature = getSignatureFromDeclaration(signatureDeclaration); return nodeBuilder.typeToTypeNode(getReturnTypeOfSignature(signature), enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker); @@ -58602,7 +59471,7 @@ var ts; function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) { var expr = ts.getParseTreeNode(exprIn, ts.isExpression); if (!expr) { - return ts.createToken(120 /* AnyKeyword */); + return ts.createToken(121 /* AnyKeyword */); } var type = getWidenedType(getRegularTypeOfExpression(expr)); return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker); @@ -58721,17 +59590,17 @@ var ts; isLateBound: function (nodeIn) { var node = ts.getParseTreeNode(nodeIn, ts.isDeclaration); var symbol = node && getSymbolOfNode(node); - return !!(symbol && ts.getCheckFlags(symbol) & 2048 /* Late */); + return !!(symbol && ts.getCheckFlags(symbol) & 4096 /* Late */); }, getJsxFactoryEntity: function (location) { return location ? (getJsxNamespace(location), (ts.getSourceFileOfNode(location).localJsxFactory || _jsxFactoryEntity)) : _jsxFactoryEntity; }, getAllAccessorDeclarations: function (accessor) { accessor = ts.getParseTreeNode(accessor, ts.isGetOrSetAccessorDeclaration); // TODO: GH#18217 - var otherKind = accessor.kind === 159 /* SetAccessor */ ? 158 /* GetAccessor */ : 159 /* SetAccessor */; + var otherKind = accessor.kind === 160 /* SetAccessor */ ? 159 /* GetAccessor */ : 160 /* SetAccessor */; var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(accessor), otherKind); var firstAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? otherAccessor : accessor; var secondAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? accessor : otherAccessor; - var setAccessor = accessor.kind === 159 /* SetAccessor */ ? accessor : otherAccessor; - var getAccessor = accessor.kind === 158 /* GetAccessor */ ? accessor : otherAccessor; + var setAccessor = accessor.kind === 160 /* SetAccessor */ ? accessor : otherAccessor; + var getAccessor = accessor.kind === 159 /* GetAccessor */ ? accessor : otherAccessor; return { firstAccessor: firstAccessor, secondAccessor: secondAccessor, @@ -58747,7 +59616,7 @@ var ts; } }; function isInHeritageClause(node) { - return node.parent && node.parent.kind === 211 /* ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 273 /* HeritageClause */; + return node.parent && node.parent.kind === 212 /* ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 274 /* HeritageClause */; } // defined here to avoid outer scope pollution function getTypeReferenceDirectivesForEntityName(node) { @@ -58759,7 +59628,7 @@ var ts; // qualified names can only be used as types\namespaces // identifiers are treated as values only if they appear in type queries var meaning = 67897832 /* Type */ | 1920 /* Namespace */; - if ((node.kind === 72 /* Identifier */ && isInTypeQuery(node)) || (node.kind === 189 /* PropertyAccessExpression */ && !isInHeritageClause(node))) { + if ((node.kind === 73 /* Identifier */ && isInTypeQuery(node)) || (node.kind === 190 /* PropertyAccessExpression */ && !isInHeritageClause(node))) { meaning = 67220415 /* Value */ | 1048576 /* ExportValue */; } var symbol = resolveEntityName(node, meaning, /*ignoreErrors*/ true); @@ -58810,7 +59679,7 @@ var ts; break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 284 /* SourceFile */ && current.flags & 512 /* ValueModule */) { + if (current.valueDeclaration && current.valueDeclaration.kind === 285 /* SourceFile */ && current.flags & 512 /* ValueModule */) { return false; } // check that at least one declaration of top level symbol originates from type declaration file @@ -58838,12 +59707,12 @@ var ts; } } function getExternalModuleFileFromDeclaration(declaration) { - var specifier = declaration.kind === 244 /* ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); + var specifier = declaration.kind === 245 /* ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, /*moduleNotFoundError*/ undefined); // TODO: GH#18217 if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 284 /* SourceFile */); + return ts.getDeclarationOfKind(moduleSymbol, 285 /* SourceFile */); } function initializeTypeChecker() { // Bind all source files and propagate errors @@ -58860,6 +59729,15 @@ var ts; continue; } if (!ts.isExternalOrCommonJsModule(file)) { + // It is an error for a non-external-module (i.e. script) to declare its own `globalThis`. + // We can't use `builtinGlobals` for this due to synthetic expando-namespace generation in JS files. + var fileGlobalThisSymbol = file.locals.get("globalThis"); + if (fileGlobalThisSymbol) { + for (var _d = 0, _e = fileGlobalThisSymbol.declarations; _d < _e.length; _d++) { + var declaration = _e[_d]; + diagnostics.add(ts.createDiagnosticForNode(declaration, ts.Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0, "globalThis")); + } + } mergeSymbolTable(globals, file.locals); } if (file.jsGlobalAugmentations) { @@ -58890,10 +59768,10 @@ var ts; if (augmentations) { // merge _global_ module augmentations. // this needs to be done after global symbol table is initialized to make sure that all ambient modules are indexed - for (var _d = 0, augmentations_1 = augmentations; _d < augmentations_1.length; _d++) { - var list = augmentations_1[_d]; - for (var _e = 0, list_1 = list; _e < list_1.length; _e++) { - var augmentation = list_1[_e]; + for (var _f = 0, augmentations_1 = augmentations; _f < augmentations_1.length; _f++) { + var list = augmentations_1[_f]; + for (var _g = 0, list_1 = list; _g < list_1.length; _g++) { + var augmentation = list_1[_g]; if (!ts.isGlobalScopeAugmentation(augmentation.parent)) continue; mergeModuleAugmentation(augmentation); @@ -58905,6 +59783,7 @@ var ts; getSymbolLinks(undefinedSymbol).type = undefinedWideningType; getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments", /*arity*/ 0, /*reportErrors*/ true); getSymbolLinks(unknownSymbol).type = errorType; + getSymbolLinks(globalThisSymbol).type = createObjectType(16 /* Anonymous */, globalThisSymbol); // Initialize special types globalArrayType = getGlobalType("Array", /*arity*/ 1, /*reportErrors*/ true); globalObjectType = getGlobalType("Object", /*arity*/ 0, /*reportErrors*/ true); @@ -58921,16 +59800,16 @@ var ts; // autoArrayType is used as a marker, so even if global Array type is not defined, it needs to be a unique type autoArrayType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, undefined, undefined); } - globalReadonlyArrayType = getGlobalTypeOrUndefined("ReadonlyArray", /*arity*/ 1); + globalReadonlyArrayType = getGlobalTypeOrUndefined("ReadonlyArray", /*arity*/ 1) || globalArrayType; anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType; globalThisType = getGlobalTypeOrUndefined("ThisType", /*arity*/ 1); if (augmentations) { // merge _nonglobal_ module augmentations. // this needs to be done after global symbol table is initialized to make sure that all ambient modules are indexed - for (var _f = 0, augmentations_2 = augmentations; _f < augmentations_2.length; _f++) { - var list = augmentations_2[_f]; - for (var _g = 0, list_2 = list; _g < list_2.length; _g++) { - var augmentation = list_2[_g]; + for (var _h = 0, augmentations_2 = augmentations; _h < augmentations_2.length; _h++) { + var list = augmentations_2[_h]; + for (var _j = 0, list_2 = list; _j < list_2.length; _j++) { + var augmentation = list_2[_j]; if (ts.isGlobalScopeAugmentation(augmentation.parent)) continue; mergeModuleAugmentation(augmentation); @@ -59021,14 +59900,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node, node.parent, node.parent.parent)) { - if (node.kind === 156 /* MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { + if (node.kind === 157 /* MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); } else { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } } - else if (node.kind === 158 /* GetAccessor */ || node.kind === 159 /* SetAccessor */) { + else if (node.kind === 159 /* GetAccessor */ || node.kind === 160 /* SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -59045,23 +59924,23 @@ var ts; var flags = 0 /* None */; for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; - if (modifier.kind !== 133 /* ReadonlyKeyword */) { - if (node.kind === 153 /* PropertySignature */ || node.kind === 155 /* MethodSignature */) { + if (modifier.kind !== 134 /* ReadonlyKeyword */) { + if (node.kind === 154 /* PropertySignature */ || node.kind === 156 /* MethodSignature */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); } - if (node.kind === 162 /* IndexSignature */) { + if (node.kind === 163 /* IndexSignature */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); } } switch (modifier.kind) { - case 77 /* ConstKeyword */: - if (node.kind !== 243 /* EnumDeclaration */) { - return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(77 /* ConstKeyword */)); + case 78 /* ConstKeyword */: + if (node.kind !== 244 /* EnumDeclaration */) { + return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(78 /* ConstKeyword */)); } break; - case 115 /* PublicKeyword */: - case 114 /* ProtectedKeyword */: - case 113 /* PrivateKeyword */: + case 116 /* PublicKeyword */: + case 115 /* ProtectedKeyword */: + case 114 /* PrivateKeyword */: var text = visibilityToString(ts.modifierToFlag(modifier.kind)); if (flags & 28 /* AccessibilityModifier */) { return grammarErrorOnNode(modifier, ts.Diagnostics.Accessibility_modifier_already_seen); @@ -59075,11 +59954,11 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 284 /* SourceFile */) { + else if (node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 285 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128 /* Abstract */) { - if (modifier.kind === 113 /* PrivateKeyword */) { + if (modifier.kind === 114 /* PrivateKeyword */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); } else { @@ -59088,7 +59967,7 @@ var ts; } flags |= ts.modifierToFlag(modifier.kind); break; - case 116 /* StaticKeyword */: + case 117 /* StaticKeyword */: if (flags & 32 /* Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } @@ -59098,10 +59977,10 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 284 /* SourceFile */) { + else if (node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 285 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 151 /* Parameter */) { + else if (node.kind === 152 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 128 /* Abstract */) { @@ -59110,18 +59989,18 @@ var ts; flags |= 32 /* Static */; lastStatic = modifier; break; - case 133 /* ReadonlyKeyword */: + case 134 /* ReadonlyKeyword */: if (flags & 64 /* Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); } - else if (node.kind !== 154 /* PropertyDeclaration */ && node.kind !== 153 /* PropertySignature */ && node.kind !== 162 /* IndexSignature */ && node.kind !== 151 /* Parameter */) { + else if (node.kind !== 155 /* PropertyDeclaration */ && node.kind !== 154 /* PropertySignature */ && node.kind !== 163 /* IndexSignature */ && node.kind !== 152 /* Parameter */) { // If node.kind === SyntaxKind.Parameter, checkParameter report an error if it's not a parameter property. return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } flags |= 64 /* Readonly */; lastReadonly = modifier; break; - case 85 /* ExportKeyword */: + case 86 /* ExportKeyword */: if (flags & 1 /* Export */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export"); } @@ -59134,52 +60013,52 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 240 /* ClassDeclaration */) { + else if (node.parent.kind === 241 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 151 /* Parameter */) { + else if (node.kind === 152 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1 /* Export */; break; - case 80 /* DefaultKeyword */: - var container = node.parent.kind === 284 /* SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 244 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { + case 81 /* DefaultKeyword */: + var container = node.parent.kind === 285 /* SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 245 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); } flags |= 512 /* Default */; break; - case 125 /* DeclareKeyword */: + case 126 /* DeclareKeyword */: if (flags & 2 /* Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 240 /* ClassDeclaration */) { + else if (node.parent.kind === 241 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 151 /* Parameter */) { + else if (node.kind === 152 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if ((node.parent.flags & 4194304 /* Ambient */) && node.parent.kind === 245 /* ModuleBlock */) { + else if ((node.parent.flags & 4194304 /* Ambient */) && node.parent.kind === 246 /* ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2 /* Ambient */; lastDeclare = modifier; break; - case 118 /* AbstractKeyword */: + case 119 /* AbstractKeyword */: if (flags & 128 /* Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 240 /* ClassDeclaration */) { - if (node.kind !== 156 /* MethodDeclaration */ && - node.kind !== 154 /* PropertyDeclaration */ && - node.kind !== 158 /* GetAccessor */ && - node.kind !== 159 /* SetAccessor */) { + if (node.kind !== 241 /* ClassDeclaration */) { + if (node.kind !== 157 /* MethodDeclaration */ && + node.kind !== 155 /* PropertyDeclaration */ && + node.kind !== 159 /* GetAccessor */ && + node.kind !== 160 /* SetAccessor */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 240 /* ClassDeclaration */ && ts.hasModifier(node.parent, 128 /* Abstract */))) { + if (!(node.parent.kind === 241 /* ClassDeclaration */ && ts.hasModifier(node.parent, 128 /* Abstract */))) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32 /* Static */) { @@ -59191,14 +60070,14 @@ var ts; } flags |= 128 /* Abstract */; break; - case 121 /* AsyncKeyword */: + case 122 /* AsyncKeyword */: if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } else if (flags & 2 /* Ambient */ || node.parent.flags & 4194304 /* Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 151 /* Parameter */) { + else if (node.kind === 152 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } flags |= 256 /* Async */; @@ -59206,7 +60085,7 @@ var ts; break; } } - if (node.kind === 157 /* Constructor */) { + if (node.kind === 158 /* Constructor */) { if (flags & 32 /* Static */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -59221,13 +60100,13 @@ var ts; } return false; } - else if ((node.kind === 249 /* ImportDeclaration */ || node.kind === 248 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { + else if ((node.kind === 250 /* ImportDeclaration */ || node.kind === 249 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 151 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 152 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern); } - else if (node.kind === 151 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && node.dotDotDotToken) { + else if (node.kind === 152 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && node.dotDotDotToken) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter); } if (flags & 256 /* Async */) { @@ -59248,38 +60127,38 @@ var ts; } function shouldReportBadModifier(node) { switch (node.kind) { - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 157 /* Constructor */: - case 154 /* PropertyDeclaration */: - case 153 /* PropertySignature */: - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: - case 162 /* IndexSignature */: - case 244 /* ModuleDeclaration */: - case 249 /* ImportDeclaration */: - case 248 /* ImportEqualsDeclaration */: - case 255 /* ExportDeclaration */: - case 254 /* ExportAssignment */: - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: - case 151 /* Parameter */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 158 /* Constructor */: + case 155 /* PropertyDeclaration */: + case 154 /* PropertySignature */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: + case 163 /* IndexSignature */: + case 245 /* ModuleDeclaration */: + case 250 /* ImportDeclaration */: + case 249 /* ImportEqualsDeclaration */: + case 256 /* ExportDeclaration */: + case 255 /* ExportAssignment */: + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: + case 152 /* Parameter */: return false; default: - if (node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 284 /* SourceFile */) { + if (node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 285 /* SourceFile */) { return false; } switch (node.kind) { - case 239 /* FunctionDeclaration */: - return nodeHasAnyModifiersExcept(node, 121 /* AsyncKeyword */); - case 240 /* ClassDeclaration */: - return nodeHasAnyModifiersExcept(node, 118 /* AbstractKeyword */); - case 241 /* InterfaceDeclaration */: - case 219 /* VariableStatement */: - case 242 /* TypeAliasDeclaration */: + case 240 /* FunctionDeclaration */: + return nodeHasAnyModifiersExcept(node, 122 /* AsyncKeyword */); + case 241 /* ClassDeclaration */: + return nodeHasAnyModifiersExcept(node, 119 /* AbstractKeyword */); + case 242 /* InterfaceDeclaration */: + case 220 /* VariableStatement */: + case 243 /* TypeAliasDeclaration */: return true; - case 243 /* EnumDeclaration */: - return nodeHasAnyModifiersExcept(node, 77 /* ConstKeyword */); + case 244 /* EnumDeclaration */: + return nodeHasAnyModifiersExcept(node, 78 /* ConstKeyword */); default: ts.Debug.fail(); return false; @@ -59291,10 +60170,10 @@ var ts; } function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { - case 156 /* MethodDeclaration */: - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: + case 157 /* MethodDeclaration */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: return false; } return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async"); @@ -59409,10 +60288,10 @@ var ts; if (!parameter.type) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - if (parameter.type.kind !== 138 /* StringKeyword */ && parameter.type.kind !== 135 /* NumberKeyword */) { + if (parameter.type.kind !== 139 /* StringKeyword */ && parameter.type.kind !== 136 /* NumberKeyword */) { var type = getTypeFromTypeNode(parameter.type); if (type.flags & 4 /* String */ || type.flags & 8 /* Number */) { - return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead, ts.getTextOfNode(parameter.name), typeToString(type), typeToString(getTypeFromTypeNode(node.type))); + return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead, ts.getTextOfNode(parameter.name), typeToString(type), typeToString(node.type ? getTypeFromTypeNode(node.type) : anyType)); } if (type.flags & 1048576 /* Union */ && allTypesAssignableToKind(type, 128 /* StringLiteral */, /*strict*/ true)) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead); @@ -59443,9 +60322,9 @@ var ts; } function checkGrammarForOmittedArgument(args) { if (args) { - for (var _i = 0, args_5 = args; _i < args_5.length; _i++) { - var arg = args_5[_i]; - if (arg.kind === 210 /* OmittedExpression */) { + for (var _i = 0, args_4 = args; _i < args_4.length; _i++) { + var arg = args_4[_i]; + if (arg.kind === 211 /* OmittedExpression */) { return grammarErrorAtPos(arg, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -59475,7 +60354,7 @@ var ts; if (!checkGrammarDecoratorsAndModifiers(node) && node.heritageClauses) { for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; - if (heritageClause.token === 86 /* ExtendsKeyword */) { + if (heritageClause.token === 87 /* ExtendsKeyword */) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); } @@ -59488,7 +60367,7 @@ var ts; seenExtendsClause = true; } else { - ts.Debug.assert(heritageClause.token === 109 /* ImplementsKeyword */); + ts.Debug.assert(heritageClause.token === 110 /* ImplementsKeyword */); if (seenImplementsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen); } @@ -59504,14 +60383,14 @@ var ts; if (node.heritageClauses) { for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; - if (heritageClause.token === 86 /* ExtendsKeyword */) { + if (heritageClause.token === 87 /* ExtendsKeyword */) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); } seenExtendsClause = true; } else { - ts.Debug.assert(heritageClause.token === 109 /* ImplementsKeyword */); + ts.Debug.assert(heritageClause.token === 110 /* ImplementsKeyword */); return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause); } // Grammar checking heritageClause inside class declaration @@ -59522,20 +60401,20 @@ var ts; } function checkGrammarComputedPropertyName(node) { // If node is not a computedPropertyName, just skip the grammar checking - if (node.kind !== 149 /* ComputedPropertyName */) { + if (node.kind !== 150 /* ComputedPropertyName */) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 204 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* CommaToken */) { + if (computedPropertyName.expression.kind === 205 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* CommaToken */) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } return false; } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 239 /* FunctionDeclaration */ || - node.kind === 196 /* FunctionExpression */ || - node.kind === 156 /* MethodDeclaration */); + ts.Debug.assert(node.kind === 240 /* FunctionDeclaration */ || + node.kind === 197 /* FunctionExpression */ || + node.kind === 157 /* MethodDeclaration */); if (node.flags & 4194304 /* Ambient */) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -59561,15 +60440,22 @@ var ts; var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 277 /* SpreadAssignment */) { + if (prop.kind === 278 /* SpreadAssignment */) { + if (inDestructuring) { + // a rest property cannot be destructured any further + var expression = ts.skipParentheses(prop.expression); + if (ts.isArrayLiteralExpression(expression) || ts.isObjectLiteralExpression(expression)) { + return grammarErrorOnNode(prop.expression, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); + } + } continue; } var name = prop.name; - if (name.kind === 149 /* ComputedPropertyName */) { + if (name.kind === 150 /* ComputedPropertyName */) { // If the name is not a ComputedPropertyName, the grammar checking will skip it checkGrammarComputedPropertyName(name); } - if (prop.kind === 276 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 277 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern // outside of destructuring it is a syntax error return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); @@ -59578,7 +60464,7 @@ var ts; if (prop.modifiers) { for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { // TODO: GH#19955 var mod = _c[_b]; - if (mod.kind !== 121 /* AsyncKeyword */ || prop.kind !== 156 /* MethodDeclaration */) { + if (mod.kind !== 122 /* AsyncKeyword */ || prop.kind !== 157 /* MethodDeclaration */) { grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); } } @@ -59593,23 +60479,23 @@ var ts; // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields var currentKind = void 0; switch (prop.kind) { - case 276 /* ShorthandPropertyAssignment */: + case 277 /* ShorthandPropertyAssignment */: checkGrammarForInvalidExclamationToken(prop.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context); /* tslint:disable:no-switch-case-fall-through */ - case 275 /* PropertyAssignment */: + case 276 /* PropertyAssignment */: // Grammar checking for computedPropertyName and shorthandPropertyAssignment checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name.kind === 8 /* NumericLiteral */) { checkGrammarNumericLiteral(name); } // falls through - case 156 /* MethodDeclaration */: + case 157 /* MethodDeclaration */: currentKind = 1 /* Property */; break; - case 158 /* GetAccessor */: + case 159 /* GetAccessor */: currentKind = 2 /* GetAccessor */; break; - case 159 /* SetAccessor */: + case 160 /* SetAccessor */: currentKind = 4 /* SetAccessor */; break; default: @@ -59646,7 +60532,7 @@ var ts; var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 269 /* JsxSpreadAttribute */) { + if (attr.kind === 270 /* JsxSpreadAttribute */) { continue; } var name = attr.name, initializer = attr.initializer; @@ -59656,7 +60542,7 @@ var ts; else { return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } - if (initializer && initializer.kind === 270 /* JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 271 /* JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -59665,12 +60551,25 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.kind === 227 /* ForOfStatement */ && forInOrOfStatement.awaitModifier) { + if (forInOrOfStatement.kind === 228 /* ForOfStatement */ && forInOrOfStatement.awaitModifier) { if ((forInOrOfStatement.flags & 16384 /* AwaitContext */) === 0 /* None */) { - return grammarErrorOnNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator); + // use of 'for-await-of' in non-async function + var sourceFile = ts.getSourceFileOfNode(forInOrOfStatement); + if (!hasParseDiagnostics(sourceFile)) { + var diagnostic = ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator); + var func = ts.getContainingFunction(forInOrOfStatement); + if (func && func.kind !== 158 /* Constructor */) { + ts.Debug.assert((ts.getFunctionFlags(func) & 2 /* Async */) === 0, "Enclosing function should never be an async function."); + var relatedInfo = ts.createDiagnosticForNode(func, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async); + ts.addRelatedInfo(diagnostic, relatedInfo); + } + diagnostics.add(diagnostic); + return true; + } + return false; } } - if (forInOrOfStatement.initializer.kind === 238 /* VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 239 /* VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -59685,20 +60584,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 226 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 227 /* ForInStatement */ ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 226 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 227 /* ForInStatement */ ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 226 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 227 /* ForInStatement */ ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -59725,11 +60624,11 @@ var ts; return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } else if (!doesAccessorHaveCorrectParameterCount(accessor)) { - return grammarErrorOnNode(accessor.name, kind === 158 /* GetAccessor */ ? + return grammarErrorOnNode(accessor.name, kind === 159 /* GetAccessor */ ? ts.Diagnostics.A_get_accessor_cannot_have_parameters : ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } - else if (kind === 159 /* SetAccessor */) { + else if (kind === 160 /* SetAccessor */) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -59753,23 +60652,23 @@ var ts; * A set accessor has one parameter or a `this` parameter and one more parameter. */ function doesAccessorHaveCorrectParameterCount(accessor) { - return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 158 /* GetAccessor */ ? 0 : 1); + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 159 /* GetAccessor */ ? 0 : 1); } function getAccessorThisParameter(accessor) { - if (accessor.parameters.length === (accessor.kind === 158 /* GetAccessor */ ? 1 : 2)) { + if (accessor.parameters.length === (accessor.kind === 159 /* GetAccessor */ ? 1 : 2)) { return ts.getThisParameter(accessor); } } function checkGrammarTypeOperatorNode(node) { - if (node.operator === 142 /* UniqueKeyword */) { - if (node.type.kind !== 139 /* SymbolKeyword */) { - return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(139 /* SymbolKeyword */)); + if (node.operator === 143 /* UniqueKeyword */) { + if (node.type.kind !== 140 /* SymbolKeyword */) { + return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(140 /* SymbolKeyword */)); } var parent = ts.walkUpParenthesizedTypes(node.parent); switch (parent.kind) { - case 237 /* VariableDeclaration */: + case 238 /* VariableDeclaration */: var decl = parent; - if (decl.name.kind !== 72 /* Identifier */) { + if (decl.name.kind !== 73 /* Identifier */) { return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name); } if (!ts.isVariableDeclarationInVariableStatement(decl)) { @@ -59779,13 +60678,13 @@ var ts; return grammarErrorOnNode(parent.name, ts.Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const); } break; - case 154 /* PropertyDeclaration */: + case 155 /* PropertyDeclaration */: if (!ts.hasModifier(parent, 32 /* Static */) || !ts.hasModifier(parent, 64 /* Readonly */)) { return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly); } break; - case 153 /* PropertySignature */: + case 154 /* PropertySignature */: if (!ts.hasModifier(parent, 64 /* Readonly */)) { return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly); } @@ -59794,9 +60693,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_are_not_allowed_here); } } - else if (node.operator === 133 /* ReadonlyKeyword */) { - if (node.type.kind !== 169 /* ArrayType */ && node.type.kind !== 170 /* TupleType */) { - return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(139 /* SymbolKeyword */)); + else if (node.operator === 134 /* ReadonlyKeyword */) { + if (node.type.kind !== 170 /* ArrayType */ && node.type.kind !== 171 /* TupleType */) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(140 /* SymbolKeyword */)); } } } @@ -59809,10 +60708,10 @@ var ts; if (checkGrammarFunctionLikeDeclaration(node)) { return true; } - if (node.kind === 156 /* MethodDeclaration */) { - if (node.parent.kind === 188 /* ObjectLiteralExpression */) { + if (node.kind === 157 /* MethodDeclaration */) { + if (node.parent.kind === 189 /* ObjectLiteralExpression */) { // We only disallow modifier on a method declaration if it is a property of object-literal-expression - if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 121 /* AsyncKeyword */)) { + if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 122 /* AsyncKeyword */)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } else if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { @@ -59825,6 +60724,9 @@ var ts; return grammarErrorAtPos(node, node.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } + else if (ts.isClassLike(node.parent) && ts.isStringLiteral(node.name) && node.name.text === "constructor" && (!compilerOptions.target || compilerOptions.target < 1 /* ES5 */)) { + return grammarErrorOnNode(node.name, ts.Diagnostics.Quoted_constructors_have_previously_been_interpreted_as_methods_which_is_incorrect_In_TypeScript_3_6_they_will_be_correctly_parsed_as_constructors_In_the_meantime_consider_using_constructor_to_write_a_constructor_or_constructor_to_write_a_method); + } if (checkGrammarForGenerator(node)) { return true; } @@ -59838,14 +60740,14 @@ var ts; if (node.flags & 4194304 /* Ambient */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } - else if (node.kind === 156 /* MethodDeclaration */ && !node.body) { + else if (node.kind === 157 /* MethodDeclaration */ && !node.body) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } - else if (node.parent.kind === 241 /* InterfaceDeclaration */) { + else if (node.parent.kind === 242 /* InterfaceDeclaration */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } - else if (node.parent.kind === 168 /* TypeLiteral */) { + else if (node.parent.kind === 169 /* TypeLiteral */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } @@ -59856,11 +60758,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 233 /* LabeledStatement */: + case 234 /* LabeledStatement */: if (node.label && current.label.escapedText === node.label.escapedText) { // found matching label - verify that label usage is correct // continue can only target labels that are on iteration statements - var isMisplacedContinueLabel = node.kind === 228 /* ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 229 /* ContinueStatement */ && !ts.isIterationStatement(current.statement, /*lookInLabeledStatement*/ true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -59868,8 +60770,8 @@ var ts; return false; } break; - case 232 /* SwitchStatement */: - if (node.kind === 229 /* BreakStatement */ && !node.label) { + case 233 /* SwitchStatement */: + if (node.kind === 230 /* BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -59884,13 +60786,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 229 /* BreakStatement */ + var message = node.kind === 230 /* BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 229 /* BreakStatement */ + var message = node.kind === 230 /* BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -59914,12 +60816,12 @@ var ts; } function isStringOrNumberLiteralExpression(expr) { return expr.kind === 10 /* StringLiteral */ || expr.kind === 8 /* NumericLiteral */ || - expr.kind === 202 /* PrefixUnaryExpression */ && expr.operator === 39 /* MinusToken */ && + expr.kind === 203 /* PrefixUnaryExpression */ && expr.operator === 39 /* MinusToken */ && expr.operand.kind === 8 /* NumericLiteral */; } function isBigIntLiteralExpression(expr) { return expr.kind === 9 /* BigIntLiteral */ || - expr.kind === 202 /* PrefixUnaryExpression */ && expr.operator === 39 /* MinusToken */ && + expr.kind === 203 /* PrefixUnaryExpression */ && expr.operator === 39 /* MinusToken */ && expr.operand.kind === 9 /* BigIntLiteral */; } function isSimpleLiteralEnumReference(expr) { @@ -59932,7 +60834,7 @@ var ts; if (initializer) { var isInvalidInitializer = !(isStringOrNumberLiteralExpression(initializer) || isSimpleLiteralEnumReference(initializer) || - initializer.kind === 102 /* TrueKeyword */ || initializer.kind === 87 /* FalseKeyword */ || + initializer.kind === 103 /* TrueKeyword */ || initializer.kind === 88 /* FalseKeyword */ || isBigIntLiteralExpression(initializer)); var isConstOrReadonly = ts.isDeclarationReadonly(node) || ts.isVariableDeclaration(node) && ts.isVarConst(node); if (isConstOrReadonly && !node.type) { @@ -59949,7 +60851,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 226 /* ForInStatement */ && node.parent.parent.kind !== 227 /* ForOfStatement */) { + if (node.parent.parent.kind !== 227 /* ForInStatement */ && node.parent.parent.kind !== 228 /* ForOfStatement */) { if (node.flags & 4194304 /* Ambient */) { checkAmbientInitializer(node); } @@ -59962,8 +60864,8 @@ var ts; } } } - if (node.exclamationToken && (node.parent.parent.kind !== 219 /* VariableStatement */ || !node.type || node.initializer || node.flags & 4194304 /* Ambient */)) { - return grammarErrorOnNode(node.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context); + if (node.exclamationToken && (node.parent.parent.kind !== 220 /* VariableStatement */ || !node.type || node.initializer || node.flags & 4194304 /* Ambient */)) { + return grammarErrorOnNode(node.exclamationToken, ts.Diagnostics.Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation); } if (compilerOptions.module !== ts.ModuleKind.ES2015 && compilerOptions.module !== ts.ModuleKind.ESNext && compilerOptions.module !== ts.ModuleKind.System && !compilerOptions.noEmit && !(node.parent.parent.flags & 4194304 /* Ambient */) && ts.hasModifier(node.parent.parent, 1 /* Export */)) { @@ -59979,7 +60881,7 @@ var ts; return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name); } function checkESModuleMarker(name) { - if (name.kind === 72 /* Identifier */) { + if (name.kind === 73 /* Identifier */) { if (ts.idText(name) === "__esModule") { return grammarErrorOnNode(name, ts.Diagnostics.Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules); } @@ -59996,8 +60898,8 @@ var ts; return false; } function checkGrammarNameInLetOrConstDeclarations(name) { - if (name.kind === 72 /* Identifier */) { - if (name.originalKeywordKind === 111 /* LetKeyword */) { + if (name.kind === 73 /* Identifier */) { + if (name.originalKeywordKind === 112 /* LetKeyword */) { return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations); } } @@ -60024,15 +60926,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 222 /* IfStatement */: - case 223 /* DoStatement */: - case 224 /* WhileStatement */: - case 231 /* WithStatement */: - case 225 /* ForStatement */: - case 226 /* ForInStatement */: - case 227 /* ForOfStatement */: + case 223 /* IfStatement */: + case 224 /* DoStatement */: + case 225 /* WhileStatement */: + case 232 /* WithStatement */: + case 226 /* ForStatement */: + case 227 /* ForInStatement */: + case 228 /* ForOfStatement */: return false; - case 233 /* LabeledStatement */: + case 234 /* LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -60050,12 +60952,12 @@ var ts; function checkGrammarMetaProperty(node) { var escapedText = node.name.escapedText; switch (node.keywordToken) { - case 95 /* NewKeyword */: + case 96 /* NewKeyword */: if (escapedText !== "target") { return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, ts.tokenToString(node.keywordToken), "target"); } break; - case 92 /* ImportKeyword */: + case 93 /* ImportKeyword */: if (escapedText !== "meta") { return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, ts.tokenToString(node.keywordToken), "meta"); } @@ -60106,11 +61008,14 @@ var ts; } function checkGrammarProperty(node) { if (ts.isClassLike(node.parent)) { + if (ts.isStringLiteral(node.name) && node.name.text === "constructor") { + return grammarErrorOnNode(node.name, ts.Diagnostics.Classes_may_not_have_a_field_named_constructor); + } if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) { return true; } } - else if (node.parent.kind === 241 /* InterfaceDeclaration */) { + else if (node.parent.kind === 242 /* InterfaceDeclaration */) { if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) { return true; } @@ -60118,7 +61023,7 @@ var ts; return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer); } } - else if (node.parent.kind === 168 /* TypeLiteral */) { + else if (node.parent.kind === 169 /* TypeLiteral */) { if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) { return true; } @@ -60147,22 +61052,22 @@ var ts; // export_opt AmbientDeclaration // // TODO: The spec needs to be amended to reflect this grammar. - if (node.kind === 241 /* InterfaceDeclaration */ || - node.kind === 242 /* TypeAliasDeclaration */ || - node.kind === 249 /* ImportDeclaration */ || - node.kind === 248 /* ImportEqualsDeclaration */ || - node.kind === 255 /* ExportDeclaration */ || - node.kind === 254 /* ExportAssignment */ || - node.kind === 247 /* NamespaceExportDeclaration */ || + if (node.kind === 242 /* InterfaceDeclaration */ || + node.kind === 243 /* TypeAliasDeclaration */ || + node.kind === 250 /* ImportDeclaration */ || + node.kind === 249 /* ImportEqualsDeclaration */ || + node.kind === 256 /* ExportDeclaration */ || + node.kind === 255 /* ExportAssignment */ || + node.kind === 248 /* NamespaceExportDeclaration */ || ts.hasModifier(node, 2 /* Ambient */ | 1 /* Export */ | 512 /* Default */)) { return false; } - return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); + return grammarErrorOnFirstToken(node, ts.Diagnostics.Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier); } function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 219 /* VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 220 /* VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -60189,7 +61094,7 @@ var ts; // to prevent noisiness. So use a bit on the block to indicate if // this has already been reported, and don't report if it has. // - if (node.parent.kind === 218 /* Block */ || node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 284 /* SourceFile */) { + if (node.parent.kind === 219 /* Block */ || node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 285 /* SourceFile */) { var links_2 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_2.hasReportedStatementInAmbientContext) { @@ -60211,10 +61116,10 @@ var ts; if (languageVersion >= 1 /* ES5 */) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 182 /* LiteralType */)) { + else if (ts.isChildOfNodeWithKind(node, 183 /* LiteralType */)) { diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 278 /* EnumMember */)) { + else if (ts.isChildOfNodeWithKind(node, 279 /* EnumMember */)) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; } if (diagnosticMessage) { @@ -60229,7 +61134,7 @@ var ts; var literalType = ts.isLiteralTypeNode(node.parent) || ts.isPrefixUnaryExpression(node.parent) && ts.isLiteralTypeNode(node.parent.parent); if (!literalType) { - if (languageVersion < 7 /* ESNext */) { + if (languageVersion < 8 /* ESNext */) { if (grammarErrorOnNode(node, ts.Diagnostics.BigInt_literals_are_not_available_when_targeting_lower_than_ESNext)) { return true; } @@ -60282,8 +61187,8 @@ var ts; /** Like 'isDeclarationName', but returns true for LHS of `import { x as y }` or `export { x as y }`. */ function isDeclarationNameOrImportPropertyName(name) { switch (name.parent.kind) { - case 253 /* ImportSpecifier */: - case 257 /* ExportSpecifier */: + case 254 /* ImportSpecifier */: + case 258 /* ExportSpecifier */: return ts.isIdentifier(name); default: return ts.isDeclarationName(name); @@ -60291,14 +61196,14 @@ var ts; } function isSomeImportDeclaration(decl) { switch (decl.kind) { - case 250 /* ImportClause */: // For default import - case 248 /* ImportEqualsDeclaration */: - case 251 /* NamespaceImport */: - case 253 /* ImportSpecifier */: // For rename import `x as y` + case 251 /* ImportClause */: // For default import + case 249 /* ImportEqualsDeclaration */: + case 252 /* NamespaceImport */: + case 254 /* ImportSpecifier */: // For rename import `x as y` return true; - case 72 /* Identifier */: + case 73 /* Identifier */: // For regular import, `decl` is an Identifier under the ImportSpecifier. - return decl.parent.kind === 253 /* ImportSpecifier */; + return decl.parent.kind === 254 /* ImportSpecifier */; default: return false; } @@ -60426,7 +61331,7 @@ var ts; return node; } function createIdentifier(text, typeArguments) { - var node = createSynthesizedNode(72 /* Identifier */); + var node = createSynthesizedNode(73 /* Identifier */); node.escapedText = ts.escapeLeadingUnderscores(text); node.originalKeywordKind = text ? ts.stringToToken(text) : 0 /* Unknown */; node.autoGenerateFlags = 0 /* None */; @@ -60507,23 +61412,23 @@ var ts; ts.createToken = createToken; // Reserved words function createSuper() { - return createSynthesizedNode(98 /* SuperKeyword */); + return createSynthesizedNode(99 /* SuperKeyword */); } ts.createSuper = createSuper; function createThis() { - return createSynthesizedNode(100 /* ThisKeyword */); + return createSynthesizedNode(101 /* ThisKeyword */); } ts.createThis = createThis; function createNull() { - return createSynthesizedNode(96 /* NullKeyword */); + return createSynthesizedNode(97 /* NullKeyword */); } ts.createNull = createNull; function createTrue() { - return createSynthesizedNode(102 /* TrueKeyword */); + return createSynthesizedNode(103 /* TrueKeyword */); } ts.createTrue = createTrue; function createFalse() { - return createSynthesizedNode(87 /* FalseKeyword */); + return createSynthesizedNode(88 /* FalseKeyword */); } ts.createFalse = createFalse; // Modifiers @@ -60534,44 +61439,44 @@ var ts; function createModifiersFromModifierFlags(flags) { var result = []; if (flags & 1 /* Export */) { - result.push(createModifier(85 /* ExportKeyword */)); + result.push(createModifier(86 /* ExportKeyword */)); } if (flags & 2 /* Ambient */) { - result.push(createModifier(125 /* DeclareKeyword */)); + result.push(createModifier(126 /* DeclareKeyword */)); } if (flags & 512 /* Default */) { - result.push(createModifier(80 /* DefaultKeyword */)); + result.push(createModifier(81 /* DefaultKeyword */)); } if (flags & 2048 /* Const */) { - result.push(createModifier(77 /* ConstKeyword */)); + result.push(createModifier(78 /* ConstKeyword */)); } if (flags & 4 /* Public */) { - result.push(createModifier(115 /* PublicKeyword */)); + result.push(createModifier(116 /* PublicKeyword */)); } if (flags & 8 /* Private */) { - result.push(createModifier(113 /* PrivateKeyword */)); + result.push(createModifier(114 /* PrivateKeyword */)); } if (flags & 16 /* Protected */) { - result.push(createModifier(114 /* ProtectedKeyword */)); + result.push(createModifier(115 /* ProtectedKeyword */)); } if (flags & 128 /* Abstract */) { - result.push(createModifier(118 /* AbstractKeyword */)); + result.push(createModifier(119 /* AbstractKeyword */)); } if (flags & 32 /* Static */) { - result.push(createModifier(116 /* StaticKeyword */)); + result.push(createModifier(117 /* StaticKeyword */)); } if (flags & 64 /* Readonly */) { - result.push(createModifier(133 /* ReadonlyKeyword */)); + result.push(createModifier(134 /* ReadonlyKeyword */)); } if (flags & 256 /* Async */) { - result.push(createModifier(121 /* AsyncKeyword */)); + result.push(createModifier(122 /* AsyncKeyword */)); } return result; } ts.createModifiersFromModifierFlags = createModifiersFromModifierFlags; // Names function createQualifiedName(left, right) { - var node = createSynthesizedNode(148 /* QualifiedName */); + var node = createSynthesizedNode(149 /* QualifiedName */); node.left = left; node.right = asName(right); return node; @@ -60590,7 +61495,7 @@ var ts; : expression; } function createComputedPropertyName(expression) { - var node = createSynthesizedNode(149 /* ComputedPropertyName */); + var node = createSynthesizedNode(150 /* ComputedPropertyName */); node.expression = parenthesizeForComputedName(expression); return node; } @@ -60603,7 +61508,7 @@ var ts; ts.updateComputedPropertyName = updateComputedPropertyName; // Signature elements function createTypeParameterDeclaration(name, constraint, defaultType) { - var node = createSynthesizedNode(150 /* TypeParameter */); + var node = createSynthesizedNode(151 /* TypeParameter */); node.name = asName(name); node.constraint = constraint; node.default = defaultType; @@ -60619,7 +61524,7 @@ var ts; } ts.updateTypeParameterDeclaration = updateTypeParameterDeclaration; function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer) { - var node = createSynthesizedNode(151 /* Parameter */); + var node = createSynthesizedNode(152 /* Parameter */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.dotDotDotToken = dotDotDotToken; @@ -60643,7 +61548,7 @@ var ts; } ts.updateParameter = updateParameter; function createDecorator(expression) { - var node = createSynthesizedNode(152 /* Decorator */); + var node = createSynthesizedNode(153 /* Decorator */); node.expression = ts.parenthesizeForAccess(expression); return node; } @@ -60656,7 +61561,7 @@ var ts; ts.updateDecorator = updateDecorator; // Type Elements function createPropertySignature(modifiers, name, questionToken, type, initializer) { - var node = createSynthesizedNode(153 /* PropertySignature */); + var node = createSynthesizedNode(154 /* PropertySignature */); node.modifiers = asNodeArray(modifiers); node.name = asName(name); node.questionToken = questionToken; @@ -60676,7 +61581,7 @@ var ts; } ts.updatePropertySignature = updatePropertySignature; function createProperty(decorators, modifiers, name, questionOrExclamationToken, type, initializer) { - var node = createSynthesizedNode(154 /* PropertyDeclaration */); + var node = createSynthesizedNode(155 /* PropertyDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -60700,7 +61605,7 @@ var ts; } ts.updateProperty = updateProperty; function createMethodSignature(typeParameters, parameters, type, name, questionToken) { - var node = createSignatureDeclaration(155 /* MethodSignature */, typeParameters, parameters, type); + var node = createSignatureDeclaration(156 /* MethodSignature */, typeParameters, parameters, type); node.name = asName(name); node.questionToken = questionToken; return node; @@ -60717,7 +61622,7 @@ var ts; } ts.updateMethodSignature = updateMethodSignature; function createMethod(decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { - var node = createSynthesizedNode(156 /* MethodDeclaration */); + var node = createSynthesizedNode(157 /* MethodDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; @@ -60745,7 +61650,7 @@ var ts; } ts.updateMethod = updateMethod; function createConstructor(decorators, modifiers, parameters, body) { - var node = createSynthesizedNode(157 /* Constructor */); + var node = createSynthesizedNode(158 /* Constructor */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.typeParameters = undefined; @@ -60765,7 +61670,7 @@ var ts; } ts.updateConstructor = updateConstructor; function createGetAccessor(decorators, modifiers, name, parameters, type, body) { - var node = createSynthesizedNode(158 /* GetAccessor */); + var node = createSynthesizedNode(159 /* GetAccessor */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -60788,7 +61693,7 @@ var ts; } ts.updateGetAccessor = updateGetAccessor; function createSetAccessor(decorators, modifiers, name, parameters, body) { - var node = createSynthesizedNode(159 /* SetAccessor */); + var node = createSynthesizedNode(160 /* SetAccessor */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -60809,7 +61714,7 @@ var ts; } ts.updateSetAccessor = updateSetAccessor; function createCallSignature(typeParameters, parameters, type) { - return createSignatureDeclaration(160 /* CallSignature */, typeParameters, parameters, type); + return createSignatureDeclaration(161 /* CallSignature */, typeParameters, parameters, type); } ts.createCallSignature = createCallSignature; function updateCallSignature(node, typeParameters, parameters, type) { @@ -60817,7 +61722,7 @@ var ts; } ts.updateCallSignature = updateCallSignature; function createConstructSignature(typeParameters, parameters, type) { - return createSignatureDeclaration(161 /* ConstructSignature */, typeParameters, parameters, type); + return createSignatureDeclaration(162 /* ConstructSignature */, typeParameters, parameters, type); } ts.createConstructSignature = createConstructSignature; function updateConstructSignature(node, typeParameters, parameters, type) { @@ -60825,7 +61730,7 @@ var ts; } ts.updateConstructSignature = updateConstructSignature; function createIndexSignature(decorators, modifiers, parameters, type) { - var node = createSynthesizedNode(162 /* IndexSignature */); + var node = createSynthesizedNode(163 /* IndexSignature */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.parameters = createNodeArray(parameters); @@ -60865,7 +61770,7 @@ var ts; } ts.createKeywordTypeNode = createKeywordTypeNode; function createTypePredicateNode(parameterName, type) { - var node = createSynthesizedNode(163 /* TypePredicate */); + var node = createSynthesizedNode(164 /* TypePredicate */); node.parameterName = asName(parameterName); node.type = type; return node; @@ -60879,7 +61784,7 @@ var ts; } ts.updateTypePredicateNode = updateTypePredicateNode; function createTypeReferenceNode(typeName, typeArguments) { - var node = createSynthesizedNode(164 /* TypeReference */); + var node = createSynthesizedNode(165 /* TypeReference */); node.typeName = asName(typeName); node.typeArguments = typeArguments && ts.parenthesizeTypeParameters(typeArguments); return node; @@ -60893,7 +61798,7 @@ var ts; } ts.updateTypeReferenceNode = updateTypeReferenceNode; function createFunctionTypeNode(typeParameters, parameters, type) { - return createSignatureDeclaration(165 /* FunctionType */, typeParameters, parameters, type); + return createSignatureDeclaration(166 /* FunctionType */, typeParameters, parameters, type); } ts.createFunctionTypeNode = createFunctionTypeNode; function updateFunctionTypeNode(node, typeParameters, parameters, type) { @@ -60901,7 +61806,7 @@ var ts; } ts.updateFunctionTypeNode = updateFunctionTypeNode; function createConstructorTypeNode(typeParameters, parameters, type) { - return createSignatureDeclaration(166 /* ConstructorType */, typeParameters, parameters, type); + return createSignatureDeclaration(167 /* ConstructorType */, typeParameters, parameters, type); } ts.createConstructorTypeNode = createConstructorTypeNode; function updateConstructorTypeNode(node, typeParameters, parameters, type) { @@ -60909,7 +61814,7 @@ var ts; } ts.updateConstructorTypeNode = updateConstructorTypeNode; function createTypeQueryNode(exprName) { - var node = createSynthesizedNode(167 /* TypeQuery */); + var node = createSynthesizedNode(168 /* TypeQuery */); node.exprName = exprName; return node; } @@ -60921,7 +61826,7 @@ var ts; } ts.updateTypeQueryNode = updateTypeQueryNode; function createTypeLiteralNode(members) { - var node = createSynthesizedNode(168 /* TypeLiteral */); + var node = createSynthesizedNode(169 /* TypeLiteral */); node.members = createNodeArray(members); return node; } @@ -60933,7 +61838,7 @@ var ts; } ts.updateTypeLiteralNode = updateTypeLiteralNode; function createArrayTypeNode(elementType) { - var node = createSynthesizedNode(169 /* ArrayType */); + var node = createSynthesizedNode(170 /* ArrayType */); node.elementType = ts.parenthesizeArrayTypeMember(elementType); return node; } @@ -60945,7 +61850,7 @@ var ts; } ts.updateArrayTypeNode = updateArrayTypeNode; function createTupleTypeNode(elementTypes) { - var node = createSynthesizedNode(170 /* TupleType */); + var node = createSynthesizedNode(171 /* TupleType */); node.elementTypes = createNodeArray(elementTypes); return node; } @@ -60957,7 +61862,7 @@ var ts; } ts.updateTupleTypeNode = updateTupleTypeNode; function createOptionalTypeNode(type) { - var node = createSynthesizedNode(171 /* OptionalType */); + var node = createSynthesizedNode(172 /* OptionalType */); node.type = ts.parenthesizeArrayTypeMember(type); return node; } @@ -60969,7 +61874,7 @@ var ts; } ts.updateOptionalTypeNode = updateOptionalTypeNode; function createRestTypeNode(type) { - var node = createSynthesizedNode(172 /* RestType */); + var node = createSynthesizedNode(173 /* RestType */); node.type = type; return node; } @@ -60981,7 +61886,7 @@ var ts; } ts.updateRestTypeNode = updateRestTypeNode; function createUnionTypeNode(types) { - return createUnionOrIntersectionTypeNode(173 /* UnionType */, types); + return createUnionOrIntersectionTypeNode(174 /* UnionType */, types); } ts.createUnionTypeNode = createUnionTypeNode; function updateUnionTypeNode(node, types) { @@ -60989,7 +61894,7 @@ var ts; } ts.updateUnionTypeNode = updateUnionTypeNode; function createIntersectionTypeNode(types) { - return createUnionOrIntersectionTypeNode(174 /* IntersectionType */, types); + return createUnionOrIntersectionTypeNode(175 /* IntersectionType */, types); } ts.createIntersectionTypeNode = createIntersectionTypeNode; function updateIntersectionTypeNode(node, types) { @@ -61008,7 +61913,7 @@ var ts; : node; } function createConditionalTypeNode(checkType, extendsType, trueType, falseType) { - var node = createSynthesizedNode(175 /* ConditionalType */); + var node = createSynthesizedNode(176 /* ConditionalType */); node.checkType = ts.parenthesizeConditionalTypeMember(checkType); node.extendsType = ts.parenthesizeConditionalTypeMember(extendsType); node.trueType = trueType; @@ -61026,7 +61931,7 @@ var ts; } ts.updateConditionalTypeNode = updateConditionalTypeNode; function createInferTypeNode(typeParameter) { - var node = createSynthesizedNode(176 /* InferType */); + var node = createSynthesizedNode(177 /* InferType */); node.typeParameter = typeParameter; return node; } @@ -61038,10 +61943,10 @@ var ts; } ts.updateInferTypeNode = updateInferTypeNode; function createImportTypeNode(argument, qualifier, typeArguments, isTypeOf) { - var node = createSynthesizedNode(183 /* ImportType */); + var node = createSynthesizedNode(184 /* ImportType */); node.argument = argument; node.qualifier = qualifier; - node.typeArguments = asNodeArray(typeArguments); + node.typeArguments = ts.parenthesizeTypeParameters(typeArguments); node.isTypeOf = isTypeOf; return node; } @@ -61056,7 +61961,7 @@ var ts; } ts.updateImportTypeNode = updateImportTypeNode; function createParenthesizedType(type) { - var node = createSynthesizedNode(177 /* ParenthesizedType */); + var node = createSynthesizedNode(178 /* ParenthesizedType */); node.type = type; return node; } @@ -61068,12 +61973,12 @@ var ts; } ts.updateParenthesizedType = updateParenthesizedType; function createThisTypeNode() { - return createSynthesizedNode(178 /* ThisType */); + return createSynthesizedNode(179 /* ThisType */); } ts.createThisTypeNode = createThisTypeNode; function createTypeOperatorNode(operatorOrType, type) { - var node = createSynthesizedNode(179 /* TypeOperator */); - node.operator = typeof operatorOrType === "number" ? operatorOrType : 129 /* KeyOfKeyword */; + var node = createSynthesizedNode(180 /* TypeOperator */); + node.operator = typeof operatorOrType === "number" ? operatorOrType : 130 /* KeyOfKeyword */; node.type = ts.parenthesizeElementTypeMember(typeof operatorOrType === "number" ? type : operatorOrType); return node; } @@ -61083,7 +61988,7 @@ var ts; } ts.updateTypeOperatorNode = updateTypeOperatorNode; function createIndexedAccessTypeNode(objectType, indexType) { - var node = createSynthesizedNode(180 /* IndexedAccessType */); + var node = createSynthesizedNode(181 /* IndexedAccessType */); node.objectType = ts.parenthesizeElementTypeMember(objectType); node.indexType = indexType; return node; @@ -61097,7 +62002,7 @@ var ts; } ts.updateIndexedAccessTypeNode = updateIndexedAccessTypeNode; function createMappedTypeNode(readonlyToken, typeParameter, questionToken, type) { - var node = createSynthesizedNode(181 /* MappedType */); + var node = createSynthesizedNode(182 /* MappedType */); node.readonlyToken = readonlyToken; node.typeParameter = typeParameter; node.questionToken = questionToken; @@ -61115,7 +62020,7 @@ var ts; } ts.updateMappedTypeNode = updateMappedTypeNode; function createLiteralTypeNode(literal) { - var node = createSynthesizedNode(182 /* LiteralType */); + var node = createSynthesizedNode(183 /* LiteralType */); node.literal = literal; return node; } @@ -61128,7 +62033,7 @@ var ts; ts.updateLiteralTypeNode = updateLiteralTypeNode; // Binding Patterns function createObjectBindingPattern(elements) { - var node = createSynthesizedNode(184 /* ObjectBindingPattern */); + var node = createSynthesizedNode(185 /* ObjectBindingPattern */); node.elements = createNodeArray(elements); return node; } @@ -61140,7 +62045,7 @@ var ts; } ts.updateObjectBindingPattern = updateObjectBindingPattern; function createArrayBindingPattern(elements) { - var node = createSynthesizedNode(185 /* ArrayBindingPattern */); + var node = createSynthesizedNode(186 /* ArrayBindingPattern */); node.elements = createNodeArray(elements); return node; } @@ -61152,7 +62057,7 @@ var ts; } ts.updateArrayBindingPattern = updateArrayBindingPattern; function createBindingElement(dotDotDotToken, propertyName, name, initializer) { - var node = createSynthesizedNode(186 /* BindingElement */); + var node = createSynthesizedNode(187 /* BindingElement */); node.dotDotDotToken = dotDotDotToken; node.propertyName = asName(propertyName); node.name = asName(name); @@ -61171,7 +62076,7 @@ var ts; ts.updateBindingElement = updateBindingElement; // Expression function createArrayLiteral(elements, multiLine) { - var node = createSynthesizedNode(187 /* ArrayLiteralExpression */); + var node = createSynthesizedNode(188 /* ArrayLiteralExpression */); node.elements = ts.parenthesizeListElements(createNodeArray(elements)); if (multiLine) node.multiLine = true; @@ -61185,7 +62090,7 @@ var ts; } ts.updateArrayLiteral = updateArrayLiteral; function createObjectLiteral(properties, multiLine) { - var node = createSynthesizedNode(188 /* ObjectLiteralExpression */); + var node = createSynthesizedNode(189 /* ObjectLiteralExpression */); node.properties = createNodeArray(properties); if (multiLine) node.multiLine = true; @@ -61199,9 +62104,9 @@ var ts; } ts.updateObjectLiteral = updateObjectLiteral; function createPropertyAccess(expression, name) { - var node = createSynthesizedNode(189 /* PropertyAccessExpression */); + var node = createSynthesizedNode(190 /* PropertyAccessExpression */); node.expression = ts.parenthesizeForAccess(expression); - node.name = asName(name); // TODO: GH#18217 + node.name = asName(name); setEmitFlags(node, 131072 /* NoIndentation */); return node; } @@ -61216,7 +62121,7 @@ var ts; } ts.updatePropertyAccess = updatePropertyAccess; function createElementAccess(expression, index) { - var node = createSynthesizedNode(190 /* ElementAccessExpression */); + var node = createSynthesizedNode(191 /* ElementAccessExpression */); node.expression = ts.parenthesizeForAccess(expression); node.argumentExpression = asExpression(index); return node; @@ -61230,7 +62135,7 @@ var ts; } ts.updateElementAccess = updateElementAccess; function createCall(expression, typeArguments, argumentsArray) { - var node = createSynthesizedNode(191 /* CallExpression */); + var node = createSynthesizedNode(192 /* CallExpression */); node.expression = ts.parenthesizeForAccess(expression); node.typeArguments = asNodeArray(typeArguments); node.arguments = ts.parenthesizeListElements(createNodeArray(argumentsArray)); @@ -61246,7 +62151,7 @@ var ts; } ts.updateCall = updateCall; function createNew(expression, typeArguments, argumentsArray) { - var node = createSynthesizedNode(192 /* NewExpression */); + var node = createSynthesizedNode(193 /* NewExpression */); node.expression = ts.parenthesizeForNew(expression); node.typeArguments = asNodeArray(typeArguments); node.arguments = argumentsArray ? ts.parenthesizeListElements(createNodeArray(argumentsArray)) : undefined; @@ -61262,7 +62167,7 @@ var ts; } ts.updateNew = updateNew; function createTaggedTemplate(tag, typeArgumentsOrTemplate, template) { - var node = createSynthesizedNode(193 /* TaggedTemplateExpression */); + var node = createSynthesizedNode(194 /* TaggedTemplateExpression */); node.tag = ts.parenthesizeForAccess(tag); if (template) { node.typeArguments = asNodeArray(typeArgumentsOrTemplate); @@ -61285,7 +62190,7 @@ var ts; } ts.updateTaggedTemplate = updateTaggedTemplate; function createTypeAssertion(type, expression) { - var node = createSynthesizedNode(194 /* TypeAssertionExpression */); + var node = createSynthesizedNode(195 /* TypeAssertionExpression */); node.type = type; node.expression = ts.parenthesizePrefixOperand(expression); return node; @@ -61299,7 +62204,7 @@ var ts; } ts.updateTypeAssertion = updateTypeAssertion; function createParen(expression) { - var node = createSynthesizedNode(195 /* ParenthesizedExpression */); + var node = createSynthesizedNode(196 /* ParenthesizedExpression */); node.expression = expression; return node; } @@ -61311,7 +62216,7 @@ var ts; } ts.updateParen = updateParen; function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createSynthesizedNode(196 /* FunctionExpression */); + var node = createSynthesizedNode(197 /* FunctionExpression */); node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; node.name = asName(name); @@ -61335,7 +62240,7 @@ var ts; } ts.updateFunctionExpression = updateFunctionExpression; function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { - var node = createSynthesizedNode(197 /* ArrowFunction */); + var node = createSynthesizedNode(198 /* ArrowFunction */); node.modifiers = asNodeArray(modifiers); node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); @@ -61357,7 +62262,7 @@ var ts; } ts.updateArrowFunction = updateArrowFunction; function createDelete(expression) { - var node = createSynthesizedNode(198 /* DeleteExpression */); + var node = createSynthesizedNode(199 /* DeleteExpression */); node.expression = ts.parenthesizePrefixOperand(expression); return node; } @@ -61369,7 +62274,7 @@ var ts; } ts.updateDelete = updateDelete; function createTypeOf(expression) { - var node = createSynthesizedNode(199 /* TypeOfExpression */); + var node = createSynthesizedNode(200 /* TypeOfExpression */); node.expression = ts.parenthesizePrefixOperand(expression); return node; } @@ -61381,7 +62286,7 @@ var ts; } ts.updateTypeOf = updateTypeOf; function createVoid(expression) { - var node = createSynthesizedNode(200 /* VoidExpression */); + var node = createSynthesizedNode(201 /* VoidExpression */); node.expression = ts.parenthesizePrefixOperand(expression); return node; } @@ -61393,7 +62298,7 @@ var ts; } ts.updateVoid = updateVoid; function createAwait(expression) { - var node = createSynthesizedNode(201 /* AwaitExpression */); + var node = createSynthesizedNode(202 /* AwaitExpression */); node.expression = ts.parenthesizePrefixOperand(expression); return node; } @@ -61405,7 +62310,7 @@ var ts; } ts.updateAwait = updateAwait; function createPrefix(operator, operand) { - var node = createSynthesizedNode(202 /* PrefixUnaryExpression */); + var node = createSynthesizedNode(203 /* PrefixUnaryExpression */); node.operator = operator; node.operand = ts.parenthesizePrefixOperand(operand); return node; @@ -61418,7 +62323,7 @@ var ts; } ts.updatePrefix = updatePrefix; function createPostfix(operand, operator) { - var node = createSynthesizedNode(203 /* PostfixUnaryExpression */); + var node = createSynthesizedNode(204 /* PostfixUnaryExpression */); node.operand = ts.parenthesizePostfixOperand(operand); node.operator = operator; return node; @@ -61431,7 +62336,7 @@ var ts; } ts.updatePostfix = updatePostfix; function createBinary(left, operator, right) { - var node = createSynthesizedNode(204 /* BinaryExpression */); + var node = createSynthesizedNode(205 /* BinaryExpression */); var operatorToken = asToken(operator); var operatorKind = operatorToken.kind; node.left = ts.parenthesizeBinaryOperand(operatorKind, left, /*isLeftSideOfBinary*/ true, /*leftOperand*/ undefined); @@ -61448,7 +62353,7 @@ var ts; } ts.updateBinary = updateBinary; function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonToken, whenFalse) { - var node = createSynthesizedNode(205 /* ConditionalExpression */); + var node = createSynthesizedNode(206 /* ConditionalExpression */); node.condition = ts.parenthesizeForConditionalHead(condition); node.questionToken = whenFalse ? questionTokenOrWhenTrue : createToken(56 /* QuestionToken */); node.whenTrue = ts.parenthesizeSubexpressionOfConditionalExpression(whenFalse ? whenTrueOrWhenFalse : questionTokenOrWhenTrue); @@ -61468,7 +62373,7 @@ var ts; } ts.updateConditional = updateConditional; function createTemplateExpression(head, templateSpans) { - var node = createSynthesizedNode(206 /* TemplateExpression */); + var node = createSynthesizedNode(207 /* TemplateExpression */); node.head = head; node.templateSpans = createNodeArray(templateSpans); return node; @@ -61506,7 +62411,7 @@ var ts; } ts.createNoSubstitutionTemplateLiteral = createNoSubstitutionTemplateLiteral; function createYield(asteriskTokenOrExpression, expression) { - var node = createSynthesizedNode(207 /* YieldExpression */); + var node = createSynthesizedNode(208 /* YieldExpression */); node.asteriskToken = asteriskTokenOrExpression && asteriskTokenOrExpression.kind === 40 /* AsteriskToken */ ? asteriskTokenOrExpression : undefined; node.expression = asteriskTokenOrExpression && asteriskTokenOrExpression.kind !== 40 /* AsteriskToken */ ? asteriskTokenOrExpression : expression; return node; @@ -61520,7 +62425,7 @@ var ts; } ts.updateYield = updateYield; function createSpread(expression) { - var node = createSynthesizedNode(208 /* SpreadElement */); + var node = createSynthesizedNode(209 /* SpreadElement */); node.expression = ts.parenthesizeExpressionForList(expression); return node; } @@ -61532,7 +62437,7 @@ var ts; } ts.updateSpread = updateSpread; function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { - var node = createSynthesizedNode(209 /* ClassExpression */); + var node = createSynthesizedNode(210 /* ClassExpression */); node.decorators = undefined; node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -61553,11 +62458,11 @@ var ts; } ts.updateClassExpression = updateClassExpression; function createOmittedExpression() { - return createSynthesizedNode(210 /* OmittedExpression */); + return createSynthesizedNode(211 /* OmittedExpression */); } ts.createOmittedExpression = createOmittedExpression; function createExpressionWithTypeArguments(typeArguments, expression) { - var node = createSynthesizedNode(211 /* ExpressionWithTypeArguments */); + var node = createSynthesizedNode(212 /* ExpressionWithTypeArguments */); node.expression = ts.parenthesizeForAccess(expression); node.typeArguments = asNodeArray(typeArguments); return node; @@ -61571,7 +62476,7 @@ var ts; } ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments; function createAsExpression(expression, type) { - var node = createSynthesizedNode(212 /* AsExpression */); + var node = createSynthesizedNode(213 /* AsExpression */); node.expression = expression; node.type = type; return node; @@ -61585,7 +62490,7 @@ var ts; } ts.updateAsExpression = updateAsExpression; function createNonNullExpression(expression) { - var node = createSynthesizedNode(213 /* NonNullExpression */); + var node = createSynthesizedNode(214 /* NonNullExpression */); node.expression = ts.parenthesizeForAccess(expression); return node; } @@ -61597,7 +62502,7 @@ var ts; } ts.updateNonNullExpression = updateNonNullExpression; function createMetaProperty(keywordToken, name) { - var node = createSynthesizedNode(214 /* MetaProperty */); + var node = createSynthesizedNode(215 /* MetaProperty */); node.keywordToken = keywordToken; node.name = name; return node; @@ -61611,7 +62516,7 @@ var ts; ts.updateMetaProperty = updateMetaProperty; // Misc function createTemplateSpan(expression, literal) { - var node = createSynthesizedNode(216 /* TemplateSpan */); + var node = createSynthesizedNode(217 /* TemplateSpan */); node.expression = expression; node.literal = literal; return node; @@ -61625,12 +62530,12 @@ var ts; } ts.updateTemplateSpan = updateTemplateSpan; function createSemicolonClassElement() { - return createSynthesizedNode(217 /* SemicolonClassElement */); + return createSynthesizedNode(218 /* SemicolonClassElement */); } ts.createSemicolonClassElement = createSemicolonClassElement; // Element function createBlock(statements, multiLine) { - var block = createSynthesizedNode(218 /* Block */); + var block = createSynthesizedNode(219 /* Block */); block.statements = createNodeArray(statements); if (multiLine) block.multiLine = multiLine; @@ -61644,7 +62549,7 @@ var ts; } ts.updateBlock = updateBlock; function createVariableStatement(modifiers, declarationList) { - var node = createSynthesizedNode(219 /* VariableStatement */); + var node = createSynthesizedNode(220 /* VariableStatement */); node.decorators = undefined; node.modifiers = asNodeArray(modifiers); node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; @@ -61659,11 +62564,11 @@ var ts; } ts.updateVariableStatement = updateVariableStatement; function createEmptyStatement() { - return createSynthesizedNode(220 /* EmptyStatement */); + return createSynthesizedNode(221 /* EmptyStatement */); } ts.createEmptyStatement = createEmptyStatement; function createExpressionStatement(expression) { - var node = createSynthesizedNode(221 /* ExpressionStatement */); + var node = createSynthesizedNode(222 /* ExpressionStatement */); node.expression = ts.parenthesizeExpressionForExpressionStatement(expression); return node; } @@ -61679,7 +62584,7 @@ var ts; /** @deprecated Use `updateExpressionStatement` instead. */ ts.updateStatement = updateExpressionStatement; function createIf(expression, thenStatement, elseStatement) { - var node = createSynthesizedNode(222 /* IfStatement */); + var node = createSynthesizedNode(223 /* IfStatement */); node.expression = expression; node.thenStatement = thenStatement; node.elseStatement = elseStatement; @@ -61695,7 +62600,7 @@ var ts; } ts.updateIf = updateIf; function createDo(statement, expression) { - var node = createSynthesizedNode(223 /* DoStatement */); + var node = createSynthesizedNode(224 /* DoStatement */); node.statement = statement; node.expression = expression; return node; @@ -61709,7 +62614,7 @@ var ts; } ts.updateDo = updateDo; function createWhile(expression, statement) { - var node = createSynthesizedNode(224 /* WhileStatement */); + var node = createSynthesizedNode(225 /* WhileStatement */); node.expression = expression; node.statement = statement; return node; @@ -61723,7 +62628,7 @@ var ts; } ts.updateWhile = updateWhile; function createFor(initializer, condition, incrementor, statement) { - var node = createSynthesizedNode(225 /* ForStatement */); + var node = createSynthesizedNode(226 /* ForStatement */); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -61741,7 +62646,7 @@ var ts; } ts.updateFor = updateFor; function createForIn(initializer, expression, statement) { - var node = createSynthesizedNode(226 /* ForInStatement */); + var node = createSynthesizedNode(227 /* ForInStatement */); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -61757,7 +62662,7 @@ var ts; } ts.updateForIn = updateForIn; function createForOf(awaitModifier, initializer, expression, statement) { - var node = createSynthesizedNode(227 /* ForOfStatement */); + var node = createSynthesizedNode(228 /* ForOfStatement */); node.awaitModifier = awaitModifier; node.initializer = initializer; node.expression = expression; @@ -61775,7 +62680,7 @@ var ts; } ts.updateForOf = updateForOf; function createContinue(label) { - var node = createSynthesizedNode(228 /* ContinueStatement */); + var node = createSynthesizedNode(229 /* ContinueStatement */); node.label = asName(label); return node; } @@ -61787,7 +62692,7 @@ var ts; } ts.updateContinue = updateContinue; function createBreak(label) { - var node = createSynthesizedNode(229 /* BreakStatement */); + var node = createSynthesizedNode(230 /* BreakStatement */); node.label = asName(label); return node; } @@ -61799,7 +62704,7 @@ var ts; } ts.updateBreak = updateBreak; function createReturn(expression) { - var node = createSynthesizedNode(230 /* ReturnStatement */); + var node = createSynthesizedNode(231 /* ReturnStatement */); node.expression = expression; return node; } @@ -61811,7 +62716,7 @@ var ts; } ts.updateReturn = updateReturn; function createWith(expression, statement) { - var node = createSynthesizedNode(231 /* WithStatement */); + var node = createSynthesizedNode(232 /* WithStatement */); node.expression = expression; node.statement = statement; return node; @@ -61825,7 +62730,7 @@ var ts; } ts.updateWith = updateWith; function createSwitch(expression, caseBlock) { - var node = createSynthesizedNode(232 /* SwitchStatement */); + var node = createSynthesizedNode(233 /* SwitchStatement */); node.expression = ts.parenthesizeExpressionForList(expression); node.caseBlock = caseBlock; return node; @@ -61839,7 +62744,7 @@ var ts; } ts.updateSwitch = updateSwitch; function createLabel(label, statement) { - var node = createSynthesizedNode(233 /* LabeledStatement */); + var node = createSynthesizedNode(234 /* LabeledStatement */); node.label = asName(label); node.statement = statement; return node; @@ -61853,7 +62758,7 @@ var ts; } ts.updateLabel = updateLabel; function createThrow(expression) { - var node = createSynthesizedNode(234 /* ThrowStatement */); + var node = createSynthesizedNode(235 /* ThrowStatement */); node.expression = expression; return node; } @@ -61865,7 +62770,7 @@ var ts; } ts.updateThrow = updateThrow; function createTry(tryBlock, catchClause, finallyBlock) { - var node = createSynthesizedNode(235 /* TryStatement */); + var node = createSynthesizedNode(236 /* TryStatement */); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -61881,11 +62786,11 @@ var ts; } ts.updateTry = updateTry; function createDebuggerStatement() { - return createSynthesizedNode(236 /* DebuggerStatement */); + return createSynthesizedNode(237 /* DebuggerStatement */); } ts.createDebuggerStatement = createDebuggerStatement; function createVariableDeclaration(name, type, initializer) { - var node = createSynthesizedNode(237 /* VariableDeclaration */); + var node = createSynthesizedNode(238 /* VariableDeclaration */); node.name = asName(name); node.type = type; node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined; @@ -61902,7 +62807,7 @@ var ts; ts.updateVariableDeclaration = updateVariableDeclaration; function createVariableDeclarationList(declarations, flags) { if (flags === void 0) { flags = 0 /* None */; } - var node = createSynthesizedNode(238 /* VariableDeclarationList */); + var node = createSynthesizedNode(239 /* VariableDeclarationList */); node.flags |= flags & 3 /* BlockScoped */; node.declarations = createNodeArray(declarations); return node; @@ -61915,7 +62820,7 @@ var ts; } ts.updateVariableDeclarationList = updateVariableDeclarationList; function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createSynthesizedNode(239 /* FunctionDeclaration */); + var node = createSynthesizedNode(240 /* FunctionDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; @@ -61941,7 +62846,7 @@ var ts; } ts.updateFunctionDeclaration = updateFunctionDeclaration; function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) { - var node = createSynthesizedNode(240 /* ClassDeclaration */); + var node = createSynthesizedNode(241 /* ClassDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -61963,7 +62868,7 @@ var ts; } ts.updateClassDeclaration = updateClassDeclaration; function createInterfaceDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) { - var node = createSynthesizedNode(241 /* InterfaceDeclaration */); + var node = createSynthesizedNode(242 /* InterfaceDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -61985,7 +62890,7 @@ var ts; } ts.updateInterfaceDeclaration = updateInterfaceDeclaration; function createTypeAliasDeclaration(decorators, modifiers, name, typeParameters, type) { - var node = createSynthesizedNode(242 /* TypeAliasDeclaration */); + var node = createSynthesizedNode(243 /* TypeAliasDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -62005,7 +62910,7 @@ var ts; } ts.updateTypeAliasDeclaration = updateTypeAliasDeclaration; function createEnumDeclaration(decorators, modifiers, name, members) { - var node = createSynthesizedNode(243 /* EnumDeclaration */); + var node = createSynthesizedNode(244 /* EnumDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -62024,7 +62929,7 @@ var ts; ts.updateEnumDeclaration = updateEnumDeclaration; function createModuleDeclaration(decorators, modifiers, name, body, flags) { if (flags === void 0) { flags = 0 /* None */; } - var node = createSynthesizedNode(244 /* ModuleDeclaration */); + var node = createSynthesizedNode(245 /* ModuleDeclaration */); node.flags |= flags & (16 /* Namespace */ | 4 /* NestedNamespace */ | 512 /* GlobalAugmentation */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); @@ -62043,7 +62948,7 @@ var ts; } ts.updateModuleDeclaration = updateModuleDeclaration; function createModuleBlock(statements) { - var node = createSynthesizedNode(245 /* ModuleBlock */); + var node = createSynthesizedNode(246 /* ModuleBlock */); node.statements = createNodeArray(statements); return node; } @@ -62055,7 +62960,7 @@ var ts; } ts.updateModuleBlock = updateModuleBlock; function createCaseBlock(clauses) { - var node = createSynthesizedNode(246 /* CaseBlock */); + var node = createSynthesizedNode(247 /* CaseBlock */); node.clauses = createNodeArray(clauses); return node; } @@ -62067,7 +62972,7 @@ var ts; } ts.updateCaseBlock = updateCaseBlock; function createNamespaceExportDeclaration(name) { - var node = createSynthesizedNode(247 /* NamespaceExportDeclaration */); + var node = createSynthesizedNode(248 /* NamespaceExportDeclaration */); node.name = asName(name); return node; } @@ -62079,7 +62984,7 @@ var ts; } ts.updateNamespaceExportDeclaration = updateNamespaceExportDeclaration; function createImportEqualsDeclaration(decorators, modifiers, name, moduleReference) { - var node = createSynthesizedNode(248 /* ImportEqualsDeclaration */); + var node = createSynthesizedNode(249 /* ImportEqualsDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.name = asName(name); @@ -62097,7 +63002,7 @@ var ts; } ts.updateImportEqualsDeclaration = updateImportEqualsDeclaration; function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier) { - var node = createSynthesizedNode(249 /* ImportDeclaration */); + var node = createSynthesizedNode(250 /* ImportDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.importClause = importClause; @@ -62115,7 +63020,7 @@ var ts; } ts.updateImportDeclaration = updateImportDeclaration; function createImportClause(name, namedBindings) { - var node = createSynthesizedNode(250 /* ImportClause */); + var node = createSynthesizedNode(251 /* ImportClause */); node.name = name; node.namedBindings = namedBindings; return node; @@ -62129,7 +63034,7 @@ var ts; } ts.updateImportClause = updateImportClause; function createNamespaceImport(name) { - var node = createSynthesizedNode(251 /* NamespaceImport */); + var node = createSynthesizedNode(252 /* NamespaceImport */); node.name = name; return node; } @@ -62141,7 +63046,7 @@ var ts; } ts.updateNamespaceImport = updateNamespaceImport; function createNamedImports(elements) { - var node = createSynthesizedNode(252 /* NamedImports */); + var node = createSynthesizedNode(253 /* NamedImports */); node.elements = createNodeArray(elements); return node; } @@ -62153,7 +63058,7 @@ var ts; } ts.updateNamedImports = updateNamedImports; function createImportSpecifier(propertyName, name) { - var node = createSynthesizedNode(253 /* ImportSpecifier */); + var node = createSynthesizedNode(254 /* ImportSpecifier */); node.propertyName = propertyName; node.name = name; return node; @@ -62167,11 +63072,11 @@ var ts; } ts.updateImportSpecifier = updateImportSpecifier; function createExportAssignment(decorators, modifiers, isExportEquals, expression) { - var node = createSynthesizedNode(254 /* ExportAssignment */); + var node = createSynthesizedNode(255 /* ExportAssignment */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.isExportEquals = isExportEquals; - node.expression = isExportEquals ? ts.parenthesizeBinaryOperand(59 /* EqualsToken */, expression, /*isLeftSideOfBinary*/ false, /*leftOperand*/ undefined) : ts.parenthesizeDefaultExpression(expression); + node.expression = isExportEquals ? ts.parenthesizeBinaryOperand(60 /* EqualsToken */, expression, /*isLeftSideOfBinary*/ false, /*leftOperand*/ undefined) : ts.parenthesizeDefaultExpression(expression); return node; } ts.createExportAssignment = createExportAssignment; @@ -62184,7 +63089,7 @@ var ts; } ts.updateExportAssignment = updateExportAssignment; function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier) { - var node = createSynthesizedNode(255 /* ExportDeclaration */); + var node = createSynthesizedNode(256 /* ExportDeclaration */); node.decorators = asNodeArray(decorators); node.modifiers = asNodeArray(modifiers); node.exportClause = exportClause; @@ -62202,7 +63107,7 @@ var ts; } ts.updateExportDeclaration = updateExportDeclaration; function createNamedExports(elements) { - var node = createSynthesizedNode(256 /* NamedExports */); + var node = createSynthesizedNode(257 /* NamedExports */); node.elements = createNodeArray(elements); return node; } @@ -62214,7 +63119,7 @@ var ts; } ts.updateNamedExports = updateNamedExports; function createExportSpecifier(propertyName, name) { - var node = createSynthesizedNode(257 /* ExportSpecifier */); + var node = createSynthesizedNode(258 /* ExportSpecifier */); node.propertyName = asName(propertyName); node.name = asName(name); return node; @@ -62229,7 +63134,7 @@ var ts; ts.updateExportSpecifier = updateExportSpecifier; // Module references function createExternalModuleReference(expression) { - var node = createSynthesizedNode(259 /* ExternalModuleReference */); + var node = createSynthesizedNode(260 /* ExternalModuleReference */); node.expression = expression; return node; } @@ -62243,14 +63148,14 @@ var ts; // JSDoc /* @internal */ function createJSDocTypeExpression(type) { - var node = createSynthesizedNode(288 /* JSDocTypeExpression */); + var node = createSynthesizedNode(289 /* JSDocTypeExpression */); node.type = type; return node; } ts.createJSDocTypeExpression = createJSDocTypeExpression; /* @internal */ function createJSDocTypeTag(typeExpression, comment) { - var tag = createJSDocTag(307 /* JSDocTypeTag */, "type"); + var tag = createJSDocTag(308 /* JSDocTypeTag */, "type"); tag.typeExpression = typeExpression; tag.comment = comment; return tag; @@ -62258,7 +63163,7 @@ var ts; ts.createJSDocTypeTag = createJSDocTypeTag; /* @internal */ function createJSDocReturnTag(typeExpression, comment) { - var tag = createJSDocTag(305 /* JSDocReturnTag */, "returns"); + var tag = createJSDocTag(306 /* JSDocReturnTag */, "returns"); tag.typeExpression = typeExpression; tag.comment = comment; return tag; @@ -62266,7 +63171,7 @@ var ts; ts.createJSDocReturnTag = createJSDocReturnTag; /* @internal */ function createJSDocParamTag(name, isBracketed, typeExpression, comment) { - var tag = createJSDocTag(304 /* JSDocParameterTag */, "param"); + var tag = createJSDocTag(305 /* JSDocParameterTag */, "param"); tag.typeExpression = typeExpression; tag.name = name; tag.isBracketed = isBracketed; @@ -62276,7 +63181,7 @@ var ts; ts.createJSDocParamTag = createJSDocParamTag; /* @internal */ function createJSDocComment(comment, tags) { - var node = createSynthesizedNode(296 /* JSDocComment */); + var node = createSynthesizedNode(297 /* JSDocComment */); node.comment = comment; node.tags = tags; return node; @@ -62290,7 +63195,7 @@ var ts; } // JSX function createJsxElement(openingElement, children, closingElement) { - var node = createSynthesizedNode(260 /* JsxElement */); + var node = createSynthesizedNode(261 /* JsxElement */); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -62306,7 +63211,7 @@ var ts; } ts.updateJsxElement = updateJsxElement; function createJsxSelfClosingElement(tagName, typeArguments, attributes) { - var node = createSynthesizedNode(261 /* JsxSelfClosingElement */); + var node = createSynthesizedNode(262 /* JsxSelfClosingElement */); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -62322,7 +63227,7 @@ var ts; } ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement; function createJsxOpeningElement(tagName, typeArguments, attributes) { - var node = createSynthesizedNode(262 /* JsxOpeningElement */); + var node = createSynthesizedNode(263 /* JsxOpeningElement */); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -62338,7 +63243,7 @@ var ts; } ts.updateJsxOpeningElement = updateJsxOpeningElement; function createJsxClosingElement(tagName) { - var node = createSynthesizedNode(263 /* JsxClosingElement */); + var node = createSynthesizedNode(264 /* JsxClosingElement */); node.tagName = tagName; return node; } @@ -62350,7 +63255,7 @@ var ts; } ts.updateJsxClosingElement = updateJsxClosingElement; function createJsxFragment(openingFragment, children, closingFragment) { - var node = createSynthesizedNode(264 /* JsxFragment */); + var node = createSynthesizedNode(265 /* JsxFragment */); node.openingFragment = openingFragment; node.children = createNodeArray(children); node.closingFragment = closingFragment; @@ -62372,11 +63277,11 @@ var ts; } ts.updateJsxText = updateJsxText; function createJsxOpeningFragment() { - return createSynthesizedNode(265 /* JsxOpeningFragment */); + return createSynthesizedNode(266 /* JsxOpeningFragment */); } ts.createJsxOpeningFragment = createJsxOpeningFragment; function createJsxJsxClosingFragment() { - return createSynthesizedNode(266 /* JsxClosingFragment */); + return createSynthesizedNode(267 /* JsxClosingFragment */); } ts.createJsxJsxClosingFragment = createJsxJsxClosingFragment; function updateJsxFragment(node, openingFragment, children, closingFragment) { @@ -62388,7 +63293,7 @@ var ts; } ts.updateJsxFragment = updateJsxFragment; function createJsxAttribute(name, initializer) { - var node = createSynthesizedNode(267 /* JsxAttribute */); + var node = createSynthesizedNode(268 /* JsxAttribute */); node.name = name; node.initializer = initializer; return node; @@ -62402,7 +63307,7 @@ var ts; } ts.updateJsxAttribute = updateJsxAttribute; function createJsxAttributes(properties) { - var node = createSynthesizedNode(268 /* JsxAttributes */); + var node = createSynthesizedNode(269 /* JsxAttributes */); node.properties = createNodeArray(properties); return node; } @@ -62414,7 +63319,7 @@ var ts; } ts.updateJsxAttributes = updateJsxAttributes; function createJsxSpreadAttribute(expression) { - var node = createSynthesizedNode(269 /* JsxSpreadAttribute */); + var node = createSynthesizedNode(270 /* JsxSpreadAttribute */); node.expression = expression; return node; } @@ -62426,7 +63331,7 @@ var ts; } ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute; function createJsxExpression(dotDotDotToken, expression) { - var node = createSynthesizedNode(270 /* JsxExpression */); + var node = createSynthesizedNode(271 /* JsxExpression */); node.dotDotDotToken = dotDotDotToken; node.expression = expression; return node; @@ -62440,7 +63345,7 @@ var ts; ts.updateJsxExpression = updateJsxExpression; // Clauses function createCaseClause(expression, statements) { - var node = createSynthesizedNode(271 /* CaseClause */); + var node = createSynthesizedNode(272 /* CaseClause */); node.expression = ts.parenthesizeExpressionForList(expression); node.statements = createNodeArray(statements); return node; @@ -62454,7 +63359,7 @@ var ts; } ts.updateCaseClause = updateCaseClause; function createDefaultClause(statements) { - var node = createSynthesizedNode(272 /* DefaultClause */); + var node = createSynthesizedNode(273 /* DefaultClause */); node.statements = createNodeArray(statements); return node; } @@ -62466,7 +63371,7 @@ var ts; } ts.updateDefaultClause = updateDefaultClause; function createHeritageClause(token, types) { - var node = createSynthesizedNode(273 /* HeritageClause */); + var node = createSynthesizedNode(274 /* HeritageClause */); node.token = token; node.types = createNodeArray(types); return node; @@ -62479,7 +63384,7 @@ var ts; } ts.updateHeritageClause = updateHeritageClause; function createCatchClause(variableDeclaration, block) { - var node = createSynthesizedNode(274 /* CatchClause */); + var node = createSynthesizedNode(275 /* CatchClause */); node.variableDeclaration = ts.isString(variableDeclaration) ? createVariableDeclaration(variableDeclaration) : variableDeclaration; node.block = block; return node; @@ -62494,7 +63399,7 @@ var ts; ts.updateCatchClause = updateCatchClause; // Property assignments function createPropertyAssignment(name, initializer) { - var node = createSynthesizedNode(275 /* PropertyAssignment */); + var node = createSynthesizedNode(276 /* PropertyAssignment */); node.name = asName(name); node.questionToken = undefined; node.initializer = ts.parenthesizeExpressionForList(initializer); @@ -62509,7 +63414,7 @@ var ts; } ts.updatePropertyAssignment = updatePropertyAssignment; function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { - var node = createSynthesizedNode(276 /* ShorthandPropertyAssignment */); + var node = createSynthesizedNode(277 /* ShorthandPropertyAssignment */); node.name = asName(name); node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? ts.parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; return node; @@ -62523,8 +63428,8 @@ var ts; } ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment; function createSpreadAssignment(expression) { - var node = createSynthesizedNode(277 /* SpreadAssignment */); - node.expression = expression !== undefined ? ts.parenthesizeExpressionForList(expression) : undefined; // TODO: GH#18217 + var node = createSynthesizedNode(278 /* SpreadAssignment */); + node.expression = ts.parenthesizeExpressionForList(expression); return node; } ts.createSpreadAssignment = createSpreadAssignment; @@ -62536,7 +63441,7 @@ var ts; ts.updateSpreadAssignment = updateSpreadAssignment; // Enum function createEnumMember(name, initializer) { - var node = createSynthesizedNode(278 /* EnumMember */); + var node = createSynthesizedNode(279 /* EnumMember */); node.name = asName(name); node.initializer = initializer && ts.parenthesizeExpressionForList(initializer); return node; @@ -62557,7 +63462,7 @@ var ts; (typeReferences !== undefined && node.typeReferenceDirectives !== typeReferences) || (libReferences !== undefined && node.libReferenceDirectives !== libReferences) || (hasNoDefaultLib !== undefined && node.hasNoDefaultLib !== hasNoDefaultLib)) { - var updated = createSynthesizedNode(284 /* SourceFile */); + var updated = createSynthesizedNode(285 /* SourceFile */); updated.flags |= node.flags; updated.statements = createNodeArray(statements); updated.endOfFileToken = node.endOfFileToken; @@ -62641,7 +63546,7 @@ var ts; * @param original The original statement. */ function createNotEmittedStatement(original) { - var node = createSynthesizedNode(312 /* NotEmittedStatement */); + var node = createSynthesizedNode(313 /* NotEmittedStatement */); node.original = original; setTextRange(node, original); return node; @@ -62653,7 +63558,7 @@ var ts; */ /* @internal */ function createEndOfDeclarationMarker(original) { - var node = createSynthesizedNode(316 /* EndOfDeclarationMarker */); + var node = createSynthesizedNode(317 /* EndOfDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -62665,7 +63570,7 @@ var ts; */ /* @internal */ function createMergeDeclarationMarker(original) { - var node = createSynthesizedNode(315 /* MergeDeclarationMarker */); + var node = createSynthesizedNode(316 /* MergeDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -62680,7 +63585,7 @@ var ts; * @param location The location for the expression. Defaults to the positions from "original" if provided. */ function createPartiallyEmittedExpression(expression, original) { - var node = createSynthesizedNode(313 /* PartiallyEmittedExpression */); + var node = createSynthesizedNode(314 /* PartiallyEmittedExpression */); node.expression = expression; node.original = original; setTextRange(node, original); @@ -62696,7 +63601,7 @@ var ts; ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression; function flattenCommaElements(node) { if (ts.nodeIsSynthesized(node) && !ts.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) { - if (node.kind === 314 /* CommaListExpression */) { + if (node.kind === 315 /* CommaListExpression */) { return node.elements; } if (ts.isBinaryExpression(node) && node.operatorToken.kind === 27 /* CommaToken */) { @@ -62706,7 +63611,7 @@ var ts; return node; } function createCommaList(elements) { - var node = createSynthesizedNode(314 /* CommaListExpression */); + var node = createSynthesizedNode(315 /* CommaListExpression */); node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements)); return node; } @@ -62719,7 +63624,7 @@ var ts; ts.updateCommaList = updateCommaList; function createBundle(sourceFiles, prepends) { if (prepends === void 0) { prepends = ts.emptyArray; } - var node = ts.createNode(285 /* Bundle */); + var node = ts.createNode(286 /* Bundle */); node.prepends = prepends; node.sourceFiles = sourceFiles; return node; @@ -62749,7 +63654,7 @@ var ts; ], function (helper) { return helper.name; })); } function createUnparsedSource() { - var node = ts.createNode(286 /* UnparsedSource */); + var node = ts.createNode(287 /* UnparsedSource */); node.prologues = ts.emptyArray; node.referencedFiles = ts.emptyArray; node.libReferenceDirectives = ts.emptyArray; @@ -62881,10 +63786,10 @@ var ts; } function mapBundleFileSectionKindToSyntaxKind(kind) { switch (kind) { - case "prologue" /* Prologue */: return 279 /* UnparsedPrologue */; - case "prepend" /* Prepend */: return 280 /* UnparsedPrepend */; - case "internal" /* Internal */: return 282 /* UnparsedInternalText */; - case "text" /* Text */: return 281 /* UnparsedText */; + case "prologue" /* Prologue */: return 280 /* UnparsedPrologue */; + case "prepend" /* Prepend */: return 281 /* UnparsedPrepend */; + case "internal" /* Internal */: return 283 /* UnparsedInternalText */; + case "text" /* Text */: return 282 /* UnparsedText */; case "emitHelpers" /* EmitHelpers */: case "no-default-lib" /* NoDefaultLib */: case "reference" /* Reference */: @@ -62902,14 +63807,14 @@ var ts; return node; } function createUnparsedSyntheticReference(section, parent) { - var node = ts.createNode(283 /* UnparsedSyntheticReference */, section.pos, section.end); + var node = ts.createNode(284 /* UnparsedSyntheticReference */, section.pos, section.end); node.parent = parent; node.data = section.data; node.section = section; return node; } function createInputFiles(javascriptTextOrReadFileText, declarationTextOrJavascriptPath, javascriptMapPath, javascriptMapTextOrDeclarationPath, declarationMapPath, declarationMapTextOrBuildInfoPath, javascriptPath, declarationPath, buildInfoPath, buildInfo, oldFileOfCurrentEmit) { - var node = ts.createNode(287 /* InputFiles */); + var node = ts.createNode(288 /* InputFiles */); if (!ts.isString(javascriptTextOrReadFileText)) { var cache_1 = ts.createMap(); var textGetter_1 = function (path) { @@ -63003,7 +63908,7 @@ var ts; } ts.createLessThan = createLessThan; function createAssignment(left, right) { - return createBinary(left, 59 /* EqualsToken */, right); + return createBinary(left, 60 /* EqualsToken */, right); } ts.createAssignment = createAssignment; function createStrictEquality(left, right) { @@ -63096,7 +64001,7 @@ var ts; // To avoid holding onto transformation artifacts, we keep track of any // parse tree node we are annotating. This allows us to clean them up after // all transformations have completed. - if (node.kind === 284 /* SourceFile */) { + if (node.kind === 285 /* SourceFile */) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = ts.getSourceFileOfNode(ts.getParseTreeNode(ts.getSourceFileOfNode(node))); @@ -63607,7 +64512,7 @@ var ts; if (!outermostLabeledStatement) { return node; } - var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 233 /* LabeledStatement */ + var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 234 /* LabeledStatement */ ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) : node); if (afterRestoreLabelCallback) { @@ -63619,20 +64524,20 @@ var ts; function shouldBeCapturedInTempVariable(node, cacheIdentifiers) { var target = ts.skipParentheses(node); switch (target.kind) { - case 72 /* Identifier */: + case 73 /* Identifier */: return cacheIdentifiers; - case 100 /* ThisKeyword */: + case 101 /* ThisKeyword */: case 8 /* NumericLiteral */: case 9 /* BigIntLiteral */: case 10 /* StringLiteral */: return false; - case 187 /* ArrayLiteralExpression */: + case 188 /* ArrayLiteralExpression */: var elements = target.elements; if (elements.length === 0) { return false; } return true; - case 188 /* ObjectLiteralExpression */: + case 189 /* ObjectLiteralExpression */: return target.properties.length > 0; default: return true; @@ -63647,7 +64552,7 @@ var ts; thisArg = ts.createThis(); target = callee; } - else if (callee.kind === 98 /* SuperKeyword */) { + else if (callee.kind === 99 /* SuperKeyword */) { thisArg = ts.createThis(); target = languageVersion < 2 /* ES2015 */ ? ts.setTextRange(ts.createIdentifier("_super"), callee) @@ -63659,7 +64564,7 @@ var ts; } else { switch (callee.kind) { - case 189 /* PropertyAccessExpression */: { + case 190 /* PropertyAccessExpression */: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { // for `a.b()` target is `(_a = a).b` and thisArg is `_a` thisArg = ts.createTempVariable(recordTempVariable); @@ -63672,7 +64577,7 @@ var ts; } break; } - case 190 /* ElementAccessExpression */: { + case 191 /* ElementAccessExpression */: { if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { // for `a[b]()` target is `(_a = a)[b]` and thisArg is `_a` thisArg = ts.createTempVariable(recordTempVariable); @@ -63729,14 +64634,14 @@ var ts; ts.createExpressionForPropertyName = createExpressionForPropertyName; function createExpressionForObjectLiteralElementLike(node, property, receiver) { switch (property.kind) { - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: return createExpressionForAccessorDeclaration(node.properties, property, receiver, !!node.multiLine); - case 275 /* PropertyAssignment */: + case 276 /* PropertyAssignment */: return createExpressionForPropertyAssignment(property, receiver); - case 276 /* ShorthandPropertyAssignment */: + case 277 /* ShorthandPropertyAssignment */: return createExpressionForShorthandPropertyAssignment(property, receiver); - case 156 /* MethodDeclaration */: + case 157 /* MethodDeclaration */: return createExpressionForMethodDeclaration(property, receiver); } } @@ -63744,7 +64649,7 @@ var ts; function createExpressionForAccessorDeclaration(properties, property, receiver, multiLine) { var _a = ts.getAllAccessorDeclarations(properties, property), firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor; if (property === firstAccessor) { - var properties_8 = []; + var properties_5 = []; if (getAccessor) { var getterFunction = ts.createFunctionExpression(getAccessor.modifiers, /*asteriskToken*/ undefined, @@ -63755,7 +64660,7 @@ var ts; ts.setTextRange(getterFunction, getAccessor); ts.setOriginalNode(getterFunction, getAccessor); var getter = ts.createPropertyAssignment("get", getterFunction); - properties_8.push(getter); + properties_5.push(getter); } if (setAccessor) { var setterFunction = ts.createFunctionExpression(setAccessor.modifiers, @@ -63767,15 +64672,15 @@ var ts; ts.setTextRange(setterFunction, setAccessor); ts.setOriginalNode(setterFunction, setAccessor); var setter = ts.createPropertyAssignment("set", setterFunction); - properties_8.push(setter); + properties_5.push(setter); } - properties_8.push(ts.createPropertyAssignment("enumerable", ts.createTrue())); - properties_8.push(ts.createPropertyAssignment("configurable", ts.createTrue())); + properties_5.push(ts.createPropertyAssignment("enumerable", ts.createTrue())); + properties_5.push(ts.createPropertyAssignment("configurable", ts.createTrue())); var expression = ts.setTextRange(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), /*typeArguments*/ undefined, [ receiver, createExpressionForPropertyName(property.name), - ts.createObjectLiteral(properties_8, multiLine) + ts.createObjectLiteral(properties_5, multiLine) ]), /*location*/ firstAccessor); return ts.aggregateTransformFlags(expression); @@ -64062,7 +64967,7 @@ var ts; function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { var skipped = ts.skipPartiallyEmittedExpressions(operand); // If the resulting expression is already parenthesized, we do not need to do any further processing. - if (skipped.kind === 195 /* ParenthesizedExpression */) { + if (skipped.kind === 196 /* ParenthesizedExpression */) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) @@ -64096,10 +65001,10 @@ var ts; // // If `a ** d` is on the left of operator `**`, we need to parenthesize to preserve // the intended order of operations: `(a ** b) ** c` - var binaryOperatorPrecedence = ts.getOperatorPrecedence(204 /* BinaryExpression */, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(204 /* BinaryExpression */, binaryOperator); + var binaryOperatorPrecedence = ts.getOperatorPrecedence(205 /* BinaryExpression */, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(205 /* BinaryExpression */, binaryOperator); var emittedOperand = ts.skipPartiallyEmittedExpressions(operand); - if (!isLeftSideOfBinary && operand.kind === 197 /* ArrowFunction */ && binaryOperatorPrecedence > 4) { + if (!isLeftSideOfBinary && operand.kind === 198 /* ArrowFunction */ && binaryOperatorPrecedence > 4) { // We need to parenthesize arrow functions on the right side to avoid it being // parsed as parenthesized expression: `a && (() => {})` return true; @@ -64111,7 +65016,7 @@ var ts; // and is a yield expression, then we do not need parentheses. if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 /* Right */ - && operand.kind === 207 /* YieldExpression */) { + && operand.kind === 208 /* YieldExpression */) { return false; } return true; @@ -64199,7 +65104,7 @@ var ts; if (ts.isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 204 /* BinaryExpression */ && node.operatorToken.kind === 38 /* PlusToken */) { + if (node.kind === 205 /* BinaryExpression */ && node.operatorToken.kind === 38 /* PlusToken */) { if (node.cachedLiteralKind !== undefined) { return node.cachedLiteralKind; } @@ -64214,7 +65119,7 @@ var ts; return 0 /* Unknown */; } function parenthesizeForConditionalHead(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(205 /* ConditionalExpression */, 56 /* QuestionToken */); + var conditionalPrecedence = ts.getOperatorPrecedence(206 /* ConditionalExpression */, 56 /* QuestionToken */); var emittedCondition = ts.skipPartiallyEmittedExpressions(condition); var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1 /* LessThan */) { @@ -64249,8 +65154,8 @@ var ts; var needsParens = isCommaSequence(check); if (!needsParens) { switch (getLeftmostExpression(check, /*stopAtCallExpression*/ false).kind) { - case 209 /* ClassExpression */: - case 196 /* FunctionExpression */: + case 210 /* ClassExpression */: + case 197 /* FunctionExpression */: needsParens = true; } } @@ -64266,9 +65171,9 @@ var ts; function parenthesizeForNew(expression) { var leftmostExpr = getLeftmostExpression(expression, /*stopAtCallExpressions*/ true); switch (leftmostExpr.kind) { - case 191 /* CallExpression */: + case 192 /* CallExpression */: return ts.createParen(expression); - case 192 /* NewExpression */: + case 193 /* NewExpression */: return !leftmostExpr.arguments ? ts.createParen(expression) : expression; @@ -64291,7 +65196,7 @@ var ts; // var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 192 /* NewExpression */ || emittedExpression.arguments)) { + && (emittedExpression.kind !== 193 /* NewExpression */ || emittedExpression.arguments)) { return expression; } return ts.setTextRange(ts.createParen(expression), expression); @@ -64329,7 +65234,7 @@ var ts; function parenthesizeExpressionForList(expression) { var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(204 /* BinaryExpression */, 27 /* CommaToken */); + var commaPrecedence = ts.getOperatorPrecedence(205 /* BinaryExpression */, 27 /* CommaToken */); return expressionPrecedence > commaPrecedence ? expression : ts.setTextRange(ts.createParen(expression), expression); @@ -64340,29 +65245,29 @@ var ts; if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression; var kind = ts.skipPartiallyEmittedExpressions(callee).kind; - if (kind === 196 /* FunctionExpression */ || kind === 197 /* ArrowFunction */) { + if (kind === 197 /* FunctionExpression */ || kind === 198 /* ArrowFunction */) { var mutableCall = ts.getMutableClone(emittedExpression); mutableCall.expression = ts.setTextRange(ts.createParen(callee), callee); return recreateOuterExpressions(expression, mutableCall, 4 /* PartiallyEmittedExpressions */); } } var leftmostExpressionKind = getLeftmostExpression(emittedExpression, /*stopAtCallExpressions*/ false).kind; - if (leftmostExpressionKind === 188 /* ObjectLiteralExpression */ || leftmostExpressionKind === 196 /* FunctionExpression */) { + if (leftmostExpressionKind === 189 /* ObjectLiteralExpression */ || leftmostExpressionKind === 197 /* FunctionExpression */) { return ts.setTextRange(ts.createParen(expression), expression); } return expression; } ts.parenthesizeExpressionForExpressionStatement = parenthesizeExpressionForExpressionStatement; function parenthesizeConditionalTypeMember(member) { - return member.kind === 175 /* ConditionalType */ ? ts.createParenthesizedType(member) : member; + return member.kind === 176 /* ConditionalType */ ? ts.createParenthesizedType(member) : member; } ts.parenthesizeConditionalTypeMember = parenthesizeConditionalTypeMember; function parenthesizeElementTypeMember(member) { switch (member.kind) { - case 173 /* UnionType */: - case 174 /* IntersectionType */: - case 165 /* FunctionType */: - case 166 /* ConstructorType */: + case 174 /* UnionType */: + case 175 /* IntersectionType */: + case 166 /* FunctionType */: + case 167 /* ConstructorType */: return ts.createParenthesizedType(member); } return parenthesizeConditionalTypeMember(member); @@ -64370,9 +65275,9 @@ var ts; ts.parenthesizeElementTypeMember = parenthesizeElementTypeMember; function parenthesizeArrayTypeMember(member) { switch (member.kind) { - case 167 /* TypeQuery */: - case 179 /* TypeOperator */: - case 176 /* InferType */: + case 168 /* TypeQuery */: + case 180 /* TypeOperator */: + case 177 /* InferType */: return ts.createParenthesizedType(member); } return parenthesizeElementTypeMember(member); @@ -64398,28 +65303,28 @@ var ts; function getLeftmostExpression(node, stopAtCallExpressions) { while (true) { switch (node.kind) { - case 203 /* PostfixUnaryExpression */: + case 204 /* PostfixUnaryExpression */: node = node.operand; continue; - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: node = node.left; continue; - case 205 /* ConditionalExpression */: + case 206 /* ConditionalExpression */: node = node.condition; continue; - case 193 /* TaggedTemplateExpression */: + case 194 /* TaggedTemplateExpression */: node = node.tag; continue; - case 191 /* CallExpression */: + case 192 /* CallExpression */: if (stopAtCallExpressions) { return node; } // falls through - case 212 /* AsExpression */: - case 190 /* ElementAccessExpression */: - case 189 /* PropertyAccessExpression */: - case 213 /* NonNullExpression */: - case 313 /* PartiallyEmittedExpression */: + case 213 /* AsExpression */: + case 191 /* ElementAccessExpression */: + case 190 /* PropertyAccessExpression */: + case 214 /* NonNullExpression */: + case 314 /* PartiallyEmittedExpression */: node = node.expression; continue; } @@ -64427,15 +65332,15 @@ var ts; } } function parenthesizeConciseBody(body) { - if (!ts.isBlock(body) && (isCommaSequence(body) || getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 188 /* ObjectLiteralExpression */)) { + if (!ts.isBlock(body) && (isCommaSequence(body) || getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 189 /* ObjectLiteralExpression */)) { return ts.setTextRange(ts.createParen(body), body); } return body; } ts.parenthesizeConciseBody = parenthesizeConciseBody; function isCommaSequence(node) { - return node.kind === 204 /* BinaryExpression */ && node.operatorToken.kind === 27 /* CommaToken */ || - node.kind === 314 /* CommaListExpression */; + return node.kind === 205 /* BinaryExpression */ && node.operatorToken.kind === 27 /* CommaToken */ || + node.kind === 315 /* CommaListExpression */; } ts.isCommaSequence = isCommaSequence; var OuterExpressionKinds; @@ -64448,13 +65353,13 @@ var ts; function isOuterExpression(node, kinds) { if (kinds === void 0) { kinds = 7 /* All */; } switch (node.kind) { - case 195 /* ParenthesizedExpression */: + case 196 /* ParenthesizedExpression */: return (kinds & 1 /* Parentheses */) !== 0; - case 194 /* TypeAssertionExpression */: - case 212 /* AsExpression */: - case 213 /* NonNullExpression */: + case 195 /* TypeAssertionExpression */: + case 213 /* AsExpression */: + case 214 /* NonNullExpression */: return (kinds & 2 /* Assertions */) !== 0; - case 313 /* PartiallyEmittedExpression */: + case 314 /* PartiallyEmittedExpression */: return (kinds & 4 /* PartiallyEmittedExpressions */) !== 0; } return false; @@ -64479,7 +65384,7 @@ var ts; } ts.skipOuterExpressions = skipOuterExpressions; function skipAssertions(node) { - while (ts.isAssertionExpression(node) || node.kind === 213 /* NonNullExpression */) { + while (ts.isAssertionExpression(node) || node.kind === 214 /* NonNullExpression */) { node = node.expression; } return node; @@ -64487,11 +65392,11 @@ var ts; ts.skipAssertions = skipAssertions; function updateOuterExpression(outerExpression, expression) { switch (outerExpression.kind) { - case 195 /* ParenthesizedExpression */: return ts.updateParen(outerExpression, expression); - case 194 /* TypeAssertionExpression */: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression); - case 212 /* AsExpression */: return ts.updateAsExpression(outerExpression, expression, outerExpression.type); - case 213 /* NonNullExpression */: return ts.updateNonNullExpression(outerExpression, expression); - case 313 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression); + case 196 /* ParenthesizedExpression */: return ts.updateParen(outerExpression, expression); + case 195 /* TypeAssertionExpression */: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression); + case 213 /* AsExpression */: return ts.updateAsExpression(outerExpression, expression, outerExpression.type); + case 214 /* NonNullExpression */: return ts.updateNonNullExpression(outerExpression, expression); + case 314 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression); } } /** @@ -64509,7 +65414,7 @@ var ts; * the containing expression is created/updated. */ function isIgnorableParen(node) { - return node.kind === 195 /* ParenthesizedExpression */ + return node.kind === 196 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node) && ts.nodeIsSynthesized(ts.getSourceMapRange(node)) && ts.nodeIsSynthesized(ts.getCommentRange(node)) @@ -64574,10 +65479,10 @@ var ts; var name = namespaceDeclaration.name; return ts.isGeneratedIdentifier(name) ? name : ts.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, name) || ts.idText(name)); } - if (node.kind === 249 /* ImportDeclaration */ && node.importClause) { + if (node.kind === 250 /* ImportDeclaration */ && node.importClause) { return ts.getGeneratedNameForNode(node); } - if (node.kind === 255 /* ExportDeclaration */ && node.moduleSpecifier) { + if (node.kind === 256 /* ExportDeclaration */ && node.moduleSpecifier) { return ts.getGeneratedNameForNode(node); } return undefined; @@ -64696,7 +65601,7 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 275 /* PropertyAssignment */: + case 276 /* PropertyAssignment */: // `b` in `({ a: b } = ...)` // `b` in `({ a: b = 1 } = ...)` // `{b}` in `({ a: {b} } = ...)` @@ -64708,11 +65613,11 @@ var ts; // `b[0]` in `({ a: b[0] } = ...)` // `b[0]` in `({ a: b[0] = 1 } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 276 /* ShorthandPropertyAssignment */: + case 277 /* ShorthandPropertyAssignment */: // `a` in `({ a } = ...)` // `a` in `({ a = 1 } = ...)` return bindingElement.name; - case 277 /* SpreadAssignment */: + case 278 /* SpreadAssignment */: // `a` in `({ ...a } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } @@ -64744,12 +65649,12 @@ var ts; */ function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 151 /* Parameter */: - case 186 /* BindingElement */: + case 152 /* Parameter */: + case 187 /* BindingElement */: // `...` in `let [...a] = ...` return bindingElement.dotDotDotToken; - case 208 /* SpreadElement */: - case 277 /* SpreadAssignment */: + case 209 /* SpreadElement */: + case 278 /* SpreadAssignment */: // `...` in `[...a] = ...` return bindingElement; } @@ -64761,7 +65666,7 @@ var ts; */ function getPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 186 /* BindingElement */: + case 187 /* BindingElement */: // `a` in `let { a: b } = ...` // `[a]` in `let { [a]: b } = ...` // `"a"` in `let { "a": b } = ...` @@ -64773,7 +65678,7 @@ var ts; : propertyName; } break; - case 275 /* PropertyAssignment */: + case 276 /* PropertyAssignment */: // `a` in `({ a: b } = ...)` // `[a]` in `({ [a]: b } = ...)` // `"a"` in `({ "a": b } = ...)` @@ -64785,7 +65690,7 @@ var ts; : propertyName; } break; - case 277 /* SpreadAssignment */: + case 278 /* SpreadAssignment */: // `a` in `({ ...a } = ...)` return bindingElement.name; } @@ -64808,13 +65713,13 @@ var ts; */ function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 184 /* ObjectBindingPattern */: - case 185 /* ArrayBindingPattern */: - case 187 /* ArrayLiteralExpression */: + case 185 /* ObjectBindingPattern */: + case 186 /* ArrayBindingPattern */: + case 188 /* ArrayLiteralExpression */: // `a` in `{a}` // `a` in `[a]` return name.elements; - case 188 /* ObjectLiteralExpression */: + case 189 /* ObjectLiteralExpression */: // `a` in `{a}` return name.properties; } @@ -64854,11 +65759,11 @@ var ts; ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement; function convertToAssignmentPattern(node) { switch (node.kind) { - case 185 /* ArrayBindingPattern */: - case 187 /* ArrayLiteralExpression */: + case 186 /* ArrayBindingPattern */: + case 188 /* ArrayLiteralExpression */: return convertToArrayAssignmentPattern(node); - case 184 /* ObjectBindingPattern */: - case 188 /* ObjectLiteralExpression */: + case 185 /* ObjectBindingPattern */: + case 189 /* ObjectLiteralExpression */: return convertToObjectAssignmentPattern(node); } } @@ -65019,276 +65924,278 @@ var ts; } var kind = node.kind; // No need to visit nodes with no children. - if ((kind > 0 /* FirstToken */ && kind <= 147 /* LastToken */) || kind === 178 /* ThisType */) { + if ((kind > 0 /* FirstToken */ && kind <= 148 /* LastToken */) || kind === 179 /* ThisType */) { return node; } switch (kind) { // Names - case 72 /* Identifier */: + case 73 /* Identifier */: return ts.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, isTypeNodeOrTypeParameterDeclaration)); - case 148 /* QualifiedName */: + case 149 /* QualifiedName */: return ts.updateQualifiedName(node, visitNode(node.left, visitor, ts.isEntityName), visitNode(node.right, visitor, ts.isIdentifier)); - case 149 /* ComputedPropertyName */: + case 150 /* ComputedPropertyName */: return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression)); // Signature elements - case 150 /* TypeParameter */: + case 151 /* TypeParameter */: return ts.updateTypeParameterDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.constraint, visitor, ts.isTypeNode), visitNode(node.default, visitor, ts.isTypeNode)); - case 151 /* Parameter */: + case 152 /* Parameter */: return ts.updateParameter(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); - case 152 /* Decorator */: + case 153 /* Decorator */: return ts.updateDecorator(node, visitNode(node.expression, visitor, ts.isExpression)); // Type elements - case 153 /* PropertySignature */: + case 154 /* PropertySignature */: return ts.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isToken), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); - case 154 /* PropertyDeclaration */: - return ts.updateProperty(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); - case 155 /* MethodSignature */: + case 155 /* PropertyDeclaration */: + return ts.updateProperty(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), + // QuestionToken and ExclamationToken is uniqued in Property Declaration and the signature of 'updateProperty' is that too + visitNode(node.questionToken || node.exclamationToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); + case 156 /* MethodSignature */: return ts.updateMethodSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken)); - case 156 /* MethodDeclaration */: + case 157 /* MethodDeclaration */: return ts.updateMethod(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); - case 157 /* Constructor */: + case 158 /* Constructor */: return ts.updateConstructor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context)); - case 158 /* GetAccessor */: + case 159 /* GetAccessor */: return ts.updateGetAccessor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); - case 159 /* SetAccessor */: + case 160 /* SetAccessor */: return ts.updateSetAccessor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context)); - case 160 /* CallSignature */: + case 161 /* CallSignature */: return ts.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode)); - case 161 /* ConstructSignature */: + case 162 /* ConstructSignature */: return ts.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode)); - case 162 /* IndexSignature */: + case 163 /* IndexSignature */: return ts.updateIndexSignature(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode)); // Types - case 163 /* TypePredicate */: + case 164 /* TypePredicate */: return ts.updateTypePredicateNode(node, visitNode(node.parameterName, visitor), visitNode(node.type, visitor, ts.isTypeNode)); - case 164 /* TypeReference */: + case 165 /* TypeReference */: return ts.updateTypeReferenceNode(node, visitNode(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 165 /* FunctionType */: + case 166 /* FunctionType */: return ts.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode)); - case 166 /* ConstructorType */: + case 167 /* ConstructorType */: return ts.updateConstructorTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode)); - case 167 /* TypeQuery */: + case 168 /* TypeQuery */: return ts.updateTypeQueryNode(node, visitNode(node.exprName, visitor, ts.isEntityName)); - case 168 /* TypeLiteral */: + case 169 /* TypeLiteral */: return ts.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 169 /* ArrayType */: + case 170 /* ArrayType */: return ts.updateArrayTypeNode(node, visitNode(node.elementType, visitor, ts.isTypeNode)); - case 170 /* TupleType */: + case 171 /* TupleType */: return ts.updateTupleTypeNode(node, nodesVisitor(node.elementTypes, visitor, ts.isTypeNode)); - case 171 /* OptionalType */: + case 172 /* OptionalType */: return ts.updateOptionalTypeNode(node, visitNode(node.type, visitor, ts.isTypeNode)); - case 172 /* RestType */: + case 173 /* RestType */: return ts.updateRestTypeNode(node, visitNode(node.type, visitor, ts.isTypeNode)); - case 173 /* UnionType */: + case 174 /* UnionType */: return ts.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); - case 174 /* IntersectionType */: + case 175 /* IntersectionType */: return ts.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); - case 175 /* ConditionalType */: + case 176 /* ConditionalType */: return ts.updateConditionalTypeNode(node, visitNode(node.checkType, visitor, ts.isTypeNode), visitNode(node.extendsType, visitor, ts.isTypeNode), visitNode(node.trueType, visitor, ts.isTypeNode), visitNode(node.falseType, visitor, ts.isTypeNode)); - case 176 /* InferType */: + case 177 /* InferType */: return ts.updateInferTypeNode(node, visitNode(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); - case 183 /* ImportType */: + case 184 /* ImportType */: return ts.updateImportTypeNode(node, visitNode(node.argument, visitor, ts.isTypeNode), visitNode(node.qualifier, visitor, ts.isEntityName), visitNodes(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); - case 177 /* ParenthesizedType */: + case 178 /* ParenthesizedType */: return ts.updateParenthesizedType(node, visitNode(node.type, visitor, ts.isTypeNode)); - case 179 /* TypeOperator */: + case 180 /* TypeOperator */: return ts.updateTypeOperatorNode(node, visitNode(node.type, visitor, ts.isTypeNode)); - case 180 /* IndexedAccessType */: + case 181 /* IndexedAccessType */: return ts.updateIndexedAccessTypeNode(node, visitNode(node.objectType, visitor, ts.isTypeNode), visitNode(node.indexType, visitor, ts.isTypeNode)); - case 181 /* MappedType */: + case 182 /* MappedType */: return ts.updateMappedTypeNode(node, visitNode(node.readonlyToken, tokenVisitor, ts.isToken), visitNode(node.typeParameter, visitor, ts.isTypeParameterDeclaration), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode)); - case 182 /* LiteralType */: + case 183 /* LiteralType */: return ts.updateLiteralTypeNode(node, visitNode(node.literal, visitor, ts.isExpression)); // Binding patterns - case 184 /* ObjectBindingPattern */: + case 185 /* ObjectBindingPattern */: return ts.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); - case 185 /* ArrayBindingPattern */: + case 186 /* ArrayBindingPattern */: return ts.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); - case 186 /* BindingElement */: + case 187 /* BindingElement */: return ts.updateBindingElement(node, visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.propertyName, visitor, ts.isPropertyName), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression)); // Expression - case 187 /* ArrayLiteralExpression */: + case 188 /* ArrayLiteralExpression */: return ts.updateArrayLiteral(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - case 188 /* ObjectLiteralExpression */: + case 189 /* ObjectLiteralExpression */: return ts.updateObjectLiteral(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); - case 189 /* PropertyAccessExpression */: + case 190 /* PropertyAccessExpression */: return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier)); - case 190 /* ElementAccessExpression */: + case 191 /* ElementAccessExpression */: return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression)); - case 191 /* CallExpression */: + case 192 /* CallExpression */: return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 192 /* NewExpression */: + case 193 /* NewExpression */: return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 193 /* TaggedTemplateExpression */: + case 194 /* TaggedTemplateExpression */: return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral)); - case 194 /* TypeAssertionExpression */: + case 195 /* TypeAssertionExpression */: return ts.updateTypeAssertion(node, visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); - case 195 /* ParenthesizedExpression */: + case 196 /* ParenthesizedExpression */: return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression)); - case 196 /* FunctionExpression */: + case 197 /* FunctionExpression */: return ts.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); - case 197 /* ArrowFunction */: + case 198 /* ArrowFunction */: return ts.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.equalsGreaterThanToken, visitor, ts.isToken), visitFunctionBody(node.body, visitor, context)); - case 198 /* DeleteExpression */: + case 199 /* DeleteExpression */: return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); - case 199 /* TypeOfExpression */: + case 200 /* TypeOfExpression */: return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression)); - case 200 /* VoidExpression */: + case 201 /* VoidExpression */: return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression)); - case 201 /* AwaitExpression */: + case 202 /* AwaitExpression */: return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression)); - case 202 /* PrefixUnaryExpression */: + case 203 /* PrefixUnaryExpression */: return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression)); - case 203 /* PostfixUnaryExpression */: + case 204 /* PostfixUnaryExpression */: return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression)); - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression), visitNode(node.operatorToken, visitor, ts.isToken)); - case 205 /* ConditionalExpression */: + case 206 /* ConditionalExpression */: return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.questionToken, visitor, ts.isToken), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.colonToken, visitor, ts.isToken), visitNode(node.whenFalse, visitor, ts.isExpression)); - case 206 /* TemplateExpression */: + case 207 /* TemplateExpression */: return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); - case 207 /* YieldExpression */: + case 208 /* YieldExpression */: return ts.updateYield(node, visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.expression, visitor, ts.isExpression)); - case 208 /* SpreadElement */: + case 209 /* SpreadElement */: return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression)); - case 209 /* ClassExpression */: + case 210 /* ClassExpression */: return ts.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 211 /* ExpressionWithTypeArguments */: + case 212 /* ExpressionWithTypeArguments */: return ts.updateExpressionWithTypeArguments(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); - case 212 /* AsExpression */: + case 213 /* AsExpression */: return ts.updateAsExpression(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.type, visitor, ts.isTypeNode)); - case 213 /* NonNullExpression */: + case 214 /* NonNullExpression */: return ts.updateNonNullExpression(node, visitNode(node.expression, visitor, ts.isExpression)); - case 214 /* MetaProperty */: + case 215 /* MetaProperty */: return ts.updateMetaProperty(node, visitNode(node.name, visitor, ts.isIdentifier)); // Misc - case 216 /* TemplateSpan */: + case 217 /* TemplateSpan */: return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); // Element - case 218 /* Block */: + case 219 /* Block */: return ts.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 219 /* VariableStatement */: + case 220 /* VariableStatement */: return ts.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 221 /* ExpressionStatement */: + case 222 /* ExpressionStatement */: return ts.updateExpressionStatement(node, visitNode(node.expression, visitor, ts.isExpression)); - case 222 /* IfStatement */: + case 223 /* IfStatement */: return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, ts.liftToBlock)); - case 223 /* DoStatement */: + case 224 /* DoStatement */: return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); - case 224 /* WhileStatement */: + case 225 /* WhileStatement */: return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); - case 225 /* ForStatement */: + case 226 /* ForStatement */: return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); - case 226 /* ForInStatement */: + case 227 /* ForInStatement */: return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); - case 227 /* ForOfStatement */: + case 228 /* ForOfStatement */: return ts.updateForOf(node, visitNode(node.awaitModifier, visitor, ts.isToken), visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); - case 228 /* ContinueStatement */: + case 229 /* ContinueStatement */: return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier)); - case 229 /* BreakStatement */: + case 230 /* BreakStatement */: return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier)); - case 230 /* ReturnStatement */: + case 231 /* ReturnStatement */: return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression)); - case 231 /* WithStatement */: + case 232 /* WithStatement */: return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); - case 232 /* SwitchStatement */: + case 233 /* SwitchStatement */: return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); - case 233 /* LabeledStatement */: + case 234 /* LabeledStatement */: return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock)); - case 234 /* ThrowStatement */: + case 235 /* ThrowStatement */: return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); - case 235 /* TryStatement */: + case 236 /* TryStatement */: return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause), visitNode(node.finallyBlock, visitor, ts.isBlock)); - case 237 /* VariableDeclaration */: + case 238 /* VariableDeclaration */: return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); - case 238 /* VariableDeclarationList */: + case 239 /* VariableDeclarationList */: return ts.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); - case 239 /* FunctionDeclaration */: + case 240 /* FunctionDeclaration */: return ts.updateFunctionDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); - case 240 /* ClassDeclaration */: + case 241 /* ClassDeclaration */: return ts.updateClassDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 241 /* InterfaceDeclaration */: + case 242 /* InterfaceDeclaration */: return ts.updateInterfaceDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 242 /* TypeAliasDeclaration */: + case 243 /* TypeAliasDeclaration */: return ts.updateTypeAliasDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode)); - case 243 /* EnumDeclaration */: + case 244 /* EnumDeclaration */: return ts.updateEnumDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: return ts.updateModuleDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.body, visitor, ts.isModuleBody)); - case 245 /* ModuleBlock */: + case 246 /* ModuleBlock */: return ts.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 246 /* CaseBlock */: + case 247 /* CaseBlock */: return ts.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 247 /* NamespaceExportDeclaration */: + case 248 /* NamespaceExportDeclaration */: return ts.updateNamespaceExportDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier)); - case 248 /* ImportEqualsDeclaration */: + case 249 /* ImportEqualsDeclaration */: return ts.updateImportEqualsDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.moduleReference, visitor, ts.isModuleReference)); - case 249 /* ImportDeclaration */: + case 250 /* ImportDeclaration */: return ts.updateImportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); - case 250 /* ImportClause */: + case 251 /* ImportClause */: return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings)); - case 251 /* NamespaceImport */: + case 252 /* NamespaceImport */: return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); - case 252 /* NamedImports */: + case 253 /* NamedImports */: return ts.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); - case 253 /* ImportSpecifier */: + case 254 /* ImportSpecifier */: return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier)); - case 254 /* ExportAssignment */: + case 255 /* ExportAssignment */: return ts.updateExportAssignment(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); - case 255 /* ExportDeclaration */: + case 256 /* ExportDeclaration */: return ts.updateExportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); - case 256 /* NamedExports */: + case 257 /* NamedExports */: return ts.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); - case 257 /* ExportSpecifier */: + case 258 /* ExportSpecifier */: return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier)); // Module references - case 259 /* ExternalModuleReference */: + case 260 /* ExternalModuleReference */: return ts.updateExternalModuleReference(node, visitNode(node.expression, visitor, ts.isExpression)); // JSX - case 260 /* JsxElement */: + case 261 /* JsxElement */: return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); - case 261 /* JsxSelfClosingElement */: + case 262 /* JsxSelfClosingElement */: return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes)); - case 262 /* JsxOpeningElement */: + case 263 /* JsxOpeningElement */: return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes)); - case 263 /* JsxClosingElement */: + case 264 /* JsxClosingElement */: return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); - case 264 /* JsxFragment */: + case 265 /* JsxFragment */: return ts.updateJsxFragment(node, visitNode(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingFragment, visitor, ts.isJsxClosingFragment)); - case 267 /* JsxAttribute */: + case 268 /* JsxAttribute */: return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 268 /* JsxAttributes */: + case 269 /* JsxAttributes */: return ts.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); - case 269 /* JsxSpreadAttribute */: + case 270 /* JsxSpreadAttribute */: return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); - case 270 /* JsxExpression */: + case 271 /* JsxExpression */: return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); // Clauses - case 271 /* CaseClause */: + case 272 /* CaseClause */: return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); - case 272 /* DefaultClause */: + case 273 /* DefaultClause */: return ts.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 273 /* HeritageClause */: + case 274 /* HeritageClause */: return ts.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); - case 274 /* CatchClause */: + case 275 /* CatchClause */: return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); // Property assignments - case 275 /* PropertyAssignment */: + case 276 /* PropertyAssignment */: return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); - case 276 /* ShorthandPropertyAssignment */: + case 277 /* ShorthandPropertyAssignment */: return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); - case 277 /* SpreadAssignment */: + case 278 /* SpreadAssignment */: return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); // Enum - case 278 /* EnumMember */: + case 279 /* EnumMember */: return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); // Top-level nodes - case 284 /* SourceFile */: + case 285 /* SourceFile */: return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); // Transformation nodes - case 313 /* PartiallyEmittedExpression */: + case 314 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); - case 314 /* CommaListExpression */: + case 315 /* CommaListExpression */: return ts.updateCommaList(node, nodesVisitor(node.elements, visitor, ts.isExpression)); default: // No need to visit nodes with no children. @@ -65330,58 +66237,58 @@ var ts; var cbNodes = cbNodeArray || cbNode; var kind = node.kind; // No need to visit nodes with no children. - if ((kind > 0 /* FirstToken */ && kind <= 147 /* LastToken */)) { + if ((kind > 0 /* FirstToken */ && kind <= 148 /* LastToken */)) { return initial; } // We do not yet support types. - if ((kind >= 163 /* TypePredicate */ && kind <= 182 /* LiteralType */)) { + if ((kind >= 164 /* TypePredicate */ && kind <= 183 /* LiteralType */)) { return initial; } var result = initial; switch (node.kind) { // Leaf nodes - case 217 /* SemicolonClassElement */: - case 220 /* EmptyStatement */: - case 210 /* OmittedExpression */: - case 236 /* DebuggerStatement */: - case 312 /* NotEmittedStatement */: + case 218 /* SemicolonClassElement */: + case 221 /* EmptyStatement */: + case 211 /* OmittedExpression */: + case 237 /* DebuggerStatement */: + case 313 /* NotEmittedStatement */: // No need to visit nodes with no children. break; // Names - case 148 /* QualifiedName */: + case 149 /* QualifiedName */: result = reduceNode(node.left, cbNode, result); result = reduceNode(node.right, cbNode, result); break; - case 149 /* ComputedPropertyName */: + case 150 /* ComputedPropertyName */: result = reduceNode(node.expression, cbNode, result); break; // Signature elements - case 151 /* Parameter */: + case 152 /* Parameter */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 152 /* Decorator */: + case 153 /* Decorator */: result = reduceNode(node.expression, cbNode, result); break; // Type member - case 153 /* PropertySignature */: + case 154 /* PropertySignature */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.questionToken, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 154 /* PropertyDeclaration */: + case 155 /* PropertyDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 156 /* MethodDeclaration */: + case 157 /* MethodDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -65390,12 +66297,12 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 157 /* Constructor */: + case 158 /* Constructor */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNodes(node.parameters, cbNodes, result); result = reduceNode(node.body, cbNode, result); break; - case 158 /* GetAccessor */: + case 159 /* GetAccessor */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -65403,7 +66310,7 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 159 /* SetAccessor */: + case 160 /* SetAccessor */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -65411,50 +66318,50 @@ var ts; result = reduceNode(node.body, cbNode, result); break; // Binding patterns - case 184 /* ObjectBindingPattern */: - case 185 /* ArrayBindingPattern */: + case 185 /* ObjectBindingPattern */: + case 186 /* ArrayBindingPattern */: result = reduceNodes(node.elements, cbNodes, result); break; - case 186 /* BindingElement */: + case 187 /* BindingElement */: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; // Expression - case 187 /* ArrayLiteralExpression */: + case 188 /* ArrayLiteralExpression */: result = reduceNodes(node.elements, cbNodes, result); break; - case 188 /* ObjectLiteralExpression */: + case 189 /* ObjectLiteralExpression */: result = reduceNodes(node.properties, cbNodes, result); break; - case 189 /* PropertyAccessExpression */: + case 190 /* PropertyAccessExpression */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.name, cbNode, result); break; - case 190 /* ElementAccessExpression */: + case 191 /* ElementAccessExpression */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.argumentExpression, cbNode, result); break; - case 191 /* CallExpression */: + case 192 /* CallExpression */: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); result = reduceNodes(node.arguments, cbNodes, result); break; - case 192 /* NewExpression */: + case 193 /* NewExpression */: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); result = reduceNodes(node.arguments, cbNodes, result); break; - case 193 /* TaggedTemplateExpression */: + case 194 /* TaggedTemplateExpression */: result = reduceNode(node.tag, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); result = reduceNode(node.template, cbNode, result); break; - case 194 /* TypeAssertionExpression */: + case 195 /* TypeAssertionExpression */: result = reduceNode(node.type, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 196 /* FunctionExpression */: + case 197 /* FunctionExpression */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.typeParameters, cbNodes, result); @@ -65462,123 +66369,123 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 197 /* ArrowFunction */: + case 198 /* ArrowFunction */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNodes(node.typeParameters, cbNodes, result); result = reduceNodes(node.parameters, cbNodes, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 195 /* ParenthesizedExpression */: - case 198 /* DeleteExpression */: - case 199 /* TypeOfExpression */: - case 200 /* VoidExpression */: - case 201 /* AwaitExpression */: - case 207 /* YieldExpression */: - case 208 /* SpreadElement */: - case 213 /* NonNullExpression */: + case 196 /* ParenthesizedExpression */: + case 199 /* DeleteExpression */: + case 200 /* TypeOfExpression */: + case 201 /* VoidExpression */: + case 202 /* AwaitExpression */: + case 208 /* YieldExpression */: + case 209 /* SpreadElement */: + case 214 /* NonNullExpression */: result = reduceNode(node.expression, cbNode, result); break; - case 202 /* PrefixUnaryExpression */: - case 203 /* PostfixUnaryExpression */: + case 203 /* PrefixUnaryExpression */: + case 204 /* PostfixUnaryExpression */: result = reduceNode(node.operand, cbNode, result); break; - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: result = reduceNode(node.left, cbNode, result); result = reduceNode(node.right, cbNode, result); break; - case 205 /* ConditionalExpression */: + case 206 /* ConditionalExpression */: result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.whenTrue, cbNode, result); result = reduceNode(node.whenFalse, cbNode, result); break; - case 206 /* TemplateExpression */: + case 207 /* TemplateExpression */: result = reduceNode(node.head, cbNode, result); result = reduceNodes(node.templateSpans, cbNodes, result); break; - case 209 /* ClassExpression */: + case 210 /* ClassExpression */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.typeParameters, cbNodes, result); result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; - case 211 /* ExpressionWithTypeArguments */: + case 212 /* ExpressionWithTypeArguments */: result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); break; - case 212 /* AsExpression */: + case 213 /* AsExpression */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.type, cbNode, result); break; // Misc - case 216 /* TemplateSpan */: + case 217 /* TemplateSpan */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.literal, cbNode, result); break; // Element - case 218 /* Block */: + case 219 /* Block */: result = reduceNodes(node.statements, cbNodes, result); break; - case 219 /* VariableStatement */: + case 220 /* VariableStatement */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.declarationList, cbNode, result); break; - case 221 /* ExpressionStatement */: + case 222 /* ExpressionStatement */: result = reduceNode(node.expression, cbNode, result); break; - case 222 /* IfStatement */: + case 223 /* IfStatement */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.thenStatement, cbNode, result); result = reduceNode(node.elseStatement, cbNode, result); break; - case 223 /* DoStatement */: + case 224 /* DoStatement */: result = reduceNode(node.statement, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 224 /* WhileStatement */: - case 231 /* WithStatement */: + case 225 /* WhileStatement */: + case 232 /* WithStatement */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 225 /* ForStatement */: + case 226 /* ForStatement */: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.incrementor, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 226 /* ForInStatement */: - case 227 /* ForOfStatement */: + case 227 /* ForInStatement */: + case 228 /* ForOfStatement */: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 230 /* ReturnStatement */: - case 234 /* ThrowStatement */: + case 231 /* ReturnStatement */: + case 235 /* ThrowStatement */: result = reduceNode(node.expression, cbNode, result); break; - case 232 /* SwitchStatement */: + case 233 /* SwitchStatement */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.caseBlock, cbNode, result); break; - case 233 /* LabeledStatement */: + case 234 /* LabeledStatement */: result = reduceNode(node.label, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 235 /* TryStatement */: + case 236 /* TryStatement */: result = reduceNode(node.tryBlock, cbNode, result); result = reduceNode(node.catchClause, cbNode, result); result = reduceNode(node.finallyBlock, cbNode, result); break; - case 237 /* VariableDeclaration */: + case 238 /* VariableDeclaration */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 238 /* VariableDeclarationList */: + case 239 /* VariableDeclarationList */: result = reduceNodes(node.declarations, cbNodes, result); break; - case 239 /* FunctionDeclaration */: + case 240 /* FunctionDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -65587,7 +66494,7 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 240 /* ClassDeclaration */: + case 241 /* ClassDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -65595,140 +66502,140 @@ var ts; result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; - case 243 /* EnumDeclaration */: + case 244 /* EnumDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNodes(node.members, cbNodes, result); break; - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 245 /* ModuleBlock */: + case 246 /* ModuleBlock */: result = reduceNodes(node.statements, cbNodes, result); break; - case 246 /* CaseBlock */: + case 247 /* CaseBlock */: result = reduceNodes(node.clauses, cbNodes, result); break; - case 248 /* ImportEqualsDeclaration */: + case 249 /* ImportEqualsDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); result = reduceNode(node.moduleReference, cbNode, result); break; - case 249 /* ImportDeclaration */: + case 250 /* ImportDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.importClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; - case 250 /* ImportClause */: + case 251 /* ImportClause */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.namedBindings, cbNode, result); break; - case 251 /* NamespaceImport */: + case 252 /* NamespaceImport */: result = reduceNode(node.name, cbNode, result); break; - case 252 /* NamedImports */: - case 256 /* NamedExports */: + case 253 /* NamedImports */: + case 257 /* NamedExports */: result = reduceNodes(node.elements, cbNodes, result); break; - case 253 /* ImportSpecifier */: - case 257 /* ExportSpecifier */: + case 254 /* ImportSpecifier */: + case 258 /* ExportSpecifier */: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); break; - case 254 /* ExportAssignment */: + case 255 /* ExportAssignment */: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 255 /* ExportDeclaration */: + case 256 /* ExportDeclaration */: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.exportClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; // Module references - case 259 /* ExternalModuleReference */: + case 260 /* ExternalModuleReference */: result = reduceNode(node.expression, cbNode, result); break; // JSX - case 260 /* JsxElement */: + case 261 /* JsxElement */: result = reduceNode(node.openingElement, cbNode, result); result = ts.reduceLeft(node.children, cbNode, result); result = reduceNode(node.closingElement, cbNode, result); break; - case 264 /* JsxFragment */: + case 265 /* JsxFragment */: result = reduceNode(node.openingFragment, cbNode, result); result = ts.reduceLeft(node.children, cbNode, result); result = reduceNode(node.closingFragment, cbNode, result); break; - case 261 /* JsxSelfClosingElement */: - case 262 /* JsxOpeningElement */: + case 262 /* JsxSelfClosingElement */: + case 263 /* JsxOpeningElement */: result = reduceNode(node.tagName, cbNode, result); result = reduceNodes(node.typeArguments, cbNode, result); result = reduceNode(node.attributes, cbNode, result); break; - case 268 /* JsxAttributes */: + case 269 /* JsxAttributes */: result = reduceNodes(node.properties, cbNodes, result); break; - case 263 /* JsxClosingElement */: + case 264 /* JsxClosingElement */: result = reduceNode(node.tagName, cbNode, result); break; - case 267 /* JsxAttribute */: + case 268 /* JsxAttribute */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 269 /* JsxSpreadAttribute */: + case 270 /* JsxSpreadAttribute */: result = reduceNode(node.expression, cbNode, result); break; - case 270 /* JsxExpression */: + case 271 /* JsxExpression */: result = reduceNode(node.expression, cbNode, result); break; // Clauses - case 271 /* CaseClause */: + case 272 /* CaseClause */: result = reduceNode(node.expression, cbNode, result); // falls through - case 272 /* DefaultClause */: + case 273 /* DefaultClause */: result = reduceNodes(node.statements, cbNodes, result); break; - case 273 /* HeritageClause */: + case 274 /* HeritageClause */: result = reduceNodes(node.types, cbNodes, result); break; - case 274 /* CatchClause */: + case 275 /* CatchClause */: result = reduceNode(node.variableDeclaration, cbNode, result); result = reduceNode(node.block, cbNode, result); break; // Property assignments - case 275 /* PropertyAssignment */: + case 276 /* PropertyAssignment */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 276 /* ShorthandPropertyAssignment */: + case 277 /* ShorthandPropertyAssignment */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.objectAssignmentInitializer, cbNode, result); break; - case 277 /* SpreadAssignment */: + case 278 /* SpreadAssignment */: result = reduceNode(node.expression, cbNode, result); break; // Enum - case 278 /* EnumMember */: + case 279 /* EnumMember */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; // Top-level nodes - case 284 /* SourceFile */: + case 285 /* SourceFile */: result = reduceNodes(node.statements, cbNodes, result); break; // Transformation nodes - case 313 /* PartiallyEmittedExpression */: + case 314 /* PartiallyEmittedExpression */: result = reduceNode(node.expression, cbNode, result); break; - case 314 /* CommaListExpression */: + case 315 /* CommaListExpression */: result = reduceNodes(node.elements, cbNodes, result); break; default: @@ -65752,7 +66659,7 @@ var ts; * @param nodes The NodeArray. */ function liftToBlock(nodes) { - Debug.assert(ts.every(nodes, ts.isStatement), "Cannot lift nodes to a Block."); + ts.Debug.assert(ts.every(nodes, ts.isStatement), "Cannot lift nodes to a Block."); return ts.singleOrUndefined(nodes) || ts.createBlock(nodes); } ts.liftToBlock = liftToBlock; @@ -65801,7 +66708,7 @@ var ts; function aggregateTransformFlagsForSubtree(node) { // We do not transform ambient declarations or types, so there is no need to // recursively aggregate transform flags. - if (ts.hasModifier(node, 2 /* Ambient */) || (ts.isTypeNode(node) && node.kind !== 211 /* ExpressionWithTypeArguments */)) { + if (ts.hasModifier(node, 2 /* Ambient */) || (ts.isTypeNode(node) && node.kind !== 212 /* ExpressionWithTypeArguments */)) { return 0 /* None */; } // Aggregate the transform flags of each child. @@ -65817,73 +66724,6 @@ var ts; function aggregateTransformFlagsForChildNodes(transformFlags, nodes) { return transformFlags | aggregateTransformFlagsForNodeArray(nodes); } - var Debug; - (function (Debug) { - var isDebugInfoEnabled = false; - function failBadSyntaxKind(node, message) { - return Debug.fail((message || "Unexpected node.") + "\r\nNode " + ts.formatSyntaxKind(node.kind) + " was unexpected.", failBadSyntaxKind); - } - Debug.failBadSyntaxKind = failBadSyntaxKind; - Debug.assertEachNode = Debug.shouldAssert(1 /* Normal */) - ? function (nodes, test, message) { return Debug.assert(test === undefined || ts.every(nodes, test), message || "Unexpected node.", function () { return "Node array did not pass test '" + Debug.getFunctionName(test) + "'."; }, Debug.assertEachNode); } - : ts.noop; - Debug.assertNode = Debug.shouldAssert(1 /* Normal */) - ? function (node, test, message) { return Debug.assert(test === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + Debug.getFunctionName(test) + "'."; }, Debug.assertNode); } - : ts.noop; - Debug.assertOptionalNode = Debug.shouldAssert(1 /* Normal */) - ? function (node, test, message) { return Debug.assert(test === undefined || node === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + Debug.getFunctionName(test) + "'."; }, Debug.assertOptionalNode); } - : ts.noop; - Debug.assertOptionalToken = Debug.shouldAssert(1 /* Normal */) - ? function (node, kind, message) { return Debug.assert(kind === undefined || node === undefined || node.kind === kind, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was not a '" + ts.formatSyntaxKind(kind) + "' token."; }, Debug.assertOptionalToken); } - : ts.noop; - Debug.assertMissingNode = Debug.shouldAssert(1 /* Normal */) - ? function (node, message) { return Debug.assert(node === undefined, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected'."; }, Debug.assertMissingNode); } - : ts.noop; - /** - * Injects debug information into frequently used types. - */ - function enableDebugInfo() { - if (isDebugInfoEnabled) - return; - // Add additional properties in debug mode to assist with debugging. - Object.defineProperties(ts.objectAllocator.getSymbolConstructor().prototype, { - __debugFlags: { get: function () { return ts.formatSymbolFlags(this.flags); } } - }); - Object.defineProperties(ts.objectAllocator.getTypeConstructor().prototype, { - __debugFlags: { get: function () { return ts.formatTypeFlags(this.flags); } }, - __debugObjectFlags: { get: function () { return this.flags & 524288 /* Object */ ? ts.formatObjectFlags(this.objectFlags) : ""; } }, - __debugTypeToString: { value: function () { return this.checker.typeToString(this); } }, - }); - var nodeConstructors = [ - ts.objectAllocator.getNodeConstructor(), - ts.objectAllocator.getIdentifierConstructor(), - ts.objectAllocator.getTokenConstructor(), - ts.objectAllocator.getSourceFileConstructor() - ]; - for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) { - var ctor = nodeConstructors_1[_i]; - if (!ctor.prototype.hasOwnProperty("__debugKind")) { - Object.defineProperties(ctor.prototype, { - __debugKind: { get: function () { return ts.formatSyntaxKind(this.kind); } }, - __debugModifierFlags: { get: function () { return ts.formatModifierFlags(ts.getModifierFlagsNoCache(this)); } }, - __debugTransformFlags: { get: function () { return ts.formatTransformFlags(this.transformFlags); } }, - __debugEmitFlags: { get: function () { return ts.formatEmitFlags(ts.getEmitFlags(this)); } }, - __debugGetText: { - value: function (includeTrivia) { - if (ts.nodeIsSynthesized(this)) - return ""; - var parseNode = ts.getParseTreeNode(this); - var sourceFile = parseNode && ts.getSourceFileOfNode(parseNode); - return sourceFile ? ts.getSourceTextOfNodeFromSourceFile(sourceFile, parseNode, includeTrivia) : ""; - } - } - }); - } - } - isDebugInfoEnabled = true; - } - Debug.enableDebugInfo = enableDebugInfo; - })(Debug = ts.Debug || (ts.Debug = {})); })(ts || (ts = {})); /* @internal */ var ts; @@ -66541,7 +67381,7 @@ var ts; function chainBundle(transformSourceFile) { return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - return node.kind === 284 /* SourceFile */ ? transformSourceFile(node) : transformBundle(node); + return node.kind === 285 /* SourceFile */ ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return ts.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends); @@ -66587,7 +67427,7 @@ var ts; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 249 /* ImportDeclaration */: + case 250 /* ImportDeclaration */: // import "mod" // import x from "mod" // import * as x from "mod" @@ -66595,13 +67435,13 @@ var ts; externalImports.push(node); hasImportStarOrImportDefault = hasImportStarOrImportDefault || getImportNeedsImportStarHelper(node) || getImportNeedsImportDefaultHelper(node); break; - case 248 /* ImportEqualsDeclaration */: - if (node.moduleReference.kind === 259 /* ExternalModuleReference */) { + case 249 /* ImportEqualsDeclaration */: + if (node.moduleReference.kind === 260 /* ExternalModuleReference */) { // import x = require("mod") externalImports.push(node); } break; - case 255 /* ExportDeclaration */: + case 256 /* ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { // export * from "mod" @@ -66631,13 +67471,13 @@ var ts; } } break; - case 254 /* ExportAssignment */: + case 255 /* ExportAssignment */: if (node.isExportEquals && !exportEquals) { // export = x exportEquals = node; } break; - case 219 /* VariableStatement */: + case 220 /* VariableStatement */: if (ts.hasModifier(node, 1 /* Export */)) { for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { var decl = _e[_d]; @@ -66645,7 +67485,7 @@ var ts; } } break; - case 239 /* FunctionDeclaration */: + case 240 /* FunctionDeclaration */: if (ts.hasModifier(node, 1 /* Export */)) { if (ts.hasModifier(node, 512 /* Default */)) { // export default function() { } @@ -66665,7 +67505,7 @@ var ts; } } break; - case 240 /* ClassDeclaration */: + case 241 /* ClassDeclaration */: if (ts.hasModifier(node, 1 /* Export */)) { if (ts.hasModifier(node, 512 /* Default */)) { // export default class { } @@ -67205,7 +68045,7 @@ var ts; ts.restHelper = { name: "typescript:rest", scoped: false, - text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\n t[p[i]] = s[p[i]];\n return t;\n };" + text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n };" }; /** Given value: o, propName: p, pattern: { a, b, ...p } from the original statement * `{ a, b, ...p } = o`, create `p = __rest(o, ["a", "b"]);` @@ -67281,8 +68121,8 @@ var ts; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; // Enable substitution for property/element access to emit const enum values. - context.enableSubstitution(189 /* PropertyAccessExpression */); - context.enableSubstitution(190 /* ElementAccessExpression */); + context.enableSubstitution(190 /* PropertyAccessExpression */); + context.enableSubstitution(191 /* ElementAccessExpression */); // These variables contain state that changes as we descend into the tree. var currentSourceFile; var currentNamespace; @@ -67312,14 +68152,14 @@ var ts; var pendingExpressions; return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - if (node.kind === 285 /* Bundle */) { + if (node.kind === 286 /* Bundle */) { return transformBundle(node); } return transformSourceFile(node); } function transformBundle(node) { return ts.createBundle(node.sourceFiles.map(transformSourceFile), ts.mapDefined(node.prepends, function (prepend) { - if (prepend.kind === 287 /* InputFiles */) { + if (prepend.kind === 288 /* InputFiles */) { return ts.createUnparsedSourceFile(prepend, "js"); } return prepend; @@ -67368,16 +68208,16 @@ var ts; */ function onBeforeVisitNode(node) { switch (node.kind) { - case 284 /* SourceFile */: - case 246 /* CaseBlock */: - case 245 /* ModuleBlock */: - case 218 /* Block */: + case 285 /* SourceFile */: + case 247 /* CaseBlock */: + case 246 /* ModuleBlock */: + case 219 /* Block */: currentLexicalScope = node; currentNameScope = undefined; currentScopeFirstDeclarationsOfName = undefined; break; - case 240 /* ClassDeclaration */: - case 239 /* FunctionDeclaration */: + case 241 /* ClassDeclaration */: + case 240 /* FunctionDeclaration */: if (ts.hasModifier(node, 2 /* Ambient */)) { break; } @@ -67389,7 +68229,7 @@ var ts; // These nodes should always have names unless they are default-exports; // however, class declaration parsing allows for undefined names, so syntactically invalid // programs may also have an undefined name. - ts.Debug.assert(node.kind === 240 /* ClassDeclaration */ || ts.hasModifier(node, 512 /* Default */)); + ts.Debug.assert(node.kind === 241 /* ClassDeclaration */ || ts.hasModifier(node, 512 /* Default */)); } if (ts.isClassDeclaration(node)) { // XXX: should probably also cover interfaces and type aliases that can have type variables? @@ -67432,10 +68272,10 @@ var ts; */ function sourceElementVisitorWorker(node) { switch (node.kind) { - case 249 /* ImportDeclaration */: - case 248 /* ImportEqualsDeclaration */: - case 254 /* ExportAssignment */: - case 255 /* ExportDeclaration */: + case 250 /* ImportDeclaration */: + case 249 /* ImportEqualsDeclaration */: + case 255 /* ExportAssignment */: + case 256 /* ExportDeclaration */: return visitEllidableStatement(node); default: return visitorWorker(node); @@ -67456,13 +68296,13 @@ var ts; return node; } switch (node.kind) { - case 249 /* ImportDeclaration */: + case 250 /* ImportDeclaration */: return visitImportDeclaration(node); - case 248 /* ImportEqualsDeclaration */: + case 249 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 254 /* ExportAssignment */: + case 255 /* ExportAssignment */: return visitExportAssignment(node); - case 255 /* ExportDeclaration */: + case 256 /* ExportDeclaration */: return visitExportDeclaration(node); default: ts.Debug.fail("Unhandled ellided statement"); @@ -67482,11 +68322,11 @@ var ts; * @param node The node to visit. */ function namespaceElementVisitorWorker(node) { - if (node.kind === 255 /* ExportDeclaration */ || - node.kind === 249 /* ImportDeclaration */ || - node.kind === 250 /* ImportClause */ || - (node.kind === 248 /* ImportEqualsDeclaration */ && - node.moduleReference.kind === 259 /* ExternalModuleReference */)) { + if (node.kind === 256 /* ExportDeclaration */ || + node.kind === 250 /* ImportDeclaration */ || + node.kind === 251 /* ImportClause */ || + (node.kind === 249 /* ImportEqualsDeclaration */ && + node.moduleReference.kind === 260 /* ExternalModuleReference */)) { // do not emit ES6 imports and exports since they are illegal inside a namespace return undefined; } @@ -67510,19 +68350,19 @@ var ts; */ function classElementVisitorWorker(node) { switch (node.kind) { - case 157 /* Constructor */: + case 158 /* Constructor */: // TypeScript constructors are transformed in `visitClassDeclaration`. // We elide them here as `visitorWorker` checks transform flags, which could // erronously include an ES6 constructor without TypeScript syntax. return undefined; - case 154 /* PropertyDeclaration */: - case 162 /* IndexSignature */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 156 /* MethodDeclaration */: + case 155 /* PropertyDeclaration */: + case 163 /* IndexSignature */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 157 /* MethodDeclaration */: // Fallback to the default visit behavior. return visitorWorker(node); - case 217 /* SemicolonClassElement */: + case 218 /* SemicolonClassElement */: return node; default: return ts.Debug.failBadSyntaxKind(node); @@ -67532,7 +68372,7 @@ var ts; if (ts.modifierToFlag(node.kind) & 2270 /* TypeScriptModifier */) { return undefined; } - else if (currentNamespace && node.kind === 85 /* ExportKeyword */) { + else if (currentNamespace && node.kind === 86 /* ExportKeyword */) { return undefined; } return node; @@ -67549,67 +68389,67 @@ var ts; return ts.createNotEmittedStatement(node); } switch (node.kind) { - case 85 /* ExportKeyword */: - case 80 /* DefaultKeyword */: + case 86 /* ExportKeyword */: + case 81 /* DefaultKeyword */: // ES6 export and default modifiers are elided when inside a namespace. return currentNamespace ? undefined : node; - case 115 /* PublicKeyword */: - case 113 /* PrivateKeyword */: - case 114 /* ProtectedKeyword */: - case 118 /* AbstractKeyword */: - case 77 /* ConstKeyword */: - case 125 /* DeclareKeyword */: - case 133 /* ReadonlyKeyword */: + case 116 /* PublicKeyword */: + case 114 /* PrivateKeyword */: + case 115 /* ProtectedKeyword */: + case 119 /* AbstractKeyword */: + case 78 /* ConstKeyword */: + case 126 /* DeclareKeyword */: + case 134 /* ReadonlyKeyword */: // TypeScript accessibility and readonly modifiers are elided. - case 169 /* ArrayType */: - case 170 /* TupleType */: - case 171 /* OptionalType */: - case 172 /* RestType */: - case 168 /* TypeLiteral */: - case 163 /* TypePredicate */: - case 150 /* TypeParameter */: - case 120 /* AnyKeyword */: - case 143 /* UnknownKeyword */: - case 123 /* BooleanKeyword */: - case 138 /* StringKeyword */: - case 135 /* NumberKeyword */: - case 132 /* NeverKeyword */: - case 106 /* VoidKeyword */: - case 139 /* SymbolKeyword */: - case 166 /* ConstructorType */: - case 165 /* FunctionType */: - case 167 /* TypeQuery */: - case 164 /* TypeReference */: - case 173 /* UnionType */: - case 174 /* IntersectionType */: - case 175 /* ConditionalType */: - case 177 /* ParenthesizedType */: - case 178 /* ThisType */: - case 179 /* TypeOperator */: - case 180 /* IndexedAccessType */: - case 181 /* MappedType */: - case 182 /* LiteralType */: + case 170 /* ArrayType */: + case 171 /* TupleType */: + case 172 /* OptionalType */: + case 173 /* RestType */: + case 169 /* TypeLiteral */: + case 164 /* TypePredicate */: + case 151 /* TypeParameter */: + case 121 /* AnyKeyword */: + case 144 /* UnknownKeyword */: + case 124 /* BooleanKeyword */: + case 139 /* StringKeyword */: + case 136 /* NumberKeyword */: + case 133 /* NeverKeyword */: + case 107 /* VoidKeyword */: + case 140 /* SymbolKeyword */: + case 167 /* ConstructorType */: + case 166 /* FunctionType */: + case 168 /* TypeQuery */: + case 165 /* TypeReference */: + case 174 /* UnionType */: + case 175 /* IntersectionType */: + case 176 /* ConditionalType */: + case 178 /* ParenthesizedType */: + case 179 /* ThisType */: + case 180 /* TypeOperator */: + case 181 /* IndexedAccessType */: + case 182 /* MappedType */: + case 183 /* LiteralType */: // TypeScript type nodes are elided. - case 162 /* IndexSignature */: + case 163 /* IndexSignature */: // TypeScript index signatures are elided. - case 152 /* Decorator */: + case 153 /* Decorator */: // TypeScript decorators are elided. They will be emitted as part of visitClassDeclaration. - case 242 /* TypeAliasDeclaration */: + case 243 /* TypeAliasDeclaration */: // TypeScript type-only declarations are elided. return undefined; - case 154 /* PropertyDeclaration */: + case 155 /* PropertyDeclaration */: // TypeScript property declarations are elided. However their names are still visited, and can potentially be retained if they could have sideeffects return visitPropertyDeclaration(node); - case 247 /* NamespaceExportDeclaration */: + case 248 /* NamespaceExportDeclaration */: // TypeScript namespace export declarations are elided. return undefined; - case 157 /* Constructor */: + case 158 /* Constructor */: return visitConstructor(node); - case 241 /* InterfaceDeclaration */: + case 242 /* InterfaceDeclaration */: // TypeScript interfaces are elided, but some comments may be preserved. // See the implementation of `getLeadingComments` in comments.ts for more details. return ts.createNotEmittedStatement(node); - case 240 /* ClassDeclaration */: + case 241 /* ClassDeclaration */: // This may be a class declaration with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -67620,7 +68460,7 @@ var ts; // - index signatures // - method overload signatures return visitClassDeclaration(node); - case 209 /* ClassExpression */: + case 210 /* ClassExpression */: // This may be a class expression with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -67631,35 +68471,35 @@ var ts; // - index signatures // - method overload signatures return visitClassExpression(node); - case 273 /* HeritageClause */: + case 274 /* HeritageClause */: // This may be a heritage clause with TypeScript syntax extensions. // // TypeScript heritage clause extensions include: // - `implements` clause return visitHeritageClause(node); - case 211 /* ExpressionWithTypeArguments */: + case 212 /* ExpressionWithTypeArguments */: // TypeScript supports type arguments on an expression in an `extends` heritage clause. return visitExpressionWithTypeArguments(node); - case 156 /* MethodDeclaration */: + case 157 /* MethodDeclaration */: // TypeScript method declarations may have decorators, modifiers // or type annotations. return visitMethodDeclaration(node); - case 158 /* GetAccessor */: + case 159 /* GetAccessor */: // Get Accessors can have TypeScript modifiers, decorators, and type annotations. return visitGetAccessor(node); - case 159 /* SetAccessor */: + case 160 /* SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node); - case 239 /* FunctionDeclaration */: + case 240 /* FunctionDeclaration */: // Typescript function declarations can have modifiers, decorators, and type annotations. return visitFunctionDeclaration(node); - case 196 /* FunctionExpression */: + case 197 /* FunctionExpression */: // TypeScript function expressions can have modifiers and type annotations. return visitFunctionExpression(node); - case 197 /* ArrowFunction */: + case 198 /* ArrowFunction */: // TypeScript arrow functions can have modifiers and type annotations. return visitArrowFunction(node); - case 151 /* Parameter */: + case 152 /* Parameter */: // This may be a parameter declaration with TypeScript syntax extensions. // // TypeScript parameter declaration syntax extensions include: @@ -67669,35 +68509,35 @@ var ts; // - type annotations // - this parameters return visitParameter(node); - case 195 /* ParenthesizedExpression */: + case 196 /* ParenthesizedExpression */: // ParenthesizedExpressions are TypeScript if their expression is a // TypeAssertion or AsExpression return visitParenthesizedExpression(node); - case 194 /* TypeAssertionExpression */: - case 212 /* AsExpression */: + case 195 /* TypeAssertionExpression */: + case 213 /* AsExpression */: // TypeScript type assertions are removed, but their subtrees are preserved. return visitAssertionExpression(node); - case 191 /* CallExpression */: + case 192 /* CallExpression */: return visitCallExpression(node); - case 192 /* NewExpression */: + case 193 /* NewExpression */: return visitNewExpression(node); - case 193 /* TaggedTemplateExpression */: + case 194 /* TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 213 /* NonNullExpression */: + case 214 /* NonNullExpression */: // TypeScript non-null expressions are removed, but their subtrees are preserved. return visitNonNullExpression(node); - case 243 /* EnumDeclaration */: + case 244 /* EnumDeclaration */: // TypeScript enum declarations do not exist in ES6 and must be rewritten. return visitEnumDeclaration(node); - case 219 /* VariableStatement */: + case 220 /* VariableStatement */: // TypeScript namespace exports for variable statements must be transformed. return visitVariableStatement(node); - case 237 /* VariableDeclaration */: + case 238 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: // TypeScript namespace declarations must be transformed. return visitModuleDeclaration(node); - case 248 /* ImportEqualsDeclaration */: + case 249 /* ImportEqualsDeclaration */: // TypeScript namespace or external module import. return visitImportEqualsDeclaration(node); default: @@ -67735,7 +68575,7 @@ var ts; if (ts.some(staticProperties)) facts |= 1 /* HasStaticInitializedProperties */; var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); - if (extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 96 /* NullKeyword */) + if (extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 97 /* NullKeyword */) facts |= 64 /* IsDerivedClass */; if (shouldEmitDecorateCallForClass(node)) facts |= 2 /* HasConstructorDecorators */; @@ -68001,7 +68841,7 @@ var ts; pendingExpressions = undefined; var staticProperties = getInitializedProperties(node, /*isStatic*/ true); var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause); - var members = transformClassMembers(node, ts.some(heritageClauses, function (c) { return c.token === 86 /* ExtendsKeyword */; })); + var members = transformClassMembers(node, ts.some(heritageClauses, function (c) { return c.token === 87 /* ExtendsKeyword */; })); var classExpression = ts.createClassExpression( /*modifiers*/ undefined, node.name, /*typeParameters*/ undefined, heritageClauses, members); @@ -68177,7 +69017,7 @@ var ts; return index; } var statement = statements[index]; - if (statement.kind === 221 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { + if (statement.kind === 222 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { result.push(ts.visitNode(statement, visitor, ts.isStatement)); return index + 1; } @@ -68248,7 +69088,7 @@ var ts; * @param isStatic A value indicating whether the member should be a static or instance member. */ function isInitializedProperty(member, isStatic) { - return member.kind === 154 /* PropertyDeclaration */ + return member.kind === 155 /* PropertyDeclaration */ && isStatic === ts.hasModifier(member, 32 /* Static */) && member.initializer !== undefined; } @@ -68259,8 +69099,8 @@ var ts; * @param receiver The receiver on which each property should be assigned. */ function addInitializedPropertyStatements(statements, properties, receiver) { - for (var _i = 0, properties_9 = properties; _i < properties_9.length; _i++) { - var property = properties_9[_i]; + for (var _i = 0, properties_6 = properties; _i < properties_6.length; _i++) { + var property = properties_6[_i]; var statement = ts.createExpressionStatement(transformInitializedProperty(property, receiver)); ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property)); ts.setCommentRange(statement, property); @@ -68276,8 +69116,8 @@ var ts; */ function generateInitializedPropertyExpressions(properties, receiver) { var expressions = []; - for (var _i = 0, properties_10 = properties; _i < properties_10.length; _i++) { - var property = properties_10[_i]; + for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) { + var property = properties_7[_i]; var expression = transformInitializedProperty(property, receiver); ts.startOnNewLine(expression); ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property)); @@ -68391,12 +69231,12 @@ var ts; */ function getAllDecoratorsOfClassElement(node, member) { switch (member.kind) { - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: return getAllDecoratorsOfAccessors(node, member); - case 156 /* MethodDeclaration */: + case 157 /* MethodDeclaration */: return getAllDecoratorsOfMethod(member); - case 154 /* PropertyDeclaration */: + case 155 /* PropertyDeclaration */: return getAllDecoratorsOfProperty(member); default: return undefined; @@ -68549,7 +69389,7 @@ var ts; var prefix = getClassMemberPrefix(node, member); var memberName = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ true); var descriptor = languageVersion > 0 /* ES3 */ - ? member.kind === 154 /* PropertyDeclaration */ + ? member.kind === 155 /* PropertyDeclaration */ // We emit `void 0` here to indicate to `__decorate` that it can invoke `Object.defineProperty` directly, but that it // should not invoke `Object.getOwnPropertyDescriptor`. ? ts.createVoidZero() @@ -68672,10 +69512,10 @@ var ts; */ function shouldAddTypeMetadata(node) { var kind = node.kind; - return kind === 156 /* MethodDeclaration */ - || kind === 158 /* GetAccessor */ - || kind === 159 /* SetAccessor */ - || kind === 154 /* PropertyDeclaration */; + return kind === 157 /* MethodDeclaration */ + || kind === 159 /* GetAccessor */ + || kind === 160 /* SetAccessor */ + || kind === 155 /* PropertyDeclaration */; } /** * Determines whether to emit the "design:returntype" metadata based on the node's kind. @@ -68685,7 +69525,7 @@ var ts; * @param node The node to test. */ function shouldAddReturnTypeMetadata(node) { - return node.kind === 156 /* MethodDeclaration */; + return node.kind === 157 /* MethodDeclaration */; } /** * Determines whether to emit the "design:paramtypes" metadata based on the node's kind. @@ -68696,12 +69536,12 @@ var ts; */ function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 240 /* ClassDeclaration */: - case 209 /* ClassExpression */: + case 241 /* ClassDeclaration */: + case 210 /* ClassExpression */: return ts.getFirstConstructorWithBody(node) !== undefined; - case 156 /* MethodDeclaration */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 157 /* MethodDeclaration */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: return true; } return false; @@ -68718,15 +69558,15 @@ var ts; */ function serializeTypeOfNode(node) { switch (node.kind) { - case 154 /* PropertyDeclaration */: - case 151 /* Parameter */: + case 155 /* PropertyDeclaration */: + case 152 /* Parameter */: return serializeTypeNode(node.type); - case 159 /* SetAccessor */: - case 158 /* GetAccessor */: + case 160 /* SetAccessor */: + case 159 /* GetAccessor */: return serializeTypeNode(getAccessorTypeNode(node)); - case 240 /* ClassDeclaration */: - case 209 /* ClassExpression */: - case 156 /* MethodDeclaration */: + case 241 /* ClassDeclaration */: + case 210 /* ClassExpression */: + case 157 /* MethodDeclaration */: return ts.createIdentifier("Function"); default: return ts.createVoidZero(); @@ -68763,7 +69603,7 @@ var ts; return ts.createArrayLiteral(expressions); } function getParametersOfDecoratedDeclaration(node, container) { - if (container && node.kind === 158 /* GetAccessor */) { + if (container && node.kind === 159 /* GetAccessor */) { var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; if (setAccessor) { return setAccessor.parameters; @@ -68808,69 +69648,69 @@ var ts; return ts.createIdentifier("Object"); } switch (node.kind) { - case 106 /* VoidKeyword */: - case 141 /* UndefinedKeyword */: - case 96 /* NullKeyword */: - case 132 /* NeverKeyword */: + case 107 /* VoidKeyword */: + case 142 /* UndefinedKeyword */: + case 97 /* NullKeyword */: + case 133 /* NeverKeyword */: return ts.createVoidZero(); - case 177 /* ParenthesizedType */: + case 178 /* ParenthesizedType */: return serializeTypeNode(node.type); - case 165 /* FunctionType */: - case 166 /* ConstructorType */: + case 166 /* FunctionType */: + case 167 /* ConstructorType */: return ts.createIdentifier("Function"); - case 169 /* ArrayType */: - case 170 /* TupleType */: + case 170 /* ArrayType */: + case 171 /* TupleType */: return ts.createIdentifier("Array"); - case 163 /* TypePredicate */: - case 123 /* BooleanKeyword */: + case 164 /* TypePredicate */: + case 124 /* BooleanKeyword */: return ts.createIdentifier("Boolean"); - case 138 /* StringKeyword */: + case 139 /* StringKeyword */: return ts.createIdentifier("String"); - case 136 /* ObjectKeyword */: + case 137 /* ObjectKeyword */: return ts.createIdentifier("Object"); - case 182 /* LiteralType */: + case 183 /* LiteralType */: switch (node.literal.kind) { case 10 /* StringLiteral */: return ts.createIdentifier("String"); - case 202 /* PrefixUnaryExpression */: + case 203 /* PrefixUnaryExpression */: case 8 /* NumericLiteral */: return ts.createIdentifier("Number"); case 9 /* BigIntLiteral */: return getGlobalBigIntNameWithFallback(); - case 102 /* TrueKeyword */: - case 87 /* FalseKeyword */: + case 103 /* TrueKeyword */: + case 88 /* FalseKeyword */: return ts.createIdentifier("Boolean"); default: return ts.Debug.failBadSyntaxKind(node.literal); } - case 135 /* NumberKeyword */: + case 136 /* NumberKeyword */: return ts.createIdentifier("Number"); - case 146 /* BigIntKeyword */: + case 147 /* BigIntKeyword */: return getGlobalBigIntNameWithFallback(); - case 139 /* SymbolKeyword */: + case 140 /* SymbolKeyword */: return languageVersion < 2 /* ES2015 */ ? getGlobalSymbolNameWithFallback() : ts.createIdentifier("Symbol"); - case 164 /* TypeReference */: + case 165 /* TypeReference */: return serializeTypeReferenceNode(node); - case 174 /* IntersectionType */: - case 173 /* UnionType */: + case 175 /* IntersectionType */: + case 174 /* UnionType */: return serializeTypeList(node.types); - case 175 /* ConditionalType */: + case 176 /* ConditionalType */: return serializeTypeList([node.trueType, node.falseType]); - case 179 /* TypeOperator */: - if (node.operator === 133 /* ReadonlyKeyword */) { + case 180 /* TypeOperator */: + if (node.operator === 134 /* ReadonlyKeyword */) { return serializeTypeNode(node.type); } break; - case 167 /* TypeQuery */: - case 180 /* IndexedAccessType */: - case 181 /* MappedType */: - case 168 /* TypeLiteral */: - case 120 /* AnyKeyword */: - case 143 /* UnknownKeyword */: - case 178 /* ThisType */: - case 183 /* ImportType */: + case 168 /* TypeQuery */: + case 181 /* IndexedAccessType */: + case 182 /* MappedType */: + case 169 /* TypeLiteral */: + case 121 /* AnyKeyword */: + case 144 /* UnknownKeyword */: + case 179 /* ThisType */: + case 184 /* ImportType */: break; default: return ts.Debug.failBadSyntaxKind(node); @@ -68881,15 +69721,15 @@ var ts; // Note when updating logic here also update getEntityNameForDecoratorMetadata // so that aliases can be marked as referenced var serializedUnion; - for (var _i = 0, types_18 = types; _i < types_18.length; _i++) { - var typeNode = types_18[_i]; - while (typeNode.kind === 177 /* ParenthesizedType */) { + for (var _i = 0, types_17 = types; _i < types_17.length; _i++) { + var typeNode = types_17[_i]; + while (typeNode.kind === 178 /* ParenthesizedType */) { typeNode = typeNode.type; // Skip parens if need be } - if (typeNode.kind === 132 /* NeverKeyword */) { + if (typeNode.kind === 133 /* NeverKeyword */) { continue; // Always elide `never` from the union/intersection if possible } - if (!strictNullChecks && (typeNode.kind === 96 /* NullKeyword */ || typeNode.kind === 141 /* UndefinedKeyword */)) { + if (!strictNullChecks && (typeNode.kind === 97 /* NullKeyword */ || typeNode.kind === 142 /* UndefinedKeyword */)) { continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks } var serializedIndividual = serializeTypeNode(typeNode); @@ -68969,12 +69809,12 @@ var ts; * @param node The entity name to serialize. */ function serializeEntityNameAsExpressionFallback(node) { - if (node.kind === 72 /* Identifier */) { + if (node.kind === 73 /* Identifier */) { // A -> typeof A !== undefined && A var copied = serializeEntityNameAsExpression(node); return createCheckedValue(copied, copied); } - if (node.left.kind === 72 /* Identifier */) { + if (node.left.kind === 73 /* Identifier */) { // A.B -> typeof A !== undefined && A.B return createCheckedValue(serializeEntityNameAsExpression(node.left), serializeEntityNameAsExpression(node)); } @@ -68990,7 +69830,7 @@ var ts; */ function serializeEntityNameAsExpression(node) { switch (node.kind) { - case 72 /* Identifier */: + case 73 /* Identifier */: // Create a clone of the name with a new parent, and treat it as if it were // a source tree node for the purposes of the checker. var name = ts.getMutableClone(node); @@ -68998,7 +69838,7 @@ var ts; name.original = undefined; name.parent = ts.getParseTreeNode(currentLexicalScope); // ensure the parent is set to a parse tree node. return name; - case 148 /* QualifiedName */: + case 149 /* QualifiedName */: return serializeQualifiedNameAsExpression(node); } } @@ -69024,7 +69864,7 @@ var ts; * available. */ function getGlobalBigIntNameWithFallback() { - return languageVersion < 7 /* ESNext */ + return languageVersion < 8 /* ESNext */ ? ts.createConditional(ts.createTypeCheck(ts.createIdentifier("BigInt"), "function"), ts.createIdentifier("BigInt"), ts.createIdentifier("Object")) : ts.createIdentifier("BigInt"); } @@ -69108,7 +69948,7 @@ var ts; * @param node The HeritageClause to transform. */ function visitHeritageClause(node) { - if (node.token === 109 /* ImplementsKeyword */) { + if (node.token === 110 /* ImplementsKeyword */) { // implements clauses are elided return undefined; } @@ -69347,7 +70187,7 @@ var ts; */ function visitEnumDeclaration(node) { if (!shouldEmitEnumDeclaration(node)) { - return undefined; + return ts.createNotEmittedStatement(node); } var statements = []; // We request to be advised when the printer is about to print this node. This allows @@ -69515,12 +70355,12 @@ var ts; // enums in any other scope are emitted as a `let` declaration. var statement = ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([ ts.createVariableDeclaration(ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true)) - ], currentLexicalScope.kind === 284 /* SourceFile */ ? 0 /* None */ : 1 /* Let */)); + ], currentLexicalScope.kind === 285 /* SourceFile */ ? 0 /* None */ : 1 /* Let */)); ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { // Adjust the source map emit to match the old emitter. - if (node.kind === 243 /* EnumDeclaration */) { + if (node.kind === 244 /* EnumDeclaration */) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -69645,7 +70485,7 @@ var ts; var statementsLocation; var blockLocation; var body = node.body; - if (body.kind === 245 /* ModuleBlock */) { + if (body.kind === 246 /* ModuleBlock */) { saveStateAndInvoke(body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = body.statements; blockLocation = body; @@ -69691,13 +70531,13 @@ var ts; // })(hi = hello.hi || (hello.hi = {})); // })(hello || (hello = {})); // We only want to emit comment on the namespace which contains block body itself, not the containing namespaces. - if (body.kind !== 245 /* ModuleBlock */) { + if (body.kind !== 246 /* ModuleBlock */) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* NoComments */); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 244 /* ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 245 /* ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -69738,7 +70578,7 @@ var ts; * @param node The named import bindings node. */ function visitNamedImportBindings(node) { - if (node.kind === 251 /* NamespaceImport */) { + if (node.kind === 252 /* NamespaceImport */) { // Elide a namespace import if it is not referenced. return resolver.isReferencedAliasDeclaration(node) ? node : undefined; } @@ -69951,7 +70791,7 @@ var ts; function enableSubstitutionForNonQualifiedEnumMembers() { if ((enabledSubstitutions & 8 /* NonQualifiedEnumMembers */) === 0) { enabledSubstitutions |= 8 /* NonQualifiedEnumMembers */; - context.enableSubstitution(72 /* Identifier */); + context.enableSubstitution(73 /* Identifier */); } } function enableSubstitutionForClassAliases() { @@ -69959,7 +70799,7 @@ var ts; enabledSubstitutions |= 1 /* ClassAliases */; // We need to enable substitutions for identifiers. This allows us to // substitute class names inside of a class declaration. - context.enableSubstitution(72 /* Identifier */); + context.enableSubstitution(73 /* Identifier */); // Keep track of class aliases. classAliases = []; } @@ -69969,17 +70809,17 @@ var ts; enabledSubstitutions |= 2 /* NamespaceExports */; // We need to enable substitutions for identifiers and shorthand property assignments. This allows us to // substitute the names of exported members of a namespace. - context.enableSubstitution(72 /* Identifier */); - context.enableSubstitution(276 /* ShorthandPropertyAssignment */); + context.enableSubstitution(73 /* Identifier */); + context.enableSubstitution(277 /* ShorthandPropertyAssignment */); // We need to be notified when entering and exiting namespaces. - context.enableEmitNotification(244 /* ModuleDeclaration */); + context.enableEmitNotification(245 /* ModuleDeclaration */); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 244 /* ModuleDeclaration */; + return ts.getOriginalNode(node).kind === 245 /* ModuleDeclaration */; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 243 /* EnumDeclaration */; + return ts.getOriginalNode(node).kind === 244 /* EnumDeclaration */; } /** * Hook for node emit. @@ -70038,11 +70878,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 72 /* Identifier */: + case 73 /* Identifier */: return substituteExpressionIdentifier(node); - case 189 /* PropertyAccessExpression */: + case 190 /* PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 190 /* ElementAccessExpression */: + case 191 /* ElementAccessExpression */: return substituteElementAccessExpression(node); } return node; @@ -70080,9 +70920,9 @@ var ts; // If we are nested within a namespace declaration, we may need to qualifiy // an identifier that is exported from a merged namespace. var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false); - if (container && container.kind !== 284 /* SourceFile */) { - var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 244 /* ModuleDeclaration */) || - (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 243 /* EnumDeclaration */); + if (container && container.kind !== 285 /* SourceFile */) { + var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 245 /* ModuleDeclaration */) || + (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 244 /* EnumDeclaration */); if (substitute) { return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node), /*location*/ node); @@ -70222,26 +71062,26 @@ var ts; return node; } switch (node.kind) { - case 121 /* AsyncKeyword */: + case 122 /* AsyncKeyword */: // ES2017 async modifier should be elided for targets < ES2017 return undefined; - case 201 /* AwaitExpression */: + case 202 /* AwaitExpression */: return visitAwaitExpression(node); - case 156 /* MethodDeclaration */: + case 157 /* MethodDeclaration */: return visitMethodDeclaration(node); - case 239 /* FunctionDeclaration */: + case 240 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 196 /* FunctionExpression */: + case 197 /* FunctionExpression */: return visitFunctionExpression(node); - case 197 /* ArrowFunction */: + case 198 /* ArrowFunction */: return visitArrowFunction(node); - case 189 /* PropertyAccessExpression */: - if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 98 /* SuperKeyword */) { + case 190 /* PropertyAccessExpression */: + if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 99 /* SuperKeyword */) { capturedSuperProperties.set(node.name.escapedText, true); } return ts.visitEachChild(node, visitor, context); - case 190 /* ElementAccessExpression */: - if (capturedSuperProperties && node.expression.kind === 98 /* SuperKeyword */) { + case 191 /* ElementAccessExpression */: + if (capturedSuperProperties && node.expression.kind === 99 /* SuperKeyword */) { hasSuperElementAccess = true; } return ts.visitEachChild(node, visitor, context); @@ -70252,27 +71092,27 @@ var ts; function asyncBodyVisitor(node) { if (ts.isNodeWithPossibleHoistedDeclaration(node)) { switch (node.kind) { - case 219 /* VariableStatement */: + case 220 /* VariableStatement */: return visitVariableStatementInAsyncBody(node); - case 225 /* ForStatement */: + case 226 /* ForStatement */: return visitForStatementInAsyncBody(node); - case 226 /* ForInStatement */: + case 227 /* ForInStatement */: return visitForInStatementInAsyncBody(node); - case 227 /* ForOfStatement */: + case 228 /* ForOfStatement */: return visitForOfStatementInAsyncBody(node); - case 274 /* CatchClause */: + case 275 /* CatchClause */: return visitCatchClauseInAsyncBody(node); - case 218 /* Block */: - case 232 /* SwitchStatement */: - case 246 /* CaseBlock */: - case 271 /* CaseClause */: - case 272 /* DefaultClause */: - case 235 /* TryStatement */: - case 223 /* DoStatement */: - case 224 /* WhileStatement */: - case 222 /* IfStatement */: - case 231 /* WithStatement */: - case 233 /* LabeledStatement */: + case 219 /* Block */: + case 233 /* SwitchStatement */: + case 247 /* CaseBlock */: + case 272 /* CaseClause */: + case 273 /* DefaultClause */: + case 236 /* TryStatement */: + case 224 /* DoStatement */: + case 225 /* WhileStatement */: + case 223 /* IfStatement */: + case 232 /* WithStatement */: + case 234 /* LabeledStatement */: return ts.visitEachChild(node, asyncBodyVisitor, context); default: return ts.Debug.assertNever(node, "Unhandled node."); @@ -70473,7 +71313,7 @@ var ts; var original = ts.getOriginalNode(node, ts.isFunctionLike); var nodeType = original.type; var promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : undefined; - var isArrowFunction = node.kind === 197 /* ArrowFunction */; + var isArrowFunction = node.kind === 198 /* ArrowFunction */; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* CaptureArguments */) !== 0; // An async function is emit as an outer function that calls an inner // generator function. To preserve lexical bindings, we pass the current @@ -70564,17 +71404,17 @@ var ts; enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(191 /* CallExpression */); - context.enableSubstitution(189 /* PropertyAccessExpression */); - context.enableSubstitution(190 /* ElementAccessExpression */); + context.enableSubstitution(192 /* CallExpression */); + context.enableSubstitution(190 /* PropertyAccessExpression */); + context.enableSubstitution(191 /* ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(240 /* ClassDeclaration */); - context.enableEmitNotification(156 /* MethodDeclaration */); - context.enableEmitNotification(158 /* GetAccessor */); - context.enableEmitNotification(159 /* SetAccessor */); - context.enableEmitNotification(157 /* Constructor */); + context.enableEmitNotification(241 /* ClassDeclaration */); + context.enableEmitNotification(157 /* MethodDeclaration */); + context.enableEmitNotification(159 /* GetAccessor */); + context.enableEmitNotification(160 /* SetAccessor */); + context.enableEmitNotification(158 /* Constructor */); // We need to be notified when entering the generated accessor arrow functions. - context.enableEmitNotification(219 /* VariableStatement */); + context.enableEmitNotification(220 /* VariableStatement */); } } /** @@ -70622,23 +71462,23 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 189 /* PropertyAccessExpression */: + case 190 /* PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 190 /* ElementAccessExpression */: + case 191 /* ElementAccessExpression */: return substituteElementAccessExpression(node); - case 191 /* CallExpression */: + case 192 /* CallExpression */: return substituteCallExpression(node); } return node; } function substitutePropertyAccessExpression(node) { - if (node.expression.kind === 98 /* SuperKeyword */) { + if (node.expression.kind === 99 /* SuperKeyword */) { return ts.setTextRange(ts.createPropertyAccess(ts.createFileLevelUniqueName("_super"), node.name), node); } return node; } function substituteElementAccessExpression(node) { - if (node.expression.kind === 98 /* SuperKeyword */) { + if (node.expression.kind === 99 /* SuperKeyword */) { return createSuperElementAccessInAsyncMethod(node.argumentExpression, node); } return node; @@ -70658,11 +71498,11 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 240 /* ClassDeclaration */ - || kind === 157 /* Constructor */ - || kind === 156 /* MethodDeclaration */ - || kind === 158 /* GetAccessor */ - || kind === 159 /* SetAccessor */; + return kind === 241 /* ClassDeclaration */ + || kind === 158 /* Constructor */ + || kind === 157 /* MethodDeclaration */ + || kind === 159 /* GetAccessor */ + || kind === 160 /* SetAccessor */; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { if (enclosingSuperContainerFlags & 4096 /* AsyncMethodWithSuperBinding */) { @@ -70797,7 +71637,7 @@ var ts; return visitorWorker(node, /*noDestructuringValue*/ true); } function visitorNoAsyncModifier(node) { - if (node.kind === 121 /* AsyncKeyword */) { + if (node.kind === 122 /* AsyncKeyword */) { return undefined; } return node; @@ -70807,53 +71647,55 @@ var ts; return node; } switch (node.kind) { - case 201 /* AwaitExpression */: + case 202 /* AwaitExpression */: return visitAwaitExpression(node); - case 207 /* YieldExpression */: + case 208 /* YieldExpression */: return visitYieldExpression(node); - case 230 /* ReturnStatement */: + case 231 /* ReturnStatement */: return visitReturnStatement(node); - case 233 /* LabeledStatement */: + case 234 /* LabeledStatement */: return visitLabeledStatement(node); - case 188 /* ObjectLiteralExpression */: + case 189 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: return visitBinaryExpression(node, noDestructuringValue); - case 237 /* VariableDeclaration */: + case 275 /* CatchClause */: + return visitCatchClause(node); + case 238 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 227 /* ForOfStatement */: + case 228 /* ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 225 /* ForStatement */: + case 226 /* ForStatement */: return visitForStatement(node); - case 200 /* VoidExpression */: + case 201 /* VoidExpression */: return visitVoidExpression(node); - case 157 /* Constructor */: + case 158 /* Constructor */: return visitConstructorDeclaration(node); - case 156 /* MethodDeclaration */: + case 157 /* MethodDeclaration */: return visitMethodDeclaration(node); - case 158 /* GetAccessor */: + case 159 /* GetAccessor */: return visitGetAccessorDeclaration(node); - case 159 /* SetAccessor */: + case 160 /* SetAccessor */: return visitSetAccessorDeclaration(node); - case 239 /* FunctionDeclaration */: + case 240 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 196 /* FunctionExpression */: + case 197 /* FunctionExpression */: return visitFunctionExpression(node); - case 197 /* ArrowFunction */: + case 198 /* ArrowFunction */: return visitArrowFunction(node); - case 151 /* Parameter */: + case 152 /* Parameter */: return visitParameter(node); - case 221 /* ExpressionStatement */: + case 222 /* ExpressionStatement */: return visitExpressionStatement(node); - case 195 /* ParenthesizedExpression */: + case 196 /* ParenthesizedExpression */: return visitParenthesizedExpression(node, noDestructuringValue); - case 189 /* PropertyAccessExpression */: - if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 98 /* SuperKeyword */) { + case 190 /* PropertyAccessExpression */: + if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 99 /* SuperKeyword */) { capturedSuperProperties.set(node.name.escapedText, true); } return ts.visitEachChild(node, visitor, context); - case 190 /* ElementAccessExpression */: - if (capturedSuperProperties && node.expression.kind === 98 /* SuperKeyword */) { + case 191 /* ElementAccessExpression */: + if (capturedSuperProperties && node.expression.kind === 99 /* SuperKeyword */) { hasSuperElementAccess = true; } return ts.visitEachChild(node, visitor, context); @@ -70889,7 +71731,7 @@ var ts; function visitLabeledStatement(node) { if (enclosingFunctionFlags & 2 /* Async */) { var statement = ts.unwrapInnermostStatementOfLabel(node); - if (statement.kind === 227 /* ForOfStatement */ && statement.awaitModifier) { + if (statement.kind === 228 /* ForOfStatement */ && statement.awaitModifier) { return visitForOfStatement(statement, node); } return ts.restoreEnclosingLabel(ts.visitEachChild(statement, visitor, context), node); @@ -70901,7 +71743,7 @@ var ts; var objects = []; for (var _i = 0, elements_4 = elements; _i < elements_4.length; _i++) { var e = elements_4[_i]; - if (e.kind === 277 /* SpreadAssignment */) { + if (e.kind === 278 /* SpreadAssignment */) { if (chunkObject) { objects.push(ts.createObjectLiteral(chunkObject)); chunkObject = undefined; @@ -70910,7 +71752,7 @@ var ts; objects.push(ts.visitNode(target, visitor, ts.isExpression)); } else { - chunkObject = ts.append(chunkObject, e.kind === 275 /* PropertyAssignment */ + chunkObject = ts.append(chunkObject, e.kind === 276 /* PropertyAssignment */ ? ts.createPropertyAssignment(e.name, ts.visitNode(e.initializer, visitor, ts.isExpression)) : ts.visitNode(e, visitor, ts.isObjectLiteralElementLike)); } @@ -70928,7 +71770,7 @@ var ts; // If the first element is a spread element, then the first argument to __assign is {}: // { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2) var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 188 /* ObjectLiteralExpression */) { + if (objects.length && objects[0].kind !== 189 /* ObjectLiteralExpression */) { objects.unshift(ts.createObjectLiteral()); } return createAssignHelper(context, objects); @@ -70955,6 +71797,23 @@ var ts; } return ts.visitEachChild(node, visitor, context); } + function visitCatchClause(node) { + if (node.variableDeclaration && + ts.isBindingPattern(node.variableDeclaration.name) && + node.variableDeclaration.name.transformFlags & 8192 /* ContainsObjectRestOrSpread */) { + var name = ts.getGeneratedNameForNode(node.variableDeclaration.name); + var updatedDecl = ts.updateVariableDeclaration(node.variableDeclaration, node.variableDeclaration.name, /*type*/ undefined, name); + var visitedBindings = ts.flattenDestructuringBinding(updatedDecl, visitor, context, 1 /* ObjectRest */); + var block = ts.visitNode(node.block, visitor, ts.isBlock); + if (ts.some(visitedBindings)) { + block = ts.updateBlock(block, [ + ts.createVariableStatement(/*modifiers*/ undefined, visitedBindings) + ].concat(block.statements)); + } + return ts.updateCatchClause(node, ts.updateVariableDeclaration(node.variableDeclaration, name, /*type*/ undefined, /*initializer*/ undefined), block); + } + return ts.visitEachChild(node, visitor, context); + } /** * Visits a VariableDeclaration node with a binding pattern. * @@ -71247,17 +72106,17 @@ var ts; enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(191 /* CallExpression */); - context.enableSubstitution(189 /* PropertyAccessExpression */); - context.enableSubstitution(190 /* ElementAccessExpression */); + context.enableSubstitution(192 /* CallExpression */); + context.enableSubstitution(190 /* PropertyAccessExpression */); + context.enableSubstitution(191 /* ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(240 /* ClassDeclaration */); - context.enableEmitNotification(156 /* MethodDeclaration */); - context.enableEmitNotification(158 /* GetAccessor */); - context.enableEmitNotification(159 /* SetAccessor */); - context.enableEmitNotification(157 /* Constructor */); + context.enableEmitNotification(241 /* ClassDeclaration */); + context.enableEmitNotification(157 /* MethodDeclaration */); + context.enableEmitNotification(159 /* GetAccessor */); + context.enableEmitNotification(160 /* SetAccessor */); + context.enableEmitNotification(158 /* Constructor */); // We need to be notified when entering the generated accessor arrow functions. - context.enableEmitNotification(219 /* VariableStatement */); + context.enableEmitNotification(220 /* VariableStatement */); } } /** @@ -71305,23 +72164,23 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 189 /* PropertyAccessExpression */: + case 190 /* PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 190 /* ElementAccessExpression */: + case 191 /* ElementAccessExpression */: return substituteElementAccessExpression(node); - case 191 /* CallExpression */: + case 192 /* CallExpression */: return substituteCallExpression(node); } return node; } function substitutePropertyAccessExpression(node) { - if (node.expression.kind === 98 /* SuperKeyword */) { + if (node.expression.kind === 99 /* SuperKeyword */) { return ts.setTextRange(ts.createPropertyAccess(ts.createFileLevelUniqueName("_super"), node.name), node); } return node; } function substituteElementAccessExpression(node) { - if (node.expression.kind === 98 /* SuperKeyword */) { + if (node.expression.kind === 99 /* SuperKeyword */) { return createSuperElementAccessInAsyncMethod(node.argumentExpression, node); } return node; @@ -71341,11 +72200,11 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 240 /* ClassDeclaration */ - || kind === 157 /* Constructor */ - || kind === 156 /* MethodDeclaration */ - || kind === 158 /* GetAccessor */ - || kind === 159 /* SetAccessor */; + return kind === 241 /* ClassDeclaration */ + || kind === 158 /* Constructor */ + || kind === 157 /* MethodDeclaration */ + || kind === 159 /* GetAccessor */ + || kind === 160 /* SetAccessor */; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { if (enclosingSuperContainerFlags & 4096 /* AsyncMethodWithSuperBinding */) { @@ -71439,7 +72298,7 @@ var ts; return node; } switch (node.kind) { - case 274 /* CatchClause */: + case 275 /* CatchClause */: return visitCatchClause(node); default: return ts.visitEachChild(node, visitor, context); @@ -71508,13 +72367,13 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 260 /* JsxElement */: + case 261 /* JsxElement */: return visitJsxElement(node, /*isChild*/ false); - case 261 /* JsxSelfClosingElement */: + case 262 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ false); - case 264 /* JsxFragment */: + case 265 /* JsxFragment */: return visitJsxFragment(node, /*isChild*/ false); - case 270 /* JsxExpression */: + case 271 /* JsxExpression */: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -71524,13 +72383,13 @@ var ts; switch (node.kind) { case 11 /* JsxText */: return visitJsxText(node); - case 270 /* JsxExpression */: + case 271 /* JsxExpression */: return visitJsxExpression(node); - case 260 /* JsxElement */: + case 261 /* JsxElement */: return visitJsxElement(node, /*isChild*/ true); - case 261 /* JsxSelfClosingElement */: + case 262 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ true); - case 264 /* JsxFragment */: + case 265 /* JsxFragment */: return visitJsxFragment(node, /*isChild*/ true); default: return ts.Debug.failBadSyntaxKind(node); @@ -71605,7 +72464,7 @@ var ts; literal.singleQuote = node.singleQuote !== undefined ? node.singleQuote : !ts.isStringDoubleQuoted(node, currentSourceFile); return ts.setTextRange(literal, node); } - else if (node.kind === 270 /* JsxExpression */) { + else if (node.kind === 271 /* JsxExpression */) { if (node.expression === undefined) { return ts.createTrue(); } @@ -71699,7 +72558,7 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 260 /* JsxElement */) { + if (node.kind === 261 /* JsxElement */) { return getTagName(node.openingElement); } else { @@ -72005,7 +72864,7 @@ var ts; return node; } switch (node.kind) { - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -72013,7 +72872,7 @@ var ts; } function visitBinaryExpression(node) { switch (node.operatorToken.kind) { - case 63 /* AsteriskAsteriskEqualsToken */: + case 64 /* AsteriskAsteriskEqualsToken */: return visitExponentiationAssignmentExpression(node); case 41 /* AsteriskAsteriskToken */: return visitExponentiationExpression(node); @@ -72098,62 +72957,63 @@ var ts; HierarchyFacts[HierarchyFacts["Block"] = 128] = "Block"; HierarchyFacts[HierarchyFacts["IterationStatement"] = 256] = "IterationStatement"; HierarchyFacts[HierarchyFacts["IterationStatementBlock"] = 512] = "IterationStatementBlock"; - HierarchyFacts[HierarchyFacts["ForStatement"] = 1024] = "ForStatement"; - HierarchyFacts[HierarchyFacts["ForInOrForOfStatement"] = 2048] = "ForInOrForOfStatement"; - HierarchyFacts[HierarchyFacts["ConstructorWithCapturedSuper"] = 4096] = "ConstructorWithCapturedSuper"; + HierarchyFacts[HierarchyFacts["IterationContainer"] = 1024] = "IterationContainer"; + HierarchyFacts[HierarchyFacts["ForStatement"] = 2048] = "ForStatement"; + HierarchyFacts[HierarchyFacts["ForInOrForOfStatement"] = 4096] = "ForInOrForOfStatement"; + HierarchyFacts[HierarchyFacts["ConstructorWithCapturedSuper"] = 8192] = "ConstructorWithCapturedSuper"; // NOTE: do not add more ancestor flags without also updating AncestorFactsMask below. // NOTE: when adding a new ancestor flag, be sure to update the subtree flags below. // // Ancestor masks // - HierarchyFacts[HierarchyFacts["AncestorFactsMask"] = 8191] = "AncestorFactsMask"; + HierarchyFacts[HierarchyFacts["AncestorFactsMask"] = 16383] = "AncestorFactsMask"; // We are always in *some* kind of block scope, but only specific block-scope containers are // top-level or Blocks. HierarchyFacts[HierarchyFacts["BlockScopeIncludes"] = 0] = "BlockScopeIncludes"; - HierarchyFacts[HierarchyFacts["BlockScopeExcludes"] = 4032] = "BlockScopeExcludes"; + HierarchyFacts[HierarchyFacts["BlockScopeExcludes"] = 7104] = "BlockScopeExcludes"; // A source file is a top-level block scope. HierarchyFacts[HierarchyFacts["SourceFileIncludes"] = 64] = "SourceFileIncludes"; - HierarchyFacts[HierarchyFacts["SourceFileExcludes"] = 3968] = "SourceFileExcludes"; + HierarchyFacts[HierarchyFacts["SourceFileExcludes"] = 8064] = "SourceFileExcludes"; // Functions, methods, and accessors are both new lexical scopes and new block scopes. HierarchyFacts[HierarchyFacts["FunctionIncludes"] = 65] = "FunctionIncludes"; - HierarchyFacts[HierarchyFacts["FunctionExcludes"] = 8094] = "FunctionExcludes"; + HierarchyFacts[HierarchyFacts["FunctionExcludes"] = 16286] = "FunctionExcludes"; HierarchyFacts[HierarchyFacts["AsyncFunctionBodyIncludes"] = 69] = "AsyncFunctionBodyIncludes"; - HierarchyFacts[HierarchyFacts["AsyncFunctionBodyExcludes"] = 8086] = "AsyncFunctionBodyExcludes"; + HierarchyFacts[HierarchyFacts["AsyncFunctionBodyExcludes"] = 16278] = "AsyncFunctionBodyExcludes"; // Arrow functions are lexically scoped to their container, but are new block scopes. HierarchyFacts[HierarchyFacts["ArrowFunctionIncludes"] = 66] = "ArrowFunctionIncludes"; - HierarchyFacts[HierarchyFacts["ArrowFunctionExcludes"] = 8064] = "ArrowFunctionExcludes"; + HierarchyFacts[HierarchyFacts["ArrowFunctionExcludes"] = 15232] = "ArrowFunctionExcludes"; // Constructors are both new lexical scopes and new block scopes. Constructors are also // always considered non-static members of a class. HierarchyFacts[HierarchyFacts["ConstructorIncludes"] = 73] = "ConstructorIncludes"; - HierarchyFacts[HierarchyFacts["ConstructorExcludes"] = 8086] = "ConstructorExcludes"; + HierarchyFacts[HierarchyFacts["ConstructorExcludes"] = 16278] = "ConstructorExcludes"; // 'do' and 'while' statements are not block scopes. We track that the subtree is contained // within an IterationStatement to indicate whether the embedded statement is an // IterationStatementBlock. - HierarchyFacts[HierarchyFacts["DoOrWhileStatementIncludes"] = 256] = "DoOrWhileStatementIncludes"; + HierarchyFacts[HierarchyFacts["DoOrWhileStatementIncludes"] = 1280] = "DoOrWhileStatementIncludes"; HierarchyFacts[HierarchyFacts["DoOrWhileStatementExcludes"] = 0] = "DoOrWhileStatementExcludes"; // 'for' statements are new block scopes and have special handling for 'let' declarations. - HierarchyFacts[HierarchyFacts["ForStatementIncludes"] = 1280] = "ForStatementIncludes"; - HierarchyFacts[HierarchyFacts["ForStatementExcludes"] = 3008] = "ForStatementExcludes"; + HierarchyFacts[HierarchyFacts["ForStatementIncludes"] = 3328] = "ForStatementIncludes"; + HierarchyFacts[HierarchyFacts["ForStatementExcludes"] = 5056] = "ForStatementExcludes"; // 'for-in' and 'for-of' statements are new block scopes and have special handling for // 'let' declarations. - HierarchyFacts[HierarchyFacts["ForInOrForOfStatementIncludes"] = 2304] = "ForInOrForOfStatementIncludes"; - HierarchyFacts[HierarchyFacts["ForInOrForOfStatementExcludes"] = 1984] = "ForInOrForOfStatementExcludes"; + HierarchyFacts[HierarchyFacts["ForInOrForOfStatementIncludes"] = 5376] = "ForInOrForOfStatementIncludes"; + HierarchyFacts[HierarchyFacts["ForInOrForOfStatementExcludes"] = 3008] = "ForInOrForOfStatementExcludes"; // Blocks (other than function bodies) are new block scopes. HierarchyFacts[HierarchyFacts["BlockIncludes"] = 128] = "BlockIncludes"; - HierarchyFacts[HierarchyFacts["BlockExcludes"] = 3904] = "BlockExcludes"; + HierarchyFacts[HierarchyFacts["BlockExcludes"] = 6976] = "BlockExcludes"; HierarchyFacts[HierarchyFacts["IterationStatementBlockIncludes"] = 512] = "IterationStatementBlockIncludes"; - HierarchyFacts[HierarchyFacts["IterationStatementBlockExcludes"] = 4032] = "IterationStatementBlockExcludes"; + HierarchyFacts[HierarchyFacts["IterationStatementBlockExcludes"] = 7104] = "IterationStatementBlockExcludes"; // // Subtree facts // - HierarchyFacts[HierarchyFacts["NewTarget"] = 8192] = "NewTarget"; - HierarchyFacts[HierarchyFacts["CapturedLexicalThis"] = 16384] = "CapturedLexicalThis"; + HierarchyFacts[HierarchyFacts["NewTarget"] = 16384] = "NewTarget"; + HierarchyFacts[HierarchyFacts["CapturedLexicalThis"] = 32768] = "CapturedLexicalThis"; // // Subtree masks // - HierarchyFacts[HierarchyFacts["SubtreeFactsMask"] = -8192] = "SubtreeFactsMask"; + HierarchyFacts[HierarchyFacts["SubtreeFactsMask"] = -16384] = "SubtreeFactsMask"; HierarchyFacts[HierarchyFacts["ArrowFunctionSubtreeExcludes"] = 0] = "ArrowFunctionSubtreeExcludes"; - HierarchyFacts[HierarchyFacts["FunctionSubtreeExcludes"] = 24576] = "FunctionSubtreeExcludes"; + HierarchyFacts[HierarchyFacts["FunctionSubtreeExcludes"] = 49152] = "FunctionSubtreeExcludes"; })(HierarchyFacts || (HierarchyFacts = {})); function transformES2015(context) { var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; @@ -72202,7 +73062,7 @@ var ts; */ function enterSubtree(excludeFacts, includeFacts) { var ancestorFacts = hierarchyFacts; - hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & 8191 /* AncestorFactsMask */; + hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & 16383 /* AncestorFactsMask */; return ancestorFacts; } /** @@ -72213,17 +73073,17 @@ var ts; * @param includeFacts The new `HierarchyFacts` of the subtree that should be propagated. */ function exitSubtree(ancestorFacts, excludeFacts, includeFacts) { - hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -8192 /* SubtreeFactsMask */ | ancestorFacts; + hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -16384 /* SubtreeFactsMask */ | ancestorFacts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { - return (hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */) !== 0 - && node.kind === 230 /* ReturnStatement */ + return (hierarchyFacts & 8192 /* ConstructorWithCapturedSuper */) !== 0 + && node.kind === 231 /* ReturnStatement */ && !node.expression; } function shouldVisitNode(node) { return (node.transformFlags & 128 /* ContainsES2015 */) !== 0 || convertedLoopState !== undefined - || (hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */ && (ts.isStatement(node) || (node.kind === 218 /* Block */))) + || (hierarchyFacts & 8192 /* ConstructorWithCapturedSuper */ && (ts.isStatement(node) || (node.kind === 219 /* Block */))) || (ts.isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatement(node)) || (ts.getEmitFlags(node) & 33554432 /* TypeScriptClassWrapper */) !== 0; } @@ -72236,72 +73096,72 @@ var ts; } } function callExpressionVisitor(node) { - if (node.kind === 98 /* SuperKeyword */) { + if (node.kind === 99 /* SuperKeyword */) { return visitSuperKeyword(/*isExpressionOfCall*/ true); } return visitor(node); } function visitJavaScript(node) { switch (node.kind) { - case 116 /* StaticKeyword */: + case 117 /* StaticKeyword */: return undefined; // elide static keyword - case 240 /* ClassDeclaration */: + case 241 /* ClassDeclaration */: return visitClassDeclaration(node); - case 209 /* ClassExpression */: + case 210 /* ClassExpression */: return visitClassExpression(node); - case 151 /* Parameter */: + case 152 /* Parameter */: return visitParameter(node); - case 239 /* FunctionDeclaration */: + case 240 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 197 /* ArrowFunction */: + case 198 /* ArrowFunction */: return visitArrowFunction(node); - case 196 /* FunctionExpression */: + case 197 /* FunctionExpression */: return visitFunctionExpression(node); - case 237 /* VariableDeclaration */: + case 238 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 72 /* Identifier */: + case 73 /* Identifier */: return visitIdentifier(node); - case 238 /* VariableDeclarationList */: + case 239 /* VariableDeclarationList */: return visitVariableDeclarationList(node); - case 232 /* SwitchStatement */: + case 233 /* SwitchStatement */: return visitSwitchStatement(node); - case 246 /* CaseBlock */: + case 247 /* CaseBlock */: return visitCaseBlock(node); - case 218 /* Block */: + case 219 /* Block */: return visitBlock(node, /*isFunctionBody*/ false); - case 229 /* BreakStatement */: - case 228 /* ContinueStatement */: + case 230 /* BreakStatement */: + case 229 /* ContinueStatement */: return visitBreakOrContinueStatement(node); - case 233 /* LabeledStatement */: + case 234 /* LabeledStatement */: return visitLabeledStatement(node); - case 223 /* DoStatement */: - case 224 /* WhileStatement */: + case 224 /* DoStatement */: + case 225 /* WhileStatement */: return visitDoOrWhileStatement(node, /*outermostLabeledStatement*/ undefined); - case 225 /* ForStatement */: + case 226 /* ForStatement */: return visitForStatement(node, /*outermostLabeledStatement*/ undefined); - case 226 /* ForInStatement */: + case 227 /* ForInStatement */: return visitForInStatement(node, /*outermostLabeledStatement*/ undefined); - case 227 /* ForOfStatement */: + case 228 /* ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 221 /* ExpressionStatement */: + case 222 /* ExpressionStatement */: return visitExpressionStatement(node); - case 188 /* ObjectLiteralExpression */: + case 189 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 274 /* CatchClause */: + case 275 /* CatchClause */: return visitCatchClause(node); - case 276 /* ShorthandPropertyAssignment */: + case 277 /* ShorthandPropertyAssignment */: return visitShorthandPropertyAssignment(node); - case 149 /* ComputedPropertyName */: + case 150 /* ComputedPropertyName */: return visitComputedPropertyName(node); - case 187 /* ArrayLiteralExpression */: + case 188 /* ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 191 /* CallExpression */: + case 192 /* CallExpression */: return visitCallExpression(node); - case 192 /* NewExpression */: + case 193 /* NewExpression */: return visitNewExpression(node); - case 195 /* ParenthesizedExpression */: + case 196 /* ParenthesizedExpression */: return visitParenthesizedExpression(node, /*needsDestructuringValue*/ true); - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: return visitBinaryExpression(node, /*needsDestructuringValue*/ true); case 14 /* NoSubstitutionTemplateLiteral */: case 15 /* TemplateHead */: @@ -72312,35 +73172,35 @@ var ts; return visitStringLiteral(node); case 8 /* NumericLiteral */: return visitNumericLiteral(node); - case 193 /* TaggedTemplateExpression */: + case 194 /* TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 206 /* TemplateExpression */: + case 207 /* TemplateExpression */: return visitTemplateExpression(node); - case 207 /* YieldExpression */: + case 208 /* YieldExpression */: return visitYieldExpression(node); - case 208 /* SpreadElement */: + case 209 /* SpreadElement */: return visitSpreadElement(node); - case 98 /* SuperKeyword */: + case 99 /* SuperKeyword */: return visitSuperKeyword(/*isExpressionOfCall*/ false); - case 100 /* ThisKeyword */: + case 101 /* ThisKeyword */: return visitThisKeyword(node); - case 214 /* MetaProperty */: + case 215 /* MetaProperty */: return visitMetaProperty(node); - case 156 /* MethodDeclaration */: + case 157 /* MethodDeclaration */: return visitMethodDeclaration(node); - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: return visitAccessorDeclaration(node); - case 219 /* VariableStatement */: + case 220 /* VariableStatement */: return visitVariableStatement(node); - case 230 /* ReturnStatement */: + case 231 /* ReturnStatement */: return visitReturnStatement(node); default: return ts.visitEachChild(node, visitor, context); } } function visitSourceFile(node) { - var ancestorFacts = enterSubtree(3968 /* SourceFileExcludes */, 64 /* SourceFileIncludes */); + var ancestorFacts = enterSubtree(8064 /* SourceFileExcludes */, 64 /* SourceFileIncludes */); var prologue = []; var statements = []; startLexicalEnvironment(); @@ -72367,7 +73227,7 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitCaseBlock(node) { - var ancestorFacts = enterSubtree(4032 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */); + var ancestorFacts = enterSubtree(7104 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */); var updated = ts.visitEachChild(node, visitor, context); exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); return updated; @@ -72394,7 +73254,7 @@ var ts; } function visitThisKeyword(node) { if (hierarchyFacts & 2 /* ArrowFunction */) { - hierarchyFacts |= 16384 /* CapturedLexicalThis */; + hierarchyFacts |= 32768 /* CapturedLexicalThis */; } if (convertedLoopState) { if (hierarchyFacts & 2 /* ArrowFunction */) { @@ -72424,14 +73284,14 @@ var ts; // it is possible if either // - break/continue is labeled and label is located inside the converted loop // - break/continue is non-labeled and located in non-converted loop/switch statement - var jump = node.kind === 229 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; + var jump = node.kind === 230 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(ts.idText(node.label))) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; var label = node.label; if (!label) { - if (node.kind === 229 /* BreakStatement */) { + if (node.kind === 230 /* BreakStatement */) { convertedLoopState.nonLocalJumps |= 2 /* Break */; labelMarker = "break"; } @@ -72442,7 +73302,7 @@ var ts; } } else { - if (node.kind === 229 /* BreakStatement */) { + if (node.kind === 230 /* BreakStatement */) { labelMarker = "break-" + label.escapedText; setLabeledJump(convertedLoopState, /*isBreak*/ true, ts.idText(label), labelMarker); } @@ -72637,7 +73497,7 @@ var ts; function addConstructor(statements, node, extendsClauseElement) { var savedConvertedLoopState = convertedLoopState; convertedLoopState = undefined; - var ancestorFacts = enterSubtree(8086 /* ConstructorExcludes */, 73 /* ConstructorIncludes */); + var ancestorFacts = enterSubtree(16278 /* ConstructorExcludes */, 73 /* ConstructorIncludes */); var constructor = ts.getFirstConstructorWithBody(node); var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined); var constructorFunction = ts.createFunctionDeclaration( @@ -72651,7 +73511,7 @@ var ts; ts.setEmitFlags(constructorFunction, 8 /* CapturesThis */); } statements.push(constructorFunction); - exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */); + exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */); convertedLoopState = savedConvertedLoopState; } /** @@ -72700,7 +73560,7 @@ var ts; function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) { // determine whether the class is known syntactically to be a derived class (e.g. a // class that extends a value that is not syntactically known to be `null`). - var isDerivedClass = !!extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 96 /* NullKeyword */; + var isDerivedClass = !!extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 97 /* NullKeyword */; // When the subclass does not have a constructor, we synthesize a *default* constructor using the following // representation: // @@ -72744,7 +73604,7 @@ var ts; } } if (superCallExpression) { - hierarchyFacts |= 4096 /* ConstructorWithCapturedSuper */; + hierarchyFacts |= 8192 /* ConstructorWithCapturedSuper */; statementOffset++; // skip this statement, we will add it after visiting the rest of the body. } // visit the remaining statements @@ -72838,11 +73698,11 @@ var ts; */ function isSufficientlyCoveredByReturnStatements(statement) { // A return statement is considered covered. - if (statement.kind === 230 /* ReturnStatement */) { + if (statement.kind === 231 /* ReturnStatement */) { return true; } // An if-statement with two covered branches is covered. - else if (statement.kind === 222 /* IfStatement */) { + else if (statement.kind === 223 /* IfStatement */) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && @@ -72850,7 +73710,7 @@ var ts; } } // A block is covered if it has a last statement which is covered. - else if (statement.kind === 218 /* Block */) { + else if (statement.kind === 219 /* Block */) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -73005,10 +73865,10 @@ var ts; return false; } // `declarationName` is the name of the local declaration for the parameter. - var declarationName = parameter.name.kind === 72 /* Identifier */ ? ts.getMutableClone(parameter.name) : ts.createTempVariable(/*recordTempVariable*/ undefined); + var declarationName = parameter.name.kind === 73 /* Identifier */ ? ts.getMutableClone(parameter.name) : ts.createTempVariable(/*recordTempVariable*/ undefined); ts.setEmitFlags(declarationName, 48 /* NoSourceMap */); // `expressionName` is the name of the parameter used in expressions. - var expressionName = parameter.name.kind === 72 /* Identifier */ ? ts.getSynthesizedClone(parameter.name) : declarationName; + var expressionName = parameter.name.kind === 73 /* Identifier */ ? ts.getSynthesizedClone(parameter.name) : declarationName; var restIndex = node.parameters.length - 1; var temp = ts.createLoopVariable(); // var param = []; @@ -73032,7 +73892,7 @@ var ts; ts.setEmitFlags(forStatement, 1048576 /* CustomPrologue */); ts.startOnNewLine(forStatement); prologueStatements.push(forStatement); - if (parameter.name.kind !== 72 /* Identifier */) { + if (parameter.name.kind !== 73 /* Identifier */) { // do the actual destructuring of the rest parameter if necessary prologueStatements.push(ts.setEmitFlags(ts.setTextRange(ts.createVariableStatement( /*modifiers*/ undefined, ts.createVariableDeclarationList(ts.flattenDestructuringBinding(parameter, visitor, context, 0 /* All */, expressionName))), parameter), 1048576 /* CustomPrologue */)); @@ -73048,7 +73908,7 @@ var ts; * @param node A node. */ function insertCaptureThisForNodeIfNeeded(statements, node) { - if (hierarchyFacts & 16384 /* CapturedLexicalThis */ && node.kind !== 197 /* ArrowFunction */) { + if (hierarchyFacts & 32768 /* CapturedLexicalThis */ && node.kind !== 198 /* ArrowFunction */) { insertCaptureThisForNode(statements, node, ts.createThis()); return true; } @@ -73066,28 +73926,28 @@ var ts; ts.insertStatementAfterCustomPrologue(statements, captureThisStatement); } function insertCaptureNewTargetIfNeeded(statements, node, copyOnWrite) { - if (hierarchyFacts & 8192 /* NewTarget */) { + if (hierarchyFacts & 16384 /* NewTarget */) { var newTarget = void 0; switch (node.kind) { - case 197 /* ArrowFunction */: + case 198 /* ArrowFunction */: return statements; - case 156 /* MethodDeclaration */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 157 /* MethodDeclaration */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: // Methods and accessors cannot be constructors, so 'new.target' will // always return 'undefined'. newTarget = ts.createVoidZero(); break; - case 157 /* Constructor */: + case 158 /* Constructor */: // Class constructors can only be called with `new`, so `this.constructor` // should be relatively safe to use. newTarget = ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"); break; - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: // Functions can be called or constructed, and may have a `this` due to // being a member or when calling an imported function via `other_1.f()`. - newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), 94 /* InstanceOfKeyword */, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"), ts.createVoidZero()); + newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), 95 /* InstanceOfKeyword */, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"), ts.createVoidZero()); break; default: return ts.Debug.failBadSyntaxKind(node); @@ -73116,20 +73976,20 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 217 /* SemicolonClassElement */: + case 218 /* SemicolonClassElement */: statements.push(transformSemicolonClassElementToStatement(member)); break; - case 156 /* MethodDeclaration */: + case 157 /* MethodDeclaration */: statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; - case 157 /* Constructor */: + case 158 /* Constructor */: // Constructors are handled in visitClassExpression/visitClassDeclaration break; default: @@ -73196,7 +74056,7 @@ var ts; // arguments are both mapped contiguously to the accessor name. var target = ts.getMutableClone(receiver); ts.setEmitFlags(target, 1536 /* NoComments */ | 32 /* NoTrailingSourceMap */); - ts.setSourceMapRange(target, firstAccessor.name); // TODO: GH#18217 + ts.setSourceMapRange(target, firstAccessor.name); var propertyName = ts.createExpressionForPropertyName(ts.visitNode(firstAccessor.name, visitor, ts.isPropertyName)); ts.setEmitFlags(propertyName, 1536 /* NoComments */ | 16 /* NoLeadingSourceMap */); ts.setSourceMapRange(propertyName, firstAccessor.name); @@ -73236,11 +74096,11 @@ var ts; */ function visitArrowFunction(node) { if (node.transformFlags & 2048 /* ContainsLexicalThis */) { - hierarchyFacts |= 16384 /* CapturedLexicalThis */; + hierarchyFacts |= 32768 /* CapturedLexicalThis */; } var savedConvertedLoopState = convertedLoopState; convertedLoopState = undefined; - var ancestorFacts = enterSubtree(8064 /* ArrowFunctionExcludes */, 66 /* ArrowFunctionIncludes */); + var ancestorFacts = enterSubtree(15232 /* ArrowFunctionExcludes */, 66 /* ArrowFunctionIncludes */); var func = ts.createFunctionExpression( /*modifiers*/ undefined, /*asteriskToken*/ undefined, @@ -73250,7 +74110,7 @@ var ts; ts.setTextRange(func, node); ts.setOriginalNode(func, node); ts.setEmitFlags(func, 8 /* CapturesThis */); - if (hierarchyFacts & 16384 /* CapturedLexicalThis */) { + if (hierarchyFacts & 32768 /* CapturedLexicalThis */) { enableSubstitutionsForCapturedThis(); } // If an arrow function contains @@ -73265,16 +74125,16 @@ var ts; */ function visitFunctionExpression(node) { var ancestorFacts = ts.getEmitFlags(node) & 262144 /* AsyncFunctionBody */ - ? enterSubtree(8086 /* AsyncFunctionBodyExcludes */, 69 /* AsyncFunctionBodyIncludes */) - : enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */); + ? enterSubtree(16278 /* AsyncFunctionBodyExcludes */, 69 /* AsyncFunctionBodyIncludes */) + : enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */); var savedConvertedLoopState = convertedLoopState; convertedLoopState = undefined; var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - var name = hierarchyFacts & 8192 /* NewTarget */ + var name = hierarchyFacts & 16384 /* NewTarget */ ? ts.getLocalName(node) : node.name; - exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */); + exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */); convertedLoopState = savedConvertedLoopState; return ts.updateFunctionExpression(node, /*modifiers*/ undefined, node.asteriskToken, name, @@ -73289,13 +74149,13 @@ var ts; function visitFunctionDeclaration(node) { var savedConvertedLoopState = convertedLoopState; convertedLoopState = undefined; - var ancestorFacts = enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */); + var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */); var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - var name = hierarchyFacts & 8192 /* NewTarget */ + var name = hierarchyFacts & 16384 /* NewTarget */ ? ts.getLocalName(node) : node.name; - exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */); + exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */); convertedLoopState = savedConvertedLoopState; return ts.updateFunctionDeclaration(node, /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, name, @@ -73313,14 +74173,14 @@ var ts; var savedConvertedLoopState = convertedLoopState; convertedLoopState = undefined; var ancestorFacts = container && ts.isClassLike(container) && !ts.hasModifier(node, 32 /* Static */) - ? enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */ | 8 /* NonStaticClassElement */) - : enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */); + ? enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */ | 8 /* NonStaticClassElement */) + : enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */); var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (hierarchyFacts & 8192 /* NewTarget */ && !name && (node.kind === 239 /* FunctionDeclaration */ || node.kind === 196 /* FunctionExpression */)) { + if (hierarchyFacts & 16384 /* NewTarget */ && !name && (node.kind === 240 /* FunctionDeclaration */ || node.kind === 197 /* FunctionExpression */)) { name = ts.getGeneratedNameForNode(node); } - exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */); + exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */); convertedLoopState = savedConvertedLoopState; return ts.setOriginalNode(ts.setTextRange(ts.createFunctionExpression( /*modifiers*/ undefined, node.asteriskToken, name, @@ -73361,7 +74221,7 @@ var ts; } } else { - ts.Debug.assert(node.kind === 197 /* ArrowFunction */); + ts.Debug.assert(node.kind === 198 /* ArrowFunction */); // To align with the old emitter, we use a synthetic end position on the location // for the statement list we synthesize when we down-level an arrow function with // an expression function body. This prevents both comments and source maps from @@ -73415,8 +74275,8 @@ var ts; return ts.visitEachChild(node, visitor, context); } var ancestorFacts = hierarchyFacts & 256 /* IterationStatement */ - ? enterSubtree(4032 /* IterationStatementBlockExcludes */, 512 /* IterationStatementBlockIncludes */) - : enterSubtree(3904 /* BlockExcludes */, 128 /* BlockIncludes */); + ? enterSubtree(7104 /* IterationStatementBlockExcludes */, 512 /* IterationStatementBlockIncludes */) + : enterSubtree(6976 /* BlockExcludes */, 128 /* BlockIncludes */); var updated = ts.visitEachChild(node, visitor, context); exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); return updated; @@ -73429,9 +74289,9 @@ var ts; function visitExpressionStatement(node) { // If we are here it is most likely because our expression is a destructuring assignment. switch (node.expression.kind) { - case 195 /* ParenthesizedExpression */: + case 196 /* ParenthesizedExpression */: return ts.updateExpressionStatement(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false)); - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: return ts.updateExpressionStatement(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false)); } return ts.visitEachChild(node, visitor, context); @@ -73450,9 +74310,9 @@ var ts; // expression. If we are in a state where we do not need the destructuring value, // we pass that information along to the children that care about it. switch (node.expression.kind) { - case 195 /* ParenthesizedExpression */: + case 196 /* ParenthesizedExpression */: return ts.updateParen(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false)); - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: return ts.updateParen(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false)); } } @@ -73487,7 +74347,7 @@ var ts; assignment = ts.flattenDestructuringAssignment(decl, visitor, context, 0 /* All */); } else { - assignment = ts.createBinary(decl.name, 59 /* EqualsToken */, ts.visitNode(decl.initializer, visitor, ts.isExpression)); + assignment = ts.createBinary(decl.name, 60 /* EqualsToken */, ts.visitNode(decl.initializer, visitor, ts.isExpression)); ts.setTextRange(assignment, decl); } assignments = ts.append(assignments, assignment); @@ -73599,11 +74459,11 @@ var ts; && isDeclaredInLoop && (hierarchyFacts & 512 /* IterationStatementBlock */) !== 0); var emitExplicitInitializer = !emittedAsTopLevel - && (hierarchyFacts & 2048 /* ForInOrForOfStatement */) === 0 + && (hierarchyFacts & 4096 /* ForInOrForOfStatement */) === 0 && (!resolver.isDeclarationWithCollidingName(node) || (isDeclaredInLoop && !isCapturedInFunction - && (hierarchyFacts & (1024 /* ForStatement */ | 2048 /* ForInOrForOfStatement */)) === 0)); + && (hierarchyFacts & (2048 /* ForStatement */ | 4096 /* ForInOrForOfStatement */)) === 0)); return emitExplicitInitializer; } /** @@ -73661,34 +74521,34 @@ var ts; } function visitIterationStatement(node, outermostLabeledStatement) { switch (node.kind) { - case 223 /* DoStatement */: - case 224 /* WhileStatement */: + case 224 /* DoStatement */: + case 225 /* WhileStatement */: return visitDoOrWhileStatement(node, outermostLabeledStatement); - case 225 /* ForStatement */: + case 226 /* ForStatement */: return visitForStatement(node, outermostLabeledStatement); - case 226 /* ForInStatement */: + case 227 /* ForInStatement */: return visitForInStatement(node, outermostLabeledStatement); - case 227 /* ForOfStatement */: + case 228 /* ForOfStatement */: return visitForOfStatement(node, outermostLabeledStatement); } } function visitIterationStatementWithFacts(excludeFacts, includeFacts, node, outermostLabeledStatement, convert) { var ancestorFacts = enterSubtree(excludeFacts, includeFacts); - var updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert); + var updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, ancestorFacts, convert); exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); return updated; } function visitDoOrWhileStatement(node, outermostLabeledStatement) { - return visitIterationStatementWithFacts(0 /* DoOrWhileStatementExcludes */, 256 /* DoOrWhileStatementIncludes */, node, outermostLabeledStatement); + return visitIterationStatementWithFacts(0 /* DoOrWhileStatementExcludes */, 1280 /* DoOrWhileStatementIncludes */, node, outermostLabeledStatement); } function visitForStatement(node, outermostLabeledStatement) { - return visitIterationStatementWithFacts(3008 /* ForStatementExcludes */, 1280 /* ForStatementIncludes */, node, outermostLabeledStatement); + return visitIterationStatementWithFacts(5056 /* ForStatementExcludes */, 3328 /* ForStatementIncludes */, node, outermostLabeledStatement); } function visitForInStatement(node, outermostLabeledStatement) { - return visitIterationStatementWithFacts(1984 /* ForInOrForOfStatementExcludes */, 2304 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement); + return visitIterationStatementWithFacts(3008 /* ForInOrForOfStatementExcludes */, 5376 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement); } function visitForOfStatement(node, outermostLabeledStatement) { - return visitIterationStatementWithFacts(1984 /* ForInOrForOfStatementExcludes */, 2304 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement, compilerOptions.downlevelIteration ? convertForOfStatementForIterable : convertForOfStatementForArray); + return visitIterationStatementWithFacts(3008 /* ForInOrForOfStatementExcludes */, 5376 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement, compilerOptions.downlevelIteration ? convertForOfStatementForIterable : convertForOfStatementForArray); } function convertForOfStatementHead(node, boundValue, convertedLoopBodyStatements) { var statements = []; @@ -73796,7 +74656,7 @@ var ts; ts.setTextRange(forStatement, node); return ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel); } - function convertForOfStatementForIterable(node, outermostLabeledStatement, convertedLoopBodyStatements) { + function convertForOfStatementForIterable(node, outermostLabeledStatement, convertedLoopBodyStatements, ancestorFacts) { var expression = ts.visitNode(node.expression, visitor, ts.isExpression); var iterator = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(expression) : ts.createTempVariable(/*recordTempVariable*/ undefined); var result = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(iterator) : ts.createTempVariable(/*recordTempVariable*/ undefined); @@ -73807,9 +74667,13 @@ var ts; var next = ts.createCall(ts.createPropertyAccess(iterator, "next"), /*typeArguments*/ undefined, []); hoistVariableDeclaration(errorRecord); hoistVariableDeclaration(returnMethod); + // if we are enclosed in an outer loop ensure we reset 'errorRecord' per each iteration + var initializer = ancestorFacts & 1024 /* IterationContainer */ + ? ts.inlineExpressions([ts.createAssignment(errorRecord, ts.createVoidZero()), values]) + : values; var forStatement = ts.setEmitFlags(ts.setTextRange(ts.createFor( /*initializer*/ ts.setEmitFlags(ts.setTextRange(ts.createVariableDeclarationList([ - ts.setTextRange(ts.createVariableDeclaration(iterator, /*type*/ undefined, values), node.expression), + ts.setTextRange(ts.createVariableDeclaration(iterator, /*type*/ undefined, initializer), node.expression), ts.createVariableDeclaration(result, /*type*/ undefined, next) ]), node.expression), 2097152 /* NoHoisting */), /*condition*/ ts.createLogicalNot(ts.createPropertyAccess(result, "done")), @@ -73852,7 +74716,7 @@ var ts; && i < numInitialPropertiesWithoutYield) { numInitialPropertiesWithoutYield = i; } - if (property.name.kind === 149 /* ComputedPropertyName */) { + if (property.name.kind === 150 /* ComputedPropertyName */) { numInitialProperties = i; break; } @@ -73907,7 +74771,7 @@ var ts; } visit(node.name); function visit(node) { - if (node.kind === 72 /* Identifier */) { + if (node.kind === 73 /* Identifier */) { state.hoistedLocalVariables.push(node); } else { @@ -73920,7 +74784,7 @@ var ts; } } } - function convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert) { + function convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, ancestorFacts, convert) { if (!shouldConvertIterationStatement(node)) { var saveAllowedNonLabeledJumps = void 0; if (convertedLoopState) { @@ -73930,7 +74794,7 @@ var ts; convertedLoopState.allowedNonLabeledJumps = 2 /* Break */ | 4 /* Continue */; } var result = convert - ? convert(node, outermostLabeledStatement, /*convertedLoopBodyStatements*/ undefined) + ? convert(node, outermostLabeledStatement, /*convertedLoopBodyStatements*/ undefined, ancestorFacts) : ts.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), outermostLabeledStatement, convertedLoopState && resetLabel); if (convertedLoopState) { convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps; @@ -73955,7 +74819,7 @@ var ts; var loop; if (bodyFunction) { if (convert) { - loop = convert(node, outermostLabeledStatement, bodyFunction.part); + loop = convert(node, outermostLabeledStatement, bodyFunction.part, ancestorFacts); } else { var clone_3 = convertIterationStatementCore(node, initializerFunction, ts.createBlock(bodyFunction.part, /*multiLine*/ true)); @@ -73973,11 +74837,11 @@ var ts; } function convertIterationStatementCore(node, initializerFunction, convertedLoopBody) { switch (node.kind) { - case 225 /* ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody); - case 226 /* ForInStatement */: return convertForInStatement(node, convertedLoopBody); - case 227 /* ForOfStatement */: return convertForOfStatement(node, convertedLoopBody); - case 223 /* DoStatement */: return convertDoStatement(node, convertedLoopBody); - case 224 /* WhileStatement */: return convertWhileStatement(node, convertedLoopBody); + case 226 /* ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody); + case 227 /* ForInStatement */: return convertForInStatement(node, convertedLoopBody); + case 228 /* ForOfStatement */: return convertForOfStatement(node, convertedLoopBody); + case 224 /* DoStatement */: return convertDoStatement(node, convertedLoopBody); + case 225 /* WhileStatement */: return convertWhileStatement(node, convertedLoopBody); default: return ts.Debug.failBadSyntaxKind(node, "IterationStatement expected"); } } @@ -74002,11 +74866,11 @@ var ts; function createConvertedLoopState(node) { var loopInitializer; switch (node.kind) { - case 225 /* ForStatement */: - case 226 /* ForInStatement */: - case 227 /* ForOfStatement */: + case 226 /* ForStatement */: + case 227 /* ForInStatement */: + case 228 /* ForOfStatement */: var initializer = node.initializer; - if (initializer && initializer.kind === 238 /* VariableDeclarationList */) { + if (initializer && initializer.kind === 239 /* VariableDeclarationList */) { loopInitializer = initializer; } break; @@ -74268,7 +75132,7 @@ var ts; function copyOutParameter(outParam, copyDirection) { var source = copyDirection === 0 /* ToOriginal */ ? outParam.outParamName : outParam.originalName; var target = copyDirection === 0 /* ToOriginal */ ? outParam.originalName : outParam.outParamName; - return ts.createBinary(target, 59 /* EqualsToken */, source); + return ts.createBinary(target, 60 /* EqualsToken */, source); } function copyOutParameters(outParams, partFlags, copyDirection, statements) { for (var _i = 0, outParams_1 = outParams; _i < outParams_1.length; _i++) { @@ -74405,20 +75269,20 @@ var ts; for (var i = start; i < numProperties; i++) { var property = properties[i]; switch (property.kind) { - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { expressions.push(transformAccessorsToExpression(receiver, accessors, node, !!node.multiLine)); } break; - case 156 /* MethodDeclaration */: + case 157 /* MethodDeclaration */: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 275 /* PropertyAssignment */: + case 276 /* PropertyAssignment */: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 276 /* ShorthandPropertyAssignment */: + case 277 /* ShorthandPropertyAssignment */: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -74473,7 +75337,7 @@ var ts; return expression; } function visitCatchClause(node) { - var ancestorFacts = enterSubtree(4032 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */); + var ancestorFacts = enterSubtree(7104 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */); var updated; ts.Debug.assert(!!node.variableDeclaration, "Catch clause variable should always be present when downleveling ES2015."); if (ts.isBindingPattern(node.variableDeclaration.name)) { @@ -74521,17 +75385,17 @@ var ts; ts.Debug.assert(!ts.isComputedPropertyName(node.name)); var savedConvertedLoopState = convertedLoopState; convertedLoopState = undefined; - var ancestorFacts = enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */); + var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */); var updated; var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (node.kind === 158 /* GetAccessor */) { + if (node.kind === 159 /* GetAccessor */) { updated = ts.updateGetAccessor(node, node.decorators, node.modifiers, node.name, parameters, node.type, body); } else { updated = ts.updateSetAccessor(node, node.decorators, node.modifiers, node.name, parameters, body); } - exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */); + exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */); convertedLoopState = savedConvertedLoopState; return updated; } @@ -74578,7 +75442,7 @@ var ts; return visitTypeScriptClassWrapper(node); } var expression = ts.skipOuterExpressions(node.expression); - if (expression.kind === 98 /* SuperKeyword */ || + if (expression.kind === 99 /* SuperKeyword */ || ts.isSuperProperty(expression) || ts.some(node.arguments, ts.isSpreadElement)) { return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ true); @@ -74702,10 +75566,10 @@ var ts; // We are here either because SuperKeyword was used somewhere in the expression, or // because we contain a SpreadElementExpression. if (node.transformFlags & 4096 /* ContainsRestOrSpread */ || - node.expression.kind === 98 /* SuperKeyword */ || + node.expression.kind === 99 /* SuperKeyword */ || ts.isSuperProperty(ts.skipOuterExpressions(node.expression))) { var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; - if (node.expression.kind === 98 /* SuperKeyword */) { + if (node.expression.kind === 99 /* SuperKeyword */) { ts.setEmitFlags(thisArg, 4 /* NoSubstitution */); } var resultingCall = void 0; @@ -74723,7 +75587,7 @@ var ts; // _super.apply(this, a.concat([b])) // _super.m.apply(this, a.concat([b])) // _super.prototype.m.apply(this, a.concat([b])) - resultingCall = ts.createFunctionApply(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 98 /* SuperKeyword */ ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false)); + resultingCall = ts.createFunctionApply(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 99 /* SuperKeyword */ ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false)); } else { // [source] @@ -74735,10 +75599,10 @@ var ts; // _super.call(this, a) // _super.m.call(this, a) // _super.prototype.m.call(this, a) - resultingCall = ts.createFunctionCall(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 98 /* SuperKeyword */ ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), + resultingCall = ts.createFunctionCall(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 99 /* SuperKeyword */ ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), /*location*/ node); } - if (node.expression.kind === 98 /* SuperKeyword */) { + if (node.expression.kind === 99 /* SuperKeyword */) { var initializer = ts.createLogicalOr(resultingCall, createActualThis()); resultingCall = assignToCapturedThis ? ts.createAssignment(ts.createFileLevelUniqueName("_this"), initializer) @@ -74801,7 +75665,7 @@ var ts; else { if (segments.length === 1) { var firstElement = elements[0]; - return needsUniqueCopy && ts.isSpreadElement(firstElement) && firstElement.expression.kind !== 187 /* ArrayLiteralExpression */ + return needsUniqueCopy && ts.isSpreadElement(firstElement) && firstElement.expression.kind !== 188 /* ArrayLiteralExpression */ ? ts.createArraySlice(segments[0]) : segments[0]; } @@ -75016,8 +75880,8 @@ var ts; : ts.createFileLevelUniqueName("_super"); } function visitMetaProperty(node) { - if (node.keywordToken === 95 /* NewKeyword */ && node.name.escapedText === "target") { - hierarchyFacts |= 8192 /* NewTarget */; + if (node.keywordToken === 96 /* NewKeyword */ && node.name.escapedText === "target") { + hierarchyFacts |= 16384 /* NewTarget */; return ts.createFileLevelUniqueName("_newTarget"); } return node; @@ -75032,7 +75896,7 @@ var ts; function onEmitNode(hint, node, emitCallback) { if (enabledSubstitutions & 1 /* CapturedThis */ && ts.isFunctionLike(node)) { // If we are tracking a captured `this`, keep track of the enclosing function. - var ancestorFacts = enterSubtree(8094 /* FunctionExcludes */, ts.getEmitFlags(node) & 8 /* CapturesThis */ + var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, ts.getEmitFlags(node) & 8 /* CapturesThis */ ? 65 /* FunctionIncludes */ | 16 /* CapturesThis */ : 65 /* FunctionIncludes */); previousOnEmitNode(hint, node, emitCallback); @@ -75048,7 +75912,7 @@ var ts; function enableSubstitutionsForBlockScopedBindings() { if ((enabledSubstitutions & 2 /* BlockScopedBindings */) === 0) { enabledSubstitutions |= 2 /* BlockScopedBindings */; - context.enableSubstitution(72 /* Identifier */); + context.enableSubstitution(73 /* Identifier */); } } /** @@ -75058,14 +75922,14 @@ var ts; function enableSubstitutionsForCapturedThis() { if ((enabledSubstitutions & 1 /* CapturedThis */) === 0) { enabledSubstitutions |= 1 /* CapturedThis */; - context.enableSubstitution(100 /* ThisKeyword */); - context.enableEmitNotification(157 /* Constructor */); - context.enableEmitNotification(156 /* MethodDeclaration */); - context.enableEmitNotification(158 /* GetAccessor */); - context.enableEmitNotification(159 /* SetAccessor */); - context.enableEmitNotification(197 /* ArrowFunction */); - context.enableEmitNotification(196 /* FunctionExpression */); - context.enableEmitNotification(239 /* FunctionDeclaration */); + context.enableSubstitution(101 /* ThisKeyword */); + context.enableEmitNotification(158 /* Constructor */); + context.enableEmitNotification(157 /* MethodDeclaration */); + context.enableEmitNotification(159 /* GetAccessor */); + context.enableEmitNotification(160 /* SetAccessor */); + context.enableEmitNotification(198 /* ArrowFunction */); + context.enableEmitNotification(197 /* FunctionExpression */); + context.enableEmitNotification(240 /* FunctionDeclaration */); } } /** @@ -75106,10 +75970,10 @@ var ts; */ function isNameOfDeclarationWithCollidingName(node) { switch (node.parent.kind) { - case 186 /* BindingElement */: - case 240 /* ClassDeclaration */: - case 243 /* EnumDeclaration */: - case 237 /* VariableDeclaration */: + case 187 /* BindingElement */: + case 241 /* ClassDeclaration */: + case 244 /* EnumDeclaration */: + case 238 /* VariableDeclaration */: return node.parent.name === node && resolver.isDeclarationWithCollidingName(node.parent); } @@ -75122,9 +75986,9 @@ var ts; */ function substituteExpression(node) { switch (node.kind) { - case 72 /* Identifier */: + case 73 /* Identifier */: return substituteExpressionIdentifier(node); - case 100 /* ThisKeyword */: + case 101 /* ThisKeyword */: return substituteThisKeyword(node); } return node; @@ -75191,19 +76055,19 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 221 /* ExpressionStatement */) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 222 /* ExpressionStatement */) { return false; } var statementExpression = statement.expression; - if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 191 /* CallExpression */) { + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 192 /* CallExpression */) { return false; } var callTarget = statementExpression.expression; - if (!ts.nodeIsSynthesized(callTarget) || callTarget.kind !== 98 /* SuperKeyword */) { + if (!ts.nodeIsSynthesized(callTarget) || callTarget.kind !== 99 /* SuperKeyword */) { return false; } var callArgument = ts.singleOrUndefined(statementExpression.arguments); - if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 208 /* SpreadElement */) { + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 209 /* SpreadElement */) { return false; } var expression = callArgument.expression; @@ -75256,15 +76120,15 @@ var ts; if (compilerOptions.jsx === 1 /* Preserve */ || compilerOptions.jsx === 3 /* ReactNative */) { previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; - context.enableEmitNotification(262 /* JsxOpeningElement */); - context.enableEmitNotification(263 /* JsxClosingElement */); - context.enableEmitNotification(261 /* JsxSelfClosingElement */); + context.enableEmitNotification(263 /* JsxOpeningElement */); + context.enableEmitNotification(264 /* JsxClosingElement */); + context.enableEmitNotification(262 /* JsxSelfClosingElement */); noSubstitution = []; } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(189 /* PropertyAccessExpression */); - context.enableSubstitution(275 /* PropertyAssignment */); + context.enableSubstitution(190 /* PropertyAccessExpression */); + context.enableSubstitution(276 /* PropertyAssignment */); return ts.chainBundle(transformSourceFile); /** * Transforms an ES5 source file to ES3. @@ -75283,9 +76147,9 @@ var ts; */ function onEmitNode(hint, node, emitCallback) { switch (node.kind) { - case 262 /* JsxOpeningElement */: - case 263 /* JsxClosingElement */: - case 261 /* JsxSelfClosingElement */: + case 263 /* JsxOpeningElement */: + case 264 /* JsxClosingElement */: + case 262 /* JsxSelfClosingElement */: var tagName = node.tagName; noSubstitution[ts.getOriginalNodeId(tagName)] = true; break; @@ -75342,7 +76206,7 @@ var ts; */ function trySubstituteReservedName(name) { var token = name.originalKeywordKind || (ts.nodeIsSynthesized(name) ? ts.stringToToken(ts.idText(name)) : undefined); - if (token !== undefined && token >= 73 /* FirstReservedWord */ && token <= 108 /* LastReservedWord */) { + if (token !== undefined && token >= 74 /* FirstReservedWord */ && token <= 109 /* LastReservedWord */) { return ts.setTextRange(ts.createLiteral(name), name); } return undefined; @@ -75617,13 +76481,13 @@ var ts; */ function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 223 /* DoStatement */: + case 224 /* DoStatement */: return visitDoStatement(node); - case 224 /* WhileStatement */: + case 225 /* WhileStatement */: return visitWhileStatement(node); - case 232 /* SwitchStatement */: + case 233 /* SwitchStatement */: return visitSwitchStatement(node); - case 233 /* LabeledStatement */: + case 234 /* LabeledStatement */: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -75636,24 +76500,24 @@ var ts; */ function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 239 /* FunctionDeclaration */: + case 240 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 196 /* FunctionExpression */: + case 197 /* FunctionExpression */: return visitFunctionExpression(node); - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: return visitAccessorDeclaration(node); - case 219 /* VariableStatement */: + case 220 /* VariableStatement */: return visitVariableStatement(node); - case 225 /* ForStatement */: + case 226 /* ForStatement */: return visitForStatement(node); - case 226 /* ForInStatement */: + case 227 /* ForInStatement */: return visitForInStatement(node); - case 229 /* BreakStatement */: + case 230 /* BreakStatement */: return visitBreakStatement(node); - case 228 /* ContinueStatement */: + case 229 /* ContinueStatement */: return visitContinueStatement(node); - case 230 /* ReturnStatement */: + case 231 /* ReturnStatement */: return visitReturnStatement(node); default: if (node.transformFlags & 131072 /* ContainsYield */) { @@ -75674,21 +76538,21 @@ var ts; */ function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: return visitBinaryExpression(node); - case 205 /* ConditionalExpression */: + case 206 /* ConditionalExpression */: return visitConditionalExpression(node); - case 207 /* YieldExpression */: + case 208 /* YieldExpression */: return visitYieldExpression(node); - case 187 /* ArrayLiteralExpression */: + case 188 /* ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 188 /* ObjectLiteralExpression */: + case 189 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 190 /* ElementAccessExpression */: + case 191 /* ElementAccessExpression */: return visitElementAccessExpression(node); - case 191 /* CallExpression */: + case 192 /* CallExpression */: return visitCallExpression(node); - case 192 /* NewExpression */: + case 193 /* NewExpression */: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -75701,9 +76565,9 @@ var ts; */ function visitGenerator(node) { switch (node.kind) { - case 239 /* FunctionDeclaration */: + case 240 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 196 /* FunctionExpression */: + case 197 /* FunctionExpression */: return visitFunctionExpression(node); default: return ts.Debug.failBadSyntaxKind(node); @@ -75902,23 +76766,23 @@ var ts; } } function isCompoundAssignment(kind) { - return kind >= 60 /* FirstCompoundAssignment */ - && kind <= 71 /* LastCompoundAssignment */; + return kind >= 61 /* FirstCompoundAssignment */ + && kind <= 72 /* LastCompoundAssignment */; } function getOperatorForCompoundAssignment(kind) { switch (kind) { - case 60 /* PlusEqualsToken */: return 38 /* PlusToken */; - case 61 /* MinusEqualsToken */: return 39 /* MinusToken */; - case 62 /* AsteriskEqualsToken */: return 40 /* AsteriskToken */; - case 63 /* AsteriskAsteriskEqualsToken */: return 41 /* AsteriskAsteriskToken */; - case 64 /* SlashEqualsToken */: return 42 /* SlashToken */; - case 65 /* PercentEqualsToken */: return 43 /* PercentToken */; - case 66 /* LessThanLessThanEqualsToken */: return 46 /* LessThanLessThanToken */; - case 67 /* GreaterThanGreaterThanEqualsToken */: return 47 /* GreaterThanGreaterThanToken */; - case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */: return 48 /* GreaterThanGreaterThanGreaterThanToken */; - case 69 /* AmpersandEqualsToken */: return 49 /* AmpersandToken */; - case 70 /* BarEqualsToken */: return 50 /* BarToken */; - case 71 /* CaretEqualsToken */: return 51 /* CaretToken */; + case 61 /* PlusEqualsToken */: return 38 /* PlusToken */; + case 62 /* MinusEqualsToken */: return 39 /* MinusToken */; + case 63 /* AsteriskEqualsToken */: return 40 /* AsteriskToken */; + case 64 /* AsteriskAsteriskEqualsToken */: return 41 /* AsteriskAsteriskToken */; + case 65 /* SlashEqualsToken */: return 42 /* SlashToken */; + case 66 /* PercentEqualsToken */: return 43 /* PercentToken */; + case 67 /* LessThanLessThanEqualsToken */: return 46 /* LessThanLessThanToken */; + case 68 /* GreaterThanGreaterThanEqualsToken */: return 47 /* GreaterThanGreaterThanToken */; + case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */: return 48 /* GreaterThanGreaterThanGreaterThanToken */; + case 70 /* AmpersandEqualsToken */: return 49 /* AmpersandToken */; + case 71 /* BarEqualsToken */: return 50 /* BarToken */; + case 72 /* CaretEqualsToken */: return 51 /* CaretToken */; } } /** @@ -75931,7 +76795,7 @@ var ts; if (containsYield(right)) { var target = void 0; switch (left.kind) { - case 189 /* PropertyAccessExpression */: + case 190 /* PropertyAccessExpression */: // [source] // a.b = yield; // @@ -75943,7 +76807,7 @@ var ts; // _a.b = %sent%; target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; - case 190 /* ElementAccessExpression */: + case 191 /* ElementAccessExpression */: // [source] // a[b] = yield; // @@ -76319,35 +77183,35 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 218 /* Block */: + case 219 /* Block */: return transformAndEmitBlock(node); - case 221 /* ExpressionStatement */: + case 222 /* ExpressionStatement */: return transformAndEmitExpressionStatement(node); - case 222 /* IfStatement */: + case 223 /* IfStatement */: return transformAndEmitIfStatement(node); - case 223 /* DoStatement */: + case 224 /* DoStatement */: return transformAndEmitDoStatement(node); - case 224 /* WhileStatement */: + case 225 /* WhileStatement */: return transformAndEmitWhileStatement(node); - case 225 /* ForStatement */: + case 226 /* ForStatement */: return transformAndEmitForStatement(node); - case 226 /* ForInStatement */: + case 227 /* ForInStatement */: return transformAndEmitForInStatement(node); - case 228 /* ContinueStatement */: + case 229 /* ContinueStatement */: return transformAndEmitContinueStatement(node); - case 229 /* BreakStatement */: + case 230 /* BreakStatement */: return transformAndEmitBreakStatement(node); - case 230 /* ReturnStatement */: + case 231 /* ReturnStatement */: return transformAndEmitReturnStatement(node); - case 231 /* WithStatement */: + case 232 /* WithStatement */: return transformAndEmitWithStatement(node); - case 232 /* SwitchStatement */: + case 233 /* SwitchStatement */: return transformAndEmitSwitchStatement(node); - case 233 /* LabeledStatement */: + case 234 /* LabeledStatement */: return transformAndEmitLabeledStatement(node); - case 234 /* ThrowStatement */: + case 235 /* ThrowStatement */: return transformAndEmitThrowStatement(node); - case 235 /* TryStatement */: + case 236 /* TryStatement */: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement)); @@ -76777,7 +77641,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 272 /* DefaultClause */ && defaultClauseIndex === -1) { + if (clause.kind === 273 /* DefaultClause */ && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -76790,7 +77654,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 271 /* CaseClause */) { + if (clause.kind === 272 /* CaseClause */) { if (containsYield(clause.expression) && pendingClauses.length > 0) { break; } @@ -77102,7 +77966,7 @@ var ts; if (!renamedCatchVariables) { renamedCatchVariables = ts.createMap(); renamedCatchVariableDeclarations = []; - context.enableSubstitution(72 /* Identifier */); + context.enableSubstitution(73 /* Identifier */); } renamedCatchVariables.set(text, true); renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name; @@ -78018,12 +78882,12 @@ var ts; var previousOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(72 /* Identifier */); // Substitutes expression identifiers with imported/exported symbols. - context.enableSubstitution(204 /* BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(202 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableSubstitution(203 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableSubstitution(276 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. - context.enableEmitNotification(284 /* SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(73 /* Identifier */); // Substitutes expression identifiers with imported/exported symbols. + context.enableSubstitution(205 /* BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(203 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableSubstitution(204 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableSubstitution(277 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. + context.enableEmitNotification(285 /* SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var currentSourceFile; // The current file. @@ -78351,23 +79215,23 @@ var ts; */ function sourceElementVisitor(node) { switch (node.kind) { - case 249 /* ImportDeclaration */: + case 250 /* ImportDeclaration */: return visitImportDeclaration(node); - case 248 /* ImportEqualsDeclaration */: + case 249 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 255 /* ExportDeclaration */: + case 256 /* ExportDeclaration */: return visitExportDeclaration(node); - case 254 /* ExportAssignment */: + case 255 /* ExportAssignment */: return visitExportAssignment(node); - case 219 /* VariableStatement */: + case 220 /* VariableStatement */: return visitVariableStatement(node); - case 239 /* FunctionDeclaration */: + case 240 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 240 /* ClassDeclaration */: + case 241 /* ClassDeclaration */: return visitClassDeclaration(node); - case 315 /* MergeDeclarationMarker */: + case 316 /* MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 316 /* EndOfDeclarationMarker */: + case 317 /* EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return ts.visitEachChild(node, moduleExpressionElementVisitor, context); @@ -78394,24 +79258,24 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var elem = _a[_i]; switch (elem.kind) { - case 275 /* PropertyAssignment */: + case 276 /* PropertyAssignment */: if (destructuringNeedsFlattening(elem.initializer)) { return true; } break; - case 276 /* ShorthandPropertyAssignment */: + case 277 /* ShorthandPropertyAssignment */: if (destructuringNeedsFlattening(elem.name)) { return true; } break; - case 277 /* SpreadAssignment */: + case 278 /* SpreadAssignment */: if (destructuringNeedsFlattening(elem.expression)) { return true; } break; - case 156 /* MethodDeclaration */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 157 /* MethodDeclaration */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: return false; default: ts.Debug.assertNever(elem, "Unhandled object member kind"); } @@ -78889,7 +79753,7 @@ var ts; // // To balance the declaration, add the exports of the elided variable // statement. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 219 /* VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 220 /* VariableStatement */) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -78944,10 +79808,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 251 /* NamespaceImport */: + case 252 /* NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 252 /* NamedImports */: + case 253 /* NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -79129,8 +79993,8 @@ var ts; function modifierVisitor(node) { // Elide module-specific modifiers. switch (node.kind) { - case 85 /* ExportKeyword */: - case 80 /* DefaultKeyword */: + case 86 /* ExportKeyword */: + case 81 /* DefaultKeyword */: return undefined; } return node; @@ -79146,7 +80010,7 @@ var ts; * @param emit A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 284 /* SourceFile */) { + if (node.kind === 285 /* SourceFile */) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; noSubstitution = []; @@ -79208,12 +80072,12 @@ var ts; */ function substituteExpression(node) { switch (node.kind) { - case 72 /* Identifier */: + case 73 /* Identifier */: return substituteExpressionIdentifier(node); - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: return substituteBinaryExpression(node); - case 203 /* PostfixUnaryExpression */: - case 202 /* PrefixUnaryExpression */: + case 204 /* PostfixUnaryExpression */: + case 203 /* PrefixUnaryExpression */: return substituteUnaryExpression(node); } return node; @@ -79234,7 +80098,7 @@ var ts; } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 284 /* SourceFile */) { + if (exportContainer && exportContainer.kind === 285 /* SourceFile */) { return ts.setTextRange(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node)), /*location*/ node); } @@ -79309,8 +80173,8 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 203 /* PostfixUnaryExpression */ - ? ts.setTextRange(ts.createBinary(node.operand, ts.createToken(node.operator === 44 /* PlusPlusToken */ ? 60 /* PlusEqualsToken */ : 61 /* MinusEqualsToken */), ts.createLiteral(1)), + var expression = node.kind === 204 /* PostfixUnaryExpression */ + ? ts.setTextRange(ts.createBinary(node.operand, ts.createToken(node.operator === 44 /* PlusPlusToken */ ? 61 /* PlusEqualsToken */ : 62 /* MinusEqualsToken */), ts.createLiteral(1)), /*location*/ node) : node; for (var _i = 0, exportedNames_3 = exportedNames; _i < exportedNames_3.length; _i++) { @@ -79384,12 +80248,12 @@ var ts; var previousOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(72 /* Identifier */); // Substitutes expression identifiers for imported symbols. - context.enableSubstitution(276 /* ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols - context.enableSubstitution(204 /* BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(202 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableSubstitution(203 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableEmitNotification(284 /* SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(73 /* Identifier */); // Substitutes expression identifiers for imported symbols. + context.enableSubstitution(277 /* ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols + context.enableSubstitution(205 /* BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(203 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableSubstitution(204 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableEmitNotification(285 /* SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var exportFunctionsMap = []; // The export function associated with a source file. @@ -79610,7 +80474,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 255 /* ExportDeclaration */ && externalImport.exportClause) { + if (externalImport.kind === 256 /* ExportDeclaration */ && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -79635,7 +80499,7 @@ var ts; } for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) { var externalImport = _e[_d]; - if (externalImport.kind !== 255 /* ExportDeclaration */) { + if (externalImport.kind !== 256 /* ExportDeclaration */) { continue; } if (!externalImport.exportClause) { @@ -79713,19 +80577,19 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); // TODO: GH#18217 switch (entry.kind) { - case 249 /* ImportDeclaration */: + case 250 /* ImportDeclaration */: if (!entry.importClause) { // 'import "..."' case // module is imported only for side-effects, no emit required break; } // falls through - case 248 /* ImportEqualsDeclaration */: + case 249 /* ImportEqualsDeclaration */: ts.Debug.assert(importVariableName !== undefined); // save import into the local statements.push(ts.createExpressionStatement(ts.createAssignment(importVariableName, parameterName))); break; - case 255 /* ExportDeclaration */: + case 256 /* ExportDeclaration */: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { // export {a, b as c} from 'foo' @@ -79775,15 +80639,15 @@ var ts; */ function sourceElementVisitor(node) { switch (node.kind) { - case 249 /* ImportDeclaration */: + case 250 /* ImportDeclaration */: return visitImportDeclaration(node); - case 248 /* ImportEqualsDeclaration */: + case 249 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 255 /* ExportDeclaration */: + case 256 /* ExportDeclaration */: // ExportDeclarations are elided as they are handled via // `appendExportsOfDeclaration`. return undefined; - case 254 /* ExportAssignment */: + case 255 /* ExportAssignment */: return visitExportAssignment(node); default: return nestedElementVisitor(node); @@ -79959,7 +80823,7 @@ var ts; function shouldHoistVariableDeclarationList(node) { // hoist only non-block scoped declarations or block scoped declarations parented by source file return (ts.getEmitFlags(node) & 2097152 /* NoHoisting */) === 0 - && (enclosingBlockScopedContainer.kind === 284 /* SourceFile */ + && (enclosingBlockScopedContainer.kind === 285 /* SourceFile */ || (ts.getOriginalNode(node).flags & 3 /* BlockScoped */) === 0); } /** @@ -80023,7 +80887,7 @@ var ts; // // To balance the declaration, we defer the exports of the elided variable // statement until we visit this declaration's `EndOfDeclarationMarker`. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 219 /* VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 220 /* VariableStatement */) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasModifier(node.original, 1 /* Export */); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -80085,10 +80949,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 251 /* NamespaceImport */: + case 252 /* NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 252 /* NamedImports */: + case 253 /* NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -80268,43 +81132,43 @@ var ts; */ function nestedElementVisitor(node) { switch (node.kind) { - case 219 /* VariableStatement */: + case 220 /* VariableStatement */: return visitVariableStatement(node); - case 239 /* FunctionDeclaration */: + case 240 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 240 /* ClassDeclaration */: + case 241 /* ClassDeclaration */: return visitClassDeclaration(node); - case 225 /* ForStatement */: + case 226 /* ForStatement */: return visitForStatement(node); - case 226 /* ForInStatement */: + case 227 /* ForInStatement */: return visitForInStatement(node); - case 227 /* ForOfStatement */: + case 228 /* ForOfStatement */: return visitForOfStatement(node); - case 223 /* DoStatement */: + case 224 /* DoStatement */: return visitDoStatement(node); - case 224 /* WhileStatement */: + case 225 /* WhileStatement */: return visitWhileStatement(node); - case 233 /* LabeledStatement */: + case 234 /* LabeledStatement */: return visitLabeledStatement(node); - case 231 /* WithStatement */: + case 232 /* WithStatement */: return visitWithStatement(node); - case 232 /* SwitchStatement */: + case 233 /* SwitchStatement */: return visitSwitchStatement(node); - case 246 /* CaseBlock */: + case 247 /* CaseBlock */: return visitCaseBlock(node); - case 271 /* CaseClause */: + case 272 /* CaseClause */: return visitCaseClause(node); - case 272 /* DefaultClause */: + case 273 /* DefaultClause */: return visitDefaultClause(node); - case 235 /* TryStatement */: + case 236 /* TryStatement */: return visitTryStatement(node); - case 274 /* CatchClause */: + case 275 /* CatchClause */: return visitCatchClause(node); - case 218 /* Block */: + case 219 /* Block */: return visitBlock(node); - case 315 /* MergeDeclarationMarker */: + case 316 /* MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 316 /* EndOfDeclarationMarker */: + case 317 /* EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return destructuringAndImportCallVisitor(node); @@ -80551,7 +81415,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 284 /* SourceFile */; + return container !== undefined && container.kind === 285 /* SourceFile */; } else { return false; @@ -80567,8 +81431,8 @@ var ts; */ function modifierVisitor(node) { switch (node.kind) { - case 85 /* ExportKeyword */: - case 80 /* DefaultKeyword */: + case 86 /* ExportKeyword */: + case 81 /* DefaultKeyword */: return undefined; } return node; @@ -80584,7 +81448,7 @@ var ts; * @param emitCallback A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 284 /* SourceFile */) { + if (node.kind === 285 /* SourceFile */) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -80632,7 +81496,7 @@ var ts; */ function substituteUnspecified(node) { switch (node.kind) { - case 276 /* ShorthandPropertyAssignment */: + case 277 /* ShorthandPropertyAssignment */: return substituteShorthandPropertyAssignment(node); } return node; @@ -80666,12 +81530,12 @@ var ts; */ function substituteExpression(node) { switch (node.kind) { - case 72 /* Identifier */: + case 73 /* Identifier */: return substituteExpressionIdentifier(node); - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: return substituteBinaryExpression(node); - case 202 /* PrefixUnaryExpression */: - case 203 /* PostfixUnaryExpression */: + case 203 /* PrefixUnaryExpression */: + case 204 /* PostfixUnaryExpression */: return substituteUnaryExpression(node); } return node; @@ -80764,14 +81628,14 @@ var ts; && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var expression = node.kind === 203 /* PostfixUnaryExpression */ + var expression = node.kind === 204 /* PostfixUnaryExpression */ ? ts.setTextRange(ts.createPrefix(node.operator, node.operand), node) : node; for (var _i = 0, exportedNames_5 = exportedNames; _i < exportedNames_5.length; _i++) { var exportName = exportedNames_5[_i]; expression = createExportExpression(exportName, preventSubstitution(expression)); } - if (node.kind === 203 /* PostfixUnaryExpression */) { + if (node.kind === 204 /* PostfixUnaryExpression */) { expression = node.operator === 44 /* PlusPlusToken */ ? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1)) : ts.createAdd(preventSubstitution(expression), ts.createLiteral(1)); @@ -80793,7 +81657,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false); - if (exportContainer && exportContainer.kind === 284 /* SourceFile */) { + if (exportContainer && exportContainer.kind === 285 /* SourceFile */) { exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -80832,8 +81696,8 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(284 /* SourceFile */); - context.enableSubstitution(72 /* Identifier */); + context.enableEmitNotification(285 /* SourceFile */); + context.enableSubstitution(73 /* Identifier */); var currentSourceFile; return ts.chainBundle(transformSourceFile); function transformSourceFile(node) { @@ -80861,10 +81725,10 @@ var ts; } function visitor(node) { switch (node.kind) { - case 248 /* ImportEqualsDeclaration */: + case 249 /* ImportEqualsDeclaration */: // Elide `import=` as it is not legal with --module ES6 return undefined; - case 254 /* ExportAssignment */: + case 255 /* ExportAssignment */: return visitExportAssignment(node); } return node; @@ -80972,7 +81836,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 240 /* ClassDeclaration */) { + else if (node.parent.kind === 241 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -81001,7 +81865,7 @@ var ts; ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 240 /* ClassDeclaration */) { + else if (node.parent.kind === 241 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -81048,7 +81912,7 @@ var ts; return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.SyntaxKind[node.kind]); } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 237 /* VariableDeclaration */ || node.kind === 186 /* BindingElement */) { + if (node.kind === 238 /* VariableDeclaration */ || node.kind === 187 /* BindingElement */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -81057,8 +81921,8 @@ var ts; } // This check is to ensure we don't report error on constructor parameter property as that error would be reported during parameter emit // The only exception here is if the constructor was marked as private. we are not emitting the constructor parameters at all. - else if (node.kind === 154 /* PropertyDeclaration */ || node.kind === 189 /* PropertyAccessExpression */ || node.kind === 153 /* PropertySignature */ || - (node.kind === 151 /* Parameter */ && ts.hasModifier(node.parent, 8 /* Private */))) { + else if (node.kind === 155 /* PropertyDeclaration */ || node.kind === 190 /* PropertyAccessExpression */ || node.kind === 154 /* PropertySignature */ || + (node.kind === 152 /* Parameter */ && ts.hasModifier(node.parent, 8 /* Private */))) { // TODO(jfreeman): Deal with computed properties in error reporting. if (ts.hasModifier(node, 32 /* Static */)) { return symbolAccessibilityResult.errorModuleName ? @@ -81067,7 +81931,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 240 /* ClassDeclaration */ || node.kind === 151 /* Parameter */) { + else if (node.parent.kind === 241 /* ClassDeclaration */ || node.kind === 152 /* Parameter */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -81092,7 +81956,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (node.kind === 159 /* SetAccessor */) { + if (node.kind === 160 /* SetAccessor */) { // Getters can infer the return type from the returned expression, but setters cannot, so the // "_from_external_module_1_but_cannot_be_named" case cannot occur. if (ts.hasModifier(node, 32 /* Static */)) { @@ -81131,26 +81995,26 @@ var ts; function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 161 /* ConstructSignature */: + case 162 /* ConstructSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 160 /* CallSignature */: + case 161 /* CallSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 162 /* IndexSignature */: + case 163 /* IndexSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: if (ts.hasModifier(node, 32 /* Static */)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? @@ -81158,7 +82022,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 240 /* ClassDeclaration */) { + else if (node.parent.kind === 241 /* ClassDeclaration */) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -81172,7 +82036,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 239 /* FunctionDeclaration */: + case 240 /* FunctionDeclaration */: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -81197,30 +82061,30 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 157 /* Constructor */: + case 158 /* Constructor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 161 /* ConstructSignature */: - case 166 /* ConstructorType */: + case 162 /* ConstructSignature */: + case 167 /* ConstructorType */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 160 /* CallSignature */: + case 161 /* CallSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 162 /* IndexSignature */: + case 163 /* IndexSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: if (ts.hasModifier(node.parent, 32 /* Static */)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? @@ -81228,7 +82092,7 @@ var ts; ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 240 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 241 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -81241,8 +82105,8 @@ var ts; ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 239 /* FunctionDeclaration */: - case 165 /* FunctionType */: + case 240 /* FunctionDeclaration */: + case 166 /* FunctionType */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -81256,39 +82120,39 @@ var ts; // Type parameter constraints are named by user so we should always be able to name it var diagnosticMessage; switch (node.parent.kind) { - case 240 /* ClassDeclaration */: + case 241 /* ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 241 /* InterfaceDeclaration */: + case 242 /* InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 181 /* MappedType */: + case 182 /* MappedType */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1; break; - case 166 /* ConstructorType */: - case 161 /* ConstructSignature */: + case 167 /* ConstructorType */: + case 162 /* ConstructSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 160 /* CallSignature */: + case 161 /* CallSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: if (ts.hasModifier(node.parent, 32 /* Static */)) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 240 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 241 /* ClassDeclaration */) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 165 /* FunctionType */: - case 239 /* FunctionDeclaration */: + case 166 /* FunctionType */: + case 240 /* FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 242 /* TypeAliasDeclaration */: + case 243 /* TypeAliasDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -81303,9 +82167,9 @@ var ts; function getHeritageClauseVisibilityError() { var diagnosticMessage; // Heritage clause is written by user so it can always be named - if (node.parent.parent.kind === 240 /* ClassDeclaration */) { + if (node.parent.parent.kind === 241 /* ClassDeclaration */) { // Class or Interface implemented/extended is inaccessible - diagnosticMessage = ts.isHeritageClause(node.parent) && node.parent.token === 109 /* ImplementsKeyword */ ? + diagnosticMessage = ts.isHeritageClause(node.parent) && node.parent.token === 110 /* ImplementsKeyword */ ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : ts.Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1; } @@ -81354,7 +82218,7 @@ var ts; } function isInternalDeclaration(node, currentSourceFile) { var parseTreeNode = ts.getParseTreeNode(node); - if (parseTreeNode && parseTreeNode.kind === 151 /* Parameter */) { + if (parseTreeNode && parseTreeNode.kind === 152 /* Parameter */) { var paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode); var previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : undefined; var text = currentSourceFile.text; @@ -81501,10 +82365,10 @@ var ts; } } function transformRoot(node) { - if (node.kind === 284 /* SourceFile */ && (node.isDeclarationFile || ts.isSourceFileJS(node))) { + if (node.kind === 285 /* SourceFile */ && (node.isDeclarationFile || ts.isSourceFileJS(node))) { return node; } - if (node.kind === 285 /* Bundle */) { + if (node.kind === 286 /* Bundle */) { isBundledEmit = true; refs = ts.createMap(); libs = ts.createMap(); @@ -81527,14 +82391,14 @@ var ts; resultHasExternalModuleIndicator = false; // unused in external module bundle emit (all external modules are within module blocks, therefore are known to be modules) needsDeclare = false; var statements_4 = ts.visitNodes(sourceFile.statements, visitDeclarationStatements); - var newFile = ts.updateSourceFileNode(sourceFile, [ts.createModuleDeclaration([], [ts.createModifier(125 /* DeclareKeyword */)], ts.createLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), ts.createModuleBlock(ts.setTextRange(ts.createNodeArray(transformAndReplaceLatePaintedStatements(statements_4)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); + var newFile = ts.updateSourceFileNode(sourceFile, [ts.createModuleDeclaration([], [ts.createModifier(126 /* DeclareKeyword */)], ts.createLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), ts.createModuleBlock(ts.setTextRange(ts.createNodeArray(transformAndReplaceLatePaintedStatements(statements_4)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); return newFile; } needsDeclare = true; var updated = ts.visitNodes(sourceFile.statements, visitDeclarationStatements); return ts.updateSourceFileNode(sourceFile, transformAndReplaceLatePaintedStatements(updated), /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); }), ts.mapDefined(node.prepends, function (prepend) { - if (prepend.kind === 287 /* InputFiles */) { + if (prepend.kind === 288 /* InputFiles */) { var sourceFile = ts.createUnparsedSourceFile(prepend, "dts", stripInternal); hasNoDefaultLib_1 = hasNoDefaultLib_1 || !!sourceFile.hasNoDefaultLib; collectReferences(sourceFile, refs); @@ -81654,11 +82518,11 @@ var ts; return ret; } function filterBindingPatternInitializers(name) { - if (name.kind === 72 /* Identifier */) { + if (name.kind === 73 /* Identifier */) { return name; } else { - if (name.kind === 185 /* ArrayBindingPattern */) { + if (name.kind === 186 /* ArrayBindingPattern */) { return ts.updateArrayBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement)); } else { @@ -81666,7 +82530,7 @@ var ts; } } function visitBindingElement(elem) { - if (elem.kind === 210 /* OmittedExpression */) { + if (elem.kind === 211 /* OmittedExpression */) { return elem; } return ts.updateBindingElement(elem, elem.dotDotDotToken, elem.propertyName, filterBindingPatternInitializers(elem.name), shouldPrintWithInitializer(elem) ? elem.initializer : undefined); @@ -81704,19 +82568,19 @@ var ts; // Literal const declarations will have an initializer ensured rather than a type return; } - var shouldUseResolverType = node.kind === 151 /* Parameter */ && + var shouldUseResolverType = node.kind === 152 /* Parameter */ && (resolver.isRequiredInitializedParameter(node) || resolver.isOptionalUninitializedParameterProperty(node)); if (type && !shouldUseResolverType) { return ts.visitNode(type, visitDeclarationSubtree); } if (!ts.getParseTreeNode(node)) { - return type ? ts.visitNode(type, visitDeclarationSubtree) : ts.createKeywordTypeNode(120 /* AnyKeyword */); + return type ? ts.visitNode(type, visitDeclarationSubtree) : ts.createKeywordTypeNode(121 /* AnyKeyword */); } - if (node.kind === 159 /* SetAccessor */) { + if (node.kind === 160 /* SetAccessor */) { // Set accessors with no associated type node (from it's param or get accessor return) are `any` since they are never contextually typed right now // (The inferred type here will be void, but the old declaration emitter printed `any`, so this replicates that) - return ts.createKeywordTypeNode(120 /* AnyKeyword */); + return ts.createKeywordTypeNode(121 /* AnyKeyword */); } errorNameNode = node.name; var oldDiag; @@ -81724,12 +82588,12 @@ var ts; oldDiag = getSymbolAccessibilityDiagnostic; getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(node); } - if (node.kind === 237 /* VariableDeclaration */ || node.kind === 186 /* BindingElement */) { + if (node.kind === 238 /* VariableDeclaration */ || node.kind === 187 /* BindingElement */) { return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); } - if (node.kind === 151 /* Parameter */ - || node.kind === 154 /* PropertyDeclaration */ - || node.kind === 153 /* PropertySignature */) { + if (node.kind === 152 /* Parameter */ + || node.kind === 155 /* PropertyDeclaration */ + || node.kind === 154 /* PropertySignature */) { if (!node.initializer) return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType)); return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType) || resolver.createTypeOfExpression(node.initializer, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); @@ -81740,26 +82604,26 @@ var ts; if (!suppressNewDiagnosticContexts) { getSymbolAccessibilityDiagnostic = oldDiag; } - return returnValue || ts.createKeywordTypeNode(120 /* AnyKeyword */); + return returnValue || ts.createKeywordTypeNode(121 /* AnyKeyword */); } } function isDeclarationAndNotVisible(node) { node = ts.getParseTreeNode(node); switch (node.kind) { - case 239 /* FunctionDeclaration */: - case 244 /* ModuleDeclaration */: - case 241 /* InterfaceDeclaration */: - case 240 /* ClassDeclaration */: - case 242 /* TypeAliasDeclaration */: - case 243 /* EnumDeclaration */: + case 240 /* FunctionDeclaration */: + case 245 /* ModuleDeclaration */: + case 242 /* InterfaceDeclaration */: + case 241 /* ClassDeclaration */: + case 243 /* TypeAliasDeclaration */: + case 244 /* EnumDeclaration */: return !resolver.isDeclarationVisible(node); // The following should be doing their own visibility checks based on filtering their members - case 237 /* VariableDeclaration */: + case 238 /* VariableDeclaration */: return !getBindingNameVisible(node); - case 248 /* ImportEqualsDeclaration */: - case 249 /* ImportDeclaration */: - case 255 /* ExportDeclaration */: - case 254 /* ExportAssignment */: + case 249 /* ImportEqualsDeclaration */: + case 250 /* ImportDeclaration */: + case 256 /* ExportDeclaration */: + case 255 /* ExportAssignment */: return false; } return false; @@ -81813,7 +82677,7 @@ var ts; function rewriteModuleSpecifier(parent, input) { if (!input) return undefined; // TODO: GH#18217 - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 244 /* ModuleDeclaration */ && parent.kind !== 183 /* ImportType */); + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 245 /* ModuleDeclaration */ && parent.kind !== 184 /* ImportType */); if (ts.isStringLiteralLike(input)) { if (isBundledEmit) { var newName = ts.getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent); @@ -81833,7 +82697,7 @@ var ts; function transformImportEqualsDeclaration(decl) { if (!resolver.isDeclarationVisible(decl)) return; - if (decl.moduleReference.kind === 259 /* ExternalModuleReference */) { + if (decl.moduleReference.kind === 260 /* ExternalModuleReference */) { // Rewrite external module names if necessary var specifier = ts.getExternalModuleImportEqualsDeclarationExpression(decl); return ts.updateImportEqualsDeclaration(decl, @@ -81860,7 +82724,7 @@ var ts; return visibleDefaultBinding && ts.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, ts.updateImportClause(decl.importClause, visibleDefaultBinding, /*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier)); } - if (decl.importClause.namedBindings.kind === 251 /* NamespaceImport */) { + if (decl.importClause.namedBindings.kind === 252 /* NamespaceImport */) { // Namespace import (optionally with visible default) var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : /*namedBindings*/ undefined; return visibleDefaultBinding || namedBindings ? ts.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, ts.updateImportClause(decl.importClause, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier)) : undefined; @@ -81968,68 +82832,68 @@ var ts; checkEntityNameVisibility(input.exprName, enclosingDeclaration); } var oldWithinObjectLiteralType = suppressNewDiagnosticContexts; - var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 168 /* TypeLiteral */ || input.kind === 181 /* MappedType */) && input.parent.kind !== 242 /* TypeAliasDeclaration */); + var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 169 /* TypeLiteral */ || input.kind === 182 /* MappedType */) && input.parent.kind !== 243 /* TypeAliasDeclaration */); if (shouldEnterSuppressNewDiagnosticsContextContext) { // We stop making new diagnostic contexts within object literal types. Unless it's an object type on the RHS of a type alias declaration. Then we do. suppressNewDiagnosticContexts = true; } if (isProcessedComponent(input)) { switch (input.kind) { - case 211 /* ExpressionWithTypeArguments */: { + case 212 /* ExpressionWithTypeArguments */: { if ((ts.isEntityName(input.expression) || ts.isEntityNameExpression(input.expression))) { checkEntityNameVisibility(input.expression, enclosingDeclaration); } var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(ts.updateExpressionWithTypeArguments(node, ts.parenthesizeTypeParameters(node.typeArguments), node.expression)); } - case 164 /* TypeReference */: { + case 165 /* TypeReference */: { checkEntityNameVisibility(input.typeName, enclosingDeclaration); var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(ts.updateTypeReferenceNode(node, node.typeName, ts.parenthesizeTypeParameters(node.typeArguments))); } - case 161 /* ConstructSignature */: + case 162 /* ConstructSignature */: return cleanup(ts.updateConstructSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); - case 157 /* Constructor */: { + case 158 /* Constructor */: { var isPrivate = ts.hasModifier(input, 8 /* Private */); // A constructor declaration may not have a type annotation - var ctor = ts.createSignatureDeclaration(157 /* Constructor */, isPrivate ? undefined : ensureTypeParams(input, input.typeParameters), + var ctor = ts.createSignatureDeclaration(158 /* Constructor */, isPrivate ? undefined : ensureTypeParams(input, input.typeParameters), // TODO: GH#18217 isPrivate ? undefined : updateParamsList(input, input.parameters, 0 /* None */), /*type*/ undefined); ctor.modifiers = ts.createNodeArray(ensureModifiers(input)); return cleanup(ctor); } - case 156 /* MethodDeclaration */: { - var sig = ts.createSignatureDeclaration(155 /* MethodSignature */, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type)); + case 157 /* MethodDeclaration */: { + var sig = ts.createSignatureDeclaration(156 /* MethodSignature */, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type)); sig.name = input.name; sig.modifiers = ts.createNodeArray(ensureModifiers(input)); sig.questionToken = input.questionToken; return cleanup(sig); } - case 158 /* GetAccessor */: { + case 159 /* GetAccessor */: { var newNode = ensureAccessor(input); return cleanup(newNode); } - case 159 /* SetAccessor */: { + case 160 /* SetAccessor */: { var newNode = ensureAccessor(input); return cleanup(newNode); } - case 154 /* PropertyDeclaration */: + case 155 /* PropertyDeclaration */: return cleanup(ts.updateProperty(input, /*decorators*/ undefined, ensureModifiers(input), input.name, input.questionToken, !ts.hasModifier(input, 8 /* Private */) ? ensureType(input, input.type) : undefined, ensureNoInitializer(input))); - case 153 /* PropertySignature */: + case 154 /* PropertySignature */: return cleanup(ts.updatePropertySignature(input, ensureModifiers(input), input.name, input.questionToken, !ts.hasModifier(input, 8 /* Private */) ? ensureType(input, input.type) : undefined, ensureNoInitializer(input))); - case 155 /* MethodSignature */: { + case 156 /* MethodSignature */: { return cleanup(ts.updateMethodSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), input.name, input.questionToken)); } - case 160 /* CallSignature */: { + case 161 /* CallSignature */: { return cleanup(ts.updateCallSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); } - case 162 /* IndexSignature */: { + case 163 /* IndexSignature */: { return cleanup(ts.updateIndexSignature(input, - /*decorators*/ undefined, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || ts.createKeywordTypeNode(120 /* AnyKeyword */))); + /*decorators*/ undefined, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || ts.createKeywordTypeNode(121 /* AnyKeyword */))); } - case 237 /* VariableDeclaration */: { + case 238 /* VariableDeclaration */: { if (ts.isBindingPattern(input.name)) { return recreateBindingPattern(input.name); } @@ -82037,13 +82901,13 @@ var ts; suppressNewDiagnosticContexts = true; // Variable declaration types also suppress new diagnostic contexts, provided the contexts wouldn't be made for binding pattern types return cleanup(ts.updateVariableDeclaration(input, input.name, ensureType(input, input.type), ensureNoInitializer(input))); } - case 150 /* TypeParameter */: { + case 151 /* TypeParameter */: { if (isPrivateMethodTypeParameter(input) && (input.default || input.constraint)) { return cleanup(ts.updateTypeParameterDeclaration(input, input.name, /*constraint*/ undefined, /*defaultType*/ undefined)); } return cleanup(ts.visitEachChild(input, visitDeclarationSubtree, context)); } - case 175 /* ConditionalType */: { + case 176 /* ConditionalType */: { // We have to process conditional types in a special way because for visibility purposes we need to push a new enclosingDeclaration // just for the `infer` types in the true branch. It's an implicit declaration scope that only applies to _part_ of the type. var checkType = ts.visitNode(input.checkType, visitDeclarationSubtree); @@ -82055,13 +82919,13 @@ var ts; var falseType = ts.visitNode(input.falseType, visitDeclarationSubtree); return cleanup(ts.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType)); } - case 165 /* FunctionType */: { + case 166 /* FunctionType */: { return cleanup(ts.updateFunctionTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } - case 166 /* ConstructorType */: { + case 167 /* ConstructorType */: { return cleanup(ts.updateConstructorTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } - case 183 /* ImportType */: { + case 184 /* ImportType */: { if (!ts.isLiteralImportTypeNode(input)) return cleanup(input); return cleanup(ts.updateImportTypeNode(input, ts.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf)); @@ -82090,7 +82954,7 @@ var ts; } } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 156 /* MethodDeclaration */ && ts.hasModifier(node.parent, 8 /* Private */); + return node.parent.kind === 157 /* MethodDeclaration */ && ts.hasModifier(node.parent, 8 /* Private */); } function visitDeclarationStatements(input) { if (!isPreservedDeclarationStatement(input)) { @@ -82100,7 +82964,7 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 255 /* ExportDeclaration */: { + case 256 /* ExportDeclaration */: { if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; resultHasScopeMarker = true; @@ -82109,13 +82973,13 @@ var ts; // Rewrite external module names if necessary return ts.updateExportDeclaration(input, /*decorators*/ undefined, input.modifiers, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier)); } - case 254 /* ExportAssignment */: { + case 255 /* ExportAssignment */: { // Always visible if the parent node isn't dropped for being not visible if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; resultHasScopeMarker = true; } - if (input.expression.kind === 72 /* Identifier */) { + if (input.expression.kind === 73 /* Identifier */) { return input; } else { @@ -82125,7 +82989,7 @@ var ts; errorNode: input }); }; var varDecl = ts.createVariableDeclaration(newId, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); - var statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(125 /* DeclareKeyword */)] : [], ts.createVariableDeclarationList([varDecl], 2 /* Const */)); + var statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(126 /* DeclareKeyword */)] : [], ts.createVariableDeclarationList([varDecl], 2 /* Const */)); return [statement, ts.updateExportAssignment(input, input.decorators, input.modifiers, newId)]; } } @@ -82139,10 +83003,10 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 248 /* ImportEqualsDeclaration */: { + case 249 /* ImportEqualsDeclaration */: { return transformImportEqualsDeclaration(input); } - case 249 /* ImportDeclaration */: { + case 250 /* ImportDeclaration */: { return transformImportDeclaration(input); } } @@ -82163,41 +83027,63 @@ var ts; } var previousNeedsDeclare = needsDeclare; switch (input.kind) { - case 242 /* TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all + case 243 /* TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all return cleanup(ts.updateTypeAliasDeclaration(input, /*decorators*/ undefined, ensureModifiers(input, isPrivate), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); - case 241 /* InterfaceDeclaration */: { + case 242 /* InterfaceDeclaration */: { return cleanup(ts.updateInterfaceDeclaration(input, /*decorators*/ undefined, ensureModifiers(input, isPrivate), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree))); } - case 239 /* FunctionDeclaration */: { + case 240 /* FunctionDeclaration */: { // Generators lose their generator-ness, excepting their return type var clean = cleanup(ts.updateFunctionDeclaration(input, /*decorators*/ undefined, ensureModifiers(input, isPrivate), /*asteriskToken*/ undefined, input.name, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), /*body*/ undefined)); if (clean && resolver.isExpandoFunctionDeclaration(input)) { - var declarations = ts.mapDefined(resolver.getPropertiesOfContainerFunction(input), function (p) { + var props = resolver.getPropertiesOfContainerFunction(input); + var fakespace_1 = ts.createModuleDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, clean.name || ts.createIdentifier("_default"), ts.createModuleBlock([]), 16 /* Namespace */); + fakespace_1.flags ^= 8 /* Synthesized */; // unset synthesized so it is usable as an enclosing declaration + fakespace_1.parent = enclosingDeclaration; + fakespace_1.locals = ts.createSymbolTable(props); + fakespace_1.symbol = props[0].parent; + var declarations = ts.mapDefined(props, function (p) { if (!ts.isPropertyAccessExpression(p.valueDeclaration)) { return undefined; } getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(p.valueDeclaration); - var type = resolver.createTypeOfDeclaration(p.valueDeclaration, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker); + var type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace_1, declarationEmitNodeBuilderFlags, symbolTracker); getSymbolAccessibilityDiagnostic = oldDiag; var varDecl = ts.createVariableDeclaration(ts.unescapeLeadingUnderscores(p.escapedName), type, /*initializer*/ undefined); return ts.createVariableStatement(/*modifiers*/ undefined, ts.createVariableDeclarationList([varDecl])); }); var namespaceDecl = ts.createModuleDeclaration(/*decorators*/ undefined, ensureModifiers(input, isPrivate), input.name, ts.createModuleBlock(declarations), 16 /* Namespace */); - return [clean, namespaceDecl]; + if (!ts.hasModifier(clean, 512 /* Default */)) { + return [clean, namespaceDecl]; + } + var modifiers = ts.createModifiersFromModifierFlags((ts.getModifierFlags(clean) & ~513 /* ExportDefault */) | 2 /* Ambient */); + var cleanDeclaration = ts.updateFunctionDeclaration(clean, + /*decorators*/ undefined, modifiers, + /*asteriskToken*/ undefined, clean.name, clean.typeParameters, clean.parameters, clean.type, + /*body*/ undefined); + var namespaceDeclaration = ts.updateModuleDeclaration(namespaceDecl, + /*decorators*/ undefined, modifiers, namespaceDecl.name, namespaceDecl.body); + var exportDefaultDeclaration = ts.createExportAssignment( + /*decorators*/ undefined, + /*modifiers*/ undefined, + /*isExportEquals*/ false, namespaceDecl.name); + resultHasExternalModuleIndicator = true; + resultHasScopeMarker = true; + return [cleanDeclaration, namespaceDeclaration, exportDefaultDeclaration]; } else { return clean; } } - case 244 /* ModuleDeclaration */: { + case 245 /* ModuleDeclaration */: { needsDeclare = false; var inner = input.body; - if (inner && inner.kind === 245 /* ModuleBlock */) { + if (inner && inner.kind === 246 /* ModuleBlock */) { var statements = ts.visitNodes(inner.statements, visitDeclarationStatements); var body = ts.updateModuleBlock(inner, transformAndReplaceLatePaintedStatements(statements)); needsDeclare = previousNeedsDeclare; @@ -82218,7 +83104,7 @@ var ts; /*decorators*/ undefined, mods, input.name, body)); } } - case 240 /* ClassDeclaration */: { + case 241 /* ClassDeclaration */: { var modifiers = ts.createNodeArray(ensureModifiers(input, isPrivate)); var typeParameters = ensureTypeParams(input, input.typeParameters); var ctor = ts.getFirstConstructorWithBody(input); @@ -82229,7 +83115,7 @@ var ts; if (!ts.hasModifier(param, 92 /* ParameterPropertyModifier */) || shouldStripInternal(param)) return; getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(param); - if (param.name.kind === 72 /* Identifier */) { + if (param.name.kind === 73 /* Identifier */) { return preserveJsDoc(ts.createProperty( /*decorators*/ undefined, ensureModifiers(param), param.name, param.questionToken, ensureType(param, param.type), ensureNoInitializer(param)), param); } @@ -82259,7 +83145,7 @@ var ts; } var members = ts.createNodeArray(ts.concatenate(parameterProperties, ts.visitNodes(input.members, visitDeclarationSubtree))); var extendsClause_1 = ts.getEffectiveBaseTypeNode(input); - if (extendsClause_1 && !ts.isEntityNameExpression(extendsClause_1.expression) && extendsClause_1.expression.kind !== 96 /* NullKeyword */) { + if (extendsClause_1 && !ts.isEntityNameExpression(extendsClause_1.expression) && extendsClause_1.expression.kind !== 97 /* NullKeyword */) { // We must add a temporary declaration for the extends clause expression var oldId = input.name ? ts.unescapeLeadingUnderscores(input.name.escapedText) : "default"; var newId_1 = ts.createOptimisticUniqueName(oldId + "_base"); @@ -82269,16 +83155,16 @@ var ts; typeName: input.name }); }; var varDecl = ts.createVariableDeclaration(newId_1, resolver.createTypeOfExpression(extendsClause_1.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); - var statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(125 /* DeclareKeyword */)] : [], ts.createVariableDeclarationList([varDecl], 2 /* Const */)); + var statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(126 /* DeclareKeyword */)] : [], ts.createVariableDeclarationList([varDecl], 2 /* Const */)); var heritageClauses = ts.createNodeArray(ts.map(input.heritageClauses, function (clause) { - if (clause.token === 86 /* ExtendsKeyword */) { + if (clause.token === 87 /* ExtendsKeyword */) { var oldDiag_2 = getSymbolAccessibilityDiagnostic; getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(clause.types[0]); var newClause = ts.updateHeritageClause(clause, ts.map(clause.types, function (t) { return ts.updateExpressionWithTypeArguments(t, ts.visitNodes(t.typeArguments, visitDeclarationSubtree), newId_1); })); getSymbolAccessibilityDiagnostic = oldDiag_2; return newClause; } - return ts.updateHeritageClause(clause, ts.visitNodes(ts.createNodeArray(ts.filter(clause.types, function (t) { return ts.isEntityNameExpression(t.expression) || t.expression.kind === 96 /* NullKeyword */; })), visitDeclarationSubtree)); + return ts.updateHeritageClause(clause, ts.visitNodes(ts.createNodeArray(ts.filter(clause.types, function (t) { return ts.isEntityNameExpression(t.expression) || t.expression.kind === 97 /* NullKeyword */; })), visitDeclarationSubtree)); })); return [statement, cleanup(ts.updateClassDeclaration(input, /*decorators*/ undefined, modifiers, input.name, typeParameters, heritageClauses, members))]; // TODO: GH#18217 @@ -82289,10 +83175,10 @@ var ts; /*decorators*/ undefined, modifiers, input.name, typeParameters, heritageClauses, members)); } } - case 219 /* VariableStatement */: { + case 220 /* VariableStatement */: { return cleanup(transformVariableStatement(input, isPrivate)); } - case 243 /* EnumDeclaration */: { + case 244 /* EnumDeclaration */: { return cleanup(ts.updateEnumDeclaration(input, /*decorators*/ undefined, ts.createNodeArray(ensureModifiers(input, isPrivate)), input.name, ts.createNodeArray(ts.mapDefined(input.members, function (m) { if (shouldStripInternal(m)) return; @@ -82311,7 +83197,7 @@ var ts; if (canProdiceDiagnostic) { getSymbolAccessibilityDiagnostic = oldDiag; } - if (input.kind === 244 /* ModuleDeclaration */) { + if (input.kind === 245 /* ModuleDeclaration */) { needsDeclare = previousNeedsDeclare; } if (node === input) { @@ -82332,7 +83218,7 @@ var ts; return ts.flatten(ts.mapDefined(d.elements, function (e) { return recreateBindingElement(e); })); } function recreateBindingElement(e) { - if (e.kind === 210 /* OmittedExpression */) { + if (e.kind === 211 /* OmittedExpression */) { return; } if (e.name) { @@ -82385,7 +83271,7 @@ var ts; function ensureModifierFlags(node, privateDeclaration) { var mask = 3071 /* All */ ^ (4 /* Public */ | 256 /* Async */); // No async modifiers in declaration files var additions = (needsDeclare && !isAlwaysType(node)) ? 2 /* Ambient */ : 0 /* None */; - var parentIsFile = node.parent.kind === 284 /* SourceFile */; + var parentIsFile = node.parent.kind === 285 /* SourceFile */; if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) { mask ^= ((privateDeclaration || (isBundledEmit && parentIsFile) || hasScopeMarker(node.parent) ? 0 : 1 /* Export */) | 2 /* Ambient */); additions = 0 /* None */; @@ -82406,7 +83292,7 @@ var ts; var prop = ts.createProperty(/*decorators*/ undefined, maskModifiers(node, /*mask*/ undefined, (!accessors.setAccessor) ? 64 /* Readonly */ : 0 /* None */), node.name, node.questionToken, ensureType(node, accessorType), /*initializer*/ undefined); var leadingsSyntheticCommentRanges = accessors.secondAccessor && ts.getLeadingCommentRangesOfNode(accessors.secondAccessor, currentSourceFile); if (leadingsSyntheticCommentRanges) { - var _loop_10 = function (range) { + var _loop_13 = function (range) { if (range.kind === 3 /* MultiLineCommentTrivia */) { var text = currentSourceFile.text.slice(range.pos + 2, range.end - 2); var lines = text.split(/\r\n?|\n/g); @@ -82420,20 +83306,20 @@ var ts; }; for (var _i = 0, leadingsSyntheticCommentRanges_1 = leadingsSyntheticCommentRanges; _i < leadingsSyntheticCommentRanges_1.length; _i++) { var range = leadingsSyntheticCommentRanges_1[_i]; - _loop_10(range); + _loop_13(range); } } return prop; } function transformHeritageClauses(nodes) { return ts.createNodeArray(ts.filter(ts.map(nodes, function (clause) { return ts.updateHeritageClause(clause, ts.visitNodes(ts.createNodeArray(ts.filter(clause.types, function (t) { - return ts.isEntityNameExpression(t.expression) || (clause.token === 86 /* ExtendsKeyword */ && t.expression.kind === 96 /* NullKeyword */); + return ts.isEntityNameExpression(t.expression) || (clause.token === 87 /* ExtendsKeyword */ && t.expression.kind === 97 /* NullKeyword */); })), visitDeclarationSubtree)); }), function (clause) { return clause.types && !!clause.types.length; })); } } ts.transformDeclarations = transformDeclarations; function isAlwaysType(node) { - if (node.kind === 241 /* InterfaceDeclaration */) { + if (node.kind === 242 /* InterfaceDeclaration */) { return true; } return false; @@ -82458,7 +83344,7 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 158 /* GetAccessor */ + return accessor.kind === 159 /* GetAccessor */ ? accessor.type // Getter - return type : accessor.parameters.length > 0 ? accessor.parameters[0].type // Setter parameter type @@ -82467,52 +83353,52 @@ var ts; } function canHaveLiteralInitializer(node) { switch (node.kind) { - case 154 /* PropertyDeclaration */: - case 153 /* PropertySignature */: + case 155 /* PropertyDeclaration */: + case 154 /* PropertySignature */: return !ts.hasModifier(node, 8 /* Private */); - case 151 /* Parameter */: - case 237 /* VariableDeclaration */: + case 152 /* Parameter */: + case 238 /* VariableDeclaration */: return true; } return false; } function isPreservedDeclarationStatement(node) { switch (node.kind) { - case 239 /* FunctionDeclaration */: - case 244 /* ModuleDeclaration */: - case 248 /* ImportEqualsDeclaration */: - case 241 /* InterfaceDeclaration */: - case 240 /* ClassDeclaration */: - case 242 /* TypeAliasDeclaration */: - case 243 /* EnumDeclaration */: - case 219 /* VariableStatement */: - case 249 /* ImportDeclaration */: - case 255 /* ExportDeclaration */: - case 254 /* ExportAssignment */: + case 240 /* FunctionDeclaration */: + case 245 /* ModuleDeclaration */: + case 249 /* ImportEqualsDeclaration */: + case 242 /* InterfaceDeclaration */: + case 241 /* ClassDeclaration */: + case 243 /* TypeAliasDeclaration */: + case 244 /* EnumDeclaration */: + case 220 /* VariableStatement */: + case 250 /* ImportDeclaration */: + case 256 /* ExportDeclaration */: + case 255 /* ExportAssignment */: return true; } return false; } function isProcessedComponent(node) { switch (node.kind) { - case 161 /* ConstructSignature */: - case 157 /* Constructor */: - case 156 /* MethodDeclaration */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 154 /* PropertyDeclaration */: - case 153 /* PropertySignature */: - case 155 /* MethodSignature */: - case 160 /* CallSignature */: - case 162 /* IndexSignature */: - case 237 /* VariableDeclaration */: - case 150 /* TypeParameter */: - case 211 /* ExpressionWithTypeArguments */: - case 164 /* TypeReference */: - case 175 /* ConditionalType */: - case 165 /* FunctionType */: - case 166 /* ConstructorType */: - case 183 /* ImportType */: + case 162 /* ConstructSignature */: + case 158 /* Constructor */: + case 157 /* MethodDeclaration */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 155 /* PropertyDeclaration */: + case 154 /* PropertySignature */: + case 156 /* MethodSignature */: + case 161 /* CallSignature */: + case 163 /* IndexSignature */: + case 238 /* VariableDeclaration */: + case 151 /* TypeParameter */: + case 212 /* ExpressionWithTypeArguments */: + case 165 /* TypeReference */: + case 176 /* ConditionalType */: + case 166 /* FunctionType */: + case 167 /* ConstructorType */: + case 184 /* ImportType */: return true; } return false; @@ -82544,17 +83430,27 @@ var ts; SyntaxKindFeatureFlags[SyntaxKindFeatureFlags["Substitution"] = 1] = "Substitution"; SyntaxKindFeatureFlags[SyntaxKindFeatureFlags["EmitNotifications"] = 2] = "EmitNotifications"; })(SyntaxKindFeatureFlags || (SyntaxKindFeatureFlags = {})); - function getTransformers(compilerOptions, customTransformers) { + ts.noTransformers = { scriptTransformers: ts.emptyArray, declarationTransformers: ts.emptyArray }; + function getTransformers(compilerOptions, customTransformers, emitOnlyDtsFiles) { + return { + scriptTransformers: getScriptTransformers(compilerOptions, customTransformers, emitOnlyDtsFiles), + declarationTransformers: getDeclarationTransformers(customTransformers), + }; + } + ts.getTransformers = getTransformers; + function getScriptTransformers(compilerOptions, customTransformers, emitOnlyDtsFiles) { + if (emitOnlyDtsFiles) + return ts.emptyArray; var jsx = compilerOptions.jsx; var languageVersion = ts.getEmitScriptTarget(compilerOptions); var moduleKind = ts.getEmitModuleKind(compilerOptions); var transformers = []; - ts.addRange(transformers, customTransformers && customTransformers.before); + ts.addRange(transformers, customTransformers && ts.map(customTransformers.before, wrapScriptTransformerFactory)); transformers.push(ts.transformTypeScript); if (jsx === 2 /* React */) { transformers.push(ts.transformJsx); } - if (languageVersion < 7 /* ESNext */) { + if (languageVersion < 8 /* ESNext */) { transformers.push(ts.transformESNext); } if (languageVersion < 6 /* ES2019 */) { @@ -82579,10 +83475,38 @@ var ts; if (languageVersion < 1 /* ES5 */) { transformers.push(ts.transformES5); } - ts.addRange(transformers, customTransformers && customTransformers.after); + ts.addRange(transformers, customTransformers && ts.map(customTransformers.after, wrapScriptTransformerFactory)); return transformers; } - ts.getTransformers = getTransformers; + function getDeclarationTransformers(customTransformers) { + var transformers = []; + transformers.push(ts.transformDeclarations); + ts.addRange(transformers, customTransformers && ts.map(customTransformers.afterDeclarations, wrapDeclarationTransformerFactory)); + return transformers; + } + /** + * Wrap a custom script or declaration transformer object in a `Transformer` callback with fallback support for transforming bundles. + */ + function wrapCustomTransformer(transformer) { + return function (node) { return ts.isBundle(node) ? transformer.transformBundle(node) : transformer.transformSourceFile(node); }; + } + /** + * Wrap a transformer factory that may return a custom script or declaration transformer object. + */ + function wrapCustomTransformerFactory(transformer, handleDefault) { + return function (context) { + var customTransformer = transformer(context); + return typeof customTransformer === "function" + ? handleDefault(customTransformer) + : wrapCustomTransformer(customTransformer); + }; + } + function wrapScriptTransformerFactory(transformer) { + return wrapCustomTransformerFactory(transformer, ts.chainBundle); + } + function wrapDeclarationTransformerFactory(transformer) { + return wrapCustomTransformerFactory(transformer, ts.identity); + } function noEmitSubstitution(_hint, node) { return node; } @@ -82602,7 +83526,7 @@ var ts; * @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files. */ function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) { - var enabledSyntaxKindFeatures = new Array(317 /* Count */); + var enabledSyntaxKindFeatures = new Array(318 /* Count */); var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentVariableDeclarationsStack = []; @@ -82655,7 +83579,14 @@ var ts; } ts.performance.mark("beforeTransform"); // Chain together and initialize each transformer. - var transformation = ts.chain.apply(void 0, transformers)(context); + var transformersWithContext = transformers.map(function (t) { return t(context); }); + var transformation = function (node) { + for (var _i = 0, transformersWithContext_1 = transformersWithContext; _i < transformersWithContext_1.length; _i++) { + var transform = transformersWithContext_1[_i]; + node = transform(node); + } + return node; + }; // prevent modification of transformation hooks. state = 1 /* Initialized */; // Transform each node. @@ -82807,6 +83738,7 @@ var ts; if (lexicalEnvironmentVariableDeclarations) { var statement = ts.createVariableStatement( /*modifiers*/ undefined, ts.createVariableDeclarationList(lexicalEnvironmentVariableDeclarations)); + ts.setEmitFlags(statement, 1048576 /* CustomPrologue */); if (!statements) { statements = [statement]; } @@ -82914,7 +83846,7 @@ var ts; /*@internal*/ function getOutputPathForBuildInfo(options) { var configFile = options.configFilePath; - if (!configFile || !ts.isIncrementalCompilation(options)) + if (!ts.isIncrementalCompilation(options)) return undefined; if (options.tsBuildInfoFile) return options.tsBuildInfoFile; @@ -82924,6 +83856,8 @@ var ts; buildInfoExtensionLess = ts.removeFileExtension(outPath); } else { + if (!configFile) + return undefined; var configFileExtensionLess = ts.removeFileExtension(configFile); buildInfoExtensionLess = options.outDir ? options.rootDir ? @@ -82948,7 +83882,7 @@ var ts; /*@internal*/ function getOutputPathsFor(sourceFile, host, forceDtsPaths) { var options = host.getCompilerOptions(); - if (sourceFile.kind === 285 /* Bundle */) { + if (sourceFile.kind === 286 /* Bundle */) { return getOutputPathsForBundle(options, forceDtsPaths); } else { @@ -83075,14 +84009,15 @@ var ts; ts.getFirstProjectOutput = getFirstProjectOutput; /*@internal*/ // targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature - function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles, transformers, declarationTransformers, onlyBuildInfo) { + function emitFiles(resolver, host, targetSourceFile, _a, emitOnlyDtsFiles, onlyBuildInfo) { + var scriptTransformers = _a.scriptTransformers, declarationTransformers = _a.declarationTransformers; var compilerOptions = host.getCompilerOptions(); var sourceMapDataList = (compilerOptions.sourceMap || compilerOptions.inlineSourceMap || ts.getAreDeclarationMapsEnabled(compilerOptions)) ? [] : undefined; var emittedFilesList = compilerOptions.listEmittedFiles ? [] : undefined; var emitterDiagnostics = ts.createDiagnosticCollection(); var newLine = ts.getNewLineCharacter(compilerOptions, function () { return host.getNewLine(); }); var writer = ts.createTextWriter(newLine); - var _a = ts.performance.createTimer("printTime", "beforePrint", "afterPrint"), enter = _a.enter, exit = _a.exit; + var _b = ts.performance.createTimer("printTime", "beforePrint", "afterPrint"), enter = _b.enter, exit = _b.exit; var bundleBuildInfo; var emitSkipped = false; var exportedModulesFromDeclarationEmit; @@ -83151,7 +84086,7 @@ var ts; return; } // Transform the source files - var transform = ts.transformNodes(resolver, host, compilerOptions, [sourceFileOrBundle], transformers, /*allowDtsFiles*/ false); + var transform = ts.transformNodes(resolver, host, compilerOptions, [sourceFileOrBundle], scriptTransformers, /*allowDtsFiles*/ false); var printerOptions = { removeComments: compilerOptions.removeComments, newLine: compilerOptions.newLine, @@ -83192,7 +84127,7 @@ var ts; // Do that here when emitting only dts files nonJsFiles.forEach(collectLinkedAliases); } - var declarationTransform = ts.transformNodes(resolver, host, compilerOptions, inputListOrBundle, ts.concatenate([ts.transformDeclarations], declarationTransformers), /*allowDtsFiles*/ false); + var declarationTransform = ts.transformNodes(resolver, host, compilerOptions, inputListOrBundle, declarationTransformers, /*allowDtsFiles*/ false); if (ts.length(declarationTransform.diagnostics)) { for (var _a = 0, _b = declarationTransform.diagnostics; _a < _b.length; _a++) { var diagnostic = _b[_a]; @@ -83229,7 +84164,7 @@ var ts; mapRoot: compilerOptions.mapRoot, extendedDiagnostics: compilerOptions.extendedDiagnostics, }); - if (emitOnlyDtsFiles && declarationTransform.transformed[0].kind === 284 /* SourceFile */) { + if (emitOnlyDtsFiles && declarationTransform.transformed[0].kind === 285 /* SourceFile */) { var sourceFile = declarationTransform.transformed[0]; exportedModulesFromDeclarationEmit = sourceFile.exportedModulesFromDeclarationEmit; } @@ -83240,7 +84175,7 @@ var ts; } function collectLinkedAliases(node) { if (ts.isExportAssignment(node)) { - if (node.expression.kind === 72 /* Identifier */) { + if (node.expression.kind === 73 /* Identifier */) { resolver.collectLinkedAliases(node.expression, /*setVisibility*/ true); } return; @@ -83252,8 +84187,8 @@ var ts; ts.forEachChild(node, collectLinkedAliases); } function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle, printer, mapOptions) { - var bundle = sourceFileOrBundle.kind === 285 /* Bundle */ ? sourceFileOrBundle : undefined; - var sourceFile = sourceFileOrBundle.kind === 284 /* SourceFile */ ? sourceFileOrBundle : undefined; + var bundle = sourceFileOrBundle.kind === 286 /* Bundle */ ? sourceFileOrBundle : undefined; + var sourceFile = sourceFileOrBundle.kind === 285 /* SourceFile */ ? sourceFileOrBundle : undefined; var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; var sourceMapGenerator; if (shouldEmitSourceMaps(mapOptions, sourceFileOrBundle)) { @@ -83294,7 +84229,7 @@ var ts; } function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) { return (mapOptions.sourceMap || mapOptions.inlineSourceMap) - && (sourceFileOrBundle.kind !== 284 /* SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Json */)); + && (sourceFileOrBundle.kind !== 285 /* SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Json */)); } function getSourceRoot(mapOptions) { // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the @@ -83404,7 +84339,7 @@ var ts; }; function createSourceFilesFromBundleBuildInfo(bundle) { var sourceFiles = bundle.sourceFiles.map(function (fileName) { - var sourceFile = ts.createNode(284 /* SourceFile */, 0, 0); + var sourceFile = ts.createNode(285 /* SourceFile */, 0, 0); sourceFile.fileName = fileName; sourceFile.text = ""; sourceFile.statements = ts.createNodeArray(); @@ -83416,7 +84351,7 @@ var ts; sourceFile.text = prologueInfo.text; sourceFile.end = prologueInfo.text.length; sourceFile.statements = ts.createNodeArray(prologueInfo.directives.map(function (directive) { - var statement = ts.createNode(221 /* ExpressionStatement */, directive.pos, directive.end); + var statement = ts.createNode(222 /* ExpressionStatement */, directive.pos, directive.end); statement.expression = ts.createNode(10 /* StringLiteral */, directive.expression.pos, directive.expression.end); statement.expression.text = directive.expression.text; return statement; @@ -83508,7 +84443,7 @@ var ts; useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); }, getProgramBuildInfo: ts.returnUndefined }; - emitFiles(ts.notImplementedResolver, emitHost, /*targetSourceFile*/ undefined, /*emitOnlyDtsFiles*/ false, ts.getTransformers(config.options)); + emitFiles(ts.notImplementedResolver, emitHost, /*targetSourceFile*/ undefined, ts.getTransformers(config.options), /*emitOnlyDtsFiles*/ false); return outputFiles; } ts.emitUsingBuildInfo = emitUsingBuildInfo; @@ -83585,9 +84520,9 @@ var ts; break; } switch (node.kind) { - case 284 /* SourceFile */: return printFile(node); - case 285 /* Bundle */: return printBundle(node); - case 286 /* UnparsedSource */: return printUnparsedSource(node); + case 285 /* SourceFile */: return printFile(node); + case 286 /* Bundle */: return printBundle(node); + case 287 /* UnparsedSource */: return printUnparsedSource(node); } writeNode(hint, node, sourceFile, beginPrint()); return endPrint(); @@ -83817,12 +84752,12 @@ var ts; } // falls through case 2 /* Comments */: - if (!commentsDisabled && node.kind !== 284 /* SourceFile */) { + if (!commentsDisabled && node.kind !== 285 /* SourceFile */) { return pipelineEmitWithComments; } // falls through case 3 /* SourceMaps */: - if (!sourceMapsDisabled && node.kind !== 284 /* SourceFile */ && !ts.isInJsonFile(node)) { + if (!sourceMapsDisabled && node.kind !== 285 /* SourceFile */ && !ts.isInJsonFile(node)) { return pipelineEmitWithSourceMap; } // falls through @@ -83859,272 +84794,272 @@ var ts; case 16 /* TemplateMiddle */: case 17 /* TemplateTail */: return emitLiteral(node); - case 286 /* UnparsedSource */: - case 280 /* UnparsedPrepend */: + case 287 /* UnparsedSource */: + case 281 /* UnparsedPrepend */: return emitUnparsedSourceOrPrepend(node); - case 279 /* UnparsedPrologue */: + case 280 /* UnparsedPrologue */: return writeUnparsedNode(node); - case 281 /* UnparsedText */: - case 282 /* UnparsedInternalText */: + case 282 /* UnparsedText */: + case 283 /* UnparsedInternalText */: return emitUnparsedTextLike(node); - case 283 /* UnparsedSyntheticReference */: + case 284 /* UnparsedSyntheticReference */: return emitUnparsedSyntheticReference(node); // Identifiers - case 72 /* Identifier */: + case 73 /* Identifier */: return emitIdentifier(node); // Parse tree nodes // Names - case 148 /* QualifiedName */: + case 149 /* QualifiedName */: return emitQualifiedName(node); - case 149 /* ComputedPropertyName */: + case 150 /* ComputedPropertyName */: return emitComputedPropertyName(node); // Signature elements - case 150 /* TypeParameter */: + case 151 /* TypeParameter */: return emitTypeParameter(node); - case 151 /* Parameter */: + case 152 /* Parameter */: return emitParameter(node); - case 152 /* Decorator */: + case 153 /* Decorator */: return emitDecorator(node); // Type members - case 153 /* PropertySignature */: + case 154 /* PropertySignature */: return emitPropertySignature(node); - case 154 /* PropertyDeclaration */: + case 155 /* PropertyDeclaration */: return emitPropertyDeclaration(node); - case 155 /* MethodSignature */: + case 156 /* MethodSignature */: return emitMethodSignature(node); - case 156 /* MethodDeclaration */: + case 157 /* MethodDeclaration */: return emitMethodDeclaration(node); - case 157 /* Constructor */: + case 158 /* Constructor */: return emitConstructor(node); - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: return emitAccessorDeclaration(node); - case 160 /* CallSignature */: + case 161 /* CallSignature */: return emitCallSignature(node); - case 161 /* ConstructSignature */: + case 162 /* ConstructSignature */: return emitConstructSignature(node); - case 162 /* IndexSignature */: + case 163 /* IndexSignature */: return emitIndexSignature(node); // Types - case 163 /* TypePredicate */: + case 164 /* TypePredicate */: return emitTypePredicate(node); - case 164 /* TypeReference */: + case 165 /* TypeReference */: return emitTypeReference(node); - case 165 /* FunctionType */: + case 166 /* FunctionType */: return emitFunctionType(node); - case 294 /* JSDocFunctionType */: + case 295 /* JSDocFunctionType */: return emitJSDocFunctionType(node); - case 166 /* ConstructorType */: + case 167 /* ConstructorType */: return emitConstructorType(node); - case 167 /* TypeQuery */: + case 168 /* TypeQuery */: return emitTypeQuery(node); - case 168 /* TypeLiteral */: + case 169 /* TypeLiteral */: return emitTypeLiteral(node); - case 169 /* ArrayType */: + case 170 /* ArrayType */: return emitArrayType(node); - case 170 /* TupleType */: + case 171 /* TupleType */: return emitTupleType(node); - case 171 /* OptionalType */: + case 172 /* OptionalType */: return emitOptionalType(node); - case 173 /* UnionType */: + case 174 /* UnionType */: return emitUnionType(node); - case 174 /* IntersectionType */: + case 175 /* IntersectionType */: return emitIntersectionType(node); - case 175 /* ConditionalType */: + case 176 /* ConditionalType */: return emitConditionalType(node); - case 176 /* InferType */: + case 177 /* InferType */: return emitInferType(node); - case 177 /* ParenthesizedType */: + case 178 /* ParenthesizedType */: return emitParenthesizedType(node); - case 211 /* ExpressionWithTypeArguments */: + case 212 /* ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 178 /* ThisType */: + case 179 /* ThisType */: return emitThisType(); - case 179 /* TypeOperator */: + case 180 /* TypeOperator */: return emitTypeOperator(node); - case 180 /* IndexedAccessType */: + case 181 /* IndexedAccessType */: return emitIndexedAccessType(node); - case 181 /* MappedType */: + case 182 /* MappedType */: return emitMappedType(node); - case 182 /* LiteralType */: + case 183 /* LiteralType */: return emitLiteralType(node); - case 183 /* ImportType */: + case 184 /* ImportType */: return emitImportTypeNode(node); - case 289 /* JSDocAllType */: + case 290 /* JSDocAllType */: writePunctuation("*"); return; - case 290 /* JSDocUnknownType */: + case 291 /* JSDocUnknownType */: writePunctuation("?"); return; - case 291 /* JSDocNullableType */: + case 292 /* JSDocNullableType */: return emitJSDocNullableType(node); - case 292 /* JSDocNonNullableType */: + case 293 /* JSDocNonNullableType */: return emitJSDocNonNullableType(node); - case 293 /* JSDocOptionalType */: + case 294 /* JSDocOptionalType */: return emitJSDocOptionalType(node); - case 172 /* RestType */: - case 295 /* JSDocVariadicType */: + case 173 /* RestType */: + case 296 /* JSDocVariadicType */: return emitRestOrJSDocVariadicType(node); // Binding patterns - case 184 /* ObjectBindingPattern */: + case 185 /* ObjectBindingPattern */: return emitObjectBindingPattern(node); - case 185 /* ArrayBindingPattern */: + case 186 /* ArrayBindingPattern */: return emitArrayBindingPattern(node); - case 186 /* BindingElement */: + case 187 /* BindingElement */: return emitBindingElement(node); // Misc - case 216 /* TemplateSpan */: + case 217 /* TemplateSpan */: return emitTemplateSpan(node); - case 217 /* SemicolonClassElement */: + case 218 /* SemicolonClassElement */: return emitSemicolonClassElement(); // Statements - case 218 /* Block */: + case 219 /* Block */: return emitBlock(node); - case 219 /* VariableStatement */: + case 220 /* VariableStatement */: return emitVariableStatement(node); - case 220 /* EmptyStatement */: + case 221 /* EmptyStatement */: return emitEmptyStatement(/*isEmbeddedStatement*/ false); - case 221 /* ExpressionStatement */: + case 222 /* ExpressionStatement */: return emitExpressionStatement(node); - case 222 /* IfStatement */: + case 223 /* IfStatement */: return emitIfStatement(node); - case 223 /* DoStatement */: + case 224 /* DoStatement */: return emitDoStatement(node); - case 224 /* WhileStatement */: + case 225 /* WhileStatement */: return emitWhileStatement(node); - case 225 /* ForStatement */: + case 226 /* ForStatement */: return emitForStatement(node); - case 226 /* ForInStatement */: + case 227 /* ForInStatement */: return emitForInStatement(node); - case 227 /* ForOfStatement */: + case 228 /* ForOfStatement */: return emitForOfStatement(node); - case 228 /* ContinueStatement */: + case 229 /* ContinueStatement */: return emitContinueStatement(node); - case 229 /* BreakStatement */: + case 230 /* BreakStatement */: return emitBreakStatement(node); - case 230 /* ReturnStatement */: + case 231 /* ReturnStatement */: return emitReturnStatement(node); - case 231 /* WithStatement */: + case 232 /* WithStatement */: return emitWithStatement(node); - case 232 /* SwitchStatement */: + case 233 /* SwitchStatement */: return emitSwitchStatement(node); - case 233 /* LabeledStatement */: + case 234 /* LabeledStatement */: return emitLabeledStatement(node); - case 234 /* ThrowStatement */: + case 235 /* ThrowStatement */: return emitThrowStatement(node); - case 235 /* TryStatement */: + case 236 /* TryStatement */: return emitTryStatement(node); - case 236 /* DebuggerStatement */: + case 237 /* DebuggerStatement */: return emitDebuggerStatement(node); // Declarations - case 237 /* VariableDeclaration */: + case 238 /* VariableDeclaration */: return emitVariableDeclaration(node); - case 238 /* VariableDeclarationList */: + case 239 /* VariableDeclarationList */: return emitVariableDeclarationList(node); - case 239 /* FunctionDeclaration */: + case 240 /* FunctionDeclaration */: return emitFunctionDeclaration(node); - case 240 /* ClassDeclaration */: + case 241 /* ClassDeclaration */: return emitClassDeclaration(node); - case 241 /* InterfaceDeclaration */: + case 242 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 242 /* TypeAliasDeclaration */: + case 243 /* TypeAliasDeclaration */: return emitTypeAliasDeclaration(node); - case 243 /* EnumDeclaration */: + case 244 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 245 /* ModuleBlock */: + case 246 /* ModuleBlock */: return emitModuleBlock(node); - case 246 /* CaseBlock */: + case 247 /* CaseBlock */: return emitCaseBlock(node); - case 247 /* NamespaceExportDeclaration */: + case 248 /* NamespaceExportDeclaration */: return emitNamespaceExportDeclaration(node); - case 248 /* ImportEqualsDeclaration */: + case 249 /* ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 249 /* ImportDeclaration */: + case 250 /* ImportDeclaration */: return emitImportDeclaration(node); - case 250 /* ImportClause */: + case 251 /* ImportClause */: return emitImportClause(node); - case 251 /* NamespaceImport */: + case 252 /* NamespaceImport */: return emitNamespaceImport(node); - case 252 /* NamedImports */: + case 253 /* NamedImports */: return emitNamedImports(node); - case 253 /* ImportSpecifier */: + case 254 /* ImportSpecifier */: return emitImportSpecifier(node); - case 254 /* ExportAssignment */: + case 255 /* ExportAssignment */: return emitExportAssignment(node); - case 255 /* ExportDeclaration */: + case 256 /* ExportDeclaration */: return emitExportDeclaration(node); - case 256 /* NamedExports */: + case 257 /* NamedExports */: return emitNamedExports(node); - case 257 /* ExportSpecifier */: + case 258 /* ExportSpecifier */: return emitExportSpecifier(node); - case 258 /* MissingDeclaration */: + case 259 /* MissingDeclaration */: return; // Module references - case 259 /* ExternalModuleReference */: + case 260 /* ExternalModuleReference */: return emitExternalModuleReference(node); // JSX (non-expression) case 11 /* JsxText */: return emitJsxText(node); - case 262 /* JsxOpeningElement */: - case 265 /* JsxOpeningFragment */: + case 263 /* JsxOpeningElement */: + case 266 /* JsxOpeningFragment */: return emitJsxOpeningElementOrFragment(node); - case 263 /* JsxClosingElement */: - case 266 /* JsxClosingFragment */: + case 264 /* JsxClosingElement */: + case 267 /* JsxClosingFragment */: return emitJsxClosingElementOrFragment(node); - case 267 /* JsxAttribute */: + case 268 /* JsxAttribute */: return emitJsxAttribute(node); - case 268 /* JsxAttributes */: + case 269 /* JsxAttributes */: return emitJsxAttributes(node); - case 269 /* JsxSpreadAttribute */: + case 270 /* JsxSpreadAttribute */: return emitJsxSpreadAttribute(node); - case 270 /* JsxExpression */: + case 271 /* JsxExpression */: return emitJsxExpression(node); // Clauses - case 271 /* CaseClause */: + case 272 /* CaseClause */: return emitCaseClause(node); - case 272 /* DefaultClause */: + case 273 /* DefaultClause */: return emitDefaultClause(node); - case 273 /* HeritageClause */: + case 274 /* HeritageClause */: return emitHeritageClause(node); - case 274 /* CatchClause */: + case 275 /* CatchClause */: return emitCatchClause(node); // Property assignments - case 275 /* PropertyAssignment */: + case 276 /* PropertyAssignment */: return emitPropertyAssignment(node); - case 276 /* ShorthandPropertyAssignment */: + case 277 /* ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 277 /* SpreadAssignment */: + case 278 /* SpreadAssignment */: return emitSpreadAssignment(node); // Enum - case 278 /* EnumMember */: + case 279 /* EnumMember */: return emitEnumMember(node); // JSDoc nodes (only used in codefixes currently) - case 304 /* JSDocParameterTag */: - case 310 /* JSDocPropertyTag */: + case 305 /* JSDocParameterTag */: + case 311 /* JSDocPropertyTag */: return emitJSDocPropertyLikeTag(node); - case 305 /* JSDocReturnTag */: - case 307 /* JSDocTypeTag */: - case 306 /* JSDocThisTag */: - case 303 /* JSDocEnumTag */: + case 306 /* JSDocReturnTag */: + case 308 /* JSDocTypeTag */: + case 307 /* JSDocThisTag */: + case 304 /* JSDocEnumTag */: return emitJSDocSimpleTypedTag(node); - case 300 /* JSDocAugmentsTag */: + case 301 /* JSDocAugmentsTag */: return emitJSDocAugmentsTag(node); - case 308 /* JSDocTemplateTag */: + case 309 /* JSDocTemplateTag */: return emitJSDocTemplateTag(node); - case 309 /* JSDocTypedefTag */: + case 310 /* JSDocTypedefTag */: return emitJSDocTypedefTag(node); - case 302 /* JSDocCallbackTag */: + case 303 /* JSDocCallbackTag */: return emitJSDocCallbackTag(node); - case 298 /* JSDocSignature */: + case 299 /* JSDocSignature */: return emitJSDocSignature(node); - case 297 /* JSDocTypeLiteral */: + case 298 /* JSDocTypeLiteral */: return emitJSDocTypeLiteral(node); - case 301 /* JSDocClassTag */: - case 299 /* JSDocTag */: + case 302 /* JSDocClassTag */: + case 300 /* JSDocTag */: return emitJSDocSimpleTag(node); - case 296 /* JSDocComment */: + case 297 /* JSDocComment */: return emitJSDoc(node); // Transformation nodes (ignored) } @@ -84149,83 +85084,83 @@ var ts; case 14 /* NoSubstitutionTemplateLiteral */: return emitLiteral(node); // Identifiers - case 72 /* Identifier */: + case 73 /* Identifier */: return emitIdentifier(node); // Reserved words - case 87 /* FalseKeyword */: - case 96 /* NullKeyword */: - case 98 /* SuperKeyword */: - case 102 /* TrueKeyword */: - case 100 /* ThisKeyword */: - case 92 /* ImportKeyword */: + case 88 /* FalseKeyword */: + case 97 /* NullKeyword */: + case 99 /* SuperKeyword */: + case 103 /* TrueKeyword */: + case 101 /* ThisKeyword */: + case 93 /* ImportKeyword */: writeTokenNode(node, writeKeyword); return; // Expressions - case 187 /* ArrayLiteralExpression */: + case 188 /* ArrayLiteralExpression */: return emitArrayLiteralExpression(node); - case 188 /* ObjectLiteralExpression */: + case 189 /* ObjectLiteralExpression */: return emitObjectLiteralExpression(node); - case 189 /* PropertyAccessExpression */: + case 190 /* PropertyAccessExpression */: return emitPropertyAccessExpression(node); - case 190 /* ElementAccessExpression */: + case 191 /* ElementAccessExpression */: return emitElementAccessExpression(node); - case 191 /* CallExpression */: + case 192 /* CallExpression */: return emitCallExpression(node); - case 192 /* NewExpression */: + case 193 /* NewExpression */: return emitNewExpression(node); - case 193 /* TaggedTemplateExpression */: + case 194 /* TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 194 /* TypeAssertionExpression */: + case 195 /* TypeAssertionExpression */: return emitTypeAssertionExpression(node); - case 195 /* ParenthesizedExpression */: + case 196 /* ParenthesizedExpression */: return emitParenthesizedExpression(node); - case 196 /* FunctionExpression */: + case 197 /* FunctionExpression */: return emitFunctionExpression(node); - case 197 /* ArrowFunction */: + case 198 /* ArrowFunction */: return emitArrowFunction(node); - case 198 /* DeleteExpression */: + case 199 /* DeleteExpression */: return emitDeleteExpression(node); - case 199 /* TypeOfExpression */: + case 200 /* TypeOfExpression */: return emitTypeOfExpression(node); - case 200 /* VoidExpression */: + case 201 /* VoidExpression */: return emitVoidExpression(node); - case 201 /* AwaitExpression */: + case 202 /* AwaitExpression */: return emitAwaitExpression(node); - case 202 /* PrefixUnaryExpression */: + case 203 /* PrefixUnaryExpression */: return emitPrefixUnaryExpression(node); - case 203 /* PostfixUnaryExpression */: + case 204 /* PostfixUnaryExpression */: return emitPostfixUnaryExpression(node); - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: return emitBinaryExpression(node); - case 205 /* ConditionalExpression */: + case 206 /* ConditionalExpression */: return emitConditionalExpression(node); - case 206 /* TemplateExpression */: + case 207 /* TemplateExpression */: return emitTemplateExpression(node); - case 207 /* YieldExpression */: + case 208 /* YieldExpression */: return emitYieldExpression(node); - case 208 /* SpreadElement */: + case 209 /* SpreadElement */: return emitSpreadExpression(node); - case 209 /* ClassExpression */: + case 210 /* ClassExpression */: return emitClassExpression(node); - case 210 /* OmittedExpression */: + case 211 /* OmittedExpression */: return; - case 212 /* AsExpression */: + case 213 /* AsExpression */: return emitAsExpression(node); - case 213 /* NonNullExpression */: + case 214 /* NonNullExpression */: return emitNonNullExpression(node); - case 214 /* MetaProperty */: + case 215 /* MetaProperty */: return emitMetaProperty(node); // JSX - case 260 /* JsxElement */: + case 261 /* JsxElement */: return emitJsxElement(node); - case 261 /* JsxSelfClosingElement */: + case 262 /* JsxSelfClosingElement */: return emitJsxSelfClosingElement(node); - case 264 /* JsxFragment */: + case 265 /* JsxFragment */: return emitJsxFragment(node); // Transformation nodes - case 313 /* PartiallyEmittedExpression */: + case 314 /* PartiallyEmittedExpression */: return emitPartiallyEmittedExpression(node); - case 314 /* CommaListExpression */: + case 315 /* CommaListExpression */: return emitCommaList(node); } } @@ -84265,7 +85200,7 @@ var ts; } function emitHelpers(node) { var helpersEmitted = false; - var bundle = node.kind === 285 /* Bundle */ ? node : undefined; + var bundle = node.kind === 286 /* Bundle */ ? node : undefined; if (bundle && moduleKind === ts.ModuleKind.None) { return; } @@ -84365,7 +85300,7 @@ var ts; var pos = getTextPosWithWriteLine(); writeUnparsedNode(unparsed); if (bundleFileInfo) { - updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 281 /* UnparsedText */ ? + updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 282 /* UnparsedText */ ? "text" /* Text */ : "internal" /* Internal */); } @@ -84398,7 +85333,7 @@ var ts; emit(node.right); } function emitEntityName(node) { - if (node.kind === 72 /* Identifier */) { + if (node.kind === 73 /* Identifier */) { emitExpression(node); } else { @@ -84434,7 +85369,7 @@ var ts; emit(node.dotDotDotToken); emitNodeWithWriter(node.name, writeParameter); emit(node.questionToken); - if (node.parent && node.parent.kind === 294 /* JSDocFunctionType */ && !node.name) { + if (node.parent && node.parent.kind === 295 /* JSDocFunctionType */ && !node.name) { emit(node.type); } else { @@ -84496,7 +85431,7 @@ var ts; function emitAccessorDeclaration(node) { emitDecorators(node, node.decorators); emitModifiers(node, node.modifiers); - writeKeyword(node.kind === 158 /* GetAccessor */ ? "get" : "set"); + writeKeyword(node.kind === 159 /* GetAccessor */ ? "get" : "set"); writeSpace(); emit(node.name); emitSignatureAndBody(node, emitSignatureHead); @@ -84673,7 +85608,7 @@ var ts; } if (node.readonlyToken) { emit(node.readonlyToken); - if (node.readonlyToken.kind !== 133 /* ReadonlyKeyword */) { + if (node.readonlyToken.kind !== 134 /* ReadonlyKeyword */) { writeKeyword("readonly"); } writeSpace(); @@ -84823,7 +85758,7 @@ var ts; emitExpressionList(node, node.arguments, 2576 /* CallExpressionArguments */); } function emitNewExpression(node) { - emitTokenWithComment(95 /* NewKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(96 /* NewKeyword */, node.pos, writeKeyword, node); writeSpace(); emitExpression(node.expression); emitTypeArguments(node, node.typeArguments); @@ -84863,22 +85798,22 @@ var ts; emit(node.equalsGreaterThanToken); } function emitDeleteExpression(node) { - emitTokenWithComment(81 /* DeleteKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(82 /* DeleteKeyword */, node.pos, writeKeyword, node); writeSpace(); emitExpression(node.expression); } function emitTypeOfExpression(node) { - emitTokenWithComment(104 /* TypeOfKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(105 /* TypeOfKeyword */, node.pos, writeKeyword, node); writeSpace(); emitExpression(node.expression); } function emitVoidExpression(node) { - emitTokenWithComment(106 /* VoidKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(107 /* VoidKeyword */, node.pos, writeKeyword, node); writeSpace(); emitExpression(node.expression); } function emitAwaitExpression(node) { - emitTokenWithComment(122 /* AwaitKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(123 /* AwaitKeyword */, node.pos, writeKeyword, node); writeSpace(); emitExpression(node.expression); } @@ -84903,7 +85838,7 @@ var ts; // expression a prefix increment whose operand is a plus expression - (++(+x)) // The same is true of minus of course. var operand = node.operand; - return operand.kind === 202 /* PrefixUnaryExpression */ + return operand.kind === 203 /* PrefixUnaryExpression */ && ((node.operator === 38 /* PlusToken */ && (operand.operator === 38 /* PlusToken */ || operand.operator === 44 /* PlusPlusToken */)) || (node.operator === 39 /* MinusToken */ && (operand.operator === 39 /* MinusToken */ || operand.operator === 45 /* MinusMinusToken */))); } @@ -84918,7 +85853,7 @@ var ts; emitExpression(node.left); increaseIndentIf(indentBeforeOperator, isCommaOperator); emitLeadingCommentsOfPosition(node.operatorToken.pos); - writeTokenNode(node.operatorToken, node.operatorToken.kind === 93 /* InKeyword */ ? writeKeyword : writeOperator); + writeTokenNode(node.operatorToken, node.operatorToken.kind === 94 /* InKeyword */ ? writeKeyword : writeOperator); emitTrailingCommentsOfPosition(node.operatorToken.end, /*prefixSpace*/ true); // Binary operators should have a space before the comment starts increaseIndentIf(indentAfterOperator, /*writeSpaceIfNotIndenting*/ true); emitExpression(node.right); @@ -84946,7 +85881,7 @@ var ts; emitList(node, node.templateSpans, 262144 /* TemplateExpressionSpans */); } function emitYieldExpression(node) { - emitTokenWithComment(117 /* YieldKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(118 /* YieldKeyword */, node.pos, writeKeyword, node); emit(node.asteriskToken); emitExpressionWithLeadingSpace(node.expression); } @@ -85023,7 +85958,7 @@ var ts; } } function emitIfStatement(node) { - var openParenPos = emitTokenWithComment(91 /* IfKeyword */, node.pos, writeKeyword, node); + var openParenPos = emitTokenWithComment(92 /* IfKeyword */, node.pos, writeKeyword, node); writeSpace(); emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node); emitExpression(node.expression); @@ -85031,8 +85966,8 @@ var ts; emitEmbeddedStatement(node, node.thenStatement); if (node.elseStatement) { writeLineOrSpace(node); - emitTokenWithComment(83 /* ElseKeyword */, node.thenStatement.end, writeKeyword, node); - if (node.elseStatement.kind === 222 /* IfStatement */) { + emitTokenWithComment(84 /* ElseKeyword */, node.thenStatement.end, writeKeyword, node); + if (node.elseStatement.kind === 223 /* IfStatement */) { writeSpace(); emit(node.elseStatement); } @@ -85042,14 +85977,14 @@ var ts; } } function emitWhileClause(node, startPos) { - var openParenPos = emitTokenWithComment(107 /* WhileKeyword */, startPos, writeKeyword, node); + var openParenPos = emitTokenWithComment(108 /* WhileKeyword */, startPos, writeKeyword, node); writeSpace(); emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node); emitExpression(node.expression); emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node); } function emitDoStatement(node) { - emitTokenWithComment(82 /* DoKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(83 /* DoKeyword */, node.pos, writeKeyword, node); emitEmbeddedStatement(node, node.statement); if (ts.isBlock(node.statement)) { writeSpace(); @@ -85065,7 +86000,7 @@ var ts; emitEmbeddedStatement(node, node.statement); } function emitForStatement(node) { - var openParenPos = emitTokenWithComment(89 /* ForKeyword */, node.pos, writeKeyword, node); + var openParenPos = emitTokenWithComment(90 /* ForKeyword */, node.pos, writeKeyword, node); writeSpace(); var pos = emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, /*contextNode*/ node); emitForBinding(node.initializer); @@ -85077,25 +86012,25 @@ var ts; emitEmbeddedStatement(node, node.statement); } function emitForInStatement(node) { - var openParenPos = emitTokenWithComment(89 /* ForKeyword */, node.pos, writeKeyword, node); + var openParenPos = emitTokenWithComment(90 /* ForKeyword */, node.pos, writeKeyword, node); writeSpace(); emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node); emitForBinding(node.initializer); writeSpace(); - emitTokenWithComment(93 /* InKeyword */, node.initializer.end, writeKeyword, node); + emitTokenWithComment(94 /* InKeyword */, node.initializer.end, writeKeyword, node); writeSpace(); emitExpression(node.expression); emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node); emitEmbeddedStatement(node, node.statement); } function emitForOfStatement(node) { - var openParenPos = emitTokenWithComment(89 /* ForKeyword */, node.pos, writeKeyword, node); + var openParenPos = emitTokenWithComment(90 /* ForKeyword */, node.pos, writeKeyword, node); writeSpace(); emitWithTrailingSpace(node.awaitModifier); emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node); emitForBinding(node.initializer); writeSpace(); - emitTokenWithComment(147 /* OfKeyword */, node.initializer.end, writeKeyword, node); + emitTokenWithComment(148 /* OfKeyword */, node.initializer.end, writeKeyword, node); writeSpace(); emitExpression(node.expression); emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node); @@ -85103,7 +86038,7 @@ var ts; } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 238 /* VariableDeclarationList */) { + if (node.kind === 239 /* VariableDeclarationList */) { emit(node); } else { @@ -85112,12 +86047,12 @@ var ts; } } function emitContinueStatement(node) { - emitTokenWithComment(78 /* ContinueKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(79 /* ContinueKeyword */, node.pos, writeKeyword, node); emitWithLeadingSpace(node.label); writeTrailingSemicolon(); } function emitBreakStatement(node) { - emitTokenWithComment(73 /* BreakKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(74 /* BreakKeyword */, node.pos, writeKeyword, node); emitWithLeadingSpace(node.label); writeTrailingSemicolon(); } @@ -85145,12 +86080,12 @@ var ts; return pos; } function emitReturnStatement(node) { - emitTokenWithComment(97 /* ReturnKeyword */, node.pos, writeKeyword, /*contextNode*/ node); + emitTokenWithComment(98 /* ReturnKeyword */, node.pos, writeKeyword, /*contextNode*/ node); emitExpressionWithLeadingSpace(node.expression); writeTrailingSemicolon(); } function emitWithStatement(node) { - var openParenPos = emitTokenWithComment(108 /* WithKeyword */, node.pos, writeKeyword, node); + var openParenPos = emitTokenWithComment(109 /* WithKeyword */, node.pos, writeKeyword, node); writeSpace(); emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node); emitExpression(node.expression); @@ -85158,7 +86093,7 @@ var ts; emitEmbeddedStatement(node, node.statement); } function emitSwitchStatement(node) { - var openParenPos = emitTokenWithComment(99 /* SwitchKeyword */, node.pos, writeKeyword, node); + var openParenPos = emitTokenWithComment(100 /* SwitchKeyword */, node.pos, writeKeyword, node); writeSpace(); emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node); emitExpression(node.expression); @@ -85173,12 +86108,12 @@ var ts; emit(node.statement); } function emitThrowStatement(node) { - emitTokenWithComment(101 /* ThrowKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(102 /* ThrowKeyword */, node.pos, writeKeyword, node); emitExpressionWithLeadingSpace(node.expression); writeTrailingSemicolon(); } function emitTryStatement(node) { - emitTokenWithComment(103 /* TryKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(104 /* TryKeyword */, node.pos, writeKeyword, node); writeSpace(); emit(node.tryBlock); if (node.catchClause) { @@ -85187,13 +86122,13 @@ var ts; } if (node.finallyBlock) { writeLineOrSpace(node); - emitTokenWithComment(88 /* FinallyKeyword */, (node.catchClause || node.tryBlock).end, writeKeyword, node); + emitTokenWithComment(89 /* FinallyKeyword */, (node.catchClause || node.tryBlock).end, writeKeyword, node); writeSpace(); emit(node.finallyBlock); } } function emitDebuggerStatement(node) { - writeToken(79 /* DebuggerKeyword */, node.pos, writeKeyword); + writeToken(80 /* DebuggerKeyword */, node.pos, writeKeyword); writeTrailingSemicolon(); } // @@ -85398,7 +86333,7 @@ var ts; var body = node.body; if (!body) return writeTrailingSemicolon(); - while (body.kind === 244 /* ModuleDeclaration */) { + while (body.kind === 245 /* ModuleDeclaration */) { writePunctuation("."); emit(body.name); body = body.body; @@ -85419,17 +86354,17 @@ var ts; } function emitImportEqualsDeclaration(node) { emitModifiers(node, node.modifiers); - emitTokenWithComment(92 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node); + emitTokenWithComment(93 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node); writeSpace(); emit(node.name); writeSpace(); - emitTokenWithComment(59 /* EqualsToken */, node.name.end, writePunctuation, node); + emitTokenWithComment(60 /* EqualsToken */, node.name.end, writePunctuation, node); writeSpace(); emitModuleReference(node.moduleReference); writeTrailingSemicolon(); } function emitModuleReference(node) { - if (node.kind === 72 /* Identifier */) { + if (node.kind === 73 /* Identifier */) { emitExpression(node); } else { @@ -85438,12 +86373,12 @@ var ts; } function emitImportDeclaration(node) { emitModifiers(node, node.modifiers); - emitTokenWithComment(92 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node); + emitTokenWithComment(93 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node); writeSpace(); if (node.importClause) { emit(node.importClause); writeSpace(); - emitTokenWithComment(144 /* FromKeyword */, node.importClause.end, writeKeyword, node); + emitTokenWithComment(145 /* FromKeyword */, node.importClause.end, writeKeyword, node); writeSpace(); } emitExpression(node.moduleSpecifier); @@ -85460,7 +86395,7 @@ var ts; function emitNamespaceImport(node) { var asPos = emitTokenWithComment(40 /* AsteriskToken */, node.pos, writePunctuation, node); writeSpace(); - emitTokenWithComment(119 /* AsKeyword */, asPos, writeKeyword, node); + emitTokenWithComment(120 /* AsKeyword */, asPos, writeKeyword, node); writeSpace(); emit(node.name); } @@ -85471,20 +86406,20 @@ var ts; emitImportOrExportSpecifier(node); } function emitExportAssignment(node) { - var nextPos = emitTokenWithComment(85 /* ExportKeyword */, node.pos, writeKeyword, node); + var nextPos = emitTokenWithComment(86 /* ExportKeyword */, node.pos, writeKeyword, node); writeSpace(); if (node.isExportEquals) { - emitTokenWithComment(59 /* EqualsToken */, nextPos, writeOperator, node); + emitTokenWithComment(60 /* EqualsToken */, nextPos, writeOperator, node); } else { - emitTokenWithComment(80 /* DefaultKeyword */, nextPos, writeKeyword, node); + emitTokenWithComment(81 /* DefaultKeyword */, nextPos, writeKeyword, node); } writeSpace(); emitExpression(node.expression); writeTrailingSemicolon(); } function emitExportDeclaration(node) { - var nextPos = emitTokenWithComment(85 /* ExportKeyword */, node.pos, writeKeyword, node); + var nextPos = emitTokenWithComment(86 /* ExportKeyword */, node.pos, writeKeyword, node); writeSpace(); if (node.exportClause) { emit(node.exportClause); @@ -85495,18 +86430,18 @@ var ts; if (node.moduleSpecifier) { writeSpace(); var fromPos = node.exportClause ? node.exportClause.end : nextPos; - emitTokenWithComment(144 /* FromKeyword */, fromPos, writeKeyword, node); + emitTokenWithComment(145 /* FromKeyword */, fromPos, writeKeyword, node); writeSpace(); emitExpression(node.moduleSpecifier); } writeTrailingSemicolon(); } function emitNamespaceExportDeclaration(node) { - var nextPos = emitTokenWithComment(85 /* ExportKeyword */, node.pos, writeKeyword, node); + var nextPos = emitTokenWithComment(86 /* ExportKeyword */, node.pos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(119 /* AsKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(120 /* AsKeyword */, nextPos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(131 /* NamespaceKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(132 /* NamespaceKeyword */, nextPos, writeKeyword, node); writeSpace(); emit(node.name); writeTrailingSemicolon(); @@ -85526,7 +86461,7 @@ var ts; if (node.propertyName) { emit(node.propertyName); writeSpace(); - emitTokenWithComment(119 /* AsKeyword */, node.propertyName.end, writeKeyword, node); + emitTokenWithComment(120 /* AsKeyword */, node.propertyName.end, writeKeyword, node); writeSpace(); } emit(node.name); @@ -85604,7 +86539,7 @@ var ts; } } function emitJsxTagName(node) { - if (node.kind === 72 /* Identifier */) { + if (node.kind === 73 /* Identifier */) { emitExpression(node); } else { @@ -85615,13 +86550,13 @@ var ts; // Clauses // function emitCaseClause(node) { - emitTokenWithComment(74 /* CaseKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(75 /* CaseKeyword */, node.pos, writeKeyword, node); writeSpace(); emitExpression(node.expression); emitCaseOrDefaultClauseRest(node, node.statements, node.expression.end); } function emitDefaultClause(node) { - var pos = emitTokenWithComment(80 /* DefaultKeyword */, node.pos, writeKeyword, node); + var pos = emitTokenWithComment(81 /* DefaultKeyword */, node.pos, writeKeyword, node); emitCaseOrDefaultClauseRest(node, node.statements, pos); } function emitCaseOrDefaultClauseRest(parentNode, statements, colonPos) { @@ -85649,7 +86584,7 @@ var ts; emitList(node, node.types, 528 /* HeritageClauseTypes */); } function emitCatchClause(node) { - var openParenPos = emitTokenWithComment(75 /* CatchKeyword */, node.pos, writeKeyword, node); + var openParenPos = emitTokenWithComment(76 /* CatchKeyword */, node.pos, writeKeyword, node); writeSpace(); if (node.variableDeclaration) { emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node); @@ -85719,7 +86654,7 @@ var ts; } } if (node.tags) { - if (node.tags.length === 1 && node.tags[0].kind === 307 /* JSDocTypeTag */ && !node.comment) { + if (node.tags.length === 1 && node.tags[0].kind === 308 /* JSDocTypeTag */ && !node.comment) { writeSpace(); emit(node.tags[0]); } @@ -85753,7 +86688,7 @@ var ts; function emitJSDocTypedefTag(tag) { emitJSDocTagName(tag.tagName); if (tag.typeExpression) { - if (tag.typeExpression.kind === 288 /* JSDocTypeExpression */) { + if (tag.typeExpression.kind === 289 /* JSDocTypeExpression */) { emitJSDocTypeExpression(tag.typeExpression); } else { @@ -85772,7 +86707,7 @@ var ts; emit(tag.fullName); } emitJSDocComment(tag.comment); - if (tag.typeExpression && tag.typeExpression.kind === 297 /* JSDocTypeLiteral */) { + if (tag.typeExpression && tag.typeExpression.kind === 298 /* JSDocTypeLiteral */) { emitJSDocTypeLiteral(tag.typeExpression); } } @@ -85906,8 +86841,8 @@ var ts; bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "reference" /* Reference */, data: directive.fileName }); writeLine(); } - for (var _d = 0, types_19 = types; _d < types_19.length; _d++) { - var directive = types_19[_d]; + for (var _d = 0, types_18 = types; _d < types_18.length; _d++) { + var directive = types_18[_d]; var pos = writer.getTextPos(); writeComment("/// "); if (bundleFileInfo) @@ -86087,7 +87022,7 @@ var ts; function emitInitializer(node, equalCommentStartPos, container) { if (node) { writeSpace(); - emitTokenWithComment(59 /* EqualsToken */, equalCommentStartPos, writeOperator, container); + emitTokenWithComment(60 /* EqualsToken */, equalCommentStartPos, writeOperator, container); writeSpace(); emitExpression(node); } @@ -86550,7 +87485,7 @@ var ts; && ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile); } function skipSynthesizedParentheses(node) { - while (node.kind === 195 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { + while (node.kind === 196 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { node = node.expression; } return node; @@ -86615,81 +87550,81 @@ var ts; if (!node) return; switch (node.kind) { - case 218 /* Block */: + case 219 /* Block */: ts.forEach(node.statements, generateNames); break; - case 233 /* LabeledStatement */: - case 231 /* WithStatement */: - case 223 /* DoStatement */: - case 224 /* WhileStatement */: + case 234 /* LabeledStatement */: + case 232 /* WithStatement */: + case 224 /* DoStatement */: + case 225 /* WhileStatement */: generateNames(node.statement); break; - case 222 /* IfStatement */: + case 223 /* IfStatement */: generateNames(node.thenStatement); generateNames(node.elseStatement); break; - case 225 /* ForStatement */: - case 227 /* ForOfStatement */: - case 226 /* ForInStatement */: + case 226 /* ForStatement */: + case 228 /* ForOfStatement */: + case 227 /* ForInStatement */: generateNames(node.initializer); generateNames(node.statement); break; - case 232 /* SwitchStatement */: + case 233 /* SwitchStatement */: generateNames(node.caseBlock); break; - case 246 /* CaseBlock */: + case 247 /* CaseBlock */: ts.forEach(node.clauses, generateNames); break; - case 271 /* CaseClause */: - case 272 /* DefaultClause */: + case 272 /* CaseClause */: + case 273 /* DefaultClause */: ts.forEach(node.statements, generateNames); break; - case 235 /* TryStatement */: + case 236 /* TryStatement */: generateNames(node.tryBlock); generateNames(node.catchClause); generateNames(node.finallyBlock); break; - case 274 /* CatchClause */: + case 275 /* CatchClause */: generateNames(node.variableDeclaration); generateNames(node.block); break; - case 219 /* VariableStatement */: + case 220 /* VariableStatement */: generateNames(node.declarationList); break; - case 238 /* VariableDeclarationList */: + case 239 /* VariableDeclarationList */: ts.forEach(node.declarations, generateNames); break; - case 237 /* VariableDeclaration */: - case 151 /* Parameter */: - case 186 /* BindingElement */: - case 240 /* ClassDeclaration */: + case 238 /* VariableDeclaration */: + case 152 /* Parameter */: + case 187 /* BindingElement */: + case 241 /* ClassDeclaration */: generateNameIfNeeded(node.name); break; - case 239 /* FunctionDeclaration */: + case 240 /* FunctionDeclaration */: generateNameIfNeeded(node.name); if (ts.getEmitFlags(node) & 524288 /* ReuseTempVariableScope */) { ts.forEach(node.parameters, generateNames); generateNames(node.body); } break; - case 184 /* ObjectBindingPattern */: - case 185 /* ArrayBindingPattern */: + case 185 /* ObjectBindingPattern */: + case 186 /* ArrayBindingPattern */: ts.forEach(node.elements, generateNames); break; - case 249 /* ImportDeclaration */: + case 250 /* ImportDeclaration */: generateNames(node.importClause); break; - case 250 /* ImportClause */: + case 251 /* ImportClause */: generateNameIfNeeded(node.name); generateNames(node.namedBindings); break; - case 251 /* NamespaceImport */: + case 252 /* NamespaceImport */: generateNameIfNeeded(node.name); break; - case 252 /* NamedImports */: + case 253 /* NamedImports */: ts.forEach(node.elements, generateNames); break; - case 253 /* ImportSpecifier */: + case 254 /* ImportSpecifier */: generateNameIfNeeded(node.propertyName || node.name); break; } @@ -86698,12 +87633,12 @@ var ts; if (!node) return; switch (node.kind) { - case 275 /* PropertyAssignment */: - case 276 /* ShorthandPropertyAssignment */: - case 154 /* PropertyDeclaration */: - case 156 /* MethodDeclaration */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 276 /* PropertyAssignment */: + case 277 /* ShorthandPropertyAssignment */: + case 155 /* PropertyDeclaration */: + case 157 /* MethodDeclaration */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: generateNameIfNeeded(node.name); break; } @@ -86883,24 +87818,26 @@ var ts; */ function generateNameForNode(node, flags) { switch (node.kind) { - case 72 /* Identifier */: + case 73 /* Identifier */: return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16 /* Optimistic */), !!(flags & 8 /* ReservedInNestedScopes */)); - case 244 /* ModuleDeclaration */: - case 243 /* EnumDeclaration */: + case 245 /* ModuleDeclaration */: + case 244 /* EnumDeclaration */: return generateNameForModuleOrEnum(node); - case 249 /* ImportDeclaration */: - case 255 /* ExportDeclaration */: + case 250 /* ImportDeclaration */: + case 256 /* ExportDeclaration */: return generateNameForImportOrExportDeclaration(node); - case 239 /* FunctionDeclaration */: - case 240 /* ClassDeclaration */: - case 254 /* ExportAssignment */: + case 240 /* FunctionDeclaration */: + case 241 /* ClassDeclaration */: + case 255 /* ExportAssignment */: return generateNameForExportDefault(); - case 209 /* ClassExpression */: + case 210 /* ClassExpression */: return generateNameForClassExpression(); - case 156 /* MethodDeclaration */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 157 /* MethodDeclaration */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: return generateNameForMethodOrAccessor(node); + case 150 /* ComputedPropertyName */: + return makeTempVariableName(0 /* Auto */, /*reserveInNestedScopes*/ true); default: return makeTempVariableName(0 /* Auto */); } @@ -86946,7 +87883,7 @@ var ts; hasWrittenComment = false; var emitFlags = ts.getEmitFlags(node); var _a = ts.getCommentRange(node), pos = _a.pos, end = _a.end; - var isEmittedNode = node.kind !== 312 /* NotEmittedStatement */; + var isEmittedNode = node.kind !== 313 /* NotEmittedStatement */; // We have to explicitly check that the node is JsxText because if the compilerOptions.jsx is "preserve" we will not do any transformation. // It is expensive to walk entire tree just to set one kind of node to have no comments. var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0 || node.kind === 11 /* JsxText */; @@ -86970,7 +87907,7 @@ var ts; containerEnd = end; // To avoid invalid comment emit in a down-level binding pattern, we // keep track of the last declaration list container's end - if (node.kind === 238 /* VariableDeclarationList */) { + if (node.kind === 239 /* VariableDeclarationList */) { declarationListContainerEnd = end; } } @@ -87227,7 +88164,7 @@ var ts; else { var _a = ts.getSourceMapRange(node), pos = _a.pos, end = _a.end, _b = _a.source, source = _b === void 0 ? sourceMapSource : _b; var emitFlags = ts.getEmitFlags(node); - if (node.kind !== 312 /* NotEmittedStatement */ + if (node.kind !== 313 /* NotEmittedStatement */ && (emitFlags & 16 /* NoLeadingSourceMap */) === 0 && pos >= 0) { emitSourcePos(source, skipSourceTrivia(source, pos)); @@ -87240,7 +88177,7 @@ var ts; else { pipelinePhase(hint, node); } - if (node.kind !== 312 /* NotEmittedStatement */ + if (node.kind !== 313 /* NotEmittedStatement */ && (emitFlags & 32 /* NoTrailingSourceMap */) === 0 && end >= 0) { emitSourcePos(source, end); @@ -87855,7 +88792,8 @@ var ts; getDirectories: function (path) { return system.getDirectories(path); }, realpath: realpath, readDirectory: function (path, extensions, include, exclude, depth) { return system.readDirectory(path, extensions, include, exclude, depth); }, - createDirectory: function (d) { return system.createDirectory(d); } + createDirectory: function (d) { return system.createDirectory(d); }, + createHash: ts.maybeBind(system, system.createHash) }; return compilerHost; } @@ -88141,6 +89079,7 @@ var ts; } } ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText; + /* @internal */ function loadWithLocalCache(names, containingFile, redirectedReference, loader) { if (names.length === 0) { return []; @@ -88160,6 +89099,7 @@ var ts; } return resolutions; } + ts.loadWithLocalCache = loadWithLocalCache; /** * Determines if program structure is upto date or needs to be recreated */ @@ -88319,7 +89259,7 @@ var ts; }); }; } else { - moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); }); + moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); }, options); var loader_1 = function (moduleName, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache, redirectedReference).resolvedModule; }; // TODO: GH#18217 resolveModuleNamesWorker = function (moduleNames, containingFile, _reusedNames, redirectedReference) { return loadWithLocalCache(ts.Debug.assertEachDefined(moduleNames), containingFile, redirectedReference, loader_1); }; } @@ -88465,6 +89405,7 @@ var ts; getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); }, + getRelationCacheSizes: function () { return getDiagnosticsProducingTypeChecker().getRelationCacheSizes(); }, getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; }, getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; }, isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary, @@ -88562,13 +89503,13 @@ var ts; // which per above occurred during the current program creation. // Since we assume the filesystem does not change during program creation, // it is safe to reuse resolutions from the earlier call. - var result_6 = []; + var result_8 = []; for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) { var moduleName = moduleNames_1[_i]; var resolvedModule = file.resolvedModules.get(moduleName); - result_6.push(resolvedModule); + result_8.push(resolvedModule); } - return result_6; + return result_8; } // At this point, we know at least one of the following hold: // - file has local declarations for ambient modules @@ -88655,7 +89596,7 @@ var ts; function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) { var resolutionToFile = ts.getResolvedModule(oldSourceFile, moduleName); var resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName); - if (resolutionToFile && resolvedFile && !resolvedFile.externalModuleIndicator) { + if (resolutionToFile && resolvedFile) { // In the old program, we resolved to an ambient module that was in the same // place as we expected to find an actual module file. // We actually need to return 'false' here even though this seems like a 'true' case @@ -88918,9 +89859,8 @@ var ts; ts.performance.mark("beforeEmit"); var emitResult = ts.emitFiles(ts.notImplementedResolver, getEmitHost(writeFileCallback), /*targetSourceFile*/ undefined, + /*transformers*/ ts.noTransformers, /*emitOnlyDtsFiles*/ false, - /*transformers*/ undefined, - /*declaraitonTransformers*/ undefined, /*onlyBuildInfo*/ true); ts.performance.mark("afterEmit"); ts.performance.measure("Emit", "beforeEmit", "afterEmit"); @@ -89008,8 +89948,7 @@ var ts; // checked is to not pass the file to getEmitResolver. var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out) ? undefined : sourceFile, cancellationToken); ts.performance.mark("beforeEmit"); - var transformers = emitOnlyDtsFiles ? [] : ts.getTransformers(options, customTransformers); - var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, emitOnlyDtsFiles, transformers, customTransformers && customTransformers.afterDeclarations); + var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, ts.getTransformers(options, customTransformers, emitOnlyDtsFiles), emitOnlyDtsFiles); ts.performance.mark("afterEmit"); ts.performance.measure("Emit", "beforeEmit", "afterEmit"); return emitResult; @@ -89151,22 +90090,22 @@ var ts; // Return directly from the case if the given node doesnt want to visit each child // Otherwise break to visit each child switch (parent.kind) { - case 151 /* Parameter */: - case 154 /* PropertyDeclaration */: + case 152 /* Parameter */: + case 155 /* PropertyDeclaration */: if (parent.questionToken === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?")); return; } // falls through - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: - case 157 /* Constructor */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 196 /* FunctionExpression */: - case 239 /* FunctionDeclaration */: - case 197 /* ArrowFunction */: - case 237 /* VariableDeclaration */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: + case 158 /* Constructor */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 197 /* FunctionExpression */: + case 240 /* FunctionDeclaration */: + case 198 /* ArrowFunction */: + case 238 /* VariableDeclaration */: // type annotation if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); @@ -89174,41 +90113,41 @@ var ts; } } switch (node.kind) { - case 248 /* ImportEqualsDeclaration */: + case 249 /* ImportEqualsDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return; - case 254 /* ExportAssignment */: + case 255 /* ExportAssignment */: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return; } break; - case 273 /* HeritageClause */: + case 274 /* HeritageClause */: var heritageClause = node; - if (heritageClause.token === 109 /* ImplementsKeyword */) { + if (heritageClause.token === 110 /* ImplementsKeyword */) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return; } break; - case 241 /* InterfaceDeclaration */: + case 242 /* InterfaceDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return; - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return; - case 242 /* TypeAliasDeclaration */: + case 243 /* TypeAliasDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return; - case 243 /* EnumDeclaration */: + case 244 /* EnumDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return; - case 213 /* NonNullExpression */: + case 214 /* NonNullExpression */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.non_null_assertions_can_only_be_used_in_a_ts_file)); return; - case 212 /* AsExpression */: + case 213 /* AsExpression */: diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); return; - case 194 /* TypeAssertionExpression */: + case 195 /* TypeAssertionExpression */: ts.Debug.fail(); // Won't parse these in a JS file anyway, as they are interpreted as JSX. } var prevParent = parent; @@ -89218,54 +90157,54 @@ var ts; } function walkArray(nodes) { if (parent.decorators === nodes && !options.experimentalDecorators) { - diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning)); + diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning)); } switch (parent.kind) { - case 240 /* ClassDeclaration */: - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: - case 157 /* Constructor */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 196 /* FunctionExpression */: - case 239 /* FunctionDeclaration */: - case 197 /* ArrowFunction */: + case 241 /* ClassDeclaration */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: + case 158 /* Constructor */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 197 /* FunctionExpression */: + case 240 /* FunctionDeclaration */: + case 198 /* ArrowFunction */: // Check type parameters if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); return; } // falls through - case 219 /* VariableStatement */: + case 220 /* VariableStatement */: // Check modifiers if (nodes === parent.modifiers) { - return checkModifiers(nodes, parent.kind === 219 /* VariableStatement */); + return checkModifiers(nodes, parent.kind === 220 /* VariableStatement */); } break; - case 154 /* PropertyDeclaration */: + case 155 /* PropertyDeclaration */: // Check modifiers of property declaration if (nodes === parent.modifiers) { for (var _i = 0, _a = nodes; _i < _a.length; _i++) { var modifier = _a[_i]; - if (modifier.kind !== 116 /* StaticKeyword */) { + if (modifier.kind !== 117 /* StaticKeyword */) { diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind))); } } return; } break; - case 151 /* Parameter */: + case 152 /* Parameter */: // Check modifiers of parameter declaration if (nodes === parent.modifiers) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file)); return; } break; - case 191 /* CallExpression */: - case 192 /* NewExpression */: - case 211 /* ExpressionWithTypeArguments */: - case 261 /* JsxSelfClosingElement */: - case 262 /* JsxOpeningElement */: + case 192 /* CallExpression */: + case 193 /* NewExpression */: + case 212 /* ExpressionWithTypeArguments */: + case 262 /* JsxSelfClosingElement */: + case 263 /* JsxOpeningElement */: // Check type arguments if (nodes === parent.typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); @@ -89282,24 +90221,24 @@ var ts; for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) { var modifier = modifiers_1[_i]; switch (modifier.kind) { - case 77 /* ConstKeyword */: + case 78 /* ConstKeyword */: if (isConstValid) { continue; } // to report error, // falls through - case 115 /* PublicKeyword */: - case 113 /* PrivateKeyword */: - case 114 /* ProtectedKeyword */: - case 133 /* ReadonlyKeyword */: - case 125 /* DeclareKeyword */: - case 118 /* AbstractKeyword */: + case 116 /* PublicKeyword */: + case 114 /* PrivateKeyword */: + case 115 /* ProtectedKeyword */: + case 134 /* ReadonlyKeyword */: + case 126 /* DeclareKeyword */: + case 119 /* AbstractKeyword */: diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind))); break; // These are all legal modifiers. - case 116 /* StaticKeyword */: - case 85 /* ExportKeyword */: - case 80 /* DefaultKeyword */: + case 117 /* StaticKeyword */: + case 86 /* ExportKeyword */: + case 81 /* DefaultKeyword */: } } } @@ -89374,8 +90313,8 @@ var ts; return a.fileName === b.fileName; } function moduleNameIsEqualTo(a, b) { - return a.kind === 72 /* Identifier */ - ? b.kind === 72 /* Identifier */ && a.escapedText === b.escapedText + return a.kind === 73 /* Identifier */ + ? b.kind === 73 /* Identifier */ && a.escapedText === b.escapedText : b.kind === 10 /* StringLiteral */ && a.text === b.text; } function collectExternalModuleReferences(file) { @@ -89590,7 +90529,10 @@ var ts; if (isRedirect) { inputName = getProjectReferenceRedirect(fileName) || fileName; } - if (ts.getNormalizedAbsolutePath(checkedName, currentDirectory) !== ts.getNormalizedAbsolutePath(inputName, currentDirectory)) { + // Check if it differs only in drive letters its ok to ignore that error: + var checkedAbsolutePath = ts.getNormalizedAbsolutePathWithoutRoot(checkedName, currentDirectory); + var inputAbsolutePath = ts.getNormalizedAbsolutePathWithoutRoot(inputName, currentDirectory); + if (checkedAbsolutePath !== inputAbsolutePath) { reportFileNamesDifferOnlyInCasingError(inputName, checkedName, refFile, refPos, refEnd); } } @@ -89619,8 +90561,13 @@ var ts; } var redirectedPath; if (refFile) { - var redirect = getProjectReferenceRedirect(fileName); - if (redirect) { + var redirectProject = getProjectReferenceRedirectProject(fileName); + if (redirectProject) { + if (redirectProject.commandLine.options.outFile || redirectProject.commandLine.options.out) { + // Shouldnt create many to 1 mapping file in --out scenario + return undefined; + } + var redirect = getProjectReferenceOutputName(redirectProject, fileName); fileName = redirect; // Once we start redirecting to a file, we can potentially come back to it // via a back-reference from another file in the .d.ts folder. If that happens we'll @@ -89704,16 +90651,19 @@ var ts; } } function getProjectReferenceRedirect(fileName) { + var referencedProject = getProjectReferenceRedirectProject(fileName); + return referencedProject && getProjectReferenceOutputName(referencedProject, fileName); + } + function getProjectReferenceRedirectProject(fileName) { // Ignore dts or any of the non ts files if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.fileExtensionIs(fileName, ".d.ts" /* Dts */) || !ts.fileExtensionIsOneOf(fileName, ts.supportedTSExtensions)) { return undefined; } // If this file is produced by a referenced project, we need to rewrite it to // look in the output folder of the referenced project rather than the input - var referencedProject = getResolvedProjectReferenceToRedirect(fileName); - if (!referencedProject) { - return undefined; - } + return getResolvedProjectReferenceToRedirect(fileName); + } + function getProjectReferenceOutputName(referencedProject, fileName) { var out = referencedProject.commandLine.options.outFile || referencedProject.commandLine.options.out; return out ? ts.changeExtension(out, ".d.ts" /* Dts */) : @@ -89958,18 +90908,33 @@ var ts; if (fromCache !== undefined) { return fromCache || undefined; } - // An absolute path pointing to the containing directory of the config file - var basePath = ts.getNormalizedAbsolutePath(ts.getDirectoryPath(refPath), host.getCurrentDirectory()); - var sourceFile = host.getSourceFile(refPath, 100 /* JSON */); - addFileToFilesByName(sourceFile, sourceFilePath, /*redirectedPath*/ undefined); - if (sourceFile === undefined) { - projectReferenceRedirects.set(sourceFilePath, false); - return undefined; + var commandLine; + var sourceFile; + if (host.getParsedCommandLine) { + commandLine = host.getParsedCommandLine(refPath); + if (!commandLine) { + addFileToFilesByName(/*sourceFile*/ undefined, sourceFilePath, /*redirectedPath*/ undefined); + projectReferenceRedirects.set(sourceFilePath, false); + return undefined; + } + sourceFile = ts.Debug.assertDefined(commandLine.options.configFile); + ts.Debug.assert(!sourceFile.path || sourceFile.path === sourceFilePath); + addFileToFilesByName(sourceFile, sourceFilePath, /*redirectedPath*/ undefined); + } + else { + // An absolute path pointing to the containing directory of the config file + var basePath = ts.getNormalizedAbsolutePath(ts.getDirectoryPath(refPath), host.getCurrentDirectory()); + sourceFile = host.getSourceFile(refPath, 100 /* JSON */); + addFileToFilesByName(sourceFile, sourceFilePath, /*redirectedPath*/ undefined); + if (sourceFile === undefined) { + projectReferenceRedirects.set(sourceFilePath, false); + return undefined; + } + commandLine = ts.parseJsonSourceFileConfigFileContent(sourceFile, configParsingHost, basePath, /*existingOptions*/ undefined, refPath); } sourceFile.path = sourceFilePath; sourceFile.resolvedPath = sourceFilePath; sourceFile.originalFileName = refPath; - var commandLine = ts.parseJsonSourceFileConfigFileContent(sourceFile, configParsingHost, basePath, /*existingOptions*/ undefined, refPath); var resolvedRef = { commandLine: commandLine, sourceFile: sourceFile }; projectReferenceRedirects.set(sourceFilePath, resolvedRef); if (commandLine.projectReferences) { @@ -89985,9 +90950,6 @@ var ts; if (ts.getEmitDeclarations(options)) { createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, getEmitDeclarationOptionName(options), "isolatedModules"); } - if (options.noEmitOnError) { - createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules"); - } if (options.out) { createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules"); } @@ -90019,17 +90981,17 @@ var ts; createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "tsBuildInfoFile", "incremental", "composite"); } } + else if (options.incremental && !options.outFile && !options.out && !options.configFilePath) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified)); + } verifyProjectReferences(); // List of collected files is complete; validate exhautiveness if this is a project with a file list if (options.composite) { var rootPaths = rootNames.map(toPath); for (var _i = 0, files_3 = files; _i < files_3.length; _i++) { var file = files_3[_i]; - // Ignore declaration files - if (file.isDeclarationFile) - continue; - // Ignore json file thats from project reference - if (ts.isJsonSourceFile(file) && getResolvedProjectReferenceToRedirect(file.fileName)) + // Ignore file that is not emitted + if (!ts.sourceFileMayBeEmitted(file, options, isSourceFileFromExternalLibrary, getResolvedProjectReferenceToRedirect)) continue; if (rootPaths.indexOf(file.path) === -1) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_in_project_file_list_Projects_must_list_all_files_or_use_an_include_pattern, file.fileName)); @@ -90106,10 +91068,10 @@ var ts; if (options.module === ts.ModuleKind.None && languageVersion < 2 /* ES2015 */) { createDiagnosticForOptionName(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher, "isolatedModules", "target"); } - var firstNonExternalModuleSourceFile = ts.find(files, function (f) { return !ts.isExternalModule(f) && !f.isDeclarationFile && f.scriptKind !== 6 /* JSON */; }); + var firstNonExternalModuleSourceFile = ts.find(files, function (f) { return !ts.isExternalModule(f) && !ts.isSourceFileJS(f) && !f.isDeclarationFile && f.scriptKind !== 6 /* JSON */; }); if (firstNonExternalModuleSourceFile) { var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); - programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided)); + programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.All_files_must_be_modules_when_the_isolatedModules_flag_is_provided)); } } else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 /* ES2015 */ && options.module === ts.ModuleKind.None) { @@ -90194,13 +91156,13 @@ var ts; var emitFilePath = toPath(emitFileName); // Report error if the output overwrites input file if (filesByName.has(emitFilePath)) { - var chain_2; + var chain = void 0; if (!options.configFilePath) { // The program is from either an inferred project or an external project - chain_2 = ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig); + chain = ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig); } - chain_2 = ts.chainDiagnosticMessages(chain_2, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file, emitFileName); - blockEmittingOfFile(emitFileName, ts.createCompilerDiagnosticFromMessageChain(chain_2)); + chain = ts.chainDiagnosticMessages(chain, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file, emitFileName); + blockEmittingOfFile(emitFileName, ts.createCompilerDiagnosticFromMessageChain(chain)); } var emitFileKey = !host.useCaseSensitiveFileNames() ? emitFilePath.toLocaleLowerCase() : emitFilePath; // Report error if multiple files write into same file @@ -90735,6 +91697,7 @@ var ts; cacheToUpdateSignature.set(sourceFile.path, latestSignature); return !prevSignature || latestSignature !== prevSignature; } + BuilderState.updateShapeSignature = updateShapeSignature; /** * Coverts the declaration emit result into exported modules map */ @@ -91012,15 +91975,9 @@ var ts; } } }); - if (oldCompilerOptions && - (oldCompilerOptions.outDir !== compilerOptions.outDir || - oldCompilerOptions.declarationDir !== compilerOptions.declarationDir || - (oldCompilerOptions.outFile || oldCompilerOptions.out) !== (compilerOptions.outFile || compilerOptions.out))) { + if (oldCompilerOptions && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) { // Add all files to affectedFilesPendingEmit since emit changed - state.affectedFilesPendingEmit = ts.concatenate(state.affectedFilesPendingEmit, newProgram.getSourceFiles().map(function (f) { return f.path; })); - if (state.affectedFilesPendingEmitIndex === undefined) { - state.affectedFilesPendingEmitIndex = 0; - } + addToAffectedFilesPendingEmit(state, newProgram.getSourceFiles().map(function (f) { return f.path; })); ts.Debug.assert(state.seenAffectedFiles === undefined); state.seenAffectedFiles = ts.createMap(); } @@ -91104,7 +92061,7 @@ var ts; if (!seenAffectedFiles.has(affectedFile.path)) { // Set the next affected file as seen and remove the cached semantic diagnostics state.affectedFilesIndex = affectedFilesIndex; - cleanSemanticDiagnosticsOfAffectedFile(state, affectedFile); + handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash); return affectedFile; } seenAffectedFiles.set(affectedFile.path, true); @@ -91165,94 +92122,49 @@ var ts; return undefined; } /** - * Remove the semantic diagnostics cached from old state for affected File and the files that are referencing modules that export entities from affected file + * Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file + * This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change */ - function cleanSemanticDiagnosticsOfAffectedFile(state, affectedFile) { - if (removeSemanticDiagnosticsOf(state, affectedFile.path)) { - // If there are no more diagnostics from old cache, done + function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash) { + removeSemanticDiagnosticsOf(state, affectedFile.path); + // If affected files is everything except default library, then nothing more to do + if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) { + if (!state.cleanedDiagnosticsOfLibFiles) { + state.cleanedDiagnosticsOfLibFiles = true; + var program_1 = ts.Debug.assertDefined(state.program); + var options_2 = program_1.getCompilerOptions(); + ts.forEach(program_1.getSourceFiles(), function (f) { + return program_1.isSourceFileDefaultLibrary(f) && + !ts.skipTypeChecking(f, options_2) && + removeSemanticDiagnosticsOf(state, f.path); + }); + } return; } - // Clean lib file diagnostics if its all files excluding default files to emit - if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles && !state.cleanedDiagnosticsOfLibFiles) { - state.cleanedDiagnosticsOfLibFiles = true; - var program_1 = ts.Debug.assertDefined(state.program); - var options_2 = program_1.getCompilerOptions(); - if (ts.forEach(program_1.getSourceFiles(), function (f) { - return program_1.isSourceFileDefaultLibrary(f) && - !ts.skipTypeChecking(f, options_2) && - removeSemanticDiagnosticsOf(state, f.path); - })) { - return; + forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash); }); + } + /** + * Handle the dts may change, so they need to be added to pending emit if dts emit is enabled, + * Also we need to make sure signature is updated for these files + */ + function handleDtsMayChangeOf(state, path, cancellationToken, computeHash) { + removeSemanticDiagnosticsOf(state, path); + if (!state.changedFilesSet.has(path)) { + var program = ts.Debug.assertDefined(state.program); + var sourceFile = program.getSourceFileByPath(path); + if (sourceFile) { + // Even though the js emit doesnt change and we are already handling dts emit and semantic diagnostics + // we need to update the signature to reflect correctness of the signature(which is output d.ts emit) of this file + // This ensures that we dont later during incremental builds considering wrong signature. + // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build + ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.assertDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap); + // If not dts emit, nothing more to do + if (ts.getEmitDeclarations(state.compilerOptions)) { + addToAffectedFilesPendingEmit(state, [path]); + } } } - // If there was change in signature for the changed file, - // then delete the semantic diagnostics for files that are affected by using exports of this module - if (!state.exportedModulesMap || state.affectedFiles.length === 1 || !state.changedFilesSet.has(affectedFile.path)) { - return; - } - ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap); - var seenFileAndExportsOfFile = ts.createMap(); - // Go through exported modules from cache first - // If exported modules has path, all files referencing file exported from are affected - if (ts.forEachEntry(state.currentAffectedFilesExportedModulesMap, function (exportedModules, exportedFromPath) { - return exportedModules && - exportedModules.has(affectedFile.path) && - removeSemanticDiagnosticsOfFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile); - })) { - return; - } - // If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected - ts.forEachEntry(state.exportedModulesMap, function (exportedModules, exportedFromPath) { - return !state.currentAffectedFilesExportedModulesMap.has(exportedFromPath) && // If we already iterated this through cache, ignore it - exportedModules.has(affectedFile.path) && - removeSemanticDiagnosticsOfFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile); - }); - } - /** - * removes the semantic diagnostics of files referencing referencedPath and - * returns true if there are no more semantic diagnostics from old state - */ - function removeSemanticDiagnosticsOfFilesReferencingPath(state, referencedPath, seenFileAndExportsOfFile) { - return ts.forEachEntry(state.referencedMap, function (referencesInFile, filePath) { - return referencesInFile.has(referencedPath) && removeSemanticDiagnosticsOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile); - }); - } - /** - * Removes semantic diagnostics of file and anything that exports this file - */ - function removeSemanticDiagnosticsOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile) { - if (!ts.addToSeen(seenFileAndExportsOfFile, filePath)) { - return false; - } - if (removeSemanticDiagnosticsOf(state, filePath)) { - // If there are no more diagnostics from old cache, done - return true; - } - ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap); - // Go through exported modules from cache first - // If exported modules has path, all files referencing file exported from are affected - if (ts.forEachEntry(state.currentAffectedFilesExportedModulesMap, function (exportedModules, exportedFromPath) { - return exportedModules && - exportedModules.has(filePath) && - removeSemanticDiagnosticsOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile); - })) { - return true; - } - // If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected - if (ts.forEachEntry(state.exportedModulesMap, function (exportedModules, exportedFromPath) { - return !state.currentAffectedFilesExportedModulesMap.has(exportedFromPath) && // If we already iterated this through cache, ignore it - exportedModules.has(filePath) && - removeSemanticDiagnosticsOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile); - })) { - return true; - } - // Remove diagnostics of files that import this file (without going to exports of referencing files) - return !!ts.forEachEntry(state.referencedMap, function (referencesInFile, referencingFilePath) { - return referencesInFile.has(filePath) && - !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file - removeSemanticDiagnosticsOf(state, referencingFilePath); - } // Dont add to seen since this is not yet done with the export removal - ); + return false; } /** * Removes semantic diagnostics for path and @@ -91266,6 +92178,78 @@ var ts; state.semanticDiagnosticsPerFile.delete(path); return !state.semanticDiagnosticsFromOldState.size; } + /** + * Iterate on referencing modules that export entities from affected file + */ + function forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, fn) { + // If there was change in signature (dts output) for the changed file, + // then only we need to handle pending file emit + if (!state.exportedModulesMap || state.affectedFiles.length === 1 || !state.changedFilesSet.has(affectedFile.path)) { + return; + } + ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap); + var seenFileAndExportsOfFile = ts.createMap(); + // Go through exported modules from cache first + // If exported modules has path, all files referencing file exported from are affected + if (ts.forEachEntry(state.currentAffectedFilesExportedModulesMap, function (exportedModules, exportedFromPath) { + return exportedModules && + exportedModules.has(affectedFile.path) && + forEachFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile, fn); + })) { + return; + } + // If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected + ts.forEachEntry(state.exportedModulesMap, function (exportedModules, exportedFromPath) { + return !state.currentAffectedFilesExportedModulesMap.has(exportedFromPath) && // If we already iterated this through cache, ignore it + exportedModules.has(affectedFile.path) && + forEachFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile, fn); + }); + } + /** + * Iterate on files referencing referencedPath + */ + function forEachFilesReferencingPath(state, referencedPath, seenFileAndExportsOfFile, fn) { + return ts.forEachEntry(state.referencedMap, function (referencesInFile, filePath) { + return referencesInFile.has(referencedPath) && forEachFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, fn); + }); + } + /** + * fn on file and iterate on anything that exports this file + */ + function forEachFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, fn) { + if (!ts.addToSeen(seenFileAndExportsOfFile, filePath)) { + return false; + } + if (fn(state, filePath)) { + // If there are no more diagnostics from old cache, done + return true; + } + ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap); + // Go through exported modules from cache first + // If exported modules has path, all files referencing file exported from are affected + if (ts.forEachEntry(state.currentAffectedFilesExportedModulesMap, function (exportedModules, exportedFromPath) { + return exportedModules && + exportedModules.has(filePath) && + forEachFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, fn); + })) { + return true; + } + // If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected + if (ts.forEachEntry(state.exportedModulesMap, function (exportedModules, exportedFromPath) { + return !state.currentAffectedFilesExportedModulesMap.has(exportedFromPath) && // If we already iterated this through cache, ignore it + exportedModules.has(filePath) && + forEachFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, fn); + })) { + return true; + } + // Remove diagnostics of files that import this file (without going to exports of referencing files) + return !!ts.forEachEntry(state.referencedMap, function (referencesInFile, referencingFilePath) { + return referencesInFile.has(filePath) && + !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file + fn(state, referencingFilePath); + } // Dont add to seen since this is not yet done with the export removal + ); + } /** * This is called after completing operation on the next affected file. * The operations here are postponed to ensure that cancellation during the iteration is handled correctly @@ -91493,7 +92477,7 @@ var ts; return toAffectedFileResult(state, // When whole program is affected, do emit only once (eg when --out or --outFile is specified) // Otherwise just affected file - affected_1.emitBuildInfo(writeFile || host.writeFile, cancellationToken), affected_1, + affected_1.emitBuildInfo(writeFile || ts.maybeBind(host, host.writeFile), cancellationToken), affected_1, /*isPendingEmitFile*/ false, /*isBuildInfoEmit*/ true); } @@ -91509,14 +92493,10 @@ var ts; affected = program; } } - // Mark seen emitted files if there are pending files to be emitted - if (state.affectedFilesPendingEmit && state.program !== affected) { - (state.seenEmittedFiles || (state.seenEmittedFiles = ts.createMap())).set(affected.path, true); - } return toAffectedFileResult(state, // When whole program is affected, do emit only once (eg when --out or --outFile is specified) // Otherwise just affected file - ts.Debug.assertDefined(state.program).emit(affected === state.program ? undefined : affected, writeFile || host.writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers), affected, isPendingEmitFile); + ts.Debug.assertDefined(state.program).emit(affected === state.program ? undefined : affected, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers), affected, isPendingEmitFile); } /** * Emits the JavaScript and declaration files. @@ -91553,7 +92533,7 @@ var ts; }; } } - return ts.Debug.assertDefined(state.program).emit(targetSourceFile, writeFile || host.writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers); + return ts.Debug.assertDefined(state.program).emit(targetSourceFile, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers); } /** * Return the semantic diagnostics for the next affected file or undefined if iteration is complete @@ -91610,14 +92590,7 @@ var ts; } // In case of emit builder, cache the files to be emitted if (affectedFilesPendingEmit) { - state.affectedFilesPendingEmit = ts.concatenate(state.affectedFilesPendingEmit, affectedFilesPendingEmit); - // affectedFilesPendingEmitIndex === undefined - // - means the emit state.affectedFilesPendingEmit was undefined before adding current affected files - // so start from 0 as array would be affectedFilesPendingEmit - // else, continue to iterate from existing index, the current set is appended to existing files - if (state.affectedFilesPendingEmitIndex === undefined) { - state.affectedFilesPendingEmitIndex = 0; - } + addToAffectedFilesPendingEmit(state, affectedFilesPendingEmit); } var diagnostics; for (var _i = 0, _a = ts.Debug.assertDefined(state.program).getSourceFiles(); _i < _a.length; _i++) { @@ -91628,6 +92601,16 @@ var ts; } } ts.createBuilderProgram = createBuilderProgram; + function addToAffectedFilesPendingEmit(state, affectedFilesPendingEmit) { + state.affectedFilesPendingEmit = ts.concatenate(state.affectedFilesPendingEmit, affectedFilesPendingEmit); + // affectedFilesPendingEmitIndex === undefined + // - means the emit state.affectedFilesPendingEmit was undefined before adding current affected files + // so start from 0 as array would be affectedFilesPendingEmit + // else, continue to iterate from existing index, the current set is appended to existing files + if (state.affectedFilesPendingEmitIndex === undefined) { + state.affectedFilesPendingEmitIndex = 0; + } + } function getMapOfReferencedSet(mapLike) { if (!mapLike) return undefined; @@ -92247,6 +93230,10 @@ var ts; // If something to do with folder/file starting with "." in node_modules folder, skip it if (isPathIgnored(fileOrDirectoryPath)) return false; + // prevent saving an open file from over-eagerly triggering invalidation + if (resolutionHost.fileIsOpen(fileOrDirectoryPath)) { + return false; + } // Some file or directory in the watching directory is created // Return early if it does not have any of the watching extension or not the custom failed lookup path var dirOfFileOrDirectory = ts.getDirectoryPath(fileOrDirectoryPath); @@ -92489,11 +93476,11 @@ var ts; } function discoverProbableSymlinks(files, getCanonicalFileName, cwd) { var result = ts.createMap(); - var symlinks = ts.mapDefined(files, function (sf) { - return sf.resolvedModules && ts.firstDefinedIterator(sf.resolvedModules.values(), function (res) { + var symlinks = ts.flatten(ts.mapDefined(files, function (sf) { + return sf.resolvedModules && ts.compact(ts.arrayFrom(ts.mapIterator(sf.resolvedModules.values(), function (res) { return res && res.originalPath && res.resolvedFileName !== res.originalPath ? [res.resolvedFileName, res.originalPath] : undefined; - }); - }); + }))); + })); for (var _i = 0, symlinks_1 = symlinks; _i < symlinks_1.length; _i++) { var _a = symlinks_1[_i], resolvedPath = _a[0], originalPath = _a[1]; var _b = guessDirectorySymlink(resolvedPath, originalPath, cwd, getCanonicalFileName), commonResolved = _b[0], commonOriginal = _b[1]; @@ -92836,6 +93823,14 @@ var ts; return "" + newLine + ts.flattenDiagnosticMessageText(d.messageText, newLine) + newLine + newLine; } ts.getErrorSummaryText = getErrorSummaryText; + function listFiles(program, writeFileName) { + if (program.getCompilerOptions().listFiles) { + ts.forEach(program.getSourceFiles(), function (file) { + writeFileName(file.fileName); + }); + } + } + ts.listFiles = listFiles; /** * Helper that emit files, report diagnostics and lists emitted and/or source files depending on compiler options */ @@ -92863,11 +93858,7 @@ var ts; var filepath = ts.getNormalizedAbsolutePath(file, currentDir_1); writeFileName("TSFILE: " + filepath); }); - if (program.getCompilerOptions().listFiles) { - ts.forEach(program.getSourceFiles(), function (file) { - writeFileName(file.fileName); - }); - } + listFiles(program, writeFileName); } if (reportSummary) { reportSummary(getErrorCountForSummary(diagnostics)); @@ -93190,6 +94181,7 @@ var ts; hasChangedAutomaticTypeDirectiveNames = true; scheduleProgramUpdate(); }; + compilerHost.fileIsOpen = ts.returnFalse; compilerHost.maxNumberOfFilesToIterateForInvalidation = host.maxNumberOfFilesToIterateForInvalidation; compilerHost.getCurrentProgram = getCurrentProgram; compilerHost.writeLog = writeLog; @@ -93680,7 +94672,8 @@ var ts; function getCompilerOptionsOfBuildOptions(buildOptions) { var result = {}; ts.commonOptionsWithBuild.forEach(function (option) { - result[option.name] = buildOptions[option.name]; + if (ts.hasProperty(buildOptions, option.name)) + result[option.name] = buildOptions[option.name]; }); return result; } @@ -93699,12 +94692,18 @@ var ts; var projectStatus = createFileMap(toPath); var missingRoots = ts.createMap(); var globalDependencyGraph; - var writeFileName = function (s) { return host.trace && host.trace(s); }; + var writeFileName = host.trace ? function (s) { return host.trace(s); } : undefined; var readFileWithCache = function (f) { return host.readFile(f); }; var projectCompilerOptions = baseCompilerOptions; var compilerHost = ts.createCompilerHostFromProgramHost(host, function () { return projectCompilerOptions; }); ts.setGetSourceFileAsHashVersioned(compilerHost, host); + compilerHost.getParsedCommandLine = parseConfigFile; + compilerHost.resolveModuleNames = ts.maybeBind(host, host.resolveModuleNames); + compilerHost.resolveTypeReferenceDirectives = ts.maybeBind(host, host.resolveTypeReferenceDirectives); + var moduleResolutionCache = !compilerHost.resolveModuleNames ? ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName) : undefined; + var cacheState; var buildInfoChecked = createFileMap(toPath); + var extendedConfigCache = ts.createMap(); // Watch state var builderPrograms = createFileMap(toPath); var diagnostics = createFileMap(toPath); @@ -93768,7 +94767,7 @@ var ts; } var diagnostic; parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = function (d) { return diagnostic = d; }; - var parsed = ts.getParsedCommandLineOfConfigFile(configFilePath, baseCompilerOptions, parseConfigFileHost); + var parsed = ts.getParsedCommandLineOfConfigFile(configFilePath, baseCompilerOptions, parseConfigFileHost, extendedConfigCache); parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop; configFileCache.setValue(configFilePath, parsed || diagnostic); return parsed; @@ -94090,6 +95089,7 @@ var ts; projectStatus.removeKey(resolved); diagnostics.removeKey(resolved); addProjToQueue(resolved, reloadLevel); + enableCache(); } /** * return true if new addition @@ -94145,6 +95145,7 @@ var ts; } } else { + disableCache(); reportErrorSummary(); } } @@ -94307,6 +95308,28 @@ var ts; } // TODO: handle resolve module name to cache result in project reference redirect projectCompilerOptions = configFile.options; + // Update module resolution cache if needed + if (moduleResolutionCache) { + var projPath = toPath(proj); + if (moduleResolutionCache.directoryToModuleNameMap.redirectsMap.size === 0) { + // The own map will be for projectCompilerOptions + ts.Debug.assert(moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.size === 0); + moduleResolutionCache.directoryToModuleNameMap.redirectsMap.set(projPath, moduleResolutionCache.directoryToModuleNameMap.ownMap); + moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.set(projPath, moduleResolutionCache.moduleNameToDirectoryMap.ownMap); + } + else { + // Set correct own map + ts.Debug.assert(moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.size > 0); + var ref = { + sourceFile: projectCompilerOptions.configFile, + commandLine: configFile + }; + moduleResolutionCache.directoryToModuleNameMap.setOwnMap(moduleResolutionCache.directoryToModuleNameMap.getOrCreateMapOfCacheRedirects(ref)); + moduleResolutionCache.moduleNameToDirectoryMap.setOwnMap(moduleResolutionCache.moduleNameToDirectoryMap.getOrCreateMapOfCacheRedirects(ref)); + } + moduleResolutionCache.directoryToModuleNameMap.setOwnOptions(projectCompilerOptions); + moduleResolutionCache.moduleNameToDirectoryMap.setOwnOptions(projectCompilerOptions); + } var program = host.createProgram(configFile.fileNames, configFile.options, compilerHost, getOldProgram(proj, configFile), configFile.errors, configFile.projectReferences); // Don't emit anything in the presence of syntactic errors or options diagnostics var syntaxDiagnostics = program.getConfigFileParsingDiagnostics().concat(program.getOptionsDiagnostics(), program.getGlobalDiagnostics(), program.getSyntacticDiagnostics()); @@ -94325,7 +95348,7 @@ var ts; var declDiagnostics; var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); }; var outputFiles = []; - ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics, writeFileName, /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }); + ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics, /*writeFileName*/ undefined, /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }); // Don't emit .d.ts if there are decl file errors if (declDiagnostics) { program.restoreState(); @@ -94347,7 +95370,7 @@ var ts; anyDtsChanged = true; } } - emittedOutputs.setValue(name, true); + emittedOutputs.setValue(name, name); ts.writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark); if (priorChangeTime !== undefined) { newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime); @@ -94358,6 +95381,10 @@ var ts; if (emitDiagnostics.length) { return buildErrors(emitDiagnostics, BuildResultFlags.EmitErrors, "Emit"); } + if (writeFileName) { + emittedOutputs.forEach(function (name) { return listEmittedFile(configFile, name); }); + ts.listFiles(program, writeFileName); + } // Update time stamps for rest of the outputs newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(configFile, newestDeclarationFileContentChangedTime, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs); var status = { @@ -94373,12 +95400,20 @@ var ts; function buildErrors(diagnostics, errorFlags, errorType) { resultFlags |= errorFlags; reportAndStoreErrors(proj, diagnostics); + // List files if any other build error using program (emit errors already report files) + if (writeFileName) + ts.listFiles(program, writeFileName); projectStatus.setValue(proj, { type: UpToDateStatusType.Unbuildable, reason: errorType + " errors" }); afterProgramCreate(proj, program); projectCompilerOptions = baseCompilerOptions; return resultFlags; } } + function listEmittedFile(proj, file) { + if (writeFileName && proj.options.listEmittedFiles) { + writeFileName("TSFILE: " + file); + } + } function afterProgramCreate(proj, program) { if (host.afterProgramEmitAndDiagnostics) { host.afterProgramEmitAndDiagnostics(program); @@ -94417,7 +95452,7 @@ var ts; var emittedOutputs = createFileMap(toPath); outputFiles.forEach(function (_a) { var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark; - emittedOutputs.setValue(name, true); + emittedOutputs.setValue(name, name); ts.writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark); }); var emitDiagnostics = emitterDiagnostics.getDiagnostics(); @@ -94427,6 +95462,9 @@ var ts; projectCompilerOptions = baseCompilerOptions; return BuildResultFlags.DeclarationOutputUnchanged | BuildResultFlags.EmitErrors; } + if (writeFileName) { + emittedOutputs.forEach(function (name) { return listEmittedFile(config, name); }); + } // Update timestamps for dts var newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(config, minimumDate, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs); var status = { @@ -94467,9 +95505,7 @@ var ts; priorNewestUpdateTime = newer(priorNewestUpdateTime, host.getModifiedTime(file) || ts.missingFileModifiedTime); } host.setModifiedTime(file, now); - if (proj.options.listEmittedFiles) { - writeFileName("TSFILE: " + file); - } + listEmittedFile(proj, file); } } return priorNewestUpdateTime; @@ -94514,28 +95550,67 @@ var ts; function resolveProjectNames(configFileNames) { return configFileNames.map(resolveProjectName); } - function buildAllProjects() { - if (options.watch) { - reportWatchStatus(ts.Diagnostics.Starting_compilation_in_watch_mode); + function enableCache() { + if (cacheState) { + disableCache(); } - // TODO:: In watch mode as well to use caches for incremental build once we can invalidate caches correctly and have right api - // Override readFile for json files and output .d.ts to cache the text - var savedReadFileWithCache = readFileWithCache; - var savedGetSourceFile = compilerHost.getSourceFile; + var originalReadFileWithCache = readFileWithCache; + var originalGetSourceFile = compilerHost.getSourceFile; var _a = ts.changeCompilerHostLikeToUseCache(host, toPath, function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } - return savedGetSourceFile.call.apply(savedGetSourceFile, [compilerHost].concat(args)); + return originalGetSourceFile.call.apply(originalGetSourceFile, [compilerHost].concat(args)); }), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile, getSourceFileWithCache = _a.getSourceFileWithCache, newReadFileWithCache = _a.readFileWithCache; readFileWithCache = newReadFileWithCache; compilerHost.getSourceFile = getSourceFileWithCache; + var originalResolveModuleNames = compilerHost.resolveModuleNames; + if (!compilerHost.resolveModuleNames) { + var loader_3 = function (moduleName, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference).resolvedModule; }; + compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference) { + return ts.loadWithLocalCache(ts.Debug.assertEachDefined(moduleNames), containingFile, redirectedReference, loader_3); + }; + } + cacheState = { + originalReadFile: originalReadFile, + originalFileExists: originalFileExists, + originalDirectoryExists: originalDirectoryExists, + originalCreateDirectory: originalCreateDirectory, + originalWriteFile: originalWriteFile, + originalReadFileWithCache: originalReadFileWithCache, + originalGetSourceFile: originalGetSourceFile, + originalResolveModuleNames: originalResolveModuleNames + }; + } + function disableCache() { + if (!cacheState) + return; + host.readFile = cacheState.originalReadFile; + host.fileExists = cacheState.originalFileExists; + host.directoryExists = cacheState.originalDirectoryExists; + host.createDirectory = cacheState.originalCreateDirectory; + host.writeFile = cacheState.originalWriteFile; + compilerHost.getSourceFile = cacheState.originalGetSourceFile; + readFileWithCache = cacheState.originalReadFileWithCache; + compilerHost.resolveModuleNames = cacheState.originalResolveModuleNames; + extendedConfigCache.clear(); + if (moduleResolutionCache) { + moduleResolutionCache.directoryToModuleNameMap.clear(); + moduleResolutionCache.moduleNameToDirectoryMap.clear(); + } + cacheState = undefined; + } + function buildAllProjects() { + if (options.watch) { + reportWatchStatus(ts.Diagnostics.Starting_compilation_in_watch_mode); + } + enableCache(); var graph = getGlobalDependencyGraph(); reportBuildQueue(graph); var anyFailed = false; - for (var _i = 0, _b = graph.buildQueue; _i < _b.length; _i++) { - var next = _b[_i]; + for (var _i = 0, _a = graph.buildQueue; _i < _a.length; _i++) { + var next = _a[_i]; var proj = parseConfigFile(next); if (proj === undefined) { reportParseConfigFileDiagnostic(next); @@ -94579,13 +95654,7 @@ var ts; anyFailed = anyFailed || !!(buildResult & BuildResultFlags.AnyErrors); } reportErrorSummary(); - host.readFile = originalReadFile; - host.fileExists = originalFileExists; - host.directoryExists = originalDirectoryExists; - host.createDirectory = originalCreateDirectory; - host.writeFile = originalWriteFile; - compilerHost.getSourceFile = savedGetSourceFile; - readFileWithCache = savedReadFileWithCache; + disableCache(); return anyFailed ? ts.ExitStatus.DiagnosticsPresent_OutputsSkipped : ts.ExitStatus.Success; } function needsBuild(status, configFile) { @@ -94675,144 +95744,6 @@ var ts; })(ts || (ts = {})); /* @internal */ var ts; -(function (ts) { - var ValueKind; - (function (ValueKind) { - ValueKind[ValueKind["Const"] = 0] = "Const"; - ValueKind[ValueKind["Array"] = 1] = "Array"; - ValueKind[ValueKind["FunctionOrClass"] = 2] = "FunctionOrClass"; - ValueKind[ValueKind["Object"] = 3] = "Object"; - })(ValueKind = ts.ValueKind || (ts.ValueKind = {})); - function inspectModule(fileNameToRequire) { - return inspectValue(ts.removeFileExtension(ts.getBaseFileName(fileNameToRequire)), tryRequire(fileNameToRequire)); - } - ts.inspectModule = inspectModule; - function inspectValue(name, value) { - return getValueInfo(name, value, getRecurser()); - } - ts.inspectValue = inspectValue; - function getRecurser() { - var seen = []; - var nameStack = []; - return function (obj, name, cbOk, cbFail) { - if (seen.indexOf(obj) !== -1 || nameStack.length > 4) { - return cbFail(seen.indexOf(obj) !== -1, nameStack); - } - seen.push(obj); - nameStack.push(name); - var res = cbOk(); - nameStack.pop(); - seen.pop(); - return res; - }; - } - function getValueInfo(name, value, recurser) { - return recurser(value, name, function () { - if (typeof value === "function") - return getFunctionOrClassInfo(value, name, recurser); - if (typeof value === "object") { - var builtin = getBuiltinType(name, value, recurser); - if (builtin !== undefined) - return builtin; - var entries = getEntriesOfObject(value); - var hasNontrivialPrototype = Object.getPrototypeOf(value) !== Object.prototype; - var members = ts.flatMap(entries, function (_a) { - var key = _a.key, value = _a.value; - return getValueInfo(key, value, recurser); - }); - return { kind: 3 /* Object */, name: name, hasNontrivialPrototype: hasNontrivialPrototype, members: members }; - } - return { kind: 0 /* Const */, name: name, typeName: isNullOrUndefined(value) ? "any" : typeof value }; - }, function (isCircularReference, keyStack) { return anyValue(name, " " + (isCircularReference ? "Circular reference" : "Too-deep object hierarchy") + " from " + keyStack.join(".")); }); - } - function getFunctionOrClassInfo(fn, name, recurser) { - var prototypeMembers = getPrototypeMembers(fn, recurser); - var namespaceMembers = ts.flatMap(getEntriesOfObject(fn), function (_a) { - var key = _a.key, value = _a.value; - return getValueInfo(key, value, recurser); - }); - var toString = ts.cast(Function.prototype.toString.call(fn), ts.isString); - var source = ts.stringContains(toString, "{ [native code] }") ? getFunctionLength(fn) : toString; - return { kind: 2 /* FunctionOrClass */, name: name, source: source, namespaceMembers: namespaceMembers, prototypeMembers: prototypeMembers }; - } - var builtins = ts.memoize(function () { - var map = ts.createMap(); - for (var _i = 0, _a = getEntriesOfObject(global); _i < _a.length; _i++) { - var _b = _a[_i], key = _b.key, value = _b.value; - if (typeof value === "function" && typeof value.prototype === "object" && value !== Object) { - map.set(key, value); - } - } - return map; - }); - function getBuiltinType(name, value, recurser) { - return ts.isArray(value) - ? { name: name, kind: 1 /* Array */, inner: value.length && getValueInfo("element", ts.first(value), recurser) || anyValue(name) } - : ts.forEachEntry(builtins(), function (builtin, builtinName) { - return value instanceof builtin ? { kind: 0 /* Const */, name: name, typeName: builtinName } : undefined; - }); - } - function getPrototypeMembers(fn, recurser) { - var prototype = fn.prototype; - // tslint:disable-next-line no-unnecessary-type-assertion (TODO: update LKG and it will really be unnecessary) - return typeof prototype !== "object" || prototype === null ? ts.emptyArray : ts.mapDefined(getEntriesOfObject(prototype), function (_a) { - var key = _a.key, value = _a.value; - return key === "constructor" ? undefined : getValueInfo(key, value, recurser); - }); - } - var ignoredProperties = ["arguments", "caller", "constructor", "eval", "super_"]; - var reservedFunctionProperties = Object.getOwnPropertyNames(ts.noop); - function getEntriesOfObject(obj) { - var seen = ts.createMap(); - var entries = []; - var chain = obj; - while (!isNullOrUndefined(chain) && chain !== Object.prototype && chain !== Function.prototype) { - for (var _i = 0, _a = Object.getOwnPropertyNames(chain); _i < _a.length; _i++) { - var key = _a[_i]; - if (!isJsPrivate(key) && - ignoredProperties.indexOf(key) === -1 && - (typeof obj !== "function" || reservedFunctionProperties.indexOf(key) === -1) && - // Don't add property from a higher prototype if it already exists in a lower one - ts.addToSeen(seen, key)) { - var value = safeGetPropertyOfObject(chain, key); - // Don't repeat "toString" that matches signature from Object.prototype - if (!(key === "toString" && typeof value === "function" && value.length === 0)) { - entries.push({ key: key, value: value }); - } - } - } - chain = Object.getPrototypeOf(chain); - } - return entries.sort(function (e1, e2) { return ts.compareStringsCaseSensitive(e1.key, e2.key); }); - } - function getFunctionLength(fn) { - return ts.tryCast(safeGetPropertyOfObject(fn, "length"), ts.isNumber) || 0; - } - function safeGetPropertyOfObject(obj, key) { - var desc = Object.getOwnPropertyDescriptor(obj, key); - return desc && desc.value; - } - function isNullOrUndefined(value) { - return value == null; // tslint:disable-line - } - function anyValue(name, comment) { - return { kind: 0 /* Const */, name: name, typeName: "any", comment: comment }; - } - function isJsPrivate(name) { - return ts.startsWith(name, "_"); - } - ts.isJsPrivate = isJsPrivate; - function tryRequire(fileNameToRequire) { - try { - return require(fileNameToRequire); - } - catch (_a) { - return undefined; - } - } -})(ts || (ts = {})); -/* @internal */ -var ts; (function (ts) { var server; (function (server) { @@ -94820,7 +95751,6 @@ var ts; server.ActionSet = "action::set"; server.ActionInvalidate = "action::invalidate"; server.ActionPackageInstalled = "action::packageInstalled"; - server.ActionValueInspected = "action::valueInspected"; server.EventTypesRegistry = "event::typesRegistry"; server.EventBeginInstallTypes = "event::beginInstallTypes"; server.EventEndInstallTypes = "event::endInstallTypes"; @@ -94837,6 +95767,11 @@ var ts; * typingsInstaller will run the command with `${npmLocation} install ...`. */ Arguments.NpmLocation = "--npmLocation"; + /** + * Flag indicating that the typings installer should try to validate the default npm location. + * If the default npm is not found when this flag is enabled, fallback to `npm install` + */ + Arguments.ValidateDefaultNpmLocation = "--validateDefaultNpmLocation"; })(Arguments = server.Arguments || (server.Arguments = {})); function hasArgument(argumentName) { return ts.sys.args.indexOf(argumentName) >= 0; @@ -95433,7 +96368,7 @@ var ts; /* @internal */ var ts; (function (ts) { - ts.scanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ true); + ts.scanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ true); var SemanticMeaning; (function (SemanticMeaning) { SemanticMeaning[SemanticMeaning["None"] = 0] = "None"; @@ -95444,37 +96379,37 @@ var ts; })(SemanticMeaning = ts.SemanticMeaning || (ts.SemanticMeaning = {})); function getMeaningFromDeclaration(node) { switch (node.kind) { - case 237 /* VariableDeclaration */: + case 238 /* VariableDeclaration */: return ts.isInJSFile(node) && ts.getJSDocEnumTag(node) ? 7 /* All */ : 1 /* Value */; - case 151 /* Parameter */: - case 186 /* BindingElement */: - case 154 /* PropertyDeclaration */: - case 153 /* PropertySignature */: - case 275 /* PropertyAssignment */: - case 276 /* ShorthandPropertyAssignment */: - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: - case 157 /* Constructor */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: - case 274 /* CatchClause */: - case 267 /* JsxAttribute */: + case 152 /* Parameter */: + case 187 /* BindingElement */: + case 155 /* PropertyDeclaration */: + case 154 /* PropertySignature */: + case 276 /* PropertyAssignment */: + case 277 /* ShorthandPropertyAssignment */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: + case 158 /* Constructor */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: + case 275 /* CatchClause */: + case 268 /* JsxAttribute */: return 1 /* Value */; - case 150 /* TypeParameter */: - case 241 /* InterfaceDeclaration */: - case 242 /* TypeAliasDeclaration */: - case 168 /* TypeLiteral */: + case 151 /* TypeParameter */: + case 242 /* InterfaceDeclaration */: + case 243 /* TypeAliasDeclaration */: + case 169 /* TypeLiteral */: return 2 /* Type */; - case 309 /* JSDocTypedefTag */: + case 310 /* JSDocTypedefTag */: // If it has no name node, it shares the name with the value declaration below it. return node.name === undefined ? 1 /* Value */ | 2 /* Type */ : 2 /* Type */; - case 278 /* EnumMember */: - case 240 /* ClassDeclaration */: + case 279 /* EnumMember */: + case 241 /* ClassDeclaration */: return 1 /* Value */ | 2 /* Type */; - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: if (ts.isAmbientModule(node)) { return 4 /* Namespace */ | 1 /* Value */; } @@ -95484,26 +96419,26 @@ var ts; else { return 4 /* Namespace */; } - case 243 /* EnumDeclaration */: - case 252 /* NamedImports */: - case 253 /* ImportSpecifier */: - case 248 /* ImportEqualsDeclaration */: - case 249 /* ImportDeclaration */: - case 254 /* ExportAssignment */: - case 255 /* ExportDeclaration */: + case 244 /* EnumDeclaration */: + case 253 /* NamedImports */: + case 254 /* ImportSpecifier */: + case 249 /* ImportEqualsDeclaration */: + case 250 /* ImportDeclaration */: + case 255 /* ExportAssignment */: + case 256 /* ExportDeclaration */: return 7 /* All */; // An external module can be a Value - case 284 /* SourceFile */: + case 285 /* SourceFile */: return 4 /* Namespace */ | 1 /* Value */; } return 7 /* All */; } ts.getMeaningFromDeclaration = getMeaningFromDeclaration; function getMeaningFromLocation(node) { - if (node.kind === 284 /* SourceFile */) { + if (node.kind === 285 /* SourceFile */) { return 1 /* Value */; } - else if (node.parent.kind === 254 /* ExportAssignment */ || node.parent.kind === 259 /* ExternalModuleReference */) { + else if (node.parent.kind === 255 /* ExportAssignment */ || node.parent.kind === 260 /* ExternalModuleReference */) { return 7 /* All */; } else if (isInRightSideOfInternalImportEqualsDeclaration(node)) { @@ -95535,11 +96470,11 @@ var ts; // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - var name = node.kind === 148 /* QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined; - return name && name.parent.kind === 248 /* ImportEqualsDeclaration */ ? 7 /* All */ : 4 /* Namespace */; + var name = node.kind === 149 /* QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined; + return name && name.parent.kind === 249 /* ImportEqualsDeclaration */ ? 7 /* All */ : 4 /* Namespace */; } function isInRightSideOfInternalImportEqualsDeclaration(node) { - while (node.parent.kind === 148 /* QualifiedName */) { + while (node.parent.kind === 149 /* QualifiedName */) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; @@ -95551,27 +96486,27 @@ var ts; function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 148 /* QualifiedName */) { - while (root.parent && root.parent.kind === 148 /* QualifiedName */) { + if (root.parent.kind === 149 /* QualifiedName */) { + while (root.parent && root.parent.kind === 149 /* QualifiedName */) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 164 /* TypeReference */ && !isLastClause; + return root.parent.kind === 165 /* TypeReference */ && !isLastClause; } function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 189 /* PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 189 /* PropertyAccessExpression */) { + if (root.parent.kind === 190 /* PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 190 /* PropertyAccessExpression */) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 211 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 273 /* HeritageClause */) { + if (!isLastClause && root.parent.kind === 212 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 274 /* HeritageClause */) { var decl = root.parent.parent.parent; - return (decl.kind === 240 /* ClassDeclaration */ && root.parent.parent.token === 109 /* ImplementsKeyword */) || - (decl.kind === 241 /* InterfaceDeclaration */ && root.parent.parent.token === 86 /* ExtendsKeyword */); + return (decl.kind === 241 /* ClassDeclaration */ && root.parent.parent.token === 110 /* ImplementsKeyword */) || + (decl.kind === 242 /* InterfaceDeclaration */ && root.parent.parent.token === 87 /* ExtendsKeyword */); } return false; } @@ -95580,17 +96515,17 @@ var ts; node = node.parent; } switch (node.kind) { - case 100 /* ThisKeyword */: + case 101 /* ThisKeyword */: return !ts.isExpressionNode(node); - case 178 /* ThisType */: + case 179 /* ThisType */: return true; } switch (node.parent.kind) { - case 164 /* TypeReference */: + case 165 /* TypeReference */: return true; - case 183 /* ImportType */: + case 184 /* ImportType */: return !node.parent.isTypeOf; - case 211 /* ExpressionWithTypeArguments */: + case 212 /* ExpressionWithTypeArguments */: return !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent); } return false; @@ -95617,7 +96552,7 @@ var ts; ts.climbPastPropertyAccess = climbPastPropertyAccess; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 233 /* LabeledStatement */ && referenceNode.label.escapedText === labelName) { + if (referenceNode.kind === 234 /* LabeledStatement */ && referenceNode.label.escapedText === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -95633,11 +96568,11 @@ var ts; } ts.hasPropertyAccessExpressionWithName = hasPropertyAccessExpressionWithName; function isJumpStatementTarget(node) { - return node.kind === 72 /* Identifier */ && ts.isBreakOrContinueStatement(node.parent) && node.parent.label === node; + return node.kind === 73 /* Identifier */ && ts.isBreakOrContinueStatement(node.parent) && node.parent.label === node; } ts.isJumpStatementTarget = isJumpStatementTarget; function isLabelOfLabeledStatement(node) { - return node.kind === 72 /* Identifier */ && ts.isLabeledStatement(node.parent) && node.parent.label === node; + return node.kind === 73 /* Identifier */ && ts.isLabeledStatement(node.parent) && node.parent.label === node; } ts.isLabelOfLabeledStatement = isLabelOfLabeledStatement; function isLabelName(node) { @@ -95649,40 +96584,40 @@ var ts; } ts.isTagName = isTagName; function isRightSideOfQualifiedName(node) { - return node.parent.kind === 148 /* QualifiedName */ && node.parent.right === node; + return node.parent.kind === 149 /* QualifiedName */ && node.parent.right === node; } ts.isRightSideOfQualifiedName = isRightSideOfQualifiedName; function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 189 /* PropertyAccessExpression */ && node.parent.name === node; + return node && node.parent && node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.name === node; } ts.isRightSideOfPropertyAccess = isRightSideOfPropertyAccess; function isNameOfModuleDeclaration(node) { - return node.parent.kind === 244 /* ModuleDeclaration */ && node.parent.name === node; + return node.parent.kind === 245 /* ModuleDeclaration */ && node.parent.name === node; } ts.isNameOfModuleDeclaration = isNameOfModuleDeclaration; function isNameOfFunctionDeclaration(node) { - return node.kind === 72 /* Identifier */ && + return node.kind === 73 /* Identifier */ && ts.isFunctionLike(node.parent) && node.parent.name === node; } ts.isNameOfFunctionDeclaration = isNameOfFunctionDeclaration; function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { switch (node.parent.kind) { - case 154 /* PropertyDeclaration */: - case 153 /* PropertySignature */: - case 275 /* PropertyAssignment */: - case 278 /* EnumMember */: - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 244 /* ModuleDeclaration */: + case 155 /* PropertyDeclaration */: + case 154 /* PropertySignature */: + case 276 /* PropertyAssignment */: + case 279 /* EnumMember */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 245 /* ModuleDeclaration */: return ts.getNameOfDeclaration(node.parent) === node; - case 190 /* ElementAccessExpression */: + case 191 /* ElementAccessExpression */: return node.parent.argumentExpression === node; - case 149 /* ComputedPropertyName */: + case 150 /* ComputedPropertyName */: return true; - case 182 /* LiteralType */: - return node.parent.parent.kind === 180 /* IndexedAccessType */; + case 183 /* LiteralType */: + return node.parent.parent.kind === 181 /* IndexedAccessType */; default: return false; } @@ -95706,17 +96641,17 @@ var ts; return undefined; } switch (node.kind) { - case 284 /* SourceFile */: - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 240 /* ClassDeclaration */: - case 241 /* InterfaceDeclaration */: - case 243 /* EnumDeclaration */: - case 244 /* ModuleDeclaration */: + case 285 /* SourceFile */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 241 /* ClassDeclaration */: + case 242 /* InterfaceDeclaration */: + case 244 /* EnumDeclaration */: + case 245 /* ModuleDeclaration */: return node; } } @@ -95724,48 +96659,48 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 284 /* SourceFile */: + case 285 /* SourceFile */: return ts.isExternalModule(node) ? "module" /* moduleElement */ : "script" /* scriptElement */; - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: return "module" /* moduleElement */; - case 240 /* ClassDeclaration */: - case 209 /* ClassExpression */: + case 241 /* ClassDeclaration */: + case 210 /* ClassExpression */: return "class" /* classElement */; - case 241 /* InterfaceDeclaration */: return "interface" /* interfaceElement */; - case 242 /* TypeAliasDeclaration */: - case 302 /* JSDocCallbackTag */: - case 309 /* JSDocTypedefTag */: + case 242 /* InterfaceDeclaration */: return "interface" /* interfaceElement */; + case 243 /* TypeAliasDeclaration */: + case 303 /* JSDocCallbackTag */: + case 310 /* JSDocTypedefTag */: return "type" /* typeElement */; - case 243 /* EnumDeclaration */: return "enum" /* enumElement */; - case 237 /* VariableDeclaration */: + case 244 /* EnumDeclaration */: return "enum" /* enumElement */; + case 238 /* VariableDeclaration */: return getKindOfVariableDeclaration(node); - case 186 /* BindingElement */: + case 187 /* BindingElement */: return getKindOfVariableDeclaration(ts.getRootDeclaration(node)); - case 197 /* ArrowFunction */: - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: + case 198 /* ArrowFunction */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: return "function" /* functionElement */; - case 158 /* GetAccessor */: return "getter" /* memberGetAccessorElement */; - case 159 /* SetAccessor */: return "setter" /* memberSetAccessorElement */; - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: + case 159 /* GetAccessor */: return "getter" /* memberGetAccessorElement */; + case 160 /* SetAccessor */: return "setter" /* memberSetAccessorElement */; + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: return "method" /* memberFunctionElement */; - case 154 /* PropertyDeclaration */: - case 153 /* PropertySignature */: + case 155 /* PropertyDeclaration */: + case 154 /* PropertySignature */: return "property" /* memberVariableElement */; - case 162 /* IndexSignature */: return "index" /* indexSignatureElement */; - case 161 /* ConstructSignature */: return "construct" /* constructSignatureElement */; - case 160 /* CallSignature */: return "call" /* callSignatureElement */; - case 157 /* Constructor */: return "constructor" /* constructorImplementationElement */; - case 150 /* TypeParameter */: return "type parameter" /* typeParameterElement */; - case 278 /* EnumMember */: return "enum member" /* enumMemberElement */; - case 151 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? "property" /* memberVariableElement */ : "parameter" /* parameterElement */; - case 248 /* ImportEqualsDeclaration */: - case 253 /* ImportSpecifier */: - case 257 /* ExportSpecifier */: - case 251 /* NamespaceImport */: + case 163 /* IndexSignature */: return "index" /* indexSignatureElement */; + case 162 /* ConstructSignature */: return "construct" /* constructSignatureElement */; + case 161 /* CallSignature */: return "call" /* callSignatureElement */; + case 158 /* Constructor */: return "constructor" /* constructorImplementationElement */; + case 151 /* TypeParameter */: return "type parameter" /* typeParameterElement */; + case 279 /* EnumMember */: return "enum member" /* enumMemberElement */; + case 152 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? "property" /* memberVariableElement */ : "parameter" /* parameterElement */; + case 249 /* ImportEqualsDeclaration */: + case 254 /* ImportSpecifier */: + case 258 /* ExportSpecifier */: + case 252 /* NamespaceImport */: return "alias" /* alias */; - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: var kind = ts.getAssignmentDeclarationKind(node); var right = node.right; switch (kind) { @@ -95792,7 +96727,7 @@ var ts; return "" /* unknown */; } } - case 72 /* Identifier */: + case 73 /* Identifier */: return ts.isImportClause(node.parent) ? "alias" /* alias */ : "" /* unknown */; default: return "" /* unknown */; @@ -95808,12 +96743,12 @@ var ts; ts.getNodeKind = getNodeKind; function isThis(node) { switch (node.kind) { - case 100 /* ThisKeyword */: + case 101 /* ThisKeyword */: // case SyntaxKind.ThisType: TODO: GH#9267 return true; - case 72 /* Identifier */: + case 73 /* Identifier */: // 'this' as a parameter - return ts.identifierIsThisKeyword(node) && node.parent.kind === 151 /* Parameter */; + return ts.identifierIsThisKeyword(node) && node.parent.kind === 152 /* Parameter */; default: return false; } @@ -95878,42 +96813,42 @@ var ts; return false; } switch (n.kind) { - case 240 /* ClassDeclaration */: - case 241 /* InterfaceDeclaration */: - case 243 /* EnumDeclaration */: - case 188 /* ObjectLiteralExpression */: - case 184 /* ObjectBindingPattern */: - case 168 /* TypeLiteral */: - case 218 /* Block */: - case 245 /* ModuleBlock */: - case 246 /* CaseBlock */: - case 252 /* NamedImports */: - case 256 /* NamedExports */: + case 241 /* ClassDeclaration */: + case 242 /* InterfaceDeclaration */: + case 244 /* EnumDeclaration */: + case 189 /* ObjectLiteralExpression */: + case 185 /* ObjectBindingPattern */: + case 169 /* TypeLiteral */: + case 219 /* Block */: + case 246 /* ModuleBlock */: + case 247 /* CaseBlock */: + case 253 /* NamedImports */: + case 257 /* NamedExports */: return nodeEndsWith(n, 19 /* CloseBraceToken */, sourceFile); - case 274 /* CatchClause */: + case 275 /* CatchClause */: return isCompletedNode(n.block, sourceFile); - case 192 /* NewExpression */: + case 193 /* NewExpression */: if (!n.arguments) { return true; } // falls through - case 191 /* CallExpression */: - case 195 /* ParenthesizedExpression */: - case 177 /* ParenthesizedType */: + case 192 /* CallExpression */: + case 196 /* ParenthesizedExpression */: + case 178 /* ParenthesizedType */: return nodeEndsWith(n, 21 /* CloseParenToken */, sourceFile); - case 165 /* FunctionType */: - case 166 /* ConstructorType */: + case 166 /* FunctionType */: + case 167 /* ConstructorType */: return isCompletedNode(n.type, sourceFile); - case 157 /* Constructor */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: - case 161 /* ConstructSignature */: - case 160 /* CallSignature */: - case 197 /* ArrowFunction */: + case 158 /* Constructor */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: + case 162 /* ConstructSignature */: + case 161 /* CallSignature */: + case 198 /* ArrowFunction */: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -95923,65 +96858,65 @@ var ts; // Even though type parameters can be unclosed, we can get away with // having at least a closing paren. return hasChildOfKind(n, 21 /* CloseParenToken */, sourceFile); - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: return !!n.body && isCompletedNode(n.body, sourceFile); - case 222 /* IfStatement */: + case 223 /* IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 221 /* ExpressionStatement */: + case 222 /* ExpressionStatement */: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 26 /* SemicolonToken */, sourceFile); - case 187 /* ArrayLiteralExpression */: - case 185 /* ArrayBindingPattern */: - case 190 /* ElementAccessExpression */: - case 149 /* ComputedPropertyName */: - case 170 /* TupleType */: + case 188 /* ArrayLiteralExpression */: + case 186 /* ArrayBindingPattern */: + case 191 /* ElementAccessExpression */: + case 150 /* ComputedPropertyName */: + case 171 /* TupleType */: return nodeEndsWith(n, 23 /* CloseBracketToken */, sourceFile); - case 162 /* IndexSignature */: + case 163 /* IndexSignature */: if (n.type) { return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 23 /* CloseBracketToken */, sourceFile); - case 271 /* CaseClause */: - case 272 /* DefaultClause */: + case 272 /* CaseClause */: + case 273 /* DefaultClause */: // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed return false; - case 225 /* ForStatement */: - case 226 /* ForInStatement */: - case 227 /* ForOfStatement */: - case 224 /* WhileStatement */: + case 226 /* ForStatement */: + case 227 /* ForInStatement */: + case 228 /* ForOfStatement */: + case 225 /* WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 223 /* DoStatement */: + case 224 /* DoStatement */: // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')'; - return hasChildOfKind(n, 107 /* WhileKeyword */, sourceFile) + return hasChildOfKind(n, 108 /* WhileKeyword */, sourceFile) ? nodeEndsWith(n, 21 /* CloseParenToken */, sourceFile) : isCompletedNode(n.statement, sourceFile); - case 167 /* TypeQuery */: + case 168 /* TypeQuery */: return isCompletedNode(n.exprName, sourceFile); - case 199 /* TypeOfExpression */: - case 198 /* DeleteExpression */: - case 200 /* VoidExpression */: - case 207 /* YieldExpression */: - case 208 /* SpreadElement */: + case 200 /* TypeOfExpression */: + case 199 /* DeleteExpression */: + case 201 /* VoidExpression */: + case 208 /* YieldExpression */: + case 209 /* SpreadElement */: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 193 /* TaggedTemplateExpression */: + case 194 /* TaggedTemplateExpression */: return isCompletedNode(n.template, sourceFile); - case 206 /* TemplateExpression */: + case 207 /* TemplateExpression */: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 216 /* TemplateSpan */: + case 217 /* TemplateSpan */: return ts.nodeIsPresent(n.literal); - case 255 /* ExportDeclaration */: - case 249 /* ImportDeclaration */: + case 256 /* ExportDeclaration */: + case 250 /* ImportDeclaration */: return ts.nodeIsPresent(n.moduleSpecifier); - case 202 /* PrefixUnaryExpression */: + case 203 /* PrefixUnaryExpression */: return isCompletedNode(n.operand, sourceFile); - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: return isCompletedNode(n.right, sourceFile); - case 205 /* ConditionalExpression */: + case 206 /* ConditionalExpression */: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -96160,7 +97095,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 284 /* SourceFile */ || n.kind === 1 /* EndOfFileToken */ || ts.isJSDocCommentContainingNode(n)); + ts.Debug.assert(startNode !== undefined || n.kind === 285 /* SourceFile */ || n.kind === 1 /* EndOfFileToken */ || ts.isJSDocCommentContainingNode(n)); // Here we know that none of child token nodes embrace the position, // the only known case is when position is at the end of the file. // Try to find the rightmost token in the file without filtering. @@ -96230,17 +97165,17 @@ var ts; return true; } //
{ |
or
- if (token.kind === 28 /* LessThanToken */ && token.parent.kind === 270 /* JsxExpression */) { + if (token.kind === 28 /* LessThanToken */ && token.parent.kind === 271 /* JsxExpression */) { return true; } //
{ // | // } < /div> - if (token && token.kind === 19 /* CloseBraceToken */ && token.parent.kind === 270 /* JsxExpression */) { + if (token && token.kind === 19 /* CloseBraceToken */ && token.parent.kind === 271 /* JsxExpression */) { return true; } //
|
- if (token.kind === 28 /* LessThanToken */ && token.parent.kind === 263 /* JsxClosingElement */) { + if (token.kind === 28 /* LessThanToken */ && token.parent.kind === 264 /* JsxClosingElement */) { return true; } return false; @@ -96359,15 +97294,15 @@ var ts; nTypeArguments++; break; case 37 /* EqualsGreaterThanToken */: - case 72 /* Identifier */: + case 73 /* Identifier */: case 10 /* StringLiteral */: case 8 /* NumericLiteral */: case 9 /* BigIntLiteral */: - case 102 /* TrueKeyword */: - case 87 /* FalseKeyword */: - case 104 /* TypeOfKeyword */: - case 86 /* ExtendsKeyword */: - case 129 /* KeyOfKeyword */: + case 103 /* TrueKeyword */: + case 88 /* FalseKeyword */: + case 105 /* TypeOfKeyword */: + case 87 /* ExtendsKeyword */: + case 130 /* KeyOfKeyword */: case 24 /* DotToken */: case 50 /* BarToken */: case 56 /* QuestionToken */: @@ -96426,10 +97361,10 @@ var ts; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 164 /* TypeReference */ || node.kind === 191 /* CallExpression */) { + if (node.kind === 165 /* TypeReference */ || node.kind === 192 /* CallExpression */) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 240 /* ClassDeclaration */ || node.kind === 241 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(node) || node.kind === 241 /* ClassDeclaration */ || node.kind === 242 /* InterfaceDeclaration */) { return node.typeParameters; } return undefined; @@ -96449,7 +97384,7 @@ var ts; } ts.isStringOrRegularExpressionOrTemplateLiteral = isStringOrRegularExpressionOrTemplateLiteral; function isPunctuation(kind) { - return 18 /* FirstPunctuation */ <= kind && kind <= 71 /* LastPunctuation */; + return 18 /* FirstPunctuation */ <= kind && kind <= 72 /* LastPunctuation */; } ts.isPunctuation = isPunctuation; function isInsideTemplateLiteral(node, position, sourceFile) { @@ -96459,9 +97394,9 @@ var ts; ts.isInsideTemplateLiteral = isInsideTemplateLiteral; function isAccessibilityModifier(kind) { switch (kind) { - case 115 /* PublicKeyword */: - case 113 /* PrivateKeyword */: - case 114 /* ProtectedKeyword */: + case 116 /* PublicKeyword */: + case 114 /* PrivateKeyword */: + case 115 /* ProtectedKeyword */: return true; } return false; @@ -96474,18 +97409,18 @@ var ts; } ts.cloneCompilerOptions = cloneCompilerOptions; function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { - if (node.kind === 187 /* ArrayLiteralExpression */ || - node.kind === 188 /* ObjectLiteralExpression */) { + if (node.kind === 188 /* ArrayLiteralExpression */ || + node.kind === 189 /* ObjectLiteralExpression */) { // [a,b,c] from: // [a, b, c] = someExpression; - if (node.parent.kind === 204 /* BinaryExpression */ && + if (node.parent.kind === 205 /* BinaryExpression */ && node.parent.left === node && - node.parent.operatorToken.kind === 59 /* EqualsToken */) { + node.parent.operatorToken.kind === 60 /* EqualsToken */) { return true; } // [a, b, c] from: // for([a, b, c] of expression) - if (node.parent.kind === 227 /* ForOfStatement */ && + if (node.parent.kind === 228 /* ForOfStatement */ && node.parent.initializer === node) { return true; } @@ -96493,7 +97428,7 @@ var ts; // [x, [a, b, c] ] = someExpression // or // {x, a: {a, b, c} } = someExpression - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 275 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 276 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { return true; } } @@ -96537,22 +97472,22 @@ var ts; } ts.createTextChange = createTextChange; ts.typeKeywords = [ - 120 /* AnyKeyword */, - 146 /* BigIntKeyword */, - 123 /* BooleanKeyword */, - 87 /* FalseKeyword */, - 129 /* KeyOfKeyword */, - 132 /* NeverKeyword */, - 96 /* NullKeyword */, - 135 /* NumberKeyword */, - 136 /* ObjectKeyword */, - 138 /* StringKeyword */, - 139 /* SymbolKeyword */, - 102 /* TrueKeyword */, - 106 /* VoidKeyword */, - 141 /* UndefinedKeyword */, - 142 /* UniqueKeyword */, - 143 /* UnknownKeyword */, + 121 /* AnyKeyword */, + 147 /* BigIntKeyword */, + 124 /* BooleanKeyword */, + 88 /* FalseKeyword */, + 130 /* KeyOfKeyword */, + 133 /* NeverKeyword */, + 97 /* NullKeyword */, + 136 /* NumberKeyword */, + 137 /* ObjectKeyword */, + 139 /* StringKeyword */, + 140 /* SymbolKeyword */, + 103 /* TrueKeyword */, + 107 /* VoidKeyword */, + 142 /* UndefinedKeyword */, + 143 /* UniqueKeyword */, + 144 /* UnknownKeyword */, ]; function isTypeKeyword(kind) { return ts.contains(ts.typeKeywords, kind); @@ -96588,7 +97523,7 @@ var ts; } ts.skipConstraint = skipConstraint; function getNameFromPropertyName(name) { - return name.kind === 149 /* ComputedPropertyName */ + return name.kind === 150 /* ComputedPropertyName */ // treat computed property names where expression is string/numeric literal as just string/numeric literal ? ts.isStringOrNumericLiteralLike(name.expression) ? name.expression.text : undefined : ts.getTextOfIdentifierOrLiteral(name); @@ -96664,7 +97599,7 @@ var ts; } return ts.firstDefined(symbol.declarations, function (decl) { var name = ts.getNameOfDeclaration(decl); - return name && name.kind === 72 /* Identifier */ ? name.escapedText : undefined; + return name && name.kind === 73 /* Identifier */ ? name.escapedText : undefined; }); } ts.symbolEscapedNameNoDefault = symbolEscapedNameNoDefault; @@ -96753,7 +97688,7 @@ var ts; /* @internal */ (function (ts) { function isFirstDeclarationOfSymbolParameter(symbol) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 151 /* Parameter */; + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 152 /* Parameter */; } ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; var displayPartWriter = getDisplayPartWriter(); @@ -97007,10 +97942,15 @@ var ts; return ts.ensureScriptKind(fileName, host && host.getScriptKind && host.getScriptKind(fileName)); } ts.getScriptKind = getScriptKind; - function getSymbolTarget(symbol) { + function getSymbolTarget(symbol, checker) { var next = symbol; - while (isTransientSymbol(next) && next.target) { - next = next.target; + while (isAliasSymbol(next) || (isTransientSymbol(next) && next.target)) { + if (isTransientSymbol(next) && next.target) { + next = next.target; + } + else { + next = ts.skipAlias(next, checker); + } } return next; } @@ -97018,6 +97958,9 @@ var ts; function isTransientSymbol(symbol) { return (symbol.flags & 33554432 /* Transient */) !== 0; } + function isAliasSymbol(symbol) { + return (symbol.flags & 2097152 /* Alias */) !== 0; + } function getUniqueSymbolId(symbol, checker) { return ts.getSymbolId(ts.skipAlias(symbol, checker)); } @@ -97053,7 +97996,14 @@ var ts; function getSynthesizedDeepCloneWithRenames(node, includeTrivia, renameMap, checker, callback) { if (includeTrivia === void 0) { includeTrivia = true; } var clone; - if (ts.isIdentifier(node) && renameMap && checker) { + if (renameMap && checker && ts.isBindingElement(node) && ts.isIdentifier(node.name) && ts.isObjectBindingPattern(node.parent)) { + var symbol = checker.getSymbolAtLocation(node.name); + var renameInfo = symbol && renameMap.get(String(ts.getSymbolId(symbol))); + if (renameInfo && renameInfo.text !== (node.name || node.propertyName).getText()) { + clone = ts.createBindingElement(node.dotDotDotToken, node.propertyName || node.name, renameInfo, node.initializer); + } + } + else if (renameMap && checker && ts.isIdentifier(node)) { var symbol = checker.getSymbolAtLocation(node); var renameInfo = symbol && renameMap.get(String(ts.getSymbolId(symbol))); if (renameInfo) { @@ -97217,15 +98167,15 @@ var ts; function getContextualTypeFromParent(node, checker) { var parent = node.parent; switch (parent.kind) { - case 192 /* NewExpression */: + case 193 /* NewExpression */: return checker.getContextualType(parent); - case 204 /* BinaryExpression */: { + case 205 /* BinaryExpression */: { var _a = parent, left = _a.left, operatorToken = _a.operatorToken, right = _a.right; return isEqualityOperatorKind(operatorToken.kind) ? checker.getTypeAtLocation(node === right ? left : right) : checker.getContextualType(node); } - case 271 /* CaseClause */: + case 272 /* CaseClause */: return parent.expression === node ? getSwitchedType(parent, checker) : undefined; default: return checker.getContextualType(node); @@ -97267,8 +98217,8 @@ var ts; switch (node.kind) { case 10 /* StringLiteral */: case 14 /* NoSubstitutionTemplateLiteral */: - case 206 /* TemplateExpression */: - case 193 /* TaggedTemplateExpression */: + case 207 /* TemplateExpression */: + case 194 /* TaggedTemplateExpression */: return true; default: return false; @@ -97311,7 +98261,7 @@ var ts; var ts; (function (ts) { function createClassifier() { - var scanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ false); + var scanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false); function getClassificationsForLine(text, lexState, syntacticClassifierAbsent) { return convertClassificationsToResult(getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent), text); } @@ -97388,13 +98338,13 @@ var ts; function handleToken() { switch (token) { case 42 /* SlashToken */: - case 64 /* SlashEqualsToken */: + case 65 /* SlashEqualsToken */: if (!noRegexTable[lastNonTriviaToken] && scanner.reScanSlashToken() === 13 /* RegularExpressionLiteral */) { token = 13 /* RegularExpressionLiteral */; } break; case 28 /* LessThanToken */: - if (lastNonTriviaToken === 72 /* Identifier */) { + if (lastNonTriviaToken === 73 /* Identifier */) { // Could be the start of something generic. Keep track of that by bumping // up the current count of generic contexts we may be in. angleBracketStack++; @@ -97407,16 +98357,16 @@ var ts; angleBracketStack--; } break; - case 120 /* AnyKeyword */: - case 138 /* StringKeyword */: - case 135 /* NumberKeyword */: - case 123 /* BooleanKeyword */: - case 139 /* SymbolKeyword */: + case 121 /* AnyKeyword */: + case 139 /* StringKeyword */: + case 136 /* NumberKeyword */: + case 124 /* BooleanKeyword */: + case 140 /* SymbolKeyword */: if (angleBracketStack > 0 && !syntacticClassifierAbsent) { // If it looks like we're could be in something generic, don't classify this // as a keyword. We may just get overwritten by the syntactic classifier, // causing a noisy experience for the user. - token = 72 /* Identifier */; + token = 73 /* Identifier */; } break; case 15 /* TemplateHead */: @@ -97455,14 +98405,14 @@ var ts; break; } if (lastNonTriviaToken === 24 /* DotToken */) { - token = 72 /* Identifier */; + token = 73 /* Identifier */; } else if (ts.isKeyword(lastNonTriviaToken) && ts.isKeyword(token) && !canFollow(lastNonTriviaToken, token)) { // We have two keywords in a row. Only treat the second as a keyword if // it's a sequence that could legally occur in the language. Otherwise // treat it as an identifier. This way, if someone writes "private var" // we recognize that 'var' is actually an identifier here. - token = 72 /* Identifier */; + token = 73 /* Identifier */; } } } @@ -97476,19 +98426,19 @@ var ts; /// we have a series of divide operator. this list allows us to be more accurate by ruling out /// locations where a regexp cannot exist. var noRegexTable = ts.arrayToNumericMap([ - 72 /* Identifier */, + 73 /* Identifier */, 10 /* StringLiteral */, 8 /* NumericLiteral */, 9 /* BigIntLiteral */, 13 /* RegularExpressionLiteral */, - 100 /* ThisKeyword */, + 101 /* ThisKeyword */, 44 /* PlusPlusToken */, 45 /* MinusMinusToken */, 21 /* CloseParenToken */, 23 /* CloseBracketToken */, 19 /* CloseBraceToken */, - 102 /* TrueKeyword */, - 87 /* FalseKeyword */, + 103 /* TrueKeyword */, + 88 /* FalseKeyword */, ], function (token) { return token; }, function () { return true; }); function getNewEndOfLineState(scanner, token, lastOnTemplateStack) { switch (token) { @@ -97600,10 +98550,10 @@ var ts; return true; } switch (keyword2) { - case 126 /* GetKeyword */: - case 137 /* SetKeyword */: - case 124 /* ConstructorKeyword */: - case 116 /* StaticKeyword */: + case 127 /* GetKeyword */: + case 138 /* SetKeyword */: + case 125 /* ConstructorKeyword */: + case 117 /* StaticKeyword */: return true; // Allow things like "public get", "public constructor" and "public static". default: return false; // Any other keyword following "public" is actually an identifier, not a real keyword. @@ -97648,9 +98598,9 @@ var ts; case 30 /* GreaterThanToken */: case 31 /* LessThanEqualsToken */: case 32 /* GreaterThanEqualsToken */: - case 94 /* InstanceOfKeyword */: - case 93 /* InKeyword */: - case 119 /* AsKeyword */: + case 95 /* InstanceOfKeyword */: + case 94 /* InKeyword */: + case 120 /* AsKeyword */: case 33 /* EqualsEqualsToken */: case 34 /* ExclamationEqualsToken */: case 35 /* EqualsEqualsEqualsToken */: @@ -97660,18 +98610,18 @@ var ts; case 50 /* BarToken */: case 54 /* AmpersandAmpersandToken */: case 55 /* BarBarToken */: - case 70 /* BarEqualsToken */: - case 69 /* AmpersandEqualsToken */: - case 71 /* CaretEqualsToken */: - case 66 /* LessThanLessThanEqualsToken */: - case 67 /* GreaterThanGreaterThanEqualsToken */: - case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 60 /* PlusEqualsToken */: - case 61 /* MinusEqualsToken */: - case 62 /* AsteriskEqualsToken */: - case 64 /* SlashEqualsToken */: - case 65 /* PercentEqualsToken */: - case 59 /* EqualsToken */: + case 71 /* BarEqualsToken */: + case 70 /* AmpersandEqualsToken */: + case 72 /* CaretEqualsToken */: + case 67 /* LessThanLessThanEqualsToken */: + case 68 /* GreaterThanGreaterThanEqualsToken */: + case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 61 /* PlusEqualsToken */: + case 62 /* MinusEqualsToken */: + case 63 /* AsteriskEqualsToken */: + case 65 /* SlashEqualsToken */: + case 66 /* PercentEqualsToken */: + case 60 /* EqualsToken */: case 27 /* CommaToken */: return true; default: @@ -97698,7 +98648,7 @@ var ts; else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) { return 5 /* operator */; } - else if (token >= 18 /* FirstPunctuation */ && token <= 71 /* LastPunctuation */) { + else if (token >= 18 /* FirstPunctuation */ && token <= 72 /* LastPunctuation */) { return 10 /* punctuation */; } switch (token) { @@ -97717,7 +98667,7 @@ var ts; case 5 /* WhitespaceTrivia */: case 4 /* NewLineTrivia */: return 8 /* whiteSpace */; - case 72 /* Identifier */: + case 73 /* Identifier */: default: if (ts.isTemplateLiteralKind(token)) { return 6 /* stringLiteral */; @@ -97742,10 +98692,10 @@ var ts; // That means we're calling back into the host around every 1.2k of the file we process. // Lib.d.ts has similar numbers. switch (kind) { - case 244 /* ModuleDeclaration */: - case 240 /* ClassDeclaration */: - case 241 /* InterfaceDeclaration */: - case 239 /* FunctionDeclaration */: + case 245 /* ModuleDeclaration */: + case 241 /* ClassDeclaration */: + case 242 /* InterfaceDeclaration */: + case 240 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } @@ -97865,8 +98815,8 @@ var ts; var spanStart = span.start; var spanLength = span.length; // Make a scanner we can get trivia from. - var triviaScanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text); - var mergeConflictScanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text); + var triviaScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text); + var mergeConflictScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text); var result = []; processElement(sourceFile); return { spans: result, endOfLineState: 0 /* None */ }; @@ -97958,18 +98908,18 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); // e.g. "param" pos = tag.tagName.end; switch (tag.kind) { - case 304 /* JSDocParameterTag */: + case 305 /* JSDocParameterTag */: processJSDocParameterTag(tag); break; - case 308 /* JSDocTemplateTag */: + case 309 /* JSDocTemplateTag */: processJSDocTemplateTag(tag); pos = tag.end; break; - case 307 /* JSDocTypeTag */: + case 308 /* JSDocTypeTag */: processElement(tag.typeExpression); pos = tag.end; break; - case 305 /* JSDocReturnTag */: + case 306 /* JSDocReturnTag */: processElement(tag.typeExpression); pos = tag.end; break; @@ -98056,22 +99006,22 @@ var ts; } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 262 /* JsxOpeningElement */: + case 263 /* JsxOpeningElement */: if (token.parent.tagName === token) { return 19 /* jsxOpenTagName */; } break; - case 263 /* JsxClosingElement */: + case 264 /* JsxClosingElement */: if (token.parent.tagName === token) { return 20 /* jsxCloseTagName */; } break; - case 261 /* JsxSelfClosingElement */: + case 262 /* JsxSelfClosingElement */: if (token.parent.tagName === token) { return 21 /* jsxSelfClosingTagName */; } break; - case 267 /* JsxAttribute */: + case 268 /* JsxAttribute */: if (token.parent.name === token) { return 22 /* jsxAttribute */; } @@ -98098,19 +99048,19 @@ var ts; if (ts.isPunctuation(tokenKind)) { if (token) { var parent = token.parent; - if (tokenKind === 59 /* EqualsToken */) { + if (tokenKind === 60 /* EqualsToken */) { // the '=' in a variable declaration is special cased here. - if (parent.kind === 237 /* VariableDeclaration */ || - parent.kind === 154 /* PropertyDeclaration */ || - parent.kind === 151 /* Parameter */ || - parent.kind === 267 /* JsxAttribute */) { + if (parent.kind === 238 /* VariableDeclaration */ || + parent.kind === 155 /* PropertyDeclaration */ || + parent.kind === 152 /* Parameter */ || + parent.kind === 268 /* JsxAttribute */) { return 5 /* operator */; } } - if (parent.kind === 204 /* BinaryExpression */ || - parent.kind === 202 /* PrefixUnaryExpression */ || - parent.kind === 203 /* PostfixUnaryExpression */ || - parent.kind === 205 /* ConditionalExpression */) { + if (parent.kind === 205 /* BinaryExpression */ || + parent.kind === 203 /* PrefixUnaryExpression */ || + parent.kind === 204 /* PostfixUnaryExpression */ || + parent.kind === 206 /* ConditionalExpression */) { return 5 /* operator */; } } @@ -98124,7 +99074,7 @@ var ts; } else if (tokenKind === 10 /* StringLiteral */) { // TODO: GH#18217 - return token.parent.kind === 267 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; + return token.parent.kind === 268 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; } else if (tokenKind === 13 /* RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. @@ -98137,35 +99087,35 @@ var ts; else if (tokenKind === 11 /* JsxText */) { return 23 /* jsxText */; } - else if (tokenKind === 72 /* Identifier */) { + else if (tokenKind === 73 /* Identifier */) { if (token) { switch (token.parent.kind) { - case 240 /* ClassDeclaration */: + case 241 /* ClassDeclaration */: if (token.parent.name === token) { return 11 /* className */; } return; - case 150 /* TypeParameter */: + case 151 /* TypeParameter */: if (token.parent.name === token) { return 15 /* typeParameterName */; } return; - case 241 /* InterfaceDeclaration */: + case 242 /* InterfaceDeclaration */: if (token.parent.name === token) { return 13 /* interfaceName */; } return; - case 243 /* EnumDeclaration */: + case 244 /* EnumDeclaration */: if (token.parent.name === token) { return 12 /* enumName */; } return; - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: if (token.parent.name === token) { return 14 /* moduleName */; } return; - case 151 /* Parameter */: + case 152 /* Parameter */: if (token.parent.name === token) { return ts.isThisIdentifier(token) ? 3 /* keyword */ : 17 /* parameterName */; } @@ -98222,7 +99172,7 @@ var ts; return convertPathCompletions(completion.paths); case 1 /* Properties */: { var entries = []; - Completions.getCompletionEntriesFromSymbols(completion.symbols, entries, sourceFile, sourceFile, checker, 7 /* ESNext */, log, 4 /* String */, preferences); // Target will not be used, so arbitrary + Completions.getCompletionEntriesFromSymbols(completion.symbols, entries, sourceFile, sourceFile, checker, 8 /* ESNext */, log, 4 /* String */, preferences); // Target will not be used, so arbitrary return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, entries: entries }; } case 2 /* Types */: { @@ -98261,7 +99211,7 @@ var ts; var isNewIdentifierLocation = true; // The user may type in a path that doesn't yet exist, creating a "new identifier" with respect to the collection of identifiers the server is aware of. var entries = pathCompletions.map(function (_a) { var name = _a.name, kind = _a.kind, span = _a.span, extension = _a.extension; - return ({ name: name, kind: kind, kindModifiers: kindModifiersFromExtension(extension), sortText: "0", replacementSpan: span }); + return ({ name: name, kind: kind, kindModifiers: kindModifiersFromExtension(extension), sortText: Completions.SortText.LocationPriority, replacementSpan: span }); }); return { isGlobalCompletion: isGlobalCompletion, isMemberCompletion: false, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries }; } @@ -98288,11 +99238,11 @@ var ts; function getStringLiteralCompletionEntries(sourceFile, node, position, typeChecker, compilerOptions, host) { var parent = node.parent; switch (parent.kind) { - case 182 /* LiteralType */: + case 183 /* LiteralType */: switch (parent.parent.kind) { - case 164 /* TypeReference */: + case 165 /* TypeReference */: return { kind: 2 /* Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(parent)), isNewIdentifier: false }; - case 180 /* IndexedAccessType */: + case 181 /* IndexedAccessType */: // Get all apparent property names // i.e. interface Foo { // foo: string; @@ -98300,9 +99250,9 @@ var ts; // } // let x: Foo["/*completion position*/"] return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(parent.parent.objectType)); - case 183 /* ImportType */: + case 184 /* ImportType */: return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker) }; - case 173 /* UnionType */: { + case 174 /* UnionType */: { if (!ts.isTypeReferenceNode(parent.parent.parent)) return undefined; var alreadyUsedTypes_1 = getAlreadyUsedTypesInStringLiteralUnion(parent.parent, parent); @@ -98312,7 +99262,7 @@ var ts; default: return undefined; } - case 275 /* PropertyAssignment */: + case 276 /* PropertyAssignment */: if (ts.isObjectLiteralExpression(parent.parent) && parent.name === node) { // Get quoted name of properties of the object literal expression // i.e. interface ConfigFiles { @@ -98329,7 +99279,7 @@ var ts; return stringLiteralCompletionsFromProperties(typeChecker.getContextualType(parent.parent)); } return fromContextualType(); - case 190 /* ElementAccessExpression */: { + case 191 /* ElementAccessExpression */: { var _a = parent, expression = _a.expression, argumentExpression = _a.argumentExpression; if (node === argumentExpression) { // Get all names of properties on the expression @@ -98342,8 +99292,8 @@ var ts; } return undefined; } - case 191 /* CallExpression */: - case 192 /* NewExpression */: + case 192 /* CallExpression */: + case 193 /* NewExpression */: if (!ts.isRequireCall(parent, /*checkArgumentIsStringLiteralLike*/ false) && !ts.isImportCall(parent)) { var argumentInfo = ts.SignatureHelp.getArgumentInfoForCompletions(node, position, sourceFile); // Get string literal completions from specialized signatures of the target @@ -98352,9 +99302,9 @@ var ts; return argumentInfo ? getStringLiteralCompletionsFromSignature(argumentInfo, typeChecker) : fromContextualType(); } // falls through (is `require("")` or `import("")`) - case 249 /* ImportDeclaration */: - case 255 /* ExportDeclaration */: - case 259 /* ExternalModuleReference */: + case 250 /* ImportDeclaration */: + case 256 /* ExportDeclaration */: + case 260 /* ExternalModuleReference */: // Get all known external module names or complete a path to a module // i.e. import * as ns from "/*completion position*/"; // var y = import("/*completion position*/"); @@ -98801,7 +99751,7 @@ var ts; var offset = index !== -1 ? index + 1 : 0; // If the range is an identifier, span is unnecessary. var length = text.length - offset; - return length === 0 || ts.isIdentifierText(text.substr(offset, length), 7 /* ESNext */) ? undefined : ts.createTextSpan(textStart + offset, length); + return length === 0 || ts.isIdentifierText(text.substr(offset, length), 8 /* ESNext */) ? undefined : ts.createTextSpan(textStart + offset, length); } // Returns true if the path is explicitly relative to the script (i.e. relative to . or ..) function isPathRelativeToScript(path) { @@ -98864,6 +99814,14 @@ var ts; (function (ts) { var Completions; (function (Completions) { + var SortText; + (function (SortText) { + SortText["LocationPriority"] = "0"; + SortText["SuggestedClassMembers"] = "1"; + SortText["GlobalsOrKeywords"] = "2"; + SortText["AutoImportSuggestions"] = "3"; + SortText["JavascriptIdentifiers"] = "4"; + })(SortText = Completions.SortText || (Completions.SortText = {})); var SymbolOriginInfoKind; (function (SymbolOriginInfoKind) { SymbolOriginInfoKind[SymbolOriginInfoKind["ThisType"] = 0] = "ThisType"; @@ -98898,14 +99856,15 @@ var ts; var typeChecker = program.getTypeChecker(); var compilerOptions = program.getCompilerOptions(); var contextToken = ts.findPrecedingToken(position, sourceFile); - if (triggerCharacter && !isValidTrigger(sourceFile, triggerCharacter, contextToken, position)) + if (triggerCharacter && !ts.isInString(sourceFile, position, contextToken) && !isValidTrigger(sourceFile, triggerCharacter, contextToken, position)) { return undefined; + } var stringCompletions = Completions.StringCompletions.getStringLiteralCompletions(sourceFile, position, contextToken, typeChecker, compilerOptions, host, log, preferences); if (stringCompletions) { return stringCompletions; } if (contextToken && ts.isBreakOrContinueStatement(contextToken.parent) - && (contextToken.kind === 73 /* BreakKeyword */ || contextToken.kind === 78 /* ContinueKeyword */ || contextToken.kind === 72 /* Identifier */)) { + && (contextToken.kind === 74 /* BreakKeyword */ || contextToken.kind === 79 /* ContinueKeyword */ || contextToken.kind === 73 /* Identifier */)) { return getLabelCompletionAtPosition(contextToken.parent); } var completionData = getCompletionData(program, log, sourceFile, isUncheckedFile(sourceFile, compilerOptions), position, preferences, /*detailsEntryId*/ undefined); @@ -98932,7 +99891,7 @@ var ts; return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries }; } function completionInfoFromData(sourceFile, typeChecker, compilerOptions, log, completionData, preferences) { - var symbols = completionData.symbols, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression; + var symbols = completionData.symbols, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap; if (location && location.parent && ts.isJsxClosingElement(location.parent)) { // In the TypeScript JSX element, if such element is not defined. When users query for completion at closing tag, // instead of simply giving unknown value, the completion will return the tag-name of an associated opening-element. @@ -98946,20 +99905,20 @@ var ts; name: tagName.getFullText(sourceFile) + (hasClosingAngleBracket ? "" : ">"), kind: "class" /* classElement */, kindModifiers: undefined, - sortText: "0", + sortText: SortText.LocationPriority, }; return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: false, entries: [entry] }; } var entries = []; if (isUncheckedFile(sourceFile, compilerOptions)) { - var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, compilerOptions.target, log, completionKind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap); + var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, compilerOptions.target, log, completionKind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap); getJSCompletionEntries(sourceFile, location.pos, uniqueNames, compilerOptions.target, entries); // TODO: GH#18217 } else { if (!isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === 0 /* None */) { return undefined; } - getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, compilerOptions.target, log, completionKind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap); + getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, compilerOptions.target, log, completionKind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap); } if (keywordFilters !== 0 /* None */) { var entryNames = ts.arrayToSet(entries, function (e) { return e.name; }); @@ -99001,7 +99960,7 @@ var ts; name: realName, kind: "warning" /* warning */, kindModifiers: "", - sortText: "1" + sortText: SortText.JavascriptIdentifiers }); } }); @@ -99010,14 +99969,9 @@ var ts; return typeof literal === "object" ? ts.pseudoBigIntToString(literal) + "n" : JSON.stringify(literal); }; function createCompletionEntryForLiteral(literal) { - return { name: completionNameForLiteral(literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: "0" }; + return { name: completionNameForLiteral(literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority }; } - function createCompletionEntry(symbol, location, sourceFile, typeChecker, target, kind, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, preferences) { - var info = getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind); - if (!info) { - return undefined; - } - var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess; + function createCompletionEntry(symbol, sortText, location, sourceFile, typeChecker, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, preferences) { var insertText; var replacementSpan; if (origin && origin.kind === 0 /* ThisType */) { @@ -99054,7 +100008,7 @@ var ts; name: name, kind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location), kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), - sortText: "0", + sortText: sortText, source: getSourceFromOrigin(origin), hasAction: trueOrUndefined(!!origin && originIsExport(origin)), isRecommended: trueOrUndefined(isRecommendedCompletionMatch(symbol, recommendedCompletion, typeChecker)), @@ -99072,7 +100026,7 @@ var ts; function getSourceFromOrigin(origin) { return origin && originIsExport(origin) ? ts.stripQuotes(origin.moduleSymbol.name) : undefined; } - function getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, target, log, kind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap) { + function getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, target, log, kind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap) { var start = ts.timestamp(); // Tracks unique names. // We don't set this for global variables or completions from external module exports, because we can have multiple of those. @@ -99082,14 +100036,18 @@ var ts; for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) { var symbol = symbols_1[_i]; var origin = symbolToOriginInfoMap ? symbolToOriginInfoMap[ts.getSymbolId(symbol)] : undefined; - var entry = createCompletionEntry(symbol, location, sourceFile, typeChecker, target, kind, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, preferences); - if (!entry) { + var info = getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind); + if (!info) { continue; } - var name = entry.name; + var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess; if (uniques.has(name)) { continue; } + var entry = createCompletionEntry(symbol, symbolToSortTextMap && symbolToSortTextMap[ts.getSymbolId(symbol)] || SortText.LocationPriority, location, sourceFile, typeChecker, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, preferences); + if (!entry) { + continue; + } // Latter case tests whether this is a global variable. if (!origin && !(symbol.parent === undefined && !ts.some(symbol.declarations, function (d) { return d.getSourceFile() === location.getSourceFile(); }))) { // TODO: GH#18217 uniques.set(name, true); @@ -99122,7 +100080,7 @@ var ts; name: name, kindModifiers: "" /* none */, kind: "label" /* label */, - sortText: "0" + sortText: SortText.LocationPriority }); } } @@ -99262,25 +100220,25 @@ var ts; function getContextualType(previousToken, position, sourceFile, checker) { var parent = previousToken.parent; switch (previousToken.kind) { - case 72 /* Identifier */: + case 73 /* Identifier */: return ts.getContextualTypeFromParent(previousToken, checker); - case 59 /* EqualsToken */: + case 60 /* EqualsToken */: switch (parent.kind) { - case 237 /* VariableDeclaration */: + case 238 /* VariableDeclaration */: return checker.getContextualType(parent.initializer); // TODO: GH#18217 - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: return checker.getTypeAtLocation(parent.left); - case 267 /* JsxAttribute */: + case 268 /* JsxAttribute */: return checker.getContextualTypeForJsxAttribute(parent); default: return undefined; } - case 95 /* NewKeyword */: + case 96 /* NewKeyword */: return checker.getContextualType(parent); - case 74 /* CaseKeyword */: + case 75 /* CaseKeyword */: return ts.getSwitchedType(ts.cast(parent, ts.isCaseClause), checker); case 18 /* OpenBraceToken */: - return ts.isJsxExpression(parent) && parent.parent.kind !== 260 /* JsxElement */ ? checker.getContextualTypeForJsxAttribute(parent.parent) : undefined; + return ts.isJsxExpression(parent) && parent.parent.kind !== 261 /* JsxElement */ ? checker.getContextualTypeForJsxAttribute(parent.parent) : undefined; default: var argInfo = ts.SignatureHelp.getArgumentInfoForCompletions(previousToken, position, sourceFile); return argInfo @@ -99299,7 +100257,7 @@ var ts; return symbol.parent && (isModuleSymbol(symbol.parent) ? symbol : getFirstSymbolInChain(symbol.parent, enclosingDeclaration, checker)); } function isModuleSymbol(symbol) { - return symbol.declarations.some(function (d) { return d.kind === 284 /* SourceFile */; }); + return symbol.declarations.some(function (d) { return d.kind === 285 /* SourceFile */; }); } function getCompletionData(program, log, sourceFile, isUncheckedFile, position, preferences, detailsEntryId) { var typeChecker = program.getTypeChecker(); @@ -99350,11 +100308,11 @@ var ts; if (tag.tagName.pos <= position && position <= tag.tagName.end) { return { kind: 1 /* JsDocTagName */ }; } - if (isTagWithTypeExpression(tag) && tag.typeExpression && tag.typeExpression.kind === 288 /* JSDocTypeExpression */) { + if (isTagWithTypeExpression(tag) && tag.typeExpression && tag.typeExpression.kind === 289 /* JSDocTypeExpression */) { currentToken = ts.getTokenAtPosition(sourceFile, position); if (!currentToken || (!ts.isDeclarationName(currentToken) && - (currentToken.parent.kind !== 310 /* JSDocPropertyTag */ || + (currentToken.parent.kind !== 311 /* JSDocPropertyTag */ || currentToken.parent.name !== currentToken))) { // Use as type location if inside tag's type expression insideJsDocTagTypeExpression = isCurrentlyEditingNode(tag.typeExpression); @@ -99404,7 +100362,7 @@ var ts; if (contextToken.kind === 24 /* DotToken */) { isRightOfDot = true; switch (parent.kind) { - case 189 /* PropertyAccessExpression */: + case 190 /* PropertyAccessExpression */: propertyAccessToConvert = parent; node = propertyAccessToConvert.expression; if (node.end === contextToken.pos && @@ -99416,14 +100374,14 @@ var ts; return undefined; } break; - case 148 /* QualifiedName */: + case 149 /* QualifiedName */: node = parent.left; break; - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: node = parent.name; break; - case 183 /* ImportType */: - case 214 /* MetaProperty */: + case 184 /* ImportType */: + case 215 /* MetaProperty */: node = parent; break; default: @@ -99436,7 +100394,7 @@ var ts; // // If the tagname is a property access expression, we will then walk up to the top most of property access expression. // Then, try to get a JSX container and its associated attributes type. - if (parent && parent.kind === 189 /* PropertyAccessExpression */) { + if (parent && parent.kind === 190 /* PropertyAccessExpression */) { contextToken = parent; parent = parent.parent; } @@ -99444,48 +100402,48 @@ var ts; if (currentToken.parent === location) { switch (currentToken.kind) { case 30 /* GreaterThanToken */: - if (currentToken.parent.kind === 260 /* JsxElement */ || currentToken.parent.kind === 262 /* JsxOpeningElement */) { + if (currentToken.parent.kind === 261 /* JsxElement */ || currentToken.parent.kind === 263 /* JsxOpeningElement */) { location = currentToken; } break; case 42 /* SlashToken */: - if (currentToken.parent.kind === 261 /* JsxSelfClosingElement */) { + if (currentToken.parent.kind === 262 /* JsxSelfClosingElement */) { location = currentToken; } break; } } switch (parent.kind) { - case 263 /* JsxClosingElement */: + case 264 /* JsxClosingElement */: if (contextToken.kind === 42 /* SlashToken */) { isStartingCloseTag = true; location = contextToken; } break; - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: if (!binaryExpressionMayBeOpenTag(parent)) { break; } // falls through - case 261 /* JsxSelfClosingElement */: - case 260 /* JsxElement */: - case 262 /* JsxOpeningElement */: + case 262 /* JsxSelfClosingElement */: + case 261 /* JsxElement */: + case 263 /* JsxOpeningElement */: if (contextToken.kind === 28 /* LessThanToken */) { isRightOfOpenTag = true; location = contextToken; } break; - case 267 /* JsxAttribute */: + case 268 /* JsxAttribute */: switch (previousToken.kind) { - case 59 /* EqualsToken */: + case 60 /* EqualsToken */: isJsxInitializer = true; break; - case 72 /* Identifier */: + case 73 /* Identifier */: // For `
` we don't want to treat this as a jsx inializer, instead it's the attribute name. if (parent !== previousToken.parent && !parent.initializer && - ts.findChildOfKind(parent, 59 /* EqualsToken */, sourceFile)) { + ts.findChildOfKind(parent, 60 /* EqualsToken */, sourceFile)) { isJsxInitializer = previousToken; } } @@ -99499,6 +100457,7 @@ var ts; var keywordFilters = 0 /* None */; var symbols = []; var symbolToOriginInfoMap = []; + var symbolToSortTextMap = []; if (isRightOfDot) { getTypeScriptMemberSymbols(); } @@ -99544,15 +100503,16 @@ var ts; recommendedCompletion: recommendedCompletion, previousToken: previousToken, isJsxInitializer: isJsxInitializer, - insideJsDocTagTypeExpression: insideJsDocTagTypeExpression + insideJsDocTagTypeExpression: insideJsDocTagTypeExpression, + symbolToSortTextMap: symbolToSortTextMap }; function isTagWithTypeExpression(tag) { switch (tag.kind) { - case 304 /* JSDocParameterTag */: - case 310 /* JSDocPropertyTag */: - case 305 /* JSDocReturnTag */: - case 307 /* JSDocTypeTag */: - case 309 /* JSDocTypedefTag */: + case 305 /* JSDocParameterTag */: + case 311 /* JSDocPropertyTag */: + case 306 /* JSDocReturnTag */: + case 308 /* JSDocTypeTag */: + case 310 /* JSDocTypedefTag */: return true; default: return false; @@ -99594,15 +100554,15 @@ var ts; // If the module is merged with a value, we must get the type of the class and add its propertes (for inherited static methods). if (!isTypeLocation && symbol.declarations && - symbol.declarations.some(function (d) { return d.kind !== 284 /* SourceFile */ && d.kind !== 244 /* ModuleDeclaration */ && d.kind !== 243 /* EnumDeclaration */; })) { + symbol.declarations.some(function (d) { return d.kind !== 285 /* SourceFile */ && d.kind !== 245 /* ModuleDeclaration */ && d.kind !== 244 /* EnumDeclaration */; })) { addTypeProperties(typeChecker.getTypeOfSymbolAtLocation(symbol, node)); } return; } } } - if (ts.isMetaProperty(node) && (node.keywordToken === 95 /* NewKeyword */ || node.keywordToken === 92 /* ImportKeyword */)) { - var completion = (node.keywordToken === 95 /* NewKeyword */) ? "target" : "meta"; + if (ts.isMetaProperty(node) && (node.keywordToken === 96 /* NewKeyword */ || node.keywordToken === 93 /* ImportKeyword */)) { + var completion = (node.keywordToken === 96 /* NewKeyword */) ? "target" : "meta"; symbols.push(typeChecker.createSymbol(4 /* Property */, ts.escapeLeadingUnderscores(completion))); return; } @@ -99623,7 +100583,7 @@ var ts; else { for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) { var symbol = _a[_i]; - if (typeChecker.isValidPropertyAccessForCompletions(node.kind === 183 /* ImportType */ ? node : node.parent, type, symbol)) { + if (typeChecker.isValidPropertyAccessForCompletions(node.kind === 184 /* ImportType */ ? node : node.parent, type, symbol)) { addPropertySymbol(symbol); } } @@ -99726,14 +100686,22 @@ var ts; var isTypeOnly = isTypeOnlyCompletion(); var symbolMeanings = (isTypeOnly ? 0 /* None */ : 67220415 /* Value */) | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */; symbols = ts.Debug.assertEachDefined(typeChecker.getSymbolsInScope(scopeNode, symbolMeanings), "getSymbolsInScope() should all be defined"); + for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) { + var symbol = symbols_2[_i]; + if (!typeChecker.isArgumentsSymbol(symbol) && + !ts.some(symbol.declarations, function (d) { return d.getSourceFile() === sourceFile; })) { + symbolToSortTextMap[ts.getSymbolId(symbol)] = SortText.GlobalsOrKeywords; + } + } // Need to insert 'this.' before properties of `this` type, so only do that if `includeInsertTextCompletions` - if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 284 /* SourceFile */) { + if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 285 /* SourceFile */) { var thisType = typeChecker.tryGetThisTypeAt(scopeNode, /*includeGlobalThis*/ false); if (thisType) { - for (var _i = 0, _a = getPropertiesForCompletion(thisType, typeChecker); _i < _a.length; _i++) { - var symbol = _a[_i]; + for (var _a = 0, _b = getPropertiesForCompletion(thisType, typeChecker); _a < _b.length; _a++) { + var symbol = _b[_a]; symbolToOriginInfoMap[ts.getSymbolId(symbol)] = { kind: 0 /* ThisType */ }; symbols.push(symbol); + symbolToSortTextMap[ts.getSymbolId(symbol)] = SortText.SuggestedClassMembers; } } } @@ -99760,10 +100728,10 @@ var ts; } function isSnippetScope(scopeNode) { switch (scopeNode.kind) { - case 284 /* SourceFile */: - case 206 /* TemplateExpression */: - case 270 /* JsxExpression */: - case 218 /* Block */: + case 285 /* SourceFile */: + case 207 /* TemplateExpression */: + case 271 /* JsxExpression */: + case 219 /* Block */: return true; default: return ts.isStatement(scopeNode); @@ -99802,25 +100770,25 @@ var ts; } function isContextTokenValueLocation(contextToken) { return contextToken && - contextToken.kind === 104 /* TypeOfKeyword */ && - (contextToken.parent.kind === 167 /* TypeQuery */ || ts.isTypeOfExpression(contextToken.parent)); + contextToken.kind === 105 /* TypeOfKeyword */ && + (contextToken.parent.kind === 168 /* TypeQuery */ || ts.isTypeOfExpression(contextToken.parent)); } function isContextTokenTypeLocation(contextToken) { if (contextToken) { var parentKind = contextToken.parent.kind; switch (contextToken.kind) { case 57 /* ColonToken */: - return parentKind === 154 /* PropertyDeclaration */ || - parentKind === 153 /* PropertySignature */ || - parentKind === 151 /* Parameter */ || - parentKind === 237 /* VariableDeclaration */ || + return parentKind === 155 /* PropertyDeclaration */ || + parentKind === 154 /* PropertySignature */ || + parentKind === 152 /* Parameter */ || + parentKind === 238 /* VariableDeclaration */ || ts.isFunctionLikeKind(parentKind); - case 59 /* EqualsToken */: - return parentKind === 242 /* TypeAliasDeclaration */; - case 119 /* AsKeyword */: - return parentKind === 212 /* AsExpression */; - case 86 /* ExtendsKeyword */: - return parentKind === 150 /* TypeParameter */; + case 60 /* EqualsToken */: + return parentKind === 243 /* TypeAliasDeclaration */; + case 120 /* AsKeyword */: + return parentKind === 213 /* AsExpression */; + case 87 /* ExtendsKeyword */: + return parentKind === 151 /* TypeParameter */; } } return false; @@ -99852,6 +100820,7 @@ var ts; // So in `declare namespace foo {} declare module "foo" { export = foo; }`, there will just be the global completion for `foo`. ts.some(resolvedModuleSymbol.declarations, function (d) { return !!d.getSourceFile().externalModuleIndicator; })) { symbols.push(resolvedModuleSymbol); + symbolToSortTextMap[ts.getSymbolId(resolvedModuleSymbol)] = SortText.AutoImportSuggestions; symbolToOriginInfoMap[ts.getSymbolId(resolvedModuleSymbol)] = { kind: 3 /* Export */, moduleSymbol: moduleSymbol, isDefaultExport: false }; } for (var _i = 0, _a = typeChecker.getExportsOfModule(moduleSymbol); _i < _a.length; _i++) { @@ -99876,6 +100845,7 @@ var ts; var origin = { kind: 3 /* Export */, moduleSymbol: moduleSymbol, isDefaultExport: isDefaultExport }; if (detailsEntryId || stringContainsCharactersInOrder(getSymbolName(symbol, origin, target).toLowerCase(), tokenTextLowerCase)) { symbols.push(symbol); + symbolToSortTextMap[ts.getSymbolId(symbol)] = SortText.AutoImportSuggestions; symbolToOriginInfoMap[ts.getSymbolId(symbol)] = origin; } } @@ -99927,11 +100897,11 @@ var ts; return true; } if (contextToken.kind === 30 /* GreaterThanToken */ && contextToken.parent) { - if (contextToken.parent.kind === 262 /* JsxOpeningElement */) { + if (contextToken.parent.kind === 263 /* JsxOpeningElement */) { return true; } - if (contextToken.parent.kind === 263 /* JsxClosingElement */ || contextToken.parent.kind === 261 /* JsxSelfClosingElement */) { - return !!contextToken.parent.parent && contextToken.parent.parent.kind === 260 /* JsxElement */; + if (contextToken.parent.kind === 264 /* JsxClosingElement */ || contextToken.parent.kind === 262 /* JsxSelfClosingElement */) { + return !!contextToken.parent.parent && contextToken.parent.parent.kind === 261 /* JsxElement */; } } return false; @@ -99942,40 +100912,40 @@ var ts; // Previous token may have been a keyword that was converted to an identifier. switch (keywordForNode(previousToken)) { case 27 /* CommaToken */: - return containingNodeKind === 191 /* CallExpression */ // func( a, | - || containingNodeKind === 157 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ - || containingNodeKind === 192 /* NewExpression */ // new C(a, | - || containingNodeKind === 187 /* ArrayLiteralExpression */ // [a, | - || containingNodeKind === 204 /* BinaryExpression */ // const x = (a, | - || containingNodeKind === 165 /* FunctionType */; // var x: (s: string, list| + return containingNodeKind === 192 /* CallExpression */ // func( a, | + || containingNodeKind === 158 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ + || containingNodeKind === 193 /* NewExpression */ // new C(a, | + || containingNodeKind === 188 /* ArrayLiteralExpression */ // [a, | + || containingNodeKind === 205 /* BinaryExpression */ // const x = (a, | + || containingNodeKind === 166 /* FunctionType */; // var x: (s: string, list| case 20 /* OpenParenToken */: - return containingNodeKind === 191 /* CallExpression */ // func( | - || containingNodeKind === 157 /* Constructor */ // constructor( | - || containingNodeKind === 192 /* NewExpression */ // new C(a| - || containingNodeKind === 195 /* ParenthesizedExpression */ // const x = (a| - || containingNodeKind === 177 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ + return containingNodeKind === 192 /* CallExpression */ // func( | + || containingNodeKind === 158 /* Constructor */ // constructor( | + || containingNodeKind === 193 /* NewExpression */ // new C(a| + || containingNodeKind === 196 /* ParenthesizedExpression */ // const x = (a| + || containingNodeKind === 178 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ case 22 /* OpenBracketToken */: - return containingNodeKind === 187 /* ArrayLiteralExpression */ // [ | - || containingNodeKind === 162 /* IndexSignature */ // [ | : string ] - || containingNodeKind === 149 /* ComputedPropertyName */; // [ | /* this can become an index signature */ - case 130 /* ModuleKeyword */: // module | - case 131 /* NamespaceKeyword */: // namespace | + return containingNodeKind === 188 /* ArrayLiteralExpression */ // [ | + || containingNodeKind === 163 /* IndexSignature */ // [ | : string ] + || containingNodeKind === 150 /* ComputedPropertyName */; // [ | /* this can become an index signature */ + case 131 /* ModuleKeyword */: // module | + case 132 /* NamespaceKeyword */: // namespace | return true; case 24 /* DotToken */: - return containingNodeKind === 244 /* ModuleDeclaration */; // module A.| + return containingNodeKind === 245 /* ModuleDeclaration */; // module A.| case 18 /* OpenBraceToken */: - return containingNodeKind === 240 /* ClassDeclaration */; // class A{ | - case 59 /* EqualsToken */: - return containingNodeKind === 237 /* VariableDeclaration */ // const x = a| - || containingNodeKind === 204 /* BinaryExpression */; // x = a| + return containingNodeKind === 241 /* ClassDeclaration */; // class A{ | + case 60 /* EqualsToken */: + return containingNodeKind === 238 /* VariableDeclaration */ // const x = a| + || containingNodeKind === 205 /* BinaryExpression */; // x = a| case 15 /* TemplateHead */: - return containingNodeKind === 206 /* TemplateExpression */; // `aa ${| + return containingNodeKind === 207 /* TemplateExpression */; // `aa ${| case 16 /* TemplateMiddle */: - return containingNodeKind === 216 /* TemplateSpan */; // `aa ${10} dd ${| - case 115 /* PublicKeyword */: - case 113 /* PrivateKeyword */: - case 114 /* ProtectedKeyword */: - return containingNodeKind === 154 /* PropertyDeclaration */; // class A{ public | + return containingNodeKind === 217 /* TemplateSpan */; // `aa ${10} dd ${| + case 116 /* PublicKeyword */: + case 114 /* PrivateKeyword */: + case 115 /* ProtectedKeyword */: + return containingNodeKind === 155 /* PropertyDeclaration */; // class A{ public | } } return false; @@ -100002,7 +100972,7 @@ var ts; completionKind = 0 /* ObjectPropertyDeclaration */; var typeMembers; var existingMembers; - if (objectLikeContainer.kind === 188 /* ObjectLiteralExpression */) { + if (objectLikeContainer.kind === 189 /* ObjectLiteralExpression */) { var typeForObject = typeChecker.getContextualType(objectLikeContainer); if (!typeForObject) return 2 /* Fail */; @@ -100011,7 +100981,7 @@ var ts; existingMembers = objectLikeContainer.properties; } else { - ts.Debug.assert(objectLikeContainer.kind === 184 /* ObjectBindingPattern */); + ts.Debug.assert(objectLikeContainer.kind === 185 /* ObjectBindingPattern */); // We are *only* completing on properties from the type being destructured. isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); @@ -100022,12 +100992,12 @@ var ts; // through type declaration or inference. // Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed - // type of parameter will flow in from the contextual type of the function - var canGetType = ts.hasInitializer(rootDeclaration) || ts.hasType(rootDeclaration) || rootDeclaration.parent.parent.kind === 227 /* ForOfStatement */; - if (!canGetType && rootDeclaration.kind === 151 /* Parameter */) { + var canGetType = ts.hasInitializer(rootDeclaration) || ts.hasType(rootDeclaration) || rootDeclaration.parent.parent.kind === 228 /* ForOfStatement */; + if (!canGetType && rootDeclaration.kind === 152 /* Parameter */) { if (ts.isExpression(rootDeclaration.parent)) { canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); } - else if (rootDeclaration.parent.kind === 156 /* MethodDeclaration */ || rootDeclaration.parent.kind === 159 /* SetAccessor */) { + else if (rootDeclaration.parent.kind === 157 /* MethodDeclaration */ || rootDeclaration.parent.kind === 160 /* SetAccessor */) { canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent); } } @@ -100069,7 +101039,7 @@ var ts; return 0 /* Continue */; // cursor is in an import clause // try to show exported member for imported module - var moduleSpecifier = (namedImportsOrExports.kind === 252 /* NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier; + var moduleSpecifier = (namedImportsOrExports.kind === 253 /* NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier; var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier); // TODO: GH#18217 if (!moduleSpecifierSymbol) return 2 /* Fail */; @@ -100100,7 +101070,7 @@ var ts; var classElement = contextToken.parent; var classElementModifierFlags = ts.isClassElement(classElement) ? ts.getModifierFlags(classElement) : 0 /* None */; // If this is context token is not something we are editing now, consider if this would lead to be modifier - if (contextToken.kind === 72 /* Identifier */ && !isCurrentlyEditingNode(contextToken)) { + if (contextToken.kind === 73 /* Identifier */ && !isCurrentlyEditingNode(contextToken)) { switch (contextToken.getText()) { case "private": classElementModifierFlags = classElementModifierFlags | 8 /* Private */; @@ -100137,7 +101107,7 @@ var ts; break; case 40 /* AsteriskToken */: return ts.isMethodDeclaration(parent) ? ts.tryCast(parent.parent, ts.isObjectLiteralExpression) : undefined; - case 72 /* Identifier */: + case 73 /* Identifier */: return contextToken.text === "async" && ts.isShorthandPropertyAssignment(contextToken.parent) ? contextToken.parent.parent : undefined; } @@ -100190,12 +101160,12 @@ var ts; case 30 /* GreaterThanToken */: // End of a type argument list case 29 /* LessThanSlashToken */: case 42 /* SlashToken */: - case 72 /* Identifier */: - case 189 /* PropertyAccessExpression */: - case 268 /* JsxAttributes */: - case 267 /* JsxAttribute */: - case 269 /* JsxSpreadAttribute */: - if (parent && (parent.kind === 261 /* JsxSelfClosingElement */ || parent.kind === 262 /* JsxOpeningElement */)) { + case 73 /* Identifier */: + case 190 /* PropertyAccessExpression */: + case 269 /* JsxAttributes */: + case 268 /* JsxAttribute */: + case 270 /* JsxSpreadAttribute */: + if (parent && (parent.kind === 262 /* JsxSelfClosingElement */ || parent.kind === 263 /* JsxOpeningElement */)) { if (contextToken.kind === 30 /* GreaterThanToken */) { var precedingToken = ts.findPrecedingToken(contextToken.pos, sourceFile, /*startNode*/ undefined); if (!parent.typeArguments || (precedingToken && precedingToken.kind === 42 /* SlashToken */)) @@ -100203,7 +101173,7 @@ var ts; } return parent; } - else if (parent.kind === 267 /* JsxAttribute */) { + else if (parent.kind === 268 /* JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -100215,7 +101185,7 @@ var ts; // its parent is a JsxExpression, whose parent is a JsxAttribute, // whose parent is a JsxOpeningLikeElement case 10 /* StringLiteral */: - if (parent && ((parent.kind === 267 /* JsxAttribute */) || (parent.kind === 269 /* JsxSpreadAttribute */))) { + if (parent && ((parent.kind === 268 /* JsxAttribute */) || (parent.kind === 270 /* JsxSpreadAttribute */))) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -100225,8 +101195,8 @@ var ts; break; case 19 /* CloseBraceToken */: if (parent && - parent.kind === 270 /* JsxExpression */ && - parent.parent && parent.parent.kind === 267 /* JsxAttribute */) { + parent.kind === 271 /* JsxExpression */ && + parent.parent && parent.parent.kind === 268 /* JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -100234,7 +101204,7 @@ var ts; // each JsxAttribute can have initializer as JsxExpression return parent.parent.parent.parent; } - if (parent && parent.kind === 269 /* JsxSpreadAttribute */) { + if (parent && parent.kind === 270 /* JsxSpreadAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -100254,62 +101224,62 @@ var ts; var containingNodeKind = parent.kind; switch (contextToken.kind) { case 27 /* CommaToken */: - return containingNodeKind === 237 /* VariableDeclaration */ || - containingNodeKind === 238 /* VariableDeclarationList */ || - containingNodeKind === 219 /* VariableStatement */ || - containingNodeKind === 243 /* EnumDeclaration */ || // enum a { foo, | + return containingNodeKind === 238 /* VariableDeclaration */ || + containingNodeKind === 239 /* VariableDeclarationList */ || + containingNodeKind === 220 /* VariableStatement */ || + containingNodeKind === 244 /* EnumDeclaration */ || // enum a { foo, | isFunctionLikeButNotConstructor(containingNodeKind) || - containingNodeKind === 241 /* InterfaceDeclaration */ || // interface A= contextToken.pos); case 24 /* DotToken */: - return containingNodeKind === 185 /* ArrayBindingPattern */; // var [.| + return containingNodeKind === 186 /* ArrayBindingPattern */; // var [.| case 57 /* ColonToken */: - return containingNodeKind === 186 /* BindingElement */; // var {x :html| + return containingNodeKind === 187 /* BindingElement */; // var {x :html| case 22 /* OpenBracketToken */: - return containingNodeKind === 185 /* ArrayBindingPattern */; // var [x| + return containingNodeKind === 186 /* ArrayBindingPattern */; // var [x| case 20 /* OpenParenToken */: - return containingNodeKind === 274 /* CatchClause */ || + return containingNodeKind === 275 /* CatchClause */ || isFunctionLikeButNotConstructor(containingNodeKind); case 18 /* OpenBraceToken */: - return containingNodeKind === 243 /* EnumDeclaration */; // enum a { | + return containingNodeKind === 244 /* EnumDeclaration */; // enum a { | case 28 /* LessThanToken */: - return containingNodeKind === 240 /* ClassDeclaration */ || // class A< | - containingNodeKind === 209 /* ClassExpression */ || // var C = class D< | - containingNodeKind === 241 /* InterfaceDeclaration */ || // interface A< | - containingNodeKind === 242 /* TypeAliasDeclaration */ || // type List< | + return containingNodeKind === 241 /* ClassDeclaration */ || // class A< | + containingNodeKind === 210 /* ClassExpression */ || // var C = class D< | + containingNodeKind === 242 /* InterfaceDeclaration */ || // interface A< | + containingNodeKind === 243 /* TypeAliasDeclaration */ || // type List< | ts.isFunctionLikeKind(containingNodeKind); - case 116 /* StaticKeyword */: - return containingNodeKind === 154 /* PropertyDeclaration */ && !ts.isClassLike(parent.parent); + case 117 /* StaticKeyword */: + return containingNodeKind === 155 /* PropertyDeclaration */ && !ts.isClassLike(parent.parent); case 25 /* DotDotDotToken */: - return containingNodeKind === 151 /* Parameter */ || - (!!parent.parent && parent.parent.kind === 185 /* ArrayBindingPattern */); // var [...z| - case 115 /* PublicKeyword */: - case 113 /* PrivateKeyword */: - case 114 /* ProtectedKeyword */: - return containingNodeKind === 151 /* Parameter */ && !ts.isConstructorDeclaration(parent.parent); - case 119 /* AsKeyword */: - return containingNodeKind === 253 /* ImportSpecifier */ || - containingNodeKind === 257 /* ExportSpecifier */ || - containingNodeKind === 251 /* NamespaceImport */; - case 126 /* GetKeyword */: - case 137 /* SetKeyword */: + return containingNodeKind === 152 /* Parameter */ || + (!!parent.parent && parent.parent.kind === 186 /* ArrayBindingPattern */); // var [...z| + case 116 /* PublicKeyword */: + case 114 /* PrivateKeyword */: + case 115 /* ProtectedKeyword */: + return containingNodeKind === 152 /* Parameter */ && !ts.isConstructorDeclaration(parent.parent); + case 120 /* AsKeyword */: + return containingNodeKind === 254 /* ImportSpecifier */ || + containingNodeKind === 258 /* ExportSpecifier */ || + containingNodeKind === 252 /* NamespaceImport */; + case 127 /* GetKeyword */: + case 138 /* SetKeyword */: return !isFromObjectTypeDeclaration(contextToken); - case 76 /* ClassKeyword */: - case 84 /* EnumKeyword */: - case 110 /* InterfaceKeyword */: - case 90 /* FunctionKeyword */: - case 105 /* VarKeyword */: - case 92 /* ImportKeyword */: - case 111 /* LetKeyword */: - case 77 /* ConstKeyword */: - case 117 /* YieldKeyword */: - case 140 /* TypeKeyword */: // type htm| + case 77 /* ClassKeyword */: + case 85 /* EnumKeyword */: + case 111 /* InterfaceKeyword */: + case 91 /* FunctionKeyword */: + case 106 /* VarKeyword */: + case 93 /* ImportKeyword */: + case 112 /* LetKeyword */: + case 78 /* ConstKeyword */: + case 118 /* YieldKeyword */: + case 141 /* TypeKeyword */: // type htm| return true; case 40 /* AsteriskToken */: return ts.isFunctionLike(contextToken.parent) && !ts.isMethodDeclaration(contextToken.parent); @@ -100332,22 +101302,22 @@ var ts; } // Previous token may have been a keyword that was converted to an identifier. switch (keywordForNode(contextToken)) { - case 118 /* AbstractKeyword */: - case 76 /* ClassKeyword */: - case 77 /* ConstKeyword */: - case 125 /* DeclareKeyword */: - case 84 /* EnumKeyword */: - case 90 /* FunctionKeyword */: - case 110 /* InterfaceKeyword */: - case 111 /* LetKeyword */: - case 113 /* PrivateKeyword */: - case 114 /* ProtectedKeyword */: - case 115 /* PublicKeyword */: - case 116 /* StaticKeyword */: - case 105 /* VarKeyword */: - case 117 /* YieldKeyword */: + case 119 /* AbstractKeyword */: + case 77 /* ClassKeyword */: + case 78 /* ConstKeyword */: + case 126 /* DeclareKeyword */: + case 85 /* EnumKeyword */: + case 91 /* FunctionKeyword */: + case 111 /* InterfaceKeyword */: + case 112 /* LetKeyword */: + case 114 /* PrivateKeyword */: + case 115 /* ProtectedKeyword */: + case 116 /* PublicKeyword */: + case 117 /* StaticKeyword */: + case 106 /* VarKeyword */: + case 118 /* YieldKeyword */: return true; - case 121 /* AsyncKeyword */: + case 122 /* AsyncKeyword */: return ts.isPropertyDeclaration(contextToken.parent); } return ts.isDeclarationName(contextToken) @@ -100357,7 +101327,7 @@ var ts; && !(ts.isClassLike(contextToken.parent) && (contextToken !== previousToken || position > previousToken.end)); } function isFunctionLikeButNotConstructor(kind) { - return ts.isFunctionLikeKind(kind) && kind !== 157 /* Constructor */; + return ts.isFunctionLikeKind(kind) && kind !== 158 /* Constructor */; } function isDotOfNumericLiteral(contextToken) { if (contextToken.kind === 8 /* NumericLiteral */) { @@ -100380,12 +101350,12 @@ var ts; for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 275 /* PropertyAssignment */ && - m.kind !== 276 /* ShorthandPropertyAssignment */ && - m.kind !== 186 /* BindingElement */ && - m.kind !== 156 /* MethodDeclaration */ && - m.kind !== 158 /* GetAccessor */ && - m.kind !== 159 /* SetAccessor */) { + if (m.kind !== 276 /* PropertyAssignment */ && + m.kind !== 277 /* ShorthandPropertyAssignment */ && + m.kind !== 187 /* BindingElement */ && + m.kind !== 157 /* MethodDeclaration */ && + m.kind !== 159 /* GetAccessor */ && + m.kind !== 160 /* SetAccessor */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -100395,7 +101365,7 @@ var ts; var existingName = void 0; if (ts.isBindingElement(m) && m.propertyName) { // include only identifiers in completion list - if (m.propertyName.kind === 72 /* Identifier */) { + if (m.propertyName.kind === 73 /* Identifier */) { existingName = m.propertyName.escapedText; } } @@ -100420,10 +101390,10 @@ var ts; for (var _i = 0, existingMembers_2 = existingMembers; _i < existingMembers_2.length; _i++) { var m = existingMembers_2[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 154 /* PropertyDeclaration */ && - m.kind !== 156 /* MethodDeclaration */ && - m.kind !== 158 /* GetAccessor */ && - m.kind !== 159 /* SetAccessor */) { + if (m.kind !== 155 /* PropertyDeclaration */ && + m.kind !== 157 /* MethodDeclaration */ && + m.kind !== 159 /* GetAccessor */ && + m.kind !== 160 /* SetAccessor */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -100463,7 +101433,7 @@ var ts; if (isCurrentlyEditingNode(attr)) { continue; } - if (attr.kind === 267 /* JsxAttribute */) { + if (attr.kind === 268 /* JsxAttribute */) { seenNames.set(attr.name.escapedText, true); } } @@ -100483,9 +101453,9 @@ var ts; || ts.isKnownSymbol(symbol)) { return undefined; } - var validIdentiferResult = { name: name, needsConvertPropertyAccess: false }; + var validIdentifierResult = { name: name, needsConvertPropertyAccess: false }; if (ts.isIdentifierText(name, target)) - return validIdentiferResult; + return validIdentifierResult; switch (kind) { case 3 /* MemberLike */: return undefined; @@ -100498,7 +101468,7 @@ var ts; return name.charCodeAt(0) === 32 /* space */ ? undefined : { name: name, needsConvertPropertyAccess: true }; case 5 /* None */: case 4 /* String */: - return validIdentiferResult; + return validIdentifierResult; default: ts.Debug.assertNever(kind); } @@ -100507,12 +101477,12 @@ var ts; var _keywordCompletions = []; var allKeywordsCompletions = ts.memoize(function () { var res = []; - for (var i = 73 /* FirstKeyword */; i <= 147 /* LastKeyword */; i++) { + for (var i = 74 /* FirstKeyword */; i <= 148 /* LastKeyword */; i++) { res.push({ name: ts.tokenToString(i), kind: "keyword" /* keyword */, kindModifiers: "" /* none */, - sortText: "0" + sortText: SortText.GlobalsOrKeywords }); } return res; @@ -100532,8 +101502,8 @@ var ts; case 0 /* None */: return false; case 1 /* All */: - return kind === 121 /* AsyncKeyword */ || 122 /* AwaitKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind) || kind === 125 /* DeclareKeyword */ || kind === 130 /* ModuleKeyword */ - || ts.isTypeKeyword(kind) && kind !== 141 /* UndefinedKeyword */; + return kind === 122 /* AsyncKeyword */ || 123 /* AwaitKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind) || kind === 126 /* DeclareKeyword */ || kind === 131 /* ModuleKeyword */ + || ts.isTypeKeyword(kind) && kind !== 142 /* UndefinedKeyword */; case 2 /* ClassElementKeywords */: return isClassMemberCompletionKeyword(kind); case 3 /* InterfaceElementKeywords */: @@ -100551,54 +101521,54 @@ var ts; } function isTypeScriptOnlyKeyword(kind) { switch (kind) { - case 118 /* AbstractKeyword */: - case 120 /* AnyKeyword */: - case 146 /* BigIntKeyword */: - case 123 /* BooleanKeyword */: - case 125 /* DeclareKeyword */: - case 84 /* EnumKeyword */: - case 145 /* GlobalKeyword */: - case 109 /* ImplementsKeyword */: - case 127 /* InferKeyword */: - case 110 /* InterfaceKeyword */: - case 128 /* IsKeyword */: - case 129 /* KeyOfKeyword */: - case 130 /* ModuleKeyword */: - case 131 /* NamespaceKeyword */: - case 132 /* NeverKeyword */: - case 135 /* NumberKeyword */: - case 136 /* ObjectKeyword */: - case 113 /* PrivateKeyword */: - case 114 /* ProtectedKeyword */: - case 115 /* PublicKeyword */: - case 133 /* ReadonlyKeyword */: - case 138 /* StringKeyword */: - case 139 /* SymbolKeyword */: - case 140 /* TypeKeyword */: - case 142 /* UniqueKeyword */: - case 143 /* UnknownKeyword */: + case 119 /* AbstractKeyword */: + case 121 /* AnyKeyword */: + case 147 /* BigIntKeyword */: + case 124 /* BooleanKeyword */: + case 126 /* DeclareKeyword */: + case 85 /* EnumKeyword */: + case 146 /* GlobalKeyword */: + case 110 /* ImplementsKeyword */: + case 128 /* InferKeyword */: + case 111 /* InterfaceKeyword */: + case 129 /* IsKeyword */: + case 130 /* KeyOfKeyword */: + case 131 /* ModuleKeyword */: + case 132 /* NamespaceKeyword */: + case 133 /* NeverKeyword */: + case 136 /* NumberKeyword */: + case 137 /* ObjectKeyword */: + case 114 /* PrivateKeyword */: + case 115 /* ProtectedKeyword */: + case 116 /* PublicKeyword */: + case 134 /* ReadonlyKeyword */: + case 139 /* StringKeyword */: + case 140 /* SymbolKeyword */: + case 141 /* TypeKeyword */: + case 143 /* UniqueKeyword */: + case 144 /* UnknownKeyword */: return true; default: return false; } } function isInterfaceOrTypeLiteralCompletionKeyword(kind) { - return kind === 133 /* ReadonlyKeyword */; + return kind === 134 /* ReadonlyKeyword */; } function isClassMemberCompletionKeyword(kind) { switch (kind) { - case 118 /* AbstractKeyword */: - case 124 /* ConstructorKeyword */: - case 126 /* GetKeyword */: - case 137 /* SetKeyword */: - case 121 /* AsyncKeyword */: + case 119 /* AbstractKeyword */: + case 125 /* ConstructorKeyword */: + case 127 /* GetKeyword */: + case 138 /* SetKeyword */: + case 122 /* AsyncKeyword */: return true; default: return ts.isClassMemberModifier(kind); } } function isFunctionLikeBodyKeyword(kind) { - return kind === 121 /* AsyncKeyword */ || kind === 122 /* AwaitKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind); + return kind === 122 /* AsyncKeyword */ || kind === 123 /* AwaitKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind); } function keywordForNode(node) { return ts.isIdentifier(node) ? node.originalKeywordKind || 0 /* Unknown */ : node.kind; @@ -100635,7 +101605,7 @@ var ts; function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location) { // class c { method() { } | method2() { } } switch (location.kind) { - case 311 /* SyntaxList */: + case 312 /* SyntaxList */: return ts.tryCast(location.parent, ts.isObjectTypeDeclaration); case 1 /* EndOfFileToken */: var cls = ts.tryCast(ts.lastOrUndefined(ts.cast(location.parent, ts.isSourceFile).statements), ts.isObjectTypeDeclaration); @@ -100744,40 +101714,40 @@ var ts; } function getHighlightSpans(node, sourceFile) { switch (node.kind) { - case 91 /* IfKeyword */: - case 83 /* ElseKeyword */: + case 92 /* IfKeyword */: + case 84 /* ElseKeyword */: return ts.isIfStatement(node.parent) ? getIfElseOccurrences(node.parent, sourceFile) : undefined; - case 97 /* ReturnKeyword */: + case 98 /* ReturnKeyword */: return useParent(node.parent, ts.isReturnStatement, getReturnOccurrences); - case 101 /* ThrowKeyword */: + case 102 /* ThrowKeyword */: return useParent(node.parent, ts.isThrowStatement, getThrowOccurrences); - case 103 /* TryKeyword */: - case 75 /* CatchKeyword */: - case 88 /* FinallyKeyword */: - var tryStatement = node.kind === 75 /* CatchKeyword */ ? node.parent.parent : node.parent; + case 104 /* TryKeyword */: + case 76 /* CatchKeyword */: + case 89 /* FinallyKeyword */: + var tryStatement = node.kind === 76 /* CatchKeyword */ ? node.parent.parent : node.parent; return useParent(tryStatement, ts.isTryStatement, getTryCatchFinallyOccurrences); - case 99 /* SwitchKeyword */: + case 100 /* SwitchKeyword */: return useParent(node.parent, ts.isSwitchStatement, getSwitchCaseDefaultOccurrences); - case 74 /* CaseKeyword */: - case 80 /* DefaultKeyword */: + case 75 /* CaseKeyword */: + case 81 /* DefaultKeyword */: return useParent(node.parent.parent.parent, ts.isSwitchStatement, getSwitchCaseDefaultOccurrences); - case 73 /* BreakKeyword */: - case 78 /* ContinueKeyword */: + case 74 /* BreakKeyword */: + case 79 /* ContinueKeyword */: return useParent(node.parent, ts.isBreakOrContinueStatement, getBreakOrContinueStatementOccurrences); - case 89 /* ForKeyword */: - case 107 /* WhileKeyword */: - case 82 /* DoKeyword */: + case 90 /* ForKeyword */: + case 108 /* WhileKeyword */: + case 83 /* DoKeyword */: return useParent(node.parent, function (n) { return ts.isIterationStatement(n, /*lookInLabeledStatements*/ true); }, getLoopBreakContinueOccurrences); - case 124 /* ConstructorKeyword */: - return getFromAllDeclarations(ts.isConstructorDeclaration, [124 /* ConstructorKeyword */]); - case 126 /* GetKeyword */: - case 137 /* SetKeyword */: - return getFromAllDeclarations(ts.isAccessor, [126 /* GetKeyword */, 137 /* SetKeyword */]); - case 122 /* AwaitKeyword */: + case 125 /* ConstructorKeyword */: + return getFromAllDeclarations(ts.isConstructorDeclaration, [125 /* ConstructorKeyword */]); + case 127 /* GetKeyword */: + case 138 /* SetKeyword */: + return getFromAllDeclarations(ts.isAccessor, [127 /* GetKeyword */, 138 /* SetKeyword */]); + case 123 /* AwaitKeyword */: return useParent(node.parent, ts.isAwaitExpression, getAsyncAndAwaitOccurrences); - case 121 /* AsyncKeyword */: + case 122 /* AsyncKeyword */: return highlightSpans(getAsyncAndAwaitOccurrences(node)); - case 117 /* YieldKeyword */: + case 118 /* YieldKeyword */: return highlightSpans(getYieldOccurrences(node)); default: return ts.isModifierKind(node.kind) && (ts.isDeclaration(node.parent) || ts.isVariableStatement(node.parent)) @@ -100820,7 +101790,7 @@ var ts; var child = throwStatement; while (child.parent) { var parent = child.parent; - if (ts.isFunctionBlock(parent) || parent.kind === 284 /* SourceFile */) { + if (ts.isFunctionBlock(parent) || parent.kind === 285 /* SourceFile */) { return parent; } // A throw-statement is only owned by a try-statement if the try-statement has @@ -100852,16 +101822,16 @@ var ts; function getBreakOrContinueOwner(statement) { return ts.findAncestor(statement, function (node) { switch (node.kind) { - case 232 /* SwitchStatement */: - if (statement.kind === 228 /* ContinueStatement */) { + case 233 /* SwitchStatement */: + if (statement.kind === 229 /* ContinueStatement */) { return false; } // falls through - case 225 /* ForStatement */: - case 226 /* ForInStatement */: - case 227 /* ForOfStatement */: - case 224 /* WhileStatement */: - case 223 /* DoStatement */: + case 226 /* ForStatement */: + case 227 /* ForInStatement */: + case 228 /* ForOfStatement */: + case 225 /* WhileStatement */: + case 224 /* DoStatement */: return !statement.label || isLabeledBy(node, statement.label.escapedText); default: // Don't cross function boundaries. @@ -100877,11 +101847,11 @@ var ts; // Types of node whose children might have modifiers. var container = declaration.parent; switch (container.kind) { - case 245 /* ModuleBlock */: - case 284 /* SourceFile */: - case 218 /* Block */: - case 271 /* CaseClause */: - case 272 /* DefaultClause */: + case 246 /* ModuleBlock */: + case 285 /* SourceFile */: + case 219 /* Block */: + case 272 /* CaseClause */: + case 273 /* DefaultClause */: // Container is either a class declaration or the declaration is a classDeclaration if (modifierFlag & 128 /* Abstract */ && ts.isClassDeclaration(declaration)) { return declaration.members.concat([declaration]); @@ -100889,12 +101859,12 @@ var ts; else { return container.statements; } - case 157 /* Constructor */: - case 156 /* MethodDeclaration */: - case 239 /* FunctionDeclaration */: + case 158 /* Constructor */: + case 157 /* MethodDeclaration */: + case 240 /* FunctionDeclaration */: return container.parameters.concat((ts.isClassLike(container.parent) ? container.parent.members : [])); - case 240 /* ClassDeclaration */: - case 209 /* ClassExpression */: + case 241 /* ClassDeclaration */: + case 210 /* ClassExpression */: var nodes = container.members; // If we're an accessibility modifier, we're in an instance member and should search // the constructor's parameter list for instance members as well. @@ -100925,12 +101895,12 @@ var ts; } function getLoopBreakContinueOccurrences(loopNode) { var keywords = []; - if (pushKeywordIf(keywords, loopNode.getFirstToken(), 89 /* ForKeyword */, 107 /* WhileKeyword */, 82 /* DoKeyword */)) { + if (pushKeywordIf(keywords, loopNode.getFirstToken(), 90 /* ForKeyword */, 108 /* WhileKeyword */, 83 /* DoKeyword */)) { // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. - if (loopNode.kind === 223 /* DoStatement */) { + if (loopNode.kind === 224 /* DoStatement */) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, loopTokens[i], 107 /* WhileKeyword */)) { + if (pushKeywordIf(keywords, loopTokens[i], 108 /* WhileKeyword */)) { break; } } @@ -100938,7 +101908,7 @@ var ts; } ts.forEach(aggregateAllBreakAndContinueStatements(loopNode.statement), function (statement) { if (ownsBreakOrContinueStatement(loopNode, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 73 /* BreakKeyword */, 78 /* ContinueKeyword */); + pushKeywordIf(keywords, statement.getFirstToken(), 74 /* BreakKeyword */, 79 /* ContinueKeyword */); } }); return keywords; @@ -100947,13 +101917,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 225 /* ForStatement */: - case 226 /* ForInStatement */: - case 227 /* ForOfStatement */: - case 223 /* DoStatement */: - case 224 /* WhileStatement */: + case 226 /* ForStatement */: + case 227 /* ForInStatement */: + case 228 /* ForOfStatement */: + case 224 /* DoStatement */: + case 225 /* WhileStatement */: return getLoopBreakContinueOccurrences(owner); - case 232 /* SwitchStatement */: + case 233 /* SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); } } @@ -100961,13 +101931,13 @@ var ts; } function getSwitchCaseDefaultOccurrences(switchStatement) { var keywords = []; - pushKeywordIf(keywords, switchStatement.getFirstToken(), 99 /* SwitchKeyword */); + pushKeywordIf(keywords, switchStatement.getFirstToken(), 100 /* SwitchKeyword */); // Go through each clause in the switch statement, collecting the 'case'/'default' keywords. ts.forEach(switchStatement.caseBlock.clauses, function (clause) { - pushKeywordIf(keywords, clause.getFirstToken(), 74 /* CaseKeyword */, 80 /* DefaultKeyword */); + pushKeywordIf(keywords, clause.getFirstToken(), 75 /* CaseKeyword */, 81 /* DefaultKeyword */); ts.forEach(aggregateAllBreakAndContinueStatements(clause), function (statement) { if (ownsBreakOrContinueStatement(switchStatement, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 73 /* BreakKeyword */); + pushKeywordIf(keywords, statement.getFirstToken(), 74 /* BreakKeyword */); } }); }); @@ -100975,13 +101945,13 @@ var ts; } function getTryCatchFinallyOccurrences(tryStatement, sourceFile) { var keywords = []; - pushKeywordIf(keywords, tryStatement.getFirstToken(), 103 /* TryKeyword */); + pushKeywordIf(keywords, tryStatement.getFirstToken(), 104 /* TryKeyword */); if (tryStatement.catchClause) { - pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 75 /* CatchKeyword */); + pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 76 /* CatchKeyword */); } if (tryStatement.finallyBlock) { - var finallyKeyword = ts.findChildOfKind(tryStatement, 88 /* FinallyKeyword */, sourceFile); - pushKeywordIf(keywords, finallyKeyword, 88 /* FinallyKeyword */); + var finallyKeyword = ts.findChildOfKind(tryStatement, 89 /* FinallyKeyword */, sourceFile); + pushKeywordIf(keywords, finallyKeyword, 89 /* FinallyKeyword */); } return keywords; } @@ -100992,13 +101962,13 @@ var ts; } var keywords = []; ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { - keywords.push(ts.findChildOfKind(throwStatement, 101 /* ThrowKeyword */, sourceFile)); + keywords.push(ts.findChildOfKind(throwStatement, 102 /* ThrowKeyword */, sourceFile)); }); // If the "owner" is a function, then we equate 'return' and 'throw' statements in their // ability to "jump out" of the function, and include occurrences for both. if (ts.isFunctionBlock(owner)) { ts.forEachReturnStatement(owner, function (returnStatement) { - keywords.push(ts.findChildOfKind(returnStatement, 97 /* ReturnKeyword */, sourceFile)); + keywords.push(ts.findChildOfKind(returnStatement, 98 /* ReturnKeyword */, sourceFile)); }); } return keywords; @@ -101010,11 +101980,11 @@ var ts; } var keywords = []; ts.forEachReturnStatement(ts.cast(func.body, ts.isBlock), function (returnStatement) { - keywords.push(ts.findChildOfKind(returnStatement, 97 /* ReturnKeyword */, sourceFile)); + keywords.push(ts.findChildOfKind(returnStatement, 98 /* ReturnKeyword */, sourceFile)); }); // Include 'throw' statements that do not occur within a try block. ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { - keywords.push(ts.findChildOfKind(throwStatement, 101 /* ThrowKeyword */, sourceFile)); + keywords.push(ts.findChildOfKind(throwStatement, 102 /* ThrowKeyword */, sourceFile)); }); return keywords; } @@ -101026,13 +101996,13 @@ var ts; var keywords = []; if (func.modifiers) { func.modifiers.forEach(function (modifier) { - pushKeywordIf(keywords, modifier, 121 /* AsyncKeyword */); + pushKeywordIf(keywords, modifier, 122 /* AsyncKeyword */); }); } ts.forEachChild(func, function (child) { traverseWithoutCrossingFunction(child, function (node) { if (ts.isAwaitExpression(node)) { - pushKeywordIf(keywords, node.getFirstToken(), 122 /* AwaitKeyword */); + pushKeywordIf(keywords, node.getFirstToken(), 123 /* AwaitKeyword */); } }); }); @@ -101047,7 +102017,7 @@ var ts; ts.forEachChild(func, function (child) { traverseWithoutCrossingFunction(child, function (node) { if (ts.isYieldExpression(node)) { - pushKeywordIf(keywords, node.getFirstToken(), 117 /* YieldKeyword */); + pushKeywordIf(keywords, node.getFirstToken(), 118 /* YieldKeyword */); } }); }); @@ -101066,7 +102036,7 @@ var ts; // We'd like to highlight else/ifs together if they are only separated by whitespace // (i.e. the keywords are separated by no comments, no newlines). for (var i = 0; i < keywords.length; i++) { - if (keywords[i].kind === 83 /* ElseKeyword */ && i < keywords.length - 1) { + if (keywords[i].kind === 84 /* ElseKeyword */ && i < keywords.length - 1) { var elseKeyword = keywords[i]; var ifKeyword = keywords[i + 1]; // this *should* always be an 'if' keyword. var shouldCombineElseAndIf = true; @@ -101101,10 +102071,10 @@ var ts; // Now traverse back down through the else branches, aggregating if/else keywords of if-statements. while (true) { var children = ifStatement.getChildren(sourceFile); - pushKeywordIf(keywords, children[0], 91 /* IfKeyword */); + pushKeywordIf(keywords, children[0], 92 /* IfKeyword */); // Generally the 'else' keyword is second-to-last, so we traverse backwards. for (var i = children.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, children[i], 83 /* ElseKeyword */)) { + if (pushKeywordIf(keywords, children[i], 84 /* ElseKeyword */)) { break; } } @@ -101320,12 +102290,12 @@ var ts; if (cancellationToken) cancellationToken.throwIfCancellationRequested(); switch (direct.kind) { - case 191 /* CallExpression */: + case 192 /* CallExpression */: if (!isAvailableThroughGlobal) { var parent = direct.parent; - if (exportKind === 2 /* ExportEquals */ && parent.kind === 237 /* VariableDeclaration */) { + if (exportKind === 2 /* ExportEquals */ && parent.kind === 238 /* VariableDeclaration */) { var name = parent.name; - if (name.kind === 72 /* Identifier */) { + if (name.kind === 73 /* Identifier */) { directImports.push(name); break; } @@ -101334,22 +102304,22 @@ var ts; addIndirectUser(direct.getSourceFile()); } break; - case 72 /* Identifier */: // for 'const x = require("y"); + case 73 /* Identifier */: // for 'const x = require("y"); break; // TODO: GH#23879 - case 248 /* ImportEqualsDeclaration */: + case 249 /* ImportEqualsDeclaration */: handleNamespaceImport(direct, direct.name, ts.hasModifier(direct, 1 /* Export */), /*alreadyAddedDirect*/ false); break; - case 249 /* ImportDeclaration */: + case 250 /* ImportDeclaration */: directImports.push(direct); var namedBindings = direct.importClause && direct.importClause.namedBindings; - if (namedBindings && namedBindings.kind === 251 /* NamespaceImport */) { + if (namedBindings && namedBindings.kind === 252 /* NamespaceImport */) { handleNamespaceImport(direct, namedBindings.name, /*isReExport*/ false, /*alreadyAddedDirect*/ true); } else if (!isAvailableThroughGlobal && ts.isDefaultImport(direct)) { addIndirectUser(getSourceFileLikeForImportDeclaration(direct)); // Add a check for indirect uses to handle synthetic default imports } break; - case 255 /* ExportDeclaration */: + case 256 /* ExportDeclaration */: if (!direct.exportClause) { // This is `export * from "foo"`, so imports of this module may import the export too. handleDirectImports(getContainingModuleSymbol(direct, checker)); @@ -101359,11 +102329,11 @@ var ts; directImports.push(direct); } break; - case 183 /* ImportType */: + case 184 /* ImportType */: directImports.push(direct); break; default: - ts.Debug.assertNever(direct, "Unexpected import kind: " + ts.Debug.showSyntaxKind(direct)); + ts.Debug.failBadSyntaxKind(direct, "Unexpected import kind."); } } } @@ -101376,7 +102346,7 @@ var ts; } else if (!isAvailableThroughGlobal) { var sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration); - ts.Debug.assert(sourceFileLike.kind === 284 /* SourceFile */ || sourceFileLike.kind === 244 /* ModuleDeclaration */); + ts.Debug.assert(sourceFileLike.kind === 285 /* SourceFile */ || sourceFileLike.kind === 245 /* ModuleDeclaration */); if (isReExport || findNamespaceReExports(sourceFileLike, name, checker)) { addIndirectUsers(sourceFileLike); } @@ -101431,17 +102401,17 @@ var ts; } return { importSearches: importSearches, singleReferences: singleReferences }; function handleImport(decl) { - if (decl.kind === 248 /* ImportEqualsDeclaration */) { + if (decl.kind === 249 /* ImportEqualsDeclaration */) { if (isExternalModuleImportEquals(decl)) { handleNamespaceImportLike(decl.name); } return; } - if (decl.kind === 72 /* Identifier */) { + if (decl.kind === 73 /* Identifier */) { handleNamespaceImportLike(decl); return; } - if (decl.kind === 183 /* ImportType */) { + if (decl.kind === 184 /* ImportType */) { if (decl.qualifier) { if (ts.isIdentifier(decl.qualifier) && decl.qualifier.escapedText === ts.symbolName(exportSymbol)) { singleReferences.push(decl.qualifier); @@ -101456,17 +102426,17 @@ var ts; if (decl.moduleSpecifier.kind !== 10 /* StringLiteral */) { return; } - if (decl.kind === 255 /* ExportDeclaration */) { + if (decl.kind === 256 /* ExportDeclaration */) { searchForNamedImport(decl.exportClause); return; } var _a = decl.importClause || { name: undefined, namedBindings: undefined }, name = _a.name, namedBindings = _a.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 251 /* NamespaceImport */: + case 252 /* NamespaceImport */: handleNamespaceImportLike(namedBindings.name); break; - case 252 /* NamedImports */: + case 253 /* NamedImports */: // 'default' might be accessed as a named import `{ default as foo }`. if (exportKind === 0 /* Named */ || exportKind === 1 /* Default */) { searchForNamedImport(namedBindings); @@ -101516,7 +102486,7 @@ var ts; } } else { - var localSymbol = element.kind === 257 /* ExportSpecifier */ && element.propertyName + var localSymbol = element.kind === 258 /* ExportSpecifier */ && element.propertyName ? checker.getExportSpecifierLocalTargetSymbol(element) // For re-exporting under a different name, we want to get the re-exported symbol. : checker.getSymbolAtLocation(name); addSearch(name, localSymbol); @@ -101545,7 +102515,7 @@ var ts; for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { var referencingFile = sourceFiles_1[_i]; var searchSourceFile = searchModuleSymbol.valueDeclaration; - if (searchSourceFile.kind === 284 /* SourceFile */) { + if (searchSourceFile.kind === 285 /* SourceFile */) { for (var _a = 0, _b = referencingFile.referencedFiles; _a < _b.length; _a++) { var ref = _b[_a]; if (program.getSourceFileFromReference(referencingFile, ref) === searchSourceFile) { @@ -101593,7 +102563,7 @@ var ts; } /** Iterates over all statements at the top level or in module declarations. Returns the first truthy result. */ function forEachPossibleImportOrExportStatement(sourceFileLike, action) { - return ts.forEach(sourceFileLike.kind === 284 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { + return ts.forEach(sourceFileLike.kind === 285 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { return action(statement) || (isAmbientModuleDeclaration(statement) && ts.forEach(statement.body && statement.body.statements, action)); }); } @@ -101608,15 +102578,15 @@ var ts; else { forEachPossibleImportOrExportStatement(sourceFile, function (statement) { switch (statement.kind) { - case 255 /* ExportDeclaration */: - case 249 /* ImportDeclaration */: { + case 256 /* ExportDeclaration */: + case 250 /* ImportDeclaration */: { var decl = statement; if (decl.moduleSpecifier && ts.isStringLiteral(decl.moduleSpecifier)) { action(decl, decl.moduleSpecifier); } break; } - case 248 /* ImportEqualsDeclaration */: { + case 249 /* ImportEqualsDeclaration */: { var decl = statement; if (isExternalModuleImportEquals(decl)) { action(decl, decl.moduleReference.expression); @@ -101640,7 +102610,7 @@ var ts; var parent = node.parent; var grandParent = parent.parent; if (symbol.exportSymbol) { - if (parent.kind === 189 /* PropertyAccessExpression */) { + if (parent.kind === 190 /* PropertyAccessExpression */) { // When accessing an export of a JS module, there's no alias. The symbol will still be flagged as an export even though we're at the use. // So check that we are at the declaration. return symbol.declarations.some(function (d) { return d === parent; }) && ts.isBinaryExpression(grandParent) @@ -101706,7 +102676,7 @@ var ts; var sym = useLhsSymbol ? checker.getSymbolAtLocation(ts.cast(node.left, ts.isPropertyAccessExpression).name) : symbol; // Better detection for GH#20803 if (sym && !(checker.getMergedSymbol(sym.parent).flags & 1536 /* Module */)) { - ts.Debug.fail("Special property assignment kind does not have a module as its parent. Assignment is " + ts.Debug.showSymbol(sym) + ", parent is " + ts.Debug.showSymbol(sym.parent)); + ts.Debug.fail("Special property assignment kind does not have a module as its parent. Assignment is " + ts.Debug.formatSymbol(sym) + ", parent is " + ts.Debug.formatSymbol(sym.parent)); } return sym && exportInfo(sym, kind); } @@ -101762,10 +102732,10 @@ var ts; // If a reference is a class expression, the exported node would be its parent. // If a reference is a variable declaration, the exported node would be the variable statement. function getExportNode(parent, node) { - if (parent.kind === 237 /* VariableDeclaration */) { + if (parent.kind === 238 /* VariableDeclaration */) { var p = parent; return p.name !== node ? undefined : - p.parent.kind === 274 /* CatchClause */ ? undefined : p.parent.parent.kind === 219 /* VariableStatement */ ? p.parent.parent : undefined; + p.parent.kind === 275 /* CatchClause */ ? undefined : p.parent.parent.kind === 220 /* VariableStatement */ ? p.parent.parent : undefined; } else { return parent; @@ -101774,13 +102744,13 @@ var ts; function isNodeImport(node) { var parent = node.parent; switch (parent.kind) { - case 248 /* ImportEqualsDeclaration */: + case 249 /* ImportEqualsDeclaration */: return parent.name === node && isExternalModuleImportEquals(parent); - case 253 /* ImportSpecifier */: + case 254 /* ImportSpecifier */: // For a rename import `{ foo as bar }`, don't search for the imported symbol. Just find local uses of `bar`. return !parent.propertyName; - case 250 /* ImportClause */: - case 251 /* NamespaceImport */: + case 251 /* ImportClause */: + case 252 /* NamespaceImport */: ts.Debug.assert(parent.name === node); return true; default: @@ -101813,21 +102783,21 @@ var ts; return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol); } function getSourceFileLikeForImportDeclaration(node) { - if (node.kind === 191 /* CallExpression */) { + if (node.kind === 192 /* CallExpression */) { return node.getSourceFile(); } var parent = node.parent; - if (parent.kind === 284 /* SourceFile */) { + if (parent.kind === 285 /* SourceFile */) { return parent; } - ts.Debug.assert(parent.kind === 245 /* ModuleBlock */); + ts.Debug.assert(parent.kind === 246 /* ModuleBlock */); return ts.cast(parent.parent, isAmbientModuleDeclaration); } function isAmbientModuleDeclaration(node) { - return node.kind === 244 /* ModuleDeclaration */ && node.name.kind === 10 /* StringLiteral */; + return node.kind === 245 /* ModuleDeclaration */ && node.name.kind === 10 /* StringLiteral */; } function isExternalModuleImportEquals(eq) { - return eq.moduleReference.kind === 259 /* ExternalModuleReference */ && eq.moduleReference.expression.kind === 10 /* StringLiteral */; + return eq.moduleReference.kind === 260 /* ExternalModuleReference */ && eq.moduleReference.expression.kind === 10 /* StringLiteral */; } })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); })(ts || (ts = {})); @@ -101879,18 +102849,18 @@ var ts; } FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition; function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position) { - if (node.kind === 284 /* SourceFile */) { + if (node.kind === 285 /* SourceFile */) { return undefined; } var checker = program.getTypeChecker(); // If invoked directly on a shorthand property assignment, then return // the declaration of the symbol being assigned (not the symbol being assigned to). - if (node.parent.kind === 276 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 277 /* ShorthandPropertyAssignment */) { var result_1 = []; FindAllReferences.Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function (node) { return result_1.push(nodeEntry(node)); }); return result_1; } - else if (node.kind === 98 /* SuperKeyword */ || ts.isSuperProperty(node.parent)) { + else if (node.kind === 99 /* SuperKeyword */ || ts.isSuperProperty(node.parent)) { // References to and accesses on the super keyword only have one possible implementation, so no // need to "Find all References" var symbol = checker.getSymbolAtLocation(node); @@ -101970,7 +102940,7 @@ var ts; textSpan: textSpan, fileName: fileName, isWriteAccess: isWriteAccessForReference(node), - isDefinition: node.kind === 80 /* DefaultKeyword */ + isDefinition: node.kind === 81 /* DefaultKeyword */ || !!ts.getDeclarationFromName(node) || ts.isLiteralComputedPropertyDeclarationName(node), isInString: kind === 2 /* StringLiteral */ ? true : undefined, @@ -102027,13 +102997,13 @@ var ts; if (symbol) { return getDefinitionKindAndDisplayParts(symbol, checker, node); } - else if (node.kind === 188 /* ObjectLiteralExpression */) { + else if (node.kind === 189 /* ObjectLiteralExpression */) { return { kind: "interface" /* interfaceElement */, displayParts: [ts.punctuationPart(20 /* OpenParenToken */), ts.textPart("object literal"), ts.punctuationPart(21 /* CloseParenToken */)] }; } - else if (node.kind === 209 /* ClassExpression */) { + else if (node.kind === 210 /* ClassExpression */) { return { kind: "local class" /* localClassElement */, displayParts: [ts.punctuationPart(20 /* OpenParenToken */), ts.textPart("anonymous local class"), ts.punctuationPart(21 /* CloseParenToken */)] @@ -102076,7 +103046,7 @@ var ts; /** A node is considered a writeAccess iff it is a name of a declaration or a target of an assignment */ function isWriteAccessForReference(node) { var decl = ts.getDeclarationFromName(node); - return !!decl && declarationIsWriteAccess(decl) || node.kind === 80 /* DefaultKeyword */ || ts.isWriteAccess(node); + return !!decl && declarationIsWriteAccess(decl) || node.kind === 81 /* DefaultKeyword */ || ts.isWriteAccess(node); } /** * True if 'decl' provides a value, as in `function f() {}`; @@ -102087,46 +103057,46 @@ var ts; if (!!(decl.flags & 4194304 /* Ambient */)) return true; switch (decl.kind) { - case 204 /* BinaryExpression */: - case 186 /* BindingElement */: - case 240 /* ClassDeclaration */: - case 209 /* ClassExpression */: - case 80 /* DefaultKeyword */: - case 243 /* EnumDeclaration */: - case 278 /* EnumMember */: - case 257 /* ExportSpecifier */: - case 250 /* ImportClause */: // default import - case 248 /* ImportEqualsDeclaration */: - case 253 /* ImportSpecifier */: - case 241 /* InterfaceDeclaration */: - case 302 /* JSDocCallbackTag */: - case 309 /* JSDocTypedefTag */: - case 267 /* JsxAttribute */: - case 244 /* ModuleDeclaration */: - case 247 /* NamespaceExportDeclaration */: - case 251 /* NamespaceImport */: - case 151 /* Parameter */: - case 276 /* ShorthandPropertyAssignment */: - case 242 /* TypeAliasDeclaration */: - case 150 /* TypeParameter */: + case 205 /* BinaryExpression */: + case 187 /* BindingElement */: + case 241 /* ClassDeclaration */: + case 210 /* ClassExpression */: + case 81 /* DefaultKeyword */: + case 244 /* EnumDeclaration */: + case 279 /* EnumMember */: + case 258 /* ExportSpecifier */: + case 251 /* ImportClause */: // default import + case 249 /* ImportEqualsDeclaration */: + case 254 /* ImportSpecifier */: + case 242 /* InterfaceDeclaration */: + case 303 /* JSDocCallbackTag */: + case 310 /* JSDocTypedefTag */: + case 268 /* JsxAttribute */: + case 245 /* ModuleDeclaration */: + case 248 /* NamespaceExportDeclaration */: + case 252 /* NamespaceImport */: + case 152 /* Parameter */: + case 277 /* ShorthandPropertyAssignment */: + case 243 /* TypeAliasDeclaration */: + case 151 /* TypeParameter */: return true; - case 275 /* PropertyAssignment */: + case 276 /* PropertyAssignment */: // In `({ x: y } = 0);`, `x` is not a write access. (Won't call this function for `y`.) return !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(decl.parent); - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: - case 157 /* Constructor */: - case 156 /* MethodDeclaration */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: + case 158 /* Constructor */: + case 157 /* MethodDeclaration */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: return !!decl.body; - case 237 /* VariableDeclaration */: - case 154 /* PropertyDeclaration */: + case 238 /* VariableDeclaration */: + case 155 /* PropertyDeclaration */: return !!decl.initializer || ts.isCatchClause(decl.parent); - case 155 /* MethodSignature */: - case 153 /* PropertySignature */: - case 310 /* JSDocPropertyTag */: - case 304 /* JSDocParameterTag */: + case 156 /* MethodSignature */: + case 154 /* PropertySignature */: + case 311 /* JSDocPropertyTag */: + case 305 /* JSDocParameterTag */: return false; default: return ts.Debug.failBadSyntaxKind(decl); @@ -102286,10 +103256,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; switch (decl.kind) { - case 284 /* SourceFile */: + case 285 /* SourceFile */: // Don't include the source file itself. (This may not be ideal behavior, but awkward to include an entire file as a reference.) break; - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: if (sourceFilesSet.has(decl.getSourceFile().fileName)) { references.push(FindAllReferences.nodeEntry(decl.name)); } @@ -102309,7 +103279,7 @@ var ts; var node = ts.isBinaryExpression(decl) && ts.isPropertyAccessExpression(decl.left) ? decl.left.expression : ts.isExportAssignment(decl) - ? ts.Debug.assertDefined(ts.findChildOfKind(decl, 85 /* ExportKeyword */, sourceFile)) + ? ts.Debug.assertDefined(ts.findChildOfKind(decl, 86 /* ExportKeyword */, sourceFile)) : ts.getNameOfDeclaration(decl) || decl; references.push(FindAllReferences.nodeEntry(node)); } @@ -102336,7 +103306,7 @@ var ts; if (ts.isThis(node)) { return getReferencesForThisKeyword(node, sourceFiles, cancellationToken); } - if (node.kind === 98 /* SuperKeyword */) { + if (node.kind === 99 /* SuperKeyword */) { return getReferencesForSuperKeyword(node); } return undefined; @@ -102353,7 +103323,7 @@ var ts; // When renaming at an export specifier, rename the export and not the thing being exported. getReferencesAtExportSpecifier(exportSpecifier.name, symbol, exportSpecifier, state.createSearch(node, originalSymbol, /*comingFrom*/ undefined), state, /*addReferencesHere*/ true, /*alwaysGetReferences*/ true); } - else if (node && node.kind === 80 /* DefaultKeyword */) { + else if (node && node.kind === 81 /* DefaultKeyword */) { addReference(node, symbol, state); searchForImportsOfExport(node, symbol, { exportingModuleSymbol: ts.Debug.assertDefined(symbol.parent, "Expected export symbol to have a parent"), exportKind: 1 /* Default */ }, state); } @@ -102381,9 +103351,9 @@ var ts; } function getSpecialSearchKind(node) { switch (node.kind) { - case 124 /* ConstructorKeyword */: + case 125 /* ConstructorKeyword */: return 1 /* Constructor */; - case 72 /* Identifier */: + case 73 /* Identifier */: if (ts.isClassLike(node.parent)) { ts.Debug.assert(node.parent.name === node); return 2 /* Class */; @@ -102406,7 +103376,7 @@ var ts; if (symbol.flags & 33554432 /* Transient */) return undefined; // Assertions for GH#21814. We should be handling SourceFile symbols in `getReferencedSymbolsForModule` instead of getting here. - ts.Debug.fail("Unexpected symbol at " + ts.Debug.showSyntaxKind(node) + ": " + ts.Debug.showSymbol(symbol)); + ts.Debug.fail("Unexpected symbol at " + ts.Debug.formatSyntaxKind(node.kind) + ": " + ts.Debug.formatSymbol(symbol)); } return ts.isTypeLiteralNode(decl.parent) && ts.isUnionTypeNode(decl.parent.parent) ? checker.getPropertyOfType(checker.getTypeFromTypeNode(decl.parent.parent), symbol.name) @@ -102511,8 +103481,8 @@ var ts; var sourceId = ts.getNodeId(sourceFile); var seenSymbols = this.sourceFileToSeenSymbols[sourceId] || (this.sourceFileToSeenSymbols[sourceId] = ts.createMap()); var anyNewSymbols = false; - for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) { - var sym = symbols_2[_i]; + for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) { + var sym = symbols_3[_i]; anyNewSymbols = ts.addToSeen(seenSymbols, ts.getSymbolId(sym)) || anyNewSymbols; } return anyNewSymbols; @@ -102619,7 +103589,7 @@ var ts; // If this is the symbol of a named function expression or named class expression, // then named references are limited to its own scope. var declarations = symbol.declarations, flags = symbol.flags, parent = symbol.parent, valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === 196 /* FunctionExpression */ || valueDeclaration.kind === 209 /* ClassExpression */)) { + if (valueDeclaration && (valueDeclaration.kind === 197 /* FunctionExpression */ || valueDeclaration.kind === 210 /* ClassExpression */)) { return valueDeclaration; } if (!declarations) { @@ -102629,7 +103599,7 @@ var ts; if (flags & (4 /* Property */ | 8192 /* Method */)) { var privateDeclaration = ts.find(declarations, function (d) { return ts.hasModifier(d, 8 /* Private */); }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 240 /* ClassDeclaration */); + return ts.getAncestor(privateDeclaration, 241 /* ClassDeclaration */); } // Else this is a public property and could be accessed from anywhere. return undefined; @@ -102658,7 +103628,7 @@ var ts; // Different declarations have different containers, bail out return undefined; } - if (!container || container.kind === 284 /* SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { + if (!container || container.kind === 285 /* SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { // This is a global variable and not an external module, any declaration defined // within this scope is visible outside the file return undefined; @@ -102745,8 +103715,8 @@ var ts; // We found a match. Make sure it's not part of a larger word (i.e. the char // before and after it have to be a non-identifier char). var endPosition = position + symbolNameLength; - if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 7 /* Latest */)) && - (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 7 /* Latest */))) { + if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 8 /* Latest */)) && + (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 8 /* Latest */))) { // Found a real match. Keep searching. positions.push(position); } @@ -102766,7 +103736,7 @@ var ts; function isValidReferencePosition(node, searchSymbolName) { // Compare the length so we filter out strict superstrings of the symbol we are looking for switch (node.kind) { - case 72 /* Identifier */: + case 73 /* Identifier */: return node.text.length === searchSymbolName.length; case 10 /* StringLiteral */: { var str = node; @@ -102775,7 +103745,7 @@ var ts; } case 8 /* NumericLiteral */: return ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && node.text.length === searchSymbolName.length; - case 80 /* DefaultKeyword */: + case 81 /* DefaultKeyword */: return "default".length === searchSymbolName.length; default: return false; @@ -102839,7 +103809,7 @@ var ts; return; } if (ts.isExportSpecifier(parent)) { - ts.Debug.assert(referenceLocation.kind === 72 /* Identifier */); + ts.Debug.assert(referenceLocation.kind === 73 /* Identifier */); getReferencesAtExportSpecifier(referenceLocation, referenceSymbol, parent, search, state, addReferencesHere); return; } @@ -102895,8 +103865,8 @@ var ts; } // For `export { foo as bar }`, rename `foo`, but not `bar`. if (!isForRenameWithPrefixAndSuffixText(state.options) || alwaysGetReferences) { - var isDefaultExport = referenceLocation.originalKeywordKind === 80 /* DefaultKeyword */ - || exportSpecifier.name.originalKeywordKind === 80 /* DefaultKeyword */; + var isDefaultExport = referenceLocation.originalKeywordKind === 81 /* DefaultKeyword */ + || exportSpecifier.name.originalKeywordKind === 81 /* DefaultKeyword */; var exportKind = isDefaultExport ? 1 /* Default */ : 0 /* Named */; var exportSymbol = ts.Debug.assertDefined(exportSpecifier.symbol); var exportInfo = ts.Debug.assertDefined(FindAllReferences.getExportInfo(exportSymbol, exportKind, state.checker)); @@ -102975,7 +103945,7 @@ var ts; } var pusher = function () { return state.referenceAdder(search.symbol); }; if (ts.isClassLike(referenceLocation.parent)) { - ts.Debug.assert(referenceLocation.kind === 80 /* DefaultKeyword */ || referenceLocation.parent.name === referenceLocation); + ts.Debug.assert(referenceLocation.kind === 81 /* DefaultKeyword */ || referenceLocation.parent.name === referenceLocation); // This is the class declaration containing the constructor. findOwnConstructorReferences(search.symbol, sourceFile, pusher()); } @@ -103002,7 +103972,7 @@ var ts; } if (member.body) { member.body.forEachChild(function cb(node) { - if (node.kind === 100 /* ThisKeyword */) { + if (node.kind === 101 /* ThisKeyword */) { addRef(node); } else if (!ts.isFunctionLike(node) && !ts.isClassLike(node)) { @@ -103021,18 +103991,18 @@ var ts; if (constructorSymbol) { for (var _i = 0, _a = constructorSymbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - var ctrKeyword = ts.findChildOfKind(decl, 124 /* ConstructorKeyword */, sourceFile); - ts.Debug.assert(decl.kind === 157 /* Constructor */ && !!ctrKeyword); + var ctrKeyword = ts.findChildOfKind(decl, 125 /* ConstructorKeyword */, sourceFile); + ts.Debug.assert(decl.kind === 158 /* Constructor */ && !!ctrKeyword); addNode(ctrKeyword); } } if (classSymbol.exports) { classSymbol.exports.forEach(function (member) { var decl = member.valueDeclaration; - if (decl && decl.kind === 156 /* MethodDeclaration */) { + if (decl && decl.kind === 157 /* MethodDeclaration */) { var body = decl.body; if (body) { - forEachDescendantOfKind(body, 100 /* ThisKeyword */, function (thisKeyword) { + forEachDescendantOfKind(body, 101 /* ThisKeyword */, function (thisKeyword) { if (ts.isNewExpressionTarget(thisKeyword)) { addNode(thisKeyword); } @@ -103053,10 +104023,10 @@ var ts; } for (var _i = 0, _a = constructor.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - ts.Debug.assert(decl.kind === 157 /* Constructor */); + ts.Debug.assert(decl.kind === 158 /* Constructor */); var body = decl.body; if (body) { - forEachDescendantOfKind(body, 98 /* SuperKeyword */, function (node) { + forEachDescendantOfKind(body, 99 /* SuperKeyword */, function (node) { if (ts.isCallExpressionTarget(node)) { addNode(node); } @@ -103080,10 +104050,10 @@ var ts; addReference(refNode); return; } - if (refNode.kind !== 72 /* Identifier */) { + if (refNode.kind !== 73 /* Identifier */) { return; } - if (refNode.parent.kind === 276 /* ShorthandPropertyAssignment */) { + if (refNode.parent.kind === 277 /* ShorthandPropertyAssignment */) { // Go ahead and dereference the shorthand assignment by going to its definition getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference); } @@ -103103,7 +104073,7 @@ var ts; } else if (ts.isFunctionLike(typeHavingNode) && typeHavingNode.body) { var body = typeHavingNode.body; - if (body.kind === 218 /* Block */) { + if (body.kind === 219 /* Block */) { ts.forEachReturnStatement(body, function (returnStatement) { if (returnStatement.expression) addIfImplementation(returnStatement.expression); @@ -103131,13 +104101,13 @@ var ts; */ function isImplementationExpression(node) { switch (node.kind) { - case 195 /* ParenthesizedExpression */: + case 196 /* ParenthesizedExpression */: return isImplementationExpression(node.expression); - case 197 /* ArrowFunction */: - case 196 /* FunctionExpression */: - case 188 /* ObjectLiteralExpression */: - case 209 /* ClassExpression */: - case 187 /* ArrayLiteralExpression */: + case 198 /* ArrowFunction */: + case 197 /* FunctionExpression */: + case 189 /* ObjectLiteralExpression */: + case 210 /* ClassExpression */: + case 188 /* ArrayLiteralExpression */: return true; default: return false; @@ -103190,13 +104160,13 @@ var ts; // Whether 'super' occurs in a static context within a class. var staticFlag = 32 /* Static */; switch (searchSpaceNode.kind) { - case 154 /* PropertyDeclaration */: - case 153 /* PropertySignature */: - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: - case 157 /* Constructor */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 155 /* PropertyDeclaration */: + case 154 /* PropertySignature */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: + case 158 /* Constructor */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: staticFlag &= ts.getModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; @@ -103205,7 +104175,7 @@ var ts; } var sourceFile = searchSpaceNode.getSourceFile(); var references = ts.mapDefined(getPossibleSymbolReferenceNodes(sourceFile, "super", searchSpaceNode), function (node) { - if (node.kind !== 98 /* SuperKeyword */) { + if (node.kind !== 99 /* SuperKeyword */) { return; } var container = ts.getSuperContainer(node, /*stopOnFunctions*/ false); @@ -103217,41 +104187,41 @@ var ts; return [{ definition: { type: 0 /* Symbol */, symbol: searchSpaceNode.symbol }, references: references }]; } function isParameterName(node) { - return node.kind === 72 /* Identifier */ && node.parent.kind === 151 /* Parameter */ && node.parent.name === node; + return node.kind === 73 /* Identifier */ && node.parent.kind === 152 /* Parameter */ && node.parent.name === node; } function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles, cancellationToken) { var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); // Whether 'this' occurs in a static context within a class. var staticFlag = 32 /* Static */; switch (searchSpaceNode.kind) { - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode)) { break; } // falls through - case 154 /* PropertyDeclaration */: - case 153 /* PropertySignature */: - case 157 /* Constructor */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 155 /* PropertyDeclaration */: + case 154 /* PropertySignature */: + case 158 /* Constructor */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: staticFlag &= ts.getModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 284 /* SourceFile */: + case 285 /* SourceFile */: if (ts.isExternalModule(searchSpaceNode) || isParameterName(thisOrSuperKeyword)) { return undefined; } // falls through - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: break; // Computed properties in classes are not handled here because references to this are illegal, // so there is no point finding references to them. default: return undefined; } - var references = ts.flatMap(searchSpaceNode.kind === 284 /* SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], function (sourceFile) { + var references = ts.flatMap(searchSpaceNode.kind === 285 /* SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], function (sourceFile) { cancellationToken.throwIfCancellationRequested(); return getPossibleSymbolReferenceNodes(sourceFile, "this", ts.isSourceFile(searchSpaceNode) ? sourceFile : searchSpaceNode).filter(function (node) { if (!ts.isThis(node)) { @@ -103259,19 +104229,19 @@ var ts; } var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); switch (searchSpaceNode.kind) { - case 196 /* FunctionExpression */: - case 239 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: + case 240 /* FunctionDeclaration */: return searchSpaceNode.symbol === container.symbol; - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: return ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol; - case 209 /* ClassExpression */: - case 240 /* ClassDeclaration */: + case 210 /* ClassExpression */: + case 241 /* ClassDeclaration */: // Make sure the container belongs to the same class // and has the appropriate static modifier from the original container. return container.parent && searchSpaceNode.symbol === container.parent.symbol && (ts.getModifierFlags(container) & 32 /* Static */) === staticFlag; - case 284 /* SourceFile */: - return container.kind === 284 /* SourceFile */ && !ts.isExternalModule(container) && !isParameterName(node); + case 285 /* SourceFile */: + return container.kind === 285 /* SourceFile */ && !ts.isExternalModule(container) && !isParameterName(node); } }); }).map(function (n) { return FindAllReferences.nodeEntry(n); }); @@ -103390,7 +104360,7 @@ var ts; }); } function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, checker) { - var bindingElement = ts.getDeclarationOfKind(symbol, 186 /* BindingElement */); + var bindingElement = ts.getDeclarationOfKind(symbol, 187 /* BindingElement */); if (bindingElement && ts.isObjectBindingElementWithoutPropertyName(bindingElement)) { return ts.getPropertySymbolFromBindingElement(checker, bindingElement); } @@ -103749,7 +104719,7 @@ var ts; else { var defs = getDefinitionFromSymbol(typeChecker, symbol, node) || ts.emptyArray; // For a 'super()' call, put the signature first, else put the variable first. - return node.kind === 98 /* SuperKeyword */ ? [sigInfo].concat(defs) : defs.concat([sigInfo]); + return node.kind === 99 /* SuperKeyword */ ? [sigInfo].concat(defs) : defs.concat([sigInfo]); } } // Because name in short-hand property assignment has two different meanings: property name and property value, @@ -103757,7 +104727,7 @@ var ts; // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition // is performed at the location of property access, we would like to go to definition of the property in the short-hand // assignment. This case and others are handled by the following code. - if (node.parent.kind === 276 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 277 /* ShorthandPropertyAssignment */) { var shorthandSymbol_1 = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); return shorthandSymbol_1 ? shorthandSymbol_1.declarations.map(function (decl) { return createDefinitionInfo(decl, typeChecker, shorthandSymbol_1, node); }) : []; } @@ -103910,18 +104880,18 @@ var ts; // (2) when the aliased symbol is originating from an import. // function shouldSkipAlias(node, declaration) { - if (node.kind !== 72 /* Identifier */) { + if (node.kind !== 73 /* Identifier */) { return false; } if (node.parent === declaration) { return true; } switch (declaration.kind) { - case 250 /* ImportClause */: - case 248 /* ImportEqualsDeclaration */: + case 251 /* ImportClause */: + case 249 /* ImportEqualsDeclaration */: return true; - case 253 /* ImportSpecifier */: - return declaration.parent.kind === 252 /* NamedImports */; + case 254 /* ImportSpecifier */: + return declaration.parent.kind === 253 /* NamedImports */; default: return false; } @@ -103931,7 +104901,7 @@ var ts; function getConstructSignatureDefinition() { // Applicable only if we are in a new expression, or we are on a constructor declaration // and in either case the symbol has a construct signature definition, i.e. class - if (symbol.flags & 32 /* Class */ && (ts.isNewExpressionTarget(node) || node.kind === 124 /* ConstructorKeyword */)) { + if (symbol.flags & 32 /* Class */ && (ts.isNewExpressionTarget(node) || node.kind === 125 /* ConstructorKeyword */)) { var cls = ts.find(symbol.declarations, ts.isClassLike) || ts.Debug.fail("Expected declaration to have at least one class-like declaration"); return getSignatureDefinition(cls.members, /*selectConstructors*/ true); } @@ -104005,9 +104975,9 @@ var ts; } function isConstructorLike(node) { switch (node.kind) { - case 157 /* Constructor */: - case 166 /* ConstructorType */: - case 161 /* ConstructSignature */: + case 158 /* Constructor */: + case 167 /* ConstructorType */: + case 162 /* ConstructSignature */: return true; default: return false; @@ -104125,11 +105095,11 @@ var ts; JsDoc.getJsDocCommentsFromDeclarations = getJsDocCommentsFromDeclarations; function getCommentHavingNodes(declaration) { switch (declaration.kind) { - case 304 /* JSDocParameterTag */: - case 310 /* JSDocPropertyTag */: + case 305 /* JSDocParameterTag */: + case 311 /* JSDocPropertyTag */: return [declaration]; - case 302 /* JSDocCallbackTag */: - case 309 /* JSDocTypedefTag */: + case 303 /* JSDocCallbackTag */: + case 310 /* JSDocTypedefTag */: return [declaration, declaration.parent]; default: return ts.getJSDocCommentsAndTags(declaration); @@ -104150,16 +105120,16 @@ var ts; function getCommentText(tag) { var comment = tag.comment; switch (tag.kind) { - case 300 /* JSDocAugmentsTag */: + case 301 /* JSDocAugmentsTag */: return withNode(tag.class); - case 308 /* JSDocTemplateTag */: + case 309 /* JSDocTemplateTag */: return withList(tag.typeParameters); - case 307 /* JSDocTypeTag */: + case 308 /* JSDocTypeTag */: return withNode(tag.typeExpression); - case 309 /* JSDocTypedefTag */: - case 302 /* JSDocCallbackTag */: - case 310 /* JSDocPropertyTag */: - case 304 /* JSDocParameterTag */: + case 310 /* JSDocTypedefTag */: + case 303 /* JSDocCallbackTag */: + case 311 /* JSDocPropertyTag */: + case 305 /* JSDocParameterTag */: var name = tag.name; return name ? withNode(name) : comment; default: @@ -104336,7 +105306,7 @@ var ts; function parameterDocComments(parameters, isJavaScriptFile, indentationStr, newLine) { return parameters.map(function (_a, i) { var name = _a.name, dotDotDotToken = _a.dotDotDotToken; - var paramName = name.kind === 72 /* Identifier */ ? name.text : "param" + i; + var paramName = name.kind === 73 /* Identifier */ ? name.text : "param" + i; var type = isJavaScriptFile ? (dotDotDotToken ? "{...any} " : "{any} ") : ""; return indentationStr + " * @param " + type + paramName + newLine; }).join(""); @@ -104346,23 +105316,23 @@ var ts; } function getCommentOwnerInfoWorker(commentOwner) { switch (commentOwner.kind) { - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: - case 156 /* MethodDeclaration */: - case 157 /* Constructor */: - case 155 /* MethodSignature */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: + case 157 /* MethodDeclaration */: + case 158 /* Constructor */: + case 156 /* MethodSignature */: var parameters = commentOwner.parameters; return { commentOwner: commentOwner, parameters: parameters }; - case 275 /* PropertyAssignment */: + case 276 /* PropertyAssignment */: return getCommentOwnerInfoWorker(commentOwner.initializer); - case 240 /* ClassDeclaration */: - case 241 /* InterfaceDeclaration */: - case 153 /* PropertySignature */: - case 243 /* EnumDeclaration */: - case 278 /* EnumMember */: - case 242 /* TypeAliasDeclaration */: + case 241 /* ClassDeclaration */: + case 242 /* InterfaceDeclaration */: + case 154 /* PropertySignature */: + case 244 /* EnumDeclaration */: + case 279 /* EnumMember */: + case 243 /* TypeAliasDeclaration */: return { commentOwner: commentOwner }; - case 219 /* VariableStatement */: { + case 220 /* VariableStatement */: { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; var parameters_1 = varDeclarations.length === 1 && varDeclarations[0].initializer @@ -104370,14 +105340,14 @@ var ts; : undefined; return { commentOwner: commentOwner, parameters: parameters_1 }; } - case 284 /* SourceFile */: + case 285 /* SourceFile */: return "quit"; - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: // If in walking up the tree, we hit a a nested namespace declaration, // then we must be somewhere within a dotted namespace name; however we don't // want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'. - return commentOwner.parent.kind === 244 /* ModuleDeclaration */ ? undefined : { commentOwner: commentOwner }; - case 204 /* BinaryExpression */: { + return commentOwner.parent.kind === 245 /* ModuleDeclaration */ ? undefined : { commentOwner: commentOwner }; + case 205 /* BinaryExpression */: { var be = commentOwner; if (ts.getAssignmentDeclarationKind(be) === 0 /* None */) { return "quit"; @@ -104396,14 +105366,14 @@ var ts; * @returns the parameters of a signature found on the RHS if one exists; otherwise 'emptyArray'. */ function getParametersFromRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 195 /* ParenthesizedExpression */) { + while (rightHandSide.kind === 196 /* ParenthesizedExpression */) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: return rightHandSide.parameters; - case 209 /* ClassExpression */: { + case 210 /* ClassExpression */: { var ctr = ts.find(rightHandSide.members, ts.isConstructorDeclaration); return ctr ? ctr.parameters : ts.emptyArray; } @@ -104465,9 +105435,9 @@ var ts; } function shouldKeepItem(declaration, checker) { switch (declaration.kind) { - case 250 /* ImportClause */: - case 253 /* ImportSpecifier */: - case 248 /* ImportEqualsDeclaration */: + case 251 /* ImportClause */: + case 254 /* ImportSpecifier */: + case 249 /* ImportEqualsDeclaration */: var importer = checker.getSymbolAtLocation(declaration.name); // TODO: GH#18217 var imported = checker.getAliasedSymbol(importer); return importer.escapedName !== imported.escapedName; @@ -104477,7 +105447,7 @@ var ts; } function tryAddSingleDeclarationName(declaration, containers) { var name = ts.getNameOfDeclaration(declaration); - return !!name && (pushLiteral(name, containers) || name.kind === 149 /* ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers)); + return !!name && (pushLiteral(name, containers) || name.kind === 150 /* ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers)); } // Only added the names of computed properties if they're simple dotted expressions, like: // @@ -104494,7 +105464,7 @@ var ts; // First, if we started with a computed property name, then add all but the last // portion into the container array. var name = ts.getNameOfDeclaration(declaration); - if (name && name.kind === 149 /* ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) { + if (name && name.kind === 150 /* ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) { return ts.emptyArray; } // Don't include the last portion. @@ -104663,7 +105633,7 @@ var ts; return; } switch (node.kind) { - case 157 /* Constructor */: + case 158 /* Constructor */: // Get parameter properties, and treat them as being on the *same* level as the constructor, not under it. var ctr = node; addNodeWithRecursiveChild(ctr, ctr.body); @@ -104675,21 +105645,21 @@ var ts; } } break; - case 156 /* MethodDeclaration */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 155 /* MethodSignature */: + case 157 /* MethodDeclaration */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 156 /* MethodSignature */: if (!ts.hasDynamicName(node)) { addNodeWithRecursiveChild(node, node.body); } break; - case 154 /* PropertyDeclaration */: - case 153 /* PropertySignature */: + case 155 /* PropertyDeclaration */: + case 154 /* PropertySignature */: if (!ts.hasDynamicName(node)) { addLeafNode(node); } break; - case 250 /* ImportClause */: + case 251 /* ImportClause */: var importClause = node; // Handle default import case e.g.: // import d from "mod"; @@ -104701,7 +105671,7 @@ var ts; // import {a, b as B} from "mod"; var namedBindings = importClause.namedBindings; if (namedBindings) { - if (namedBindings.kind === 251 /* NamespaceImport */) { + if (namedBindings.kind === 252 /* NamespaceImport */) { addLeafNode(namedBindings); } else { @@ -104712,8 +105682,8 @@ var ts; } } break; - case 186 /* BindingElement */: - case 237 /* VariableDeclaration */: + case 187 /* BindingElement */: + case 238 /* VariableDeclaration */: var _d = node, name = _d.name, initializer = _d.initializer; if (ts.isBindingPattern(name)) { addChildrenRecursively(name); @@ -104734,12 +105704,12 @@ var ts; addNodeWithRecursiveChild(node, initializer); } break; - case 197 /* ArrowFunction */: - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: + case 198 /* ArrowFunction */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: addNodeWithRecursiveChild(node, node.body); break; - case 243 /* EnumDeclaration */: + case 244 /* EnumDeclaration */: startNode(node); for (var _e = 0, _f = node.members; _e < _f.length; _e++) { var member = _f[_e]; @@ -104749,9 +105719,9 @@ var ts; } endNode(); break; - case 240 /* ClassDeclaration */: - case 209 /* ClassExpression */: - case 241 /* InterfaceDeclaration */: + case 241 /* ClassDeclaration */: + case 210 /* ClassExpression */: + case 242 /* InterfaceDeclaration */: startNode(node); for (var _g = 0, _h = node.members; _g < _h.length; _g++) { var member = _h[_g]; @@ -104759,18 +105729,18 @@ var ts; } endNode(); break; - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case 257 /* ExportSpecifier */: - case 248 /* ImportEqualsDeclaration */: - case 162 /* IndexSignature */: - case 160 /* CallSignature */: - case 161 /* ConstructSignature */: - case 242 /* TypeAliasDeclaration */: + case 258 /* ExportSpecifier */: + case 249 /* ImportEqualsDeclaration */: + case 163 /* IndexSignature */: + case 161 /* CallSignature */: + case 162 /* ConstructSignature */: + case 243 /* TypeAliasDeclaration */: addLeafNode(node); break; - case 204 /* BinaryExpression */: { + case 205 /* BinaryExpression */: { var special = ts.getAssignmentDeclarationKind(node); switch (special) { case 1 /* ExportsProperty */: @@ -104852,12 +105822,12 @@ var ts; return false; } switch (a.kind) { - case 154 /* PropertyDeclaration */: - case 156 /* MethodDeclaration */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 155 /* PropertyDeclaration */: + case 157 /* MethodDeclaration */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: return ts.hasModifier(a, 32 /* Static */) === ts.hasModifier(b, 32 /* Static */); - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: return areSameModule(a, b); default: return true; @@ -104873,7 +105843,7 @@ var ts; // Only merge module nodes that have the same chain. Don't merge 'A.B.C' with 'A'! function areSameModule(a, b) { // TODO: GH#18217 - return a.body.kind === b.body.kind && (a.body.kind !== 244 /* ModuleDeclaration */ || areSameModule(a.body, b.body)); + return a.body.kind === b.body.kind && (a.body.kind !== 245 /* ModuleDeclaration */ || areSameModule(a.body, b.body)); } /** Merge source into target. Source should be thrown away after this is called. */ function merge(target, source) { @@ -104903,7 +105873,7 @@ var ts; * So `new()` can still come before an `aardvark` method. */ function tryGetName(node) { - if (node.kind === 244 /* ModuleDeclaration */) { + if (node.kind === 245 /* ModuleDeclaration */) { return getModuleName(node); } var declName = ts.getNameOfDeclaration(node); @@ -104911,16 +105881,16 @@ var ts; return ts.unescapeLeadingUnderscores(ts.getPropertyNameForPropertyNameNode(declName)); // TODO: GH#18217 } switch (node.kind) { - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: - case 209 /* ClassExpression */: + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: + case 210 /* ClassExpression */: return getFunctionOrClassName(node); default: return undefined; } } function getItemName(node, name) { - if (node.kind === 244 /* ModuleDeclaration */) { + if (node.kind === 245 /* ModuleDeclaration */) { return getModuleName(node); } if (name) { @@ -104930,16 +105900,16 @@ var ts; } } switch (node.kind) { - case 284 /* SourceFile */: + case 285 /* SourceFile */: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\"" : ""; - case 197 /* ArrowFunction */: - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: - case 240 /* ClassDeclaration */: - case 209 /* ClassExpression */: + case 198 /* ArrowFunction */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: + case 241 /* ClassDeclaration */: + case 210 /* ClassExpression */: if (ts.getModifierFlags(node) & 512 /* Default */) { return "default"; } @@ -104947,13 +105917,13 @@ var ts; // (eg: "app\n.onactivated"), so we should remove the whitespace for readabiltiy in the // navigation bar. return getFunctionOrClassName(node); - case 157 /* Constructor */: + case 158 /* Constructor */: return "constructor"; - case 161 /* ConstructSignature */: + case 162 /* ConstructSignature */: return "new()"; - case 160 /* CallSignature */: + case 161 /* CallSignature */: return "()"; - case 162 /* IndexSignature */: + case 163 /* IndexSignature */: return "[]"; default: return ""; @@ -104977,25 +105947,25 @@ var ts; return topLevel; function isTopLevel(item) { switch (navigationBarNodeKind(item)) { - case 240 /* ClassDeclaration */: - case 209 /* ClassExpression */: - case 243 /* EnumDeclaration */: - case 241 /* InterfaceDeclaration */: - case 244 /* ModuleDeclaration */: - case 284 /* SourceFile */: - case 242 /* TypeAliasDeclaration */: - case 309 /* JSDocTypedefTag */: - case 302 /* JSDocCallbackTag */: + case 241 /* ClassDeclaration */: + case 210 /* ClassExpression */: + case 244 /* EnumDeclaration */: + case 242 /* InterfaceDeclaration */: + case 245 /* ModuleDeclaration */: + case 285 /* SourceFile */: + case 243 /* TypeAliasDeclaration */: + case 310 /* JSDocTypedefTag */: + case 303 /* JSDocCallbackTag */: return true; - case 157 /* Constructor */: - case 156 /* MethodDeclaration */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 237 /* VariableDeclaration */: + case 158 /* Constructor */: + case 157 /* MethodDeclaration */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 238 /* VariableDeclaration */: return hasSomeImportantChild(item); - case 197 /* ArrowFunction */: - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: + case 198 /* ArrowFunction */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: return isTopLevelFunctionDeclaration(item); default: return false; @@ -105005,10 +105975,10 @@ var ts; return false; } switch (navigationBarNodeKind(item.parent)) { - case 245 /* ModuleBlock */: - case 284 /* SourceFile */: - case 156 /* MethodDeclaration */: - case 157 /* Constructor */: + case 246 /* ModuleBlock */: + case 285 /* SourceFile */: + case 157 /* MethodDeclaration */: + case 158 /* Constructor */: return true; default: return hasSomeImportantChild(item); @@ -105017,7 +105987,7 @@ var ts; function hasSomeImportantChild(item) { return ts.some(item.children, function (child) { var childKind = navigationBarNodeKind(child); - return childKind !== 237 /* VariableDeclaration */ && childKind !== 186 /* BindingElement */; + return childKind !== 238 /* VariableDeclaration */ && childKind !== 187 /* BindingElement */; }); } } @@ -105074,7 +106044,7 @@ var ts; // Otherwise, we need to aggregate each identifier to build up the qualified name. var result = []; result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 244 /* ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 245 /* ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)); } @@ -105088,13 +106058,13 @@ var ts; return decl.body && ts.isModuleDeclaration(decl.body) ? getInteriorModule(decl.body) : decl; } function isComputedProperty(member) { - return !member.name || member.name.kind === 149 /* ComputedPropertyName */; + return !member.name || member.name.kind === 150 /* ComputedPropertyName */; } function getNodeSpan(node) { - return node.kind === 284 /* SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile); + return node.kind === 285 /* SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile); } function getModifiers(node) { - if (node.parent && node.parent.kind === 237 /* VariableDeclaration */) { + if (node.parent && node.parent.kind === 238 /* VariableDeclaration */) { node = node.parent; } return ts.getNodeModifiers(node); @@ -105109,7 +106079,7 @@ var ts; return ts.declarationNameToString(parent.name); } // See if it is of the form " = function(){...}". If so, use the text from the left-hand side. - else if (ts.isBinaryExpression(parent) && parent.operatorToken.kind === 59 /* EqualsToken */) { + else if (ts.isBinaryExpression(parent) && parent.operatorToken.kind === 60 /* EqualsToken */) { return nodeText(parent.left).replace(whiteSpaceRegex, ""); } // See if it is a property assignment, and if so use the property name @@ -105147,9 +106117,9 @@ var ts; } function isFunctionOrClassExpression(node) { switch (node.kind) { - case 197 /* ArrowFunction */: - case 196 /* FunctionExpression */: - case 209 /* ClassExpression */: + case 198 /* ArrowFunction */: + case 197 /* FunctionExpression */: + case 210 /* ClassExpression */: return true; default: return false; @@ -105476,7 +106446,7 @@ var ts; } var lastImport = current - 1; if (lastImport !== firstImport) { - out.push(createOutliningSpanFromBounds(ts.findChildOfKind(statements[firstImport], 92 /* ImportKeyword */, sourceFile).getStart(sourceFile), statements[lastImport].getEnd(), "imports" /* Imports */)); + out.push(createOutliningSpanFromBounds(ts.findChildOfKind(statements[firstImport], 93 /* ImportKeyword */, sourceFile).getStart(sourceFile), statements[lastImport].getEnd(), "imports" /* Imports */)); } } function visitNonImportNode(n) { @@ -105593,31 +106563,31 @@ var ts; } function getOutliningSpanForNode(n, sourceFile) { switch (n.kind) { - case 218 /* Block */: - if (ts.isFunctionBlock(n)) { - return spanForNode(n.parent, /*autoCollapse*/ n.parent.kind !== 197 /* ArrowFunction */); + case 219 /* Block */: + if (ts.isFunctionLike(n.parent)) { + return functionSpan(n.parent, n, sourceFile); } // Check if the block is standalone, or 'attached' to some parent statement. // If the latter, we want to collapse the block, but consider its hint span // to be the entire span of the parent. switch (n.parent.kind) { - case 223 /* DoStatement */: - case 226 /* ForInStatement */: - case 227 /* ForOfStatement */: - case 225 /* ForStatement */: - case 222 /* IfStatement */: - case 224 /* WhileStatement */: - case 231 /* WithStatement */: - case 274 /* CatchClause */: + case 224 /* DoStatement */: + case 227 /* ForInStatement */: + case 228 /* ForOfStatement */: + case 226 /* ForStatement */: + case 223 /* IfStatement */: + case 225 /* WhileStatement */: + case 232 /* WithStatement */: + case 275 /* CatchClause */: return spanForNode(n.parent); - case 235 /* TryStatement */: + case 236 /* TryStatement */: // Could be the try-block, or the finally-block. var tryStatement = n.parent; if (tryStatement.tryBlock === n) { return spanForNode(n.parent); } else if (tryStatement.finallyBlock === n) { - return spanForNode(ts.findChildOfKind(tryStatement, 88 /* FinallyKeyword */, sourceFile)); + return spanForNode(ts.findChildOfKind(tryStatement, 89 /* FinallyKeyword */, sourceFile)); } // falls through default: @@ -105625,22 +106595,22 @@ var ts; // the span of the block, independent of any parent span. return createOutliningSpan(ts.createTextSpanFromNode(n, sourceFile), "code" /* Code */); } - case 245 /* ModuleBlock */: + case 246 /* ModuleBlock */: return spanForNode(n.parent); - case 240 /* ClassDeclaration */: - case 209 /* ClassExpression */: - case 241 /* InterfaceDeclaration */: - case 243 /* EnumDeclaration */: - case 246 /* CaseBlock */: + case 241 /* ClassDeclaration */: + case 210 /* ClassExpression */: + case 242 /* InterfaceDeclaration */: + case 244 /* EnumDeclaration */: + case 247 /* CaseBlock */: return spanForNode(n); - case 188 /* ObjectLiteralExpression */: + case 189 /* ObjectLiteralExpression */: return spanForObjectOrArrayLiteral(n); - case 187 /* ArrayLiteralExpression */: + case 188 /* ArrayLiteralExpression */: return spanForObjectOrArrayLiteral(n, 22 /* OpenBracketToken */); - case 260 /* JsxElement */: + case 261 /* JsxElement */: return spanForJSXElement(n); - case 261 /* JsxSelfClosingElement */: - case 262 /* JsxOpeningElement */: + case 262 /* JsxSelfClosingElement */: + case 263 /* JsxOpeningElement */: return spanForJSXAttributes(n.attributes); } function spanForJSXElement(node) { @@ -105662,20 +106632,29 @@ var ts; // Otherwise, the collapsed section will include the end of the previous line. return spanForNode(node, /*autoCollapse*/ false, /*useFullStart*/ !ts.isArrayLiteralExpression(node.parent) && !ts.isCallExpression(node.parent), open); } - function spanForNode(hintSpanNode, autoCollapse, useFullStart, open) { + function spanForNode(hintSpanNode, autoCollapse, useFullStart, open, close) { if (autoCollapse === void 0) { autoCollapse = false; } if (useFullStart === void 0) { useFullStart = true; } if (open === void 0) { open = 18 /* OpenBraceToken */; } + if (close === void 0) { close = open === 18 /* OpenBraceToken */ ? 19 /* CloseBraceToken */ : 23 /* CloseBracketToken */; } var openToken = ts.findChildOfKind(n, open, sourceFile); - var close = open === 18 /* OpenBraceToken */ ? 19 /* CloseBraceToken */ : 23 /* CloseBracketToken */; var closeToken = ts.findChildOfKind(n, close, sourceFile); - if (!openToken || !closeToken) { - return undefined; - } - var textSpan = ts.createTextSpanFromBounds(useFullStart ? openToken.getFullStart() : openToken.getStart(sourceFile), closeToken.getEnd()); - return createOutliningSpan(textSpan, "code" /* Code */, ts.createTextSpanFromNode(hintSpanNode, sourceFile), autoCollapse); + return openToken && closeToken && spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse, useFullStart); } } + function functionSpan(node, body, sourceFile) { + var openToken = ts.isNodeArrayMultiLine(node.parameters, sourceFile) + ? ts.findChildOfKind(node, 20 /* OpenParenToken */, sourceFile) + : ts.findChildOfKind(body, 18 /* OpenBraceToken */, sourceFile); + var closeToken = ts.findChildOfKind(body, 19 /* CloseBraceToken */, sourceFile); + return openToken && closeToken && spanBetweenTokens(openToken, closeToken, node, sourceFile, /*autoCollapse*/ node.kind !== 198 /* ArrowFunction */); + } + function spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse, useFullStart) { + if (autoCollapse === void 0) { autoCollapse = false; } + if (useFullStart === void 0) { useFullStart = true; } + var textSpan = ts.createTextSpanFromBounds(useFullStart ? openToken.getFullStart() : openToken.getStart(sourceFile), closeToken.getEnd()); + return createOutliningSpan(textSpan, "code" /* Code */, ts.createTextSpanFromNode(hintSpanNode, sourceFile), autoCollapse); + } function createOutliningSpan(textSpan, kind, hintSpan, autoCollapse, bannerText) { if (hintSpan === void 0) { hintSpan = textSpan; } if (autoCollapse === void 0) { autoCollapse = false; } @@ -105938,7 +106917,7 @@ var ts; if (ch >= 65 /* A */ && ch <= 90 /* Z */) { return true; } - if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 7 /* Latest */)) { + if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 8 /* Latest */)) { return false; } // TODO: find a way to determine this for any unicode characters in a @@ -105951,7 +106930,7 @@ var ts; if (ch >= 97 /* a */ && ch <= 122 /* z */) { return true; } - if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 7 /* Latest */)) { + if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 8 /* Latest */)) { return false; } // TODO: find a way to determine this for any unicode characters in a @@ -106203,10 +107182,10 @@ var ts; */ function tryConsumeDeclare() { var token = ts.scanner.getToken(); - if (token === 125 /* DeclareKeyword */) { + if (token === 126 /* DeclareKeyword */) { // declare module "mod" token = nextToken(); - if (token === 130 /* ModuleKeyword */) { + if (token === 131 /* ModuleKeyword */) { token = nextToken(); if (token === 10 /* StringLiteral */) { recordAmbientExternalModule(); @@ -106224,7 +107203,7 @@ var ts; return false; } var token = ts.scanner.getToken(); - if (token === 92 /* ImportKeyword */) { + if (token === 93 /* ImportKeyword */) { token = nextToken(); if (token === 20 /* OpenParenToken */) { token = nextToken(); @@ -106240,9 +107219,9 @@ var ts; return true; } else { - if (token === 72 /* Identifier */ || ts.isKeyword(token)) { + if (token === 73 /* Identifier */ || ts.isKeyword(token)) { token = nextToken(); - if (token === 144 /* FromKeyword */) { + if (token === 145 /* FromKeyword */) { token = nextToken(); if (token === 10 /* StringLiteral */) { // import d from "mod"; @@ -106250,7 +107229,7 @@ var ts; return true; } } - else if (token === 59 /* EqualsToken */) { + else if (token === 60 /* EqualsToken */) { if (tryConsumeRequireCall(/*skipCurrentToken*/ true)) { return true; } @@ -106273,7 +107252,7 @@ var ts; } if (token === 19 /* CloseBraceToken */) { token = nextToken(); - if (token === 144 /* FromKeyword */) { + if (token === 145 /* FromKeyword */) { token = nextToken(); if (token === 10 /* StringLiteral */) { // import {a as A} from "mod"; @@ -106285,11 +107264,11 @@ var ts; } else if (token === 40 /* AsteriskToken */) { token = nextToken(); - if (token === 119 /* AsKeyword */) { + if (token === 120 /* AsKeyword */) { token = nextToken(); - if (token === 72 /* Identifier */ || ts.isKeyword(token)) { + if (token === 73 /* Identifier */ || ts.isKeyword(token)) { token = nextToken(); - if (token === 144 /* FromKeyword */) { + if (token === 145 /* FromKeyword */) { token = nextToken(); if (token === 10 /* StringLiteral */) { // import * as NS from "mod" @@ -106307,7 +107286,7 @@ var ts; } function tryConsumeExport() { var token = ts.scanner.getToken(); - if (token === 85 /* ExportKeyword */) { + if (token === 86 /* ExportKeyword */) { markAsExternalModuleIfTopLevel(); token = nextToken(); if (token === 18 /* OpenBraceToken */) { @@ -106319,7 +107298,7 @@ var ts; } if (token === 19 /* CloseBraceToken */) { token = nextToken(); - if (token === 144 /* FromKeyword */) { + if (token === 145 /* FromKeyword */) { token = nextToken(); if (token === 10 /* StringLiteral */) { // export {a as A} from "mod"; @@ -106331,7 +107310,7 @@ var ts; } else if (token === 40 /* AsteriskToken */) { token = nextToken(); - if (token === 144 /* FromKeyword */) { + if (token === 145 /* FromKeyword */) { token = nextToken(); if (token === 10 /* StringLiteral */) { // export * from "mod" @@ -106339,11 +107318,11 @@ var ts; } } } - else if (token === 92 /* ImportKeyword */) { + else if (token === 93 /* ImportKeyword */) { token = nextToken(); - if (token === 72 /* Identifier */ || ts.isKeyword(token)) { + if (token === 73 /* Identifier */ || ts.isKeyword(token)) { token = nextToken(); - if (token === 59 /* EqualsToken */) { + if (token === 60 /* EqualsToken */) { if (tryConsumeRequireCall(/*skipCurrentToken*/ true)) { return true; } @@ -106356,7 +107335,7 @@ var ts; } function tryConsumeRequireCall(skipCurrentToken) { var token = skipCurrentToken ? nextToken() : ts.scanner.getToken(); - if (token === 134 /* RequireKeyword */) { + if (token === 135 /* RequireKeyword */) { token = nextToken(); if (token === 20 /* OpenParenToken */) { token = nextToken(); @@ -106371,7 +107350,7 @@ var ts; } function tryConsumeDefine() { var token = ts.scanner.getToken(); - if (token === 72 /* Identifier */ && ts.scanner.getTokenValue() === "define") { + if (token === 73 /* Identifier */ && ts.scanner.getTokenValue() === "define") { token = nextToken(); if (token !== 20 /* OpenParenToken */) { return true; @@ -106505,14 +107484,14 @@ var ts; return getRenameInfoError(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library); } // Cannot rename `default` as in `import { default as foo } from "./someModule"; - if (ts.isIdentifier(node) && node.originalKeywordKind === 80 /* DefaultKeyword */ && symbol.parent.flags & 1536 /* Module */) { + if (ts.isIdentifier(node) && node.originalKeywordKind === 81 /* DefaultKeyword */ && symbol.parent.flags & 1536 /* Module */) { return undefined; } if (ts.isStringLiteralLike(node) && ts.tryGetImportFromModuleSpecifier(node)) { return options && options.allowRenameOfImportPath ? getRenameInfoForModule(node, sourceFile, symbol) : undefined; } var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node); - var specifierName = (ts.isImportOrExportSpecifierName(node) || ts.isStringOrNumericLiteralLike(node) && node.parent.kind === 149 /* ComputedPropertyName */) + var specifierName = (ts.isImportOrExportSpecifierName(node) || ts.isStringOrNumericLiteralLike(node) && node.parent.kind === 150 /* ComputedPropertyName */) ? ts.stripQuotes(ts.getTextOfIdentifierOrLiteral(node)) : undefined; var displayName = specifierName || typeChecker.symbolToString(symbol); @@ -106568,9 +107547,9 @@ var ts; } function nodeIsEligibleForRename(node) { switch (node.kind) { - case 72 /* Identifier */: + case 73 /* Identifier */: case 10 /* StringLiteral */: - case 100 /* ThisKeyword */: + case 101 /* ThisKeyword */: return true; case 8 /* NumericLiteral */: return ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node); @@ -106582,6 +107561,275 @@ var ts; })(ts || (ts = {})); /* @internal */ var ts; +(function (ts) { + var SmartSelectionRange; + (function (SmartSelectionRange) { + function getSmartSelectionRange(pos, sourceFile) { + var selectionRange = { + textSpan: ts.createTextSpanFromBounds(sourceFile.getFullStart(), sourceFile.getEnd()) + }; + var parentNode = sourceFile; + outer: while (true) { + var children = getSelectionChildren(parentNode); + if (!children.length) + break; + for (var i = 0; i < children.length; i++) { + var prevNode = children[i - 1]; + var node = children[i]; + var nextNode = children[i + 1]; + if (node.getStart(sourceFile) > pos) { + break outer; + } + if (positionShouldSnapToNode(pos, node, nextNode)) { + // 1. Blocks are effectively redundant with SyntaxLists. + // 2. TemplateSpans, along with the SyntaxLists containing them, are a somewhat unintuitive grouping + // of things that should be considered independently. + // 3. A VariableStatement’s children are just a VaraiableDeclarationList and a semicolon. + // 4. A lone VariableDeclaration in a VaraibleDeclaration feels redundant with the VariableStatement. + // + // Dive in without pushing a selection range. + if (ts.isBlock(node) + || ts.isTemplateSpan(node) || ts.isTemplateHead(node) + || prevNode && ts.isTemplateHead(prevNode) + || ts.isVariableDeclarationList(node) && ts.isVariableStatement(parentNode) + || ts.isSyntaxList(node) && ts.isVariableDeclarationList(parentNode) + || ts.isVariableDeclaration(node) && ts.isSyntaxList(parentNode) && children.length === 1) { + parentNode = node; + break; + } + // Synthesize a stop for '${ ... }' since '${' and '}' actually belong to siblings. + if (ts.isTemplateSpan(parentNode) && nextNode && ts.isTemplateMiddleOrTemplateTail(nextNode)) { + var start_2 = node.getFullStart() - "${".length; + var end_2 = nextNode.getStart() + "}".length; + pushSelectionRange(start_2, end_2); + } + // Blocks with braces, brackets, parens, or JSX tags on separate lines should be + // selected from open to close, including whitespace but not including the braces/etc. themselves. + var isBetweenMultiLineBookends = ts.isSyntaxList(node) + && isListOpener(prevNode) + && isListCloser(nextNode) + && !ts.positionsAreOnSameLine(prevNode.getStart(), nextNode.getStart(), sourceFile); + var jsDocCommentStart = ts.hasJSDocNodes(node) && node.jsDoc[0].getStart(); + var start = isBetweenMultiLineBookends ? prevNode.getEnd() : node.getStart(); + var end = isBetweenMultiLineBookends ? nextNode.getStart() : node.getEnd(); + if (ts.isNumber(jsDocCommentStart)) { + pushSelectionRange(jsDocCommentStart, end); + } + pushSelectionRange(start, end); + // String literals should have a stop both inside and outside their quotes. + if (ts.isStringLiteral(node) || ts.isTemplateLiteral(node)) { + pushSelectionRange(start + 1, end - 1); + } + parentNode = node; + break; + } + } + } + return selectionRange; + function pushSelectionRange(start, end) { + // Skip empty ranges + if (start !== end) { + // Skip ranges that are identical to the parent + var textSpan = ts.createTextSpanFromBounds(start, end); + if (!selectionRange || !ts.textSpansEqual(textSpan, selectionRange.textSpan)) { + selectionRange = __assign({ textSpan: textSpan }, selectionRange && { parent: selectionRange }); + } + } + } + } + SmartSelectionRange.getSmartSelectionRange = getSmartSelectionRange; + /** + * Like `ts.positionBelongsToNode`, except positions immediately after nodes + * count too, unless that position belongs to the next node. In effect, makes + * selections able to snap to preceding tokens when the cursor is on the tail + * end of them with only whitespace ahead. + * @param pos The position to check. + * @param node The candidate node to snap to. + * @param nextNode The next sibling node in the tree. + * @param sourceFile The source file containing the nodes. + */ + function positionShouldSnapToNode(pos, node, nextNode) { + // Can’t use 'ts.positionBelongsToNode()' here because it cleverly accounts + // for missing nodes, which can’t really be considered when deciding what + // to select. + ts.Debug.assert(node.pos <= pos); + if (pos < node.end) { + return true; + } + var nodeEnd = node.getEnd(); + var nextNodeStart = nextNode && nextNode.getStart(); + if (nodeEnd === pos) { + return pos !== nextNodeStart; + } + return false; + } + var isImport = ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration); + /** + * Gets the children of a node to be considered for selection ranging, + * transforming them into an artificial tree according to their intuitive + * grouping where no grouping actually exists in the parse tree. For example, + * top-level imports are grouped into their own SyntaxList so they can be + * selected all together, even though in the AST they’re just siblings of each + * other as well as of other top-level statements and declarations. + */ + function getSelectionChildren(node) { + // Group top-level imports + if (ts.isSourceFile(node)) { + return groupChildren(node.getChildAt(0).getChildren(), isImport); + } + // Mapped types _look_ like ObjectTypes with a single member, + // but in fact don’t contain a SyntaxList or a node containing + // the “key/value” pair like ObjectTypes do, but it seems intuitive + // that the selection would snap to those points. The philosophy + // of choosing a selection range is not so much about what the + // syntax currently _is_ as what the syntax might easily become + // if the user is making a selection; e.g., we synthesize a selection + // around the “key/value” pair not because there’s a node there, but + // because it allows the mapped type to become an object type with a + // few keystrokes. + if (ts.isMappedTypeNode(node)) { + var _a = node.getChildren(), openBraceToken = _a[0], children = _a.slice(1); + var closeBraceToken = ts.Debug.assertDefined(children.pop()); + ts.Debug.assertEqual(openBraceToken.kind, 18 /* OpenBraceToken */); + ts.Debug.assertEqual(closeBraceToken.kind, 19 /* CloseBraceToken */); + // Group `-/+readonly` and `-/+?` + var groupedWithPlusMinusTokens = groupChildren(children, function (child) { + return child === node.readonlyToken || child.kind === 134 /* ReadonlyKeyword */ || + child === node.questionToken || child.kind === 56 /* QuestionToken */; + }); + // Group type parameter with surrounding brackets + var groupedWithBrackets = groupChildren(groupedWithPlusMinusTokens, function (_a) { + var kind = _a.kind; + return kind === 22 /* OpenBracketToken */ || + kind === 151 /* TypeParameter */ || + kind === 23 /* CloseBracketToken */; + }); + return [ + openBraceToken, + // Pivot on `:` + createSyntaxList(splitChildren(groupedWithBrackets, function (_a) { + var kind = _a.kind; + return kind === 57 /* ColonToken */; + })), + closeBraceToken, + ]; + } + // Group modifiers and property name, then pivot on `:`. + if (ts.isPropertySignature(node)) { + var children = groupChildren(node.getChildren(), function (child) { + return child === node.name || ts.contains(node.modifiers, child); + }); + return splitChildren(children, function (_a) { + var kind = _a.kind; + return kind === 57 /* ColonToken */; + }); + } + // Group the parameter name with its `...`, then that group with its `?`, then pivot on `=`. + if (ts.isParameter(node)) { + var groupedDotDotDotAndName_1 = groupChildren(node.getChildren(), function (child) { + return child === node.dotDotDotToken || child === node.name; + }); + var groupedWithQuestionToken = groupChildren(groupedDotDotDotAndName_1, function (child) { + return child === groupedDotDotDotAndName_1[0] || child === node.questionToken; + }); + return splitChildren(groupedWithQuestionToken, function (_a) { + var kind = _a.kind; + return kind === 60 /* EqualsToken */; + }); + } + // Pivot on '=' + if (ts.isBindingElement(node)) { + return splitChildren(node.getChildren(), function (_a) { + var kind = _a.kind; + return kind === 60 /* EqualsToken */; + }); + } + return node.getChildren(); + } + /** + * Groups sibling nodes together into their own SyntaxList if they + * a) are adjacent, AND b) match a predicate function. + */ + function groupChildren(children, groupOn) { + var result = []; + var group; + for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { + var child = children_1[_i]; + if (groupOn(child)) { + group = group || []; + group.push(child); + } + else { + if (group) { + result.push(createSyntaxList(group)); + group = undefined; + } + result.push(child); + } + } + if (group) { + result.push(createSyntaxList(group)); + } + return result; + } + /** + * Splits sibling nodes into up to four partitions: + * 1) everything left of the first node matched by `pivotOn`, + * 2) the first node matched by `pivotOn`, + * 3) everything right of the first node matched by `pivotOn`, + * 4) a trailing semicolon, if `separateTrailingSemicolon` is enabled. + * The left and right groups, if not empty, will each be grouped into their own containing SyntaxList. + * @param children The sibling nodes to split. + * @param pivotOn The predicate function to match the node to be the pivot. The first node that matches + * the predicate will be used; any others that may match will be included into the right-hand group. + * @param separateTrailingSemicolon If the last token is a semicolon, it will be returned as a separate + * child rather than be included in the right-hand group. + */ + function splitChildren(children, pivotOn, separateTrailingSemicolon) { + if (separateTrailingSemicolon === void 0) { separateTrailingSemicolon = true; } + if (children.length < 2) { + return children; + } + var splitTokenIndex = ts.findIndex(children, pivotOn); + if (splitTokenIndex === -1) { + return children; + } + var leftChildren = children.slice(0, splitTokenIndex); + var splitToken = children[splitTokenIndex]; + var lastToken = ts.last(children); + var separateLastToken = separateTrailingSemicolon && lastToken.kind === 26 /* SemicolonToken */; + var rightChildren = children.slice(splitTokenIndex + 1, separateLastToken ? children.length - 1 : undefined); + var result = ts.compact([ + leftChildren.length ? createSyntaxList(leftChildren) : undefined, + splitToken, + rightChildren.length ? createSyntaxList(rightChildren) : undefined, + ]); + return separateLastToken ? result.concat(lastToken) : result; + } + function createSyntaxList(children) { + ts.Debug.assertGreaterThanOrEqual(children.length, 1); + var syntaxList = ts.createNode(312 /* SyntaxList */, children[0].pos, ts.last(children).end); + syntaxList._children = children; + return syntaxList; + } + function isListOpener(token) { + var kind = token && token.kind; + return kind === 18 /* OpenBraceToken */ + || kind === 22 /* OpenBracketToken */ + || kind === 20 /* OpenParenToken */ + || kind === 263 /* JsxOpeningElement */; + } + function isListCloser(token) { + var kind = token && token.kind; + return kind === 19 /* CloseBraceToken */ + || kind === 23 /* CloseBracketToken */ + || kind === 21 /* CloseParenToken */ + || kind === 264 /* JsxClosingElement */; + } + })(SmartSelectionRange = ts.SmartSelectionRange || (ts.SmartSelectionRange = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; (function (ts) { var SignatureHelp; (function (SignatureHelp) { @@ -106693,8 +107941,21 @@ var ts; }); } function containsPrecedingToken(startingToken, sourceFile, container) { - var precedingToken = ts.Debug.assertDefined(ts.findPrecedingToken(startingToken.getFullStart(), sourceFile, startingToken.parent, /*excludeJsdoc*/ true)); - return ts.rangeContainsRange(container, precedingToken); + var pos = startingToken.getFullStart(); + // There’s a possibility that `startingToken.parent` contains only `startingToken` and + // missing nodes, none of which are valid to be returned by `findPrecedingToken`. In that + // case, the preceding token we want is actually higher up the tree—almost definitely the + // next parent, but theoretically the situation with missing nodes might be happening on + // multiple nested levels. + var currentParent = startingToken.parent; + while (currentParent) { + var precedingToken = ts.findPrecedingToken(pos, sourceFile, currentParent, /*excludeJsdoc*/ true); + if (precedingToken) { + return ts.rangeContainsRange(container, precedingToken); + } + currentParent = currentParent.parent; + } + return ts.Debug.fail("Could not find preceding token"); } function getArgumentInfoForCompletions(node, position, sourceFile) { var info = getImmediatelyContainingArgumentInfo(node, position, sourceFile); @@ -106768,10 +108029,10 @@ var ts; } return undefined; } - else if (ts.isTemplateHead(node) && parent.parent.kind === 193 /* TaggedTemplateExpression */) { + else if (ts.isTemplateHead(node) && parent.parent.kind === 194 /* TaggedTemplateExpression */) { var templateExpression = parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 206 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 207 /* TemplateExpression */); var argumentIndex = ts.isInsideTemplateLiteral(node, position, sourceFile) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } @@ -106838,17 +108099,17 @@ var ts; return undefined; var parent = startingToken.parent; switch (parent.kind) { - case 195 /* ParenthesizedExpression */: - case 156 /* MethodDeclaration */: - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: + case 196 /* ParenthesizedExpression */: + case 157 /* MethodDeclaration */: + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: var info = getArgumentOrParameterListInfo(startingToken, sourceFile); if (!info) return undefined; var argumentIndex = info.argumentIndex, argumentCount = info.argumentCount, argumentsSpan = info.argumentsSpan; var contextualType = ts.isMethodDeclaration(parent) ? checker.getContextualTypeForObjectLiteralElement(parent) : checker.getContextualType(parent); return contextualType && { contextualType: contextualType, argumentIndex: argumentIndex, argumentCount: argumentCount, argumentsSpan: argumentsSpan }; - case 204 /* BinaryExpression */: { + case 205 /* BinaryExpression */: { var highestBinary = getHighestBinary(parent); var contextualType_1 = checker.getContextualType(highestBinary); var argumentIndex_1 = startingToken.kind === 20 /* OpenParenToken */ ? 0 : countBinaryExpressionParameters(parent) - 1; @@ -106972,7 +108233,7 @@ var ts; // | | // This is because a Missing node has no width. However, what we actually want is to include trivia // leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail. - if (template.kind === 206 /* TemplateExpression */) { + if (template.kind === 207 /* TemplateExpression */) { var lastSpan = ts.last(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false); @@ -106984,7 +108245,7 @@ var ts; var _loop_7 = function (n) { // If the node is not a subspan of its parent, this is a big problem. // There have been crashes that might be caused by this violation. - ts.Debug.assert(ts.rangeContainsRange(n.parent, n), "Not a subspan", function () { return "Child: " + ts.Debug.showSyntaxKind(n) + ", parent: " + ts.Debug.showSyntaxKind(n.parent); }); + ts.Debug.assert(ts.rangeContainsRange(n.parent, n), "Not a subspan", function () { return "Child: " + ts.Debug.formatSyntaxKind(n.kind) + ", parent: " + ts.Debug.formatSyntaxKind(n.parent.kind); }); var argumentInfo = getImmediatelyContainingArgumentOrContextualParameterInfo(n, position, sourceFile, checker); if (argumentInfo) { return { value: argumentInfo }; @@ -107284,7 +108545,7 @@ var ts; function check(node) { if (isJsFile) { switch (node.kind) { - case 196 /* FunctionExpression */: + case 197 /* FunctionExpression */: var decl = ts.getDeclarationOfExpando(node); if (decl) { var symbol_1 = decl.symbol; @@ -107294,7 +108555,7 @@ var ts; } } // falls through if no diagnostic was created - case 239 /* FunctionDeclaration */: + case 240 /* FunctionDeclaration */: var symbol = node.symbol; if (symbol.members && (symbol.members.size > 0)) { diags.push(ts.createDiagnosticForNode(ts.isVariableDeclaration(node.parent) ? node.parent.name : node, ts.Diagnostics.This_constructor_function_may_be_converted_to_a_class_declaration)); @@ -107327,11 +108588,11 @@ var ts; function containsTopLevelCommonjs(sourceFile) { return sourceFile.statements.some(function (statement) { switch (statement.kind) { - case 219 /* VariableStatement */: + case 220 /* VariableStatement */: return statement.declarationList.declarations.some(function (decl) { return !!decl.initializer && ts.isRequireCall(propertyAccessLeftHandSide(decl.initializer), /*checkArgumentIsStringLiteralLike*/ true); }); - case 221 /* ExpressionStatement */: { + case 222 /* ExpressionStatement */: { var expression = statement.expression; if (!ts.isBinaryExpression(expression)) return ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true); @@ -107348,12 +108609,12 @@ var ts; } function importNameForConvertToDefaultImport(node) { switch (node.kind) { - case 249 /* ImportDeclaration */: + case 250 /* ImportDeclaration */: var importClause = node.importClause, moduleSpecifier = node.moduleSpecifier; - return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 251 /* NamespaceImport */ && ts.isStringLiteral(moduleSpecifier) + return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 252 /* NamespaceImport */ && ts.isStringLiteral(moduleSpecifier) ? importClause.namedBindings.name : undefined; - case 248 /* ImportEqualsDeclaration */: + case 249 /* ImportEqualsDeclaration */: return node.name; default: return undefined; @@ -107411,13 +108672,13 @@ var ts; // should be kept up to date with getTransformationBody in convertToAsyncFunction.ts function isFixablePromiseArgument(arg) { switch (arg.kind) { - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: visitedNestedConvertibleFunctions.set(getKeyFromNode(arg), true); /* falls through */ - case 96 /* NullKeyword */: - case 72 /* Identifier */: // identifier includes undefined + case 97 /* NullKeyword */: + case 73 /* Identifier */: // identifier includes undefined return true; default: return false; @@ -107440,7 +108701,7 @@ var ts; } var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol); if (flags & 32 /* Class */) { - return ts.getDeclarationOfKind(symbol, 209 /* ClassExpression */) ? + return ts.getDeclarationOfKind(symbol, 210 /* ClassExpression */) ? "local class" /* localClassElement */ : "class" /* classElement */; } if (flags & 384 /* Enum */) @@ -107477,7 +108738,7 @@ var ts; if (typeChecker.isArgumentsSymbol(symbol)) { return "local var" /* localVariableElement */; } - if (location.kind === 100 /* ThisKeyword */ && ts.isExpression(location)) { + if (location.kind === 101 /* ThisKeyword */ && ts.isExpression(location)) { return "parameter" /* parameterElement */; } var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol); @@ -107528,11 +108789,11 @@ var ts; // If we requested completions after `x.` at the top-level, we may be at a source file location. switch (location.parent && location.parent.kind) { // If we've typed a character of the attribute name, will be 'JsxAttribute', else will be 'JsxOpeningElement'. - case 262 /* JsxOpeningElement */: - case 260 /* JsxElement */: - case 261 /* JsxSelfClosingElement */: - return location.kind === 72 /* Identifier */ ? "property" /* memberVariableElement */ : "JSX attribute" /* jsxAttribute */; - case 267 /* JsxAttribute */: + case 263 /* JsxOpeningElement */: + case 261 /* JsxElement */: + case 262 /* JsxSelfClosingElement */: + return location.kind === 73 /* Identifier */ ? "property" /* memberVariableElement */ : "JSX attribute" /* jsxAttribute */; + case 268 /* JsxAttribute */: return "JSX attribute" /* jsxAttribute */; default: return "property" /* memberVariableElement */; @@ -107559,13 +108820,13 @@ var ts; var symbolFlags = ts.getCombinedLocalAndExportSymbolFlags(symbol); var symbolKind = semanticMeaning & 1 /* Value */ ? getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location) : "" /* unknown */; var hasAddedSymbolInfo = false; - var isThisExpression = location.kind === 100 /* ThisKeyword */ && ts.isInExpressionContext(location); + var isThisExpression = location.kind === 101 /* ThisKeyword */ && ts.isInExpressionContext(location); var type; var printer; var documentationFromAlias; var tagsFromAlias; - if (location.kind === 100 /* ThisKeyword */ && !isThisExpression) { - return { displayParts: [ts.keywordPart(100 /* ThisKeyword */)], documentation: [], symbolKind: "primitive type" /* primitiveType */, tags: undefined }; + if (location.kind === 101 /* ThisKeyword */ && !isThisExpression) { + return { displayParts: [ts.keywordPart(101 /* ThisKeyword */)], documentation: [], symbolKind: "primitive type" /* primitiveType */, tags: undefined }; } // Class at constructor site need to be shown as constructor apart from property,method, vars if (symbolKind !== "" /* unknown */ || symbolFlags & 32 /* Class */ || symbolFlags & 2097152 /* Alias */) { @@ -107575,7 +108836,7 @@ var ts; } var signature = void 0; type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol.exportSymbol || symbol, location); - if (location.parent && location.parent.kind === 189 /* PropertyAccessExpression */) { + if (location.parent && location.parent.kind === 190 /* PropertyAccessExpression */) { var right = location.parent.name; // Either the location is on the right of a property access, or on the left and the right is missing if (right === location || (right && right.getFullWidth() === 0)) { @@ -107594,9 +108855,8 @@ var ts; callExpressionLike = location.parent; } if (callExpressionLike) { - var candidateSignatures = []; - signature = typeChecker.getResolvedSignature(callExpressionLike, candidateSignatures); // TODO: GH#18217 - var useConstructSignatures = callExpressionLike.kind === 192 /* NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 98 /* SuperKeyword */); + signature = typeChecker.getResolvedSignature(callExpressionLike); // TODO: GH#18217 + var useConstructSignatures = callExpressionLike.kind === 193 /* NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 99 /* SuperKeyword */); var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { // Get the first signature if there is one -- allSignatures may contain @@ -107614,7 +108874,7 @@ var ts; pushSymbolKind(symbolKind); displayParts.push(ts.spacePart()); if (useConstructSignatures) { - displayParts.push(ts.keywordPart(95 /* NewKeyword */)); + displayParts.push(ts.keywordPart(96 /* NewKeyword */)); displayParts.push(ts.spacePart()); } addFullSymbolName(symbol); @@ -107638,7 +108898,7 @@ var ts; displayParts.push(ts.lineBreakPart()); } if (useConstructSignatures) { - displayParts.push(ts.keywordPart(95 /* NewKeyword */)); + displayParts.push(ts.keywordPart(96 /* NewKeyword */)); displayParts.push(ts.spacePart()); } addSignatureDisplayParts(signature, allSignatures, 262144 /* WriteArrowStyleSignature */); @@ -107651,29 +108911,29 @@ var ts; } } else if ((ts.isNameOfFunctionDeclaration(location) && !(symbolFlags & 98304 /* Accessor */)) || // name of function declaration - (location.kind === 124 /* ConstructorKeyword */ && location.parent.kind === 157 /* Constructor */)) { // At constructor keyword of constructor declaration + (location.kind === 125 /* ConstructorKeyword */ && location.parent.kind === 158 /* Constructor */)) { // At constructor keyword of constructor declaration // get the signature from the declaration and write it var functionDeclaration_1 = location.parent; // Use function declaration to write the signatures only if the symbol corresponding to this declaration var locationIsSymbolDeclaration = ts.find(symbol.declarations, function (declaration) { - return declaration === (location.kind === 124 /* ConstructorKeyword */ ? functionDeclaration_1.parent : functionDeclaration_1); + return declaration === (location.kind === 125 /* ConstructorKeyword */ ? functionDeclaration_1.parent : functionDeclaration_1); }); if (locationIsSymbolDeclaration) { - var allSignatures = functionDeclaration_1.kind === 157 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); + var allSignatures = functionDeclaration_1.kind === 158 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration_1)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration_1); // TODO: GH#18217 } else { signature = allSignatures[0]; } - if (functionDeclaration_1.kind === 157 /* Constructor */) { + if (functionDeclaration_1.kind === 158 /* Constructor */) { // show (constructor) Type(...) signature symbolKind = "constructor" /* constructorImplementationElement */; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { // (function/method) symbol(..signature) - addPrefixForAnyFunctionOrVar(functionDeclaration_1.kind === 160 /* CallSignature */ && + addPrefixForAnyFunctionOrVar(functionDeclaration_1.kind === 161 /* CallSignature */ && !(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); @@ -107683,7 +108943,7 @@ var ts; } if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo && !isThisExpression) { addAliasPrefixIfNecessary(); - if (ts.getDeclarationOfKind(symbol, 209 /* ClassExpression */)) { + if (ts.getDeclarationOfKind(symbol, 210 /* ClassExpression */)) { // Special case for class expressions because we would like to indicate that // the class name is local to the class body (similar to function expression) // (local class) class @@ -107691,7 +108951,7 @@ var ts; } else { // Class declaration has name which is not local. - displayParts.push(ts.keywordPart(76 /* ClassKeyword */)); + displayParts.push(ts.keywordPart(77 /* ClassKeyword */)); } displayParts.push(ts.spacePart()); addFullSymbolName(symbol); @@ -107699,37 +108959,37 @@ var ts; } if ((symbolFlags & 64 /* Interface */) && (semanticMeaning & 2 /* Type */)) { prefixNextMeaning(); - displayParts.push(ts.keywordPart(110 /* InterfaceKeyword */)); + displayParts.push(ts.keywordPart(111 /* InterfaceKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); } if ((symbolFlags & 524288 /* TypeAlias */) && (semanticMeaning & 2 /* Type */)) { prefixNextMeaning(); - displayParts.push(ts.keywordPart(140 /* TypeKeyword */)); + displayParts.push(ts.keywordPart(141 /* TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(59 /* EqualsToken */)); + displayParts.push(ts.operatorPart(60 /* EqualsToken */)); displayParts.push(ts.spacePart()); ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, 8388608 /* InTypeAlias */)); } if (symbolFlags & 384 /* Enum */) { prefixNextMeaning(); if (ts.some(symbol.declarations, function (d) { return ts.isEnumDeclaration(d) && ts.isEnumConst(d); })) { - displayParts.push(ts.keywordPart(77 /* ConstKeyword */)); + displayParts.push(ts.keywordPart(78 /* ConstKeyword */)); displayParts.push(ts.spacePart()); } - displayParts.push(ts.keywordPart(84 /* EnumKeyword */)); + displayParts.push(ts.keywordPart(85 /* EnumKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); } if (symbolFlags & 1536 /* Module */ && !isThisExpression) { prefixNextMeaning(); - var declaration = ts.getDeclarationOfKind(symbol, 244 /* ModuleDeclaration */); - var isNamespace = declaration && declaration.name && declaration.name.kind === 72 /* Identifier */; - displayParts.push(ts.keywordPart(isNamespace ? 131 /* NamespaceKeyword */ : 130 /* ModuleKeyword */)); + var declaration = ts.getDeclarationOfKind(symbol, 245 /* ModuleDeclaration */); + var isNamespace = declaration && declaration.name && declaration.name.kind === 73 /* Identifier */; + displayParts.push(ts.keywordPart(isNamespace ? 132 /* NamespaceKeyword */ : 131 /* ModuleKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); } @@ -107748,7 +109008,7 @@ var ts; } else { // Method/function type parameter - var decl = ts.getDeclarationOfKind(symbol, 150 /* TypeParameter */); + var decl = ts.getDeclarationOfKind(symbol, 151 /* TypeParameter */); if (decl === undefined) return ts.Debug.fail(); var declaration = decl.parent; @@ -107756,21 +109016,21 @@ var ts; if (ts.isFunctionLikeKind(declaration.kind)) { addInPrefix(); var signature = typeChecker.getSignatureFromDeclaration(declaration); // TODO: GH#18217 - if (declaration.kind === 161 /* ConstructSignature */) { - displayParts.push(ts.keywordPart(95 /* NewKeyword */)); + if (declaration.kind === 162 /* ConstructSignature */) { + displayParts.push(ts.keywordPart(96 /* NewKeyword */)); displayParts.push(ts.spacePart()); } - else if (declaration.kind !== 160 /* CallSignature */ && declaration.name) { + else if (declaration.kind !== 161 /* CallSignature */ && declaration.name) { addFullSymbolName(declaration.symbol); } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */)); } - else if (declaration.kind === 242 /* TypeAliasDeclaration */) { + else if (declaration.kind === 243 /* TypeAliasDeclaration */) { // Type alias type parameter // For example // type list = T[]; // Both T will go through same code path addInPrefix(); - displayParts.push(ts.keywordPart(140 /* TypeKeyword */)); + displayParts.push(ts.keywordPart(141 /* TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(declaration.symbol); writeTypeParametersOfSymbol(declaration.symbol, sourceFile); @@ -107782,11 +109042,11 @@ var ts; symbolKind = "enum member" /* enumMemberElement */; addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 278 /* EnumMember */) { + if (declaration.kind === 279 /* EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(59 /* EqualsToken */)); + displayParts.push(ts.operatorPart(60 /* EqualsToken */)); displayParts.push(ts.spacePart()); displayParts.push(ts.displayPart(ts.getTextOfConstantValue(constantValue), typeof constantValue === "number" ? ts.SymbolDisplayPartKind.numericLiteral : ts.SymbolDisplayPartKind.stringLiteral)); } @@ -107812,32 +109072,32 @@ var ts; } } switch (symbol.declarations[0].kind) { - case 247 /* NamespaceExportDeclaration */: - displayParts.push(ts.keywordPart(85 /* ExportKeyword */)); + case 248 /* NamespaceExportDeclaration */: + displayParts.push(ts.keywordPart(86 /* ExportKeyword */)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(131 /* NamespaceKeyword */)); + displayParts.push(ts.keywordPart(132 /* NamespaceKeyword */)); break; - case 254 /* ExportAssignment */: - displayParts.push(ts.keywordPart(85 /* ExportKeyword */)); + case 255 /* ExportAssignment */: + displayParts.push(ts.keywordPart(86 /* ExportKeyword */)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(symbol.declarations[0].isExportEquals ? 59 /* EqualsToken */ : 80 /* DefaultKeyword */)); + displayParts.push(ts.keywordPart(symbol.declarations[0].isExportEquals ? 60 /* EqualsToken */ : 81 /* DefaultKeyword */)); break; - case 257 /* ExportSpecifier */: - displayParts.push(ts.keywordPart(85 /* ExportKeyword */)); + case 258 /* ExportSpecifier */: + displayParts.push(ts.keywordPart(86 /* ExportKeyword */)); break; default: - displayParts.push(ts.keywordPart(92 /* ImportKeyword */)); + displayParts.push(ts.keywordPart(93 /* ImportKeyword */)); } displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 248 /* ImportEqualsDeclaration */) { + if (declaration.kind === 249 /* ImportEqualsDeclaration */) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(59 /* EqualsToken */)); + displayParts.push(ts.operatorPart(60 /* EqualsToken */)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(134 /* RequireKeyword */)); + displayParts.push(ts.keywordPart(135 /* RequireKeyword */)); displayParts.push(ts.punctuationPart(20 /* OpenParenToken */)); displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), ts.SymbolDisplayPartKind.stringLiteral)); displayParts.push(ts.punctuationPart(21 /* CloseParenToken */)); @@ -107846,7 +109106,7 @@ var ts; var internalAliasSymbol = typeChecker.getSymbolAtLocation(importEqualsDeclaration.moduleReference); if (internalAliasSymbol) { displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(59 /* EqualsToken */)); + displayParts.push(ts.operatorPart(60 /* EqualsToken */)); displayParts.push(ts.spacePart()); addFullSymbolName(internalAliasSymbol, enclosingDeclaration); } @@ -107860,7 +109120,7 @@ var ts; if (type) { if (isThisExpression) { prefixNextMeaning(); - displayParts.push(ts.keywordPart(100 /* ThisKeyword */)); + displayParts.push(ts.keywordPart(101 /* ThisKeyword */)); } else { addPrefixForAnyFunctionOrVar(symbol, symbolKind); @@ -107909,10 +109169,10 @@ var ts; // For some special property access expressions like `exports.foo = foo` or `module.exports.foo = foo` // there documentation comments might be attached to the right hand side symbol of their declarations. // The pattern of such special property access is that the parent symbol is the symbol of the file. - if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 284 /* SourceFile */; })) { + if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 285 /* SourceFile */; })) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (!declaration.parent || declaration.parent.kind !== 204 /* BinaryExpression */) { + if (!declaration.parent || declaration.parent.kind !== 205 /* BinaryExpression */) { continue; } var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right); @@ -107955,7 +109215,7 @@ var ts; } function addInPrefix() { displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(93 /* InKeyword */)); + displayParts.push(ts.keywordPart(94 /* InKeyword */)); displayParts.push(ts.spacePart()); } function addFullSymbolName(symbolToDisplay, enclosingDeclaration) { @@ -108025,16 +109285,16 @@ var ts; } return ts.forEach(symbol.declarations, function (declaration) { // Function expressions are local - if (declaration.kind === 196 /* FunctionExpression */) { + if (declaration.kind === 197 /* FunctionExpression */) { return true; } - if (declaration.kind !== 237 /* VariableDeclaration */ && declaration.kind !== 239 /* FunctionDeclaration */) { + if (declaration.kind !== 238 /* VariableDeclaration */ && declaration.kind !== 240 /* FunctionDeclaration */) { return false; } // If the parent is not sourceFile or module block it is local variable for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { // Reached source file or module block - if (parent.kind === 284 /* SourceFile */ || parent.kind === 245 /* ModuleBlock */) { + if (parent.kind === 285 /* SourceFile */ || parent.kind === 246 /* ModuleBlock */) { return false; } } @@ -108263,8 +109523,8 @@ var ts; (function (ts) { var formatting; (function (formatting) { - var standardScanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ false, 0 /* Standard */); - var jsxScanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ false, 1 /* JSX */); + var standardScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, 0 /* Standard */); + var jsxScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, 1 /* JSX */); var ScanAction; (function (ScanAction) { ScanAction[ScanAction["Scan"] = 0] = "Scan"; @@ -108328,8 +109588,8 @@ var ts; function shouldRescanGreaterThanToken(node) { switch (node.kind) { case 32 /* GreaterThanEqualsToken */: - case 67 /* GreaterThanGreaterThanEqualsToken */: - case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 68 /* GreaterThanGreaterThanEqualsToken */: + case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */: case 48 /* GreaterThanGreaterThanGreaterThanToken */: case 47 /* GreaterThanGreaterThanToken */: return true; @@ -108339,12 +109599,12 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 267 /* JsxAttribute */: - case 262 /* JsxOpeningElement */: - case 263 /* JsxClosingElement */: - case 261 /* JsxSelfClosingElement */: + case 268 /* JsxAttribute */: + case 263 /* JsxOpeningElement */: + case 264 /* JsxClosingElement */: + case 262 /* JsxSelfClosingElement */: // May parse an identifier like `module-layout`; that will be scanned as a keyword at first, but we should parse the whole thing to get an identifier. - return ts.isKeyword(node.kind) || node.kind === 72 /* Identifier */; + return ts.isKeyword(node.kind) || node.kind === 73 /* Identifier */; } } return false; @@ -108360,7 +109620,7 @@ var ts; container.kind === 17 /* TemplateTail */; } function startsWithSlashToken(t) { - return t === 42 /* SlashToken */ || t === 64 /* SlashEqualsToken */; + return t === 42 /* SlashToken */ || t === 65 /* SlashEqualsToken */; } function readTokenInfo(n) { ts.Debug.assert(isOnToken()); @@ -108519,7 +109779,7 @@ var ts; (function (formatting) { function getAllRules() { var allTokens = []; - for (var token = 0 /* FirstToken */; token <= 147 /* LastToken */; token++) { + for (var token = 0 /* FirstToken */; token <= 148 /* LastToken */; token++) { allTokens.push(token); } function anyTokenExcept() { @@ -108531,27 +109791,27 @@ var ts; } var anyToken = { tokens: allTokens, isSpecific: false }; var anyTokenIncludingMultilineComments = tokenRangeFrom(allTokens.concat([3 /* MultiLineCommentTrivia */])); - var keywords = tokenRangeFromRange(73 /* FirstKeyword */, 147 /* LastKeyword */); - var binaryOperators = tokenRangeFromRange(28 /* FirstBinaryOperator */, 71 /* LastBinaryOperator */); - var binaryKeywordOperators = [93 /* InKeyword */, 94 /* InstanceOfKeyword */, 147 /* OfKeyword */, 119 /* AsKeyword */, 128 /* IsKeyword */]; + var keywords = tokenRangeFromRange(74 /* FirstKeyword */, 148 /* LastKeyword */); + var binaryOperators = tokenRangeFromRange(28 /* FirstBinaryOperator */, 72 /* LastBinaryOperator */); + var binaryKeywordOperators = [94 /* InKeyword */, 95 /* InstanceOfKeyword */, 148 /* OfKeyword */, 120 /* AsKeyword */, 129 /* IsKeyword */]; var unaryPrefixOperators = [44 /* PlusPlusToken */, 45 /* MinusMinusToken */, 53 /* TildeToken */, 52 /* ExclamationToken */]; var unaryPrefixExpressions = [ - 8 /* NumericLiteral */, 9 /* BigIntLiteral */, 72 /* Identifier */, 20 /* OpenParenToken */, - 22 /* OpenBracketToken */, 18 /* OpenBraceToken */, 100 /* ThisKeyword */, 95 /* NewKeyword */ + 8 /* NumericLiteral */, 9 /* BigIntLiteral */, 73 /* Identifier */, 20 /* OpenParenToken */, + 22 /* OpenBracketToken */, 18 /* OpenBraceToken */, 101 /* ThisKeyword */, 96 /* NewKeyword */ ]; - var unaryPreincrementExpressions = [72 /* Identifier */, 20 /* OpenParenToken */, 100 /* ThisKeyword */, 95 /* NewKeyword */]; - var unaryPostincrementExpressions = [72 /* Identifier */, 21 /* CloseParenToken */, 23 /* CloseBracketToken */, 95 /* NewKeyword */]; - var unaryPredecrementExpressions = [72 /* Identifier */, 20 /* OpenParenToken */, 100 /* ThisKeyword */, 95 /* NewKeyword */]; - var unaryPostdecrementExpressions = [72 /* Identifier */, 21 /* CloseParenToken */, 23 /* CloseBracketToken */, 95 /* NewKeyword */]; + var unaryPreincrementExpressions = [73 /* Identifier */, 20 /* OpenParenToken */, 101 /* ThisKeyword */, 96 /* NewKeyword */]; + var unaryPostincrementExpressions = [73 /* Identifier */, 21 /* CloseParenToken */, 23 /* CloseBracketToken */, 96 /* NewKeyword */]; + var unaryPredecrementExpressions = [73 /* Identifier */, 20 /* OpenParenToken */, 101 /* ThisKeyword */, 96 /* NewKeyword */]; + var unaryPostdecrementExpressions = [73 /* Identifier */, 21 /* CloseParenToken */, 23 /* CloseBracketToken */, 96 /* NewKeyword */]; var comments = [2 /* SingleLineCommentTrivia */, 3 /* MultiLineCommentTrivia */]; - var typeNames = [72 /* Identifier */].concat(ts.typeKeywords); + var typeNames = [73 /* Identifier */].concat(ts.typeKeywords); // Place a space before open brace in a function declaration // TypeScript: Function can have return types, which can be made of tons of different token kinds var functionOpenBraceLeftTokenRange = anyTokenIncludingMultilineComments; // Place a space before open brace in a TypeScript declaration that has braces as children (class, module, enum, etc) - var typeScriptOpenBraceLeftTokenRange = tokenRangeFrom([72 /* Identifier */, 3 /* MultiLineCommentTrivia */, 76 /* ClassKeyword */, 85 /* ExportKeyword */, 92 /* ImportKeyword */]); + var typeScriptOpenBraceLeftTokenRange = tokenRangeFrom([73 /* Identifier */, 3 /* MultiLineCommentTrivia */, 77 /* ClassKeyword */, 86 /* ExportKeyword */, 93 /* ImportKeyword */]); // Place a space before open brace in a control flow construct - var controlOpenBraceLeftTokenRange = tokenRangeFrom([21 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 82 /* DoKeyword */, 103 /* TryKeyword */, 88 /* FinallyKeyword */, 83 /* ElseKeyword */]); + var controlOpenBraceLeftTokenRange = tokenRangeFrom([21 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 83 /* DoKeyword */, 104 /* TryKeyword */, 89 /* FinallyKeyword */, 84 /* ElseKeyword */]); // These rules are higher in priority than user-configurable var highPriorityCommonRules = [ // Leave comments alone @@ -108566,7 +109826,7 @@ var ts; rule("NoSpaceAfterQuestionMark", 56 /* QuestionToken */, anyToken, [isNonJsxSameLineTokenContext], 8 /* Delete */), rule("NoSpaceBeforeDot", anyToken, 24 /* DotToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */), rule("NoSpaceAfterDot", 24 /* DotToken */, anyToken, [isNonJsxSameLineTokenContext], 8 /* Delete */), - rule("NoSpaceBetweenImportParenInImportType", 92 /* ImportKeyword */, 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isImportTypeContext], 8 /* Delete */), + rule("NoSpaceBetweenImportParenInImportType", 93 /* ImportKeyword */, 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isImportTypeContext], 8 /* Delete */), // Special handling of unary operators. // Prefix operators generally shouldn't have a space between // them and their target unary expression. @@ -108593,79 +109853,79 @@ var ts; rule("SpaceAfterCloseBrace", 19 /* CloseBraceToken */, anyTokenExcept(21 /* CloseParenToken */), [isNonJsxSameLineTokenContext, isAfterCodeBlockContext], 2 /* Space */), // Special case for (}, else) and (}, while) since else & while tokens are not part of the tree which makes SpaceAfterCloseBrace rule not applied // Also should not apply to }) - rule("SpaceBetweenCloseBraceAndElse", 19 /* CloseBraceToken */, 83 /* ElseKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */), - rule("SpaceBetweenCloseBraceAndWhile", 19 /* CloseBraceToken */, 107 /* WhileKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */), + rule("SpaceBetweenCloseBraceAndElse", 19 /* CloseBraceToken */, 84 /* ElseKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */), + rule("SpaceBetweenCloseBraceAndWhile", 19 /* CloseBraceToken */, 108 /* WhileKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */), rule("NoSpaceBetweenEmptyBraceBrackets", 18 /* OpenBraceToken */, 19 /* CloseBraceToken */, [isNonJsxSameLineTokenContext, isObjectContext], 8 /* Delete */), // Add a space after control dec context if the next character is an open bracket ex: 'if (false)[a, b] = [1, 2];' -> 'if (false) [a, b] = [1, 2];' rule("SpaceAfterConditionalClosingParen", 21 /* CloseParenToken */, 22 /* OpenBracketToken */, [isControlDeclContext], 2 /* Space */), - rule("NoSpaceBetweenFunctionKeywordAndStar", 90 /* FunctionKeyword */, 40 /* AsteriskToken */, [isFunctionDeclarationOrFunctionExpressionContext], 8 /* Delete */), - rule("SpaceAfterStarInGeneratorDeclaration", 40 /* AsteriskToken */, [72 /* Identifier */, 20 /* OpenParenToken */], [isFunctionDeclarationOrFunctionExpressionContext], 2 /* Space */), - rule("SpaceAfterFunctionInFuncDecl", 90 /* FunctionKeyword */, anyToken, [isFunctionDeclContext], 2 /* Space */), + rule("NoSpaceBetweenFunctionKeywordAndStar", 91 /* FunctionKeyword */, 40 /* AsteriskToken */, [isFunctionDeclarationOrFunctionExpressionContext], 8 /* Delete */), + rule("SpaceAfterStarInGeneratorDeclaration", 40 /* AsteriskToken */, 73 /* Identifier */, [isFunctionDeclarationOrFunctionExpressionContext], 2 /* Space */), + rule("SpaceAfterFunctionInFuncDecl", 91 /* FunctionKeyword */, anyToken, [isFunctionDeclContext], 2 /* Space */), // Insert new line after { and before } in multi-line contexts. rule("NewLineAfterOpenBraceInBlockContext", 18 /* OpenBraceToken */, anyToken, [isMultilineBlockContext], 4 /* NewLine */), // For get/set members, we check for (identifier,identifier) since get/set don't have tokens and they are represented as just an identifier token. // Though, we do extra check on the context to make sure we are dealing with get/set node. Example: // get x() {} // set x(val) {} - rule("SpaceAfterGetSetInMember", [126 /* GetKeyword */, 137 /* SetKeyword */], 72 /* Identifier */, [isFunctionDeclContext], 2 /* Space */), - rule("NoSpaceBetweenYieldKeywordAndStar", 117 /* YieldKeyword */, 40 /* AsteriskToken */, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 8 /* Delete */), - rule("SpaceBetweenYieldOrYieldStarAndOperand", [117 /* YieldKeyword */, 40 /* AsteriskToken */], anyToken, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 2 /* Space */), - rule("NoSpaceBetweenReturnAndSemicolon", 97 /* ReturnKeyword */, 26 /* SemicolonToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */), - rule("SpaceAfterCertainKeywords", [105 /* VarKeyword */, 101 /* ThrowKeyword */, 95 /* NewKeyword */, 81 /* DeleteKeyword */, 97 /* ReturnKeyword */, 104 /* TypeOfKeyword */, 122 /* AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 2 /* Space */), - rule("SpaceAfterLetConstInVariableDeclaration", [111 /* LetKeyword */, 77 /* ConstKeyword */], anyToken, [isNonJsxSameLineTokenContext, isStartOfVariableDeclarationList], 2 /* Space */), + rule("SpaceAfterGetSetInMember", [127 /* GetKeyword */, 138 /* SetKeyword */], 73 /* Identifier */, [isFunctionDeclContext], 2 /* Space */), + rule("NoSpaceBetweenYieldKeywordAndStar", 118 /* YieldKeyword */, 40 /* AsteriskToken */, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 8 /* Delete */), + rule("SpaceBetweenYieldOrYieldStarAndOperand", [118 /* YieldKeyword */, 40 /* AsteriskToken */], anyToken, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 2 /* Space */), + rule("NoSpaceBetweenReturnAndSemicolon", 98 /* ReturnKeyword */, 26 /* SemicolonToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */), + rule("SpaceAfterCertainKeywords", [106 /* VarKeyword */, 102 /* ThrowKeyword */, 96 /* NewKeyword */, 82 /* DeleteKeyword */, 98 /* ReturnKeyword */, 105 /* TypeOfKeyword */, 123 /* AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 2 /* Space */), + rule("SpaceAfterLetConstInVariableDeclaration", [112 /* LetKeyword */, 78 /* ConstKeyword */], anyToken, [isNonJsxSameLineTokenContext, isStartOfVariableDeclarationList], 2 /* Space */), rule("NoSpaceBeforeOpenParenInFuncCall", anyToken, 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isFunctionCallOrNewContext, isPreviousTokenNotComma], 8 /* Delete */), // Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options. rule("SpaceBeforeBinaryKeywordOperator", anyToken, binaryKeywordOperators, [isNonJsxSameLineTokenContext, isBinaryOpContext], 2 /* Space */), rule("SpaceAfterBinaryKeywordOperator", binaryKeywordOperators, anyToken, [isNonJsxSameLineTokenContext, isBinaryOpContext], 2 /* Space */), - rule("SpaceAfterVoidOperator", 106 /* VoidKeyword */, anyToken, [isNonJsxSameLineTokenContext, isVoidOpContext], 2 /* Space */), + rule("SpaceAfterVoidOperator", 107 /* VoidKeyword */, anyToken, [isNonJsxSameLineTokenContext, isVoidOpContext], 2 /* Space */), // Async-await - rule("SpaceBetweenAsyncAndOpenParen", 121 /* AsyncKeyword */, 20 /* OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 2 /* Space */), - rule("SpaceBetweenAsyncAndFunctionKeyword", 121 /* AsyncKeyword */, 90 /* FunctionKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */), + rule("SpaceBetweenAsyncAndOpenParen", 122 /* AsyncKeyword */, 20 /* OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 2 /* Space */), + rule("SpaceBetweenAsyncAndFunctionKeyword", 122 /* AsyncKeyword */, 91 /* FunctionKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */), // Template string - rule("NoSpaceBetweenTagAndTemplateString", [72 /* Identifier */, 21 /* CloseParenToken */], [14 /* NoSubstitutionTemplateLiteral */, 15 /* TemplateHead */], [isNonJsxSameLineTokenContext], 8 /* Delete */), + rule("NoSpaceBetweenTagAndTemplateString", [73 /* Identifier */, 21 /* CloseParenToken */], [14 /* NoSubstitutionTemplateLiteral */, 15 /* TemplateHead */], [isNonJsxSameLineTokenContext], 8 /* Delete */), // JSX opening elements - rule("SpaceBeforeJsxAttribute", anyToken, 72 /* Identifier */, [isNextTokenParentJsxAttribute, isNonJsxSameLineTokenContext], 2 /* Space */), + rule("SpaceBeforeJsxAttribute", anyToken, 73 /* Identifier */, [isNextTokenParentJsxAttribute, isNonJsxSameLineTokenContext], 2 /* Space */), rule("SpaceBeforeSlashInJsxOpeningElement", anyToken, 42 /* SlashToken */, [isJsxSelfClosingElementContext, isNonJsxSameLineTokenContext], 2 /* Space */), rule("NoSpaceBeforeGreaterThanTokenInJsxOpeningElement", 42 /* SlashToken */, 30 /* GreaterThanToken */, [isJsxSelfClosingElementContext, isNonJsxSameLineTokenContext], 8 /* Delete */), - rule("NoSpaceBeforeEqualInJsxAttribute", anyToken, 59 /* EqualsToken */, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 8 /* Delete */), - rule("NoSpaceAfterEqualInJsxAttribute", 59 /* EqualsToken */, anyToken, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 8 /* Delete */), + rule("NoSpaceBeforeEqualInJsxAttribute", anyToken, 60 /* EqualsToken */, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 8 /* Delete */), + rule("NoSpaceAfterEqualInJsxAttribute", 60 /* EqualsToken */, anyToken, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 8 /* Delete */), // TypeScript-specific rules // Use of module as a function call. e.g.: import m2 = module("m2"); - rule("NoSpaceAfterModuleImport", [130 /* ModuleKeyword */, 134 /* RequireKeyword */], 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */), + rule("NoSpaceAfterModuleImport", [131 /* ModuleKeyword */, 135 /* RequireKeyword */], 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */), // Add a space around certain TypeScript keywords rule("SpaceAfterCertainTypeScriptKeywords", [ - 118 /* AbstractKeyword */, - 76 /* ClassKeyword */, - 125 /* DeclareKeyword */, - 80 /* DefaultKeyword */, - 84 /* EnumKeyword */, - 85 /* ExportKeyword */, - 86 /* ExtendsKeyword */, - 126 /* GetKeyword */, - 109 /* ImplementsKeyword */, - 92 /* ImportKeyword */, - 110 /* InterfaceKeyword */, - 130 /* ModuleKeyword */, - 131 /* NamespaceKeyword */, - 113 /* PrivateKeyword */, - 115 /* PublicKeyword */, - 114 /* ProtectedKeyword */, - 133 /* ReadonlyKeyword */, - 137 /* SetKeyword */, - 116 /* StaticKeyword */, - 140 /* TypeKeyword */, - 144 /* FromKeyword */, - 129 /* KeyOfKeyword */, - 127 /* InferKeyword */, + 119 /* AbstractKeyword */, + 77 /* ClassKeyword */, + 126 /* DeclareKeyword */, + 81 /* DefaultKeyword */, + 85 /* EnumKeyword */, + 86 /* ExportKeyword */, + 87 /* ExtendsKeyword */, + 127 /* GetKeyword */, + 110 /* ImplementsKeyword */, + 93 /* ImportKeyword */, + 111 /* InterfaceKeyword */, + 131 /* ModuleKeyword */, + 132 /* NamespaceKeyword */, + 114 /* PrivateKeyword */, + 116 /* PublicKeyword */, + 115 /* ProtectedKeyword */, + 134 /* ReadonlyKeyword */, + 138 /* SetKeyword */, + 117 /* StaticKeyword */, + 141 /* TypeKeyword */, + 145 /* FromKeyword */, + 130 /* KeyOfKeyword */, + 128 /* InferKeyword */, ], anyToken, [isNonJsxSameLineTokenContext], 2 /* Space */), - rule("SpaceBeforeCertainTypeScriptKeywords", anyToken, [86 /* ExtendsKeyword */, 109 /* ImplementsKeyword */, 144 /* FromKeyword */], [isNonJsxSameLineTokenContext], 2 /* Space */), + rule("SpaceBeforeCertainTypeScriptKeywords", anyToken, [87 /* ExtendsKeyword */, 110 /* ImplementsKeyword */, 145 /* FromKeyword */], [isNonJsxSameLineTokenContext], 2 /* Space */), // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { rule("SpaceAfterModuleName", 10 /* StringLiteral */, 18 /* OpenBraceToken */, [isModuleDeclContext], 2 /* Space */), // Lambda expressions rule("SpaceBeforeArrow", anyToken, 37 /* EqualsGreaterThanToken */, [isNonJsxSameLineTokenContext], 2 /* Space */), rule("SpaceAfterArrow", 37 /* EqualsGreaterThanToken */, anyToken, [isNonJsxSameLineTokenContext], 2 /* Space */), // Optional parameters and let args - rule("NoSpaceAfterEllipsis", 25 /* DotDotDotToken */, 72 /* Identifier */, [isNonJsxSameLineTokenContext], 8 /* Delete */), + rule("NoSpaceAfterEllipsis", 25 /* DotDotDotToken */, 73 /* Identifier */, [isNonJsxSameLineTokenContext], 8 /* Delete */), rule("NoSpaceAfterOptionalParameters", 56 /* QuestionToken */, [21 /* CloseParenToken */, 27 /* CommaToken */], [isNonJsxSameLineTokenContext, isNotBinaryOpContext], 8 /* Delete */), // Remove spaces in empty interface literals. e.g.: x: {} rule("NoSpaceBetweenEmptyInterfaceBraceBrackets", 18 /* OpenBraceToken */, 19 /* CloseBraceToken */, [isNonJsxSameLineTokenContext, isObjectTypeContext], 8 /* Delete */), @@ -108676,37 +109936,37 @@ var ts; rule("NoSpaceBeforeCloseAngularBracket", anyToken, 30 /* GreaterThanToken */, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 8 /* Delete */), rule("NoSpaceAfterCloseAngularBracket", 30 /* GreaterThanToken */, [20 /* OpenParenToken */, 22 /* OpenBracketToken */, 30 /* GreaterThanToken */, 27 /* CommaToken */], [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext, isNotFunctionDeclContext /*To prevent an interference with the SpaceBeforeOpenParenInFuncDecl rule*/], 8 /* Delete */), // decorators - rule("SpaceBeforeAt", [21 /* CloseParenToken */, 72 /* Identifier */], 58 /* AtToken */, [isNonJsxSameLineTokenContext], 2 /* Space */), + rule("SpaceBeforeAt", [21 /* CloseParenToken */, 73 /* Identifier */], 58 /* AtToken */, [isNonJsxSameLineTokenContext], 2 /* Space */), rule("NoSpaceAfterAt", 58 /* AtToken */, anyToken, [isNonJsxSameLineTokenContext], 8 /* Delete */), // Insert space after @ in decorator rule("SpaceAfterDecorator", anyToken, [ - 118 /* AbstractKeyword */, - 72 /* Identifier */, - 85 /* ExportKeyword */, - 80 /* DefaultKeyword */, - 76 /* ClassKeyword */, - 116 /* StaticKeyword */, - 115 /* PublicKeyword */, - 113 /* PrivateKeyword */, - 114 /* ProtectedKeyword */, - 126 /* GetKeyword */, - 137 /* SetKeyword */, + 119 /* AbstractKeyword */, + 73 /* Identifier */, + 86 /* ExportKeyword */, + 81 /* DefaultKeyword */, + 77 /* ClassKeyword */, + 117 /* StaticKeyword */, + 116 /* PublicKeyword */, + 114 /* PrivateKeyword */, + 115 /* ProtectedKeyword */, + 127 /* GetKeyword */, + 138 /* SetKeyword */, 22 /* OpenBracketToken */, 40 /* AsteriskToken */, ], [isEndOfDecoratorContextOnSameLine], 2 /* Space */), rule("NoSpaceBeforeNonNullAssertionOperator", anyToken, 52 /* ExclamationToken */, [isNonJsxSameLineTokenContext, isNonNullAssertionContext], 8 /* Delete */), - rule("NoSpaceAfterNewKeywordOnConstructorSignature", 95 /* NewKeyword */, 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isConstructorSignatureContext], 8 /* Delete */), + rule("NoSpaceAfterNewKeywordOnConstructorSignature", 96 /* NewKeyword */, 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isConstructorSignatureContext], 8 /* Delete */), ]; // These rules are applied after high priority var userConfigurableRules = [ // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses - rule("SpaceAfterConstructor", 124 /* ConstructorKeyword */, 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 2 /* Space */), - rule("NoSpaceAfterConstructor", 124 /* ConstructorKeyword */, 20 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 8 /* Delete */), + rule("SpaceAfterConstructor", 125 /* ConstructorKeyword */, 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 2 /* Space */), + rule("NoSpaceAfterConstructor", 125 /* ConstructorKeyword */, 20 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 8 /* Delete */), rule("SpaceAfterComma", 27 /* CommaToken */, anyToken, [isOptionEnabled("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNextTokenNotCloseBracket], 2 /* Space */), rule("NoSpaceAfterComma", 27 /* CommaToken */, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext], 8 /* Delete */), // Insert space after function keyword for anonymous functions - rule("SpaceAfterAnonymousFunctionKeyword", 90 /* FunctionKeyword */, 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), isFunctionDeclContext], 2 /* Space */), - rule("NoSpaceAfterAnonymousFunctionKeyword", 90 /* FunctionKeyword */, 20 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), isFunctionDeclContext], 8 /* Delete */), + rule("SpaceAfterAnonymousFunctionKeyword", [91 /* FunctionKeyword */, 40 /* AsteriskToken */], 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), isFunctionDeclContext], 2 /* Space */), + rule("NoSpaceAfterAnonymousFunctionKeyword", [91 /* FunctionKeyword */, 40 /* AsteriskToken */], 20 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), isFunctionDeclContext], 8 /* Delete */), // Insert space after keywords in control flow statements rule("SpaceAfterKeywordInControl", keywords, 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterKeywordsInControlFlowStatements"), isControlDeclContext], 2 /* Space */), rule("NoSpaceAfterKeywordInControl", keywords, 20 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterKeywordsInControlFlowStatements"), isControlDeclContext], 8 /* Delete */), @@ -108770,16 +110030,16 @@ var ts; rule("SpaceBeforeOpenBraceInTypeScriptDeclWithBlock", typeScriptOpenBraceLeftTokenRange, 18 /* OpenBraceToken */, [isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForFunctions"), isTypeScriptDeclWithBlockContext, isNotFormatOnEnter, isSameLineTokenOrBeforeBlockContext], 2 /* Space */, 1 /* CanDeleteNewLines */), rule("NoSpaceBeforeComma", anyToken, 27 /* CommaToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */), // No space before and after indexer `x[]` - rule("NoSpaceBeforeOpenBracket", anyTokenExcept(121 /* AsyncKeyword */, 74 /* CaseKeyword */), 22 /* OpenBracketToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */), + rule("NoSpaceBeforeOpenBracket", anyTokenExcept(122 /* AsyncKeyword */, 75 /* CaseKeyword */), 22 /* OpenBracketToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */), rule("NoSpaceAfterCloseBracket", 23 /* CloseBracketToken */, anyToken, [isNonJsxSameLineTokenContext, isNotBeforeBlockInFunctionDeclarationContext], 8 /* Delete */), rule("SpaceAfterSemicolon", 26 /* SemicolonToken */, anyToken, [isNonJsxSameLineTokenContext], 2 /* Space */), // Remove extra space between for and await - rule("SpaceBetweenForAndAwaitKeyword", 89 /* ForKeyword */, 122 /* AwaitKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */), + rule("SpaceBetweenForAndAwaitKeyword", 90 /* ForKeyword */, 123 /* AwaitKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */), // Add a space between statements. All keywords except (do,else,case) has open/close parens after them. // So, we have a rule to add a space for [),Any], [do,Any], [else,Any], and [case,Any] - rule("SpaceBetweenStatements", [21 /* CloseParenToken */, 82 /* DoKeyword */, 83 /* ElseKeyword */, 74 /* CaseKeyword */], anyToken, [isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNotForContext], 2 /* Space */), + rule("SpaceBetweenStatements", [21 /* CloseParenToken */, 83 /* DoKeyword */, 84 /* ElseKeyword */, 75 /* CaseKeyword */], anyToken, [isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNotForContext], 2 /* Space */), // This low-pri rule takes care of "try {" and "finally {" in case the rule SpaceBeforeOpenBraceInControl didn't execute on FormatOnEnter. - rule("SpaceAfterTryFinally", [103 /* TryKeyword */, 88 /* FinallyKeyword */], 18 /* OpenBraceToken */, [isNonJsxSameLineTokenContext], 2 /* Space */), + rule("SpaceAfterTryFinally", [104 /* TryKeyword */, 89 /* FinallyKeyword */], 18 /* OpenBraceToken */, [isNonJsxSameLineTokenContext], 2 /* Space */), ]; return highPriorityCommonRules.concat(userConfigurableRules, lowPriorityCommonRules); } @@ -108823,45 +110083,45 @@ var ts; return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !!context.options[optionName]; }; } function isForContext(context) { - return context.contextNode.kind === 225 /* ForStatement */; + return context.contextNode.kind === 226 /* ForStatement */; } function isNotForContext(context) { return !isForContext(context); } function isBinaryOpContext(context) { switch (context.contextNode.kind) { - case 204 /* BinaryExpression */: - case 205 /* ConditionalExpression */: - case 175 /* ConditionalType */: - case 212 /* AsExpression */: - case 257 /* ExportSpecifier */: - case 253 /* ImportSpecifier */: - case 163 /* TypePredicate */: - case 173 /* UnionType */: - case 174 /* IntersectionType */: + case 205 /* BinaryExpression */: + case 206 /* ConditionalExpression */: + case 176 /* ConditionalType */: + case 213 /* AsExpression */: + case 258 /* ExportSpecifier */: + case 254 /* ImportSpecifier */: + case 164 /* TypePredicate */: + case 174 /* UnionType */: + case 175 /* IntersectionType */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) - case 186 /* BindingElement */: + case 187 /* BindingElement */: // equals in type X = ... - case 242 /* TypeAliasDeclaration */: + case 243 /* TypeAliasDeclaration */: // equal in import a = module('a'); - case 248 /* ImportEqualsDeclaration */: + case 249 /* ImportEqualsDeclaration */: // equal in let a = 0; - case 237 /* VariableDeclaration */: + case 238 /* VariableDeclaration */: // equal in p = 0; - case 151 /* Parameter */: - case 278 /* EnumMember */: - case 154 /* PropertyDeclaration */: - case 153 /* PropertySignature */: - return context.currentTokenSpan.kind === 59 /* EqualsToken */ || context.nextTokenSpan.kind === 59 /* EqualsToken */; + case 152 /* Parameter */: + case 279 /* EnumMember */: + case 155 /* PropertyDeclaration */: + case 154 /* PropertySignature */: + return context.currentTokenSpan.kind === 60 /* EqualsToken */ || context.nextTokenSpan.kind === 60 /* EqualsToken */; // "in" keyword in for (let x in []) { } - case 226 /* ForInStatement */: + case 227 /* ForInStatement */: // "in" keyword in [P in keyof T]: T[P] - case 150 /* TypeParameter */: - return context.currentTokenSpan.kind === 93 /* InKeyword */ || context.nextTokenSpan.kind === 93 /* InKeyword */ || context.currentTokenSpan.kind === 59 /* EqualsToken */ || context.nextTokenSpan.kind === 59 /* EqualsToken */; + case 151 /* TypeParameter */: + return context.currentTokenSpan.kind === 94 /* InKeyword */ || context.nextTokenSpan.kind === 94 /* InKeyword */ || context.currentTokenSpan.kind === 60 /* EqualsToken */ || context.nextTokenSpan.kind === 60 /* EqualsToken */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 227 /* ForOfStatement */: - return context.currentTokenSpan.kind === 147 /* OfKeyword */ || context.nextTokenSpan.kind === 147 /* OfKeyword */; + case 228 /* ForOfStatement */: + return context.currentTokenSpan.kind === 148 /* OfKeyword */ || context.nextTokenSpan.kind === 148 /* OfKeyword */; } return false; } @@ -108873,22 +110133,22 @@ var ts; } function isTypeAnnotationContext(context) { var contextKind = context.contextNode.kind; - return contextKind === 154 /* PropertyDeclaration */ || - contextKind === 153 /* PropertySignature */ || - contextKind === 151 /* Parameter */ || - contextKind === 237 /* VariableDeclaration */ || + return contextKind === 155 /* PropertyDeclaration */ || + contextKind === 154 /* PropertySignature */ || + contextKind === 152 /* Parameter */ || + contextKind === 238 /* VariableDeclaration */ || ts.isFunctionLikeKind(contextKind); } function isConditionalOperatorContext(context) { - return context.contextNode.kind === 205 /* ConditionalExpression */ || - context.contextNode.kind === 175 /* ConditionalType */; + return context.contextNode.kind === 206 /* ConditionalExpression */ || + context.contextNode.kind === 176 /* ConditionalType */; } function isSameLineTokenOrBeforeBlockContext(context) { return context.TokensAreOnSameLine() || isBeforeBlockContext(context); } function isBraceWrappedContext(context) { - return context.contextNode.kind === 184 /* ObjectBindingPattern */ || - context.contextNode.kind === 181 /* MappedType */ || + return context.contextNode.kind === 185 /* ObjectBindingPattern */ || + context.contextNode.kind === 182 /* MappedType */ || isSingleLineBlockContext(context); } // This check is done before an open brace in a control construct, a function, or a typescript block declaration @@ -108914,31 +110174,31 @@ var ts; return true; } switch (node.kind) { - case 218 /* Block */: - case 246 /* CaseBlock */: - case 188 /* ObjectLiteralExpression */: - case 245 /* ModuleBlock */: + case 219 /* Block */: + case 247 /* CaseBlock */: + case 189 /* ObjectLiteralExpression */: + case 246 /* ModuleBlock */: return true; } return false; } function isFunctionDeclContext(context) { switch (context.contextNode.kind) { - case 239 /* FunctionDeclaration */: - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: + case 240 /* FunctionDeclaration */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: // case SyntaxKind.MemberFunctionDeclaration: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: // case SyntaxKind.MethodSignature: - case 160 /* CallSignature */: - case 196 /* FunctionExpression */: - case 157 /* Constructor */: - case 197 /* ArrowFunction */: + case 161 /* CallSignature */: + case 197 /* FunctionExpression */: + case 158 /* Constructor */: + case 198 /* ArrowFunction */: // case SyntaxKind.ConstructorDeclaration: // case SyntaxKind.SimpleArrowFunctionExpression: // case SyntaxKind.ParenthesizedArrowFunctionExpression: - case 241 /* InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one + case 242 /* InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one return true; } return false; @@ -108947,40 +110207,40 @@ var ts; return !isFunctionDeclContext(context); } function isFunctionDeclarationOrFunctionExpressionContext(context) { - return context.contextNode.kind === 239 /* FunctionDeclaration */ || context.contextNode.kind === 196 /* FunctionExpression */; + return context.contextNode.kind === 240 /* FunctionDeclaration */ || context.contextNode.kind === 197 /* FunctionExpression */; } function isTypeScriptDeclWithBlockContext(context) { return nodeIsTypeScriptDeclWithBlockContext(context.contextNode); } function nodeIsTypeScriptDeclWithBlockContext(node) { switch (node.kind) { - case 240 /* ClassDeclaration */: - case 209 /* ClassExpression */: - case 241 /* InterfaceDeclaration */: - case 243 /* EnumDeclaration */: - case 168 /* TypeLiteral */: - case 244 /* ModuleDeclaration */: - case 255 /* ExportDeclaration */: - case 256 /* NamedExports */: - case 249 /* ImportDeclaration */: - case 252 /* NamedImports */: + case 241 /* ClassDeclaration */: + case 210 /* ClassExpression */: + case 242 /* InterfaceDeclaration */: + case 244 /* EnumDeclaration */: + case 169 /* TypeLiteral */: + case 245 /* ModuleDeclaration */: + case 256 /* ExportDeclaration */: + case 257 /* NamedExports */: + case 250 /* ImportDeclaration */: + case 253 /* NamedImports */: return true; } return false; } function isAfterCodeBlockContext(context) { switch (context.currentTokenParent.kind) { - case 240 /* ClassDeclaration */: - case 244 /* ModuleDeclaration */: - case 243 /* EnumDeclaration */: - case 274 /* CatchClause */: - case 245 /* ModuleBlock */: - case 232 /* SwitchStatement */: + case 241 /* ClassDeclaration */: + case 245 /* ModuleDeclaration */: + case 244 /* EnumDeclaration */: + case 275 /* CatchClause */: + case 246 /* ModuleBlock */: + case 233 /* SwitchStatement */: return true; - case 218 /* Block */: { + case 219 /* Block */: { var blockParent = context.currentTokenParent.parent; // In a codefix scenario, we can't rely on parents being set. So just always return true. - if (!blockParent || blockParent.kind !== 197 /* ArrowFunction */ && blockParent.kind !== 196 /* FunctionExpression */) { + if (!blockParent || blockParent.kind !== 198 /* ArrowFunction */ && blockParent.kind !== 197 /* FunctionExpression */) { return true; } } @@ -108989,31 +110249,31 @@ var ts; } function isControlDeclContext(context) { switch (context.contextNode.kind) { - case 222 /* IfStatement */: - case 232 /* SwitchStatement */: - case 225 /* ForStatement */: - case 226 /* ForInStatement */: - case 227 /* ForOfStatement */: - case 224 /* WhileStatement */: - case 235 /* TryStatement */: - case 223 /* DoStatement */: - case 231 /* WithStatement */: + case 223 /* IfStatement */: + case 233 /* SwitchStatement */: + case 226 /* ForStatement */: + case 227 /* ForInStatement */: + case 228 /* ForOfStatement */: + case 225 /* WhileStatement */: + case 236 /* TryStatement */: + case 224 /* DoStatement */: + case 232 /* WithStatement */: // TODO // case SyntaxKind.ElseClause: - case 274 /* CatchClause */: + case 275 /* CatchClause */: return true; default: return false; } } function isObjectContext(context) { - return context.contextNode.kind === 188 /* ObjectLiteralExpression */; + return context.contextNode.kind === 189 /* ObjectLiteralExpression */; } function isFunctionCallContext(context) { - return context.contextNode.kind === 191 /* CallExpression */; + return context.contextNode.kind === 192 /* CallExpression */; } function isNewContext(context) { - return context.contextNode.kind === 192 /* NewExpression */; + return context.contextNode.kind === 193 /* NewExpression */; } function isFunctionCallOrNewContext(context) { return isFunctionCallContext(context) || isNewContext(context); @@ -109025,28 +110285,28 @@ var ts; return context.nextTokenSpan.kind !== 23 /* CloseBracketToken */; } function isArrowFunctionContext(context) { - return context.contextNode.kind === 197 /* ArrowFunction */; + return context.contextNode.kind === 198 /* ArrowFunction */; } function isImportTypeContext(context) { - return context.contextNode.kind === 183 /* ImportType */; + return context.contextNode.kind === 184 /* ImportType */; } function isNonJsxSameLineTokenContext(context) { return context.TokensAreOnSameLine() && context.contextNode.kind !== 11 /* JsxText */; } function isNonJsxElementOrFragmentContext(context) { - return context.contextNode.kind !== 260 /* JsxElement */ && context.contextNode.kind !== 264 /* JsxFragment */; + return context.contextNode.kind !== 261 /* JsxElement */ && context.contextNode.kind !== 265 /* JsxFragment */; } function isJsxExpressionContext(context) { - return context.contextNode.kind === 270 /* JsxExpression */ || context.contextNode.kind === 269 /* JsxSpreadAttribute */; + return context.contextNode.kind === 271 /* JsxExpression */ || context.contextNode.kind === 270 /* JsxSpreadAttribute */; } function isNextTokenParentJsxAttribute(context) { - return context.nextTokenParent.kind === 267 /* JsxAttribute */; + return context.nextTokenParent.kind === 268 /* JsxAttribute */; } function isJsxAttributeContext(context) { - return context.contextNode.kind === 267 /* JsxAttribute */; + return context.contextNode.kind === 268 /* JsxAttribute */; } function isJsxSelfClosingElementContext(context) { - return context.contextNode.kind === 261 /* JsxSelfClosingElement */; + return context.contextNode.kind === 262 /* JsxSelfClosingElement */; } function isNotBeforeBlockInFunctionDeclarationContext(context) { return !isFunctionDeclContext(context) && !isBeforeBlockContext(context); @@ -109061,45 +110321,45 @@ var ts; while (ts.isExpressionNode(node)) { node = node.parent; } - return node.kind === 152 /* Decorator */; + return node.kind === 153 /* Decorator */; } function isStartOfVariableDeclarationList(context) { - return context.currentTokenParent.kind === 238 /* VariableDeclarationList */ && + return context.currentTokenParent.kind === 239 /* VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; } function isNotFormatOnEnter(context) { return context.formattingRequestKind !== 2 /* FormatOnEnter */; } function isModuleDeclContext(context) { - return context.contextNode.kind === 244 /* ModuleDeclaration */; + return context.contextNode.kind === 245 /* ModuleDeclaration */; } function isObjectTypeContext(context) { - return context.contextNode.kind === 168 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; + return context.contextNode.kind === 169 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; } function isConstructorSignatureContext(context) { - return context.contextNode.kind === 161 /* ConstructSignature */; + return context.contextNode.kind === 162 /* ConstructSignature */; } function isTypeArgumentOrParameterOrAssertion(token, parent) { if (token.kind !== 28 /* LessThanToken */ && token.kind !== 30 /* GreaterThanToken */) { return false; } switch (parent.kind) { - case 164 /* TypeReference */: - case 194 /* TypeAssertionExpression */: - case 242 /* TypeAliasDeclaration */: - case 240 /* ClassDeclaration */: - case 209 /* ClassExpression */: - case 241 /* InterfaceDeclaration */: - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: - case 160 /* CallSignature */: - case 161 /* ConstructSignature */: - case 191 /* CallExpression */: - case 192 /* NewExpression */: - case 211 /* ExpressionWithTypeArguments */: + case 165 /* TypeReference */: + case 195 /* TypeAssertionExpression */: + case 243 /* TypeAliasDeclaration */: + case 241 /* ClassDeclaration */: + case 210 /* ClassExpression */: + case 242 /* InterfaceDeclaration */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: + case 161 /* CallSignature */: + case 162 /* ConstructSignature */: + case 192 /* CallExpression */: + case 193 /* NewExpression */: + case 212 /* ExpressionWithTypeArguments */: return true; default: return false; @@ -109110,16 +110370,16 @@ var ts; isTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); } function isTypeAssertionContext(context) { - return context.contextNode.kind === 194 /* TypeAssertionExpression */; + return context.contextNode.kind === 195 /* TypeAssertionExpression */; } function isVoidOpContext(context) { - return context.currentTokenSpan.kind === 106 /* VoidKeyword */ && context.currentTokenParent.kind === 200 /* VoidExpression */; + return context.currentTokenSpan.kind === 107 /* VoidKeyword */ && context.currentTokenParent.kind === 201 /* VoidExpression */; } function isYieldOrYieldStarWithOperand(context) { - return context.contextNode.kind === 207 /* YieldExpression */ && context.contextNode.expression !== undefined; + return context.contextNode.kind === 208 /* YieldExpression */ && context.contextNode.expression !== undefined; } function isNonNullAssertionContext(context) { - return context.contextNode.kind === 213 /* NonNullExpression */; + return context.contextNode.kind === 214 /* NonNullExpression */; } })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -109170,12 +110430,12 @@ var ts; return map; } function getRuleBucketIndex(row, column) { - ts.Debug.assert(row <= 147 /* LastKeyword */ && column <= 147 /* LastKeyword */, "Must compute formatting context from tokens"); + ts.Debug.assert(row <= 148 /* LastKeyword */ && column <= 148 /* LastKeyword */, "Must compute formatting context from tokens"); return (row * mapRowLength) + column; } var maskBitSize = 5; var mask = 31; // MaskBitSize bits - var mapRowLength = 147 /* LastToken */ + 1; + var mapRowLength = 148 /* LastToken */ + 1; var RulesPosition; (function (RulesPosition) { RulesPosition[RulesPosition["IgnoreRulesSpecific"] = 0] = "IgnoreRulesSpecific"; @@ -109353,17 +110613,17 @@ var ts; // i.e. parent is class declaration with the list of members and node is one of members. function isListElement(parent, node) { switch (parent.kind) { - case 240 /* ClassDeclaration */: - case 241 /* InterfaceDeclaration */: + case 241 /* ClassDeclaration */: + case 242 /* InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: var body = parent.body; - return !!body && body.kind === 245 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node); - case 284 /* SourceFile */: - case 218 /* Block */: - case 245 /* ModuleBlock */: + return !!body && body.kind === 246 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node); + case 285 /* SourceFile */: + case 219 /* Block */: + case 246 /* ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 274 /* CatchClause */: + case 275 /* CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -109585,19 +110845,19 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 240 /* ClassDeclaration */: return 76 /* ClassKeyword */; - case 241 /* InterfaceDeclaration */: return 110 /* InterfaceKeyword */; - case 239 /* FunctionDeclaration */: return 90 /* FunctionKeyword */; - case 243 /* EnumDeclaration */: return 243 /* EnumDeclaration */; - case 158 /* GetAccessor */: return 126 /* GetKeyword */; - case 159 /* SetAccessor */: return 137 /* SetKeyword */; - case 156 /* MethodDeclaration */: + case 241 /* ClassDeclaration */: return 77 /* ClassKeyword */; + case 242 /* InterfaceDeclaration */: return 111 /* InterfaceKeyword */; + case 240 /* FunctionDeclaration */: return 91 /* FunctionKeyword */; + case 244 /* EnumDeclaration */: return 244 /* EnumDeclaration */; + case 159 /* GetAccessor */: return 127 /* GetKeyword */; + case 160 /* SetAccessor */: return 138 /* SetKeyword */; + case 157 /* MethodDeclaration */: if (node.asteriskToken) { return 40 /* AsteriskToken */; } // falls through - case 154 /* PropertyDeclaration */: - case 151 /* Parameter */: + case 155 /* PropertyDeclaration */: + case 152 /* Parameter */: var name = ts.getNameOfDeclaration(node); if (name) { return name.kind; @@ -109647,22 +110907,22 @@ var ts; case 18 /* OpenBraceToken */: case 19 /* CloseBraceToken */: case 21 /* CloseParenToken */: - case 83 /* ElseKeyword */: - case 107 /* WhileKeyword */: + case 84 /* ElseKeyword */: + case 108 /* WhileKeyword */: case 58 /* AtToken */: return false; case 42 /* SlashToken */: case 30 /* GreaterThanToken */: switch (container.kind) { - case 262 /* JsxOpeningElement */: - case 263 /* JsxClosingElement */: - case 261 /* JsxSelfClosingElement */: + case 263 /* JsxOpeningElement */: + case 264 /* JsxClosingElement */: + case 262 /* JsxSelfClosingElement */: return false; } break; case 22 /* OpenBracketToken */: case 23 /* CloseBracketToken */: - if (container.kind !== 181 /* MappedType */) { + if (container.kind !== 182 /* MappedType */) { return false; } break; @@ -109754,7 +111014,7 @@ var ts; consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child); return inheritedIndentation; } - var effectiveParentStartLine = child.kind === 152 /* Decorator */ ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 153 /* Decorator */ ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); if (child.kind === 11 /* JsxText */) { @@ -109762,7 +111022,7 @@ var ts; indentMultilineCommentOrJsxText(range, childIndentation.indentation, /*firstLineIsIndented*/ true, /*indentFinalLine*/ false); } childContextNode = node; - if (isFirstListItem && parent.kind === 187 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) { + if (isFirstListItem && parent.kind === 188 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) { inheritedIndentation = childIndentation.indentation; } return inheritedIndentation; @@ -110180,12 +111440,12 @@ var ts; formatting.getRangeOfEnclosingComment = getRangeOfEnclosingComment; function getOpenTokenForList(node, list) { switch (node.kind) { - case 157 /* Constructor */: - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: - case 197 /* ArrowFunction */: + case 158 /* Constructor */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: + case 198 /* ArrowFunction */: if (node.typeParameters === list) { return 28 /* LessThanToken */; } @@ -110193,8 +111453,8 @@ var ts; return 20 /* OpenParenToken */; } break; - case 191 /* CallExpression */: - case 192 /* NewExpression */: + case 192 /* CallExpression */: + case 193 /* NewExpression */: if (node.typeArguments === list) { return 28 /* LessThanToken */; } @@ -110202,12 +111462,12 @@ var ts; return 20 /* OpenParenToken */; } break; - case 164 /* TypeReference */: + case 165 /* TypeReference */: if (node.typeArguments === list) { return 28 /* LessThanToken */; } break; - case 168 /* TypeLiteral */: + case 169 /* TypeLiteral */: return 18 /* OpenBraceToken */; } return 0 /* Unknown */; @@ -110324,7 +111584,7 @@ var ts; if (options.indentStyle === ts.IndentStyle.Block) { return getBlockIndent(sourceFile, position, options); } - if (precedingToken.kind === 27 /* CommaToken */ && precedingToken.parent.kind !== 204 /* BinaryExpression */) { + if (precedingToken.kind === 27 /* CommaToken */ && precedingToken.parent.kind !== 205 /* BinaryExpression */) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1 /* Unknown */) { @@ -110478,7 +111738,7 @@ var ts; // - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually // - parent and child are not on the same line var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) && - (parent.kind === 284 /* SourceFile */ || !parentAndChildShareLine); + (parent.kind === 285 /* SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Unknown */; } @@ -110526,8 +111786,8 @@ var ts; } SmartIndenter.isArgumentAndStartLineOverlapsExpressionBeingCalled = isArgumentAndStartLineOverlapsExpressionBeingCalled; function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 222 /* IfStatement */ && parent.elseStatement === child) { - var elseKeyword = ts.findChildOfKind(parent, 83 /* ElseKeyword */, sourceFile); + if (parent.kind === 223 /* IfStatement */ && parent.elseStatement === child) { + var elseKeyword = ts.findChildOfKind(parent, 84 /* ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; return elseKeywordStartLine === childStartLine; @@ -110544,40 +111804,40 @@ var ts; } function getListByRange(start, end, node, sourceFile) { switch (node.kind) { - case 164 /* TypeReference */: + case 165 /* TypeReference */: return getList(node.typeArguments); - case 188 /* ObjectLiteralExpression */: + case 189 /* ObjectLiteralExpression */: return getList(node.properties); - case 187 /* ArrayLiteralExpression */: + case 188 /* ArrayLiteralExpression */: return getList(node.elements); - case 168 /* TypeLiteral */: + case 169 /* TypeLiteral */: return getList(node.members); - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: - case 160 /* CallSignature */: - case 157 /* Constructor */: - case 166 /* ConstructorType */: - case 161 /* ConstructSignature */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: + case 161 /* CallSignature */: + case 158 /* Constructor */: + case 167 /* ConstructorType */: + case 162 /* ConstructSignature */: return getList(node.typeParameters) || getList(node.parameters); - case 240 /* ClassDeclaration */: - case 209 /* ClassExpression */: - case 241 /* InterfaceDeclaration */: - case 242 /* TypeAliasDeclaration */: - case 308 /* JSDocTemplateTag */: + case 241 /* ClassDeclaration */: + case 210 /* ClassExpression */: + case 242 /* InterfaceDeclaration */: + case 243 /* TypeAliasDeclaration */: + case 309 /* JSDocTemplateTag */: return getList(node.typeParameters); - case 192 /* NewExpression */: - case 191 /* CallExpression */: + case 193 /* NewExpression */: + case 192 /* CallExpression */: return getList(node.typeArguments) || getList(node.arguments); - case 238 /* VariableDeclarationList */: + case 239 /* VariableDeclarationList */: return getList(node.declarations); - case 252 /* NamedImports */: - case 256 /* NamedExports */: + case 253 /* NamedImports */: + case 257 /* NamedExports */: return getList(node.elements); - case 184 /* ObjectBindingPattern */: - case 185 /* ArrayBindingPattern */: + case 185 /* ObjectBindingPattern */: + case 186 /* ArrayBindingPattern */: return getList(node.elements); } function getList(list) { @@ -110600,7 +111860,7 @@ var ts; return findColumnForFirstNonWhitespaceCharacterInLine(sourceFile.getLineAndCharacterOfPosition(list.pos), sourceFile, options); } function getActualIndentationForListItem(node, sourceFile, options, listIndentsChild) { - if (node.parent && node.parent.kind === 238 /* VariableDeclarationList */) { + if (node.parent && node.parent.kind === 239 /* VariableDeclarationList */) { // VariableDeclarationList has no wrapping tokens return -1 /* Unknown */; } @@ -110673,83 +111933,83 @@ var ts; function nodeWillIndentChild(settings, parent, child, sourceFile, indentByDefault) { var childKind = child ? child.kind : 0 /* Unknown */; switch (parent.kind) { - case 221 /* ExpressionStatement */: - case 240 /* ClassDeclaration */: - case 209 /* ClassExpression */: - case 241 /* InterfaceDeclaration */: - case 243 /* EnumDeclaration */: - case 242 /* TypeAliasDeclaration */: - case 187 /* ArrayLiteralExpression */: - case 218 /* Block */: - case 245 /* ModuleBlock */: - case 188 /* ObjectLiteralExpression */: - case 168 /* TypeLiteral */: - case 181 /* MappedType */: - case 170 /* TupleType */: - case 246 /* CaseBlock */: - case 272 /* DefaultClause */: - case 271 /* CaseClause */: - case 195 /* ParenthesizedExpression */: - case 189 /* PropertyAccessExpression */: - case 191 /* CallExpression */: - case 192 /* NewExpression */: - case 219 /* VariableStatement */: - case 254 /* ExportAssignment */: - case 230 /* ReturnStatement */: - case 205 /* ConditionalExpression */: - case 185 /* ArrayBindingPattern */: - case 184 /* ObjectBindingPattern */: - case 262 /* JsxOpeningElement */: - case 265 /* JsxOpeningFragment */: - case 261 /* JsxSelfClosingElement */: - case 270 /* JsxExpression */: - case 155 /* MethodSignature */: - case 160 /* CallSignature */: - case 161 /* ConstructSignature */: - case 151 /* Parameter */: - case 165 /* FunctionType */: - case 166 /* ConstructorType */: - case 177 /* ParenthesizedType */: - case 193 /* TaggedTemplateExpression */: - case 201 /* AwaitExpression */: - case 256 /* NamedExports */: - case 252 /* NamedImports */: - case 257 /* ExportSpecifier */: - case 253 /* ImportSpecifier */: - case 154 /* PropertyDeclaration */: + case 222 /* ExpressionStatement */: + case 241 /* ClassDeclaration */: + case 210 /* ClassExpression */: + case 242 /* InterfaceDeclaration */: + case 244 /* EnumDeclaration */: + case 243 /* TypeAliasDeclaration */: + case 188 /* ArrayLiteralExpression */: + case 219 /* Block */: + case 246 /* ModuleBlock */: + case 189 /* ObjectLiteralExpression */: + case 169 /* TypeLiteral */: + case 182 /* MappedType */: + case 171 /* TupleType */: + case 247 /* CaseBlock */: + case 273 /* DefaultClause */: + case 272 /* CaseClause */: + case 196 /* ParenthesizedExpression */: + case 190 /* PropertyAccessExpression */: + case 192 /* CallExpression */: + case 193 /* NewExpression */: + case 220 /* VariableStatement */: + case 255 /* ExportAssignment */: + case 231 /* ReturnStatement */: + case 206 /* ConditionalExpression */: + case 186 /* ArrayBindingPattern */: + case 185 /* ObjectBindingPattern */: + case 263 /* JsxOpeningElement */: + case 266 /* JsxOpeningFragment */: + case 262 /* JsxSelfClosingElement */: + case 271 /* JsxExpression */: + case 156 /* MethodSignature */: + case 161 /* CallSignature */: + case 162 /* ConstructSignature */: + case 152 /* Parameter */: + case 166 /* FunctionType */: + case 167 /* ConstructorType */: + case 178 /* ParenthesizedType */: + case 194 /* TaggedTemplateExpression */: + case 202 /* AwaitExpression */: + case 257 /* NamedExports */: + case 253 /* NamedImports */: + case 258 /* ExportSpecifier */: + case 254 /* ImportSpecifier */: + case 155 /* PropertyDeclaration */: return true; - case 237 /* VariableDeclaration */: - case 275 /* PropertyAssignment */: - if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 188 /* ObjectLiteralExpression */) { // TODO: GH#18217 + case 238 /* VariableDeclaration */: + case 276 /* PropertyAssignment */: + if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 189 /* ObjectLiteralExpression */) { // TODO: GH#18217 return rangeIsOnOneLine(sourceFile, child); } return true; - case 223 /* DoStatement */: - case 224 /* WhileStatement */: - case 226 /* ForInStatement */: - case 227 /* ForOfStatement */: - case 225 /* ForStatement */: - case 222 /* IfStatement */: - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: - case 156 /* MethodDeclaration */: - case 197 /* ArrowFunction */: - case 157 /* Constructor */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - return childKind !== 218 /* Block */; - case 255 /* ExportDeclaration */: - return childKind !== 256 /* NamedExports */; - case 249 /* ImportDeclaration */: - return childKind !== 250 /* ImportClause */ || - (!!child.namedBindings && child.namedBindings.kind !== 252 /* NamedImports */); - case 260 /* JsxElement */: - return childKind !== 263 /* JsxClosingElement */; - case 264 /* JsxFragment */: - return childKind !== 266 /* JsxClosingFragment */; - case 174 /* IntersectionType */: - case 173 /* UnionType */: - if (childKind === 168 /* TypeLiteral */) { + case 224 /* DoStatement */: + case 225 /* WhileStatement */: + case 227 /* ForInStatement */: + case 228 /* ForOfStatement */: + case 226 /* ForStatement */: + case 223 /* IfStatement */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: + case 157 /* MethodDeclaration */: + case 198 /* ArrowFunction */: + case 158 /* Constructor */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + return childKind !== 219 /* Block */; + case 256 /* ExportDeclaration */: + return childKind !== 257 /* NamedExports */; + case 250 /* ImportDeclaration */: + return childKind !== 251 /* ImportClause */ || + (!!child.namedBindings && child.namedBindings.kind !== 253 /* NamedImports */); + case 261 /* JsxElement */: + return childKind !== 264 /* JsxClosingElement */; + case 265 /* JsxFragment */: + return childKind !== 267 /* JsxClosingFragment */; + case 175 /* IntersectionType */: + case 174 /* UnionType */: + if (childKind === 169 /* TypeLiteral */) { return false; } // falls through @@ -110760,11 +112020,11 @@ var ts; SmartIndenter.nodeWillIndentChild = nodeWillIndentChild; function isControlFlowEndingStatement(kind, parent) { switch (kind) { - case 230 /* ReturnStatement */: - case 234 /* ThrowStatement */: - case 228 /* ContinueStatement */: - case 229 /* BreakStatement */: - return parent.kind !== 218 /* Block */; + case 231 /* ReturnStatement */: + case 235 /* ThrowStatement */: + case 229 /* ContinueStatement */: + case 230 /* BreakStatement */: + return parent.kind !== 219 /* Block */; default: return false; } @@ -110906,7 +112166,7 @@ var ts; * Checks if 'candidate' argument is a legal separator in the list that contains 'node' as an element */ function isSeparator(node, candidate) { - return !!candidate && !!node.parent && (candidate.kind === 27 /* CommaToken */ || (candidate.kind === 26 /* SemicolonToken */ && node.parent.kind === 188 /* ObjectLiteralExpression */)); + return !!candidate && !!node.parent && (candidate.kind === 27 /* CommaToken */ || (candidate.kind === 26 /* SemicolonToken */ && node.parent.kind === 189 /* ObjectLiteralExpression */)); } function spaces(count) { var s = ""; @@ -111067,7 +112327,7 @@ var ts; } } else { - endNode = node.kind !== 237 /* VariableDeclaration */ && node.questionToken ? node.questionToken : node.name; + endNode = node.kind !== 238 /* VariableDeclaration */ && node.questionToken ? node.questionToken : node.name; } this.insertNodeAt(sourceFile, endNode.end, type, { prefix: ": " }); }; @@ -111179,18 +112439,18 @@ var ts; }; ChangeTracker.prototype.getInsertNodeAfterOptionsWorker = function (node) { switch (node.kind) { - case 240 /* ClassDeclaration */: - case 244 /* ModuleDeclaration */: + case 241 /* ClassDeclaration */: + case 245 /* ModuleDeclaration */: return { prefix: this.newLineCharacter, suffix: this.newLineCharacter }; - case 237 /* VariableDeclaration */: + case 238 /* VariableDeclaration */: case 10 /* StringLiteral */: - case 72 /* Identifier */: + case 73 /* Identifier */: return { prefix: ", " }; - case 275 /* PropertyAssignment */: + case 276 /* PropertyAssignment */: return { suffix: "," + this.newLineCharacter }; - case 85 /* ExportKeyword */: + case 86 /* ExportKeyword */: return { prefix: " " }; - case 151 /* Parameter */: + case 152 /* Parameter */: return {}; default: ts.Debug.assert(ts.isStatement(node) || ts.isClassOrTypeElement(node)); // Else we haven't handled this kind of node yet -- add it @@ -111199,12 +112459,12 @@ var ts; }; ChangeTracker.prototype.insertName = function (sourceFile, node, name) { ts.Debug.assert(!node.name); - if (node.kind === 197 /* ArrowFunction */) { + if (node.kind === 198 /* ArrowFunction */) { var arrow = ts.findChildOfKind(node, 37 /* EqualsGreaterThanToken */, sourceFile); var lparen = ts.findChildOfKind(node, 20 /* OpenParenToken */, sourceFile); if (lparen) { // `() => {}` --> `function f() {}` - this.insertNodesAt(sourceFile, lparen.getStart(sourceFile), [ts.createToken(90 /* FunctionKeyword */), ts.createIdentifier(name)], { joiner: " " }); + this.insertNodesAt(sourceFile, lparen.getStart(sourceFile), [ts.createToken(91 /* FunctionKeyword */), ts.createIdentifier(name)], { joiner: " " }); deleteNode(this, sourceFile, arrow); } else { @@ -111213,14 +112473,14 @@ var ts; // Replacing full range of arrow to get rid of the leading space -- replace ` =>` with `)` this.replaceRange(sourceFile, arrow, ts.createToken(21 /* CloseParenToken */)); } - if (node.body.kind !== 218 /* Block */) { + if (node.body.kind !== 219 /* Block */) { // `() => 0` => `function f() { return 0; }` - this.insertNodesAt(sourceFile, node.body.getStart(sourceFile), [ts.createToken(18 /* OpenBraceToken */), ts.createToken(97 /* ReturnKeyword */)], { joiner: " ", suffix: " " }); + this.insertNodesAt(sourceFile, node.body.getStart(sourceFile), [ts.createToken(18 /* OpenBraceToken */), ts.createToken(98 /* ReturnKeyword */)], { joiner: " ", suffix: " " }); this.insertNodesAt(sourceFile, node.body.end, [ts.createToken(26 /* SemicolonToken */), ts.createToken(19 /* CloseBraceToken */)], { joiner: " " }); } } else { - var pos = ts.findChildOfKind(node, node.kind === 196 /* FunctionExpression */ ? 90 /* FunctionKeyword */ : 76 /* ClassKeyword */, sourceFile).end; + var pos = ts.findChildOfKind(node, node.kind === 197 /* FunctionExpression */ ? 91 /* FunctionKeyword */ : 77 /* ClassKeyword */, sourceFile).end; this.insertNodeAt(sourceFile, pos, ts.createIdentifier(name), { prefix: " " }); } }; @@ -111447,7 +112707,7 @@ var ts; function newFileChangesWorker(oldFile, scriptKind, statements, newLineCharacter, formatContext) { // TODO: this emits the file, parses it back, then formats it that -- may be a less roundabout way to do this var nonFormattedText = statements.map(function (s) { return getNonformattedText(s, oldFile, newLineCharacter).text; }).join(newLineCharacter); - var sourceFile = ts.createSourceFile("any file name", nonFormattedText, 7 /* ESNext */, /*setParentNodes*/ true, scriptKind); + var sourceFile = ts.createSourceFile("any file name", nonFormattedText, 8 /* ESNext */, /*setParentNodes*/ true, scriptKind); var changes = ts.formatting.formatDocument(sourceFile, formatContext); return applyChanges(nonFormattedText, changes) + newLineCharacter; } @@ -111715,14 +112975,14 @@ var ts; } textChanges_3.isValidLocationToAddComment = isValidLocationToAddComment; function needSemicolonBetween(a, b) { - return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 149 /* ComputedPropertyName */ + return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 150 /* ComputedPropertyName */ || ts.isStatementButNotDeclaration(a) && ts.isStatementButNotDeclaration(b); // TODO: only if b would start with a `(` or `[` } var deleteDeclaration; (function (deleteDeclaration_1) { function deleteDeclaration(changes, deletedNodesInLists, sourceFile, node) { switch (node.kind) { - case 151 /* Parameter */: { + case 152 /* Parameter */: { var oldFunction = node.parent; if (ts.isArrowFunction(oldFunction) && oldFunction.parameters.length === 1 && @@ -111737,14 +112997,14 @@ var ts; } break; } - case 249 /* ImportDeclaration */: + case 250 /* ImportDeclaration */: deleteNode(changes, sourceFile, node, // For first import, leave header comment in place node === sourceFile.imports[0].parent ? { leadingTriviaOption: LeadingTriviaOption.Exclude } : undefined); break; - case 186 /* BindingElement */: + case 187 /* BindingElement */: var pattern = node.parent; - var preserveComma = pattern.kind === 185 /* ArrayBindingPattern */ && node !== ts.last(pattern.elements); + var preserveComma = pattern.kind === 186 /* ArrayBindingPattern */ && node !== ts.last(pattern.elements); if (preserveComma) { deleteNode(changes, sourceFile, node); } @@ -111752,13 +113012,13 @@ var ts; deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } break; - case 237 /* VariableDeclaration */: + case 238 /* VariableDeclaration */: deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node); break; - case 150 /* TypeParameter */: + case 151 /* TypeParameter */: deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); break; - case 253 /* ImportSpecifier */: + case 254 /* ImportSpecifier */: var namedImports = node.parent; if (namedImports.elements.length === 1) { deleteImportBinding(changes, sourceFile, namedImports); @@ -111767,7 +113027,7 @@ var ts; deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } break; - case 251 /* NamespaceImport */: + case 252 /* NamespaceImport */: deleteImportBinding(changes, sourceFile, node); break; default: @@ -111814,13 +113074,13 @@ var ts; // Delete the entire import declaration // |import * as ns from './file'| // |import { a } from './file'| - var importDecl = ts.getAncestor(node, 249 /* ImportDeclaration */); + var importDecl = ts.getAncestor(node, 250 /* ImportDeclaration */); deleteNode(changes, sourceFile, importDecl); } } function deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node) { var parent = node.parent; - if (parent.kind === 274 /* CatchClause */) { + if (parent.kind === 275 /* CatchClause */) { // TODO: There's currently no unused diagnostic for this, could be a suggestion changes.deleteNodeRange(sourceFile, ts.findChildOfKind(parent, 20 /* OpenParenToken */, sourceFile), ts.findChildOfKind(parent, 21 /* CloseParenToken */, sourceFile)); return; @@ -111831,14 +113091,14 @@ var ts; } var gp = parent.parent; switch (gp.kind) { - case 227 /* ForOfStatement */: - case 226 /* ForInStatement */: + case 228 /* ForOfStatement */: + case 227 /* ForInStatement */: changes.replaceNode(sourceFile, node, ts.createObjectLiteral()); break; - case 225 /* ForStatement */: + case 226 /* ForStatement */: deleteNode(changes, sourceFile, parent); break; - case 219 /* VariableStatement */: + case 220 /* VariableStatement */: deleteNode(changes, sourceFile, gp); break; default: @@ -112001,8 +113261,8 @@ var ts; var token = ts.getTokenAtPosition(sourceFile, pos); var assertion = ts.Debug.assertDefined(ts.findAncestor(token, function (n) { return ts.isAsExpression(n) || ts.isTypeAssertion(n); })); var replacement = ts.isAsExpression(assertion) - ? ts.createAsExpression(assertion.expression, ts.createKeywordTypeNode(143 /* UnknownKeyword */)) - : ts.createTypeAssertion(ts.createKeywordTypeNode(143 /* UnknownKeyword */), assertion.expression); + ? ts.createAsExpression(assertion.expression, ts.createKeywordTypeNode(144 /* UnknownKeyword */)) + : ts.createTypeAssertion(ts.createKeywordTypeNode(144 /* UnknownKeyword */), assertion.expression); changeTracker.replaceNode(sourceFile, assertion.expression, replacement); } })(codefix = ts.codefix || (ts.codefix = {})); @@ -112051,11 +113311,11 @@ var ts; function makeChange(changeTracker, sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); if (!ts.isIdentifier(token)) { - return ts.Debug.fail("add-name-to-nameless-parameter operates on identifiers, but got a " + ts.formatSyntaxKind(token.kind)); + return ts.Debug.fail("add-name-to-nameless-parameter operates on identifiers, but got a " + ts.Debug.formatSyntaxKind(token.kind)); } var param = token.parent; if (!ts.isParameter(param)) { - return ts.Debug.fail("Tried to add a parameter name to a non-parameter: " + ts.formatSyntaxKind(token.kind)); + return ts.Debug.fail("Tried to add a parameter name to a non-parameter: " + ts.Debug.formatSyntaxKind(token.kind)); } var i = param.parent.parameters.indexOf(param); ts.Debug.assert(!param.type, "Tried to add a parameter name to a parameter that already had one."); @@ -112137,26 +113397,26 @@ var ts; } function isDeclarationWithType(node) { return ts.isFunctionLikeDeclaration(node) || - node.kind === 237 /* VariableDeclaration */ || - node.kind === 153 /* PropertySignature */ || - node.kind === 154 /* PropertyDeclaration */; + node.kind === 238 /* VariableDeclaration */ || + node.kind === 154 /* PropertySignature */ || + node.kind === 155 /* PropertyDeclaration */; } function transformJSDocType(node) { switch (node.kind) { - case 289 /* JSDocAllType */: - case 290 /* JSDocUnknownType */: + case 290 /* JSDocAllType */: + case 291 /* JSDocUnknownType */: return ts.createTypeReferenceNode("any", ts.emptyArray); - case 293 /* JSDocOptionalType */: + case 294 /* JSDocOptionalType */: return transformJSDocOptionalType(node); - case 292 /* JSDocNonNullableType */: + case 293 /* JSDocNonNullableType */: return transformJSDocType(node.type); - case 291 /* JSDocNullableType */: + case 292 /* JSDocNullableType */: return transformJSDocNullableType(node); - case 295 /* JSDocVariadicType */: + case 296 /* JSDocVariadicType */: return transformJSDocVariadicType(node); - case 294 /* JSDocFunctionType */: + case 295 /* JSDocFunctionType */: return transformJSDocFunctionType(node); - case 164 /* TypeReference */: + case 165 /* TypeReference */: return transformJSDocTypeReference(node); default: var visited = ts.visitEachChild(node, transformJSDocType, /*context*/ undefined); // TODO: GH#18217 @@ -112178,7 +113438,7 @@ var ts; } function transformJSDocParameter(node) { var index = node.parent.parameters.indexOf(node); - var isRest = node.type.kind === 295 /* JSDocVariadicType */ && index === node.parent.parameters.length - 1; // TODO: GH#18217 + var isRest = node.type.kind === 296 /* JSDocVariadicType */ && index === node.parent.parameters.length - 1; // TODO: GH#18217 var name = node.name || (isRest ? "rest" : "arg" + index); var dotdotdot = isRest ? ts.createToken(25 /* DotDotDotToken */) : node.dotDotDotToken; return ts.createParameter(node.decorators, node.modifiers, dotdotdot, name, node.questionToken, ts.visitNode(node.type, transformJSDocType), node.initializer); @@ -112218,8 +113478,8 @@ var ts; var index = ts.createParameter( /*decorators*/ undefined, /*modifiers*/ undefined, - /*dotDotDotToken*/ undefined, node.typeArguments[0].kind === 135 /* NumberKeyword */ ? "n" : "s", - /*questionToken*/ undefined, ts.createTypeReferenceNode(node.typeArguments[0].kind === 135 /* NumberKeyword */ ? "number" : "string", []), + /*dotDotDotToken*/ undefined, node.typeArguments[0].kind === 136 /* NumberKeyword */ ? "n" : "s", + /*questionToken*/ undefined, ts.createTypeReferenceNode(node.typeArguments[0].kind === 136 /* NumberKeyword */ ? "number" : "string", []), /*initializer*/ undefined); var indexSignature = ts.createTypeLiteralNode([ts.createIndexSignature(/*decorators*/ undefined, /*modifiers*/ undefined, [index], node.typeArguments[1])]); ts.setEmitFlags(indexSignature, 1 /* SingleLine */); @@ -112319,7 +113579,7 @@ var ts; return errorCode; } function doChange(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen, host) { - if (!ts.isParameterPropertyModifier(token.kind) && token.kind !== 72 /* Identifier */ && token.kind !== 25 /* DotDotDotToken */ && token.kind !== 100 /* ThisKeyword */) { + if (!ts.isParameterPropertyModifier(token.kind) && token.kind !== 73 /* Identifier */ && token.kind !== 25 /* DotDotDotToken */ && token.kind !== 101 /* ThisKeyword */) { return undefined; } var parent = token.parent; @@ -112440,7 +113700,7 @@ var ts; function annotate(changes, sourceFile, declaration, type, program, host) { var typeNode = ts.getTypeNodeIfAccessible(type, declaration, program, host); if (typeNode) { - if (ts.isInJSFile(sourceFile) && declaration.kind !== 153 /* PropertySignature */) { + if (ts.isInJSFile(sourceFile) && declaration.kind !== 154 /* PropertySignature */) { var parent = ts.isVariableDeclaration(declaration) ? ts.tryCast(declaration.parent.parent, ts.isVariableStatement) : declaration; if (!parent) { return; @@ -112481,13 +113741,13 @@ var ts; return !!merged; }); }); var tag = ts.createJSDocComment(comments.join("\n"), ts.createNodeArray((oldTags || ts.emptyArray).concat(unmergedNewTags))); - var jsDocNode = parent.kind === 197 /* ArrowFunction */ ? getJsDocNodeForArrowFunction(parent) : parent; + var jsDocNode = parent.kind === 198 /* ArrowFunction */ ? getJsDocNodeForArrowFunction(parent) : parent; jsDocNode.jsDoc = parent.jsDoc; jsDocNode.jsDocCache = parent.jsDocCache; changes.insertJsdocCommentBefore(sourceFile, jsDocNode, tag); } function getJsDocNodeForArrowFunction(signature) { - if (signature.parent.kind === 154 /* PropertyDeclaration */) { + if (signature.parent.kind === 155 /* PropertyDeclaration */) { return signature.parent; } return signature.parent.parent; @@ -112497,14 +113757,14 @@ var ts; return undefined; } switch (oldTag.kind) { - case 304 /* JSDocParameterTag */: { + case 305 /* JSDocParameterTag */: { var oldParam = oldTag; var newParam = newTag; return ts.isIdentifier(oldParam.name) && ts.isIdentifier(newParam.name) && oldParam.name.escapedText === newParam.name.escapedText ? ts.createJSDocParamTag(newParam.name, newParam.isBracketed, newParam.typeExpression, oldParam.comment) : undefined; } - case 305 /* JSDocReturnTag */: + case 306 /* JSDocReturnTag */: return ts.createJSDocReturnTag(newTag.typeExpression, oldTag.comment); } } @@ -112523,18 +113783,18 @@ var ts; function inferTypeForParametersFromUsage(containingFunction, sourceFile, program, cancellationToken) { var searchToken; switch (containingFunction.kind) { - case 157 /* Constructor */: - searchToken = ts.findChildOfKind(containingFunction, 124 /* ConstructorKeyword */, sourceFile); + case 158 /* Constructor */: + searchToken = ts.findChildOfKind(containingFunction, 125 /* ConstructorKeyword */, sourceFile); break; - case 197 /* ArrowFunction */: - case 196 /* FunctionExpression */: + case 198 /* ArrowFunction */: + case 197 /* FunctionExpression */: var parent = containingFunction.parent; searchToken = ts.isVariableDeclaration(parent) && ts.isIdentifier(parent.name) ? parent.name : containingFunction.name; break; - case 239 /* FunctionDeclaration */: - case 156 /* MethodDeclaration */: + case 240 /* FunctionDeclaration */: + case 157 /* MethodDeclaration */: searchToken = containingFunction.name; break; } @@ -112606,21 +113866,21 @@ var ts; node = node.parent; } switch (node.parent.kind) { - case 203 /* PostfixUnaryExpression */: + case 204 /* PostfixUnaryExpression */: usageContext.isNumber = true; break; - case 202 /* PrefixUnaryExpression */: + case 203 /* PrefixUnaryExpression */: inferTypeFromPrefixUnaryExpressionContext(node.parent, usageContext); break; - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: inferTypeFromBinaryExpressionContext(node, node.parent, checker, usageContext); break; - case 271 /* CaseClause */: - case 272 /* DefaultClause */: + case 272 /* CaseClause */: + case 273 /* DefaultClause */: inferTypeFromSwitchStatementLabelContext(node.parent, checker, usageContext); break; - case 191 /* CallExpression */: - case 192 /* NewExpression */: + case 192 /* CallExpression */: + case 193 /* NewExpression */: if (node.parent.expression === node) { inferTypeFromCallExpressionContext(node.parent, checker, usageContext); } @@ -112628,13 +113888,13 @@ var ts; inferTypeFromContextualType(node, checker, usageContext); } break; - case 189 /* PropertyAccessExpression */: + case 190 /* PropertyAccessExpression */: inferTypeFromPropertyAccessExpressionContext(node.parent, checker, usageContext); break; - case 190 /* ElementAccessExpression */: + case 191 /* ElementAccessExpression */: inferTypeFromPropertyElementExpressionContext(node.parent, node, checker, usageContext); break; - case 237 /* VariableDeclaration */: { + case 238 /* VariableDeclaration */: { var _a = node.parent, name = _a.name, initializer = _a.initializer; if (node === name) { if (initializer) { // This can happen for `let x = null;` which still has an implicit-any error. @@ -112685,17 +113945,17 @@ var ts; case 50 /* BarToken */: case 51 /* CaretToken */: // CompoundAssignmentOperator - case 61 /* MinusEqualsToken */: - case 63 /* AsteriskAsteriskEqualsToken */: - case 62 /* AsteriskEqualsToken */: - case 64 /* SlashEqualsToken */: - case 65 /* PercentEqualsToken */: - case 69 /* AmpersandEqualsToken */: - case 70 /* BarEqualsToken */: - case 71 /* CaretEqualsToken */: - case 66 /* LessThanLessThanEqualsToken */: - case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 67 /* GreaterThanGreaterThanEqualsToken */: + case 62 /* MinusEqualsToken */: + case 64 /* AsteriskAsteriskEqualsToken */: + case 63 /* AsteriskEqualsToken */: + case 65 /* SlashEqualsToken */: + case 66 /* PercentEqualsToken */: + case 70 /* AmpersandEqualsToken */: + case 71 /* BarEqualsToken */: + case 72 /* CaretEqualsToken */: + case 67 /* LessThanLessThanEqualsToken */: + case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 68 /* GreaterThanGreaterThanEqualsToken */: // AdditiveOperator case 39 /* MinusToken */: // RelationalOperator @@ -112711,7 +113971,7 @@ var ts; usageContext.isNumber = true; } break; - case 60 /* PlusEqualsToken */: + case 61 /* PlusEqualsToken */: case 38 /* PlusToken */: var otherOperandType = checker.getTypeAtLocation(parent.left === node ? parent.right : parent.left); if (otherOperandType.flags & 1056 /* EnumLike */) { @@ -112728,14 +113988,14 @@ var ts; } break; // AssignmentOperators - case 59 /* EqualsToken */: + case 60 /* EqualsToken */: case 33 /* EqualsEqualsToken */: case 35 /* EqualsEqualsEqualsToken */: case 36 /* ExclamationEqualsEqualsToken */: case 34 /* ExclamationEqualsToken */: addCandidateType(usageContext, checker.getTypeAtLocation(parent.left === node ? parent.right : parent.left)); break; - case 93 /* InKeyword */: + case 94 /* InKeyword */: if (node === parent.left) { usageContext.isString = true; } @@ -112743,7 +114003,7 @@ var ts; // LogicalOperator case 55 /* BarBarToken */: if (node === parent.left && - (node.parent.parent.kind === 237 /* VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) { + (node.parent.parent.kind === 238 /* VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) { // var x = x || {}; // TODO: use getFalsyflagsOfType addCandidateType(usageContext, checker.getTypeAtLocation(parent.right)); @@ -112751,7 +114011,7 @@ var ts; break; case 54 /* AmpersandAmpersandToken */: case 27 /* CommaToken */: - case 94 /* InstanceOfKeyword */: + case 95 /* InstanceOfKeyword */: // nothing to infer here break; } @@ -112771,7 +114031,7 @@ var ts; } } inferTypeFromContext(parent, checker, callContext.returnType); - if (parent.kind === 191 /* CallExpression */) { + if (parent.kind === 192 /* CallExpression */) { (usageContext.callContexts || (usageContext.callContexts = [])).push(callContext); } else { @@ -113011,12 +114271,12 @@ var ts; var precedingNode; var newClassDeclaration; switch (ctorDeclaration.kind) { - case 239 /* FunctionDeclaration */: + case 240 /* FunctionDeclaration */: precedingNode = ctorDeclaration; changes.delete(sourceFile, ctorDeclaration); newClassDeclaration = createClassFromFunctionDeclaration(ctorDeclaration); break; - case 237 /* VariableDeclaration */: + case 238 /* VariableDeclaration */: precedingNode = ctorDeclaration.parent.parent; newClassDeclaration = createClassFromVariableDeclaration(ctorDeclaration); if (ctorDeclaration.parent.declarations.length === 1) { @@ -113048,7 +114308,7 @@ var ts; // all static members are stored in the "exports" array of symbol if (symbol.exports) { symbol.exports.forEach(function (member) { - var memberElement = createClassElement(member, [ts.createToken(116 /* StaticKeyword */)]); + var memberElement = createClassElement(member, [ts.createToken(117 /* StaticKeyword */)]); if (memberElement) { memberElements.push(memberElement); } @@ -113071,7 +114331,7 @@ var ts; return; } // delete the entire statement if this expression is the sole expression to take care of the semicolon at the end - var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 221 /* ExpressionStatement */ + var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 222 /* ExpressionStatement */ ? assignmentBinaryExpression.parent : assignmentBinaryExpression; changes.delete(sourceFile, nodeToDelete); if (!assignmentBinaryExpression.right) { @@ -113079,27 +114339,27 @@ var ts; /*type*/ undefined, /*initializer*/ undefined); } switch (assignmentBinaryExpression.right.kind) { - case 196 /* FunctionExpression */: { + case 197 /* FunctionExpression */: { var functionExpression = assignmentBinaryExpression.right; - var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 121 /* AsyncKeyword */)); + var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 122 /* AsyncKeyword */)); var method = ts.createMethod(/*decorators*/ undefined, fullModifiers, /*asteriskToken*/ undefined, memberDeclaration.name, /*questionToken*/ undefined, /*typeParameters*/ undefined, functionExpression.parameters, /*type*/ undefined, functionExpression.body); ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile); return method; } - case 197 /* ArrowFunction */: { + case 198 /* ArrowFunction */: { var arrowFunction = assignmentBinaryExpression.right; var arrowFunctionBody = arrowFunction.body; var bodyBlock = void 0; // case 1: () => { return [1,2,3] } - if (arrowFunctionBody.kind === 218 /* Block */) { + if (arrowFunctionBody.kind === 219 /* Block */) { bodyBlock = arrowFunctionBody; } // case 2: () => [1,2,3] else { bodyBlock = ts.createBlock([ts.createReturn(arrowFunctionBody)]); } - var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(arrowFunction, 121 /* AsyncKeyword */)); + var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(arrowFunction, 122 /* AsyncKeyword */)); var method = ts.createMethod(/*decorators*/ undefined, fullModifiers, /*asteriskToken*/ undefined, memberDeclaration.name, /*questionToken*/ undefined, /*typeParameters*/ undefined, arrowFunction.parameters, /*type*/ undefined, bodyBlock); ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile); @@ -113120,17 +114380,17 @@ var ts; } function createClassFromVariableDeclaration(node) { var initializer = node.initializer; - if (!initializer || initializer.kind !== 196 /* FunctionExpression */) { + if (!initializer || initializer.kind !== 197 /* FunctionExpression */) { return undefined; } - if (node.name.kind !== 72 /* Identifier */) { + if (node.name.kind !== 73 /* Identifier */) { return undefined; } var memberElements = createClassElementsFromSymbol(node.symbol); if (initializer.body) { memberElements.unshift(ts.createConstructor(/*decorators*/ undefined, /*modifiers*/ undefined, initializer.parameters, initializer.body)); } - var modifiers = getModifierKindFromSource(precedingNode, 85 /* ExportKeyword */); + var modifiers = getModifierKindFromSource(precedingNode, 86 /* ExportKeyword */); var cls = ts.createClassDeclaration(/*decorators*/ undefined, modifiers, node.name, /*typeParameters*/ undefined, /*heritageClauses*/ undefined, memberElements); // Don't call copyComments here because we'll already leave them in place @@ -113141,7 +114401,7 @@ var ts; if (node.body) { memberElements.unshift(ts.createConstructor(/*decorators*/ undefined, /*modifiers*/ undefined, node.parameters, node.body)); } - var modifiers = getModifierKindFromSource(node, 85 /* ExportKeyword */); + var modifiers = getModifierKindFromSource(node, 86 /* ExportKeyword */); var cls = ts.createClassDeclaration(/*decorators*/ undefined, modifiers, node.name, /*typeParameters*/ undefined, /*heritageClauses*/ undefined, memberElements); // Don't call copyComments here because we'll already leave them in place @@ -113171,6 +114431,11 @@ var ts; fixIds: [fixId], getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, err) { return convertToAsyncFunction(changes, err.file, err.start, context.program.getTypeChecker(), context); }); }, }); + var SynthBindingNameKind; + (function (SynthBindingNameKind) { + SynthBindingNameKind[SynthBindingNameKind["Identifier"] = 0] = "Identifier"; + SynthBindingNameKind[SynthBindingNameKind["BindingPattern"] = 1] = "BindingPattern"; + })(SynthBindingNameKind || (SynthBindingNameKind = {})); function convertToAsyncFunction(changes, sourceFile, position, checker, context) { // get the function declaration - returns a promise var tokenAtPosition = ts.getTokenAtPosition(sourceFile, position); @@ -113199,7 +114464,7 @@ var ts; return; } // add the async keyword - changes.insertLastModifierBefore(sourceFile, 121 /* AsyncKeyword */, functionToConvert); + changes.insertLastModifierBefore(sourceFile, 122 /* AsyncKeyword */, functionToConvert); function startTransformation(node, nodeToReplace) { var newNodes = transformExpression(node, transformer, node); changes.replaceNodeWithNodes(sourceFile, nodeToReplace, newNodes); @@ -113307,8 +114572,8 @@ var ts; allVarNames.push({ identifier: synthName.identifier, symbol: symbol }); addNameToFrequencyMap(collidingSymbolMap, ident.text, symbol); } - // we only care about identifiers that are parameters and declarations (don't care about other uses) - else if (node.parent && (ts.isParameter(node.parent) || ts.isVariableDeclaration(node.parent))) { + // we only care about identifiers that are parameters, declarations, or binding elements (don't care about other uses) + else if (node.parent && (ts.isParameter(node.parent) || ts.isVariableDeclaration(node.parent) || ts.isBindingElement(node.parent))) { var originalName = node.text; var collidingSymbols = collidingSymbolMap.get(originalName); // if the identifier name conflicts with a different identifier that we've already seen @@ -113322,7 +114587,7 @@ var ts; else { var identifier = ts.getSynthesizedDeepClone(node); identsToRenameMap.set(symbolIdString, identifier); - synthNamesMap.set(symbolIdString, { identifier: identifier, types: [], numberOfAssignmentsOriginal: allVarNames.filter(function (elem) { return elem.identifier.text === node.text; }).length /*, numberOfAssignmentsSynthesized: 0*/ }); + synthNamesMap.set(symbolIdString, createSynthIdentifier(identifier, [], allVarNames.filter(function (elem) { return elem.identifier.text === node.text; }).length /*, numberOfAssignmentsSynthesized: 0*/)); if ((ts.isParameter(node.parent) && isExpressionOrCallOnTypePromise(node.parent.parent)) || ts.isVariableDeclaration(node.parent)) { allVarNames.push({ identifier: identifier, symbol: symbol }); addNameToFrequencyMap(collidingSymbolMap, originalName, symbol); @@ -113370,7 +114635,7 @@ var ts; var numVarsSameName = (originalNames.get(name.text) || ts.emptyArray).length; var numberOfAssignmentsOriginal = 0; var identifier = numVarsSameName === 0 ? name : ts.createIdentifier(name.text + "_" + numVarsSameName); - return { identifier: identifier, types: [], numberOfAssignmentsOriginal: numberOfAssignmentsOriginal }; + return createSynthIdentifier(identifier, [], numberOfAssignmentsOriginal); } // dispatch function to recursively build the refactoring // should be kept up to date with isFixablePromiseHandler in suggestionDiagnostics.ts @@ -113397,68 +114662,90 @@ var ts; } function transformCatch(node, transformer, prevArgName) { var func = node.arguments[0]; - var argName = getArgName(func, transformer); + var argName = getArgBindingName(func, transformer); var shouldReturn = transformer.setOfExpressionsToReturn.get(ts.getNodeId(node).toString()); + var possibleNameForVarDecl; /* If there is another call in the chain after the .catch() we are transforming, we will need to save the result of both paths (try block and catch block) To do this, we will need to synthesize a variable that we were not aware of while we were adding identifiers to the synthNamesMap We will use the prevArgName and then update the synthNamesMap with a new variable name for the next transformation step */ if (prevArgName && !shouldReturn) { - prevArgName.numberOfAssignmentsOriginal = 2; // Try block and catch block - transformer.synthNamesMap.forEach(function (val, key) { - if (val.identifier.text === prevArgName.identifier.text) { - var newSynthName = createUniqueSynthName(prevArgName); - transformer.synthNamesMap.set(key, newSynthName); - } - }); + if (isSynthIdentifier(prevArgName)) { + possibleNameForVarDecl = prevArgName; + transformer.synthNamesMap.forEach(function (val, key) { + if (val.identifier.text === prevArgName.identifier.text) { + var newSynthName = createUniqueSynthName(prevArgName); + transformer.synthNamesMap.set(key, newSynthName); + } + }); + } + else { + possibleNameForVarDecl = createSynthIdentifier(ts.createOptimisticUniqueName("result"), prevArgName.types); + } + possibleNameForVarDecl.numberOfAssignmentsOriginal = 2; // Try block and catch block // update the constIdentifiers list - if (transformer.constIdentifiers.some(function (elem) { return elem.text === prevArgName.identifier.text; })) { - transformer.constIdentifiers.push(createUniqueSynthName(prevArgName).identifier); + if (transformer.constIdentifiers.some(function (elem) { return elem.text === possibleNameForVarDecl.identifier.text; })) { + transformer.constIdentifiers.push(createUniqueSynthName(possibleNameForVarDecl).identifier); } } - var tryBlock = ts.createBlock(transformExpression(node.expression, transformer, node, prevArgName)); - var transformationBody = getTransformationBody(func, prevArgName, argName, node, transformer); - var catchArg = argName ? argName.identifier.text : "e"; - var catchClause = ts.createCatchClause(catchArg, ts.createBlock(transformationBody)); + var tryBlock = ts.createBlock(transformExpression(node.expression, transformer, node, possibleNameForVarDecl)); + var transformationBody = getTransformationBody(func, possibleNameForVarDecl, argName, node, transformer); + var catchArg = argName ? isSynthIdentifier(argName) ? argName.identifier.text : argName.bindingPattern : "e"; + var catchVariableDeclaration = ts.createVariableDeclaration(catchArg); + var catchClause = ts.createCatchClause(catchVariableDeclaration, ts.createBlock(transformationBody)); /* In order to avoid an implicit any, we will synthesize a type for the declaration using the unions of the types of both paths (try block and catch block) */ var varDeclList; - if (prevArgName && !shouldReturn) { - var typeArray = prevArgName.types; + var varDeclIdentifier; + if (possibleNameForVarDecl && !shouldReturn) { + varDeclIdentifier = ts.getSynthesizedDeepClone(possibleNameForVarDecl.identifier); + var typeArray = possibleNameForVarDecl.types; var unionType = transformer.checker.getUnionType(typeArray, 2 /* Subtype */); var unionTypeNode = transformer.isInJSFile ? undefined : transformer.checker.typeToTypeNode(unionType); - var varDecl = [ts.createVariableDeclaration(ts.getSynthesizedDeepClone(prevArgName.identifier), unionTypeNode)]; + var varDecl = [ts.createVariableDeclaration(varDeclIdentifier, unionTypeNode)]; varDeclList = ts.createVariableStatement(/*modifiers*/ undefined, ts.createVariableDeclarationList(varDecl, 1 /* Let */)); } var tryStatement = ts.createTry(tryBlock, catchClause, /*finallyBlock*/ undefined); - return varDeclList ? [varDeclList, tryStatement] : [tryStatement]; + var destructuredResult = prevArgName && varDeclIdentifier && isSynthBindingPattern(prevArgName) + && ts.createVariableStatement(/* modifiers */ undefined, ts.createVariableDeclarationList([ts.createVariableDeclaration(ts.getSynthesizedDeepCloneWithRenames(prevArgName.bindingPattern), /* type */ undefined, varDeclIdentifier)], 2 /* Const */)); + return ts.compact([varDeclList, tryStatement, destructuredResult]); + } + function getIdentifierTextsFromBindingName(bindingName) { + if (ts.isIdentifier(bindingName)) + return [bindingName.text]; + return ts.flatMap(bindingName.elements, function (element) { + if (ts.isOmittedExpression(element)) + return []; + return getIdentifierTextsFromBindingName(element.name); + }); } function createUniqueSynthName(prevArgName) { var renamedPrevArg = ts.createOptimisticUniqueName(prevArgName.identifier.text); - var newSynthName = { identifier: renamedPrevArg, types: [], numberOfAssignmentsOriginal: 0 }; - return newSynthName; + return createSynthIdentifier(renamedPrevArg); } function transformThen(node, transformer, outermostParent, prevArgName) { var _a = node.arguments, res = _a[0], rej = _a[1]; if (!res) { return transformExpression(node.expression, transformer, outermostParent); } - var argNameRes = getArgName(res, transformer); + var argNameRes = getArgBindingName(res, transformer); var transformationBody = getTransformationBody(res, prevArgName, argNameRes, node, transformer); if (rej) { - var argNameRej = getArgName(rej, transformer); + var argNameRej = getArgBindingName(rej, transformer); var tryBlock = ts.createBlock(transformExpression(node.expression, transformer, node, argNameRes).concat(transformationBody)); var transformationBody2 = getTransformationBody(rej, prevArgName, argNameRej, node, transformer); - var catchArg = argNameRej ? argNameRej.identifier.text : "e"; - var catchClause = ts.createCatchClause(catchArg, ts.createBlock(transformationBody2)); + var catchArg = argNameRej ? isSynthIdentifier(argNameRej) ? argNameRej.identifier.text : argNameRej.bindingPattern : "e"; + var catchVariableDeclaration = ts.createVariableDeclaration(catchArg); + var catchClause = ts.createCatchClause(catchVariableDeclaration, ts.createBlock(transformationBody2)); return [ts.createTry(tryBlock, catchClause, /* finallyBlock */ undefined)]; } return transformExpression(node.expression, transformer, node, argNameRes).concat(transformationBody); } - function getFlagOfIdentifier(node, constIdentifiers) { - var inArr = constIdentifiers.some(function (elem) { return elem.text === node.text; }); + function getFlagOfBindingName(bindingName, constIdentifiers) { + var identifiers = getIdentifierTextsFromBindingName(getNode(bindingName)); + var inArr = constIdentifiers.some(function (elem) { return ts.contains(identifiers, elem.text); }); return inArr ? 2 /* Const */ : 1 /* Let */; } function transformPromiseCall(node, transformer, prevArgName) { @@ -113474,29 +114761,29 @@ var ts; return [ts.createReturn(ts.getSynthesizedDeepClone(node))]; } function createTransformedStatement(prevArgName, rightHandSide, transformer) { - if (!prevArgName || prevArgName.identifier.text.length === 0) { + if (!prevArgName || isEmpty(prevArgName)) { // if there's no argName to assign to, there still might be side effects return [ts.createStatement(rightHandSide)]; } - if (prevArgName.types.length < prevArgName.numberOfAssignmentsOriginal) { + if (isSynthIdentifier(prevArgName) && prevArgName.types.length < prevArgName.numberOfAssignmentsOriginal) { // if the variable has already been declared, we don't need "let" or "const" return [ts.createStatement(ts.createAssignment(ts.getSynthesizedDeepClone(prevArgName.identifier), rightHandSide))]; } - return [ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(ts.getSynthesizedDeepClone(prevArgName.identifier), /*type*/ undefined, rightHandSide)], getFlagOfIdentifier(prevArgName.identifier, transformer.constIdentifiers))))]; + return [ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(ts.getSynthesizedDeepClone(getNode(prevArgName)), /*type*/ undefined, rightHandSide)], getFlagOfBindingName(prevArgName, transformer.constIdentifiers))))]; } // should be kept up to date with isFixablePromiseArgument in suggestionDiagnostics.ts function getTransformationBody(func, prevArgName, argName, parent, transformer) { var shouldReturn = transformer.setOfExpressionsToReturn.get(ts.getNodeId(parent).toString()); switch (func.kind) { - case 96 /* NullKeyword */: + case 97 /* NullKeyword */: // do not produce a transformed statement for a null argument break; - case 72 /* Identifier */: // identifier includes undefined + case 73 /* Identifier */: // identifier includes undefined if (!argName) { // undefined was argument passed to promise handler break; } - var synthCall = ts.createCall(ts.getSynthesizedDeepClone(func), /*typeArguments*/ undefined, [argName.identifier]); + var synthCall = ts.createCall(ts.getSynthesizedDeepClone(func), /*typeArguments*/ undefined, isSynthIdentifier(argName) ? [argName.identifier] : []); if (shouldReturn) { return [ts.createReturn(synthCall)]; } @@ -113513,8 +114800,8 @@ var ts; prevArgName.types.push(returnType); } return varDeclOrAssignment; - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: { + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: { var funcBody = func.body; // Arrow functions with block bodies { } will enter this control flow if (ts.isBlock(funcBody)) { @@ -113533,7 +114820,7 @@ var ts; } } return shouldReturn ? refactoredStmts.map(function (s) { return ts.getSynthesizedDeepClone(s); }) : - removeReturns(refactoredStmts, prevArgName === undefined ? undefined : prevArgName.identifier, transformer, seenReturnStatement); + removeReturns(refactoredStmts, prevArgName, transformer, seenReturnStatement); } else { var innerRetStmts = ts.isFixablePromiseHandler(funcBody) ? [ts.createReturn(funcBody)] : ts.emptyArray; @@ -113579,7 +114866,7 @@ var ts; ret.push(ts.createExpressionStatement(possiblyAwaitedExpression)); } else { - ret.push(ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(prevArgName, /*type*/ undefined, possiblyAwaitedExpression)], getFlagOfIdentifier(prevArgName, transformer.constIdentifiers))))); + ret.push(ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(getNode(prevArgName), /*type*/ undefined, possiblyAwaitedExpression)], getFlagOfBindingName(prevArgName, transformer.constIdentifiers))))); } } } @@ -113589,7 +114876,7 @@ var ts; } // if block has no return statement, need to define prevArgName as undefined to prevent undeclared variables if (!seenReturnStatement && prevArgName !== undefined) { - ret.push(ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(prevArgName, /*type*/ undefined, ts.createIdentifier("undefined"))], getFlagOfIdentifier(prevArgName, transformer.constIdentifiers))))); + ret.push(ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(getNode(prevArgName), /*type*/ undefined, ts.createIdentifier("undefined"))], getFlagOfBindingName(prevArgName, transformer.constIdentifiers))))); } return ret; } @@ -113612,32 +114899,42 @@ var ts; } return innerCbBody; } - function getArgName(funcNode, transformer) { + function getArgBindingName(funcNode, transformer) { var numberOfAssignmentsOriginal = 0; var types = []; var name; if (ts.isFunctionLikeDeclaration(funcNode)) { if (funcNode.parameters.length > 0) { var param = funcNode.parameters[0].name; - name = getMapEntryOrDefault(param); + name = getMappedBindingNameOrDefault(param); } } else if (ts.isIdentifier(funcNode)) { name = getMapEntryOrDefault(funcNode); } // return undefined argName when arg is null or undefined - if (!name || name.identifier.text === "undefined") { + if (!name || "identifier" in name && name.identifier.text === "undefined") { return undefined; } return name; + function getMappedBindingNameOrDefault(bindingName) { + if (ts.isIdentifier(bindingName)) + return getMapEntryOrDefault(bindingName); + var elements = ts.flatMap(bindingName.elements, function (element) { + if (ts.isOmittedExpression(element)) + return []; + return [getMappedBindingNameOrDefault(element.name)]; + }); + return createSynthBindingPattern(bindingName, elements); + } function getMapEntryOrDefault(identifier) { var originalNode = getOriginalNode(identifier); var symbol = getSymbol(originalNode); if (!symbol) { - return { identifier: identifier, types: types, numberOfAssignmentsOriginal: numberOfAssignmentsOriginal }; + return createSynthIdentifier(identifier, types, numberOfAssignmentsOriginal); } var mapEntry = transformer.synthNamesMap.get(ts.getSymbolId(symbol).toString()); - return mapEntry || { identifier: identifier, types: types, numberOfAssignmentsOriginal: numberOfAssignmentsOriginal }; + return mapEntry || createSynthIdentifier(identifier, types, numberOfAssignmentsOriginal); } function getSymbol(node) { return node.symbol ? node.symbol : transformer.checker.getSymbolAtLocation(node); @@ -113646,6 +114943,34 @@ var ts; return node.original ? node.original : node; } } + function isEmpty(bindingName) { + if (!bindingName) { + return true; + } + if (isSynthIdentifier(bindingName)) { + return !bindingName.identifier.text; + } + return ts.every(bindingName.elements, isEmpty); + } + function getNode(bindingName) { + return isSynthIdentifier(bindingName) ? bindingName.identifier : bindingName.bindingPattern; + } + function createSynthIdentifier(identifier, types, numberOfAssignmentsOriginal) { + if (types === void 0) { types = []; } + if (numberOfAssignmentsOriginal === void 0) { numberOfAssignmentsOriginal = 0; } + return { kind: 0 /* Identifier */, identifier: identifier, types: types, numberOfAssignmentsOriginal: numberOfAssignmentsOriginal }; + } + function createSynthBindingPattern(bindingPattern, elements, types) { + if (elements === void 0) { elements = ts.emptyArray; } + if (types === void 0) { types = []; } + return { kind: 1 /* BindingPattern */, bindingPattern: bindingPattern, elements: elements, types: types }; + } + function isSynthIdentifier(bindingName) { + return bindingName.kind === 0 /* Identifier */; + } + function isSynthBindingPattern(bindingName) { + return bindingName.kind === 1 /* BindingPattern */; + } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); /* @internal */ @@ -113679,10 +115004,10 @@ var ts; } var importNode = ts.importFromModuleSpecifier(moduleSpecifier); switch (importNode.kind) { - case 248 /* ImportEqualsDeclaration */: + case 249 /* ImportEqualsDeclaration */: changes.replaceNode(importingFile, importNode, ts.makeImport(importNode.name, /*namedImports*/ undefined, moduleSpecifier, quotePreference)); break; - case 191 /* CallExpression */: + case 192 /* CallExpression */: if (ts.isRequireCall(importNode, /*checkArgumentIsStringLiteralLike*/ false)) { changes.replaceNode(importingFile, importNode, ts.createPropertyAccess(ts.getSynthesizedDeepClone(importNode), "default")); } @@ -113728,29 +115053,29 @@ var ts; sourceFile.forEachChild(function recur(node) { if (ts.isPropertyAccessExpression(node) && ts.isExportsOrModuleExportsOrAlias(sourceFile, node.expression)) { var parent = node.parent; - cb(node, ts.isBinaryExpression(parent) && parent.left === node && parent.operatorToken.kind === 59 /* EqualsToken */); + cb(node, ts.isBinaryExpression(parent) && parent.left === node && parent.operatorToken.kind === 60 /* EqualsToken */); } node.forEachChild(recur); }); } function convertStatement(sourceFile, statement, checker, changes, identifiers, target, exports, quotePreference) { switch (statement.kind) { - case 219 /* VariableStatement */: + case 220 /* VariableStatement */: convertVariableStatement(sourceFile, statement, changes, checker, identifiers, target, quotePreference); return false; - case 221 /* ExpressionStatement */: { + case 222 /* ExpressionStatement */: { var expression = statement.expression; switch (expression.kind) { - case 191 /* CallExpression */: { + case 192 /* CallExpression */: { if (ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true)) { // For side-effecting require() call, just make a side-effecting import. changes.replaceNode(sourceFile, statement, ts.makeImport(/*name*/ undefined, /*namedImports*/ undefined, expression.arguments[0], quotePreference)); } return false; } - case 204 /* BinaryExpression */: { + case 205 /* BinaryExpression */: { var operatorToken = expression.operatorToken; - return operatorToken.kind === 59 /* EqualsToken */ && convertAssignment(sourceFile, checker, expression, changes, exports); + return operatorToken.kind === 60 /* EqualsToken */ && convertAssignment(sourceFile, checker, expression, changes, exports); } } } @@ -113790,8 +115115,8 @@ var ts; /** Converts `const name = require("moduleSpecifier").propertyName` */ function convertPropertyAccessImport(name, propertyName, moduleSpecifier, identifiers, quotePreference) { switch (name.kind) { - case 184 /* ObjectBindingPattern */: - case 185 /* ArrayBindingPattern */: { + case 185 /* ObjectBindingPattern */: + case 186 /* ArrayBindingPattern */: { // `const [a, b] = require("c").d` --> `import { d } from "c"; const [a, b] = d;` var tmp = makeUniqueName(propertyName, identifiers); return [ @@ -113799,7 +115124,7 @@ var ts; makeConst(/*modifiers*/ undefined, name, ts.createIdentifier(tmp)), ]; } - case 72 /* Identifier */: + case 73 /* Identifier */: // `const a = require("b").c` --> `import { c as a } from "./b"; return [makeSingleImport(name.text, propertyName, moduleSpecifier, quotePreference)]; default: @@ -113842,16 +115167,16 @@ var ts; function tryChangeModuleExportsObject(object) { var statements = ts.mapAllOrFail(object.properties, function (prop) { switch (prop.kind) { - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: // TODO: Maybe we should handle this? See fourslash test `refactorConvertToEs6Module_export_object_shorthand.ts`. - case 276 /* ShorthandPropertyAssignment */: - case 277 /* SpreadAssignment */: + case 277 /* ShorthandPropertyAssignment */: + case 278 /* SpreadAssignment */: return undefined; - case 275 /* PropertyAssignment */: + case 276 /* PropertyAssignment */: return !ts.isIdentifier(prop.name) ? undefined : convertExportsDotXEquals_replaceNode(prop.name.text, prop.initializer); - case 156 /* MethodDeclaration */: - return !ts.isIdentifier(prop.name) ? undefined : functionExpressionToDeclaration(prop.name.text, [ts.createToken(85 /* ExportKeyword */)], prop); + case 157 /* MethodDeclaration */: + return !ts.isIdentifier(prop.name) ? undefined : functionExpressionToDeclaration(prop.name.text, [ts.createToken(86 /* ExportKeyword */)], prop); default: ts.Debug.assertNever(prop); } @@ -113900,7 +115225,7 @@ var ts; var name = left.name.text; if ((ts.isFunctionExpression(right) || ts.isArrowFunction(right) || ts.isClassExpression(right)) && (!right.name || right.name.text === name)) { // `exports.f = function() {}` -> `export function f() {}` -- Replace `exports.f = ` with `export `, and insert the name after `function`. - changes.replaceRange(sourceFile, { pos: left.getStart(sourceFile), end: right.getStart(sourceFile) }, ts.createToken(85 /* ExportKeyword */), { suffix: " " }); + changes.replaceRange(sourceFile, { pos: left.getStart(sourceFile), end: right.getStart(sourceFile) }, ts.createToken(86 /* ExportKeyword */), { suffix: " " }); if (!right.name) changes.insertName(sourceFile, right, name); var semi = ts.findChildOfKind(parent, 26 /* SemicolonToken */, sourceFile); @@ -113909,14 +115234,14 @@ var ts; } else { // `exports.f = function g() {}` -> `export const f = function g() {}` -- just replace `exports.` with `export const ` - changes.replaceNodeRangeWithNodes(sourceFile, left.expression, ts.findChildOfKind(left, 24 /* DotToken */, sourceFile), [ts.createToken(85 /* ExportKeyword */), ts.createToken(77 /* ConstKeyword */)], { joiner: " ", suffix: " " }); + changes.replaceNodeRangeWithNodes(sourceFile, left.expression, ts.findChildOfKind(left, 24 /* DotToken */, sourceFile), [ts.createToken(86 /* ExportKeyword */), ts.createToken(78 /* ConstKeyword */)], { joiner: " ", suffix: " " }); } } // TODO: GH#22492 this will cause an error if a change has been made inside the body of the node. function convertExportsDotXEquals_replaceNode(name, exported) { - var modifiers = [ts.createToken(85 /* ExportKeyword */)]; + var modifiers = [ts.createToken(86 /* ExportKeyword */)]; switch (exported.kind) { - case 196 /* FunctionExpression */: { + case 197 /* FunctionExpression */: { var expressionName = exported.name; if (expressionName && expressionName.text !== name) { // `exports.f = function g() {}` -> `export const f = function g() {}` @@ -113924,10 +115249,10 @@ var ts; } } // falls through - case 197 /* ArrowFunction */: + case 198 /* ArrowFunction */: // `exports.f = function() {}` --> `export function f() {}` return functionExpressionToDeclaration(name, modifiers, exported); - case 209 /* ClassExpression */: + case 210 /* ClassExpression */: // `exports.C = class {}` --> `export class C {}` return classExpressionToDeclaration(name, modifiers, exported); default: @@ -113945,7 +115270,7 @@ var ts; */ function convertSingleImport(file, name, moduleSpecifier, changes, checker, identifiers, target, quotePreference) { switch (name.kind) { - case 184 /* ObjectBindingPattern */: { + case 185 /* ObjectBindingPattern */: { var importSpecifiers = ts.mapAllOrFail(name.elements, function (e) { return e.dotDotDotToken || e.initializer || e.propertyName && !ts.isIdentifier(e.propertyName) || !ts.isIdentifier(e.name) ? undefined @@ -113956,7 +115281,7 @@ var ts; } } // falls through -- object destructuring has an interesting pattern and must be a variable declaration - case 185 /* ArrayBindingPattern */: { + case 186 /* ArrayBindingPattern */: { /* import x from "x"; const [a, b, c] = x; @@ -113967,7 +115292,7 @@ var ts; makeConst(/*modifiers*/ undefined, ts.getSynthesizedDeepClone(name), ts.createIdentifier(tmp)), ]; } - case 72 /* Identifier */: + case 73 /* Identifier */: return convertSingleIdentifierImport(file, name, moduleSpecifier, changes, checker, identifiers, quotePreference); default: return ts.Debug.assertNever(name); @@ -114039,11 +115364,11 @@ var ts; function isFreeIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 189 /* PropertyAccessExpression */: + case 190 /* PropertyAccessExpression */: return parent.name !== node; - case 186 /* BindingElement */: + case 187 /* BindingElement */: return parent.propertyName !== node; - case 253 /* ImportSpecifier */: + case 254 /* ImportSpecifier */: return parent.propertyName !== node; default: return true; @@ -114382,21 +115707,21 @@ var ts; function tryAddToExistingImport(existingImports) { return ts.firstDefined(existingImports, function (_a) { var declaration = _a.declaration, importKind = _a.importKind; - if (declaration.kind !== 249 /* ImportDeclaration */) + if (declaration.kind !== 250 /* ImportDeclaration */) return undefined; var importClause = declaration.importClause; if (!importClause) return undefined; var name = importClause.name, namedBindings = importClause.namedBindings; - return importKind === 1 /* Default */ && !name || importKind === 0 /* Named */ && (!namedBindings || namedBindings.kind === 252 /* NamedImports */) + return importKind === 1 /* Default */ && !name || importKind === 0 /* Named */ && (!namedBindings || namedBindings.kind === 253 /* NamedImports */) ? { kind: 2 /* AddToExisting */, importClause: importClause, importKind: importKind } : undefined; }); } function getNamespaceImportName(declaration) { - if (declaration.kind === 249 /* ImportDeclaration */) { + if (declaration.kind === 250 /* ImportDeclaration */) { var namedBindings = declaration.importClause && ts.isImportClause(declaration.importClause) && declaration.importClause.namedBindings; - return namedBindings && namedBindings.kind === 251 /* NamespaceImport */ ? namedBindings.name : undefined; + return namedBindings && namedBindings.kind === 252 /* NamespaceImport */ ? namedBindings.name : undefined; } else { return declaration.name; @@ -114407,7 +115732,7 @@ var ts; // Can't use an es6 import for a type in JS. return exportedSymbolIsTypeOnly && ts.isSourceFileJS(sourceFile) ? ts.emptyArray : ts.mapDefined(sourceFile.imports, function (moduleSpecifier) { var i = ts.importFromModuleSpecifier(moduleSpecifier); - return (i.kind === 249 /* ImportDeclaration */ || i.kind === 248 /* ImportEqualsDeclaration */) + return (i.kind === 250 /* ImportDeclaration */ || i.kind === 249 /* ImportEqualsDeclaration */) && checker.getSymbolAtLocation(moduleSpecifier) === moduleSymbol ? { declaration: i, importKind: importKind } : undefined; }); } @@ -114430,9 +115755,9 @@ var ts; } function newImportInfoFromExistingSpecifier(_a) { var declaration = _a.declaration, importKind = _a.importKind; - var expression = declaration.kind === 249 /* ImportDeclaration */ + var expression = declaration.kind === 250 /* ImportDeclaration */ ? declaration.moduleSpecifier - : declaration.moduleReference.kind === 259 /* ExternalModuleReference */ + : declaration.moduleReference.kind === 260 /* ExternalModuleReference */ ? declaration.moduleReference.expression : undefined; return expression && ts.isStringLiteral(expression) ? { kind: 3 /* AddNew */, moduleSpecifier: expression.text, importKind: importKind } : undefined; @@ -114760,12 +116085,12 @@ var ts; var checker = context.program.getTypeChecker(); var suggestion; if (ts.isPropertyAccessExpression(node.parent) && node.parent.name === node) { - ts.Debug.assert(node.kind === 72 /* Identifier */); + ts.Debug.assert(node.kind === 73 /* Identifier */); var containingType = checker.getTypeAtLocation(node.parent.expression); suggestion = checker.getSuggestionForNonexistentProperty(node, containingType); } else if (ts.isImportSpecifier(node.parent) && node.parent.name === node) { - ts.Debug.assert(node.kind === 72 /* Identifier */); + ts.Debug.assert(node.kind === 73 /* Identifier */); var importDeclaration = ts.findAncestor(node, ts.isImportDeclaration); var resolvedSourceFile = getResolvedSourceFileFromImportDeclaration(sourceFile, context, importDeclaration); if (resolvedSourceFile && resolvedSourceFile.symbol) { @@ -114828,7 +116153,7 @@ var ts; codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { - var info = getInfo(context.sourceFile, context.span.start, context.program.getTypeChecker()); + var info = getInfo(context.sourceFile, context.span.start, context.program.getTypeChecker(), context.program); if (!info) return undefined; if (info.kind === 0 /* Enum */) { @@ -114851,7 +116176,7 @@ var ts; var typeDeclToMembers = new ts.NodeMap(); return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, function (changes) { codefix.eachDiagnostic(context, errorCodes, function (diag) { - var info = getInfo(diag.file, diag.start, checker); + var info = getInfo(diag.file, diag.start, checker, context.program); if (!info || !ts.addToSeen(seen, ts.getNodeId(info.parentDeclaration) + "#" + info.token.text)) { return; } @@ -114919,7 +116244,7 @@ var ts; InfoKind[InfoKind["Enum"] = 0] = "Enum"; InfoKind[InfoKind["ClassOrInterface"] = 1] = "ClassOrInterface"; })(InfoKind || (InfoKind = {})); - function getInfo(tokenSourceFile, tokenPos, checker) { + function getInfo(tokenSourceFile, tokenPos, checker, program) { // The identifier of the missing property. eg: // this.missing = 1; // ^^^^^^^ @@ -114936,7 +116261,7 @@ var ts; return undefined; // Prefer to change the class instead of the interface if they are merged var classOrInterface = ts.find(symbol.declarations, ts.isClassLike) || ts.find(symbol.declarations, ts.isInterfaceDeclaration); - if (classOrInterface) { + if (classOrInterface && !program.isSourceFileFromExternalLibrary(classOrInterface.getSourceFile())) { var makeStatic = (leftExpressionType.target || leftExpressionType) !== checker.getDeclaredTypeOfSymbol(symbol); var declSourceFile = classOrInterface.getSourceFile(); var inJs = ts.isSourceFileJS(declSourceFile); @@ -114944,7 +116269,7 @@ var ts; return { kind: 1 /* ClassOrInterface */, token: token, parentDeclaration: classOrInterface, makeStatic: makeStatic, declSourceFile: declSourceFile, inJs: inJs, call: call }; } var enumDeclaration = ts.find(symbol.declarations, ts.isEnumDeclaration); - if (enumDeclaration) { + if (enumDeclaration && !program.isSourceFileFromExternalLibrary(enumDeclaration.getSourceFile())) { return { kind: 0 /* Enum */, token: token, parentDeclaration: enumDeclaration }; } return undefined; @@ -114956,7 +116281,7 @@ var ts; } function addMissingMemberInJs(changeTracker, declSourceFile, classDeclaration, tokenName, makeStatic) { if (makeStatic) { - if (classDeclaration.kind === 209 /* ClassExpression */) { + if (classDeclaration.kind === 210 /* ClassExpression */) { return; } var className = classDeclaration.name.getText(); @@ -114982,7 +116307,7 @@ var ts; } function getTypeNode(checker, classDeclaration, token) { var typeNode; - if (token.parent.parent.kind === 204 /* BinaryExpression */) { + if (token.parent.parent.kind === 205 /* BinaryExpression */) { var binaryExpression = token.parent.parent; var otherExpression = token.parent === binaryExpression.left ? binaryExpression.right : binaryExpression.left; var widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(otherExpression))); @@ -114992,7 +116317,7 @@ var ts; var contextualType = checker.getContextualType(token.parent); typeNode = contextualType ? checker.typeToTypeNode(contextualType) : undefined; } - return typeNode || ts.createKeywordTypeNode(120 /* AnyKeyword */); + return typeNode || ts.createKeywordTypeNode(121 /* AnyKeyword */); } function createAddPropertyDeclarationAction(context, declSourceFile, classDeclaration, makeStatic, tokenName, typeNode) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addPropertyDeclaration(t, declSourceFile, classDeclaration, tokenName, typeNode, makeStatic); }); @@ -115001,7 +116326,7 @@ var ts; function addPropertyDeclaration(changeTracker, declSourceFile, classDeclaration, tokenName, typeNode, makeStatic) { var property = ts.createProperty( /*decorators*/ undefined, - /*modifiers*/ makeStatic ? [ts.createToken(116 /* StaticKeyword */)] : undefined, tokenName, + /*modifiers*/ makeStatic ? [ts.createToken(117 /* StaticKeyword */)] : undefined, tokenName, /*questionToken*/ undefined, typeNode, /*initializer*/ undefined); var lastProp = getNodeToInsertPropertyAfter(classDeclaration); @@ -115025,7 +116350,7 @@ var ts; } function createAddIndexSignatureAction(context, declSourceFile, classDeclaration, tokenName, typeNode) { // Index signatures cannot have the static modifier. - var stringTypeNode = ts.createKeywordTypeNode(138 /* StringKeyword */); + var stringTypeNode = ts.createKeywordTypeNode(139 /* StringKeyword */); var indexingParameter = ts.createParameter( /*decorators*/ undefined, /*modifiers*/ undefined, @@ -115045,7 +116370,7 @@ var ts; } function addMethodDeclaration(context, changeTracker, declSourceFile, typeDecl, token, callExpression, makeStatic, inJs, preferences) { var methodDeclaration = codefix.createMethodFromCallExpression(context, callExpression, token.text, inJs, makeStatic, preferences, typeDecl); - var containingMethodDeclaration = ts.getAncestor(callExpression, 156 /* MethodDeclaration */); + var containingMethodDeclaration = ts.getAncestor(callExpression, 157 /* MethodDeclaration */); if (containingMethodDeclaration && containingMethodDeclaration.parent === typeDecl) { changeTracker.insertNodeAfter(declSourceFile, containingMethodDeclaration, methodDeclaration); } @@ -115109,7 +116434,6 @@ var ts; (function (codefix) { var fixName = "fixCannotFindModule"; var fixIdInstallTypesPackage = "installTypesPackage"; - var fixIdGenerateTypes = "generateTypes"; var errorCodeCannotFindModule = ts.Diagnostics.Cannot_find_module_0.code; var errorCodes = [ errorCodeCannotFindModule, @@ -115124,13 +116448,12 @@ var ts; return undefined; var typesPackageName = getTypesPackageNameToInstall(packageName, host, context.errorCode); return typesPackageName === undefined - ? ts.singleElementArray(tryGetGenerateTypesAction(context, packageName)) + ? [] : [codefix.createCodeFixAction(fixName, /*changes*/ [], [ts.Diagnostics.Install_0, typesPackageName], fixIdInstallTypesPackage, ts.Diagnostics.Install_all_missing_types_packages, getInstallCommand(sourceFile.fileName, typesPackageName))]; }, - fixIds: [fixIdInstallTypesPackage, fixIdGenerateTypes], + fixIds: [fixIdInstallTypesPackage], getAllCodeActions: function (context) { - var savedTypesDir = null; // tslint:disable-line no-null-keyword - return codefix.codeFixAll(context, errorCodes, function (changes, diag, commands) { + return codefix.codeFixAll(context, errorCodes, function (_changes, diag, commands) { var packageName = tryGetImportedPackageName(diag.file, diag.start); if (packageName === undefined) return undefined; @@ -115142,96 +116465,12 @@ var ts; } break; } - case fixIdGenerateTypes: { - var typesDir = savedTypesDir !== null ? savedTypesDir : savedTypesDir = getOrCreateTypesDirectory(changes, context); - var command = typesDir === undefined ? undefined : tryGenerateTypes(typesDir, packageName, context); - if (command) - commands.push(command); - break; - } default: ts.Debug.fail("Bad fixId: " + context.fixId); } }); }, }); - function tryGetGenerateTypesAction(context, packageName) { - var command; - var changes = ts.textChanges.ChangeTracker.with(context, function (t) { - var typesDir = getOrCreateTypesDirectory(t, context); - command = typesDir === undefined ? undefined : tryGenerateTypes(typesDir, packageName, context); - }); - return command && codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Generate_types_for_0, packageName], fixIdGenerateTypes, ts.Diagnostics.Generate_types_for_all_packages_without_types, command); - } - function tryGenerateTypes(typesDir, packageName, context) { - var file = context.sourceFile.fileName; - var fileToGenerateTypesFor = ts.tryResolveJSModule(packageName, ts.getDirectoryPath(file), context.host); // TODO: GH#18217 - if (fileToGenerateTypesFor === undefined) - return undefined; - var outputFileName = ts.resolvePath(ts.getDirectoryPath(context.program.getCompilerOptions().configFile.fileName), typesDir, packageName + ".d.ts"); - if (context.host.fileExists(outputFileName)) - return undefined; - return { type: "generate types", file: file, fileToGenerateTypesFor: fileToGenerateTypesFor, outputFileName: outputFileName }; - } - // If no types directory exists yet, adds it to tsconfig.json - function getOrCreateTypesDirectory(changes, context) { - var configFile = context.program.getCompilerOptions().configFile; - if (!configFile) - return undefined; - var tsconfigObjectLiteral = ts.getTsConfigObjectLiteralExpression(configFile); - if (!tsconfigObjectLiteral) - return undefined; - var compilerOptionsProperty = codefix.findJsonProperty(tsconfigObjectLiteral, "compilerOptions"); - if (!compilerOptionsProperty) { - var newCompilerOptions = ts.createObjectLiteral([makeDefaultBaseUrl(), makeDefaultPaths()]); - changes.insertNodeAtObjectStart(configFile, tsconfigObjectLiteral, codefix.createJsonPropertyAssignment("compilerOptions", newCompilerOptions)); - return defaultTypesDirectoryName; - } - var compilerOptions = compilerOptionsProperty.initializer; - if (!ts.isObjectLiteralExpression(compilerOptions)) - return defaultTypesDirectoryName; - var baseUrl = getOrAddBaseUrl(changes, configFile, compilerOptions); - var typesDirectoryFromPathMapping = getOrAddPathMapping(changes, configFile, compilerOptions); - return ts.combinePaths(baseUrl, typesDirectoryFromPathMapping); - } - var defaultBaseUrl = "."; - function makeDefaultBaseUrl() { - return codefix.createJsonPropertyAssignment("baseUrl", ts.createStringLiteral(defaultBaseUrl)); - } - function getOrAddBaseUrl(changes, tsconfig, compilerOptions) { - var baseUrlProp = codefix.findJsonProperty(compilerOptions, "baseUrl"); - if (baseUrlProp) { - return ts.isStringLiteral(baseUrlProp.initializer) ? baseUrlProp.initializer.text : defaultBaseUrl; - } - else { - changes.insertNodeAtObjectStart(tsconfig, compilerOptions, makeDefaultBaseUrl()); - return defaultBaseUrl; - } - } - var defaultTypesDirectoryName = "types"; - function makeDefaultPathMapping() { - return codefix.createJsonPropertyAssignment("*", ts.createArrayLiteral([ts.createStringLiteral(defaultTypesDirectoryName + "/*")])); - } - function makeDefaultPaths() { - return codefix.createJsonPropertyAssignment("paths", ts.createObjectLiteral([makeDefaultPathMapping()])); - } - function getOrAddPathMapping(changes, tsconfig, compilerOptions) { - var paths = codefix.findJsonProperty(compilerOptions, "paths"); - if (!paths || !ts.isObjectLiteralExpression(paths.initializer)) { - changes.insertNodeAtObjectStart(tsconfig, compilerOptions, makeDefaultPaths()); - return defaultTypesDirectoryName; - } - // Look for an existing path mapping. Should look like `"*": "foo/*"`. - var existing = ts.firstDefined(paths.initializer.properties, function (prop) { - return ts.isPropertyAssignment(prop) && ts.isStringLiteral(prop.name) && prop.name.text === "*" && ts.isArrayLiteralExpression(prop.initializer) - ? ts.firstDefined(prop.initializer.elements, function (value) { return ts.isStringLiteral(value) ? ts.tryRemoveSuffix(value.text, "/*") : undefined; }) - : undefined; - }); - if (existing) - return existing; - changes.insertNodeAtObjectStart(tsconfig, paths.initializer, makeDefaultPathMapping()); - return defaultTypesDirectoryName; - } function getInstallCommand(fileName, packageName) { return { type: "install package", file: fileName, packageName: packageName }; } @@ -115339,7 +116578,7 @@ var ts; } function getNodes(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); - if (token.kind !== 100 /* ThisKeyword */) + if (token.kind !== 101 /* ThisKeyword */) return undefined; var constructor = ts.getContainingFunction(token); var superCall = findSuperCall(constructor.body); @@ -115378,7 +116617,7 @@ var ts; }); function getNode(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); - ts.Debug.assert(token.kind === 124 /* ConstructorKeyword */); + ts.Debug.assert(token.kind === 125 /* ConstructorKeyword */); return token.parent; } function doChange(changes, sourceFile, ctr) { @@ -115394,7 +116633,7 @@ var ts; (function (codefix) { var fixId = "enableExperimentalDecorators"; var errorCodes = [ - ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning.code + ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning.code ]; codefix.registerCodeFix({ errorCodes: errorCodes, @@ -115403,12 +116642,19 @@ var ts; if (configFile === undefined) { return undefined; } - var changes = ts.textChanges.ChangeTracker.with(context, function (changeTracker) { return makeChange(changeTracker, configFile); }); + var changes = ts.textChanges.ChangeTracker.with(context, function (changeTracker) { return doChange(changeTracker, configFile); }); return [codefix.createCodeFixActionNoFixId(fixId, changes, ts.Diagnostics.Enable_the_experimentalDecorators_option_in_your_configuration_file)]; }, fixIds: [fixId], + getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes) { + var configFile = context.program.getCompilerOptions().configFile; + if (configFile === undefined) { + return undefined; + } + doChange(changes, configFile); + }); }, }); - function makeChange(changeTracker, configFile) { + function doChange(changeTracker, configFile) { codefix.setJsonCompilerOptionValue(changeTracker, configFile, "experimentalDecorators", ts.createTrue()); } })(codefix = ts.codefix || (ts.codefix = {})); @@ -115442,14 +116688,14 @@ var ts; var token = ts.getTokenAtPosition(sourceFile, pos); var heritageClauses = ts.getContainingClass(token).heritageClauses; var extendsToken = heritageClauses[0].getFirstToken(); - return extendsToken.kind === 86 /* ExtendsKeyword */ ? { extendsToken: extendsToken, heritageClauses: heritageClauses } : undefined; + return extendsToken.kind === 87 /* ExtendsKeyword */ ? { extendsToken: extendsToken, heritageClauses: heritageClauses } : undefined; } function doChanges(changes, sourceFile, extendsToken, heritageClauses) { - changes.replaceNode(sourceFile, extendsToken, ts.createToken(109 /* ImplementsKeyword */)); + changes.replaceNode(sourceFile, extendsToken, ts.createToken(110 /* ImplementsKeyword */)); // If there is already an implements clause, replace the implements keyword with a comma. if (heritageClauses.length === 2 && - heritageClauses[0].token === 86 /* ExtendsKeyword */ && - heritageClauses[1].token === 109 /* ImplementsKeyword */) { + heritageClauses[0].token === 87 /* ExtendsKeyword */ && + heritageClauses[1].token === 110 /* ImplementsKeyword */) { var implementsToken = heritageClauses[1].getFirstToken(); var implementsFullStart = implementsToken.getFullStart(); changes.replaceRange(sourceFile, { pos: implementsFullStart, end: implementsFullStart }, ts.createToken(27 /* CommaToken */)); @@ -115556,7 +116802,7 @@ var ts; return [createDeleteFix(delVar, ts.Diagnostics.Remove_variable_statement)]; } var result = []; - if (token.kind === 127 /* InferKeyword */) { + if (token.kind === 128 /* InferKeyword */) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return changeInferToUnknown(t, sourceFile, token); }); var name = ts.cast(token.parent, ts.isInferTypeNode).typeParameter.name.text; result.push(codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Replace_infer_0_with_unknown, name], fixIdInfer, ts.Diagnostics.Replace_all_unused_infer_with_unknown)); @@ -115588,7 +116834,7 @@ var ts; tryPrefixDeclaration(changes, diag.code, sourceFile, token); break; case fixIdDelete: { - if (token.kind === 127 /* InferKeyword */) + if (token.kind === 128 /* InferKeyword */) break; // Can't delete var importDecl = tryGetFullImport(token); if (importDecl) { @@ -115607,7 +116853,7 @@ var ts; break; } case fixIdInfer: - if (token.kind === 127 /* InferKeyword */) { + if (token.kind === 128 /* InferKeyword */) { changeInferToUnknown(changes, sourceFile, token); } break; @@ -115618,7 +116864,7 @@ var ts; }, }); function changeInferToUnknown(changes, sourceFile, token) { - changes.replaceNode(sourceFile, token.parent, ts.createKeywordTypeNode(143 /* UnknownKeyword */)); + changes.replaceNode(sourceFile, token.parent, ts.createKeywordTypeNode(144 /* UnknownKeyword */)); } function createDeleteFix(changes, diag) { return codefix.createCodeFixAction(fixName, changes, diag, fixIdDelete, ts.Diagnostics.Delete_all_unused_declarations); @@ -115628,13 +116874,13 @@ var ts; } // Sometimes the diagnostic span is an entire ImportDeclaration, so we should remove the whole thing. function tryGetFullImport(token) { - return token.kind === 92 /* ImportKeyword */ ? ts.tryCast(token.parent, ts.isImportDeclaration) : undefined; + return token.kind === 93 /* ImportKeyword */ ? ts.tryCast(token.parent, ts.isImportDeclaration) : undefined; } function tryDeleteFullDestructure(token, changes, sourceFile, checker, sourceFiles, isFixAll) { if (token.kind !== 18 /* OpenBraceToken */ || !ts.isObjectBindingPattern(token.parent)) return false; var decl = token.parent.parent; - if (decl.kind === 151 /* Parameter */) { + if (decl.kind === 152 /* Parameter */) { tryDeleteParameter(changes, sourceFile, decl, checker, sourceFiles, isFixAll); } else { @@ -115645,7 +116891,7 @@ var ts; function tryDeleteFullVariableStatement(sourceFile, token, changes) { var declarationList = ts.tryCast(token.parent, ts.isVariableDeclarationList); if (declarationList && declarationList.getChildren(sourceFile)[0] === token) { - changes.delete(sourceFile, declarationList.parent.kind === 219 /* VariableStatement */ ? declarationList.parent : declarationList); + changes.delete(sourceFile, declarationList.parent.kind === 220 /* VariableStatement */ ? declarationList.parent : declarationList); return true; } return false; @@ -115654,7 +116900,7 @@ var ts; // Don't offer to prefix a property. if (errorCode === ts.Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code) return; - if (token.kind === 127 /* InferKeyword */) { + if (token.kind === 128 /* InferKeyword */) { token = ts.cast(token.parent, ts.isInferTypeNode).typeParameter.name; } if (ts.isIdentifier(token) && canPrefix(token)) { @@ -115663,14 +116909,14 @@ var ts; } function canPrefix(token) { switch (token.parent.kind) { - case 151 /* Parameter */: - case 150 /* TypeParameter */: + case 152 /* Parameter */: + case 151 /* TypeParameter */: return true; - case 237 /* VariableDeclaration */: { + case 238 /* VariableDeclaration */: { var varDecl = token.parent; switch (varDecl.parent.parent.kind) { - case 227 /* ForOfStatement */: - case 226 /* ForInStatement */: + case 228 /* ForOfStatement */: + case 227 /* ForInStatement */: return true; } } @@ -115717,26 +116963,26 @@ var ts; function mayDeleteParameter(p, checker, isFixAll) { var parent = p.parent; switch (parent.kind) { - case 156 /* MethodDeclaration */: + case 157 /* MethodDeclaration */: // Don't remove a parameter if this overrides something. var symbol = checker.getSymbolAtLocation(parent.name); if (ts.isMemberSymbolInBaseType(symbol, checker)) return false; // falls through - case 157 /* Constructor */: - case 239 /* FunctionDeclaration */: + case 158 /* Constructor */: + case 240 /* FunctionDeclaration */: return true; - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: { + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: { // Can't remove a non-last parameter in a callback. Can remove a parameter in code-fix-all if future parameters are also unused. var parameters = parent.parameters; var index = parameters.indexOf(p); ts.Debug.assert(index !== -1); return isFixAll - ? parameters.slice(index + 1).every(function (p) { return p.name.kind === 72 /* Identifier */ && !p.symbol.isReferenced; }) + ? parameters.slice(index + 1).every(function (p) { return p.name.kind === 73 /* Identifier */ && !p.symbol.isReferenced; }) : index === parameters.length - 1; } - case 159 /* SetAccessor */: + case 160 /* SetAccessor */: // Setter must have a parameter return false; default: @@ -115776,7 +117022,7 @@ var ts; var container = (ts.isBlock(statement.parent) ? statement.parent : statement).parent; if (!ts.isBlock(statement.parent) || statement === ts.first(statement.parent.statements)) { switch (container.kind) { - case 222 /* IfStatement */: + case 223 /* IfStatement */: if (container.elseStatement) { if (ts.isBlock(statement.parent)) { break; @@ -115787,15 +117033,15 @@ var ts; return; } // falls through - case 224 /* WhileStatement */: - case 225 /* ForStatement */: + case 225 /* WhileStatement */: + case 226 /* ForStatement */: changes.delete(sourceFile, container); return; } } if (ts.isBlock(statement.parent)) { - var end_2 = start + length; - var lastStatement = ts.Debug.assertDefined(lastWhere(ts.sliceAfter(statement.parent.statements, statement), function (s) { return s.pos < end_2; })); + var end_3 = start + length; + var lastStatement = ts.Debug.assertDefined(lastWhere(ts.sliceAfter(statement.parent.statements, statement), function (s) { return s.pos < end_3; })); changes.deleteNodeRange(sourceFile, statement, lastStatement); } else { @@ -115861,7 +117107,7 @@ var ts; var typeNode = info.typeNode, type = info.type; var original = typeNode.getText(sourceFile); var actions = [fix(type, fixIdPlain, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript)]; - if (typeNode.kind === 291 /* JSDocNullableType */) { + if (typeNode.kind === 292 /* JSDocNullableType */) { // for nullable types, suggest the flow-compatible `T | null | undefined` // in addition to the jsdoc/closure-compatible `T | null` actions.push(fix(checker.getNullableType(type, 32768 /* Undefined */), fixIdNullable, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types)); @@ -115881,7 +117127,7 @@ var ts; if (!info) return; var typeNode = info.typeNode, type = info.type; - var fixedType = typeNode.kind === 291 /* JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type; + var fixedType = typeNode.kind === 292 /* JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type; doChange(changes, sourceFile, typeNode, fixedType, checker); }); } @@ -115898,22 +117144,22 @@ var ts; // NOTE: Some locations are not handled yet: // MappedTypeNode.typeParameters and SignatureDeclaration.typeParameters, as well as CallExpression.typeArguments switch (node.kind) { - case 212 /* AsExpression */: - case 160 /* CallSignature */: - case 161 /* ConstructSignature */: - case 239 /* FunctionDeclaration */: - case 158 /* GetAccessor */: - case 162 /* IndexSignature */: - case 181 /* MappedType */: - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: - case 151 /* Parameter */: - case 154 /* PropertyDeclaration */: - case 153 /* PropertySignature */: - case 159 /* SetAccessor */: - case 242 /* TypeAliasDeclaration */: - case 194 /* TypeAssertionExpression */: - case 237 /* VariableDeclaration */: + case 213 /* AsExpression */: + case 161 /* CallSignature */: + case 162 /* ConstructSignature */: + case 240 /* FunctionDeclaration */: + case 159 /* GetAccessor */: + case 163 /* IndexSignature */: + case 182 /* MappedType */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: + case 152 /* Parameter */: + case 155 /* PropertyDeclaration */: + case 154 /* PropertySignature */: + case 160 /* SetAccessor */: + case 243 /* TypeAliasDeclaration */: + case 195 /* TypeAssertionExpression */: + case 238 /* VariableDeclaration */: return true; default: return false; @@ -115967,14 +117213,14 @@ var ts; } var insertBefore; switch (containingFunction.kind) { - case 156 /* MethodDeclaration */: + case 157 /* MethodDeclaration */: insertBefore = containingFunction.name; break; - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: - insertBefore = ts.findChildOfKind(containingFunction, 90 /* FunctionKeyword */, sourceFile); + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: + insertBefore = ts.findChildOfKind(containingFunction, 91 /* FunctionKeyword */, sourceFile); break; - case 197 /* ArrowFunction */: + case 198 /* ArrowFunction */: insertBefore = ts.findChildOfKind(containingFunction, 20 /* OpenParenToken */, sourceFile) || ts.first(containingFunction.parameters); break; default: @@ -115989,11 +117235,11 @@ var ts; var insertBefore = _a.insertBefore, returnType = _a.returnType; if (returnType) { var entityName = ts.getEntityNameFromTypeNode(returnType); - if (!entityName || entityName.kind !== 72 /* Identifier */ || entityName.text !== "Promise") { + if (!entityName || entityName.kind !== 73 /* Identifier */ || entityName.text !== "Promise") { changes.replaceNode(sourceFile, returnType, ts.createTypeReferenceNode("Promise", ts.createNodeArray([returnType]))); } } - changes.insertModifierBefore(sourceFile, 121 /* AsyncKeyword */, insertBefore); + changes.insertModifierBefore(sourceFile, 122 /* AsyncKeyword */, insertBefore); } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); @@ -116102,17 +117348,17 @@ var ts; var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration)); var optional = !!(symbol.flags & 16777216 /* Optional */); switch (declaration.kind) { - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 153 /* PropertySignature */: - case 154 /* PropertyDeclaration */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 154 /* PropertySignature */: + case 155 /* PropertyDeclaration */: var typeNode = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context)); out(ts.createProperty( /*decorators*/ undefined, modifiers, name, optional ? ts.createToken(56 /* QuestionToken */) : undefined, typeNode, /*initializer*/ undefined)); break; - case 155 /* MethodSignature */: - case 156 /* MethodDeclaration */: + case 156 /* MethodSignature */: + case 157 /* MethodDeclaration */: // The signature for the implementation appears as an entry in `signatures` iff // there is only one signature. // If there are overloads and an implementation signature, it appears as an @@ -116153,7 +117399,7 @@ var ts; } function signatureToMethodDeclaration(context, signature, enclosingDeclaration, modifiers, name, optional, body) { var program = context.program; - var signatureDeclaration = program.getTypeChecker().signatureToSignatureDeclaration(signature, 156 /* MethodDeclaration */, enclosingDeclaration, 1 /* NoTruncation */ | 256 /* SuppressAnyReturnType */, getNoopSymbolTrackerWithResolver(context)); + var signatureDeclaration = program.getTypeChecker().signatureToSignatureDeclaration(signature, 157 /* MethodDeclaration */, enclosingDeclaration, 1 /* NoTruncation */ | 256 /* SuppressAnyReturnType */, getNoopSymbolTrackerWithResolver(context)); if (!signatureDeclaration) { return undefined; } @@ -116181,7 +117427,7 @@ var ts; var returnType = (inJs || !contextualType) ? undefined : checker.typeToTypeNode(contextualType, contextNode, /*flags*/ undefined, tracker); return ts.createMethod( /*decorators*/ undefined, - /*modifiers*/ makeStatic ? [ts.createToken(116 /* StaticKeyword */)] : undefined, + /*modifiers*/ makeStatic ? [ts.createToken(117 /* StaticKeyword */)] : undefined, /*asteriskToken*/ ts.isYieldExpression(parent) ? ts.createToken(40 /* AsteriskToken */) : undefined, methodName, /*questionToken*/ undefined, /*typeParameters*/ inJs ? undefined : ts.map(typeArguments, function (_, i) { @@ -116200,7 +117446,7 @@ var ts; /*dotDotDotToken*/ undefined, /*name*/ names && names[i] || "arg" + i, /*questionToken*/ minArgumentCount !== undefined && i >= minArgumentCount ? ts.createToken(56 /* QuestionToken */) : undefined, - /*type*/ inJs ? undefined : types && types[i] || ts.createKeywordTypeNode(120 /* AnyKeyword */), + /*type*/ inJs ? undefined : types && types[i] || ts.createKeywordTypeNode(121 /* AnyKeyword */), /*initializer*/ undefined); parameters.push(newParameter); } @@ -116228,7 +117474,7 @@ var ts; var maxArgsParameterSymbolNames = maxArgsSignature.parameters.map(function (symbol) { return symbol.name; }); var parameters = createDummyParameters(maxNonRestArgs, maxArgsParameterSymbolNames, /* types */ undefined, minArgumentCount, /*inJs*/ false); if (someSigHasRestParameter) { - var anyArrayType = ts.createArrayTypeNode(ts.createKeywordTypeNode(120 /* AnyKeyword */)); + var anyArrayType = ts.createArrayTypeNode(ts.createKeywordTypeNode(121 /* AnyKeyword */)); var restParameter = ts.createParameter( /*decorators*/ undefined, /*modifiers*/ undefined, ts.createToken(25 /* DotDotDotToken */), maxArgsParameterSymbolNames[maxNonRestArgs] || "rest", @@ -116254,10 +117500,10 @@ var ts; } function createVisibilityModifier(flags) { if (flags & 4 /* Public */) { - return ts.createToken(115 /* PublicKeyword */); + return ts.createToken(116 /* PublicKeyword */); } else if (flags & 16 /* Protected */) { - return ts.createToken(114 /* ProtectedKeyword */); + return ts.createToken(115 /* ProtectedKeyword */); } return undefined; } @@ -116329,7 +117575,7 @@ var ts; }); function getActionsForUsageOfInvalidImport(context) { var sourceFile = context.sourceFile; - var targetKind = ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures.code === context.errorCode ? 191 /* CallExpression */ : 192 /* NewExpression */; + var targetKind = ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures.code === context.errorCode ? 192 /* CallExpression */ : 193 /* NewExpression */; var node = ts.findAncestor(ts.getTokenAtPosition(sourceFile, context.span.start), function (a) { return a.kind === targetKind && a.getStart() === context.span.start && a.getEnd() === (context.span.start + context.span.length); }); if (!node) { return []; @@ -116448,7 +117694,7 @@ var ts; return codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Add_undefined_type_to_property_0, propertyDeclaration.name.getText()], fixIdAddUndefinedType, ts.Diagnostics.Add_undefined_type_to_all_uninitialized_properties); } function addUndefinedType(changeTracker, propertyDeclarationSourceFile, propertyDeclaration) { - var undefinedTypeNode = ts.createKeywordTypeNode(141 /* UndefinedKeyword */); + var undefinedTypeNode = ts.createKeywordTypeNode(142 /* UndefinedKeyword */); var type = propertyDeclaration.type; // TODO: GH#18217 var types = ts.isUnionTypeNode(type) ? type.types.concat(undefinedTypeNode) : [type, undefinedTypeNode]; changeTracker.replaceNode(propertyDeclarationSourceFile, type, ts.createUnionTypeNode(types)); @@ -116494,235 +117740,6 @@ var ts; } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); -var ts; -(function (ts) { - function generateTypesForModule(name, moduleValue, formatSettings) { - return generateTypesForModuleOrGlobal(name, moduleValue, formatSettings, 0 /* ExportEquals */); - } - ts.generateTypesForModule = generateTypesForModule; - function generateTypesForGlobal(name, globalValue, formatSettings) { - return generateTypesForModuleOrGlobal(name, globalValue, formatSettings, 3 /* Global */); - } - ts.generateTypesForGlobal = generateTypesForGlobal; - function generateTypesForModuleOrGlobal(name, globalValue, formatSettings, outputKind) { - return valueInfoToDeclarationFileText(ts.inspectValue(name, globalValue), formatSettings, outputKind); - } - /* @internal */ - function valueInfoToDeclarationFileText(valueInfo, formatSettings, outputKind) { - if (outputKind === void 0) { outputKind = 0 /* ExportEquals */; } - return ts.textChanges.getNewFileText(toStatements(valueInfo, outputKind), 3 /* TS */, formatSettings.newLineCharacter || "\n", ts.formatting.getFormatContext(formatSettings)); - } - ts.valueInfoToDeclarationFileText = valueInfoToDeclarationFileText; - /* @internal */ - var OutputKind; - (function (OutputKind) { - OutputKind[OutputKind["ExportEquals"] = 0] = "ExportEquals"; - OutputKind[OutputKind["NamedExport"] = 1] = "NamedExport"; - OutputKind[OutputKind["NamespaceMember"] = 2] = "NamespaceMember"; - OutputKind[OutputKind["Global"] = 3] = "Global"; - })(OutputKind || (OutputKind = {})); - function toNamespaceMemberStatements(info) { - return toStatements(info, 2 /* NamespaceMember */); - } - function toStatements(info, kind) { - var isDefault = info.name === "default" /* Default */; - var name = isDefault ? "_default" : info.name; - if (!isValidIdentifier(name) || isDefault && kind !== 1 /* NamedExport */) - return ts.emptyArray; - var modifiers = isDefault && info.kind === 2 /* FunctionOrClass */ ? [ts.createModifier(85 /* ExportKeyword */), ts.createModifier(80 /* DefaultKeyword */)] - : kind === 3 /* Global */ || kind === 0 /* ExportEquals */ ? [ts.createModifier(125 /* DeclareKeyword */)] - : kind === 1 /* NamedExport */ ? [ts.createModifier(85 /* ExportKeyword */)] - : undefined; - var exportEquals = function () { return kind === 0 /* ExportEquals */ ? [exportEqualsOrDefault(info.name, /*isExportEquals*/ true)] : ts.emptyArray; }; - var exportDefault = function () { return isDefault ? [exportEqualsOrDefault("_default", /*isExportEquals*/ false)] : ts.emptyArray; }; - switch (info.kind) { - case 2 /* FunctionOrClass */: - return exportEquals().concat(functionOrClassToStatements(modifiers, name, info)); - case 3 /* Object */: - var members = info.members, hasNontrivialPrototype = info.hasNontrivialPrototype; - if (!hasNontrivialPrototype) { - if (kind === 0 /* ExportEquals */) { - return ts.flatMap(members, function (v) { return toStatements(v, 1 /* NamedExport */); }); - } - if (members.some(function (m) { return m.kind === 2 /* FunctionOrClass */; })) { - // If some member is a function, use a namespace so it gets a FunctionDeclaration or ClassDeclaration. - return exportDefault().concat([createNamespace(modifiers, name, ts.flatMap(members, toNamespaceMemberStatements))]); - } - } - // falls through - case 0 /* Const */: - case 1 /* Array */: { - var comment = info.kind === 0 /* Const */ ? info.comment : undefined; - var constVar = ts.createVariableStatement(modifiers, ts.createVariableDeclarationList([ts.createVariableDeclaration(name, toType(info))], 2 /* Const */)); - return exportEquals().concat(exportDefault(), [addComment(constVar, comment)]); - } - default: - return ts.Debug.assertNever(info); - } - } - function exportEqualsOrDefault(name, isExportEquals) { - return ts.createExportAssignment(/*decorators*/ undefined, /*modifiers*/ undefined, isExportEquals, ts.createIdentifier(name)); - } - function functionOrClassToStatements(modifiers, name, _a) { - var source = _a.source, prototypeMembers = _a.prototypeMembers, namespaceMembers = _a.namespaceMembers; - var fnAst = parseClassOrFunctionBody(source); - var _b = fnAst === undefined ? { parameters: ts.emptyArray, returnType: anyType() } : getParametersAndReturnType(fnAst), parameters = _b.parameters, returnType = _b.returnType; - var protoOrInstanceMembers = ts.createMap(); - if (typeof fnAst === "object") - getConstructorFunctionInstanceProperties(fnAst, protoOrInstanceMembers); - for (var _i = 0, prototypeMembers_1 = prototypeMembers; _i < prototypeMembers_1.length; _i++) { - var p = prototypeMembers_1[_i]; - // ignore non-functions on the prototype - if (p.kind === 2 /* FunctionOrClass */) { - var m = tryGetMethod(p); - if (m) { - protoOrInstanceMembers.set(p.name, m); - } - } - } - var classStaticMembers = protoOrInstanceMembers.size !== 0 || fnAst === undefined || typeof fnAst !== "number" && fnAst.kind === 157 /* Constructor */ ? [] : undefined; - var namespaceStatements = ts.flatMap(namespaceMembers, function (info) { - if (!isValidIdentifier(info.name)) - return undefined; - if (classStaticMembers) { - switch (info.kind) { - case 3 /* Object */: - if (info.members.some(function (m) { return m.kind === 2 /* FunctionOrClass */; })) { - break; - } - // falls through - case 1 /* Array */: - case 0 /* Const */: - classStaticMembers.push(addComment(ts.createProperty(/*decorators*/ undefined, [ts.createModifier(116 /* StaticKeyword */)], info.name, /*questionOrExclamationToken*/ undefined, toType(info), /*initializer*/ undefined), info.kind === 0 /* Const */ ? info.comment : undefined)); - return undefined; - case 2 /* FunctionOrClass */: - if (!info.namespaceMembers.length) { // Else, can't merge a static method with a namespace. Must make it a function on the namespace. - var sig = tryGetMethod(info, [ts.createModifier(116 /* StaticKeyword */)]); - if (sig) { - classStaticMembers.push(sig); - return undefined; - } - } - break; - default: - ts.Debug.assertNever(info); - } - } - return toStatements(info, 2 /* NamespaceMember */); - }); - var decl = classStaticMembers - ? ts.createClassDeclaration( - /*decorators*/ undefined, modifiers, name, - /*typeParameters*/ undefined, - /*heritageClauses*/ undefined, classStaticMembers.concat((parameters.length ? [ts.createConstructor(/*decorators*/ undefined, /*modifiers*/ undefined, parameters, /*body*/ undefined)] : ts.emptyArray), ts.arrayFrom(protoOrInstanceMembers.values()))) - : ts.createFunctionDeclaration(/*decorators*/ undefined, modifiers, /*asteriskToken*/ undefined, name, /*typeParameters*/ undefined, parameters, returnType, /*body*/ undefined); - return [decl].concat((namespaceStatements.length === 0 ? ts.emptyArray : [createNamespace(modifiers && modifiers.map(function (m) { return ts.getSynthesizedDeepClone(m); }), name, namespaceStatements)])); - } - function tryGetMethod(_a, modifiers) { - var name = _a.name, source = _a.source; - if (!isValidIdentifier(name)) - return undefined; - var fnAst = parseClassOrFunctionBody(source); - if (fnAst === undefined || (typeof fnAst !== "number" && fnAst.kind === 157 /* Constructor */)) - return undefined; - var sig = getParametersAndReturnType(fnAst); - return sig && ts.createMethod( - /*decorators*/ undefined, modifiers, - /*asteriskToken*/ undefined, name, - /*questionToken*/ undefined, - /*typeParameters*/ undefined, sig.parameters, sig.returnType, - /*body*/ undefined); - } - function toType(info) { - switch (info.kind) { - case 0 /* Const */: - return ts.createTypeReferenceNode(info.typeName, /*typeArguments*/ undefined); - case 1 /* Array */: - return ts.createArrayTypeNode(toType(info.inner)); - case 2 /* FunctionOrClass */: - return ts.createTypeReferenceNode("Function", /*typeArguments*/ undefined); // Normally we create a FunctionDeclaration, but this can happen for a function in an array. - case 3 /* Object */: - return ts.createTypeLiteralNode(info.members.map(function (m) { return ts.createPropertySignature(/*modifiers*/ undefined, toPropertyName(m.name), /*questionToken*/ undefined, toType(m), /*initializer*/ undefined); })); - default: - return ts.Debug.assertNever(info); - } - } - function toPropertyName(name) { - return ts.isIdentifierText(name, 7 /* ESNext */) ? ts.createIdentifier(name) : ts.createStringLiteral(name); - } - // Parses assignments to "this.x" in the constructor into class property declarations - function getConstructorFunctionInstanceProperties(fnAst, members) { - forEachOwnNodeOfFunction(fnAst, function (node) { - if (ts.isAssignmentExpression(node, /*excludeCompoundAssignment*/ true) && - ts.isPropertyAccessExpression(node.left) && node.left.expression.kind === 100 /* ThisKeyword */) { - var name_4 = node.left.name.text; - if (!ts.isJsPrivate(name_4)) { - ts.getOrUpdate(members, name_4, function () { return ts.createProperty(/*decorators*/ undefined, /*modifiers*/ undefined, name_4, /*questionOrExclamationToken*/ undefined, anyType(), /*initializer*/ undefined); }); - } - } - }); - } - function getParametersAndReturnType(fnAst) { - if (typeof fnAst === "number") { - return { parameters: ts.fill(fnAst, function (i) { return makeParameter("p" + i, anyType()); }), returnType: anyType() }; - } - var usedArguments = false, hasReturn = false; - forEachOwnNodeOfFunction(fnAst, function (node) { - usedArguments = usedArguments || ts.isIdentifier(node) && node.text === "arguments"; - hasReturn = hasReturn || ts.isReturnStatement(node) && !!node.expression && node.expression.kind !== 200 /* VoidExpression */; - }); - var parameters = fnAst.parameters.map(function (p) { return makeParameter("" + p.name.getText(), inferParameterType(fnAst, p)); }).concat((usedArguments ? [makeRestParameter()] : ts.emptyArray)); - return { parameters: parameters, returnType: hasReturn ? anyType() : ts.createKeywordTypeNode(106 /* VoidKeyword */) }; - } - function makeParameter(name, type) { - return ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, name, /*questionToken*/ undefined, type); - } - function makeRestParameter() { - return ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, ts.createToken(25 /* DotDotDotToken */), "args", /*questionToken*/ undefined, ts.createArrayTypeNode(anyType())); - } - /** Returns 'undefined' for class with no declared constructor */ - function parseClassOrFunctionBody(source) { - if (typeof source === "number") - return source; - var classOrFunction = ts.tryCast(parseExpression(source), function (node) { return ts.isFunctionExpression(node) || ts.isArrowFunction(node) || ts.isClassExpression(node); }); - return classOrFunction - ? ts.isClassExpression(classOrFunction) ? ts.find(classOrFunction.members, ts.isConstructorDeclaration) : classOrFunction - // If that didn't parse, it's a method `m() {}`. Parse again inside of an object literal. - : ts.cast(ts.first(ts.cast(parseExpression("{ " + source + " }"), ts.isObjectLiteralExpression).properties), ts.isMethodDeclaration); - } - function parseExpression(expr) { - var text = "const _ = " + expr; - var srcFile = ts.createSourceFile("test.ts", text, 7 /* Latest */, /*setParentNodes*/ true); - return ts.first(ts.cast(ts.first(srcFile.statements), ts.isVariableStatement).declarationList.declarations).initializer; - } - function inferParameterType(_fn, _param) { - // TODO: Inspect function body for clues (see inferFromUsage.ts) - return anyType(); - } - // Descends through all nodes in a function, but not in nested functions. - function forEachOwnNodeOfFunction(fnAst, cb) { - fnAst.body.forEachChild(function recur(node) { - cb(node); - if (!ts.isFunctionLike(node)) - node.forEachChild(recur); - }); - } - function isValidIdentifier(name) { - var keyword = ts.stringToToken(name); - return !(keyword && ts.isNonContextualKeyword(keyword)) && ts.isIdentifierText(name, 7 /* ESNext */); - } - function addComment(node, comment) { - if (comment !== undefined) - ts.addSyntheticLeadingComment(node, 2 /* SingleLineCommentTrivia */, comment); - return node; - } - function anyType() { - return ts.createKeywordTypeNode(120 /* AnyKeyword */); - } - function createNamespace(modifiers, name, statements) { - return ts.createModuleDeclaration(/*decorators*/ undefined, modifiers, ts.createIdentifier(name), ts.createModuleBlock(statements), 16 /* Namespace */); - } -})(ts || (ts = {})); /* @internal */ var ts; (function (ts) { @@ -116819,8 +117836,8 @@ var ts; }); function getImportTypeNode(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); - ts.Debug.assert(token.kind === 92 /* ImportKeyword */); - ts.Debug.assert(token.parent.kind === 183 /* ImportType */); + ts.Debug.assert(token.kind === 93 /* ImportKeyword */); + ts.Debug.assert(token.parent.kind === 184 /* ImportType */); return token.parent; } function doChange(changes, sourceFile, importType) { @@ -116872,7 +117889,7 @@ var ts; var otherMembers = members.filter(function (member) { return !ts.isIndexSignatureDeclaration(member); }); var parameter = ts.first(indexSignature.parameters); var mappedTypeParameter = ts.createTypeParameterDeclaration(ts.cast(parameter.name, ts.isIdentifier), parameter.type); - var mappedIntersectionType = ts.createMappedTypeNode(ts.hasReadonlyModifier(indexSignature) ? ts.createModifier(133 /* ReadonlyKeyword */) : undefined, mappedTypeParameter, indexSignature.questionToken, indexSignature.type); + var mappedIntersectionType = ts.createMappedTypeNode(ts.hasReadonlyModifier(indexSignature) ? ts.createModifier(134 /* ReadonlyKeyword */) : undefined, mappedTypeParameter, indexSignature.questionToken, indexSignature.type); var intersectionType = ts.createIntersectionTypeNode(ts.getAllSuperTypeNodes(container).concat([ mappedIntersectionType ], (otherMembers.length ? [ts.createTypeLiteralNode(otherMembers)] : ts.emptyArray))); @@ -116919,16 +117936,16 @@ var ts; return undefined; } switch (exportNode.kind) { - case 239 /* FunctionDeclaration */: - case 240 /* ClassDeclaration */: - case 241 /* InterfaceDeclaration */: - case 243 /* EnumDeclaration */: - case 242 /* TypeAliasDeclaration */: - case 244 /* ModuleDeclaration */: { + case 240 /* FunctionDeclaration */: + case 241 /* ClassDeclaration */: + case 242 /* InterfaceDeclaration */: + case 244 /* EnumDeclaration */: + case 243 /* TypeAliasDeclaration */: + case 245 /* ModuleDeclaration */: { var node = exportNode; return node.name && ts.isIdentifier(node.name) ? { exportNode: node, exportName: node.name, wasDefault: wasDefault, exportingModuleSymbol: exportingModuleSymbol } : undefined; } - case 219 /* VariableStatement */: { + case 220 /* VariableStatement */: { var vs = exportNode; // Must be `export const x = something;`. if (!(vs.declarationList.flags & 2 /* Const */) || vs.declarationList.declarations.length !== 1) { @@ -116951,17 +117968,17 @@ var ts; function changeExport(exportingSourceFile, _a, changes, checker) { var wasDefault = _a.wasDefault, exportNode = _a.exportNode, exportName = _a.exportName; if (wasDefault) { - changes.delete(exportingSourceFile, ts.Debug.assertDefined(ts.findModifier(exportNode, 80 /* DefaultKeyword */))); + changes.delete(exportingSourceFile, ts.Debug.assertDefined(ts.findModifier(exportNode, 81 /* DefaultKeyword */))); } else { - var exportKeyword = ts.Debug.assertDefined(ts.findModifier(exportNode, 85 /* ExportKeyword */)); + var exportKeyword = ts.Debug.assertDefined(ts.findModifier(exportNode, 86 /* ExportKeyword */)); switch (exportNode.kind) { - case 239 /* FunctionDeclaration */: - case 240 /* ClassDeclaration */: - case 241 /* InterfaceDeclaration */: - changes.insertNodeAfter(exportingSourceFile, exportKeyword, ts.createToken(80 /* DefaultKeyword */)); + case 240 /* FunctionDeclaration */: + case 241 /* ClassDeclaration */: + case 242 /* InterfaceDeclaration */: + changes.insertNodeAfter(exportingSourceFile, exportKeyword, ts.createToken(81 /* DefaultKeyword */)); break; - case 219 /* VariableStatement */: + case 220 /* VariableStatement */: // If 'x' isn't used in this file, `export const x = 0;` --> `export default 0;` if (!ts.FindAllReferences.Core.isSymbolReferencedInFile(exportName, checker, exportingSourceFile)) { // We checked in `getInfo` that an initializer exists. @@ -116969,9 +117986,9 @@ var ts; break; } // falls through - case 243 /* EnumDeclaration */: - case 242 /* TypeAliasDeclaration */: - case 244 /* ModuleDeclaration */: + case 244 /* EnumDeclaration */: + case 243 /* TypeAliasDeclaration */: + case 245 /* ModuleDeclaration */: // `export type T = number;` -> `type T = number; export default T;` changes.deleteModifier(exportingSourceFile, exportKeyword); changes.insertNodeAfter(exportingSourceFile, exportNode, ts.createExportDefault(ts.createIdentifier(exportName.text))); @@ -116998,18 +118015,18 @@ var ts; function changeDefaultToNamedImport(importingSourceFile, ref, changes, exportName) { var parent = ref.parent; switch (parent.kind) { - case 189 /* PropertyAccessExpression */: + case 190 /* PropertyAccessExpression */: // `a.default` --> `a.foo` changes.replaceNode(importingSourceFile, ref, ts.createIdentifier(exportName)); break; - case 253 /* ImportSpecifier */: - case 257 /* ExportSpecifier */: { + case 254 /* ImportSpecifier */: + case 258 /* ExportSpecifier */: { var spec = parent; // `default as foo` --> `foo`, `default as bar` --> `foo as bar` changes.replaceNode(importingSourceFile, spec, makeImportSpecifier(exportName, spec.name.text)); break; } - case 250 /* ImportClause */: { + case 251 /* ImportClause */: { var clause = parent; ts.Debug.assert(clause.name === ref); var spec = makeImportSpecifier(exportName, ref.text); @@ -117018,7 +118035,7 @@ var ts; // `import foo from "./a";` --> `import { foo } from "./a";` changes.replaceNode(importingSourceFile, ref, ts.createNamedImports([spec])); } - else if (namedBindings.kind === 251 /* NamespaceImport */) { + else if (namedBindings.kind === 252 /* NamespaceImport */) { // `import foo, * as a from "./a";` --> `import * as a from ".a/"; import { foo } from "./a";` changes.deleteRange(importingSourceFile, { pos: ref.getStart(importingSourceFile), end: namedBindings.getStart(importingSourceFile) }); var quotePreference = ts.isStringLiteral(clause.parent.moduleSpecifier) ? ts.quotePreferenceFromString(clause.parent.moduleSpecifier, importingSourceFile) : 1 /* Double */; @@ -117039,11 +118056,11 @@ var ts; function changeNamedToDefaultImport(importingSourceFile, ref, changes) { var parent = ref.parent; switch (parent.kind) { - case 189 /* PropertyAccessExpression */: + case 190 /* PropertyAccessExpression */: // `a.foo` --> `a.default` changes.replaceNode(importingSourceFile, ref, ts.createIdentifier("default")); break; - case 253 /* ImportSpecifier */: { + case 254 /* ImportSpecifier */: { // `import { foo } from "./a";` --> `import foo from "./a";` // `import { foo as bar } from "./a";` --> `import bar from "./a";` var defaultImport = ts.createIdentifier(parent.name.text); @@ -117056,7 +118073,7 @@ var ts; } break; } - case 257 /* ExportSpecifier */: { + case 258 /* ExportSpecifier */: { // `export { foo } from "./a";` --> `export { default as foo } from "./a";` // `export { foo as bar } from "./a";` --> `export { default as bar } from "./a";` // `export { foo as default } from "./a";` --> `export { default } from "./a";` @@ -117089,8 +118106,8 @@ var ts; var i = getImportToConvert(context); if (!i) return ts.emptyArray; - var description = i.kind === 251 /* NamespaceImport */ ? ts.Diagnostics.Convert_namespace_import_to_named_imports.message : ts.Diagnostics.Convert_named_imports_to_namespace_import.message; - var actionName = i.kind === 251 /* NamespaceImport */ ? actionNameNamespaceToNamed : actionNameNamedToNamespace; + var description = i.kind === 252 /* NamespaceImport */ ? ts.Diagnostics.Convert_namespace_import_to_named_imports.message : ts.Diagnostics.Convert_named_imports_to_namespace_import.message; + var actionName = i.kind === 252 /* NamespaceImport */ ? actionNameNamespaceToNamed : actionNameNamedToNamespace; return [{ name: refactorName, description: description, actions: [{ name: actionName, description: description }] }]; }, getEditsForAction: function (context, actionName) { @@ -117112,7 +118129,7 @@ var ts; } function doChange(sourceFile, program, changes, toConvert) { var checker = program.getTypeChecker(); - if (toConvert.kind === 251 /* NamespaceImport */) { + if (toConvert.kind === 252 /* NamespaceImport */) { doChangeNamespaceToNamed(sourceFile, checker, changes, toConvert, ts.getAllowSyntheticDefaultImports(program.getCompilerOptions())); } else { @@ -117164,7 +118181,7 @@ var ts; function doChangeNamedToNamespace(sourceFile, checker, changes, toConvert) { var importDecl = toConvert.parent.parent; var moduleSpecifier = importDecl.moduleSpecifier; - var preferredName = moduleSpecifier && ts.isStringLiteral(moduleSpecifier) ? ts.codefix.moduleSpecifierToValidIdentifier(moduleSpecifier.text, 7 /* ESNext */) : "module"; + var preferredName = moduleSpecifier && ts.isStringLiteral(moduleSpecifier) ? ts.codefix.moduleSpecifierToValidIdentifier(moduleSpecifier.text, 8 /* ESNext */) : "module"; var namespaceNameConflicts = toConvert.elements.some(function (element) { return ts.FindAllReferences.Core.eachSymbolReferenceInFile(element.name, checker, sourceFile, function (id) { return !!checker.resolveName(preferredName, id, 67108863 /* All */, /*excludeGlobals*/ true); @@ -117455,20 +118472,20 @@ var ts; function checkForStaticContext(nodeToCheck, containingClass) { var current = nodeToCheck; while (current !== containingClass) { - if (current.kind === 154 /* PropertyDeclaration */) { + if (current.kind === 155 /* PropertyDeclaration */) { if (ts.hasModifier(current, 32 /* Static */)) { rangeFacts |= RangeFacts.InStaticRegion; } break; } - else if (current.kind === 151 /* Parameter */) { + else if (current.kind === 152 /* Parameter */) { var ctorOrMethod = ts.getContainingFunction(current); - if (ctorOrMethod.kind === 157 /* Constructor */) { + if (ctorOrMethod.kind === 158 /* Constructor */) { rangeFacts |= RangeFacts.InStaticRegion; } break; } - else if (current.kind === 156 /* MethodDeclaration */) { + else if (current.kind === 157 /* MethodDeclaration */) { if (ts.hasModifier(current, 32 /* Static */)) { rangeFacts |= RangeFacts.InStaticRegion; } @@ -117511,7 +118528,7 @@ var ts; return true; } if (ts.isDeclaration(node)) { - var declaringNode = (node.kind === 237 /* VariableDeclaration */) ? node.parent.parent : node; + var declaringNode = (node.kind === 238 /* VariableDeclaration */) ? node.parent.parent : node; if (ts.hasModifier(declaringNode, 1 /* Export */)) { // TODO: GH#18217 Silly to use `errors ||` since it's definitely not defined (see top of `visit`) // Also, if we're only pushing one error, just use `let error: Diagnostic | undefined`! @@ -117523,13 +118540,13 @@ var ts; } // Some things can't be extracted in certain situations switch (node.kind) { - case 249 /* ImportDeclaration */: + case 250 /* ImportDeclaration */: (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractImport)); return true; - case 98 /* SuperKeyword */: + case 99 /* SuperKeyword */: // For a super *constructor call*, we have to be extracting the entire class, // but a super *method call* simply implies a 'this' reference - if (node.parent.kind === 191 /* CallExpression */) { + if (node.parent.kind === 192 /* CallExpression */) { // Super constructor call var containingClass_1 = ts.getContainingClass(node); // TODO:GH#18217 if (containingClass_1.pos < span.start || containingClass_1.end >= (span.start + span.length)) { @@ -117544,8 +118561,8 @@ var ts; } if (ts.isFunctionLikeDeclaration(node) || ts.isClassLike(node)) { switch (node.kind) { - case 239 /* FunctionDeclaration */: - case 240 /* ClassDeclaration */: + case 240 /* FunctionDeclaration */: + case 241 /* ClassDeclaration */: if (ts.isSourceFile(node.parent) && node.parent.externalModuleIndicator === undefined) { // You cannot extract global declarations (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.functionWillNotBeVisibleInTheNewScope)); @@ -117557,20 +118574,20 @@ var ts; } var savedPermittedJumps = permittedJumps; switch (node.kind) { - case 222 /* IfStatement */: + case 223 /* IfStatement */: permittedJumps = 0 /* None */; break; - case 235 /* TryStatement */: + case 236 /* TryStatement */: // forbid all jumps inside try blocks permittedJumps = 0 /* None */; break; - case 218 /* Block */: - if (node.parent && node.parent.kind === 235 /* TryStatement */ && node.parent.finallyBlock === node) { + case 219 /* Block */: + if (node.parent && node.parent.kind === 236 /* TryStatement */ && node.parent.finallyBlock === node) { // allow unconditional returns from finally blocks permittedJumps = 4 /* Return */; } break; - case 271 /* CaseClause */: + case 272 /* CaseClause */: // allow unlabeled break inside case clauses permittedJumps |= 1 /* Break */; break; @@ -117582,19 +118599,19 @@ var ts; break; } switch (node.kind) { - case 178 /* ThisType */: - case 100 /* ThisKeyword */: + case 179 /* ThisType */: + case 101 /* ThisKeyword */: rangeFacts |= RangeFacts.UsesThis; break; - case 233 /* LabeledStatement */: { + case 234 /* LabeledStatement */: { var label = node.label; (seenLabels || (seenLabels = [])).push(label.escapedText); ts.forEachChild(node, visit); seenLabels.pop(); break; } - case 229 /* BreakStatement */: - case 228 /* ContinueStatement */: { + case 230 /* BreakStatement */: + case 229 /* ContinueStatement */: { var label = node.label; if (label) { if (!ts.contains(seenLabels, label.escapedText)) { @@ -117603,20 +118620,20 @@ var ts; } } else { - if (!(permittedJumps & (node.kind === 229 /* BreakStatement */ ? 1 /* Break */ : 2 /* Continue */))) { + if (!(permittedJumps & (node.kind === 230 /* BreakStatement */ ? 1 /* Break */ : 2 /* Continue */))) { // attempt to break or continue in a forbidden context (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractRangeContainingConditionalBreakOrContinueStatements)); } } break; } - case 201 /* AwaitExpression */: + case 202 /* AwaitExpression */: rangeFacts |= RangeFacts.IsAsyncFunction; break; - case 207 /* YieldExpression */: + case 208 /* YieldExpression */: rangeFacts |= RangeFacts.IsGenerator; break; - case 230 /* ReturnStatement */: + case 231 /* ReturnStatement */: if (permittedJumps & 4 /* Return */) { rangeFacts |= RangeFacts.HasReturn; } @@ -117670,7 +118687,7 @@ var ts; while (true) { current = current.parent; // A function parameter's initializer is actually in the outer scope, not the function declaration - if (current.kind === 151 /* Parameter */) { + if (current.kind === 152 /* Parameter */) { // Skip all the way to the outer scope of the function that declared this parameter current = ts.findAncestor(current, function (parent) { return ts.isFunctionLikeDeclaration(parent); }).parent; } @@ -117681,7 +118698,7 @@ var ts; // * Module/namespace or source file if (isScope(current)) { scopes.push(current); - if (current.kind === 284 /* SourceFile */) { + if (current.kind === 285 /* SourceFile */) { return scopes; } } @@ -117771,32 +118788,32 @@ var ts; } function getDescriptionForFunctionLikeDeclaration(scope) { switch (scope.kind) { - case 157 /* Constructor */: + case 158 /* Constructor */: return "constructor"; - case 196 /* FunctionExpression */: - case 239 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: + case 240 /* FunctionDeclaration */: return scope.name ? "function '" + scope.name.text + "'" : "anonymous function"; - case 197 /* ArrowFunction */: + case 198 /* ArrowFunction */: return "arrow function"; - case 156 /* MethodDeclaration */: + case 157 /* MethodDeclaration */: return "method '" + scope.name.getText() + "'"; - case 158 /* GetAccessor */: + case 159 /* GetAccessor */: return "'get " + scope.name.getText() + "'"; - case 159 /* SetAccessor */: + case 160 /* SetAccessor */: return "'set " + scope.name.getText() + "'"; default: throw ts.Debug.assertNever(scope); } } function getDescriptionForClassLikeDeclaration(scope) { - return scope.kind === 240 /* ClassDeclaration */ + return scope.kind === 241 /* ClassDeclaration */ ? scope.name ? "class '" + scope.name.text + "'" : "anonymous class declaration" : scope.name ? "class expression '" + scope.name.text + "'" : "anonymous class expression"; } function getDescriptionForModuleLikeDeclaration(scope) { - return scope.kind === 245 /* ModuleBlock */ + return scope.kind === 246 /* ModuleBlock */ ? "namespace '" + scope.parent.name.getText() + "'" : scope.externalModuleIndicator ? 0 /* Module */ : 1 /* Global */; } @@ -117862,12 +118879,12 @@ var ts; var newFunction; if (ts.isClassLike(scope)) { // always create private method in TypeScript files - var modifiers = isJS ? [] : [ts.createToken(113 /* PrivateKeyword */)]; + var modifiers = isJS ? [] : [ts.createToken(114 /* PrivateKeyword */)]; if (range.facts & RangeFacts.InStaticRegion) { - modifiers.push(ts.createToken(116 /* StaticKeyword */)); + modifiers.push(ts.createToken(117 /* StaticKeyword */)); } if (range.facts & RangeFacts.IsAsyncFunction) { - modifiers.push(ts.createToken(121 /* AsyncKeyword */)); + modifiers.push(ts.createToken(122 /* AsyncKeyword */)); } newFunction = ts.createMethod( /*decorators*/ undefined, modifiers.length ? modifiers : undefined, range.facts & RangeFacts.IsGenerator ? ts.createToken(40 /* AsteriskToken */) : undefined, functionName, @@ -117875,7 +118892,7 @@ var ts; } else { newFunction = ts.createFunctionDeclaration( - /*decorators*/ undefined, range.facts & RangeFacts.IsAsyncFunction ? [ts.createToken(121 /* AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.createToken(40 /* AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body); + /*decorators*/ undefined, range.facts & RangeFacts.IsAsyncFunction ? [ts.createToken(122 /* AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.createToken(40 /* AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body); } var changeTracker = ts.textChanges.ChangeTracker.fromContext(context); var minInsertionPos = (isReadonlyArray(range.range) ? ts.last(range.range) : range.range).end; @@ -118016,9 +119033,9 @@ var ts; while (ts.isParenthesizedTypeNode(withoutParens)) { withoutParens = withoutParens.type; } - return ts.isUnionTypeNode(withoutParens) && ts.find(withoutParens.types, function (t) { return t.kind === 141 /* UndefinedKeyword */; }) + return ts.isUnionTypeNode(withoutParens) && ts.find(withoutParens.types, function (t) { return t.kind === 142 /* UndefinedKeyword */; }) ? clone - : ts.createUnionTypeNode([clone, ts.createKeywordTypeNode(141 /* UndefinedKeyword */)]); + : ts.createUnionTypeNode([clone, ts.createKeywordTypeNode(142 /* UndefinedKeyword */)]); } } /** @@ -118041,11 +119058,11 @@ var ts; if (ts.isClassLike(scope)) { ts.Debug.assert(!isJS); // See CannotExtractToJSClass var modifiers = []; - modifiers.push(ts.createToken(113 /* PrivateKeyword */)); + modifiers.push(ts.createToken(114 /* PrivateKeyword */)); if (rangeFacts & RangeFacts.InStaticRegion) { - modifiers.push(ts.createToken(116 /* StaticKeyword */)); + modifiers.push(ts.createToken(117 /* StaticKeyword */)); } - modifiers.push(ts.createToken(133 /* ReadonlyKeyword */)); + modifiers.push(ts.createToken(134 /* ReadonlyKeyword */)); var newVariable = ts.createProperty( /*decorators*/ undefined, modifiers, localNameText, /*questionToken*/ undefined, variableType, initializer); @@ -118074,7 +119091,7 @@ var ts; var localReference = ts.createIdentifier(localNameText); changeTracker.replaceNode(context.file, node, localReference); } - else if (node.parent.kind === 221 /* ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) { + else if (node.parent.kind === 222 /* ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) { // If the parent is an expression statement and the target scope is the immediately enclosing one, // replace the statement with the declaration. var newVariableStatement = ts.createVariableStatement( @@ -118093,7 +119110,7 @@ var ts; changeTracker.insertNodeBefore(context.file, nodeToInsertBefore, newVariableStatement, /*blankLineBetween*/ false); } // Consume - if (node.parent.kind === 221 /* ExpressionStatement */) { + if (node.parent.kind === 222 /* ExpressionStatement */) { // If the parent is an expression statement, delete it. changeTracker.delete(context.file, node.parent); } @@ -118180,7 +119197,7 @@ var ts; return { body: ts.createBlock(statements, /*multiLine*/ true), returnValueProperty: undefined }; } function visitor(node) { - if (!ignoreReturns && node.kind === 230 /* ReturnStatement */ && hasWritesOrVariableDeclarations) { + if (!ignoreReturns && node.kind === 231 /* ReturnStatement */ && hasWritesOrVariableDeclarations) { var assignments = getPropertyAssignmentsForWritesAndVariableDeclarations(exposedVariableDeclarations, writes); if (node.expression) { if (!returnValueProperty) { @@ -118358,7 +119375,7 @@ var ts; var scope = scopes_1[_i]; usagesPerScope.push({ usages: ts.createMap(), typeParameterUsages: ts.createMap(), substitutions: ts.createMap() }); substitutionsPerScope.push(ts.createMap()); - functionErrorsPerScope.push(ts.isFunctionLikeDeclaration(scope) && scope.kind !== 239 /* FunctionDeclaration */ + functionErrorsPerScope.push(ts.isFunctionLikeDeclaration(scope) && scope.kind !== 240 /* FunctionDeclaration */ ? [ts.createDiagnosticForNode(scope, Messages.cannotExtractToOtherFunctionLike)] : []); var constantErrors = []; @@ -118674,30 +119691,30 @@ var ts; function isExtractableExpression(node) { var parent = node.parent; switch (parent.kind) { - case 278 /* EnumMember */: + case 279 /* EnumMember */: return false; } switch (node.kind) { case 10 /* StringLiteral */: - return parent.kind !== 249 /* ImportDeclaration */ && - parent.kind !== 253 /* ImportSpecifier */; - case 208 /* SpreadElement */: - case 184 /* ObjectBindingPattern */: - case 186 /* BindingElement */: + return parent.kind !== 250 /* ImportDeclaration */ && + parent.kind !== 254 /* ImportSpecifier */; + case 209 /* SpreadElement */: + case 185 /* ObjectBindingPattern */: + case 187 /* BindingElement */: return false; - case 72 /* Identifier */: - return parent.kind !== 186 /* BindingElement */ && - parent.kind !== 253 /* ImportSpecifier */ && - parent.kind !== 257 /* ExportSpecifier */; + case 73 /* Identifier */: + return parent.kind !== 187 /* BindingElement */ && + parent.kind !== 254 /* ImportSpecifier */ && + parent.kind !== 258 /* ExportSpecifier */; } return true; } function isBlockLike(node) { switch (node.kind) { - case 218 /* Block */: - case 284 /* SourceFile */: - case 245 /* ModuleBlock */: - case 271 /* CaseClause */: + case 219 /* Block */: + case 285 /* SourceFile */: + case 246 /* ModuleBlock */: + case 272 /* CaseClause */: return true; default: return false; @@ -118708,6 +119725,136 @@ var ts; })(ts || (ts = {})); /* @internal */ var ts; +(function (ts) { + var refactor; + (function (refactor) { + var refactorName = "Extract type"; + var extractToTypeAlias = "Extract to type alias"; + var extractToTypeDef = "Extract to typedef"; + refactor.registerRefactor(refactorName, { + getAvailableActions: function (context) { + var info = getRangeToExtract(context); + if (!info) + return ts.emptyArray; + return [{ + name: refactorName, + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Extract_type), + actions: [info.isJS ? { + name: extractToTypeDef, description: ts.getLocaleSpecificMessage(ts.Diagnostics.Extract_to_typedef) + } : { + name: extractToTypeAlias, description: ts.getLocaleSpecificMessage(ts.Diagnostics.Extract_to_type_alias) + }] + }]; + }, + getEditsForAction: function (context, actionName) { + ts.Debug.assert(actionName === extractToTypeAlias || actionName === extractToTypeDef); + var file = context.file; + var info = ts.Debug.assertDefined(getRangeToExtract(context)); + ts.Debug.assert(actionName === extractToTypeAlias && !info.isJS || actionName === extractToTypeDef && info.isJS); + var name = ts.getUniqueName("NewType", file); + var edits = ts.textChanges.ChangeTracker.with(context, function (changes) { return info.isJS ? + doTypedefChange(changes, file, name, info.firstStatement, info.selection, info.typeParameters) : + doTypeAliasChange(changes, file, name, info.firstStatement, info.selection, info.typeParameters); }); + var renameFilename = file.fileName; + var renameLocation = ts.getRenameLocation(edits, renameFilename, name, /*preferLastLocation*/ false); + return { edits: edits, renameFilename: renameFilename, renameLocation: renameLocation }; + } + }); + function getRangeToExtract(context) { + var file = context.file, startPosition = context.startPosition; + var isJS = ts.isSourceFileJS(file); + var current = ts.getTokenAtPosition(file, startPosition); + var range = ts.createTextRangeFromSpan(ts.getRefactorContextSpan(context)); + var selection = ts.findAncestor(current, (function (node) { return node.parent && rangeContainsSkipTrivia(range, node, file) && !rangeContainsSkipTrivia(range, node.parent, file); })); + if (!selection || !ts.isTypeNode(selection)) + return undefined; + var checker = context.program.getTypeChecker(); + var firstStatement = ts.Debug.assertDefined(isJS ? ts.findAncestor(selection, isStatementAndHasJSDoc) : ts.findAncestor(selection, ts.isStatement)); + var typeParameters = collectTypeParameters(checker, selection, firstStatement, file); + if (!typeParameters) + return undefined; + return { isJS: isJS, selection: selection, firstStatement: firstStatement, typeParameters: typeParameters }; + } + function isStatementAndHasJSDoc(n) { + return ts.isStatement(n) && ts.hasJSDocNodes(n); + } + function rangeContainsSkipTrivia(r1, node, file) { + return ts.rangeContainsStartEnd(r1, ts.skipTrivia(file.text, node.pos), node.end); + } + function collectTypeParameters(checker, selection, statement, file) { + var result = []; + return visitor(selection) ? undefined : result; + function visitor(node) { + if (ts.isTypeReferenceNode(node)) { + if (ts.isIdentifier(node.typeName)) { + var symbol = checker.resolveName(node.typeName.text, node.typeName, 262144 /* TypeParameter */, /* excludeGlobals */ true); + if (symbol) { + var declaration = ts.cast(ts.first(symbol.declarations), ts.isTypeParameterDeclaration); + if (rangeContainsSkipTrivia(statement, declaration, file) && !rangeContainsSkipTrivia(selection, declaration, file)) { + result.push(declaration); + } + } + } + } + else if (ts.isInferTypeNode(node)) { + var conditionalTypeNode = ts.findAncestor(node, function (n) { return ts.isConditionalTypeNode(n) && rangeContainsSkipTrivia(n.extendsType, node, file); }); + if (!conditionalTypeNode || !rangeContainsSkipTrivia(selection, conditionalTypeNode, file)) { + return true; + } + } + else if ((ts.isTypePredicateNode(node) || ts.isThisTypeNode(node))) { + var functionLikeNode = ts.findAncestor(node.parent, ts.isFunctionLike); + if (functionLikeNode && functionLikeNode.type && rangeContainsSkipTrivia(functionLikeNode.type, node, file) && !rangeContainsSkipTrivia(selection, functionLikeNode, file)) { + return true; + } + } + else if (ts.isTypeQueryNode(node)) { + if (ts.isIdentifier(node.exprName)) { + var symbol = checker.resolveName(node.exprName.text, node.exprName, 67220415 /* Value */, /* excludeGlobals */ false); + if (symbol && rangeContainsSkipTrivia(statement, symbol.valueDeclaration, file) && !rangeContainsSkipTrivia(selection, symbol.valueDeclaration, file)) { + return true; + } + } + else { + if (ts.isThisIdentifier(node.exprName.left) && !rangeContainsSkipTrivia(selection, node.parent, file)) { + return true; + } + } + } + return ts.forEachChild(node, visitor); + } + } + function doTypeAliasChange(changes, file, name, firstStatement, selection, typeParameters) { + var newTypeNode = ts.createTypeAliasDeclaration( + /* decorators */ undefined, + /* modifiers */ undefined, name, typeParameters.map(function (id) { return ts.updateTypeParameterDeclaration(id, id.name, id.constraint, /* defaultType */ undefined); }), selection); + changes.insertNodeBefore(file, firstStatement, newTypeNode, /* blankLineBetween */ true); + changes.replaceNode(file, selection, ts.createTypeReferenceNode(name, typeParameters.map(function (id) { return ts.createTypeReferenceNode(id.name, /* typeArguments */ undefined); }))); + } + function doTypedefChange(changes, file, name, firstStatement, selection, typeParameters) { + var node = ts.createNode(310 /* JSDocTypedefTag */); + node.tagName = ts.createIdentifier("typedef"); // TODO: jsdoc factory https://github.com/Microsoft/TypeScript/pull/29539 + node.fullName = ts.createIdentifier(name); + node.name = node.fullName; + node.typeExpression = ts.createJSDocTypeExpression(selection); + var templates = []; + ts.forEach(typeParameters, function (typeParameter) { + var constraint = ts.getEffectiveConstraintOfTypeParameter(typeParameter); + var template = ts.createNode(309 /* JSDocTemplateTag */); + template.tagName = ts.createIdentifier("template"); + template.constraint = constraint && ts.cast(constraint, ts.isJSDocTypeExpression); + var parameter = ts.createNode(151 /* TypeParameter */); + parameter.name = typeParameter.name; + template.typeParameters = ts.createNodeArray([parameter]); + templates.push(template); + }); + changes.insertNodeBefore(file, firstStatement, ts.createJSDocComment(/* comment */ undefined, ts.createNodeArray(ts.concatenate(templates, [node]))), /* blankLineBetween */ true); + changes.replaceNode(file, selection, ts.createTypeReferenceNode(name, typeParameters.map(function (id) { return ts.createTypeReferenceNode(id.name, /* typeArguments */ undefined); }))); + } + })(refactor = ts.refactor || (ts.refactor = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; (function (ts) { var refactor; (function (refactor) { @@ -118746,10 +119893,10 @@ var ts; var modifierFlags = ts.getModifierFlags(declaration) & ~64 /* Readonly */; var accessorModifiers = isInClassLike ? !modifierFlags || modifierFlags & 8 /* Private */ - ? getModifiers(isJS, isStatic, 115 /* PublicKeyword */) + ? getModifiers(isJS, isStatic, 116 /* PublicKeyword */) : ts.createNodeArray(ts.createModifiersFromModifierFlags(modifierFlags)) : undefined; - var fieldModifiers = isInClassLike ? getModifiers(isJS, isStatic, 113 /* PrivateKeyword */) : undefined; + var fieldModifiers = isInClassLike ? getModifiers(isJS, isStatic, 114 /* PrivateKeyword */) : undefined; updateFieldDeclaration(changeTracker, file, declaration, fieldName, fieldModifiers); var getAccessor = generateGetAccessor(fieldName, accessorName, type, accessorModifiers, isStatic, container); ts.suppressLeadingAndTrailingTrivia(getAccessor); @@ -118787,7 +119934,7 @@ var ts; return ts.isIdentifier(fieldName) ? ts.createPropertyAccess(leftHead, fieldName) : ts.createElementAccess(leftHead, ts.createLiteral(fieldName)); } function getModifiers(isJS, isStatic, accessModifier) { - var modifiers = ts.append(!isJS ? [ts.createToken(accessModifier)] : undefined, isStatic ? ts.createToken(116 /* StaticKeyword */) : undefined); + var modifiers = ts.append(!isJS ? [ts.createToken(accessModifier)] : undefined, isStatic ? ts.createToken(117 /* StaticKeyword */) : undefined); return modifiers && ts.createNodeArray(modifiers); } function startsWithUnderscore(name) { @@ -118810,7 +119957,7 @@ var ts; isStatic: ts.hasStaticModifier(declaration), isReadonly: ts.hasReadonlyModifier(declaration), type: ts.getTypeAnnotationNode(declaration), - container: declaration.kind === 151 /* Parameter */ ? declaration.parent.parent : declaration.parent, + container: declaration.kind === 152 /* Parameter */ ? declaration.parent.parent : declaration.parent, originalName: declaration.name.text, declaration: declaration, fieldName: fieldName, @@ -118867,13 +120014,13 @@ var ts; return; constructor.body.forEachChild(function recur(node) { if (ts.isElementAccessExpression(node) && - node.expression.kind === 100 /* ThisKeyword */ && + node.expression.kind === 101 /* ThisKeyword */ && ts.isStringLiteral(node.argumentExpression) && node.argumentExpression.text === originalName && ts.isWriteAccess(node)) { changeTracker.replaceNode(file, node.argumentExpression, ts.createStringLiteral(fieldName)); } - if (ts.isPropertyAccessExpression(node) && node.expression.kind === 100 /* ThisKeyword */ && node.name.text === originalName && ts.isWriteAccess(node)) { + if (ts.isPropertyAccessExpression(node) && node.expression.kind === 101 /* ThisKeyword */ && node.name.text === originalName && ts.isWriteAccess(node)) { changeTracker.replaceNode(file, node.name, ts.createIdentifier(fieldName)); } if (!ts.isFunctionLike(node) && !ts.isClassLike(node)) { @@ -118955,11 +120102,11 @@ var ts; } function isPureImport(node) { switch (node.kind) { - case 249 /* ImportDeclaration */: + case 250 /* ImportDeclaration */: return true; - case 248 /* ImportEqualsDeclaration */: + case 249 /* ImportEqualsDeclaration */: return !ts.hasModifier(node, 1 /* Export */); - case 219 /* VariableStatement */: + case 220 /* VariableStatement */: return node.declarationList.declarations.every(function (d) { return !!d.initializer && ts.isRequireCall(d.initializer, /*checkArgumentIsStringLiteralLike*/ true); }); default: return false; @@ -119047,19 +120194,19 @@ var ts; } function getNamespaceLikeImport(node) { switch (node.kind) { - case 249 /* ImportDeclaration */: - return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 251 /* NamespaceImport */ ? + case 250 /* ImportDeclaration */: + return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 252 /* NamespaceImport */ ? node.importClause.namedBindings.name : undefined; - case 248 /* ImportEqualsDeclaration */: + case 249 /* ImportEqualsDeclaration */: return node.name; - case 237 /* VariableDeclaration */: + case 238 /* VariableDeclaration */: return ts.tryCast(node.name, ts.isIdentifier); default: return ts.Debug.assertNever(node); } } function updateNamespaceLikeImport(changes, sourceFile, checker, movedSymbols, newModuleName, newModuleSpecifier, oldImportId, oldImportNode) { - var preferredNewNamespaceName = ts.codefix.moduleSpecifierToValidIdentifier(newModuleName, 7 /* ESNext */); + var preferredNewNamespaceName = ts.codefix.moduleSpecifierToValidIdentifier(newModuleName, 8 /* ESNext */); var needUniqueName = false; var toChange = []; ts.FindAllReferences.Core.eachSymbolReferenceInFile(oldImportId, checker, sourceFile, function (ref) { @@ -119083,20 +120230,20 @@ var ts; var newNamespaceId = ts.createIdentifier(newNamespaceName); var newModuleString = ts.createLiteral(newModuleSpecifier); switch (node.kind) { - case 249 /* ImportDeclaration */: + case 250 /* ImportDeclaration */: return ts.createImportDeclaration( /*decorators*/ undefined, /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(newNamespaceId)), newModuleString); - case 248 /* ImportEqualsDeclaration */: + case 249 /* ImportEqualsDeclaration */: return ts.createImportEqualsDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, newNamespaceId, ts.createExternalModuleReference(newModuleString)); - case 237 /* VariableDeclaration */: + case 238 /* VariableDeclaration */: return ts.createVariableDeclaration(newNamespaceId, /*type*/ undefined, createRequireCall(newModuleString)); default: return ts.Debug.assertNever(node); } } function moduleSpecifierFromImport(i) { - return (i.kind === 249 /* ImportDeclaration */ ? i.moduleSpecifier - : i.kind === 248 /* ImportEqualsDeclaration */ ? i.moduleReference.expression + return (i.kind === 250 /* ImportDeclaration */ ? i.moduleSpecifier + : i.kind === 249 /* ImportEqualsDeclaration */ ? i.moduleReference.expression : i.initializer.arguments[0]); } function forEachImportInStatement(statement, cb) { @@ -119166,15 +120313,15 @@ var ts; } function deleteUnusedImports(sourceFile, importDecl, changes, isUnused) { switch (importDecl.kind) { - case 249 /* ImportDeclaration */: + case 250 /* ImportDeclaration */: deleteUnusedImportsInDeclaration(sourceFile, importDecl, changes, isUnused); break; - case 248 /* ImportEqualsDeclaration */: + case 249 /* ImportEqualsDeclaration */: if (isUnused(importDecl.name)) { changes.delete(sourceFile, importDecl); } break; - case 237 /* VariableDeclaration */: + case 238 /* VariableDeclaration */: deleteUnusedImportsInVariableDeclaration(sourceFile, importDecl, changes, isUnused); break; default: @@ -119187,7 +120334,7 @@ var ts; var _a = importDecl.importClause, name = _a.name, namedBindings = _a.namedBindings; var defaultUnused = !name || isUnused(name); var namedBindingsUnused = !namedBindings || - (namedBindings.kind === 251 /* NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every(function (e) { return isUnused(e.name); })); + (namedBindings.kind === 252 /* NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every(function (e) { return isUnused(e.name); })); if (defaultUnused && namedBindingsUnused) { changes.delete(sourceFile, importDecl); } @@ -119199,7 +120346,7 @@ var ts; if (namedBindingsUnused) { changes.delete(sourceFile, namedBindings); } - else if (namedBindings.kind === 252 /* NamedImports */) { + else if (namedBindings.kind === 253 /* NamedImports */) { for (var _i = 0, _b = namedBindings.elements; _i < _b.length; _i++) { var element = _b[_i]; if (isUnused(element.name)) @@ -119212,14 +120359,14 @@ var ts; function deleteUnusedImportsInVariableDeclaration(sourceFile, varDecl, changes, isUnused) { var name = varDecl.name; switch (name.kind) { - case 72 /* Identifier */: + case 73 /* Identifier */: if (isUnused(name)) { changes.delete(sourceFile, name); } break; - case 185 /* ArrayBindingPattern */: + case 186 /* ArrayBindingPattern */: break; - case 184 /* ObjectBindingPattern */: + case 185 /* ObjectBindingPattern */: if (name.elements.every(function (e) { return ts.isIdentifier(e.name) && isUnused(e.name); })) { changes.delete(sourceFile, ts.isVariableDeclarationList(varDecl.parent) && varDecl.parent.declarations.length === 1 ? varDecl.parent.parent : varDecl); } @@ -119346,13 +120493,13 @@ var ts; // Below should all be utilities function isInImport(decl) { switch (decl.kind) { - case 248 /* ImportEqualsDeclaration */: - case 253 /* ImportSpecifier */: - case 250 /* ImportClause */: + case 249 /* ImportEqualsDeclaration */: + case 254 /* ImportSpecifier */: + case 251 /* ImportClause */: return true; - case 237 /* VariableDeclaration */: + case 238 /* VariableDeclaration */: return isVariableDeclarationInImport(decl); - case 186 /* BindingElement */: + case 187 /* BindingElement */: return ts.isVariableDeclaration(decl.parent.parent) && isVariableDeclarationInImport(decl.parent.parent); default: return false; @@ -119364,7 +120511,7 @@ var ts; } function filterImport(i, moduleSpecifier, keep) { switch (i.kind) { - case 249 /* ImportDeclaration */: { + case 250 /* ImportDeclaration */: { var clause = i.importClause; if (!clause) return undefined; @@ -119374,9 +120521,9 @@ var ts; ? ts.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, ts.createImportClause(defaultImport, namedBindings), moduleSpecifier) : undefined; } - case 248 /* ImportEqualsDeclaration */: + case 249 /* ImportEqualsDeclaration */: return keep(i.name) ? i : undefined; - case 237 /* VariableDeclaration */: { + case 238 /* VariableDeclaration */: { var name = filterBindingName(i.name, keep); return name ? makeVariableStatement(name, i.type, createRequireCall(moduleSpecifier), i.parent.flags) : undefined; } @@ -119385,7 +120532,7 @@ var ts; } } function filterNamedBindings(namedBindings, keep) { - if (namedBindings.kind === 251 /* NamespaceImport */) { + if (namedBindings.kind === 252 /* NamespaceImport */) { return keep(namedBindings.name) ? namedBindings : undefined; } else { @@ -119395,11 +120542,11 @@ var ts; } function filterBindingName(name, keep) { switch (name.kind) { - case 72 /* Identifier */: + case 73 /* Identifier */: return keep(name) ? name : undefined; - case 185 /* ArrayBindingPattern */: + case 186 /* ArrayBindingPattern */: return name; - case 184 /* ObjectBindingPattern */: { + case 185 /* ObjectBindingPattern */: { // We can't handle nested destructurings or property names well here, so just copy them all. var newElements = name.elements.filter(function (prop) { return prop.propertyName || !ts.isIdentifier(prop.name) || keep(prop.name); }); return newElements.length ? ts.createObjectBindingPattern(newElements) : undefined; @@ -119456,13 +120603,13 @@ var ts; } function isNonVariableTopLevelDeclaration(node) { switch (node.kind) { - case 239 /* FunctionDeclaration */: - case 240 /* ClassDeclaration */: - case 244 /* ModuleDeclaration */: - case 243 /* EnumDeclaration */: - case 242 /* TypeAliasDeclaration */: - case 241 /* InterfaceDeclaration */: - case 248 /* ImportEqualsDeclaration */: + case 240 /* FunctionDeclaration */: + case 241 /* ClassDeclaration */: + case 245 /* ModuleDeclaration */: + case 244 /* EnumDeclaration */: + case 243 /* TypeAliasDeclaration */: + case 242 /* InterfaceDeclaration */: + case 249 /* ImportEqualsDeclaration */: return true; default: return false; @@ -119470,17 +120617,17 @@ var ts; } function forEachTopLevelDeclaration(statement, cb) { switch (statement.kind) { - case 239 /* FunctionDeclaration */: - case 240 /* ClassDeclaration */: - case 244 /* ModuleDeclaration */: - case 243 /* EnumDeclaration */: - case 242 /* TypeAliasDeclaration */: - case 241 /* InterfaceDeclaration */: - case 248 /* ImportEqualsDeclaration */: + case 240 /* FunctionDeclaration */: + case 241 /* ClassDeclaration */: + case 245 /* ModuleDeclaration */: + case 244 /* EnumDeclaration */: + case 243 /* TypeAliasDeclaration */: + case 242 /* InterfaceDeclaration */: + case 249 /* ImportEqualsDeclaration */: return cb(statement); - case 219 /* VariableStatement */: + case 220 /* VariableStatement */: return ts.firstDefined(statement.declarationList.declarations, function (decl) { return forEachTopLevelDeclarationInBindingName(decl.name, cb); }); - case 221 /* ExpressionStatement */: { + case 222 /* ExpressionStatement */: { var expression = statement.expression; return ts.isBinaryExpression(expression) && ts.getAssignmentDeclarationKind(expression) === 1 /* ExportsProperty */ ? cb(statement) @@ -119490,10 +120637,10 @@ var ts; } function forEachTopLevelDeclarationInBindingName(name, cb) { switch (name.kind) { - case 72 /* Identifier */: + case 73 /* Identifier */: return cb(ts.cast(name.parent, function (x) { return ts.isVariableDeclaration(x) || ts.isBindingElement(x); })); - case 185 /* ArrayBindingPattern */: - case 184 /* ObjectBindingPattern */: + case 186 /* ArrayBindingPattern */: + case 185 /* ObjectBindingPattern */: return ts.firstDefined(name.elements, function (em) { return ts.isOmittedExpression(em) ? undefined : forEachTopLevelDeclarationInBindingName(em.name, cb); }); default: return ts.Debug.assertNever(name); @@ -119504,9 +120651,9 @@ var ts; } function getTopLevelDeclarationStatement(d) { switch (d.kind) { - case 237 /* VariableDeclaration */: + case 238 /* VariableDeclaration */: return d.parent.parent; - case 186 /* BindingElement */: + case 187 /* BindingElement */: return getTopLevelDeclarationStatement(ts.cast(d.parent.parent, function (p) { return ts.isVariableDeclaration(p) || ts.isBindingElement(p); })); default: return d; @@ -119537,25 +120684,25 @@ var ts; return useEs6Exports ? [addEs6Export(decl)] : addCommonjsExport(decl); } function addEs6Export(d) { - var modifiers = ts.concatenate([ts.createModifier(85 /* ExportKeyword */)], d.modifiers); + var modifiers = ts.concatenate([ts.createModifier(86 /* ExportKeyword */)], d.modifiers); switch (d.kind) { - case 239 /* FunctionDeclaration */: + case 240 /* FunctionDeclaration */: return ts.updateFunctionDeclaration(d, d.decorators, modifiers, d.asteriskToken, d.name, d.typeParameters, d.parameters, d.type, d.body); - case 240 /* ClassDeclaration */: + case 241 /* ClassDeclaration */: return ts.updateClassDeclaration(d, d.decorators, modifiers, d.name, d.typeParameters, d.heritageClauses, d.members); - case 219 /* VariableStatement */: + case 220 /* VariableStatement */: return ts.updateVariableStatement(d, modifiers, d.declarationList); - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: return ts.updateModuleDeclaration(d, d.decorators, modifiers, d.name, d.body); - case 243 /* EnumDeclaration */: + case 244 /* EnumDeclaration */: return ts.updateEnumDeclaration(d, d.decorators, modifiers, d.name, d.members); - case 242 /* TypeAliasDeclaration */: + case 243 /* TypeAliasDeclaration */: return ts.updateTypeAliasDeclaration(d, d.decorators, modifiers, d.name, d.typeParameters, d.type); - case 241 /* InterfaceDeclaration */: + case 242 /* InterfaceDeclaration */: return ts.updateInterfaceDeclaration(d, d.decorators, modifiers, d.name, d.typeParameters, d.heritageClauses, d.members); - case 248 /* ImportEqualsDeclaration */: + case 249 /* ImportEqualsDeclaration */: return ts.updateImportEqualsDeclaration(d, d.decorators, modifiers, d.name, d.moduleReference); - case 221 /* ExpressionStatement */: + case 222 /* ExpressionStatement */: return ts.Debug.fail(); // Shouldn't try to add 'export' keyword to `exports.x = ...` default: return ts.Debug.assertNever(d); @@ -119566,18 +120713,18 @@ var ts; } function getNamesToExportInCommonJS(decl) { switch (decl.kind) { - case 239 /* FunctionDeclaration */: - case 240 /* ClassDeclaration */: + case 240 /* FunctionDeclaration */: + case 241 /* ClassDeclaration */: return [decl.name.text]; // TODO: GH#18217 - case 219 /* VariableStatement */: + case 220 /* VariableStatement */: return ts.mapDefined(decl.declarationList.declarations, function (d) { return ts.isIdentifier(d.name) ? d.name.text : undefined; }); - case 244 /* ModuleDeclaration */: - case 243 /* EnumDeclaration */: - case 242 /* TypeAliasDeclaration */: - case 241 /* InterfaceDeclaration */: - case 248 /* ImportEqualsDeclaration */: + case 245 /* ModuleDeclaration */: + case 244 /* EnumDeclaration */: + case 243 /* TypeAliasDeclaration */: + case 242 /* InterfaceDeclaration */: + case 249 /* ImportEqualsDeclaration */: return ts.emptyArray; - case 221 /* ExpressionStatement */: + case 222 /* ExpressionStatement */: return ts.Debug.fail(); // Shouldn't try to add 'export' keyword to `exports.x = ...` default: return ts.Debug.assertNever(decl); @@ -119585,7 +120732,7 @@ var ts; } /** Creates `exports.x = x;` */ function createExportAssignment(name) { - return ts.createExpressionStatement(ts.createBinary(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.createIdentifier(name)), 59 /* EqualsToken */, ts.createIdentifier(name))); + return ts.createExpressionStatement(ts.createBinary(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.createIdentifier(name)), 60 /* EqualsToken */, ts.createIdentifier(name))); } })(refactor = ts.refactor || (ts.refactor = {})); })(ts || (ts = {})); @@ -119751,8 +120898,8 @@ var ts; function groupReferences(referenceEntries) { var classReferences = { accessExpressions: [], typeUsages: [] }; var groupedReferences = { functionCalls: [], declarations: [], classReferences: classReferences, valid: true }; - var functionSymbols = ts.map(functionNames, checker.getSymbolAtLocation); - var classSymbols = ts.map(classNames, checker.getSymbolAtLocation); + var functionSymbols = ts.map(functionNames, getSymbolTargetAtLocation); + var classSymbols = ts.map(classNames, getSymbolTargetAtLocation); var isConstructor = ts.isConstructorDeclaration(functionDeclaration); for (var _i = 0, referenceEntries_1 = referenceEntries; _i < referenceEntries_1.length; _i++) { var entry = referenceEntries_1[_i]; @@ -119771,7 +120918,11 @@ var ts; So we need to add a special case for this because when calling a constructor of a class through one of its subclasses, the symbols are going to be different. */ - if (ts.contains(functionSymbols, checker.getSymbolAtLocation(entry.node), symbolComparer) || ts.isNewExpressionTarget(entry.node)) { + if (ts.contains(functionSymbols, getSymbolTargetAtLocation(entry.node)) || ts.isNewExpressionTarget(entry.node)) { + var importOrExportReference = entryToImportOrExport(entry); + if (importOrExportReference) { + continue; + } var decl = entryToDeclaration(entry); if (decl) { groupedReferences.declarations.push(decl); @@ -119784,7 +120935,11 @@ var ts; } } // if the refactored function is a constructor, we must also check if the references to its class are valid - if (isConstructor && ts.contains(classSymbols, checker.getSymbolAtLocation(entry.node), symbolComparer)) { + if (isConstructor && ts.contains(classSymbols, getSymbolTargetAtLocation(entry.node))) { + var importOrExportReference = entryToImportOrExport(entry); + if (importOrExportReference) { + continue; + } var decl = entryToDeclaration(entry); if (decl) { groupedReferences.declarations.push(decl); @@ -119809,9 +120964,23 @@ var ts; } return groupedReferences; } + function getSymbolTargetAtLocation(node) { + var symbol = checker.getSymbolAtLocation(node); + return symbol && ts.getSymbolTarget(symbol, checker); + } } - function symbolComparer(a, b) { - return ts.getSymbolTarget(a) === ts.getSymbolTarget(b); + function entryToImportOrExport(entry) { + var node = entry.node; + if (ts.isImportSpecifier(node.parent) + || ts.isImportClause(node.parent) + || ts.isImportEqualsDeclaration(node.parent) + || ts.isNamespaceImport(node.parent)) { + return node; + } + if (ts.isExportSpecifier(node.parent) || ts.isExportAssignment(node.parent)) { + return node; + } + return undefined; } function entryToDeclaration(entry) { if (ts.isDeclaration(entry.node.parent)) { @@ -119824,37 +120993,31 @@ var ts; var functionReference = entry.node; var parent = functionReference.parent; switch (parent.kind) { - // Function call (foo(...) or super(...)) - case 191 /* CallExpression */: - var callExpression = ts.tryCast(parent, ts.isCallExpression); - if (callExpression && callExpression.expression === functionReference) { - return callExpression; + // foo(...) or super(...) or new Foo(...) + case 192 /* CallExpression */: + case 193 /* NewExpression */: + var callOrNewExpression = ts.tryCast(parent, ts.isCallOrNewExpression); + if (callOrNewExpression && callOrNewExpression.expression === functionReference) { + return callOrNewExpression; } break; - // Constructor call (new Foo(...)) - case 192 /* NewExpression */: - var newExpression = ts.tryCast(parent, ts.isNewExpression); - if (newExpression && newExpression.expression === functionReference) { - return newExpression; - } - break; - // Method call (x.foo(...)) - case 189 /* PropertyAccessExpression */: + // x.foo(...) + case 190 /* PropertyAccessExpression */: var propertyAccessExpression = ts.tryCast(parent, ts.isPropertyAccessExpression); if (propertyAccessExpression && propertyAccessExpression.parent && propertyAccessExpression.name === functionReference) { - var callExpression_1 = ts.tryCast(propertyAccessExpression.parent, ts.isCallExpression); - if (callExpression_1 && callExpression_1.expression === propertyAccessExpression) { - return callExpression_1; + var callOrNewExpression_1 = ts.tryCast(propertyAccessExpression.parent, ts.isCallOrNewExpression); + if (callOrNewExpression_1 && callOrNewExpression_1.expression === propertyAccessExpression) { + return callOrNewExpression_1; } } break; - // Method call (x["foo"](...)) - case 190 /* ElementAccessExpression */: + // x["foo"](...) + case 191 /* ElementAccessExpression */: var elementAccessExpression = ts.tryCast(parent, ts.isElementAccessExpression); if (elementAccessExpression && elementAccessExpression.parent && elementAccessExpression.argumentExpression === functionReference) { - var callExpression_2 = ts.tryCast(elementAccessExpression.parent, ts.isCallExpression); - if (callExpression_2 && callExpression_2.expression === elementAccessExpression) { - return callExpression_2; + var callOrNewExpression_2 = ts.tryCast(elementAccessExpression.parent, ts.isCallOrNewExpression); + if (callOrNewExpression_2 && callOrNewExpression_2.expression === elementAccessExpression) { + return callOrNewExpression_2; } } break; @@ -119868,14 +121031,14 @@ var ts; var parent = reference.parent; switch (parent.kind) { // `C.foo` - case 189 /* PropertyAccessExpression */: + case 190 /* PropertyAccessExpression */: var propertyAccessExpression = ts.tryCast(parent, ts.isPropertyAccessExpression); if (propertyAccessExpression && propertyAccessExpression.expression === reference) { return propertyAccessExpression; } break; // `C["foo"]` - case 190 /* ElementAccessExpression */: + case 191 /* ElementAccessExpression */: var elementAccessExpression = ts.tryCast(parent, ts.isElementAccessExpression); if (elementAccessExpression && elementAccessExpression.expression === reference) { return elementAccessExpression; @@ -119894,7 +121057,7 @@ var ts; } function getFunctionDeclarationAtPosition(file, startPosition, checker) { var node = ts.getTouchingToken(file, startPosition); - var functionDeclaration = ts.getContainingFunction(node); + var functionDeclaration = ts.getContainingFunctionDeclaration(node); // don't offer refactor on top-level JSDoc if (isTopLevelJSDoc(node)) return undefined; @@ -119917,28 +121080,34 @@ var ts; if (!isValidParameterNodeArray(functionDeclaration.parameters, checker)) return false; switch (functionDeclaration.kind) { - case 239 /* FunctionDeclaration */: - case 156 /* MethodDeclaration */: - return !!functionDeclaration.name - && !!functionDeclaration.body - && !checker.isImplementationOfOverload(functionDeclaration); - case 157 /* Constructor */: + case 240 /* FunctionDeclaration */: + return hasNameOrDefault(functionDeclaration) && isSingleImplementation(functionDeclaration, checker); + case 157 /* MethodDeclaration */: + return isSingleImplementation(functionDeclaration, checker); + case 158 /* Constructor */: if (ts.isClassDeclaration(functionDeclaration.parent)) { - return !!functionDeclaration.body - && !!functionDeclaration.parent.name - && !checker.isImplementationOfOverload(functionDeclaration); + return hasNameOrDefault(functionDeclaration.parent) && isSingleImplementation(functionDeclaration, checker); } else { return isValidVariableDeclaration(functionDeclaration.parent.parent) - && !!functionDeclaration.body - && !checker.isImplementationOfOverload(functionDeclaration); + && isSingleImplementation(functionDeclaration, checker); } - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: return isValidVariableDeclaration(functionDeclaration.parent); } return false; } + function isSingleImplementation(functionDeclaration, checker) { + return !!functionDeclaration.body && !checker.isImplementationOfOverload(functionDeclaration); + } + function hasNameOrDefault(functionOrClassDeclaration) { + if (!functionOrClassDeclaration.name) { + var defaultKeyword = ts.findModifier(functionOrClassDeclaration, 81 /* DefaultKeyword */); + return !!defaultKeyword; + } + return true; + } function isValidParameterNodeArray(parameters, checker) { return getRefactorableParametersLength(parameters) >= minimumParameterLength && ts.every(parameters, /*callback*/ function (/*callback*/ paramDecl) { return isValidParameterDeclaration(paramDecl, checker); }); @@ -120095,10 +121264,15 @@ var ts; } function getClassNames(constructorDeclaration) { switch (constructorDeclaration.parent.kind) { - case 240 /* ClassDeclaration */: + case 241 /* ClassDeclaration */: var classDeclaration = constructorDeclaration.parent; - return [classDeclaration.name]; - case 209 /* ClassExpression */: + if (classDeclaration.name) + return [classDeclaration.name]; + // If the class declaration doesn't have a name, it should have a default modifier. + // We validated this in `isValidFunctionDeclaration` through `hasNameOrDefault` + var defaultModifier = ts.Debug.assertDefined(ts.findModifier(classDeclaration, 81 /* DefaultKeyword */), "Nameless class declaration should be a default export"); + return [defaultModifier]; + case 210 /* ClassExpression */: var classExpression = constructorDeclaration.parent; var variableDeclaration = constructorDeclaration.parent.parent; var className = classExpression.name; @@ -120109,19 +121283,25 @@ var ts; } function getFunctionNames(functionDeclaration) { switch (functionDeclaration.kind) { - case 239 /* FunctionDeclaration */: - case 156 /* MethodDeclaration */: + case 240 /* FunctionDeclaration */: + if (functionDeclaration.name) + return [functionDeclaration.name]; + // If the function declaration doesn't have a name, it should have a default modifier. + // We validated this in `isValidFunctionDeclaration` through `hasNameOrDefault` + var defaultModifier = ts.Debug.assertDefined(ts.findModifier(functionDeclaration, 81 /* DefaultKeyword */), "Nameless function declaration should be a default export"); + return [defaultModifier]; + case 157 /* MethodDeclaration */: return [functionDeclaration.name]; - case 157 /* Constructor */: - var ctrKeyword = ts.findChildOfKind(functionDeclaration, 124 /* ConstructorKeyword */, functionDeclaration.getSourceFile()); - if (functionDeclaration.parent.kind === 209 /* ClassExpression */) { + case 158 /* Constructor */: + var ctrKeyword = ts.Debug.assertDefined(ts.findChildOfKind(functionDeclaration, 125 /* ConstructorKeyword */, functionDeclaration.getSourceFile()), "Constructor declaration should have constructor keyword"); + if (functionDeclaration.parent.kind === 210 /* ClassExpression */) { var variableDeclaration = functionDeclaration.parent.parent; return [variableDeclaration.name, ctrKeyword]; } return [ctrKeyword]; - case 197 /* ArrowFunction */: + case 198 /* ArrowFunction */: return [functionDeclaration.parent.name]; - case 196 /* FunctionExpression */: + case 197 /* FunctionExpression */: if (functionDeclaration.name) return [functionDeclaration.name, functionDeclaration.parent.name]; return [functionDeclaration.parent.name]; @@ -120138,7 +121318,7 @@ var ts; ts.servicesVersion = "0.8"; function createNode(kind, pos, end, parent) { var node = ts.isNodeKind(kind) ? new NodeObject(kind, pos, end) : - kind === 72 /* Identifier */ ? new IdentifierObject(72 /* Identifier */, pos, end) : + kind === 73 /* Identifier */ ? new IdentifierObject(73 /* Identifier */, pos, end) : new TokenObject(kind, pos, end); node.parent = parent; node.flags = parent.flags & 12679168 /* ContextFlags */; @@ -120212,8 +121392,8 @@ var ts; if (!children.length) { return undefined; } - var child = ts.find(children, function (kid) { return kid.kind < 288 /* FirstJSDocNode */ || kid.kind > 310 /* LastJSDocNode */; }); - return child.kind < 148 /* FirstNode */ ? + var child = ts.find(children, function (kid) { return kid.kind < 289 /* FirstJSDocNode */ || kid.kind > 311 /* LastJSDocNode */; }); + return child.kind < 149 /* FirstNode */ ? child : child.getFirstToken(sourceFile); }; @@ -120224,7 +121404,7 @@ var ts; if (!child) { return undefined; } - return child.kind < 148 /* FirstNode */ ? child : child.getLastToken(sourceFile); + return child.kind < 149 /* FirstNode */ ? child : child.getLastToken(sourceFile); }; NodeObject.prototype.forEachChild = function (cbNode, cbNodeArray) { return ts.forEachChild(this, cbNode, cbNodeArray); @@ -120270,8 +121450,8 @@ var ts; var token = ts.scanner.scan(); var textPos = ts.scanner.getTextPos(); if (textPos <= end) { - if (token === 72 /* Identifier */) { - ts.Debug.fail("Did not expect " + ts.Debug.showSyntaxKind(parent) + " to have an Identifier in its trivia"); + if (token === 73 /* Identifier */) { + ts.Debug.fail("Did not expect " + ts.Debug.formatSyntaxKind(parent.kind) + " to have an Identifier in its trivia"); } nodes.push(createNode(token, pos, textPos, parent)); } @@ -120282,7 +121462,7 @@ var ts; } } function createSyntaxList(nodes, parent) { - var list = createNode(311 /* SyntaxList */, nodes.pos, nodes.end, parent); + var list = createNode(312 /* SyntaxList */, nodes.pos, nodes.end, parent); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) { @@ -120416,7 +121596,7 @@ var ts; }); return IdentifierObject; }(TokenOrIdentifierObject)); - IdentifierObject.prototype.kind = 72 /* Identifier */; + IdentifierObject.prototype.kind = 73 /* Identifier */; var TypeObject = /** @class */ (function () { function TypeObject(checker, flags) { this.checker = checker; @@ -120617,10 +121797,10 @@ var ts; } function visit(node) { switch (node.kind) { - case 239 /* FunctionDeclaration */: - case 196 /* FunctionExpression */: - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: + case 240 /* FunctionDeclaration */: + case 197 /* FunctionExpression */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -120640,31 +121820,31 @@ var ts; } ts.forEachChild(node, visit); break; - case 240 /* ClassDeclaration */: - case 209 /* ClassExpression */: - case 241 /* InterfaceDeclaration */: - case 242 /* TypeAliasDeclaration */: - case 243 /* EnumDeclaration */: - case 244 /* ModuleDeclaration */: - case 248 /* ImportEqualsDeclaration */: - case 257 /* ExportSpecifier */: - case 253 /* ImportSpecifier */: - case 250 /* ImportClause */: - case 251 /* NamespaceImport */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 168 /* TypeLiteral */: + case 241 /* ClassDeclaration */: + case 210 /* ClassExpression */: + case 242 /* InterfaceDeclaration */: + case 243 /* TypeAliasDeclaration */: + case 244 /* EnumDeclaration */: + case 245 /* ModuleDeclaration */: + case 249 /* ImportEqualsDeclaration */: + case 258 /* ExportSpecifier */: + case 254 /* ImportSpecifier */: + case 251 /* ImportClause */: + case 252 /* NamespaceImport */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 169 /* TypeLiteral */: addDeclaration(node); ts.forEachChild(node, visit); break; - case 151 /* Parameter */: + case 152 /* Parameter */: // Only consider parameter properties if (!ts.hasModifier(node, 92 /* ParameterPropertyModifier */)) { break; } // falls through - case 237 /* VariableDeclaration */: - case 186 /* BindingElement */: { + case 238 /* VariableDeclaration */: + case 187 /* BindingElement */: { var decl = node; if (ts.isBindingPattern(decl.name)) { ts.forEachChild(decl.name, visit); @@ -120675,19 +121855,19 @@ var ts; } } // falls through - case 278 /* EnumMember */: - case 154 /* PropertyDeclaration */: - case 153 /* PropertySignature */: + case 279 /* EnumMember */: + case 155 /* PropertyDeclaration */: + case 154 /* PropertySignature */: addDeclaration(node); break; - case 255 /* ExportDeclaration */: + case 256 /* ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 249 /* ImportDeclaration */: + case 250 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -120699,7 +121879,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 251 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 252 /* NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -120708,7 +121888,7 @@ var ts; } } break; - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: if (ts.getAssignmentDeclarationKind(node) !== 0 /* None */) { addDeclaration(node); } @@ -120877,7 +122057,7 @@ var ts; var sourceFile; if (this.currentFileName !== fileName) { // This is a new file, just parse it - sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 7 /* Latest */, version, /*setNodeParents*/ true, scriptKind); + sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 8 /* Latest */, version, /*setNodeParents*/ true, scriptKind); } else if (this.currentFileVersion !== version) { // This is the same file, just a newer version. Incrementally parse the file. @@ -121281,41 +122461,48 @@ var ts; return undefined; } var typeChecker = program.getTypeChecker(); - var symbol = getSymbolAtLocationForQuickInfo(node, typeChecker); + var nodeForQuickInfo = getNodeForQuickInfo(node); + var symbol = getSymbolAtLocationForQuickInfo(nodeForQuickInfo, typeChecker); if (!symbol || typeChecker.isUnknownSymbol(symbol)) { - var type_2 = shouldGetType(sourceFile, node, position) ? typeChecker.getTypeAtLocation(node) : undefined; + var type_2 = shouldGetType(sourceFile, nodeForQuickInfo, position) ? typeChecker.getTypeAtLocation(nodeForQuickInfo) : undefined; return type_2 && { kind: "" /* unknown */, kindModifiers: "" /* none */, - textSpan: ts.createTextSpanFromNode(node, sourceFile), - displayParts: typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) { return ts.typeToDisplayParts(typeChecker, type_2, ts.getContainerNode(node)); }), + textSpan: ts.createTextSpanFromNode(nodeForQuickInfo, sourceFile), + displayParts: typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) { return ts.typeToDisplayParts(typeChecker, type_2, ts.getContainerNode(nodeForQuickInfo)); }), documentation: type_2.symbol ? type_2.symbol.getDocumentationComment(typeChecker) : undefined, tags: type_2.symbol ? type_2.symbol.getJsDocTags() : undefined }; } var _a = typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) { - return ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, ts.getContainerNode(node), node); + return ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, ts.getContainerNode(nodeForQuickInfo), nodeForQuickInfo); }), symbolKind = _a.symbolKind, displayParts = _a.displayParts, documentation = _a.documentation, tags = _a.tags; return { kind: symbolKind, kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), - textSpan: ts.createTextSpanFromNode(node, sourceFile), + textSpan: ts.createTextSpanFromNode(nodeForQuickInfo, sourceFile), displayParts: displayParts, documentation: documentation, tags: tags, }; } + function getNodeForQuickInfo(node) { + if (ts.isNewExpression(node.parent) && node.pos === node.parent.pos) { + return node.parent.expression; + } + return node; + } function shouldGetType(sourceFile, node, position) { switch (node.kind) { - case 72 /* Identifier */: + case 73 /* Identifier */: return !ts.isLabelName(node) && !ts.isTagName(node); - case 189 /* PropertyAccessExpression */: - case 148 /* QualifiedName */: + case 190 /* PropertyAccessExpression */: + case 149 /* QualifiedName */: // Don't return quickInfo if inside the comment in `a/**/.b` return !ts.isInComment(sourceFile, position); - case 100 /* ThisKeyword */: - case 178 /* ThisType */: - case 98 /* SuperKeyword */: + case 101 /* ThisKeyword */: + case 179 /* ThisType */: + case 99 /* SuperKeyword */: return true; default: return false; @@ -121422,16 +122609,16 @@ var ts; return undefined; } switch (node.kind) { - case 189 /* PropertyAccessExpression */: - case 148 /* QualifiedName */: + case 190 /* PropertyAccessExpression */: + case 149 /* QualifiedName */: case 10 /* StringLiteral */: - case 87 /* FalseKeyword */: - case 102 /* TrueKeyword */: - case 96 /* NullKeyword */: - case 98 /* SuperKeyword */: - case 100 /* ThisKeyword */: - case 178 /* ThisType */: - case 72 /* Identifier */: + case 88 /* FalseKeyword */: + case 103 /* TrueKeyword */: + case 97 /* NullKeyword */: + case 99 /* SuperKeyword */: + case 101 /* ThisKeyword */: + case 179 /* ThisType */: + case 73 /* Identifier */: break; // Cant create the text span default: @@ -121447,7 +122634,7 @@ var ts; // If this is name of a module declarations, check if this is right side of dotted module name // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of // Then this name is name from dotted module - if (nodeForStartPos.parent.parent.kind === 244 /* ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 245 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -121590,30 +122777,14 @@ var ts; } function applyCodeActionCommand(fileName, actionOrFormatSettingsOrUndefined) { var action = typeof fileName === "string" ? actionOrFormatSettingsOrUndefined : fileName; - var formatSettings = typeof fileName !== "string" ? actionOrFormatSettingsOrUndefined : undefined; - return ts.isArray(action) ? Promise.all(action.map(function (a) { return applySingleCodeActionCommand(a, formatSettings); })) : applySingleCodeActionCommand(action, formatSettings); + return ts.isArray(action) ? Promise.all(action.map(function (a) { return applySingleCodeActionCommand(a); })) : applySingleCodeActionCommand(action); } - function applySingleCodeActionCommand(action, formatSettings) { + function applySingleCodeActionCommand(action) { var getPath = function (path) { return ts.toPath(path, currentDirectory, getCanonicalFileName); }; - switch (action.type) { - case "install package": - return host.installPackage - ? host.installPackage({ fileName: getPath(action.file), packageName: action.packageName }) - : Promise.reject("Host does not implement `installPackage`"); - case "generate types": { - var fileToGenerateTypesFor = action.fileToGenerateTypesFor, outputFileName_1 = action.outputFileName; - if (!host.inspectValue) - return Promise.reject("Host does not implement `installPackage`"); - var valueInfoPromise = host.inspectValue({ fileNameToRequire: fileToGenerateTypesFor }); - return valueInfoPromise.then(function (valueInfo) { - var fullOut = getPath(outputFileName_1); - host.writeFile(fullOut, ts.valueInfoToDeclarationFileText(valueInfo, formatSettings || ts.testFormatSettings)); // TODO: GH#18217 - return { successMessage: "Wrote types to '" + fullOut + "'" }; - }); - } - default: - return ts.Debug.assertNever(action); - } + ts.Debug.assertEqual(action.type, "install package"); + return host.installPackage + ? host.installPackage({ fileName: getPath(action.file), packageName: action.packageName }) + : Promise.reject("Host does not implement `installPackage`"); } function getDocCommentTemplateAtPosition(fileName, position) { return ts.JsDoc.getDocCommentTemplateAtPosition(ts.getNewLineOrDefaultFromHost(host), syntaxTreeCache.getCurrentSourceFile(fileName), position); @@ -121809,6 +122980,9 @@ var ts; preferences: preferences, }; } + function getSmartSelectionRange(fileName, position) { + return ts.SmartSelectionRange.getSmartSelectionRange(position, syntaxTreeCache.getCurrentSourceFile(fileName)); + } function getApplicableRefactors(fileName, positionOrRange, preferences) { if (preferences === void 0) { preferences = ts.emptyOptions; } synchronizeHostData(); @@ -121849,6 +123023,7 @@ var ts; getBreakpointStatementAtPosition: getBreakpointStatementAtPosition, getNavigateToItems: getNavigateToItems, getRenameInfo: getRenameInfo, + getSmartSelectionRange: getSmartSelectionRange, findRenameLocations: findRenameLocations, getNavigationBarItems: getNavigationBarItems, getNavigationTree: getNavigationTree, @@ -121911,7 +123086,7 @@ var ts; */ function literalIsName(node) { return ts.isDeclarationName(node) || - node.parent.kind === 259 /* ExternalModuleReference */ || + node.parent.kind === 260 /* ExternalModuleReference */ || isArgumentOfElementAccessExpression(node) || ts.isLiteralComputedPropertyDeclarationName(node); } @@ -121928,13 +123103,13 @@ var ts; switch (node.kind) { case 10 /* StringLiteral */: case 8 /* NumericLiteral */: - if (node.parent.kind === 149 /* ComputedPropertyName */) { + if (node.parent.kind === 150 /* ComputedPropertyName */) { return ts.isObjectLiteralElement(node.parent.parent) ? node.parent.parent : undefined; } // falls through - case 72 /* Identifier */: + case 73 /* Identifier */: return ts.isObjectLiteralElement(node.parent) && - (node.parent.parent.kind === 188 /* ObjectLiteralExpression */ || node.parent.parent.kind === 268 /* JsxAttributes */) && + (node.parent.parent.kind === 189 /* ObjectLiteralExpression */ || node.parent.parent.kind === 269 /* JsxAttributes */) && node.parent.name === node ? node.parent : undefined; } return undefined; @@ -121976,7 +123151,7 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 190 /* ElementAccessExpression */ && + node.parent.kind === 191 /* ElementAccessExpression */ && node.parent.argumentExpression === node; } /** @@ -122056,114 +123231,114 @@ var ts; if (node) { var parent = node.parent; switch (node.kind) { - case 219 /* VariableStatement */: + case 220 /* VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 237 /* VariableDeclaration */: - case 154 /* PropertyDeclaration */: - case 153 /* PropertySignature */: + case 238 /* VariableDeclaration */: + case 155 /* PropertyDeclaration */: + case 154 /* PropertySignature */: return spanInVariableDeclaration(node); - case 151 /* Parameter */: + case 152 /* Parameter */: return spanInParameterDeclaration(node); - case 239 /* FunctionDeclaration */: - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 157 /* Constructor */: - case 196 /* FunctionExpression */: - case 197 /* ArrowFunction */: + case 240 /* FunctionDeclaration */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 158 /* Constructor */: + case 197 /* FunctionExpression */: + case 198 /* ArrowFunction */: return spanInFunctionDeclaration(node); - case 218 /* Block */: + case 219 /* Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } // falls through - case 245 /* ModuleBlock */: + case 246 /* ModuleBlock */: return spanInBlock(node); - case 274 /* CatchClause */: + case 275 /* CatchClause */: return spanInBlock(node.block); - case 221 /* ExpressionStatement */: + case 222 /* ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 230 /* ReturnStatement */: + case 231 /* ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 224 /* WhileStatement */: + case 225 /* WhileStatement */: // Span on while(...) return textSpanEndingAtNextToken(node, node.expression); - case 223 /* DoStatement */: + case 224 /* DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 236 /* DebuggerStatement */: + case 237 /* DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 222 /* IfStatement */: + case 223 /* IfStatement */: // set on if(..) span return textSpanEndingAtNextToken(node, node.expression); - case 233 /* LabeledStatement */: + case 234 /* LabeledStatement */: // span in statement return spanInNode(node.statement); - case 229 /* BreakStatement */: - case 228 /* ContinueStatement */: + case 230 /* BreakStatement */: + case 229 /* ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 225 /* ForStatement */: + case 226 /* ForStatement */: return spanInForStatement(node); - case 226 /* ForInStatement */: + case 227 /* ForInStatement */: // span of for (a in ...) return textSpanEndingAtNextToken(node, node.expression); - case 227 /* ForOfStatement */: + case 228 /* ForOfStatement */: // span in initializer return spanInInitializerOfForLike(node); - case 232 /* SwitchStatement */: + case 233 /* SwitchStatement */: // span on switch(...) return textSpanEndingAtNextToken(node, node.expression); - case 271 /* CaseClause */: - case 272 /* DefaultClause */: + case 272 /* CaseClause */: + case 273 /* DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 235 /* TryStatement */: + case 236 /* TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 234 /* ThrowStatement */: + case 235 /* ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 254 /* ExportAssignment */: + case 255 /* ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 248 /* ImportEqualsDeclaration */: + case 249 /* ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 249 /* ImportDeclaration */: + case 250 /* ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 255 /* ExportDeclaration */: + case 256 /* ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return undefined; } // falls through - case 240 /* ClassDeclaration */: - case 243 /* EnumDeclaration */: - case 278 /* EnumMember */: - case 186 /* BindingElement */: + case 241 /* ClassDeclaration */: + case 244 /* EnumDeclaration */: + case 279 /* EnumMember */: + case 187 /* BindingElement */: // span on complete node return textSpan(node); - case 231 /* WithStatement */: + case 232 /* WithStatement */: // span in statement return spanInNode(node.statement); - case 152 /* Decorator */: + case 153 /* Decorator */: return spanInNodeArray(parent.decorators); - case 184 /* ObjectBindingPattern */: - case 185 /* ArrayBindingPattern */: + case 185 /* ObjectBindingPattern */: + case 186 /* ArrayBindingPattern */: return spanInBindingPattern(node); // No breakpoint in interface, type alias - case 241 /* InterfaceDeclaration */: - case 242 /* TypeAliasDeclaration */: + case 242 /* InterfaceDeclaration */: + case 243 /* TypeAliasDeclaration */: return undefined; // Tokens: case 26 /* SemicolonToken */: @@ -122187,13 +123362,13 @@ var ts; case 28 /* LessThanToken */: return spanInGreaterThanOrLessThanToken(node); // Keywords: - case 107 /* WhileKeyword */: + case 108 /* WhileKeyword */: return spanInWhileKeyword(node); - case 83 /* ElseKeyword */: - case 75 /* CatchKeyword */: - case 88 /* FinallyKeyword */: + case 84 /* ElseKeyword */: + case 76 /* CatchKeyword */: + case 89 /* FinallyKeyword */: return spanInNextNode(node); - case 147 /* OfKeyword */: + case 148 /* OfKeyword */: return spanInOfKeyword(node); default: // Destructuring pattern in destructuring assignment @@ -122205,14 +123380,14 @@ var ts; // Set breakpoint on identifier element of destructuring pattern // `a` or `...c` or `d: x` from // `[a, b, ...c]` or `{ a, b }` or `{ d: x }` from destructuring pattern - if ((node.kind === 72 /* Identifier */ || - node.kind === 208 /* SpreadElement */ || - node.kind === 275 /* PropertyAssignment */ || - node.kind === 276 /* ShorthandPropertyAssignment */) && + if ((node.kind === 73 /* Identifier */ || + node.kind === 209 /* SpreadElement */ || + node.kind === 276 /* PropertyAssignment */ || + node.kind === 277 /* ShorthandPropertyAssignment */) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(parent)) { return textSpan(node); } - if (node.kind === 204 /* BinaryExpression */) { + if (node.kind === 205 /* BinaryExpression */) { var _a = node, left = _a.left, operatorToken = _a.operatorToken; // Set breakpoint in destructuring pattern if its destructuring assignment // [a, b, c] or {a, b, c} of @@ -122221,7 +123396,7 @@ var ts; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(left)) { return spanInArrayLiteralOrObjectLiteralDestructuringPattern(left); } - if (operatorToken.kind === 59 /* EqualsToken */ && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { + if (operatorToken.kind === 60 /* EqualsToken */ && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { // Set breakpoint on assignment expression element of destructuring pattern // a = expression of // [a = expression, b, c] = someExpression or @@ -122234,22 +123409,22 @@ var ts; } if (ts.isExpressionNode(node)) { switch (parent.kind) { - case 223 /* DoStatement */: + case 224 /* DoStatement */: // Set span as if on while keyword return spanInPreviousNode(node); - case 152 /* Decorator */: + case 153 /* Decorator */: // Set breakpoint on the decorator emit return spanInNode(node.parent); - case 225 /* ForStatement */: - case 227 /* ForOfStatement */: + case 226 /* ForStatement */: + case 228 /* ForOfStatement */: return textSpan(node); - case 204 /* BinaryExpression */: + case 205 /* BinaryExpression */: if (node.parent.operatorToken.kind === 27 /* CommaToken */) { // If this is a comma expression, the breakpoint is possible in this expression return textSpan(node); } break; - case 197 /* ArrowFunction */: + case 198 /* ArrowFunction */: if (node.parent.body === node) { // If this is body of arrow function, it is allowed to have the breakpoint return textSpan(node); @@ -122258,21 +123433,21 @@ var ts; } } switch (node.parent.kind) { - case 275 /* PropertyAssignment */: + case 276 /* PropertyAssignment */: // If this is name of property assignment, set breakpoint in the initializer if (node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); } break; - case 194 /* TypeAssertionExpression */: + case 195 /* TypeAssertionExpression */: // Breakpoint in type assertion goes to its operand if (node.parent.type === node) { return spanInNextNode(node.parent.type); } break; - case 237 /* VariableDeclaration */: - case 151 /* Parameter */: { + case 238 /* VariableDeclaration */: + case 152 /* Parameter */: { // initializer of variable/parameter declaration go to previous node var _b = node.parent, initializer = _b.initializer, type = _b.type; if (initializer === node || type === node || ts.isAssignmentOperator(node.kind)) { @@ -122280,7 +123455,7 @@ var ts; } break; } - case 204 /* BinaryExpression */: { + case 205 /* BinaryExpression */: { var left = node.parent.left; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(left) && node !== left) { // If initializer of destructuring assignment move to previous token @@ -122310,7 +123485,7 @@ var ts; } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 226 /* ForInStatement */) { + if (variableDeclaration.parent.parent.kind === 227 /* ForInStatement */) { return spanInNode(variableDeclaration.parent.parent); } var parent = variableDeclaration.parent; @@ -122322,7 +123497,7 @@ var ts; // or its declaration from 'for of' if (variableDeclaration.initializer || ts.hasModifier(variableDeclaration, 1 /* Export */) || - parent.parent.kind === 227 /* ForOfStatement */) { + parent.parent.kind === 228 /* ForOfStatement */) { return textSpanFromVariableDeclaration(variableDeclaration); } if (ts.isVariableDeclarationList(variableDeclaration.parent) && @@ -122363,7 +123538,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return ts.hasModifier(functionDeclaration, 1 /* Export */) || - (functionDeclaration.parent.kind === 240 /* ClassDeclaration */ && functionDeclaration.kind !== 157 /* Constructor */); + (functionDeclaration.parent.kind === 241 /* ClassDeclaration */ && functionDeclaration.kind !== 158 /* Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -122386,26 +123561,26 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 244 /* ModuleDeclaration */: + case 245 /* ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) { return undefined; } // falls through // Set on parent if on same line otherwise on first statement - case 224 /* WhileStatement */: - case 222 /* IfStatement */: - case 226 /* ForInStatement */: + case 225 /* WhileStatement */: + case 223 /* IfStatement */: + case 227 /* ForInStatement */: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); // Set span on previous token if it starts on same line otherwise on the first statement of the block - case 225 /* ForStatement */: - case 227 /* ForOfStatement */: + case 226 /* ForStatement */: + case 228 /* ForOfStatement */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } // Default action is to set on first statement return spanInNode(block.statements[0]); } function spanInInitializerOfForLike(forLikeStatement) { - if (forLikeStatement.initializer.kind === 238 /* VariableDeclarationList */) { + if (forLikeStatement.initializer.kind === 239 /* VariableDeclarationList */) { // Declaration list - set breakpoint in first declaration var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -122430,21 +123605,21 @@ var ts; } function spanInBindingPattern(bindingPattern) { // Set breakpoint in first binding element - var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 210 /* OmittedExpression */ ? element : undefined; }); + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 211 /* OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } // Empty binding pattern of binding element, set breakpoint on binding element - if (bindingPattern.parent.kind === 186 /* BindingElement */) { + if (bindingPattern.parent.kind === 187 /* BindingElement */) { return textSpan(bindingPattern.parent); } // Variable declaration is used as the span return textSpanFromVariableDeclaration(bindingPattern.parent); } function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { - ts.Debug.assert(node.kind !== 185 /* ArrayBindingPattern */ && node.kind !== 184 /* ObjectBindingPattern */); - var elements = node.kind === 187 /* ArrayLiteralExpression */ ? node.elements : node.properties; - var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 210 /* OmittedExpression */ ? element : undefined; }); + ts.Debug.assert(node.kind !== 186 /* ArrayBindingPattern */ && node.kind !== 185 /* ObjectBindingPattern */); + var elements = node.kind === 188 /* ArrayLiteralExpression */ ? node.elements : node.properties; + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 211 /* OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } @@ -122452,18 +123627,18 @@ var ts; // just nested element in another destructuring assignment // set breakpoint on assignment when parent is destructuring assignment // Otherwise set breakpoint for this element - return textSpan(node.parent.kind === 204 /* BinaryExpression */ ? node.parent : node); + return textSpan(node.parent.kind === 205 /* BinaryExpression */ ? node.parent : node); } // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 243 /* EnumDeclaration */: + case 244 /* EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 240 /* ClassDeclaration */: + case 241 /* ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 246 /* CaseBlock */: + case 247 /* CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -122471,25 +123646,25 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 245 /* ModuleBlock */: + case 246 /* ModuleBlock */: // If this is not an instantiated module block, no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) { return undefined; } // falls through - case 243 /* EnumDeclaration */: - case 240 /* ClassDeclaration */: + case 244 /* EnumDeclaration */: + case 241 /* ClassDeclaration */: // Span on close brace token return textSpan(node); - case 218 /* Block */: + case 219 /* Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } // falls through - case 274 /* CatchClause */: + case 275 /* CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 246 /* CaseBlock */: + case 247 /* CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); @@ -122497,7 +123672,7 @@ var ts; return spanInNode(ts.lastOrUndefined(lastClause.statements)); } return undefined; - case 184 /* ObjectBindingPattern */: + case 185 /* ObjectBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -122513,7 +123688,7 @@ var ts; } function spanInCloseBracketToken(node) { switch (node.parent.kind) { - case 185 /* ArrayBindingPattern */: + case 186 /* ArrayBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -122528,12 +123703,12 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 223 /* DoStatement */ || // Go to while keyword and do action instead - node.parent.kind === 191 /* CallExpression */ || - node.parent.kind === 192 /* NewExpression */) { + if (node.parent.kind === 224 /* DoStatement */ || // Go to while keyword and do action instead + node.parent.kind === 192 /* CallExpression */ || + node.parent.kind === 193 /* NewExpression */) { return spanInPreviousNode(node); } - if (node.parent.kind === 195 /* ParenthesizedExpression */) { + if (node.parent.kind === 196 /* ParenthesizedExpression */) { return spanInNextNode(node); } // Default to parent node @@ -122542,21 +123717,21 @@ var ts; function spanInCloseParenToken(node) { // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { - case 196 /* FunctionExpression */: - case 239 /* FunctionDeclaration */: - case 197 /* ArrowFunction */: - case 156 /* MethodDeclaration */: - case 155 /* MethodSignature */: - case 158 /* GetAccessor */: - case 159 /* SetAccessor */: - case 157 /* Constructor */: - case 224 /* WhileStatement */: - case 223 /* DoStatement */: - case 225 /* ForStatement */: - case 227 /* ForOfStatement */: - case 191 /* CallExpression */: - case 192 /* NewExpression */: - case 195 /* ParenthesizedExpression */: + case 197 /* FunctionExpression */: + case 240 /* FunctionDeclaration */: + case 198 /* ArrowFunction */: + case 157 /* MethodDeclaration */: + case 156 /* MethodSignature */: + case 159 /* GetAccessor */: + case 160 /* SetAccessor */: + case 158 /* Constructor */: + case 225 /* WhileStatement */: + case 224 /* DoStatement */: + case 226 /* ForStatement */: + case 228 /* ForOfStatement */: + case 192 /* CallExpression */: + case 193 /* NewExpression */: + case 196 /* ParenthesizedExpression */: return spanInPreviousNode(node); // Default to parent node default: @@ -122566,20 +123741,20 @@ var ts; function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration if (ts.isFunctionLike(node.parent) || - node.parent.kind === 275 /* PropertyAssignment */ || - node.parent.kind === 151 /* Parameter */) { + node.parent.kind === 276 /* PropertyAssignment */ || + node.parent.kind === 152 /* Parameter */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 194 /* TypeAssertionExpression */) { + if (node.parent.kind === 195 /* TypeAssertionExpression */) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 223 /* DoStatement */) { + if (node.parent.kind === 224 /* DoStatement */) { // Set span on while expression return textSpanEndingAtNextToken(node, node.parent.expression); } @@ -122587,7 +123762,7 @@ var ts; return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 227 /* ForOfStatement */) { + if (node.parent.kind === 228 /* ForOfStatement */) { // Set using next token return spanInNextNode(node); } @@ -123056,6 +124231,10 @@ var ts; var _this = this; return this.forwardJSONCall("getRenameInfo('" + fileName + "', " + position + ")", function () { return _this.languageService.getRenameInfo(fileName, position, options); }); }; + LanguageServiceShimObject.prototype.getSmartSelectionRange = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getSmartSelectionRange('" + fileName + "', " + position + ")", function () { return _this.languageService.getSmartSelectionRange(fileName, position); }); + }; LanguageServiceShimObject.prototype.findRenameLocations = function (fileName, position, findInStrings, findInComments, providePrefixAndSuffixTextForRename) { var _this = this; return this.forwardJSONCall("findRenameLocations('" + fileName + "', " + position + ", " + findInStrings + ", " + findInComments + ", " + providePrefixAndSuffixTextForRename + ")", function () { return _this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments, providePrefixAndSuffixTextForRename); }); diff --git a/packages/schematics/angular/utility/latest-versions.ts b/packages/schematics/angular/utility/latest-versions.ts index 3f1016dbb2..a1c89fd7c6 100644 --- a/packages/schematics/angular/utility/latest-versions.ts +++ b/packages/schematics/angular/utility/latest-versions.ts @@ -8,11 +8,11 @@ export const latestVersions = { // These versions should be kept up to date with latest Angular peer dependencies. - Angular: '~8.2.0-next.2', + Angular: '~8.2.0-rc.0', RxJs: '~6.4.0', ZoneJs: '~0.9.1', - TypeScript: '~3.4.3', - TsLib: '^1.9.0', + TypeScript: '~3.5.3', + TsLib: '^1.10.0', // The versions below must be manually updated when making a new devkit release. DevkitBuildAngular: '~0.802.0-next.2', @@ -20,6 +20,6 @@ export const latestVersions = { DevkitBuildWebpack: '~0.802.0-next.2', AngularPWA: '~0.802.0-next.2', - tsickle: '^0.35.0', - ngPackagr: '^5.1.0', + tsickle: '^0.36.0', + ngPackagr: '^5.3.0', }; diff --git a/packages/schematics/schematics/blank/project-files/package.json.template b/packages/schematics/schematics/blank/project-files/package.json.template index ca350c4d86..2f6937d098 100644 --- a/packages/schematics/schematics/blank/project-files/package.json.template +++ b/packages/schematics/schematics/blank/project-files/package.json.template @@ -18,6 +18,6 @@ "@types/jasmine": "^3.3.9", "@types/node": "^8.0.31", "jasmine": "^3.3.1", - "typescript": "~3.4.3" + "typescript": "~3.5.3" } } diff --git a/packages/schematics/schematics/schematic/files/package.json b/packages/schematics/schematics/schematic/files/package.json index 29db628a22..4c6c6be6b4 100644 --- a/packages/schematics/schematics/schematic/files/package.json +++ b/packages/schematics/schematics/schematic/files/package.json @@ -18,6 +18,6 @@ "@types/jasmine": "^3.3.9", "@types/node": "^8.0.31", "jasmine": "^3.3.1", - "typescript": "3.4.5" + "typescript": "3.5.3" } } diff --git a/tests/legacy-cli/e2e/assets/webpack/test-app-weird/package.json b/tests/legacy-cli/e2e/assets/webpack/test-app-weird/package.json index 71c49f7b9f..084987d33c 100644 --- a/tests/legacy-cli/e2e/assets/webpack/test-app-weird/package.json +++ b/tests/legacy-cli/e2e/assets/webpack/test-app-weird/package.json @@ -21,7 +21,7 @@ "preprocess-loader": "^0.2.2", "raw-loader": "^0.5.1", "sass-loader": "^6.0.0", - "typescript": "~3.4.5", + "typescript": "~3.5.3", "webpack": "~4.0.1", "webpack-cli": "~2.0.9" } diff --git a/tests/legacy-cli/e2e/assets/webpack/test-app/package.json b/tests/legacy-cli/e2e/assets/webpack/test-app/package.json index 11ea587ef4..ad8926ad67 100644 --- a/tests/legacy-cli/e2e/assets/webpack/test-app/package.json +++ b/tests/legacy-cli/e2e/assets/webpack/test-app/package.json @@ -2,14 +2,14 @@ "name": "test", "license": "MIT", "dependencies": { - "@angular/common": "^8.0.0-rc.0", - "@angular/compiler": "^8.0.0-rc.0", - "@angular/compiler-cli": "^8.0.0-rc.0", - "@angular/core": "^8.0.0-rc.0", - "@angular/platform-browser": "^8.0.0-rc.0", - "@angular/platform-browser-dynamic": "^8.0.0-rc.0", - "@angular/platform-server": "^8.0.0-rc.0", - "@angular/router": "^8.0.0-rc.0", + "@angular/common": "^8.2.0-rc.0", + "@angular/compiler": "^8.2.0-rc.0", + "@angular/compiler-cli": "^8.2.0-rc.0", + "@angular/core": "^8.2.0-rc.0", + "@angular/platform-browser": "^8.2.0-rc.0", + "@angular/platform-browser-dynamic": "^8.2.0-rc.0", + "@angular/platform-server": "^8.2.0-rc.0", + "@angular/router": "^8.2.0-rc.0", "@ngtools/webpack": "0.0.0", "core-js": "^3.0.0", "rxjs": "^6.4.0", @@ -20,7 +20,7 @@ "performance-now": "^0.2.0", "raw-loader": "^0.5.1", "sass-loader": "^6.0.0", - "typescript": "~3.4.5", + "typescript": "~3.5.3", "webpack": "~4.0.1", "webpack-cli": "~2.0.9" } diff --git a/tests/legacy-cli/e2e/assets/webpack/test-server-app/package.json b/tests/legacy-cli/e2e/assets/webpack/test-server-app/package.json index 5f30c3cb45..cd1f314e91 100644 --- a/tests/legacy-cli/e2e/assets/webpack/test-server-app/package.json +++ b/tests/legacy-cli/e2e/assets/webpack/test-server-app/package.json @@ -21,7 +21,7 @@ "performance-now": "^0.2.0", "raw-loader": "^0.5.1", "sass-loader": "^6.0.3", - "typescript": "~3.4.5", + "typescript": "~3.5.3", "webpack": "~4.0.1", "webpack-cli": "~2.0.9" } diff --git a/yarn.lock b/yarn.lock index 8fe6d4366c..f40e733b0a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,10 +2,10 @@ # yarn lockfile v1 -"@angular/animations@~8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-8.1.0.tgz#acc6716df47599e48c715c7ec24dfc1e340256e2" - integrity sha512-v1paXrWQGsD+E4QBpwNUZ8dPj8hEn0b2kDVzYX6l/e9flUX6W2BWYx+BRuC4QBnNtTV9jiGsHT8FmQq/WztgWw== +"@angular/animations@~8.2.0-rc.0": + version "8.2.0-rc.0" + resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-8.2.0-rc.0.tgz#290466ddd7c93ba875cb13a053054334281f71d9" + integrity sha512-Uq6xORBq117KeD9iVXYu2Vkz55+zm3NngAkxyzlhZkbYRz8ByQxFAtfMhWVVcHlqW5GnLhyqX/lN5Nav0jdcIw== dependencies: tslib "^1.9.0" @@ -18,17 +18,17 @@ optionalDependencies: parse5 "^5.0.0" -"@angular/common@~8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@angular/common/-/common-8.1.0.tgz#aeb34e52e7f808e49d045eee36b97c802152c8fb" - integrity sha512-m5oEBPSy5nE+4SZTu3XchJhKT/u73NnJIS3+41xRsF5aX/1p8uNHkhJR7kcJmlVa7BZNr4byl8bGsYjX0CCpVg== +"@angular/common@~8.2.0-rc.0": + version "8.2.0-rc.0" + resolved "https://registry.yarnpkg.com/@angular/common/-/common-8.2.0-rc.0.tgz#58b4fdc85d7db9667d9f9d28e8cb6356923c5e92" + integrity sha512-aOTXW2KRGhX/y5v6NUFFxxoTi1HlMwGv9XaxH1I9qj+YnlHO+oVqyHB4MS+gvb2eLqbyxKTKzUYWsMDblX8nVA== dependencies: tslib "^1.9.0" -"@angular/compiler-cli@~8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-8.1.0.tgz#a42376cc42d34d04a9d7f1238b5d7ef535a218f6" - integrity sha512-WqEWjUTkvkp4rYDwYKo9XVXK1sbUHihwiZDOZrBEiGdw08TvZ+3qZs/mnYwRUYCzoN99RVG5rxJDg8Sf2VTY+w== +"@angular/compiler-cli@~8.2.0-rc.0": + version "8.2.0-rc.0" + resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-8.2.0-rc.0.tgz#a5b290d5c92d0f9a6de5d17c63ea7740169845e3" + integrity sha512-w4KSp2cSYpg2qcONZeVaeCGB0JkiXdXVIPO9PdkCp8tU7KYVOAt/ZbN91zBKunSD4EbzlaF7pr290J094CH04w== dependencies: canonical-path "1.0.0" chokidar "^2.1.1" @@ -37,22 +37,28 @@ magic-string "^0.25.0" minimist "^1.2.0" reflect-metadata "^0.1.2" - shelljs "^0.8.1" source-map "^0.6.1" tslib "^1.9.0" yargs "13.1.0" -"@angular/compiler@~8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-8.1.0.tgz#8d94ad49d5388b2f2f0e369233a224f649619be9" - integrity sha512-+o4jR7WfqR39zgGk7gwpxZfd2hS3X2qgr17mUCeqQkKj0gh+GYWj7OlSuYXG63OS9S4iLsKQiVUYYgqdNSK5mg== +"@angular/compiler@~8.2.0-rc.0": + version "8.2.0-rc.0" + resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-8.2.0-rc.0.tgz#3c288d33717e3a687333a5e7de533f871a5e5fca" + integrity sha512-fS2/5MTUtYy38kCwToltqBku6aq0hq90jn0p37TSRoYsNm7Ae2NU3nkM36A5G1wzetBn6R92updswbR62OVD1w== dependencies: tslib "^1.9.0" -"@angular/core@~8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@angular/core/-/core-8.1.0.tgz#68bc170b4c041e3c19b9a17c0fff74b88fb37aae" - integrity sha512-GviWJjOu6LJMYNbukdSK35VaXvSrp5LTNd0FbXoBQF+mhVVV/8cG4hTKKjxG1xwWXI5E1t5U4aUKXrKUNJ1sQg== +"@angular/core@~8.2.0-rc.0": + version "8.2.0-rc.0" + resolved "https://registry.yarnpkg.com/@angular/core/-/core-8.2.0-rc.0.tgz#97a028fb2871abed3aa5fd04b5c4237818a5adb8" + integrity sha512-G7vdTjNCxhpLlOaAcQ/xWt9kFLs1PkNkMzyRsiGUe/k5Mlr+xcmUDb1e5N3bLHJmIDFIUO1fXp/KHp1dysqB7g== + dependencies: + tslib "^1.9.0" + +"@angular/forms@~8.2.0-rc.0": + version "8.2.0-rc.0" + resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-8.2.0-rc.0.tgz#999970f6e5d37bafd91dffaba7057fc1f801f4fe" + integrity sha512-HjUjdqAu8XfI29+CXC8qDGYsGkFFonLMRwuDhWn2KpF7MXvFhERlxsFUNYNIYd29+HcoJcg/PRHTzqqJ2TPJLg== dependencies: tslib "^1.9.0" @@ -63,40 +69,40 @@ dependencies: tslib "^1.7.1" -"@angular/platform-browser-dynamic@~8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-8.1.0.tgz#407fae89fc7294783b8d27c19c1f96e36a3fdabd" - integrity sha512-By9I9hXqg538UzhlYDrF1dW7cDaF2JPjoFCE9jZZQxVRhOdjVoYVuIxIa5qPuGWfmMITO2G9rfMMrDiRHMyEDg== +"@angular/platform-browser-dynamic@~8.2.0-rc.0": + version "8.2.0-rc.0" + resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-8.2.0-rc.0.tgz#4d231e1091502792ef1bd02a49f94a54f12503d0" + integrity sha512-4LOE9pbcEM+dsXPBqIcHDglsizUYU4n23N+J6jsud3GM7VYx7KKd70e1KF+TTNEnNqE1gv7aCz5vZ3J3cYlWTQ== dependencies: tslib "^1.9.0" -"@angular/platform-browser@~8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-8.1.0.tgz#186ce714304d2f72c4a3bf50a1607e03c8de6abd" - integrity sha512-qH6bH6DSRGvgx5iD7BbufsdeMxhh7lL1zN47LkrLGa8hojF+yxwtdE+go+WJ160ArACyX/FrPmPDSWT20YilUQ== +"@angular/platform-browser@~8.2.0-rc.0": + version "8.2.0-rc.0" + resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-8.2.0-rc.0.tgz#69ae708dfc74fcc03e8cd1cdb296e1a828b433b9" + integrity sha512-Vk9Zdv6kHm3hwPvhc6FG0AnMxWOkNXfdAoXTLDY4vbo367ym1xxcDUmUf+mou/HODpnGdoHKSTLj5SEua2SSMw== dependencies: tslib "^1.9.0" -"@angular/platform-server@~8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@angular/platform-server/-/platform-server-8.1.0.tgz#e0f9e69cbe87ab8538c5256be748e0718a480718" - integrity sha512-bFsbYnbsXl178pOYxppfpTAxGcOaAz1kjTWQr/zVcMOthtu/M08oGXMke2l7Fx4Bt3MM7DXd93Qjebv7N4ECRQ== +"@angular/platform-server@~8.2.0-rc.0": + version "8.2.0-rc.0" + resolved "https://registry.yarnpkg.com/@angular/platform-server/-/platform-server-8.2.0-rc.0.tgz#7d54506a01f25a927f68716027f231947f293350" + integrity sha512-acMb95y5vKp5b/CbqDLbb5ZrS99nl4WedAv1FDfQH8kEWR/RtHfxB+Q3w3LwNBDC+Pivy3Ce+E8dZSpVTt4bUA== dependencies: domino "^2.1.2" tslib "^1.9.0" xhr2 "^0.1.4" -"@angular/router@~8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@angular/router/-/router-8.1.0.tgz#e8e0d146a489abcc7b8aed0f9efe10922e467db6" - integrity sha512-LeJOmiFdsXVf0KlN/jzA5NgWY1V4Ty5TDcfNd01s/ckZlzZd+p5hFhRFc75qwENTb8UwClTLsYQLmvmphnB4dA== +"@angular/router@~8.2.0-rc.0": + version "8.2.0-rc.0" + resolved "https://registry.yarnpkg.com/@angular/router/-/router-8.2.0-rc.0.tgz#8a5eba78917d45485fc5001592e690d9ed4e4ad8" + integrity sha512-hpidAfvDpIaWBccogRNck1cFO/STgN/KinF/VkMWeYMlt9IFwefEOWwY/d1V71L3wjTwV+NMhuUTguE8OptT3w== dependencies: tslib "^1.9.0" -"@angular/service-worker@~8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@angular/service-worker/-/service-worker-8.1.0.tgz#bd7d41863526441e4ea2b93ac19e69255c52ca6e" - integrity sha512-O4vUqrTPoCeRRnbUYBk+5Dx2zj/nc6UxZS/WZ1HKEGJZvYvuXf3SMfi1cHdzKPedCUj8PMt6yLpiP0qkyxV+Ww== +"@angular/service-worker@~8.2.0-rc.0": + version "8.2.0-rc.0" + resolved "https://registry.yarnpkg.com/@angular/service-worker/-/service-worker-8.2.0-rc.0.tgz#9bfc4da356c177264448185b0a8d0be80853154f" + integrity sha512-9RKJyjruUGY+caJ532J58umsR10R/eW2gU60cndDBPanopoqLsXMstss+bUZOgrtMnO7HaV72aypVZS6sBrbQA== dependencies: tslib "^1.9.0" @@ -282,6 +288,13 @@ dependencies: defer-to-connect "^1.0.1" +"@szmarczak/http-timer@^1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-1.1.2.tgz#b1665e2c461a2cd92f4c1bbf50d5454de0d4b421" + integrity sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA== + dependencies: + defer-to-connect "^1.0.1" + "@types/bluebird@*": version "3.5.26" resolved "https://registry.yarnpkg.com/@types/bluebird/-/bluebird-3.5.26.tgz#a38c438ae84fa02431d6892edf86e46edcbca291" @@ -454,10 +467,10 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-10.9.4.tgz#0f4cb2dc7c1de6096055357f70179043c33e9897" integrity sha512-fCHV45gS+m3hH17zgkgADUSi2RR1Vht6wOZ0jyHP8rjiQra9f+mIcgwPQHllmDocYOstIEbKlxbFDYlgrTPYqw== -"@types/node@^11.11.6": - version "11.12.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-11.12.0.tgz#ec5594728811dc2797e42396cfcdf786f2052c12" - integrity sha512-Lg00egj78gM+4aE0Erw05cuDbvX9sLJbaaPwwRtdCdAMnIudqrQZ0oZX98Ek0yiSK/A2nubHgJfvII/rTT2Dwg== +"@types/node@^12.6.2": + version "12.6.8" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.6.8.tgz#e469b4bf9d1c9832aee4907ba8a051494357c12c" + integrity sha512-aX+gFgA5GHcDi89KG5keey2zf0WfZk/HAQotEamsK2kbey+8yGKcson0hbK8E+v0NArlCJQCqMP161YhV6ZXLg== "@types/node@^6.0.46": version "6.14.0" @@ -491,6 +504,13 @@ "@types/node" "*" "@types/tough-cookie" "*" +"@types/resolve@0.0.8": + version "0.0.8" + resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-0.0.8.tgz#f26074d238e02659e323ce1a13d041eee280e194" + integrity sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ== + dependencies: + "@types/node" "*" + "@types/rx-core-binding@*": version "4.0.4" resolved "https://registry.yarnpkg.com/@types/rx-core-binding/-/rx-core-binding-4.0.4.tgz#d969d32f15a62b89e2862c17b3ee78fe329818d3" @@ -1039,12 +1059,12 @@ amdefine@>=0.0.4: resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" integrity sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU= -ansi-align@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-2.0.0.tgz#c36aeccba563b89ceb556f3690f0b1d9e3547f7f" - integrity sha1-w2rsy6VjuJzrVW82kPCx2eNUf38= +ansi-align@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-3.0.0.tgz#b536b371cf687caaef236c18d3e21fe3797467cb" + integrity sha512-ZpClVKqXN3RGBmKibdfWzqCY4lnjEuoNzU5T0oEFpfd/z5qJHVarukridD4juLO2FXMiwUQxr9WqQtaYa8XRYw== dependencies: - string-width "^2.0.0" + string-width "^3.0.0" ansi-colors@3.2.4: version "3.2.4" @@ -1336,7 +1356,7 @@ atob@^2.1.1: resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== -autoprefixer@9.6.1: +autoprefixer@9.6.1, autoprefixer@^9.6.0: version "9.6.1" resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-9.6.1.tgz#51967a02d2d2300bb01866c1611ec8348d355a47" integrity sha512-aVo5WxR3VyvyJxcJC3h4FKfwCQvQWb1tSI5VHNibddCVWrcD1NvlxEweg3TSgiPztMnWfjpy2FURKA2kvDE+Tw== @@ -1349,18 +1369,6 @@ autoprefixer@9.6.1: postcss "^7.0.17" postcss-value-parser "^4.0.0" -autoprefixer@^9.0.0: - version "9.3.1" - resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-9.3.1.tgz#71b622174de2b783d5fd99f9ad617b7a3c78443e" - integrity sha512-DY9gOh8z3tnCbJ13JIWaeQsoYncTGdsrgCceBaQSIL4nvdrLxgbRSBPevg2XbX7u4QCSfLheSJEEIUUSlkbx6Q== - dependencies: - browserslist "^4.3.3" - caniuse-lite "^1.0.30000898" - normalize-range "^0.1.2" - num2fraction "^1.2.2" - postcss "^7.0.5" - postcss-value-parser "^3.3.1" - aws-sign2@~0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" @@ -1620,17 +1628,18 @@ bootstrap@^4.0.0: resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-4.1.3.tgz#0eb371af2c8448e8c210411d0cb824a6409a12be" integrity sha512-rDFIzgXcof0jDyjNosjv4Sno77X4KuPeFxG2XZZv1/Kc8DRVGVADdoQyyOVDwPqL36DDmtCQbrpMCqvpPLJQ0w== -boxen@^1.2.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/boxen/-/boxen-1.3.0.tgz#55c6c39a8ba58d9c61ad22cd877532deb665a20b" - integrity sha512-TNPjfTr432qx7yOjQyaXm3dSR0MH9vXp7eT1BFSl/C51g+EFnOR9hTg1IreahGBmDNCehscshe45f+C1TBZbLw== +boxen@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/boxen/-/boxen-3.2.0.tgz#fbdff0de93636ab4450886b6ff45b92d098f45eb" + integrity sha512-cU4J/+NodM3IHdSL2yN8bqYqnmlBTidDR4RC7nJs61ZmtGz8VZzM3HLQX0zY5mrSmPtR3xWwsq2jOUQqFZN8+A== dependencies: - ansi-align "^2.0.0" - camelcase "^4.0.0" - chalk "^2.0.1" - cli-boxes "^1.0.0" - string-width "^2.0.0" + ansi-align "^3.0.0" + camelcase "^5.3.1" + chalk "^2.4.2" + cli-boxes "^2.2.0" + string-width "^3.0.0" term-size "^1.2.0" + type-fest "^0.3.0" widest-line "^2.0.0" brace-expansion@^1.1.7: @@ -1761,7 +1770,7 @@ browserslist@4.6.6: electron-to-chromium "^1.3.191" node-releases "^1.1.25" -browserslist@^4.0.0, browserslist@^4.3.3: +browserslist@^4.0.0: version "4.5.5" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.5.5.tgz#fe1a352330d2490d5735574c149a85bc18ef9b82" integrity sha512-0QFO1r/2c792Ohkit5XI8Cm8pDtZxgNl2H6HU4mHrpYz7314pEYcsAVVatM0l/YmxPnEzh9VygXouj4gkFUTKA== @@ -1843,10 +1852,10 @@ builtin-modules@^1.0.0, builtin-modules@^1.1.1: resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" integrity sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8= -builtin-modules@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.0.0.tgz#1e587d44b006620d90286cc7a9238bbc6129cab1" - integrity sha512-hMIeU4K2ilbXV6Uv93ZZ0Avg/M91RaKXucQ+4me2Do1txxBDyDZWCBa5bJSLqoNTRpXTLwEzIk1KmloenDDjhg== +builtin-modules@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.1.0.tgz#aad97c15131eb76b65b50ef208e7584cd76a7484" + integrity sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw== builtin-status-codes@^3.0.0: version "3.0.0" @@ -1993,6 +2002,19 @@ cacheable-request@^5.1.0: normalize-url "^3.1.0" responselike "^1.0.2" +cacheable-request@^6.0.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/cacheable-request/-/cacheable-request-6.1.0.tgz#20ffb8bd162ba4be11e9567d823db651052ca912" + integrity sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg== + dependencies: + clone-response "^1.0.2" + get-stream "^5.1.0" + http-cache-semantics "^4.0.0" + keyv "^3.0.0" + lowercase-keys "^2.0.0" + normalize-url "^4.1.0" + responselike "^1.0.2" + caller-callsite@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/caller-callsite/-/caller-callsite-2.0.0.tgz#847e0fce0a223750a9a027c54b33731ad3154134" @@ -2039,12 +2061,12 @@ camelcase@^2.0.0, camelcase@^2.0.1: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f" integrity sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8= -camelcase@^4.0.0, camelcase@^4.1.0: +camelcase@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" integrity sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0= -camelcase@^5.0.0: +camelcase@^5.0.0, camelcase@^5.3.1: version "5.3.1" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== @@ -2054,11 +2076,6 @@ caniuse-lite@1.0.30000985: resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000985.tgz#0eb40f6c8a8c219155cbe43c4975c0efb4a0f77f" integrity sha512-1ngiwkgqAYPG0JSSUp3PUDGPKKY59EK7NrGGX+VOxaKCNzRbNc7uXMny+c3VJfZxtoK3wSImTvG9T9sXiTw2+w== -caniuse-lite@^1.0.30000898: - version "1.0.30000903" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000903.tgz#86d46227759279b3db345ddbe778335dbba9e858" - integrity sha512-T1XVJEpGCoaq7MDw7/6hCdYUukmSaS+1l/OQJkLtw7Cr2+/+d67tNGKEbyiqf7Ck8x6EhNFUxjYFXXka0N/w5g== - caniuse-lite@^1.0.30000960: version "1.0.30000960" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000960.tgz#ec48297037e5607f582f246ae7b12bee66a78999" @@ -2084,11 +2101,6 @@ canonical-path@1.0.0: resolved "https://registry.yarnpkg.com/canonical-path/-/canonical-path-1.0.0.tgz#fcb470c23958def85081856be7a86e904f180d1d" integrity sha512-feylzsbDxi1gPZ1IjystzIQZagYYLvfKrSuygUCgf7z6x790VEzze5QEkdSV1U58RA7Hi0+v6fv4K54atOzATg== -capture-stack-trace@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/capture-stack-trace/-/capture-stack-trace-1.0.1.tgz#a6c0bbe1f38f3aa0b92238ecb6ff42c344d4135d" - integrity sha512-mYQLZnx5Qt1JgB1WEiMCf2647plpGeQ2NMR/5L0HNZzGQo4fuSPnK+wjfPnKZV0aiJDgzmWqqkV/g7JD+DW0qw== - caseless@~0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" @@ -2234,11 +2246,6 @@ chrome-trace-event@^1.0.0: dependencies: tslib "^1.9.0" -ci-info@^1.5.0: - version "1.5.1" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.5.1.tgz#17e8eb5de6f8b2b6038f0cbb714d410bfa9f3030" - integrity sha512-fKFIKXaYiL1exImwJ0AhR/6jxFPSKQBk2ayV5NiNoruUs2+rxC2kNw0EG+1Z9dugZRdCrppskQ8DN2cyaUM1Hw== - ci-info@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" @@ -2279,10 +2286,10 @@ clean-css@4.2.1, clean-css@^4.1.11: dependencies: source-map "~0.6.0" -cli-boxes@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-1.0.0.tgz#4fa917c3e59c94a004cd61f8ee509da651687143" - integrity sha1-T6kXw+WclKAEzWH47lCdplFocUM= +cli-boxes@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-2.2.0.tgz#538ecae8f9c6ca508e3c3c95b453fe93cb4c168d" + integrity sha512-gpaBrMAizVEANOpfZp/EEUixTXDyGt7DFzdK5hU+UbWt/J0lB0w20ncZj59Z9a93xHb9u12zF5BS6i9RKbtg4w== cli-cursor@^2.1.0: version "2.1.0" @@ -2557,10 +2564,10 @@ concat-stream@1.6.2, concat-stream@^1.5.0, concat-stream@^1.5.2, concat-stream@~ readable-stream "^2.2.2" typedarray "^0.0.6" -configstore@^3.0.0: - version "3.1.2" - resolved "https://registry.yarnpkg.com/configstore/-/configstore-3.1.2.tgz#c6f25defaeef26df12dd33414b001fe81a543f8f" - integrity sha512-vtv5HtGjcYUgFrXc6Kx747B83MRRVS5R1VTEQoXvuP+kMI+if6uywV0nDGoiydJRy4yk7h9od5Og0kxx4zUXmw== +configstore@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/configstore/-/configstore-4.0.0.tgz#5933311e95d3687efb592c528b922d9262d227e7" + integrity sha512-CmquAXFBocrzaSM8mtGPMM/HiWmyIpr4CcJl/rgY2uCObZ/S7cKU0silxslqJejl+t/T9HS8E0PUNQD81JGUEQ== dependencies: dot-prop "^4.1.0" graceful-fs "^4.1.2" @@ -2901,13 +2908,6 @@ create-ecdh@^4.0.0: bn.js "^4.1.0" elliptic "^6.0.0" -create-error-class@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/create-error-class/-/create-error-class-3.0.2.tgz#06be7abef947a3f14a30fd610671d401bca8b7b6" - integrity sha1-Br56vvlHo/FKMP1hBnHUAbyot7Y= - dependencies: - capture-stack-trace "^1.0.0" - create-hash@^1.1.0, create-hash@^1.1.2: version "1.2.0" resolved "http://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" @@ -3782,6 +3782,11 @@ estree-walker@^0.6.0: resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.6.0.tgz#5d865327c44a618dde5699f763891ae31f257dae" integrity sha512-peq1RfVAVzr3PU/jL31RaOjUKLoZJpObQWJJ+LgfcxDUifyLZ1RjPQZTl0pzj2uJ45b7A7XpyppXvxdEqzo4rw== +estree-walker@^0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.6.1.tgz#53049143f40c6eb918b23671d1fe3219f3a1b362" + integrity sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w== + esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" @@ -4359,6 +4364,15 @@ fs-extra@^7.0.0: jsonfile "^4.0.0" universalify "^0.1.0" +fs-extra@^8.0.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0" + integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g== + dependencies: + graceful-fs "^4.2.0" + jsonfile "^4.0.0" + universalify "^0.1.0" + fs-minipass@^1.2.5: version "1.2.5" resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.5.tgz#06c277218454ec288df77ada54a03b8702aacb9d" @@ -4469,6 +4483,13 @@ get-stream@^4.0.0, get-stream@^4.1.0: dependencies: pump "^3.0.0" +get-stream@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.1.0.tgz#01203cdc92597f9b909067c3e656cc1f4d3c4dc9" + integrity sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw== + dependencies: + pump "^3.0.0" + get-value@^2.0.3, get-value@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" @@ -4609,7 +4630,7 @@ glob@^6.0.1: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.0.6, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3: +glob@^7.0.3, glob@^7.0.5, glob@^7.0.6, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3: version "7.1.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1" integrity sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ== @@ -4673,23 +4694,6 @@ globby@^7.1.1: pify "^3.0.0" slash "^1.0.0" -got@^6.7.1: - version "6.7.1" - resolved "http://registry.npmjs.org/got/-/got-6.7.1.tgz#240cd05785a9a18e561dc1b44b41c763ef1e8db0" - integrity sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA= - dependencies: - create-error-class "^3.0.0" - duplexer3 "^0.1.4" - get-stream "^3.0.0" - is-redirect "^1.0.0" - is-retry-allowed "^1.0.0" - is-stream "^1.0.0" - lowercase-keys "^1.0.0" - safe-buffer "^5.0.1" - timed-out "^4.0.0" - unzip-response "^2.0.1" - url-parse-lax "^1.0.0" - got@^9.1.0: version "9.5.0" resolved "https://registry.yarnpkg.com/got/-/got-9.5.0.tgz#6fd0312c6b694c0a11d9119d95fd7daed174eb49" @@ -4707,6 +4711,23 @@ got@^9.1.0: to-readable-stream "^1.0.0" url-parse-lax "^3.0.0" +got@^9.6.0: + version "9.6.0" + resolved "https://registry.yarnpkg.com/got/-/got-9.6.0.tgz#edf45e7d67f99545705de1f7bbeeeb121765ed85" + integrity sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q== + dependencies: + "@sindresorhus/is" "^0.14.0" + "@szmarczak/http-timer" "^1.1.2" + cacheable-request "^6.0.0" + decompress-response "^3.3.0" + duplexer3 "^0.1.4" + get-stream "^4.1.0" + lowercase-keys "^1.0.1" + mimic-response "^1.0.1" + p-cancelable "^1.0.0" + to-readable-stream "^1.0.0" + url-parse-lax "^3.0.0" + graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6: version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" @@ -4717,6 +4738,11 @@ graceful-fs@^4.1.15: resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.15.tgz#ffb703e1066e8a0eeaa4c8b80ba9253eeefbfb00" integrity sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA== +graceful-fs@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.0.tgz#8d8fdc73977cb04104721cb53666c1ca64cd328b" + integrity sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg== + handle-thing@^1.2.5: version "1.2.5" resolved "https://registry.yarnpkg.com/handle-thing/-/handle-thing-1.2.5.tgz#fd7aad726bf1a5fd16dfc29b2f7a6601d27139c4" @@ -4840,6 +4866,11 @@ has-values@^1.0.0: is-number "^3.0.0" kind-of "^4.0.0" +has-yarn@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/has-yarn/-/has-yarn-2.1.0.tgz#137e11354a7b5bf11aa5cb649cf0c6f3ff2b2e77" + integrity sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw== + has@^1.0.1, has@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" @@ -5209,11 +5240,6 @@ internal-ip@^4.3.0: default-gateway "^4.2.0" ipaddr.js "^1.9.0" -interpret@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.1.0.tgz#7ed1b1410c6a0e0f78cf95d3b8440c63f78b8614" - integrity sha1-ftGxQQxqDg94z5XTuEQMY/eLhhQ= - invariant@^2.2.2: version "2.2.4" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" @@ -5311,13 +5337,6 @@ is-callable@^1.1.4: resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" integrity sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA== -is-ci@^1.0.10: - version "1.2.1" - resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.2.1.tgz#e3779c8ee17fccf428488f6e281187f2e632841c" - integrity sha512-s6tfsaQaQi3JNciBH6shVqEDvhGut0SUXr31ag8Pd8BBbVVlcGfWhpPmEOoM6RJ5TFhbypvf5yyRw/VXW1IiWg== - dependencies: - ci-info "^1.5.0" - is-ci@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c" @@ -5461,10 +5480,10 @@ is-module@^1.0.0: resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591" integrity sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE= -is-npm@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-npm/-/is-npm-1.0.0.tgz#f2fb63a65e4905b406c86072765a1a4dc793b9f4" - integrity sha1-8vtjpl5JBbQGyGBydloaTceTufQ= +is-npm@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-npm/-/is-npm-3.0.0.tgz#ec9147bfb629c43f494cf67936a961edec7e8053" + integrity sha512-wsigDr1Kkschp2opC4G3yA6r9EgVA6NjRpWzIi9axXqeIaAATPRJc4uLujXe3Nd9uO8KoDyA4MD6aZSeXTADhA== is-number@^2.1.0: version "2.1.0" @@ -5553,10 +5572,12 @@ is-promise@^2.1.0: resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" integrity sha1-eaKp7OfwlugPNtKy87wWwf9L8/o= -is-redirect@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-redirect/-/is-redirect-1.0.0.tgz#1d03dded53bd8db0f30c26e4f95d36fc7c87dc24" - integrity sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ= +is-reference@^1.1.2: + version "1.1.3" + resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-1.1.3.tgz#e99059204b66fdbe09305cfca715a29caa5c8a51" + integrity sha512-W1iHHv/oyBb2pPxkBxtaewxa1BC58Pn5J0hogyCdefwUIvb6R+TGbAcIa4qPNYLqLhb3EnOgUf2MQkkF76BcKw== + dependencies: + "@types/estree" "0.0.39" is-regex@^1.0.4: version "1.0.4" @@ -5565,12 +5586,7 @@ is-regex@^1.0.4: dependencies: has "^1.0.1" -is-retry-allowed@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz#11a060568b67339444033d0125a61a20d564fb34" - integrity sha1-EaBgVotnM5REAz0BJaYaINVk+zQ= - -is-stream@^1.0.0, is-stream@^1.1.0: +is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= @@ -5614,6 +5630,11 @@ is-wsl@^1.1.0: resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d" integrity sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0= +is-yarn-global@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/is-yarn-global/-/is-yarn-global-0.3.0.tgz#d502d3382590ea3004893746754c89139973e232" + integrity sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw== + isarray@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" @@ -6206,12 +6227,12 @@ kuler@1.0.x: dependencies: colornames "^1.1.1" -latest-version@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/latest-version/-/latest-version-3.1.0.tgz#a205383fea322b33b5ae3b18abee0dc2f356ee15" - integrity sha1-ogU4P+oyKzO1rjsYq+4NwvNW7hU= +latest-version@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/latest-version/-/latest-version-5.1.0.tgz#119dfe908fe38d15dfa43ecd13fa12ec8832face" + integrity sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA== dependencies: - package-json "^4.0.0" + package-json "^6.3.0" lcid@^1.0.0: version "1.0.0" @@ -6546,6 +6567,11 @@ lowercase-keys@^1.0.0, lowercase-keys@^1.0.1: resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.1.tgz#6f9e30b47084d971a7c820ff15a6c5167b74c26f" integrity sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA== +lowercase-keys@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-2.0.0.tgz#2603e78b7b4b0006cbca2fbcc8a3202558ac9479" + integrity sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA== + lru-cache@4.1.x, lru-cache@^4.0.1, lru-cache@^4.1.2, lru-cache@^4.1.3: version "4.1.3" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.3.tgz#a1175cf3496dfc8436c156c334b4955992bce69c" @@ -6573,7 +6599,7 @@ lunr-mutable-indexes@2.3.2: resolved "https://registry.yarnpkg.com/lunr/-/lunr-2.3.6.tgz#f278beee7ffd56ad86e6e478ce02ab2b98c78dd5" integrity sha512-swStvEyDqQ85MGpABCMBclZcLI/pBIlu8FFDtmX197+oEgKloJ67QnB+Tidh0340HmLMs39c4GrkPY3cmkXp6Q== -magic-string@0.25.3: +magic-string@0.25.3, magic-string@^0.25.2: version "0.25.3" resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.3.tgz#34b8d2a2c7fec9d9bdf9929a3fd81d271ef35be9" integrity sha512-6QK0OpF/phMz0Q2AxILkX2mFhi7m+WMwTRg0LQKq/WBB0cDP4rYH3Wp4/d3OTXlrPLVJT/RFqj8tFeAR4nk8AA== @@ -6594,13 +6620,6 @@ magic-string@^0.25.0: dependencies: sourcemap-codec "^1.4.1" -magic-string@^0.25.1: - version "0.25.1" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.1.tgz#b1c248b399cd7485da0fe7385c2fc7011843266e" - integrity sha512-sCuTz6pYom8Rlt4ISPFn6wuFodbKMIHUMv4Qko9P17dpxb7s52KJTmRuZZqHdGmLCK9AOcDare039nRIcfdkEg== - dependencies: - sourcemap-codec "^1.4.1" - make-dir@^1.0.0, make-dir@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.3.0.tgz#79c1033b80515bd6d24ec9933e860ca75ee27f0c" @@ -7142,39 +7161,38 @@ neo-async@^2.6.0: resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.1.tgz#ac27ada66167fa8849a6addd837f6b189ad2081c" integrity sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw== -ng-packagr@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/ng-packagr/-/ng-packagr-5.1.0.tgz#4262775f29f7da72b3e5492c480a6857065d712e" - integrity sha512-sBQrn3jy0S2T8nN1gnptO3Dd55X6oNPSFlCckfHPp7G3T3eNUfo3o9dqeZc58PFiY1WOAi4z43LI7kFFeSrTTA== +ng-packagr@^5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/ng-packagr/-/ng-packagr-5.3.0.tgz#92434ca05ecbd1e01fe961a66c8a9a66b095f6fa" + integrity sha512-i+964lzZC7VVzatDCLDZndiXTog1XGozY7K1Bs78+uBF8O1YHNQP9wB9C5fR4uEaSKVhCWEBYekoS69flCugMA== dependencies: "@ngtools/json-schema" "^1.1.0" - autoprefixer "^9.0.0" + autoprefixer "^9.6.0" browserslist "^4.0.0" chalk "^2.3.1" - chokidar "^2.0.3" + chokidar "^3.0.0" clean-css "^4.1.11" commander "^2.12.0" - fs-extra "^7.0.0" + fs-extra "^8.0.0" glob "^7.1.2" injection-js "^2.2.1" less "^3.8.0" less-plugin-npm-import "^2.1.0" node-sass-tilde-importer "^1.0.0" - opencollective-postinstall "^2.0.1" postcss "^7.0.0" postcss-url "^8.0.0" read-pkg-up "^5.0.0" rimraf "^2.6.1" - rollup "^1.6.0" - rollup-plugin-commonjs "^9.1.3" + rollup "^1.12.1" + rollup-plugin-commonjs "^10.0.0" rollup-plugin-json "^4.0.0" - rollup-plugin-node-resolve "^4.0.1" + rollup-plugin-node-resolve "^5.0.0" rollup-plugin-sourcemaps "^0.4.2" rxjs "^6.0.0" sass "^1.17.3" stylus "^0.54.5" - terser "^3.16.1" - update-notifier "^2.3.0" + terser "^4.0.0" + update-notifier "^3.0.0" nice-try@^1.0.4: version "1.0.5" @@ -7330,6 +7348,11 @@ normalize-url@^3.1.0: resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-3.3.0.tgz#b2e1c4dc4f7c6d57743df733a4f5978d18650559" integrity sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg== +normalize-url@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-4.3.0.tgz#9c49e10fc1876aeb76dba88bf1b2b5d9fa57b2ee" + integrity sha512-0NLtR71o4k6GLP+mr6Ty34c5GA6CMoEsncKJxvQd8NzPxaHRJNnb5gZE8R1XF4CPIS7QPHLJ74IFszwtNVAHVQ== + npm-bundled@^1.0.1: version "1.0.5" resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.0.5.tgz#3c1732b7ba936b3a10325aef616467c0ccbcc979" @@ -7572,11 +7595,6 @@ open@6.4.0: dependencies: is-wsl "^1.1.0" -opencollective-postinstall@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/opencollective-postinstall/-/opencollective-postinstall-2.0.2.tgz#5657f1bede69b6e33a45939b061eb53d3c6c3a89" - integrity sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw== - opn@^5.1.0: version "5.4.0" resolved "https://registry.yarnpkg.com/opn/-/opn-5.4.0.tgz#cb545e7aab78562beb11aa3bfabc7042e1761035" @@ -7753,15 +7771,15 @@ p-try@^2.0.0: resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.0.0.tgz#85080bb87c64688fa47996fe8f7dfbe8211760b1" integrity sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ== -package-json@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/package-json/-/package-json-4.0.1.tgz#8869a0401253661c4c4ca3da6c2121ed555f5eed" - integrity sha1-iGmgQBJTZhxMTKPabCEh7VVfXu0= +package-json@^6.3.0: + version "6.5.0" + resolved "https://registry.yarnpkg.com/package-json/-/package-json-6.5.0.tgz#6feedaca35e75725876d0b0e64974697fed145b0" + integrity sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ== dependencies: - got "^6.7.1" - registry-auth-token "^3.0.1" - registry-url "^3.0.3" - semver "^5.1.0" + got "^9.6.0" + registry-auth-token "^4.0.0" + registry-url "^5.0.0" + semver "^6.2.0" pacote@9.5.4: version "9.5.4" @@ -8167,7 +8185,7 @@ postcss-url@^8.0.0: postcss "^7.0.2" xxhashjs "^0.2.1" -postcss-value-parser@^3.2.3, postcss-value-parser@^3.3.1: +postcss-value-parser@^3.2.3: version "3.3.1" resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz#9ff822547e2893213cf1c30efa51ac5fd1ba8281" integrity sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ== @@ -8186,7 +8204,7 @@ postcss@7.0.17, postcss@^7.0.17: source-map "^0.6.1" supports-color "^6.1.0" -postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.2, postcss@^7.0.5: +postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.2: version "7.0.5" resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.5.tgz#70e6443e36a6d520b0fd4e7593fcca3635ee9f55" integrity sha512-HBNpviAUFCKvEh7NZhw1e8MBPivRszIiUnhrJ+sBFVSYSqubrzwX3KG51mYgcRHX8j/cAgZJedONZcm5jTBdgQ== @@ -8200,7 +8218,7 @@ prelude-ls@~1.1.2: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= -prepend-http@^1.0.0, prepend-http@^1.0.1: +prepend-http@^1.0.0: version "1.0.4" resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc" integrity sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw= @@ -8551,7 +8569,7 @@ raw-loader@1.0.0: loader-utils "^1.1.0" schema-utils "^1.0.0" -rc@^1.0.1, rc@^1.1.6, rc@^1.2.7: +rc@^1.2.7, rc@^1.2.8: version "1.2.8" resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== @@ -8739,13 +8757,6 @@ readdirp@^3.1.1: dependencies: picomatch "^2.0.4" -rechoir@^0.6.2: - version "0.6.2" - resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" - integrity sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q= - dependencies: - resolve "^1.1.6" - redent@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/redent/-/redent-1.0.0.tgz#cf916ab1fd5f1f16dfb20822dd6ec7f730c2afde" @@ -8801,20 +8812,20 @@ regexpu-core@^1.0.0: regjsgen "^0.2.0" regjsparser "^0.1.4" -registry-auth-token@^3.0.1: - version "3.3.2" - resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-3.3.2.tgz#851fd49038eecb586911115af845260eec983f20" - integrity sha512-JL39c60XlzCVgNrO+qq68FoNb56w/m7JYvGR2jT5iR1xBrUA3Mfx5Twk5rqTThPmQKMWydGmq8oFtDlxfrmxnQ== +registry-auth-token@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-4.0.0.tgz#30e55961eec77379da551ea5c4cf43cbf03522be" + integrity sha512-lpQkHxd9UL6tb3k/aHAVfnVtn+Bcs9ob5InuFLLEDqSqeq+AljB8GZW9xY0x7F+xYwEcjKe07nyoxzEYz6yvkw== dependencies: - rc "^1.1.6" + rc "^1.2.8" safe-buffer "^5.0.1" -registry-url@^3.0.3: - version "3.1.0" - resolved "https://registry.yarnpkg.com/registry-url/-/registry-url-3.1.0.tgz#3d4ef870f73dde1d77f0cf9a381432444e174942" - integrity sha1-PU74cPc93h138M+aOBQyRE4XSUI= +registry-url@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/registry-url/-/registry-url-5.1.0.tgz#e98334b50d5434b81136b44ec638d9c2009c5009" + integrity sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw== dependencies: - rc "^1.0.1" + rc "^1.2.8" regjsgen@^0.2.0: version "0.2.0" @@ -8970,17 +8981,17 @@ resolve@1.1.x, resolve@~1.1.6: resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= -resolve@^1.1.5, resolve@^1.1.6, resolve@^1.1.7, resolve@^1.3.2, resolve@^1.8.1: +resolve@^1.1.5, resolve@^1.1.7, resolve@^1.3.2: version "1.8.1" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.8.1.tgz#82f1ec19a423ac1fbd080b0bab06ba36e84a7a26" integrity sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA== dependencies: path-parse "^1.0.5" -resolve@^1.10.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.10.0.tgz#3bdaaeaf45cc07f375656dfd2e54ed0810b101ba" - integrity sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg== +resolve@^1.11.0, resolve@^1.11.1: + version "1.11.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.11.1.tgz#ea10d8110376982fef578df8fc30b9ac30a07a3e" + integrity sha512-vIpgF6wfuJOZI7KKKSP+HmiKggadPQAdsp5HiC1mvqnfp0gF1vdwgBWZIdrVft9pgqoMFQN+R7BSWZiBxx+BBw== dependencies: path-parse "^1.0.6" @@ -9048,15 +9059,16 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^3.0.0" inherits "^2.0.1" -rollup-plugin-commonjs@^9.1.3: - version "9.2.0" - resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-9.2.0.tgz#4604e25069e0c78a09e08faa95dc32dec27f7c89" - integrity sha512-0RM5U4Vd6iHjL6rLvr3lKBwnPsaVml+qxOGaaNUWN1lSq6S33KhITOfHmvxV3z2vy9Mk4t0g4rNlVaJJsNQPWA== +rollup-plugin-commonjs@^10.0.0: + version "10.0.1" + resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-10.0.1.tgz#fbfcadf4ce2e826068e056a9f5c19287d9744ddf" + integrity sha512-x0PcCVdEc4J8igv1qe2vttz8JKAKcTs3wfIA3L8xEty3VzxgORLrzZrNWaVMc+pBC4U3aDOb9BnWLAQ8J11vkA== dependencies: - estree-walker "^0.5.2" - magic-string "^0.25.1" - resolve "^1.8.1" - rollup-pluginutils "^2.3.3" + estree-walker "^0.6.1" + is-reference "^1.1.2" + magic-string "^0.25.2" + resolve "^1.11.0" + rollup-pluginutils "^2.8.1" rollup-plugin-json@^4.0.0: version "4.0.0" @@ -9065,14 +9077,16 @@ rollup-plugin-json@^4.0.0: dependencies: rollup-pluginutils "^2.5.0" -rollup-plugin-node-resolve@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-4.0.1.tgz#f95765d174e5daeef9ea6268566141f53aa9d422" - integrity sha512-fSS7YDuCe0gYqKsr5OvxMloeZYUSgN43Ypi1WeRZzQcWtHgFayV5tUSPYpxuaioIIWaBXl6NrVk0T2/sKwueLg== +rollup-plugin-node-resolve@^5.0.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.2.0.tgz#730f93d10ed202473b1fb54a5997a7db8c6d8523" + integrity sha512-jUlyaDXts7TW2CqQ4GaO5VJ4PwwaV8VUGA7+km3n6k6xtOEacf61u0VXwN80phY/evMcaS+9eIeJ9MOyDxt5Zw== dependencies: - builtin-modules "^3.0.0" + "@types/resolve" "0.0.8" + builtin-modules "^3.1.0" is-module "^1.0.0" - resolve "^1.10.0" + resolve "^1.11.1" + rollup-pluginutils "^2.8.1" rollup-plugin-sourcemaps@^0.4.2: version "0.4.2" @@ -9082,7 +9096,7 @@ rollup-plugin-sourcemaps@^0.4.2: rollup-pluginutils "^2.0.1" source-map-resolve "^0.5.0" -rollup-pluginutils@^2.0.1, rollup-pluginutils@^2.3.3: +rollup-pluginutils@^2.0.1: version "2.3.3" resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.3.3.tgz#3aad9b1eb3e7fe8262820818840bf091e5ae6794" integrity sha512-2XZwja7b6P5q4RZ5FhyX1+f46xi1Z3qBKigLRZ6VTZjwbN0K1IFGMlwm06Uu0Emcre2Z63l77nq/pzn+KxIEoA== @@ -9098,14 +9112,21 @@ rollup-pluginutils@^2.5.0: estree-walker "^0.6.0" micromatch "^3.1.10" -rollup@^1.6.0: - version "1.7.3" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.7.3.tgz#cade518b92e23efa72026e264e29d9a56cbf8eb9" - integrity sha512-U3/HaZujvGofNZQldfIknKoaNFNRS+j8/uCS/jSy3FrxF9t0FBsgZW4+VXLHG7l1daTgE6+jEy0Dv7cVCB2NPg== +rollup-pluginutils@^2.8.1: + version "2.8.1" + resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.8.1.tgz#8fa6dd0697344938ef26c2c09d2488ce9e33ce97" + integrity sha512-J5oAoysWar6GuZo0s+3bZ6sVZAC0pfqKz68De7ZgDi5z63jOVZn1uJL/+z1jeKHNbGII8kAyHF5q8LnxSX5lQg== + dependencies: + estree-walker "^0.6.1" + +rollup@^1.12.1: + version "1.17.0" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.17.0.tgz#47ee8b04514544fc93b39bae06271244c8db7dfa" + integrity sha512-k/j1m0NIsI4SYgCJR4MWPstGJOWfJyd6gycKoMhyoKPVXxm+L49XtbUwZyFsrSU2YXsOkM4u1ll9CS/ZgJBUpw== dependencies: "@types/estree" "0.0.39" - "@types/node" "^11.11.6" - acorn "^6.1.1" + "@types/node" "^12.6.2" + acorn "^6.2.0" run-async@^2.2.0: version "2.3.0" @@ -9307,7 +9328,7 @@ semver-intersect@1.4.0: dependencies: semver "^5.0.0" -"semver@2 >=2.2.1 || 3.x || 4 || 5", semver@5.6.0, semver@^5.0.0, semver@^5.0.3, semver@^5.1.0, semver@^5.4.1, semver@^5.6.0: +"semver@2 >=2.2.1 || 3.x || 4 || 5", semver@5.6.0, semver@^5.0.0, semver@^5.0.3, semver@^5.4.1, semver@^5.6.0: version "5.6.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg== @@ -9322,7 +9343,7 @@ semver@6.2.0: resolved "https://registry.yarnpkg.com/semver/-/semver-6.2.0.tgz#4d813d9590aaf8a9192693d6c85b9344de5901db" integrity sha512-jdFC1VdUGT/2Scgbimf7FSx9iJLXoqfglSF+gJeuNWVpiE37OIbc1jywR/GJyFdz3mnkz2/id0L0J/cr0izR5A== -semver@6.3.0: +semver@6.3.0, semver@^6.2.0: version "6.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== @@ -9492,15 +9513,6 @@ shebang-regex@^1.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= -shelljs@^0.8.1: - version "0.8.2" - resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.2.tgz#345b7df7763f4c2340d584abb532c5f752ca9e35" - integrity sha512-pRXeNrCA2Wd9itwhvLp5LZQvPJ0wU6bcjaTMywHHGX5XWhVN2nzSu7WV0q+oUY7mGK3mgSkDDzP3MgjqdyIgbQ== - dependencies: - glob "^7.0.0" - interpret "^1.0.0" - rechoir "^0.6.2" - signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" @@ -9704,14 +9716,6 @@ source-map-support@~0.4.0: dependencies: source-map "^0.5.6" -source-map-support@~0.5.9: - version "0.5.10" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.10.tgz#2214080bc9d51832511ee2bab96e3c2f9353120c" - integrity sha512-YfQ3tQFTK/yzlGJuX8pTwa4tifQj4QS2Mj7UegOu8jAz59MqIiMGPXxQhVQiIMNzayuUSF/jEuVnfFF5JqybmQ== - dependencies: - buffer-from "^1.0.0" - source-map "^0.6.0" - source-map-url@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" @@ -10309,15 +10313,6 @@ terser-webpack-plugin@^1.1.0: webpack-sources "^1.1.0" worker-farm "^1.5.2" -terser@^3.16.1: - version "3.16.1" - resolved "https://registry.yarnpkg.com/terser/-/terser-3.16.1.tgz#5b0dd4fa1ffd0b0b43c2493b2c364fd179160493" - integrity sha512-JDJjgleBROeek2iBcSNzOHLKsB/MdDf+E/BOAJ0Tk9r7p9/fVobfv7LMJ/g/k3v9SXdmjZnIlFd5nfn/Rt0Xow== - dependencies: - commander "~2.17.1" - source-map "~0.6.1" - source-map-support "~0.5.9" - terser@^3.8.1: version "3.10.8" resolved "https://registry.yarnpkg.com/terser/-/terser-3.10.8.tgz#2fe3967396a10cdc3d575074fe857efd30a2895a" @@ -10364,11 +10359,6 @@ thunky@^1.0.2: resolved "https://registry.yarnpkg.com/thunky/-/thunky-1.0.3.tgz#f5df732453407b09191dae73e2a8cc73f381a826" integrity sha512-YwT8pjmNcAXBZqrubu22P4FYsh2D4dxRmnWBOL8Jk8bUcRUtc5326kx32tuTmFDAZtLOGEVNl8POAR8j896Iow== -timed-out@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-4.0.1.tgz#f32eacac5a175bea25d7fab565ab3ed8741ef56f" - integrity sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8= - timers-browserify@^2.0.4: version "2.0.10" resolved "https://registry.yarnpkg.com/timers-browserify/-/timers-browserify-2.0.10.tgz#1d28e3d2aadf1d5a5996c4e9f95601cd053480ae" @@ -10559,6 +10549,11 @@ ts-node@^5.0.0: source-map-support "^0.5.3" yn "^2.0.0" +tslib@^1.10.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" + integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== + tslib@^1.7.1, tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0: version "1.9.3" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" @@ -10633,6 +10628,11 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" +type-fest@^0.3.0: + version "0.3.1" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.3.1.tgz#63d00d204e059474fe5e1b7c011112bbd1dc29e1" + integrity sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ== + type-is@~1.6.16: version "1.6.16" resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.16.tgz#f89ce341541c672b25ee7ae3c73dee3b2be50194" @@ -10654,10 +10654,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@3.4.5: - version "3.4.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.4.5.tgz#2d2618d10bb566572b8d7aad5180d84257d70a99" - integrity sha512-YycBxUb49UUhdNMU5aJ7z5Ej2XGmaIBL0x34vZ82fn3hGvD+bgrMrVDpatgz2f7YxUMJxMkbWxJZeAvDxVe7Vw== +typescript@3.5.3: + version "3.5.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.3.tgz#c830f657f93f1ea846819e929092f5fe5983e977" + integrity sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g== uglify-js@^3.1.4: version "3.4.9" @@ -10750,11 +10750,6 @@ unset-value@^1.0.0: has-value "^0.3.1" isobject "^3.0.0" -unzip-response@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/unzip-response/-/unzip-response-2.0.1.tgz#d2f0f737d16b0615e72a6935ed04214572d56f97" - integrity sha1-0vD3N9FrBhXnKmk17QQhRXLVb5c= - upath@^1.0.5: version "1.1.0" resolved "https://registry.yarnpkg.com/upath/-/upath-1.1.0.tgz#35256597e46a581db4793d0ce47fa9aebfc9fabd" @@ -10765,19 +10760,21 @@ upath@^1.1.0, upath@^1.1.1: resolved "https://registry.yarnpkg.com/upath/-/upath-1.1.2.tgz#3db658600edaeeccbe6db5e684d67ee8c2acd068" integrity sha512-kXpym8nmDmlCBr7nKdIx8P2jNBa+pBpIUFRnKJ4dr8htyYGJFokkr2ZvERRtUN+9SY+JqXouNgUPtv6JQva/2Q== -update-notifier@^2.3.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/update-notifier/-/update-notifier-2.5.0.tgz#d0744593e13f161e406acb1d9408b72cad08aff6" - integrity sha512-gwMdhgJHGuj/+wHJJs9e6PcCszpxR1b236igrOkUofGhqJuG+amlIKwApH1IW1WWl7ovZxsX49lMBWLxSdm5Dw== +update-notifier@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/update-notifier/-/update-notifier-3.0.1.tgz#78ecb68b915e2fd1be9f767f6e298ce87b736250" + integrity sha512-grrmrB6Zb8DUiyDIaeRTBCkgISYUgETNe7NglEbVsrLWXeESnlCSP50WfRSj/GmzMPl6Uchj24S/p80nP/ZQrQ== dependencies: - boxen "^1.2.1" + boxen "^3.0.0" chalk "^2.0.1" - configstore "^3.0.0" + configstore "^4.0.0" + has-yarn "^2.1.0" import-lazy "^2.1.0" - is-ci "^1.0.10" + is-ci "^2.0.0" is-installed-globally "^0.1.0" - is-npm "^1.0.0" - latest-version "^3.0.0" + is-npm "^3.0.0" + is-yarn-global "^0.3.0" + latest-version "^5.0.0" semver-diff "^2.0.0" xdg-basedir "^3.0.0" @@ -10798,13 +10795,6 @@ urix@^0.1.0: resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= -url-parse-lax@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/url-parse-lax/-/url-parse-lax-1.0.0.tgz#7af8f303645e9bd79a272e7a14ac68bc0609da73" - integrity sha1-evjzA2Rem9eaJy56FKxovAYJ2nM= - dependencies: - prepend-http "^1.0.1" - url-parse-lax@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/url-parse-lax/-/url-parse-lax-3.0.0.tgz#16b5cafc07dbe3676c1b1999177823d6503acb0c"