diff --git a/package.json b/package.json index f0a070d08579..8303909563ed 100644 --- a/package.json +++ b/package.json @@ -211,7 +211,7 @@ "tree-kill": "1.2.2", "ts-node": "^10.9.1", "tslib": "2.6.2", - "typescript": "5.1.6", + "typescript": "5.2.2", "verdaccio": "5.26.1", "verdaccio-auth-memory": "^10.0.0", "vite": "4.4.9", diff --git a/packages/angular_devkit/build_angular/package.json b/packages/angular_devkit/build_angular/package.json index bf7d73f95490..2b0bc5f9b499 100644 --- a/packages/angular_devkit/build_angular/package.json +++ b/packages/angular_devkit/build_angular/package.json @@ -87,7 +87,7 @@ "ng-packagr": "^16.0.0 || ^16.2.0-next.0", "protractor": "^7.0.0", "tailwindcss": "^2.0.0 || ^3.0.0", - "typescript": ">=4.9.3 <5.2" + "typescript": ">=4.9.3 <5.3" }, "peerDependenciesMeta": { "@angular/localize": { diff --git a/packages/ngtools/webpack/package.json b/packages/ngtools/webpack/package.json index 00327fc26819..1bb121a1bec1 100644 --- a/packages/ngtools/webpack/package.json +++ b/packages/ngtools/webpack/package.json @@ -30,7 +30,7 @@ "@angular-devkit/core": "0.0.0-PLACEHOLDER", "@angular/compiler": "17.0.0-next.1", "@angular/compiler-cli": "17.0.0-next.1", - "typescript": "5.1.6", + "typescript": "5.2.2", "webpack": "5.88.2" } } diff --git a/packages/ngtools/webpack/src/transformers/elide_imports_spec.ts b/packages/ngtools/webpack/src/transformers/elide_imports_spec.ts index e2459e15f67b..20fe47f7e731 100644 --- a/packages/ngtools/webpack/src/transformers/elide_imports_spec.ts +++ b/packages/ngtools/webpack/src/transformers/elide_imports_spec.ts @@ -366,8 +366,9 @@ describe('@ngtools/webpack transformers', () => { import { __decorate } from "tslib"; import { Decorator } from './decorator'; - export let Foo = class Foo { constructor(param) { } }; + let Foo = class Foo { constructor(param) { } }; Foo = __decorate([ Decorator() ], Foo); + export { Foo }; `; const { program, compilerHost } = createTypescriptContext( @@ -404,8 +405,9 @@ describe('@ngtools/webpack transformers', () => { import { __decorate } from "tslib"; import { Decorator } from './decorator'; - export let Foo = class Foo { constructor(param) { } }; + let Foo = class Foo { constructor(param) { } }; Foo = __decorate([ Decorator() ], Foo); + export { Foo }; `; const { program, compilerHost } = createTypescriptContext( @@ -455,8 +457,9 @@ describe('@ngtools/webpack transformers', () => { const test = createElement("p", null, "123"); - export let Foo = class Foo { constructor(param) { } }; + let Foo = class Foo { constructor(param) { } }; Foo = __decorate([ Decorator() ], Foo); + export { Foo }; `; const { program, compilerHost } = createTypescriptContext( @@ -494,8 +497,9 @@ describe('@ngtools/webpack transformers', () => { import { __decorate } from "tslib"; import { Decorator } from './decorator'; - export let Foo = class Foo { ngOnChanges(changes) { } }; + let Foo = class Foo { ngOnChanges(changes) { } }; Foo = __decorate([ Decorator() ], Foo); + export { Foo }; `; const { program, compilerHost } = createTypescriptContext( @@ -533,8 +537,9 @@ describe('@ngtools/webpack transformers', () => { import { Decorator } from './decorator'; import { Service } from './service'; - export let Foo = class Foo { constructor(param) { } }; + let Foo = class Foo { constructor(param) { } }; Foo = __decorate([ Decorator(), __metadata("design:paramtypes", [Service]) ], Foo); + export { Foo }; `; const { program, compilerHost } = createTypescriptContext( diff --git a/packages/ngtools/webpack/src/transformers/replace_resources_spec.ts b/packages/ngtools/webpack/src/transformers/replace_resources_spec.ts index 34542a3092a0..c244419e6e4e 100644 --- a/packages/ngtools/webpack/src/transformers/replace_resources_spec.ts +++ b/packages/ngtools/webpack/src/transformers/replace_resources_spec.ts @@ -50,7 +50,7 @@ describe('@ngtools/webpack transformers', () => { import __NG_CLI_RESOURCE__2 from "./app.component.2.css?ngResource"; import { Component } from '@angular/core'; - export let AppComponent = class AppComponent { + let AppComponent = class AppComponent { constructor() { this.title = 'app'; } @@ -62,6 +62,7 @@ describe('@ngtools/webpack transformers', () => { styles: [__NG_CLI_RESOURCE__1, __NG_CLI_RESOURCE__2] }) ], AppComponent); + export { AppComponent }; `; const result = transform(input); @@ -89,9 +90,10 @@ describe('@ngtools/webpack transformers', () => { const tslib_1 = require("tslib"); const core_1 = require("@angular/core"); - let AppComponent = exports.AppComponent = class AppComponent { + let AppComponent = class AppComponent { constructor() { this.title = 'app'; } }; + exports.AppComponent = AppComponent; exports.AppComponent = AppComponent = tslib_1.__decorate([ (0, core_1.Component)({ selector: 'app-root', @@ -119,7 +121,7 @@ describe('@ngtools/webpack transformers', () => { import { __decorate } from "tslib"; import __NG_CLI_RESOURCE__0 from "./app.component.svg?ngResource"; import { Component } from '@angular/core'; - export let AppComponent = class AppComponent { + let AppComponent = class AppComponent { constructor() { this.title = 'app'; } @@ -130,6 +132,7 @@ describe('@ngtools/webpack transformers', () => { template: __NG_CLI_RESOURCE__0 }) ], AppComponent); + export { AppComponent }; `; const result = transform(input); @@ -156,7 +159,7 @@ describe('@ngtools/webpack transformers', () => { import __NG_CLI_RESOURCE__1 from "./app.component.css?ngResource"; import { Component } from '@angular/core'; - export let AppComponent = class AppComponent { + let AppComponent = class AppComponent { constructor() { this.title = 'app'; } @@ -168,6 +171,7 @@ describe('@ngtools/webpack transformers', () => { styles: ["a { color: red }", __NG_CLI_RESOURCE__1] }) ], AppComponent); + export { AppComponent }; `; const result = transform(input); @@ -194,7 +198,7 @@ describe('@ngtools/webpack transformers', () => { import __NG_CLI_RESOURCE__2 from "./app.component.2.css?ngResource"; import { Component } from '@angular/core'; - export let AppComponent = class AppComponent { + let AppComponent = class AppComponent { constructor() { this.title = 'app'; } @@ -206,6 +210,7 @@ describe('@ngtools/webpack transformers', () => { styles: [__NG_CLI_RESOURCE__1, __NG_CLI_RESOURCE__2] }) ], AppComponent); + export { AppComponent }; `; const result = transform(input); @@ -232,7 +237,7 @@ describe('@ngtools/webpack transformers', () => { import __NG_CLI_RESOURCE__2 from "./app.component.2.css?ngResource"; import { Component as NgComponent } from '@angular/core'; - export let AppComponent = class AppComponent { + let AppComponent = class AppComponent { constructor() { this.title = 'app'; } @@ -244,6 +249,7 @@ describe('@ngtools/webpack transformers', () => { styles: [__NG_CLI_RESOURCE__1, __NG_CLI_RESOURCE__2] }) ], AppComponent); + export { AppComponent }; `; const { program } = createTypescriptContext(input); @@ -274,7 +280,7 @@ describe('@ngtools/webpack transformers', () => { import __NG_CLI_RESOURCE__2 from "./app.component.2.css?ngResource"; import * as ng from '@angular/core'; - export let AppComponent = class AppComponent { + let AppComponent = class AppComponent { constructor() { this.title = 'app'; } @@ -286,6 +292,7 @@ describe('@ngtools/webpack transformers', () => { styles: [__NG_CLI_RESOURCE__1, __NG_CLI_RESOURCE__2] }) ], AppComponent); + export { AppComponent }; `; const result = transform(input); @@ -318,7 +325,7 @@ describe('@ngtools/webpack transformers', () => { import { Component } from '@angular/core'; - export let AppComponent = class AppComponent { + let AppComponent = class AppComponent { constructor() { this.obj = [ { @@ -336,6 +343,7 @@ describe('@ngtools/webpack transformers', () => { styles: [__NG_CLI_RESOURCE__1] }) ], AppComponent); + export { AppComponent }; `; const result = transform(input); @@ -365,7 +373,7 @@ describe('@ngtools/webpack transformers', () => { import { __decorate } from "tslib"; import { Component } from 'foo'; - export let AppComponent = class AppComponent { + let AppComponent = class AppComponent { constructor() { this.obj = [ { @@ -383,6 +391,7 @@ describe('@ngtools/webpack transformers', () => { styleUrls: ['./app.component.css'] }) ], AppComponent); + export { AppComponent }; `; const result = transform(input); @@ -405,7 +414,7 @@ describe('@ngtools/webpack transformers', () => { const output = ` import { __decorate } from "tslib"; import { Component } from '@angular/core'; - export let AppComponent = class AppComponent { + let AppComponent = class AppComponent { constructor() { this.title = 'app'; } @@ -417,6 +426,7 @@ describe('@ngtools/webpack transformers', () => { styleUrls: ['./app.component.css', './app.component.2.css'] }) ], AppComponent); + export { AppComponent }; `; const result = transform(input, false); diff --git a/packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/BUILD.bazel b/packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/BUILD.bazel index d2bfeb6eef8f..8c0671a5ba8b 100644 --- a/packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/BUILD.bazel +++ b/packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/BUILD.bazel @@ -1,11 +1,11 @@ load("//tools:defaults.bzl", "ts_library") # files fetched on 2023-06-02 from -# https://github.com/microsoft/TypeScript/releases/tag/v5.1.3 +# https://github.com/microsoft/TypeScript/releases/tag/v5.2.2 # Commands to download: -# curl https://raw.githubusercontent.com/microsoft/TypeScript/v5.1.3/lib/typescript.d.ts -o packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript.d.ts -# curl https://raw.githubusercontent.com/microsoft/TypeScript/v5.1.3/lib/typescript.js -o packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript.js +# curl https://raw.githubusercontent.com/microsoft/TypeScript/v5.2.2/lib/typescript.d.ts -o packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript.d.ts +# curl https://raw.githubusercontent.com/microsoft/TypeScript/v5.2.2/lib/typescript.js -o packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript.js licenses(["notice"]) # Apache 2.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 23f0581ff7c3..ead6d07d8fb2 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 = "5.1"; + const versionMajorMinor = "5.2"; /** The version of the TypeScript compiler release */ const version: string; /** @@ -204,211 +204,212 @@ declare namespace ts { UndefinedKeyword = 157, UniqueKeyword = 158, UnknownKeyword = 159, - FromKeyword = 160, - GlobalKeyword = 161, - BigIntKeyword = 162, - OverrideKeyword = 163, - OfKeyword = 164, - QualifiedName = 165, - ComputedPropertyName = 166, - TypeParameter = 167, - Parameter = 168, - Decorator = 169, - PropertySignature = 170, - PropertyDeclaration = 171, - MethodSignature = 172, - MethodDeclaration = 173, - ClassStaticBlockDeclaration = 174, - Constructor = 175, - GetAccessor = 176, - SetAccessor = 177, - CallSignature = 178, - ConstructSignature = 179, - IndexSignature = 180, - TypePredicate = 181, - TypeReference = 182, - FunctionType = 183, - ConstructorType = 184, - TypeQuery = 185, - TypeLiteral = 186, - ArrayType = 187, - TupleType = 188, - OptionalType = 189, - RestType = 190, - UnionType = 191, - IntersectionType = 192, - ConditionalType = 193, - InferType = 194, - ParenthesizedType = 195, - ThisType = 196, - TypeOperator = 197, - IndexedAccessType = 198, - MappedType = 199, - LiteralType = 200, - NamedTupleMember = 201, - TemplateLiteralType = 202, - TemplateLiteralTypeSpan = 203, - ImportType = 204, - ObjectBindingPattern = 205, - ArrayBindingPattern = 206, - BindingElement = 207, - ArrayLiteralExpression = 208, - ObjectLiteralExpression = 209, - PropertyAccessExpression = 210, - ElementAccessExpression = 211, - CallExpression = 212, - NewExpression = 213, - TaggedTemplateExpression = 214, - TypeAssertionExpression = 215, - ParenthesizedExpression = 216, - FunctionExpression = 217, - ArrowFunction = 218, - DeleteExpression = 219, - TypeOfExpression = 220, - VoidExpression = 221, - AwaitExpression = 222, - PrefixUnaryExpression = 223, - PostfixUnaryExpression = 224, - BinaryExpression = 225, - ConditionalExpression = 226, - TemplateExpression = 227, - YieldExpression = 228, - SpreadElement = 229, - ClassExpression = 230, - OmittedExpression = 231, - ExpressionWithTypeArguments = 232, - AsExpression = 233, - NonNullExpression = 234, - MetaProperty = 235, - SyntheticExpression = 236, - SatisfiesExpression = 237, - TemplateSpan = 238, - SemicolonClassElement = 239, - Block = 240, - EmptyStatement = 241, - VariableStatement = 242, - ExpressionStatement = 243, - IfStatement = 244, - DoStatement = 245, - WhileStatement = 246, - ForStatement = 247, - ForInStatement = 248, - ForOfStatement = 249, - ContinueStatement = 250, - BreakStatement = 251, - ReturnStatement = 252, - WithStatement = 253, - SwitchStatement = 254, - LabeledStatement = 255, - ThrowStatement = 256, - TryStatement = 257, - DebuggerStatement = 258, - VariableDeclaration = 259, - VariableDeclarationList = 260, - FunctionDeclaration = 261, - ClassDeclaration = 262, - InterfaceDeclaration = 263, - TypeAliasDeclaration = 264, - EnumDeclaration = 265, - ModuleDeclaration = 266, - ModuleBlock = 267, - CaseBlock = 268, - NamespaceExportDeclaration = 269, - ImportEqualsDeclaration = 270, - ImportDeclaration = 271, - ImportClause = 272, - NamespaceImport = 273, - NamedImports = 274, - ImportSpecifier = 275, - ExportAssignment = 276, - ExportDeclaration = 277, - NamedExports = 278, - NamespaceExport = 279, - ExportSpecifier = 280, - MissingDeclaration = 281, - ExternalModuleReference = 282, - JsxElement = 283, - JsxSelfClosingElement = 284, - JsxOpeningElement = 285, - JsxClosingElement = 286, - JsxFragment = 287, - JsxOpeningFragment = 288, - JsxClosingFragment = 289, - JsxAttribute = 290, - JsxAttributes = 291, - JsxSpreadAttribute = 292, - JsxExpression = 293, - JsxNamespacedName = 294, - CaseClause = 295, - DefaultClause = 296, - HeritageClause = 297, - CatchClause = 298, - AssertClause = 299, - AssertEntry = 300, - ImportTypeAssertionContainer = 301, - PropertyAssignment = 302, - ShorthandPropertyAssignment = 303, - SpreadAssignment = 304, - EnumMember = 305, - /** @deprecated */ UnparsedPrologue = 306, - /** @deprecated */ UnparsedPrepend = 307, - /** @deprecated */ UnparsedText = 308, - /** @deprecated */ UnparsedInternalText = 309, - /** @deprecated */ UnparsedSyntheticReference = 310, - SourceFile = 311, - Bundle = 312, - /** @deprecated */ UnparsedSource = 313, - /** @deprecated */ InputFiles = 314, - JSDocTypeExpression = 315, - JSDocNameReference = 316, - JSDocMemberName = 317, - JSDocAllType = 318, - JSDocUnknownType = 319, - JSDocNullableType = 320, - JSDocNonNullableType = 321, - JSDocOptionalType = 322, - JSDocFunctionType = 323, - JSDocVariadicType = 324, - JSDocNamepathType = 325, - JSDoc = 326, + UsingKeyword = 160, + FromKeyword = 161, + GlobalKeyword = 162, + BigIntKeyword = 163, + OverrideKeyword = 164, + OfKeyword = 165, + QualifiedName = 166, + ComputedPropertyName = 167, + TypeParameter = 168, + Parameter = 169, + Decorator = 170, + PropertySignature = 171, + PropertyDeclaration = 172, + MethodSignature = 173, + MethodDeclaration = 174, + ClassStaticBlockDeclaration = 175, + Constructor = 176, + GetAccessor = 177, + SetAccessor = 178, + CallSignature = 179, + ConstructSignature = 180, + IndexSignature = 181, + TypePredicate = 182, + TypeReference = 183, + FunctionType = 184, + ConstructorType = 185, + TypeQuery = 186, + TypeLiteral = 187, + ArrayType = 188, + TupleType = 189, + OptionalType = 190, + RestType = 191, + UnionType = 192, + IntersectionType = 193, + ConditionalType = 194, + InferType = 195, + ParenthesizedType = 196, + ThisType = 197, + TypeOperator = 198, + IndexedAccessType = 199, + MappedType = 200, + LiteralType = 201, + NamedTupleMember = 202, + TemplateLiteralType = 203, + TemplateLiteralTypeSpan = 204, + ImportType = 205, + ObjectBindingPattern = 206, + ArrayBindingPattern = 207, + BindingElement = 208, + ArrayLiteralExpression = 209, + ObjectLiteralExpression = 210, + PropertyAccessExpression = 211, + ElementAccessExpression = 212, + CallExpression = 213, + NewExpression = 214, + TaggedTemplateExpression = 215, + TypeAssertionExpression = 216, + ParenthesizedExpression = 217, + FunctionExpression = 218, + ArrowFunction = 219, + DeleteExpression = 220, + TypeOfExpression = 221, + VoidExpression = 222, + AwaitExpression = 223, + PrefixUnaryExpression = 224, + PostfixUnaryExpression = 225, + BinaryExpression = 226, + ConditionalExpression = 227, + TemplateExpression = 228, + YieldExpression = 229, + SpreadElement = 230, + ClassExpression = 231, + OmittedExpression = 232, + ExpressionWithTypeArguments = 233, + AsExpression = 234, + NonNullExpression = 235, + MetaProperty = 236, + SyntheticExpression = 237, + SatisfiesExpression = 238, + TemplateSpan = 239, + SemicolonClassElement = 240, + Block = 241, + EmptyStatement = 242, + VariableStatement = 243, + ExpressionStatement = 244, + IfStatement = 245, + DoStatement = 246, + WhileStatement = 247, + ForStatement = 248, + ForInStatement = 249, + ForOfStatement = 250, + ContinueStatement = 251, + BreakStatement = 252, + ReturnStatement = 253, + WithStatement = 254, + SwitchStatement = 255, + LabeledStatement = 256, + ThrowStatement = 257, + TryStatement = 258, + DebuggerStatement = 259, + VariableDeclaration = 260, + VariableDeclarationList = 261, + FunctionDeclaration = 262, + ClassDeclaration = 263, + InterfaceDeclaration = 264, + TypeAliasDeclaration = 265, + EnumDeclaration = 266, + ModuleDeclaration = 267, + ModuleBlock = 268, + CaseBlock = 269, + NamespaceExportDeclaration = 270, + ImportEqualsDeclaration = 271, + ImportDeclaration = 272, + ImportClause = 273, + NamespaceImport = 274, + NamedImports = 275, + ImportSpecifier = 276, + ExportAssignment = 277, + ExportDeclaration = 278, + NamedExports = 279, + NamespaceExport = 280, + ExportSpecifier = 281, + MissingDeclaration = 282, + ExternalModuleReference = 283, + JsxElement = 284, + JsxSelfClosingElement = 285, + JsxOpeningElement = 286, + JsxClosingElement = 287, + JsxFragment = 288, + JsxOpeningFragment = 289, + JsxClosingFragment = 290, + JsxAttribute = 291, + JsxAttributes = 292, + JsxSpreadAttribute = 293, + JsxExpression = 294, + JsxNamespacedName = 295, + CaseClause = 296, + DefaultClause = 297, + HeritageClause = 298, + CatchClause = 299, + AssertClause = 300, + AssertEntry = 301, + ImportTypeAssertionContainer = 302, + PropertyAssignment = 303, + ShorthandPropertyAssignment = 304, + SpreadAssignment = 305, + EnumMember = 306, + /** @deprecated */ UnparsedPrologue = 307, + /** @deprecated */ UnparsedPrepend = 308, + /** @deprecated */ UnparsedText = 309, + /** @deprecated */ UnparsedInternalText = 310, + /** @deprecated */ UnparsedSyntheticReference = 311, + SourceFile = 312, + Bundle = 313, + /** @deprecated */ UnparsedSource = 314, + /** @deprecated */ InputFiles = 315, + JSDocTypeExpression = 316, + JSDocNameReference = 317, + JSDocMemberName = 318, + JSDocAllType = 319, + JSDocUnknownType = 320, + JSDocNullableType = 321, + JSDocNonNullableType = 322, + JSDocOptionalType = 323, + JSDocFunctionType = 324, + JSDocVariadicType = 325, + JSDocNamepathType = 326, + JSDoc = 327, /** @deprecated Use SyntaxKind.JSDoc */ - JSDocComment = 326, - JSDocText = 327, - JSDocTypeLiteral = 328, - JSDocSignature = 329, - JSDocLink = 330, - JSDocLinkCode = 331, - JSDocLinkPlain = 332, - JSDocTag = 333, - JSDocAugmentsTag = 334, - JSDocImplementsTag = 335, - JSDocAuthorTag = 336, - JSDocDeprecatedTag = 337, - JSDocClassTag = 338, - JSDocPublicTag = 339, - JSDocPrivateTag = 340, - JSDocProtectedTag = 341, - JSDocReadonlyTag = 342, - JSDocOverrideTag = 343, - JSDocCallbackTag = 344, - JSDocOverloadTag = 345, - JSDocEnumTag = 346, - JSDocParameterTag = 347, - JSDocReturnTag = 348, - JSDocThisTag = 349, - JSDocTypeTag = 350, - JSDocTemplateTag = 351, - JSDocTypedefTag = 352, - JSDocSeeTag = 353, - JSDocPropertyTag = 354, - JSDocThrowsTag = 355, - JSDocSatisfiesTag = 356, - SyntaxList = 357, - NotEmittedStatement = 358, - PartiallyEmittedExpression = 359, - CommaListExpression = 360, - SyntheticReferenceExpression = 361, - Count = 362, + JSDocComment = 327, + JSDocText = 328, + JSDocTypeLiteral = 329, + JSDocSignature = 330, + JSDocLink = 331, + JSDocLinkCode = 332, + JSDocLinkPlain = 333, + JSDocTag = 334, + JSDocAugmentsTag = 335, + JSDocImplementsTag = 336, + JSDocAuthorTag = 337, + JSDocDeprecatedTag = 338, + JSDocClassTag = 339, + JSDocPublicTag = 340, + JSDocPrivateTag = 341, + JSDocProtectedTag = 342, + JSDocReadonlyTag = 343, + JSDocOverrideTag = 344, + JSDocCallbackTag = 345, + JSDocOverloadTag = 346, + JSDocEnumTag = 347, + JSDocParameterTag = 348, + JSDocReturnTag = 349, + JSDocThisTag = 350, + JSDocTypeTag = 351, + JSDocTemplateTag = 352, + JSDocTypedefTag = 353, + JSDocSeeTag = 354, + JSDocPropertyTag = 355, + JSDocThrowsTag = 356, + JSDocSatisfiesTag = 357, + SyntaxList = 358, + NotEmittedStatement = 359, + PartiallyEmittedExpression = 360, + CommaListExpression = 361, + SyntheticReferenceExpression = 362, + Count = 363, FirstAssignment = 64, LastAssignment = 79, FirstCompoundAssignment = 65, @@ -416,15 +417,15 @@ declare namespace ts { FirstReservedWord = 83, LastReservedWord = 118, FirstKeyword = 83, - LastKeyword = 164, + LastKeyword = 165, FirstFutureReservedWord = 119, LastFutureReservedWord = 127, - FirstTypeNode = 181, - LastTypeNode = 204, + FirstTypeNode = 182, + LastTypeNode = 205, FirstPunctuation = 19, LastPunctuation = 79, FirstToken = 0, - LastToken = 164, + LastToken = 165, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 9, @@ -433,19 +434,19 @@ declare namespace ts { LastTemplateToken = 18, FirstBinaryOperator = 30, LastBinaryOperator = 79, - FirstStatement = 242, - LastStatement = 258, - FirstNode = 165, - FirstJSDocNode = 315, - LastJSDocNode = 356, - FirstJSDocTagNode = 333, - LastJSDocTagNode = 356 + FirstStatement = 243, + LastStatement = 259, + FirstNode = 166, + FirstJSDocNode = 316, + LastJSDocNode = 357, + FirstJSDocTagNode = 334, + LastJSDocTagNode = 357 } type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; type PseudoLiteralSyntaxKind = SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail; type PunctuationSyntaxKind = SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.QuestionDotToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.AmpersandAmpersandEqualsToken | SyntaxKind.BarBarToken | SyntaxKind.BarBarEqualsToken | SyntaxKind.QuestionQuestionToken | SyntaxKind.QuestionQuestionEqualsToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.BacktickToken | SyntaxKind.HashToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken; - type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | 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.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SatisfiesKeyword | 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; + type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | 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.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SatisfiesKeyword | 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.UsingKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.InKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword; type KeywordTypeSyntaxKind = SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VoidKeyword; type TokenSyntaxKind = SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | TriviaSyntaxKind | LiteralSyntaxKind | PseudoLiteralSyntaxKind | PunctuationSyntaxKind | SyntaxKind.Identifier | KeywordSyntaxKind; @@ -455,32 +456,35 @@ declare namespace ts { None = 0, Let = 1, Const = 2, - NestedNamespace = 4, - Synthesized = 8, - Namespace = 16, - OptionalChain = 32, - ExportContext = 64, - ContainsThis = 128, - HasImplicitReturn = 256, - HasExplicitReturn = 512, - GlobalAugmentation = 1024, - HasAsyncFunctions = 2048, - DisallowInContext = 4096, - YieldContext = 8192, - DecoratorContext = 16384, - AwaitContext = 32768, - DisallowConditionalTypesContext = 65536, - ThisNodeHasError = 131072, - JavaScriptFile = 262144, - ThisNodeOrAnySubNodesHasError = 524288, - HasAggregatedChildData = 1048576, - JSDoc = 8388608, - JsonFile = 67108864, - BlockScoped = 3, - ReachabilityCheckFlags = 768, - ReachabilityAndEmitFlags = 2816, - ContextFlags = 50720768, - TypeExcludesFlags = 40960 + Using = 4, + AwaitUsing = 6, + NestedNamespace = 8, + Synthesized = 16, + Namespace = 32, + OptionalChain = 64, + ExportContext = 128, + ContainsThis = 256, + HasImplicitReturn = 512, + HasExplicitReturn = 1024, + GlobalAugmentation = 2048, + HasAsyncFunctions = 4096, + DisallowInContext = 8192, + YieldContext = 16384, + DecoratorContext = 32768, + AwaitContext = 65536, + DisallowConditionalTypesContext = 131072, + ThisNodeHasError = 262144, + JavaScriptFile = 524288, + ThisNodeOrAnySubNodesHasError = 1048576, + HasAggregatedChildData = 2097152, + JSDoc = 16777216, + JsonFile = 134217728, + BlockScoped = 7, + Constant = 6, + ReachabilityCheckFlags = 1536, + ReachabilityAndEmitFlags = 5632, + ContextFlags = 101441536, + TypeExcludesFlags = 81920 } enum ModifierFlags { None = 0, @@ -1398,7 +1402,6 @@ declare namespace ts { type JsxAttributeValue = StringLiteral | JsxExpression | JsxElement | JsxSelfClosingElement | JsxFragment; interface JsxSpreadAttribute extends ObjectLiteralElement { readonly kind: SyntaxKind.JsxSpreadAttribute; - readonly name: PropertyName; readonly parent: JsxAttributes; readonly expression: Expression; } @@ -1771,9 +1774,11 @@ declare namespace ts { }; }) | ExportDeclaration & { readonly isTypeOnly: true; + readonly moduleSpecifier: Expression; } | NamespaceExport & { readonly parent: ExportDeclaration & { readonly isTypeOnly: true; + readonly moduleSpecifier: Expression; }; }; type TypeOnlyAliasDeclaration = TypeOnlyImportDeclaration | TypeOnlyExportDeclaration; @@ -2218,7 +2223,7 @@ declare namespace ts { getSourceFileByPath(path: Path): SourceFile | undefined; getCurrentDirectory(): string; } - interface ParseConfigHost { + interface ParseConfigHost extends ModuleResolutionHost { useCaseSensitiveFileNames: boolean; readDirectory(rootDir: string, extensions: readonly string[], excludes: readonly string[] | undefined, includes: readonly string[], depth?: number): readonly string[]; /** @@ -2895,7 +2900,7 @@ declare namespace ts { hasRestElement: boolean; combinedFlags: ElementFlags; readonly: boolean; - labeledElementDeclarations?: readonly (NamedTupleMember | ParameterDeclaration)[]; + labeledElementDeclarations?: readonly (NamedTupleMember | ParameterDeclaration | undefined)[]; } interface TupleTypeReference extends TypeReference { target: TupleType; @@ -3536,7 +3541,14 @@ declare namespace ts { All = 15, ExcludeJSDocTypeAssertion = 16 } - type TypeOfTag = "undefined" | "number" | "bigint" | "boolean" | "string" | "symbol" | "object" | "function"; + type ImmediatelyInvokedFunctionExpression = CallExpression & { + readonly expression: FunctionExpression; + }; + type ImmediatelyInvokedArrowFunction = CallExpression & { + readonly expression: ParenthesizedExpression & { + readonly expression: ArrowFunction; + }; + }; interface NodeFactory { createNodeArray(elements?: readonly T[], hasTrailingComma?: boolean): NodeArray; createNumericLiteral(value: string | number, numericLiteralFlags?: TokenFlags): NumericLiteral; @@ -4006,8 +4018,8 @@ declare namespace ts { createPostfixDecrement(operand: Expression): PostfixUnaryExpression; createImmediatelyInvokedFunctionExpression(statements: readonly Statement[]): CallExpression; createImmediatelyInvokedFunctionExpression(statements: readonly Statement[], param: ParameterDeclaration, paramValue: Expression): CallExpression; - createImmediatelyInvokedArrowFunction(statements: readonly Statement[]): CallExpression; - createImmediatelyInvokedArrowFunction(statements: readonly Statement[], param: ParameterDeclaration, paramValue: Expression): CallExpression; + createImmediatelyInvokedArrowFunction(statements: readonly Statement[]): ImmediatelyInvokedArrowFunction; + createImmediatelyInvokedArrowFunction(statements: readonly Statement[], param: ParameterDeclaration, paramValue: Expression): ImmediatelyInvokedArrowFunction; createVoidZero(): VoidExpression; createExportDefault(expression: Expression): ExportAssignment; createExternalModuleExport(exportName: Identifier): ExportDeclaration; @@ -4337,6 +4349,7 @@ declare namespace ts { readonly includeInlayPropertyDeclarationTypeHints?: boolean; readonly includeInlayFunctionLikeReturnTypeHints?: boolean; readonly includeInlayEnumMemberValueHints?: boolean; + readonly interactiveInlayHints?: boolean; readonly allowRenameOfImportPath?: boolean; readonly autoImportFileExcludePatterns?: string[]; readonly organizeImportsIgnoreCase?: "auto" | boolean; @@ -5595,7 +5608,7 @@ declare namespace ts { * When targetSource file is specified, emits the files corresponding to that source file, * otherwise for the whole program. * In case of EmitAndSemanticDiagnosticsBuilderProgram, when targetSourceFile is specified, - * it is assumed that file is handled from affected file list. If targetSourceFile is not specified, + * it is assumed that that file is handled from affected file list. If targetSourceFile is not specified, * it will only emit all the affected files instead of whole program * * The first of writeFile if provided, writeFile of BuilderProgramHost if provided, writeFile of compiler host @@ -6403,11 +6416,18 @@ declare namespace ts { Enum = "Enum" } interface InlayHint { + /** This property will be the empty string when displayParts is set. */ text: string; position: number; kind: InlayHintKind; whitespaceBefore?: boolean; whitespaceAfter?: boolean; + displayParts?: InlayHintDisplayPart[]; + } + interface InlayHintDisplayPart { + text: string; + span?: TextSpan; + file?: string; } interface TodoCommentDescriptor { text: string; @@ -6839,6 +6859,7 @@ declare namespace ts { kindModifiers?: string; sortText: string; insertText?: string; + filterText?: string; isSnippet?: true; /** * An optional span that indicates the text to be replaced by this completion item. @@ -6998,6 +7019,10 @@ declare namespace ts { variableElement = "var", /** Inside function */ localVariableElement = "local var", + /** using foo = ... */ + variableUsingElement = "using", + /** await using foo = ... */ + variableAwaitUsingElement = "await using", /** * Inside module and script only * function f() { } @@ -7270,4 +7295,4 @@ declare namespace ts { */ function transform(source: T | T[], transformers: TransformerFactory[], compilerOptions?: CompilerOptions): TransformationResult; } -export = ts; +export = ts; \ No newline at end of file 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 3e038fb51b5e..4d0ee1550663 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 @@ -34,8 +34,8 @@ var ts = (() => { var init_corePublic = __esm({ "src/compiler/corePublic.ts"() { "use strict"; - versionMajorMinor = "5.1"; - version = "5.1.3"; + versionMajorMinor = "5.2"; + version = "5.2.2"; Comparison = /* @__PURE__ */ ((Comparison3) => { Comparison3[Comparison3["LessThan"] = -1] = "LessThan"; Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo"; @@ -1464,8 +1464,8 @@ var ts = (() => { } return false; } - function createGetCanonicalFileName(useCaseSensitiveFileNames) { - return useCaseSensitiveFileNames ? identity : toFileNameLowerCase; + function createGetCanonicalFileName(useCaseSensitiveFileNames2) { + return useCaseSensitiveFileNames2 ? identity : toFileNameLowerCase; } function patternText({ prefix, suffix }) { return `${prefix}*${suffix}`; @@ -1646,7 +1646,7 @@ var ts = (() => { return void 0; }; hasOwnProperty = Object.prototype.hasOwnProperty; - fileNameLowerCaseRegExp = /[^\u0130\u0131\u00DFa-z0-9\\/:\-_\. ]+/g; + fileNameLowerCaseRegExp = /[^\u0130\u0131\u00DFa-z0-9\\/:\-_. ]+/g; AssertionLevel = /* @__PURE__ */ ((AssertionLevel2) => { AssertionLevel2[AssertionLevel2["None"] = 0] = "None"; AssertionLevel2[AssertionLevel2["Normal"] = 1] = "Normal"; @@ -1748,10 +1748,10 @@ var ts = (() => { } Debug2.log = log; ((_log) => { - function error(s) { + function error2(s) { logMessage(1 /* Error */, s); } - _log.error = error; + _log.error = error2; function warn(s) { logMessage(2 /* Warning */, s); } @@ -1951,7 +1951,7 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`, return func.name; } else { const text = Function.prototype.toString.call(func); - const match = /^function\s+([\w\$]+)\s*\(/.exec(text); + const match = /^function\s+([\w$]+)\s*\(/.exec(text); return match ? match[1] : ""; } } @@ -2025,6 +2025,15 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`, ); } Debug2.formatSnippetKind = formatSnippetKind; + function formatScriptKind(kind) { + return formatEnum( + kind, + ScriptKind, + /*isFlags*/ + false + ); + } + Debug2.formatScriptKind = formatScriptKind; function formatNodeFlags(flags) { return formatEnum( flags, @@ -2927,13 +2936,13 @@ ${lanes.join("\n")} "src/compiler/semver.ts"() { "use strict"; init_ts2(); - versionRegExp = /^(0|[1-9]\d*)(?:\.(0|[1-9]\d*)(?:\.(0|[1-9]\d*)(?:\-([a-z0-9-.]+))?(?:\+([a-z0-9-.]+))?)?)?$/i; + versionRegExp = /^(0|[1-9]\d*)(?:\.(0|[1-9]\d*)(?:\.(0|[1-9]\d*)(?:-([a-z0-9-.]+))?(?:\+([a-z0-9-.]+))?)?)?$/i; prereleaseRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)(?:\.(?:0|[1-9]\d*|[a-z-][a-z0-9-]*))*$/i; prereleasePartRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)$/i; buildRegExp = /^[a-z0-9-]+(?:\.[a-z0-9-]+)*$/i; buildPartRegExp = /^[a-z0-9-]+$/i; numericIdentifierRegExp = /^(0|[1-9]\d*)$/; - _Version = class { + _Version = class _Version { constructor(major, minor = 0, patch = 0, prerelease = "", build2 = "") { if (typeof major === "string") { const result = Debug.checkDefined(tryParseComponents(major), "Invalid version"); @@ -2997,16 +3006,16 @@ ${lanes.join("\n")} return result; } }; + _Version.zero = new _Version(0, 0, 0, ["0"]); Version = _Version; - Version.zero = new _Version(0, 0, 0, ["0"]); - VersionRange = class { + VersionRange = class _VersionRange { constructor(spec) { this._alternatives = spec ? Debug.checkDefined(parseRange(spec), "Invalid range spec.") : emptyArray; } static tryParse(text) { const sets = parseRange(text); if (sets) { - const range = new VersionRange(""); + const range = new _VersionRange(""); range._alternatives = sets; return range; } @@ -3684,210 +3693,211 @@ ${lanes.join("\n")} SyntaxKind5[SyntaxKind5["UndefinedKeyword"] = 157] = "UndefinedKeyword"; SyntaxKind5[SyntaxKind5["UniqueKeyword"] = 158] = "UniqueKeyword"; SyntaxKind5[SyntaxKind5["UnknownKeyword"] = 159] = "UnknownKeyword"; - SyntaxKind5[SyntaxKind5["FromKeyword"] = 160] = "FromKeyword"; - SyntaxKind5[SyntaxKind5["GlobalKeyword"] = 161] = "GlobalKeyword"; - SyntaxKind5[SyntaxKind5["BigIntKeyword"] = 162] = "BigIntKeyword"; - SyntaxKind5[SyntaxKind5["OverrideKeyword"] = 163] = "OverrideKeyword"; - SyntaxKind5[SyntaxKind5["OfKeyword"] = 164] = "OfKeyword"; - SyntaxKind5[SyntaxKind5["QualifiedName"] = 165] = "QualifiedName"; - SyntaxKind5[SyntaxKind5["ComputedPropertyName"] = 166] = "ComputedPropertyName"; - SyntaxKind5[SyntaxKind5["TypeParameter"] = 167] = "TypeParameter"; - SyntaxKind5[SyntaxKind5["Parameter"] = 168] = "Parameter"; - SyntaxKind5[SyntaxKind5["Decorator"] = 169] = "Decorator"; - SyntaxKind5[SyntaxKind5["PropertySignature"] = 170] = "PropertySignature"; - SyntaxKind5[SyntaxKind5["PropertyDeclaration"] = 171] = "PropertyDeclaration"; - SyntaxKind5[SyntaxKind5["MethodSignature"] = 172] = "MethodSignature"; - SyntaxKind5[SyntaxKind5["MethodDeclaration"] = 173] = "MethodDeclaration"; - SyntaxKind5[SyntaxKind5["ClassStaticBlockDeclaration"] = 174] = "ClassStaticBlockDeclaration"; - SyntaxKind5[SyntaxKind5["Constructor"] = 175] = "Constructor"; - SyntaxKind5[SyntaxKind5["GetAccessor"] = 176] = "GetAccessor"; - SyntaxKind5[SyntaxKind5["SetAccessor"] = 177] = "SetAccessor"; - SyntaxKind5[SyntaxKind5["CallSignature"] = 178] = "CallSignature"; - SyntaxKind5[SyntaxKind5["ConstructSignature"] = 179] = "ConstructSignature"; - SyntaxKind5[SyntaxKind5["IndexSignature"] = 180] = "IndexSignature"; - SyntaxKind5[SyntaxKind5["TypePredicate"] = 181] = "TypePredicate"; - SyntaxKind5[SyntaxKind5["TypeReference"] = 182] = "TypeReference"; - SyntaxKind5[SyntaxKind5["FunctionType"] = 183] = "FunctionType"; - SyntaxKind5[SyntaxKind5["ConstructorType"] = 184] = "ConstructorType"; - SyntaxKind5[SyntaxKind5["TypeQuery"] = 185] = "TypeQuery"; - SyntaxKind5[SyntaxKind5["TypeLiteral"] = 186] = "TypeLiteral"; - SyntaxKind5[SyntaxKind5["ArrayType"] = 187] = "ArrayType"; - SyntaxKind5[SyntaxKind5["TupleType"] = 188] = "TupleType"; - SyntaxKind5[SyntaxKind5["OptionalType"] = 189] = "OptionalType"; - SyntaxKind5[SyntaxKind5["RestType"] = 190] = "RestType"; - SyntaxKind5[SyntaxKind5["UnionType"] = 191] = "UnionType"; - SyntaxKind5[SyntaxKind5["IntersectionType"] = 192] = "IntersectionType"; - SyntaxKind5[SyntaxKind5["ConditionalType"] = 193] = "ConditionalType"; - SyntaxKind5[SyntaxKind5["InferType"] = 194] = "InferType"; - SyntaxKind5[SyntaxKind5["ParenthesizedType"] = 195] = "ParenthesizedType"; - SyntaxKind5[SyntaxKind5["ThisType"] = 196] = "ThisType"; - SyntaxKind5[SyntaxKind5["TypeOperator"] = 197] = "TypeOperator"; - SyntaxKind5[SyntaxKind5["IndexedAccessType"] = 198] = "IndexedAccessType"; - SyntaxKind5[SyntaxKind5["MappedType"] = 199] = "MappedType"; - SyntaxKind5[SyntaxKind5["LiteralType"] = 200] = "LiteralType"; - SyntaxKind5[SyntaxKind5["NamedTupleMember"] = 201] = "NamedTupleMember"; - SyntaxKind5[SyntaxKind5["TemplateLiteralType"] = 202] = "TemplateLiteralType"; - SyntaxKind5[SyntaxKind5["TemplateLiteralTypeSpan"] = 203] = "TemplateLiteralTypeSpan"; - SyntaxKind5[SyntaxKind5["ImportType"] = 204] = "ImportType"; - SyntaxKind5[SyntaxKind5["ObjectBindingPattern"] = 205] = "ObjectBindingPattern"; - SyntaxKind5[SyntaxKind5["ArrayBindingPattern"] = 206] = "ArrayBindingPattern"; - SyntaxKind5[SyntaxKind5["BindingElement"] = 207] = "BindingElement"; - SyntaxKind5[SyntaxKind5["ArrayLiteralExpression"] = 208] = "ArrayLiteralExpression"; - SyntaxKind5[SyntaxKind5["ObjectLiteralExpression"] = 209] = "ObjectLiteralExpression"; - SyntaxKind5[SyntaxKind5["PropertyAccessExpression"] = 210] = "PropertyAccessExpression"; - SyntaxKind5[SyntaxKind5["ElementAccessExpression"] = 211] = "ElementAccessExpression"; - SyntaxKind5[SyntaxKind5["CallExpression"] = 212] = "CallExpression"; - SyntaxKind5[SyntaxKind5["NewExpression"] = 213] = "NewExpression"; - SyntaxKind5[SyntaxKind5["TaggedTemplateExpression"] = 214] = "TaggedTemplateExpression"; - SyntaxKind5[SyntaxKind5["TypeAssertionExpression"] = 215] = "TypeAssertionExpression"; - SyntaxKind5[SyntaxKind5["ParenthesizedExpression"] = 216] = "ParenthesizedExpression"; - SyntaxKind5[SyntaxKind5["FunctionExpression"] = 217] = "FunctionExpression"; - SyntaxKind5[SyntaxKind5["ArrowFunction"] = 218] = "ArrowFunction"; - SyntaxKind5[SyntaxKind5["DeleteExpression"] = 219] = "DeleteExpression"; - SyntaxKind5[SyntaxKind5["TypeOfExpression"] = 220] = "TypeOfExpression"; - SyntaxKind5[SyntaxKind5["VoidExpression"] = 221] = "VoidExpression"; - SyntaxKind5[SyntaxKind5["AwaitExpression"] = 222] = "AwaitExpression"; - SyntaxKind5[SyntaxKind5["PrefixUnaryExpression"] = 223] = "PrefixUnaryExpression"; - SyntaxKind5[SyntaxKind5["PostfixUnaryExpression"] = 224] = "PostfixUnaryExpression"; - SyntaxKind5[SyntaxKind5["BinaryExpression"] = 225] = "BinaryExpression"; - SyntaxKind5[SyntaxKind5["ConditionalExpression"] = 226] = "ConditionalExpression"; - SyntaxKind5[SyntaxKind5["TemplateExpression"] = 227] = "TemplateExpression"; - SyntaxKind5[SyntaxKind5["YieldExpression"] = 228] = "YieldExpression"; - SyntaxKind5[SyntaxKind5["SpreadElement"] = 229] = "SpreadElement"; - SyntaxKind5[SyntaxKind5["ClassExpression"] = 230] = "ClassExpression"; - SyntaxKind5[SyntaxKind5["OmittedExpression"] = 231] = "OmittedExpression"; - SyntaxKind5[SyntaxKind5["ExpressionWithTypeArguments"] = 232] = "ExpressionWithTypeArguments"; - SyntaxKind5[SyntaxKind5["AsExpression"] = 233] = "AsExpression"; - SyntaxKind5[SyntaxKind5["NonNullExpression"] = 234] = "NonNullExpression"; - SyntaxKind5[SyntaxKind5["MetaProperty"] = 235] = "MetaProperty"; - SyntaxKind5[SyntaxKind5["SyntheticExpression"] = 236] = "SyntheticExpression"; - SyntaxKind5[SyntaxKind5["SatisfiesExpression"] = 237] = "SatisfiesExpression"; - SyntaxKind5[SyntaxKind5["TemplateSpan"] = 238] = "TemplateSpan"; - SyntaxKind5[SyntaxKind5["SemicolonClassElement"] = 239] = "SemicolonClassElement"; - SyntaxKind5[SyntaxKind5["Block"] = 240] = "Block"; - SyntaxKind5[SyntaxKind5["EmptyStatement"] = 241] = "EmptyStatement"; - SyntaxKind5[SyntaxKind5["VariableStatement"] = 242] = "VariableStatement"; - SyntaxKind5[SyntaxKind5["ExpressionStatement"] = 243] = "ExpressionStatement"; - SyntaxKind5[SyntaxKind5["IfStatement"] = 244] = "IfStatement"; - SyntaxKind5[SyntaxKind5["DoStatement"] = 245] = "DoStatement"; - SyntaxKind5[SyntaxKind5["WhileStatement"] = 246] = "WhileStatement"; - SyntaxKind5[SyntaxKind5["ForStatement"] = 247] = "ForStatement"; - SyntaxKind5[SyntaxKind5["ForInStatement"] = 248] = "ForInStatement"; - SyntaxKind5[SyntaxKind5["ForOfStatement"] = 249] = "ForOfStatement"; - SyntaxKind5[SyntaxKind5["ContinueStatement"] = 250] = "ContinueStatement"; - SyntaxKind5[SyntaxKind5["BreakStatement"] = 251] = "BreakStatement"; - SyntaxKind5[SyntaxKind5["ReturnStatement"] = 252] = "ReturnStatement"; - SyntaxKind5[SyntaxKind5["WithStatement"] = 253] = "WithStatement"; - SyntaxKind5[SyntaxKind5["SwitchStatement"] = 254] = "SwitchStatement"; - SyntaxKind5[SyntaxKind5["LabeledStatement"] = 255] = "LabeledStatement"; - SyntaxKind5[SyntaxKind5["ThrowStatement"] = 256] = "ThrowStatement"; - SyntaxKind5[SyntaxKind5["TryStatement"] = 257] = "TryStatement"; - SyntaxKind5[SyntaxKind5["DebuggerStatement"] = 258] = "DebuggerStatement"; - SyntaxKind5[SyntaxKind5["VariableDeclaration"] = 259] = "VariableDeclaration"; - SyntaxKind5[SyntaxKind5["VariableDeclarationList"] = 260] = "VariableDeclarationList"; - SyntaxKind5[SyntaxKind5["FunctionDeclaration"] = 261] = "FunctionDeclaration"; - SyntaxKind5[SyntaxKind5["ClassDeclaration"] = 262] = "ClassDeclaration"; - SyntaxKind5[SyntaxKind5["InterfaceDeclaration"] = 263] = "InterfaceDeclaration"; - SyntaxKind5[SyntaxKind5["TypeAliasDeclaration"] = 264] = "TypeAliasDeclaration"; - SyntaxKind5[SyntaxKind5["EnumDeclaration"] = 265] = "EnumDeclaration"; - SyntaxKind5[SyntaxKind5["ModuleDeclaration"] = 266] = "ModuleDeclaration"; - SyntaxKind5[SyntaxKind5["ModuleBlock"] = 267] = "ModuleBlock"; - SyntaxKind5[SyntaxKind5["CaseBlock"] = 268] = "CaseBlock"; - SyntaxKind5[SyntaxKind5["NamespaceExportDeclaration"] = 269] = "NamespaceExportDeclaration"; - SyntaxKind5[SyntaxKind5["ImportEqualsDeclaration"] = 270] = "ImportEqualsDeclaration"; - SyntaxKind5[SyntaxKind5["ImportDeclaration"] = 271] = "ImportDeclaration"; - SyntaxKind5[SyntaxKind5["ImportClause"] = 272] = "ImportClause"; - SyntaxKind5[SyntaxKind5["NamespaceImport"] = 273] = "NamespaceImport"; - SyntaxKind5[SyntaxKind5["NamedImports"] = 274] = "NamedImports"; - SyntaxKind5[SyntaxKind5["ImportSpecifier"] = 275] = "ImportSpecifier"; - SyntaxKind5[SyntaxKind5["ExportAssignment"] = 276] = "ExportAssignment"; - SyntaxKind5[SyntaxKind5["ExportDeclaration"] = 277] = "ExportDeclaration"; - SyntaxKind5[SyntaxKind5["NamedExports"] = 278] = "NamedExports"; - SyntaxKind5[SyntaxKind5["NamespaceExport"] = 279] = "NamespaceExport"; - SyntaxKind5[SyntaxKind5["ExportSpecifier"] = 280] = "ExportSpecifier"; - SyntaxKind5[SyntaxKind5["MissingDeclaration"] = 281] = "MissingDeclaration"; - SyntaxKind5[SyntaxKind5["ExternalModuleReference"] = 282] = "ExternalModuleReference"; - SyntaxKind5[SyntaxKind5["JsxElement"] = 283] = "JsxElement"; - SyntaxKind5[SyntaxKind5["JsxSelfClosingElement"] = 284] = "JsxSelfClosingElement"; - SyntaxKind5[SyntaxKind5["JsxOpeningElement"] = 285] = "JsxOpeningElement"; - SyntaxKind5[SyntaxKind5["JsxClosingElement"] = 286] = "JsxClosingElement"; - SyntaxKind5[SyntaxKind5["JsxFragment"] = 287] = "JsxFragment"; - SyntaxKind5[SyntaxKind5["JsxOpeningFragment"] = 288] = "JsxOpeningFragment"; - SyntaxKind5[SyntaxKind5["JsxClosingFragment"] = 289] = "JsxClosingFragment"; - SyntaxKind5[SyntaxKind5["JsxAttribute"] = 290] = "JsxAttribute"; - SyntaxKind5[SyntaxKind5["JsxAttributes"] = 291] = "JsxAttributes"; - SyntaxKind5[SyntaxKind5["JsxSpreadAttribute"] = 292] = "JsxSpreadAttribute"; - SyntaxKind5[SyntaxKind5["JsxExpression"] = 293] = "JsxExpression"; - SyntaxKind5[SyntaxKind5["JsxNamespacedName"] = 294] = "JsxNamespacedName"; - SyntaxKind5[SyntaxKind5["CaseClause"] = 295] = "CaseClause"; - SyntaxKind5[SyntaxKind5["DefaultClause"] = 296] = "DefaultClause"; - SyntaxKind5[SyntaxKind5["HeritageClause"] = 297] = "HeritageClause"; - SyntaxKind5[SyntaxKind5["CatchClause"] = 298] = "CatchClause"; - SyntaxKind5[SyntaxKind5["AssertClause"] = 299] = "AssertClause"; - SyntaxKind5[SyntaxKind5["AssertEntry"] = 300] = "AssertEntry"; - SyntaxKind5[SyntaxKind5["ImportTypeAssertionContainer"] = 301] = "ImportTypeAssertionContainer"; - SyntaxKind5[SyntaxKind5["PropertyAssignment"] = 302] = "PropertyAssignment"; - SyntaxKind5[SyntaxKind5["ShorthandPropertyAssignment"] = 303] = "ShorthandPropertyAssignment"; - SyntaxKind5[SyntaxKind5["SpreadAssignment"] = 304] = "SpreadAssignment"; - SyntaxKind5[SyntaxKind5["EnumMember"] = 305] = "EnumMember"; - SyntaxKind5[SyntaxKind5["UnparsedPrologue"] = 306] = "UnparsedPrologue"; - SyntaxKind5[SyntaxKind5["UnparsedPrepend"] = 307] = "UnparsedPrepend"; - SyntaxKind5[SyntaxKind5["UnparsedText"] = 308] = "UnparsedText"; - SyntaxKind5[SyntaxKind5["UnparsedInternalText"] = 309] = "UnparsedInternalText"; - SyntaxKind5[SyntaxKind5["UnparsedSyntheticReference"] = 310] = "UnparsedSyntheticReference"; - SyntaxKind5[SyntaxKind5["SourceFile"] = 311] = "SourceFile"; - SyntaxKind5[SyntaxKind5["Bundle"] = 312] = "Bundle"; - SyntaxKind5[SyntaxKind5["UnparsedSource"] = 313] = "UnparsedSource"; - SyntaxKind5[SyntaxKind5["InputFiles"] = 314] = "InputFiles"; - SyntaxKind5[SyntaxKind5["JSDocTypeExpression"] = 315] = "JSDocTypeExpression"; - SyntaxKind5[SyntaxKind5["JSDocNameReference"] = 316] = "JSDocNameReference"; - SyntaxKind5[SyntaxKind5["JSDocMemberName"] = 317] = "JSDocMemberName"; - SyntaxKind5[SyntaxKind5["JSDocAllType"] = 318] = "JSDocAllType"; - SyntaxKind5[SyntaxKind5["JSDocUnknownType"] = 319] = "JSDocUnknownType"; - SyntaxKind5[SyntaxKind5["JSDocNullableType"] = 320] = "JSDocNullableType"; - SyntaxKind5[SyntaxKind5["JSDocNonNullableType"] = 321] = "JSDocNonNullableType"; - SyntaxKind5[SyntaxKind5["JSDocOptionalType"] = 322] = "JSDocOptionalType"; - SyntaxKind5[SyntaxKind5["JSDocFunctionType"] = 323] = "JSDocFunctionType"; - SyntaxKind5[SyntaxKind5["JSDocVariadicType"] = 324] = "JSDocVariadicType"; - SyntaxKind5[SyntaxKind5["JSDocNamepathType"] = 325] = "JSDocNamepathType"; - SyntaxKind5[SyntaxKind5["JSDoc"] = 326] = "JSDoc"; - SyntaxKind5[SyntaxKind5["JSDocComment"] = 326 /* JSDoc */] = "JSDocComment"; - SyntaxKind5[SyntaxKind5["JSDocText"] = 327] = "JSDocText"; - SyntaxKind5[SyntaxKind5["JSDocTypeLiteral"] = 328] = "JSDocTypeLiteral"; - SyntaxKind5[SyntaxKind5["JSDocSignature"] = 329] = "JSDocSignature"; - SyntaxKind5[SyntaxKind5["JSDocLink"] = 330] = "JSDocLink"; - SyntaxKind5[SyntaxKind5["JSDocLinkCode"] = 331] = "JSDocLinkCode"; - SyntaxKind5[SyntaxKind5["JSDocLinkPlain"] = 332] = "JSDocLinkPlain"; - SyntaxKind5[SyntaxKind5["JSDocTag"] = 333] = "JSDocTag"; - SyntaxKind5[SyntaxKind5["JSDocAugmentsTag"] = 334] = "JSDocAugmentsTag"; - SyntaxKind5[SyntaxKind5["JSDocImplementsTag"] = 335] = "JSDocImplementsTag"; - SyntaxKind5[SyntaxKind5["JSDocAuthorTag"] = 336] = "JSDocAuthorTag"; - SyntaxKind5[SyntaxKind5["JSDocDeprecatedTag"] = 337] = "JSDocDeprecatedTag"; - SyntaxKind5[SyntaxKind5["JSDocClassTag"] = 338] = "JSDocClassTag"; - SyntaxKind5[SyntaxKind5["JSDocPublicTag"] = 339] = "JSDocPublicTag"; - SyntaxKind5[SyntaxKind5["JSDocPrivateTag"] = 340] = "JSDocPrivateTag"; - SyntaxKind5[SyntaxKind5["JSDocProtectedTag"] = 341] = "JSDocProtectedTag"; - SyntaxKind5[SyntaxKind5["JSDocReadonlyTag"] = 342] = "JSDocReadonlyTag"; - SyntaxKind5[SyntaxKind5["JSDocOverrideTag"] = 343] = "JSDocOverrideTag"; - SyntaxKind5[SyntaxKind5["JSDocCallbackTag"] = 344] = "JSDocCallbackTag"; - SyntaxKind5[SyntaxKind5["JSDocOverloadTag"] = 345] = "JSDocOverloadTag"; - SyntaxKind5[SyntaxKind5["JSDocEnumTag"] = 346] = "JSDocEnumTag"; - SyntaxKind5[SyntaxKind5["JSDocParameterTag"] = 347] = "JSDocParameterTag"; - SyntaxKind5[SyntaxKind5["JSDocReturnTag"] = 348] = "JSDocReturnTag"; - SyntaxKind5[SyntaxKind5["JSDocThisTag"] = 349] = "JSDocThisTag"; - SyntaxKind5[SyntaxKind5["JSDocTypeTag"] = 350] = "JSDocTypeTag"; - SyntaxKind5[SyntaxKind5["JSDocTemplateTag"] = 351] = "JSDocTemplateTag"; - SyntaxKind5[SyntaxKind5["JSDocTypedefTag"] = 352] = "JSDocTypedefTag"; - SyntaxKind5[SyntaxKind5["JSDocSeeTag"] = 353] = "JSDocSeeTag"; - SyntaxKind5[SyntaxKind5["JSDocPropertyTag"] = 354] = "JSDocPropertyTag"; - SyntaxKind5[SyntaxKind5["JSDocThrowsTag"] = 355] = "JSDocThrowsTag"; - SyntaxKind5[SyntaxKind5["JSDocSatisfiesTag"] = 356] = "JSDocSatisfiesTag"; - SyntaxKind5[SyntaxKind5["SyntaxList"] = 357] = "SyntaxList"; - SyntaxKind5[SyntaxKind5["NotEmittedStatement"] = 358] = "NotEmittedStatement"; - SyntaxKind5[SyntaxKind5["PartiallyEmittedExpression"] = 359] = "PartiallyEmittedExpression"; - SyntaxKind5[SyntaxKind5["CommaListExpression"] = 360] = "CommaListExpression"; - SyntaxKind5[SyntaxKind5["SyntheticReferenceExpression"] = 361] = "SyntheticReferenceExpression"; - SyntaxKind5[SyntaxKind5["Count"] = 362] = "Count"; + SyntaxKind5[SyntaxKind5["UsingKeyword"] = 160] = "UsingKeyword"; + SyntaxKind5[SyntaxKind5["FromKeyword"] = 161] = "FromKeyword"; + SyntaxKind5[SyntaxKind5["GlobalKeyword"] = 162] = "GlobalKeyword"; + SyntaxKind5[SyntaxKind5["BigIntKeyword"] = 163] = "BigIntKeyword"; + SyntaxKind5[SyntaxKind5["OverrideKeyword"] = 164] = "OverrideKeyword"; + SyntaxKind5[SyntaxKind5["OfKeyword"] = 165] = "OfKeyword"; + SyntaxKind5[SyntaxKind5["QualifiedName"] = 166] = "QualifiedName"; + SyntaxKind5[SyntaxKind5["ComputedPropertyName"] = 167] = "ComputedPropertyName"; + SyntaxKind5[SyntaxKind5["TypeParameter"] = 168] = "TypeParameter"; + SyntaxKind5[SyntaxKind5["Parameter"] = 169] = "Parameter"; + SyntaxKind5[SyntaxKind5["Decorator"] = 170] = "Decorator"; + SyntaxKind5[SyntaxKind5["PropertySignature"] = 171] = "PropertySignature"; + SyntaxKind5[SyntaxKind5["PropertyDeclaration"] = 172] = "PropertyDeclaration"; + SyntaxKind5[SyntaxKind5["MethodSignature"] = 173] = "MethodSignature"; + SyntaxKind5[SyntaxKind5["MethodDeclaration"] = 174] = "MethodDeclaration"; + SyntaxKind5[SyntaxKind5["ClassStaticBlockDeclaration"] = 175] = "ClassStaticBlockDeclaration"; + SyntaxKind5[SyntaxKind5["Constructor"] = 176] = "Constructor"; + SyntaxKind5[SyntaxKind5["GetAccessor"] = 177] = "GetAccessor"; + SyntaxKind5[SyntaxKind5["SetAccessor"] = 178] = "SetAccessor"; + SyntaxKind5[SyntaxKind5["CallSignature"] = 179] = "CallSignature"; + SyntaxKind5[SyntaxKind5["ConstructSignature"] = 180] = "ConstructSignature"; + SyntaxKind5[SyntaxKind5["IndexSignature"] = 181] = "IndexSignature"; + SyntaxKind5[SyntaxKind5["TypePredicate"] = 182] = "TypePredicate"; + SyntaxKind5[SyntaxKind5["TypeReference"] = 183] = "TypeReference"; + SyntaxKind5[SyntaxKind5["FunctionType"] = 184] = "FunctionType"; + SyntaxKind5[SyntaxKind5["ConstructorType"] = 185] = "ConstructorType"; + SyntaxKind5[SyntaxKind5["TypeQuery"] = 186] = "TypeQuery"; + SyntaxKind5[SyntaxKind5["TypeLiteral"] = 187] = "TypeLiteral"; + SyntaxKind5[SyntaxKind5["ArrayType"] = 188] = "ArrayType"; + SyntaxKind5[SyntaxKind5["TupleType"] = 189] = "TupleType"; + SyntaxKind5[SyntaxKind5["OptionalType"] = 190] = "OptionalType"; + SyntaxKind5[SyntaxKind5["RestType"] = 191] = "RestType"; + SyntaxKind5[SyntaxKind5["UnionType"] = 192] = "UnionType"; + SyntaxKind5[SyntaxKind5["IntersectionType"] = 193] = "IntersectionType"; + SyntaxKind5[SyntaxKind5["ConditionalType"] = 194] = "ConditionalType"; + SyntaxKind5[SyntaxKind5["InferType"] = 195] = "InferType"; + SyntaxKind5[SyntaxKind5["ParenthesizedType"] = 196] = "ParenthesizedType"; + SyntaxKind5[SyntaxKind5["ThisType"] = 197] = "ThisType"; + SyntaxKind5[SyntaxKind5["TypeOperator"] = 198] = "TypeOperator"; + SyntaxKind5[SyntaxKind5["IndexedAccessType"] = 199] = "IndexedAccessType"; + SyntaxKind5[SyntaxKind5["MappedType"] = 200] = "MappedType"; + SyntaxKind5[SyntaxKind5["LiteralType"] = 201] = "LiteralType"; + SyntaxKind5[SyntaxKind5["NamedTupleMember"] = 202] = "NamedTupleMember"; + SyntaxKind5[SyntaxKind5["TemplateLiteralType"] = 203] = "TemplateLiteralType"; + SyntaxKind5[SyntaxKind5["TemplateLiteralTypeSpan"] = 204] = "TemplateLiteralTypeSpan"; + SyntaxKind5[SyntaxKind5["ImportType"] = 205] = "ImportType"; + SyntaxKind5[SyntaxKind5["ObjectBindingPattern"] = 206] = "ObjectBindingPattern"; + SyntaxKind5[SyntaxKind5["ArrayBindingPattern"] = 207] = "ArrayBindingPattern"; + SyntaxKind5[SyntaxKind5["BindingElement"] = 208] = "BindingElement"; + SyntaxKind5[SyntaxKind5["ArrayLiteralExpression"] = 209] = "ArrayLiteralExpression"; + SyntaxKind5[SyntaxKind5["ObjectLiteralExpression"] = 210] = "ObjectLiteralExpression"; + SyntaxKind5[SyntaxKind5["PropertyAccessExpression"] = 211] = "PropertyAccessExpression"; + SyntaxKind5[SyntaxKind5["ElementAccessExpression"] = 212] = "ElementAccessExpression"; + SyntaxKind5[SyntaxKind5["CallExpression"] = 213] = "CallExpression"; + SyntaxKind5[SyntaxKind5["NewExpression"] = 214] = "NewExpression"; + SyntaxKind5[SyntaxKind5["TaggedTemplateExpression"] = 215] = "TaggedTemplateExpression"; + SyntaxKind5[SyntaxKind5["TypeAssertionExpression"] = 216] = "TypeAssertionExpression"; + SyntaxKind5[SyntaxKind5["ParenthesizedExpression"] = 217] = "ParenthesizedExpression"; + SyntaxKind5[SyntaxKind5["FunctionExpression"] = 218] = "FunctionExpression"; + SyntaxKind5[SyntaxKind5["ArrowFunction"] = 219] = "ArrowFunction"; + SyntaxKind5[SyntaxKind5["DeleteExpression"] = 220] = "DeleteExpression"; + SyntaxKind5[SyntaxKind5["TypeOfExpression"] = 221] = "TypeOfExpression"; + SyntaxKind5[SyntaxKind5["VoidExpression"] = 222] = "VoidExpression"; + SyntaxKind5[SyntaxKind5["AwaitExpression"] = 223] = "AwaitExpression"; + SyntaxKind5[SyntaxKind5["PrefixUnaryExpression"] = 224] = "PrefixUnaryExpression"; + SyntaxKind5[SyntaxKind5["PostfixUnaryExpression"] = 225] = "PostfixUnaryExpression"; + SyntaxKind5[SyntaxKind5["BinaryExpression"] = 226] = "BinaryExpression"; + SyntaxKind5[SyntaxKind5["ConditionalExpression"] = 227] = "ConditionalExpression"; + SyntaxKind5[SyntaxKind5["TemplateExpression"] = 228] = "TemplateExpression"; + SyntaxKind5[SyntaxKind5["YieldExpression"] = 229] = "YieldExpression"; + SyntaxKind5[SyntaxKind5["SpreadElement"] = 230] = "SpreadElement"; + SyntaxKind5[SyntaxKind5["ClassExpression"] = 231] = "ClassExpression"; + SyntaxKind5[SyntaxKind5["OmittedExpression"] = 232] = "OmittedExpression"; + SyntaxKind5[SyntaxKind5["ExpressionWithTypeArguments"] = 233] = "ExpressionWithTypeArguments"; + SyntaxKind5[SyntaxKind5["AsExpression"] = 234] = "AsExpression"; + SyntaxKind5[SyntaxKind5["NonNullExpression"] = 235] = "NonNullExpression"; + SyntaxKind5[SyntaxKind5["MetaProperty"] = 236] = "MetaProperty"; + SyntaxKind5[SyntaxKind5["SyntheticExpression"] = 237] = "SyntheticExpression"; + SyntaxKind5[SyntaxKind5["SatisfiesExpression"] = 238] = "SatisfiesExpression"; + SyntaxKind5[SyntaxKind5["TemplateSpan"] = 239] = "TemplateSpan"; + SyntaxKind5[SyntaxKind5["SemicolonClassElement"] = 240] = "SemicolonClassElement"; + SyntaxKind5[SyntaxKind5["Block"] = 241] = "Block"; + SyntaxKind5[SyntaxKind5["EmptyStatement"] = 242] = "EmptyStatement"; + SyntaxKind5[SyntaxKind5["VariableStatement"] = 243] = "VariableStatement"; + SyntaxKind5[SyntaxKind5["ExpressionStatement"] = 244] = "ExpressionStatement"; + SyntaxKind5[SyntaxKind5["IfStatement"] = 245] = "IfStatement"; + SyntaxKind5[SyntaxKind5["DoStatement"] = 246] = "DoStatement"; + SyntaxKind5[SyntaxKind5["WhileStatement"] = 247] = "WhileStatement"; + SyntaxKind5[SyntaxKind5["ForStatement"] = 248] = "ForStatement"; + SyntaxKind5[SyntaxKind5["ForInStatement"] = 249] = "ForInStatement"; + SyntaxKind5[SyntaxKind5["ForOfStatement"] = 250] = "ForOfStatement"; + SyntaxKind5[SyntaxKind5["ContinueStatement"] = 251] = "ContinueStatement"; + SyntaxKind5[SyntaxKind5["BreakStatement"] = 252] = "BreakStatement"; + SyntaxKind5[SyntaxKind5["ReturnStatement"] = 253] = "ReturnStatement"; + SyntaxKind5[SyntaxKind5["WithStatement"] = 254] = "WithStatement"; + SyntaxKind5[SyntaxKind5["SwitchStatement"] = 255] = "SwitchStatement"; + SyntaxKind5[SyntaxKind5["LabeledStatement"] = 256] = "LabeledStatement"; + SyntaxKind5[SyntaxKind5["ThrowStatement"] = 257] = "ThrowStatement"; + SyntaxKind5[SyntaxKind5["TryStatement"] = 258] = "TryStatement"; + SyntaxKind5[SyntaxKind5["DebuggerStatement"] = 259] = "DebuggerStatement"; + SyntaxKind5[SyntaxKind5["VariableDeclaration"] = 260] = "VariableDeclaration"; + SyntaxKind5[SyntaxKind5["VariableDeclarationList"] = 261] = "VariableDeclarationList"; + SyntaxKind5[SyntaxKind5["FunctionDeclaration"] = 262] = "FunctionDeclaration"; + SyntaxKind5[SyntaxKind5["ClassDeclaration"] = 263] = "ClassDeclaration"; + SyntaxKind5[SyntaxKind5["InterfaceDeclaration"] = 264] = "InterfaceDeclaration"; + SyntaxKind5[SyntaxKind5["TypeAliasDeclaration"] = 265] = "TypeAliasDeclaration"; + SyntaxKind5[SyntaxKind5["EnumDeclaration"] = 266] = "EnumDeclaration"; + SyntaxKind5[SyntaxKind5["ModuleDeclaration"] = 267] = "ModuleDeclaration"; + SyntaxKind5[SyntaxKind5["ModuleBlock"] = 268] = "ModuleBlock"; + SyntaxKind5[SyntaxKind5["CaseBlock"] = 269] = "CaseBlock"; + SyntaxKind5[SyntaxKind5["NamespaceExportDeclaration"] = 270] = "NamespaceExportDeclaration"; + SyntaxKind5[SyntaxKind5["ImportEqualsDeclaration"] = 271] = "ImportEqualsDeclaration"; + SyntaxKind5[SyntaxKind5["ImportDeclaration"] = 272] = "ImportDeclaration"; + SyntaxKind5[SyntaxKind5["ImportClause"] = 273] = "ImportClause"; + SyntaxKind5[SyntaxKind5["NamespaceImport"] = 274] = "NamespaceImport"; + SyntaxKind5[SyntaxKind5["NamedImports"] = 275] = "NamedImports"; + SyntaxKind5[SyntaxKind5["ImportSpecifier"] = 276] = "ImportSpecifier"; + SyntaxKind5[SyntaxKind5["ExportAssignment"] = 277] = "ExportAssignment"; + SyntaxKind5[SyntaxKind5["ExportDeclaration"] = 278] = "ExportDeclaration"; + SyntaxKind5[SyntaxKind5["NamedExports"] = 279] = "NamedExports"; + SyntaxKind5[SyntaxKind5["NamespaceExport"] = 280] = "NamespaceExport"; + SyntaxKind5[SyntaxKind5["ExportSpecifier"] = 281] = "ExportSpecifier"; + SyntaxKind5[SyntaxKind5["MissingDeclaration"] = 282] = "MissingDeclaration"; + SyntaxKind5[SyntaxKind5["ExternalModuleReference"] = 283] = "ExternalModuleReference"; + SyntaxKind5[SyntaxKind5["JsxElement"] = 284] = "JsxElement"; + SyntaxKind5[SyntaxKind5["JsxSelfClosingElement"] = 285] = "JsxSelfClosingElement"; + SyntaxKind5[SyntaxKind5["JsxOpeningElement"] = 286] = "JsxOpeningElement"; + SyntaxKind5[SyntaxKind5["JsxClosingElement"] = 287] = "JsxClosingElement"; + SyntaxKind5[SyntaxKind5["JsxFragment"] = 288] = "JsxFragment"; + SyntaxKind5[SyntaxKind5["JsxOpeningFragment"] = 289] = "JsxOpeningFragment"; + SyntaxKind5[SyntaxKind5["JsxClosingFragment"] = 290] = "JsxClosingFragment"; + SyntaxKind5[SyntaxKind5["JsxAttribute"] = 291] = "JsxAttribute"; + SyntaxKind5[SyntaxKind5["JsxAttributes"] = 292] = "JsxAttributes"; + SyntaxKind5[SyntaxKind5["JsxSpreadAttribute"] = 293] = "JsxSpreadAttribute"; + SyntaxKind5[SyntaxKind5["JsxExpression"] = 294] = "JsxExpression"; + SyntaxKind5[SyntaxKind5["JsxNamespacedName"] = 295] = "JsxNamespacedName"; + SyntaxKind5[SyntaxKind5["CaseClause"] = 296] = "CaseClause"; + SyntaxKind5[SyntaxKind5["DefaultClause"] = 297] = "DefaultClause"; + SyntaxKind5[SyntaxKind5["HeritageClause"] = 298] = "HeritageClause"; + SyntaxKind5[SyntaxKind5["CatchClause"] = 299] = "CatchClause"; + SyntaxKind5[SyntaxKind5["AssertClause"] = 300] = "AssertClause"; + SyntaxKind5[SyntaxKind5["AssertEntry"] = 301] = "AssertEntry"; + SyntaxKind5[SyntaxKind5["ImportTypeAssertionContainer"] = 302] = "ImportTypeAssertionContainer"; + SyntaxKind5[SyntaxKind5["PropertyAssignment"] = 303] = "PropertyAssignment"; + SyntaxKind5[SyntaxKind5["ShorthandPropertyAssignment"] = 304] = "ShorthandPropertyAssignment"; + SyntaxKind5[SyntaxKind5["SpreadAssignment"] = 305] = "SpreadAssignment"; + SyntaxKind5[SyntaxKind5["EnumMember"] = 306] = "EnumMember"; + SyntaxKind5[SyntaxKind5["UnparsedPrologue"] = 307] = "UnparsedPrologue"; + SyntaxKind5[SyntaxKind5["UnparsedPrepend"] = 308] = "UnparsedPrepend"; + SyntaxKind5[SyntaxKind5["UnparsedText"] = 309] = "UnparsedText"; + SyntaxKind5[SyntaxKind5["UnparsedInternalText"] = 310] = "UnparsedInternalText"; + SyntaxKind5[SyntaxKind5["UnparsedSyntheticReference"] = 311] = "UnparsedSyntheticReference"; + SyntaxKind5[SyntaxKind5["SourceFile"] = 312] = "SourceFile"; + SyntaxKind5[SyntaxKind5["Bundle"] = 313] = "Bundle"; + SyntaxKind5[SyntaxKind5["UnparsedSource"] = 314] = "UnparsedSource"; + SyntaxKind5[SyntaxKind5["InputFiles"] = 315] = "InputFiles"; + SyntaxKind5[SyntaxKind5["JSDocTypeExpression"] = 316] = "JSDocTypeExpression"; + SyntaxKind5[SyntaxKind5["JSDocNameReference"] = 317] = "JSDocNameReference"; + SyntaxKind5[SyntaxKind5["JSDocMemberName"] = 318] = "JSDocMemberName"; + SyntaxKind5[SyntaxKind5["JSDocAllType"] = 319] = "JSDocAllType"; + SyntaxKind5[SyntaxKind5["JSDocUnknownType"] = 320] = "JSDocUnknownType"; + SyntaxKind5[SyntaxKind5["JSDocNullableType"] = 321] = "JSDocNullableType"; + SyntaxKind5[SyntaxKind5["JSDocNonNullableType"] = 322] = "JSDocNonNullableType"; + SyntaxKind5[SyntaxKind5["JSDocOptionalType"] = 323] = "JSDocOptionalType"; + SyntaxKind5[SyntaxKind5["JSDocFunctionType"] = 324] = "JSDocFunctionType"; + SyntaxKind5[SyntaxKind5["JSDocVariadicType"] = 325] = "JSDocVariadicType"; + SyntaxKind5[SyntaxKind5["JSDocNamepathType"] = 326] = "JSDocNamepathType"; + SyntaxKind5[SyntaxKind5["JSDoc"] = 327] = "JSDoc"; + SyntaxKind5[SyntaxKind5["JSDocComment"] = 327 /* JSDoc */] = "JSDocComment"; + SyntaxKind5[SyntaxKind5["JSDocText"] = 328] = "JSDocText"; + SyntaxKind5[SyntaxKind5["JSDocTypeLiteral"] = 329] = "JSDocTypeLiteral"; + SyntaxKind5[SyntaxKind5["JSDocSignature"] = 330] = "JSDocSignature"; + SyntaxKind5[SyntaxKind5["JSDocLink"] = 331] = "JSDocLink"; + SyntaxKind5[SyntaxKind5["JSDocLinkCode"] = 332] = "JSDocLinkCode"; + SyntaxKind5[SyntaxKind5["JSDocLinkPlain"] = 333] = "JSDocLinkPlain"; + SyntaxKind5[SyntaxKind5["JSDocTag"] = 334] = "JSDocTag"; + SyntaxKind5[SyntaxKind5["JSDocAugmentsTag"] = 335] = "JSDocAugmentsTag"; + SyntaxKind5[SyntaxKind5["JSDocImplementsTag"] = 336] = "JSDocImplementsTag"; + SyntaxKind5[SyntaxKind5["JSDocAuthorTag"] = 337] = "JSDocAuthorTag"; + SyntaxKind5[SyntaxKind5["JSDocDeprecatedTag"] = 338] = "JSDocDeprecatedTag"; + SyntaxKind5[SyntaxKind5["JSDocClassTag"] = 339] = "JSDocClassTag"; + SyntaxKind5[SyntaxKind5["JSDocPublicTag"] = 340] = "JSDocPublicTag"; + SyntaxKind5[SyntaxKind5["JSDocPrivateTag"] = 341] = "JSDocPrivateTag"; + SyntaxKind5[SyntaxKind5["JSDocProtectedTag"] = 342] = "JSDocProtectedTag"; + SyntaxKind5[SyntaxKind5["JSDocReadonlyTag"] = 343] = "JSDocReadonlyTag"; + SyntaxKind5[SyntaxKind5["JSDocOverrideTag"] = 344] = "JSDocOverrideTag"; + SyntaxKind5[SyntaxKind5["JSDocCallbackTag"] = 345] = "JSDocCallbackTag"; + SyntaxKind5[SyntaxKind5["JSDocOverloadTag"] = 346] = "JSDocOverloadTag"; + SyntaxKind5[SyntaxKind5["JSDocEnumTag"] = 347] = "JSDocEnumTag"; + SyntaxKind5[SyntaxKind5["JSDocParameterTag"] = 348] = "JSDocParameterTag"; + SyntaxKind5[SyntaxKind5["JSDocReturnTag"] = 349] = "JSDocReturnTag"; + SyntaxKind5[SyntaxKind5["JSDocThisTag"] = 350] = "JSDocThisTag"; + SyntaxKind5[SyntaxKind5["JSDocTypeTag"] = 351] = "JSDocTypeTag"; + SyntaxKind5[SyntaxKind5["JSDocTemplateTag"] = 352] = "JSDocTemplateTag"; + SyntaxKind5[SyntaxKind5["JSDocTypedefTag"] = 353] = "JSDocTypedefTag"; + SyntaxKind5[SyntaxKind5["JSDocSeeTag"] = 354] = "JSDocSeeTag"; + SyntaxKind5[SyntaxKind5["JSDocPropertyTag"] = 355] = "JSDocPropertyTag"; + SyntaxKind5[SyntaxKind5["JSDocThrowsTag"] = 356] = "JSDocThrowsTag"; + SyntaxKind5[SyntaxKind5["JSDocSatisfiesTag"] = 357] = "JSDocSatisfiesTag"; + SyntaxKind5[SyntaxKind5["SyntaxList"] = 358] = "SyntaxList"; + SyntaxKind5[SyntaxKind5["NotEmittedStatement"] = 359] = "NotEmittedStatement"; + SyntaxKind5[SyntaxKind5["PartiallyEmittedExpression"] = 360] = "PartiallyEmittedExpression"; + SyntaxKind5[SyntaxKind5["CommaListExpression"] = 361] = "CommaListExpression"; + SyntaxKind5[SyntaxKind5["SyntheticReferenceExpression"] = 362] = "SyntheticReferenceExpression"; + SyntaxKind5[SyntaxKind5["Count"] = 363] = "Count"; SyntaxKind5[SyntaxKind5["FirstAssignment"] = 64 /* EqualsToken */] = "FirstAssignment"; SyntaxKind5[SyntaxKind5["LastAssignment"] = 79 /* CaretEqualsToken */] = "LastAssignment"; SyntaxKind5[SyntaxKind5["FirstCompoundAssignment"] = 65 /* PlusEqualsToken */] = "FirstCompoundAssignment"; @@ -3895,15 +3905,15 @@ ${lanes.join("\n")} SyntaxKind5[SyntaxKind5["FirstReservedWord"] = 83 /* BreakKeyword */] = "FirstReservedWord"; SyntaxKind5[SyntaxKind5["LastReservedWord"] = 118 /* WithKeyword */] = "LastReservedWord"; SyntaxKind5[SyntaxKind5["FirstKeyword"] = 83 /* BreakKeyword */] = "FirstKeyword"; - SyntaxKind5[SyntaxKind5["LastKeyword"] = 164 /* OfKeyword */] = "LastKeyword"; + SyntaxKind5[SyntaxKind5["LastKeyword"] = 165 /* OfKeyword */] = "LastKeyword"; SyntaxKind5[SyntaxKind5["FirstFutureReservedWord"] = 119 /* ImplementsKeyword */] = "FirstFutureReservedWord"; SyntaxKind5[SyntaxKind5["LastFutureReservedWord"] = 127 /* YieldKeyword */] = "LastFutureReservedWord"; - SyntaxKind5[SyntaxKind5["FirstTypeNode"] = 181 /* TypePredicate */] = "FirstTypeNode"; - SyntaxKind5[SyntaxKind5["LastTypeNode"] = 204 /* ImportType */] = "LastTypeNode"; + SyntaxKind5[SyntaxKind5["FirstTypeNode"] = 182 /* TypePredicate */] = "FirstTypeNode"; + SyntaxKind5[SyntaxKind5["LastTypeNode"] = 205 /* ImportType */] = "LastTypeNode"; SyntaxKind5[SyntaxKind5["FirstPunctuation"] = 19 /* OpenBraceToken */] = "FirstPunctuation"; SyntaxKind5[SyntaxKind5["LastPunctuation"] = 79 /* CaretEqualsToken */] = "LastPunctuation"; SyntaxKind5[SyntaxKind5["FirstToken"] = 0 /* Unknown */] = "FirstToken"; - SyntaxKind5[SyntaxKind5["LastToken"] = 164 /* LastKeyword */] = "LastToken"; + SyntaxKind5[SyntaxKind5["LastToken"] = 165 /* LastKeyword */] = "LastToken"; SyntaxKind5[SyntaxKind5["FirstTriviaToken"] = 2 /* SingleLineCommentTrivia */] = "FirstTriviaToken"; SyntaxKind5[SyntaxKind5["LastTriviaToken"] = 7 /* ConflictMarkerTrivia */] = "LastTriviaToken"; SyntaxKind5[SyntaxKind5["FirstLiteralToken"] = 9 /* NumericLiteral */] = "FirstLiteralToken"; @@ -3912,56 +3922,59 @@ ${lanes.join("\n")} SyntaxKind5[SyntaxKind5["LastTemplateToken"] = 18 /* TemplateTail */] = "LastTemplateToken"; SyntaxKind5[SyntaxKind5["FirstBinaryOperator"] = 30 /* LessThanToken */] = "FirstBinaryOperator"; SyntaxKind5[SyntaxKind5["LastBinaryOperator"] = 79 /* CaretEqualsToken */] = "LastBinaryOperator"; - SyntaxKind5[SyntaxKind5["FirstStatement"] = 242 /* VariableStatement */] = "FirstStatement"; - SyntaxKind5[SyntaxKind5["LastStatement"] = 258 /* DebuggerStatement */] = "LastStatement"; - SyntaxKind5[SyntaxKind5["FirstNode"] = 165 /* QualifiedName */] = "FirstNode"; - SyntaxKind5[SyntaxKind5["FirstJSDocNode"] = 315 /* JSDocTypeExpression */] = "FirstJSDocNode"; - SyntaxKind5[SyntaxKind5["LastJSDocNode"] = 356 /* JSDocSatisfiesTag */] = "LastJSDocNode"; - SyntaxKind5[SyntaxKind5["FirstJSDocTagNode"] = 333 /* JSDocTag */] = "FirstJSDocTagNode"; - SyntaxKind5[SyntaxKind5["LastJSDocTagNode"] = 356 /* JSDocSatisfiesTag */] = "LastJSDocTagNode"; + SyntaxKind5[SyntaxKind5["FirstStatement"] = 243 /* VariableStatement */] = "FirstStatement"; + SyntaxKind5[SyntaxKind5["LastStatement"] = 259 /* DebuggerStatement */] = "LastStatement"; + SyntaxKind5[SyntaxKind5["FirstNode"] = 166 /* QualifiedName */] = "FirstNode"; + SyntaxKind5[SyntaxKind5["FirstJSDocNode"] = 316 /* JSDocTypeExpression */] = "FirstJSDocNode"; + SyntaxKind5[SyntaxKind5["LastJSDocNode"] = 357 /* JSDocSatisfiesTag */] = "LastJSDocNode"; + SyntaxKind5[SyntaxKind5["FirstJSDocTagNode"] = 334 /* JSDocTag */] = "FirstJSDocTagNode"; + SyntaxKind5[SyntaxKind5["LastJSDocTagNode"] = 357 /* JSDocSatisfiesTag */] = "LastJSDocTagNode"; SyntaxKind5[SyntaxKind5["FirstContextualKeyword"] = 128 /* AbstractKeyword */] = "FirstContextualKeyword"; - SyntaxKind5[SyntaxKind5["LastContextualKeyword"] = 164 /* OfKeyword */] = "LastContextualKeyword"; + SyntaxKind5[SyntaxKind5["LastContextualKeyword"] = 165 /* OfKeyword */] = "LastContextualKeyword"; return SyntaxKind5; })(SyntaxKind || {}); NodeFlags = /* @__PURE__ */ ((NodeFlags3) => { NodeFlags3[NodeFlags3["None"] = 0] = "None"; NodeFlags3[NodeFlags3["Let"] = 1] = "Let"; NodeFlags3[NodeFlags3["Const"] = 2] = "Const"; - NodeFlags3[NodeFlags3["NestedNamespace"] = 4] = "NestedNamespace"; - NodeFlags3[NodeFlags3["Synthesized"] = 8] = "Synthesized"; - NodeFlags3[NodeFlags3["Namespace"] = 16] = "Namespace"; - NodeFlags3[NodeFlags3["OptionalChain"] = 32] = "OptionalChain"; - NodeFlags3[NodeFlags3["ExportContext"] = 64] = "ExportContext"; - NodeFlags3[NodeFlags3["ContainsThis"] = 128] = "ContainsThis"; - NodeFlags3[NodeFlags3["HasImplicitReturn"] = 256] = "HasImplicitReturn"; - NodeFlags3[NodeFlags3["HasExplicitReturn"] = 512] = "HasExplicitReturn"; - NodeFlags3[NodeFlags3["GlobalAugmentation"] = 1024] = "GlobalAugmentation"; - NodeFlags3[NodeFlags3["HasAsyncFunctions"] = 2048] = "HasAsyncFunctions"; - NodeFlags3[NodeFlags3["DisallowInContext"] = 4096] = "DisallowInContext"; - NodeFlags3[NodeFlags3["YieldContext"] = 8192] = "YieldContext"; - NodeFlags3[NodeFlags3["DecoratorContext"] = 16384] = "DecoratorContext"; - NodeFlags3[NodeFlags3["AwaitContext"] = 32768] = "AwaitContext"; - NodeFlags3[NodeFlags3["DisallowConditionalTypesContext"] = 65536] = "DisallowConditionalTypesContext"; - NodeFlags3[NodeFlags3["ThisNodeHasError"] = 131072] = "ThisNodeHasError"; - NodeFlags3[NodeFlags3["JavaScriptFile"] = 262144] = "JavaScriptFile"; - NodeFlags3[NodeFlags3["ThisNodeOrAnySubNodesHasError"] = 524288] = "ThisNodeOrAnySubNodesHasError"; - NodeFlags3[NodeFlags3["HasAggregatedChildData"] = 1048576] = "HasAggregatedChildData"; - NodeFlags3[NodeFlags3["PossiblyContainsDynamicImport"] = 2097152] = "PossiblyContainsDynamicImport"; - NodeFlags3[NodeFlags3["PossiblyContainsImportMeta"] = 4194304] = "PossiblyContainsImportMeta"; - NodeFlags3[NodeFlags3["JSDoc"] = 8388608] = "JSDoc"; - NodeFlags3[NodeFlags3["Ambient"] = 16777216] = "Ambient"; - NodeFlags3[NodeFlags3["InWithStatement"] = 33554432] = "InWithStatement"; - NodeFlags3[NodeFlags3["JsonFile"] = 67108864] = "JsonFile"; - NodeFlags3[NodeFlags3["TypeCached"] = 134217728] = "TypeCached"; - NodeFlags3[NodeFlags3["Deprecated"] = 268435456] = "Deprecated"; - NodeFlags3[NodeFlags3["BlockScoped"] = 3] = "BlockScoped"; - NodeFlags3[NodeFlags3["ReachabilityCheckFlags"] = 768] = "ReachabilityCheckFlags"; - NodeFlags3[NodeFlags3["ReachabilityAndEmitFlags"] = 2816] = "ReachabilityAndEmitFlags"; - NodeFlags3[NodeFlags3["ContextFlags"] = 50720768] = "ContextFlags"; - NodeFlags3[NodeFlags3["TypeExcludesFlags"] = 40960] = "TypeExcludesFlags"; - NodeFlags3[NodeFlags3["PermanentlySetIncrementalFlags"] = 6291456] = "PermanentlySetIncrementalFlags"; - NodeFlags3[NodeFlags3["IdentifierHasExtendedUnicodeEscape"] = 128 /* ContainsThis */] = "IdentifierHasExtendedUnicodeEscape"; - NodeFlags3[NodeFlags3["IdentifierIsInJSDocNamespace"] = 2048 /* HasAsyncFunctions */] = "IdentifierIsInJSDocNamespace"; + NodeFlags3[NodeFlags3["Using"] = 4] = "Using"; + NodeFlags3[NodeFlags3["AwaitUsing"] = 6] = "AwaitUsing"; + NodeFlags3[NodeFlags3["NestedNamespace"] = 8] = "NestedNamespace"; + NodeFlags3[NodeFlags3["Synthesized"] = 16] = "Synthesized"; + NodeFlags3[NodeFlags3["Namespace"] = 32] = "Namespace"; + NodeFlags3[NodeFlags3["OptionalChain"] = 64] = "OptionalChain"; + NodeFlags3[NodeFlags3["ExportContext"] = 128] = "ExportContext"; + NodeFlags3[NodeFlags3["ContainsThis"] = 256] = "ContainsThis"; + NodeFlags3[NodeFlags3["HasImplicitReturn"] = 512] = "HasImplicitReturn"; + NodeFlags3[NodeFlags3["HasExplicitReturn"] = 1024] = "HasExplicitReturn"; + NodeFlags3[NodeFlags3["GlobalAugmentation"] = 2048] = "GlobalAugmentation"; + NodeFlags3[NodeFlags3["HasAsyncFunctions"] = 4096] = "HasAsyncFunctions"; + NodeFlags3[NodeFlags3["DisallowInContext"] = 8192] = "DisallowInContext"; + NodeFlags3[NodeFlags3["YieldContext"] = 16384] = "YieldContext"; + NodeFlags3[NodeFlags3["DecoratorContext"] = 32768] = "DecoratorContext"; + NodeFlags3[NodeFlags3["AwaitContext"] = 65536] = "AwaitContext"; + NodeFlags3[NodeFlags3["DisallowConditionalTypesContext"] = 131072] = "DisallowConditionalTypesContext"; + NodeFlags3[NodeFlags3["ThisNodeHasError"] = 262144] = "ThisNodeHasError"; + NodeFlags3[NodeFlags3["JavaScriptFile"] = 524288] = "JavaScriptFile"; + NodeFlags3[NodeFlags3["ThisNodeOrAnySubNodesHasError"] = 1048576] = "ThisNodeOrAnySubNodesHasError"; + NodeFlags3[NodeFlags3["HasAggregatedChildData"] = 2097152] = "HasAggregatedChildData"; + NodeFlags3[NodeFlags3["PossiblyContainsDynamicImport"] = 4194304] = "PossiblyContainsDynamicImport"; + NodeFlags3[NodeFlags3["PossiblyContainsImportMeta"] = 8388608] = "PossiblyContainsImportMeta"; + NodeFlags3[NodeFlags3["JSDoc"] = 16777216] = "JSDoc"; + NodeFlags3[NodeFlags3["Ambient"] = 33554432] = "Ambient"; + NodeFlags3[NodeFlags3["InWithStatement"] = 67108864] = "InWithStatement"; + NodeFlags3[NodeFlags3["JsonFile"] = 134217728] = "JsonFile"; + NodeFlags3[NodeFlags3["TypeCached"] = 268435456] = "TypeCached"; + NodeFlags3[NodeFlags3["Deprecated"] = 536870912] = "Deprecated"; + NodeFlags3[NodeFlags3["BlockScoped"] = 7] = "BlockScoped"; + NodeFlags3[NodeFlags3["Constant"] = 6] = "Constant"; + NodeFlags3[NodeFlags3["ReachabilityCheckFlags"] = 1536] = "ReachabilityCheckFlags"; + NodeFlags3[NodeFlags3["ReachabilityAndEmitFlags"] = 5632] = "ReachabilityAndEmitFlags"; + NodeFlags3[NodeFlags3["ContextFlags"] = 101441536] = "ContextFlags"; + NodeFlags3[NodeFlags3["TypeExcludesFlags"] = 81920] = "TypeExcludesFlags"; + NodeFlags3[NodeFlags3["PermanentlySetIncrementalFlags"] = 12582912] = "PermanentlySetIncrementalFlags"; + NodeFlags3[NodeFlags3["IdentifierHasExtendedUnicodeEscape"] = 256 /* ContainsThis */] = "IdentifierHasExtendedUnicodeEscape"; + NodeFlags3[NodeFlags3["IdentifierIsInJSDocNamespace"] = 4096 /* HasAsyncFunctions */] = "IdentifierIsInJSDocNamespace"; return NodeFlags3; })(NodeFlags || {}); ModifierFlags = /* @__PURE__ */ ((ModifierFlags3) => { @@ -4374,15 +4387,13 @@ ${lanes.join("\n")} NodeCheckFlags2[NodeCheckFlags2["ContainsCapturedBlockScopeBinding"] = 8192] = "ContainsCapturedBlockScopeBinding"; NodeCheckFlags2[NodeCheckFlags2["CapturedBlockScopedBinding"] = 16384] = "CapturedBlockScopedBinding"; NodeCheckFlags2[NodeCheckFlags2["BlockScopedBindingInLoop"] = 32768] = "BlockScopedBindingInLoop"; - NodeCheckFlags2[NodeCheckFlags2["ClassWithBodyScopedClassBinding"] = 65536] = "ClassWithBodyScopedClassBinding"; - NodeCheckFlags2[NodeCheckFlags2["BodyScopedClassBinding"] = 131072] = "BodyScopedClassBinding"; - NodeCheckFlags2[NodeCheckFlags2["NeedsLoopOutParameter"] = 262144] = "NeedsLoopOutParameter"; - NodeCheckFlags2[NodeCheckFlags2["AssignmentsMarked"] = 524288] = "AssignmentsMarked"; - NodeCheckFlags2[NodeCheckFlags2["ClassWithConstructorReference"] = 1048576] = "ClassWithConstructorReference"; - NodeCheckFlags2[NodeCheckFlags2["ConstructorReferenceInClass"] = 2097152] = "ConstructorReferenceInClass"; - NodeCheckFlags2[NodeCheckFlags2["ContainsClassWithPrivateIdentifiers"] = 4194304] = "ContainsClassWithPrivateIdentifiers"; - NodeCheckFlags2[NodeCheckFlags2["ContainsSuperPropertyInStaticInitializer"] = 8388608] = "ContainsSuperPropertyInStaticInitializer"; - NodeCheckFlags2[NodeCheckFlags2["InCheckIdentifier"] = 16777216] = "InCheckIdentifier"; + NodeCheckFlags2[NodeCheckFlags2["NeedsLoopOutParameter"] = 65536] = "NeedsLoopOutParameter"; + NodeCheckFlags2[NodeCheckFlags2["AssignmentsMarked"] = 131072] = "AssignmentsMarked"; + NodeCheckFlags2[NodeCheckFlags2["ContainsConstructorReference"] = 262144] = "ContainsConstructorReference"; + NodeCheckFlags2[NodeCheckFlags2["ConstructorReference"] = 536870912] = "ConstructorReference"; + NodeCheckFlags2[NodeCheckFlags2["ContainsClassWithPrivateIdentifiers"] = 1048576] = "ContainsClassWithPrivateIdentifiers"; + NodeCheckFlags2[NodeCheckFlags2["ContainsSuperPropertyInStaticInitializer"] = 2097152] = "ContainsSuperPropertyInStaticInitializer"; + NodeCheckFlags2[NodeCheckFlags2["InCheckIdentifier"] = 4194304] = "InCheckIdentifier"; return NodeCheckFlags2; })(NodeCheckFlags || {}); TypeFlags = /* @__PURE__ */ ((TypeFlags2) => { @@ -4563,7 +4574,8 @@ ${lanes.join("\n")} SignatureFlags5[SignatureFlags5["IsOuterCallChain"] = 16] = "IsOuterCallChain"; SignatureFlags5[SignatureFlags5["IsUntypedSignatureInJSFile"] = 32] = "IsUntypedSignatureInJSFile"; SignatureFlags5[SignatureFlags5["IsNonInferrable"] = 64] = "IsNonInferrable"; - SignatureFlags5[SignatureFlags5["PropagatingFlags"] = 39] = "PropagatingFlags"; + SignatureFlags5[SignatureFlags5["IsSignatureCandidateForOverloadFailure"] = 128] = "IsSignatureCandidateForOverloadFailure"; + SignatureFlags5[SignatureFlags5["PropagatingFlags"] = 167] = "PropagatingFlags"; SignatureFlags5[SignatureFlags5["CallChainFlags"] = 24] = "CallChainFlags"; return SignatureFlags5; })(SignatureFlags || {}); @@ -4705,16 +4717,16 @@ ${lanes.join("\n")} NewLineKind2[NewLineKind2["LineFeed"] = 1] = "LineFeed"; return NewLineKind2; })(NewLineKind || {}); - ScriptKind = /* @__PURE__ */ ((ScriptKind5) => { - ScriptKind5[ScriptKind5["Unknown"] = 0] = "Unknown"; - ScriptKind5[ScriptKind5["JS"] = 1] = "JS"; - ScriptKind5[ScriptKind5["JSX"] = 2] = "JSX"; - ScriptKind5[ScriptKind5["TS"] = 3] = "TS"; - ScriptKind5[ScriptKind5["TSX"] = 4] = "TSX"; - ScriptKind5[ScriptKind5["External"] = 5] = "External"; - ScriptKind5[ScriptKind5["JSON"] = 6] = "JSON"; - ScriptKind5[ScriptKind5["Deferred"] = 7] = "Deferred"; - return ScriptKind5; + ScriptKind = /* @__PURE__ */ ((ScriptKind6) => { + ScriptKind6[ScriptKind6["Unknown"] = 0] = "Unknown"; + ScriptKind6[ScriptKind6["JS"] = 1] = "JS"; + ScriptKind6[ScriptKind6["JSX"] = 2] = "JSX"; + ScriptKind6[ScriptKind6["TS"] = 3] = "TS"; + ScriptKind6[ScriptKind6["TSX"] = 4] = "TSX"; + ScriptKind6[ScriptKind6["External"] = 5] = "External"; + ScriptKind6[ScriptKind6["JSON"] = 6] = "JSON"; + ScriptKind6[ScriptKind6["Deferred"] = 7] = "Deferred"; + return ScriptKind6; })(ScriptKind || {}); ScriptTarget = /* @__PURE__ */ ((ScriptTarget10) => { ScriptTarget10[ScriptTarget10["ES3"] = 0] = "ES3"; @@ -5029,8 +5041,9 @@ ${lanes.join("\n")} ExternalEmitHelpers2[ExternalEmitHelpers2["CreateBinding"] = 4194304] = "CreateBinding"; ExternalEmitHelpers2[ExternalEmitHelpers2["SetFunctionName"] = 8388608] = "SetFunctionName"; ExternalEmitHelpers2[ExternalEmitHelpers2["PropKey"] = 16777216] = "PropKey"; + ExternalEmitHelpers2[ExternalEmitHelpers2["AddDisposableResourceAndDisposeResources"] = 33554432] = "AddDisposableResourceAndDisposeResources"; ExternalEmitHelpers2[ExternalEmitHelpers2["FirstEmitHelper"] = 1 /* Extends */] = "FirstEmitHelper"; - ExternalEmitHelpers2[ExternalEmitHelpers2["LastEmitHelper"] = 16777216 /* PropKey */] = "LastEmitHelper"; + ExternalEmitHelpers2[ExternalEmitHelpers2["LastEmitHelper"] = 33554432 /* AddDisposableResourceAndDisposeResources */] = "LastEmitHelper"; ExternalEmitHelpers2[ExternalEmitHelpers2["ForOfIncludes"] = 256 /* Values */] = "ForOfIncludes"; ExternalEmitHelpers2[ExternalEmitHelpers2["ForAwaitOfIncludes"] = 16384 /* AsyncValues */] = "ForAwaitOfIncludes"; ExternalEmitHelpers2[ExternalEmitHelpers2["AsyncGeneratorIncludes"] = 6144] = "AsyncGeneratorIncludes"; @@ -5411,10 +5424,10 @@ ${lanes.join("\n")} pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === 250 /* Low */ ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingInterval === 250 /* Low */ ? "pollLowPollingIntervalQueue" : "pollPollingIntervalQueue", pollingIntervalQueue(pollingInterval)); } } - function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) { + function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2) { const fileWatcherCallbacks = createMultiMap(); const dirWatchers = /* @__PURE__ */ new Map(); - const toCanonicalName = createGetCanonicalFileName(useCaseSensitiveFileNames); + const toCanonicalName = createGetCanonicalFileName(useCaseSensitiveFileNames2); return nonPollingWatchFile; function nonPollingWatchFile(fileName, callback, _pollingInterval, fallbackOptions) { const filePath = toCanonicalName(fileName); @@ -5490,8 +5503,8 @@ ${lanes.join("\n")} pollScheduled = host.setTimeout(pollQueue, 2e3 /* High */, "pollQueue"); } } - function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) { - const toCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames); + function createSingleWatcherPerName(cache, useCaseSensitiveFileNames2, name, callback, createWatcher) { + const toCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames2); const path = toCanonicalFileName(name); const existing = cache.get(path); if (existing) { @@ -5541,7 +5554,7 @@ ${lanes.join("\n")} } function createDirectoryWatcherSupportingRecursive({ watchDirectory, - useCaseSensitiveFileNames, + useCaseSensitiveFileNames: useCaseSensitiveFileNames2, getCurrentDirectory, getAccessibleSortedChildDirectories, fileSystemEntryExists, @@ -5553,8 +5566,8 @@ ${lanes.join("\n")} const callbackCache = createMultiMap(); const cacheToUpdateChildWatches = /* @__PURE__ */ new Map(); let timerToUpdateChildWatches; - const filePathComparer = getStringComparer(!useCaseSensitiveFileNames); - const toCanonicalFilePath = createGetCanonicalFileName(useCaseSensitiveFileNames); + const filePathComparer = getStringComparer(!useCaseSensitiveFileNames2); + const toCanonicalFilePath = createGetCanonicalFileName(useCaseSensitiveFileNames2); return (dirName, callback, recursive, options) => recursive ? createDirectoryWatcher(dirName, options, callback) : watchDirectory(dirName, callback, recursive, options); function createDirectoryWatcher(dirName, options, callback) { const dirPath = toCanonicalFilePath(dirName); @@ -5721,12 +5734,12 @@ ${lanes.join("\n")} } } function isIgnoredPath(path, options) { - return some(ignoredPaths, (searchPath) => isInPath(path, searchPath)) || isIgnoredByWatchOptions(path, options, useCaseSensitiveFileNames, getCurrentDirectory); + return some(ignoredPaths, (searchPath) => isInPath(path, searchPath)) || isIgnoredByWatchOptions(path, options, useCaseSensitiveFileNames2, getCurrentDirectory); } function isInPath(path, searchPath) { if (stringContains(path, searchPath)) return true; - if (useCaseSensitiveFileNames) + if (useCaseSensitiveFileNames2) return false; return stringContains(toCanonicalFilePath(path), searchPath); } @@ -5744,14 +5757,14 @@ ${lanes.join("\n")} } }; } - function isIgnoredByWatchOptions(pathToCheck, options, useCaseSensitiveFileNames, getCurrentDirectory) { - return ((options == null ? void 0 : options.excludeDirectories) || (options == null ? void 0 : options.excludeFiles)) && (matchesExclude(pathToCheck, options == null ? void 0 : options.excludeFiles, useCaseSensitiveFileNames, getCurrentDirectory()) || matchesExclude(pathToCheck, options == null ? void 0 : options.excludeDirectories, useCaseSensitiveFileNames, getCurrentDirectory())); + function isIgnoredByWatchOptions(pathToCheck, options, useCaseSensitiveFileNames2, getCurrentDirectory) { + return ((options == null ? void 0 : options.excludeDirectories) || (options == null ? void 0 : options.excludeFiles)) && (matchesExclude(pathToCheck, options == null ? void 0 : options.excludeFiles, useCaseSensitiveFileNames2, getCurrentDirectory()) || matchesExclude(pathToCheck, options == null ? void 0 : options.excludeDirectories, useCaseSensitiveFileNames2, getCurrentDirectory())); } - function createFsWatchCallbackForDirectoryWatcherCallback(directoryName, callback, options, useCaseSensitiveFileNames, getCurrentDirectory) { + function createFsWatchCallbackForDirectoryWatcherCallback(directoryName, callback, options, useCaseSensitiveFileNames2, getCurrentDirectory) { return (eventName, relativeFileName) => { if (eventName === "rename") { const fileName = !relativeFileName ? directoryName : normalizePath(combinePaths(directoryName, relativeFileName)); - if (!relativeFileName || !isIgnoredByWatchOptions(fileName, options, useCaseSensitiveFileNames, getCurrentDirectory)) { + if (!relativeFileName || !isIgnoredByWatchOptions(fileName, options, useCaseSensitiveFileNames2, getCurrentDirectory)) { callback(fileName); } } @@ -5764,7 +5777,7 @@ ${lanes.join("\n")} clearTimeout: clearTimeout2, fsWatchWorker, fileSystemEntryExists, - useCaseSensitiveFileNames, + useCaseSensitiveFileNames: useCaseSensitiveFileNames2, getCurrentDirectory, fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories, @@ -5836,7 +5849,7 @@ ${lanes.join("\n")} ); case 5 /* UseFsEventsOnParentDirectory */: if (!nonPollingWatchFile) { - nonPollingWatchFile = createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames); + nonPollingWatchFile = createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2); } return nonPollingWatchFile(fileName, callback, pollingInterval, getFallbackOptions(options)); default: @@ -5885,7 +5898,7 @@ ${lanes.join("\n")} return fsWatch( directoryName, 1 /* Directory */, - createFsWatchCallbackForDirectoryWatcherCallback(directoryName, callback, options, useCaseSensitiveFileNames, getCurrentDirectory), + createFsWatchCallbackForDirectoryWatcherCallback(directoryName, callback, options, useCaseSensitiveFileNames2, getCurrentDirectory), recursive, 500 /* Medium */, getFallbackOptions(options) @@ -5893,7 +5906,7 @@ ${lanes.join("\n")} } if (!hostRecursiveDirectoryWatcher) { hostRecursiveDirectoryWatcher = createDirectoryWatcherSupportingRecursive({ - useCaseSensitiveFileNames, + useCaseSensitiveFileNames: useCaseSensitiveFileNames2, getCurrentDirectory, fileSystemEntryExists, getAccessibleSortedChildDirectories, @@ -5939,7 +5952,7 @@ ${lanes.join("\n")} return fsWatch( directoryName, 1 /* Directory */, - createFsWatchCallbackForDirectoryWatcherCallback(directoryName, callback, options, useCaseSensitiveFileNames, getCurrentDirectory), + createFsWatchCallbackForDirectoryWatcherCallback(directoryName, callback, options, useCaseSensitiveFileNames2, getCurrentDirectory), recursive, 500 /* Medium */, getFallbackOptions(watchDirectoryOptions) @@ -5967,7 +5980,7 @@ ${lanes.join("\n")} function pollingWatchFile(fileName, callback, pollingInterval, options) { return createSingleWatcherPerName( pollingWatches, - useCaseSensitiveFileNames, + useCaseSensitiveFileNames2, fileName, callback, (cb) => pollingWatchFileWorker(fileName, cb, pollingInterval, options) @@ -5976,7 +5989,7 @@ ${lanes.join("\n")} function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) { return createSingleWatcherPerName( recursive ? fsWatchesRecursive : fsWatches, - useCaseSensitiveFileNames, + useCaseSensitiveFileNames2, fileOrDirectory, callback, (cb) => fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, cb, recursive, fallbackPollingInterval, fallbackOptions) @@ -6135,7 +6148,7 @@ ${lanes.join("\n")} const Buffer2 = require("buffer").Buffer; const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin"; const platform = _os.platform(); - const useCaseSensitiveFileNames = isFileSystemCaseSensitive(); + const useCaseSensitiveFileNames2 = isFileSystemCaseSensitive(); const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync; const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename; const fsSupportsRecursiveFsWatch = process.platform === "win32" || process.platform === "darwin"; @@ -6146,7 +6159,7 @@ ${lanes.join("\n")} setTimeout, clearTimeout, fsWatchWorker, - useCaseSensitiveFileNames, + useCaseSensitiveFileNames: useCaseSensitiveFileNames2, getCurrentDirectory, fileSystemEntryExists, // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows @@ -6163,7 +6176,7 @@ ${lanes.join("\n")} const nodeSystem = { args: process.argv.slice(2), newLine: _os.EOL, - useCaseSensitiveFileNames, + useCaseSensitiveFileNames: useCaseSensitiveFileNames2, write(s) { process.stdout.write(s); }, @@ -6228,7 +6241,7 @@ ${lanes.join("\n")} disableCPUProfiler, cpuProfilingEnabled: () => !!activeSession || contains(process.execArgv, "--cpu-prof") || contains(process.execArgv, "--prof"), realpath, - debugMode: !!process.env.NODE_INSPECTOR_IPC || !!process.env.VSCODE_INSPECTOR_OPTIONS || some(process.execArgv, (arg) => /^--(inspect|debug)(-brk)?(=\d+)?$/i.test(arg)), + debugMode: !!process.env.NODE_INSPECTOR_IPC || !!process.env.VSCODE_INSPECTOR_OPTIONS || some(process.execArgv, (arg) => /^--(inspect|debug)(-brk)?(=\d+)?$/i.test(arg)) || !!process.recordreplay, tryEnableSourceMapsForHost() { try { require("source-map-support").install(); @@ -6254,8 +6267,8 @@ ${lanes.join("\n")} try { const modulePath = resolveJSModule(moduleName, baseDir, nodeSystem); return { module: require(modulePath), modulePath, error: void 0 }; - } catch (error) { - return { module: void 0, modulePath: void 0, error }; + } catch (error2) { + return { module: void 0, modulePath: void 0, error: error2 }; } } }; @@ -6292,12 +6305,12 @@ ${lanes.join("\n")} for (const node of profile.nodes) { if (node.callFrame.url) { const url = normalizeSlashes(node.callFrame.url); - if (containsPath(fileUrlRoot, url, useCaseSensitiveFileNames)) { + if (containsPath(fileUrlRoot, url, useCaseSensitiveFileNames2)) { node.callFrame.url = getRelativePathToDirectoryOrUrl( fileUrlRoot, url, fileUrlRoot, - createGetCanonicalFileName(useCaseSensitiveFileNames), + createGetCanonicalFileName(useCaseSensitiveFileNames2), /*isAbsolutePathAnUrl*/ true ); @@ -6477,7 +6490,7 @@ ${lanes.join("\n")} } } function readDirectory(path, extensions, excludes, includes, depth) { - return matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), depth, getAccessibleFileSystemEntries, realpath); + return matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames2, process.cwd(), depth, getAccessibleFileSystemEntries, realpath); } function fileSystemEntryExists(path, entryKind) { const originalStackTraceLimit = Error.stackTraceLimit; @@ -7053,6 +7066,7 @@ ${lanes.join("\n")} Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: diag(1062, 1 /* Error */, "Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062", "Type is referenced directly or indirectly in the fulfillment callback of its own 'then' method."), An_export_assignment_cannot_be_used_in_a_namespace: diag(1063, 1 /* Error */, "An_export_assignment_cannot_be_used_in_a_namespace_1063", "An export assignment cannot be used in a namespace."), The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0: diag(1064, 1 /* Error */, "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_wri_1064", "The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise<{0}>'?"), + The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type: diag(1065, 1 /* Error */, "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1065", "The return type of an async function or method must be the global Promise type."), In_ambient_enum_declarations_member_initializer_must_be_constant_expression: diag(1066, 1 /* Error */, "In_ambient_enum_declarations_member_initializer_must_be_constant_expression_1066", "In ambient enum declarations member initializer must be constant expression."), Unexpected_token_A_constructor_method_accessor_or_property_was_expected: diag(1068, 1 /* Error */, "Unexpected_token_A_constructor_method_accessor_or_property_was_expected_1068", "Unexpected token. A constructor, method, accessor, or property was expected."), Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces: diag(1069, 1 /* Error */, "Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces_1069", "Unexpected token. A type parameter name was expected without curly braces."), @@ -7082,6 +7096,7 @@ ${lanes.join("\n")} A_return_statement_can_only_be_used_within_a_function_body: diag(1108, 1 /* Error */, "A_return_statement_can_only_be_used_within_a_function_body_1108", "A 'return' statement can only be used within a function body."), Expression_expected: diag(1109, 1 /* Error */, "Expression_expected_1109", "Expression expected."), Type_expected: diag(1110, 1 /* Error */, "Type_expected_1110", "Type expected."), + Private_field_0_must_be_declared_in_an_enclosing_class: diag(1111, 1 /* Error */, "Private_field_0_must_be_declared_in_an_enclosing_class_1111", "Private field '{0}' must be declared in an enclosing class."), A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: diag(1113, 1 /* Error */, "A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113", "A 'default' clause cannot appear more than once in a 'switch' statement."), Duplicate_label_0: diag(1114, 1 /* Error */, "Duplicate_label_0_1114", "Duplicate label '{0}'."), A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: diag(1115, 1 /* Error */, "A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115", "A 'continue' statement can only jump to a label of an enclosing iteration statement."), @@ -7116,9 +7131,8 @@ ${lanes.join("\n")} Import_declarations_in_a_namespace_cannot_reference_a_module: diag(1147, 1 /* Error */, "Import_declarations_in_a_namespace_cannot_reference_a_module_1147", "Import declarations in a namespace cannot reference a module."), Cannot_use_imports_exports_or_module_augmentations_when_module_is_none: diag(1148, 1 /* Error */, "Cannot_use_imports_exports_or_module_augmentations_when_module_is_none_1148", "Cannot use imports, exports, or module augmentations when '--module' is 'none'."), File_name_0_differs_from_already_included_file_name_1_only_in_casing: diag(1149, 1 /* Error */, "File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149", "File name '{0}' differs from already included file name '{1}' only in casing."), - const_declarations_must_be_initialized: diag(1155, 1 /* Error */, "const_declarations_must_be_initialized_1155", "'const' declarations must be initialized."), - const_declarations_can_only_be_declared_inside_a_block: diag(1156, 1 /* Error */, "const_declarations_can_only_be_declared_inside_a_block_1156", "'const' declarations can only be declared inside a block."), - let_declarations_can_only_be_declared_inside_a_block: diag(1157, 1 /* Error */, "let_declarations_can_only_be_declared_inside_a_block_1157", "'let' declarations can only be declared inside a block."), + _0_declarations_must_be_initialized: diag(1155, 1 /* Error */, "_0_declarations_must_be_initialized_1155", "'{0}' declarations must be initialized."), + _0_declarations_can_only_be_declared_inside_a_block: diag(1156, 1 /* Error */, "_0_declarations_can_only_be_declared_inside_a_block_1156", "'{0}' declarations can only be declared inside a block."), Unterminated_template_literal: diag(1160, 1 /* Error */, "Unterminated_template_literal_1160", "Unterminated template literal."), Unterminated_regular_expression_literal: diag(1161, 1 /* Error */, "Unterminated_regular_expression_literal_1161", "Unterminated regular expression literal."), An_object_member_cannot_be_declared_optional: diag(1162, 1 /* Error */, "An_object_member_cannot_be_declared_optional_1162", "An object member cannot be declared optional."), @@ -7300,8 +7314,6 @@ ${lanes.join("\n")} Class_constructor_may_not_be_a_generator: diag(1368, 1 /* Error */, "Class_constructor_may_not_be_a_generator_1368", "Class constructor may not be a generator."), Did_you_mean_0: diag(1369, 3 /* Message */, "Did_you_mean_0_1369", "Did you mean '{0}'?"), This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error: diag(1371, 1 /* Error */, "This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set__1371", "This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'."), - Convert_to_type_only_import: diag(1373, 3 /* Message */, "Convert_to_type_only_import_1373", "Convert to type-only import"), - Convert_all_imports_not_used_as_a_value_to_type_only_imports: diag(1374, 3 /* Message */, "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374", "Convert all imports not used as a value to type-only imports"), await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(1375, 1 /* Error */, "await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_fi_1375", "'await' expressions are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."), _0_was_imported_here: diag(1376, 3 /* Message */, "_0_was_imported_here_1376", "'{0}' was imported here."), _0_was_exported_here: diag(1377, 3 /* Message */, "_0_was_exported_here_1377", "'{0}' was exported here."), @@ -7405,6 +7417,11 @@ ${lanes.join("\n")} Escape_sequence_0_is_not_allowed: diag(1488, 1 /* Error */, "Escape_sequence_0_is_not_allowed_1488", "Escape sequence '{0}' is not allowed."), Decimals_with_leading_zeros_are_not_allowed: diag(1489, 1 /* Error */, "Decimals_with_leading_zeros_are_not_allowed_1489", "Decimals with leading zeros are not allowed."), File_appears_to_be_binary: diag(1490, 1 /* Error */, "File_appears_to_be_binary_1490", "File appears to be binary."), + _0_modifier_cannot_appear_on_a_using_declaration: diag(1491, 1 /* Error */, "_0_modifier_cannot_appear_on_a_using_declaration_1491", "'{0}' modifier cannot appear on a 'using' declaration."), + _0_declarations_may_not_have_binding_patterns: diag(1492, 1 /* Error */, "_0_declarations_may_not_have_binding_patterns_1492", "'{0}' declarations may not have binding patterns."), + The_left_hand_side_of_a_for_in_statement_cannot_be_a_using_declaration: diag(1493, 1 /* Error */, "The_left_hand_side_of_a_for_in_statement_cannot_be_a_using_declaration_1493", "The left-hand side of a 'for...in' statement cannot be a 'using' declaration."), + The_left_hand_side_of_a_for_in_statement_cannot_be_an_await_using_declaration: diag(1494, 1 /* Error */, "The_left_hand_side_of_a_for_in_statement_cannot_be_an_await_using_declaration_1494", "The left-hand side of a 'for...in' statement cannot be an 'await using' declaration."), + _0_modifier_cannot_appear_on_an_await_using_declaration: diag(1495, 1 /* Error */, "_0_modifier_cannot_appear_on_an_await_using_declaration_1495", "'{0}' modifier cannot appear on an 'await using' declaration."), The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."), The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."), Call_signature_return_types_0_and_1_are_incompatible: diag( @@ -7499,7 +7516,6 @@ ${lanes.join("\n")} This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0: diag(2343, 1 /* Error */, "This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_ve_2343", "This syntax requires an imported helper named '{1}' which does not exist in '{0}'. Consider upgrading your version of '{0}'."), Type_0_does_not_satisfy_the_constraint_1: diag(2344, 1 /* Error */, "Type_0_does_not_satisfy_the_constraint_1_2344", "Type '{0}' does not satisfy the constraint '{1}'."), Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: diag(2345, 1 /* Error */, "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345", "Argument of type '{0}' is not assignable to parameter of type '{1}'."), - Call_target_does_not_contain_any_signatures: diag(2346, 1 /* Error */, "Call_target_does_not_contain_any_signatures_2346", "Call target does not contain any signatures."), Untyped_function_calls_may_not_accept_type_arguments: diag(2347, 1 /* Error */, "Untyped_function_calls_may_not_accept_type_arguments_2347", "Untyped function calls may not accept type arguments."), Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: diag(2348, 1 /* Error */, "Value_of_type_0_is_not_callable_Did_you_mean_to_include_new_2348", "Value of type '{0}' is not callable. Did you mean to include 'new'?"), This_expression_is_not_callable: diag(2349, 1 /* Error */, "This_expression_is_not_callable_2349", "This expression is not callable."), @@ -7951,6 +7967,11 @@ ${lanes.join("\n")} A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_file_0_instead: diag(2846, 1 /* Error */, "A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_f_2846", "A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file '{0}' instead?"), The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression: diag(2848, 1 /* Error */, "The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression_2848", "The right-hand side of an 'instanceof' expression must not be an instantiation expression."), Target_signature_provides_too_few_arguments_Expected_0_or_more_but_got_1: diag(2849, 1 /* Error */, "Target_signature_provides_too_few_arguments_Expected_0_or_more_but_got_1_2849", "Target signature provides too few arguments. Expected {0} or more, but got {1}."), + The_initializer_of_a_using_declaration_must_be_either_an_object_with_a_Symbol_dispose_method_or_be_null_or_undefined: diag(2850, 1 /* Error */, "The_initializer_of_a_using_declaration_must_be_either_an_object_with_a_Symbol_dispose_method_or_be_n_2850", "The initializer of a 'using' declaration must be either an object with a '[Symbol.dispose]()' method, or be 'null' or 'undefined'."), + The_initializer_of_an_await_using_declaration_must_be_either_an_object_with_a_Symbol_asyncDispose_or_Symbol_dispose_method_or_be_null_or_undefined: diag(2851, 1 /* Error */, "The_initializer_of_an_await_using_declaration_must_be_either_an_object_with_a_Symbol_asyncDispose_or_2851", "The initializer of an 'await using' declaration must be either an object with a '[Symbol.asyncDispose]()' or '[Symbol.dispose]()' method, or be 'null' or 'undefined'."), + await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(2852, 1 /* Error */, "await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_2852", "'await using' statements are only allowed within async functions and at the top levels of modules."), + await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(2853, 1 /* Error */, "await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_th_2853", "'await using' statements are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."), + Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(2854, 1 /* Error */, "Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_sys_2854", "Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher."), Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* 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, 1 /* 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, 1 /* 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}'."), @@ -8104,7 +8125,6 @@ ${lanes.join("\n")} Cannot_find_a_tsconfig_json_file_at_the_current_directory_Colon_0: diag(5081, 1 /* Error */, "Cannot_find_a_tsconfig_json_file_at_the_current_directory_Colon_0_5081", "Cannot find a tsconfig.json file at the current directory: {0}."), _0_could_be_instantiated_with_an_arbitrary_type_which_could_be_unrelated_to_1: diag(5082, 1 /* Error */, "_0_could_be_instantiated_with_an_arbitrary_type_which_could_be_unrelated_to_1_5082", "'{0}' could be instantiated with an arbitrary type which could be unrelated to '{1}'."), Cannot_read_file_0: diag(5083, 1 /* Error */, "Cannot_read_file_0_5083", "Cannot read file '{0}'."), - Tuple_members_must_all_have_names_or_all_not_have_names: diag(5084, 1 /* Error */, "Tuple_members_must_all_have_names_or_all_not_have_names_5084", "Tuple members must all have names or all not have names."), A_tuple_member_cannot_be_both_optional_and_rest: diag(5085, 1 /* Error */, "A_tuple_member_cannot_be_both_optional_and_rest_5085", "A tuple member cannot be both optional and rest."), A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type: diag(5086, 1 /* Error */, "A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_c_5086", "A labeled tuple element is declared as optional with a question mark after the name and before the colon, rather than after the type."), A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type: diag(5087, 1 /* Error */, "A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type_5087", "A labeled tuple element is declared as rest with a '...' before the name, rather than before the type."), @@ -8127,6 +8147,8 @@ ${lanes.join("\n")} Use_0_instead: diag(5106, 3 /* Message */, "Use_0_instead_5106", "Use '{0}' instead."), Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDeprecations_Colon_3_to_silence_this_error: diag(5107, 1 /* Error */, "Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDepr_5107", `Option '{0}={1}' is deprecated and will stop functioning in TypeScript {2}. Specify compilerOption '"ignoreDeprecations": "{3}"' to silence this error.`), Option_0_1_has_been_removed_Please_remove_it_from_your_configuration: diag(5108, 1 /* Error */, "Option_0_1_has_been_removed_Please_remove_it_from_your_configuration_5108", "Option '{0}={1}' has been removed. Please remove it from your configuration."), + Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1: diag(5109, 1 /* Error */, "Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1_5109", "Option 'moduleResolution' must be set to '{0}' (or left unspecified) when option 'module' is set to '{1}'."), + Option_module_must_be_set_to_0_when_option_moduleResolution_is_set_to_1: diag(5110, 1 /* Error */, "Option_module_must_be_set_to_0_when_option_moduleResolution_is_set_to_1_5110", "Option 'module' must be set to '{0}' when option 'moduleResolution' is set to '{1}'."), Generates_a_sourcemap_for_each_corresponding_d_ts_file: diag(6e3, 3 /* 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, 3 /* Message */, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."), Generates_corresponding_d_ts_file: diag(6002, 3 /* Message */, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."), @@ -8507,6 +8529,8 @@ ${lanes.join("\n")} Resolved_under_condition_0: diag(6414, 3 /* Message */, "Resolved_under_condition_0_6414", "Resolved under condition '{0}'."), Failed_to_resolve_under_condition_0: diag(6415, 3 /* Message */, "Failed_to_resolve_under_condition_0_6415", "Failed to resolve under condition '{0}'."), Exiting_conditional_exports: diag(6416, 3 /* Message */, "Exiting_conditional_exports_6416", "Exiting conditional exports."), + Searching_all_ancestor_node_modules_directories_for_preferred_extensions_Colon_0: diag(6417, 3 /* Message */, "Searching_all_ancestor_node_modules_directories_for_preferred_extensions_Colon_0_6417", "Searching all ancestor node_modules directories for preferred extensions: {0}."), + Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0: diag(6418, 3 /* Message */, "Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0_6418", "Searching all ancestor node_modules directories for fallback extensions: {0}."), The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, 3 /* Message */, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"), The_expected_type_comes_from_this_index_signature: diag(6501, 3 /* Message */, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."), The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, 3 /* Message */, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."), @@ -8745,6 +8769,7 @@ ${lanes.join("\n")} Parameter_modifiers_can_only_be_used_in_TypeScript_files: diag(8012, 1 /* Error */, "Parameter_modifiers_can_only_be_used_in_TypeScript_files_8012", "Parameter modifiers can only be used in TypeScript files."), Non_null_assertions_can_only_be_used_in_TypeScript_files: diag(8013, 1 /* Error */, "Non_null_assertions_can_only_be_used_in_TypeScript_files_8013", "Non-null assertions can only be used in TypeScript files."), Type_assertion_expressions_can_only_be_used_in_TypeScript_files: diag(8016, 1 /* Error */, "Type_assertion_expressions_can_only_be_used_in_TypeScript_files_8016", "Type assertion expressions can only be used in TypeScript files."), + Signature_declarations_can_only_be_used_in_TypeScript_files: diag(8017, 1 /* Error */, "Signature_declarations_can_only_be_used_in_TypeScript_files_8017", "Signature declarations can only be used in TypeScript files."), Report_errors_in_js_files: diag(8019, 3 /* Message */, "Report_errors_in_js_files_8019", "Report errors in .js files."), JSDoc_types_can_only_be_used_inside_documentation_comments: diag(8020, 1 /* Error */, "JSDoc_types_can_only_be_used_inside_documentation_comments_8020", "JSDoc types can only be used inside documentation comments."), JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags: diag(8021, 1 /* Error */, "JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021", "JSDoc '@typedef' tag should either have a type annotation or be followed by '@property' or '@member' tags."), @@ -9019,6 +9044,14 @@ ${lanes.join("\n")} Convert_all_typedef_to_TypeScript_types: diag(95177, 3 /* Message */, "Convert_all_typedef_to_TypeScript_types_95177", "Convert all typedef to TypeScript types."), Move_to_file: diag(95178, 3 /* Message */, "Move_to_file_95178", "Move to file"), Cannot_move_to_file_selected_file_is_invalid: diag(95179, 3 /* Message */, "Cannot_move_to_file_selected_file_is_invalid_95179", "Cannot move to file, selected file is invalid"), + Use_import_type: diag(95180, 3 /* Message */, "Use_import_type_95180", "Use 'import type'"), + Use_type_0: diag(95181, 3 /* Message */, "Use_type_0_95181", "Use 'type {0}'"), + Fix_all_with_type_only_imports: diag(95182, 3 /* Message */, "Fix_all_with_type_only_imports_95182", "Fix all with type-only imports"), + Cannot_move_statements_to_the_selected_file: diag(95183, 3 /* Message */, "Cannot_move_statements_to_the_selected_file_95183", "Cannot move statements to the selected file"), + Inline_variable: diag(95184, 3 /* Message */, "Inline_variable_95184", "Inline variable"), + Could_not_find_variable_to_inline: diag(95185, 3 /* Message */, "Could_not_find_variable_to_inline_95185", "Could not find variable to inline."), + Variables_with_multiple_declarations_cannot_be_inlined: diag(95186, 3 /* Message */, "Variables_with_multiple_declarations_cannot_be_inlined_95186", "Variables with multiple declarations cannot be inlined."), + Add_missing_comma_for_object_member_completion_0: diag(95187, 3 /* Message */, "Add_missing_comma_for_object_member_completion_0_95187", "Add missing comma for object member completion '{0}'."), No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* 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."), Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."), JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"), @@ -9045,8 +9078,8 @@ ${lanes.join("\n")} Specify_the_JSX_fragment_factory_function_to_use_when_targeting_react_JSX_emit_with_jsxFactory_compiler_option_is_specified_e_g_Fragment: diag(18034, 3 /* Message */, "Specify_the_JSX_fragment_factory_function_to_use_when_targeting_react_JSX_emit_with_jsxFactory_compi_18034", "Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'."), Invalid_value_for_jsxFragmentFactory_0_is_not_a_valid_identifier_or_qualified_name: diag(18035, 1 /* Error */, "Invalid_value_for_jsxFragmentFactory_0_is_not_a_valid_identifier_or_qualified_name_18035", "Invalid value for 'jsxFragmentFactory'. '{0}' is not a valid identifier or qualified-name."), Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator: diag(18036, 1 /* Error */, "Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_dec_18036", "Class decorators can't be used with static private identifier. Consider removing the experimental decorator."), - Await_expression_cannot_be_used_inside_a_class_static_block: diag(18037, 1 /* Error */, "Await_expression_cannot_be_used_inside_a_class_static_block_18037", "Await expression cannot be used inside a class static block."), - For_await_loops_cannot_be_used_inside_a_class_static_block: diag(18038, 1 /* Error */, "For_await_loops_cannot_be_used_inside_a_class_static_block_18038", "'For await' loops cannot be used inside a class static block."), + await_expression_cannot_be_used_inside_a_class_static_block: diag(18037, 1 /* Error */, "await_expression_cannot_be_used_inside_a_class_static_block_18037", "'await' expression cannot be used inside a class static block."), + for_await_loops_cannot_be_used_inside_a_class_static_block: diag(18038, 1 /* Error */, "for_await_loops_cannot_be_used_inside_a_class_static_block_18038", "'for await' loops cannot be used inside a class static block."), Invalid_use_of_0_It_cannot_be_used_inside_a_class_static_block: diag(18039, 1 /* Error */, "Invalid_use_of_0_It_cannot_be_used_inside_a_class_static_block_18039", "Invalid use of '{0}'. It cannot be used inside a class static block."), A_return_statement_cannot_be_used_inside_a_class_static_block: diag(18041, 1 /* Error */, "A_return_statement_cannot_be_used_inside_a_class_static_block_18041", "A 'return' statement cannot be used inside a class static block."), _0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation: diag(18042, 1 /* Error */, "_0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation_18042", "'{0}' is a type and cannot be imported in JavaScript files. Use '{1}' in a JSDoc type annotation."), @@ -9060,7 +9093,8 @@ ${lanes.join("\n")} The_value_0_cannot_be_used_here: diag(18050, 1 /* Error */, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."), Compiler_option_0_cannot_be_given_an_empty_string: diag(18051, 1 /* Error */, "Compiler_option_0_cannot_be_given_an_empty_string_18051", "Compiler option '{0}' cannot be given an empty string."), Non_abstract_class_0_does_not_implement_all_abstract_members_of_1: diag(18052, 1 /* Error */, "Non_abstract_class_0_does_not_implement_all_abstract_members_of_1_18052", "Non-abstract class '{0}' does not implement all abstract members of '{1}'"), - Its_type_0_is_not_a_valid_JSX_element_type: diag(18053, 1 /* Error */, "Its_type_0_is_not_a_valid_JSX_element_type_18053", "Its type '{0}' is not a valid JSX element type.") + Its_type_0_is_not_a_valid_JSX_element_type: diag(18053, 1 /* Error */, "Its_type_0_is_not_a_valid_JSX_element_type_18053", "Its type '{0}' is not a valid JSX element type."), + await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block.") }; } }); @@ -9337,9 +9371,9 @@ ${lanes.join("\n")} } return false; } - function scanConflictMarkerTrivia(text, pos, error) { - if (error) { - error(Diagnostics.Merge_conflict_marker_encountered, pos, mergeConflictMarkerLength); + function scanConflictMarkerTrivia(text, pos, error2) { + if (error2) { + error2(Diagnostics.Merge_conflict_marker_encountered, pos, mergeConflictMarkerLength); } const ch = text.charCodeAt(pos); const len = text.length; @@ -9635,7 +9669,7 @@ ${lanes.join("\n")} }); } return scanner2; - function error(message, errPos = pos, length3, arg0) { + function error2(message, errPos = pos, length3, arg0) { if (onError) { const oldPos = pos; pos = errPos; @@ -9659,9 +9693,9 @@ ${lanes.join("\n")} } else { tokenFlags |= 16384 /* ContainsInvalidSeparator */; if (isPreviousTokenSeparator) { - error(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1); + error2(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1); } else { - error(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1); + error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1); } } pos++; @@ -9678,7 +9712,7 @@ ${lanes.join("\n")} } if (text.charCodeAt(pos - 1) === 95 /* _ */) { tokenFlags |= 16384 /* ContainsInvalidSeparator */; - error(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1); + error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1); } return result + text.substring(start2, pos); } @@ -9689,7 +9723,7 @@ ${lanes.join("\n")} pos++; if (text.charCodeAt(pos) === 95 /* _ */) { tokenFlags |= 512 /* ContainsSeparator */ | 16384 /* ContainsInvalidSeparator */; - error(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1); + error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1); pos--; mainFragment = scanNumberFragment(); } else if (!scanDigits()) { @@ -9704,8 +9738,8 @@ ${lanes.join("\n")} const literal = (withMinus ? "-" : "") + "0o" + (+tokenValue).toString(8); if (withMinus) start2--; - error(Diagnostics.Octal_literals_are_not_allowed_Use_the_syntax_0, start2, pos - start2, literal); - return { type: 9 /* NumericLiteral */, value: tokenValue }; + error2(Diagnostics.Octal_literals_are_not_allowed_Use_the_syntax_0, start2, pos - start2, literal); + return 9 /* NumericLiteral */; } } else { mainFragment = scanNumberFragment(); @@ -9725,7 +9759,7 @@ ${lanes.join("\n")} const preNumericPart = pos; const finalFragment = scanNumberFragment(); if (!finalFragment) { - error(Diagnostics.Digit_expected); + error2(Diagnostics.Digit_expected); } else { scientificFragment = text.substring(end2, preNumericPart) + finalFragment; end2 = pos; @@ -9744,21 +9778,19 @@ ${lanes.join("\n")} result = text.substring(start2, end2); } if (tokenFlags & 8192 /* ContainsLeadingZero */) { - error(Diagnostics.Decimals_with_leading_zeros_are_not_allowed, start2, end2 - start2); - return { type: 9 /* NumericLiteral */, value: "" + +result }; + error2(Diagnostics.Decimals_with_leading_zeros_are_not_allowed, start2, end2 - start2); + tokenValue = "" + +result; + return 9 /* NumericLiteral */; } if (decimalFragment !== void 0 || tokenFlags & 16 /* Scientific */) { checkForIdentifierStartAfterNumericLiteral(start2, decimalFragment === void 0 && !!(tokenFlags & 16 /* Scientific */)); - return { - type: 9 /* NumericLiteral */, - value: "" + +result - // if value is not an integer, it can be safely coerced to a number - }; + tokenValue = "" + +result; + return 9 /* NumericLiteral */; } else { tokenValue = result; const type = checkBigIntSuffix(); checkForIdentifierStartAfterNumericLiteral(start2); - return { type, value: tokenValue }; + return type; } } function checkForIdentifierStartAfterNumericLiteral(numericStart, isScientific) { @@ -9769,12 +9801,12 @@ ${lanes.join("\n")} const { length: length3 } = scanIdentifierParts(); if (length3 === 1 && text[identifierStart] === "n") { if (isScientific) { - error(Diagnostics.A_bigint_literal_cannot_use_exponential_notation, numericStart, identifierStart - numericStart + 1); + error2(Diagnostics.A_bigint_literal_cannot_use_exponential_notation, numericStart, identifierStart - numericStart + 1); } else { - error(Diagnostics.A_bigint_literal_must_be_an_integer, numericStart, identifierStart - numericStart + 1); + error2(Diagnostics.A_bigint_literal_must_be_an_integer, numericStart, identifierStart - numericStart + 1); } } else { - error(Diagnostics.An_identifier_or_keyword_cannot_immediately_follow_a_numeric_literal, identifierStart, length3); + error2(Diagnostics.An_identifier_or_keyword_cannot_immediately_follow_a_numeric_literal, identifierStart, length3); pos = identifierStart; } } @@ -9821,9 +9853,9 @@ ${lanes.join("\n")} allowSeparator = false; isPreviousTokenSeparator = true; } else if (isPreviousTokenSeparator) { - error(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1); + error2(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1); } else { - error(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1); + error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1); } pos++; continue; @@ -9842,7 +9874,7 @@ ${lanes.join("\n")} valueChars = []; } if (text.charCodeAt(pos - 1) === 95 /* _ */) { - error(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1); + error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1); } return String.fromCharCode(...valueChars); } @@ -9855,7 +9887,7 @@ ${lanes.join("\n")} if (pos >= end) { result += text.substring(start2, pos); tokenFlags |= 4 /* Unterminated */; - error(Diagnostics.Unterminated_string_literal); + error2(Diagnostics.Unterminated_string_literal); break; } const ch = text.charCodeAt(pos); @@ -9876,7 +9908,7 @@ ${lanes.join("\n")} if (isLineBreak(ch) && !jsxAttributeString) { result += text.substring(start2, pos); tokenFlags |= 4 /* Unterminated */; - error(Diagnostics.Unterminated_string_literal); + error2(Diagnostics.Unterminated_string_literal); break; } pos++; @@ -9893,7 +9925,7 @@ ${lanes.join("\n")} if (pos >= end) { contents += text.substring(start2, pos); tokenFlags |= 4 /* Unterminated */; - error(Diagnostics.Unterminated_template_literal); + error2(Diagnostics.Unterminated_template_literal); resultingToken = startedWithBacktick ? 15 /* NoSubstitutionTemplateLiteral */ : 18 /* TemplateTail */; break; } @@ -9936,7 +9968,7 @@ ${lanes.join("\n")} const start2 = pos; pos++; if (pos >= end) { - error(Diagnostics.Unexpected_end_of_text); + error2(Diagnostics.Unexpected_end_of_text); return ""; } const ch = text.charCodeAt(pos); @@ -9962,7 +9994,7 @@ ${lanes.join("\n")} tokenFlags |= 2048 /* ContainsInvalidEscape */; if (shouldEmitInvalidEscapeError) { const code = parseInt(text.substring(start2 + 1, pos), 8); - error(Diagnostics.Octal_escape_sequences_are_not_allowed_Use_the_syntax_0, start2, pos - start2, "\\x" + padLeft(code.toString(16), 2, "0")); + error2(Diagnostics.Octal_escape_sequences_are_not_allowed_Use_the_syntax_0, start2, pos - start2, "\\x" + padLeft(code.toString(16), 2, "0")); return String.fromCharCode(code); } return text.substring(start2, pos); @@ -9970,7 +10002,7 @@ ${lanes.join("\n")} case 57 /* _9 */: tokenFlags |= 2048 /* ContainsInvalidEscape */; if (shouldEmitInvalidEscapeError) { - error(Diagnostics.Escape_sequence_0_is_not_allowed, start2, pos - start2, text.substring(start2, pos)); + error2(Diagnostics.Escape_sequence_0_is_not_allowed, start2, pos - start2, text.substring(start2, pos)); return String.fromCharCode(ch); } return text.substring(start2, pos); @@ -10002,28 +10034,28 @@ ${lanes.join("\n")} if (escapedValue < 0) { tokenFlags |= 2048 /* ContainsInvalidEscape */; if (shouldEmitInvalidEscapeError) { - error(Diagnostics.Hexadecimal_digit_expected); + error2(Diagnostics.Hexadecimal_digit_expected); } return text.substring(start2, pos); } if (!isCodePoint(escapedValue)) { tokenFlags |= 2048 /* ContainsInvalidEscape */; if (shouldEmitInvalidEscapeError) { - error(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive); + error2(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive); } return text.substring(start2, pos); } if (pos >= end) { tokenFlags |= 2048 /* ContainsInvalidEscape */; if (shouldEmitInvalidEscapeError) { - error(Diagnostics.Unexpected_end_of_text); + error2(Diagnostics.Unexpected_end_of_text); } return text.substring(start2, pos); } if (text.charCodeAt(pos) !== 125 /* closeBrace */) { tokenFlags |= 2048 /* ContainsInvalidEscape */; if (shouldEmitInvalidEscapeError) { - error(Diagnostics.Unterminated_Unicode_escape_sequence); + error2(Diagnostics.Unterminated_Unicode_escape_sequence); } return text.substring(start2, pos); } @@ -10035,7 +10067,7 @@ ${lanes.join("\n")} if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) { tokenFlags |= 2048 /* ContainsInvalidEscape */; if (shouldEmitInvalidEscapeError) { - error(Diagnostics.Hexadecimal_digit_expected); + error2(Diagnostics.Hexadecimal_digit_expected); } return text.substring(start2, pos); } @@ -10047,7 +10079,7 @@ ${lanes.join("\n")} if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) { tokenFlags |= 2048 /* ContainsInvalidEscape */; if (shouldEmitInvalidEscapeError) { - error(Diagnostics.Hexadecimal_digit_expected); + error2(Diagnostics.Hexadecimal_digit_expected); } return text.substring(start2, pos); } @@ -10075,19 +10107,19 @@ ${lanes.join("\n")} const escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1; let isInvalidExtendedEscape = false; if (escapedValue < 0) { - error(Diagnostics.Hexadecimal_digit_expected); + error2(Diagnostics.Hexadecimal_digit_expected); isInvalidExtendedEscape = true; } else if (escapedValue > 1114111) { - error(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive); + error2(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive); isInvalidExtendedEscape = true; } if (pos >= end) { - error(Diagnostics.Unexpected_end_of_text); + error2(Diagnostics.Unexpected_end_of_text); isInvalidExtendedEscape = true; } else if (text.charCodeAt(pos) === 125 /* closeBrace */) { pos++; } else { - error(Diagnostics.Unterminated_Unicode_escape_sequence); + error2(Diagnostics.Unterminated_Unicode_escape_sequence); isInvalidExtendedEscape = true; } if (isInvalidExtendedEscape) { @@ -10181,9 +10213,9 @@ ${lanes.join("\n")} separatorAllowed = false; isPreviousTokenSeparator = true; } else if (isPreviousTokenSeparator) { - error(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1); + error2(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1); } else { - error(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1); + error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1); } pos++; continue; @@ -10197,7 +10229,7 @@ ${lanes.join("\n")} isPreviousTokenSeparator = false; } if (text.charCodeAt(pos - 1) === 95 /* _ */) { - error(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1); + error2(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1); } return value; } @@ -10227,7 +10259,7 @@ ${lanes.join("\n")} const ch = codePointAt(text, pos); if (pos === 0) { if (ch === 65533 /* replacementCharacter */) { - error(Diagnostics.File_appears_to_be_binary); + error2(Diagnostics.File_appears_to_be_binary); pos = end; return token = 8 /* NonTextFileMarkerTrivia */; } @@ -10367,7 +10399,7 @@ ${lanes.join("\n")} return token = 41 /* MinusToken */; case 46 /* dot */: if (isDigit(text.charCodeAt(pos + 1))) { - tokenValue = scanNumber().value; + scanNumber(); return token = 9 /* NumericLiteral */; } if (text.charCodeAt(pos + 1) === 46 /* dot */ && text.charCodeAt(pos + 2) === 46 /* dot */) { @@ -10418,7 +10450,7 @@ ${lanes.join("\n")} } commentDirectives = appendIfCommentDirective(commentDirectives, text.slice(lastLineStart, pos), commentDirectiveRegExMultiLine, lastLineStart); if (!commentClosed) { - error(Diagnostics.Asterisk_Slash_expected); + error2(Diagnostics.Asterisk_Slash_expected); } if (skipTrivia2) { continue; @@ -10443,7 +10475,7 @@ ${lanes.join("\n")} true ); if (!tokenValue) { - error(Diagnostics.Hexadecimal_digit_expected); + error2(Diagnostics.Hexadecimal_digit_expected); tokenValue = "0"; } tokenValue = "0x" + tokenValue; @@ -10456,7 +10488,7 @@ ${lanes.join("\n")} 2 ); if (!tokenValue) { - error(Diagnostics.Binary_digit_expected); + error2(Diagnostics.Binary_digit_expected); tokenValue = "0"; } tokenValue = "0b" + tokenValue; @@ -10469,7 +10501,7 @@ ${lanes.join("\n")} 8 ); if (!tokenValue) { - error(Diagnostics.Octal_digit_expected); + error2(Diagnostics.Octal_digit_expected); tokenValue = "0"; } tokenValue = "0o" + tokenValue; @@ -10485,8 +10517,7 @@ ${lanes.join("\n")} case 55 /* _7 */: case 56 /* _8 */: case 57 /* _9 */: - ({ type: token, value: tokenValue } = scanNumber()); - return token; + return token = scanNumber(); case 58 /* colon */: pos++; return token = 59 /* ColonToken */; @@ -10495,7 +10526,7 @@ ${lanes.join("\n")} return token = 27 /* SemicolonToken */; case 60 /* lessThan */: if (isConflictMarkerTrivia(text, pos)) { - pos = scanConflictMarkerTrivia(text, pos, error); + pos = scanConflictMarkerTrivia(text, pos, error2); if (skipTrivia2) { continue; } else { @@ -10518,7 +10549,7 @@ ${lanes.join("\n")} return token = 30 /* LessThanToken */; case 61 /* equals */: if (isConflictMarkerTrivia(text, pos)) { - pos = scanConflictMarkerTrivia(text, pos, error); + pos = scanConflictMarkerTrivia(text, pos, error2); if (skipTrivia2) { continue; } else { @@ -10538,7 +10569,7 @@ ${lanes.join("\n")} return token = 64 /* EqualsToken */; case 62 /* greaterThan */: if (isConflictMarkerTrivia(text, pos)) { - pos = scanConflictMarkerTrivia(text, pos, error); + pos = scanConflictMarkerTrivia(text, pos, error2); if (skipTrivia2) { continue; } else { @@ -10576,7 +10607,7 @@ ${lanes.join("\n")} return token = 19 /* OpenBraceToken */; case 124 /* bar */: if (isConflictMarkerTrivia(text, pos)) { - pos = scanConflictMarkerTrivia(text, pos, error); + pos = scanConflictMarkerTrivia(text, pos, error2); if (skipTrivia2) { continue; } else { @@ -10618,12 +10649,12 @@ ${lanes.join("\n")} tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts(); return token = getIdentifierToken(); } - error(Diagnostics.Invalid_character); + error2(Diagnostics.Invalid_character); pos++; return token = 0 /* Unknown */; case 35 /* hash */: if (pos !== 0 && text[pos + 1] === "!") { - error(Diagnostics.can_only_be_used_at_the_start_of_a_file); + error2(Diagnostics.can_only_be_used_at_the_start_of_a_file); pos++; return token = 0 /* Unknown */; } @@ -10651,7 +10682,7 @@ ${lanes.join("\n")} scanIdentifier(charAfterHash, languageVersion); } else { tokenValue = "#"; - error(Diagnostics.Invalid_character, pos++, charSize(ch)); + error2(Diagnostics.Invalid_character, pos++, charSize(ch)); } return token = 81 /* PrivateIdentifier */; default: @@ -10667,7 +10698,7 @@ ${lanes.join("\n")} continue; } const size = charSize(ch); - error(Diagnostics.Invalid_character, pos, size); + error2(Diagnostics.Invalid_character, pos, size); pos += size; return token = 0 /* Unknown */; } @@ -10733,13 +10764,13 @@ ${lanes.join("\n")} while (true) { if (p >= end) { tokenFlags |= 4 /* Unterminated */; - error(Diagnostics.Unterminated_regular_expression_literal); + error2(Diagnostics.Unterminated_regular_expression_literal); break; } const ch = text.charCodeAt(p); if (isLineBreak(ch)) { tokenFlags |= 4 /* Unterminated */; - error(Diagnostics.Unterminated_regular_expression_literal); + error2(Diagnostics.Unterminated_regular_expression_literal); break; } if (inEscape) { @@ -10851,16 +10882,16 @@ ${lanes.join("\n")} } if (char === 60 /* lessThan */) { if (isConflictMarkerTrivia(text, pos)) { - pos = scanConflictMarkerTrivia(text, pos, error); + pos = scanConflictMarkerTrivia(text, pos, error2); return token = 7 /* ConflictMarkerTrivia */; } break; } if (char === 62 /* greaterThan */) { - error(Diagnostics.Unexpected_token_Did_you_mean_or_gt, pos, 1); + error2(Diagnostics.Unexpected_token_Did_you_mean_or_gt, pos, 1); } if (char === 125 /* closeBrace */) { - error(Diagnostics.Unexpected_token_Did_you_mean_or_rbrace, pos, 1); + error2(Diagnostics.Unexpected_token_Did_you_mean_or_rbrace, pos, 1); } if (isLineBreak(char) && firstNonWhitespace === 0) { firstNonWhitespace = -1; @@ -11130,7 +11161,7 @@ ${lanes.join("\n")} as: 130 /* AsKeyword */, asserts: 131 /* AssertsKeyword */, assert: 132 /* AssertKeyword */, - bigint: 162 /* BigIntKeyword */, + bigint: 163 /* BigIntKeyword */, boolean: 136 /* BooleanKeyword */, break: 83 /* BreakKeyword */, case: 84 /* CaseKeyword */, @@ -11151,7 +11182,7 @@ ${lanes.join("\n")} false: 97 /* FalseKeyword */, finally: 98 /* FinallyKeyword */, for: 99 /* ForKeyword */, - from: 160 /* FromKeyword */, + from: 161 /* FromKeyword */, function: 100 /* FunctionKeyword */, get: 139 /* GetKeyword */, if: 101 /* IfKeyword */, @@ -11176,11 +11207,11 @@ ${lanes.join("\n")} private: 123 /* PrivateKeyword */, protected: 124 /* ProtectedKeyword */, public: 125 /* PublicKeyword */, - override: 163 /* OverrideKeyword */, + override: 164 /* OverrideKeyword */, out: 147 /* OutKeyword */, readonly: 148 /* ReadonlyKeyword */, require: 149 /* RequireKeyword */, - global: 161 /* GlobalKeyword */, + global: 162 /* GlobalKeyword */, return: 107 /* ReturnKeyword */, satisfies: 152 /* SatisfiesKeyword */, set: 153 /* SetKeyword */, @@ -11198,6 +11229,7 @@ ${lanes.join("\n")} undefined: 157 /* UndefinedKeyword */, unique: 158 /* UniqueKeyword */, unknown: 159 /* UnknownKeyword */, + using: 160 /* UsingKeyword */, var: 115 /* VarKeyword */, void: 116 /* VoidKeyword */, while: 117 /* WhileKeyword */, @@ -11205,7 +11237,7 @@ ${lanes.join("\n")} yield: 127 /* YieldKeyword */, async: 134 /* AsyncKeyword */, await: 135 /* AwaitKeyword */, - of: 164 /* OfKeyword */ + of: 165 /* OfKeyword */ }; textToKeyword = new Map(Object.entries(textToKeywordObj)); textToToken = new Map(Object.entries({ @@ -11427,16 +11459,16 @@ ${lanes.join("\n")} ); } function getTypeParameterOwner(d) { - if (d && d.kind === 167 /* TypeParameter */) { + if (d && d.kind === 168 /* TypeParameter */) { for (let current = d; current; current = current.parent) { - if (isFunctionLike(current) || isClassLike(current) || current.kind === 263 /* InterfaceDeclaration */) { + if (isFunctionLike(current) || isClassLike(current) || current.kind === 264 /* InterfaceDeclaration */) { return current; } } } } function isParameterPropertyDeclaration(node, parent2) { - return isParameter(node) && hasSyntacticModifier(node, 16476 /* ParameterPropertyModifier */) && parent2.kind === 175 /* Constructor */; + return isParameter(node) && hasSyntacticModifier(node, 16476 /* ParameterPropertyModifier */) && parent2.kind === 176 /* Constructor */; } function isEmptyBindingPattern(node) { if (isBindingPattern(node)) { @@ -11462,14 +11494,14 @@ ${lanes.join("\n")} node = walkUpBindingElementsAndPatterns(node); } let flags = getFlags(node); - if (node.kind === 259 /* VariableDeclaration */) { + if (node.kind === 260 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 260 /* VariableDeclarationList */) { + if (node && node.kind === 261 /* VariableDeclarationList */) { flags |= getFlags(node); node = node.parent; } - if (node && node.kind === 242 /* VariableStatement */) { + if (node && node.kind === 243 /* VariableStatement */) { flags |= getFlags(node); } return flags; @@ -11481,11 +11513,14 @@ ${lanes.join("\n")} return getCombinedFlags(node, getEffectiveModifierFlagsAlwaysIncludeJSDoc); } function getCombinedNodeFlags(node) { - return getCombinedFlags(node, (n) => n.flags); + return getCombinedFlags(node, getNodeFlags); + } + function getNodeFlags(node) { + return node.flags; } function validateLocaleAndSetLanguage(locale, sys2, errors) { const lowerCaseLocale = locale.toLowerCase(); - const matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(lowerCaseLocale); + const matchResult = /^([a-z]+)([_-]([a-z]+))?$/.exec(lowerCaseLocale); if (!matchResult) { if (errors) { errors.push(createCompilerDiagnostic(Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, "en", "ja-jp")); @@ -11558,7 +11593,7 @@ ${lanes.join("\n")} return void 0; } function isParseTreeNode(node) { - return (node.flags & 8 /* Synthesized */) === 0; + return (node.flags & 16 /* Synthesized */) === 0; } function getParseTreeNode(node, nodeTest) { if (node === void 0 || isParseTreeNode(node)) { @@ -11601,30 +11636,30 @@ ${lanes.join("\n")} return getDeclarationIdentifier(hostNode); } switch (hostNode.kind) { - case 242 /* VariableStatement */: + case 243 /* VariableStatement */: if (hostNode.declarationList && hostNode.declarationList.declarations[0]) { return getDeclarationIdentifier(hostNode.declarationList.declarations[0]); } break; - case 243 /* ExpressionStatement */: + case 244 /* ExpressionStatement */: let expr = hostNode.expression; - if (expr.kind === 225 /* BinaryExpression */ && expr.operatorToken.kind === 64 /* EqualsToken */) { + if (expr.kind === 226 /* BinaryExpression */ && expr.operatorToken.kind === 64 /* EqualsToken */) { expr = expr.left; } switch (expr.kind) { - case 210 /* PropertyAccessExpression */: + case 211 /* PropertyAccessExpression */: return expr.name; - case 211 /* ElementAccessExpression */: + case 212 /* ElementAccessExpression */: const arg = expr.argumentExpression; if (isIdentifier(arg)) { return arg; } } break; - case 216 /* ParenthesizedExpression */: { + case 217 /* ParenthesizedExpression */: { return getDeclarationIdentifier(hostNode.expression); } - case 255 /* LabeledStatement */: { + case 256 /* LabeledStatement */: { if (isDeclaration(hostNode.statement) || isExpression(hostNode.statement)) { return getDeclarationIdentifier(hostNode.statement); } @@ -11655,16 +11690,16 @@ ${lanes.join("\n")} switch (declaration.kind) { case 80 /* Identifier */: return declaration; - case 354 /* JSDocPropertyTag */: - case 347 /* JSDocParameterTag */: { + case 355 /* JSDocPropertyTag */: + case 348 /* JSDocParameterTag */: { const { name } = declaration; - if (name.kind === 165 /* QualifiedName */) { + if (name.kind === 166 /* QualifiedName */) { return name.right; } break; } - case 212 /* CallExpression */: - case 225 /* BinaryExpression */: { + case 213 /* CallExpression */: + case 226 /* BinaryExpression */: { const expr2 = declaration; switch (getAssignmentDeclarationKind(expr2)) { case 1 /* ExportsProperty */: @@ -11680,15 +11715,15 @@ ${lanes.join("\n")} return void 0; } } - case 352 /* JSDocTypedefTag */: + case 353 /* JSDocTypedefTag */: return getNameOfJSDocTypedef(declaration); - case 346 /* JSDocEnumTag */: + case 347 /* JSDocEnumTag */: return nameForNamelessJSDocTypedef(declaration); - case 276 /* ExportAssignment */: { + case 277 /* ExportAssignment */: { const { expression } = declaration; return isIdentifier(expression) ? expression : void 0; } - case 211 /* ElementAccessExpression */: + case 212 /* ElementAccessExpression */: const expr = declaration; if (isBindableStaticElementAccessExpression(expr)) { return expr.argumentExpression; @@ -11935,10 +11970,10 @@ ${lanes.join("\n")} return getJSDocTags(node).filter((doc) => doc.kind === kind); } function getTextOfJSDocComment(comment) { - return typeof comment === "string" ? comment : comment == null ? void 0 : comment.map((c) => c.kind === 327 /* JSDocText */ ? c.text : formatJSDocLink(c)).join(""); + return typeof comment === "string" ? comment : comment == null ? void 0 : comment.map((c) => c.kind === 328 /* JSDocText */ ? c.text : formatJSDocLink(c)).join(""); } function formatJSDocLink(link) { - const kind = link.kind === 330 /* JSDocLink */ ? "link" : link.kind === 331 /* JSDocLinkCode */ ? "linkcode" : "linkplain"; + const kind = link.kind === 331 /* JSDocLink */ ? "link" : link.kind === 332 /* JSDocLinkCode */ ? "linkcode" : "linkplain"; const name = link.name ? entityNameToString(link.name) : ""; const space = link.name && link.text.startsWith("://") ? "" : " "; return `{@${kind} ${name}${space}${link.text}}`; @@ -11954,7 +11989,7 @@ ${lanes.join("\n")} return emptyArray; } if (isJSDocTypeAlias(node)) { - Debug.assert(node.parent.kind === 326 /* JSDoc */); + Debug.assert(node.parent.kind === 327 /* JSDoc */); return flatMap(node.parent.tags, (tag) => isJSDocTemplateTag(tag) ? tag.typeParameters : void 0); } if (node.typeParameters) { @@ -11982,20 +12017,20 @@ ${lanes.join("\n")} return node.kind === 80 /* Identifier */ || node.kind === 81 /* PrivateIdentifier */; } function isGetOrSetAccessorDeclaration(node) { - return node.kind === 177 /* SetAccessor */ || node.kind === 176 /* GetAccessor */; + return node.kind === 178 /* SetAccessor */ || node.kind === 177 /* GetAccessor */; } function isPropertyAccessChain(node) { - return isPropertyAccessExpression(node) && !!(node.flags & 32 /* OptionalChain */); + return isPropertyAccessExpression(node) && !!(node.flags & 64 /* OptionalChain */); } function isElementAccessChain(node) { - return isElementAccessExpression(node) && !!(node.flags & 32 /* OptionalChain */); + return isElementAccessExpression(node) && !!(node.flags & 64 /* OptionalChain */); } function isCallChain(node) { - return isCallExpression(node) && !!(node.flags & 32 /* OptionalChain */); + return isCallExpression(node) && !!(node.flags & 64 /* OptionalChain */); } function isOptionalChain(node) { const kind = node.kind; - return !!(node.flags & 32 /* OptionalChain */) && (kind === 210 /* PropertyAccessExpression */ || kind === 211 /* ElementAccessExpression */ || kind === 212 /* CallExpression */ || kind === 234 /* NonNullExpression */); + return !!(node.flags & 64 /* OptionalChain */) && (kind === 211 /* PropertyAccessExpression */ || kind === 212 /* ElementAccessExpression */ || kind === 213 /* CallExpression */ || kind === 235 /* NonNullExpression */); } function isOptionalChainRoot(node) { return isOptionalChain(node) && !isNonNullExpression(node) && !!node.questionDotToken; @@ -12007,7 +12042,7 @@ ${lanes.join("\n")} return !isOptionalChain(node.parent) || isOptionalChainRoot(node.parent) || node !== node.parent.expression; } function isNullishCoalesce(node) { - return node.kind === 225 /* BinaryExpression */ && node.operatorToken.kind === 61 /* QuestionQuestionToken */; + return node.kind === 226 /* BinaryExpression */ && node.operatorToken.kind === 61 /* QuestionQuestionToken */; } function isConstTypeReference(node) { return isTypeReferenceNode(node) && isIdentifier(node.typeName) && node.typeName.escapedText === "const" && !node.typeArguments; @@ -12016,37 +12051,37 @@ ${lanes.join("\n")} return skipOuterExpressions(node, 8 /* PartiallyEmittedExpressions */); } function isNonNullChain(node) { - return isNonNullExpression(node) && !!(node.flags & 32 /* OptionalChain */); + return isNonNullExpression(node) && !!(node.flags & 64 /* OptionalChain */); } function isBreakOrContinueStatement(node) { - return node.kind === 251 /* BreakStatement */ || node.kind === 250 /* ContinueStatement */; + return node.kind === 252 /* BreakStatement */ || node.kind === 251 /* ContinueStatement */; } function isNamedExportBindings(node) { - return node.kind === 279 /* NamespaceExport */ || node.kind === 278 /* NamedExports */; + return node.kind === 280 /* NamespaceExport */ || node.kind === 279 /* NamedExports */; } function isUnparsedTextLike(node) { switch (node.kind) { - case 308 /* UnparsedText */: - case 309 /* UnparsedInternalText */: + case 309 /* UnparsedText */: + case 310 /* UnparsedInternalText */: return true; default: return false; } } function isUnparsedNode(node) { - return isUnparsedTextLike(node) || node.kind === 306 /* UnparsedPrologue */ || node.kind === 310 /* UnparsedSyntheticReference */; + return isUnparsedTextLike(node) || node.kind === 307 /* UnparsedPrologue */ || node.kind === 311 /* UnparsedSyntheticReference */; } function isJSDocPropertyLikeTag(node) { - return node.kind === 354 /* JSDocPropertyTag */ || node.kind === 347 /* JSDocParameterTag */; + return node.kind === 355 /* JSDocPropertyTag */ || node.kind === 348 /* JSDocParameterTag */; } function isNode(node) { return isNodeKind(node.kind); } function isNodeKind(kind) { - return kind >= 165 /* FirstNode */; + return kind >= 166 /* FirstNode */; } function isTokenKind(kind) { - return kind >= 0 /* FirstToken */ && kind <= 164 /* LastToken */; + return kind >= 0 /* FirstToken */ && kind <= 165 /* LastToken */; } function isToken(n) { return isTokenKind(n.kind); @@ -12062,11 +12097,11 @@ ${lanes.join("\n")} } function isLiteralExpressionOfObject(node) { switch (node.kind) { - case 209 /* ObjectLiteralExpression */: - case 208 /* ArrayLiteralExpression */: + case 210 /* ObjectLiteralExpression */: + case 209 /* ArrayLiteralExpression */: case 14 /* RegularExpressionLiteral */: - case 217 /* FunctionExpression */: - case 230 /* ClassExpression */: + case 218 /* FunctionExpression */: + case 231 /* ClassExpression */: return true; } return false; @@ -12086,23 +12121,23 @@ ${lanes.join("\n")} } function isTypeOnlyImportDeclaration(node) { switch (node.kind) { - case 275 /* ImportSpecifier */: + case 276 /* ImportSpecifier */: return node.isTypeOnly || node.parent.parent.isTypeOnly; - case 273 /* NamespaceImport */: + case 274 /* NamespaceImport */: return node.parent.isTypeOnly; - case 272 /* ImportClause */: - case 270 /* ImportEqualsDeclaration */: + case 273 /* ImportClause */: + case 271 /* ImportEqualsDeclaration */: return node.isTypeOnly; } return false; } function isTypeOnlyExportDeclaration(node) { switch (node.kind) { - case 280 /* ExportSpecifier */: + case 281 /* ExportSpecifier */: return node.isTypeOnly || node.parent.parent.isTypeOnly; - case 277 /* ExportDeclaration */: + case 278 /* ExportDeclaration */: return node.isTypeOnly && !!node.moduleSpecifier && !node.exportClause; - case 279 /* NamespaceExport */: + case 280 /* NamespaceExport */: return node.parent.isTypeOnly; } return false; @@ -12124,6 +12159,10 @@ ${lanes.join("\n")} var _a; return isPrivateIdentifier(node) && ((_a = node.emitNode) == null ? void 0 : _a.autoGenerate) !== void 0; } + function isFileLevelReservedGeneratedIdentifier(node) { + const flags = node.emitNode.autoGenerate.flags; + return !!(flags & 32 /* FileLevel */) && !!(flags & 16 /* Optimistic */) && !!(flags & 8 /* ReservedInNestedScopes */); + } function isPrivateIdentifierClassElementDeclaration(node) { return (isPropertyDeclaration(node) || isMethodOrAccessor(node)) && isPrivateIdentifier(node.name); } @@ -12146,7 +12185,7 @@ ${lanes.join("\n")} case 148 /* ReadonlyKeyword */: case 126 /* StaticKeyword */: case 147 /* OutKeyword */: - case 163 /* OverrideKeyword */: + case 164 /* OverrideKeyword */: return true; } return false; @@ -12155,22 +12194,22 @@ ${lanes.join("\n")} return !!(modifierToFlag(kind) & 16476 /* ParameterPropertyModifier */); } function isClassMemberModifier(idToken) { - return isParameterPropertyModifier(idToken) || idToken === 126 /* StaticKeyword */ || idToken === 163 /* OverrideKeyword */ || idToken === 129 /* AccessorKeyword */; + return isParameterPropertyModifier(idToken) || idToken === 126 /* StaticKeyword */ || idToken === 164 /* OverrideKeyword */ || idToken === 129 /* AccessorKeyword */; } function isModifier(node) { return isModifierKind(node.kind); } function isEntityName(node) { const kind = node.kind; - return kind === 165 /* QualifiedName */ || kind === 80 /* Identifier */; + return kind === 166 /* QualifiedName */ || kind === 80 /* Identifier */; } function isPropertyName(node) { const kind = node.kind; - return kind === 80 /* Identifier */ || kind === 81 /* PrivateIdentifier */ || kind === 11 /* StringLiteral */ || kind === 9 /* NumericLiteral */ || kind === 166 /* ComputedPropertyName */; + return kind === 80 /* Identifier */ || kind === 81 /* PrivateIdentifier */ || kind === 11 /* StringLiteral */ || kind === 9 /* NumericLiteral */ || kind === 167 /* ComputedPropertyName */; } function isBindingName(node) { const kind = node.kind; - return kind === 80 /* Identifier */ || kind === 205 /* ObjectBindingPattern */ || kind === 206 /* ArrayBindingPattern */; + return kind === 80 /* Identifier */ || kind === 206 /* ObjectBindingPattern */ || kind === 207 /* ArrayBindingPattern */; } function isFunctionLike(node) { return !!node && isFunctionLikeKind(node.kind); @@ -12186,13 +12225,13 @@ ${lanes.join("\n")} } function isFunctionLikeDeclarationKind(kind) { switch (kind) { - case 261 /* FunctionDeclaration */: - case 173 /* MethodDeclaration */: - case 175 /* Constructor */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: + case 262 /* FunctionDeclaration */: + case 174 /* MethodDeclaration */: + case 176 /* Constructor */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: return true; default: return false; @@ -12200,14 +12239,14 @@ ${lanes.join("\n")} } function isFunctionLikeKind(kind) { switch (kind) { - case 172 /* MethodSignature */: - case 178 /* CallSignature */: - case 329 /* JSDocSignature */: - case 179 /* ConstructSignature */: - case 180 /* IndexSignature */: - case 183 /* FunctionType */: - case 323 /* JSDocFunctionType */: - case 184 /* ConstructorType */: + case 173 /* MethodSignature */: + case 179 /* CallSignature */: + case 330 /* JSDocSignature */: + case 180 /* ConstructSignature */: + case 181 /* IndexSignature */: + case 184 /* FunctionType */: + case 324 /* JSDocFunctionType */: + case 185 /* ConstructorType */: return true; default: return isFunctionLikeDeclarationKind(kind); @@ -12218,22 +12257,22 @@ ${lanes.join("\n")} } function isClassElement(node) { const kind = node.kind; - return kind === 175 /* Constructor */ || kind === 171 /* PropertyDeclaration */ || kind === 173 /* MethodDeclaration */ || kind === 176 /* GetAccessor */ || kind === 177 /* SetAccessor */ || kind === 180 /* IndexSignature */ || kind === 174 /* ClassStaticBlockDeclaration */ || kind === 239 /* SemicolonClassElement */; + return kind === 176 /* Constructor */ || kind === 172 /* PropertyDeclaration */ || kind === 174 /* MethodDeclaration */ || kind === 177 /* GetAccessor */ || kind === 178 /* SetAccessor */ || kind === 181 /* IndexSignature */ || kind === 175 /* ClassStaticBlockDeclaration */ || kind === 240 /* SemicolonClassElement */; } function isClassLike(node) { - return node && (node.kind === 262 /* ClassDeclaration */ || node.kind === 230 /* ClassExpression */); + return node && (node.kind === 263 /* ClassDeclaration */ || node.kind === 231 /* ClassExpression */); } function isAccessor(node) { - return node && (node.kind === 176 /* GetAccessor */ || node.kind === 177 /* SetAccessor */); + return node && (node.kind === 177 /* GetAccessor */ || node.kind === 178 /* SetAccessor */); } function isAutoAccessorPropertyDeclaration(node) { return isPropertyDeclaration(node) && hasAccessorModifier(node); } function isMethodOrAccessor(node) { switch (node.kind) { - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: return true; default: return false; @@ -12241,10 +12280,10 @@ ${lanes.join("\n")} } function isNamedClassElement(node) { switch (node.kind) { - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 171 /* PropertyDeclaration */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 172 /* PropertyDeclaration */: return true; default: return false; @@ -12255,22 +12294,22 @@ ${lanes.join("\n")} } function isTypeElement(node) { const kind = node.kind; - return kind === 179 /* ConstructSignature */ || kind === 178 /* CallSignature */ || kind === 170 /* PropertySignature */ || kind === 172 /* MethodSignature */ || kind === 180 /* IndexSignature */ || kind === 176 /* GetAccessor */ || kind === 177 /* SetAccessor */; + return kind === 180 /* ConstructSignature */ || kind === 179 /* CallSignature */ || kind === 171 /* PropertySignature */ || kind === 173 /* MethodSignature */ || kind === 181 /* IndexSignature */ || kind === 177 /* GetAccessor */ || kind === 178 /* SetAccessor */; } function isClassOrTypeElement(node) { return isTypeElement(node) || isClassElement(node); } function isObjectLiteralElementLike(node) { const kind = node.kind; - return kind === 302 /* PropertyAssignment */ || kind === 303 /* ShorthandPropertyAssignment */ || kind === 304 /* SpreadAssignment */ || kind === 173 /* MethodDeclaration */ || kind === 176 /* GetAccessor */ || kind === 177 /* SetAccessor */; + return kind === 303 /* PropertyAssignment */ || kind === 304 /* ShorthandPropertyAssignment */ || kind === 305 /* SpreadAssignment */ || kind === 174 /* MethodDeclaration */ || kind === 177 /* GetAccessor */ || kind === 178 /* SetAccessor */; } function isTypeNode(node) { return isTypeNodeKind(node.kind); } function isFunctionOrConstructorTypeNode(node) { switch (node.kind) { - case 183 /* FunctionType */: - case 184 /* ConstructorType */: + case 184 /* FunctionType */: + case 185 /* ConstructorType */: return true; } return false; @@ -12278,23 +12317,23 @@ ${lanes.join("\n")} function isBindingPattern(node) { if (node) { const kind = node.kind; - return kind === 206 /* ArrayBindingPattern */ || kind === 205 /* ObjectBindingPattern */; + return kind === 207 /* ArrayBindingPattern */ || kind === 206 /* ObjectBindingPattern */; } return false; } function isAssignmentPattern(node) { const kind = node.kind; - return kind === 208 /* ArrayLiteralExpression */ || kind === 209 /* ObjectLiteralExpression */; + return kind === 209 /* ArrayLiteralExpression */ || kind === 210 /* ObjectLiteralExpression */; } function isArrayBindingElement(node) { const kind = node.kind; - return kind === 207 /* BindingElement */ || kind === 231 /* OmittedExpression */; + return kind === 208 /* BindingElement */ || kind === 232 /* OmittedExpression */; } function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 259 /* VariableDeclaration */: - case 168 /* Parameter */: - case 207 /* BindingElement */: + case 260 /* VariableDeclaration */: + case 169 /* Parameter */: + case 208 /* BindingElement */: return true; } return false; @@ -12307,40 +12346,40 @@ ${lanes.join("\n")} } function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 205 /* ObjectBindingPattern */: - case 209 /* ObjectLiteralExpression */: + case 206 /* ObjectBindingPattern */: + case 210 /* ObjectLiteralExpression */: return true; } return false; } function isObjectBindingOrAssignmentElement(node) { switch (node.kind) { - case 207 /* BindingElement */: - case 302 /* PropertyAssignment */: - case 303 /* ShorthandPropertyAssignment */: - case 304 /* SpreadAssignment */: + case 208 /* BindingElement */: + case 303 /* PropertyAssignment */: + case 304 /* ShorthandPropertyAssignment */: + case 305 /* SpreadAssignment */: return true; } return false; } function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 206 /* ArrayBindingPattern */: - case 208 /* ArrayLiteralExpression */: + case 207 /* ArrayBindingPattern */: + case 209 /* ArrayLiteralExpression */: return true; } return false; } function isArrayBindingOrAssignmentElement(node) { switch (node.kind) { - case 207 /* BindingElement */: - case 231 /* OmittedExpression */: - case 229 /* SpreadElement */: - case 208 /* ArrayLiteralExpression */: - case 209 /* ObjectLiteralExpression */: + case 208 /* BindingElement */: + case 232 /* OmittedExpression */: + case 230 /* SpreadElement */: + case 209 /* ArrayLiteralExpression */: + case 210 /* ObjectLiteralExpression */: case 80 /* Identifier */: - case 210 /* PropertyAccessExpression */: - case 211 /* ElementAccessExpression */: + case 211 /* PropertyAccessExpression */: + case 212 /* ElementAccessExpression */: return true; } return isAssignmentExpression( @@ -12351,50 +12390,50 @@ ${lanes.join("\n")} } function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) { const kind = node.kind; - return kind === 210 /* PropertyAccessExpression */ || kind === 165 /* QualifiedName */ || kind === 204 /* ImportType */; + return kind === 211 /* PropertyAccessExpression */ || kind === 166 /* QualifiedName */ || kind === 205 /* ImportType */; } function isPropertyAccessOrQualifiedName(node) { const kind = node.kind; - return kind === 210 /* PropertyAccessExpression */ || kind === 165 /* QualifiedName */; + return kind === 211 /* PropertyAccessExpression */ || kind === 166 /* QualifiedName */; } function isCallLikeExpression(node) { switch (node.kind) { - case 285 /* JsxOpeningElement */: - case 284 /* JsxSelfClosingElement */: - case 212 /* CallExpression */: - case 213 /* NewExpression */: - case 214 /* TaggedTemplateExpression */: - case 169 /* Decorator */: + case 286 /* JsxOpeningElement */: + case 285 /* JsxSelfClosingElement */: + case 213 /* CallExpression */: + case 214 /* NewExpression */: + case 215 /* TaggedTemplateExpression */: + case 170 /* Decorator */: return true; default: return false; } } function isCallOrNewExpression(node) { - return node.kind === 212 /* CallExpression */ || node.kind === 213 /* NewExpression */; + return node.kind === 213 /* CallExpression */ || node.kind === 214 /* NewExpression */; } function isTemplateLiteral(node) { const kind = node.kind; - return kind === 227 /* TemplateExpression */ || kind === 15 /* NoSubstitutionTemplateLiteral */; + return kind === 228 /* TemplateExpression */ || kind === 15 /* NoSubstitutionTemplateLiteral */; } function isLeftHandSideExpression(node) { return isLeftHandSideExpressionKind(skipPartiallyEmittedExpressions(node).kind); } function isLeftHandSideExpressionKind(kind) { switch (kind) { - case 210 /* PropertyAccessExpression */: - case 211 /* ElementAccessExpression */: - case 213 /* NewExpression */: - case 212 /* CallExpression */: - case 283 /* JsxElement */: - case 284 /* JsxSelfClosingElement */: - case 287 /* JsxFragment */: - case 214 /* TaggedTemplateExpression */: - case 208 /* ArrayLiteralExpression */: - case 216 /* ParenthesizedExpression */: - case 209 /* ObjectLiteralExpression */: - case 230 /* ClassExpression */: - case 217 /* FunctionExpression */: + case 211 /* PropertyAccessExpression */: + case 212 /* ElementAccessExpression */: + case 214 /* NewExpression */: + case 213 /* CallExpression */: + case 284 /* JsxElement */: + case 285 /* JsxSelfClosingElement */: + case 288 /* JsxFragment */: + case 215 /* TaggedTemplateExpression */: + case 209 /* ArrayLiteralExpression */: + case 217 /* ParenthesizedExpression */: + case 210 /* ObjectLiteralExpression */: + case 231 /* ClassExpression */: + case 218 /* FunctionExpression */: case 80 /* Identifier */: case 81 /* PrivateIdentifier */: case 14 /* RegularExpressionLiteral */: @@ -12402,17 +12441,17 @@ ${lanes.join("\n")} case 10 /* BigIntLiteral */: case 11 /* StringLiteral */: case 15 /* NoSubstitutionTemplateLiteral */: - case 227 /* TemplateExpression */: + case 228 /* TemplateExpression */: case 97 /* FalseKeyword */: case 106 /* NullKeyword */: case 110 /* ThisKeyword */: case 112 /* TrueKeyword */: case 108 /* SuperKeyword */: - case 234 /* NonNullExpression */: - case 232 /* ExpressionWithTypeArguments */: - case 235 /* MetaProperty */: + case 235 /* NonNullExpression */: + case 233 /* ExpressionWithTypeArguments */: + case 236 /* MetaProperty */: case 102 /* ImportKeyword */: - case 281 /* MissingDeclaration */: + case 282 /* MissingDeclaration */: return true; default: return false; @@ -12423,13 +12462,13 @@ ${lanes.join("\n")} } function isUnaryExpressionKind(kind) { switch (kind) { - case 223 /* PrefixUnaryExpression */: - case 224 /* PostfixUnaryExpression */: - case 219 /* DeleteExpression */: - case 220 /* TypeOfExpression */: - case 221 /* VoidExpression */: - case 222 /* AwaitExpression */: - case 215 /* TypeAssertionExpression */: + case 224 /* PrefixUnaryExpression */: + case 225 /* PostfixUnaryExpression */: + case 220 /* DeleteExpression */: + case 221 /* TypeOfExpression */: + case 222 /* VoidExpression */: + case 223 /* AwaitExpression */: + case 216 /* TypeAssertionExpression */: return true; default: return isLeftHandSideExpressionKind(kind); @@ -12437,9 +12476,9 @@ ${lanes.join("\n")} } function isUnaryExpressionWithWrite(expr) { switch (expr.kind) { - case 224 /* PostfixUnaryExpression */: + case 225 /* PostfixUnaryExpression */: return true; - case 223 /* PrefixUnaryExpression */: + case 224 /* PrefixUnaryExpression */: return expr.operator === 46 /* PlusPlusToken */ || expr.operator === 47 /* MinusMinusToken */; default: return false; @@ -12450,7 +12489,7 @@ ${lanes.join("\n")} case 106 /* NullKeyword */: case 112 /* TrueKeyword */: case 97 /* FalseKeyword */: - case 223 /* PrefixUnaryExpression */: + case 224 /* PrefixUnaryExpression */: return true; default: return isLiteralExpression(node); @@ -12461,16 +12500,16 @@ ${lanes.join("\n")} } function isExpressionKind(kind) { switch (kind) { - case 226 /* ConditionalExpression */: - case 228 /* YieldExpression */: - case 218 /* ArrowFunction */: - case 225 /* BinaryExpression */: - case 229 /* SpreadElement */: - case 233 /* AsExpression */: - case 231 /* OmittedExpression */: - case 360 /* CommaListExpression */: - case 359 /* PartiallyEmittedExpression */: - case 237 /* SatisfiesExpression */: + case 227 /* ConditionalExpression */: + case 229 /* YieldExpression */: + case 219 /* ArrowFunction */: + case 226 /* BinaryExpression */: + case 230 /* SpreadElement */: + case 234 /* AsExpression */: + case 232 /* OmittedExpression */: + case 361 /* CommaListExpression */: + case 360 /* PartiallyEmittedExpression */: + case 238 /* SatisfiesExpression */: return true; default: return isUnaryExpressionKind(kind); @@ -12478,20 +12517,20 @@ ${lanes.join("\n")} } function isAssertionExpression(node) { const kind = node.kind; - return kind === 215 /* TypeAssertionExpression */ || kind === 233 /* AsExpression */; + return kind === 216 /* TypeAssertionExpression */ || kind === 234 /* AsExpression */; } function isNotEmittedOrPartiallyEmittedNode(node) { return isNotEmittedStatement(node) || isPartiallyEmittedExpression(node); } function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 247 /* ForStatement */: - case 248 /* ForInStatement */: - case 249 /* ForOfStatement */: - case 245 /* DoStatement */: - case 246 /* WhileStatement */: + case 248 /* ForStatement */: + case 249 /* ForInStatement */: + case 250 /* ForOfStatement */: + case 246 /* DoStatement */: + case 247 /* WhileStatement */: return true; - case 255 /* LabeledStatement */: + case 256 /* LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -12509,7 +12548,7 @@ ${lanes.join("\n")} return isAnyImportOrReExport(result) || isExportAssignment(result) || hasSyntacticModifier(result, 1 /* Export */); } function isForInOrOfStatement(node) { - return node.kind === 248 /* ForInStatement */ || node.kind === 249 /* ForOfStatement */; + return node.kind === 249 /* ForInStatement */ || node.kind === 250 /* ForOfStatement */; } function isConciseBody(node) { return isBlock(node) || isExpression(node); @@ -12522,89 +12561,89 @@ ${lanes.join("\n")} } function isModuleBody(node) { const kind = node.kind; - return kind === 267 /* ModuleBlock */ || kind === 266 /* ModuleDeclaration */ || kind === 80 /* Identifier */; + return kind === 268 /* ModuleBlock */ || kind === 267 /* ModuleDeclaration */ || kind === 80 /* Identifier */; } function isNamespaceBody(node) { const kind = node.kind; - return kind === 267 /* ModuleBlock */ || kind === 266 /* ModuleDeclaration */; + return kind === 268 /* ModuleBlock */ || kind === 267 /* ModuleDeclaration */; } function isJSDocNamespaceBody(node) { const kind = node.kind; - return kind === 80 /* Identifier */ || kind === 266 /* ModuleDeclaration */; + return kind === 80 /* Identifier */ || kind === 267 /* ModuleDeclaration */; } function isNamedImportBindings(node) { const kind = node.kind; - return kind === 274 /* NamedImports */ || kind === 273 /* NamespaceImport */; + return kind === 275 /* NamedImports */ || kind === 274 /* NamespaceImport */; } function isModuleOrEnumDeclaration(node) { - return node.kind === 266 /* ModuleDeclaration */ || node.kind === 265 /* EnumDeclaration */; + return node.kind === 267 /* ModuleDeclaration */ || node.kind === 266 /* EnumDeclaration */; } function canHaveSymbol(node) { switch (node.kind) { - case 218 /* ArrowFunction */: - case 225 /* BinaryExpression */: - case 207 /* BindingElement */: - case 212 /* CallExpression */: - case 178 /* CallSignature */: - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: - case 174 /* ClassStaticBlockDeclaration */: - case 175 /* Constructor */: - case 184 /* ConstructorType */: - case 179 /* ConstructSignature */: - case 211 /* ElementAccessExpression */: - case 265 /* EnumDeclaration */: - case 305 /* EnumMember */: - case 276 /* ExportAssignment */: - case 277 /* ExportDeclaration */: - case 280 /* ExportSpecifier */: - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 183 /* FunctionType */: - case 176 /* GetAccessor */: + case 219 /* ArrowFunction */: + case 226 /* BinaryExpression */: + case 208 /* BindingElement */: + case 213 /* CallExpression */: + case 179 /* CallSignature */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: + case 175 /* ClassStaticBlockDeclaration */: + case 176 /* Constructor */: + case 185 /* ConstructorType */: + case 180 /* ConstructSignature */: + case 212 /* ElementAccessExpression */: + case 266 /* EnumDeclaration */: + case 306 /* EnumMember */: + case 277 /* ExportAssignment */: + case 278 /* ExportDeclaration */: + case 281 /* ExportSpecifier */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 184 /* FunctionType */: + case 177 /* GetAccessor */: case 80 /* Identifier */: - case 272 /* ImportClause */: - case 270 /* ImportEqualsDeclaration */: - case 275 /* ImportSpecifier */: - case 180 /* IndexSignature */: - case 263 /* InterfaceDeclaration */: - case 344 /* JSDocCallbackTag */: - case 346 /* JSDocEnumTag */: - case 323 /* JSDocFunctionType */: - case 347 /* JSDocParameterTag */: - case 354 /* JSDocPropertyTag */: - case 329 /* JSDocSignature */: - case 352 /* JSDocTypedefTag */: - case 328 /* JSDocTypeLiteral */: - case 290 /* JsxAttribute */: - case 291 /* JsxAttributes */: - case 292 /* JsxSpreadAttribute */: - case 199 /* MappedType */: - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: - case 266 /* ModuleDeclaration */: - case 201 /* NamedTupleMember */: - case 279 /* NamespaceExport */: - case 269 /* NamespaceExportDeclaration */: - case 273 /* NamespaceImport */: - case 213 /* NewExpression */: + case 273 /* ImportClause */: + case 271 /* ImportEqualsDeclaration */: + case 276 /* ImportSpecifier */: + case 181 /* IndexSignature */: + case 264 /* InterfaceDeclaration */: + case 345 /* JSDocCallbackTag */: + case 347 /* JSDocEnumTag */: + case 324 /* JSDocFunctionType */: + case 348 /* JSDocParameterTag */: + case 355 /* JSDocPropertyTag */: + case 330 /* JSDocSignature */: + case 353 /* JSDocTypedefTag */: + case 329 /* JSDocTypeLiteral */: + case 291 /* JsxAttribute */: + case 292 /* JsxAttributes */: + case 293 /* JsxSpreadAttribute */: + case 200 /* MappedType */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: + case 267 /* ModuleDeclaration */: + case 202 /* NamedTupleMember */: + case 280 /* NamespaceExport */: + case 270 /* NamespaceExportDeclaration */: + case 274 /* NamespaceImport */: + case 214 /* NewExpression */: case 15 /* NoSubstitutionTemplateLiteral */: case 9 /* NumericLiteral */: - case 209 /* ObjectLiteralExpression */: - case 168 /* Parameter */: - case 210 /* PropertyAccessExpression */: - case 302 /* PropertyAssignment */: - case 171 /* PropertyDeclaration */: - case 170 /* PropertySignature */: - case 177 /* SetAccessor */: - case 303 /* ShorthandPropertyAssignment */: - case 311 /* SourceFile */: - case 304 /* SpreadAssignment */: + case 210 /* ObjectLiteralExpression */: + case 169 /* Parameter */: + case 211 /* PropertyAccessExpression */: + case 303 /* PropertyAssignment */: + case 172 /* PropertyDeclaration */: + case 171 /* PropertySignature */: + case 178 /* SetAccessor */: + case 304 /* ShorthandPropertyAssignment */: + case 312 /* SourceFile */: + case 305 /* SpreadAssignment */: case 11 /* StringLiteral */: - case 264 /* TypeAliasDeclaration */: - case 186 /* TypeLiteral */: - case 167 /* TypeParameter */: - case 259 /* VariableDeclaration */: + case 265 /* TypeAliasDeclaration */: + case 187 /* TypeLiteral */: + case 168 /* TypeParameter */: + case 260 /* VariableDeclaration */: return true; default: return false; @@ -12612,53 +12651,53 @@ ${lanes.join("\n")} } function canHaveLocals(node) { switch (node.kind) { - case 218 /* ArrowFunction */: - case 240 /* Block */: - case 178 /* CallSignature */: - case 268 /* CaseBlock */: - case 298 /* CatchClause */: - case 174 /* ClassStaticBlockDeclaration */: - case 193 /* ConditionalType */: - case 175 /* Constructor */: - case 184 /* ConstructorType */: - case 179 /* ConstructSignature */: - case 247 /* ForStatement */: - case 248 /* ForInStatement */: - case 249 /* ForOfStatement */: - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 183 /* FunctionType */: - case 176 /* GetAccessor */: - case 180 /* IndexSignature */: - case 344 /* JSDocCallbackTag */: - case 346 /* JSDocEnumTag */: - case 323 /* JSDocFunctionType */: - case 329 /* JSDocSignature */: - case 352 /* JSDocTypedefTag */: - case 199 /* MappedType */: - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: - case 266 /* ModuleDeclaration */: - case 177 /* SetAccessor */: - case 311 /* SourceFile */: - case 264 /* TypeAliasDeclaration */: + case 219 /* ArrowFunction */: + case 241 /* Block */: + case 179 /* CallSignature */: + case 269 /* CaseBlock */: + case 299 /* CatchClause */: + case 175 /* ClassStaticBlockDeclaration */: + case 194 /* ConditionalType */: + case 176 /* Constructor */: + case 185 /* ConstructorType */: + case 180 /* ConstructSignature */: + case 248 /* ForStatement */: + case 249 /* ForInStatement */: + case 250 /* ForOfStatement */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 184 /* FunctionType */: + case 177 /* GetAccessor */: + case 181 /* IndexSignature */: + case 345 /* JSDocCallbackTag */: + case 347 /* JSDocEnumTag */: + case 324 /* JSDocFunctionType */: + case 330 /* JSDocSignature */: + case 353 /* JSDocTypedefTag */: + case 200 /* MappedType */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: + case 267 /* ModuleDeclaration */: + case 178 /* SetAccessor */: + case 312 /* SourceFile */: + case 265 /* TypeAliasDeclaration */: return true; default: return false; } } function isDeclarationKind(kind) { - return kind === 218 /* ArrowFunction */ || kind === 207 /* BindingElement */ || kind === 262 /* ClassDeclaration */ || kind === 230 /* ClassExpression */ || kind === 174 /* ClassStaticBlockDeclaration */ || kind === 175 /* Constructor */ || kind === 265 /* EnumDeclaration */ || kind === 305 /* EnumMember */ || kind === 280 /* ExportSpecifier */ || kind === 261 /* FunctionDeclaration */ || kind === 217 /* FunctionExpression */ || kind === 176 /* GetAccessor */ || kind === 272 /* ImportClause */ || kind === 270 /* ImportEqualsDeclaration */ || kind === 275 /* ImportSpecifier */ || kind === 263 /* InterfaceDeclaration */ || kind === 290 /* JsxAttribute */ || kind === 173 /* MethodDeclaration */ || kind === 172 /* MethodSignature */ || kind === 266 /* ModuleDeclaration */ || kind === 269 /* NamespaceExportDeclaration */ || kind === 273 /* NamespaceImport */ || kind === 279 /* NamespaceExport */ || kind === 168 /* Parameter */ || kind === 302 /* PropertyAssignment */ || kind === 171 /* PropertyDeclaration */ || kind === 170 /* PropertySignature */ || kind === 177 /* SetAccessor */ || kind === 303 /* ShorthandPropertyAssignment */ || kind === 264 /* TypeAliasDeclaration */ || kind === 167 /* TypeParameter */ || kind === 259 /* VariableDeclaration */ || kind === 352 /* JSDocTypedefTag */ || kind === 344 /* JSDocCallbackTag */ || kind === 354 /* JSDocPropertyTag */; + return kind === 219 /* ArrowFunction */ || kind === 208 /* BindingElement */ || kind === 263 /* ClassDeclaration */ || kind === 231 /* ClassExpression */ || kind === 175 /* ClassStaticBlockDeclaration */ || kind === 176 /* Constructor */ || kind === 266 /* EnumDeclaration */ || kind === 306 /* EnumMember */ || kind === 281 /* ExportSpecifier */ || kind === 262 /* FunctionDeclaration */ || kind === 218 /* FunctionExpression */ || kind === 177 /* GetAccessor */ || kind === 273 /* ImportClause */ || kind === 271 /* ImportEqualsDeclaration */ || kind === 276 /* ImportSpecifier */ || kind === 264 /* InterfaceDeclaration */ || kind === 291 /* JsxAttribute */ || kind === 174 /* MethodDeclaration */ || kind === 173 /* MethodSignature */ || kind === 267 /* ModuleDeclaration */ || kind === 270 /* NamespaceExportDeclaration */ || kind === 274 /* NamespaceImport */ || kind === 280 /* NamespaceExport */ || kind === 169 /* Parameter */ || kind === 303 /* PropertyAssignment */ || kind === 172 /* PropertyDeclaration */ || kind === 171 /* PropertySignature */ || kind === 178 /* SetAccessor */ || kind === 304 /* ShorthandPropertyAssignment */ || kind === 265 /* TypeAliasDeclaration */ || kind === 168 /* TypeParameter */ || kind === 260 /* VariableDeclaration */ || kind === 353 /* JSDocTypedefTag */ || kind === 345 /* JSDocCallbackTag */ || kind === 355 /* JSDocPropertyTag */; } function isDeclarationStatementKind(kind) { - return kind === 261 /* FunctionDeclaration */ || kind === 281 /* MissingDeclaration */ || kind === 262 /* ClassDeclaration */ || kind === 263 /* InterfaceDeclaration */ || kind === 264 /* TypeAliasDeclaration */ || kind === 265 /* EnumDeclaration */ || kind === 266 /* ModuleDeclaration */ || kind === 271 /* ImportDeclaration */ || kind === 270 /* ImportEqualsDeclaration */ || kind === 277 /* ExportDeclaration */ || kind === 276 /* ExportAssignment */ || kind === 269 /* NamespaceExportDeclaration */; + return kind === 262 /* FunctionDeclaration */ || kind === 282 /* MissingDeclaration */ || kind === 263 /* ClassDeclaration */ || kind === 264 /* InterfaceDeclaration */ || kind === 265 /* TypeAliasDeclaration */ || kind === 266 /* EnumDeclaration */ || kind === 267 /* ModuleDeclaration */ || kind === 272 /* ImportDeclaration */ || kind === 271 /* ImportEqualsDeclaration */ || kind === 278 /* ExportDeclaration */ || kind === 277 /* ExportAssignment */ || kind === 270 /* NamespaceExportDeclaration */; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 251 /* BreakStatement */ || kind === 250 /* ContinueStatement */ || kind === 258 /* DebuggerStatement */ || kind === 245 /* DoStatement */ || kind === 243 /* ExpressionStatement */ || kind === 241 /* EmptyStatement */ || kind === 248 /* ForInStatement */ || kind === 249 /* ForOfStatement */ || kind === 247 /* ForStatement */ || kind === 244 /* IfStatement */ || kind === 255 /* LabeledStatement */ || kind === 252 /* ReturnStatement */ || kind === 254 /* SwitchStatement */ || kind === 256 /* ThrowStatement */ || kind === 257 /* TryStatement */ || kind === 242 /* VariableStatement */ || kind === 246 /* WhileStatement */ || kind === 253 /* WithStatement */ || kind === 358 /* NotEmittedStatement */; + return kind === 252 /* BreakStatement */ || kind === 251 /* ContinueStatement */ || kind === 259 /* DebuggerStatement */ || kind === 246 /* DoStatement */ || kind === 244 /* ExpressionStatement */ || kind === 242 /* EmptyStatement */ || kind === 249 /* ForInStatement */ || kind === 250 /* ForOfStatement */ || kind === 248 /* ForStatement */ || kind === 245 /* IfStatement */ || kind === 256 /* LabeledStatement */ || kind === 253 /* ReturnStatement */ || kind === 255 /* SwitchStatement */ || kind === 257 /* ThrowStatement */ || kind === 258 /* TryStatement */ || kind === 243 /* VariableStatement */ || kind === 247 /* WhileStatement */ || kind === 254 /* WithStatement */ || kind === 359 /* NotEmittedStatement */; } function isDeclaration(node) { - if (node.kind === 167 /* TypeParameter */) { - return node.parent && node.parent.kind !== 351 /* JSDocTemplateTag */ || isInJSFile(node); + if (node.kind === 168 /* TypeParameter */) { + return node.parent && node.parent.kind !== 352 /* JSDocTemplateTag */ || isInJSFile(node); } return isDeclarationKind(node.kind); } @@ -12673,10 +12712,10 @@ ${lanes.join("\n")} return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) || isBlockStatement(node); } function isBlockStatement(node) { - if (node.kind !== 240 /* Block */) + if (node.kind !== 241 /* Block */) return false; if (node.parent !== void 0) { - if (node.parent.kind === 257 /* TryStatement */ || node.parent.kind === 298 /* CatchClause */) { + if (node.parent.kind === 258 /* TryStatement */ || node.parent.kind === 299 /* CatchClause */) { return false; } } @@ -12684,50 +12723,50 @@ ${lanes.join("\n")} } function isStatementOrBlock(node) { const kind = node.kind; - return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) || kind === 240 /* Block */; + return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) || kind === 241 /* Block */; } function isModuleReference(node) { const kind = node.kind; - return kind === 282 /* ExternalModuleReference */ || kind === 165 /* QualifiedName */ || kind === 80 /* Identifier */; + return kind === 283 /* ExternalModuleReference */ || kind === 166 /* QualifiedName */ || kind === 80 /* Identifier */; } function isJsxTagNameExpression(node) { const kind = node.kind; - return kind === 110 /* ThisKeyword */ || kind === 80 /* Identifier */ || kind === 210 /* PropertyAccessExpression */ || kind === 294 /* JsxNamespacedName */; + return kind === 110 /* ThisKeyword */ || kind === 80 /* Identifier */ || kind === 211 /* PropertyAccessExpression */ || kind === 295 /* JsxNamespacedName */; } function isJsxChild(node) { const kind = node.kind; - return kind === 283 /* JsxElement */ || kind === 293 /* JsxExpression */ || kind === 284 /* JsxSelfClosingElement */ || kind === 12 /* JsxText */ || kind === 287 /* JsxFragment */; + return kind === 284 /* JsxElement */ || kind === 294 /* JsxExpression */ || kind === 285 /* JsxSelfClosingElement */ || kind === 12 /* JsxText */ || kind === 288 /* JsxFragment */; } function isJsxAttributeLike(node) { const kind = node.kind; - return kind === 290 /* JsxAttribute */ || kind === 292 /* JsxSpreadAttribute */; + return kind === 291 /* JsxAttribute */ || kind === 293 /* JsxSpreadAttribute */; } function isStringLiteralOrJsxExpression(node) { const kind = node.kind; - return kind === 11 /* StringLiteral */ || kind === 293 /* JsxExpression */; + return kind === 11 /* StringLiteral */ || kind === 294 /* JsxExpression */; } function isJsxOpeningLikeElement(node) { const kind = node.kind; - return kind === 285 /* JsxOpeningElement */ || kind === 284 /* JsxSelfClosingElement */; + return kind === 286 /* JsxOpeningElement */ || kind === 285 /* JsxSelfClosingElement */; } function isCaseOrDefaultClause(node) { const kind = node.kind; - return kind === 295 /* CaseClause */ || kind === 296 /* DefaultClause */; + return kind === 296 /* CaseClause */ || kind === 297 /* DefaultClause */; } function isJSDocNode(node) { - return node.kind >= 315 /* FirstJSDocNode */ && node.kind <= 356 /* LastJSDocNode */; + return node.kind >= 316 /* FirstJSDocNode */ && node.kind <= 357 /* LastJSDocNode */; } function isJSDocCommentContainingNode(node) { - return node.kind === 326 /* JSDoc */ || node.kind === 325 /* JSDocNamepathType */ || node.kind === 327 /* JSDocText */ || isJSDocLinkLike(node) || isJSDocTag(node) || isJSDocTypeLiteral(node) || isJSDocSignature(node); + return node.kind === 327 /* JSDoc */ || node.kind === 326 /* JSDocNamepathType */ || node.kind === 328 /* JSDocText */ || isJSDocLinkLike(node) || isJSDocTag(node) || isJSDocTypeLiteral(node) || isJSDocSignature(node); } function isJSDocTag(node) { - return node.kind >= 333 /* FirstJSDocTagNode */ && node.kind <= 356 /* LastJSDocTagNode */; + return node.kind >= 334 /* FirstJSDocTagNode */ && node.kind <= 357 /* LastJSDocTagNode */; } function isSetAccessor(node) { - return node.kind === 177 /* SetAccessor */; + return node.kind === 178 /* SetAccessor */; } function isGetAccessor(node) { - return node.kind === 176 /* GetAccessor */; + return node.kind === 177 /* GetAccessor */; } function hasJSDocNodes(node) { if (!canHaveJSDoc(node)) @@ -12743,22 +12782,22 @@ ${lanes.join("\n")} } function hasOnlyExpressionInitializer(node) { switch (node.kind) { - case 259 /* VariableDeclaration */: - case 168 /* Parameter */: - case 207 /* BindingElement */: - case 171 /* PropertyDeclaration */: - case 302 /* PropertyAssignment */: - case 305 /* EnumMember */: + case 260 /* VariableDeclaration */: + case 169 /* Parameter */: + case 208 /* BindingElement */: + case 172 /* PropertyDeclaration */: + case 303 /* PropertyAssignment */: + case 306 /* EnumMember */: return true; default: return false; } } function isObjectLiteralElement(node) { - return node.kind === 290 /* JsxAttribute */ || node.kind === 292 /* JsxSpreadAttribute */ || isObjectLiteralElementLike(node); + return node.kind === 291 /* JsxAttribute */ || node.kind === 293 /* JsxSpreadAttribute */ || isObjectLiteralElementLike(node); } function isTypeReferenceType(node) { - return node.kind === 182 /* TypeReference */ || node.kind === 232 /* ExpressionWithTypeArguments */; + return node.kind === 183 /* TypeReference */ || node.kind === 233 /* ExpressionWithTypeArguments */; } function guessIndentation(lines) { let indentation = MAX_SMI_X86; @@ -12785,7 +12824,7 @@ ${lanes.join("\n")} return node.kind === 11 /* StringLiteral */ || node.kind === 15 /* NoSubstitutionTemplateLiteral */; } function isJSDocLinkLike(node) { - return node.kind === 330 /* JSDocLink */ || node.kind === 331 /* JSDocLinkCode */ || node.kind === 332 /* JSDocLinkPlain */; + return node.kind === 331 /* JSDocLink */ || node.kind === 332 /* JSDocLinkCode */ || node.kind === 333 /* JSDocLinkPlain */; } function hasRestParameter(s) { const last2 = lastOrUndefined(s.parameters); @@ -12793,7 +12832,7 @@ ${lanes.join("\n")} } function isRestParameter(node) { const type = isJSDocParameterTag(node) ? node.typeExpression && node.typeExpression.type : node.type; - return node.dotDotDotToken !== void 0 || !!type && type.kind === 324 /* JSDocVariadicType */; + return node.dotDotDotToken !== void 0 || !!type && type.kind === 325 /* JSDocVariadicType */; } var unchangedTextChangeRange, supportedLocaleDirectories, MAX_SMI_X86; var init_utilitiesPublic = __esm({ @@ -13015,19 +13054,19 @@ ${lanes.join("\n")} } function containsParseError(node) { aggregateChildData(node); - return (node.flags & 524288 /* ThisNodeOrAnySubNodesHasError */) !== 0; + return (node.flags & 1048576 /* ThisNodeOrAnySubNodesHasError */) !== 0; } function aggregateChildData(node) { - if (!(node.flags & 1048576 /* HasAggregatedChildData */)) { - const thisNodeOrAnySubNodesHasError = (node.flags & 131072 /* ThisNodeHasError */) !== 0 || forEachChild(node, containsParseError); + if (!(node.flags & 2097152 /* HasAggregatedChildData */)) { + const thisNodeOrAnySubNodesHasError = (node.flags & 262144 /* ThisNodeHasError */) !== 0 || forEachChild(node, containsParseError); if (thisNodeOrAnySubNodesHasError) { - node.flags |= 524288 /* ThisNodeOrAnySubNodesHasError */; + node.flags |= 1048576 /* ThisNodeOrAnySubNodesHasError */; } - node.flags |= 1048576 /* HasAggregatedChildData */; + node.flags |= 2097152 /* HasAggregatedChildData */; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 311 /* SourceFile */) { + while (node && node.kind !== 312 /* SourceFile */) { node = node.parent; } return node; @@ -13040,11 +13079,11 @@ ${lanes.join("\n")} } function isStatementWithLocals(node) { switch (node.kind) { - case 240 /* Block */: - case 268 /* CaseBlock */: - case 247 /* ForStatement */: - case 248 /* ForInStatement */: - case 249 /* ForOfStatement */: + case 241 /* Block */: + case 269 /* CaseBlock */: + case 248 /* ForStatement */: + case 249 /* ForInStatement */: + case 250 /* ForOfStatement */: return true; } return false; @@ -13203,7 +13242,7 @@ ${lanes.join("\n")} if (includeJsDoc && hasJSDocNodes(node)) { return getTokenPosOfNode(node.jsDoc[0], sourceFile); } - if (node.kind === 357 /* SyntaxList */ && node._children.length > 0) { + if (node.kind === 358 /* SyntaxList */ && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return skipTrivia( @@ -13718,11 +13757,11 @@ ${lanes.join("\n")} return getBaseFileName(moduleName).replace(/^(\d)/, "_$1").replace(/\W/g, "_"); } function isBlockOrCatchScoped(declaration) { - return (getCombinedNodeFlags(declaration) & 3 /* BlockScoped */) !== 0 || isCatchClauseVariableDeclarationOrBindingElement(declaration); + return (getCombinedNodeFlags(declaration) & 7 /* BlockScoped */) !== 0 || isCatchClauseVariableDeclarationOrBindingElement(declaration); } function isCatchClauseVariableDeclarationOrBindingElement(declaration) { const node = getRootDeclaration(declaration); - return node.kind === 259 /* VariableDeclaration */ && node.parent.kind === 298 /* CatchClause */; + return node.kind === 260 /* VariableDeclaration */ && node.parent.kind === 299 /* CatchClause */; } function isAmbientModule(node) { return isModuleDeclaration(node) && (node.name.kind === 11 /* StringLiteral */ || isGlobalScopeAugmentation(node)); @@ -13740,22 +13779,22 @@ ${lanes.join("\n")} return isShorthandAmbientModule(moduleSymbol.valueDeclaration); } function isShorthandAmbientModule(node) { - return !!node && node.kind === 266 /* ModuleDeclaration */ && !node.body; + return !!node && node.kind === 267 /* ModuleDeclaration */ && !node.body; } function isBlockScopedContainerTopLevel(node) { - return node.kind === 311 /* SourceFile */ || node.kind === 266 /* ModuleDeclaration */ || isFunctionLikeOrClassStaticBlockDeclaration(node); + return node.kind === 312 /* SourceFile */ || node.kind === 267 /* ModuleDeclaration */ || isFunctionLikeOrClassStaticBlockDeclaration(node); } function isGlobalScopeAugmentation(module2) { - return !!(module2.flags & 1024 /* GlobalAugmentation */); + return !!(module2.flags & 2048 /* GlobalAugmentation */); } function isExternalModuleAugmentation(node) { return isAmbientModule(node) && isModuleAugmentationExternal(node); } function isModuleAugmentationExternal(node) { switch (node.parent.kind) { - case 311 /* SourceFile */: + case 312 /* SourceFile */: return isExternalModule(node.parent); - case 267 /* ModuleBlock */: + case 268 /* ModuleBlock */: return isAmbientModule(node.parent.parent) && isSourceFile(node.parent.parent.parent) && !isExternalModule(node.parent.parent.parent); } return false; @@ -13798,28 +13837,28 @@ ${lanes.join("\n")} return false; } function isAmbientPropertyDeclaration(node) { - return !!(node.flags & 16777216 /* Ambient */) || hasSyntacticModifier(node, 2 /* Ambient */); + return !!(node.flags & 33554432 /* Ambient */) || hasSyntacticModifier(node, 2 /* Ambient */); } function isBlockScope(node, parentNode) { switch (node.kind) { - case 311 /* SourceFile */: - case 268 /* CaseBlock */: - case 298 /* CatchClause */: - case 266 /* ModuleDeclaration */: - case 247 /* ForStatement */: - case 248 /* ForInStatement */: - case 249 /* ForOfStatement */: - case 175 /* Constructor */: - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: - case 171 /* PropertyDeclaration */: - case 174 /* ClassStaticBlockDeclaration */: + case 312 /* SourceFile */: + case 269 /* CaseBlock */: + case 299 /* CatchClause */: + case 267 /* ModuleDeclaration */: + case 248 /* ForStatement */: + case 249 /* ForInStatement */: + case 250 /* ForOfStatement */: + case 176 /* Constructor */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: + case 172 /* PropertyDeclaration */: + case 175 /* ClassStaticBlockDeclaration */: return true; - case 240 /* Block */: + case 241 /* Block */: return !isFunctionLikeOrClassStaticBlockDeclaration(parentNode); } return false; @@ -13827,9 +13866,9 @@ ${lanes.join("\n")} function isDeclarationWithTypeParameters(node) { Debug.type(node); switch (node.kind) { - case 344 /* JSDocCallbackTag */: - case 352 /* JSDocTypedefTag */: - case 329 /* JSDocSignature */: + case 345 /* JSDocCallbackTag */: + case 353 /* JSDocTypedefTag */: + case 330 /* JSDocSignature */: return true; default: assertType(node); @@ -13839,25 +13878,25 @@ ${lanes.join("\n")} function isDeclarationWithTypeParameterChildren(node) { Debug.type(node); switch (node.kind) { - case 178 /* CallSignature */: - case 179 /* ConstructSignature */: - case 172 /* MethodSignature */: - case 180 /* IndexSignature */: - case 183 /* FunctionType */: - case 184 /* ConstructorType */: - case 323 /* JSDocFunctionType */: - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: - case 263 /* InterfaceDeclaration */: - case 264 /* TypeAliasDeclaration */: - case 351 /* JSDocTemplateTag */: - case 261 /* FunctionDeclaration */: - case 173 /* MethodDeclaration */: - case 175 /* Constructor */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: + case 179 /* CallSignature */: + case 180 /* ConstructSignature */: + case 173 /* MethodSignature */: + case 181 /* IndexSignature */: + case 184 /* FunctionType */: + case 185 /* ConstructorType */: + case 324 /* JSDocFunctionType */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: + case 264 /* InterfaceDeclaration */: + case 265 /* TypeAliasDeclaration */: + case 352 /* JSDocTemplateTag */: + case 262 /* FunctionDeclaration */: + case 174 /* MethodDeclaration */: + case 176 /* Constructor */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: return true; default: assertType(node); @@ -13866,8 +13905,8 @@ ${lanes.join("\n")} } function isAnyImportSyntax(node) { switch (node.kind) { - case 271 /* ImportDeclaration */: - case 270 /* ImportEqualsDeclaration */: + case 272 /* ImportDeclaration */: + case 271 /* ImportEqualsDeclaration */: return true; default: return false; @@ -13878,15 +13917,15 @@ ${lanes.join("\n")} } function isLateVisibilityPaintedStatement(node) { switch (node.kind) { - case 271 /* ImportDeclaration */: - case 270 /* ImportEqualsDeclaration */: - case 242 /* VariableStatement */: - case 262 /* ClassDeclaration */: - case 261 /* FunctionDeclaration */: - case 266 /* ModuleDeclaration */: - case 264 /* TypeAliasDeclaration */: - case 263 /* InterfaceDeclaration */: - case 265 /* EnumDeclaration */: + case 272 /* ImportDeclaration */: + case 271 /* ImportEqualsDeclaration */: + case 243 /* VariableStatement */: + case 263 /* ClassDeclaration */: + case 262 /* FunctionDeclaration */: + case 267 /* ModuleDeclaration */: + case 265 /* TypeAliasDeclaration */: + case 264 /* InterfaceDeclaration */: + case 266 /* EnumDeclaration */: return true; default: return false; @@ -13898,6 +13937,9 @@ ${lanes.join("\n")} function isAnyImportOrReExport(node) { return isAnyImportSyntax(node) || isExportDeclaration(node); } + function getEnclosingContainer(node) { + return findAncestor(node.parent, (n) => !!(getContainerFlags(n) & 1 /* IsContainer */)); + } function getEnclosingBlockScopeContainer(node) { return findAncestor(node.parent, (current) => isBlockScope(current, current.parent)); } @@ -13915,7 +13957,7 @@ ${lanes.join("\n")} return info.declaration ? declarationNameToString(info.declaration.parameters[0].name) : void 0; } function isComputedNonLiteralName(name) { - return name.kind === 166 /* ComputedPropertyName */ && !isStringOrNumericLiteralLike(name.expression); + return name.kind === 167 /* ComputedPropertyName */ && !isStringOrNumericLiteralLike(name.expression); } function tryGetTextOfPropertyName(name) { var _a; @@ -13927,11 +13969,11 @@ ${lanes.join("\n")} case 9 /* NumericLiteral */: case 15 /* NoSubstitutionTemplateLiteral */: return escapeLeadingUnderscores(name.text); - case 166 /* ComputedPropertyName */: + case 167 /* ComputedPropertyName */: if (isStringOrNumericLiteralLike(name.expression)) return escapeLeadingUnderscores(name.expression.text); return void 0; - case 294 /* JsxNamespacedName */: + case 295 /* JsxNamespacedName */: return getEscapedTextOfJsxNamespacedName(name); default: return Debug.assertNever(name); @@ -13947,17 +13989,17 @@ ${lanes.join("\n")} case 81 /* PrivateIdentifier */: case 80 /* Identifier */: return getFullWidth(name) === 0 ? idText(name) : getTextOfNode(name); - case 165 /* QualifiedName */: + case 166 /* QualifiedName */: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 210 /* PropertyAccessExpression */: + case 211 /* PropertyAccessExpression */: if (isIdentifier(name.name) || isPrivateIdentifier(name.name)) { return entityNameToString(name.expression) + "." + entityNameToString(name.name); } else { return Debug.assertNever(name.name); } - case 317 /* JSDocMemberName */: + case 318 /* JSDocMemberName */: return entityNameToString(name.left) + entityNameToString(name.right); - case 294 /* JsxNamespacedName */: + case 295 /* JsxNamespacedName */: return entityNameToString(name.namespace) + ":" + entityNameToString(name.name); default: return Debug.assertNever(name); @@ -14063,7 +14105,7 @@ ${lanes.join("\n")} } function getErrorSpanForArrowFunction(sourceFile, node) { const pos = skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 240 /* Block */) { + if (node.body && node.body.kind === 241 /* Block */) { const { line: startLine } = getLineAndCharacterOfPosition(sourceFile, node.body.pos); const { line: endLine } = getLineAndCharacterOfPosition(sourceFile, node.body.end); if (startLine < endLine) { @@ -14075,7 +14117,7 @@ ${lanes.join("\n")} function getErrorSpanForNode(sourceFile, node) { let errorNode = node; switch (node.kind) { - case 311 /* SourceFile */: { + case 312 /* SourceFile */: { const pos2 = skipTrivia( sourceFile.text, 0, @@ -14087,43 +14129,43 @@ ${lanes.join("\n")} } return getSpanOfTokenAtPosition(sourceFile, pos2); } - case 259 /* VariableDeclaration */: - case 207 /* BindingElement */: - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: - case 263 /* InterfaceDeclaration */: - case 266 /* ModuleDeclaration */: - case 265 /* EnumDeclaration */: - case 305 /* EnumMember */: - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 264 /* TypeAliasDeclaration */: - case 171 /* PropertyDeclaration */: - case 170 /* PropertySignature */: - case 273 /* NamespaceImport */: + case 260 /* VariableDeclaration */: + case 208 /* BindingElement */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: + case 264 /* InterfaceDeclaration */: + case 267 /* ModuleDeclaration */: + case 266 /* EnumDeclaration */: + case 306 /* EnumMember */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 265 /* TypeAliasDeclaration */: + case 172 /* PropertyDeclaration */: + case 171 /* PropertySignature */: + case 274 /* NamespaceImport */: errorNode = node.name; break; - case 218 /* ArrowFunction */: + case 219 /* ArrowFunction */: return getErrorSpanForArrowFunction(sourceFile, node); - case 295 /* CaseClause */: - case 296 /* DefaultClause */: { + case 296 /* CaseClause */: + case 297 /* DefaultClause */: { const start = skipTrivia(sourceFile.text, node.pos); const end = node.statements.length > 0 ? node.statements[0].pos : node.end; return createTextSpanFromBounds(start, end); } - case 252 /* ReturnStatement */: - case 228 /* YieldExpression */: { + case 253 /* ReturnStatement */: + case 229 /* YieldExpression */: { const pos2 = skipTrivia(sourceFile.text, node.pos); return getSpanOfTokenAtPosition(sourceFile, pos2); } - case 237 /* SatisfiesExpression */: { + case 238 /* SatisfiesExpression */: { const pos2 = skipTrivia(sourceFile.text, node.expression.end); return getSpanOfTokenAtPosition(sourceFile, pos2); } - case 356 /* JSDocSatisfiesTag */: { + case 357 /* JSDocSatisfiesTag */: { const pos2 = skipTrivia(sourceFile.text, node.tagName.pos); return getSpanOfTokenAtPosition(sourceFile, pos2); } @@ -14155,17 +14197,23 @@ ${lanes.join("\n")} function isDeclarationReadonly(declaration) { return !!(getCombinedModifierFlags(declaration) & 64 /* Readonly */ && !isParameterPropertyDeclaration(declaration, declaration.parent)); } + function isVarAwaitUsing(node) { + return (getCombinedNodeFlags(node) & 7 /* BlockScoped */) === 6 /* AwaitUsing */; + } + function isVarUsing(node) { + return (getCombinedNodeFlags(node) & 7 /* BlockScoped */) === 4 /* Using */; + } function isVarConst(node) { - return !!(getCombinedNodeFlags(node) & 2 /* Const */); + return (getCombinedNodeFlags(node) & 7 /* BlockScoped */) === 2 /* Const */; } function isLet(node) { - return !!(getCombinedNodeFlags(node) & 1 /* Let */); + return (getCombinedNodeFlags(node) & 7 /* BlockScoped */) === 1 /* Let */; } function isSuperCall(n) { - return n.kind === 212 /* CallExpression */ && n.expression.kind === 108 /* SuperKeyword */; + return n.kind === 213 /* CallExpression */ && n.expression.kind === 108 /* SuperKeyword */; } function isImportCall(n) { - return n.kind === 212 /* CallExpression */ && n.expression.kind === 102 /* ImportKeyword */; + return n.kind === 213 /* CallExpression */ && n.expression.kind === 102 /* ImportKeyword */; } function isImportMeta(n) { return isMetaProperty(n) && n.keywordToken === 102 /* ImportKeyword */ && n.name.escapedText === "meta"; @@ -14174,7 +14222,7 @@ ${lanes.join("\n")} return isImportTypeNode(n) && isLiteralTypeNode(n.argument) && isStringLiteral(n.argument.literal); } function isPrologueDirective(node) { - return node.kind === 243 /* ExpressionStatement */ && node.expression.kind === 11 /* StringLiteral */; + return node.kind === 244 /* ExpressionStatement */ && node.expression.kind === 11 /* StringLiteral */; } function isCustomPrologue(node) { return !!(getEmitFlags(node) & 2097152 /* CustomPrologue */); @@ -14192,18 +14240,18 @@ ${lanes.join("\n")} return node.kind !== 12 /* JsxText */ ? getLeadingCommentRanges(sourceFileOfNode.text, node.pos) : void 0; } function getJSDocCommentRanges(node, text) { - const commentRanges = node.kind === 168 /* Parameter */ || node.kind === 167 /* TypeParameter */ || node.kind === 217 /* FunctionExpression */ || node.kind === 218 /* ArrowFunction */ || node.kind === 216 /* ParenthesizedExpression */ || node.kind === 259 /* VariableDeclaration */ || node.kind === 280 /* ExportSpecifier */ ? concatenate(getTrailingCommentRanges(text, node.pos), getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRanges(text, node.pos); + const commentRanges = node.kind === 169 /* Parameter */ || node.kind === 168 /* TypeParameter */ || node.kind === 218 /* FunctionExpression */ || node.kind === 219 /* ArrowFunction */ || node.kind === 217 /* ParenthesizedExpression */ || node.kind === 260 /* VariableDeclaration */ || node.kind === 281 /* ExportSpecifier */ ? concatenate(getTrailingCommentRanges(text, node.pos), getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRanges(text, node.pos); return filter(commentRanges, (comment) => text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 2) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 3) !== 47 /* slash */); } function isPartOfTypeNode(node) { - if (181 /* FirstTypeNode */ <= node.kind && node.kind <= 204 /* LastTypeNode */) { + if (182 /* FirstTypeNode */ <= node.kind && node.kind <= 205 /* LastTypeNode */) { return true; } switch (node.kind) { case 133 /* AnyKeyword */: case 159 /* UnknownKeyword */: case 150 /* NumberKeyword */: - case 162 /* BigIntKeyword */: + case 163 /* BigIntKeyword */: case 154 /* StringKeyword */: case 136 /* BooleanKeyword */: case 155 /* SymbolKeyword */: @@ -14213,64 +14261,64 @@ ${lanes.join("\n")} case 146 /* NeverKeyword */: return true; case 116 /* VoidKeyword */: - return node.parent.kind !== 221 /* VoidExpression */; - case 232 /* ExpressionWithTypeArguments */: + return node.parent.kind !== 222 /* VoidExpression */; + case 233 /* ExpressionWithTypeArguments */: return isHeritageClause(node.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(node); - case 167 /* TypeParameter */: - return node.parent.kind === 199 /* MappedType */ || node.parent.kind === 194 /* InferType */; + case 168 /* TypeParameter */: + return node.parent.kind === 200 /* MappedType */ || node.parent.kind === 195 /* InferType */; case 80 /* Identifier */: - if (node.parent.kind === 165 /* QualifiedName */ && node.parent.right === node) { + if (node.parent.kind === 166 /* QualifiedName */ && node.parent.right === node) { node = node.parent; - } else if (node.parent.kind === 210 /* PropertyAccessExpression */ && node.parent.name === node) { + } else if (node.parent.kind === 211 /* PropertyAccessExpression */ && node.parent.name === node) { node = node.parent; } Debug.assert( - node.kind === 80 /* Identifier */ || node.kind === 165 /* QualifiedName */ || node.kind === 210 /* PropertyAccessExpression */, + node.kind === 80 /* Identifier */ || node.kind === 166 /* QualifiedName */ || node.kind === 211 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'." ); - case 165 /* QualifiedName */: - case 210 /* PropertyAccessExpression */: + case 166 /* QualifiedName */: + case 211 /* PropertyAccessExpression */: case 110 /* ThisKeyword */: { const { parent: parent2 } = node; - if (parent2.kind === 185 /* TypeQuery */) { + if (parent2.kind === 186 /* TypeQuery */) { return false; } - if (parent2.kind === 204 /* ImportType */) { + if (parent2.kind === 205 /* ImportType */) { return !parent2.isTypeOf; } - if (181 /* FirstTypeNode */ <= parent2.kind && parent2.kind <= 204 /* LastTypeNode */) { + if (182 /* FirstTypeNode */ <= parent2.kind && parent2.kind <= 205 /* LastTypeNode */) { return true; } switch (parent2.kind) { - case 232 /* ExpressionWithTypeArguments */: + case 233 /* ExpressionWithTypeArguments */: return isHeritageClause(parent2.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(parent2); - case 167 /* TypeParameter */: + case 168 /* TypeParameter */: return node === parent2.constraint; - case 351 /* JSDocTemplateTag */: + case 352 /* JSDocTemplateTag */: return node === parent2.constraint; - case 171 /* PropertyDeclaration */: - case 170 /* PropertySignature */: - case 168 /* Parameter */: - case 259 /* VariableDeclaration */: + case 172 /* PropertyDeclaration */: + case 171 /* PropertySignature */: + case 169 /* Parameter */: + case 260 /* VariableDeclaration */: return node === parent2.type; - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: - case 175 /* Constructor */: - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: + case 176 /* Constructor */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: return node === parent2.type; - case 178 /* CallSignature */: - case 179 /* ConstructSignature */: - case 180 /* IndexSignature */: + case 179 /* CallSignature */: + case 180 /* ConstructSignature */: + case 181 /* IndexSignature */: return node === parent2.type; - case 215 /* TypeAssertionExpression */: + case 216 /* TypeAssertionExpression */: return node === parent2.type; - case 212 /* CallExpression */: - case 213 /* NewExpression */: - case 214 /* TaggedTemplateExpression */: + case 213 /* CallExpression */: + case 214 /* NewExpression */: + case 215 /* TaggedTemplateExpression */: return contains(parent2.typeArguments, node); } } @@ -14290,23 +14338,23 @@ ${lanes.join("\n")} return traverse(body); function traverse(node) { switch (node.kind) { - case 252 /* ReturnStatement */: + case 253 /* ReturnStatement */: return visitor(node); - case 268 /* CaseBlock */: - case 240 /* Block */: - case 244 /* IfStatement */: - case 245 /* DoStatement */: - case 246 /* WhileStatement */: - case 247 /* ForStatement */: - case 248 /* ForInStatement */: - case 249 /* ForOfStatement */: - case 253 /* WithStatement */: - case 254 /* SwitchStatement */: - case 295 /* CaseClause */: - case 296 /* DefaultClause */: - case 255 /* LabeledStatement */: - case 257 /* TryStatement */: - case 298 /* CatchClause */: + case 269 /* CaseBlock */: + case 241 /* Block */: + case 245 /* IfStatement */: + case 246 /* DoStatement */: + case 247 /* WhileStatement */: + case 248 /* ForStatement */: + case 249 /* ForInStatement */: + case 250 /* ForOfStatement */: + case 254 /* WithStatement */: + case 255 /* SwitchStatement */: + case 296 /* CaseClause */: + case 297 /* DefaultClause */: + case 256 /* LabeledStatement */: + case 258 /* TryStatement */: + case 299 /* CatchClause */: return forEachChild(node, traverse); } } @@ -14315,21 +14363,21 @@ ${lanes.join("\n")} return traverse(body); function traverse(node) { switch (node.kind) { - case 228 /* YieldExpression */: + case 229 /* YieldExpression */: visitor(node); const operand = node.expression; if (operand) { traverse(operand); } return; - case 265 /* EnumDeclaration */: - case 263 /* InterfaceDeclaration */: - case 266 /* ModuleDeclaration */: - case 264 /* TypeAliasDeclaration */: + case 266 /* EnumDeclaration */: + case 264 /* InterfaceDeclaration */: + case 267 /* ModuleDeclaration */: + case 265 /* TypeAliasDeclaration */: return; default: if (isFunctionLike(node)) { - if (node.name && node.name.kind === 166 /* ComputedPropertyName */) { + if (node.name && node.name.kind === 167 /* ComputedPropertyName */) { traverse(node.name.expression); return; } @@ -14340,9 +14388,9 @@ ${lanes.join("\n")} } } function getRestParameterElementType(node) { - if (node && node.kind === 187 /* ArrayType */) { + if (node && node.kind === 188 /* ArrayType */) { return node.elementType; - } else if (node && node.kind === 182 /* TypeReference */) { + } else if (node && node.kind === 183 /* TypeReference */) { return singleOrUndefined(node.typeArguments); } else { return void 0; @@ -14350,26 +14398,26 @@ ${lanes.join("\n")} } function getMembersOfDeclaration(node) { switch (node.kind) { - case 263 /* InterfaceDeclaration */: - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: - case 186 /* TypeLiteral */: + case 264 /* InterfaceDeclaration */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: + case 187 /* TypeLiteral */: return node.members; - case 209 /* ObjectLiteralExpression */: + case 210 /* ObjectLiteralExpression */: return node.properties; } } function isVariableLike(node) { if (node) { switch (node.kind) { - case 207 /* BindingElement */: - case 305 /* EnumMember */: - case 168 /* Parameter */: - case 302 /* PropertyAssignment */: - case 171 /* PropertyDeclaration */: - case 170 /* PropertySignature */: - case 303 /* ShorthandPropertyAssignment */: - case 259 /* VariableDeclaration */: + case 208 /* BindingElement */: + case 306 /* EnumMember */: + case 169 /* Parameter */: + case 303 /* PropertyAssignment */: + case 172 /* PropertyDeclaration */: + case 171 /* PropertySignature */: + case 304 /* ShorthandPropertyAssignment */: + case 260 /* VariableDeclaration */: return true; } } @@ -14379,7 +14427,7 @@ ${lanes.join("\n")} return isVariableLike(node) || isAccessor(node); } function isVariableDeclarationInVariableStatement(node) { - return node.parent.kind === 260 /* VariableDeclarationList */ && node.parent.parent.kind === 242 /* VariableStatement */; + return node.parent.kind === 261 /* VariableDeclarationList */ && node.parent.parent.kind === 243 /* VariableStatement */; } function isCommonJsExportedExpression(node) { if (!isInJSFile(node)) @@ -14396,13 +14444,13 @@ ${lanes.join("\n")} } function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: - case 175 /* Constructor */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: + case 176 /* Constructor */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: return true; } return false; @@ -14412,20 +14460,20 @@ ${lanes.join("\n")} if (beforeUnwrapLabelCallback) { beforeUnwrapLabelCallback(node); } - if (node.statement.kind !== 255 /* LabeledStatement */) { + if (node.statement.kind !== 256 /* LabeledStatement */) { return node.statement; } node = node.statement; } } function isFunctionBlock(node) { - return node && node.kind === 240 /* Block */ && isFunctionLike(node.parent); + return node && node.kind === 241 /* Block */ && isFunctionLike(node.parent); } function isObjectLiteralMethod(node) { - return node && node.kind === 173 /* MethodDeclaration */ && node.parent.kind === 209 /* ObjectLiteralExpression */; + return node && node.kind === 174 /* MethodDeclaration */ && node.parent.kind === 210 /* ObjectLiteralExpression */; } function isObjectLiteralOrClassExpressionMethodOrAccessor(node) { - return (node.kind === 173 /* MethodDeclaration */ || node.kind === 176 /* GetAccessor */ || node.kind === 177 /* SetAccessor */) && (node.parent.kind === 209 /* ObjectLiteralExpression */ || node.parent.kind === 230 /* ClassExpression */); + return (node.kind === 174 /* MethodDeclaration */ || node.kind === 177 /* GetAccessor */ || node.kind === 178 /* SetAccessor */) && (node.parent.kind === 210 /* ObjectLiteralExpression */ || node.parent.kind === 231 /* ClassExpression */); } function isIdentifierTypePredicate(predicate) { return predicate && predicate.kind === 1 /* Identifier */; @@ -14480,64 +14528,68 @@ ${lanes.join("\n")} function getContainingFunctionOrClassStaticBlock(node) { return findAncestor(node.parent, isFunctionLikeOrClassStaticBlockDeclaration); } + function getContainingClassExcludingClassDecorators(node) { + const decorator = findAncestor(node.parent, (n) => isClassLike(n) ? "quit" : isDecorator(n)); + return decorator && isClassLike(decorator.parent) ? getContainingClass(decorator.parent) : getContainingClass(decorator ?? node); + } function getThisContainer(node, includeArrowFunctions, includeClassComputedPropertyName) { - Debug.assert(node.kind !== 311 /* SourceFile */); + Debug.assert(node.kind !== 312 /* SourceFile */); while (true) { node = node.parent; if (!node) { return Debug.fail(); } switch (node.kind) { - case 166 /* ComputedPropertyName */: + case 167 /* ComputedPropertyName */: if (includeClassComputedPropertyName && isClassLike(node.parent.parent)) { return node; } node = node.parent.parent; break; - case 169 /* Decorator */: - if (node.parent.kind === 168 /* Parameter */ && isClassElement(node.parent.parent)) { + case 170 /* Decorator */: + if (node.parent.kind === 169 /* Parameter */ && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { node = node.parent; } break; - case 218 /* ArrowFunction */: + case 219 /* ArrowFunction */: if (!includeArrowFunctions) { continue; } - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 266 /* ModuleDeclaration */: - case 174 /* ClassStaticBlockDeclaration */: - case 171 /* PropertyDeclaration */: - case 170 /* PropertySignature */: - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: - case 175 /* Constructor */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 178 /* CallSignature */: - case 179 /* ConstructSignature */: - case 180 /* IndexSignature */: - case 265 /* EnumDeclaration */: - case 311 /* SourceFile */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 267 /* ModuleDeclaration */: + case 175 /* ClassStaticBlockDeclaration */: + case 172 /* PropertyDeclaration */: + case 171 /* PropertySignature */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: + case 176 /* Constructor */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 179 /* CallSignature */: + case 180 /* ConstructSignature */: + case 181 /* IndexSignature */: + case 266 /* EnumDeclaration */: + case 312 /* SourceFile */: return node; } } } function isThisContainerOrFunctionBlock(node) { switch (node.kind) { - case 218 /* ArrowFunction */: - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 171 /* PropertyDeclaration */: + case 219 /* ArrowFunction */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 172 /* PropertyDeclaration */: return true; - case 240 /* Block */: + case 241 /* Block */: switch (node.parent.kind) { - case 175 /* Constructor */: - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 176 /* Constructor */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: return true; default: return false; @@ -14569,9 +14621,9 @@ ${lanes.join("\n")} ); if (container) { switch (container.kind) { - case 175 /* Constructor */: - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: + case 176 /* Constructor */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: return container; } } @@ -14584,26 +14636,26 @@ ${lanes.join("\n")} return void 0; } switch (node.kind) { - case 166 /* ComputedPropertyName */: + case 167 /* ComputedPropertyName */: node = node.parent; break; - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: if (!stopOnFunctions) { continue; } - case 171 /* PropertyDeclaration */: - case 170 /* PropertySignature */: - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: - case 175 /* Constructor */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 174 /* ClassStaticBlockDeclaration */: + case 172 /* PropertyDeclaration */: + case 171 /* PropertySignature */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: + case 176 /* Constructor */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 175 /* ClassStaticBlockDeclaration */: return node; - case 169 /* Decorator */: - if (node.parent.kind === 168 /* Parameter */ && isClassElement(node.parent.parent)) { + case 170 /* Decorator */: + if (node.parent.kind === 169 /* Parameter */ && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { node = node.parent; @@ -14613,14 +14665,14 @@ ${lanes.join("\n")} } } function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 217 /* FunctionExpression */ || func.kind === 218 /* ArrowFunction */) { + if (func.kind === 218 /* FunctionExpression */ || func.kind === 219 /* ArrowFunction */) { let prev = func; let parent2 = func.parent; - while (parent2.kind === 216 /* ParenthesizedExpression */) { + while (parent2.kind === 217 /* ParenthesizedExpression */) { prev = parent2; parent2 = parent2.parent; } - if (parent2.kind === 212 /* CallExpression */ && parent2.expression === prev) { + if (parent2.kind === 213 /* CallExpression */ && parent2.expression === prev) { return parent2; } } @@ -14630,11 +14682,11 @@ ${lanes.join("\n")} } function isSuperProperty(node) { const kind = node.kind; - return (kind === 210 /* PropertyAccessExpression */ || kind === 211 /* ElementAccessExpression */) && node.expression.kind === 108 /* SuperKeyword */; + return (kind === 211 /* PropertyAccessExpression */ || kind === 212 /* ElementAccessExpression */) && node.expression.kind === 108 /* SuperKeyword */; } function isThisProperty(node) { const kind = node.kind; - return (kind === 210 /* PropertyAccessExpression */ || kind === 211 /* ElementAccessExpression */) && node.expression.kind === 110 /* ThisKeyword */; + return (kind === 211 /* PropertyAccessExpression */ || kind === 212 /* ElementAccessExpression */) && node.expression.kind === 110 /* ThisKeyword */; } function isThisInitializedDeclaration(node) { var _a; @@ -14645,22 +14697,22 @@ ${lanes.join("\n")} } function getEntityNameFromTypeNode(node) { switch (node.kind) { - case 182 /* TypeReference */: + case 183 /* TypeReference */: return node.typeName; - case 232 /* ExpressionWithTypeArguments */: + case 233 /* ExpressionWithTypeArguments */: return isEntityNameExpression(node.expression) ? node.expression : void 0; case 80 /* Identifier */: - case 165 /* QualifiedName */: + case 166 /* QualifiedName */: return node; } return void 0; } function getInvokedExpression(node) { switch (node.kind) { - case 214 /* TaggedTemplateExpression */: + case 215 /* TaggedTemplateExpression */: return node.tag; - case 285 /* JsxOpeningElement */: - case 284 /* JsxSelfClosingElement */: + case 286 /* JsxOpeningElement */: + case 285 /* JsxSelfClosingElement */: return node.tagName; default: return node.expression; @@ -14671,20 +14723,20 @@ ${lanes.join("\n")} return false; } switch (node.kind) { - case 262 /* ClassDeclaration */: + case 263 /* ClassDeclaration */: return true; - case 230 /* ClassExpression */: + case 231 /* ClassExpression */: return !useLegacyDecorators; - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: return parent2 !== void 0 && (useLegacyDecorators ? isClassDeclaration(parent2) : isClassLike(parent2) && !hasAbstractModifier(node) && !hasAmbientModifier(node)); - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 173 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 174 /* MethodDeclaration */: return node.body !== void 0 && parent2 !== void 0 && (useLegacyDecorators ? isClassDeclaration(parent2) : isClassLike(parent2)); - case 168 /* Parameter */: + case 169 /* Parameter */: if (!useLegacyDecorators) return false; - return parent2 !== void 0 && parent2.body !== void 0 && (parent2.kind === 175 /* Constructor */ || parent2.kind === 173 /* MethodDeclaration */ || parent2.kind === 177 /* SetAccessor */) && getThisParameter(parent2) !== node && grandparent !== void 0 && grandparent.kind === 262 /* ClassDeclaration */; + return parent2 !== void 0 && parent2.body !== void 0 && (parent2.kind === 176 /* Constructor */ || parent2.kind === 174 /* MethodDeclaration */ || parent2.kind === 178 /* SetAccessor */) && getThisParameter(parent2) !== node && grandparent !== void 0 && grandparent.kind === 263 /* ClassDeclaration */; } return false; } @@ -14696,13 +14748,13 @@ ${lanes.join("\n")} } function childIsDecorated(useLegacyDecorators, node, parent2) { switch (node.kind) { - case 262 /* ClassDeclaration */: + case 263 /* ClassDeclaration */: return some(node.members, (m) => nodeOrChildIsDecorated(useLegacyDecorators, m, node, parent2)); - case 230 /* ClassExpression */: + case 231 /* ClassExpression */: return !useLegacyDecorators && some(node.members, (m) => nodeOrChildIsDecorated(useLegacyDecorators, m, node, parent2)); - case 173 /* MethodDeclaration */: - case 177 /* SetAccessor */: - case 175 /* Constructor */: + case 174 /* MethodDeclaration */: + case 178 /* SetAccessor */: + case 176 /* Constructor */: return some(node.parameters, (p) => nodeIsDecorated(useLegacyDecorators, p, node, parent2)); default: return false; @@ -14753,7 +14805,7 @@ ${lanes.join("\n")} } function isJSXTagName(node) { const { parent: parent2 } = node; - if (parent2.kind === 285 /* JsxOpeningElement */ || parent2.kind === 284 /* JsxSelfClosingElement */ || parent2.kind === 286 /* JsxClosingElement */) { + if (parent2.kind === 286 /* JsxOpeningElement */ || parent2.kind === 285 /* JsxSelfClosingElement */ || parent2.kind === 287 /* JsxClosingElement */) { return parent2.tagName === node; } return false; @@ -14765,54 +14817,54 @@ ${lanes.join("\n")} case 112 /* TrueKeyword */: case 97 /* FalseKeyword */: case 14 /* RegularExpressionLiteral */: - case 208 /* ArrayLiteralExpression */: - case 209 /* ObjectLiteralExpression */: - case 210 /* PropertyAccessExpression */: - case 211 /* ElementAccessExpression */: - case 212 /* CallExpression */: - case 213 /* NewExpression */: - case 214 /* TaggedTemplateExpression */: - case 233 /* AsExpression */: - case 215 /* TypeAssertionExpression */: - case 237 /* SatisfiesExpression */: - case 234 /* NonNullExpression */: - case 216 /* ParenthesizedExpression */: - case 217 /* FunctionExpression */: - case 230 /* ClassExpression */: - case 218 /* ArrowFunction */: - case 221 /* VoidExpression */: - case 219 /* DeleteExpression */: - case 220 /* TypeOfExpression */: - case 223 /* PrefixUnaryExpression */: - case 224 /* PostfixUnaryExpression */: - case 225 /* BinaryExpression */: - case 226 /* ConditionalExpression */: - case 229 /* SpreadElement */: - case 227 /* TemplateExpression */: - case 231 /* OmittedExpression */: - case 283 /* JsxElement */: - case 284 /* JsxSelfClosingElement */: - case 287 /* JsxFragment */: - case 228 /* YieldExpression */: - case 222 /* AwaitExpression */: - case 235 /* MetaProperty */: + case 209 /* ArrayLiteralExpression */: + case 210 /* ObjectLiteralExpression */: + case 211 /* PropertyAccessExpression */: + case 212 /* ElementAccessExpression */: + case 213 /* CallExpression */: + case 214 /* NewExpression */: + case 215 /* TaggedTemplateExpression */: + case 234 /* AsExpression */: + case 216 /* TypeAssertionExpression */: + case 238 /* SatisfiesExpression */: + case 235 /* NonNullExpression */: + case 217 /* ParenthesizedExpression */: + case 218 /* FunctionExpression */: + case 231 /* ClassExpression */: + case 219 /* ArrowFunction */: + case 222 /* VoidExpression */: + case 220 /* DeleteExpression */: + case 221 /* TypeOfExpression */: + case 224 /* PrefixUnaryExpression */: + case 225 /* PostfixUnaryExpression */: + case 226 /* BinaryExpression */: + case 227 /* ConditionalExpression */: + case 230 /* SpreadElement */: + case 228 /* TemplateExpression */: + case 232 /* OmittedExpression */: + case 284 /* JsxElement */: + case 285 /* JsxSelfClosingElement */: + case 288 /* JsxFragment */: + case 229 /* YieldExpression */: + case 223 /* AwaitExpression */: + case 236 /* MetaProperty */: return true; - case 232 /* ExpressionWithTypeArguments */: + case 233 /* ExpressionWithTypeArguments */: return !isHeritageClause(node.parent) && !isJSDocAugmentsTag(node.parent); - case 165 /* QualifiedName */: - while (node.parent.kind === 165 /* QualifiedName */) { + case 166 /* QualifiedName */: + while (node.parent.kind === 166 /* QualifiedName */) { node = node.parent; } - return node.parent.kind === 185 /* TypeQuery */ || isJSDocLinkLike(node.parent) || isJSDocNameReference(node.parent) || isJSDocMemberName(node.parent) || isJSXTagName(node); - case 317 /* JSDocMemberName */: + return node.parent.kind === 186 /* TypeQuery */ || isJSDocLinkLike(node.parent) || isJSDocNameReference(node.parent) || isJSDocMemberName(node.parent) || isJSXTagName(node); + case 318 /* JSDocMemberName */: while (isJSDocMemberName(node.parent)) { node = node.parent; } - return node.parent.kind === 185 /* TypeQuery */ || isJSDocLinkLike(node.parent) || isJSDocNameReference(node.parent) || isJSDocMemberName(node.parent) || isJSXTagName(node); + return node.parent.kind === 186 /* TypeQuery */ || isJSDocLinkLike(node.parent) || isJSDocNameReference(node.parent) || isJSDocMemberName(node.parent) || isJSXTagName(node); case 81 /* PrivateIdentifier */: return isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 103 /* InKeyword */; case 80 /* Identifier */: - if (node.parent.kind === 185 /* TypeQuery */ || isJSDocLinkLike(node.parent) || isJSDocNameReference(node.parent) || isJSDocMemberName(node.parent) || isJSXTagName(node)) { + if (node.parent.kind === 186 /* TypeQuery */ || isJSDocLinkLike(node.parent) || isJSDocNameReference(node.parent) || isJSDocMemberName(node.parent) || isJSXTagName(node)) { return true; } case 9 /* NumericLiteral */: @@ -14828,64 +14880,64 @@ ${lanes.join("\n")} function isInExpressionContext(node) { const { parent: parent2 } = node; switch (parent2.kind) { - case 259 /* VariableDeclaration */: - case 168 /* Parameter */: - case 171 /* PropertyDeclaration */: - case 170 /* PropertySignature */: - case 305 /* EnumMember */: - case 302 /* PropertyAssignment */: - case 207 /* BindingElement */: + case 260 /* VariableDeclaration */: + case 169 /* Parameter */: + case 172 /* PropertyDeclaration */: + case 171 /* PropertySignature */: + case 306 /* EnumMember */: + case 303 /* PropertyAssignment */: + case 208 /* BindingElement */: return parent2.initializer === node; - case 243 /* ExpressionStatement */: - case 244 /* IfStatement */: - case 245 /* DoStatement */: - case 246 /* WhileStatement */: - case 252 /* ReturnStatement */: - case 253 /* WithStatement */: - case 254 /* SwitchStatement */: - case 295 /* CaseClause */: - case 256 /* ThrowStatement */: + case 244 /* ExpressionStatement */: + case 245 /* IfStatement */: + case 246 /* DoStatement */: + case 247 /* WhileStatement */: + case 253 /* ReturnStatement */: + case 254 /* WithStatement */: + case 255 /* SwitchStatement */: + case 296 /* CaseClause */: + case 257 /* ThrowStatement */: return parent2.expression === node; - case 247 /* ForStatement */: + case 248 /* ForStatement */: const forStatement = parent2; - return forStatement.initializer === node && forStatement.initializer.kind !== 260 /* VariableDeclarationList */ || forStatement.condition === node || forStatement.incrementor === node; - case 248 /* ForInStatement */: - case 249 /* ForOfStatement */: + return forStatement.initializer === node && forStatement.initializer.kind !== 261 /* VariableDeclarationList */ || forStatement.condition === node || forStatement.incrementor === node; + case 249 /* ForInStatement */: + case 250 /* ForOfStatement */: const forInStatement = parent2; - return forInStatement.initializer === node && forInStatement.initializer.kind !== 260 /* VariableDeclarationList */ || forInStatement.expression === node; - case 215 /* TypeAssertionExpression */: - case 233 /* AsExpression */: + return forInStatement.initializer === node && forInStatement.initializer.kind !== 261 /* VariableDeclarationList */ || forInStatement.expression === node; + case 216 /* TypeAssertionExpression */: + case 234 /* AsExpression */: return node === parent2.expression; - case 238 /* TemplateSpan */: + case 239 /* TemplateSpan */: return node === parent2.expression; - case 166 /* ComputedPropertyName */: + case 167 /* ComputedPropertyName */: return node === parent2.expression; - case 169 /* Decorator */: - case 293 /* JsxExpression */: - case 292 /* JsxSpreadAttribute */: - case 304 /* SpreadAssignment */: + case 170 /* Decorator */: + case 294 /* JsxExpression */: + case 293 /* JsxSpreadAttribute */: + case 305 /* SpreadAssignment */: return true; - case 232 /* ExpressionWithTypeArguments */: + case 233 /* ExpressionWithTypeArguments */: return parent2.expression === node && !isPartOfTypeNode(parent2); - case 303 /* ShorthandPropertyAssignment */: + case 304 /* ShorthandPropertyAssignment */: return parent2.objectAssignmentInitializer === node; - case 237 /* SatisfiesExpression */: + case 238 /* SatisfiesExpression */: return node === parent2.expression; default: return isExpressionNode(parent2); } } function isPartOfTypeQuery(node) { - while (node.kind === 165 /* QualifiedName */ || node.kind === 80 /* Identifier */) { + while (node.kind === 166 /* QualifiedName */ || node.kind === 80 /* Identifier */) { node = node.parent; } - return node.kind === 185 /* TypeQuery */; + return node.kind === 186 /* TypeQuery */; } function isNamespaceReexportDeclaration(node) { return isNamespaceExport(node) && !!node.parent.moduleSpecifier; } function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 270 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 282 /* ExternalModuleReference */; + return node.kind === 271 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 283 /* ExternalModuleReference */; } function getExternalModuleImportEqualsDeclarationExpression(node) { Debug.assert(isExternalModuleImportEqualsDeclaration(node)); @@ -14895,7 +14947,7 @@ ${lanes.join("\n")} return isVariableDeclarationInitializedToBareOrAccessedRequire(node) && getLeftmostAccessExpression(node.initializer).arguments[0]; } function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 270 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 282 /* ExternalModuleReference */; + return node.kind === 271 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 283 /* ExternalModuleReference */; } function isSourceFileJS(file) { return isInJSFile(file); @@ -14904,22 +14956,22 @@ ${lanes.join("\n")} return !isInJSFile(file); } function isInJSFile(node) { - return !!node && !!(node.flags & 262144 /* JavaScriptFile */); + return !!node && !!(node.flags & 524288 /* JavaScriptFile */); } function isInJsonFile(node) { - return !!node && !!(node.flags & 67108864 /* JsonFile */); + return !!node && !!(node.flags & 134217728 /* JsonFile */); } function isSourceFileNotJson(file) { return !isJsonSourceFile(file); } function isInJSDoc(node) { - return !!node && !!(node.flags & 8388608 /* JSDoc */); + return !!node && !!(node.flags & 16777216 /* JSDoc */); } function isJSDocIndexSignature(node) { return isTypeReferenceNode(node) && isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && node.typeArguments && node.typeArguments.length === 2 && (node.typeArguments[0].kind === 154 /* StringKeyword */ || node.typeArguments[0].kind === 150 /* NumberKeyword */); } function isRequireCall(callExpression, requireStringLiteralLikeArgument) { - if (callExpression.kind !== 212 /* CallExpression */) { + if (callExpression.kind !== 213 /* CallExpression */) { return false; } const { expression, arguments: args } = callExpression; @@ -14996,9 +15048,9 @@ ${lanes.join("\n")} function getExpandoInitializer(initializer, isPrototypeAssignment) { if (isCallExpression(initializer)) { const e = skipParentheses(initializer.expression); - return e.kind === 217 /* FunctionExpression */ || e.kind === 218 /* ArrowFunction */ ? initializer : void 0; + return e.kind === 218 /* FunctionExpression */ || e.kind === 219 /* ArrowFunction */ ? initializer : void 0; } - if (initializer.kind === 217 /* FunctionExpression */ || initializer.kind === 230 /* ClassExpression */ || initializer.kind === 218 /* ArrowFunction */) { + if (initializer.kind === 218 /* FunctionExpression */ || initializer.kind === 231 /* ClassExpression */ || initializer.kind === 219 /* ArrowFunction */) { return initializer; } if (isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) { @@ -15189,11 +15241,11 @@ ${lanes.join("\n")} return isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 3 /* PrototypeProperty */; } function isSpecialPropertyDeclaration(expr) { - return isInJSFile(expr) && expr.parent && expr.parent.kind === 243 /* ExpressionStatement */ && (!isElementAccessExpression(expr) || isLiteralLikeElementAccess(expr)) && !!getJSDocTypeTag(expr.parent); + return isInJSFile(expr) && expr.parent && expr.parent.kind === 244 /* ExpressionStatement */ && (!isElementAccessExpression(expr) || isLiteralLikeElementAccess(expr)) && !!getJSDocTypeTag(expr.parent); } function setValueDeclaration(symbol, node) { const { valueDeclaration } = symbol; - if (!valueDeclaration || !(node.flags & 16777216 /* Ambient */ && !isInJSFile(node) && !(valueDeclaration.flags & 16777216 /* Ambient */)) && (isAssignmentDeclaration(valueDeclaration) && !isAssignmentDeclaration(node)) || valueDeclaration.kind !== node.kind && isEffectiveModuleDeclaration(valueDeclaration)) { + if (!valueDeclaration || !(node.flags & 33554432 /* Ambient */ && !isInJSFile(node) && !(valueDeclaration.flags & 33554432 /* Ambient */)) && (isAssignmentDeclaration(valueDeclaration) && !isAssignmentDeclaration(node)) || valueDeclaration.kind !== node.kind && isEffectiveModuleDeclaration(valueDeclaration)) { symbol.valueDeclaration = node; } } @@ -15202,29 +15254,29 @@ ${lanes.join("\n")} return false; } const decl = symbol.valueDeclaration; - return decl.kind === 261 /* FunctionDeclaration */ || isVariableDeclaration(decl) && decl.initializer && isFunctionLike(decl.initializer); + return decl.kind === 262 /* FunctionDeclaration */ || isVariableDeclaration(decl) && decl.initializer && isFunctionLike(decl.initializer); } function tryGetModuleSpecifierFromDeclaration(node) { var _a, _b; switch (node.kind) { - case 259 /* VariableDeclaration */: - case 207 /* BindingElement */: + case 260 /* VariableDeclaration */: + case 208 /* BindingElement */: return (_a = findAncestor(node.initializer, (node2) => isRequireCall( node2, /*requireStringLiteralLikeArgument*/ true ))) == null ? void 0 : _a.arguments[0]; - case 271 /* ImportDeclaration */: + case 272 /* ImportDeclaration */: return tryCast(node.moduleSpecifier, isStringLiteralLike); - case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportEqualsDeclaration */: return tryCast((_b = tryCast(node.moduleReference, isExternalModuleReference)) == null ? void 0 : _b.expression, isStringLiteralLike); - case 272 /* ImportClause */: - case 279 /* NamespaceExport */: + case 273 /* ImportClause */: + case 280 /* NamespaceExport */: return tryCast(node.parent.moduleSpecifier, isStringLiteralLike); - case 273 /* NamespaceImport */: - case 280 /* ExportSpecifier */: + case 274 /* NamespaceImport */: + case 281 /* ExportSpecifier */: return tryCast(node.parent.parent.moduleSpecifier, isStringLiteralLike); - case 275 /* ImportSpecifier */: + case 276 /* ImportSpecifier */: return tryCast(node.parent.parent.parent.moduleSpecifier, isStringLiteralLike); default: Debug.assertNever(node); @@ -15235,18 +15287,18 @@ ${lanes.join("\n")} } function tryGetImportFromModuleSpecifier(node) { switch (node.parent.kind) { - case 271 /* ImportDeclaration */: - case 277 /* ExportDeclaration */: + case 272 /* ImportDeclaration */: + case 278 /* ExportDeclaration */: return node.parent; - case 282 /* ExternalModuleReference */: + case 283 /* ExternalModuleReference */: return node.parent.parent; - case 212 /* CallExpression */: + case 213 /* CallExpression */: return isImportCall(node.parent) || isRequireCall( node.parent, /*requireStringLiteralLikeArgument*/ false ) ? node.parent : void 0; - case 200 /* LiteralType */: + case 201 /* LiteralType */: Debug.assert(isStringLiteral(node)); return tryCast(node.parent.parent, isImportTypeNode); default: @@ -15255,16 +15307,16 @@ ${lanes.join("\n")} } function getExternalModuleName(node) { switch (node.kind) { - case 271 /* ImportDeclaration */: - case 277 /* ExportDeclaration */: + case 272 /* ImportDeclaration */: + case 278 /* ExportDeclaration */: return node.moduleSpecifier; - case 270 /* ImportEqualsDeclaration */: - return node.moduleReference.kind === 282 /* ExternalModuleReference */ ? node.moduleReference.expression : void 0; - case 204 /* ImportType */: + case 271 /* ImportEqualsDeclaration */: + return node.moduleReference.kind === 283 /* ExternalModuleReference */ ? node.moduleReference.expression : void 0; + case 205 /* ImportType */: return isLiteralImportTypeNode(node) ? node.argument.literal : void 0; - case 212 /* CallExpression */: + case 213 /* CallExpression */: return node.arguments[0]; - case 266 /* ModuleDeclaration */: + case 267 /* ModuleDeclaration */: return node.name.kind === 11 /* StringLiteral */ ? node.name : void 0; default: return Debug.assertNever(node); @@ -15272,18 +15324,18 @@ ${lanes.join("\n")} } function getNamespaceDeclarationNode(node) { switch (node.kind) { - case 271 /* ImportDeclaration */: + case 272 /* ImportDeclaration */: return node.importClause && tryCast(node.importClause.namedBindings, isNamespaceImport); - case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportEqualsDeclaration */: return node; - case 277 /* ExportDeclaration */: + case 278 /* ExportDeclaration */: return node.exportClause && tryCast(node.exportClause, isNamespaceExport); default: return Debug.assertNever(node); } } function isDefaultImport(node) { - return node.kind === 271 /* ImportDeclaration */ && !!node.importClause && !!node.importClause.name; + return node.kind === 272 /* ImportDeclaration */ && !!node.importClause && !!node.importClause.name; } function forEachImportClauseDeclaration(node, action) { if (node.name) { @@ -15300,13 +15352,13 @@ ${lanes.join("\n")} function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 168 /* Parameter */: - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: - case 303 /* ShorthandPropertyAssignment */: - case 302 /* PropertyAssignment */: - case 171 /* PropertyDeclaration */: - case 170 /* PropertySignature */: + case 169 /* Parameter */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: + case 304 /* ShorthandPropertyAssignment */: + case 303 /* PropertyAssignment */: + case 172 /* PropertyDeclaration */: + case 171 /* PropertySignature */: return node.questionToken !== void 0; } } @@ -15318,7 +15370,7 @@ ${lanes.join("\n")} return !!name && name.escapedText === "new"; } function isJSDocTypeAlias(node) { - return node.kind === 352 /* JSDocTypedefTag */ || node.kind === 344 /* JSDocCallbackTag */ || node.kind === 346 /* JSDocEnumTag */; + return node.kind === 353 /* JSDocTypedefTag */ || node.kind === 345 /* JSDocCallbackTag */ || node.kind === 347 /* JSDocEnumTag */; } function isTypeAlias(node) { return isJSDocTypeAlias(node) || isTypeAliasDeclaration(node); @@ -15331,12 +15383,12 @@ ${lanes.join("\n")} } function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) { switch (node.kind) { - case 242 /* VariableStatement */: + case 243 /* VariableStatement */: const v = getSingleVariableOfVariableStatement(node); return v && v.initializer; - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: return node.initializer; - case 302 /* PropertyAssignment */: + case 303 /* PropertyAssignment */: return node.initializer; } } @@ -15344,26 +15396,26 @@ ${lanes.join("\n")} return isVariableStatement(node) ? firstOrUndefined(node.declarationList.declarations) : void 0; } function getNestedModuleDeclaration(node) { - return isModuleDeclaration(node) && node.body && node.body.kind === 266 /* ModuleDeclaration */ ? node.body : void 0; + return isModuleDeclaration(node) && node.body && node.body.kind === 267 /* ModuleDeclaration */ ? node.body : void 0; } function canHaveFlowNode(node) { - if (node.kind >= 242 /* FirstStatement */ && node.kind <= 258 /* LastStatement */) { + if (node.kind >= 243 /* FirstStatement */ && node.kind <= 259 /* LastStatement */) { return true; } switch (node.kind) { case 80 /* Identifier */: case 110 /* ThisKeyword */: case 108 /* SuperKeyword */: - case 165 /* QualifiedName */: - case 235 /* MetaProperty */: - case 211 /* ElementAccessExpression */: - case 210 /* PropertyAccessExpression */: - case 207 /* BindingElement */: - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 166 /* QualifiedName */: + case 236 /* MetaProperty */: + case 212 /* ElementAccessExpression */: + case 211 /* PropertyAccessExpression */: + case 208 /* BindingElement */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: return true; default: return false; @@ -15371,72 +15423,72 @@ ${lanes.join("\n")} } function canHaveJSDoc(node) { switch (node.kind) { - case 218 /* ArrowFunction */: - case 225 /* BinaryExpression */: - case 240 /* Block */: - case 251 /* BreakStatement */: - case 178 /* CallSignature */: - case 295 /* CaseClause */: - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: - case 174 /* ClassStaticBlockDeclaration */: - case 175 /* Constructor */: - case 184 /* ConstructorType */: - case 179 /* ConstructSignature */: - case 250 /* ContinueStatement */: - case 258 /* DebuggerStatement */: - case 245 /* DoStatement */: - case 211 /* ElementAccessExpression */: - case 241 /* EmptyStatement */: + case 219 /* ArrowFunction */: + case 226 /* BinaryExpression */: + case 241 /* Block */: + case 252 /* BreakStatement */: + case 179 /* CallSignature */: + case 296 /* CaseClause */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: + case 175 /* ClassStaticBlockDeclaration */: + case 176 /* Constructor */: + case 185 /* ConstructorType */: + case 180 /* ConstructSignature */: + case 251 /* ContinueStatement */: + case 259 /* DebuggerStatement */: + case 246 /* DoStatement */: + case 212 /* ElementAccessExpression */: + case 242 /* EmptyStatement */: case 1 /* EndOfFileToken */: - case 265 /* EnumDeclaration */: - case 305 /* EnumMember */: - case 276 /* ExportAssignment */: - case 277 /* ExportDeclaration */: - case 280 /* ExportSpecifier */: - case 243 /* ExpressionStatement */: - case 248 /* ForInStatement */: - case 249 /* ForOfStatement */: - case 247 /* ForStatement */: - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 183 /* FunctionType */: - case 176 /* GetAccessor */: + case 266 /* EnumDeclaration */: + case 306 /* EnumMember */: + case 277 /* ExportAssignment */: + case 278 /* ExportDeclaration */: + case 281 /* ExportSpecifier */: + case 244 /* ExpressionStatement */: + case 249 /* ForInStatement */: + case 250 /* ForOfStatement */: + case 248 /* ForStatement */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 184 /* FunctionType */: + case 177 /* GetAccessor */: case 80 /* Identifier */: - case 244 /* IfStatement */: - case 271 /* ImportDeclaration */: - case 270 /* ImportEqualsDeclaration */: - case 180 /* IndexSignature */: - case 263 /* InterfaceDeclaration */: - case 323 /* JSDocFunctionType */: - case 329 /* JSDocSignature */: - case 255 /* LabeledStatement */: - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: - case 266 /* ModuleDeclaration */: - case 201 /* NamedTupleMember */: - case 269 /* NamespaceExportDeclaration */: - case 209 /* ObjectLiteralExpression */: - case 168 /* Parameter */: - case 216 /* ParenthesizedExpression */: - case 210 /* PropertyAccessExpression */: - case 302 /* PropertyAssignment */: - case 171 /* PropertyDeclaration */: - case 170 /* PropertySignature */: - case 252 /* ReturnStatement */: - case 239 /* SemicolonClassElement */: - case 177 /* SetAccessor */: - case 303 /* ShorthandPropertyAssignment */: - case 304 /* SpreadAssignment */: - case 254 /* SwitchStatement */: - case 256 /* ThrowStatement */: - case 257 /* TryStatement */: - case 264 /* TypeAliasDeclaration */: - case 167 /* TypeParameter */: - case 259 /* VariableDeclaration */: - case 242 /* VariableStatement */: - case 246 /* WhileStatement */: - case 253 /* WithStatement */: + case 245 /* IfStatement */: + case 272 /* ImportDeclaration */: + case 271 /* ImportEqualsDeclaration */: + case 181 /* IndexSignature */: + case 264 /* InterfaceDeclaration */: + case 324 /* JSDocFunctionType */: + case 330 /* JSDocSignature */: + case 256 /* LabeledStatement */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: + case 267 /* ModuleDeclaration */: + case 202 /* NamedTupleMember */: + case 270 /* NamespaceExportDeclaration */: + case 210 /* ObjectLiteralExpression */: + case 169 /* Parameter */: + case 217 /* ParenthesizedExpression */: + case 211 /* PropertyAccessExpression */: + case 303 /* PropertyAssignment */: + case 172 /* PropertyDeclaration */: + case 171 /* PropertySignature */: + case 253 /* ReturnStatement */: + case 240 /* SemicolonClassElement */: + case 178 /* SetAccessor */: + case 304 /* ShorthandPropertyAssignment */: + case 305 /* SpreadAssignment */: + case 255 /* SwitchStatement */: + case 257 /* ThrowStatement */: + case 258 /* TryStatement */: + case 265 /* TypeAliasDeclaration */: + case 168 /* TypeParameter */: + case 260 /* VariableDeclaration */: + case 243 /* VariableStatement */: + case 247 /* WhileStatement */: + case 254 /* WithStatement */: return true; default: return false; @@ -15452,11 +15504,11 @@ ${lanes.join("\n")} if (hasJSDocNodes(node)) { result = addRange(result, filterOwnedJSDocTags(hostNode, last(node.jsDoc))); } - if (node.kind === 168 /* Parameter */) { + if (node.kind === 169 /* Parameter */) { result = addRange(result, (noCache ? getJSDocParameterTagsNoCache : getJSDocParameterTags)(node)); break; } - if (node.kind === 167 /* TypeParameter */) { + if (node.kind === 168 /* TypeParameter */) { result = addRange(result, (noCache ? getJSDocTypeParameterTagsNoCache : getJSDocTypeParameterTags)(node)); break; } @@ -15476,7 +15528,7 @@ ${lanes.join("\n")} } function getNextJSDocCommentLocation(node) { const parent2 = node.parent; - if (parent2.kind === 302 /* PropertyAssignment */ || parent2.kind === 276 /* ExportAssignment */ || parent2.kind === 171 /* PropertyDeclaration */ || parent2.kind === 243 /* ExpressionStatement */ && node.kind === 210 /* PropertyAccessExpression */ || parent2.kind === 252 /* ReturnStatement */ || getNestedModuleDeclaration(parent2) || isBinaryExpression(node) && node.operatorToken.kind === 64 /* EqualsToken */) { + if (parent2.kind === 303 /* PropertyAssignment */ || parent2.kind === 277 /* ExportAssignment */ || parent2.kind === 172 /* PropertyDeclaration */ || parent2.kind === 244 /* ExpressionStatement */ && node.kind === 211 /* PropertyAccessExpression */ || parent2.kind === 253 /* ReturnStatement */ || getNestedModuleDeclaration(parent2) || isBinaryExpression(node) && node.operatorToken.kind === 64 /* EqualsToken */) { return parent2; } else if (parent2.parent && (getSingleVariableOfVariableStatement(parent2.parent) === node || isBinaryExpression(parent2) && parent2.operatorToken.kind === 64 /* EqualsToken */)) { return parent2.parent; @@ -15546,32 +15598,32 @@ ${lanes.join("\n")} let parent2 = node.parent; while (true) { switch (parent2.kind) { - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: const binaryOperator = parent2.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent2.left === node ? binaryOperator === 64 /* EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* Definite */ : 2 /* Compound */ : 0 /* None */; - case 223 /* PrefixUnaryExpression */: - case 224 /* PostfixUnaryExpression */: + case 224 /* PrefixUnaryExpression */: + case 225 /* PostfixUnaryExpression */: const unaryOperator = parent2.operator; return unaryOperator === 46 /* PlusPlusToken */ || unaryOperator === 47 /* MinusMinusToken */ ? 2 /* Compound */ : 0 /* None */; - case 248 /* ForInStatement */: - case 249 /* ForOfStatement */: + case 249 /* ForInStatement */: + case 250 /* ForOfStatement */: return parent2.initializer === node ? 1 /* Definite */ : 0 /* None */; - case 216 /* ParenthesizedExpression */: - case 208 /* ArrayLiteralExpression */: - case 229 /* SpreadElement */: - case 234 /* NonNullExpression */: + case 217 /* ParenthesizedExpression */: + case 209 /* ArrayLiteralExpression */: + case 230 /* SpreadElement */: + case 235 /* NonNullExpression */: node = parent2; break; - case 304 /* SpreadAssignment */: + case 305 /* SpreadAssignment */: node = parent2.parent; break; - case 303 /* ShorthandPropertyAssignment */: + case 304 /* ShorthandPropertyAssignment */: if (parent2.name !== node) { return 0 /* None */; } node = parent2.parent; break; - case 302 /* PropertyAssignment */: + case 303 /* PropertyAssignment */: if (parent2.name === node) { return 0 /* None */; } @@ -15588,22 +15640,22 @@ ${lanes.join("\n")} } function isNodeWithPossibleHoistedDeclaration(node) { switch (node.kind) { - case 240 /* Block */: - case 242 /* VariableStatement */: - case 253 /* WithStatement */: - case 244 /* IfStatement */: - case 254 /* SwitchStatement */: - case 268 /* CaseBlock */: - case 295 /* CaseClause */: - case 296 /* DefaultClause */: - case 255 /* LabeledStatement */: - case 247 /* ForStatement */: - case 248 /* ForInStatement */: - case 249 /* ForOfStatement */: - case 245 /* DoStatement */: - case 246 /* WhileStatement */: - case 257 /* TryStatement */: - case 298 /* CatchClause */: + case 241 /* Block */: + case 243 /* VariableStatement */: + case 254 /* WithStatement */: + case 245 /* IfStatement */: + case 255 /* SwitchStatement */: + case 269 /* CaseBlock */: + case 296 /* CaseClause */: + case 297 /* DefaultClause */: + case 256 /* LabeledStatement */: + case 248 /* ForStatement */: + case 249 /* ForInStatement */: + case 250 /* ForOfStatement */: + case 246 /* DoStatement */: + case 247 /* WhileStatement */: + case 258 /* TryStatement */: + case 299 /* CatchClause */: return true; } return false; @@ -15618,14 +15670,14 @@ ${lanes.join("\n")} return node; } function walkUpParenthesizedTypes(node) { - return walkUp(node, 195 /* ParenthesizedType */); + return walkUp(node, 196 /* ParenthesizedType */); } function walkUpParenthesizedExpressions(node) { - return walkUp(node, 216 /* ParenthesizedExpression */); + return walkUp(node, 217 /* ParenthesizedExpression */); } function walkUpParenthesizedTypesAndGetParentAndChild(node) { let child; - while (node && node.kind === 195 /* ParenthesizedType */) { + while (node && node.kind === 196 /* ParenthesizedType */) { child = node; node = node.parent; } @@ -15641,11 +15693,11 @@ ${lanes.join("\n")} return skipOuterExpressions(node, flags); } function isDeleteTarget(node) { - if (node.kind !== 210 /* PropertyAccessExpression */ && node.kind !== 211 /* ElementAccessExpression */) { + if (node.kind !== 211 /* PropertyAccessExpression */ && node.kind !== 212 /* ElementAccessExpression */) { return false; } node = walkUpParenthesizedExpressions(node.parent); - return node && node.kind === 219 /* DeleteExpression */; + return node && node.kind === 220 /* DeleteExpression */; } function isNodeDescendantOf(node, ancestor) { while (node) { @@ -15683,55 +15735,55 @@ ${lanes.join("\n")} } } function isLiteralComputedPropertyDeclarationName(node) { - return isStringOrNumericLiteralLike(node) && node.parent.kind === 166 /* ComputedPropertyName */ && isDeclaration(node.parent.parent); + return isStringOrNumericLiteralLike(node) && node.parent.kind === 167 /* ComputedPropertyName */ && isDeclaration(node.parent.parent); } function isIdentifierName(node) { const parent2 = node.parent; switch (parent2.kind) { - case 171 /* PropertyDeclaration */: - case 170 /* PropertySignature */: - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 305 /* EnumMember */: - case 302 /* PropertyAssignment */: - case 210 /* PropertyAccessExpression */: + case 172 /* PropertyDeclaration */: + case 171 /* PropertySignature */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 306 /* EnumMember */: + case 303 /* PropertyAssignment */: + case 211 /* PropertyAccessExpression */: return parent2.name === node; - case 165 /* QualifiedName */: + case 166 /* QualifiedName */: return parent2.right === node; - case 207 /* BindingElement */: - case 275 /* ImportSpecifier */: + case 208 /* BindingElement */: + case 276 /* ImportSpecifier */: return parent2.propertyName === node; - case 280 /* ExportSpecifier */: - case 290 /* JsxAttribute */: - case 284 /* JsxSelfClosingElement */: - case 285 /* JsxOpeningElement */: - case 286 /* JsxClosingElement */: + case 281 /* ExportSpecifier */: + case 291 /* JsxAttribute */: + case 285 /* JsxSelfClosingElement */: + case 286 /* JsxOpeningElement */: + case 287 /* JsxClosingElement */: return true; } return false; } function isAliasSymbolDeclaration(node) { - if (node.kind === 270 /* ImportEqualsDeclaration */ || node.kind === 269 /* NamespaceExportDeclaration */ || node.kind === 272 /* ImportClause */ && !!node.name || node.kind === 273 /* NamespaceImport */ || node.kind === 279 /* NamespaceExport */ || node.kind === 275 /* ImportSpecifier */ || node.kind === 280 /* ExportSpecifier */ || node.kind === 276 /* ExportAssignment */ && exportAssignmentIsAlias(node)) { + if (node.kind === 271 /* ImportEqualsDeclaration */ || node.kind === 270 /* NamespaceExportDeclaration */ || node.kind === 273 /* ImportClause */ && !!node.name || node.kind === 274 /* NamespaceImport */ || node.kind === 280 /* NamespaceExport */ || node.kind === 276 /* ImportSpecifier */ || node.kind === 281 /* ExportSpecifier */ || node.kind === 277 /* ExportAssignment */ && exportAssignmentIsAlias(node)) { return true; } return isInJSFile(node) && (isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node) || isPropertyAccessExpression(node) && isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 64 /* EqualsToken */ && isAliasableExpression(node.parent.right)); } function getAliasDeclarationFromName(node) { switch (node.parent.kind) { - case 272 /* ImportClause */: - case 275 /* ImportSpecifier */: - case 273 /* NamespaceImport */: - case 280 /* ExportSpecifier */: - case 276 /* ExportAssignment */: - case 270 /* ImportEqualsDeclaration */: - case 279 /* NamespaceExport */: + case 273 /* ImportClause */: + case 276 /* ImportSpecifier */: + case 274 /* NamespaceImport */: + case 281 /* ExportSpecifier */: + case 277 /* ExportAssignment */: + case 271 /* ImportEqualsDeclaration */: + case 280 /* NamespaceExport */: return node.parent; - case 165 /* QualifiedName */: + case 166 /* QualifiedName */: do { node = node.parent; - } while (node.parent.kind === 165 /* QualifiedName */); + } while (node.parent.kind === 166 /* QualifiedName */); return getAliasDeclarationFromName(node); } } @@ -15746,7 +15798,7 @@ ${lanes.join("\n")} return isExportAssignment(node) ? node.expression : node.right; } function getPropertyAssignmentAliasLikeExpression(node) { - return node.kind === 303 /* ShorthandPropertyAssignment */ ? node.name : node.kind === 302 /* PropertyAssignment */ ? node.initializer : node.parent.right; + return node.kind === 304 /* ShorthandPropertyAssignment */ ? node.name : node.kind === 303 /* PropertyAssignment */ ? node.initializer : node.parent.right; } function getEffectiveBaseTypeNode(node) { const baseType = getClassExtendsHeritageElement(node); @@ -15797,7 +15849,7 @@ ${lanes.join("\n")} return void 0; } function isKeyword(token) { - return 83 /* FirstKeyword */ <= token && token <= 164 /* LastKeyword */; + return 83 /* FirstKeyword */ <= token && token <= 165 /* LastKeyword */; } function isPunctuation(token) { return 19 /* FirstPunctuation */ <= token && token <= 79 /* LastPunctuation */; @@ -15806,7 +15858,7 @@ ${lanes.join("\n")} return isKeyword(token) || isPunctuation(token); } function isContextualKeyword(token) { - return 128 /* FirstContextualKeyword */ <= token && token <= 164 /* LastContextualKeyword */; + return 128 /* FirstContextualKeyword */ <= token && token <= 165 /* LastContextualKeyword */; } function isNonContextualKeyword(token) { return isKeyword(token) && !isContextualKeyword(token); @@ -15835,13 +15887,13 @@ ${lanes.join("\n")} } let flags = 0 /* Normal */; switch (node.kind) { - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 173 /* MethodDeclaration */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 174 /* MethodDeclaration */: if (node.asteriskToken) { flags |= 1 /* Generator */; } - case 218 /* ArrowFunction */: + case 219 /* ArrowFunction */: if (hasSyntacticModifier(node, 512 /* Async */)) { flags |= 2 /* Async */; } @@ -15854,10 +15906,10 @@ ${lanes.join("\n")} } function isAsyncFunction(node) { switch (node.kind) { - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: - case 173 /* MethodDeclaration */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: + case 174 /* MethodDeclaration */: return node.body !== void 0 && node.asteriskToken === void 0 && hasSyntacticModifier(node, 512 /* Async */); } return false; @@ -15873,7 +15925,7 @@ ${lanes.join("\n")} return !!name && isDynamicName(name); } function isDynamicName(name) { - if (!(name.kind === 166 /* ComputedPropertyName */ || name.kind === 211 /* ElementAccessExpression */)) { + if (!(name.kind === 167 /* ComputedPropertyName */ || name.kind === 212 /* ElementAccessExpression */)) { return false; } const expr = isElementAccessExpression(name) ? skipParentheses(name.argumentExpression) : name.expression; @@ -15887,7 +15939,7 @@ ${lanes.join("\n")} case 11 /* StringLiteral */: case 9 /* NumericLiteral */: return escapeLeadingUnderscores(name.text); - case 166 /* ComputedPropertyName */: + case 167 /* ComputedPropertyName */: const nameExpression = name.expression; if (isStringOrNumericLiteralLike(nameExpression)) { return escapeLeadingUnderscores(nameExpression.text); @@ -15898,7 +15950,7 @@ ${lanes.join("\n")} return nameExpression.operand.text; } return void 0; - case 294 /* JsxNamespacedName */: + case 295 /* JsxNamespacedName */: return getEscapedTextOfJsxNamespacedName(name); default: return Debug.assertNever(name); @@ -15942,13 +15994,17 @@ ${lanes.join("\n")} function isAnonymousFunctionDefinition(node, cb) { node = skipOuterExpressions(node); switch (node.kind) { - case 230 /* ClassExpression */: - case 217 /* FunctionExpression */: + case 231 /* ClassExpression */: + if (classHasDeclaredOrExplicitlyAssignedName(node)) { + return false; + } + break; + case 218 /* FunctionExpression */: if (node.name) { return false; } break; - case 218 /* ArrowFunction */: + case 219 /* ArrowFunction */: break; default: return false; @@ -15957,19 +16013,19 @@ ${lanes.join("\n")} } function isNamedEvaluationSource(node) { switch (node.kind) { - case 302 /* PropertyAssignment */: + case 303 /* PropertyAssignment */: return !isProtoSetter(node.name); - case 303 /* ShorthandPropertyAssignment */: + case 304 /* ShorthandPropertyAssignment */: return !!node.objectAssignmentInitializer; - case 259 /* VariableDeclaration */: + case 260 /* VariableDeclaration */: return isIdentifier(node.name) && !!node.initializer; - case 168 /* Parameter */: + case 169 /* Parameter */: return isIdentifier(node.name) && !!node.initializer && !node.dotDotDotToken; - case 207 /* BindingElement */: + case 208 /* BindingElement */: return isIdentifier(node.name) && !!node.initializer && !node.dotDotDotToken; - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: return !!node.initializer; - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: switch (node.operatorToken.kind) { case 64 /* EqualsToken */: case 77 /* AmpersandAmpersandEqualsToken */: @@ -15978,7 +16034,7 @@ ${lanes.join("\n")} return isIdentifier(node.left); } break; - case 276 /* ExportAssignment */: + case 277 /* ExportAssignment */: return true; } return false; @@ -15987,18 +16043,18 @@ ${lanes.join("\n")} if (!isNamedEvaluationSource(node)) return false; switch (node.kind) { - case 302 /* PropertyAssignment */: + case 303 /* PropertyAssignment */: return isAnonymousFunctionDefinition(node.initializer, cb); - case 303 /* ShorthandPropertyAssignment */: + case 304 /* ShorthandPropertyAssignment */: return isAnonymousFunctionDefinition(node.objectAssignmentInitializer, cb); - case 259 /* VariableDeclaration */: - case 168 /* Parameter */: - case 207 /* BindingElement */: - case 171 /* PropertyDeclaration */: + case 260 /* VariableDeclaration */: + case 169 /* Parameter */: + case 208 /* BindingElement */: + case 172 /* PropertyDeclaration */: return isAnonymousFunctionDefinition(node.initializer, cb); - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: return isAnonymousFunctionDefinition(node.right, cb); - case 276 /* ExportAssignment */: + case 277 /* ExportAssignment */: return isAnonymousFunctionDefinition(node.expression, cb); } } @@ -16007,17 +16063,17 @@ ${lanes.join("\n")} } function isParameterDeclaration(node) { const root = getRootDeclaration(node); - return root.kind === 168 /* Parameter */; + return root.kind === 169 /* Parameter */; } function getRootDeclaration(node) { - while (node.kind === 207 /* BindingElement */) { + while (node.kind === 208 /* BindingElement */) { node = node.parent.parent; } return node; } function nodeStartsNewLexicalEnvironment(node) { const kind = node.kind; - return kind === 175 /* Constructor */ || kind === 217 /* FunctionExpression */ || kind === 261 /* FunctionDeclaration */ || kind === 218 /* ArrowFunction */ || kind === 173 /* MethodDeclaration */ || kind === 176 /* GetAccessor */ || kind === 177 /* SetAccessor */ || kind === 266 /* ModuleDeclaration */ || kind === 311 /* SourceFile */; + return kind === 176 /* Constructor */ || kind === 218 /* FunctionExpression */ || kind === 262 /* FunctionDeclaration */ || kind === 219 /* ArrowFunction */ || kind === 174 /* MethodDeclaration */ || kind === 177 /* GetAccessor */ || kind === 178 /* SetAccessor */ || kind === 267 /* ModuleDeclaration */ || kind === 312 /* SourceFile */; } function nodeIsSynthesized(range) { return positionIsSynthesized(range.pos) || positionIsSynthesized(range.end); @@ -16027,22 +16083,22 @@ ${lanes.join("\n")} } function getExpressionAssociativity(expression) { const operator = getOperator(expression); - const hasArguments = expression.kind === 213 /* NewExpression */ && expression.arguments !== void 0; + const hasArguments = expression.kind === 214 /* NewExpression */ && expression.arguments !== void 0; return getOperatorAssociativity(expression.kind, operator, hasArguments); } function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 213 /* NewExpression */: + case 214 /* NewExpression */: return hasArguments ? 0 /* Left */ : 1 /* Right */; - case 223 /* PrefixUnaryExpression */: - case 220 /* TypeOfExpression */: - case 221 /* VoidExpression */: - case 219 /* DeleteExpression */: - case 222 /* AwaitExpression */: - case 226 /* ConditionalExpression */: - case 228 /* YieldExpression */: + case 224 /* PrefixUnaryExpression */: + case 221 /* TypeOfExpression */: + case 222 /* VoidExpression */: + case 220 /* DeleteExpression */: + case 223 /* AwaitExpression */: + case 227 /* ConditionalExpression */: + case 229 /* YieldExpression */: return 1 /* Right */; - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: switch (operator) { case 43 /* AsteriskAsteriskToken */: case 64 /* EqualsToken */: @@ -16068,13 +16124,13 @@ ${lanes.join("\n")} } function getExpressionPrecedence(expression) { const operator = getOperator(expression); - const hasArguments = expression.kind === 213 /* NewExpression */ && expression.arguments !== void 0; + const hasArguments = expression.kind === 214 /* NewExpression */ && expression.arguments !== void 0; return getOperatorPrecedence(expression.kind, operator, hasArguments); } function getOperator(expression) { - if (expression.kind === 225 /* BinaryExpression */) { + if (expression.kind === 226 /* BinaryExpression */) { return expression.operatorToken.kind; - } else if (expression.kind === 223 /* PrefixUnaryExpression */ || expression.kind === 224 /* PostfixUnaryExpression */) { + } else if (expression.kind === 224 /* PrefixUnaryExpression */ || expression.kind === 225 /* PostfixUnaryExpression */) { return expression.operator; } else { return expression.kind; @@ -16082,15 +16138,15 @@ ${lanes.join("\n")} } function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) { switch (nodeKind) { - case 360 /* CommaListExpression */: + case 361 /* CommaListExpression */: return 0 /* Comma */; - case 229 /* SpreadElement */: + case 230 /* SpreadElement */: return 1 /* Spread */; - case 228 /* YieldExpression */: + case 229 /* YieldExpression */: return 2 /* Yield */; - case 226 /* ConditionalExpression */: + case 227 /* ConditionalExpression */: return 4 /* Conditional */; - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: switch (operatorKind) { case 28 /* CommaToken */: return 0 /* Comma */; @@ -16114,27 +16170,27 @@ ${lanes.join("\n")} default: return getBinaryOperatorPrecedence(operatorKind); } - case 215 /* TypeAssertionExpression */: - case 234 /* NonNullExpression */: - case 223 /* PrefixUnaryExpression */: - case 220 /* TypeOfExpression */: - case 221 /* VoidExpression */: - case 219 /* DeleteExpression */: - case 222 /* AwaitExpression */: + case 216 /* TypeAssertionExpression */: + case 235 /* NonNullExpression */: + case 224 /* PrefixUnaryExpression */: + case 221 /* TypeOfExpression */: + case 222 /* VoidExpression */: + case 220 /* DeleteExpression */: + case 223 /* AwaitExpression */: return 16 /* Unary */; - case 224 /* PostfixUnaryExpression */: + case 225 /* PostfixUnaryExpression */: return 17 /* Update */; - case 212 /* CallExpression */: + case 213 /* CallExpression */: return 18 /* LeftHandSide */; - case 213 /* NewExpression */: + case 214 /* NewExpression */: return hasArguments ? 19 /* Member */ : 18 /* LeftHandSide */; - case 214 /* TaggedTemplateExpression */: - case 210 /* PropertyAccessExpression */: - case 211 /* ElementAccessExpression */: - case 235 /* MetaProperty */: + case 215 /* TaggedTemplateExpression */: + case 211 /* PropertyAccessExpression */: + case 212 /* ElementAccessExpression */: + case 236 /* MetaProperty */: return 19 /* Member */; - case 233 /* AsExpression */: - case 237 /* SatisfiesExpression */: + case 234 /* AsExpression */: + case 238 /* SatisfiesExpression */: return 11 /* Relational */; case 110 /* ThisKeyword */: case 108 /* SuperKeyword */: @@ -16146,19 +16202,19 @@ ${lanes.join("\n")} case 9 /* NumericLiteral */: case 10 /* BigIntLiteral */: case 11 /* StringLiteral */: - case 208 /* ArrayLiteralExpression */: - case 209 /* ObjectLiteralExpression */: - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: - case 230 /* ClassExpression */: + case 209 /* ArrayLiteralExpression */: + case 210 /* ObjectLiteralExpression */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: + case 231 /* ClassExpression */: case 14 /* RegularExpressionLiteral */: case 15 /* NoSubstitutionTemplateLiteral */: - case 227 /* TemplateExpression */: - case 216 /* ParenthesizedExpression */: - case 231 /* OmittedExpression */: - case 283 /* JsxElement */: - case 284 /* JsxSelfClosingElement */: - case 287 /* JsxFragment */: + case 228 /* TemplateExpression */: + case 217 /* ParenthesizedExpression */: + case 232 /* OmittedExpression */: + case 284 /* JsxElement */: + case 285 /* JsxSelfClosingElement */: + case 288 /* JsxFragment */: return 20 /* Primary */; default: return -1 /* Invalid */; @@ -16211,7 +16267,7 @@ ${lanes.join("\n")} function getSemanticJsxChildren(children) { return filter(children, (i) => { switch (i.kind) { - case 293 /* JsxExpression */: + case 294 /* JsxExpression */: return !!i.expression; case 12 /* JsxText */: return !i.containsOnlyTriviaWhiteSpaces; @@ -16680,6 +16736,12 @@ ${lanes.join("\n")} function isThisIdentifier(node) { return !!node && node.kind === 80 /* Identifier */ && identifierIsThisKeyword(node); } + function isInTypeQuery(node) { + return !!findAncestor( + node, + (n) => n.kind === 186 /* TypeQuery */ ? true : n.kind === 80 /* Identifier */ || n.kind === 166 /* QualifiedName */ ? false : "quit" + ); + } function isThisInTypeQuery(node) { if (!isThisIdentifier(node)) { return false; @@ -16687,7 +16749,7 @@ ${lanes.join("\n")} while (isQualifiedName(node.parent) && node.parent.left === node) { node = node.parent; } - return node.parent.kind === 185 /* TypeQuery */; + return node.parent.kind === 186 /* TypeQuery */; } function identifierIsThisKeyword(id) { return id.escapedText === "this"; @@ -16699,9 +16761,9 @@ ${lanes.join("\n")} let setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 176 /* GetAccessor */) { + if (accessor.kind === 177 /* GetAccessor */) { getAccessor = accessor; - } else if (accessor.kind === 177 /* SetAccessor */) { + } else if (accessor.kind === 178 /* SetAccessor */) { setAccessor = accessor; } else { Debug.fail("Accessor has wrong kind"); @@ -16717,10 +16779,10 @@ ${lanes.join("\n")} } else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 176 /* GetAccessor */ && !getAccessor) { + if (member.kind === 177 /* GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 177 /* SetAccessor */ && !setAccessor) { + if (member.kind === 178 /* SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -16752,7 +16814,7 @@ ${lanes.join("\n")} return flatMap(getJSDocTags(node), (tag) => isNonTypeAliasTemplate(tag) ? tag.typeParameters : void 0); } function isNonTypeAliasTemplate(tag) { - return isJSDocTemplateTag(tag) && !(tag.parent.kind === 326 /* JSDoc */ && (tag.parent.tags.some(isJSDocTypeAlias) || tag.parent.tags.some(isJSDocOverloadTag))); + return isJSDocTemplateTag(tag) && !(tag.parent.kind === 327 /* JSDoc */ && (tag.parent.tags.some(isJSDocTypeAlias) || tag.parent.tags.some(isJSDocOverloadTag))); } function getEffectiveSetAccessorTypeAnnotationNode(node) { const parameter = getSetAccessorValueParameter(node); @@ -16942,7 +17004,7 @@ ${lanes.join("\n")} return getSyntacticModifierFlags(node) & flags; } function getModifierFlagsWorker(node, includeJSDoc, alwaysIncludeJSDoc) { - if (node.kind >= 0 /* FirstToken */ && node.kind <= 164 /* LastToken */) { + if (node.kind >= 0 /* FirstToken */ && node.kind <= 165 /* LastToken */) { return 0 /* None */; } if (!(node.modifierFlagsCache & 536870912 /* HasComputedFlags */)) { @@ -17001,7 +17063,7 @@ ${lanes.join("\n")} } function getSyntacticModifierFlagsNoCache(node) { let flags = canHaveModifiers(node) ? modifiersToFlags(node.modifiers) : 0 /* None */; - if (node.flags & 4 /* NestedNamespace */ || node.kind === 80 /* Identifier */ && node.flags & 2048 /* IdentifierIsInJSDocNamespace */) { + if (node.flags & 8 /* NestedNamespace */ || node.kind === 80 /* Identifier */ && node.flags & 4096 /* IdentifierIsInJSDocNamespace */) { flags |= 1 /* Export */; } return flags; @@ -17041,13 +17103,13 @@ ${lanes.join("\n")} return 512 /* Async */; case 148 /* ReadonlyKeyword */: return 64 /* Readonly */; - case 163 /* OverrideKeyword */: + case 164 /* OverrideKeyword */: return 16384 /* Override */; case 103 /* InKeyword */: return 32768 /* In */; case 147 /* OutKeyword */: return 65536 /* Out */; - case 169 /* Decorator */: + case 170 /* Decorator */: return 131072 /* Decorator */; } return 0 /* None */; @@ -17104,7 +17166,7 @@ ${lanes.join("\n")} true )) { const kind = node.left.kind; - return kind === 209 /* ObjectLiteralExpression */ || kind === 208 /* ArrayLiteralExpression */; + return kind === 210 /* ObjectLiteralExpression */ || kind === 209 /* ArrayLiteralExpression */; } return false; } @@ -17118,12 +17180,12 @@ ${lanes.join("\n")} switch (node.kind) { case 80 /* Identifier */: return node; - case 165 /* QualifiedName */: + case 166 /* QualifiedName */: do { node = node.left; } while (node.kind !== 80 /* Identifier */); return node; - case 210 /* PropertyAccessExpression */: + case 211 /* PropertyAccessExpression */: do { node = node.expression; } while (node.kind !== 80 /* Identifier */); @@ -17131,7 +17193,7 @@ ${lanes.join("\n")} } } function isDottedName(node) { - return node.kind === 80 /* Identifier */ || node.kind === 110 /* ThisKeyword */ || node.kind === 108 /* SuperKeyword */ || node.kind === 235 /* MetaProperty */ || node.kind === 210 /* PropertyAccessExpression */ && isDottedName(node.expression) || node.kind === 216 /* ParenthesizedExpression */ && isDottedName(node.expression); + return node.kind === 80 /* Identifier */ || node.kind === 110 /* ThisKeyword */ || node.kind === 108 /* SuperKeyword */ || node.kind === 236 /* MetaProperty */ || node.kind === 211 /* PropertyAccessExpression */ && isDottedName(node.expression) || node.kind === 217 /* ParenthesizedExpression */ && isDottedName(node.expression); } function isPropertyAccessEntityNameExpression(node) { return isPropertyAccessExpression(node) && isIdentifier(node.name) && isEntityNameExpression(node.expression); @@ -17158,7 +17220,7 @@ ${lanes.join("\n")} return isBindableStaticAccessExpression(node) && getElementOrPropertyAccessName(node) === "prototype"; } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return node.parent.kind === 165 /* QualifiedName */ && node.parent.right === node || node.parent.kind === 210 /* PropertyAccessExpression */ && node.parent.name === node; + return node.parent.kind === 166 /* QualifiedName */ && node.parent.right === node || node.parent.kind === 211 /* PropertyAccessExpression */ && node.parent.name === node || node.parent.kind === 236 /* MetaProperty */ && node.parent.name === node; } function isRightSideOfAccessExpression(node) { return isPropertyAccessExpression(node.parent) && node.parent.name === node || isElementAccessExpression(node.parent) && node.parent.argumentExpression === node; @@ -17167,10 +17229,10 @@ ${lanes.join("\n")} return isQualifiedName(node.parent) && node.parent.right === node || isPropertyAccessExpression(node.parent) && node.parent.name === node || isJSDocMemberName(node.parent) && node.parent.right === node; } function isEmptyObjectLiteral(expression) { - return expression.kind === 209 /* ObjectLiteralExpression */ && expression.properties.length === 0; + return expression.kind === 210 /* ObjectLiteralExpression */ && expression.properties.length === 0; } function isEmptyArrayLiteral(expression) { - return expression.kind === 208 /* ArrayLiteralExpression */ && expression.elements.length === 0; + return expression.kind === 209 /* ArrayLiteralExpression */ && expression.elements.length === 0; } function getLocalSymbolForExportDefault(symbol) { if (!isExportDefaultSymbol(symbol) || !symbol.declarations) @@ -17436,8 +17498,8 @@ ${lanes.join("\n")} const parseNode = getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 265 /* EnumDeclaration */: - case 266 /* ModuleDeclaration */: + case 266 /* EnumDeclaration */: + case 267 /* ModuleDeclaration */: return parseNode === parseNode.parent.name; } } @@ -17490,24 +17552,24 @@ ${lanes.join("\n")} function accessKind(node) { const { parent: parent2 } = node; switch (parent2 == null ? void 0 : parent2.kind) { - case 216 /* ParenthesizedExpression */: + case 217 /* ParenthesizedExpression */: return accessKind(parent2); - case 224 /* PostfixUnaryExpression */: - case 223 /* PrefixUnaryExpression */: + case 225 /* PostfixUnaryExpression */: + case 224 /* PrefixUnaryExpression */: const { operator } = parent2; return operator === 46 /* PlusPlusToken */ || operator === 47 /* MinusMinusToken */ ? 2 /* ReadWrite */ : 0 /* Read */; - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: const { left, operatorToken } = parent2; return left === node && isAssignmentOperator(operatorToken.kind) ? operatorToken.kind === 64 /* EqualsToken */ ? 1 /* Write */ : 2 /* ReadWrite */ : 0 /* Read */; - case 210 /* PropertyAccessExpression */: + case 211 /* PropertyAccessExpression */: return parent2.name !== node ? 0 /* Read */ : accessKind(parent2); - case 302 /* PropertyAssignment */: { + case 303 /* PropertyAssignment */: { const parentAccess = accessKind(parent2.parent); return node === parent2.name ? reverseAccessKind(parentAccess) : parentAccess; } - case 303 /* ShorthandPropertyAssignment */: + case 304 /* ShorthandPropertyAssignment */: return node === parent2.objectAssignmentInitializer ? 0 /* Read */ : accessKind(parent2.parent); - case 208 /* ArrayLiteralExpression */: + case 209 /* ArrayLiteralExpression */: return accessKind(parent2); default: return 0 /* Read */; @@ -17620,16 +17682,16 @@ ${lanes.join("\n")} return isClassLike(node) || isInterfaceDeclaration(node) || isTypeLiteralNode(node); } function isTypeNodeKind(kind) { - return kind >= 181 /* FirstTypeNode */ && kind <= 204 /* LastTypeNode */ || kind === 133 /* AnyKeyword */ || kind === 159 /* UnknownKeyword */ || kind === 150 /* NumberKeyword */ || kind === 162 /* BigIntKeyword */ || kind === 151 /* ObjectKeyword */ || kind === 136 /* BooleanKeyword */ || kind === 154 /* StringKeyword */ || kind === 155 /* SymbolKeyword */ || kind === 116 /* VoidKeyword */ || kind === 157 /* UndefinedKeyword */ || kind === 146 /* NeverKeyword */ || kind === 141 /* IntrinsicKeyword */ || kind === 232 /* ExpressionWithTypeArguments */ || kind === 318 /* JSDocAllType */ || kind === 319 /* JSDocUnknownType */ || kind === 320 /* JSDocNullableType */ || kind === 321 /* JSDocNonNullableType */ || kind === 322 /* JSDocOptionalType */ || kind === 323 /* JSDocFunctionType */ || kind === 324 /* JSDocVariadicType */; + return kind >= 182 /* FirstTypeNode */ && kind <= 205 /* LastTypeNode */ || kind === 133 /* AnyKeyword */ || kind === 159 /* UnknownKeyword */ || kind === 150 /* NumberKeyword */ || kind === 163 /* BigIntKeyword */ || kind === 151 /* ObjectKeyword */ || kind === 136 /* BooleanKeyword */ || kind === 154 /* StringKeyword */ || kind === 155 /* SymbolKeyword */ || kind === 116 /* VoidKeyword */ || kind === 157 /* UndefinedKeyword */ || kind === 146 /* NeverKeyword */ || kind === 141 /* IntrinsicKeyword */ || kind === 233 /* ExpressionWithTypeArguments */ || kind === 319 /* JSDocAllType */ || kind === 320 /* JSDocUnknownType */ || kind === 321 /* JSDocNullableType */ || kind === 322 /* JSDocNonNullableType */ || kind === 323 /* JSDocOptionalType */ || kind === 324 /* JSDocFunctionType */ || kind === 325 /* JSDocVariadicType */; } function isAccessExpression(node) { - return node.kind === 210 /* PropertyAccessExpression */ || node.kind === 211 /* ElementAccessExpression */; + return node.kind === 211 /* PropertyAccessExpression */ || node.kind === 212 /* ElementAccessExpression */; } function getNameOfAccessExpression(node) { - if (node.kind === 210 /* PropertyAccessExpression */) { + if (node.kind === 211 /* PropertyAccessExpression */) { return node.name; } - Debug.assert(node.kind === 211 /* ElementAccessExpression */); + Debug.assert(node.kind === 212 /* ElementAccessExpression */); return node.argumentExpression; } function isBundleFileTextLike(section) { @@ -17642,7 +17704,7 @@ ${lanes.join("\n")} } } function isNamedImportsOrExports(node) { - return node.kind === 274 /* NamedImports */ || node.kind === 278 /* NamedExports */; + return node.kind === 275 /* NamedImports */ || node.kind === 279 /* NamedExports */; } function getLeftmostAccessExpression(expr) { while (isAccessExpression(expr)) { @@ -17655,12 +17717,12 @@ ${lanes.join("\n")} return walkAccessExpression(name.parent); } function walkAccessExpression(access) { - if (access.kind === 210 /* PropertyAccessExpression */) { + if (access.kind === 211 /* PropertyAccessExpression */) { const res = action(access.name); if (res !== void 0) { return res; } - } else if (access.kind === 211 /* ElementAccessExpression */) { + } else if (access.kind === 212 /* ElementAccessExpression */) { if (isIdentifier(access.argumentExpression) || isStringLiteralLike(access.argumentExpression)) { const res = action(access.argumentExpression); if (res !== void 0) { @@ -17682,28 +17744,28 @@ ${lanes.join("\n")} function getLeftmostExpression(node, stopAtCallExpressions) { while (true) { switch (node.kind) { - case 224 /* PostfixUnaryExpression */: + case 225 /* PostfixUnaryExpression */: node = node.operand; continue; - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: node = node.left; continue; - case 226 /* ConditionalExpression */: + case 227 /* ConditionalExpression */: node = node.condition; continue; - case 214 /* TaggedTemplateExpression */: + case 215 /* TaggedTemplateExpression */: node = node.tag; continue; - case 212 /* CallExpression */: + case 213 /* CallExpression */: if (stopAtCallExpressions) { return node; } - case 233 /* AsExpression */: - case 211 /* ElementAccessExpression */: - case 210 /* PropertyAccessExpression */: - case 234 /* NonNullExpression */: - case 359 /* PartiallyEmittedExpression */: - case 237 /* SatisfiesExpression */: + case 234 /* AsExpression */: + case 212 /* ElementAccessExpression */: + case 211 /* PropertyAccessExpression */: + case 235 /* NonNullExpression */: + case 360 /* PartiallyEmittedExpression */: + case 238 /* SatisfiesExpression */: node = node.expression; continue; } @@ -18161,6 +18223,9 @@ ${lanes.join("\n")} function getUseDefineForClassFields(compilerOptions) { return compilerOptions.useDefineForClassFields === void 0 ? getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */ : compilerOptions.useDefineForClassFields; } + function getEmitStandardClassFields(compilerOptions) { + return compilerOptions.useDefineForClassFields !== false && getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */; + } function compilerOptionsAffectSemanticDiagnostics(newOptions, oldOptions) { return optionsHaveChanges(oldOptions, newOptions, semanticDiagnosticsOptionDeclarations); } @@ -18346,7 +18411,7 @@ ${lanes.join("\n")} function replaceWildcardCharacter(match, singleAsteriskRegexFragment) { return match === "*" ? singleAsteriskRegexFragment : match === "?" ? "[^/]" : "\\" + match; } - function getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory) { + function getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames2, currentDirectory) { path = normalizePath(path); currentDirectory = normalizePath(currentDirectory); const absolutePath = combinePaths(currentDirectory, path); @@ -18355,22 +18420,22 @@ ${lanes.join("\n")} includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"), includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"), excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"), - basePaths: getBasePaths(path, includes, useCaseSensitiveFileNames) + basePaths: getBasePaths(path, includes, useCaseSensitiveFileNames2) }; } - function getRegexFromPattern(pattern, useCaseSensitiveFileNames) { - return new RegExp(pattern, useCaseSensitiveFileNames ? "" : "i"); + function getRegexFromPattern(pattern, useCaseSensitiveFileNames2) { + return new RegExp(pattern, useCaseSensitiveFileNames2 ? "" : "i"); } - function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries, realpath) { + function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames2, currentDirectory, depth, getFileSystemEntries, realpath) { path = normalizePath(path); currentDirectory = normalizePath(currentDirectory); - const patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory); - const includeFileRegexes = patterns.includeFilePatterns && patterns.includeFilePatterns.map((pattern) => getRegexFromPattern(pattern, useCaseSensitiveFileNames)); - const includeDirectoryRegex = patterns.includeDirectoryPattern && getRegexFromPattern(patterns.includeDirectoryPattern, useCaseSensitiveFileNames); - const excludeRegex = patterns.excludePattern && getRegexFromPattern(patterns.excludePattern, useCaseSensitiveFileNames); + const patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames2, currentDirectory); + const includeFileRegexes = patterns.includeFilePatterns && patterns.includeFilePatterns.map((pattern) => getRegexFromPattern(pattern, useCaseSensitiveFileNames2)); + const includeDirectoryRegex = patterns.includeDirectoryPattern && getRegexFromPattern(patterns.includeDirectoryPattern, useCaseSensitiveFileNames2); + const excludeRegex = patterns.excludePattern && getRegexFromPattern(patterns.excludePattern, useCaseSensitiveFileNames2); const results = includeFileRegexes ? includeFileRegexes.map(() => []) : [[]]; const visited = /* @__PURE__ */ new Map(); - const toCanonical = createGetCanonicalFileName(useCaseSensitiveFileNames); + const toCanonical = createGetCanonicalFileName(useCaseSensitiveFileNames2); for (const basePath of patterns.basePaths) { visitDirectory(basePath, combinePaths(currentDirectory, basePath), depth); } @@ -18412,7 +18477,7 @@ ${lanes.join("\n")} } } } - function getBasePaths(path, includes, useCaseSensitiveFileNames) { + function getBasePaths(path, includes, useCaseSensitiveFileNames2) { const basePaths = [path]; if (includes) { const includeBasePaths = []; @@ -18420,9 +18485,9 @@ ${lanes.join("\n")} const absolute = isRootedDiskPath(include) ? include : normalizePath(combinePaths(path, include)); includeBasePaths.push(getIncludeBasePath(absolute)); } - includeBasePaths.sort(getStringComparer(!useCaseSensitiveFileNames)); + includeBasePaths.sort(getStringComparer(!useCaseSensitiveFileNames2)); for (const includeBasePath of includeBasePaths) { - if (every(basePaths, (basePath) => !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames))) { + if (every(basePaths, (basePath) => !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames2))) { basePaths.push(includeBasePath); } } @@ -18781,39 +18846,39 @@ ${lanes.join("\n")} return success && result === 10 /* BigIntLiteral */ && scanner2.getTokenEnd() === s.length + 1 && !(flags & 512 /* ContainsSeparator */) && (!roundTripOnly || s === pseudoBigIntToString({ negative, base10Value: parsePseudoBigInt(scanner2.getTokenValue()) })); } function isValidTypeOnlyAliasUseSite(useSite) { - return !!(useSite.flags & 16777216 /* Ambient */) || isPartOfTypeQuery(useSite) || isIdentifierInNonEmittingHeritageClause(useSite) || isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(useSite) || !(isExpressionNode(useSite) || isShorthandPropertyNameUseSite(useSite)); + return !!(useSite.flags & 33554432 /* Ambient */) || isPartOfTypeQuery(useSite) || isIdentifierInNonEmittingHeritageClause(useSite) || isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(useSite) || !(isExpressionNode(useSite) || isShorthandPropertyNameUseSite(useSite)); } function isShorthandPropertyNameUseSite(useSite) { return isIdentifier(useSite) && isShorthandPropertyAssignment(useSite.parent) && useSite.parent.name === useSite; } function isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(node) { - while (node.kind === 80 /* Identifier */ || node.kind === 210 /* PropertyAccessExpression */) { + while (node.kind === 80 /* Identifier */ || node.kind === 211 /* PropertyAccessExpression */) { node = node.parent; } - if (node.kind !== 166 /* ComputedPropertyName */) { + if (node.kind !== 167 /* ComputedPropertyName */) { return false; } if (hasSyntacticModifier(node.parent, 256 /* Abstract */)) { return true; } const containerKind = node.parent.parent.kind; - return containerKind === 263 /* InterfaceDeclaration */ || containerKind === 186 /* TypeLiteral */; + return containerKind === 264 /* InterfaceDeclaration */ || containerKind === 187 /* TypeLiteral */; } function isIdentifierInNonEmittingHeritageClause(node) { if (node.kind !== 80 /* Identifier */) return false; const heritageClause = findAncestor(node.parent, (parent2) => { switch (parent2.kind) { - case 297 /* HeritageClause */: + case 298 /* HeritageClause */: return true; - case 210 /* PropertyAccessExpression */: - case 232 /* ExpressionWithTypeArguments */: + case 211 /* PropertyAccessExpression */: + case 233 /* ExpressionWithTypeArguments */: return false; default: return "quit"; } }); - return (heritageClause == null ? void 0 : heritageClause.token) === 119 /* ImplementsKeyword */ || (heritageClause == null ? void 0 : heritageClause.parent.kind) === 263 /* InterfaceDeclaration */; + return (heritageClause == null ? void 0 : heritageClause.token) === 119 /* ImplementsKeyword */ || (heritageClause == null ? void 0 : heritageClause.parent.kind) === 264 /* InterfaceDeclaration */; } function isIdentifierTypeReference(node) { return isTypeReferenceNode(node) && isIdentifier(node.typeName); @@ -18925,20 +18990,20 @@ ${lanes.join("\n")} if (!node.parent) return void 0; switch (node.kind) { - case 167 /* TypeParameter */: + case 168 /* TypeParameter */: const { parent: parent3 } = node; - return parent3.kind === 194 /* InferType */ ? void 0 : parent3.typeParameters; - case 168 /* Parameter */: + return parent3.kind === 195 /* InferType */ ? void 0 : parent3.typeParameters; + case 169 /* Parameter */: return node.parent.parameters; - case 203 /* TemplateLiteralTypeSpan */: + case 204 /* TemplateLiteralTypeSpan */: return node.parent.templateSpans; - case 238 /* TemplateSpan */: + case 239 /* TemplateSpan */: return node.parent.templateSpans; - case 169 /* Decorator */: { + case 170 /* Decorator */: { const { parent: parent4 } = node; return canHaveDecorators(parent4) ? parent4.modifiers : void 0; } - case 297 /* HeritageClause */: + case 298 /* HeritageClause */: return node.parent.heritageClauses; } const { parent: parent2 } = node; @@ -18946,43 +19011,43 @@ ${lanes.join("\n")} return isJSDocTypeLiteral(node.parent) ? void 0 : node.parent.tags; } switch (parent2.kind) { - case 186 /* TypeLiteral */: - case 263 /* InterfaceDeclaration */: + case 187 /* TypeLiteral */: + case 264 /* InterfaceDeclaration */: return isTypeElement(node) ? parent2.members : void 0; - case 191 /* UnionType */: - case 192 /* IntersectionType */: + case 192 /* UnionType */: + case 193 /* IntersectionType */: return parent2.types; - case 188 /* TupleType */: - case 208 /* ArrayLiteralExpression */: - case 360 /* CommaListExpression */: - case 274 /* NamedImports */: - case 278 /* NamedExports */: + case 189 /* TupleType */: + case 209 /* ArrayLiteralExpression */: + case 361 /* CommaListExpression */: + case 275 /* NamedImports */: + case 279 /* NamedExports */: return parent2.elements; - case 209 /* ObjectLiteralExpression */: - case 291 /* JsxAttributes */: + case 210 /* ObjectLiteralExpression */: + case 292 /* JsxAttributes */: return parent2.properties; - case 212 /* CallExpression */: - case 213 /* NewExpression */: + case 213 /* CallExpression */: + case 214 /* NewExpression */: return isTypeNode(node) ? parent2.typeArguments : parent2.expression === node ? void 0 : parent2.arguments; - case 283 /* JsxElement */: - case 287 /* JsxFragment */: + case 284 /* JsxElement */: + case 288 /* JsxFragment */: return isJsxChild(node) ? parent2.children : void 0; - case 285 /* JsxOpeningElement */: - case 284 /* JsxSelfClosingElement */: + case 286 /* JsxOpeningElement */: + case 285 /* JsxSelfClosingElement */: return isTypeNode(node) ? parent2.typeArguments : void 0; - case 240 /* Block */: - case 295 /* CaseClause */: - case 296 /* DefaultClause */: - case 267 /* ModuleBlock */: + case 241 /* Block */: + case 296 /* CaseClause */: + case 297 /* DefaultClause */: + case 268 /* ModuleBlock */: return parent2.statements; - case 268 /* CaseBlock */: + case 269 /* CaseBlock */: return parent2.clauses; - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: return isClassElement(node) ? parent2.members : void 0; - case 265 /* EnumDeclaration */: + case 266 /* EnumDeclaration */: return isEnumMember(node) ? parent2.members : void 0; - case 311 /* SourceFile */: + case 312 /* SourceFile */: return parent2.statements; } } @@ -18991,7 +19056,7 @@ ${lanes.join("\n")} if (some(node.parameters, (p) => !getEffectiveTypeAnnotationNode(p))) { return true; } - if (node.kind !== 218 /* ArrowFunction */) { + if (node.kind !== 219 /* ArrowFunction */) { const parameter = firstOrUndefined(node.parameters); if (!(parameter && parameterIsThisKeyword(parameter))) { return true; @@ -19004,14 +19069,14 @@ ${lanes.join("\n")} return name === "Infinity" || name === "-Infinity" || name === "NaN"; } function isCatchClauseVariableDeclaration(node) { - return node.kind === 259 /* VariableDeclaration */ && node.parent.kind === 298 /* CatchClause */; + return node.kind === 260 /* VariableDeclaration */ && node.parent.kind === 299 /* CatchClause */; } function isParameterOrCatchClauseVariable(symbol) { const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration); return !!declaration && (isParameter(declaration) || isCatchClauseVariableDeclaration(declaration)); } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 217 /* FunctionExpression */ || node.kind === 218 /* ArrowFunction */; + return node.kind === 218 /* FunctionExpression */ || node.kind === 219 /* ArrowFunction */; } function escapeSnippetText(text) { return text.replace(/\$/gm, () => "\\$"); @@ -19074,23 +19139,23 @@ ${lanes.join("\n")} } function getParameterTypeNode(parameter) { var _a; - return parameter.kind === 347 /* JSDocParameterTag */ ? (_a = parameter.typeExpression) == null ? void 0 : _a.type : parameter.type; + return parameter.kind === 348 /* JSDocParameterTag */ ? (_a = parameter.typeExpression) == null ? void 0 : _a.type : parameter.type; } function isTypeDeclaration(node) { switch (node.kind) { - case 167 /* TypeParameter */: - case 262 /* ClassDeclaration */: - case 263 /* InterfaceDeclaration */: - case 264 /* TypeAliasDeclaration */: - case 265 /* EnumDeclaration */: - case 352 /* JSDocTypedefTag */: - case 344 /* JSDocCallbackTag */: - case 346 /* JSDocEnumTag */: + case 168 /* TypeParameter */: + case 263 /* ClassDeclaration */: + case 264 /* InterfaceDeclaration */: + case 265 /* TypeAliasDeclaration */: + case 266 /* EnumDeclaration */: + case 353 /* JSDocTypedefTag */: + case 345 /* JSDocCallbackTag */: + case 347 /* JSDocEnumTag */: return true; - case 272 /* ImportClause */: + case 273 /* ImportClause */: return node.isTypeOnly; - case 275 /* ImportSpecifier */: - case 280 /* ExportSpecifier */: + case 276 /* ImportSpecifier */: + case 281 /* ExportSpecifier */: return node.parent.parent.isTypeOnly; default: return false; @@ -19104,7 +19169,7 @@ ${lanes.join("\n")} return false; } const { isBracketed, typeExpression } = node; - return isBracketed || !!typeExpression && typeExpression.type.kind === 322 /* JSDocOptionalType */; + return isBracketed || !!typeExpression && typeExpression.type.kind === 323 /* JSDocOptionalType */; } function canUsePropertyAccess(name, languageVersion) { if (name.length === 0) { @@ -19119,17 +19184,17 @@ ${lanes.join("\n")} } function isJSDocOptionalParameter(node) { return isInJSFile(node) && // node.type should only be a JSDocOptionalType when node is a parameter of a JSDocFunctionType - (node.type && node.type.kind === 322 /* JSDocOptionalType */ || getJSDocParameterTags(node).some(({ isBracketed, typeExpression }) => isBracketed || !!typeExpression && typeExpression.type.kind === 322 /* JSDocOptionalType */)); + (node.type && node.type.kind === 323 /* JSDocOptionalType */ || getJSDocParameterTags(node).some(({ isBracketed, typeExpression }) => isBracketed || !!typeExpression && typeExpression.type.kind === 323 /* JSDocOptionalType */)); } function isOptionalDeclaration(declaration) { switch (declaration.kind) { - case 171 /* PropertyDeclaration */: - case 170 /* PropertySignature */: + case 172 /* PropertyDeclaration */: + case 171 /* PropertySignature */: return !!declaration.questionToken; - case 168 /* Parameter */: + case 169 /* Parameter */: return !!declaration.questionToken || isJSDocOptionalParameter(declaration); - case 354 /* JSDocPropertyTag */: - case 347 /* JSDocParameterTag */: + case 355 /* JSDocPropertyTag */: + case 348 /* JSDocParameterTag */: return isOptionalJSDocPropertyLikeTag(declaration); default: return false; @@ -19137,7 +19202,7 @@ ${lanes.join("\n")} } function isNonNullAccess(node) { const kind = node.kind; - return (kind === 210 /* PropertyAccessExpression */ || kind === 211 /* ElementAccessExpression */) && isNonNullExpression(node.expression); + return (kind === 211 /* PropertyAccessExpression */ || kind === 212 /* ElementAccessExpression */) && isNonNullExpression(node.expression); } function isJSDocSatisfiesExpression(node) { return isInJSFile(node) && isParenthesizedExpression(node) && hasJSDocNodes(node) && !!getJSDocSatisfiesTag(node); @@ -19157,7 +19222,7 @@ ${lanes.join("\n")} } function isJsxAttributeName(node) { const kind = node.kind; - return kind === 80 /* Identifier */ || kind === 294 /* JsxNamespacedName */; + return kind === 80 /* Identifier */ || kind === 295 /* JsxNamespacedName */; } function getEscapedTextOfJsxNamespacedName(node) { return `${node.namespace.escapedText}:${idText(node.name)}`; @@ -19168,6 +19233,18 @@ ${lanes.join("\n")} function intrinsicTagNameToString(node) { return isIdentifier(node) ? idText(node) : getTextOfJsxNamespacedName(node); } + function isTypeUsableAsPropertyName(type) { + return !!(type.flags & 8576 /* StringOrNumberLiteralOrUnique */); + } + function getPropertyNameFromType(type) { + if (type.flags & 8192 /* UniqueESSymbol */) { + return type.escapedName; + } + if (type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) { + return escapeLeadingUnderscores("" + type.value); + } + return Debug.fail(); + } var resolvingEmptyArray, externalHelpersModuleNameText, defaultMaximumTruncationLength, noTruncationMaximumTruncationLength, stringWriter, GetLiteralTextFlags, fullTripleSlashReferencePathRegEx, fullTripleSlashReferenceTypeReferenceDirectiveRegEx, fullTripleSlashLibReferenceRegEx, fullTripleSlashAMDReferencePathRegEx, fullTripleSlashAMDModuleRegEx, defaultLibReferenceRegEx, AssignmentKind, FunctionFlags, Associativity, OperatorPrecedence, templateSubstitutionRegExp, doubleQuoteEscapedCharsRegExp, singleQuoteEscapedCharsRegExp, backtickQuoteEscapedCharsRegExp, escapedCharsMap, nonAsciiCharacters, jsxDoubleQuoteEscapedCharsRegExp, jsxSingleQuoteEscapedCharsRegExp, jsxEscapedCharsMap, indentStrings, base64Digits, carriageReturnLineFeed, lineFeed, objectAllocator, objectAllocatorPatchers, localizedDiagnosticMessages, reservedCharacterPattern, wildcardCharCodes, commonPackageFolders, implicitExcludePathRegexPattern, filesMatcher, directoriesMatcher, excludeMatcher, wildcardMatchers, supportedTSExtensions, supportedTSExtensionsFlat, supportedTSExtensionsWithJson, supportedTSExtensionsForExtractExtension, supportedJSExtensions, supportedJSExtensionsFlat, allSupportedExtensions, allSupportedExtensionsWithJson, supportedDeclarationExtensions, supportedTSImplementationExtensions, extensionsNotSupportingExtensionlessResolution, ModuleSpecifierEnding, extensionsToRemove, emptyFileSystemEntries; var init_utilities = __esm({ "src/compiler/utilities.ts"() { @@ -19240,9 +19317,9 @@ ${lanes.join("\n")} return OperatorPrecedence2; })(OperatorPrecedence || {}); templateSubstitutionRegExp = /\$\{/g; - doubleQuoteEscapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; - singleQuoteEscapedCharsRegExp = /[\\\'\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; - backtickQuoteEscapedCharsRegExp = /\r\n|[\\\`\u0000-\u001f\t\v\f\b\r\u2028\u2029\u0085]/g; + doubleQuoteEscapedCharsRegExp = /[\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; + singleQuoteEscapedCharsRegExp = /[\\'\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; + backtickQuoteEscapedCharsRegExp = /\r\n|[\\`\u0000-\u001f\t\v\f\b\r\u2028\u2029\u0085]/g; escapedCharsMap = new Map(Object.entries({ " ": "\\t", "\v": "\\v", @@ -19264,8 +19341,8 @@ ${lanes.join("\n")} // special case for CRLFs in backticks })); nonAsciiCharacters = /[^\u0000-\u007F]/g; - jsxDoubleQuoteEscapedCharsRegExp = /[\"\u0000-\u001f\u2028\u2029\u0085]/g; - jsxSingleQuoteEscapedCharsRegExp = /[\'\u0000-\u001f\u2028\u2029\u0085]/g; + jsxDoubleQuoteEscapedCharsRegExp = /["\u0000-\u001f\u2028\u2029\u0085]/g; + jsxSingleQuoteEscapedCharsRegExp = /['\u0000-\u001f\u2028\u2029\u0085]/g; jsxEscapedCharsMap = new Map(Object.entries({ '"': """, "'": "'" @@ -19286,7 +19363,7 @@ ${lanes.join("\n")} getSourceMapSourceConstructor: () => SourceMapSource }; objectAllocatorPatchers = []; - reservedCharacterPattern = /[^\w\s\/]/g; + reservedCharacterPattern = /[^\w\s/]/g; wildcardCharCodes = [42 /* asterisk */, 63 /* question */]; commonPackageFolders = ["node_modules", "bower_components", "jspm_packages"]; implicitExcludePathRegexPattern = `(?!(${commonPackageFolders.join("|")})(/|$))`; @@ -19477,16 +19554,16 @@ ${lanes.join("\n")} return parenthesizerRule; } function binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { - const binaryOperatorPrecedence = getOperatorPrecedence(225 /* BinaryExpression */, binaryOperator); - const binaryOperatorAssociativity = getOperatorAssociativity(225 /* BinaryExpression */, binaryOperator); + const binaryOperatorPrecedence = getOperatorPrecedence(226 /* BinaryExpression */, binaryOperator); + const binaryOperatorAssociativity = getOperatorAssociativity(226 /* BinaryExpression */, binaryOperator); const emittedOperand = skipPartiallyEmittedExpressions(operand); - if (!isLeftSideOfBinary && operand.kind === 218 /* ArrowFunction */ && binaryOperatorPrecedence > 3 /* Assignment */) { + if (!isLeftSideOfBinary && operand.kind === 219 /* ArrowFunction */ && binaryOperatorPrecedence > 3 /* Assignment */) { return true; } const operandPrecedence = getExpressionPrecedence(emittedOperand); switch (compareValues(operandPrecedence, binaryOperatorPrecedence)) { case -1 /* LessThan */: - if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 /* Right */ && operand.kind === 228 /* YieldExpression */) { + if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 /* Right */ && operand.kind === 229 /* YieldExpression */) { return false; } return true; @@ -19520,7 +19597,7 @@ ${lanes.join("\n")} if (isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 225 /* BinaryExpression */ && node.operatorToken.kind === 40 /* PlusToken */) { + if (node.kind === 226 /* BinaryExpression */ && node.operatorToken.kind === 40 /* PlusToken */) { if (node.cachedLiteralKind !== void 0) { return node.cachedLiteralKind; } @@ -19533,7 +19610,7 @@ ${lanes.join("\n")} } function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { const skipped = skipPartiallyEmittedExpressions(operand); - if (skipped.kind === 216 /* ParenthesizedExpression */) { + if (skipped.kind === 217 /* ParenthesizedExpression */) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) ? factory2.createParenthesizedExpression(operand) : operand; @@ -19559,7 +19636,7 @@ ${lanes.join("\n")} return isCommaSequence(expression) ? factory2.createParenthesizedExpression(expression) : expression; } function parenthesizeConditionOfConditionalExpression(condition) { - const conditionalPrecedence = getOperatorPrecedence(226 /* ConditionalExpression */, 58 /* QuestionToken */); + const conditionalPrecedence = getOperatorPrecedence(227 /* ConditionalExpression */, 58 /* QuestionToken */); const emittedCondition = skipPartiallyEmittedExpressions(condition); const conditionPrecedence = getExpressionPrecedence(emittedCondition); if (compareValues(conditionPrecedence, conditionalPrecedence) !== 1 /* GreaterThan */) { @@ -19580,8 +19657,8 @@ ${lanes.join("\n")} /*stopAtCallExpressions*/ false ).kind) { - case 230 /* ClassExpression */: - case 217 /* FunctionExpression */: + case 231 /* ClassExpression */: + case 218 /* FunctionExpression */: needsParens = true; } } @@ -19594,16 +19671,16 @@ ${lanes.join("\n")} true ); switch (leftmostExpr.kind) { - case 212 /* CallExpression */: + case 213 /* CallExpression */: return factory2.createParenthesizedExpression(expression); - case 213 /* NewExpression */: + case 214 /* NewExpression */: return !leftmostExpr.arguments ? factory2.createParenthesizedExpression(expression) : expression; } return parenthesizeLeftSideOfAccess(expression); } function parenthesizeLeftSideOfAccess(expression, optionalChain) { const emittedExpression = skipPartiallyEmittedExpressions(expression); - if (isLeftHandSideExpression(emittedExpression) && (emittedExpression.kind !== 213 /* NewExpression */ || emittedExpression.arguments) && (optionalChain || !isOptionalChain(emittedExpression))) { + if (isLeftHandSideExpression(emittedExpression) && (emittedExpression.kind !== 214 /* NewExpression */ || emittedExpression.arguments) && (optionalChain || !isOptionalChain(emittedExpression))) { return expression; } return setTextRange(factory2.createParenthesizedExpression(expression), expression); @@ -19621,7 +19698,7 @@ ${lanes.join("\n")} function parenthesizeExpressionForDisallowedComma(expression) { const emittedExpression = skipPartiallyEmittedExpressions(expression); const expressionPrecedence = getExpressionPrecedence(emittedExpression); - const commaPrecedence = getOperatorPrecedence(225 /* BinaryExpression */, 28 /* CommaToken */); + const commaPrecedence = getOperatorPrecedence(226 /* BinaryExpression */, 28 /* CommaToken */); return expressionPrecedence > commaPrecedence ? expression : setTextRange(factory2.createParenthesizedExpression(expression), expression); } function parenthesizeExpressionOfExpressionStatement(expression) { @@ -19629,7 +19706,7 @@ ${lanes.join("\n")} if (isCallExpression(emittedExpression)) { const callee = emittedExpression.expression; const kind = skipPartiallyEmittedExpressions(callee).kind; - if (kind === 217 /* FunctionExpression */ || kind === 218 /* ArrowFunction */) { + if (kind === 218 /* FunctionExpression */ || kind === 219 /* ArrowFunction */) { const updated = factory2.updateCallExpression( emittedExpression, setTextRange(factory2.createParenthesizedExpression(callee), callee), @@ -19644,7 +19721,7 @@ ${lanes.join("\n")} /*stopAtCallExpressions*/ false ).kind; - if (leftmostExpressionKind === 209 /* ObjectLiteralExpression */ || leftmostExpressionKind === 217 /* FunctionExpression */) { + if (leftmostExpressionKind === 210 /* ObjectLiteralExpression */ || leftmostExpressionKind === 218 /* FunctionExpression */) { return setTextRange(factory2.createParenthesizedExpression(expression), expression); } return expression; @@ -19654,31 +19731,31 @@ ${lanes.join("\n")} body, /*stopAtCallExpressions*/ false - ).kind === 209 /* ObjectLiteralExpression */)) { + ).kind === 210 /* ObjectLiteralExpression */)) { return setTextRange(factory2.createParenthesizedExpression(body), body); } return body; } function parenthesizeCheckTypeOfConditionalType(checkType) { switch (checkType.kind) { - case 183 /* FunctionType */: - case 184 /* ConstructorType */: - case 193 /* ConditionalType */: + case 184 /* FunctionType */: + case 185 /* ConstructorType */: + case 194 /* ConditionalType */: return factory2.createParenthesizedType(checkType); } return checkType; } function parenthesizeExtendsTypeOfConditionalType(extendsType) { switch (extendsType.kind) { - case 193 /* ConditionalType */: + case 194 /* ConditionalType */: return factory2.createParenthesizedType(extendsType); } return extendsType; } function parenthesizeConstituentTypeOfUnionType(type) { switch (type.kind) { - case 191 /* UnionType */: - case 192 /* IntersectionType */: + case 192 /* UnionType */: + case 193 /* IntersectionType */: return factory2.createParenthesizedType(type); } return parenthesizeCheckTypeOfConditionalType(type); @@ -19688,8 +19765,8 @@ ${lanes.join("\n")} } function parenthesizeConstituentTypeOfIntersectionType(type) { switch (type.kind) { - case 191 /* UnionType */: - case 192 /* IntersectionType */: + case 192 /* UnionType */: + case 193 /* IntersectionType */: return factory2.createParenthesizedType(type); } return parenthesizeConstituentTypeOfUnionType(type); @@ -19699,23 +19776,23 @@ ${lanes.join("\n")} } function parenthesizeOperandOfTypeOperator(type) { switch (type.kind) { - case 192 /* IntersectionType */: + case 193 /* IntersectionType */: return factory2.createParenthesizedType(type); } return parenthesizeConstituentTypeOfIntersectionType(type); } function parenthesizeOperandOfReadonlyTypeOperator(type) { switch (type.kind) { - case 197 /* TypeOperator */: + case 198 /* TypeOperator */: return factory2.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); } function parenthesizeNonArrayTypeOfPostfixType(type) { switch (type.kind) { - case 194 /* InferType */: - case 197 /* TypeOperator */: - case 185 /* TypeQuery */: + case 195 /* InferType */: + case 198 /* TypeOperator */: + case 186 /* TypeQuery */: return factory2.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); @@ -19807,6 +19884,7 @@ ${lanes.join("\n")} return { convertToFunctionBlock, convertToFunctionExpression, + convertToClassExpression, convertToArrayAssignmentElement, convertToObjectAssignmentElement, convertToAssignmentPattern, @@ -19824,10 +19902,11 @@ ${lanes.join("\n")} return body; } function convertToFunctionExpression(node) { + var _a; if (!node.body) return Debug.fail(`Cannot convert a FunctionDeclaration without a body`); const updated = factory2.createFunctionExpression( - getModifiers(node), + (_a = getModifiers(node)) == null ? void 0 : _a.filter((modifier) => !isExportModifier(modifier) && !isDefaultModifier(modifier)), node.asteriskToken, node.name, node.typeParameters, @@ -19846,6 +19925,26 @@ ${lanes.join("\n")} } return updated; } + function convertToClassExpression(node) { + var _a; + const updated = factory2.createClassExpression( + (_a = node.modifiers) == null ? void 0 : _a.filter((modifier) => !isExportModifier(modifier) && !isDefaultModifier(modifier)), + node.name, + node.typeParameters, + node.heritageClauses, + node.members + ); + setOriginalNode(updated, node); + setTextRange(updated, node); + if (getStartsOnNewLine(node)) { + setStartsOnNewLine( + updated, + /*newLine*/ + true + ); + } + return updated; + } function convertToArrayAssignmentElement(element) { if (isBindingElement(element)) { if (element.dotDotDotToken) { @@ -19880,11 +19979,11 @@ ${lanes.join("\n")} } function convertToAssignmentPattern(node) { switch (node.kind) { - case 206 /* ArrayBindingPattern */: - case 208 /* ArrayLiteralExpression */: + case 207 /* ArrayBindingPattern */: + case 209 /* ArrayLiteralExpression */: return convertToArrayAssignmentPattern(node); - case 205 /* ObjectBindingPattern */: - case 209 /* ObjectLiteralExpression */: + case 206 /* ObjectBindingPattern */: + case 210 /* ObjectLiteralExpression */: return convertToObjectAssignmentPattern(node); } } @@ -19927,6 +20026,7 @@ ${lanes.join("\n")} nullNodeConverters = { convertToFunctionBlock: notImplemented, convertToFunctionExpression: notImplemented, + convertToClassExpression: notImplemented, convertToArrayAssignmentElement: notImplemented, convertToObjectAssignmentElement: notImplemented, convertToAssignmentPattern: notImplemented, @@ -20239,40 +20339,40 @@ ${lanes.join("\n")} updateExternalModuleReference, // lazily load factory members for JSDoc types with similar structure get createJSDocAllType() { - return getJSDocPrimaryTypeCreateFunction(318 /* JSDocAllType */); + return getJSDocPrimaryTypeCreateFunction(319 /* JSDocAllType */); }, get createJSDocUnknownType() { - return getJSDocPrimaryTypeCreateFunction(319 /* JSDocUnknownType */); + return getJSDocPrimaryTypeCreateFunction(320 /* JSDocUnknownType */); }, get createJSDocNonNullableType() { - return getJSDocPrePostfixUnaryTypeCreateFunction(321 /* JSDocNonNullableType */); + return getJSDocPrePostfixUnaryTypeCreateFunction(322 /* JSDocNonNullableType */); }, get updateJSDocNonNullableType() { - return getJSDocPrePostfixUnaryTypeUpdateFunction(321 /* JSDocNonNullableType */); + return getJSDocPrePostfixUnaryTypeUpdateFunction(322 /* JSDocNonNullableType */); }, get createJSDocNullableType() { - return getJSDocPrePostfixUnaryTypeCreateFunction(320 /* JSDocNullableType */); + return getJSDocPrePostfixUnaryTypeCreateFunction(321 /* JSDocNullableType */); }, get updateJSDocNullableType() { - return getJSDocPrePostfixUnaryTypeUpdateFunction(320 /* JSDocNullableType */); + return getJSDocPrePostfixUnaryTypeUpdateFunction(321 /* JSDocNullableType */); }, get createJSDocOptionalType() { - return getJSDocUnaryTypeCreateFunction(322 /* JSDocOptionalType */); + return getJSDocUnaryTypeCreateFunction(323 /* JSDocOptionalType */); }, get updateJSDocOptionalType() { - return getJSDocUnaryTypeUpdateFunction(322 /* JSDocOptionalType */); + return getJSDocUnaryTypeUpdateFunction(323 /* JSDocOptionalType */); }, get createJSDocVariadicType() { - return getJSDocUnaryTypeCreateFunction(324 /* JSDocVariadicType */); + return getJSDocUnaryTypeCreateFunction(325 /* JSDocVariadicType */); }, get updateJSDocVariadicType() { - return getJSDocUnaryTypeUpdateFunction(324 /* JSDocVariadicType */); + return getJSDocUnaryTypeUpdateFunction(325 /* JSDocVariadicType */); }, get createJSDocNamepathType() { - return getJSDocUnaryTypeCreateFunction(325 /* JSDocNamepathType */); + return getJSDocUnaryTypeCreateFunction(326 /* JSDocNamepathType */); }, get updateJSDocNamepathType() { - return getJSDocUnaryTypeUpdateFunction(325 /* JSDocNamepathType */); + return getJSDocUnaryTypeUpdateFunction(326 /* JSDocNamepathType */); }, createJSDocFunctionType, updateJSDocFunctionType, @@ -20312,82 +20412,82 @@ ${lanes.join("\n")} updateJSDocLinkPlain, // lazily load factory members for JSDoc tags with similar structure get createJSDocTypeTag() { - return getJSDocTypeLikeTagCreateFunction(350 /* JSDocTypeTag */); + return getJSDocTypeLikeTagCreateFunction(351 /* JSDocTypeTag */); }, get updateJSDocTypeTag() { - return getJSDocTypeLikeTagUpdateFunction(350 /* JSDocTypeTag */); + return getJSDocTypeLikeTagUpdateFunction(351 /* JSDocTypeTag */); }, get createJSDocReturnTag() { - return getJSDocTypeLikeTagCreateFunction(348 /* JSDocReturnTag */); + return getJSDocTypeLikeTagCreateFunction(349 /* JSDocReturnTag */); }, get updateJSDocReturnTag() { - return getJSDocTypeLikeTagUpdateFunction(348 /* JSDocReturnTag */); + return getJSDocTypeLikeTagUpdateFunction(349 /* JSDocReturnTag */); }, get createJSDocThisTag() { - return getJSDocTypeLikeTagCreateFunction(349 /* JSDocThisTag */); + return getJSDocTypeLikeTagCreateFunction(350 /* JSDocThisTag */); }, get updateJSDocThisTag() { - return getJSDocTypeLikeTagUpdateFunction(349 /* JSDocThisTag */); + return getJSDocTypeLikeTagUpdateFunction(350 /* JSDocThisTag */); }, get createJSDocAuthorTag() { - return getJSDocSimpleTagCreateFunction(336 /* JSDocAuthorTag */); + return getJSDocSimpleTagCreateFunction(337 /* JSDocAuthorTag */); }, get updateJSDocAuthorTag() { - return getJSDocSimpleTagUpdateFunction(336 /* JSDocAuthorTag */); + return getJSDocSimpleTagUpdateFunction(337 /* JSDocAuthorTag */); }, get createJSDocClassTag() { - return getJSDocSimpleTagCreateFunction(338 /* JSDocClassTag */); + return getJSDocSimpleTagCreateFunction(339 /* JSDocClassTag */); }, get updateJSDocClassTag() { - return getJSDocSimpleTagUpdateFunction(338 /* JSDocClassTag */); + return getJSDocSimpleTagUpdateFunction(339 /* JSDocClassTag */); }, get createJSDocPublicTag() { - return getJSDocSimpleTagCreateFunction(339 /* JSDocPublicTag */); + return getJSDocSimpleTagCreateFunction(340 /* JSDocPublicTag */); }, get updateJSDocPublicTag() { - return getJSDocSimpleTagUpdateFunction(339 /* JSDocPublicTag */); + return getJSDocSimpleTagUpdateFunction(340 /* JSDocPublicTag */); }, get createJSDocPrivateTag() { - return getJSDocSimpleTagCreateFunction(340 /* JSDocPrivateTag */); + return getJSDocSimpleTagCreateFunction(341 /* JSDocPrivateTag */); }, get updateJSDocPrivateTag() { - return getJSDocSimpleTagUpdateFunction(340 /* JSDocPrivateTag */); + return getJSDocSimpleTagUpdateFunction(341 /* JSDocPrivateTag */); }, get createJSDocProtectedTag() { - return getJSDocSimpleTagCreateFunction(341 /* JSDocProtectedTag */); + return getJSDocSimpleTagCreateFunction(342 /* JSDocProtectedTag */); }, get updateJSDocProtectedTag() { - return getJSDocSimpleTagUpdateFunction(341 /* JSDocProtectedTag */); + return getJSDocSimpleTagUpdateFunction(342 /* JSDocProtectedTag */); }, get createJSDocReadonlyTag() { - return getJSDocSimpleTagCreateFunction(342 /* JSDocReadonlyTag */); + return getJSDocSimpleTagCreateFunction(343 /* JSDocReadonlyTag */); }, get updateJSDocReadonlyTag() { - return getJSDocSimpleTagUpdateFunction(342 /* JSDocReadonlyTag */); + return getJSDocSimpleTagUpdateFunction(343 /* JSDocReadonlyTag */); }, get createJSDocOverrideTag() { - return getJSDocSimpleTagCreateFunction(343 /* JSDocOverrideTag */); + return getJSDocSimpleTagCreateFunction(344 /* JSDocOverrideTag */); }, get updateJSDocOverrideTag() { - return getJSDocSimpleTagUpdateFunction(343 /* JSDocOverrideTag */); + return getJSDocSimpleTagUpdateFunction(344 /* JSDocOverrideTag */); }, get createJSDocDeprecatedTag() { - return getJSDocSimpleTagCreateFunction(337 /* JSDocDeprecatedTag */); + return getJSDocSimpleTagCreateFunction(338 /* JSDocDeprecatedTag */); }, get updateJSDocDeprecatedTag() { - return getJSDocSimpleTagUpdateFunction(337 /* JSDocDeprecatedTag */); + return getJSDocSimpleTagUpdateFunction(338 /* JSDocDeprecatedTag */); }, get createJSDocThrowsTag() { - return getJSDocTypeLikeTagCreateFunction(355 /* JSDocThrowsTag */); + return getJSDocTypeLikeTagCreateFunction(356 /* JSDocThrowsTag */); }, get updateJSDocThrowsTag() { - return getJSDocTypeLikeTagUpdateFunction(355 /* JSDocThrowsTag */); + return getJSDocTypeLikeTagUpdateFunction(356 /* JSDocThrowsTag */); }, get createJSDocSatisfiesTag() { - return getJSDocTypeLikeTagCreateFunction(356 /* JSDocSatisfiesTag */); + return getJSDocTypeLikeTagCreateFunction(357 /* JSDocSatisfiesTag */); }, get updateJSDocSatisfiesTag() { - return getJSDocTypeLikeTagUpdateFunction(356 /* JSDocSatisfiesTag */); + return getJSDocTypeLikeTagUpdateFunction(357 /* JSDocSatisfiesTag */); }, createJSDocEnumTag, updateJSDocEnumTag, @@ -20562,6 +20662,7 @@ ${lanes.join("\n")} createExportDefault, createExternalModuleExport, createTypeCheck, + createIsNotTypeCheck, createMethodCall, createGlobalMethodCall, createFunctionBindCall, @@ -20593,7 +20694,8 @@ ${lanes.join("\n")} ensureUseStrict, liftToBlock, mergeLexicalEnvironment, - updateModifiers + updateModifiers, + updateModifierLike }; forEach(nodeFactoryPatchers, (fn) => fn(factory2)); return factory2; @@ -20751,11 +20853,11 @@ ${lanes.join("\n")} } const node = createBaseIdentifier(escapeLeadingUnderscores(text)); if (hasExtendedUnicodeEscape) - node.flags |= 128 /* IdentifierHasExtendedUnicodeEscape */; + node.flags |= 256 /* IdentifierHasExtendedUnicodeEscape */; if (node.escapedText === "await") { node.transformFlags |= 67108864 /* ContainsPossibleTopLevelAwait */; } - if (node.flags & 128 /* IdentifierHasExtendedUnicodeEscape */) { + if (node.flags & 256 /* IdentifierHasExtendedUnicodeEscape */) { node.transformFlags |= 1024 /* ContainsES2015 */; } return node; @@ -20850,7 +20952,7 @@ ${lanes.join("\n")} return baseFactory2.createBaseTokenNode(kind); } function createToken(token) { - Debug.assert(token >= 0 /* FirstToken */ && token <= 164 /* LastToken */, "Invalid token"); + Debug.assert(token >= 0 /* FirstToken */ && token <= 165 /* LastToken */, "Invalid token"); Debug.assert(token <= 15 /* FirstTemplateToken */ || token >= 18 /* LastTemplateToken */, "Invalid token. Use 'createTemplateLiteralLikeNode' to create template literals."); Debug.assert(token <= 9 /* FirstLiteralToken */ || token >= 15 /* LastLiteralToken */, "Invalid token. Use 'createLiteralLikeNode' to create literals."); Debug.assert(token !== 80 /* Identifier */, "Invalid token. Use 'createIdentifier' to create identifiers"); @@ -20860,6 +20962,9 @@ ${lanes.join("\n")} case 134 /* AsyncKeyword */: transformFlags = 256 /* ContainsES2017 */ | 128 /* ContainsES2018 */; break; + case 160 /* UsingKeyword */: + transformFlags = 4 /* ContainsESNext */; + break; case 125 /* PublicKeyword */: case 123 /* PrivateKeyword */: case 124 /* ProtectedKeyword */: @@ -20869,12 +20974,12 @@ ${lanes.join("\n")} case 87 /* ConstKeyword */: case 133 /* AnyKeyword */: case 150 /* NumberKeyword */: - case 162 /* BigIntKeyword */: + case 163 /* BigIntKeyword */: case 146 /* NeverKeyword */: case 151 /* ObjectKeyword */: case 103 /* InKeyword */: case 147 /* OutKeyword */: - case 163 /* OverrideKeyword */: + case 164 /* OverrideKeyword */: case 154 /* StringKeyword */: case 136 /* BooleanKeyword */: case 155 /* SymbolKeyword */: @@ -20942,7 +21047,7 @@ ${lanes.join("\n")} if (flags2 & 32 /* Static */) result.push(createModifier(126 /* StaticKeyword */)); if (flags2 & 16384 /* Override */) - result.push(createModifier(163 /* OverrideKeyword */)); + result.push(createModifier(164 /* OverrideKeyword */)); if (flags2 & 64 /* Readonly */) result.push(createModifier(148 /* ReadonlyKeyword */)); if (flags2 & 128 /* Accessor */) @@ -20956,7 +21061,7 @@ ${lanes.join("\n")} return result.length ? result : void 0; } function createQualifiedName(left, right) { - const node = createBaseNode(165 /* QualifiedName */); + const node = createBaseNode(166 /* QualifiedName */); node.left = left; node.right = asName(right); node.transformFlags |= propagateChildFlags(node.left) | propagateIdentifierNameFlags(node.right); @@ -20967,7 +21072,7 @@ ${lanes.join("\n")} return node.left !== left || node.right !== right ? update(createQualifiedName(left, right), node) : node; } function createComputedPropertyName(expression) { - const node = createBaseNode(166 /* ComputedPropertyName */); + const node = createBaseNode(167 /* ComputedPropertyName */); node.expression = parenthesizerRules().parenthesizeExpressionOfComputedPropertyName(expression); node.transformFlags |= propagateChildFlags(node.expression) | 1024 /* ContainsES2015 */ | 131072 /* ContainsComputedPropertyName */; return node; @@ -20976,7 +21081,7 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createComputedPropertyName(expression), node) : node; } function createTypeParameterDeclaration(modifiers, name, constraint, defaultType) { - const node = createBaseDeclaration(167 /* TypeParameter */); + const node = createBaseDeclaration(168 /* TypeParameter */); node.modifiers = asNodeArray(modifiers); node.name = asName(name); node.constraint = constraint; @@ -20990,7 +21095,7 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.name !== name || node.constraint !== constraint || node.default !== defaultType ? update(createTypeParameterDeclaration(modifiers, name, constraint, defaultType), node) : node; } function createParameterDeclaration(modifiers, dotDotDotToken, name, questionToken, type, initializer) { - const node = createBaseDeclaration(168 /* Parameter */); + const node = createBaseDeclaration(169 /* Parameter */); node.modifiers = asNodeArray(modifiers); node.dotDotDotToken = dotDotDotToken; node.name = asName(name); @@ -21009,7 +21114,7 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.questionToken !== questionToken || node.type !== type || node.initializer !== initializer ? update(createParameterDeclaration(modifiers, dotDotDotToken, name, questionToken, type, initializer), node) : node; } function createDecorator(expression) { - const node = createBaseNode(169 /* Decorator */); + const node = createBaseNode(170 /* Decorator */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess( expression, /*optionalChain*/ @@ -21022,7 +21127,7 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createDecorator(expression), node) : node; } function createPropertySignature(modifiers, name, questionToken, type) { - const node = createBaseDeclaration(170 /* PropertySignature */); + const node = createBaseDeclaration(171 /* PropertySignature */); node.modifiers = asNodeArray(modifiers); node.name = asName(name); node.type = type; @@ -21042,14 +21147,14 @@ ${lanes.join("\n")} return update(updated, original); } function createPropertyDeclaration(modifiers, name, questionOrExclamationToken, type, initializer) { - const node = createBaseDeclaration(171 /* PropertyDeclaration */); + const node = createBaseDeclaration(172 /* PropertyDeclaration */); node.modifiers = asNodeArray(modifiers); node.name = asName(name); node.questionToken = questionOrExclamationToken && isQuestionToken(questionOrExclamationToken) ? questionOrExclamationToken : void 0; node.exclamationToken = questionOrExclamationToken && isExclamationToken(questionOrExclamationToken) ? questionOrExclamationToken : void 0; node.type = type; node.initializer = asInitializer(initializer); - const isAmbient = node.flags & 16777216 /* Ambient */ || modifiersToFlags(node.modifiers) & 2 /* Ambient */; + const isAmbient = node.flags & 33554432 /* Ambient */ || modifiersToFlags(node.modifiers) & 2 /* Ambient */; node.transformFlags = propagateChildrenFlags(node.modifiers) | propagateNameFlags(node.name) | propagateChildFlags(node.initializer) | (isAmbient || node.questionToken || node.exclamationToken || node.type ? 1 /* ContainsTypeScript */ : 0 /* None */) | (isComputedPropertyName(node.name) || modifiersToFlags(node.modifiers) & 32 /* Static */ && node.initializer ? 8192 /* ContainsTypeScriptClassSyntax */ : 0 /* None */) | 16777216 /* ContainsClassFields */; node.jsDoc = void 0; return node; @@ -21058,7 +21163,7 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.name !== name || node.questionToken !== (questionOrExclamationToken !== void 0 && isQuestionToken(questionOrExclamationToken) ? questionOrExclamationToken : void 0) || node.exclamationToken !== (questionOrExclamationToken !== void 0 && isExclamationToken(questionOrExclamationToken) ? questionOrExclamationToken : void 0) || node.type !== type || node.initializer !== initializer ? update(createPropertyDeclaration(modifiers, name, questionOrExclamationToken, type, initializer), node) : node; } function createMethodSignature(modifiers, name, questionToken, typeParameters, parameters, type) { - const node = createBaseDeclaration(172 /* MethodSignature */); + const node = createBaseDeclaration(173 /* MethodSignature */); node.modifiers = asNodeArray(modifiers); node.name = asName(name); node.questionToken = questionToken; @@ -21076,7 +21181,7 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.name !== name || node.questionToken !== questionToken || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type ? finishUpdateBaseSignatureDeclaration(createMethodSignature(modifiers, name, questionToken, typeParameters, parameters, type), node) : node; } function createMethodDeclaration(modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { - const node = createBaseDeclaration(173 /* MethodDeclaration */); + const node = createBaseDeclaration(174 /* MethodDeclaration */); node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; node.name = asName(name); @@ -21113,7 +21218,7 @@ ${lanes.join("\n")} return update(updated, original); } function createClassStaticBlockDeclaration(body) { - const node = createBaseDeclaration(174 /* ClassStaticBlockDeclaration */); + const node = createBaseDeclaration(175 /* ClassStaticBlockDeclaration */); node.body = body; node.transformFlags = propagateChildFlags(body) | 16777216 /* ContainsClassFields */; node.modifiers = void 0; @@ -21134,7 +21239,7 @@ ${lanes.join("\n")} return update(updated, original); } function createConstructorDeclaration(modifiers, parameters, body) { - const node = createBaseDeclaration(175 /* Constructor */); + const node = createBaseDeclaration(176 /* Constructor */); node.modifiers = asNodeArray(modifiers); node.parameters = createNodeArray(parameters); node.body = body; @@ -21160,7 +21265,7 @@ ${lanes.join("\n")} return finishUpdateBaseSignatureDeclaration(updated, original); } function createGetAccessorDeclaration(modifiers, name, parameters, type, body) { - const node = createBaseDeclaration(176 /* GetAccessor */); + const node = createBaseDeclaration(177 /* GetAccessor */); node.modifiers = asNodeArray(modifiers); node.name = asName(name); node.parameters = createNodeArray(parameters); @@ -21191,7 +21296,7 @@ ${lanes.join("\n")} return finishUpdateBaseSignatureDeclaration(updated, original); } function createSetAccessorDeclaration(modifiers, name, parameters, body) { - const node = createBaseDeclaration(177 /* SetAccessor */); + const node = createBaseDeclaration(178 /* SetAccessor */); node.modifiers = asNodeArray(modifiers); node.name = asName(name); node.parameters = createNodeArray(parameters); @@ -21223,7 +21328,7 @@ ${lanes.join("\n")} return finishUpdateBaseSignatureDeclaration(updated, original); } function createCallSignature(typeParameters, parameters, type) { - const node = createBaseDeclaration(178 /* CallSignature */); + const node = createBaseDeclaration(179 /* CallSignature */); node.typeParameters = asNodeArray(typeParameters); node.parameters = asNodeArray(parameters); node.type = type; @@ -21238,7 +21343,7 @@ ${lanes.join("\n")} return node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type ? finishUpdateBaseSignatureDeclaration(createCallSignature(typeParameters, parameters, type), node) : node; } function createConstructSignature(typeParameters, parameters, type) { - const node = createBaseDeclaration(179 /* ConstructSignature */); + const node = createBaseDeclaration(180 /* ConstructSignature */); node.typeParameters = asNodeArray(typeParameters); node.parameters = asNodeArray(parameters); node.type = type; @@ -21253,7 +21358,7 @@ ${lanes.join("\n")} return node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type ? finishUpdateBaseSignatureDeclaration(createConstructSignature(typeParameters, parameters, type), node) : node; } function createIndexSignature(modifiers, parameters, type) { - const node = createBaseDeclaration(180 /* IndexSignature */); + const node = createBaseDeclaration(181 /* IndexSignature */); node.modifiers = asNodeArray(modifiers); node.parameters = asNodeArray(parameters); node.type = type; @@ -21268,7 +21373,7 @@ ${lanes.join("\n")} return node.parameters !== parameters || node.type !== type || node.modifiers !== modifiers ? finishUpdateBaseSignatureDeclaration(createIndexSignature(modifiers, parameters, type), node) : node; } function createTemplateLiteralTypeSpan(type, literal) { - const node = createBaseNode(203 /* TemplateLiteralTypeSpan */); + const node = createBaseNode(204 /* TemplateLiteralTypeSpan */); node.type = type; node.literal = literal; node.transformFlags = 1 /* ContainsTypeScript */; @@ -21281,7 +21386,7 @@ ${lanes.join("\n")} return createToken(kind); } function createTypePredicateNode(assertsModifier, parameterName, type) { - const node = createBaseNode(181 /* TypePredicate */); + const node = createBaseNode(182 /* TypePredicate */); node.assertsModifier = assertsModifier; node.parameterName = asName(parameterName); node.type = type; @@ -21292,7 +21397,7 @@ ${lanes.join("\n")} return node.assertsModifier !== assertsModifier || node.parameterName !== parameterName || node.type !== type ? update(createTypePredicateNode(assertsModifier, parameterName, type), node) : node; } function createTypeReferenceNode(typeName, typeArguments) { - const node = createBaseNode(182 /* TypeReference */); + const node = createBaseNode(183 /* TypeReference */); node.typeName = asName(typeName); node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(createNodeArray(typeArguments)); node.transformFlags = 1 /* ContainsTypeScript */; @@ -21302,7 +21407,7 @@ ${lanes.join("\n")} return node.typeName !== typeName || node.typeArguments !== typeArguments ? update(createTypeReferenceNode(typeName, typeArguments), node) : node; } function createFunctionTypeNode(typeParameters, parameters, type) { - const node = createBaseDeclaration(183 /* FunctionType */); + const node = createBaseDeclaration(184 /* FunctionType */); node.typeParameters = asNodeArray(typeParameters); node.parameters = asNodeArray(parameters); node.type = type; @@ -21327,7 +21432,7 @@ ${lanes.join("\n")} return args.length === 4 ? createConstructorTypeNode1(...args) : args.length === 3 ? createConstructorTypeNode2(...args) : Debug.fail("Incorrect number of arguments specified."); } function createConstructorTypeNode1(modifiers, typeParameters, parameters, type) { - const node = createBaseDeclaration(184 /* ConstructorType */); + const node = createBaseDeclaration(185 /* ConstructorType */); node.modifiers = asNodeArray(modifiers); node.typeParameters = asNodeArray(typeParameters); node.parameters = asNodeArray(parameters); @@ -21358,7 +21463,7 @@ ${lanes.join("\n")} return updateConstructorTypeNode1(node, node.modifiers, typeParameters, parameters, type); } function createTypeQueryNode(exprName, typeArguments) { - const node = createBaseNode(185 /* TypeQuery */); + const node = createBaseNode(186 /* TypeQuery */); node.exprName = exprName; node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags = 1 /* ContainsTypeScript */; @@ -21368,7 +21473,7 @@ ${lanes.join("\n")} return node.exprName !== exprName || node.typeArguments !== typeArguments ? update(createTypeQueryNode(exprName, typeArguments), node) : node; } function createTypeLiteralNode(members) { - const node = createBaseDeclaration(186 /* TypeLiteral */); + const node = createBaseDeclaration(187 /* TypeLiteral */); node.members = createNodeArray(members); node.transformFlags = 1 /* ContainsTypeScript */; return node; @@ -21377,7 +21482,7 @@ ${lanes.join("\n")} return node.members !== members ? update(createTypeLiteralNode(members), node) : node; } function createArrayTypeNode(elementType) { - const node = createBaseNode(187 /* ArrayType */); + const node = createBaseNode(188 /* ArrayType */); node.elementType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(elementType); node.transformFlags = 1 /* ContainsTypeScript */; return node; @@ -21386,7 +21491,7 @@ ${lanes.join("\n")} return node.elementType !== elementType ? update(createArrayTypeNode(elementType), node) : node; } function createTupleTypeNode(elements) { - const node = createBaseNode(188 /* TupleType */); + const node = createBaseNode(189 /* TupleType */); node.elements = createNodeArray(parenthesizerRules().parenthesizeElementTypesOfTupleType(elements)); node.transformFlags = 1 /* ContainsTypeScript */; return node; @@ -21395,7 +21500,7 @@ ${lanes.join("\n")} return node.elements !== elements ? update(createTupleTypeNode(elements), node) : node; } function createNamedTupleMember(dotDotDotToken, name, questionToken, type) { - const node = createBaseDeclaration(201 /* NamedTupleMember */); + const node = createBaseDeclaration(202 /* NamedTupleMember */); node.dotDotDotToken = dotDotDotToken; node.name = name; node.questionToken = questionToken; @@ -21408,7 +21513,7 @@ ${lanes.join("\n")} return node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.questionToken !== questionToken || node.type !== type ? update(createNamedTupleMember(dotDotDotToken, name, questionToken, type), node) : node; } function createOptionalTypeNode(type) { - const node = createBaseNode(189 /* OptionalType */); + const node = createBaseNode(190 /* OptionalType */); node.type = parenthesizerRules().parenthesizeTypeOfOptionalType(type); node.transformFlags = 1 /* ContainsTypeScript */; return node; @@ -21417,7 +21522,7 @@ ${lanes.join("\n")} return node.type !== type ? update(createOptionalTypeNode(type), node) : node; } function createRestTypeNode(type) { - const node = createBaseNode(190 /* RestType */); + const node = createBaseNode(191 /* RestType */); node.type = type; node.transformFlags = 1 /* ContainsTypeScript */; return node; @@ -21435,19 +21540,19 @@ ${lanes.join("\n")} return node.types !== types ? update(createUnionOrIntersectionTypeNode(node.kind, types, parenthesize), node) : node; } function createUnionTypeNode(types) { - return createUnionOrIntersectionTypeNode(191 /* UnionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); + return createUnionOrIntersectionTypeNode(192 /* UnionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); } function updateUnionTypeNode(node, types) { return updateUnionOrIntersectionTypeNode(node, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); } function createIntersectionTypeNode(types) { - return createUnionOrIntersectionTypeNode(192 /* IntersectionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); + return createUnionOrIntersectionTypeNode(193 /* IntersectionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); } function updateIntersectionTypeNode(node, types) { return updateUnionOrIntersectionTypeNode(node, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); } function createConditionalTypeNode(checkType, extendsType, trueType, falseType) { - const node = createBaseNode(193 /* ConditionalType */); + const node = createBaseNode(194 /* ConditionalType */); node.checkType = parenthesizerRules().parenthesizeCheckTypeOfConditionalType(checkType); node.extendsType = parenthesizerRules().parenthesizeExtendsTypeOfConditionalType(extendsType); node.trueType = trueType; @@ -21461,7 +21566,7 @@ ${lanes.join("\n")} return node.checkType !== checkType || node.extendsType !== extendsType || node.trueType !== trueType || node.falseType !== falseType ? update(createConditionalTypeNode(checkType, extendsType, trueType, falseType), node) : node; } function createInferTypeNode(typeParameter) { - const node = createBaseNode(194 /* InferType */); + const node = createBaseNode(195 /* InferType */); node.typeParameter = typeParameter; node.transformFlags = 1 /* ContainsTypeScript */; return node; @@ -21470,7 +21575,7 @@ ${lanes.join("\n")} return node.typeParameter !== typeParameter ? update(createInferTypeNode(typeParameter), node) : node; } function createTemplateLiteralType(head, templateSpans) { - const node = createBaseNode(202 /* TemplateLiteralType */); + const node = createBaseNode(203 /* TemplateLiteralType */); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags = 1 /* ContainsTypeScript */; @@ -21480,7 +21585,7 @@ ${lanes.join("\n")} return node.head !== head || node.templateSpans !== templateSpans ? update(createTemplateLiteralType(head, templateSpans), node) : node; } function createImportTypeNode(argument, assertions, qualifier, typeArguments, isTypeOf = false) { - const node = createBaseNode(204 /* ImportType */); + const node = createBaseNode(205 /* ImportType */); node.argument = argument; node.assertions = assertions; node.qualifier = qualifier; @@ -21493,7 +21598,7 @@ ${lanes.join("\n")} return node.argument !== argument || node.assertions !== assertions || node.qualifier !== qualifier || node.typeArguments !== typeArguments || node.isTypeOf !== isTypeOf ? update(createImportTypeNode(argument, assertions, qualifier, typeArguments, isTypeOf), node) : node; } function createParenthesizedType(type) { - const node = createBaseNode(195 /* ParenthesizedType */); + const node = createBaseNode(196 /* ParenthesizedType */); node.type = type; node.transformFlags = 1 /* ContainsTypeScript */; return node; @@ -21502,12 +21607,12 @@ ${lanes.join("\n")} return node.type !== type ? update(createParenthesizedType(type), node) : node; } function createThisTypeNode() { - const node = createBaseNode(196 /* ThisType */); + const node = createBaseNode(197 /* ThisType */); node.transformFlags = 1 /* ContainsTypeScript */; return node; } function createTypeOperatorNode(operator, type) { - const node = createBaseNode(197 /* TypeOperator */); + const node = createBaseNode(198 /* TypeOperator */); node.operator = operator; node.type = operator === 148 /* ReadonlyKeyword */ ? parenthesizerRules().parenthesizeOperandOfReadonlyTypeOperator(type) : parenthesizerRules().parenthesizeOperandOfTypeOperator(type); node.transformFlags = 1 /* ContainsTypeScript */; @@ -21517,7 +21622,7 @@ ${lanes.join("\n")} return node.type !== type ? update(createTypeOperatorNode(node.operator, type), node) : node; } function createIndexedAccessTypeNode(objectType, indexType) { - const node = createBaseNode(198 /* IndexedAccessType */); + const node = createBaseNode(199 /* IndexedAccessType */); node.objectType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(objectType); node.indexType = indexType; node.transformFlags = 1 /* ContainsTypeScript */; @@ -21527,7 +21632,7 @@ ${lanes.join("\n")} return node.objectType !== objectType || node.indexType !== indexType ? update(createIndexedAccessTypeNode(objectType, indexType), node) : node; } function createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members) { - const node = createBaseDeclaration(199 /* MappedType */); + const node = createBaseDeclaration(200 /* MappedType */); node.readonlyToken = readonlyToken; node.typeParameter = typeParameter; node.nameType = nameType; @@ -21543,7 +21648,7 @@ ${lanes.join("\n")} return node.readonlyToken !== readonlyToken || node.typeParameter !== typeParameter || node.nameType !== nameType || node.questionToken !== questionToken || node.type !== type || node.members !== members ? update(createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members), node) : node; } function createLiteralTypeNode(literal) { - const node = createBaseNode(200 /* LiteralType */); + const node = createBaseNode(201 /* LiteralType */); node.literal = literal; node.transformFlags = 1 /* ContainsTypeScript */; return node; @@ -21552,7 +21657,7 @@ ${lanes.join("\n")} return node.literal !== literal ? update(createLiteralTypeNode(literal), node) : node; } function createObjectBindingPattern(elements) { - const node = createBaseNode(205 /* ObjectBindingPattern */); + const node = createBaseNode(206 /* ObjectBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | 1024 /* ContainsES2015 */ | 524288 /* ContainsBindingPattern */; if (node.transformFlags & 32768 /* ContainsRestOrSpread */) { @@ -21564,7 +21669,7 @@ ${lanes.join("\n")} return node.elements !== elements ? update(createObjectBindingPattern(elements), node) : node; } function createArrayBindingPattern(elements) { - const node = createBaseNode(206 /* ArrayBindingPattern */); + const node = createBaseNode(207 /* ArrayBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | 1024 /* ContainsES2015 */ | 524288 /* ContainsBindingPattern */; return node; @@ -21573,7 +21678,7 @@ ${lanes.join("\n")} return node.elements !== elements ? update(createArrayBindingPattern(elements), node) : node; } function createBindingElement(dotDotDotToken, propertyName, name, initializer) { - const node = createBaseDeclaration(207 /* BindingElement */); + const node = createBaseDeclaration(208 /* BindingElement */); node.dotDotDotToken = dotDotDotToken; node.propertyName = asName(propertyName); node.name = asName(name); @@ -21586,7 +21691,7 @@ ${lanes.join("\n")} return node.propertyName !== propertyName || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.initializer !== initializer ? update(createBindingElement(dotDotDotToken, propertyName, name, initializer), node) : node; } function createArrayLiteralExpression(elements, multiLine) { - const node = createBaseNode(208 /* ArrayLiteralExpression */); + const node = createBaseNode(209 /* ArrayLiteralExpression */); const lastElement = elements && lastOrUndefined(elements); const elementsArray = createNodeArray(elements, lastElement && isOmittedExpression(lastElement) ? true : void 0); node.elements = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(elementsArray); @@ -21598,7 +21703,7 @@ ${lanes.join("\n")} return node.elements !== elements ? update(createArrayLiteralExpression(elements, node.multiLine), node) : node; } function createObjectLiteralExpression(properties, multiLine) { - const node = createBaseDeclaration(209 /* ObjectLiteralExpression */); + const node = createBaseDeclaration(210 /* ObjectLiteralExpression */); node.properties = createNodeArray(properties); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.properties); @@ -21609,7 +21714,7 @@ ${lanes.join("\n")} return node.properties !== properties ? update(createObjectLiteralExpression(properties, node.multiLine), node) : node; } function createBasePropertyAccessExpression(expression, questionDotToken, name) { - const node = createBaseDeclaration(210 /* PropertyAccessExpression */); + const node = createBaseDeclaration(211 /* PropertyAccessExpression */); node.expression = expression; node.questionDotToken = questionDotToken; node.name = name; @@ -21650,16 +21755,16 @@ ${lanes.join("\n")} questionDotToken, asName(name) ); - node.flags |= 32 /* OptionalChain */; + node.flags |= 64 /* OptionalChain */; node.transformFlags |= 32 /* ContainsES2020 */; return node; } function updatePropertyAccessChain(node, expression, questionDotToken, name) { - Debug.assert(!!(node.flags & 32 /* OptionalChain */), "Cannot update a PropertyAccessExpression using updatePropertyAccessChain. Use updatePropertyAccess instead."); + Debug.assert(!!(node.flags & 64 /* OptionalChain */), "Cannot update a PropertyAccessExpression using updatePropertyAccessChain. Use updatePropertyAccess instead."); return node.expression !== expression || node.questionDotToken !== questionDotToken || node.name !== name ? update(createPropertyAccessChain(expression, questionDotToken, name), node) : node; } function createBaseElementAccessExpression(expression, questionDotToken, argumentExpression) { - const node = createBaseDeclaration(211 /* ElementAccessExpression */); + const node = createBaseDeclaration(212 /* ElementAccessExpression */); node.expression = expression; node.questionDotToken = questionDotToken; node.argumentExpression = argumentExpression; @@ -21700,16 +21805,16 @@ ${lanes.join("\n")} questionDotToken, asExpression(index) ); - node.flags |= 32 /* OptionalChain */; + node.flags |= 64 /* OptionalChain */; node.transformFlags |= 32 /* ContainsES2020 */; return node; } function updateElementAccessChain(node, expression, questionDotToken, argumentExpression) { - Debug.assert(!!(node.flags & 32 /* OptionalChain */), "Cannot update a ElementAccessExpression using updateElementAccessChain. Use updateElementAccess instead."); + Debug.assert(!!(node.flags & 64 /* OptionalChain */), "Cannot update a ElementAccessExpression using updateElementAccessChain. Use updateElementAccess instead."); return node.expression !== expression || node.questionDotToken !== questionDotToken || node.argumentExpression !== argumentExpression ? update(createElementAccessChain(expression, questionDotToken, argumentExpression), node) : node; } function createBaseCallExpression(expression, questionDotToken, typeArguments, argumentsArray) { - const node = createBaseDeclaration(212 /* CallExpression */); + const node = createBaseDeclaration(213 /* CallExpression */); node.expression = expression; node.questionDotToken = questionDotToken; node.typeArguments = typeArguments; @@ -21757,16 +21862,16 @@ ${lanes.join("\n")} asNodeArray(typeArguments), parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(createNodeArray(argumentsArray)) ); - node.flags |= 32 /* OptionalChain */; + node.flags |= 64 /* OptionalChain */; node.transformFlags |= 32 /* ContainsES2020 */; return node; } function updateCallChain(node, expression, questionDotToken, typeArguments, argumentsArray) { - Debug.assert(!!(node.flags & 32 /* OptionalChain */), "Cannot update a CallExpression using updateCallChain. Use updateCall instead."); + Debug.assert(!!(node.flags & 64 /* OptionalChain */), "Cannot update a CallExpression using updateCallChain. Use updateCall instead."); return node.expression !== expression || node.questionDotToken !== questionDotToken || node.typeArguments !== typeArguments || node.arguments !== argumentsArray ? update(createCallChain(expression, questionDotToken, typeArguments, argumentsArray), node) : node; } function createNewExpression(expression, typeArguments, argumentsArray) { - const node = createBaseDeclaration(213 /* NewExpression */); + const node = createBaseDeclaration(214 /* NewExpression */); node.expression = parenthesizerRules().parenthesizeExpressionOfNew(expression); node.typeArguments = asNodeArray(typeArguments); node.arguments = argumentsArray ? parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(argumentsArray) : void 0; @@ -21780,7 +21885,7 @@ ${lanes.join("\n")} return node.expression !== expression || node.typeArguments !== typeArguments || node.arguments !== argumentsArray ? update(createNewExpression(expression, typeArguments, argumentsArray), node) : node; } function createTaggedTemplateExpression(tag, typeArguments, template) { - const node = createBaseNode(214 /* TaggedTemplateExpression */); + const node = createBaseNode(215 /* TaggedTemplateExpression */); node.tag = parenthesizerRules().parenthesizeLeftSideOfAccess( tag, /*optionalChain*/ @@ -21801,7 +21906,7 @@ ${lanes.join("\n")} return node.tag !== tag || node.typeArguments !== typeArguments || node.template !== template ? update(createTaggedTemplateExpression(tag, typeArguments, template), node) : node; } function createTypeAssertion(type, expression) { - const node = createBaseNode(215 /* TypeAssertionExpression */); + const node = createBaseNode(216 /* TypeAssertionExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.type = type; node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.type) | 1 /* ContainsTypeScript */; @@ -21811,7 +21916,7 @@ ${lanes.join("\n")} return node.type !== type || node.expression !== expression ? update(createTypeAssertion(type, expression), node) : node; } function createParenthesizedExpression(expression) { - const node = createBaseNode(216 /* ParenthesizedExpression */); + const node = createBaseNode(217 /* ParenthesizedExpression */); node.expression = expression; node.transformFlags = propagateChildFlags(node.expression); node.jsDoc = void 0; @@ -21821,7 +21926,7 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createParenthesizedExpression(expression), node) : node; } function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - const node = createBaseDeclaration(217 /* FunctionExpression */); + const node = createBaseDeclaration(218 /* FunctionExpression */); node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; node.name = asName(name); @@ -21846,7 +21951,7 @@ ${lanes.join("\n")} return node.name !== name || node.modifiers !== modifiers || node.asteriskToken !== asteriskToken || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body ? finishUpdateBaseSignatureDeclaration(createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body), node) : node; } function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { - const node = createBaseDeclaration(218 /* ArrowFunction */); + const node = createBaseDeclaration(219 /* ArrowFunction */); node.modifiers = asNodeArray(modifiers); node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); @@ -21868,7 +21973,7 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.equalsGreaterThanToken !== equalsGreaterThanToken || node.body !== body ? finishUpdateBaseSignatureDeclaration(createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body), node) : node; } function createDeleteExpression(expression) { - const node = createBaseNode(219 /* DeleteExpression */); + const node = createBaseNode(220 /* DeleteExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -21877,7 +21982,7 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createDeleteExpression(expression), node) : node; } function createTypeOfExpression(expression) { - const node = createBaseNode(220 /* TypeOfExpression */); + const node = createBaseNode(221 /* TypeOfExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -21886,7 +21991,7 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createTypeOfExpression(expression), node) : node; } function createVoidExpression(expression) { - const node = createBaseNode(221 /* VoidExpression */); + const node = createBaseNode(222 /* VoidExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -21895,7 +22000,7 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createVoidExpression(expression), node) : node; } function createAwaitExpression(expression) { - const node = createBaseNode(222 /* AwaitExpression */); + const node = createBaseNode(223 /* AwaitExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression) | 256 /* ContainsES2017 */ | 128 /* ContainsES2018 */ | 2097152 /* ContainsAwait */; return node; @@ -21904,7 +22009,7 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createAwaitExpression(expression), node) : node; } function createPrefixUnaryExpression(operator, operand) { - const node = createBaseNode(223 /* PrefixUnaryExpression */); + const node = createBaseNode(224 /* PrefixUnaryExpression */); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPrefixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); @@ -21917,7 +22022,7 @@ ${lanes.join("\n")} return node.operand !== operand ? update(createPrefixUnaryExpression(node.operator, operand), node) : node; } function createPostfixUnaryExpression(operand, operator) { - const node = createBaseNode(224 /* PostfixUnaryExpression */); + const node = createBaseNode(225 /* PostfixUnaryExpression */); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPostfixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); @@ -21930,7 +22035,7 @@ ${lanes.join("\n")} return node.operand !== operand ? update(createPostfixUnaryExpression(operand, node.operator), node) : node; } function createBinaryExpression(left, operator, right) { - const node = createBaseDeclaration(225 /* BinaryExpression */); + const node = createBaseDeclaration(226 /* BinaryExpression */); const operatorToken = asToken(operator); const operatorKind = operatorToken.kind; node.left = parenthesizerRules().parenthesizeLeftSideOfBinary(operatorKind, left); @@ -21963,7 +22068,7 @@ ${lanes.join("\n")} return node.left !== left || node.operatorToken !== operator || node.right !== right ? update(createBinaryExpression(left, operator, right), node) : node; } function createConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse) { - const node = createBaseNode(226 /* ConditionalExpression */); + const node = createBaseNode(227 /* ConditionalExpression */); node.condition = parenthesizerRules().parenthesizeConditionOfConditionalExpression(condition); node.questionToken = questionToken ?? createToken(58 /* QuestionToken */); node.whenTrue = parenthesizerRules().parenthesizeBranchOfConditionalExpression(whenTrue); @@ -21976,7 +22081,7 @@ ${lanes.join("\n")} return node.condition !== condition || node.questionToken !== questionToken || node.whenTrue !== whenTrue || node.colonToken !== colonToken || node.whenFalse !== whenFalse ? update(createConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse), node) : node; } function createTemplateExpression(head, templateSpans) { - const node = createBaseNode(227 /* TemplateExpression */); + const node = createBaseNode(228 /* TemplateExpression */); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags |= propagateChildFlags(node.head) | propagateChildrenFlags(node.templateSpans) | 1024 /* ContainsES2015 */; @@ -22051,7 +22156,7 @@ ${lanes.join("\n")} } function createYieldExpression(asteriskToken, expression) { Debug.assert(!asteriskToken || !!expression, "A `YieldExpression` with an asteriskToken must have an expression."); - const node = createBaseNode(228 /* YieldExpression */); + const node = createBaseNode(229 /* YieldExpression */); node.expression = expression && parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.asteriskToken = asteriskToken; node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.asteriskToken) | 1024 /* ContainsES2015 */ | 128 /* ContainsES2018 */ | 1048576 /* ContainsYield */; @@ -22061,7 +22166,7 @@ ${lanes.join("\n")} return node.expression !== expression || node.asteriskToken !== asteriskToken ? update(createYieldExpression(asteriskToken, expression), node) : node; } function createSpreadElement(expression) { - const node = createBaseNode(229 /* SpreadElement */); + const node = createBaseNode(230 /* SpreadElement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | 1024 /* ContainsES2015 */ | 32768 /* ContainsRestOrSpread */; return node; @@ -22070,7 +22175,7 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createSpreadElement(expression), node) : node; } function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { - const node = createBaseDeclaration(230 /* ClassExpression */); + const node = createBaseDeclaration(231 /* ClassExpression */); node.modifiers = asNodeArray(modifiers); node.name = asName(name); node.typeParameters = asNodeArray(typeParameters); @@ -22084,10 +22189,10 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members ? update(createClassExpression(modifiers, name, typeParameters, heritageClauses, members), node) : node; } function createOmittedExpression() { - return createBaseNode(231 /* OmittedExpression */); + return createBaseNode(232 /* OmittedExpression */); } function createExpressionWithTypeArguments(expression, typeArguments) { - const node = createBaseNode(232 /* ExpressionWithTypeArguments */); + const node = createBaseNode(233 /* ExpressionWithTypeArguments */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess( expression, /*optionalChain*/ @@ -22101,7 +22206,7 @@ ${lanes.join("\n")} return node.expression !== expression || node.typeArguments !== typeArguments ? update(createExpressionWithTypeArguments(expression, typeArguments), node) : node; } function createAsExpression(expression, type) { - const node = createBaseNode(233 /* AsExpression */); + const node = createBaseNode(234 /* AsExpression */); node.expression = expression; node.type = type; node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.type) | 1 /* ContainsTypeScript */; @@ -22111,7 +22216,7 @@ ${lanes.join("\n")} return node.expression !== expression || node.type !== type ? update(createAsExpression(expression, type), node) : node; } function createNonNullExpression(expression) { - const node = createBaseNode(234 /* NonNullExpression */); + const node = createBaseNode(235 /* NonNullExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess( expression, /*optionalChain*/ @@ -22127,7 +22232,7 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createNonNullExpression(expression), node) : node; } function createSatisfiesExpression(expression, type) { - const node = createBaseNode(237 /* SatisfiesExpression */); + const node = createBaseNode(238 /* SatisfiesExpression */); node.expression = expression; node.type = type; node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.type) | 1 /* ContainsTypeScript */; @@ -22137,8 +22242,8 @@ ${lanes.join("\n")} return node.expression !== expression || node.type !== type ? update(createSatisfiesExpression(expression, type), node) : node; } function createNonNullChain(expression) { - const node = createBaseNode(234 /* NonNullExpression */); - node.flags |= 32 /* OptionalChain */; + const node = createBaseNode(235 /* NonNullExpression */); + node.flags |= 64 /* OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess( expression, /*optionalChain*/ @@ -22148,11 +22253,11 @@ ${lanes.join("\n")} return node; } function updateNonNullChain(node, expression) { - Debug.assert(!!(node.flags & 32 /* OptionalChain */), "Cannot update a NonNullExpression using updateNonNullChain. Use updateNonNullExpression instead."); + Debug.assert(!!(node.flags & 64 /* OptionalChain */), "Cannot update a NonNullExpression using updateNonNullChain. Use updateNonNullExpression instead."); return node.expression !== expression ? update(createNonNullChain(expression), node) : node; } function createMetaProperty(keywordToken, name) { - const node = createBaseNode(235 /* MetaProperty */); + const node = createBaseNode(236 /* MetaProperty */); node.keywordToken = keywordToken; node.name = name; node.transformFlags |= propagateChildFlags(node.name); @@ -22173,7 +22278,7 @@ ${lanes.join("\n")} return node.name !== name ? update(createMetaProperty(node.keywordToken, name), node) : node; } function createTemplateSpan(expression, literal) { - const node = createBaseNode(238 /* TemplateSpan */); + const node = createBaseNode(239 /* TemplateSpan */); node.expression = expression; node.literal = literal; node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.literal) | 1024 /* ContainsES2015 */; @@ -22183,12 +22288,12 @@ ${lanes.join("\n")} return node.expression !== expression || node.literal !== literal ? update(createTemplateSpan(expression, literal), node) : node; } function createSemicolonClassElement() { - const node = createBaseNode(239 /* SemicolonClassElement */); + const node = createBaseNode(240 /* SemicolonClassElement */); node.transformFlags |= 1024 /* ContainsES2015 */; return node; } function createBlock(statements, multiLine) { - const node = createBaseNode(240 /* Block */); + const node = createBaseNode(241 /* Block */); node.statements = createNodeArray(statements); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.statements); @@ -22201,7 +22306,7 @@ ${lanes.join("\n")} return node.statements !== statements ? update(createBlock(statements, node.multiLine), node) : node; } function createVariableStatement(modifiers, declarationList) { - const node = createBaseNode(242 /* VariableStatement */); + const node = createBaseNode(243 /* VariableStatement */); node.modifiers = asNodeArray(modifiers); node.declarationList = isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; node.transformFlags |= propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.declarationList); @@ -22216,12 +22321,12 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.declarationList !== declarationList ? update(createVariableStatement(modifiers, declarationList), node) : node; } function createEmptyStatement() { - const node = createBaseNode(241 /* EmptyStatement */); + const node = createBaseNode(242 /* EmptyStatement */); node.jsDoc = void 0; return node; } function createExpressionStatement(expression) { - const node = createBaseNode(243 /* ExpressionStatement */); + const node = createBaseNode(244 /* ExpressionStatement */); node.expression = parenthesizerRules().parenthesizeExpressionOfExpressionStatement(expression); node.transformFlags |= propagateChildFlags(node.expression); node.jsDoc = void 0; @@ -22232,7 +22337,7 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createExpressionStatement(expression), node) : node; } function createIfStatement(expression, thenStatement, elseStatement) { - const node = createBaseNode(244 /* IfStatement */); + const node = createBaseNode(245 /* IfStatement */); node.expression = expression; node.thenStatement = asEmbeddedStatement(thenStatement); node.elseStatement = asEmbeddedStatement(elseStatement); @@ -22245,7 +22350,7 @@ ${lanes.join("\n")} return node.expression !== expression || node.thenStatement !== thenStatement || node.elseStatement !== elseStatement ? update(createIfStatement(expression, thenStatement, elseStatement), node) : node; } function createDoStatement(statement, expression) { - const node = createBaseNode(245 /* DoStatement */); + const node = createBaseNode(246 /* DoStatement */); node.statement = asEmbeddedStatement(statement); node.expression = expression; node.transformFlags |= propagateChildFlags(node.statement) | propagateChildFlags(node.expression); @@ -22257,7 +22362,7 @@ ${lanes.join("\n")} return node.statement !== statement || node.expression !== expression ? update(createDoStatement(statement, expression), node) : node; } function createWhileStatement(expression, statement) { - const node = createBaseNode(246 /* WhileStatement */); + const node = createBaseNode(247 /* WhileStatement */); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.statement); @@ -22269,7 +22374,7 @@ ${lanes.join("\n")} return node.expression !== expression || node.statement !== statement ? update(createWhileStatement(expression, statement), node) : node; } function createForStatement(initializer, condition, incrementor, statement) { - const node = createBaseNode(247 /* ForStatement */); + const node = createBaseNode(248 /* ForStatement */); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -22285,7 +22390,7 @@ ${lanes.join("\n")} return node.initializer !== initializer || node.condition !== condition || node.incrementor !== incrementor || node.statement !== statement ? update(createForStatement(initializer, condition, incrementor, statement), node) : node; } function createForInStatement(initializer, expression, statement) { - const node = createBaseNode(248 /* ForInStatement */); + const node = createBaseNode(249 /* ForInStatement */); node.initializer = initializer; node.expression = expression; node.statement = asEmbeddedStatement(statement); @@ -22300,7 +22405,7 @@ ${lanes.join("\n")} return node.initializer !== initializer || node.expression !== expression || node.statement !== statement ? update(createForInStatement(initializer, expression, statement), node) : node; } function createForOfStatement(awaitModifier, initializer, expression, statement) { - const node = createBaseNode(249 /* ForOfStatement */); + const node = createBaseNode(250 /* ForOfStatement */); node.awaitModifier = awaitModifier; node.initializer = initializer; node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); @@ -22318,7 +22423,7 @@ ${lanes.join("\n")} return node.awaitModifier !== awaitModifier || node.initializer !== initializer || node.expression !== expression || node.statement !== statement ? update(createForOfStatement(awaitModifier, initializer, expression, statement), node) : node; } function createContinueStatement(label) { - const node = createBaseNode(250 /* ContinueStatement */); + const node = createBaseNode(251 /* ContinueStatement */); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | 4194304 /* ContainsHoistedDeclarationOrCompletion */; node.jsDoc = void 0; @@ -22329,7 +22434,7 @@ ${lanes.join("\n")} return node.label !== label ? update(createContinueStatement(label), node) : node; } function createBreakStatement(label) { - const node = createBaseNode(251 /* BreakStatement */); + const node = createBaseNode(252 /* BreakStatement */); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | 4194304 /* ContainsHoistedDeclarationOrCompletion */; node.jsDoc = void 0; @@ -22340,7 +22445,7 @@ ${lanes.join("\n")} return node.label !== label ? update(createBreakStatement(label), node) : node; } function createReturnStatement(expression) { - const node = createBaseNode(252 /* ReturnStatement */); + const node = createBaseNode(253 /* ReturnStatement */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression) | 128 /* ContainsES2018 */ | 4194304 /* ContainsHoistedDeclarationOrCompletion */; node.jsDoc = void 0; @@ -22351,7 +22456,7 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createReturnStatement(expression), node) : node; } function createWithStatement(expression, statement) { - const node = createBaseNode(253 /* WithStatement */); + const node = createBaseNode(254 /* WithStatement */); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.statement); @@ -22363,7 +22468,7 @@ ${lanes.join("\n")} return node.expression !== expression || node.statement !== statement ? update(createWithStatement(expression, statement), node) : node; } function createSwitchStatement(expression, caseBlock) { - const node = createBaseNode(254 /* SwitchStatement */); + const node = createBaseNode(255 /* SwitchStatement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.caseBlock = caseBlock; node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.caseBlock); @@ -22376,7 +22481,7 @@ ${lanes.join("\n")} return node.expression !== expression || node.caseBlock !== caseBlock ? update(createSwitchStatement(expression, caseBlock), node) : node; } function createLabeledStatement(label, statement) { - const node = createBaseNode(255 /* LabeledStatement */); + const node = createBaseNode(256 /* LabeledStatement */); node.label = asName(label); node.statement = asEmbeddedStatement(statement); node.transformFlags |= propagateChildFlags(node.label) | propagateChildFlags(node.statement); @@ -22388,7 +22493,7 @@ ${lanes.join("\n")} return node.label !== label || node.statement !== statement ? update(createLabeledStatement(label, statement), node) : node; } function createThrowStatement(expression) { - const node = createBaseNode(256 /* ThrowStatement */); + const node = createBaseNode(257 /* ThrowStatement */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); node.jsDoc = void 0; @@ -22399,7 +22504,7 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createThrowStatement(expression), node) : node; } function createTryStatement(tryBlock, catchClause, finallyBlock) { - const node = createBaseNode(257 /* TryStatement */); + const node = createBaseNode(258 /* TryStatement */); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -22412,13 +22517,13 @@ ${lanes.join("\n")} return node.tryBlock !== tryBlock || node.catchClause !== catchClause || node.finallyBlock !== finallyBlock ? update(createTryStatement(tryBlock, catchClause, finallyBlock), node) : node; } function createDebuggerStatement() { - const node = createBaseNode(258 /* DebuggerStatement */); + const node = createBaseNode(259 /* DebuggerStatement */); node.jsDoc = void 0; node.flowNode = void 0; return node; } function createVariableDeclaration(name, exclamationToken, type, initializer) { - const node = createBaseDeclaration(259 /* VariableDeclaration */); + const node = createBaseDeclaration(260 /* VariableDeclaration */); node.name = asName(name); node.exclamationToken = exclamationToken; node.type = type; @@ -22431,20 +22536,23 @@ ${lanes.join("\n")} return node.name !== name || node.type !== type || node.exclamationToken !== exclamationToken || node.initializer !== initializer ? update(createVariableDeclaration(name, exclamationToken, type, initializer), node) : node; } function createVariableDeclarationList(declarations, flags2 = 0 /* None */) { - const node = createBaseNode(260 /* VariableDeclarationList */); - node.flags |= flags2 & 3 /* BlockScoped */; + const node = createBaseNode(261 /* VariableDeclarationList */); + node.flags |= flags2 & 7 /* BlockScoped */; node.declarations = createNodeArray(declarations); node.transformFlags |= propagateChildrenFlags(node.declarations) | 4194304 /* ContainsHoistedDeclarationOrCompletion */; - if (flags2 & 3 /* BlockScoped */) { + if (flags2 & 7 /* BlockScoped */) { node.transformFlags |= 1024 /* ContainsES2015 */ | 262144 /* ContainsBlockScopedBinding */; } + if (flags2 & 4 /* Using */) { + node.transformFlags |= 4 /* ContainsESNext */; + } return node; } function updateVariableDeclarationList(node, declarations) { return node.declarations !== declarations ? update(createVariableDeclarationList(declarations, node.flags), node) : node; } function createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - const node = createBaseDeclaration(261 /* FunctionDeclaration */); + const node = createBaseDeclaration(262 /* FunctionDeclaration */); node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; node.name = asName(name); @@ -22480,7 +22588,7 @@ ${lanes.join("\n")} return finishUpdateBaseSignatureDeclaration(updated, original); } function createClassDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - const node = createBaseDeclaration(262 /* ClassDeclaration */); + const node = createBaseDeclaration(263 /* ClassDeclaration */); node.modifiers = asNodeArray(modifiers); node.name = asName(name); node.typeParameters = asNodeArray(typeParameters); @@ -22501,7 +22609,7 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members ? update(createClassDeclaration(modifiers, name, typeParameters, heritageClauses, members), node) : node; } function createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - const node = createBaseDeclaration(263 /* InterfaceDeclaration */); + const node = createBaseDeclaration(264 /* InterfaceDeclaration */); node.modifiers = asNodeArray(modifiers); node.name = asName(name); node.typeParameters = asNodeArray(typeParameters); @@ -22515,7 +22623,7 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members ? update(createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members), node) : node; } function createTypeAliasDeclaration(modifiers, name, typeParameters, type) { - const node = createBaseDeclaration(264 /* TypeAliasDeclaration */); + const node = createBaseDeclaration(265 /* TypeAliasDeclaration */); node.modifiers = asNodeArray(modifiers); node.name = asName(name); node.typeParameters = asNodeArray(typeParameters); @@ -22530,7 +22638,7 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.type !== type ? update(createTypeAliasDeclaration(modifiers, name, typeParameters, type), node) : node; } function createEnumDeclaration(modifiers, name, members) { - const node = createBaseDeclaration(265 /* EnumDeclaration */); + const node = createBaseDeclaration(266 /* EnumDeclaration */); node.modifiers = asNodeArray(modifiers); node.name = asName(name); node.members = createNodeArray(members); @@ -22543,9 +22651,9 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.name !== name || node.members !== members ? update(createEnumDeclaration(modifiers, name, members), node) : node; } function createModuleDeclaration(modifiers, name, body, flags2 = 0 /* None */) { - const node = createBaseDeclaration(266 /* ModuleDeclaration */); + const node = createBaseDeclaration(267 /* ModuleDeclaration */); node.modifiers = asNodeArray(modifiers); - node.flags |= flags2 & (16 /* Namespace */ | 4 /* NestedNamespace */ | 1024 /* GlobalAugmentation */); + node.flags |= flags2 & (32 /* Namespace */ | 8 /* NestedNamespace */ | 2048 /* GlobalAugmentation */); node.name = name; node.body = body; if (modifiersToFlags(node.modifiers) & 2 /* Ambient */) { @@ -22563,7 +22671,7 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.name !== name || node.body !== body ? update(createModuleDeclaration(modifiers, name, body, node.flags), node) : node; } function createModuleBlock(statements) { - const node = createBaseNode(267 /* ModuleBlock */); + const node = createBaseNode(268 /* ModuleBlock */); node.statements = createNodeArray(statements); node.transformFlags |= propagateChildrenFlags(node.statements); node.jsDoc = void 0; @@ -22573,7 +22681,7 @@ ${lanes.join("\n")} return node.statements !== statements ? update(createModuleBlock(statements), node) : node; } function createCaseBlock(clauses) { - const node = createBaseNode(268 /* CaseBlock */); + const node = createBaseNode(269 /* CaseBlock */); node.clauses = createNodeArray(clauses); node.transformFlags |= propagateChildrenFlags(node.clauses); node.locals = void 0; @@ -22584,7 +22692,7 @@ ${lanes.join("\n")} return node.clauses !== clauses ? update(createCaseBlock(clauses), node) : node; } function createNamespaceExportDeclaration(name) { - const node = createBaseDeclaration(269 /* NamespaceExportDeclaration */); + const node = createBaseDeclaration(270 /* NamespaceExportDeclaration */); node.name = asName(name); node.transformFlags |= propagateIdentifierNameFlags(node.name) | 1 /* ContainsTypeScript */; node.modifiers = void 0; @@ -22601,7 +22709,7 @@ ${lanes.join("\n")} return update(updated, original); } function createImportEqualsDeclaration(modifiers, isTypeOnly, name, moduleReference) { - const node = createBaseDeclaration(270 /* ImportEqualsDeclaration */); + const node = createBaseDeclaration(271 /* ImportEqualsDeclaration */); node.modifiers = asNodeArray(modifiers); node.name = asName(name); node.isTypeOnly = isTypeOnly; @@ -22618,7 +22726,7 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.isTypeOnly !== isTypeOnly || node.name !== name || node.moduleReference !== moduleReference ? update(createImportEqualsDeclaration(modifiers, isTypeOnly, name, moduleReference), node) : node; } function createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause) { - const node = createBaseNode(271 /* ImportDeclaration */); + const node = createBaseNode(272 /* ImportDeclaration */); node.modifiers = asNodeArray(modifiers); node.importClause = importClause; node.moduleSpecifier = moduleSpecifier; @@ -22632,7 +22740,7 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier || node.assertClause !== assertClause ? update(createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause), node) : node; } function createImportClause(isTypeOnly, name, namedBindings) { - const node = createBaseDeclaration(272 /* ImportClause */); + const node = createBaseDeclaration(273 /* ImportClause */); node.isTypeOnly = isTypeOnly; node.name = name; node.namedBindings = namedBindings; @@ -22647,7 +22755,7 @@ ${lanes.join("\n")} return node.isTypeOnly !== isTypeOnly || node.name !== name || node.namedBindings !== namedBindings ? update(createImportClause(isTypeOnly, name, namedBindings), node) : node; } function createAssertClause(elements, multiLine) { - const node = createBaseNode(299 /* AssertClause */); + const node = createBaseNode(300 /* AssertClause */); node.elements = createNodeArray(elements); node.multiLine = multiLine; node.transformFlags |= 4 /* ContainsESNext */; @@ -22657,7 +22765,7 @@ ${lanes.join("\n")} return node.elements !== elements || node.multiLine !== multiLine ? update(createAssertClause(elements, multiLine), node) : node; } function createAssertEntry(name, value) { - const node = createBaseNode(300 /* AssertEntry */); + const node = createBaseNode(301 /* AssertEntry */); node.name = name; node.value = value; node.transformFlags |= 4 /* ContainsESNext */; @@ -22667,7 +22775,7 @@ ${lanes.join("\n")} return node.name !== name || node.value !== value ? update(createAssertEntry(name, value), node) : node; } function createImportTypeAssertionContainer(clause, multiLine) { - const node = createBaseNode(301 /* ImportTypeAssertionContainer */); + const node = createBaseNode(302 /* ImportTypeAssertionContainer */); node.assertClause = clause; node.multiLine = multiLine; return node; @@ -22676,7 +22784,7 @@ ${lanes.join("\n")} return node.assertClause !== clause || node.multiLine !== multiLine ? update(createImportTypeAssertionContainer(clause, multiLine), node) : node; } function createNamespaceImport(name) { - const node = createBaseDeclaration(273 /* NamespaceImport */); + const node = createBaseDeclaration(274 /* NamespaceImport */); node.name = name; node.transformFlags |= propagateChildFlags(node.name); node.transformFlags &= ~67108864 /* ContainsPossibleTopLevelAwait */; @@ -22686,7 +22794,7 @@ ${lanes.join("\n")} return node.name !== name ? update(createNamespaceImport(name), node) : node; } function createNamespaceExport(name) { - const node = createBaseDeclaration(279 /* NamespaceExport */); + const node = createBaseDeclaration(280 /* NamespaceExport */); node.name = name; node.transformFlags |= propagateChildFlags(node.name) | 32 /* ContainsES2020 */; node.transformFlags &= ~67108864 /* ContainsPossibleTopLevelAwait */; @@ -22696,7 +22804,7 @@ ${lanes.join("\n")} return node.name !== name ? update(createNamespaceExport(name), node) : node; } function createNamedImports(elements) { - const node = createBaseNode(274 /* NamedImports */); + const node = createBaseNode(275 /* NamedImports */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864 /* ContainsPossibleTopLevelAwait */; @@ -22706,7 +22814,7 @@ ${lanes.join("\n")} return node.elements !== elements ? update(createNamedImports(elements), node) : node; } function createImportSpecifier(isTypeOnly, propertyName, name) { - const node = createBaseDeclaration(275 /* ImportSpecifier */); + const node = createBaseDeclaration(276 /* ImportSpecifier */); node.isTypeOnly = isTypeOnly; node.propertyName = propertyName; node.name = name; @@ -22718,7 +22826,7 @@ ${lanes.join("\n")} return node.isTypeOnly !== isTypeOnly || node.propertyName !== propertyName || node.name !== name ? update(createImportSpecifier(isTypeOnly, propertyName, name), node) : node; } function createExportAssignment2(modifiers, isExportEquals, expression) { - const node = createBaseDeclaration(276 /* ExportAssignment */); + const node = createBaseDeclaration(277 /* ExportAssignment */); node.modifiers = asNodeArray(modifiers); node.isExportEquals = isExportEquals; node.expression = isExportEquals ? parenthesizerRules().parenthesizeRightSideOfBinary( @@ -22736,7 +22844,7 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.expression !== expression ? update(createExportAssignment2(modifiers, node.isExportEquals, expression), node) : node; } function createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause) { - const node = createBaseDeclaration(277 /* ExportDeclaration */); + const node = createBaseDeclaration(278 /* ExportDeclaration */); node.modifiers = asNodeArray(modifiers); node.isTypeOnly = isTypeOnly; node.exportClause = exportClause; @@ -22759,7 +22867,7 @@ ${lanes.join("\n")} return update(updated, original); } function createNamedExports(elements) { - const node = createBaseNode(278 /* NamedExports */); + const node = createBaseNode(279 /* NamedExports */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864 /* ContainsPossibleTopLevelAwait */; @@ -22769,7 +22877,7 @@ ${lanes.join("\n")} return node.elements !== elements ? update(createNamedExports(elements), node) : node; } function createExportSpecifier(isTypeOnly, propertyName, name) { - const node = createBaseNode(280 /* ExportSpecifier */); + const node = createBaseNode(281 /* ExportSpecifier */); node.isTypeOnly = isTypeOnly; node.propertyName = asName(propertyName); node.name = asName(name); @@ -22782,12 +22890,12 @@ ${lanes.join("\n")} return node.isTypeOnly !== isTypeOnly || node.propertyName !== propertyName || node.name !== name ? update(createExportSpecifier(isTypeOnly, propertyName, name), node) : node; } function createMissingDeclaration() { - const node = createBaseDeclaration(281 /* MissingDeclaration */); + const node = createBaseDeclaration(282 /* MissingDeclaration */); node.jsDoc = void 0; return node; } function createExternalModuleReference(expression) { - const node = createBaseNode(282 /* ExternalModuleReference */); + const node = createBaseNode(283 /* ExternalModuleReference */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); node.transformFlags &= ~67108864 /* ContainsPossibleTopLevelAwait */; @@ -22819,7 +22927,7 @@ ${lanes.join("\n")} return node.type !== type ? update(createJSDocUnaryTypeWorker(kind, type), node) : node; } function createJSDocFunctionType(parameters, type) { - const node = createBaseDeclaration(323 /* JSDocFunctionType */); + const node = createBaseDeclaration(324 /* JSDocFunctionType */); node.parameters = asNodeArray(parameters); node.type = type; node.transformFlags = propagateChildrenFlags(node.parameters) | (node.type ? 1 /* ContainsTypeScript */ : 0 /* None */); @@ -22833,7 +22941,7 @@ ${lanes.join("\n")} return node.parameters !== parameters || node.type !== type ? update(createJSDocFunctionType(parameters, type), node) : node; } function createJSDocTypeLiteral(propertyTags, isArrayType = false) { - const node = createBaseDeclaration(328 /* JSDocTypeLiteral */); + const node = createBaseDeclaration(329 /* JSDocTypeLiteral */); node.jsDocPropertyTags = asNodeArray(propertyTags); node.isArrayType = isArrayType; return node; @@ -22842,7 +22950,7 @@ ${lanes.join("\n")} return node.jsDocPropertyTags !== propertyTags || node.isArrayType !== isArrayType ? update(createJSDocTypeLiteral(propertyTags, isArrayType), node) : node; } function createJSDocTypeExpression(type) { - const node = createBaseNode(315 /* JSDocTypeExpression */); + const node = createBaseNode(316 /* JSDocTypeExpression */); node.type = type; return node; } @@ -22850,7 +22958,7 @@ ${lanes.join("\n")} return node.type !== type ? update(createJSDocTypeExpression(type), node) : node; } function createJSDocSignature(typeParameters, parameters, type) { - const node = createBaseDeclaration(329 /* JSDocSignature */); + const node = createBaseDeclaration(330 /* JSDocSignature */); node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; @@ -22879,7 +22987,7 @@ ${lanes.join("\n")} return node; } function createJSDocTemplateTag(tagName, constraint, typeParameters, comment) { - const node = createBaseJSDocTag(351 /* JSDocTemplateTag */, tagName ?? createIdentifier("template"), comment); + const node = createBaseJSDocTag(352 /* JSDocTemplateTag */, tagName ?? createIdentifier("template"), comment); node.constraint = constraint; node.typeParameters = createNodeArray(typeParameters); return node; @@ -22888,7 +22996,7 @@ ${lanes.join("\n")} return node.tagName !== tagName || node.constraint !== constraint || node.typeParameters !== typeParameters || node.comment !== comment ? update(createJSDocTemplateTag(tagName, constraint, typeParameters, comment), node) : node; } function createJSDocTypedefTag(tagName, typeExpression, fullName, comment) { - const node = createBaseJSDocTagDeclaration(352 /* JSDocTypedefTag */, tagName ?? createIdentifier("typedef"), comment); + const node = createBaseJSDocTagDeclaration(353 /* JSDocTypedefTag */, tagName ?? createIdentifier("typedef"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = getJSDocTypeAliasName(fullName); @@ -22900,7 +23008,7 @@ ${lanes.join("\n")} return node.tagName !== tagName || node.typeExpression !== typeExpression || node.fullName !== fullName || node.comment !== comment ? update(createJSDocTypedefTag(tagName, typeExpression, fullName, comment), node) : node; } function createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - const node = createBaseJSDocTagDeclaration(347 /* JSDocParameterTag */, tagName ?? createIdentifier("param"), comment); + const node = createBaseJSDocTagDeclaration(348 /* JSDocParameterTag */, tagName ?? createIdentifier("param"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -22911,7 +23019,7 @@ ${lanes.join("\n")} return node.tagName !== tagName || node.name !== name || node.isBracketed !== isBracketed || node.typeExpression !== typeExpression || node.isNameFirst !== isNameFirst || node.comment !== comment ? update(createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment), node) : node; } function createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - const node = createBaseJSDocTagDeclaration(354 /* JSDocPropertyTag */, tagName ?? createIdentifier("prop"), comment); + const node = createBaseJSDocTagDeclaration(355 /* JSDocPropertyTag */, tagName ?? createIdentifier("prop"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -22922,7 +23030,7 @@ ${lanes.join("\n")} return node.tagName !== tagName || node.name !== name || node.isBracketed !== isBracketed || node.typeExpression !== typeExpression || node.isNameFirst !== isNameFirst || node.comment !== comment ? update(createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment), node) : node; } function createJSDocCallbackTag(tagName, typeExpression, fullName, comment) { - const node = createBaseJSDocTagDeclaration(344 /* JSDocCallbackTag */, tagName ?? createIdentifier("callback"), comment); + const node = createBaseJSDocTagDeclaration(345 /* JSDocCallbackTag */, tagName ?? createIdentifier("callback"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = getJSDocTypeAliasName(fullName); @@ -22934,7 +23042,7 @@ ${lanes.join("\n")} return node.tagName !== tagName || node.typeExpression !== typeExpression || node.fullName !== fullName || node.comment !== comment ? update(createJSDocCallbackTag(tagName, typeExpression, fullName, comment), node) : node; } function createJSDocOverloadTag(tagName, typeExpression, comment) { - const node = createBaseJSDocTag(345 /* JSDocOverloadTag */, tagName ?? createIdentifier("overload"), comment); + const node = createBaseJSDocTag(346 /* JSDocOverloadTag */, tagName ?? createIdentifier("overload"), comment); node.typeExpression = typeExpression; return node; } @@ -22942,7 +23050,7 @@ ${lanes.join("\n")} return node.tagName !== tagName || node.typeExpression !== typeExpression || node.comment !== comment ? update(createJSDocOverloadTag(tagName, typeExpression, comment), node) : node; } function createJSDocAugmentsTag(tagName, className, comment) { - const node = createBaseJSDocTag(334 /* JSDocAugmentsTag */, tagName ?? createIdentifier("augments"), comment); + const node = createBaseJSDocTag(335 /* JSDocAugmentsTag */, tagName ?? createIdentifier("augments"), comment); node.class = className; return node; } @@ -22950,12 +23058,12 @@ ${lanes.join("\n")} return node.tagName !== tagName || node.class !== className || node.comment !== comment ? update(createJSDocAugmentsTag(tagName, className, comment), node) : node; } function createJSDocImplementsTag(tagName, className, comment) { - const node = createBaseJSDocTag(335 /* JSDocImplementsTag */, tagName ?? createIdentifier("implements"), comment); + const node = createBaseJSDocTag(336 /* JSDocImplementsTag */, tagName ?? createIdentifier("implements"), comment); node.class = className; return node; } function createJSDocSeeTag(tagName, name, comment) { - const node = createBaseJSDocTag(353 /* JSDocSeeTag */, tagName ?? createIdentifier("see"), comment); + const node = createBaseJSDocTag(354 /* JSDocSeeTag */, tagName ?? createIdentifier("see"), comment); node.name = name; return node; } @@ -22963,7 +23071,7 @@ ${lanes.join("\n")} return node.tagName !== tagName || node.name !== name || node.comment !== comment ? update(createJSDocSeeTag(tagName, name, comment), node) : node; } function createJSDocNameReference(name) { - const node = createBaseNode(316 /* JSDocNameReference */); + const node = createBaseNode(317 /* JSDocNameReference */); node.name = name; return node; } @@ -22971,7 +23079,7 @@ ${lanes.join("\n")} return node.name !== name ? update(createJSDocNameReference(name), node) : node; } function createJSDocMemberName(left, right) { - const node = createBaseNode(317 /* JSDocMemberName */); + const node = createBaseNode(318 /* JSDocMemberName */); node.left = left; node.right = right; node.transformFlags |= propagateChildFlags(node.left) | propagateChildFlags(node.right); @@ -22981,7 +23089,7 @@ ${lanes.join("\n")} return node.left !== left || node.right !== right ? update(createJSDocMemberName(left, right), node) : node; } function createJSDocLink(name, text) { - const node = createBaseNode(330 /* JSDocLink */); + const node = createBaseNode(331 /* JSDocLink */); node.name = name; node.text = text; return node; @@ -22990,7 +23098,7 @@ ${lanes.join("\n")} return node.name !== name ? update(createJSDocLink(name, text), node) : node; } function createJSDocLinkCode(name, text) { - const node = createBaseNode(331 /* JSDocLinkCode */); + const node = createBaseNode(332 /* JSDocLinkCode */); node.name = name; node.text = text; return node; @@ -22999,7 +23107,7 @@ ${lanes.join("\n")} return node.name !== name ? update(createJSDocLinkCode(name, text), node) : node; } function createJSDocLinkPlain(name, text) { - const node = createBaseNode(332 /* JSDocLinkPlain */); + const node = createBaseNode(333 /* JSDocLinkPlain */); node.name = name; node.text = text; return node; @@ -23026,14 +23134,14 @@ ${lanes.join("\n")} return node.tagName !== tagName || node.typeExpression !== typeExpression || node.comment !== comment ? update(createJSDocTypeLikeTagWorker(kind, tagName, typeExpression, comment), node) : node; } function createJSDocUnknownTag(tagName, comment) { - const node = createBaseJSDocTag(333 /* JSDocTag */, tagName, comment); + const node = createBaseJSDocTag(334 /* JSDocTag */, tagName, comment); return node; } function updateJSDocUnknownTag(node, tagName, comment) { return node.tagName !== tagName || node.comment !== comment ? update(createJSDocUnknownTag(tagName, comment), node) : node; } function createJSDocEnumTag(tagName, typeExpression, comment) { - const node = createBaseJSDocTagDeclaration(346 /* JSDocEnumTag */, tagName ?? createIdentifier(getDefaultTagNameForKind(346 /* JSDocEnumTag */)), comment); + const node = createBaseJSDocTagDeclaration(347 /* JSDocEnumTag */, tagName ?? createIdentifier(getDefaultTagNameForKind(347 /* JSDocEnumTag */)), comment); node.typeExpression = typeExpression; node.locals = void 0; node.nextContainer = void 0; @@ -23043,7 +23151,7 @@ ${lanes.join("\n")} return node.tagName !== tagName || node.typeExpression !== typeExpression || node.comment !== comment ? update(createJSDocEnumTag(tagName, typeExpression, comment), node) : node; } function createJSDocText(text) { - const node = createBaseNode(327 /* JSDocText */); + const node = createBaseNode(328 /* JSDocText */); node.text = text; return node; } @@ -23051,7 +23159,7 @@ ${lanes.join("\n")} return node.text !== text ? update(createJSDocText(text), node) : node; } function createJSDocComment(comment, tags) { - const node = createBaseNode(326 /* JSDoc */); + const node = createBaseNode(327 /* JSDoc */); node.comment = comment; node.tags = asNodeArray(tags); return node; @@ -23060,7 +23168,7 @@ ${lanes.join("\n")} return node.comment !== comment || node.tags !== tags ? update(createJSDocComment(comment, tags), node) : node; } function createJsxElement(openingElement, children, closingElement) { - const node = createBaseNode(283 /* JsxElement */); + const node = createBaseNode(284 /* JsxElement */); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -23071,7 +23179,7 @@ ${lanes.join("\n")} return node.openingElement !== openingElement || node.children !== children || node.closingElement !== closingElement ? update(createJsxElement(openingElement, children, closingElement), node) : node; } function createJsxSelfClosingElement(tagName, typeArguments, attributes) { - const node = createBaseNode(284 /* JsxSelfClosingElement */); + const node = createBaseNode(285 /* JsxSelfClosingElement */); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -23085,7 +23193,7 @@ ${lanes.join("\n")} return node.tagName !== tagName || node.typeArguments !== typeArguments || node.attributes !== attributes ? update(createJsxSelfClosingElement(tagName, typeArguments, attributes), node) : node; } function createJsxOpeningElement(tagName, typeArguments, attributes) { - const node = createBaseNode(285 /* JsxOpeningElement */); + const node = createBaseNode(286 /* JsxOpeningElement */); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -23099,7 +23207,7 @@ ${lanes.join("\n")} return node.tagName !== tagName || node.typeArguments !== typeArguments || node.attributes !== attributes ? update(createJsxOpeningElement(tagName, typeArguments, attributes), node) : node; } function createJsxClosingElement(tagName) { - const node = createBaseNode(286 /* JsxClosingElement */); + const node = createBaseNode(287 /* JsxClosingElement */); node.tagName = tagName; node.transformFlags |= propagateChildFlags(node.tagName) | 2 /* ContainsJsx */; return node; @@ -23108,7 +23216,7 @@ ${lanes.join("\n")} return node.tagName !== tagName ? update(createJsxClosingElement(tagName), node) : node; } function createJsxFragment(openingFragment, children, closingFragment) { - const node = createBaseNode(287 /* JsxFragment */); + const node = createBaseNode(288 /* JsxFragment */); node.openingFragment = openingFragment; node.children = createNodeArray(children); node.closingFragment = closingFragment; @@ -23129,17 +23237,17 @@ ${lanes.join("\n")} return node.text !== text || node.containsOnlyTriviaWhiteSpaces !== containsOnlyTriviaWhiteSpaces ? update(createJsxText(text, containsOnlyTriviaWhiteSpaces), node) : node; } function createJsxOpeningFragment() { - const node = createBaseNode(288 /* JsxOpeningFragment */); + const node = createBaseNode(289 /* JsxOpeningFragment */); node.transformFlags |= 2 /* ContainsJsx */; return node; } function createJsxJsxClosingFragment() { - const node = createBaseNode(289 /* JsxClosingFragment */); + const node = createBaseNode(290 /* JsxClosingFragment */); node.transformFlags |= 2 /* ContainsJsx */; return node; } function createJsxAttribute(name, initializer) { - const node = createBaseDeclaration(290 /* JsxAttribute */); + const node = createBaseDeclaration(291 /* JsxAttribute */); node.name = name; node.initializer = initializer; node.transformFlags |= propagateChildFlags(node.name) | propagateChildFlags(node.initializer) | 2 /* ContainsJsx */; @@ -23149,7 +23257,7 @@ ${lanes.join("\n")} return node.name !== name || node.initializer !== initializer ? update(createJsxAttribute(name, initializer), node) : node; } function createJsxAttributes(properties) { - const node = createBaseDeclaration(291 /* JsxAttributes */); + const node = createBaseDeclaration(292 /* JsxAttributes */); node.properties = createNodeArray(properties); node.transformFlags |= propagateChildrenFlags(node.properties) | 2 /* ContainsJsx */; return node; @@ -23158,7 +23266,7 @@ ${lanes.join("\n")} return node.properties !== properties ? update(createJsxAttributes(properties), node) : node; } function createJsxSpreadAttribute(expression) { - const node = createBaseNode(292 /* JsxSpreadAttribute */); + const node = createBaseNode(293 /* JsxSpreadAttribute */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression) | 2 /* ContainsJsx */; return node; @@ -23167,7 +23275,7 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createJsxSpreadAttribute(expression), node) : node; } function createJsxExpression(dotDotDotToken, expression) { - const node = createBaseNode(293 /* JsxExpression */); + const node = createBaseNode(294 /* JsxExpression */); node.dotDotDotToken = dotDotDotToken; node.expression = expression; node.transformFlags |= propagateChildFlags(node.dotDotDotToken) | propagateChildFlags(node.expression) | 2 /* ContainsJsx */; @@ -23177,7 +23285,7 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createJsxExpression(node.dotDotDotToken, expression), node) : node; } function createJsxNamespacedName(namespace, name) { - const node = createBaseNode(294 /* JsxNamespacedName */); + const node = createBaseNode(295 /* JsxNamespacedName */); node.namespace = namespace; node.name = name; node.transformFlags |= propagateChildFlags(node.namespace) | propagateChildFlags(node.name) | 2 /* ContainsJsx */; @@ -23187,7 +23295,7 @@ ${lanes.join("\n")} return node.namespace !== namespace || node.name !== name ? update(createJsxNamespacedName(namespace, name), node) : node; } function createCaseClause(expression, statements) { - const node = createBaseNode(295 /* CaseClause */); + const node = createBaseNode(296 /* CaseClause */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.statements = createNodeArray(statements); node.transformFlags |= propagateChildFlags(node.expression) | propagateChildrenFlags(node.statements); @@ -23198,7 +23306,7 @@ ${lanes.join("\n")} return node.expression !== expression || node.statements !== statements ? update(createCaseClause(expression, statements), node) : node; } function createDefaultClause(statements) { - const node = createBaseNode(296 /* DefaultClause */); + const node = createBaseNode(297 /* DefaultClause */); node.statements = createNodeArray(statements); node.transformFlags = propagateChildrenFlags(node.statements); return node; @@ -23207,7 +23315,7 @@ ${lanes.join("\n")} return node.statements !== statements ? update(createDefaultClause(statements), node) : node; } function createHeritageClause(token, types) { - const node = createBaseNode(297 /* HeritageClause */); + const node = createBaseNode(298 /* HeritageClause */); node.token = token; node.types = createNodeArray(types); node.transformFlags |= propagateChildrenFlags(node.types); @@ -23227,7 +23335,7 @@ ${lanes.join("\n")} return node.types !== types ? update(createHeritageClause(node.token, types), node) : node; } function createCatchClause(variableDeclaration, block) { - const node = createBaseNode(298 /* CatchClause */); + const node = createBaseNode(299 /* CatchClause */); node.variableDeclaration = asVariableDeclaration(variableDeclaration); node.block = block; node.transformFlags |= propagateChildFlags(node.variableDeclaration) | propagateChildFlags(node.block) | (!variableDeclaration ? 64 /* ContainsES2019 */ : 0 /* None */); @@ -23239,7 +23347,7 @@ ${lanes.join("\n")} return node.variableDeclaration !== variableDeclaration || node.block !== block ? update(createCatchClause(variableDeclaration, block), node) : node; } function createPropertyAssignment(name, initializer) { - const node = createBaseDeclaration(302 /* PropertyAssignment */); + const node = createBaseDeclaration(303 /* PropertyAssignment */); node.name = asName(name); node.initializer = parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= propagateNameFlags(node.name) | propagateChildFlags(node.initializer); @@ -23261,7 +23369,7 @@ ${lanes.join("\n")} return update(updated, original); } function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { - const node = createBaseDeclaration(303 /* ShorthandPropertyAssignment */); + const node = createBaseDeclaration(304 /* ShorthandPropertyAssignment */); node.name = asName(name); node.objectAssignmentInitializer = objectAssignmentInitializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(objectAssignmentInitializer); node.transformFlags |= propagateIdentifierNameFlags(node.name) | propagateChildFlags(node.objectAssignmentInitializer) | 1024 /* ContainsES2015 */; @@ -23285,7 +23393,7 @@ ${lanes.join("\n")} return update(updated, original); } function createSpreadAssignment(expression) { - const node = createBaseDeclaration(304 /* SpreadAssignment */); + const node = createBaseDeclaration(305 /* SpreadAssignment */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | 128 /* ContainsES2018 */ | 65536 /* ContainsObjectRestOrSpread */; node.jsDoc = void 0; @@ -23295,7 +23403,7 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createSpreadAssignment(expression), node) : node; } function createEnumMember(name, initializer) { - const node = createBaseDeclaration(305 /* EnumMember */); + const node = createBaseDeclaration(306 /* EnumMember */); node.name = asName(name); node.initializer = initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= propagateChildFlags(node.name) | propagateChildFlags(node.initializer) | 1 /* ContainsTypeScript */; @@ -23306,7 +23414,7 @@ ${lanes.join("\n")} return node.name !== name || node.initializer !== initializer ? update(createEnumMember(name, initializer), node) : node; } function createSourceFile2(statements, endOfFileToken, flags2) { - const node = baseFactory2.createBaseSourceFileNode(311 /* SourceFile */); + const node = baseFactory2.createBaseSourceFileNode(312 /* SourceFile */); node.statements = createNodeArray(statements); node.endOfFileToken = endOfFileToken; node.flags |= flags2; @@ -23376,7 +23484,7 @@ ${lanes.join("\n")} } function cloneRedirectedSourceFile(source) { const node = createRedirectedSourceFile(source.redirectInfo); - node.flags |= source.flags & ~8 /* Synthesized */; + node.flags |= source.flags & ~16 /* Synthesized */; node.fileName = source.fileName; node.path = source.path; node.resolvedPath = source.resolvedPath; @@ -23387,8 +23495,8 @@ ${lanes.join("\n")} return node; } function cloneSourceFileWorker(source) { - const node = baseFactory2.createBaseSourceFileNode(311 /* SourceFile */); - node.flags |= source.flags & ~8 /* Synthesized */; + const node = baseFactory2.createBaseSourceFileNode(312 /* SourceFile */); + node.flags |= source.flags & ~16 /* Synthesized */; for (const p in source) { if (hasProperty(node, p) || !hasProperty(source, p)) { continue; @@ -23421,7 +23529,7 @@ ${lanes.join("\n")} return node.statements !== statements || node.isDeclarationFile !== isDeclarationFile || node.referencedFiles !== referencedFiles || node.typeReferenceDirectives !== typeReferenceDirectives || node.hasNoDefaultLib !== hasNoDefaultLib || node.libReferenceDirectives !== libReferenceDirectives ? update(cloneSourceFileWithChanges(node, statements, isDeclarationFile, referencedFiles, typeReferenceDirectives, hasNoDefaultLib, libReferenceDirectives), node) : node; } function createBundle(sourceFiles, prepends = emptyArray) { - const node = createBaseNode(312 /* Bundle */); + const node = createBaseNode(313 /* Bundle */); node.prepends = prepends; node.sourceFiles = sourceFiles; node.syntheticFileReferences = void 0; @@ -23434,7 +23542,7 @@ ${lanes.join("\n")} return node.sourceFiles !== sourceFiles || node.prepends !== prepends ? update(createBundle(sourceFiles, prepends), node) : node; } function createUnparsedSource(prologues, syntheticReferences, texts) { - const node = createBaseNode(313 /* UnparsedSource */); + const node = createBaseNode(314 /* UnparsedSource */); node.prologues = prologues; node.syntheticReferences = syntheticReferences; node.texts = texts; @@ -23451,48 +23559,48 @@ ${lanes.join("\n")} return node; } function createUnparsedPrologue(data) { - return createBaseUnparsedNode(306 /* UnparsedPrologue */, data); + return createBaseUnparsedNode(307 /* UnparsedPrologue */, data); } function createUnparsedPrepend(data, texts) { - const node = createBaseUnparsedNode(307 /* UnparsedPrepend */, data); + const node = createBaseUnparsedNode(308 /* UnparsedPrepend */, data); node.texts = texts; return node; } function createUnparsedTextLike(data, internal) { - return createBaseUnparsedNode(internal ? 309 /* UnparsedInternalText */ : 308 /* UnparsedText */, data); + return createBaseUnparsedNode(internal ? 310 /* UnparsedInternalText */ : 309 /* UnparsedText */, data); } function createUnparsedSyntheticReference(section) { - const node = createBaseNode(310 /* UnparsedSyntheticReference */); + const node = createBaseNode(311 /* UnparsedSyntheticReference */); node.data = section.data; node.section = section; return node; } function createInputFiles2() { - const node = createBaseNode(314 /* InputFiles */); + const node = createBaseNode(315 /* InputFiles */); node.javascriptText = ""; node.declarationText = ""; return node; } function createSyntheticExpression(type, isSpread = false, tupleNameSource) { - const node = createBaseNode(236 /* SyntheticExpression */); + const node = createBaseNode(237 /* SyntheticExpression */); node.type = type; node.isSpread = isSpread; node.tupleNameSource = tupleNameSource; return node; } function createSyntaxList3(children) { - const node = createBaseNode(357 /* SyntaxList */); + const node = createBaseNode(358 /* SyntaxList */); node._children = children; return node; } function createNotEmittedStatement(original) { - const node = createBaseNode(358 /* NotEmittedStatement */); + const node = createBaseNode(359 /* NotEmittedStatement */); node.original = original; setTextRange(node, original); return node; } function createPartiallyEmittedExpression(expression, original) { - const node = createBaseNode(359 /* PartiallyEmittedExpression */); + const node = createBaseNode(360 /* PartiallyEmittedExpression */); node.expression = expression; node.original = original; node.transformFlags |= propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */; @@ -23514,7 +23622,7 @@ ${lanes.join("\n")} return node; } function createCommaListExpression(elements) { - const node = createBaseNode(360 /* CommaListExpression */); + const node = createBaseNode(361 /* CommaListExpression */); node.elements = createNodeArray(sameFlatMap(elements, flattenCommaElements)); node.transformFlags |= propagateChildrenFlags(node.elements); return node; @@ -23523,7 +23631,7 @@ ${lanes.join("\n")} return node.elements !== elements ? update(createCommaListExpression(elements), node) : node; } function createSyntheticReferenceExpression(expression, thisArg) { - const node = createBaseNode(361 /* SyntheticReferenceExpression */); + const node = createBaseNode(362 /* SyntheticReferenceExpression */); node.expression = expression; node.thisArg = thisArg; node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.thisArg); @@ -23534,7 +23642,7 @@ ${lanes.join("\n")} } function cloneGeneratedIdentifier(node) { const clone2 = createBaseIdentifier(node.escapedText); - clone2.flags |= node.flags & ~8 /* Synthesized */; + clone2.flags |= node.flags & ~16 /* Synthesized */; clone2.transformFlags = node.transformFlags; setOriginalNode(clone2, node); setIdentifierAutoGenerate(clone2, { ...node.emitNode.autoGenerate }); @@ -23542,7 +23650,7 @@ ${lanes.join("\n")} } function cloneIdentifier(node) { const clone2 = createBaseIdentifier(node.escapedText); - clone2.flags |= node.flags & ~8 /* Synthesized */; + clone2.flags |= node.flags & ~16 /* Synthesized */; clone2.jsDoc = node.jsDoc; clone2.flowNode = node.flowNode; clone2.symbol = node.symbol; @@ -23555,7 +23663,7 @@ ${lanes.join("\n")} } function cloneGeneratedPrivateIdentifier(node) { const clone2 = createBasePrivateIdentifier(node.escapedText); - clone2.flags |= node.flags & ~8 /* Synthesized */; + clone2.flags |= node.flags & ~16 /* Synthesized */; clone2.transformFlags = node.transformFlags; setOriginalNode(clone2, node); setIdentifierAutoGenerate(clone2, { ...node.emitNode.autoGenerate }); @@ -23563,7 +23671,7 @@ ${lanes.join("\n")} } function clonePrivateIdentifier(node) { const clone2 = createBasePrivateIdentifier(node.escapedText); - clone2.flags |= node.flags & ~8 /* Synthesized */; + clone2.flags |= node.flags & ~16 /* Synthesized */; clone2.transformFlags = node.transformFlags; setOriginalNode(clone2, node); return clone2; @@ -23588,7 +23696,7 @@ ${lanes.join("\n")} return clonePrivateIdentifier(node); } const clone2 = !isNodeKind(node.kind) ? baseFactory2.createBaseTokenNode(node.kind) : baseFactory2.createBaseNode(node.kind); - clone2.flags |= node.flags & ~8 /* Synthesized */; + clone2.flags |= node.flags & ~16 /* Synthesized */; clone2.transformFlags = node.transformFlags; setOriginalNode(clone2, node); for (const key in node) { @@ -23681,7 +23789,10 @@ ${lanes.join("\n")} ); } function createTypeCheck(value, tag) { - return tag === "undefined" ? factory2.createStrictEquality(value, createVoidZero()) : factory2.createStrictEquality(createTypeOfExpression(value), createStringLiteral(tag)); + return tag === "null" ? factory2.createStrictEquality(value, createNull()) : tag === "undefined" ? factory2.createStrictEquality(value, createVoidZero()) : factory2.createStrictEquality(createTypeOfExpression(value), createStringLiteral(tag)); + } + function createIsNotTypeCheck(value, tag) { + return tag === "null" ? factory2.createStrictInequality(value, createNull()) : tag === "undefined" ? factory2.createStrictInequality(value, createVoidZero()) : factory2.createStrictInequality(createTypeOfExpression(value), createStringLiteral(tag)); } function createMethodCall(object, methodName, argumentsList) { if (isCallChain(object)) { @@ -23756,17 +23867,17 @@ ${lanes.join("\n")} } function updateOuterExpression(outerExpression, expression) { switch (outerExpression.kind) { - case 216 /* ParenthesizedExpression */: + case 217 /* ParenthesizedExpression */: return updateParenthesizedExpression(outerExpression, expression); - case 215 /* TypeAssertionExpression */: + case 216 /* TypeAssertionExpression */: return updateTypeAssertion(outerExpression, outerExpression.type, expression); - case 233 /* AsExpression */: + case 234 /* AsExpression */: return updateAsExpression(outerExpression, expression, outerExpression.type); - case 237 /* SatisfiesExpression */: + case 238 /* SatisfiesExpression */: return updateSatisfiesExpression(outerExpression, expression, outerExpression.type); - case 234 /* NonNullExpression */: + case 235 /* NonNullExpression */: return updateNonNullExpression(outerExpression, expression); - case 359 /* PartiallyEmittedExpression */: + case 360 /* PartiallyEmittedExpression */: return updatePartiallyEmittedExpression(outerExpression, expression); } } @@ -23806,13 +23917,13 @@ ${lanes.join("\n")} case 10 /* BigIntLiteral */: case 11 /* StringLiteral */: return false; - case 208 /* ArrayLiteralExpression */: + case 209 /* ArrayLiteralExpression */: const elements = target.elements; if (elements.length === 0) { return false; } return true; - case 209 /* ObjectLiteralExpression */: + case 210 /* ObjectLiteralExpression */: return target.properties.length > 0; default: return true; @@ -24075,6 +24186,9 @@ ${lanes.join("\n")} } return isTypeParameterDeclaration(node) ? updateTypeParameterDeclaration(node, modifierArray, node.name, node.constraint, node.default) : isParameter(node) ? updateParameterDeclaration(node, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) : isConstructorTypeNode(node) ? updateConstructorTypeNode1(node, modifierArray, node.typeParameters, node.parameters, node.type) : isPropertySignature(node) ? updatePropertySignature(node, modifierArray, node.name, node.questionToken, node.type) : isPropertyDeclaration(node) ? updatePropertyDeclaration2(node, modifierArray, node.name, node.questionToken ?? node.exclamationToken, node.type, node.initializer) : isMethodSignature(node) ? updateMethodSignature(node, modifierArray, node.name, node.questionToken, node.typeParameters, node.parameters, node.type) : isMethodDeclaration(node) ? updateMethodDeclaration(node, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) : isConstructorDeclaration(node) ? updateConstructorDeclaration(node, modifierArray, node.parameters, node.body) : isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.type, node.body) : isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.body) : isIndexSignatureDeclaration(node) ? updateIndexSignature(node, modifierArray, node.parameters, node.type) : isFunctionExpression(node) ? updateFunctionExpression(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isArrowFunction(node) ? updateArrowFunction(node, modifierArray, node.typeParameters, node.parameters, node.type, node.equalsGreaterThanToken, node.body) : isClassExpression(node) ? updateClassExpression(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isVariableStatement(node) ? updateVariableStatement(node, modifierArray, node.declarationList) : isFunctionDeclaration(node) ? updateFunctionDeclaration(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isClassDeclaration(node) ? updateClassDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isInterfaceDeclaration(node) ? updateInterfaceDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isTypeAliasDeclaration(node) ? updateTypeAliasDeclaration(node, modifierArray, node.name, node.typeParameters, node.type) : isEnumDeclaration(node) ? updateEnumDeclaration(node, modifierArray, node.name, node.members) : isModuleDeclaration(node) ? updateModuleDeclaration(node, modifierArray, node.name, node.body) : isImportEqualsDeclaration(node) ? updateImportEqualsDeclaration(node, modifierArray, node.isTypeOnly, node.name, node.moduleReference) : isImportDeclaration(node) ? updateImportDeclaration(node, modifierArray, node.importClause, node.moduleSpecifier, node.assertClause) : isExportAssignment(node) ? updateExportAssignment(node, modifierArray, node.expression) : isExportDeclaration(node) ? updateExportDeclaration(node, modifierArray, node.isTypeOnly, node.exportClause, node.moduleSpecifier, node.assertClause) : Debug.assertNever(node); } + function updateModifierLike(node, modifierArray) { + return isParameter(node) ? updateParameterDeclaration(node, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) : isPropertyDeclaration(node) ? updatePropertyDeclaration2(node, modifierArray, node.name, node.questionToken ?? node.exclamationToken, node.type, node.initializer) : isMethodDeclaration(node) ? updateMethodDeclaration(node, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) : isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.type, node.body) : isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.body) : isClassExpression(node) ? updateClassExpression(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isClassDeclaration(node) ? updateClassDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : Debug.assertNever(node); + } function asNodeArray(array) { return array ? createNodeArray(array) : void 0; } @@ -24123,43 +24237,43 @@ ${lanes.join("\n")} } function getDefaultTagNameForKind(kind) { switch (kind) { - case 350 /* JSDocTypeTag */: + case 351 /* JSDocTypeTag */: return "type"; - case 348 /* JSDocReturnTag */: + case 349 /* JSDocReturnTag */: return "returns"; - case 349 /* JSDocThisTag */: + case 350 /* JSDocThisTag */: return "this"; - case 346 /* JSDocEnumTag */: + case 347 /* JSDocEnumTag */: return "enum"; - case 336 /* JSDocAuthorTag */: + case 337 /* JSDocAuthorTag */: return "author"; - case 338 /* JSDocClassTag */: + case 339 /* JSDocClassTag */: return "class"; - case 339 /* JSDocPublicTag */: + case 340 /* JSDocPublicTag */: return "public"; - case 340 /* JSDocPrivateTag */: + case 341 /* JSDocPrivateTag */: return "private"; - case 341 /* JSDocProtectedTag */: + case 342 /* JSDocProtectedTag */: return "protected"; - case 342 /* JSDocReadonlyTag */: + case 343 /* JSDocReadonlyTag */: return "readonly"; - case 343 /* JSDocOverrideTag */: + case 344 /* JSDocOverrideTag */: return "override"; - case 351 /* JSDocTemplateTag */: + case 352 /* JSDocTemplateTag */: return "template"; - case 352 /* JSDocTypedefTag */: + case 353 /* JSDocTypedefTag */: return "typedef"; - case 347 /* JSDocParameterTag */: + case 348 /* JSDocParameterTag */: return "param"; - case 354 /* JSDocPropertyTag */: + case 355 /* JSDocPropertyTag */: return "prop"; - case 344 /* JSDocCallbackTag */: + case 345 /* JSDocCallbackTag */: return "callback"; - case 345 /* JSDocOverloadTag */: + case 346 /* JSDocOverloadTag */: return "overload"; - case 334 /* JSDocAugmentsTag */: + case 335 /* JSDocAugmentsTag */: return "augments"; - case 335 /* JSDocImplementsTag */: + case 336 /* JSDocImplementsTag */: return "implements"; default: return Debug.fail(`Unsupported kind: ${Debug.formatSyntaxKind(kind)}`); @@ -24241,77 +24355,77 @@ ${lanes.join("\n")} children.transformFlags = subtreeFlags; } function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 181 /* FirstTypeNode */ && kind <= 204 /* LastTypeNode */) { + if (kind >= 182 /* FirstTypeNode */ && kind <= 205 /* LastTypeNode */) { return -2 /* TypeExcludes */; } switch (kind) { - case 212 /* CallExpression */: - case 213 /* NewExpression */: - case 208 /* ArrayLiteralExpression */: + case 213 /* CallExpression */: + case 214 /* NewExpression */: + case 209 /* ArrayLiteralExpression */: return -2147450880 /* ArrayLiteralOrCallOrNewExcludes */; - case 266 /* ModuleDeclaration */: + case 267 /* ModuleDeclaration */: return -1941676032 /* ModuleExcludes */; - case 168 /* Parameter */: + case 169 /* Parameter */: return -2147483648 /* ParameterExcludes */; - case 218 /* ArrowFunction */: + case 219 /* ArrowFunction */: return -2072174592 /* ArrowFunctionExcludes */; - case 217 /* FunctionExpression */: - case 261 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 262 /* FunctionDeclaration */: return -1937940480 /* FunctionExcludes */; - case 260 /* VariableDeclarationList */: + case 261 /* VariableDeclarationList */: return -2146893824 /* VariableDeclarationListExcludes */; - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: return -2147344384 /* ClassExcludes */; - case 175 /* Constructor */: + case 176 /* Constructor */: return -1937948672 /* ConstructorExcludes */; - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: return -2013249536 /* PropertyExcludes */; - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: return -2005057536 /* MethodOrAccessorExcludes */; case 133 /* AnyKeyword */: case 150 /* NumberKeyword */: - case 162 /* BigIntKeyword */: + case 163 /* BigIntKeyword */: case 146 /* NeverKeyword */: case 154 /* StringKeyword */: case 151 /* ObjectKeyword */: case 136 /* BooleanKeyword */: case 155 /* SymbolKeyword */: case 116 /* VoidKeyword */: - case 167 /* TypeParameter */: - case 170 /* PropertySignature */: - case 172 /* MethodSignature */: - case 178 /* CallSignature */: - case 179 /* ConstructSignature */: - case 180 /* IndexSignature */: - case 263 /* InterfaceDeclaration */: - case 264 /* TypeAliasDeclaration */: + case 168 /* TypeParameter */: + case 171 /* PropertySignature */: + case 173 /* MethodSignature */: + case 179 /* CallSignature */: + case 180 /* ConstructSignature */: + case 181 /* IndexSignature */: + case 264 /* InterfaceDeclaration */: + case 265 /* TypeAliasDeclaration */: return -2 /* TypeExcludes */; - case 209 /* ObjectLiteralExpression */: + case 210 /* ObjectLiteralExpression */: return -2147278848 /* ObjectLiteralExcludes */; - case 298 /* CatchClause */: + case 299 /* CatchClause */: return -2147418112 /* CatchClauseExcludes */; - case 205 /* ObjectBindingPattern */: - case 206 /* ArrayBindingPattern */: + case 206 /* ObjectBindingPattern */: + case 207 /* ArrayBindingPattern */: return -2147450880 /* BindingPatternExcludes */; - case 215 /* TypeAssertionExpression */: - case 237 /* SatisfiesExpression */: - case 233 /* AsExpression */: - case 359 /* PartiallyEmittedExpression */: - case 216 /* ParenthesizedExpression */: + case 216 /* TypeAssertionExpression */: + case 238 /* SatisfiesExpression */: + case 234 /* AsExpression */: + case 360 /* PartiallyEmittedExpression */: + case 217 /* ParenthesizedExpression */: case 108 /* SuperKeyword */: return -2147483648 /* OuterExpressionExcludes */; - case 210 /* PropertyAccessExpression */: - case 211 /* ElementAccessExpression */: + case 211 /* PropertyAccessExpression */: + case 212 /* ElementAccessExpression */: return -2147483648 /* PropertyAccessExcludes */; default: return -2147483648 /* NodeExcludes */; } } function makeSynthetic(node) { - node.flags |= 8 /* Synthesized */; + node.flags |= 16 /* Synthesized */; return node; } function createUnparsedSourceFile(textOrInputFiles, mapPathOrType, mapTextOrStripInternal) { @@ -24560,11 +24674,13 @@ ${lanes.join("\n")} return new (SourceMapSource2 || (SourceMapSource2 = objectAllocator.getSourceMapSourceConstructor()))(fileName, text, skipTrivia2); } function setOriginalNode(node, original) { - node.original = original; - if (original) { - const emitNode = original.emitNode; - if (emitNode) - node.emitNode = mergeEmitNode(emitNode, node.emitNode); + if (node.original !== original) { + node.original = original; + if (original) { + const emitNode = original.emitNode; + if (emitNode) + node.emitNode = mergeEmitNode(emitNode, node.emitNode); + } } return node; } @@ -24580,35 +24696,53 @@ ${lanes.join("\n")} constantValue, helpers, startsOnNewLine, - snippetElement + snippetElement, + classThis, + assignedName } = sourceEmitNode; if (!destEmitNode) destEmitNode = {}; - if (leadingComments) - destEmitNode.leadingComments = addRange(leadingComments.slice(), destEmitNode.leadingComments); - if (trailingComments) - destEmitNode.trailingComments = addRange(trailingComments.slice(), destEmitNode.trailingComments); - if (flags) + if (flags) { destEmitNode.flags = flags; - if (internalFlags) + } + if (internalFlags) { destEmitNode.internalFlags = internalFlags & ~8 /* Immutable */; - if (commentRange) + } + if (leadingComments) { + destEmitNode.leadingComments = addRange(leadingComments.slice(), destEmitNode.leadingComments); + } + if (trailingComments) { + destEmitNode.trailingComments = addRange(trailingComments.slice(), destEmitNode.trailingComments); + } + if (commentRange) { destEmitNode.commentRange = commentRange; - if (sourceMapRange) + } + if (sourceMapRange) { destEmitNode.sourceMapRange = sourceMapRange; - if (tokenSourceMapRanges) + } + if (tokenSourceMapRanges) { destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges); - if (constantValue !== void 0) + } + if (constantValue !== void 0) { destEmitNode.constantValue = constantValue; + } if (helpers) { for (const helper of helpers) { destEmitNode.helpers = appendIfUnique(destEmitNode.helpers, helper); } } - if (startsOnNewLine !== void 0) + if (startsOnNewLine !== void 0) { destEmitNode.startsOnNewLine = startsOnNewLine; - if (snippetElement !== void 0) + } + if (snippetElement !== void 0) { destEmitNode.snippetElement = snippetElement; + } + if (classThis) { + destEmitNode.classThis = classThis; + } + if (assignedName) { + destEmitNode.assignedName = assignedName; + } return destEmitNode; } function mergeTokenSourceMapRanges(sourceRanges, destRanges) { @@ -24651,7 +24785,7 @@ ${lanes.join("\n")} function getOrCreateEmitNode(node) { if (!node.emitNode) { if (isParseTreeNode(node)) { - if (node.kind === 311 /* SourceFile */) { + if (node.kind === 312 /* SourceFile */) { return node.emitNode = { annotatedNodes: [node] }; } const sourceFile = getSourceFileOfNode(getParseTreeNode(getSourceFileOfNode(node))) ?? Debug.fail("Could not determine parsed source file."); @@ -24913,7 +25047,10 @@ ${lanes.join("\n")} // Class Fields Helpers createClassPrivateFieldGetHelper, createClassPrivateFieldSetHelper, - createClassPrivateFieldInHelper + createClassPrivateFieldInHelper, + // 'using' helpers + createAddDisposableResourceHelper, + createDisposeResourcesHelper }; function getUnscopedHelperName(name) { return setEmitFlags(factory2.createIdentifier(name), 8192 /* HelperName */ | 4 /* AdviseOnEmitNode */); @@ -24968,10 +25105,12 @@ ${lanes.join("\n")} ); } function createESDecorateClassContextObject(contextIn) { - return factory2.createObjectLiteralExpression([ + const properties = [ factory2.createPropertyAssignment(factory2.createIdentifier("kind"), factory2.createStringLiteral("class")), - factory2.createPropertyAssignment(factory2.createIdentifier("name"), contextIn.name) - ]); + factory2.createPropertyAssignment(factory2.createIdentifier("name"), contextIn.name), + factory2.createPropertyAssignment(factory2.createIdentifier("metadata"), contextIn.metadata) + ]; + return factory2.createObjectLiteralExpression(properties); } function createESDecorateClassElementAccessGetMethod(elementName) { const accessor = elementName.computed ? factory2.createElementAccessExpression(factory2.createIdentifier("obj"), elementName.name) : factory2.createPropertyAccessExpression(factory2.createIdentifier("obj"), elementName.name); @@ -25075,13 +25214,15 @@ ${lanes.join("\n")} return factory2.createObjectLiteralExpression(properties); } function createESDecorateClassElementContextObject(contextIn) { - return factory2.createObjectLiteralExpression([ + const properties = [ factory2.createPropertyAssignment(factory2.createIdentifier("kind"), factory2.createStringLiteral(contextIn.kind)), factory2.createPropertyAssignment(factory2.createIdentifier("name"), contextIn.name.computed ? contextIn.name.name : factory2.createStringLiteralFromNode(contextIn.name.name)), factory2.createPropertyAssignment(factory2.createIdentifier("static"), contextIn.static ? factory2.createTrue() : factory2.createFalse()), factory2.createPropertyAssignment(factory2.createIdentifier("private"), contextIn.private ? factory2.createTrue() : factory2.createFalse()), - factory2.createPropertyAssignment(factory2.createIdentifier("access"), createESDecorateClassElementAccessObject(contextIn.name, contextIn.access)) - ]); + factory2.createPropertyAssignment(factory2.createIdentifier("access"), createESDecorateClassElementAccessObject(contextIn.name, contextIn.access)), + factory2.createPropertyAssignment(factory2.createIdentifier("metadata"), contextIn.metadata) + ]; + return factory2.createObjectLiteralExpression(properties); } function createESDecorateContextObject(contextIn) { return contextIn.kind === "class" ? createESDecorateClassContextObject(contextIn) : createESDecorateClassElementContextObject(contextIn); @@ -25392,6 +25533,24 @@ ${lanes.join("\n")} [state, receiver] ); } + function createAddDisposableResourceHelper(envBinding, value, async) { + context.requestEmitHelper(addDisposableResourceHelper); + return factory2.createCallExpression( + getUnscopedHelperName("__addDisposableResource"), + /*typeArguments*/ + void 0, + [envBinding, value, async ? factory2.createTrue() : factory2.createFalse()] + ); + } + function createDisposeResourcesHelper(envBinding) { + context.requestEmitHelper(disposeResourcesHelper); + return factory2.createCallExpression( + getUnscopedHelperName("__disposeResources"), + /*typeArguments*/ + void 0, + [envBinding] + ); + } } function compareEmitHelpers(x, y) { if (x === y) @@ -25444,13 +25603,15 @@ ${lanes.join("\n")} classPrivateFieldSetHelper, classPrivateFieldInHelper, createBindingHelper, - setModuleDefaultHelper + setModuleDefaultHelper, + addDisposableResourceHelper, + disposeResourcesHelper ], (helper) => helper.name)); } function isCallToHelper(firstSegment, helperName) { return isCallExpression(firstSegment) && isIdentifier(firstSegment.expression) && (getEmitFlags(firstSegment.expression) & 8192 /* HelperName */) !== 0 && firstSegment.expression.escapedText === helperName; } - var PrivateIdentifierKind, decorateHelper, metadataHelper, paramHelper, esDecorateHelper, runInitializersHelper, assignHelper, awaitHelper, asyncGeneratorHelper, asyncDelegator, asyncValues, restHelper, awaiterHelper, extendsHelper, templateObjectHelper, readHelper, spreadArrayHelper, propKeyHelper, setFunctionNameHelper, valuesHelper, generatorHelper, createBindingHelper, setModuleDefaultHelper, importStarHelper, importDefaultHelper, exportStarHelper, classPrivateFieldGetHelper, classPrivateFieldSetHelper, classPrivateFieldInHelper, allUnscopedEmitHelpers, asyncSuperHelper, advancedAsyncSuperHelper; + var PrivateIdentifierKind, decorateHelper, metadataHelper, paramHelper, esDecorateHelper, runInitializersHelper, assignHelper, awaitHelper, asyncGeneratorHelper, asyncDelegator, asyncValues, restHelper, awaiterHelper, extendsHelper, templateObjectHelper, readHelper, spreadArrayHelper, propKeyHelper, setFunctionNameHelper, valuesHelper, generatorHelper, createBindingHelper, setModuleDefaultHelper, importStarHelper, importDefaultHelper, exportStarHelper, classPrivateFieldGetHelper, classPrivateFieldSetHelper, classPrivateFieldInHelper, addDisposableResourceHelper, disposeResourcesHelper, allUnscopedEmitHelpers, asyncSuperHelper, advancedAsyncSuperHelper; var init_emitHelpers = __esm({ "src/compiler/factory/emitHelpers.ts"() { "use strict"; @@ -25882,6 +26043,63 @@ ${lanes.join("\n")} return typeof state === "function" ? receiver === state : state.has(receiver); };` }; + addDisposableResourceHelper = { + name: "typescript:addDisposableResource", + importName: "__addDisposableResource", + scoped: false, + text: ` + var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) { + if (value !== null && value !== void 0) { + if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); + var dispose; + if (async) { + if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); + dispose = value[Symbol.asyncDispose]; + } + if (dispose === void 0) { + if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); + dispose = value[Symbol.dispose]; + } + if (typeof dispose !== "function") throw new TypeError("Object not disposable."); + env.stack.push({ value: value, dispose: dispose, async: async }); + } + else if (async) { + env.stack.push({ async: true }); + } + return value; + };` + }; + disposeResourcesHelper = { + name: "typescript:disposeResources", + importName: "__disposeResources", + scoped: false, + text: ` + var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) { + return function (env) { + function fail(e) { + env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; + env.hasError = true; + } + function next() { + while (env.stack.length) { + var rec = env.stack.pop(); + try { + var result = rec.dispose && rec.dispose.call(rec.value); + if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); + } + catch (e) { + fail(e); + } + } + if (env.hasError) throw env.error; + } + return next(); + }; + })(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; + });` + }; asyncSuperHelper = { name: "typescript:async-super", scoped: true, @@ -25989,7 +26207,7 @@ ${lanes.join("\n")} return node.kind === 128 /* AbstractKeyword */; } function isOverrideModifier(node) { - return node.kind === 163 /* OverrideKeyword */; + return node.kind === 164 /* OverrideKeyword */; } function isAccessorModifier(node) { return node.kind === 129 /* AccessorKeyword */; @@ -26004,577 +26222,577 @@ ${lanes.join("\n")} return node.kind === 84 /* CaseKeyword */; } function isQualifiedName(node) { - return node.kind === 165 /* QualifiedName */; + return node.kind === 166 /* QualifiedName */; } function isComputedPropertyName(node) { - return node.kind === 166 /* ComputedPropertyName */; + return node.kind === 167 /* ComputedPropertyName */; } function isTypeParameterDeclaration(node) { - return node.kind === 167 /* TypeParameter */; + return node.kind === 168 /* TypeParameter */; } function isParameter(node) { - return node.kind === 168 /* Parameter */; + return node.kind === 169 /* Parameter */; } function isDecorator(node) { - return node.kind === 169 /* Decorator */; + return node.kind === 170 /* Decorator */; } function isPropertySignature(node) { - return node.kind === 170 /* PropertySignature */; + return node.kind === 171 /* PropertySignature */; } function isPropertyDeclaration(node) { - return node.kind === 171 /* PropertyDeclaration */; + return node.kind === 172 /* PropertyDeclaration */; } function isMethodSignature(node) { - return node.kind === 172 /* MethodSignature */; + return node.kind === 173 /* MethodSignature */; } function isMethodDeclaration(node) { - return node.kind === 173 /* MethodDeclaration */; + return node.kind === 174 /* MethodDeclaration */; } function isClassStaticBlockDeclaration(node) { - return node.kind === 174 /* ClassStaticBlockDeclaration */; + return node.kind === 175 /* ClassStaticBlockDeclaration */; } function isConstructorDeclaration(node) { - return node.kind === 175 /* Constructor */; + return node.kind === 176 /* Constructor */; } function isGetAccessorDeclaration(node) { - return node.kind === 176 /* GetAccessor */; + return node.kind === 177 /* GetAccessor */; } function isSetAccessorDeclaration(node) { - return node.kind === 177 /* SetAccessor */; + return node.kind === 178 /* SetAccessor */; } function isCallSignatureDeclaration(node) { - return node.kind === 178 /* CallSignature */; + return node.kind === 179 /* CallSignature */; } function isConstructSignatureDeclaration(node) { - return node.kind === 179 /* ConstructSignature */; + return node.kind === 180 /* ConstructSignature */; } function isIndexSignatureDeclaration(node) { - return node.kind === 180 /* IndexSignature */; + return node.kind === 181 /* IndexSignature */; } function isTypePredicateNode(node) { - return node.kind === 181 /* TypePredicate */; + return node.kind === 182 /* TypePredicate */; } function isTypeReferenceNode(node) { - return node.kind === 182 /* TypeReference */; + return node.kind === 183 /* TypeReference */; } function isFunctionTypeNode(node) { - return node.kind === 183 /* FunctionType */; + return node.kind === 184 /* FunctionType */; } function isConstructorTypeNode(node) { - return node.kind === 184 /* ConstructorType */; + return node.kind === 185 /* ConstructorType */; } function isTypeQueryNode(node) { - return node.kind === 185 /* TypeQuery */; + return node.kind === 186 /* TypeQuery */; } function isTypeLiteralNode(node) { - return node.kind === 186 /* TypeLiteral */; + return node.kind === 187 /* TypeLiteral */; } function isArrayTypeNode(node) { - return node.kind === 187 /* ArrayType */; + return node.kind === 188 /* ArrayType */; } function isTupleTypeNode(node) { - return node.kind === 188 /* TupleType */; + return node.kind === 189 /* TupleType */; } function isNamedTupleMember(node) { - return node.kind === 201 /* NamedTupleMember */; + return node.kind === 202 /* NamedTupleMember */; } function isOptionalTypeNode(node) { - return node.kind === 189 /* OptionalType */; + return node.kind === 190 /* OptionalType */; } function isRestTypeNode(node) { - return node.kind === 190 /* RestType */; + return node.kind === 191 /* RestType */; } function isUnionTypeNode(node) { - return node.kind === 191 /* UnionType */; + return node.kind === 192 /* UnionType */; } function isIntersectionTypeNode(node) { - return node.kind === 192 /* IntersectionType */; + return node.kind === 193 /* IntersectionType */; } function isConditionalTypeNode(node) { - return node.kind === 193 /* ConditionalType */; + return node.kind === 194 /* ConditionalType */; } function isInferTypeNode(node) { - return node.kind === 194 /* InferType */; + return node.kind === 195 /* InferType */; } function isParenthesizedTypeNode(node) { - return node.kind === 195 /* ParenthesizedType */; + return node.kind === 196 /* ParenthesizedType */; } function isThisTypeNode(node) { - return node.kind === 196 /* ThisType */; + return node.kind === 197 /* ThisType */; } function isTypeOperatorNode(node) { - return node.kind === 197 /* TypeOperator */; + return node.kind === 198 /* TypeOperator */; } function isIndexedAccessTypeNode(node) { - return node.kind === 198 /* IndexedAccessType */; + return node.kind === 199 /* IndexedAccessType */; } function isMappedTypeNode(node) { - return node.kind === 199 /* MappedType */; + return node.kind === 200 /* MappedType */; } function isLiteralTypeNode(node) { - return node.kind === 200 /* LiteralType */; + return node.kind === 201 /* LiteralType */; } function isImportTypeNode(node) { - return node.kind === 204 /* ImportType */; + return node.kind === 205 /* ImportType */; } function isTemplateLiteralTypeSpan(node) { - return node.kind === 203 /* TemplateLiteralTypeSpan */; + return node.kind === 204 /* TemplateLiteralTypeSpan */; } function isTemplateLiteralTypeNode(node) { - return node.kind === 202 /* TemplateLiteralType */; + return node.kind === 203 /* TemplateLiteralType */; } function isObjectBindingPattern(node) { - return node.kind === 205 /* ObjectBindingPattern */; + return node.kind === 206 /* ObjectBindingPattern */; } function isArrayBindingPattern(node) { - return node.kind === 206 /* ArrayBindingPattern */; + return node.kind === 207 /* ArrayBindingPattern */; } function isBindingElement(node) { - return node.kind === 207 /* BindingElement */; + return node.kind === 208 /* BindingElement */; } function isArrayLiteralExpression(node) { - return node.kind === 208 /* ArrayLiteralExpression */; + return node.kind === 209 /* ArrayLiteralExpression */; } function isObjectLiteralExpression(node) { - return node.kind === 209 /* ObjectLiteralExpression */; + return node.kind === 210 /* ObjectLiteralExpression */; } function isPropertyAccessExpression(node) { - return node.kind === 210 /* PropertyAccessExpression */; + return node.kind === 211 /* PropertyAccessExpression */; } function isElementAccessExpression(node) { - return node.kind === 211 /* ElementAccessExpression */; + return node.kind === 212 /* ElementAccessExpression */; } function isCallExpression(node) { - return node.kind === 212 /* CallExpression */; + return node.kind === 213 /* CallExpression */; } function isNewExpression(node) { - return node.kind === 213 /* NewExpression */; + return node.kind === 214 /* NewExpression */; } function isTaggedTemplateExpression(node) { - return node.kind === 214 /* TaggedTemplateExpression */; + return node.kind === 215 /* TaggedTemplateExpression */; } function isTypeAssertionExpression(node) { - return node.kind === 215 /* TypeAssertionExpression */; + return node.kind === 216 /* TypeAssertionExpression */; } function isParenthesizedExpression(node) { - return node.kind === 216 /* ParenthesizedExpression */; + return node.kind === 217 /* ParenthesizedExpression */; } function isFunctionExpression(node) { - return node.kind === 217 /* FunctionExpression */; + return node.kind === 218 /* FunctionExpression */; } function isArrowFunction(node) { - return node.kind === 218 /* ArrowFunction */; + return node.kind === 219 /* ArrowFunction */; } function isDeleteExpression(node) { - return node.kind === 219 /* DeleteExpression */; + return node.kind === 220 /* DeleteExpression */; } function isTypeOfExpression(node) { - return node.kind === 220 /* TypeOfExpression */; + return node.kind === 221 /* TypeOfExpression */; } function isVoidExpression(node) { - return node.kind === 221 /* VoidExpression */; + return node.kind === 222 /* VoidExpression */; } function isAwaitExpression(node) { - return node.kind === 222 /* AwaitExpression */; + return node.kind === 223 /* AwaitExpression */; } function isPrefixUnaryExpression(node) { - return node.kind === 223 /* PrefixUnaryExpression */; + return node.kind === 224 /* PrefixUnaryExpression */; } function isPostfixUnaryExpression(node) { - return node.kind === 224 /* PostfixUnaryExpression */; + return node.kind === 225 /* PostfixUnaryExpression */; } function isBinaryExpression(node) { - return node.kind === 225 /* BinaryExpression */; + return node.kind === 226 /* BinaryExpression */; } function isConditionalExpression(node) { - return node.kind === 226 /* ConditionalExpression */; + return node.kind === 227 /* ConditionalExpression */; } function isTemplateExpression(node) { - return node.kind === 227 /* TemplateExpression */; + return node.kind === 228 /* TemplateExpression */; } function isYieldExpression(node) { - return node.kind === 228 /* YieldExpression */; + return node.kind === 229 /* YieldExpression */; } function isSpreadElement(node) { - return node.kind === 229 /* SpreadElement */; + return node.kind === 230 /* SpreadElement */; } function isClassExpression(node) { - return node.kind === 230 /* ClassExpression */; + return node.kind === 231 /* ClassExpression */; } function isOmittedExpression(node) { - return node.kind === 231 /* OmittedExpression */; + return node.kind === 232 /* OmittedExpression */; } function isExpressionWithTypeArguments(node) { - return node.kind === 232 /* ExpressionWithTypeArguments */; + return node.kind === 233 /* ExpressionWithTypeArguments */; } function isAsExpression(node) { - return node.kind === 233 /* AsExpression */; + return node.kind === 234 /* AsExpression */; } function isSatisfiesExpression(node) { - return node.kind === 237 /* SatisfiesExpression */; + return node.kind === 238 /* SatisfiesExpression */; } function isNonNullExpression(node) { - return node.kind === 234 /* NonNullExpression */; + return node.kind === 235 /* NonNullExpression */; } function isMetaProperty(node) { - return node.kind === 235 /* MetaProperty */; + return node.kind === 236 /* MetaProperty */; } function isSyntheticExpression(node) { - return node.kind === 236 /* SyntheticExpression */; + return node.kind === 237 /* SyntheticExpression */; } function isPartiallyEmittedExpression(node) { - return node.kind === 359 /* PartiallyEmittedExpression */; + return node.kind === 360 /* PartiallyEmittedExpression */; } function isCommaListExpression(node) { - return node.kind === 360 /* CommaListExpression */; + return node.kind === 361 /* CommaListExpression */; } function isTemplateSpan(node) { - return node.kind === 238 /* TemplateSpan */; + return node.kind === 239 /* TemplateSpan */; } function isSemicolonClassElement(node) { - return node.kind === 239 /* SemicolonClassElement */; + return node.kind === 240 /* SemicolonClassElement */; } function isBlock(node) { - return node.kind === 240 /* Block */; + return node.kind === 241 /* Block */; } function isVariableStatement(node) { - return node.kind === 242 /* VariableStatement */; + return node.kind === 243 /* VariableStatement */; } function isEmptyStatement(node) { - return node.kind === 241 /* EmptyStatement */; + return node.kind === 242 /* EmptyStatement */; } function isExpressionStatement(node) { - return node.kind === 243 /* ExpressionStatement */; + return node.kind === 244 /* ExpressionStatement */; } function isIfStatement(node) { - return node.kind === 244 /* IfStatement */; + return node.kind === 245 /* IfStatement */; } function isDoStatement(node) { - return node.kind === 245 /* DoStatement */; + return node.kind === 246 /* DoStatement */; } function isWhileStatement(node) { - return node.kind === 246 /* WhileStatement */; + return node.kind === 247 /* WhileStatement */; } function isForStatement(node) { - return node.kind === 247 /* ForStatement */; + return node.kind === 248 /* ForStatement */; } function isForInStatement(node) { - return node.kind === 248 /* ForInStatement */; + return node.kind === 249 /* ForInStatement */; } function isForOfStatement(node) { - return node.kind === 249 /* ForOfStatement */; + return node.kind === 250 /* ForOfStatement */; } function isContinueStatement(node) { - return node.kind === 250 /* ContinueStatement */; + return node.kind === 251 /* ContinueStatement */; } function isBreakStatement(node) { - return node.kind === 251 /* BreakStatement */; + return node.kind === 252 /* BreakStatement */; } function isReturnStatement(node) { - return node.kind === 252 /* ReturnStatement */; + return node.kind === 253 /* ReturnStatement */; } function isWithStatement(node) { - return node.kind === 253 /* WithStatement */; + return node.kind === 254 /* WithStatement */; } function isSwitchStatement(node) { - return node.kind === 254 /* SwitchStatement */; + return node.kind === 255 /* SwitchStatement */; } function isLabeledStatement(node) { - return node.kind === 255 /* LabeledStatement */; + return node.kind === 256 /* LabeledStatement */; } function isThrowStatement(node) { - return node.kind === 256 /* ThrowStatement */; + return node.kind === 257 /* ThrowStatement */; } function isTryStatement(node) { - return node.kind === 257 /* TryStatement */; + return node.kind === 258 /* TryStatement */; } function isDebuggerStatement(node) { - return node.kind === 258 /* DebuggerStatement */; + return node.kind === 259 /* DebuggerStatement */; } function isVariableDeclaration(node) { - return node.kind === 259 /* VariableDeclaration */; + return node.kind === 260 /* VariableDeclaration */; } function isVariableDeclarationList(node) { - return node.kind === 260 /* VariableDeclarationList */; + return node.kind === 261 /* VariableDeclarationList */; } function isFunctionDeclaration(node) { - return node.kind === 261 /* FunctionDeclaration */; + return node.kind === 262 /* FunctionDeclaration */; } function isClassDeclaration(node) { - return node.kind === 262 /* ClassDeclaration */; + return node.kind === 263 /* ClassDeclaration */; } function isInterfaceDeclaration(node) { - return node.kind === 263 /* InterfaceDeclaration */; + return node.kind === 264 /* InterfaceDeclaration */; } function isTypeAliasDeclaration(node) { - return node.kind === 264 /* TypeAliasDeclaration */; + return node.kind === 265 /* TypeAliasDeclaration */; } function isEnumDeclaration(node) { - return node.kind === 265 /* EnumDeclaration */; + return node.kind === 266 /* EnumDeclaration */; } function isModuleDeclaration(node) { - return node.kind === 266 /* ModuleDeclaration */; + return node.kind === 267 /* ModuleDeclaration */; } function isModuleBlock(node) { - return node.kind === 267 /* ModuleBlock */; + return node.kind === 268 /* ModuleBlock */; } function isCaseBlock(node) { - return node.kind === 268 /* CaseBlock */; + return node.kind === 269 /* CaseBlock */; } function isNamespaceExportDeclaration(node) { - return node.kind === 269 /* NamespaceExportDeclaration */; + return node.kind === 270 /* NamespaceExportDeclaration */; } function isImportEqualsDeclaration(node) { - return node.kind === 270 /* ImportEqualsDeclaration */; + return node.kind === 271 /* ImportEqualsDeclaration */; } function isImportDeclaration(node) { - return node.kind === 271 /* ImportDeclaration */; + return node.kind === 272 /* ImportDeclaration */; } function isImportClause(node) { - return node.kind === 272 /* ImportClause */; + return node.kind === 273 /* ImportClause */; } function isImportTypeAssertionContainer(node) { - return node.kind === 301 /* ImportTypeAssertionContainer */; + return node.kind === 302 /* ImportTypeAssertionContainer */; } function isAssertClause(node) { - return node.kind === 299 /* AssertClause */; + return node.kind === 300 /* AssertClause */; } function isAssertEntry(node) { - return node.kind === 300 /* AssertEntry */; + return node.kind === 301 /* AssertEntry */; } function isNamespaceImport(node) { - return node.kind === 273 /* NamespaceImport */; + return node.kind === 274 /* NamespaceImport */; } function isNamespaceExport(node) { - return node.kind === 279 /* NamespaceExport */; + return node.kind === 280 /* NamespaceExport */; } function isNamedImports(node) { - return node.kind === 274 /* NamedImports */; + return node.kind === 275 /* NamedImports */; } function isImportSpecifier(node) { - return node.kind === 275 /* ImportSpecifier */; + return node.kind === 276 /* ImportSpecifier */; } function isExportAssignment(node) { - return node.kind === 276 /* ExportAssignment */; + return node.kind === 277 /* ExportAssignment */; } function isExportDeclaration(node) { - return node.kind === 277 /* ExportDeclaration */; + return node.kind === 278 /* ExportDeclaration */; } function isNamedExports(node) { - return node.kind === 278 /* NamedExports */; + return node.kind === 279 /* NamedExports */; } function isExportSpecifier(node) { - return node.kind === 280 /* ExportSpecifier */; + return node.kind === 281 /* ExportSpecifier */; } function isMissingDeclaration(node) { - return node.kind === 281 /* MissingDeclaration */; + return node.kind === 282 /* MissingDeclaration */; } function isNotEmittedStatement(node) { - return node.kind === 358 /* NotEmittedStatement */; + return node.kind === 359 /* NotEmittedStatement */; } function isSyntheticReference(node) { - return node.kind === 361 /* SyntheticReferenceExpression */; + return node.kind === 362 /* SyntheticReferenceExpression */; } function isExternalModuleReference(node) { - return node.kind === 282 /* ExternalModuleReference */; + return node.kind === 283 /* ExternalModuleReference */; } function isJsxElement(node) { - return node.kind === 283 /* JsxElement */; + return node.kind === 284 /* JsxElement */; } function isJsxSelfClosingElement(node) { - return node.kind === 284 /* JsxSelfClosingElement */; + return node.kind === 285 /* JsxSelfClosingElement */; } function isJsxOpeningElement(node) { - return node.kind === 285 /* JsxOpeningElement */; + return node.kind === 286 /* JsxOpeningElement */; } function isJsxClosingElement(node) { - return node.kind === 286 /* JsxClosingElement */; + return node.kind === 287 /* JsxClosingElement */; } function isJsxFragment(node) { - return node.kind === 287 /* JsxFragment */; + return node.kind === 288 /* JsxFragment */; } function isJsxOpeningFragment(node) { - return node.kind === 288 /* JsxOpeningFragment */; + return node.kind === 289 /* JsxOpeningFragment */; } function isJsxClosingFragment(node) { - return node.kind === 289 /* JsxClosingFragment */; + return node.kind === 290 /* JsxClosingFragment */; } function isJsxAttribute(node) { - return node.kind === 290 /* JsxAttribute */; + return node.kind === 291 /* JsxAttribute */; } function isJsxAttributes(node) { - return node.kind === 291 /* JsxAttributes */; + return node.kind === 292 /* JsxAttributes */; } function isJsxSpreadAttribute(node) { - return node.kind === 292 /* JsxSpreadAttribute */; + return node.kind === 293 /* JsxSpreadAttribute */; } function isJsxExpression(node) { - return node.kind === 293 /* JsxExpression */; + return node.kind === 294 /* JsxExpression */; } function isJsxNamespacedName(node) { - return node.kind === 294 /* JsxNamespacedName */; + return node.kind === 295 /* JsxNamespacedName */; } function isCaseClause(node) { - return node.kind === 295 /* CaseClause */; + return node.kind === 296 /* CaseClause */; } function isDefaultClause(node) { - return node.kind === 296 /* DefaultClause */; + return node.kind === 297 /* DefaultClause */; } function isHeritageClause(node) { - return node.kind === 297 /* HeritageClause */; + return node.kind === 298 /* HeritageClause */; } function isCatchClause(node) { - return node.kind === 298 /* CatchClause */; + return node.kind === 299 /* CatchClause */; } function isPropertyAssignment(node) { - return node.kind === 302 /* PropertyAssignment */; + return node.kind === 303 /* PropertyAssignment */; } function isShorthandPropertyAssignment(node) { - return node.kind === 303 /* ShorthandPropertyAssignment */; + return node.kind === 304 /* ShorthandPropertyAssignment */; } function isSpreadAssignment(node) { - return node.kind === 304 /* SpreadAssignment */; + return node.kind === 305 /* SpreadAssignment */; } function isEnumMember(node) { - return node.kind === 305 /* EnumMember */; + return node.kind === 306 /* EnumMember */; } function isUnparsedPrepend(node) { - return node.kind === 307 /* UnparsedPrepend */; + return node.kind === 308 /* UnparsedPrepend */; } function isSourceFile(node) { - return node.kind === 311 /* SourceFile */; + return node.kind === 312 /* SourceFile */; } function isBundle(node) { - return node.kind === 312 /* Bundle */; + return node.kind === 313 /* Bundle */; } function isUnparsedSource(node) { - return node.kind === 313 /* UnparsedSource */; + return node.kind === 314 /* UnparsedSource */; } function isJSDocTypeExpression(node) { - return node.kind === 315 /* JSDocTypeExpression */; + return node.kind === 316 /* JSDocTypeExpression */; } function isJSDocNameReference(node) { - return node.kind === 316 /* JSDocNameReference */; + return node.kind === 317 /* JSDocNameReference */; } function isJSDocMemberName(node) { - return node.kind === 317 /* JSDocMemberName */; + return node.kind === 318 /* JSDocMemberName */; } function isJSDocLink(node) { - return node.kind === 330 /* JSDocLink */; + return node.kind === 331 /* JSDocLink */; } function isJSDocLinkCode(node) { - return node.kind === 331 /* JSDocLinkCode */; + return node.kind === 332 /* JSDocLinkCode */; } function isJSDocLinkPlain(node) { - return node.kind === 332 /* JSDocLinkPlain */; + return node.kind === 333 /* JSDocLinkPlain */; } function isJSDocAllType(node) { - return node.kind === 318 /* JSDocAllType */; + return node.kind === 319 /* JSDocAllType */; } function isJSDocUnknownType(node) { - return node.kind === 319 /* JSDocUnknownType */; + return node.kind === 320 /* JSDocUnknownType */; } function isJSDocNullableType(node) { - return node.kind === 320 /* JSDocNullableType */; + return node.kind === 321 /* JSDocNullableType */; } function isJSDocNonNullableType(node) { - return node.kind === 321 /* JSDocNonNullableType */; + return node.kind === 322 /* JSDocNonNullableType */; } function isJSDocOptionalType(node) { - return node.kind === 322 /* JSDocOptionalType */; + return node.kind === 323 /* JSDocOptionalType */; } function isJSDocFunctionType(node) { - return node.kind === 323 /* JSDocFunctionType */; + return node.kind === 324 /* JSDocFunctionType */; } function isJSDocVariadicType(node) { - return node.kind === 324 /* JSDocVariadicType */; + return node.kind === 325 /* JSDocVariadicType */; } function isJSDocNamepathType(node) { - return node.kind === 325 /* JSDocNamepathType */; + return node.kind === 326 /* JSDocNamepathType */; } function isJSDoc(node) { - return node.kind === 326 /* JSDoc */; + return node.kind === 327 /* JSDoc */; } function isJSDocTypeLiteral(node) { - return node.kind === 328 /* JSDocTypeLiteral */; + return node.kind === 329 /* JSDocTypeLiteral */; } function isJSDocSignature(node) { - return node.kind === 329 /* JSDocSignature */; + return node.kind === 330 /* JSDocSignature */; } function isJSDocAugmentsTag(node) { - return node.kind === 334 /* JSDocAugmentsTag */; + return node.kind === 335 /* JSDocAugmentsTag */; } function isJSDocAuthorTag(node) { - return node.kind === 336 /* JSDocAuthorTag */; + return node.kind === 337 /* JSDocAuthorTag */; } function isJSDocClassTag(node) { - return node.kind === 338 /* JSDocClassTag */; + return node.kind === 339 /* JSDocClassTag */; } function isJSDocCallbackTag(node) { - return node.kind === 344 /* JSDocCallbackTag */; + return node.kind === 345 /* JSDocCallbackTag */; } function isJSDocPublicTag(node) { - return node.kind === 339 /* JSDocPublicTag */; + return node.kind === 340 /* JSDocPublicTag */; } function isJSDocPrivateTag(node) { - return node.kind === 340 /* JSDocPrivateTag */; + return node.kind === 341 /* JSDocPrivateTag */; } function isJSDocProtectedTag(node) { - return node.kind === 341 /* JSDocProtectedTag */; + return node.kind === 342 /* JSDocProtectedTag */; } function isJSDocReadonlyTag(node) { - return node.kind === 342 /* JSDocReadonlyTag */; + return node.kind === 343 /* JSDocReadonlyTag */; } function isJSDocOverrideTag(node) { - return node.kind === 343 /* JSDocOverrideTag */; + return node.kind === 344 /* JSDocOverrideTag */; } function isJSDocOverloadTag(node) { - return node.kind === 345 /* JSDocOverloadTag */; + return node.kind === 346 /* JSDocOverloadTag */; } function isJSDocDeprecatedTag(node) { - return node.kind === 337 /* JSDocDeprecatedTag */; + return node.kind === 338 /* JSDocDeprecatedTag */; } function isJSDocSeeTag(node) { - return node.kind === 353 /* JSDocSeeTag */; + return node.kind === 354 /* JSDocSeeTag */; } function isJSDocEnumTag(node) { - return node.kind === 346 /* JSDocEnumTag */; + return node.kind === 347 /* JSDocEnumTag */; } function isJSDocParameterTag(node) { - return node.kind === 347 /* JSDocParameterTag */; + return node.kind === 348 /* JSDocParameterTag */; } function isJSDocReturnTag(node) { - return node.kind === 348 /* JSDocReturnTag */; + return node.kind === 349 /* JSDocReturnTag */; } function isJSDocThisTag(node) { - return node.kind === 349 /* JSDocThisTag */; + return node.kind === 350 /* JSDocThisTag */; } function isJSDocTypeTag(node) { - return node.kind === 350 /* JSDocTypeTag */; + return node.kind === 351 /* JSDocTypeTag */; } function isJSDocTemplateTag(node) { - return node.kind === 351 /* JSDocTemplateTag */; + return node.kind === 352 /* JSDocTemplateTag */; } function isJSDocTypedefTag(node) { - return node.kind === 352 /* JSDocTypedefTag */; + return node.kind === 353 /* JSDocTypedefTag */; } function isJSDocUnknownTag(node) { - return node.kind === 333 /* JSDocTag */; + return node.kind === 334 /* JSDocTag */; } function isJSDocPropertyTag(node) { - return node.kind === 354 /* JSDocPropertyTag */; + return node.kind === 355 /* JSDocPropertyTag */; } function isJSDocImplementsTag(node) { - return node.kind === 335 /* JSDocImplementsTag */; + return node.kind === 336 /* JSDocImplementsTag */; } function isJSDocSatisfiesTag(node) { - return node.kind === 356 /* JSDocSatisfiesTag */; + return node.kind === 357 /* JSDocSatisfiesTag */; } function isJSDocThrowsTag(node) { - return node.kind === 355 /* JSDocThrowsTag */; + return node.kind === 356 /* JSDocThrowsTag */; } function isSyntaxList(n) { - return n.kind === 357 /* SyntaxList */; + return n.kind === 358 /* SyntaxList */; } var init_nodeTests = __esm({ "src/compiler/factory/nodeTests.ts"() { @@ -26888,14 +27106,14 @@ ${lanes.join("\n")} Debug.failBadSyntaxKind(property.name, "Private identifiers are not allowed in object literals."); } switch (property.kind) { - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: return createExpressionForAccessorDeclaration(factory2, node.properties, property, receiver, !!node.multiLine); - case 302 /* PropertyAssignment */: + case 303 /* PropertyAssignment */: return createExpressionForPropertyAssignment(factory2, property, receiver); - case 303 /* ShorthandPropertyAssignment */: + case 304 /* ShorthandPropertyAssignment */: return createExpressionForShorthandPropertyAssignment(factory2, property, receiver); - case 173 /* MethodDeclaration */: + case 174 /* MethodDeclaration */: return createExpressionForMethodDeclaration(factory2, property, receiver); } } @@ -26948,7 +27166,7 @@ ${lanes.join("\n")} return firstStatement !== void 0 && isPrologueDirective(firstStatement) && isUseStrictPrologue(firstStatement); } function isCommaExpression(node) { - return node.kind === 225 /* BinaryExpression */ && node.operatorToken.kind === 28 /* CommaToken */; + return node.kind === 226 /* BinaryExpression */ && node.operatorToken.kind === 28 /* CommaToken */; } function isCommaSequence(node) { return isCommaExpression(node) || isCommaListExpression(node); @@ -26963,19 +27181,19 @@ ${lanes.join("\n")} } function isOuterExpression(node, kinds = 15 /* All */) { switch (node.kind) { - case 216 /* ParenthesizedExpression */: + case 217 /* ParenthesizedExpression */: if (kinds & 16 /* ExcludeJSDocTypeAssertion */ && isJSDocTypeAssertion(node)) { return false; } return (kinds & 1 /* Parentheses */) !== 0; - case 215 /* TypeAssertionExpression */: - case 233 /* AsExpression */: - case 232 /* ExpressionWithTypeArguments */: - case 237 /* SatisfiesExpression */: + case 216 /* TypeAssertionExpression */: + case 234 /* AsExpression */: + case 233 /* ExpressionWithTypeArguments */: + case 238 /* SatisfiesExpression */: return (kinds & 2 /* TypeAssertions */) !== 0; - case 234 /* NonNullExpression */: + case 235 /* NonNullExpression */: return (kinds & 4 /* NonNullAssertions */) !== 0; - case 359 /* PartiallyEmittedExpression */: + case 360 /* PartiallyEmittedExpression */: return (kinds & 8 /* PartiallyEmittedExpressions */) !== 0; } return false; @@ -27112,10 +27330,10 @@ ${lanes.join("\n")} const name = namespaceDeclaration.name; return isGeneratedIdentifier(name) ? name : factory2.createIdentifier(getSourceTextOfNodeFromSourceFile(sourceFile, name) || idText(name)); } - if (node.kind === 271 /* ImportDeclaration */ && node.importClause) { + if (node.kind === 272 /* ImportDeclaration */ && node.importClause) { return factory2.getGeneratedNameForNode(node); } - if (node.kind === 277 /* ExportDeclaration */ && node.moduleSpecifier) { + if (node.kind === 278 /* ExportDeclaration */ && node.moduleSpecifier) { return factory2.getGeneratedNameForNode(node); } return void 0; @@ -27178,11 +27396,11 @@ ${lanes.join("\n")} } if (isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 302 /* PropertyAssignment */: + case 303 /* PropertyAssignment */: return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 303 /* ShorthandPropertyAssignment */: + case 304 /* ShorthandPropertyAssignment */: return bindingElement.name; - case 304 /* SpreadAssignment */: + case 305 /* SpreadAssignment */: return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } return void 0; @@ -27201,11 +27419,11 @@ ${lanes.join("\n")} } function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 168 /* Parameter */: - case 207 /* BindingElement */: + case 169 /* Parameter */: + case 208 /* BindingElement */: return bindingElement.dotDotDotToken; - case 229 /* SpreadElement */: - case 304 /* SpreadAssignment */: + case 230 /* SpreadElement */: + case 305 /* SpreadAssignment */: return bindingElement; } return void 0; @@ -27217,7 +27435,7 @@ ${lanes.join("\n")} } function tryGetPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 207 /* BindingElement */: + case 208 /* BindingElement */: if (bindingElement.propertyName) { const propertyName = bindingElement.propertyName; if (isPrivateIdentifier(propertyName)) { @@ -27226,7 +27444,7 @@ ${lanes.join("\n")} return isComputedPropertyName(propertyName) && isStringOrNumericLiteral(propertyName.expression) ? propertyName.expression : propertyName; } break; - case 302 /* PropertyAssignment */: + case 303 /* PropertyAssignment */: if (bindingElement.name) { const propertyName = bindingElement.name; if (isPrivateIdentifier(propertyName)) { @@ -27235,7 +27453,7 @@ ${lanes.join("\n")} return isComputedPropertyName(propertyName) && isStringOrNumericLiteral(propertyName.expression) ? propertyName.expression : propertyName; } break; - case 304 /* SpreadAssignment */: + case 305 /* SpreadAssignment */: if (bindingElement.name && isPrivateIdentifier(bindingElement.name)) { return Debug.failBadSyntaxKind(bindingElement.name); } @@ -27252,11 +27470,11 @@ ${lanes.join("\n")} } function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 205 /* ObjectBindingPattern */: - case 206 /* ArrayBindingPattern */: - case 208 /* ArrayLiteralExpression */: + case 206 /* ObjectBindingPattern */: + case 207 /* ArrayBindingPattern */: + case 209 /* ArrayLiteralExpression */: return name.elements; - case 209 /* ObjectLiteralExpression */: + case 210 /* ObjectLiteralExpression */: return name.properties; } } @@ -27273,19 +27491,19 @@ ${lanes.join("\n")} } function canHaveIllegalType(node) { const kind = node.kind; - return kind === 175 /* Constructor */ || kind === 177 /* SetAccessor */; + return kind === 176 /* Constructor */ || kind === 178 /* SetAccessor */; } function canHaveIllegalTypeParameters(node) { const kind = node.kind; - return kind === 175 /* Constructor */ || kind === 176 /* GetAccessor */ || kind === 177 /* SetAccessor */; + return kind === 176 /* Constructor */ || kind === 177 /* GetAccessor */ || kind === 178 /* SetAccessor */; } function canHaveIllegalDecorators(node) { const kind = node.kind; - return kind === 302 /* PropertyAssignment */ || kind === 303 /* ShorthandPropertyAssignment */ || kind === 261 /* FunctionDeclaration */ || kind === 175 /* Constructor */ || kind === 180 /* IndexSignature */ || kind === 174 /* ClassStaticBlockDeclaration */ || kind === 281 /* MissingDeclaration */ || kind === 242 /* VariableStatement */ || kind === 263 /* InterfaceDeclaration */ || kind === 264 /* TypeAliasDeclaration */ || kind === 265 /* EnumDeclaration */ || kind === 266 /* ModuleDeclaration */ || kind === 270 /* ImportEqualsDeclaration */ || kind === 271 /* ImportDeclaration */ || kind === 269 /* NamespaceExportDeclaration */ || kind === 277 /* ExportDeclaration */ || kind === 276 /* ExportAssignment */; + return kind === 303 /* PropertyAssignment */ || kind === 304 /* ShorthandPropertyAssignment */ || kind === 262 /* FunctionDeclaration */ || kind === 176 /* Constructor */ || kind === 181 /* IndexSignature */ || kind === 175 /* ClassStaticBlockDeclaration */ || kind === 282 /* MissingDeclaration */ || kind === 243 /* VariableStatement */ || kind === 264 /* InterfaceDeclaration */ || kind === 265 /* TypeAliasDeclaration */ || kind === 266 /* EnumDeclaration */ || kind === 267 /* ModuleDeclaration */ || kind === 271 /* ImportEqualsDeclaration */ || kind === 272 /* ImportDeclaration */ || kind === 270 /* NamespaceExportDeclaration */ || kind === 278 /* ExportDeclaration */ || kind === 277 /* ExportAssignment */; } function canHaveIllegalModifiers(node) { const kind = node.kind; - return kind === 174 /* ClassStaticBlockDeclaration */ || kind === 302 /* PropertyAssignment */ || kind === 303 /* ShorthandPropertyAssignment */ || kind === 281 /* MissingDeclaration */ || kind === 269 /* NamespaceExportDeclaration */; + return kind === 175 /* ClassStaticBlockDeclaration */ || kind === 303 /* PropertyAssignment */ || kind === 304 /* ShorthandPropertyAssignment */ || kind === 282 /* MissingDeclaration */ || kind === 270 /* NamespaceExportDeclaration */; } function isQuestionOrExclamationToken(node) { return isQuestionToken(node) || isExclamationToken(node); @@ -27452,7 +27670,7 @@ ${lanes.join("\n")} initializer ); } - function createAccessorPropertyGetRedirector(factory2, node, modifiers, name) { + function createAccessorPropertyGetRedirector(factory2, node, modifiers, name, receiver = factory2.createThis()) { return factory2.createGetAccessorDeclaration( modifiers, name, @@ -27462,7 +27680,7 @@ ${lanes.join("\n")} factory2.createBlock([ factory2.createReturnStatement( factory2.createPropertyAccessExpression( - factory2.createThis(), + receiver, factory2.getGeneratedPrivateNameForNode( node.name, /*prefix*/ @@ -27474,7 +27692,7 @@ ${lanes.join("\n")} ]) ); } - function createAccessorPropertySetRedirector(factory2, node, modifiers, name) { + function createAccessorPropertySetRedirector(factory2, node, modifiers, name, receiver = factory2.createThis()) { return factory2.createSetAccessorDeclaration( modifiers, name, @@ -27489,7 +27707,7 @@ ${lanes.join("\n")} factory2.createExpressionStatement( factory2.createAssignment( factory2.createPropertyAccessExpression( - factory2.createThis(), + receiver, factory2.getGeneratedPrivateNameForNode( node.name, /*prefix*/ @@ -27690,11 +27908,11 @@ ${lanes.join("\n")} } function canHaveModifiers(node) { const kind = node.kind; - return kind === 167 /* TypeParameter */ || kind === 168 /* Parameter */ || kind === 170 /* PropertySignature */ || kind === 171 /* PropertyDeclaration */ || kind === 172 /* MethodSignature */ || kind === 173 /* MethodDeclaration */ || kind === 175 /* Constructor */ || kind === 176 /* GetAccessor */ || kind === 177 /* SetAccessor */ || kind === 180 /* IndexSignature */ || kind === 184 /* ConstructorType */ || kind === 217 /* FunctionExpression */ || kind === 218 /* ArrowFunction */ || kind === 230 /* ClassExpression */ || kind === 242 /* VariableStatement */ || kind === 261 /* FunctionDeclaration */ || kind === 262 /* ClassDeclaration */ || kind === 263 /* InterfaceDeclaration */ || kind === 264 /* TypeAliasDeclaration */ || kind === 265 /* EnumDeclaration */ || kind === 266 /* ModuleDeclaration */ || kind === 270 /* ImportEqualsDeclaration */ || kind === 271 /* ImportDeclaration */ || kind === 276 /* ExportAssignment */ || kind === 277 /* ExportDeclaration */; + return kind === 168 /* TypeParameter */ || kind === 169 /* Parameter */ || kind === 171 /* PropertySignature */ || kind === 172 /* PropertyDeclaration */ || kind === 173 /* MethodSignature */ || kind === 174 /* MethodDeclaration */ || kind === 176 /* Constructor */ || kind === 177 /* GetAccessor */ || kind === 178 /* SetAccessor */ || kind === 181 /* IndexSignature */ || kind === 185 /* ConstructorType */ || kind === 218 /* FunctionExpression */ || kind === 219 /* ArrowFunction */ || kind === 231 /* ClassExpression */ || kind === 243 /* VariableStatement */ || kind === 262 /* FunctionDeclaration */ || kind === 263 /* ClassDeclaration */ || kind === 264 /* InterfaceDeclaration */ || kind === 265 /* TypeAliasDeclaration */ || kind === 266 /* EnumDeclaration */ || kind === 267 /* ModuleDeclaration */ || kind === 271 /* ImportEqualsDeclaration */ || kind === 272 /* ImportDeclaration */ || kind === 277 /* ExportAssignment */ || kind === 278 /* ExportDeclaration */; } function canHaveDecorators(node) { const kind = node.kind; - return kind === 168 /* Parameter */ || kind === 171 /* PropertyDeclaration */ || kind === 173 /* MethodDeclaration */ || kind === 176 /* GetAccessor */ || kind === 177 /* SetAccessor */ || kind === 230 /* ClassExpression */ || kind === 262 /* ClassDeclaration */; + return kind === 169 /* Parameter */ || kind === 172 /* PropertyDeclaration */ || kind === 174 /* MethodDeclaration */ || kind === 177 /* GetAccessor */ || kind === 178 /* SetAccessor */ || kind === 231 /* ClassExpression */ || kind === 263 /* ClassDeclaration */; } var init_utilitiesPublic2 = __esm({ "src/compiler/factory/utilitiesPublic.ts"() { @@ -27730,7 +27948,7 @@ ${lanes.join("\n")} return canHaveModifiers(node) && hasModifierOfKind(node, 95 /* ExportKeyword */) || isImportEqualsDeclaration(node) && isExternalModuleReference(node.moduleReference) || isImportDeclaration(node) || isExportAssignment(node) || isExportDeclaration(node) ? node : void 0; } function getImportMetaIfNecessary(sourceFile) { - return sourceFile.flags & 4194304 /* PossiblyContainsImportMeta */ ? walkTreeForImportMeta(sourceFile) : void 0; + return sourceFile.flags & 8388608 /* PossiblyContainsImportMeta */ ? walkTreeForImportMeta(sourceFile) : void 0; } function walkTreeForImportMeta(node) { return isImportMeta2(node) ? node : forEachChild(node, walkTreeForImportMeta); @@ -27794,7 +28012,7 @@ ${lanes.join("\n")} return visitNode2(cbNode, node.expression); } function forEachChild(node, cbNode, cbNodes) { - if (node === void 0 || node.kind <= 164 /* LastToken */) { + if (node === void 0 || node.kind <= 165 /* LastToken */) { return; } const fn = forEachChildTable[node.kind]; @@ -27829,7 +28047,7 @@ ${lanes.join("\n")} continue; return res; } - if (current.kind >= 165 /* FirstNode */) { + if (current.kind >= 166 /* FirstNode */) { for (const child of gatherPossibleChildren(current)) { queue.push(child); parents.push(current); @@ -27910,7 +28128,7 @@ ${lanes.join("\n")} } function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks = false) { const newSourceFile = IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks); - newSourceFile.flags |= sourceFile.flags & 6291456 /* PermanentlySetIncrementalFlags */; + newSourceFile.flags |= sourceFile.flags & 12582912 /* PermanentlySetIncrementalFlags */; return newSourceFile; } function parseIsolatedJSDocComment(content, start, length2) { @@ -28131,7 +28349,7 @@ ${lanes.join("\n")} if (lhs.kind === 110 /* ThisKeyword */) { return true; } - if (lhs.kind === 294 /* JsxNamespacedName */) { + if (lhs.kind === 295 /* JsxNamespacedName */) { return lhs.namespace.escapedText === rhs.namespace.escapedText && lhs.name.escapedText === rhs.name.escapedText; } return lhs.name.escapedText === rhs.name.escapedText && tagNamesAreEquivalent(lhs.expression, rhs.expression); @@ -28151,428 +28369,428 @@ ${lanes.join("\n")} }; parseNodeFactory = createNodeFactory(1 /* NoParenthesizerRules */, parseBaseNodeFactory); forEachChildTable = { - [165 /* QualifiedName */]: function forEachChildInQualifiedName(node, cbNode, _cbNodes) { + [166 /* QualifiedName */]: function forEachChildInQualifiedName(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.left) || visitNode2(cbNode, node.right); }, - [167 /* TypeParameter */]: function forEachChildInTypeParameter(node, cbNode, cbNodes) { + [168 /* TypeParameter */]: function forEachChildInTypeParameter(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNode2(cbNode, node.constraint) || visitNode2(cbNode, node.default) || visitNode2(cbNode, node.expression); }, - [303 /* ShorthandPropertyAssignment */]: function forEachChildInShorthandPropertyAssignment(node, cbNode, cbNodes) { + [304 /* ShorthandPropertyAssignment */]: function forEachChildInShorthandPropertyAssignment(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNode2(cbNode, node.questionToken) || visitNode2(cbNode, node.exclamationToken) || visitNode2(cbNode, node.equalsToken) || visitNode2(cbNode, node.objectAssignmentInitializer); }, - [304 /* SpreadAssignment */]: function forEachChildInSpreadAssignment(node, cbNode, _cbNodes) { + [305 /* SpreadAssignment */]: function forEachChildInSpreadAssignment(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [168 /* Parameter */]: function forEachChildInParameter(node, cbNode, cbNodes) { + [169 /* Parameter */]: function forEachChildInParameter(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.dotDotDotToken) || visitNode2(cbNode, node.name) || visitNode2(cbNode, node.questionToken) || visitNode2(cbNode, node.type) || visitNode2(cbNode, node.initializer); }, - [171 /* PropertyDeclaration */]: function forEachChildInPropertyDeclaration(node, cbNode, cbNodes) { + [172 /* PropertyDeclaration */]: function forEachChildInPropertyDeclaration(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNode2(cbNode, node.questionToken) || visitNode2(cbNode, node.exclamationToken) || visitNode2(cbNode, node.type) || visitNode2(cbNode, node.initializer); }, - [170 /* PropertySignature */]: function forEachChildInPropertySignature(node, cbNode, cbNodes) { + [171 /* PropertySignature */]: function forEachChildInPropertySignature(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNode2(cbNode, node.questionToken) || visitNode2(cbNode, node.type) || visitNode2(cbNode, node.initializer); }, - [302 /* PropertyAssignment */]: function forEachChildInPropertyAssignment(node, cbNode, cbNodes) { + [303 /* PropertyAssignment */]: function forEachChildInPropertyAssignment(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNode2(cbNode, node.questionToken) || visitNode2(cbNode, node.exclamationToken) || visitNode2(cbNode, node.initializer); }, - [259 /* VariableDeclaration */]: function forEachChildInVariableDeclaration(node, cbNode, _cbNodes) { + [260 /* VariableDeclaration */]: function forEachChildInVariableDeclaration(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.name) || visitNode2(cbNode, node.exclamationToken) || visitNode2(cbNode, node.type) || visitNode2(cbNode, node.initializer); }, - [207 /* BindingElement */]: function forEachChildInBindingElement(node, cbNode, _cbNodes) { + [208 /* BindingElement */]: function forEachChildInBindingElement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.dotDotDotToken) || visitNode2(cbNode, node.propertyName) || visitNode2(cbNode, node.name) || visitNode2(cbNode, node.initializer); }, - [180 /* IndexSignature */]: function forEachChildInIndexSignature(node, cbNode, cbNodes) { + [181 /* IndexSignature */]: function forEachChildInIndexSignature(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type); }, - [184 /* ConstructorType */]: function forEachChildInConstructorType(node, cbNode, cbNodes) { + [185 /* ConstructorType */]: function forEachChildInConstructorType(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type); }, - [183 /* FunctionType */]: function forEachChildInFunctionType(node, cbNode, cbNodes) { + [184 /* FunctionType */]: function forEachChildInFunctionType(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type); }, - [178 /* CallSignature */]: forEachChildInCallOrConstructSignature, - [179 /* ConstructSignature */]: forEachChildInCallOrConstructSignature, - [173 /* MethodDeclaration */]: function forEachChildInMethodDeclaration(node, cbNode, cbNodes) { + [179 /* CallSignature */]: forEachChildInCallOrConstructSignature, + [180 /* ConstructSignature */]: forEachChildInCallOrConstructSignature, + [174 /* MethodDeclaration */]: function forEachChildInMethodDeclaration(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.asteriskToken) || visitNode2(cbNode, node.name) || visitNode2(cbNode, node.questionToken) || visitNode2(cbNode, node.exclamationToken) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type) || visitNode2(cbNode, node.body); }, - [172 /* MethodSignature */]: function forEachChildInMethodSignature(node, cbNode, cbNodes) { + [173 /* MethodSignature */]: function forEachChildInMethodSignature(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNode2(cbNode, node.questionToken) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type); }, - [175 /* Constructor */]: function forEachChildInConstructor(node, cbNode, cbNodes) { + [176 /* Constructor */]: function forEachChildInConstructor(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type) || visitNode2(cbNode, node.body); }, - [176 /* GetAccessor */]: function forEachChildInGetAccessor(node, cbNode, cbNodes) { + [177 /* GetAccessor */]: function forEachChildInGetAccessor(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type) || visitNode2(cbNode, node.body); }, - [177 /* SetAccessor */]: function forEachChildInSetAccessor(node, cbNode, cbNodes) { + [178 /* SetAccessor */]: function forEachChildInSetAccessor(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type) || visitNode2(cbNode, node.body); }, - [261 /* FunctionDeclaration */]: function forEachChildInFunctionDeclaration(node, cbNode, cbNodes) { + [262 /* FunctionDeclaration */]: function forEachChildInFunctionDeclaration(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.asteriskToken) || visitNode2(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type) || visitNode2(cbNode, node.body); }, - [217 /* FunctionExpression */]: function forEachChildInFunctionExpression(node, cbNode, cbNodes) { + [218 /* FunctionExpression */]: function forEachChildInFunctionExpression(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.asteriskToken) || visitNode2(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type) || visitNode2(cbNode, node.body); }, - [218 /* ArrowFunction */]: function forEachChildInArrowFunction(node, cbNode, cbNodes) { + [219 /* ArrowFunction */]: function forEachChildInArrowFunction(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type) || visitNode2(cbNode, node.equalsGreaterThanToken) || visitNode2(cbNode, node.body); }, - [174 /* ClassStaticBlockDeclaration */]: function forEachChildInClassStaticBlockDeclaration(node, cbNode, cbNodes) { + [175 /* ClassStaticBlockDeclaration */]: function forEachChildInClassStaticBlockDeclaration(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.body); }, - [182 /* TypeReference */]: function forEachChildInTypeReference(node, cbNode, cbNodes) { + [183 /* TypeReference */]: function forEachChildInTypeReference(node, cbNode, cbNodes) { return visitNode2(cbNode, node.typeName) || visitNodes(cbNode, cbNodes, node.typeArguments); }, - [181 /* TypePredicate */]: function forEachChildInTypePredicate(node, cbNode, _cbNodes) { + [182 /* TypePredicate */]: function forEachChildInTypePredicate(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.assertsModifier) || visitNode2(cbNode, node.parameterName) || visitNode2(cbNode, node.type); }, - [185 /* TypeQuery */]: function forEachChildInTypeQuery(node, cbNode, cbNodes) { + [186 /* TypeQuery */]: function forEachChildInTypeQuery(node, cbNode, cbNodes) { return visitNode2(cbNode, node.exprName) || visitNodes(cbNode, cbNodes, node.typeArguments); }, - [186 /* TypeLiteral */]: function forEachChildInTypeLiteral(node, cbNode, cbNodes) { + [187 /* TypeLiteral */]: function forEachChildInTypeLiteral(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.members); }, - [187 /* ArrayType */]: function forEachChildInArrayType(node, cbNode, _cbNodes) { + [188 /* ArrayType */]: function forEachChildInArrayType(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.elementType); }, - [188 /* TupleType */]: function forEachChildInTupleType(node, cbNode, cbNodes) { + [189 /* TupleType */]: function forEachChildInTupleType(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.elements); }, - [191 /* UnionType */]: forEachChildInUnionOrIntersectionType, - [192 /* IntersectionType */]: forEachChildInUnionOrIntersectionType, - [193 /* ConditionalType */]: function forEachChildInConditionalType(node, cbNode, _cbNodes) { + [192 /* UnionType */]: forEachChildInUnionOrIntersectionType, + [193 /* IntersectionType */]: forEachChildInUnionOrIntersectionType, + [194 /* ConditionalType */]: function forEachChildInConditionalType(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.checkType) || visitNode2(cbNode, node.extendsType) || visitNode2(cbNode, node.trueType) || visitNode2(cbNode, node.falseType); }, - [194 /* InferType */]: function forEachChildInInferType(node, cbNode, _cbNodes) { + [195 /* InferType */]: function forEachChildInInferType(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.typeParameter); }, - [204 /* ImportType */]: function forEachChildInImportType(node, cbNode, cbNodes) { + [205 /* ImportType */]: function forEachChildInImportType(node, cbNode, cbNodes) { return visitNode2(cbNode, node.argument) || visitNode2(cbNode, node.assertions) || visitNode2(cbNode, node.qualifier) || visitNodes(cbNode, cbNodes, node.typeArguments); }, - [301 /* ImportTypeAssertionContainer */]: function forEachChildInImportTypeAssertionContainer(node, cbNode, _cbNodes) { + [302 /* ImportTypeAssertionContainer */]: function forEachChildInImportTypeAssertionContainer(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.assertClause); }, - [195 /* ParenthesizedType */]: forEachChildInParenthesizedTypeOrTypeOperator, - [197 /* TypeOperator */]: forEachChildInParenthesizedTypeOrTypeOperator, - [198 /* IndexedAccessType */]: function forEachChildInIndexedAccessType(node, cbNode, _cbNodes) { + [196 /* ParenthesizedType */]: forEachChildInParenthesizedTypeOrTypeOperator, + [198 /* TypeOperator */]: forEachChildInParenthesizedTypeOrTypeOperator, + [199 /* IndexedAccessType */]: function forEachChildInIndexedAccessType(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.objectType) || visitNode2(cbNode, node.indexType); }, - [199 /* MappedType */]: function forEachChildInMappedType(node, cbNode, cbNodes) { + [200 /* MappedType */]: function forEachChildInMappedType(node, cbNode, cbNodes) { return visitNode2(cbNode, node.readonlyToken) || visitNode2(cbNode, node.typeParameter) || visitNode2(cbNode, node.nameType) || visitNode2(cbNode, node.questionToken) || visitNode2(cbNode, node.type) || visitNodes(cbNode, cbNodes, node.members); }, - [200 /* LiteralType */]: function forEachChildInLiteralType(node, cbNode, _cbNodes) { + [201 /* LiteralType */]: function forEachChildInLiteralType(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.literal); }, - [201 /* NamedTupleMember */]: function forEachChildInNamedTupleMember(node, cbNode, _cbNodes) { + [202 /* NamedTupleMember */]: function forEachChildInNamedTupleMember(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.dotDotDotToken) || visitNode2(cbNode, node.name) || visitNode2(cbNode, node.questionToken) || visitNode2(cbNode, node.type); }, - [205 /* ObjectBindingPattern */]: forEachChildInObjectOrArrayBindingPattern, - [206 /* ArrayBindingPattern */]: forEachChildInObjectOrArrayBindingPattern, - [208 /* ArrayLiteralExpression */]: function forEachChildInArrayLiteralExpression(node, cbNode, cbNodes) { + [206 /* ObjectBindingPattern */]: forEachChildInObjectOrArrayBindingPattern, + [207 /* ArrayBindingPattern */]: forEachChildInObjectOrArrayBindingPattern, + [209 /* ArrayLiteralExpression */]: function forEachChildInArrayLiteralExpression(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.elements); }, - [209 /* ObjectLiteralExpression */]: function forEachChildInObjectLiteralExpression(node, cbNode, cbNodes) { + [210 /* ObjectLiteralExpression */]: function forEachChildInObjectLiteralExpression(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.properties); }, - [210 /* PropertyAccessExpression */]: function forEachChildInPropertyAccessExpression(node, cbNode, _cbNodes) { + [211 /* PropertyAccessExpression */]: function forEachChildInPropertyAccessExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression) || visitNode2(cbNode, node.questionDotToken) || visitNode2(cbNode, node.name); }, - [211 /* ElementAccessExpression */]: function forEachChildInElementAccessExpression(node, cbNode, _cbNodes) { + [212 /* ElementAccessExpression */]: function forEachChildInElementAccessExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression) || visitNode2(cbNode, node.questionDotToken) || visitNode2(cbNode, node.argumentExpression); }, - [212 /* CallExpression */]: forEachChildInCallOrNewExpression, - [213 /* NewExpression */]: forEachChildInCallOrNewExpression, - [214 /* TaggedTemplateExpression */]: function forEachChildInTaggedTemplateExpression(node, cbNode, cbNodes) { + [213 /* CallExpression */]: forEachChildInCallOrNewExpression, + [214 /* NewExpression */]: forEachChildInCallOrNewExpression, + [215 /* TaggedTemplateExpression */]: function forEachChildInTaggedTemplateExpression(node, cbNode, cbNodes) { return visitNode2(cbNode, node.tag) || visitNode2(cbNode, node.questionDotToken) || visitNodes(cbNode, cbNodes, node.typeArguments) || visitNode2(cbNode, node.template); }, - [215 /* TypeAssertionExpression */]: function forEachChildInTypeAssertionExpression(node, cbNode, _cbNodes) { + [216 /* TypeAssertionExpression */]: function forEachChildInTypeAssertionExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.type) || visitNode2(cbNode, node.expression); }, - [216 /* ParenthesizedExpression */]: function forEachChildInParenthesizedExpression(node, cbNode, _cbNodes) { + [217 /* ParenthesizedExpression */]: function forEachChildInParenthesizedExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [219 /* DeleteExpression */]: function forEachChildInDeleteExpression(node, cbNode, _cbNodes) { + [220 /* DeleteExpression */]: function forEachChildInDeleteExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [220 /* TypeOfExpression */]: function forEachChildInTypeOfExpression(node, cbNode, _cbNodes) { + [221 /* TypeOfExpression */]: function forEachChildInTypeOfExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [221 /* VoidExpression */]: function forEachChildInVoidExpression(node, cbNode, _cbNodes) { + [222 /* VoidExpression */]: function forEachChildInVoidExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [223 /* PrefixUnaryExpression */]: function forEachChildInPrefixUnaryExpression(node, cbNode, _cbNodes) { + [224 /* PrefixUnaryExpression */]: function forEachChildInPrefixUnaryExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.operand); }, - [228 /* YieldExpression */]: function forEachChildInYieldExpression(node, cbNode, _cbNodes) { + [229 /* YieldExpression */]: function forEachChildInYieldExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.asteriskToken) || visitNode2(cbNode, node.expression); }, - [222 /* AwaitExpression */]: function forEachChildInAwaitExpression(node, cbNode, _cbNodes) { + [223 /* AwaitExpression */]: function forEachChildInAwaitExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [224 /* PostfixUnaryExpression */]: function forEachChildInPostfixUnaryExpression(node, cbNode, _cbNodes) { + [225 /* PostfixUnaryExpression */]: function forEachChildInPostfixUnaryExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.operand); }, - [225 /* BinaryExpression */]: function forEachChildInBinaryExpression(node, cbNode, _cbNodes) { + [226 /* BinaryExpression */]: function forEachChildInBinaryExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.left) || visitNode2(cbNode, node.operatorToken) || visitNode2(cbNode, node.right); }, - [233 /* AsExpression */]: function forEachChildInAsExpression(node, cbNode, _cbNodes) { + [234 /* AsExpression */]: function forEachChildInAsExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression) || visitNode2(cbNode, node.type); }, - [234 /* NonNullExpression */]: function forEachChildInNonNullExpression(node, cbNode, _cbNodes) { + [235 /* NonNullExpression */]: function forEachChildInNonNullExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [237 /* SatisfiesExpression */]: function forEachChildInSatisfiesExpression(node, cbNode, _cbNodes) { + [238 /* SatisfiesExpression */]: function forEachChildInSatisfiesExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression) || visitNode2(cbNode, node.type); }, - [235 /* MetaProperty */]: function forEachChildInMetaProperty(node, cbNode, _cbNodes) { + [236 /* MetaProperty */]: function forEachChildInMetaProperty(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.name); }, - [226 /* ConditionalExpression */]: function forEachChildInConditionalExpression(node, cbNode, _cbNodes) { + [227 /* ConditionalExpression */]: function forEachChildInConditionalExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.condition) || visitNode2(cbNode, node.questionToken) || visitNode2(cbNode, node.whenTrue) || visitNode2(cbNode, node.colonToken) || visitNode2(cbNode, node.whenFalse); }, - [229 /* SpreadElement */]: function forEachChildInSpreadElement(node, cbNode, _cbNodes) { + [230 /* SpreadElement */]: function forEachChildInSpreadElement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [240 /* Block */]: forEachChildInBlock, - [267 /* ModuleBlock */]: forEachChildInBlock, - [311 /* SourceFile */]: function forEachChildInSourceFile(node, cbNode, cbNodes) { + [241 /* Block */]: forEachChildInBlock, + [268 /* ModuleBlock */]: forEachChildInBlock, + [312 /* SourceFile */]: function forEachChildInSourceFile(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.statements) || visitNode2(cbNode, node.endOfFileToken); }, - [242 /* VariableStatement */]: function forEachChildInVariableStatement(node, cbNode, cbNodes) { + [243 /* VariableStatement */]: function forEachChildInVariableStatement(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.declarationList); }, - [260 /* VariableDeclarationList */]: function forEachChildInVariableDeclarationList(node, cbNode, cbNodes) { + [261 /* VariableDeclarationList */]: function forEachChildInVariableDeclarationList(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.declarations); }, - [243 /* ExpressionStatement */]: function forEachChildInExpressionStatement(node, cbNode, _cbNodes) { + [244 /* ExpressionStatement */]: function forEachChildInExpressionStatement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [244 /* IfStatement */]: function forEachChildInIfStatement(node, cbNode, _cbNodes) { + [245 /* IfStatement */]: function forEachChildInIfStatement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression) || visitNode2(cbNode, node.thenStatement) || visitNode2(cbNode, node.elseStatement); }, - [245 /* DoStatement */]: function forEachChildInDoStatement(node, cbNode, _cbNodes) { + [246 /* DoStatement */]: function forEachChildInDoStatement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.statement) || visitNode2(cbNode, node.expression); }, - [246 /* WhileStatement */]: function forEachChildInWhileStatement(node, cbNode, _cbNodes) { + [247 /* WhileStatement */]: function forEachChildInWhileStatement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression) || visitNode2(cbNode, node.statement); }, - [247 /* ForStatement */]: function forEachChildInForStatement(node, cbNode, _cbNodes) { + [248 /* ForStatement */]: function forEachChildInForStatement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.initializer) || visitNode2(cbNode, node.condition) || visitNode2(cbNode, node.incrementor) || visitNode2(cbNode, node.statement); }, - [248 /* ForInStatement */]: function forEachChildInForInStatement(node, cbNode, _cbNodes) { + [249 /* ForInStatement */]: function forEachChildInForInStatement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.initializer) || visitNode2(cbNode, node.expression) || visitNode2(cbNode, node.statement); }, - [249 /* ForOfStatement */]: function forEachChildInForOfStatement(node, cbNode, _cbNodes) { + [250 /* ForOfStatement */]: function forEachChildInForOfStatement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.awaitModifier) || visitNode2(cbNode, node.initializer) || visitNode2(cbNode, node.expression) || visitNode2(cbNode, node.statement); }, - [250 /* ContinueStatement */]: forEachChildInContinueOrBreakStatement, - [251 /* BreakStatement */]: forEachChildInContinueOrBreakStatement, - [252 /* ReturnStatement */]: function forEachChildInReturnStatement(node, cbNode, _cbNodes) { + [251 /* ContinueStatement */]: forEachChildInContinueOrBreakStatement, + [252 /* BreakStatement */]: forEachChildInContinueOrBreakStatement, + [253 /* ReturnStatement */]: function forEachChildInReturnStatement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [253 /* WithStatement */]: function forEachChildInWithStatement(node, cbNode, _cbNodes) { + [254 /* WithStatement */]: function forEachChildInWithStatement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression) || visitNode2(cbNode, node.statement); }, - [254 /* SwitchStatement */]: function forEachChildInSwitchStatement(node, cbNode, _cbNodes) { + [255 /* SwitchStatement */]: function forEachChildInSwitchStatement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression) || visitNode2(cbNode, node.caseBlock); }, - [268 /* CaseBlock */]: function forEachChildInCaseBlock(node, cbNode, cbNodes) { + [269 /* CaseBlock */]: function forEachChildInCaseBlock(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.clauses); }, - [295 /* CaseClause */]: function forEachChildInCaseClause(node, cbNode, cbNodes) { + [296 /* CaseClause */]: function forEachChildInCaseClause(node, cbNode, cbNodes) { return visitNode2(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.statements); }, - [296 /* DefaultClause */]: function forEachChildInDefaultClause(node, cbNode, cbNodes) { + [297 /* DefaultClause */]: function forEachChildInDefaultClause(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.statements); }, - [255 /* LabeledStatement */]: function forEachChildInLabeledStatement(node, cbNode, _cbNodes) { + [256 /* LabeledStatement */]: function forEachChildInLabeledStatement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.label) || visitNode2(cbNode, node.statement); }, - [256 /* ThrowStatement */]: function forEachChildInThrowStatement(node, cbNode, _cbNodes) { + [257 /* ThrowStatement */]: function forEachChildInThrowStatement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [257 /* TryStatement */]: function forEachChildInTryStatement(node, cbNode, _cbNodes) { + [258 /* TryStatement */]: function forEachChildInTryStatement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.tryBlock) || visitNode2(cbNode, node.catchClause) || visitNode2(cbNode, node.finallyBlock); }, - [298 /* CatchClause */]: function forEachChildInCatchClause(node, cbNode, _cbNodes) { + [299 /* CatchClause */]: function forEachChildInCatchClause(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.variableDeclaration) || visitNode2(cbNode, node.block); }, - [169 /* Decorator */]: function forEachChildInDecorator(node, cbNode, _cbNodes) { + [170 /* Decorator */]: function forEachChildInDecorator(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [262 /* ClassDeclaration */]: forEachChildInClassDeclarationOrExpression, - [230 /* ClassExpression */]: forEachChildInClassDeclarationOrExpression, - [263 /* InterfaceDeclaration */]: function forEachChildInInterfaceDeclaration(node, cbNode, cbNodes) { + [263 /* ClassDeclaration */]: forEachChildInClassDeclarationOrExpression, + [231 /* ClassExpression */]: forEachChildInClassDeclarationOrExpression, + [264 /* InterfaceDeclaration */]: function forEachChildInInterfaceDeclaration(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.heritageClauses) || visitNodes(cbNode, cbNodes, node.members); }, - [264 /* TypeAliasDeclaration */]: function forEachChildInTypeAliasDeclaration(node, cbNode, cbNodes) { + [265 /* TypeAliasDeclaration */]: function forEachChildInTypeAliasDeclaration(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNode2(cbNode, node.type); }, - [265 /* EnumDeclaration */]: function forEachChildInEnumDeclaration(node, cbNode, cbNodes) { + [266 /* EnumDeclaration */]: function forEachChildInEnumDeclaration(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.members); }, - [305 /* EnumMember */]: function forEachChildInEnumMember(node, cbNode, _cbNodes) { + [306 /* EnumMember */]: function forEachChildInEnumMember(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.name) || visitNode2(cbNode, node.initializer); }, - [266 /* ModuleDeclaration */]: function forEachChildInModuleDeclaration(node, cbNode, cbNodes) { + [267 /* ModuleDeclaration */]: function forEachChildInModuleDeclaration(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNode2(cbNode, node.body); }, - [270 /* ImportEqualsDeclaration */]: function forEachChildInImportEqualsDeclaration(node, cbNode, cbNodes) { + [271 /* ImportEqualsDeclaration */]: function forEachChildInImportEqualsDeclaration(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNode2(cbNode, node.moduleReference); }, - [271 /* ImportDeclaration */]: function forEachChildInImportDeclaration(node, cbNode, cbNodes) { + [272 /* ImportDeclaration */]: function forEachChildInImportDeclaration(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.importClause) || visitNode2(cbNode, node.moduleSpecifier) || visitNode2(cbNode, node.assertClause); }, - [272 /* ImportClause */]: function forEachChildInImportClause(node, cbNode, _cbNodes) { + [273 /* ImportClause */]: function forEachChildInImportClause(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.name) || visitNode2(cbNode, node.namedBindings); }, - [299 /* AssertClause */]: function forEachChildInAssertClause(node, cbNode, cbNodes) { + [300 /* AssertClause */]: function forEachChildInAssertClause(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.elements); }, - [300 /* AssertEntry */]: function forEachChildInAssertEntry(node, cbNode, _cbNodes) { + [301 /* AssertEntry */]: function forEachChildInAssertEntry(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.name) || visitNode2(cbNode, node.value); }, - [269 /* NamespaceExportDeclaration */]: function forEachChildInNamespaceExportDeclaration(node, cbNode, cbNodes) { + [270 /* NamespaceExportDeclaration */]: function forEachChildInNamespaceExportDeclaration(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name); }, - [273 /* NamespaceImport */]: function forEachChildInNamespaceImport(node, cbNode, _cbNodes) { + [274 /* NamespaceImport */]: function forEachChildInNamespaceImport(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.name); }, - [279 /* NamespaceExport */]: function forEachChildInNamespaceExport(node, cbNode, _cbNodes) { + [280 /* NamespaceExport */]: function forEachChildInNamespaceExport(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.name); }, - [274 /* NamedImports */]: forEachChildInNamedImportsOrExports, - [278 /* NamedExports */]: forEachChildInNamedImportsOrExports, - [277 /* ExportDeclaration */]: function forEachChildInExportDeclaration(node, cbNode, cbNodes) { + [275 /* NamedImports */]: forEachChildInNamedImportsOrExports, + [279 /* NamedExports */]: forEachChildInNamedImportsOrExports, + [278 /* ExportDeclaration */]: function forEachChildInExportDeclaration(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.exportClause) || visitNode2(cbNode, node.moduleSpecifier) || visitNode2(cbNode, node.assertClause); }, - [275 /* ImportSpecifier */]: forEachChildInImportOrExportSpecifier, - [280 /* ExportSpecifier */]: forEachChildInImportOrExportSpecifier, - [276 /* ExportAssignment */]: function forEachChildInExportAssignment(node, cbNode, cbNodes) { + [276 /* ImportSpecifier */]: forEachChildInImportOrExportSpecifier, + [281 /* ExportSpecifier */]: forEachChildInImportOrExportSpecifier, + [277 /* ExportAssignment */]: function forEachChildInExportAssignment(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.expression); }, - [227 /* TemplateExpression */]: function forEachChildInTemplateExpression(node, cbNode, cbNodes) { + [228 /* TemplateExpression */]: function forEachChildInTemplateExpression(node, cbNode, cbNodes) { return visitNode2(cbNode, node.head) || visitNodes(cbNode, cbNodes, node.templateSpans); }, - [238 /* TemplateSpan */]: function forEachChildInTemplateSpan(node, cbNode, _cbNodes) { + [239 /* TemplateSpan */]: function forEachChildInTemplateSpan(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression) || visitNode2(cbNode, node.literal); }, - [202 /* TemplateLiteralType */]: function forEachChildInTemplateLiteralType(node, cbNode, cbNodes) { + [203 /* TemplateLiteralType */]: function forEachChildInTemplateLiteralType(node, cbNode, cbNodes) { return visitNode2(cbNode, node.head) || visitNodes(cbNode, cbNodes, node.templateSpans); }, - [203 /* TemplateLiteralTypeSpan */]: function forEachChildInTemplateLiteralTypeSpan(node, cbNode, _cbNodes) { + [204 /* TemplateLiteralTypeSpan */]: function forEachChildInTemplateLiteralTypeSpan(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.type) || visitNode2(cbNode, node.literal); }, - [166 /* ComputedPropertyName */]: function forEachChildInComputedPropertyName(node, cbNode, _cbNodes) { + [167 /* ComputedPropertyName */]: function forEachChildInComputedPropertyName(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [297 /* HeritageClause */]: function forEachChildInHeritageClause(node, cbNode, cbNodes) { + [298 /* HeritageClause */]: function forEachChildInHeritageClause(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.types); }, - [232 /* ExpressionWithTypeArguments */]: function forEachChildInExpressionWithTypeArguments(node, cbNode, cbNodes) { + [233 /* ExpressionWithTypeArguments */]: function forEachChildInExpressionWithTypeArguments(node, cbNode, cbNodes) { return visitNode2(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.typeArguments); }, - [282 /* ExternalModuleReference */]: function forEachChildInExternalModuleReference(node, cbNode, _cbNodes) { + [283 /* ExternalModuleReference */]: function forEachChildInExternalModuleReference(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [281 /* MissingDeclaration */]: function forEachChildInMissingDeclaration(node, cbNode, cbNodes) { + [282 /* MissingDeclaration */]: function forEachChildInMissingDeclaration(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers); }, - [360 /* CommaListExpression */]: function forEachChildInCommaListExpression(node, cbNode, cbNodes) { + [361 /* CommaListExpression */]: function forEachChildInCommaListExpression(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.elements); }, - [283 /* JsxElement */]: function forEachChildInJsxElement(node, cbNode, cbNodes) { + [284 /* JsxElement */]: function forEachChildInJsxElement(node, cbNode, cbNodes) { return visitNode2(cbNode, node.openingElement) || visitNodes(cbNode, cbNodes, node.children) || visitNode2(cbNode, node.closingElement); }, - [287 /* JsxFragment */]: function forEachChildInJsxFragment(node, cbNode, cbNodes) { + [288 /* JsxFragment */]: function forEachChildInJsxFragment(node, cbNode, cbNodes) { return visitNode2(cbNode, node.openingFragment) || visitNodes(cbNode, cbNodes, node.children) || visitNode2(cbNode, node.closingFragment); }, - [284 /* JsxSelfClosingElement */]: forEachChildInJsxOpeningOrSelfClosingElement, - [285 /* JsxOpeningElement */]: forEachChildInJsxOpeningOrSelfClosingElement, - [291 /* JsxAttributes */]: function forEachChildInJsxAttributes(node, cbNode, cbNodes) { + [285 /* JsxSelfClosingElement */]: forEachChildInJsxOpeningOrSelfClosingElement, + [286 /* JsxOpeningElement */]: forEachChildInJsxOpeningOrSelfClosingElement, + [292 /* JsxAttributes */]: function forEachChildInJsxAttributes(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.properties); }, - [290 /* JsxAttribute */]: function forEachChildInJsxAttribute(node, cbNode, _cbNodes) { + [291 /* JsxAttribute */]: function forEachChildInJsxAttribute(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.name) || visitNode2(cbNode, node.initializer); }, - [292 /* JsxSpreadAttribute */]: function forEachChildInJsxSpreadAttribute(node, cbNode, _cbNodes) { + [293 /* JsxSpreadAttribute */]: function forEachChildInJsxSpreadAttribute(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [293 /* JsxExpression */]: function forEachChildInJsxExpression(node, cbNode, _cbNodes) { + [294 /* JsxExpression */]: function forEachChildInJsxExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.dotDotDotToken) || visitNode2(cbNode, node.expression); }, - [286 /* JsxClosingElement */]: function forEachChildInJsxClosingElement(node, cbNode, _cbNodes) { + [287 /* JsxClosingElement */]: function forEachChildInJsxClosingElement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.tagName); }, - [294 /* JsxNamespacedName */]: function forEachChildInJsxNamespacedName(node, cbNode, _cbNodes) { + [295 /* JsxNamespacedName */]: function forEachChildInJsxNamespacedName(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.namespace) || visitNode2(cbNode, node.name); }, - [189 /* OptionalType */]: forEachChildInOptionalRestOrJSDocParameterModifier, - [190 /* RestType */]: forEachChildInOptionalRestOrJSDocParameterModifier, - [315 /* JSDocTypeExpression */]: forEachChildInOptionalRestOrJSDocParameterModifier, - [321 /* JSDocNonNullableType */]: forEachChildInOptionalRestOrJSDocParameterModifier, - [320 /* JSDocNullableType */]: forEachChildInOptionalRestOrJSDocParameterModifier, - [322 /* JSDocOptionalType */]: forEachChildInOptionalRestOrJSDocParameterModifier, - [324 /* JSDocVariadicType */]: forEachChildInOptionalRestOrJSDocParameterModifier, - [323 /* JSDocFunctionType */]: function forEachChildInJSDocFunctionType(node, cbNode, cbNodes) { + [190 /* OptionalType */]: forEachChildInOptionalRestOrJSDocParameterModifier, + [191 /* RestType */]: forEachChildInOptionalRestOrJSDocParameterModifier, + [316 /* JSDocTypeExpression */]: forEachChildInOptionalRestOrJSDocParameterModifier, + [322 /* JSDocNonNullableType */]: forEachChildInOptionalRestOrJSDocParameterModifier, + [321 /* JSDocNullableType */]: forEachChildInOptionalRestOrJSDocParameterModifier, + [323 /* JSDocOptionalType */]: forEachChildInOptionalRestOrJSDocParameterModifier, + [325 /* JSDocVariadicType */]: forEachChildInOptionalRestOrJSDocParameterModifier, + [324 /* JSDocFunctionType */]: function forEachChildInJSDocFunctionType(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type); }, - [326 /* JSDoc */]: function forEachChildInJSDoc(node, cbNode, cbNodes) { + [327 /* JSDoc */]: function forEachChildInJSDoc(node, cbNode, cbNodes) { return (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment)) || visitNodes(cbNode, cbNodes, node.tags); }, - [353 /* JSDocSeeTag */]: function forEachChildInJSDocSeeTag(node, cbNode, cbNodes) { + [354 /* JSDocSeeTag */]: function forEachChildInJSDocSeeTag(node, cbNode, cbNodes) { return visitNode2(cbNode, node.tagName) || visitNode2(cbNode, node.name) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment)); }, - [316 /* JSDocNameReference */]: function forEachChildInJSDocNameReference(node, cbNode, _cbNodes) { + [317 /* JSDocNameReference */]: function forEachChildInJSDocNameReference(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.name); }, - [317 /* JSDocMemberName */]: function forEachChildInJSDocMemberName(node, cbNode, _cbNodes) { + [318 /* JSDocMemberName */]: function forEachChildInJSDocMemberName(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.left) || visitNode2(cbNode, node.right); }, - [347 /* JSDocParameterTag */]: forEachChildInJSDocParameterOrPropertyTag, - [354 /* JSDocPropertyTag */]: forEachChildInJSDocParameterOrPropertyTag, - [336 /* JSDocAuthorTag */]: function forEachChildInJSDocAuthorTag(node, cbNode, cbNodes) { + [348 /* JSDocParameterTag */]: forEachChildInJSDocParameterOrPropertyTag, + [355 /* JSDocPropertyTag */]: forEachChildInJSDocParameterOrPropertyTag, + [337 /* JSDocAuthorTag */]: function forEachChildInJSDocAuthorTag(node, cbNode, cbNodes) { return visitNode2(cbNode, node.tagName) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment)); }, - [335 /* JSDocImplementsTag */]: function forEachChildInJSDocImplementsTag(node, cbNode, cbNodes) { + [336 /* JSDocImplementsTag */]: function forEachChildInJSDocImplementsTag(node, cbNode, cbNodes) { return visitNode2(cbNode, node.tagName) || visitNode2(cbNode, node.class) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment)); }, - [334 /* JSDocAugmentsTag */]: function forEachChildInJSDocAugmentsTag(node, cbNode, cbNodes) { + [335 /* JSDocAugmentsTag */]: function forEachChildInJSDocAugmentsTag(node, cbNode, cbNodes) { return visitNode2(cbNode, node.tagName) || visitNode2(cbNode, node.class) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment)); }, - [351 /* JSDocTemplateTag */]: function forEachChildInJSDocTemplateTag(node, cbNode, cbNodes) { + [352 /* JSDocTemplateTag */]: function forEachChildInJSDocTemplateTag(node, cbNode, cbNodes) { return visitNode2(cbNode, node.tagName) || visitNode2(cbNode, node.constraint) || visitNodes(cbNode, cbNodes, node.typeParameters) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment)); }, - [352 /* JSDocTypedefTag */]: function forEachChildInJSDocTypedefTag(node, cbNode, cbNodes) { - return visitNode2(cbNode, node.tagName) || (node.typeExpression && node.typeExpression.kind === 315 /* JSDocTypeExpression */ ? visitNode2(cbNode, node.typeExpression) || visitNode2(cbNode, node.fullName) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment)) : visitNode2(cbNode, node.fullName) || visitNode2(cbNode, node.typeExpression) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment))); + [353 /* JSDocTypedefTag */]: function forEachChildInJSDocTypedefTag(node, cbNode, cbNodes) { + return visitNode2(cbNode, node.tagName) || (node.typeExpression && node.typeExpression.kind === 316 /* JSDocTypeExpression */ ? visitNode2(cbNode, node.typeExpression) || visitNode2(cbNode, node.fullName) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment)) : visitNode2(cbNode, node.fullName) || visitNode2(cbNode, node.typeExpression) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment))); }, - [344 /* JSDocCallbackTag */]: function forEachChildInJSDocCallbackTag(node, cbNode, cbNodes) { + [345 /* JSDocCallbackTag */]: function forEachChildInJSDocCallbackTag(node, cbNode, cbNodes) { return visitNode2(cbNode, node.tagName) || visitNode2(cbNode, node.fullName) || visitNode2(cbNode, node.typeExpression) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment)); }, - [348 /* JSDocReturnTag */]: forEachChildInJSDocTypeLikeTag, - [350 /* JSDocTypeTag */]: forEachChildInJSDocTypeLikeTag, - [349 /* JSDocThisTag */]: forEachChildInJSDocTypeLikeTag, - [346 /* JSDocEnumTag */]: forEachChildInJSDocTypeLikeTag, - [356 /* JSDocSatisfiesTag */]: forEachChildInJSDocTypeLikeTag, - [355 /* JSDocThrowsTag */]: forEachChildInJSDocTypeLikeTag, - [345 /* JSDocOverloadTag */]: forEachChildInJSDocTypeLikeTag, - [329 /* JSDocSignature */]: function forEachChildInJSDocSignature(node, cbNode, _cbNodes) { + [349 /* JSDocReturnTag */]: forEachChildInJSDocTypeLikeTag, + [351 /* JSDocTypeTag */]: forEachChildInJSDocTypeLikeTag, + [350 /* JSDocThisTag */]: forEachChildInJSDocTypeLikeTag, + [347 /* JSDocEnumTag */]: forEachChildInJSDocTypeLikeTag, + [357 /* JSDocSatisfiesTag */]: forEachChildInJSDocTypeLikeTag, + [356 /* JSDocThrowsTag */]: forEachChildInJSDocTypeLikeTag, + [346 /* JSDocOverloadTag */]: forEachChildInJSDocTypeLikeTag, + [330 /* JSDocSignature */]: function forEachChildInJSDocSignature(node, cbNode, _cbNodes) { return forEach(node.typeParameters, cbNode) || forEach(node.parameters, cbNode) || visitNode2(cbNode, node.type); }, - [330 /* JSDocLink */]: forEachChildInJSDocLinkCodeOrPlain, - [331 /* JSDocLinkCode */]: forEachChildInJSDocLinkCodeOrPlain, - [332 /* JSDocLinkPlain */]: forEachChildInJSDocLinkCodeOrPlain, - [328 /* JSDocTypeLiteral */]: function forEachChildInJSDocTypeLiteral(node, cbNode, _cbNodes) { + [331 /* JSDocLink */]: forEachChildInJSDocLinkCodeOrPlain, + [332 /* JSDocLinkCode */]: forEachChildInJSDocLinkCodeOrPlain, + [333 /* JSDocLinkPlain */]: forEachChildInJSDocLinkCodeOrPlain, + [329 /* JSDocTypeLiteral */]: function forEachChildInJSDocTypeLiteral(node, cbNode, _cbNodes) { return forEach(node.jsDocPropertyTags, cbNode); }, - [333 /* JSDocTag */]: forEachChildInJSDocTag, - [338 /* JSDocClassTag */]: forEachChildInJSDocTag, - [339 /* JSDocPublicTag */]: forEachChildInJSDocTag, - [340 /* JSDocPrivateTag */]: forEachChildInJSDocTag, - [341 /* JSDocProtectedTag */]: forEachChildInJSDocTag, - [342 /* JSDocReadonlyTag */]: forEachChildInJSDocTag, - [337 /* JSDocDeprecatedTag */]: forEachChildInJSDocTag, - [343 /* JSDocOverrideTag */]: forEachChildInJSDocTag, - [359 /* PartiallyEmittedExpression */]: forEachChildInPartiallyEmittedExpression + [334 /* JSDocTag */]: forEachChildInJSDocTag, + [339 /* JSDocClassTag */]: forEachChildInJSDocTag, + [340 /* JSDocPublicTag */]: forEachChildInJSDocTag, + [341 /* JSDocPrivateTag */]: forEachChildInJSDocTag, + [342 /* JSDocProtectedTag */]: forEachChildInJSDocTag, + [343 /* JSDocReadonlyTag */]: forEachChildInJSDocTag, + [338 /* JSDocDeprecatedTag */]: forEachChildInJSDocTag, + [344 /* JSDocOverrideTag */]: forEachChildInJSDocTag, + [360 /* PartiallyEmittedExpression */]: forEachChildInPartiallyEmittedExpression }; ((Parser2) => { var scanner2 = createScanner( @@ -28580,7 +28798,7 @@ ${lanes.join("\n")} /*skipTrivia*/ true ); - var disallowInAndDecoratorContext = 4096 /* DisallowInContext */ | 16384 /* DecoratorContext */; + var disallowInAndDecoratorContext = 8192 /* DisallowInContext */ | 32768 /* DecoratorContext */; var NodeConstructor2; var TokenConstructor2; var IdentifierConstructor2; @@ -28825,10 +29043,10 @@ ${lanes.join("\n")} switch (scriptKind) { case 1 /* JS */: case 2 /* JSX */: - contextFlags = 262144 /* JavaScriptFile */; + contextFlags = 524288 /* JavaScriptFile */; break; case 6 /* JSON */: - contextFlags = 262144 /* JavaScriptFile */ | 67108864 /* JsonFile */; + contextFlags = 524288 /* JavaScriptFile */ | 134217728 /* JsonFile */; break; default: contextFlags = 0 /* None */; @@ -28860,13 +29078,14 @@ ${lanes.join("\n")} function parseSourceFileWorker(languageVersion2, setParentNodes, scriptKind2, setExternalModuleIndicator2) { const isDeclarationFile = isDeclarationFileName(fileName); if (isDeclarationFile) { - contextFlags |= 16777216 /* Ambient */; + contextFlags |= 33554432 /* Ambient */; } sourceFlags = contextFlags; nextToken(); const statements = parseList(0 /* SourceElements */, parseStatement); Debug.assert(token() === 1 /* EndOfFileToken */); - const endOfFileToken = addJSDocComment(parseTokenNode()); + const endHasJSDoc = hasPrecedingJSDocComment(); + const endOfFileToken = withJSDoc(parseTokenNode(), endHasJSDoc); const sourceFile = createSourceFile2(fileName, languageVersion2, scriptKind2, isDeclarationFile, statements, endOfFileToken, sourceFlags, setExternalModuleIndicator2); processCommentPragmas(sourceFile, sourceText); processPragmasIntoFields(sourceFile, reportPragmaDiagnostic); @@ -28886,18 +29105,18 @@ ${lanes.join("\n")} parseDiagnostics.push(createDetachedDiagnostic(fileName, pos, end, diagnostic)); } } - function withJSDoc(node, hasJSDoc) { - return hasJSDoc ? addJSDocComment(node) : node; - } let hasDeprecatedTag = false; - function addJSDocComment(node) { + function withJSDoc(node, hasJSDoc) { + if (!hasJSDoc) { + return node; + } Debug.assert(!node.jsDoc); const jsDoc = mapDefined(getJSDocCommentRanges(node, sourceText), (comment) => JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos)); if (jsDoc.length) node.jsDoc = jsDoc; if (hasDeprecatedTag) { hasDeprecatedTag = false; - node.flags |= 268435456 /* Deprecated */; + node.flags |= 536870912 /* Deprecated */; } return node; } @@ -28922,7 +29141,7 @@ ${lanes.join("\n")} } speculationHelper(() => { const savedContextFlags = contextFlags; - contextFlags |= 32768 /* AwaitContext */; + contextFlags |= 65536 /* AwaitContext */; scanner2.resetTokenState(nextStatement.pos); nextToken(); while (token() !== 1 /* EndOfFileToken */) { @@ -28957,7 +29176,7 @@ ${lanes.join("\n")} syntaxCursor = savedSyntaxCursor; return factory2.updateSourceFile(sourceFile, setTextRange(factoryCreateNodeArray(statements), sourceFile.statements)); function containsPossibleTopLevelAwait(node) { - return !(node.flags & 32768 /* AwaitContext */) && !!(node.transformFlags & 67108864 /* ContainsPossibleTopLevelAwait */); + return !(node.flags & 65536 /* AwaitContext */) && !!(node.transformFlags & 67108864 /* ContainsPossibleTopLevelAwait */); } function findNextStatementWithAwait(statements2, start2) { for (let i = start2; i < statements2.length; i++) { @@ -29021,16 +29240,16 @@ ${lanes.join("\n")} } } function setDisallowInContext(val) { - setContextFlag(val, 4096 /* DisallowInContext */); + setContextFlag(val, 8192 /* DisallowInContext */); } function setYieldContext(val) { - setContextFlag(val, 8192 /* YieldContext */); + setContextFlag(val, 16384 /* YieldContext */); } function setDecoratorContext(val) { - setContextFlag(val, 16384 /* DecoratorContext */); + setContextFlag(val, 32768 /* DecoratorContext */); } function setAwaitContext(val) { - setContextFlag(val, 32768 /* AwaitContext */); + setContextFlag(val, 65536 /* AwaitContext */); } function doOutsideOfContext(context, func) { const contextFlagsToClear = context & contextFlags; @@ -29069,52 +29288,52 @@ ${lanes.join("\n")} return func(); } function allowInAnd(func) { - return doOutsideOfContext(4096 /* DisallowInContext */, func); + return doOutsideOfContext(8192 /* DisallowInContext */, func); } function disallowInAnd(func) { - return doInsideOfContext(4096 /* DisallowInContext */, func); + return doInsideOfContext(8192 /* DisallowInContext */, func); } function allowConditionalTypesAnd(func) { - return doOutsideOfContext(65536 /* DisallowConditionalTypesContext */, func); + return doOutsideOfContext(131072 /* DisallowConditionalTypesContext */, func); } function disallowConditionalTypesAnd(func) { - return doInsideOfContext(65536 /* DisallowConditionalTypesContext */, func); + return doInsideOfContext(131072 /* DisallowConditionalTypesContext */, func); } function doInYieldContext(func) { - return doInsideOfContext(8192 /* YieldContext */, func); + return doInsideOfContext(16384 /* YieldContext */, func); } function doInDecoratorContext(func) { - return doInsideOfContext(16384 /* DecoratorContext */, func); + return doInsideOfContext(32768 /* DecoratorContext */, func); } function doInAwaitContext(func) { - return doInsideOfContext(32768 /* AwaitContext */, func); + return doInsideOfContext(65536 /* AwaitContext */, func); } function doOutsideOfAwaitContext(func) { - return doOutsideOfContext(32768 /* AwaitContext */, func); + return doOutsideOfContext(65536 /* AwaitContext */, func); } function doInYieldAndAwaitContext(func) { - return doInsideOfContext(8192 /* YieldContext */ | 32768 /* AwaitContext */, func); + return doInsideOfContext(16384 /* YieldContext */ | 65536 /* AwaitContext */, func); } function doOutsideOfYieldAndAwaitContext(func) { - return doOutsideOfContext(8192 /* YieldContext */ | 32768 /* AwaitContext */, func); + return doOutsideOfContext(16384 /* YieldContext */ | 65536 /* AwaitContext */, func); } function inContext(flags) { return (contextFlags & flags) !== 0; } function inYieldContext() { - return inContext(8192 /* YieldContext */); + return inContext(16384 /* YieldContext */); } function inDisallowInContext() { - return inContext(4096 /* DisallowInContext */); + return inContext(8192 /* DisallowInContext */); } function inDisallowConditionalTypesContext() { - return inContext(65536 /* DisallowConditionalTypesContext */); + return inContext(131072 /* DisallowConditionalTypesContext */); } function inDecoratorContext() { - return inContext(16384 /* DecoratorContext */); + return inContext(32768 /* DecoratorContext */); } function inAwaitContext() { - return inContext(32768 /* AwaitContext */); + return inContext(65536 /* AwaitContext */); } function parseErrorAtCurrentToken(message, ...args) { return parseErrorAt(scanner2.getTokenStart(), scanner2.getTokenEnd(), message, ...args); @@ -29438,7 +29657,7 @@ ${lanes.join("\n")} } if (parseErrorBeforeNextFinishedNode) { parseErrorBeforeNextFinishedNode = false; - node.flags |= 131072 /* ThisNodeHasError */; + node.flags |= 262144 /* ThisNodeHasError */; } return node; } @@ -29467,7 +29686,7 @@ ${lanes.join("\n")} "", /*isSingleQuote*/ void 0 - ) : kind === 281 /* MissingDeclaration */ ? factory2.createMissingDeclaration() : factoryCreateToken(kind); + ) : kind === 282 /* MissingDeclaration */ ? factory2.createMissingDeclaration() : factoryCreateToken(kind); return finishNode(result, pos); } function internIdentifier(text) { @@ -29684,6 +29903,9 @@ ${lanes.join("\n")} case 22 /* HeritageClauses */: return isHeritageClause2(); case 23 /* ImportOrExportSpecifiers */: + if (token() === 161 /* FromKeyword */ && lookAhead(nextTokenIsStringLiteral)) { + return false; + } return tokenIsIdentifierOrKeyword(token()); case 13 /* JsxAttributes */: return tokenIsIdentifierOrKeyword(token()) || token() === 19 /* OpenBraceToken */; @@ -29840,7 +30062,7 @@ ${lanes.join("\n")} if (nodeIsMissing(node) || node.intersectsChange || containsParseError(node)) { return void 0; } - const nodeContextFlags = node.flags & 50720768 /* ContextFlags */; + const nodeContextFlags = node.flags & 101441536 /* ContextFlags */; if (nodeContextFlags !== contextFlags) { return void 0; } @@ -29898,14 +30120,14 @@ ${lanes.join("\n")} function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 175 /* Constructor */: - case 180 /* IndexSignature */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 171 /* PropertyDeclaration */: - case 239 /* SemicolonClassElement */: + case 176 /* Constructor */: + case 181 /* IndexSignature */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 172 /* PropertyDeclaration */: + case 240 /* SemicolonClassElement */: return true; - case 173 /* MethodDeclaration */: + case 174 /* MethodDeclaration */: const methodDeclaration = node; const nameIsConstructor = methodDeclaration.name.kind === 80 /* Identifier */ && methodDeclaration.name.escapedText === "constructor"; return !nameIsConstructor; @@ -29916,8 +30138,8 @@ ${lanes.join("\n")} function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 295 /* CaseClause */: - case 296 /* DefaultClause */: + case 296 /* CaseClause */: + case 297 /* DefaultClause */: return true; } } @@ -29926,65 +30148,65 @@ ${lanes.join("\n")} function isReusableStatement(node) { if (node) { switch (node.kind) { - case 261 /* FunctionDeclaration */: - case 242 /* VariableStatement */: - case 240 /* Block */: - case 244 /* IfStatement */: - case 243 /* ExpressionStatement */: - case 256 /* ThrowStatement */: - case 252 /* ReturnStatement */: - case 254 /* SwitchStatement */: - case 251 /* BreakStatement */: - case 250 /* ContinueStatement */: - case 248 /* ForInStatement */: - case 249 /* ForOfStatement */: - case 247 /* ForStatement */: - case 246 /* WhileStatement */: - case 253 /* WithStatement */: - case 241 /* EmptyStatement */: - case 257 /* TryStatement */: - case 255 /* LabeledStatement */: - case 245 /* DoStatement */: - case 258 /* DebuggerStatement */: - case 271 /* ImportDeclaration */: - case 270 /* ImportEqualsDeclaration */: - case 277 /* ExportDeclaration */: - case 276 /* ExportAssignment */: - case 266 /* ModuleDeclaration */: - case 262 /* ClassDeclaration */: - case 263 /* InterfaceDeclaration */: - case 265 /* EnumDeclaration */: - case 264 /* TypeAliasDeclaration */: + case 262 /* FunctionDeclaration */: + case 243 /* VariableStatement */: + case 241 /* Block */: + case 245 /* IfStatement */: + case 244 /* ExpressionStatement */: + case 257 /* ThrowStatement */: + case 253 /* ReturnStatement */: + case 255 /* SwitchStatement */: + case 252 /* BreakStatement */: + case 251 /* ContinueStatement */: + case 249 /* ForInStatement */: + case 250 /* ForOfStatement */: + case 248 /* ForStatement */: + case 247 /* WhileStatement */: + case 254 /* WithStatement */: + case 242 /* EmptyStatement */: + case 258 /* TryStatement */: + case 256 /* LabeledStatement */: + case 246 /* DoStatement */: + case 259 /* DebuggerStatement */: + case 272 /* ImportDeclaration */: + case 271 /* ImportEqualsDeclaration */: + case 278 /* ExportDeclaration */: + case 277 /* ExportAssignment */: + case 267 /* ModuleDeclaration */: + case 263 /* ClassDeclaration */: + case 264 /* InterfaceDeclaration */: + case 266 /* EnumDeclaration */: + case 265 /* TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 305 /* EnumMember */; + return node.kind === 306 /* EnumMember */; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 179 /* ConstructSignature */: - case 172 /* MethodSignature */: - case 180 /* IndexSignature */: - case 170 /* PropertySignature */: - case 178 /* CallSignature */: + case 180 /* ConstructSignature */: + case 173 /* MethodSignature */: + case 181 /* IndexSignature */: + case 171 /* PropertySignature */: + case 179 /* CallSignature */: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 259 /* VariableDeclaration */) { + if (node.kind !== 260 /* VariableDeclaration */) { return false; } const variableDeclarator = node; return variableDeclarator.initializer === void 0; } function isReusableParameter(node) { - if (node.kind !== 168 /* Parameter */) { + if (node.kind !== 169 /* Parameter */) { return false; } const parameter = node; @@ -30042,6 +30264,9 @@ ${lanes.join("\n")} case 22 /* HeritageClauses */: return parseErrorAtCurrentToken(Diagnostics.Unexpected_token_expected); case 23 /* ImportOrExportSpecifiers */: + if (token() === 161 /* FromKeyword */) { + return parseErrorAtCurrentToken(Diagnostics._0_expected, "}"); + } return parseErrorAtCurrentToken(Diagnostics.Identifier_expected); case 13 /* JsxAttributes */: return parseErrorAtCurrentToken(Diagnostics.Identifier_expected); @@ -30321,14 +30546,14 @@ ${lanes.join("\n")} } function typeHasArrowFunctionBlockingParseError(node) { switch (node.kind) { - case 182 /* TypeReference */: + case 183 /* TypeReference */: return nodeIsMissing(node.typeName); - case 183 /* FunctionType */: - case 184 /* ConstructorType */: { + case 184 /* FunctionType */: + case 185 /* ConstructorType */: { const { parameters, type } = node; return isMissingList(parameters) || typeHasArrowFunctionBlockingParseError(type); } - case 195 /* ParenthesizedType */: + case 196 /* ParenthesizedType */: return typeHasArrowFunctionBlockingParseError(node.type); default: return false; @@ -30620,7 +30845,7 @@ ${lanes.join("\n")} function parseSignatureMember(kind) { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); - if (kind === 179 /* ConstructSignature */) { + if (kind === 180 /* ConstructSignature */) { parseExpected(105 /* NewKeyword */); } const typeParameters = parseTypeParameters(); @@ -30631,7 +30856,7 @@ ${lanes.join("\n")} true ); parseTypeMemberSemicolon(); - const node = kind === 178 /* CallSignature */ ? factory2.createCallSignature(typeParameters, parameters, type) : factory2.createConstructSignature(typeParameters, parameters, type); + const node = kind === 179 /* CallSignature */ ? factory2.createCallSignature(typeParameters, parameters, type) : factory2.createConstructSignature(typeParameters, parameters, type); return withJSDoc(finishNode(node, pos), hasJSDoc); } function isIndexSignature() { @@ -30716,10 +30941,10 @@ ${lanes.join("\n")} } function parseTypeMember() { if (token() === 21 /* OpenParenToken */ || token() === 30 /* LessThanToken */) { - return parseSignatureMember(178 /* CallSignature */); + return parseSignatureMember(179 /* CallSignature */); } if (token() === 105 /* NewKeyword */ && lookAhead(nextTokenIsOpenParenOrLessThan)) { - return parseSignatureMember(179 /* ConstructSignature */); + return parseSignatureMember(180 /* ConstructSignature */); } const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); @@ -30728,10 +30953,10 @@ ${lanes.join("\n")} false ); if (parseContextualModifier(139 /* GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, modifiers, 176 /* GetAccessor */, 4 /* Type */); + return parseAccessorDeclaration(pos, hasJSDoc, modifiers, 177 /* GetAccessor */, 4 /* Type */); } if (parseContextualModifier(153 /* SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, modifiers, 177 /* SetAccessor */, 4 /* Type */); + return parseAccessorDeclaration(pos, hasJSDoc, modifiers, 178 /* SetAccessor */, 4 /* Type */); } if (isIndexSignature()) { return parseIndexSignatureDeclaration(pos, hasJSDoc, modifiers); @@ -30940,7 +31165,7 @@ ${lanes.join("\n")} return finishNode(factory2.createImportTypeAssertionContainer(clause, multiLine), pos); } function parseImportType() { - sourceFlags |= 2097152 /* PossiblyContainsDynamicImport */; + sourceFlags |= 4194304 /* PossiblyContainsDynamicImport */; const pos = getNodePos(); const isTypeOf = parseOptional(114 /* TypeOfKeyword */); parseExpected(102 /* ImportKeyword */); @@ -30965,7 +31190,7 @@ ${lanes.join("\n")} case 159 /* UnknownKeyword */: case 154 /* StringKeyword */: case 150 /* NumberKeyword */: - case 162 /* BigIntKeyword */: + case 163 /* BigIntKeyword */: case 155 /* SymbolKeyword */: case 136 /* BooleanKeyword */: case 157 /* UndefinedKeyword */: @@ -31031,7 +31256,7 @@ ${lanes.join("\n")} case 159 /* UnknownKeyword */: case 154 /* StringKeyword */: case 150 /* NumberKeyword */: - case 162 /* BigIntKeyword */: + case 163 /* BigIntKeyword */: case 136 /* BooleanKeyword */: case 148 /* ReadonlyKeyword */: case 155 /* SymbolKeyword */: @@ -31277,8 +31502,8 @@ ${lanes.join("\n")} return finishNode(factory2.createTypePredicateNode(assertsModifier, parameterName, type), pos); } function parseType() { - if (contextFlags & 40960 /* TypeExcludesFlags */) { - return doOutsideOfContext(40960 /* TypeExcludesFlags */, parseType); + if (contextFlags & 81920 /* TypeExcludesFlags */) { + return doOutsideOfContext(81920 /* TypeExcludesFlags */, parseType); } if (isStartOfFunctionTypeOrConstructorType()) { return parseFunctionOrConstructorType(); @@ -31399,12 +31624,14 @@ ${lanes.join("\n")} return arrowExpression; } const pos = getNodePos(); + const hasJSDoc = hasPrecedingJSDocComment(); const expr = parseBinaryExpressionOrHigher(0 /* Lowest */); if (expr.kind === 80 /* Identifier */ && token() === 39 /* EqualsGreaterThanToken */) { return parseSimpleArrowFunctionExpression( pos, expr, allowReturnTypeInArrowFunction, + hasJSDoc, /*asyncModifier*/ void 0 ); @@ -31450,7 +31677,7 @@ ${lanes.join("\n")} ), pos); } } - function parseSimpleArrowFunctionExpression(pos, identifier, allowReturnTypeInArrowFunction, asyncModifier) { + function parseSimpleArrowFunctionExpression(pos, identifier, allowReturnTypeInArrowFunction, hasJSDoc, asyncModifier) { Debug.assert(token() === 39 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); const parameter = factory2.createParameterDeclaration( /*modifiers*/ @@ -31483,7 +31710,7 @@ ${lanes.join("\n")} equalsGreaterThanToken, body ); - return addJSDocComment(finishNode(node, pos)); + return withJSDoc(finishNode(node, pos), hasJSDoc); } function tryParseParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction) { const triState = isParenthesizedArrowFunctionExpression(); @@ -31611,9 +31838,10 @@ ${lanes.join("\n")} if (token() === 134 /* AsyncKeyword */) { if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) { const pos = getNodePos(); + const hasJSDoc = hasPrecedingJSDocComment(); const asyncModifier = parseModifiersForArrowFunction(); const expr = parseBinaryExpressionOrHigher(0 /* Lowest */); - return parseSimpleArrowFunctionExpression(pos, expr, allowReturnTypeInArrowFunction, asyncModifier); + return parseSimpleArrowFunctionExpression(pos, expr, allowReturnTypeInArrowFunction, hasJSDoc, asyncModifier); } } return void 0; @@ -31667,7 +31895,7 @@ ${lanes.join("\n")} return void 0; } let unwrappedType = type; - while ((unwrappedType == null ? void 0 : unwrappedType.kind) === 195 /* ParenthesizedType */) { + while ((unwrappedType == null ? void 0 : unwrappedType.kind) === 196 /* ParenthesizedType */) { unwrappedType = unwrappedType.type; } const hasJSDocFunctionType = unwrappedType && isJSDocFunctionType(unwrappedType); @@ -31730,7 +31958,7 @@ ${lanes.join("\n")} return parseBinaryExpressionRest(precedence, leftOperand, pos); } function isInOrOfKeyword(t) { - return t === 103 /* InKeyword */ || t === 164 /* OfKeyword */; + return t === 103 /* InKeyword */ || t === 165 /* OfKeyword */; } function parseBinaryExpressionRest(precedence, leftOperand, pos) { while (true) { @@ -31812,7 +32040,7 @@ ${lanes.join("\n")} if (token() === 43 /* AsteriskAsteriskToken */) { const pos = skipTrivia(sourceText, simpleUnaryExpression.pos); const { end } = simpleUnaryExpression; - if (simpleUnaryExpression.kind === 215 /* TypeAssertionExpression */) { + if (simpleUnaryExpression.kind === 216 /* TypeAssertionExpression */) { parseErrorAt(pos, end, Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); } else { Debug.assert(isKeywordOrPunctuation(unaryOperator)); @@ -31899,13 +32127,13 @@ ${lanes.join("\n")} let expression; if (token() === 102 /* ImportKeyword */) { if (lookAhead(nextTokenIsOpenParenOrLessThan)) { - sourceFlags |= 2097152 /* PossiblyContainsDynamicImport */; + sourceFlags |= 4194304 /* PossiblyContainsDynamicImport */; expression = parseTokenNode(); } else if (lookAhead(nextTokenIsDot)) { nextToken(); nextToken(); expression = finishNode(factory2.createMetaProperty(102 /* ImportKeyword */, parseIdentifierName()), pos); - sourceFlags |= 4194304 /* PossiblyContainsImportMeta */; + sourceFlags |= 8388608 /* PossiblyContainsImportMeta */; } else { expression = parseMemberExpressionOrHigher(); } @@ -31952,11 +32180,11 @@ ${lanes.join("\n")} const pos = getNodePos(); const opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); let result; - if (opening.kind === 285 /* JsxOpeningElement */) { + if (opening.kind === 286 /* JsxOpeningElement */) { let children = parseJsxChildren(opening); let closingElement; const lastChild = children[children.length - 1]; - if ((lastChild == null ? void 0 : lastChild.kind) === 283 /* JsxElement */ && !tagNamesAreEquivalent(lastChild.openingElement.tagName, lastChild.closingElement.tagName) && tagNamesAreEquivalent(opening.tagName, lastChild.closingElement.tagName)) { + if ((lastChild == null ? void 0 : lastChild.kind) === 284 /* JsxElement */ && !tagNamesAreEquivalent(lastChild.openingElement.tagName, lastChild.closingElement.tagName) && tagNamesAreEquivalent(opening.tagName, lastChild.closingElement.tagName)) { const end = lastChild.children.end; const newLast = finishNode( factory2.createJsxElement( @@ -31980,10 +32208,10 @@ ${lanes.join("\n")} } } result = finishNode(factory2.createJsxElement(opening, children, closingElement), pos); - } else if (opening.kind === 288 /* JsxOpeningFragment */) { + } else if (opening.kind === 289 /* JsxOpeningFragment */) { result = finishNode(factory2.createJsxFragment(opening, parseJsxChildren(opening), parseJsxClosingFragment(inExpressionContext)), pos); } else { - Debug.assert(opening.kind === 284 /* JsxSelfClosingElement */); + Debug.assert(opening.kind === 285 /* JsxSelfClosingElement */); result = opening; } if (!mustBeUnary && inExpressionContext && token() === 30 /* LessThanToken */) { @@ -32056,7 +32284,7 @@ ${lanes.join("\n")} if (!child) break; list.push(child); - if (isJsxOpeningElement(openingTag) && (child == null ? void 0 : child.kind) === 283 /* JsxElement */ && !tagNamesAreEquivalent(child.openingElement.tagName, child.closingElement.tagName) && tagNamesAreEquivalent(openingTag.tagName, child.closingElement.tagName)) { + if (isJsxOpeningElement(openingTag) && (child == null ? void 0 : child.kind) === 284 /* JsxElement */ && !tagNamesAreEquivalent(child.openingElement.tagName, child.closingElement.tagName) && tagNamesAreEquivalent(openingTag.tagName, child.closingElement.tagName)) { break; } } @@ -32075,7 +32303,7 @@ ${lanes.join("\n")} return finishNode(factory2.createJsxOpeningFragment(), pos); } const tagName = parseJsxElementName(); - const typeArguments = (contextFlags & 262144 /* JavaScriptFile */) === 0 ? tryParseTypeArguments() : void 0; + const typeArguments = (contextFlags & 524288 /* JavaScriptFile */) === 0 ? tryParseTypeArguments() : void 0; const attributes = parseJsxAttributes(); let node; if (token() === 32 /* GreaterThanToken */) { @@ -32253,17 +32481,17 @@ ${lanes.join("\n")} return token() === 29 /* QuestionDotToken */ && lookAhead(nextTokenIsIdentifierOrKeywordOrOpenBracketOrTemplate); } function tryReparseOptionalChain(node) { - if (node.flags & 32 /* OptionalChain */) { + if (node.flags & 64 /* OptionalChain */) { return true; } if (isNonNullExpression(node)) { let expr = node.expression; - while (isNonNullExpression(expr) && !(expr.flags & 32 /* OptionalChain */)) { + while (isNonNullExpression(expr) && !(expr.flags & 64 /* OptionalChain */)) { expr = expr.expression; } - if (expr.flags & 32 /* OptionalChain */) { + if (expr.flags & 64 /* OptionalChain */) { while (isNonNullExpression(node)) { - node.flags |= 32 /* OptionalChain */; + node.flags |= 64 /* OptionalChain */; node = node.expression; } return true; @@ -32329,7 +32557,7 @@ ${lanes.join("\n")} continue; } if (isTemplateStartOfTaggedTemplate()) { - expression = !questionDotToken && expression.kind === 232 /* ExpressionWithTypeArguments */ ? parseTaggedTemplateRest(pos, expression.expression, questionDotToken, expression.typeArguments) : parseTaggedTemplateRest( + expression = !questionDotToken && expression.kind === 233 /* ExpressionWithTypeArguments */ ? parseTaggedTemplateRest(pos, expression.expression, questionDotToken, expression.typeArguments) : parseTaggedTemplateRest( pos, expression, questionDotToken, @@ -32368,8 +32596,8 @@ ${lanes.join("\n")} true ) ); - if (questionDotToken || tag.flags & 32 /* OptionalChain */) { - tagExpression.flags |= 32 /* OptionalChain */; + if (questionDotToken || tag.flags & 64 /* OptionalChain */) { + tagExpression.flags |= 64 /* OptionalChain */; } tagExpression.questionDotToken = questionDotToken; return finishNode(tagExpression, pos); @@ -32392,7 +32620,7 @@ ${lanes.join("\n")} } } if (typeArguments || token() === 21 /* OpenParenToken */) { - if (!questionDotToken && expression.kind === 232 /* ExpressionWithTypeArguments */) { + if (!questionDotToken && expression.kind === 233 /* ExpressionWithTypeArguments */) { typeArguments = expression.typeArguments; expression = expression.expression; } @@ -32421,7 +32649,7 @@ ${lanes.join("\n")} return result; } function parseTypeArgumentsInExpression() { - if ((contextFlags & 262144 /* JavaScriptFile */) !== 0) { + if ((contextFlags & 524288 /* JavaScriptFile */) !== 0) { return void 0; } if (reScanLessThanToken() !== 30 /* LessThanToken */) { @@ -32553,10 +32781,10 @@ ${lanes.join("\n")} true ); if (parseContextualModifier(139 /* GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, modifiers, 176 /* GetAccessor */, 0 /* None */); + return parseAccessorDeclaration(pos, hasJSDoc, modifiers, 177 /* GetAccessor */, 0 /* None */); } if (parseContextualModifier(153 /* SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, modifiers, 177 /* SetAccessor */, 0 /* None */); + return parseAccessorDeclaration(pos, hasJSDoc, modifiers, 178 /* SetAccessor */, 0 /* None */); } const asteriskToken = parseOptionalToken(42 /* AsteriskToken */); const tokenIsIdentifier = isIdentifier2(); @@ -32650,7 +32878,7 @@ ${lanes.join("\n")} false ); let typeArguments; - if (expression.kind === 232 /* ExpressionWithTypeArguments */) { + if (expression.kind === 233 /* ExpressionWithTypeArguments */) { typeArguments = expression.typeArguments; expression = expression.expression; } @@ -32760,7 +32988,7 @@ ${lanes.join("\n")} parseExpected(21 /* OpenParenToken */); let initializer; if (token() !== 27 /* SemicolonToken */) { - if (token() === 115 /* VarKeyword */ || token() === 121 /* LetKeyword */ || token() === 87 /* ConstKeyword */) { + if (token() === 115 /* VarKeyword */ || token() === 121 /* LetKeyword */ || token() === 87 /* ConstKeyword */ || token() === 160 /* UsingKeyword */ && lookAhead(nextTokenIsBindingIdentifierOrStartOfDestructuringOnSameLineDisallowOf) || token() === 135 /* AwaitKeyword */ && lookAhead(nextTokenIsUsingKeywordThenBindingIdentifierOrStartOfObjectDestructuringOnSameLineDisallowOf)) { initializer = parseVariableDeclarationList( /*inForStatementInitializer*/ true @@ -32770,7 +32998,7 @@ ${lanes.join("\n")} } } let node; - if (awaitToken ? parseExpected(164 /* OfKeyword */) : parseOptional(164 /* OfKeyword */)) { + if (awaitToken ? parseExpected(165 /* OfKeyword */) : parseOptional(165 /* OfKeyword */)) { const expression = allowInAnd(() => parseAssignmentExpressionOrHigher( /*allowReturnTypeInArrowFunction*/ true @@ -32794,10 +33022,10 @@ ${lanes.join("\n")} function parseBreakOrContinueStatement(kind) { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); - parseExpected(kind === 251 /* BreakStatement */ ? 83 /* BreakKeyword */ : 88 /* ContinueKeyword */); + parseExpected(kind === 252 /* BreakStatement */ ? 83 /* BreakKeyword */ : 88 /* ContinueKeyword */); const label = canParseSemicolon() ? void 0 : parseIdentifier(); parseSemicolon(); - const node = kind === 251 /* BreakStatement */ ? factory2.createBreakStatement(label) : factory2.createContinueStatement(label); + const node = kind === 252 /* BreakStatement */ ? factory2.createBreakStatement(label) : factory2.createContinueStatement(label); return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseReturnStatement() { @@ -32816,7 +33044,7 @@ ${lanes.join("\n")} const openParenParsed = parseExpected(21 /* OpenParenToken */); const expression = allowInAnd(parseExpression); parseExpectedMatchingBrackets(21 /* OpenParenToken */, 22 /* CloseParenToken */, openParenParsed, openParenPosition); - const statement = doInsideOfContext(33554432 /* InWithStatement */, parseStatement); + const statement = doInsideOfContext(67108864 /* InWithStatement */, parseStatement); return withJSDoc(finishNode(factory2.createWithStatement(expression, statement), pos), hasJSDoc); } function parseCaseClause() { @@ -32956,6 +33184,10 @@ ${lanes.join("\n")} case 86 /* ClassKeyword */: case 94 /* EnumKeyword */: return true; + case 160 /* UsingKeyword */: + return isUsingDeclaration(); + case 135 /* AwaitKeyword */: + return isAwaitUsingDeclaration(); case 120 /* InterfaceKeyword */: case 156 /* TypeKeyword */: return nextTokenIsIdentifierOnSameLine(); @@ -32970,12 +33202,16 @@ ${lanes.join("\n")} case 124 /* ProtectedKeyword */: case 125 /* PublicKeyword */: case 148 /* ReadonlyKeyword */: + const previousToken = token(); nextToken(); if (scanner2.hasPrecedingLineBreak()) { return false; } + if (previousToken === 138 /* DeclareKeyword */ && token() === 156 /* TypeKeyword */) { + return true; + } continue; - case 161 /* GlobalKeyword */: + case 162 /* GlobalKeyword */: nextToken(); return token() === 19 /* OpenBraceToken */ || token() === 80 /* Identifier */ || token() === 95 /* ExportKeyword */; case 102 /* ImportKeyword */: @@ -33008,6 +33244,7 @@ ${lanes.join("\n")} case 19 /* OpenBraceToken */: case 115 /* VarKeyword */: case 121 /* LetKeyword */: + case 160 /* UsingKeyword */: case 100 /* FunctionKeyword */: case 86 /* ClassKeyword */: case 94 /* EnumKeyword */: @@ -33037,7 +33274,7 @@ ${lanes.join("\n")} case 144 /* ModuleKeyword */: case 145 /* NamespaceKeyword */: case 156 /* TypeKeyword */: - case 161 /* GlobalKeyword */: + case 162 /* GlobalKeyword */: return true; case 129 /* AccessorKeyword */: case 125 /* PublicKeyword */: @@ -33057,6 +33294,36 @@ ${lanes.join("\n")} function isLetDeclaration() { return lookAhead(nextTokenIsBindingIdentifierOrStartOfDestructuring); } + function nextTokenIsBindingIdentifierOrStartOfDestructuringOnSameLineDisallowOf() { + return nextTokenIsBindingIdentifierOrStartOfDestructuringOnSameLine( + /*disallowOf*/ + true + ); + } + function nextTokenIsBindingIdentifierOrStartOfDestructuringOnSameLine(disallowOf) { + nextToken(); + if (disallowOf && token() === 165 /* OfKeyword */) + return false; + return (isBindingIdentifier() || token() === 19 /* OpenBraceToken */) && !scanner2.hasPrecedingLineBreak(); + } + function isUsingDeclaration() { + return lookAhead(nextTokenIsBindingIdentifierOrStartOfDestructuringOnSameLine); + } + function nextTokenIsUsingKeywordThenBindingIdentifierOrStartOfObjectDestructuringOnSameLineDisallowOf() { + return nextTokenIsUsingKeywordThenBindingIdentifierOrStartOfObjectDestructuringOnSameLine( + /*disallowOf*/ + true + ); + } + function nextTokenIsUsingKeywordThenBindingIdentifierOrStartOfObjectDestructuringOnSameLine(disallowOf) { + if (nextToken() === 160 /* UsingKeyword */) { + return nextTokenIsBindingIdentifierOrStartOfDestructuringOnSameLine(disallowOf); + } + return false; + } + function isAwaitUsingDeclaration() { + return lookAhead(nextTokenIsUsingKeywordThenBindingIdentifierOrStartOfObjectDestructuringOnSameLine); + } function parseStatement() { switch (token()) { case 27 /* SemicolonToken */: @@ -33083,6 +33350,26 @@ ${lanes.join("\n")} ); } break; + case 135 /* AwaitKeyword */: + if (isAwaitUsingDeclaration()) { + return parseVariableStatement( + getNodePos(), + hasPrecedingJSDocComment(), + /*modifiers*/ + void 0 + ); + } + break; + case 160 /* UsingKeyword */: + if (isUsingDeclaration()) { + return parseVariableStatement( + getNodePos(), + hasPrecedingJSDocComment(), + /*modifiers*/ + void 0 + ); + } + break; case 100 /* FunctionKeyword */: return parseFunctionDeclaration( getNodePos(), @@ -33106,9 +33393,9 @@ ${lanes.join("\n")} case 99 /* ForKeyword */: return parseForOrForInOrForOfStatement(); case 88 /* ContinueKeyword */: - return parseBreakOrContinueStatement(250 /* ContinueStatement */); + return parseBreakOrContinueStatement(251 /* ContinueStatement */); case 83 /* BreakKeyword */: - return parseBreakOrContinueStatement(251 /* BreakStatement */); + return parseBreakOrContinueStatement(252 /* BreakStatement */); case 107 /* ReturnKeyword */: return parseReturnStatement(); case 118 /* WithKeyword */: @@ -33142,7 +33429,7 @@ ${lanes.join("\n")} case 129 /* AccessorKeyword */: case 126 /* StaticKeyword */: case 148 /* ReadonlyKeyword */: - case 161 /* GlobalKeyword */: + case 162 /* GlobalKeyword */: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -33167,15 +33454,15 @@ ${lanes.join("\n")} return node; } for (const m of modifiers) { - m.flags |= 16777216 /* Ambient */; + m.flags |= 33554432 /* Ambient */; } - return doInsideOfContext(16777216 /* Ambient */, () => parseDeclarationWorker(pos, hasJSDoc, modifiers)); + return doInsideOfContext(33554432 /* Ambient */, () => parseDeclarationWorker(pos, hasJSDoc, modifiers)); } else { return parseDeclarationWorker(pos, hasJSDoc, modifiers); } } function tryReuseAmbientDeclaration(pos) { - return doInsideOfContext(16777216 /* Ambient */, () => { + return doInsideOfContext(33554432 /* Ambient */, () => { const node = currentNode(parsingContext, pos); if (node) { return consumeNode(node); @@ -33187,6 +33474,8 @@ ${lanes.join("\n")} case 115 /* VarKeyword */: case 121 /* LetKeyword */: case 87 /* ConstKeyword */: + case 160 /* UsingKeyword */: + case 135 /* AwaitKeyword */: return parseVariableStatement(pos, hasJSDoc, modifiersIn); case 100 /* FunctionKeyword */: return parseFunctionDeclaration(pos, hasJSDoc, modifiersIn); @@ -33198,7 +33487,7 @@ ${lanes.join("\n")} return parseTypeAliasDeclaration(pos, hasJSDoc, modifiersIn); case 94 /* EnumKeyword */: return parseEnumDeclaration(pos, hasJSDoc, modifiersIn); - case 161 /* GlobalKeyword */: + case 162 /* GlobalKeyword */: case 144 /* ModuleKeyword */: case 145 /* NamespaceKeyword */: return parseModuleDeclaration(pos, hasJSDoc, modifiersIn); @@ -33218,7 +33507,7 @@ ${lanes.join("\n")} default: if (modifiersIn) { const missing = createMissingNode( - 281 /* MissingDeclaration */, + 282 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, Diagnostics.Declaration_expected @@ -33230,6 +33519,9 @@ ${lanes.join("\n")} return void 0; } } + function nextTokenIsStringLiteral() { + return nextToken() === 11 /* StringLiteral */; + } function nextTokenIsIdentifierOrStringLiteralOnSameLine() { nextToken(); return !scanner2.hasPrecedingLineBreak() && (isIdentifier2() || token() === 11 /* StringLiteral */); @@ -33282,14 +33574,14 @@ ${lanes.join("\n")} function parseObjectBindingPattern() { const pos = getNodePos(); parseExpected(19 /* OpenBraceToken */); - const elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement); + const elements = allowInAnd(() => parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement)); parseExpected(20 /* CloseBraceToken */); return finishNode(factory2.createObjectBindingPattern(elements), pos); } function parseArrayBindingPattern() { const pos = getNodePos(); parseExpected(23 /* OpenBracketToken */); - const elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement); + const elements = allowInAnd(() => parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement)); parseExpected(24 /* CloseBracketToken */); return finishNode(factory2.createArrayBindingPattern(elements), pos); } @@ -33336,12 +33628,20 @@ ${lanes.join("\n")} case 87 /* ConstKeyword */: flags |= 2 /* Const */; break; + case 160 /* UsingKeyword */: + flags |= 4 /* Using */; + break; + case 135 /* AwaitKeyword */: + Debug.assert(isAwaitUsingDeclaration()); + flags |= 6 /* AwaitUsing */; + nextToken(); + break; default: Debug.fail(); } nextToken(); let declarations; - if (token() === 164 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { + if (token() === 165 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { declarations = createMissingList(); } else { const savedDisallowIn = inDisallowInContext(); @@ -33447,7 +33747,7 @@ ${lanes.join("\n")} function parsePropertyDeclaration(pos, hasJSDoc, modifiers, name, questionToken) { const exclamationToken = !questionToken && !scanner2.hasPrecedingLineBreak() ? parseOptionalToken(54 /* ExclamationToken */) : void 0; const type = parseTypeAnnotation(); - const initializer = doOutsideOfContext(8192 /* YieldContext */ | 32768 /* AwaitContext */ | 4096 /* DisallowInContext */, parseInitializer); + const initializer = doOutsideOfContext(16384 /* YieldContext */ | 65536 /* AwaitContext */ | 8192 /* DisallowInContext */, parseInitializer); parseSemicolonAfterPropertyName(name, type, initializer); const node = factory2.createPropertyDeclaration( modifiers, @@ -33487,7 +33787,7 @@ ${lanes.join("\n")} false ); const body = parseFunctionBlockOrSemicolon(flags); - const node = kind === 176 /* GetAccessor */ ? factory2.createGetAccessorDeclaration(modifiers, name, parameters, type, body) : factory2.createSetAccessorDeclaration(modifiers, name, parameters, body); + const node = kind === 177 /* GetAccessor */ ? factory2.createGetAccessorDeclaration(modifiers, name, parameters, type, body) : factory2.createSetAccessorDeclaration(modifiers, name, parameters, body); node.typeParameters = typeParameters; if (isSetAccessorDeclaration(node)) node.type = type; @@ -33653,10 +33953,10 @@ ${lanes.join("\n")} return parseClassStaticBlockDeclaration(pos, hasJSDoc, modifiers); } if (parseContextualModifier(139 /* GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, modifiers, 176 /* GetAccessor */, 0 /* None */); + return parseAccessorDeclaration(pos, hasJSDoc, modifiers, 177 /* GetAccessor */, 0 /* None */); } if (parseContextualModifier(153 /* SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, modifiers, 177 /* SetAccessor */, 0 /* None */); + return parseAccessorDeclaration(pos, hasJSDoc, modifiers, 178 /* SetAccessor */, 0 /* None */); } if (token() === 137 /* ConstructorKeyword */ || token() === 11 /* StringLiteral */) { const constructorDeclaration = tryParseConstructorDeclaration(pos, hasJSDoc, modifiers); @@ -33671,9 +33971,9 @@ ${lanes.join("\n")} const isAmbient = some(modifiers, isDeclareModifier); if (isAmbient) { for (const m of modifiers) { - m.flags |= 16777216 /* Ambient */; + m.flags |= 33554432 /* Ambient */; } - return doInsideOfContext(16777216 /* Ambient */, () => parsePropertyOrMethodDeclaration(pos, hasJSDoc, modifiers)); + return doInsideOfContext(33554432 /* Ambient */, () => parsePropertyOrMethodDeclaration(pos, hasJSDoc, modifiers)); } else { return parsePropertyOrMethodDeclaration(pos, hasJSDoc, modifiers); } @@ -33704,10 +34004,10 @@ ${lanes.join("\n")} true ); if (token() === 86 /* ClassKeyword */) { - return parseClassDeclarationOrExpression(pos, hasJSDoc, modifiers, 230 /* ClassExpression */); + return parseClassDeclarationOrExpression(pos, hasJSDoc, modifiers, 231 /* ClassExpression */); } const missing = createMissingNode( - 281 /* MissingDeclaration */, + 282 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, Diagnostics.Expression_expected @@ -33722,11 +34022,11 @@ ${lanes.join("\n")} hasPrecedingJSDocComment(), /*modifiers*/ void 0, - 230 /* ClassExpression */ + 231 /* ClassExpression */ ); } function parseClassDeclaration(pos, hasJSDoc, modifiers) { - return parseClassDeclarationOrExpression(pos, hasJSDoc, modifiers, 262 /* ClassDeclaration */); + return parseClassDeclarationOrExpression(pos, hasJSDoc, modifiers, 263 /* ClassDeclaration */); } function parseClassDeclarationOrExpression(pos, hasJSDoc, modifiers, kind) { const savedAwaitContext = inAwaitContext(); @@ -33747,7 +34047,7 @@ ${lanes.join("\n")} members = createMissingList(); } setAwaitContext(savedAwaitContext); - const node = kind === 262 /* ClassDeclaration */ ? factory2.createClassDeclaration(modifiers, name, typeParameters, heritageClauses, members) : factory2.createClassExpression(modifiers, name, typeParameters, heritageClauses, members); + const node = kind === 263 /* ClassDeclaration */ ? factory2.createClassDeclaration(modifiers, name, typeParameters, heritageClauses, members) : factory2.createClassExpression(modifiers, name, typeParameters, heritageClauses, members); return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseNameOfClassDeclarationOrExpression() { @@ -33773,7 +34073,7 @@ ${lanes.join("\n")} function parseExpressionWithTypeArguments() { const pos = getNodePos(); const expression = parseLeftHandSideExpressionOrHigher(); - if (expression.kind === 232 /* ExpressionWithTypeArguments */) { + if (expression.kind === 233 /* ExpressionWithTypeArguments */) { return expression; } const typeArguments = tryParseTypeArguments(); @@ -33799,6 +34099,9 @@ ${lanes.join("\n")} } function parseTypeAliasDeclaration(pos, hasJSDoc, modifiers) { parseExpected(156 /* TypeKeyword */); + if (scanner2.hasPrecedingLineBreak()) { + parseErrorAtCurrentToken(Diagnostics.Line_break_not_permitted_here); + } const name = parseIdentifier(); const typeParameters = parseTypeParameters(); parseExpected(64 /* EqualsToken */); @@ -33839,7 +34142,7 @@ ${lanes.join("\n")} return finishNode(factory2.createModuleBlock(statements), pos); } function parseModuleOrNamespaceDeclaration(pos, hasJSDoc, modifiers, flags) { - const namespaceFlag = flags & 16 /* Namespace */; + const namespaceFlag = flags & 32 /* Namespace */; const name = parseIdentifier(); const body = parseOptional(25 /* DotToken */) ? parseModuleOrNamespaceDeclaration( getNodePos(), @@ -33847,7 +34150,7 @@ ${lanes.join("\n")} false, /*modifiers*/ void 0, - 4 /* NestedNamespace */ | namespaceFlag + 8 /* NestedNamespace */ | namespaceFlag ) : parseModuleBlock(); const node = factory2.createModuleDeclaration(modifiers, name, body, flags); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -33855,9 +34158,9 @@ ${lanes.join("\n")} function parseAmbientExternalModuleDeclaration(pos, hasJSDoc, modifiersIn) { let flags = 0; let name; - if (token() === 161 /* GlobalKeyword */) { + if (token() === 162 /* GlobalKeyword */) { name = parseIdentifier(); - flags |= 1024 /* GlobalAugmentation */; + flags |= 2048 /* GlobalAugmentation */; } else { name = parseLiteralNode(); name.text = internIdentifier(name.text); @@ -33873,10 +34176,10 @@ ${lanes.join("\n")} } function parseModuleDeclaration(pos, hasJSDoc, modifiersIn) { let flags = 0; - if (token() === 161 /* GlobalKeyword */) { + if (token() === 162 /* GlobalKeyword */) { return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, modifiersIn); } else if (parseOptional(145 /* NamespaceKeyword */)) { - flags |= 16 /* Namespace */; + flags |= 32 /* Namespace */; } else { parseExpected(144 /* ModuleKeyword */); if (token() === 11 /* StringLiteral */) { @@ -33914,7 +34217,7 @@ ${lanes.join("\n")} identifier = parseIdentifier(); } let isTypeOnly = false; - if (token() !== 160 /* FromKeyword */ && (identifier == null ? void 0 : identifier.escapedText) === "type" && (isIdentifier2() || tokenAfterImportDefinitelyProducesImportDeclaration())) { + if (token() !== 161 /* FromKeyword */ && (identifier == null ? void 0 : identifier.escapedText) === "type" && (isIdentifier2() || tokenAfterImportDefinitelyProducesImportDeclaration())) { isTypeOnly = true; identifier = isIdentifier2() ? parseIdentifier() : void 0; } @@ -33926,7 +34229,7 @@ ${lanes.join("\n")} token() === 42 /* AsteriskToken */ || // import * token() === 19 /* OpenBraceToken */) { importClause = parseImportClause(identifier, afterImportPos, isTypeOnly); - parseExpected(160 /* FromKeyword */); + parseExpected(161 /* FromKeyword */); } const moduleSpecifier = parseModuleSpecifier(); let assertClause; @@ -33991,7 +34294,7 @@ ${lanes.join("\n")} return token() === 42 /* AsteriskToken */ || token() === 19 /* OpenBraceToken */; } function tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration() { - return token() === 28 /* CommaToken */ || token() === 160 /* FromKeyword */; + return token() === 28 /* CommaToken */ || token() === 161 /* FromKeyword */; } function parseImportEqualsDeclaration(pos, hasJSDoc, modifiers, identifier, isTypeOnly) { parseExpected(64 /* EqualsToken */); @@ -34004,7 +34307,7 @@ ${lanes.join("\n")} function parseImportClause(identifier, pos, isTypeOnly) { let namedBindings; if (!identifier || parseOptional(28 /* CommaToken */)) { - namedBindings = token() === 42 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(274 /* NamedImports */); + namedBindings = token() === 42 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(275 /* NamedImports */); } return finishNode(factory2.createImportClause(isTypeOnly, identifier, namedBindings), pos); } @@ -34040,15 +34343,15 @@ ${lanes.join("\n")} } function parseNamedImportsOrExports(kind) { const pos = getNodePos(); - const node = kind === 274 /* NamedImports */ ? factory2.createNamedImports(parseBracketedList(23 /* ImportOrExportSpecifiers */, parseImportSpecifier, 19 /* OpenBraceToken */, 20 /* CloseBraceToken */)) : factory2.createNamedExports(parseBracketedList(23 /* ImportOrExportSpecifiers */, parseExportSpecifier, 19 /* OpenBraceToken */, 20 /* CloseBraceToken */)); + const node = kind === 275 /* NamedImports */ ? factory2.createNamedImports(parseBracketedList(23 /* ImportOrExportSpecifiers */, parseImportSpecifier, 19 /* OpenBraceToken */, 20 /* CloseBraceToken */)) : factory2.createNamedExports(parseBracketedList(23 /* ImportOrExportSpecifiers */, parseExportSpecifier, 19 /* OpenBraceToken */, 20 /* CloseBraceToken */)); return finishNode(node, pos); } function parseExportSpecifier() { const hasJSDoc = hasPrecedingJSDocComment(); - return withJSDoc(parseImportOrExportSpecifier(280 /* ExportSpecifier */), hasJSDoc); + return withJSDoc(parseImportOrExportSpecifier(281 /* ExportSpecifier */), hasJSDoc); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(275 /* ImportSpecifier */); + return parseImportOrExportSpecifier(276 /* ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { const pos = getNodePos(); @@ -34092,10 +34395,10 @@ ${lanes.join("\n")} parseExpected(130 /* AsKeyword */); name = parseNameWithKeywordCheck(); } - if (kind === 275 /* ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 276 /* ImportSpecifier */ && checkIdentifierIsKeyword) { parseErrorAt(checkIdentifierStart, checkIdentifierEnd, Diagnostics.Identifier_expected); } - const node = kind === 275 /* ImportSpecifier */ ? factory2.createImportSpecifier(isTypeOnly, propertyName, name) : factory2.createExportSpecifier(isTypeOnly, propertyName, name); + const node = kind === 276 /* ImportSpecifier */ ? factory2.createImportSpecifier(isTypeOnly, propertyName, name) : factory2.createExportSpecifier(isTypeOnly, propertyName, name); return finishNode(node, pos); function parseNameWithKeywordCheck() { checkIdentifierIsKeyword = isKeyword(token()) && !isIdentifier2(); @@ -34122,12 +34425,12 @@ ${lanes.join("\n")} if (parseOptional(130 /* AsKeyword */)) { exportClause = parseNamespaceExport(namespaceExportPos); } - parseExpected(160 /* FromKeyword */); + parseExpected(161 /* FromKeyword */); moduleSpecifier = parseModuleSpecifier(); } else { - exportClause = parseNamedImportsOrExports(278 /* NamedExports */); - if (token() === 160 /* FromKeyword */ || token() === 11 /* StringLiteral */ && !scanner2.hasPrecedingLineBreak()) { - parseExpected(160 /* FromKeyword */); + exportClause = parseNamedImportsOrExports(279 /* NamedExports */); + if (token() === 161 /* FromKeyword */ || token() === 11 /* StringLiteral */ && !scanner2.hasPrecedingLineBreak()) { + parseExpected(161 /* FromKeyword */); moduleSpecifier = parseModuleSpecifier(); } } @@ -34232,7 +34535,7 @@ ${lanes.join("\n")} function parseJSDocTypeExpression(mayOmitBraces) { const pos = getNodePos(); const hasBrace = (mayOmitBraces ? parseOptional : parseExpected)(19 /* OpenBraceToken */); - const type = doInsideOfContext(8388608 /* JSDoc */, parseJSDocType); + const type = doInsideOfContext(16777216 /* JSDoc */, parseJSDocType); if (!mayOmitBraces || hasBrace) { parseExpectedJSDoc(20 /* CloseBraceToken */); } @@ -34271,7 +34574,7 @@ ${lanes.join("\n")} void 0, 1 /* JS */ ); - const jsDoc = doInsideOfContext(8388608 /* JSDoc */, () => parseJSDocCommentWorker(start, length2)); + const jsDoc = doInsideOfContext(16777216 /* JSDoc */, () => parseJSDocCommentWorker(start, length2)); const sourceFile = { languageVariant: 0 /* Standard */, text: content }; const diagnostics = attachFileToDiagnostics(parseDiagnostics, sourceFile); clearState(); @@ -34282,9 +34585,9 @@ ${lanes.join("\n")} const saveToken = currentToken; const saveParseDiagnosticsLength = parseDiagnostics.length; const saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; - const comment = doInsideOfContext(8388608 /* JSDoc */, () => parseJSDocCommentWorker(start, length2)); + const comment = doInsideOfContext(16777216 /* JSDoc */, () => parseJSDocCommentWorker(start, length2)); setParent(comment, parent2); - if (contextFlags & 262144 /* JavaScriptFile */) { + if (contextFlags & 524288 /* JavaScriptFile */) { if (!jsDocDiagnostics) { jsDocDiagnostics = []; } @@ -34765,7 +35068,7 @@ ${lanes.join("\n")} switch (node.kind) { case 151 /* ObjectKeyword */: return true; - case 187 /* ArrayType */: + case 188 /* ArrayType */: return isObjectOrObjectArrayTypeReference(node.elementType); default: return isTypeReferenceNode(node) && isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && !node.typeArguments; @@ -34781,7 +35084,7 @@ ${lanes.join("\n")} typeExpression = tryParseTypeExpression(); } const comment = parseTrailingTagComments(start2, getNodePos(), indent2, indentText); - const nestedTypeLiteral = target !== 4 /* CallbackParameter */ && parseNestedTypeLiteral(typeExpression, name, target, indent2); + const nestedTypeLiteral = parseNestedTypeLiteral(typeExpression, name, target, indent2); if (nestedTypeLiteral) { typeExpression = nestedTypeLiteral; isNameFirst = true; @@ -34795,14 +35098,14 @@ ${lanes.join("\n")} let child; let children; while (child = tryParse(() => parseChildParameterOrPropertyTag(target, indent2, name))) { - if (child.kind === 347 /* JSDocParameterTag */ || child.kind === 354 /* JSDocPropertyTag */) { + if (child.kind === 348 /* JSDocParameterTag */ || child.kind === 355 /* JSDocPropertyTag */) { children = append(children, child); - } else if (child.kind === 351 /* JSDocTemplateTag */) { + } else if (child.kind === 352 /* JSDocTemplateTag */) { parseErrorAtRange(child.tagName, Diagnostics.A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag); } } if (children) { - const literal = finishNode(factory2.createJSDocTypeLiteral(children, typeExpression.type.kind === 187 /* ArrayType */), pos); + const literal = finishNode(factory2.createJSDocTypeLiteral(children, typeExpression.type.kind === 188 /* ArrayType */), pos); return finishNode(factory2.createJSDocTypeExpression(literal), pos); } } @@ -34937,11 +35240,11 @@ ${lanes.join("\n")} let jsDocPropertyTags; let hasChildren = false; while (child = tryParse(() => parseChildPropertyTag(indent2))) { - if (child.kind === 351 /* JSDocTemplateTag */) { + if (child.kind === 352 /* JSDocTemplateTag */) { break; } hasChildren = true; - if (child.kind === 350 /* JSDocTypeTag */) { + if (child.kind === 351 /* JSDocTypeTag */) { if (childTypeTag) { const lastError = parseErrorAtCurrentToken(Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); if (lastError) { @@ -34956,7 +35259,7 @@ ${lanes.join("\n")} } } if (hasChildren) { - const isArrayType = typeExpression && typeExpression.type.kind === 187 /* ArrayType */; + const isArrayType = typeExpression && typeExpression.type.kind === 188 /* ArrayType */; const jsdocTypeLiteral = factory2.createJSDocTypeLiteral(jsDocPropertyTags, isArrayType); typeExpression = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ? childTypeTag.typeExpression : finishNode(jsdocTypeLiteral, start2); end2 = typeExpression.end; @@ -34985,12 +35288,12 @@ ${lanes.join("\n")} void 0, typeNameOrNamespaceName, body, - nested ? 4 /* NestedNamespace */ : void 0 + nested ? 8 /* NestedNamespace */ : void 0 ); return finishNode(jsDocNamespaceNode, start2); } if (nested) { - typeNameOrNamespaceName.flags |= 2048 /* IdentifierIsInJSDocNamespace */; + typeNameOrNamespaceName.flags |= 4096 /* IdentifierIsInJSDocNamespace */; } return typeNameOrNamespaceName; } @@ -34999,7 +35302,7 @@ ${lanes.join("\n")} let child; let parameters; while (child = tryParse(() => parseChildParameterOrPropertyTag(4 /* CallbackParameter */, indent2))) { - if (child.kind === 351 /* JSDocTemplateTag */) { + if (child.kind === 352 /* JSDocTemplateTag */) { parseErrorAtRange(child.tagName, Diagnostics.A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag); break; } @@ -35012,7 +35315,7 @@ ${lanes.join("\n")} const returnTag = tryParse(() => { if (parseOptionalJsdoc(60 /* AtToken */)) { const tag = parseTag(indent2); - if (tag && tag.kind === 348 /* JSDocReturnTag */) { + if (tag && tag.kind === 349 /* JSDocReturnTag */) { return tag; } } @@ -35067,7 +35370,7 @@ ${lanes.join("\n")} case 60 /* AtToken */: if (canParseTag) { const child = tryParseChildTag(target, indent2); - if (child && (child.kind === 347 /* JSDocParameterTag */ || child.kind === 354 /* JSDocPropertyTag */) && target !== 4 /* CallbackParameter */ && name && (isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { + if (child && (child.kind === 348 /* JSDocParameterTag */ || child.kind === 355 /* JSDocPropertyTag */) && name && (isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; } return child; @@ -35132,7 +35435,7 @@ ${lanes.join("\n")} if (isBracketed) { skipWhitespace(); parseExpected(64 /* EqualsToken */); - defaultType = doInsideOfContext(8388608 /* JSDoc */, parseJSDocType); + defaultType = doInsideOfContext(16777216 /* JSDoc */, parseJSDocType); parseExpected(24 /* CloseBracketToken */); } if (nodeIsMissing(name)) { @@ -35582,7 +35885,7 @@ ${lanes.join("\n")} })(IncrementalParser || (IncrementalParser = {})); namedArgRegExCache = /* @__PURE__ */ new Map(); tripleSlashXMLCommentStartRegEx = /^\/\/\/\s*<(\S+)\s.*?\/>/im; - singleLinePragmaRegEx = /^\/\/\/?\s*@(\S+)\s*(.*)\s*$/im; + singleLinePragmaRegEx = /^\/\/\/?\s*@([^\s:]+)(.*)\s*$/im; } }); @@ -35968,7 +36271,7 @@ ${lanes.join("\n")} function convertConfigFileToObject(sourceFile, errors, jsonConversionNotifier) { var _a; const rootExpression = (_a = sourceFile.statements[0]) == null ? void 0 : _a.expression; - if (rootExpression && rootExpression.kind !== 209 /* ObjectLiteralExpression */) { + if (rootExpression && rootExpression.kind !== 210 /* ObjectLiteralExpression */) { errors.push(createDiagnosticForNodeInSourceFile( sourceFile, rootExpression, @@ -36020,7 +36323,7 @@ ${lanes.join("\n")} var _a; const result = returnValue ? {} : void 0; for (const element of node.properties) { - if (element.kind !== 302 /* PropertyAssignment */) { + if (element.kind !== 303 /* PropertyAssignment */) { errors.push(createDiagnosticForNodeInSourceFile(sourceFile, element, Diagnostics.Property_assignment_expected)); continue; } @@ -36065,15 +36368,15 @@ ${lanes.join("\n")} return valueExpression.text; case 9 /* NumericLiteral */: return Number(valueExpression.text); - case 223 /* PrefixUnaryExpression */: + case 224 /* PrefixUnaryExpression */: if (valueExpression.operator !== 41 /* MinusToken */ || valueExpression.operand.kind !== 9 /* NumericLiteral */) { break; } return -Number(valueExpression.operand.text); - case 209 /* ObjectLiteralExpression */: + case 210 /* ObjectLiteralExpression */: const objectLiteralExpression = valueExpression; return convertObjectLiteralExpressionToJson(objectLiteralExpression, option); - case 208 /* ArrayLiteralExpression */: + case 209 /* ArrayLiteralExpression */: return convertArrayLiteralExpressionToJson( valueExpression.elements, option && option.element @@ -36456,8 +36759,8 @@ ${lanes.join("\n")} const fileName = configFileName || "tsconfig.json"; const diagnosticMessage = Diagnostics.The_files_list_in_config_file_0_is_empty; const nodeValue = forEachTsConfigPropArray(sourceFile, "files", (property) => property.initializer); - const error = createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, nodeValue, diagnosticMessage, fileName); - errors.push(error); + const error2 = createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, nodeValue, diagnosticMessage, fileName); + errors.push(error2); } else { createCompilerDiagnosticOnlyIfJson(Diagnostics.The_files_list_in_config_file_0_is_empty, configFileName || "tsconfig.json"); } @@ -36564,8 +36867,8 @@ ${lanes.join("\n")} } } } - function isErrorNoInputFiles(error) { - return error.code === Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2.code; + function isErrorNoInputFiles(error2) { + return error2.code === Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2.code; } function getErrorForNoInputFiles({ includeSpecs, excludeSpecs }, configFileName) { return createCompilerDiagnostic( @@ -36586,7 +36889,7 @@ ${lanes.join("\n")} if (shouldReportNoInputFiles(fileNames, canJsonReportNoInutFiles)) { configParseDiagnostics.push(getErrorForNoInputFiles(configFileSpecs, configFileName)); } else { - filterMutate(configParseDiagnostics, (error) => !isErrorNoInputFiles(error)); + filterMutate(configParseDiagnostics, (error2) => !isErrorNoInputFiles(error2)); } return existingErrors !== configParseDiagnostics.length; } @@ -36994,19 +37297,19 @@ ${lanes.join("\n")} const wildcardFiles = arrayFrom(wildcardFileMap.values()); return literalFiles.concat(wildcardFiles, arrayFrom(wildCardJsonFileMap.values())); } - function isExcludedFile(pathToCheck, spec, basePath, useCaseSensitiveFileNames, currentDirectory) { + function isExcludedFile(pathToCheck, spec, basePath, useCaseSensitiveFileNames2, currentDirectory) { const { validatedFilesSpec, validatedIncludeSpecs, validatedExcludeSpecs } = spec; if (!length(validatedIncludeSpecs) || !length(validatedExcludeSpecs)) return false; basePath = normalizePath(basePath); - const keyMapper = createGetCanonicalFileName(useCaseSensitiveFileNames); + const keyMapper = createGetCanonicalFileName(useCaseSensitiveFileNames2); if (validatedFilesSpec) { for (const fileName of validatedFilesSpec) { if (keyMapper(getNormalizedAbsolutePath(fileName, basePath)) === pathToCheck) return false; } } - return matchesExcludeWorker(pathToCheck, validatedExcludeSpecs, useCaseSensitiveFileNames, currentDirectory, basePath); + return matchesExcludeWorker(pathToCheck, validatedExcludeSpecs, useCaseSensitiveFileNames2, currentDirectory, basePath); } function invalidDotDotAfterRecursiveWildcard(s) { const wildcardIndex = startsWith(s, "**/") ? 0 : s.indexOf("/**/"); @@ -37016,17 +37319,17 @@ ${lanes.join("\n")} const lastDotIndex = endsWith(s, "/..") ? s.length : s.lastIndexOf("/../"); return lastDotIndex > wildcardIndex; } - function matchesExclude(pathToCheck, excludeSpecs, useCaseSensitiveFileNames, currentDirectory) { + function matchesExclude(pathToCheck, excludeSpecs, useCaseSensitiveFileNames2, currentDirectory) { return matchesExcludeWorker( pathToCheck, filter(excludeSpecs, (spec) => !invalidDotDotAfterRecursiveWildcard(spec)), - useCaseSensitiveFileNames, + useCaseSensitiveFileNames2, currentDirectory ); } - function matchesExcludeWorker(pathToCheck, excludeSpecs, useCaseSensitiveFileNames, currentDirectory, basePath) { + function matchesExcludeWorker(pathToCheck, excludeSpecs, useCaseSensitiveFileNames2, currentDirectory, basePath) { const excludePattern = getRegularExpressionForWildcard(excludeSpecs, combinePaths(normalizePath(currentDirectory), basePath), "exclude"); - const excludeRegex = excludePattern && getRegexFromPattern(excludePattern, useCaseSensitiveFileNames); + const excludeRegex = excludePattern && getRegexFromPattern(excludePattern, useCaseSensitiveFileNames2); if (!excludeRegex) return false; if (excludeRegex.test(pathToCheck)) @@ -37056,9 +37359,9 @@ ${lanes.join("\n")} return [Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec]; } } - function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExcludeSpecs: exclude }, path, useCaseSensitiveFileNames) { + function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExcludeSpecs: exclude }, path, useCaseSensitiveFileNames2) { const rawExcludeRegex = getRegularExpressionForWildcard(exclude, path, "exclude"); - const excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i"); + const excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames2 ? "" : "i"); const wildcardDirectories = {}; if (include !== void 0) { const recursiveKeys = []; @@ -37067,7 +37370,7 @@ ${lanes.join("\n")} if (excludeRegex && excludeRegex.test(spec)) { continue; } - const match = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames); + const match = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2); if (match) { const { key, flags } = match; const existingFlags = wildcardDirectories[key]; @@ -37082,7 +37385,7 @@ ${lanes.join("\n")} for (const key in wildcardDirectories) { if (hasProperty(wildcardDirectories, key)) { for (const recursiveKey of recursiveKeys) { - if (key !== recursiveKey && containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { + if (key !== recursiveKey && containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames2)) { delete wildcardDirectories[key]; } } @@ -37091,20 +37394,20 @@ ${lanes.join("\n")} } return wildcardDirectories; } - function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames) { + function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2) { const match = wildcardDirectoryPattern.exec(spec); if (match) { const questionWildcardIndex = spec.indexOf("?"); const starWildcardIndex = spec.indexOf("*"); const lastDirectorySeperatorIndex = spec.lastIndexOf(directorySeparator); return { - key: useCaseSensitiveFileNames ? match[0] : toFileNameLowerCase(match[0]), + key: useCaseSensitiveFileNames2 ? match[0] : toFileNameLowerCase(match[0]), flags: questionWildcardIndex !== -1 && questionWildcardIndex < lastDirectorySeperatorIndex || starWildcardIndex !== -1 && starWildcardIndex < lastDirectorySeperatorIndex ? 1 /* Recursive */ : 0 /* None */ }; } if (isImplicitGlob(spec.substring(spec.lastIndexOf(directorySeparator) + 1))) { return { - key: removeTrailingDirectorySeparator(useCaseSensitiveFileNames ? spec : toFileNameLowerCase(spec)), + key: removeTrailingDirectorySeparator(useCaseSensitiveFileNames2 ? spec : toFileNameLowerCase(spec)), flags: 1 /* Recursive */ }; } @@ -37254,6 +37557,7 @@ ${lanes.join("\n")} ["es2015.symbol", "lib.es2015.symbol.d.ts"], ["es2015.symbol.wellknown", "lib.es2015.symbol.wellknown.d.ts"], ["es2016.array.include", "lib.es2016.array.include.d.ts"], + ["es2017.date", "lib.es2017.date.d.ts"], ["es2017.object", "lib.es2017.object.d.ts"], ["es2017.sharedmemory", "lib.es2017.sharedmemory.d.ts"], ["es2017.string", "lib.es2017.string.d.ts"], @@ -37289,14 +37593,18 @@ ${lanes.join("\n")} ["es2022.string", "lib.es2022.string.d.ts"], ["es2022.regexp", "lib.es2022.regexp.d.ts"], ["es2023.array", "lib.es2023.array.d.ts"], + ["es2023.collection", "lib.es2023.collection.d.ts"], ["esnext.array", "lib.es2023.array.d.ts"], + ["esnext.collection", "lib.es2023.collection.d.ts"], ["esnext.symbol", "lib.es2019.symbol.d.ts"], ["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"], ["esnext.intl", "lib.esnext.intl.d.ts"], + ["esnext.disposable", "lib.esnext.disposable.d.ts"], ["esnext.bigint", "lib.es2020.bigint.d.ts"], ["esnext.string", "lib.es2022.string.d.ts"], ["esnext.promise", "lib.es2021.promise.d.ts"], ["esnext.weakref", "lib.es2021.weakref.d.ts"], + ["esnext.decorators", "lib.esnext.decorators.d.ts"], ["decorators", "lib.decorators.d.ts"], ["decorators.legacy", "lib.decorators.legacy.d.ts"] ]; @@ -37704,6 +38012,7 @@ ${lanes.join("\n")} { name: "checkJs", type: "boolean", + affectsModuleResolution: true, showInSimplifiedHelpView: true, category: Diagnostics.JavaScript_Support, description: Diagnostics.Enable_error_reporting_in_type_checked_JavaScript_files, @@ -37930,7 +38239,7 @@ ${lanes.join("\n")} strictFlag: true, category: Diagnostics.Type_Checking, description: Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any, - defaultValueDescription: false + defaultValueDescription: Diagnostics.false_unless_strict_is_set }, { name: "alwaysStrict", @@ -38784,6 +39093,18 @@ ${lanes.join("\n")} result.push("JSON"); return result.join(", "); } + function extensionsToExtensionsArray(extensions) { + const result = []; + if (extensions & 1 /* TypeScript */) + result.push(...supportedTSImplementationExtensions); + if (extensions & 2 /* JavaScript */) + result.push(...supportedJSExtensionsFlat); + if (extensions & 4 /* Declaration */) + result.push(...supportedDeclarationExtensions); + if (extensions & 8 /* Json */) + result.push(".json" /* Json */); + return result; + } function resolvedTypeScriptOnly(resolved) { if (!resolved) { return void 0; @@ -38956,8 +39277,8 @@ ${lanes.join("\n")} return typeRoots; } function arePathsEqual(path1, path2, host) { - const useCaseSensitiveFileNames = typeof host.useCaseSensitiveFileNames === "function" ? host.useCaseSensitiveFileNames() : host.useCaseSensitiveFileNames; - return comparePaths(path1, path2, !useCaseSensitiveFileNames) === 0 /* EqualTo */; + const useCaseSensitiveFileNames2 = typeof host.useCaseSensitiveFileNames === "function" ? host.useCaseSensitiveFileNames() : host.useCaseSensitiveFileNames; + return comparePaths(path1, path2, !useCaseSensitiveFileNames2) === 0 /* EqualTo */; } function getOriginalAndResolvedFileName(fileName, host, traceEnabled) { const resolvedFileName = realPath(fileName, host, traceEnabled); @@ -39260,7 +39581,7 @@ ${lanes.join("\n")} return str + "}"; } function getKeyForCompilerOptions(options, affectingOptionDeclarations) { - return affectingOptionDeclarations.map((option) => compilerOptionValueToString(getCompilerOptionValue(options, option))).join("|") + (options.pathsBasePath ? `|${options.pathsBasePath}` : void 0); + return affectingOptionDeclarations.map((option) => compilerOptionValueToString(getCompilerOptionValue(options, option))).join("|") + `|${options.pathsBasePath}`; } function createCacheWithRedirects(ownOptions) { const redirectsMap = /* @__PURE__ */ new Map(); @@ -40220,7 +40541,7 @@ ${lanes.join("\n")} arrayIsEqualTo ); for (const conditions of conditionSets) { - const loadPackageJsonExportsState = { ...loadPackageJsonMainState, failedLookupLocations: [], conditions }; + const loadPackageJsonExportsState = { ...loadPackageJsonMainState, failedLookupLocations: [], conditions, host }; const exportResolutions = loadEntrypointsFromExportMap( packageJsonInfo, packageJsonInfo.contents.packageJsonContent.exports, @@ -40252,23 +40573,42 @@ ${lanes.join("\n")} return entrypoints; function loadEntrypointsFromTargetExports(target) { var _a, _b; - if (typeof target === "string" && startsWith(target, "./") && target.indexOf("*") === -1) { - const partsAfterFirst = getPathComponents(target).slice(2); - if (partsAfterFirst.indexOf("..") >= 0 || partsAfterFirst.indexOf(".") >= 0 || partsAfterFirst.indexOf("node_modules") >= 0) { - return false; - } - const resolvedTarget = combinePaths(scope.packageDirectory, target); - const finalPath = getNormalizedAbsolutePath(resolvedTarget, (_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a)); - const result = loadFileNameFromPackageJsonField( - extensions, - finalPath, - /*onlyRecordFailures*/ - false, - state - ); - if (result) { - entrypoints = appendIfUnique(entrypoints, result, (a, b) => a.path === b.path); - return true; + if (typeof target === "string" && startsWith(target, "./")) { + if (target.indexOf("*") >= 0 && state.host.readDirectory) { + if (target.indexOf("*") !== target.lastIndexOf("*")) { + return false; + } + state.host.readDirectory( + scope.packageDirectory, + extensionsToExtensionsArray(extensions), + /*excludes*/ + void 0, + [changeAnyExtension(target.replace("*", "**/*"), getDeclarationEmitExtensionForPath(target))] + ).forEach((entry) => { + entrypoints = appendIfUnique(entrypoints, { + path: entry, + ext: getAnyExtensionFromPath(entry), + resolvedUsingTsExtension: void 0 + }); + }); + } else { + const partsAfterFirst = getPathComponents(target).slice(2); + if (partsAfterFirst.indexOf("..") >= 0 || partsAfterFirst.indexOf(".") >= 0 || partsAfterFirst.indexOf("node_modules") >= 0) { + return false; + } + const resolvedTarget = combinePaths(scope.packageDirectory, target); + const finalPath = getNormalizedAbsolutePath(resolvedTarget, (_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a)); + const result = loadFileNameFromPackageJsonField( + extensions, + finalPath, + /*onlyRecordFailures*/ + false, + state + ); + if (result) { + entrypoints = appendIfUnique(entrypoints, result, (a, b) => a.path === b.path); + return true; + } } } else if (Array.isArray(target)) { for (const t of target) { @@ -40477,6 +40817,9 @@ ${lanes.join("\n")} } const trailingParts = parts.slice(nameParts.length); const subpath = !length(trailingParts) ? "." : `.${directorySeparator}${trailingParts.join(directorySeparator)}`; + if (getAllowJSCompilerOption(state.compilerOptions) && !pathContainsNodeModules(directory)) { + return loadModuleFromExports(scope, extensions, subpath, state, cache, redirectedReference); + } const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */); const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */); return loadModuleFromExports(scope, priorityExtensions, subpath, state, cache, redirectedReference) || loadModuleFromExports(scope, secondaryExtensions, subpath, state, cache, redirectedReference); @@ -40824,13 +41167,10 @@ ${lanes.join("\n")} function combineDirectoryPath(root, dir) { return ensureTrailingDirectorySeparator(combinePaths(root, dir)); } - function useCaseSensitiveFileNames() { - return !state.host.useCaseSensitiveFileNames ? true : typeof state.host.useCaseSensitiveFileNames === "boolean" ? state.host.useCaseSensitiveFileNames : state.host.useCaseSensitiveFileNames(); - } function tryLoadInputFileForPath(finalPath, entry, packagePath, isImports2) { var _a, _b, _c, _d; - if (!state.isConfigLookup && (state.compilerOptions.declarationDir || state.compilerOptions.outDir) && finalPath.indexOf("/node_modules/") === -1 && (state.compilerOptions.configFile ? containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames()) : true)) { - const getCanonicalFileName = hostGetCanonicalFileName({ useCaseSensitiveFileNames }); + if (!state.isConfigLookup && (state.compilerOptions.declarationDir || state.compilerOptions.outDir) && finalPath.indexOf("/node_modules/") === -1 && (state.compilerOptions.configFile ? containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames(state)) : true)) { + const getCanonicalFileName = hostGetCanonicalFileName({ useCaseSensitiveFileNames: () => useCaseSensitiveFileNames(state) }); const commonSourceDirGuesses = []; if (state.compilerOptions.rootDir || state.compilerOptions.composite && state.compilerOptions.configFilePath) { const commonDir = toAbsolutePath(getCommonSourceDirectory(state.compilerOptions, () => [], ((_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a)) || "", getCanonicalFileName)); @@ -40859,7 +41199,7 @@ ${lanes.join("\n")} for (const commonSourceDirGuess of commonSourceDirGuesses) { const candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess); for (const candidateDir of candidateDirectories) { - if (containsPath(candidateDir, finalPath, !useCaseSensitiveFileNames())) { + if (containsPath(candidateDir, finalPath, !useCaseSensitiveFileNames(state))) { const pathFragment = finalPath.slice(candidateDir.length + 1); const possibleInputBase = combinePaths(commonSourceDirGuess, pathFragment); const jsAndDtsExtensions = [".mjs" /* Mjs */, ".cjs" /* Cjs */, ".js" /* Js */, ".json" /* Json */, ".d.mts" /* Dmts */, ".d.cts" /* Dcts */, ".d.ts" /* Dts */]; @@ -40869,7 +41209,7 @@ ${lanes.join("\n")} for (const possibleExt of inputExts) { if (!extensionIsOk(extensions, possibleExt)) continue; - const possibleInputWithInputExtension = changeAnyExtension(possibleInputBase, possibleExt, ext, !useCaseSensitiveFileNames()); + const possibleInputWithInputExtension = changeAnyExtension(possibleInputBase, possibleExt, ext, !useCaseSensitiveFileNames(state)); if (state.host.fileExists(possibleInputWithInputExtension)) { return toSearchResult(withPackageId(scope, loadFileNameFromPackageJsonField( extensions, @@ -40943,11 +41283,13 @@ ${lanes.join("\n")} const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */); const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */); if (priorityExtensions) { + traceIfEnabled(state, Diagnostics.Searching_all_ancestor_node_modules_directories_for_preferred_extensions_Colon_0, formatExtensions(priorityExtensions)); const result = lookup(priorityExtensions); if (result) return result; } if (secondaryExtensions && !typesScopeOnly) { + traceIfEnabled(state, Diagnostics.Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0, formatExtensions(secondaryExtensions)); return lookup(secondaryExtensions); } function lookup(extensions2) { @@ -41283,6 +41625,9 @@ ${lanes.join("\n")} trace(state.host, diagnostic, ...args); } } + function useCaseSensitiveFileNames(state) { + return !state.host.useCaseSensitiveFileNames ? true : typeof state.host.useCaseSensitiveFileNames === "boolean" ? state.host.useCaseSensitiveFileNames : state.host.useCaseSensitiveFileNames(); + } var typeScriptVersion, nodeModulesAtTypes, NodeResolutionFeatures, nodeModulesPathPart, mangledScopedPackageSeparator; var init_moduleNameResolver = __esm({ "src/compiler/moduleNameResolver.ts"() { @@ -41331,23 +41676,23 @@ ${lanes.join("\n")} } function getModuleInstanceStateWorker(node, visited) { switch (node.kind) { - case 263 /* InterfaceDeclaration */: - case 264 /* TypeAliasDeclaration */: + case 264 /* InterfaceDeclaration */: + case 265 /* TypeAliasDeclaration */: return 0 /* NonInstantiated */; - case 265 /* EnumDeclaration */: + case 266 /* EnumDeclaration */: if (isEnumConst(node)) { return 2 /* ConstEnumOnly */; } break; - case 271 /* ImportDeclaration */: - case 270 /* ImportEqualsDeclaration */: + case 272 /* ImportDeclaration */: + case 271 /* ImportEqualsDeclaration */: if (!hasSyntacticModifier(node, 1 /* Export */)) { return 0 /* NonInstantiated */; } break; - case 277 /* ExportDeclaration */: + case 278 /* ExportDeclaration */: const exportDeclaration = node; - if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 278 /* NamedExports */) { + if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 279 /* NamedExports */) { let state = 0 /* NonInstantiated */; for (const specifier of exportDeclaration.exportClause.elements) { const specifierState = getModuleInstanceStateForAliasTarget(specifier, visited); @@ -41361,7 +41706,7 @@ ${lanes.join("\n")} return state; } break; - case 267 /* ModuleBlock */: { + case 268 /* ModuleBlock */: { let state = 0 /* NonInstantiated */; forEachChild(node, (n) => { const childState = getModuleInstanceStateCached(n, visited); @@ -41380,10 +41725,10 @@ ${lanes.join("\n")} }); return state; } - case 266 /* ModuleDeclaration */: + case 267 /* ModuleDeclaration */: return getModuleInstanceState(node, visited); case 80 /* Identifier */: - if (node.flags & 2048 /* IdentifierIsInJSDocNamespace */) { + if (node.flags & 4096 /* IdentifierIsInJSDocNamespace */) { return 0 /* NonInstantiated */; } } @@ -41413,6 +41758,9 @@ ${lanes.join("\n")} if (found === 1 /* Instantiated */) { return found; } + if (statement.kind === 271 /* ImportEqualsDeclaration */) { + found = 1 /* Instantiated */; + } } } if (found !== void 0) { @@ -41546,7 +41894,7 @@ ${lanes.join("\n")} } } function getDeclarationName(node) { - if (node.kind === 276 /* ExportAssignment */) { + if (node.kind === 277 /* ExportAssignment */) { return node.isExportEquals ? "export=" /* ExportEquals */ : "default" /* Default */; } const name = getNameOfDeclaration(node); @@ -41555,7 +41903,7 @@ ${lanes.join("\n")} const moduleName = getTextOfIdentifierOrLiteral(name); return isGlobalScopeAugmentation(node) ? "__global" : `"${moduleName}"`; } - if (name.kind === 166 /* ComputedPropertyName */) { + if (name.kind === 167 /* ComputedPropertyName */) { const nameExpression = name.expression; if (isStringOrNumericLiteralLike(nameExpression)) { return escapeLeadingUnderscores(nameExpression.text); @@ -41580,31 +41928,31 @@ ${lanes.join("\n")} return isPropertyNameLiteral(name) ? getEscapedTextOfIdentifierOrLiteral(name) : void 0; } switch (node.kind) { - case 175 /* Constructor */: + case 176 /* Constructor */: return "__constructor" /* Constructor */; - case 183 /* FunctionType */: - case 178 /* CallSignature */: - case 329 /* JSDocSignature */: + case 184 /* FunctionType */: + case 179 /* CallSignature */: + case 330 /* JSDocSignature */: return "__call" /* Call */; - case 184 /* ConstructorType */: - case 179 /* ConstructSignature */: + case 185 /* ConstructorType */: + case 180 /* ConstructSignature */: return "__new" /* New */; - case 180 /* IndexSignature */: + case 181 /* IndexSignature */: return "__index" /* Index */; - case 277 /* ExportDeclaration */: + case 278 /* ExportDeclaration */: return "__export" /* ExportStar */; - case 311 /* SourceFile */: + case 312 /* SourceFile */: return "export=" /* ExportEquals */; - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: if (getAssignmentDeclarationKind(node) === 2 /* ModuleExports */) { return "export=" /* ExportEquals */; } Debug.fail("Unknown binary declaration kind"); break; - case 323 /* JSDocFunctionType */: + case 324 /* JSDocFunctionType */: return isJSDocConstructSignature(node) ? "__new" /* New */ : "__call" /* Call */; - case 168 /* Parameter */: - Debug.assert(node.parent.kind === 323 /* JSDocFunctionType */, "Impossible parameter parent kind", () => `parent is: ${Debug.formatSyntaxKind(node.parent.kind)}, expected JSDocFunctionType`); + case 169 /* Parameter */: + Debug.assert(node.parent.kind === 324 /* JSDocFunctionType */, "Impossible parameter parent kind", () => `parent is: ${Debug.formatSyntaxKind(node.parent.kind)}, expected JSDocFunctionType`); const functionType = node.parent; const index = functionType.parameters.indexOf(node); return "arg" + index; @@ -41651,7 +41999,7 @@ ${lanes.join("\n")} messageNeedsName = false; multipleDefaultExports = true; } else { - if (symbol.declarations && symbol.declarations.length && (node.kind === 276 /* ExportAssignment */ && !node.isExportEquals)) { + if (symbol.declarations && symbol.declarations.length && (node.kind === 277 /* ExportAssignment */ && !node.isExportEquals)) { message = Diagnostics.A_module_cannot_have_multiple_default_exports; messageNeedsName = false; multipleDefaultExports = true; @@ -41690,7 +42038,7 @@ ${lanes.join("\n")} function declareModuleMember(node, symbolFlags, symbolExcludes) { const hasExportModifier = !!(getCombinedModifierFlags(node) & 1 /* Export */) || jsdocTreatAsExported(node); if (symbolFlags & 2097152 /* Alias */) { - if (node.kind === 280 /* ExportSpecifier */ || node.kind === 270 /* ImportEqualsDeclaration */ && hasExportModifier) { + if (node.kind === 281 /* ExportSpecifier */ || node.kind === 271 /* ImportEqualsDeclaration */ && hasExportModifier) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { Debug.assertNode(container, canHaveLocals); @@ -41706,7 +42054,7 @@ ${lanes.join("\n")} } else { if (isJSDocTypeAlias(node)) Debug.assert(isInJSFile(node)); - if (!isAmbientModule(node) && (hasExportModifier || container.flags & 64 /* ExportContext */)) { + if (!isAmbientModule(node) && (hasExportModifier || container.flags & 128 /* ExportContext */)) { if (!canHaveLocals(container) || !container.locals || hasSyntacticModifier(node, 1024 /* Default */) && !getDeclarationName(node)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } @@ -41757,7 +42105,7 @@ ${lanes.join("\n")} const saveThisParentContainer = thisParentContainer; const savedBlockScopeContainer = blockScopeContainer; if (containerFlags & 1 /* IsContainer */) { - if (node.kind !== 218 /* ArrowFunction */) { + if (node.kind !== 219 /* ArrowFunction */) { thisParentContainer = container; } container = blockScopeContainer = node; @@ -41779,35 +42127,35 @@ ${lanes.join("\n")} const saveExceptionTarget = currentExceptionTarget; const saveActiveLabelList = activeLabelList; const saveHasExplicitReturn = hasExplicitReturn; - const isImmediatelyInvoked = containerFlags & 16 /* IsFunctionExpression */ && !hasSyntacticModifier(node, 512 /* Async */) && !node.asteriskToken && !!getImmediatelyInvokedFunctionExpression(node) || node.kind === 174 /* ClassStaticBlockDeclaration */; + const isImmediatelyInvoked = containerFlags & 16 /* IsFunctionExpression */ && !hasSyntacticModifier(node, 512 /* Async */) && !node.asteriskToken && !!getImmediatelyInvokedFunctionExpression(node) || node.kind === 175 /* ClassStaticBlockDeclaration */; if (!isImmediatelyInvoked) { currentFlow = initFlowNode({ flags: 2 /* Start */ }); if (containerFlags & (16 /* IsFunctionExpression */ | 128 /* IsObjectLiteralOrClassExpressionMethodOrAccessor */)) { currentFlow.node = node; } } - currentReturnTarget = isImmediatelyInvoked || node.kind === 175 /* Constructor */ || isInJSFile(node) && (node.kind === 261 /* FunctionDeclaration */ || node.kind === 217 /* FunctionExpression */) ? createBranchLabel() : void 0; + currentReturnTarget = isImmediatelyInvoked || node.kind === 176 /* Constructor */ || isInJSFile(node) && (node.kind === 262 /* FunctionDeclaration */ || node.kind === 218 /* FunctionExpression */) ? createBranchLabel() : void 0; currentExceptionTarget = void 0; currentBreakTarget = void 0; currentContinueTarget = void 0; activeLabelList = void 0; hasExplicitReturn = false; bindChildren(node); - node.flags &= ~2816 /* ReachabilityAndEmitFlags */; + node.flags &= ~5632 /* ReachabilityAndEmitFlags */; if (!(currentFlow.flags & 1 /* Unreachable */) && containerFlags & 8 /* IsFunctionLike */ && nodeIsPresent(node.body)) { - node.flags |= 256 /* HasImplicitReturn */; + node.flags |= 512 /* HasImplicitReturn */; if (hasExplicitReturn) - node.flags |= 512 /* HasExplicitReturn */; + node.flags |= 1024 /* HasExplicitReturn */; node.endFlowNode = currentFlow; } - if (node.kind === 311 /* SourceFile */) { + if (node.kind === 312 /* SourceFile */) { node.flags |= emitFlags; node.endFlowNode = currentFlow; } if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); currentFlow = finishFlowLabel(currentReturnTarget); - if (node.kind === 175 /* Constructor */ || node.kind === 174 /* ClassStaticBlockDeclaration */ || isInJSFile(node) && (node.kind === 261 /* FunctionDeclaration */ || node.kind === 217 /* FunctionExpression */)) { + if (node.kind === 176 /* Constructor */ || node.kind === 175 /* ClassStaticBlockDeclaration */ || isInJSFile(node) && (node.kind === 262 /* FunctionDeclaration */ || node.kind === 218 /* FunctionExpression */)) { node.returnFlowNode = currentFlow; } } @@ -41824,7 +42172,7 @@ ${lanes.join("\n")} seenThisKeyword = false; bindChildren(node); Debug.assertNotNode(node, isIdentifier); - node.flags = seenThisKeyword ? node.flags | 128 /* ContainsThis */ : node.flags & ~128 /* ContainsThis */; + node.flags = seenThisKeyword ? node.flags | 256 /* ContainsThis */ : node.flags & ~256 /* ContainsThis */; } else { bindChildren(node); } @@ -41833,8 +42181,8 @@ ${lanes.join("\n")} blockScopeContainer = savedBlockScopeContainer; } function bindEachFunctionsFirst(nodes) { - bindEach(nodes, (n) => n.kind === 261 /* FunctionDeclaration */ ? bind(n) : void 0); - bindEach(nodes, (n) => n.kind !== 261 /* FunctionDeclaration */ ? bind(n) : void 0); + bindEach(nodes, (n) => n.kind === 262 /* FunctionDeclaration */ ? bind(n) : void 0); + bindEach(nodes, (n) => n.kind !== 262 /* FunctionDeclaration */ ? bind(n) : void 0); } function bindEach(nodes, bindFunction = bind) { if (nodes === void 0) { @@ -41854,59 +42202,59 @@ ${lanes.join("\n")} inAssignmentPattern = saveInAssignmentPattern; return; } - if (node.kind >= 242 /* FirstStatement */ && node.kind <= 258 /* LastStatement */ && !options.allowUnreachableCode) { + if (node.kind >= 243 /* FirstStatement */ && node.kind <= 259 /* LastStatement */ && !options.allowUnreachableCode) { node.flowNode = currentFlow; } switch (node.kind) { - case 246 /* WhileStatement */: + case 247 /* WhileStatement */: bindWhileStatement(node); break; - case 245 /* DoStatement */: + case 246 /* DoStatement */: bindDoStatement(node); break; - case 247 /* ForStatement */: + case 248 /* ForStatement */: bindForStatement(node); break; - case 248 /* ForInStatement */: - case 249 /* ForOfStatement */: + case 249 /* ForInStatement */: + case 250 /* ForOfStatement */: bindForInOrForOfStatement(node); break; - case 244 /* IfStatement */: + case 245 /* IfStatement */: bindIfStatement(node); break; - case 252 /* ReturnStatement */: - case 256 /* ThrowStatement */: + case 253 /* ReturnStatement */: + case 257 /* ThrowStatement */: bindReturnOrThrow(node); break; - case 251 /* BreakStatement */: - case 250 /* ContinueStatement */: + case 252 /* BreakStatement */: + case 251 /* ContinueStatement */: bindBreakOrContinueStatement(node); break; - case 257 /* TryStatement */: + case 258 /* TryStatement */: bindTryStatement(node); break; - case 254 /* SwitchStatement */: + case 255 /* SwitchStatement */: bindSwitchStatement(node); break; - case 268 /* CaseBlock */: + case 269 /* CaseBlock */: bindCaseBlock(node); break; - case 295 /* CaseClause */: + case 296 /* CaseClause */: bindCaseClause(node); break; - case 243 /* ExpressionStatement */: + case 244 /* ExpressionStatement */: bindExpressionStatement(node); break; - case 255 /* LabeledStatement */: + case 256 /* LabeledStatement */: bindLabeledStatement(node); break; - case 223 /* PrefixUnaryExpression */: + case 224 /* PrefixUnaryExpression */: bindPrefixUnaryExpressionFlow(node); break; - case 224 /* PostfixUnaryExpression */: + case 225 /* PostfixUnaryExpression */: bindPostfixUnaryExpressionFlow(node); break; - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: if (isDestructuringAssignment(node)) { inAssignmentPattern = saveInAssignmentPattern; bindDestructuringAssignmentFlow(node); @@ -41914,49 +42262,49 @@ ${lanes.join("\n")} } bindBinaryExpressionFlow(node); break; - case 219 /* DeleteExpression */: + case 220 /* DeleteExpression */: bindDeleteExpressionFlow(node); break; - case 226 /* ConditionalExpression */: + case 227 /* ConditionalExpression */: bindConditionalExpressionFlow(node); break; - case 259 /* VariableDeclaration */: + case 260 /* VariableDeclaration */: bindVariableDeclarationFlow(node); break; - case 210 /* PropertyAccessExpression */: - case 211 /* ElementAccessExpression */: + case 211 /* PropertyAccessExpression */: + case 212 /* ElementAccessExpression */: bindAccessExpressionFlow(node); break; - case 212 /* CallExpression */: + case 213 /* CallExpression */: bindCallExpressionFlow(node); break; - case 234 /* NonNullExpression */: + case 235 /* NonNullExpression */: bindNonNullExpressionFlow(node); break; - case 352 /* JSDocTypedefTag */: - case 344 /* JSDocCallbackTag */: - case 346 /* JSDocEnumTag */: + case 353 /* JSDocTypedefTag */: + case 345 /* JSDocCallbackTag */: + case 347 /* JSDocEnumTag */: bindJSDocTypeAlias(node); break; - case 311 /* SourceFile */: { + case 312 /* SourceFile */: { bindEachFunctionsFirst(node.statements); bind(node.endOfFileToken); break; } - case 240 /* Block */: - case 267 /* ModuleBlock */: + case 241 /* Block */: + case 268 /* ModuleBlock */: bindEachFunctionsFirst(node.statements); break; - case 207 /* BindingElement */: + case 208 /* BindingElement */: bindBindingElementFlow(node); break; - case 168 /* Parameter */: + case 169 /* Parameter */: bindParameterFlow(node); break; - case 209 /* ObjectLiteralExpression */: - case 208 /* ArrayLiteralExpression */: - case 302 /* PropertyAssignment */: - case 229 /* SpreadElement */: + case 210 /* ObjectLiteralExpression */: + case 209 /* ArrayLiteralExpression */: + case 303 /* PropertyAssignment */: + case 230 /* SpreadElement */: inAssignmentPattern = saveInAssignmentPattern; default: bindEachChild(node); @@ -41970,19 +42318,19 @@ ${lanes.join("\n")} case 80 /* Identifier */: case 81 /* PrivateIdentifier */: case 110 /* ThisKeyword */: - case 210 /* PropertyAccessExpression */: - case 211 /* ElementAccessExpression */: + case 211 /* PropertyAccessExpression */: + case 212 /* ElementAccessExpression */: return containsNarrowableReference(expr); - case 212 /* CallExpression */: + case 213 /* CallExpression */: return hasNarrowableArgument(expr); - case 216 /* ParenthesizedExpression */: - case 234 /* NonNullExpression */: + case 217 /* ParenthesizedExpression */: + case 235 /* NonNullExpression */: return isNarrowingExpression(expr.expression); - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: return isNarrowingBinaryExpression(expr); - case 223 /* PrefixUnaryExpression */: + case 224 /* PrefixUnaryExpression */: return expr.operator === 54 /* ExclamationToken */ && isNarrowingExpression(expr.operand); - case 220 /* TypeOfExpression */: + case 221 /* TypeOfExpression */: return isNarrowingExpression(expr.expression); } return false; @@ -42001,7 +42349,7 @@ ${lanes.join("\n")} } } } - if (expr.expression.kind === 210 /* PropertyAccessExpression */ && containsNarrowableReference(expr.expression.expression)) { + if (expr.expression.kind === 211 /* PropertyAccessExpression */ && containsNarrowableReference(expr.expression.expression)) { return true; } return false; @@ -42032,9 +42380,9 @@ ${lanes.join("\n")} } function isNarrowableOperand(expr) { switch (expr.kind) { - case 216 /* ParenthesizedExpression */: + case 217 /* ParenthesizedExpression */: return isNarrowableOperand(expr.expression); - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: switch (expr.operatorToken.kind) { case 64 /* EqualsToken */: return isNarrowableOperand(expr.left); @@ -42107,21 +42455,21 @@ ${lanes.join("\n")} function isStatementCondition(node) { const parent3 = node.parent; switch (parent3.kind) { - case 244 /* IfStatement */: - case 246 /* WhileStatement */: - case 245 /* DoStatement */: + case 245 /* IfStatement */: + case 247 /* WhileStatement */: + case 246 /* DoStatement */: return parent3.expression === node; - case 247 /* ForStatement */: - case 226 /* ConditionalExpression */: + case 248 /* ForStatement */: + case 227 /* ConditionalExpression */: return parent3.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 216 /* ParenthesizedExpression */) { + if (node.kind === 217 /* ParenthesizedExpression */) { node = node.expression; - } else if (node.kind === 223 /* PrefixUnaryExpression */ && node.operator === 54 /* ExclamationToken */) { + } else if (node.kind === 224 /* PrefixUnaryExpression */ && node.operator === 54 /* ExclamationToken */) { node = node.operand; } else { return isLogicalOrCoalescingBinaryExpression(node); @@ -42164,7 +42512,7 @@ ${lanes.join("\n")} } function setContinueTarget(node, target) { let label = activeLabelList; - while (label && node.parent.kind === 255 /* LabeledStatement */) { + while (label && node.parent.kind === 256 /* LabeledStatement */) { label.continueTarget = target; label = label.next; node = node.parent; @@ -42215,12 +42563,12 @@ ${lanes.join("\n")} bind(node.expression); addAntecedent(preLoopLabel, currentFlow); currentFlow = preLoopLabel; - if (node.kind === 249 /* ForOfStatement */) { + if (node.kind === 250 /* ForOfStatement */) { bind(node.awaitModifier); } addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 260 /* VariableDeclarationList */) { + if (node.initializer.kind !== 261 /* VariableDeclarationList */) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -42242,7 +42590,7 @@ ${lanes.join("\n")} } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 252 /* ReturnStatement */) { + if (node.kind === 253 /* ReturnStatement */) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -42259,7 +42607,7 @@ ${lanes.join("\n")} return void 0; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - const flowLabel = node.kind === 251 /* BreakStatement */ ? breakTarget : continueTarget; + const flowLabel = node.kind === 252 /* BreakStatement */ ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -42329,7 +42677,7 @@ ${lanes.join("\n")} preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - const hasDefault = forEach(node.caseBlock.clauses, (c) => c.kind === 296 /* DefaultClause */); + const hasDefault = forEach(node.caseBlock.clauses, (c) => c.kind === 297 /* DefaultClause */); node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; if (!hasDefault) { addAntecedent(postSwitchLabel, createFlowSwitchClause(preSwitchCaseFlow, node, 0, 0)); @@ -42372,7 +42720,7 @@ ${lanes.join("\n")} maybeBindExpressionFlowIfCall(node.expression); } function maybeBindExpressionFlowIfCall(node) { - if (node.kind === 212 /* CallExpression */) { + if (node.kind === 213 /* CallExpression */) { const call = node; if (call.expression.kind !== 108 /* SuperKeyword */ && isDottedName(call.expression)) { currentFlow = createFlowCall(currentFlow, call); @@ -42398,7 +42746,7 @@ ${lanes.join("\n")} currentFlow = finishFlowLabel(postStatementLabel); } function bindDestructuringTargetFlow(node) { - if (node.kind === 225 /* BinaryExpression */ && node.operatorToken.kind === 64 /* EqualsToken */) { + if (node.kind === 226 /* BinaryExpression */ && node.operatorToken.kind === 64 /* EqualsToken */) { bindAssignmentTargetFlow(node.left); } else { bindAssignmentTargetFlow(node); @@ -42407,21 +42755,21 @@ ${lanes.join("\n")} function bindAssignmentTargetFlow(node) { if (isNarrowableReference(node)) { currentFlow = createFlowMutation(16 /* Assignment */, currentFlow, node); - } else if (node.kind === 208 /* ArrayLiteralExpression */) { + } else if (node.kind === 209 /* ArrayLiteralExpression */) { for (const e of node.elements) { - if (e.kind === 229 /* SpreadElement */) { + if (e.kind === 230 /* SpreadElement */) { bindAssignmentTargetFlow(e.expression); } else { bindDestructuringTargetFlow(e); } } - } else if (node.kind === 209 /* ObjectLiteralExpression */) { + } else if (node.kind === 210 /* ObjectLiteralExpression */) { for (const p of node.properties) { - if (p.kind === 302 /* PropertyAssignment */) { + if (p.kind === 303 /* PropertyAssignment */) { bindDestructuringTargetFlow(p.initializer); - } else if (p.kind === 303 /* ShorthandPropertyAssignment */) { + } else if (p.kind === 304 /* ShorthandPropertyAssignment */) { bindAssignmentTargetFlow(p.name); - } else if (p.kind === 304 /* SpreadAssignment */) { + } else if (p.kind === 305 /* SpreadAssignment */) { bindAssignmentTargetFlow(p.expression); } } @@ -42552,7 +42900,7 @@ ${lanes.join("\n")} const operator = node.operatorToken.kind; if (isAssignmentOperator(operator) && !isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 64 /* EqualsToken */ && node.left.kind === 211 /* ElementAccessExpression */) { + if (operator === 64 /* EqualsToken */ && node.left.kind === 212 /* ElementAccessExpression */) { const elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowMutation(256 /* ArrayMutation */, currentFlow, node); @@ -42580,7 +42928,7 @@ ${lanes.join("\n")} } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 210 /* PropertyAccessExpression */) { + if (node.expression.kind === 211 /* PropertyAccessExpression */) { bindAssignmentTargetFlow(node.expression); } } @@ -42645,7 +42993,7 @@ ${lanes.join("\n")} } function bindJSDocTypeAlias(node) { bind(node.tagName); - if (node.kind !== 346 /* JSDocEnumTag */ && node.fullName) { + if (node.kind !== 347 /* JSDocEnumTag */ && node.fullName) { setParent(node.fullName, node); setParentRecursive( node.fullName, @@ -42660,7 +43008,7 @@ ${lanes.join("\n")} function bindJSDocClassTag(node) { bindEachChild(node); const host = getHostSignatureFromJSDoc(node); - if (host && host.kind !== 173 /* MethodDeclaration */) { + if (host && host.kind !== 174 /* MethodDeclaration */) { addDeclarationToSymbol(host.symbol, host, 32 /* Class */); } } @@ -42673,15 +43021,15 @@ ${lanes.join("\n")} } function bindOptionalChainRest(node) { switch (node.kind) { - case 210 /* PropertyAccessExpression */: + case 211 /* PropertyAccessExpression */: bind(node.questionDotToken); bind(node.name); break; - case 211 /* ElementAccessExpression */: + case 212 /* ElementAccessExpression */: bind(node.questionDotToken); bind(node.argumentExpression); break; - case 212 /* CallExpression */: + case 213 /* CallExpression */: bind(node.questionDotToken); bindEach(node.typeArguments); bindEach(node.arguments); @@ -42728,7 +43076,7 @@ ${lanes.join("\n")} bindOptionalChainFlow(node); } else { const expr = skipParentheses(node.expression); - if (expr.kind === 217 /* FunctionExpression */ || expr.kind === 218 /* ArrowFunction */) { + if (expr.kind === 218 /* FunctionExpression */ || expr.kind === 219 /* ArrowFunction */) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -42739,7 +43087,7 @@ ${lanes.join("\n")} } } } - if (node.expression.kind === 210 /* PropertyAccessExpression */) { + if (node.expression.kind === 211 /* PropertyAccessExpression */) { const propertyAccess = node.expression; if (isIdentifier(propertyAccess.name) && isNarrowableOperand(propertyAccess.expression) && isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowMutation(256 /* ArrayMutation */, currentFlow, node); @@ -42754,39 +43102,39 @@ ${lanes.join("\n")} } function declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) { switch (container.kind) { - case 266 /* ModuleDeclaration */: + case 267 /* ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 311 /* SourceFile */: + case 312 /* SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 230 /* ClassExpression */: - case 262 /* ClassDeclaration */: + case 231 /* ClassExpression */: + case 263 /* ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 265 /* EnumDeclaration */: + case 266 /* EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 186 /* TypeLiteral */: - case 328 /* JSDocTypeLiteral */: - case 209 /* ObjectLiteralExpression */: - case 263 /* InterfaceDeclaration */: - case 291 /* JsxAttributes */: + case 187 /* TypeLiteral */: + case 329 /* JSDocTypeLiteral */: + case 210 /* ObjectLiteralExpression */: + case 264 /* InterfaceDeclaration */: + case 292 /* JsxAttributes */: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 183 /* FunctionType */: - case 184 /* ConstructorType */: - case 178 /* CallSignature */: - case 179 /* ConstructSignature */: - case 329 /* JSDocSignature */: - case 180 /* IndexSignature */: - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: - case 175 /* Constructor */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: - case 323 /* JSDocFunctionType */: - case 174 /* ClassStaticBlockDeclaration */: - case 264 /* TypeAliasDeclaration */: - case 199 /* MappedType */: + case 184 /* FunctionType */: + case 185 /* ConstructorType */: + case 179 /* CallSignature */: + case 180 /* ConstructSignature */: + case 330 /* JSDocSignature */: + case 181 /* IndexSignature */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: + case 176 /* Constructor */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: + case 324 /* JSDocFunctionType */: + case 175 /* ClassStaticBlockDeclaration */: + case 265 /* TypeAliasDeclaration */: + case 200 /* MappedType */: if (container.locals) Debug.assertNode(container, canHaveLocals); return declareSymbol( @@ -42817,10 +43165,10 @@ ${lanes.join("\n")} return !!body && body.statements.some((s) => isExportDeclaration(s) || isExportAssignment(s)); } function setExportContextFlag(node) { - if (node.flags & 16777216 /* Ambient */ && !hasExportDeclarations(node)) { - node.flags |= 64 /* ExportContext */; + if (node.flags & 33554432 /* Ambient */ && !hasExportDeclarations(node)) { + node.flags |= 128 /* ExportContext */; } else { - node.flags &= ~64 /* ExportContext */; + node.flags &= ~128 /* ExportContext */; } } function bindModuleDeclaration(node) { @@ -42888,10 +43236,10 @@ ${lanes.join("\n")} } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 266 /* ModuleDeclaration */: + case 267 /* ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 311 /* SourceFile */: + case 312 /* SourceFile */: if (isExternalOrCommonJsModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -42923,7 +43271,7 @@ ${lanes.join("\n")} const saveCurrentFlow = currentFlow; for (const typeAlias of delayedTypeAliases) { const host = typeAlias.parent.parent; - container = findAncestor(host.parent, (n) => !!(getContainerFlags(n) & 1 /* IsContainer */)) || file; + container = getEnclosingContainer(host) || file; blockScopeContainer = getEnclosingBlockScopeContainer(host) || file; currentFlow = initFlowNode({ flags: 2 /* Start */ }); parent2 = typeAlias; @@ -42981,7 +43329,7 @@ ${lanes.join("\n")} currentFlow = saveCurrentFlow; } function checkContextualIdentifier(node) { - if (!file.parseDiagnostics.length && !(node.flags & 16777216 /* Ambient */) && !(node.flags & 8388608 /* JSDoc */) && !isIdentifierName(node)) { + if (!file.parseDiagnostics.length && !(node.flags & 33554432 /* Ambient */) && !(node.flags & 16777216 /* JSDoc */) && !isIdentifierName(node)) { const originalKeywordKind = identifierToKeywordKind(node); if (originalKeywordKind === void 0) { return; @@ -42999,14 +43347,14 @@ ${lanes.join("\n")} Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module, declarationNameToString(node) )); - } else if (node.flags & 32768 /* AwaitContext */) { + } else if (node.flags & 65536 /* AwaitContext */) { file.bindDiagnostics.push(createDiagnosticForNode2( node, Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here, declarationNameToString(node) )); } - } else if (originalKeywordKind === 127 /* YieldKeyword */ && node.flags & 8192 /* YieldContext */) { + } else if (originalKeywordKind === 127 /* YieldKeyword */ && node.flags & 16384 /* YieldContext */) { file.bindDiagnostics.push(createDiagnosticForNode2( node, Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here, @@ -43094,7 +43442,7 @@ ${lanes.join("\n")} } function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2 /* ES2015 */) { - if (blockScopeContainer.kind !== 311 /* SourceFile */ && blockScopeContainer.kind !== 266 /* ModuleDeclaration */ && !isFunctionLikeOrClassStaticBlockDeclaration(blockScopeContainer)) { + if (blockScopeContainer.kind !== 312 /* SourceFile */ && blockScopeContainer.kind !== 267 /* ModuleDeclaration */ && !isFunctionLikeOrClassStaticBlockDeclaration(blockScopeContainer)) { const errorSpan = getErrorSpanForNode(file, node); file.bindDiagnostics.push(createFileDiagnostic( file, @@ -43156,7 +43504,7 @@ ${lanes.join("\n")} node.tracingPath = file.path; const saveInStrictMode = inStrictMode; bindWorker(node); - if (node.kind > 164 /* LastToken */) { + if (node.kind > 165 /* LastToken */) { const saveParent = parent2; parent2 = node; const containerFlags = getContainerFlags(node); @@ -43213,7 +43561,7 @@ ${lanes.join("\n")} function bindWorker(node) { switch (node.kind) { case 80 /* Identifier */: - if (node.flags & 2048 /* IdentifierIsInJSDocNamespace */) { + if (node.flags & 4096 /* IdentifierIsInJSDocNamespace */) { let parentNode = node.parent; while (parentNode && !isJSDocTypeAlias(parentNode)) { parentNode = parentNode.parent; @@ -43222,23 +43570,23 @@ ${lanes.join("\n")} break; } case 110 /* ThisKeyword */: - if (currentFlow && (isExpression(node) || parent2.kind === 303 /* ShorthandPropertyAssignment */)) { + if (currentFlow && (isExpression(node) || parent2.kind === 304 /* ShorthandPropertyAssignment */)) { node.flowNode = currentFlow; } return checkContextualIdentifier(node); - case 165 /* QualifiedName */: + case 166 /* QualifiedName */: if (currentFlow && isPartOfTypeQuery(node)) { node.flowNode = currentFlow; } break; - case 235 /* MetaProperty */: + case 236 /* MetaProperty */: case 108 /* SuperKeyword */: node.flowNode = currentFlow; break; case 81 /* PrivateIdentifier */: return checkPrivateIdentifier(node); - case 210 /* PropertyAccessExpression */: - case 211 /* ElementAccessExpression */: + case 211 /* PropertyAccessExpression */: + case 212 /* ElementAccessExpression */: const expr = node; if (currentFlow && isNarrowableReference(expr)) { expr.flowNode = currentFlow; @@ -43257,7 +43605,7 @@ ${lanes.join("\n")} ); } break; - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: const specialKind = getAssignmentDeclarationKind(node); switch (specialKind) { case 1 /* ExportsProperty */: @@ -43292,81 +43640,81 @@ ${lanes.join("\n")} Debug.fail("Unknown binary expression special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 298 /* CatchClause */: + case 299 /* CatchClause */: return checkStrictModeCatchClause(node); - case 219 /* DeleteExpression */: + case 220 /* DeleteExpression */: return checkStrictModeDeleteExpression(node); - case 224 /* PostfixUnaryExpression */: + case 225 /* PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 223 /* PrefixUnaryExpression */: + case 224 /* PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 253 /* WithStatement */: + case 254 /* WithStatement */: return checkStrictModeWithStatement(node); - case 255 /* LabeledStatement */: + case 256 /* LabeledStatement */: return checkStrictModeLabeledStatement(node); - case 196 /* ThisType */: + case 197 /* ThisType */: seenThisKeyword = true; return; - case 181 /* TypePredicate */: + case 182 /* TypePredicate */: break; - case 167 /* TypeParameter */: + case 168 /* TypeParameter */: return bindTypeParameter(node); - case 168 /* Parameter */: + case 169 /* Parameter */: return bindParameter(node); - case 259 /* VariableDeclaration */: + case 260 /* VariableDeclaration */: return bindVariableDeclarationOrBindingElement(node); - case 207 /* BindingElement */: + case 208 /* BindingElement */: node.flowNode = currentFlow; return bindVariableDeclarationOrBindingElement(node); - case 171 /* PropertyDeclaration */: - case 170 /* PropertySignature */: + case 172 /* PropertyDeclaration */: + case 171 /* PropertySignature */: return bindPropertyWorker(node); - case 302 /* PropertyAssignment */: - case 303 /* ShorthandPropertyAssignment */: + case 303 /* PropertyAssignment */: + case 304 /* ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */); - case 305 /* EnumMember */: + case 306 /* EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 900095 /* EnumMemberExcludes */); - case 178 /* CallSignature */: - case 179 /* ConstructSignature */: - case 180 /* IndexSignature */: + case 179 /* CallSignature */: + case 180 /* ConstructSignature */: + case 181 /* IndexSignature */: return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */); - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: return bindPropertyOrMethodOrAccessor( node, 8192 /* Method */ | (node.questionToken ? 16777216 /* Optional */ : 0 /* None */), isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 103359 /* MethodExcludes */ ); - case 261 /* FunctionDeclaration */: + case 262 /* FunctionDeclaration */: return bindFunctionDeclaration(node); - case 175 /* Constructor */: + case 176 /* Constructor */: return declareSymbolAndAddToSymbolTable( node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */ ); - case 176 /* GetAccessor */: + case 177 /* GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 46015 /* GetAccessorExcludes */); - case 177 /* SetAccessor */: + case 178 /* SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 78783 /* SetAccessorExcludes */); - case 183 /* FunctionType */: - case 323 /* JSDocFunctionType */: - case 329 /* JSDocSignature */: - case 184 /* ConstructorType */: + case 184 /* FunctionType */: + case 324 /* JSDocFunctionType */: + case 330 /* JSDocSignature */: + case 185 /* ConstructorType */: return bindFunctionOrConstructorType(node); - case 186 /* TypeLiteral */: - case 328 /* JSDocTypeLiteral */: - case 199 /* MappedType */: + case 187 /* TypeLiteral */: + case 329 /* JSDocTypeLiteral */: + case 200 /* MappedType */: return bindAnonymousTypeWorker(node); - case 338 /* JSDocClassTag */: + case 339 /* JSDocClassTag */: return bindJSDocClassTag(node); - case 209 /* ObjectLiteralExpression */: + case 210 /* ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: return bindFunctionExpression(node); - case 212 /* CallExpression */: + case 213 /* CallExpression */: const assignmentKind = getAssignmentDeclarationKind(node); switch (assignmentKind) { case 7 /* ObjectDefinePropertyValue */: @@ -43384,60 +43732,60 @@ ${lanes.join("\n")} bindCallExpression(node); } break; - case 230 /* ClassExpression */: - case 262 /* ClassDeclaration */: + case 231 /* ClassExpression */: + case 263 /* ClassDeclaration */: inStrictMode = true; return bindClassLikeDeclaration(node); - case 263 /* InterfaceDeclaration */: + case 264 /* InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* Interface */, 788872 /* InterfaceExcludes */); - case 264 /* TypeAliasDeclaration */: + case 265 /* TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */); - case 265 /* EnumDeclaration */: + case 266 /* EnumDeclaration */: return bindEnumDeclaration(node); - case 266 /* ModuleDeclaration */: + case 267 /* ModuleDeclaration */: return bindModuleDeclaration(node); - case 291 /* JsxAttributes */: + case 292 /* JsxAttributes */: return bindJsxAttributes(node); - case 290 /* JsxAttribute */: + case 291 /* JsxAttribute */: return bindJsxAttribute(node, 4 /* Property */, 0 /* PropertyExcludes */); - case 270 /* ImportEqualsDeclaration */: - case 273 /* NamespaceImport */: - case 275 /* ImportSpecifier */: - case 280 /* ExportSpecifier */: + case 271 /* ImportEqualsDeclaration */: + case 274 /* NamespaceImport */: + case 276 /* ImportSpecifier */: + case 281 /* ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */); - case 269 /* NamespaceExportDeclaration */: + case 270 /* NamespaceExportDeclaration */: return bindNamespaceExportDeclaration(node); - case 272 /* ImportClause */: + case 273 /* ImportClause */: return bindImportClause(node); - case 277 /* ExportDeclaration */: + case 278 /* ExportDeclaration */: return bindExportDeclaration(node); - case 276 /* ExportAssignment */: + case 277 /* ExportAssignment */: return bindExportAssignment(node); - case 311 /* SourceFile */: + case 312 /* SourceFile */: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 240 /* Block */: + case 241 /* Block */: if (!isFunctionLikeOrClassStaticBlockDeclaration(node.parent)) { return; } - case 267 /* ModuleBlock */: + case 268 /* ModuleBlock */: return updateStrictModeStatementList(node.statements); - case 347 /* JSDocParameterTag */: - if (node.parent.kind === 329 /* JSDocSignature */) { + case 348 /* JSDocParameterTag */: + if (node.parent.kind === 330 /* JSDocSignature */) { return bindParameter(node); } - if (node.parent.kind !== 328 /* JSDocTypeLiteral */) { + if (node.parent.kind !== 329 /* JSDocTypeLiteral */) { break; } - case 354 /* JSDocPropertyTag */: + case 355 /* JSDocPropertyTag */: const propTag = node; - const flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 322 /* JSDocOptionalType */ ? 4 /* Property */ | 16777216 /* Optional */ : 4 /* Property */; + const flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 323 /* JSDocOptionalType */ ? 4 /* Property */ | 16777216 /* Optional */ : 4 /* Property */; return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* PropertyExcludes */); - case 352 /* JSDocTypedefTag */: - case 344 /* JSDocCallbackTag */: - case 346 /* JSDocEnumTag */: + case 353 /* JSDocTypedefTag */: + case 345 /* JSDocCallbackTag */: + case 347 /* JSDocEnumTag */: return (delayedTypeAliases || (delayedTypeAliases = [])).push(node); - case 345 /* JSDocOverloadTag */: + case 346 /* JSDocOverloadTag */: return bind(node.typeExpression); } } @@ -43589,8 +43937,8 @@ ${lanes.join("\n")} false ); switch (thisContainer.kind) { - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: let constructorSymbol = thisContainer.symbol; if (isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 64 /* EqualsToken */) { const l = thisContainer.parent.left; @@ -43608,12 +43956,12 @@ ${lanes.join("\n")} addDeclarationToSymbol(constructorSymbol, constructorSymbol.valueDeclaration, 32 /* Class */); } break; - case 175 /* Constructor */: - case 171 /* PropertyDeclaration */: - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 174 /* ClassStaticBlockDeclaration */: + case 176 /* Constructor */: + case 172 /* PropertyDeclaration */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 175 /* ClassStaticBlockDeclaration */: const containingClass = thisContainer.parent; const symbolTable = isStatic(thisContainer) ? containingClass.symbol.exports : containingClass.symbol.members; if (hasDynamicName(node)) { @@ -43630,7 +43978,7 @@ ${lanes.join("\n")} ); } break; - case 311 /* SourceFile */: + case 312 /* SourceFile */: if (hasDynamicName(node)) { break; } else if (thisContainer.commonJsModuleIndicator) { @@ -43639,7 +43987,7 @@ ${lanes.join("\n")} declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111550 /* FunctionScopedVariableExcludes */); } break; - case 266 /* ModuleDeclaration */: + case 267 /* ModuleDeclaration */: break; default: Debug.failBadSyntaxKind(thisContainer); @@ -43667,7 +44015,7 @@ ${lanes.join("\n")} function bindSpecialPropertyDeclaration(node) { if (node.expression.kind === 110 /* ThisKeyword */) { bindThisPropertyAssignment(node); - } else if (isBindableStaticAccessExpression(node) && node.parent.parent.kind === 311 /* SourceFile */) { + } else if (isBindableStaticAccessExpression(node) && node.parent.parent.kind === 312 /* SourceFile */) { if (isPrototypeAccess(node.expression)) { bindPrototypePropertyAssignment(node, node.parent); } else { @@ -43716,7 +44064,7 @@ ${lanes.join("\n")} } function bindObjectDefinePropertyAssignment(node) { let namespaceSymbol = lookupSymbolForPropertyAccess(node.arguments[0]); - const isToplevel = node.parent.parent.kind === 311 /* SourceFile */; + const isToplevel = node.parent.parent.kind === 312 /* SourceFile */; namespaceSymbol = bindPotentiallyMissingNamespaces( namespaceSymbol, node.arguments[0], @@ -43830,7 +44178,7 @@ ${lanes.join("\n")} declareSymbol(symbolTable, namespaceSymbol, declaration, includes | 67108864 /* Assignment */, excludes & ~67108864 /* Assignment */); } function isTopLevelNamespaceAssignment(propertyAccess) { - return isBinaryExpression(propertyAccess.parent) ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 311 /* SourceFile */ : propertyAccess.parent.parent.kind === 311 /* SourceFile */; + return isBinaryExpression(propertyAccess.parent) ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 312 /* SourceFile */ : propertyAccess.parent.parent.kind === 312 /* SourceFile */; } function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty, containerIsClass) { let namespaceSymbol = lookupSymbolForPropertyAccess(name, container) || lookupSymbolForPropertyAccess(name, blockScopeContainer); @@ -43892,7 +44240,7 @@ ${lanes.join("\n")} } } function bindClassLikeDeclaration(node) { - if (node.kind === 262 /* ClassDeclaration */) { + if (node.kind === 263 /* ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* Class */, 899503 /* ClassExcludes */); } else { const bindingName = node.name ? node.name.escapedText : "__class" /* Class */; @@ -43921,7 +44269,7 @@ ${lanes.join("\n")} checkStrictModeEvalOrArguments(node, node.name); } if (!isBindingPattern(node.name)) { - const possibleVariableDecl = node.kind === 259 /* VariableDeclaration */ ? node : node.parent.parent; + const possibleVariableDecl = node.kind === 260 /* VariableDeclaration */ ? node : node.parent.parent; if (isInJSFile(node) && shouldResolveJsRequire(options) && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & 1 /* Export */)) { declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */); } else if (isBlockOrCatchScoped(node)) { @@ -43934,10 +44282,10 @@ ${lanes.join("\n")} } } function bindParameter(node) { - if (node.kind === 347 /* JSDocParameterTag */ && container.kind !== 329 /* JSDocSignature */) { + if (node.kind === 348 /* JSDocParameterTag */ && container.kind !== 330 /* JSDocSignature */) { return; } - if (inStrictMode && !(node.flags & 16777216 /* Ambient */)) { + if (inStrictMode && !(node.flags & 33554432 /* Ambient */)) { checkStrictModeEvalOrArguments(node, node.name); } if (isBindingPattern(node.name)) { @@ -43951,9 +44299,9 @@ ${lanes.join("\n")} } } function bindFunctionDeclaration(node) { - if (!file.isDeclarationFile && !(node.flags & 16777216 /* Ambient */)) { + if (!file.isDeclarationFile && !(node.flags & 33554432 /* Ambient */)) { if (isAsyncFunction(node)) { - emitFlags |= 2048 /* HasAsyncFunctions */; + emitFlags |= 4096 /* HasAsyncFunctions */; } } checkStrictModeFunctionName(node); @@ -43965,9 +44313,9 @@ ${lanes.join("\n")} } } function bindFunctionExpression(node) { - if (!file.isDeclarationFile && !(node.flags & 16777216 /* Ambient */)) { + if (!file.isDeclarationFile && !(node.flags & 33554432 /* Ambient */)) { if (isAsyncFunction(node)) { - emitFlags |= 2048 /* HasAsyncFunctions */; + emitFlags |= 4096 /* HasAsyncFunctions */; } } if (currentFlow) { @@ -43978,8 +44326,8 @@ ${lanes.join("\n")} return bindAnonymousDeclaration(node, 16 /* Function */, bindingName); } function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) { - if (!file.isDeclarationFile && !(node.flags & 16777216 /* Ambient */) && isAsyncFunction(node)) { - emitFlags |= 2048 /* HasAsyncFunctions */; + if (!file.isDeclarationFile && !(node.flags & 33554432 /* Ambient */) && isAsyncFunction(node)) { + emitFlags |= 4096 /* HasAsyncFunctions */; } if (currentFlow && isObjectLiteralOrClassExpressionMethodOrAccessor(node)) { node.flowNode = currentFlow; @@ -44007,7 +44355,7 @@ ${lanes.join("\n")} } else { declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 526824 /* TypeParameterExcludes */); } - } else if (node.parent.kind === 194 /* InferType */) { + } else if (node.parent.kind === 195 /* InferType */) { const container2 = getInferTypeContainer(node.parent); if (container2) { Debug.assertNode(container2, canHaveLocals); @@ -44038,14 +44386,14 @@ ${lanes.join("\n")} if (currentFlow === unreachableFlow) { const reportError = ( // report error on all statements except empty ones - isStatementButNotDeclaration(node) && node.kind !== 241 /* EmptyStatement */ || // report error on class declarations - node.kind === 262 /* ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - node.kind === 266 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node) + isStatementButNotDeclaration(node) && node.kind !== 242 /* EmptyStatement */ || // report error on class declarations + node.kind === 263 /* ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set + node.kind === 267 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node) ); if (reportError) { currentFlow = reportedUnreachableFlow; if (!options.allowUnreachableCode) { - const isError = unreachableCodeIsError(options) && !(node.flags & 16777216 /* Ambient */) && (!isVariableStatement(node) || !!(getCombinedNodeFlags(node.declarationList) & 3 /* BlockScoped */) || node.declarationList.declarations.some((d) => !!d.initializer)); + const isError = unreachableCodeIsError(options) && !(node.flags & 33554432 /* Ambient */) && (!isVariableStatement(node) || !!(getCombinedNodeFlags(node.declarationList) & 7 /* BlockScoped */) || node.declarationList.declarations.some((d) => !!d.initializer)); eachUnreachableRange(node, (start, end) => errorOrSuggestionOnRange(isError, start, end, Diagnostics.Unreachable_code_detected)); } } @@ -44064,16 +44412,16 @@ ${lanes.join("\n")} } function isExecutableStatement(s) { return !isFunctionDeclaration(s) && !isPurelyTypeDeclaration(s) && !isEnumDeclaration(s) && // `var x;` may declare a variable used above - !(isVariableStatement(s) && !(getCombinedNodeFlags(s) & (1 /* Let */ | 2 /* Const */)) && s.declarationList.declarations.some((d) => !d.initializer)); + !(isVariableStatement(s) && !(getCombinedNodeFlags(s) & 7 /* BlockScoped */) && s.declarationList.declarations.some((d) => !d.initializer)); } function isPurelyTypeDeclaration(s) { switch (s.kind) { - case 263 /* InterfaceDeclaration */: - case 264 /* TypeAliasDeclaration */: + case 264 /* InterfaceDeclaration */: + case 265 /* TypeAliasDeclaration */: return true; - case 266 /* ModuleDeclaration */: + case 267 /* ModuleDeclaration */: return getModuleInstanceState(s) !== 1 /* Instantiated */; - case 265 /* EnumDeclaration */: + case 266 /* EnumDeclaration */: return hasSyntacticModifier(s, 2048 /* Const */); default: return false; @@ -44108,54 +44456,54 @@ ${lanes.join("\n")} } function getContainerFlags(node) { switch (node.kind) { - case 230 /* ClassExpression */: - case 262 /* ClassDeclaration */: - case 265 /* EnumDeclaration */: - case 209 /* ObjectLiteralExpression */: - case 186 /* TypeLiteral */: - case 328 /* JSDocTypeLiteral */: - case 291 /* JsxAttributes */: + case 231 /* ClassExpression */: + case 263 /* ClassDeclaration */: + case 266 /* EnumDeclaration */: + case 210 /* ObjectLiteralExpression */: + case 187 /* TypeLiteral */: + case 329 /* JSDocTypeLiteral */: + case 292 /* JsxAttributes */: return 1 /* IsContainer */; - case 263 /* InterfaceDeclaration */: + case 264 /* InterfaceDeclaration */: return 1 /* IsContainer */ | 64 /* IsInterface */; - case 266 /* ModuleDeclaration */: - case 264 /* TypeAliasDeclaration */: - case 199 /* MappedType */: - case 180 /* IndexSignature */: + case 267 /* ModuleDeclaration */: + case 265 /* TypeAliasDeclaration */: + case 200 /* MappedType */: + case 181 /* IndexSignature */: return 1 /* IsContainer */ | 32 /* HasLocals */; - case 311 /* SourceFile */: + case 312 /* SourceFile */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */; - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 173 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 174 /* MethodDeclaration */: if (isObjectLiteralOrClassExpressionMethodOrAccessor(node)) { return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 128 /* IsObjectLiteralOrClassExpressionMethodOrAccessor */; } - case 175 /* Constructor */: - case 261 /* FunctionDeclaration */: - case 172 /* MethodSignature */: - case 178 /* CallSignature */: - case 329 /* JSDocSignature */: - case 323 /* JSDocFunctionType */: - case 183 /* FunctionType */: - case 179 /* ConstructSignature */: - case 184 /* ConstructorType */: - case 174 /* ClassStaticBlockDeclaration */: + case 176 /* Constructor */: + case 262 /* FunctionDeclaration */: + case 173 /* MethodSignature */: + case 179 /* CallSignature */: + case 330 /* JSDocSignature */: + case 324 /* JSDocFunctionType */: + case 184 /* FunctionType */: + case 180 /* ConstructSignature */: + case 185 /* ConstructorType */: + case 175 /* ClassStaticBlockDeclaration */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */; - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 16 /* IsFunctionExpression */; - case 267 /* ModuleBlock */: + case 268 /* ModuleBlock */: return 4 /* IsControlFlowContainer */; - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: return node.initializer ? 4 /* IsControlFlowContainer */ : 0; - case 298 /* CatchClause */: - case 247 /* ForStatement */: - case 248 /* ForInStatement */: - case 249 /* ForOfStatement */: - case 268 /* CaseBlock */: + case 299 /* CatchClause */: + case 248 /* ForStatement */: + case 249 /* ForInStatement */: + case 250 /* ForOfStatement */: + case 269 /* CaseBlock */: return 2 /* IsBlockScopedContainer */ | 32 /* HasLocals */; - case 240 /* Block */: + case 241 /* Block */: return isFunctionLike(node.parent) || isClassStaticBlockDeclaration(node.parent) ? 0 /* None */ : 2 /* IsBlockScopedContainer */ | 32 /* HasLocals */; } return 0 /* None */; @@ -44173,7 +44521,7 @@ ${lanes.join("\n")} return (_d = (_c = container.symbol) == null ? void 0 : _c.exports) == null ? void 0 : _d.get(name); } } - var ModuleInstanceState, binder; + var ModuleInstanceState, ContainerFlags, binder; var init_binder = __esm({ "src/compiler/binder.ts"() { "use strict"; @@ -44185,6 +44533,18 @@ ${lanes.join("\n")} ModuleInstanceState2[ModuleInstanceState2["ConstEnumOnly"] = 2] = "ConstEnumOnly"; return ModuleInstanceState2; })(ModuleInstanceState || {}); + ContainerFlags = /* @__PURE__ */ ((ContainerFlags2) => { + ContainerFlags2[ContainerFlags2["None"] = 0] = "None"; + ContainerFlags2[ContainerFlags2["IsContainer"] = 1] = "IsContainer"; + ContainerFlags2[ContainerFlags2["IsBlockScopedContainer"] = 2] = "IsBlockScopedContainer"; + ContainerFlags2[ContainerFlags2["IsControlFlowContainer"] = 4] = "IsControlFlowContainer"; + ContainerFlags2[ContainerFlags2["IsFunctionLike"] = 8] = "IsFunctionLike"; + ContainerFlags2[ContainerFlags2["IsFunctionExpression"] = 16] = "IsFunctionExpression"; + ContainerFlags2[ContainerFlags2["HasLocals"] = 32] = "HasLocals"; + ContainerFlags2[ContainerFlags2["IsInterface"] = 64] = "IsInterface"; + ContainerFlags2[ContainerFlags2["IsObjectLiteralOrClassExpressionMethodOrAccessor"] = 128] = "IsObjectLiteralOrClassExpressionMethodOrAccessor"; + return ContainerFlags2; + })(ContainerFlags || {}); binder = /* @__PURE__ */ createBinder(); } }); @@ -44331,7 +44691,7 @@ ${lanes.join("\n")} symbol.exports.forEach(visitSymbol); } forEach(symbol.declarations, (d) => { - if (d.type && d.type.kind === 185 /* TypeQuery */) { + if (d.type && d.type.kind === 186 /* TypeQuery */) { const query = d.type; const entity = getResolvedSymbol(getFirstIdentifier2(query.exprName)); visitSymbol(entity); @@ -44746,7 +45106,7 @@ ${lanes.join("\n")} if (originalExportSymbol === d.symbol) return topNamespace.parent.parent; function getTopNamespace(namespaceDeclaration) { - while (namespaceDeclaration.flags & 4 /* NestedNamespace */) { + while (namespaceDeclaration.flags & 8 /* NestedNamespace */) { namespaceDeclaration = namespaceDeclaration.parent; } return namespaceDeclaration; @@ -44776,7 +45136,9 @@ ${lanes.join("\n")} for (const { ending, value } of candidates) { if (value.length >= prefix.length + suffix.length && startsWith(value, prefix) && endsWith(value, suffix) && validateEnding({ ending, value })) { const matchedStar = value.substring(prefix.length, value.length - suffix.length); - return pathIsRelative(matchedStar) ? void 0 : key.replace("*", matchedStar); + if (!pathIsRelative(matchedStar)) { + return key.replace("*", matchedStar); + } } } } else if (some(candidates, (c) => c.ending !== 0 /* Minimal */ && pattern === c.value) || some(candidates, (c) => c.ending === 0 /* Minimal */ && pattern === c.value && validateEnding(c))) { @@ -44848,7 +45210,7 @@ ${lanes.join("\n")} for (const key of getOwnKeys(exports)) { if (key === "default" || conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(conditions, key)) { const subTarget = exports[key]; - const result = tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, subTarget, conditions); + const result = tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode); if (result) { return result; } @@ -45163,6 +45525,7 @@ ${lanes.join("\n")} var moduleKind = getEmitModuleKind(compilerOptions); var legacyDecorators = !!compilerOptions.experimentalDecorators; var useDefineForClassFields = getUseDefineForClassFields(compilerOptions); + var emitStandardClassFields = getEmitStandardClassFields(compilerOptions); var allowSyntheticDefaultImports = getAllowSyntheticDefaultImports(compilerOptions); var strictNullChecks = getStrictOptionValue(compilerOptions, "strictNullChecks"); var strictFunctionTypes = getStrictOptionValue(compilerOptions, "strictFunctionTypes"); @@ -45190,6 +45553,10 @@ ${lanes.join("\n")} var isolatedModulesLikeFlagName = compilerOptions.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules"; var canCollectSymbolAliasAccessabilityData = !compilerOptions.verbatimModuleSyntax || !!compilerOptions.importsNotUsedAsValues; var apparentArgumentCount; + var lastGetCombinedNodeFlagsNode; + var lastGetCombinedNodeFlagsResult = 0 /* None */; + var lastGetCombinedModifierFlagsNode; + var lastGetCombinedModifierFlagsResult = 0 /* None */; const checker = { getNodeCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.nodeCount, 0), getIdentifierCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.identifierCount, 0), @@ -45249,7 +45616,7 @@ ${lanes.join("\n")} return node ? getTypeFromTypeNode(node) : errorType; }, getParameterType: getTypeAtPosition, - getParameterIdentifierNameAtPosition, + getParameterIdentifierInfoAtPosition, getPromisedTypeOfPromise, getAwaitedType: (type) => getAwaitedType(type), getReturnTypeOfSignature, @@ -45367,13 +45734,24 @@ ${lanes.join("\n")} getTypeOfPropertyOfContextualType, getFullyQualifiedName, getResolvedSignature: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */), - getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker( - call, - candidatesOutArray, - /*argumentCount*/ - void 0, - 32 /* IsForStringLiteralArgumentCompletions */ - )), + getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray, checkMode = 32 /* IsForStringLiteralArgumentCompletions */) => { + if (checkMode & 32 /* IsForStringLiteralArgumentCompletions */) { + return runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker( + call, + candidatesOutArray, + /*argumentCount*/ + void 0, + checkMode & ~32 /* IsForStringLiteralArgumentCompletions */ + )); + } + return runWithoutResolvedSignatureCaching(editingArgument, () => getResolvedSignatureWorker( + call, + candidatesOutArray, + /*argumentCount*/ + void 0, + checkMode & ~32 /* IsForStringLiteralArgumentCompletions */ + )); + }, getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)), getExpandedParameters, hasEffectiveRestParameter, @@ -45547,7 +45925,7 @@ ${lanes.join("\n")} Debug.assert(!!(getNodeLinks(file).flags & 1 /* TypeChecked */)); diagnostics2 = addRange(diagnostics2, suggestionDiagnostics.getDiagnostics(file.fileName)); checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(file), (containingNode, kind, diag2) => { - if (!containsParseError(containingNode) && !unusedIsError(kind, !!(containingNode.flags & 16777216 /* Ambient */))) { + if (!containsParseError(containingNode) && !unusedIsError(kind, !!(containingNode.flags & 33554432 /* Ambient */))) { (diagnostics2 || (diagnostics2 = [])).push({ ...diag2, category: 2 /* Suggestion */ }); } }); @@ -45573,14 +45951,19 @@ ${lanes.join("\n")} typeHasCallOrConstructSignatures }; function runWithoutResolvedSignatureCaching(node, fn) { - const containingCall = findAncestor(node, isCallLikeExpression); - const containingCallResolvedSignature = containingCall && getNodeLinks(containingCall).resolvedSignature; - if (containingCall) { - getNodeLinks(containingCall).resolvedSignature = void 0; + const cachedSignatures = []; + while (node) { + if (isCallLikeExpression(node)) { + const nodeLinks2 = getNodeLinks(node); + const resolvedSignature = nodeLinks2.resolvedSignature; + cachedSignatures.push([nodeLinks2, resolvedSignature]); + nodeLinks2.resolvedSignature = void 0; + } + node = node.parent; } const result = fn(); - if (containingCall) { - getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature; + for (const [nodeLinks2, resolvedSignature] of cachedSignatures) { + nodeLinks2.resolvedSignature = resolvedSignature; } return result; } @@ -45886,7 +46269,7 @@ ${lanes.join("\n")} }; var amalgamatedDuplicates; var reverseMappedCache = /* @__PURE__ */ new Map(); - var inInferTypeForHomomorphicMappedType = false; + var homomorphicMappedTypeInferenceStack = []; var ambientModulesCache; var patternAmbientModules; var patternAmbientModuleAugmentations; @@ -45927,6 +46310,8 @@ ${lanes.join("\n")} var deferredGlobalImportMetaType; var deferredGlobalImportMetaExpressionType; var deferredGlobalImportCallOptionsType; + var deferredGlobalDisposableType; + var deferredGlobalAsyncDisposableType; var deferredGlobalExtractSymbol; var deferredGlobalOmitSymbol; var deferredGlobalAwaitedSymbol; @@ -46098,14 +46483,14 @@ ${lanes.join("\n")} } } function errorSkippedOn(key, location, message, ...args) { - const diagnostic = error(location, message, ...args); + const diagnostic = error2(location, message, ...args); diagnostic.skippedOn = key; return diagnostic; } function createError(location, message, ...args) { return location ? createDiagnosticForNode(location, message, ...args) : createCompilerDiagnostic(message, ...args); } - function error(location, message, ...args) { + function error2(location, message, ...args) { const diagnostic = createError(location, message, ...args); diagnostics.add(diagnostic); return diagnostic; @@ -46129,7 +46514,7 @@ ${lanes.join("\n")} addErrorOrSuggestion(isError, "message" in message ? createDiagnosticForNode(location, message, ...args) : createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(location), location, message)); } function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, ...args) { - const diagnostic = error(location, message, ...args); + const diagnostic = error2(location, message, ...args); if (maybeMissingAwait) { const related = createDiagnosticForNode(location, Diagnostics.Did_you_forget_to_use_await); addRelatedInfo(diagnostic, related); @@ -46155,7 +46540,7 @@ ${lanes.join("\n")} return !!symbol.valueDeclaration && isDeprecatedDeclaration2(symbol.valueDeclaration) || length(symbol.declarations) && every(symbol.declarations, isDeprecatedDeclaration2); } function isDeprecatedDeclaration2(declaration) { - return !!(getCombinedNodeFlags(declaration) & 268435456 /* Deprecated */); + return !!(getCombinedNodeFlagsCached(declaration) & 536870912 /* Deprecated */); } function addDeprecatedSuggestion(location, declarations, deprecatedEntity) { const diagnostic = createDiagnosticForNode(location, Diagnostics._0_is_deprecated, deprecatedEntity); @@ -46275,7 +46660,7 @@ ${lanes.join("\n")} } } else if (target.flags & 1024 /* NamespaceModule */) { if (target !== globalThisSymbol) { - error( + error2( source.declarations && getNameOfDeclaration(source.declarations[0]), Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity, symbolToString(target) @@ -46369,7 +46754,7 @@ ${lanes.join("\n")} if (isGlobalScopeAugmentation(moduleAugmentation)) { mergeSymbolTable(globals, moduleAugmentation.symbol.exports); } else { - const moduleNotFoundError = !(moduleName.parent.parent.flags & 16777216 /* Ambient */) ? Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found : void 0; + const moduleNotFoundError = !(moduleName.parent.parent.flags & 33554432 /* Ambient */) ? Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found : void 0; let mainModule = resolveExternalModuleNameWorker( moduleName, moduleName, @@ -46405,7 +46790,7 @@ ${lanes.join("\n")} mergeSymbol(mainModule, moduleAugmentation.symbol); } } else { - error(moduleName, Diagnostics.Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity, moduleName.text); + error2(moduleName, Diagnostics.Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity, moduleName.text); } } } @@ -46433,7 +46818,7 @@ ${lanes.join("\n")} return nodeLinks[nodeId] || (nodeLinks[nodeId] = new NodeLinks()); } function isGlobalSourceFile(node) { - return node.kind === 311 /* SourceFile */ && !isExternalOrCommonJsModule(node); + return node.kind === 312 /* SourceFile */ && !isExternalOrCommonJsModule(node); } function getSymbol2(symbols, name, meaning) { if (meaning) { @@ -46444,7 +46829,7 @@ ${lanes.join("\n")} return symbol; } if (symbol.flags & 2097152 /* Alias */) { - const targetFlags = getAllSymbolFlags(symbol); + const targetFlags = getSymbolFlags(symbol); if (targetFlags & meaning) { return symbol; } @@ -46467,7 +46852,7 @@ ${lanes.join("\n")} const useFile = getSourceFileOfNode(usage); const declContainer = getEnclosingBlockScopeContainer(declaration); if (declarationFile !== useFile) { - if (moduleKind && (declarationFile.externalModuleIndicator || useFile.externalModuleIndicator) || !outFile(compilerOptions) || isInTypeQuery(usage) || declaration.flags & 16777216 /* Ambient */) { + if (moduleKind && (declarationFile.externalModuleIndicator || useFile.externalModuleIndicator) || !outFile(compilerOptions) || isInTypeQuery(usage) || declaration.flags & 33554432 /* Ambient */) { return true; } if (isUsedInFunctionOrInstanceProperty(usage, declaration)) { @@ -46477,13 +46862,13 @@ ${lanes.join("\n")} return sourceFiles.indexOf(declarationFile) <= sourceFiles.indexOf(useFile); } if (declaration.pos <= usage.pos && !(isPropertyDeclaration(declaration) && isThisProperty(usage.parent) && !declaration.initializer && !declaration.exclamationToken)) { - if (declaration.kind === 207 /* BindingElement */) { - const errorBindingElement = getAncestor(usage, 207 /* BindingElement */); + if (declaration.kind === 208 /* BindingElement */) { + const errorBindingElement = getAncestor(usage, 208 /* BindingElement */); if (errorBindingElement) { return findAncestor(errorBindingElement, isBindingElement) !== findAncestor(declaration, isBindingElement) || declaration.pos < errorBindingElement.pos; } - return isBlockScopedNameDeclaredBeforeUse(getAncestor(declaration, 259 /* VariableDeclaration */), usage); - } else if (declaration.kind === 259 /* VariableDeclaration */) { + return isBlockScopedNameDeclaredBeforeUse(getAncestor(declaration, 260 /* VariableDeclaration */), usage); + } else if (declaration.kind === 260 /* VariableDeclaration */) { return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } else if (isClassDeclaration(declaration)) { return !findAncestor(usage, (n) => isComputedPropertyName(n) && n.parent.parent === declaration); @@ -46495,21 +46880,21 @@ ${lanes.join("\n")} false ); } else if (isParameterPropertyDeclaration(declaration, declaration.parent)) { - return !(getEmitScriptTarget(compilerOptions) === 99 /* ESNext */ && useDefineForClassFields && getContainingClass(declaration) === getContainingClass(usage) && isUsedInFunctionOrInstanceProperty(usage, declaration)); + return !(emitStandardClassFields && getContainingClass(declaration) === getContainingClass(usage) && isUsedInFunctionOrInstanceProperty(usage, declaration)); } return true; } - if (usage.parent.kind === 280 /* ExportSpecifier */ || usage.parent.kind === 276 /* ExportAssignment */ && usage.parent.isExportEquals) { + if (usage.parent.kind === 281 /* ExportSpecifier */ || usage.parent.kind === 277 /* ExportAssignment */ && usage.parent.isExportEquals) { return true; } - if (usage.kind === 276 /* ExportAssignment */ && usage.isExportEquals) { + if (usage.kind === 277 /* ExportAssignment */ && usage.isExportEquals) { return true; } - if (!!(usage.flags & 8388608 /* JSDoc */) || isInTypeQuery(usage) || isInAmbientOrTypeNode(usage)) { + if (!!(usage.flags & 16777216 /* JSDoc */) || isInTypeQuery(usage) || isInAmbientOrTypeNode(usage)) { return true; } if (isUsedInFunctionOrInstanceProperty(usage, declaration)) { - if (getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */ && useDefineForClassFields && getContainingClass(declaration) && (isPropertyDeclaration(declaration) || isParameterPropertyDeclaration(declaration, declaration.parent))) { + if (emitStandardClassFields && getContainingClass(declaration) && (isPropertyDeclaration(declaration) || isParameterPropertyDeclaration(declaration, declaration.parent))) { return !isPropertyImmediatelyReferencedWithinDeclaration( declaration, usage, @@ -46523,9 +46908,9 @@ ${lanes.join("\n")} return false; function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration2, usage2) { switch (declaration2.parent.parent.kind) { - case 242 /* VariableStatement */: - case 247 /* ForStatement */: - case 249 /* ForOfStatement */: + case 243 /* VariableStatement */: + case 248 /* ForStatement */: + case 250 /* ForOfStatement */: if (isSameScopeDescendentOf(usage2, declaration2, declContainer)) { return true; } @@ -46550,7 +46935,7 @@ ${lanes.join("\n")} const initializerOfProperty = propertyDeclaration.initializer === current; if (initializerOfProperty) { if (isStatic(current.parent)) { - if (declaration2.kind === 173 /* MethodDeclaration */) { + if (declaration2.kind === 174 /* MethodDeclaration */) { return true; } if (isPropertyDeclaration(declaration2) && getContainingClass(usage2) === getContainingClass(declaration2)) { @@ -46564,7 +46949,7 @@ ${lanes.join("\n")} } } } else { - const isDeclarationInstanceProperty = declaration2.kind === 171 /* PropertyDeclaration */ && !isStatic(declaration2); + const isDeclarationInstanceProperty = declaration2.kind === 172 /* PropertyDeclaration */ && !isStatic(declaration2); if (!isDeclarationInstanceProperty || getContainingClass(usage2) !== getContainingClass(declaration2)) { return true; } @@ -46583,15 +46968,15 @@ ${lanes.join("\n")} return "quit"; } switch (node.kind) { - case 218 /* ArrowFunction */: + case 219 /* ArrowFunction */: return true; - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: return stopAtAnyPropertyDeclaration && (isPropertyDeclaration(declaration2) && node.parent === declaration2.parent || isParameterPropertyDeclaration(declaration2, declaration2.parent) && node.parent === declaration2.parent.parent) ? "quit" : true; - case 240 /* Block */: + case 241 /* Block */: switch (node.parent.kind) { - case 176 /* GetAccessor */: - case 173 /* MethodDeclaration */: - case 177 /* SetAccessor */: + case 177 /* GetAccessor */: + case 174 /* MethodDeclaration */: + case 178 /* SetAccessor */: return true; default: return false; @@ -46621,19 +47006,19 @@ ${lanes.join("\n")} } function requiresScopeChangeWorker(node) { switch (node.kind) { - case 218 /* ArrowFunction */: - case 217 /* FunctionExpression */: - case 261 /* FunctionDeclaration */: - case 175 /* Constructor */: + case 219 /* ArrowFunction */: + case 218 /* FunctionExpression */: + case 262 /* FunctionDeclaration */: + case 176 /* Constructor */: return false; - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 302 /* PropertyAssignment */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 303 /* PropertyAssignment */: return requiresScopeChangeWorker(node.name); - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: if (hasStaticModifier(node)) { - return target < 99 /* ESNext */ || !useDefineForClassFields; + return !emitStandardClassFields; } return requiresScopeChangeWorker(node.name); default: @@ -46672,7 +47057,7 @@ ${lanes.join("\n")} if (name === "const" && isConstAssertion(location)) { return void 0; } - if (isModuleDeclaration(location) && lastLocation && location.name === lastLocation) { + if (isModuleOrEnumDeclaration(location) && lastLocation && location.name === lastLocation) { lastLocation = location; location = location.parent; } @@ -46680,17 +47065,17 @@ ${lanes.join("\n")} if (result = lookup(location.locals, name, meaning)) { let useResult = true; if (isFunctionLike(location) && lastLocation && lastLocation !== location.body) { - if (meaning & result.flags & 788968 /* Type */ && lastLocation.kind !== 326 /* JSDoc */) { - useResult = result.flags & 262144 /* TypeParameter */ ? lastLocation === location.type || lastLocation.kind === 168 /* Parameter */ || lastLocation.kind === 347 /* JSDocParameterTag */ || lastLocation.kind === 348 /* JSDocReturnTag */ || lastLocation.kind === 167 /* TypeParameter */ : false; + if (meaning & result.flags & 788968 /* Type */ && lastLocation.kind !== 327 /* JSDoc */) { + useResult = result.flags & 262144 /* TypeParameter */ ? lastLocation === location.type || lastLocation.kind === 169 /* Parameter */ || lastLocation.kind === 348 /* JSDocParameterTag */ || lastLocation.kind === 349 /* JSDocReturnTag */ || lastLocation.kind === 168 /* TypeParameter */ : false; } if (meaning & result.flags & 3 /* Variable */) { if (useOuterVariableScopeInParameter(result, location, lastLocation)) { useResult = false; } else if (result.flags & 1 /* FunctionScopedVariable */) { - useResult = lastLocation.kind === 168 /* Parameter */ || lastLocation === location.type && !!findAncestor(result.valueDeclaration, isParameter); + useResult = lastLocation.kind === 169 /* Parameter */ || lastLocation === location.type && !!findAncestor(result.valueDeclaration, isParameter); } } - } else if (location.kind === 193 /* ConditionalType */) { + } else if (location.kind === 194 /* ConditionalType */) { useResult = lastLocation === location.trueType; } if (useResult) { @@ -46702,13 +47087,13 @@ ${lanes.join("\n")} } withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation); switch (location.kind) { - case 311 /* SourceFile */: + case 312 /* SourceFile */: if (!isExternalOrCommonJsModule(location)) break; isInExternalModule = true; - case 266 /* ModuleDeclaration */: + case 267 /* ModuleDeclaration */: const moduleExports = ((_a = getSymbolOfDeclaration(location)) == null ? void 0 : _a.exports) || emptySymbols; - if (location.kind === 311 /* SourceFile */ || isModuleDeclaration(location) && location.flags & 16777216 /* Ambient */ && !isGlobalScopeAugmentation(location)) { + if (location.kind === 312 /* SourceFile */ || isModuleDeclaration(location) && location.flags & 33554432 /* Ambient */ && !isGlobalScopeAugmentation(location)) { if (result = moduleExports.get("default" /* Default */)) { const localSymbol = getLocalSymbolForExportDefault(result); if (localSymbol && result.flags & meaning && localSymbol.escapedName === name) { @@ -46717,7 +47102,7 @@ ${lanes.join("\n")} result = void 0; } const moduleExport = moduleExports.get(name); - if (moduleExport && moduleExport.flags === 2097152 /* Alias */ && (getDeclarationOfKind(moduleExport, 280 /* ExportSpecifier */) || getDeclarationOfKind(moduleExport, 279 /* NamespaceExport */))) { + if (moduleExport && moduleExport.flags === 2097152 /* Alias */ && (getDeclarationOfKind(moduleExport, 281 /* ExportSpecifier */) || getDeclarationOfKind(moduleExport, 280 /* NamespaceExport */))) { break; } } @@ -46729,10 +47114,10 @@ ${lanes.join("\n")} } } break; - case 265 /* EnumDeclaration */: + case 266 /* EnumDeclaration */: if (result = lookup(((_c = getSymbolOfDeclaration(location)) == null ? void 0 : _c.exports) || emptySymbols, name, meaning & 8 /* EnumMember */)) { - if (nameNotFoundMessage && getIsolatedModules(compilerOptions) && !(location.flags & 16777216 /* Ambient */) && getSourceFileOfNode(location) !== getSourceFileOfNode(result.valueDeclaration)) { - error( + if (nameNotFoundMessage && getIsolatedModules(compilerOptions) && !(location.flags & 33554432 /* Ambient */) && getSourceFileOfNode(location) !== getSourceFileOfNode(result.valueDeclaration)) { + error2( errorLocation, Diagnostics.Cannot_access_0_from_another_file_without_qualification_when_1_is_enabled_Use_2_instead, unescapeLeadingUnderscores(name), @@ -46743,7 +47128,7 @@ ${lanes.join("\n")} break loop; } break; - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: if (!isStatic(location)) { const ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { @@ -46754,9 +47139,9 @@ ${lanes.join("\n")} } } break; - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: - case 263 /* InterfaceDeclaration */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: + case 264 /* InterfaceDeclaration */: if (result = lookup(getSymbolOfDeclaration(location).members || emptySymbols, name, meaning & 788968 /* Type */)) { if (!isTypeParameterSymbolDeclaredInContainer(result, location)) { result = void 0; @@ -46764,7 +47149,7 @@ ${lanes.join("\n")} } if (lastLocation && isStatic(lastLocation)) { if (nameNotFoundMessage) { - error(errorLocation, Diagnostics.Static_members_cannot_reference_class_type_parameters); + error2(errorLocation, Diagnostics.Static_members_cannot_reference_class_type_parameters); } return void 0; } @@ -46778,43 +47163,43 @@ ${lanes.join("\n")} } } break; - case 232 /* ExpressionWithTypeArguments */: + case 233 /* ExpressionWithTypeArguments */: if (lastLocation === location.expression && location.parent.token === 96 /* ExtendsKeyword */) { const container = location.parent.parent; if (isClassLike(container) && (result = lookup(getSymbolOfDeclaration(container).members, name, meaning & 788968 /* Type */))) { if (nameNotFoundMessage) { - error(errorLocation, Diagnostics.Base_class_expressions_cannot_reference_class_type_parameters); + error2(errorLocation, Diagnostics.Base_class_expressions_cannot_reference_class_type_parameters); } return void 0; } } break; - case 166 /* ComputedPropertyName */: + case 167 /* ComputedPropertyName */: grandparent = location.parent.parent; - if (isClassLike(grandparent) || grandparent.kind === 263 /* InterfaceDeclaration */) { + if (isClassLike(grandparent) || grandparent.kind === 264 /* InterfaceDeclaration */) { if (result = lookup(getSymbolOfDeclaration(grandparent).members, name, meaning & 788968 /* Type */)) { if (nameNotFoundMessage) { - error(errorLocation, Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + error2(errorLocation, Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); } return void 0; } } break; - case 218 /* ArrowFunction */: + case 219 /* ArrowFunction */: if (getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */) { break; } - case 173 /* MethodDeclaration */: - case 175 /* Constructor */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 261 /* FunctionDeclaration */: + case 174 /* MethodDeclaration */: + case 176 /* Constructor */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 262 /* FunctionDeclaration */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 217 /* FunctionExpression */: + case 218 /* FunctionExpression */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -46827,37 +47212,37 @@ ${lanes.join("\n")} } } break; - case 169 /* Decorator */: - if (location.parent && location.parent.kind === 168 /* Parameter */) { + case 170 /* Decorator */: + if (location.parent && location.parent.kind === 169 /* Parameter */) { location = location.parent; } - if (location.parent && (isClassElement(location.parent) || location.parent.kind === 262 /* ClassDeclaration */)) { + if (location.parent && (isClassElement(location.parent) || location.parent.kind === 263 /* ClassDeclaration */)) { location = location.parent; } break; - case 352 /* JSDocTypedefTag */: - case 344 /* JSDocCallbackTag */: - case 346 /* JSDocEnumTag */: + case 353 /* JSDocTypedefTag */: + case 345 /* JSDocCallbackTag */: + case 347 /* JSDocEnumTag */: const root = getJSDocRoot(location); if (root) { location = root.parent; } break; - case 168 /* Parameter */: + case 169 /* Parameter */: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && isBindingPattern(lastLocation))) { if (!associatedDeclarationForContainingInitializerOrBindingName) { associatedDeclarationForContainingInitializerOrBindingName = location; } } break; - case 207 /* BindingElement */: + case 208 /* BindingElement */: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && isBindingPattern(lastLocation))) { if (isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) { associatedDeclarationForContainingInitializerOrBindingName = location; } } break; - case 194 /* InferType */: + case 195 /* InferType */: if (meaning & 262144 /* TypeParameter */) { const parameterName = location.typeParameter.name; if (parameterName && name === parameterName.escapedText) { @@ -46866,7 +47251,7 @@ ${lanes.join("\n")} } } break; - case 280 /* ExportSpecifier */: + case 281 /* ExportSpecifier */: if (lastLocation && lastLocation === location.propertyName && location.parent.parent.moduleSpecifier) { location = location.parent.parent.parent; } @@ -46904,8 +47289,8 @@ ${lanes.join("\n")} } } function checkAndReportErrorForInvalidInitializer() { - if (propertyWithInvalidInitializer && !(useDefineForClassFields && getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */)) { - error( + if (propertyWithInvalidInitializer && !emitStandardClassFields) { + error2( errorLocation, errorLocation && propertyWithInvalidInitializer.type && textRangeContainsPositionInclusive(propertyWithInvalidInitializer.type, errorLocation.pos) ? Diagnostics.Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor : Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, declarationNameToString(propertyWithInvalidInitializer.name), @@ -46918,14 +47303,14 @@ ${lanes.join("\n")} if (!result) { if (nameNotFoundMessage) { addLazyDiagnostic(() => { - if (!errorLocation || errorLocation.parent.kind !== 330 /* JSDocLink */ && !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && // TODO: GH#18217 + if (!errorLocation || errorLocation.parent.kind !== 331 /* JSDocLink */ && !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && // TODO: GH#18217 !checkAndReportErrorForInvalidInitializer() && !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) && !checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) { let suggestion; let suggestedLib; if (nameArg) { suggestedLib = getSuggestedLibForNonExistentName(nameArg); if (suggestedLib) { - error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg), suggestedLib); + error2(errorLocation, nameNotFoundMessage, diagnosticName(nameArg), suggestedLib); } } if (!suggestedLib && getSpellingSuggestions && suggestionCount < maximumSuggestionCount) { @@ -46954,7 +47339,7 @@ ${lanes.join("\n")} } } if (!suggestion && !suggestedLib && nameArg) { - error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg)); + error2(errorLocation, nameNotFoundMessage, diagnosticName(nameArg)); } suggestionCount++; } @@ -46972,7 +47357,7 @@ ${lanes.join("\n")} checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation); } } - if (result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */ && !(originalLocation.flags & 8388608 /* JSDoc */)) { + if (result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */ && !(originalLocation.flags & 16777216 /* JSDoc */)) { const merged = getMergedSymbol(result); if (length(merged.declarations) && every(merged.declarations, (d) => isNamespaceExportDeclaration(d) || isSourceFile(d) && !!d.symbol.globalExports)) { errorOrSuggestion(!compilerOptions.allowUmdGlobalAccess, errorLocation, Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, unescapeLeadingUnderscores(name)); @@ -46982,18 +47367,18 @@ ${lanes.join("\n")} const candidate = getMergedSymbol(getLateBoundSymbol(result)); const root = getRootDeclaration(associatedDeclarationForContainingInitializerOrBindingName); if (candidate === getSymbolOfDeclaration(associatedDeclarationForContainingInitializerOrBindingName)) { - error(errorLocation, Diagnostics.Parameter_0_cannot_reference_itself, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name)); + error2(errorLocation, Diagnostics.Parameter_0_cannot_reference_itself, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name)); } else if (candidate.valueDeclaration && candidate.valueDeclaration.pos > associatedDeclarationForContainingInitializerOrBindingName.pos && root.parent.locals && lookup(root.parent.locals, candidate.escapedName, meaning) === candidate) { - error(errorLocation, Diagnostics.Parameter_0_cannot_reference_identifier_1_declared_after_it, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name), declarationNameToString(errorLocation)); + error2(errorLocation, Diagnostics.Parameter_0_cannot_reference_identifier_1_declared_after_it, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name), declarationNameToString(errorLocation)); } } if (result && errorLocation && meaning & 111551 /* Value */ && result.flags & 2097152 /* Alias */ && !(result.flags & 111551 /* Value */) && !isValidTypeOnlyAliasUseSite(errorLocation)) { const typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result, 111551 /* Value */); if (typeOnlyDeclaration) { - const message = typeOnlyDeclaration.kind === 280 /* ExportSpecifier */ || typeOnlyDeclaration.kind === 277 /* ExportDeclaration */ || typeOnlyDeclaration.kind === 279 /* NamespaceExport */ ? Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type : Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type; + const message = typeOnlyDeclaration.kind === 281 /* ExportSpecifier */ || typeOnlyDeclaration.kind === 278 /* ExportDeclaration */ || typeOnlyDeclaration.kind === 280 /* NamespaceExport */ ? Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type : Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type; const unescapedName = unescapeLeadingUnderscores(name); addTypeOnlyDeclarationRelatedInfo( - error(errorLocation, message, unescapedName), + error2(errorLocation, message, unescapedName), typeOnlyDeclaration, unescapedName ); @@ -47010,14 +47395,14 @@ ${lanes.join("\n")} diagnostic, createDiagnosticForNode( typeOnlyDeclaration, - typeOnlyDeclaration.kind === 280 /* ExportSpecifier */ || typeOnlyDeclaration.kind === 277 /* ExportDeclaration */ || typeOnlyDeclaration.kind === 279 /* NamespaceExport */ ? Diagnostics._0_was_exported_here : Diagnostics._0_was_imported_here, + typeOnlyDeclaration.kind === 281 /* ExportSpecifier */ || typeOnlyDeclaration.kind === 278 /* ExportDeclaration */ || typeOnlyDeclaration.kind === 280 /* NamespaceExport */ ? Diagnostics._0_was_exported_here : Diagnostics._0_was_imported_here, unescapedName ) ); } function getIsDeferredContext(location, lastLocation) { - if (location.kind !== 218 /* ArrowFunction */ && location.kind !== 217 /* FunctionExpression */) { - return isTypeQueryNode(location) || (isFunctionLikeDeclaration(location) || location.kind === 171 /* PropertyDeclaration */ && !isStatic(location)) && (!lastLocation || lastLocation !== location.name); + if (location.kind !== 219 /* ArrowFunction */ && location.kind !== 218 /* FunctionExpression */) { + return isTypeQueryNode(location) || (isFunctionLikeDeclaration(location) || location.kind === 172 /* PropertyDeclaration */ && !isStatic(location)) && (!lastLocation || lastLocation !== location.name); } if (lastLocation && lastLocation === location.name) { return false; @@ -47029,12 +47414,12 @@ ${lanes.join("\n")} } function isSelfReferenceLocation(node) { switch (node.kind) { - case 261 /* FunctionDeclaration */: - case 262 /* ClassDeclaration */: - case 263 /* InterfaceDeclaration */: - case 265 /* EnumDeclaration */: - case 264 /* TypeAliasDeclaration */: - case 266 /* ModuleDeclaration */: + case 262 /* FunctionDeclaration */: + case 263 /* ClassDeclaration */: + case 264 /* InterfaceDeclaration */: + case 266 /* EnumDeclaration */: + case 265 /* TypeAliasDeclaration */: + case 267 /* ModuleDeclaration */: return true; default: return false; @@ -47046,7 +47431,7 @@ ${lanes.join("\n")} function isTypeParameterSymbolDeclaredInContainer(symbol, container) { if (symbol.declarations) { for (const decl of symbol.declarations) { - if (decl.kind === 167 /* TypeParameter */) { + if (decl.kind === 168 /* TypeParameter */) { const parent2 = isJSDocTemplateTag(decl.parent) ? getJSDocHost(decl.parent) : decl.parent; if (parent2 === container) { return !(isJSDocTemplateTag(decl.parent) && find(decl.parent.parent.tags, isJSDocTypeAlias)); @@ -47076,13 +47461,13 @@ ${lanes.join("\n")} } const constructorType = getTypeOfSymbol(classSymbol); if (getPropertyOfType(constructorType, name)) { - error(errorLocation, Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0, diagnosticName(nameArg), symbolToString(classSymbol)); + error2(errorLocation, Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0, diagnosticName(nameArg), symbolToString(classSymbol)); return true; } if (location === container && !isStatic(location)) { const instanceType = getDeclaredTypeOfSymbol(classSymbol).thisType; if (getPropertyOfType(instanceType, name)) { - error(errorLocation, Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0, diagnosticName(nameArg)); + error2(errorLocation, Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0, diagnosticName(nameArg)); return true; } } @@ -47099,7 +47484,7 @@ ${lanes.join("\n")} /*ignoreErrors*/ true )) { - error(errorLocation, Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements, getTextOfNode(expression)); + error2(errorLocation, Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements, getTextOfNode(expression)); return true; } return false; @@ -47107,9 +47492,9 @@ ${lanes.join("\n")} function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 80 /* Identifier */: - case 210 /* PropertyAccessExpression */: + case 211 /* PropertyAccessExpression */: return node.parent ? getEntityNameForExtendingInterface(node.parent) : void 0; - case 232 /* ExpressionWithTypeArguments */: + case 233 /* ExpressionWithTypeArguments */: if (isEntityNameExpression(node.expression)) { return node.expression; } @@ -47138,7 +47523,7 @@ ${lanes.join("\n")} const propName = parent2.right.escapedText; const propType = getPropertyOfType(getDeclaredTypeOfSymbol(symbol), propName); if (propType) { - error( + error2( parent2, Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1, unescapeLeadingUnderscores(name), @@ -47147,7 +47532,7 @@ ${lanes.join("\n")} return true; } } - error(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here, unescapeLeadingUnderscores(name)); + error2(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here, unescapeLeadingUnderscores(name)); return true; } } @@ -47167,7 +47552,7 @@ ${lanes.join("\n")} false )); if (symbol && !(symbol.flags & 1920 /* Namespace */)) { - error(errorLocation, Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0, unescapeLeadingUnderscores(name)); + error2(errorLocation, Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0, unescapeLeadingUnderscores(name)); return true; } } @@ -47177,8 +47562,8 @@ ${lanes.join("\n")} return name === "any" || name === "string" || name === "number" || name === "boolean" || name === "never" || name === "unknown"; } function checkAndReportErrorForExportingPrimitiveType(errorLocation, name) { - if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 280 /* ExportSpecifier */) { - error(errorLocation, Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, name); + if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 281 /* ExportSpecifier */) { + error2(errorLocation, Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, name); return true; } return false; @@ -47187,9 +47572,9 @@ ${lanes.join("\n")} if (meaning & 111551 /* Value */) { if (isPrimitiveTypeName(name)) { if (isExtendedByInterface(errorLocation)) { - error(errorLocation, Diagnostics.An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes, unescapeLeadingUnderscores(name)); + error2(errorLocation, Diagnostics.An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes, unescapeLeadingUnderscores(name)); } else { - error(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, unescapeLeadingUnderscores(name)); + error2(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, unescapeLeadingUnderscores(name)); } return true; } @@ -47204,15 +47589,15 @@ ${lanes.join("\n")} /*isUse*/ false )); - const allFlags = symbol && getAllSymbolFlags(symbol); + const allFlags = symbol && getSymbolFlags(symbol); if (symbol && allFlags !== void 0 && !(allFlags & 111551 /* Value */)) { const rawName = unescapeLeadingUnderscores(name); if (isES2015OrLaterConstructorName(name)) { - error(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later, rawName); + error2(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later, rawName); } else if (maybeMappedType(errorLocation, symbol)) { - error(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0, rawName, rawName === "K" ? "P" : "K"); + error2(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0, rawName, rawName === "K" ? "P" : "K"); } else { - error(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, rawName); + error2(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, rawName); } return true; } @@ -47268,7 +47653,7 @@ ${lanes.join("\n")} false )); if (symbol) { - error( + error2( errorLocation, Diagnostics.Cannot_use_namespace_0_as_a_value, unescapeLeadingUnderscores(name) @@ -47288,7 +47673,7 @@ ${lanes.join("\n")} false )); if (symbol) { - error(errorLocation, Diagnostics.Cannot_use_namespace_0_as_a_type, unescapeLeadingUnderscores(name)); + error2(errorLocation, Diagnostics.Cannot_use_namespace_0_as_a_type, unescapeLeadingUnderscores(name)); return true; } } @@ -47301,19 +47686,19 @@ ${lanes.join("\n")} return; } const declaration = (_a = result.declarations) == null ? void 0 : _a.find( - (d) => isBlockOrCatchScoped(d) || isClassLike(d) || d.kind === 265 /* EnumDeclaration */ + (d) => isBlockOrCatchScoped(d) || isClassLike(d) || d.kind === 266 /* EnumDeclaration */ ); if (declaration === void 0) return Debug.fail("checkResolvedBlockScopedVariable could not find block-scoped declaration"); - if (!(declaration.flags & 16777216 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { + if (!(declaration.flags & 33554432 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { let diagnosticMessage; const declarationName = declarationNameToString(getNameOfDeclaration(declaration)); if (result.flags & 2 /* BlockScopedVariable */) { - diagnosticMessage = error(errorLocation, Diagnostics.Block_scoped_variable_0_used_before_its_declaration, declarationName); + diagnosticMessage = error2(errorLocation, Diagnostics.Block_scoped_variable_0_used_before_its_declaration, declarationName); } else if (result.flags & 32 /* Class */) { - diagnosticMessage = error(errorLocation, Diagnostics.Class_0_used_before_its_declaration, declarationName); + diagnosticMessage = error2(errorLocation, Diagnostics.Class_0_used_before_its_declaration, declarationName); } else if (result.flags & 256 /* RegularEnum */) { - diagnosticMessage = error(errorLocation, Diagnostics.Enum_0_used_before_its_declaration, declarationName); + diagnosticMessage = error2(errorLocation, Diagnostics.Enum_0_used_before_its_declaration, declarationName); } if (diagnosticMessage) { addRelatedInfo( @@ -47328,13 +47713,13 @@ ${lanes.join("\n")} } function getAnyImportSyntax(node) { switch (node.kind) { - case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportEqualsDeclaration */: return node; - case 272 /* ImportClause */: + case 273 /* ImportClause */: return node.parent; - case 273 /* NamespaceImport */: + case 274 /* NamespaceImport */: return node.parent.parent; - case 275 /* ImportSpecifier */: + case 276 /* ImportSpecifier */: return node.parent.parent.parent; default: return void 0; @@ -47344,7 +47729,7 @@ ${lanes.join("\n")} return symbol.declarations && findLast(symbol.declarations, isAliasSymbolDeclaration2); } function isAliasSymbolDeclaration2(node) { - return node.kind === 270 /* ImportEqualsDeclaration */ || node.kind === 269 /* NamespaceExportDeclaration */ || node.kind === 272 /* ImportClause */ && !!node.name || node.kind === 273 /* NamespaceImport */ || node.kind === 279 /* NamespaceExport */ || node.kind === 275 /* ImportSpecifier */ || node.kind === 280 /* ExportSpecifier */ || node.kind === 276 /* ExportAssignment */ && exportAssignmentIsAlias(node) || isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node) || isAccessExpression(node) && isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 64 /* EqualsToken */ && isAliasableOrJsExpression(node.parent.right) || node.kind === 303 /* ShorthandPropertyAssignment */ || node.kind === 302 /* PropertyAssignment */ && isAliasableOrJsExpression(node.initializer) || node.kind === 259 /* VariableDeclaration */ && isVariableDeclarationInitializedToBareOrAccessedRequire(node) || node.kind === 207 /* BindingElement */ && isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); + return node.kind === 271 /* ImportEqualsDeclaration */ || node.kind === 270 /* NamespaceExportDeclaration */ || node.kind === 273 /* ImportClause */ && !!node.name || node.kind === 274 /* NamespaceImport */ || node.kind === 280 /* NamespaceExport */ || node.kind === 276 /* ImportSpecifier */ || node.kind === 281 /* ExportSpecifier */ || node.kind === 277 /* ExportAssignment */ && exportAssignmentIsAlias(node) || isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node) || isAccessExpression(node) && isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 64 /* EqualsToken */ && isAliasableOrJsExpression(node.parent.right) || node.kind === 304 /* ShorthandPropertyAssignment */ || node.kind === 303 /* PropertyAssignment */ && isAliasableOrJsExpression(node.initializer) || node.kind === 260 /* VariableDeclaration */ && isVariableDeclarationInitializedToBareOrAccessedRequire(node) || node.kind === 208 /* BindingElement */ && isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); } function isAliasableOrJsExpression(e) { return isAliasableExpression(e) || isFunctionExpression(e) && isJSConstructor(e); @@ -47355,7 +47740,7 @@ ${lanes.join("\n")} const name = getLeftmostAccessExpression(commonJSPropertyAccess.expression).arguments[0]; return isIdentifier(commonJSPropertyAccess.name) ? resolveSymbol(getPropertyOfType(resolveExternalModuleTypeByLiteral(name), commonJSPropertyAccess.name.escapedText)) : void 0; } - if (isVariableDeclaration(node) || node.moduleReference.kind === 282 /* ExternalModuleReference */) { + if (isVariableDeclaration(node) || node.moduleReference.kind === 283 /* ExternalModuleReference */) { const immediate = resolveExternalModuleName( node, getExternalModuleRequireArgument(node) || getExternalModuleImportEqualsDeclarationExpression(node) @@ -47384,11 +47769,11 @@ ${lanes.join("\n")} false ) && !node.isTypeOnly) { const typeOnlyDeclaration = getTypeOnlyAliasDeclaration(getSymbolOfDeclaration(node)); - const isExport = typeOnlyDeclaration.kind === 280 /* ExportSpecifier */ || typeOnlyDeclaration.kind === 277 /* ExportDeclaration */; + const isExport = typeOnlyDeclaration.kind === 281 /* ExportSpecifier */ || typeOnlyDeclaration.kind === 278 /* ExportDeclaration */; const message = isExport ? Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type : Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type; const relatedMessage = isExport ? Diagnostics._0_was_exported_here : Diagnostics._0_was_imported_here; - const name = typeOnlyDeclaration.kind === 277 /* ExportDeclaration */ ? "*" : unescapeLeadingUnderscores(typeOnlyDeclaration.name.escapedText); - addRelatedInfo(error(node.moduleReference, message), createDiagnosticForNode(typeOnlyDeclaration, relatedMessage, name)); + const name = typeOnlyDeclaration.kind === 278 /* ExportDeclaration */ ? "*" : unescapeLeadingUnderscores(typeOnlyDeclaration.name.escapedText); + addRelatedInfo(error2(node.moduleReference, message), createDiagnosticForNode(typeOnlyDeclaration, relatedMessage, name)); } } function resolveExportByName(moduleSymbol, name, sourceNode, dontResolveAlias) { @@ -47493,7 +47878,7 @@ ${lanes.join("\n")} const compilerOptionName = moduleKind >= 5 /* ES2015 */ ? "allowSyntheticDefaultImports" : "esModuleInterop"; const exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */); const exportAssignment = exportEqualsSymbol.valueDeclaration; - const err = error(node.name, Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName); + const err = error2(node.name, Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName); if (exportAssignment) { addRelatedInfo(err, createDiagnosticForNode( exportAssignment, @@ -47529,15 +47914,15 @@ ${lanes.join("\n")} } function getModuleSpecifierForImportOrExport(node) { switch (node.kind) { - case 272 /* ImportClause */: + case 273 /* ImportClause */: return node.parent.moduleSpecifier; - case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportEqualsDeclaration */: return isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : void 0; - case 273 /* NamespaceImport */: + case 274 /* NamespaceImport */: return node.parent.parent.moduleSpecifier; - case 275 /* ImportSpecifier */: + case 276 /* ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier; - case 280 /* ExportSpecifier */: + case 281 /* ExportSpecifier */: return node.parent.parent.moduleSpecifier; default: return Debug.assertNever(node); @@ -47546,14 +47931,14 @@ ${lanes.join("\n")} function reportNonDefaultExport(moduleSymbol, node) { var _a, _b, _c; if ((_a = moduleSymbol.exports) == null ? void 0 : _a.has(node.symbol.escapedName)) { - error( + error2( node.name, Diagnostics.Module_0_has_no_default_export_Did_you_mean_to_use_import_1_from_0_instead, symbolToString(moduleSymbol), symbolToString(node.symbol) ); } else { - const diagnostic = error(node.name, Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); + const diagnostic = error2(node.name, Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); const exportStar = (_b = moduleSymbol.exports) == null ? void 0 : _b.get("__export" /* ExportStar */); if (exportStar) { const defaultExport = (_c = exportStar.declarations) == null ? void 0 : _c.find((decl) => { @@ -47704,7 +48089,7 @@ ${lanes.join("\n")} const suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol); if (suggestion !== void 0) { const suggestionName = symbolToString(suggestion); - const diagnostic = error(name, Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName); + const diagnostic = error2(name, Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName); if (suggestion.valueDeclaration) { addRelatedInfo( diagnostic, @@ -47713,7 +48098,7 @@ ${lanes.join("\n")} } } else { if ((_a = moduleSymbol.exports) == null ? void 0 : _a.has("default" /* Default */)) { - error( + error2( name, Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead, moduleName, @@ -47731,10 +48116,10 @@ ${lanes.join("\n")} if (localSymbol) { const exportedEqualsSymbol = exports == null ? void 0 : exports.get("export=" /* ExportEquals */); if (exportedEqualsSymbol) { - getSymbolIfSameReference(exportedEqualsSymbol, localSymbol) ? reportInvalidImportEqualsExportMember(node, name, declarationName, moduleName) : error(name, Diagnostics.Module_0_has_no_exported_member_1, moduleName, declarationName); + getSymbolIfSameReference(exportedEqualsSymbol, localSymbol) ? reportInvalidImportEqualsExportMember(node, name, declarationName, moduleName) : error2(name, Diagnostics.Module_0_has_no_exported_member_1, moduleName, declarationName); } else { const exportedSymbol = exports ? find(symbolsToArray(exports), (symbol) => !!getSymbolIfSameReference(symbol, localSymbol)) : void 0; - const diagnostic = exportedSymbol ? error(name, Diagnostics.Module_0_declares_1_locally_but_it_is_exported_as_2, moduleName, declarationName, symbolToString(exportedSymbol)) : error(name, Diagnostics.Module_0_declares_1_locally_but_it_is_not_exported, moduleName, declarationName); + const diagnostic = exportedSymbol ? error2(name, Diagnostics.Module_0_declares_1_locally_but_it_is_exported_as_2, moduleName, declarationName, symbolToString(exportedSymbol)) : error2(name, Diagnostics.Module_0_declares_1_locally_but_it_is_not_exported, moduleName, declarationName); if (localSymbol.declarations) { addRelatedInfo( diagnostic, @@ -47743,20 +48128,20 @@ ${lanes.join("\n")} } } } else { - error(name, Diagnostics.Module_0_has_no_exported_member_1, moduleName, declarationName); + error2(name, Diagnostics.Module_0_has_no_exported_member_1, moduleName, declarationName); } } function reportInvalidImportEqualsExportMember(node, name, declarationName, moduleName) { if (moduleKind >= 5 /* ES2015 */) { const message = getESModuleInterop(compilerOptions) ? Diagnostics._0_can_only_be_imported_by_using_a_default_import : Diagnostics._0_can_only_be_imported_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import; - error(name, message, declarationName); + error2(name, message, declarationName); } else { if (isInJSFile(node)) { const message = getESModuleInterop(compilerOptions) ? Diagnostics._0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import : Diagnostics._0_can_only_be_imported_by_using_a_require_call_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import; - error(name, message, declarationName); + error2(name, message, declarationName); } else { const message = getESModuleInterop(compilerOptions) ? Diagnostics._0_can_only_be_imported_by_using_import_1_require_2_or_a_default_import : Diagnostics._0_can_only_be_imported_by_using_import_1_require_2_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import; - error(name, message, declarationName, declarationName, moduleName); + error2(name, message, declarationName, declarationName, moduleName); } } } @@ -47870,26 +48255,26 @@ ${lanes.join("\n")} } function getTargetOfAliasDeclaration(node, dontRecursivelyResolve = false) { switch (node.kind) { - case 270 /* ImportEqualsDeclaration */: - case 259 /* VariableDeclaration */: + case 271 /* ImportEqualsDeclaration */: + case 260 /* VariableDeclaration */: return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve); - case 272 /* ImportClause */: + case 273 /* ImportClause */: return getTargetOfImportClause(node, dontRecursivelyResolve); - case 273 /* NamespaceImport */: + case 274 /* NamespaceImport */: return getTargetOfNamespaceImport(node, dontRecursivelyResolve); - case 279 /* NamespaceExport */: + case 280 /* NamespaceExport */: return getTargetOfNamespaceExport(node, dontRecursivelyResolve); - case 275 /* ImportSpecifier */: - case 207 /* BindingElement */: + case 276 /* ImportSpecifier */: + case 208 /* BindingElement */: return getTargetOfImportSpecifier(node, dontRecursivelyResolve); - case 280 /* ExportSpecifier */: + case 281 /* ExportSpecifier */: return getTargetOfExportSpecifier(node, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */, dontRecursivelyResolve); - case 276 /* ExportAssignment */: - case 225 /* BinaryExpression */: + case 277 /* ExportAssignment */: + case 226 /* BinaryExpression */: return getTargetOfExportAssignment(node, dontRecursivelyResolve); - case 269 /* NamespaceExportDeclaration */: + case 270 /* NamespaceExportDeclaration */: return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve); - case 303 /* ShorthandPropertyAssignment */: + case 304 /* ShorthandPropertyAssignment */: return resolveEntityName( node.name, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */, @@ -47897,10 +48282,10 @@ ${lanes.join("\n")} true, dontRecursivelyResolve ); - case 302 /* PropertyAssignment */: + case 303 /* PropertyAssignment */: return getTargetOfAliasLikeExpression(node.initializer, dontRecursivelyResolve); - case 211 /* ElementAccessExpression */: - case 210 /* PropertyAccessExpression */: + case 212 /* ElementAccessExpression */: + case 211 /* PropertyAccessExpression */: return getTargetOfAccessExpression(node, dontRecursivelyResolve); default: return Debug.fail(); @@ -47926,7 +48311,7 @@ ${lanes.join("\n")} if (links.aliasTarget === resolvingSymbol) { links.aliasTarget = target || unknownSymbol; } else { - error(node, Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol)); + error2(node, Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol)); } } else if (links.aliasTarget === resolvingSymbol) { links.aliasTarget = unknownSymbol; @@ -47940,11 +48325,23 @@ ${lanes.join("\n")} } return void 0; } - function getAllSymbolFlags(symbol) { - let flags = symbol.flags; + function getSymbolFlags(symbol, excludeTypeOnlyMeanings, excludeLocalMeanings) { + const typeOnlyDeclaration = excludeTypeOnlyMeanings && getTypeOnlyAliasDeclaration(symbol); + const typeOnlyDeclarationIsExportStar = typeOnlyDeclaration && isExportDeclaration(typeOnlyDeclaration); + const typeOnlyResolution = typeOnlyDeclaration && (typeOnlyDeclarationIsExportStar ? resolveExternalModuleName( + typeOnlyDeclaration.moduleSpecifier, + typeOnlyDeclaration.moduleSpecifier, + /*ignoreErrors*/ + true + ) : resolveAlias(typeOnlyDeclaration.symbol)); + const typeOnlyExportStarTargets = typeOnlyDeclarationIsExportStar && typeOnlyResolution ? getExportsOfModule(typeOnlyResolution) : void 0; + let flags = excludeLocalMeanings ? 0 /* None */ : symbol.flags; let seenSymbols; while (symbol.flags & 2097152 /* Alias */) { - const target = resolveAlias(symbol); + const target = getExportSymbolOfValueSymbolIfExported(resolveAlias(symbol)); + if (!typeOnlyDeclarationIsExportStar && target === typeOnlyResolution || (typeOnlyExportStarTargets == null ? void 0 : typeOnlyExportStarTargets.get(target.escapedName)) === target) { + break; + } if (target === unknownSymbol) { return 67108863 /* All */; } @@ -48001,8 +48398,8 @@ ${lanes.join("\n")} return links.typeOnlyDeclaration || void 0; } if (links.typeOnlyDeclaration) { - const resolved = links.typeOnlyDeclaration.kind === 277 /* ExportDeclaration */ ? resolveSymbol(getExportsOfModule(links.typeOnlyDeclaration.symbol.parent).get(links.typeOnlyExportStarName || symbol.escapedName)) : resolveAlias(links.typeOnlyDeclaration.symbol); - return getAllSymbolFlags(resolved) & include ? links.typeOnlyDeclaration : void 0; + const resolved = links.typeOnlyDeclaration.kind === 278 /* ExportDeclaration */ ? resolveSymbol(getExportsOfModule(links.typeOnlyDeclaration.symbol.parent).get(links.typeOnlyExportStarName || symbol.escapedName)) : resolveAlias(links.typeOnlyDeclaration.symbol); + return getSymbolFlags(resolved) & include ? links.typeOnlyDeclaration : void 0; } return void 0; } @@ -48013,7 +48410,11 @@ ${lanes.join("\n")} const symbol = getSymbolOfDeclaration(node); const target = resolveAlias(symbol); if (target) { - const markAlias = target === unknownSymbol || getAllSymbolFlags(target) & 111551 /* Value */ && !isConstEnumOrConstEnumOnlyModule(target) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* Value */); + const markAlias = target === unknownSymbol || getSymbolFlags( + symbol, + /*excludeTypeOnlyMeanings*/ + true + ) & 111551 /* Value */ && !isConstEnumOrConstEnumOnlyModule(target); if (markAlias) { markAliasSymbolAsReferenced(symbol); } @@ -48028,7 +48429,7 @@ ${lanes.join("\n")} if (!node) return Debug.fail(); if (isInternalModuleImportEqualsDeclaration(node)) { - if (getAllSymbolFlags(resolveSymbol(symbol)) & 111551 /* Value */) { + if (getSymbolFlags(resolveSymbol(symbol)) & 111551 /* Value */) { checkExpressionCached(node.moduleReference); } } @@ -48044,7 +48445,7 @@ ${lanes.join("\n")} if (entityName.kind === 80 /* Identifier */ && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (entityName.kind === 80 /* Identifier */ || entityName.parent.kind === 165 /* QualifiedName */) { + if (entityName.kind === 80 /* Identifier */ || entityName.parent.kind === 166 /* QualifiedName */) { return resolveEntityName( entityName, 1920 /* Namespace */, @@ -48053,7 +48454,7 @@ ${lanes.join("\n")} dontResolveAlias ); } else { - Debug.assert(entityName.parent.kind === 270 /* ImportEqualsDeclaration */); + Debug.assert(entityName.parent.kind === 271 /* ImportEqualsDeclaration */); return resolveEntityName( entityName, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */, @@ -48126,9 +48527,9 @@ ${lanes.join("\n")} if (!symbol) { return getMergedSymbol(symbolFromJSPrototype); } - } else if (name.kind === 165 /* QualifiedName */ || name.kind === 210 /* PropertyAccessExpression */) { - const left = name.kind === 165 /* QualifiedName */ ? name.left : name.expression; - const right = name.kind === 165 /* QualifiedName */ ? name.right : name.name; + } else if (name.kind === 166 /* QualifiedName */ || name.kind === 211 /* PropertyAccessExpression */) { + const left = name.kind === 166 /* QualifiedName */ ? name.left : name.expression; + const right = name.kind === 166 /* QualifiedName */ ? name.right : name.name; let namespace = resolveEntityName( left, namespaceMeaning, @@ -48162,13 +48563,13 @@ ${lanes.join("\n")} const declarationName = declarationNameToString(right); const suggestionForNonexistentModule = getSuggestedSymbolForNonexistentModule(right, namespace); if (suggestionForNonexistentModule) { - error(right, Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, namespaceName, declarationName, symbolToString(suggestionForNonexistentModule)); + error2(right, Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, namespaceName, declarationName, symbolToString(suggestionForNonexistentModule)); return void 0; } const containingQualifiedName = isQualifiedName(name) && getContainingQualifiedNameNode(name); const canSuggestTypeof = globalObjectType && meaning & 788968 /* Type */ && containingQualifiedName && !isTypeOfExpression(containingQualifiedName.parent) && tryGetQualifiedNameAsValue(containingQualifiedName); if (canSuggestTypeof) { - error( + error2( containingQualifiedName, Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0, entityNameToString(containingQualifiedName) @@ -48178,7 +48579,7 @@ ${lanes.join("\n")} if (meaning & 1920 /* Namespace */ && isQualifiedName(name.parent)) { const exportedTypeSymbol = getMergedSymbol(getSymbol2(getExportsOfSymbol(namespace), right.escapedText, 788968 /* Type */)); if (exportedTypeSymbol) { - error( + error2( name.parent.right, Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1, symbolToString(exportedTypeSymbol), @@ -48187,7 +48588,7 @@ ${lanes.join("\n")} return void 0; } } - error(right, Diagnostics.Namespace_0_has_no_exported_member_1, namespaceName, declarationName); + error2(right, Diagnostics.Namespace_0_has_no_exported_member_1, namespaceName, declarationName); } return void 0; } @@ -48195,7 +48596,7 @@ ${lanes.join("\n")} Debug.assertNever(name, "Unknown entity name kind."); } Debug.assert((getCheckFlags(symbol) & 1 /* Instantiated */) === 0, "Should never get an instantiated symbol here."); - if (!nodeIsSynthesized(name) && isEntityName(name) && (symbol.flags & 2097152 /* Alias */ || name.parent.kind === 276 /* ExportAssignment */)) { + if (!nodeIsSynthesized(name) && isEntityName(name) && (symbol.flags & 2097152 /* Alias */ || name.parent.kind === 277 /* ExportAssignment */)) { markSymbolOfAliasDeclarationIfTypeOnly( getAliasDeclarationFromName(name), symbol, @@ -48225,7 +48626,7 @@ ${lanes.join("\n")} } } function getAssignmentDeclarationLocation(node) { - const typeAlias = findAncestor(node, (node2) => !(isJSDocNode(node2) || node2.flags & 8388608 /* JSDoc */) ? "quit" : isJSDocTypeAlias(node2)); + const typeAlias = findAncestor(node, (node2) => !(isJSDocNode(node2) || node2.flags & 16777216 /* JSDoc */) ? "quit" : isJSDocTypeAlias(node2)); if (typeAlias) { return; } @@ -48288,11 +48689,11 @@ ${lanes.join("\n")} return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0; } function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) { - var _a, _b, _c, _d, _e, _f, _g, _h, _i; + var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j; if (startsWith(moduleReference, "@types/")) { const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1; const withoutAtTypePrefix = removePrefix(moduleReference, "@types/"); - error(errorNode, diag2, withoutAtTypePrefix, moduleReference); + error2(errorNode, diag2, withoutAtTypePrefix, moduleReference); } const ambientModule = tryFindAmbientModule( moduleReference, @@ -48311,20 +48712,23 @@ ${lanes.join("\n")} const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName); if (sourceFile) { if (resolutionDiagnostic) { - error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName); + error2(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName); } if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) { const importOrExport = ((_g = findAncestor(location, isImportDeclaration)) == null ? void 0 : _g.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration)); if (importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) { - error( + error2( errorNode, Diagnostics.A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_file_0_instead, getSuggestedImportSource(Debug.checkDefined(tryExtractTSExtension(moduleReference))) ); } } else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) { - const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference)); - error(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension); + const importOrExport = ((_h = findAncestor(location, isImportDeclaration)) == null ? void 0 : _h.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration)); + if (!((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) { + const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference)); + error2(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension); + } } if (sourceFile.symbol) { if (resolvedModule.isExternalLibraryImport && !resolutionExtensionIsTSOrJson(resolvedModule.extension)) { @@ -48341,10 +48745,10 @@ ${lanes.join("\n")} if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) { const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration); const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l)); - const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_h = overrideClauseHost.assertions) == null ? void 0 : _h.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause; + const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_i = overrideClauseHost.assertions) == null ? void 0 : _i.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause; if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !getResolutionModeOverrideForClause(overrideClause)) { if (findAncestor(location, isImportEqualsDeclaration)) { - error(errorNode, Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead, moduleReference); + error2(errorNode, Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead, moduleReference); } else { let diagnosticDetails; const ext = tryGetExtensionFromPath2(currentSourceFile.fileName); @@ -48396,7 +48800,7 @@ ${lanes.join("\n")} return getMergedSymbol(sourceFile.symbol); } if (moduleNotFoundError) { - error(errorNode, Diagnostics.File_0_is_not_a_module, sourceFile.fileName); + error2(errorNode, Diagnostics.File_0_is_not_a_module, sourceFile.fileName); } return void 0; } @@ -48413,7 +48817,7 @@ ${lanes.join("\n")} if (resolvedModule && !resolutionExtensionIsTSOrJson(resolvedModule.extension) && resolutionDiagnostic === void 0 || resolutionDiagnostic === Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type) { if (isForAugmentation) { const diag2 = Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented; - error(errorNode, diag2, moduleReference, resolvedModule.resolvedFileName); + error2(errorNode, diag2, moduleReference, resolvedModule.resolvedFileName); } else { errorOnImplicitAnyModule( /*isError*/ @@ -48431,31 +48835,31 @@ ${lanes.join("\n")} if (resolvedModule) { const redirect = host.getProjectReferenceRedirect(resolvedModule.resolvedFileName); if (redirect) { - error(errorNode, Diagnostics.Output_file_0_has_not_been_built_from_source_file_1, redirect, resolvedModule.resolvedFileName); + error2(errorNode, Diagnostics.Output_file_0_has_not_been_built_from_source_file_1, redirect, resolvedModule.resolvedFileName); return void 0; } } if (resolutionDiagnostic) { - error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName); + error2(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName); } else { const isExtensionlessRelativePathImport = pathIsRelative(moduleReference) && !hasExtension(moduleReference); const resolutionIsNode16OrNext = moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */; if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) { - error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference); + error2(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference); } else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) { const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path)); - const suggestedExt = (_i = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _i[1]; + const suggestedExt = (_j = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _j[1]; if (suggestedExt) { - error( + error2( errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt ); } else { - error(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path); + error2(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path); } } else { - error(errorNode, moduleNotFoundError, moduleReference); + error2(errorNode, moduleNotFoundError, moduleReference); } } } @@ -48519,9 +48923,9 @@ ${lanes.join("\n")} var _a; const symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias); if (!dontResolveAlias && symbol) { - if (!suppressInteropError && !(symbol.flags & (1536 /* Module */ | 3 /* Variable */)) && !getDeclarationOfKind(symbol, 311 /* SourceFile */)) { + if (!suppressInteropError && !(symbol.flags & (1536 /* Module */ | 3 /* Variable */)) && !getDeclarationOfKind(symbol, 312 /* SourceFile */)) { const compilerOptionName = moduleKind >= 5 /* ES2015 */ ? "allowSyntheticDefaultImports" : "esModuleInterop"; - error(referencingLocation, Diagnostics.This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_referencing_its_default_export, compilerOptionName); + error2(referencingLocation, Diagnostics.This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_referencing_its_default_export, compilerOptionName); return symbol; } const referenceParent = referencingLocation.parent; @@ -48876,12 +49280,12 @@ ${lanes.join("\n")} return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0 && symbol.exportSymbol || symbol); } function symbolIsValue(symbol, includeTypeOnlyMembers) { - return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ && getAllSymbolFlags(symbol) & 111551 /* Value */ && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol))); + return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ && getSymbolFlags(symbol, !includeTypeOnlyMembers) & 111551 /* Value */); } function findConstructorDeclaration(node) { const members = node.members; for (const member of members) { - if (member.kind === 175 /* Constructor */ && nodeIsPresent(member.body)) { + if (member.kind === 176 /* Constructor */ && nodeIsPresent(member.body)) { return member; } } @@ -48905,7 +49309,7 @@ ${lanes.join("\n")} function createIntrinsicType(kind, intrinsicName, objectFlags = 0 /* None */) { const type = createType(kind); type.intrinsicName = intrinsicName; - type.objectFlags = objectFlags; + type.objectFlags = objectFlags | 524288 /* CouldContainTypeVariablesComputed */ | 2097152 /* IsGenericTypeComputed */ | 33554432 /* IsUnknownLikeUnionComputed */ | 16777216 /* IsNeverIntersectionComputed */; return type; } function createObjectType(objectFlags, symbol) { @@ -48999,11 +49403,11 @@ ${lanes.join("\n")} } } switch (location.kind) { - case 311 /* SourceFile */: + case 312 /* SourceFile */: if (!isExternalOrCommonJsModule(location)) { break; } - case 266 /* ModuleDeclaration */: + case 267 /* ModuleDeclaration */: const sym = getSymbolOfDeclaration(location); if (result = callback( (sym == null ? void 0 : sym.exports) || emptySymbols, @@ -49016,9 +49420,9 @@ ${lanes.join("\n")} return result; } break; - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: - case 263 /* InterfaceDeclaration */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: + case 264 /* InterfaceDeclaration */: let table; (getSymbolOfDeclaration(location).members || emptySymbols).forEach((memberSymbol, key) => { if (memberSymbol.flags & (788968 /* Type */ & ~67108864 /* Assignment */)) { @@ -49096,7 +49500,7 @@ ${lanes.join("\n")} return [symbol]; } const result2 = forEachEntry(symbols, (symbolFromSymbolTable) => { - if (symbolFromSymbolTable.flags & 2097152 /* Alias */ && symbolFromSymbolTable.escapedName !== "export=" /* ExportEquals */ && symbolFromSymbolTable.escapedName !== "default" /* Default */ && !(isUMDExportSymbol(symbolFromSymbolTable) && enclosingDeclaration && isExternalModule(getSourceFileOfNode(enclosingDeclaration))) && (!useOnlyExternalAliasing || some(symbolFromSymbolTable.declarations, isExternalModuleImportEqualsDeclaration)) && (isLocalNameLookup ? !some(symbolFromSymbolTable.declarations, isNamespaceReexportDeclaration) : true) && (ignoreQualification || !getDeclarationOfKind(symbolFromSymbolTable, 280 /* ExportSpecifier */))) { + if (symbolFromSymbolTable.flags & 2097152 /* Alias */ && symbolFromSymbolTable.escapedName !== "export=" /* ExportEquals */ && symbolFromSymbolTable.escapedName !== "default" /* Default */ && !(isUMDExportSymbol(symbolFromSymbolTable) && enclosingDeclaration && isExternalModule(getSourceFileOfNode(enclosingDeclaration))) && (!useOnlyExternalAliasing || some(symbolFromSymbolTable.declarations, isExternalModuleImportEqualsDeclaration)) && (isLocalNameLookup ? !some(symbolFromSymbolTable.declarations, isNamespaceReexportDeclaration) : true) && (ignoreQualification || !getDeclarationOfKind(symbolFromSymbolTable, 281 /* ExportSpecifier */))) { const resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); const candidate = getCandidateListForSymbol(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification); if (candidate) { @@ -49141,9 +49545,9 @@ ${lanes.join("\n")} if (symbolFromSymbolTable === symbol) { return true; } - const shouldResolveAlias = symbolFromSymbolTable.flags & 2097152 /* Alias */ && !getDeclarationOfKind(symbolFromSymbolTable, 280 /* ExportSpecifier */); + const shouldResolveAlias = symbolFromSymbolTable.flags & 2097152 /* Alias */ && !getDeclarationOfKind(symbolFromSymbolTable, 281 /* ExportSpecifier */); symbolFromSymbolTable = shouldResolveAlias ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; - const flags = shouldResolveAlias ? getAllSymbolFlags(symbolFromSymbolTable) : symbolFromSymbolTable.flags; + const flags = shouldResolveAlias ? getSymbolFlags(symbolFromSymbolTable) : symbolFromSymbolTable.flags; if (flags & meaning) { qualify = true; return true; @@ -49156,10 +49560,10 @@ ${lanes.join("\n")} if (symbol.declarations && symbol.declarations.length) { for (const declaration of symbol.declarations) { switch (declaration.kind) { - case 171 /* PropertyDeclaration */: - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 172 /* PropertyDeclaration */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: continue; default: return false; @@ -49295,10 +49699,10 @@ ${lanes.join("\n")} return node && getSymbolOfDeclaration(node); } function hasExternalModuleSymbol(declaration) { - return isAmbientModule(declaration) || declaration.kind === 311 /* SourceFile */ && isExternalOrCommonJsModule(declaration); + return isAmbientModule(declaration) || declaration.kind === 312 /* SourceFile */ && isExternalOrCommonJsModule(declaration); } function hasNonGlobalAugmentationExternalModuleSymbol(declaration) { - return isModuleWithStringLiteralName(declaration) || declaration.kind === 311 /* SourceFile */ && isExternalOrCommonJsModule(declaration); + return isModuleWithStringLiteralName(declaration) || declaration.kind === 312 /* SourceFile */ && isExternalOrCommonJsModule(declaration); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { let aliasesToMakeVisible; @@ -49346,9 +49750,9 @@ ${lanes.join("\n")} } function isEntityNameVisible(entityName, enclosingDeclaration) { let meaning; - if (entityName.parent.kind === 185 /* TypeQuery */ || entityName.parent.kind === 232 /* ExpressionWithTypeArguments */ && !isPartOfTypeNode(entityName.parent) || entityName.parent.kind === 166 /* ComputedPropertyName */) { + if (entityName.parent.kind === 186 /* TypeQuery */ || entityName.parent.kind === 233 /* ExpressionWithTypeArguments */ && !isPartOfTypeNode(entityName.parent) || entityName.parent.kind === 167 /* ComputedPropertyName */) { meaning = 111551 /* Value */ | 1048576 /* ExportValue */; - } else if (entityName.kind === 165 /* QualifiedName */ || entityName.kind === 210 /* PropertyAccessExpression */ || entityName.parent.kind === 270 /* ImportEqualsDeclaration */) { + } else if (entityName.kind === 166 /* QualifiedName */ || entityName.kind === 211 /* PropertyAccessExpression */ || entityName.parent.kind === 271 /* ImportEqualsDeclaration */) { meaning = 1920 /* Namespace */; } else { meaning = 788968 /* Type */; @@ -49414,7 +49818,7 @@ ${lanes.join("\n")} return writer ? symbolToStringWorker(writer).getText() : usingSingleLineStringWriter(symbolToStringWorker); function symbolToStringWorker(writer2) { const entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags); - const printer = (enclosingDeclaration == null ? void 0 : enclosingDeclaration.kind) === 311 /* SourceFile */ ? createPrinterWithRemoveCommentsNeverAsciiEscape() : createPrinterWithRemoveComments(); + const printer = (enclosingDeclaration == null ? void 0 : enclosingDeclaration.kind) === 312 /* SourceFile */ ? createPrinterWithRemoveCommentsNeverAsciiEscape() : createPrinterWithRemoveComments(); const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration); printer.writeNode( 4 /* Unspecified */, @@ -49431,9 +49835,9 @@ ${lanes.join("\n")} function signatureToStringWorker(writer2) { let sigOutput; if (flags & 262144 /* WriteArrowStyleSignature */) { - sigOutput = kind === 1 /* Construct */ ? 184 /* ConstructorType */ : 183 /* FunctionType */; + sigOutput = kind === 1 /* Construct */ ? 185 /* ConstructorType */ : 184 /* FunctionType */; } else { - sigOutput = kind === 1 /* Construct */ ? 179 /* ConstructSignature */ : 178 /* CallSignature */; + sigOutput = kind === 1 /* Construct */ ? 180 /* ConstructSignature */ : 179 /* CallSignature */; } const sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | 512 /* WriteTypeParametersInQualifiedName */); const printer = createPrinterWithRemoveCommentsOmitTrailingSemicolon(); @@ -49535,7 +49939,7 @@ ${lanes.join("\n")} return symbolToExpression(symbol, context, meaning); } function withContext(enclosingDeclaration, flags, tracker, cb) { - Debug.assert(enclosingDeclaration === void 0 || (enclosingDeclaration.flags & 8 /* Synthesized */) === 0); + Debug.assert(enclosingDeclaration === void 0 || (enclosingDeclaration.flags & 16 /* Synthesized */) === 0); const moduleResolverHost = (tracker == null ? void 0 : tracker.trackSymbol) ? tracker.moduleResolverHost : flags & 134217728 /* DoNotIncludeSymbolChain */ ? createBasicNodeBuilderModuleSpecifierResolutionHost(host) : void 0; const context = { enclosingDeclaration, @@ -49607,7 +50011,7 @@ ${lanes.join("\n")} } if (type.flags & 64 /* BigInt */) { context.approximateLength += 6; - return factory.createKeywordTypeNode(162 /* BigIntKeyword */); + return factory.createKeywordTypeNode(163 /* BigIntKeyword */); } if (type.flags & 16 /* Boolean */ && !type.aliasSymbol) { context.approximateLength += 7; @@ -49880,11 +50284,13 @@ ${lanes.join("\n")} return !!type2.target && isMappedTypeHomomorphic(type2.target) && !isMappedTypeHomomorphic(type2); } function createMappedTypeNodeFromType(type2) { + var _a2; Debug.assert(!!(type2.flags & 524288 /* Object */)); const readonlyToken = type2.declaration.readonlyToken ? factory.createToken(type2.declaration.readonlyToken.kind) : void 0; const questionToken = type2.declaration.questionToken ? factory.createToken(type2.declaration.questionToken.kind) : void 0; let appropriateConstraintTypeNode; let newTypeVariable; + const needsModifierPreservingWrapper = !isMappedTypeWithKeyofConstraintDeclaration(type2) && !(getModifiersTypeFromMappedType(type2).flags & 2 /* Unknown */) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && !(getConstraintTypeFromMappedType(type2).flags & 262144 /* TypeParameter */ && ((_a2 = getConstraintOfTypeParameter(getConstraintTypeFromMappedType(type2))) == null ? void 0 : _a2.flags) & 4194304 /* Index */); if (isMappedTypeWithKeyofConstraintDeclaration(type2)) { if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) { const newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T")); @@ -49892,6 +50298,11 @@ ${lanes.join("\n")} newTypeVariable = factory.createTypeReferenceNode(name); } appropriateConstraintTypeNode = factory.createTypeOperatorNode(143 /* KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type2), context)); + } else if (needsModifierPreservingWrapper) { + const newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T")); + const name = typeParameterToName(newParam, context); + newTypeVariable = factory.createTypeReferenceNode(name); + appropriateConstraintTypeNode = newTypeVariable; } else { appropriateConstraintTypeNode = typeToTypeNodeHelper(getConstraintTypeFromMappedType(type2), context); } @@ -49922,6 +50333,18 @@ ${lanes.join("\n")} result, factory.createKeywordTypeNode(146 /* NeverKeyword */) ); + } else if (needsModifierPreservingWrapper) { + return factory.createConditionalTypeNode( + typeToTypeNodeHelper(getConstraintTypeFromMappedType(type2), context), + factory.createInferTypeNode(factory.createTypeParameterDeclaration( + /*modifiers*/ + void 0, + factory.cloneNode(newTypeVariable.typeName), + factory.createTypeOperatorNode(143 /* KeyOfKeyword */, typeToTypeNodeHelper(getModifiersTypeFromMappedType(type2), context)) + )), + result, + factory.createKeywordTypeNode(146 /* NeverKeyword */) + ); } return result; } @@ -49973,7 +50396,7 @@ ${lanes.join("\n")} const isStaticMethodSymbol = !!(symbol.flags & 8192 /* Method */) && // typeof static method some(symbol.declarations, (declaration) => isStatic(declaration)); const isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || // is exported function symbol - forEach(symbol.declarations, (declaration) => declaration.parent.kind === 311 /* SourceFile */ || declaration.parent.kind === 267 /* ModuleBlock */)); + forEach(symbol.declarations, (declaration) => declaration.parent.kind === 312 /* SourceFile */ || declaration.parent.kind === 268 /* ModuleBlock */)); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return (!!(context.flags & 4096 /* UseTypeOfFunction */) || ((_a3 = context.visitedTypes) == null ? void 0 : _a3.has(typeId))) && // it is type of the symbol uses itself recursively (!(context.flags & 8 /* UseStructuralFallback */) || isValueSymbolAccessible(symbol, context.enclosingDeclaration)); @@ -50056,12 +50479,12 @@ ${lanes.join("\n")} } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { const signature = resolved.callSignatures[0]; - const signatureNode = signatureToSignatureDeclarationHelper(signature, 183 /* FunctionType */, context); + const signatureNode = signatureToSignatureDeclarationHelper(signature, 184 /* FunctionType */, context); return signatureNode; } if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { const signature = resolved.constructSignatures[0]; - const signatureNode = signatureToSignatureDeclarationHelper(signature, 184 /* ConstructorType */, context); + const signatureNode = signatureToSignatureDeclarationHelper(signature, 185 /* ConstructorType */, context); return signatureNode; } } @@ -50101,19 +50524,18 @@ ${lanes.join("\n")} const arity = getTypeReferenceArity(type2); const tupleConstituentNodes = mapToTypeNodes(typeArguments.slice(0, arity), context); if (tupleConstituentNodes) { - if (type2.target.labeledElementDeclarations) { - for (let i = 0; i < tupleConstituentNodes.length; i++) { - const flags = type2.target.elementFlags[i]; + const { labeledElementDeclarations } = type2.target; + for (let i = 0; i < tupleConstituentNodes.length; i++) { + const flags = type2.target.elementFlags[i]; + const labeledElementDeclaration = labeledElementDeclarations == null ? void 0 : labeledElementDeclarations[i]; + if (labeledElementDeclaration) { tupleConstituentNodes[i] = factory.createNamedTupleMember( flags & 12 /* Variable */ ? factory.createToken(26 /* DotDotDotToken */) : void 0, - factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(type2.target.labeledElementDeclarations[i]))), + factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(labeledElementDeclaration))), flags & 2 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0, flags & 4 /* Rest */ ? factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i] ); - } - } else { - for (let i = 0; i < Math.min(arity, tupleConstituentNodes.length); i++) { - const flags = type2.target.elementFlags[i]; + } else { tupleConstituentNodes[i] = flags & 12 /* Variable */ ? factory.createRestTypeNode(flags & 4 /* Rest */ ? factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]) : flags & 2 /* Optional */ ? factory.createOptionalTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]; } } @@ -50247,12 +50669,12 @@ ${lanes.join("\n")} } const typeElements = []; for (const signature of resolvedType.callSignatures) { - typeElements.push(signatureToSignatureDeclarationHelper(signature, 178 /* CallSignature */, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 179 /* CallSignature */, context)); } for (const signature of resolvedType.constructSignatures) { if (signature.flags & 4 /* Abstract */) continue; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 179 /* ConstructSignature */, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 180 /* ConstructSignature */, context)); } for (const info of resolvedType.indexInfos) { typeElements.push(indexInfoToIndexSignatureDeclarationHelper(info, context, resolvedType.objectFlags & 1024 /* ReverseMapped */ ? createElidedInformationPlaceholder(context) : void 0)); @@ -50336,39 +50758,41 @@ ${lanes.join("\n")} if (propertySymbol.flags & (16 /* Function */ | 8192 /* Method */) && !getPropertiesOfObjectType(propertyType).length && !isReadonlySymbol(propertySymbol)) { const signatures = getSignaturesOfType(filterType(propertyType, (t) => !(t.flags & 32768 /* Undefined */)), 0 /* Call */); for (const signature of signatures) { - const methodDeclaration = signatureToSignatureDeclarationHelper(signature, 172 /* MethodSignature */, context, { name: propertyName, questionToken: optionalToken }); + const methodDeclaration = signatureToSignatureDeclarationHelper(signature, 173 /* MethodSignature */, context, { name: propertyName, questionToken: optionalToken }); typeElements.push(preserveCommentsOn(methodDeclaration)); } + if (signatures.length || !optionalToken) { + return; + } + } + let propertyTypeNode; + if (shouldUsePlaceholderForProperty(propertySymbol, context)) { + propertyTypeNode = createElidedInformationPlaceholder(context); } else { - let propertyTypeNode; - if (shouldUsePlaceholderForProperty(propertySymbol, context)) { - propertyTypeNode = createElidedInformationPlaceholder(context); - } else { - if (propertyIsReverseMapped) { - context.reverseMappedStack || (context.reverseMappedStack = []); - context.reverseMappedStack.push(propertySymbol); - } - propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */); - if (propertyIsReverseMapped) { - context.reverseMappedStack.pop(); - } + if (propertyIsReverseMapped) { + context.reverseMappedStack || (context.reverseMappedStack = []); + context.reverseMappedStack.push(propertySymbol); } - const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0; - if (modifiers) { - context.approximateLength += 9; + propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */); + if (propertyIsReverseMapped) { + context.reverseMappedStack.pop(); } - const propertySignature = factory.createPropertySignature( - modifiers, - propertyName, - optionalToken, - propertyTypeNode - ); - typeElements.push(preserveCommentsOn(propertySignature)); } + const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0; + if (modifiers) { + context.approximateLength += 9; + } + const propertySignature = factory.createPropertySignature( + modifiers, + propertyName, + optionalToken, + propertyTypeNode + ); + typeElements.push(preserveCommentsOn(propertySignature)); function preserveCommentsOn(node) { var _a2; - if (some(propertySymbol.declarations, (d) => d.kind === 354 /* JSDocPropertyTag */)) { - const d = (_a2 = propertySymbol.declarations) == null ? void 0 : _a2.find((d2) => d2.kind === 354 /* JSDocPropertyTag */); + if (some(propertySymbol.declarations, (d) => d.kind === 355 /* JSDocPropertyTag */)) { + const d = (_a2 = propertySymbol.declarations) == null ? void 0 : _a2.find((d2) => d2.kind === 355 /* JSDocPropertyTag */); const commentText = getTextOfJSDocComment(d.comment); if (commentText) { setSyntheticLeadingComments(node, [{ kind: 3 /* MultiLineCommentTrivia */, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]); @@ -50474,6 +50898,7 @@ ${lanes.join("\n")} ); } function signatureToSignatureDeclarationHelper(signature, kind, context, options) { + var _a; const suppressAny = context.flags & 256 /* SuppressAnyReturnType */; if (suppressAny) context.flags &= ~256 /* SuppressAnyReturnType */; @@ -50523,7 +50948,7 @@ ${lanes.join("\n")} } } } - const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 175 /* Constructor */, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports)); + const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 176 /* Constructor */, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports)); const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context); if (thisParameter) { parameters.unshift(thisParameter); @@ -50544,11 +50969,11 @@ ${lanes.join("\n")} } } let modifiers = options == null ? void 0 : options.modifiers; - if (kind === 184 /* ConstructorType */ && signature.flags & 4 /* Abstract */) { + if (kind === 185 /* ConstructorType */ && signature.flags & 4 /* Abstract */) { const flags = modifiersToFlags(modifiers); modifiers = factory.createModifiersFromModifierFlags(flags | 256 /* Abstract */); } - const node = kind === 178 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 179 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 172 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (options == null ? void 0 : options.name) ?? factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 173 /* MethodDeclaration */ ? factory.createMethodDeclaration( + const node = kind === 179 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 180 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 173 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (options == null ? void 0 : options.name) ?? factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 174 /* MethodDeclaration */ ? factory.createMethodDeclaration( modifiers, /*asteriskToken*/ void 0, @@ -50560,25 +50985,25 @@ ${lanes.join("\n")} returnTypeNode, /*body*/ void 0 - ) : kind === 175 /* Constructor */ ? factory.createConstructorDeclaration( + ) : kind === 176 /* Constructor */ ? factory.createConstructorDeclaration( modifiers, parameters, /*body*/ void 0 - ) : kind === 176 /* GetAccessor */ ? factory.createGetAccessorDeclaration( + ) : kind === 177 /* GetAccessor */ ? factory.createGetAccessorDeclaration( modifiers, (options == null ? void 0 : options.name) ?? factory.createIdentifier(""), parameters, returnTypeNode, /*body*/ void 0 - ) : kind === 177 /* SetAccessor */ ? factory.createSetAccessorDeclaration( + ) : kind === 178 /* SetAccessor */ ? factory.createSetAccessorDeclaration( modifiers, (options == null ? void 0 : options.name) ?? factory.createIdentifier(""), parameters, /*body*/ void 0 - ) : kind === 180 /* IndexSignature */ ? factory.createIndexSignature(modifiers, parameters, returnTypeNode) : kind === 323 /* JSDocFunctionType */ ? factory.createJSDocFunctionType(parameters, returnTypeNode) : kind === 183 /* FunctionType */ ? factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode ?? factory.createTypeReferenceNode(factory.createIdentifier(""))) : kind === 184 /* ConstructorType */ ? factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode ?? factory.createTypeReferenceNode(factory.createIdentifier(""))) : kind === 261 /* FunctionDeclaration */ ? factory.createFunctionDeclaration( + ) : kind === 181 /* IndexSignature */ ? factory.createIndexSignature(modifiers, parameters, returnTypeNode) : kind === 324 /* JSDocFunctionType */ ? factory.createJSDocFunctionType(parameters, returnTypeNode) : kind === 184 /* FunctionType */ ? factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode ?? factory.createTypeReferenceNode(factory.createIdentifier(""))) : kind === 185 /* ConstructorType */ ? factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode ?? factory.createTypeReferenceNode(factory.createIdentifier(""))) : kind === 262 /* FunctionDeclaration */ ? factory.createFunctionDeclaration( modifiers, /*asteriskToken*/ void 0, @@ -50588,7 +51013,7 @@ ${lanes.join("\n")} returnTypeNode, /*body*/ void 0 - ) : kind === 217 /* FunctionExpression */ ? factory.createFunctionExpression( + ) : kind === 218 /* FunctionExpression */ ? factory.createFunctionExpression( modifiers, /*asteriskToken*/ void 0, @@ -50597,7 +51022,7 @@ ${lanes.join("\n")} parameters, returnTypeNode, factory.createBlock([]) - ) : kind === 218 /* ArrowFunction */ ? factory.createArrowFunction( + ) : kind === 219 /* ArrowFunction */ ? factory.createArrowFunction( modifiers, typeParameters, parameters, @@ -50609,6 +51034,20 @@ ${lanes.join("\n")} if (typeArguments) { node.typeArguments = factory.createNodeArray(typeArguments); } + if (((_a = signature.declaration) == null ? void 0 : _a.kind) === 330 /* JSDocSignature */ && signature.declaration.parent.kind === 346 /* JSDocOverloadTag */) { + const comment = getTextOfNode( + signature.declaration.parent.parent, + /*includeTrivia*/ + true + ).slice(2, -2).split(/\r\n|\n|\r/).map((line) => line.replace(/^\s+/, " ")).join("\n"); + addSyntheticLeadingComment( + node, + 3 /* MultiLineCommentTrivia */, + comment, + /*hasTrailingNewLine*/ + true + ); + } cleanup == null ? void 0 : cleanup(); return node; } @@ -50647,9 +51086,9 @@ ${lanes.join("\n")} return typeParameterToDeclarationWithConstraint(type, context, constraintNode); } function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags, privateSymbolVisitor, bundledImports) { - let parameterDeclaration = getDeclarationOfKind(parameterSymbol, 168 /* Parameter */); + let parameterDeclaration = getDeclarationOfKind(parameterSymbol, 169 /* Parameter */); if (!parameterDeclaration && !isTransientSymbol(parameterSymbol)) { - parameterDeclaration = getDeclarationOfKind(parameterSymbol, 347 /* JSDocParameterTag */); + parameterDeclaration = getDeclarationOfKind(parameterSymbol, 348 /* JSDocParameterTag */); } let parameterType = getTypeOfSymbol(parameterSymbol); if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) { @@ -50659,7 +51098,7 @@ ${lanes.join("\n")} const modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && canHaveModifiers(parameterDeclaration) ? map(getModifiers(parameterDeclaration), factory.cloneNode) : void 0; const isRest = parameterDeclaration && isRestParameter(parameterDeclaration) || getCheckFlags(parameterSymbol) & 32768 /* RestParameter */; const dotDotDotToken = isRest ? factory.createToken(26 /* DotDotDotToken */) : void 0; - const name = parameterDeclaration ? parameterDeclaration.name ? parameterDeclaration.name.kind === 80 /* Identifier */ ? setEmitFlags(factory.cloneNode(parameterDeclaration.name), 16777216 /* NoAsciiEscaping */) : parameterDeclaration.name.kind === 165 /* QualifiedName */ ? setEmitFlags(factory.cloneNode(parameterDeclaration.name.right), 16777216 /* NoAsciiEscaping */) : cloneBindingName(parameterDeclaration.name) : symbolName(parameterSymbol) : symbolName(parameterSymbol); + const name = parameterDeclaration ? parameterDeclaration.name ? parameterDeclaration.name.kind === 80 /* Identifier */ ? setEmitFlags(factory.cloneNode(parameterDeclaration.name), 16777216 /* NoAsciiEscaping */) : parameterDeclaration.name.kind === 166 /* QualifiedName */ ? setEmitFlags(factory.cloneNode(parameterDeclaration.name.right), 16777216 /* NoAsciiEscaping */) : cloneBindingName(parameterDeclaration.name) : symbolName(parameterSymbol) : symbolName(parameterSymbol); const isOptional = parameterDeclaration && isOptionalParameter(parameterDeclaration) || getCheckFlags(parameterSymbol) & 16384 /* OptionalParameter */; const questionToken = isOptional ? factory.createToken(58 /* QuestionToken */) : void 0; const parameterNode = factory.createParameterDeclaration( @@ -50839,11 +51278,11 @@ ${lanes.join("\n")} return top; } function getSpecifierForModuleSymbol(symbol, context, overrideImportMode) { - let file = getDeclarationOfKind(symbol, 311 /* SourceFile */); + let file = getDeclarationOfKind(symbol, 312 /* SourceFile */); if (!file) { const equivalentFileSymbol = firstDefined(symbol.declarations, (d) => getFileSymbolIfFileSymbolExportEqualsContainer(d, symbol)); if (equivalentFileSymbol) { - file = getDeclarationOfKind(equivalentFileSymbol, 311 /* SourceFile */); + file = getDeclarationOfKind(equivalentFileSymbol, 312 /* SourceFile */); } } if (file && file.moduleName !== void 0) { @@ -51323,7 +51762,7 @@ ${lanes.join("\n")} } return transformed === existing ? setTextRange(factory.cloneNode(existing), existing) : transformed; function visitExistingNodeTreeSymbols(node) { - if (isJSDocAllType(node) || node.kind === 325 /* JSDocNamepathType */) { + if (isJSDocAllType(node) || node.kind === 326 /* JSDocNamepathType */) { return factory.createKeywordTypeNode(133 /* AnyKeyword */); } if (isJSDocUnknownType(node)) { @@ -51487,13 +51926,13 @@ ${lanes.join("\n")} function symbolTableToDeclarationStatements(symbolTable, context, bundled) { const serializePropertySymbolForClass = makeSerializePropertySymbol( factory.createPropertyDeclaration, - 173 /* MethodDeclaration */, + 174 /* MethodDeclaration */, /*useAccessors*/ true ); const serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol( (mods, name, question, type) => factory.createPropertySignature(mods, name, question, type), - 172 /* MethodSignature */, + 173 /* MethodSignature */, /*useAccessors*/ false ); @@ -51762,7 +52201,7 @@ ${lanes.join("\n")} if (!(symbol.flags & 16 /* Function */) && isTypeRepresentableAsFunctionNamespaceMerge(type, symbol)) { serializeAsFunctionNamespaceMerge(type, symbol, localName, modifierFlags); } else { - const flags = !(symbol.flags & 2 /* BlockScopedVariable */) ? ((_a = symbol.parent) == null ? void 0 : _a.valueDeclaration) && isSourceFile((_b = symbol.parent) == null ? void 0 : _b.valueDeclaration) ? 2 /* Const */ : void 0 : isConstVariable(symbol) ? 2 /* Const */ : 1 /* Let */; + const flags = !(symbol.flags & 2 /* BlockScopedVariable */) ? ((_a = symbol.parent) == null ? void 0 : _a.valueDeclaration) && isSourceFile((_b = symbol.parent) == null ? void 0 : _b.valueDeclaration) ? 2 /* Const */ : void 0 : isConstantVariable(symbol) ? 2 /* Const */ : 1 /* Let */; const name = needsPostExportDefault || !(symbol.flags & 4 /* Property */) ? localName : getUnusedName(localName, symbol); let textRange = symbol.declarations && find(symbol.declarations, (d) => isVariableDeclaration(d)); if (textRange && isVariableDeclarationList(textRange.parent) && textRange.parent.declarations.length === 1) { @@ -51908,7 +52347,7 @@ ${lanes.join("\n")} if (additionalModifierFlags & 1 /* Export */ && enclosingDeclaration2 && (isExportingScope(enclosingDeclaration2) || isModuleDeclaration(enclosingDeclaration2)) && canHaveExportModifier(node)) { newModifierFlags |= 1 /* Export */; } - if (addingDeclare && !(newModifierFlags & 1 /* Export */) && (!enclosingDeclaration2 || !(enclosingDeclaration2.flags & 16777216 /* Ambient */)) && (isEnumDeclaration(node) || isVariableStatement(node) || isFunctionDeclaration(node) || isClassDeclaration(node) || isModuleDeclaration(node))) { + if (addingDeclare && !(newModifierFlags & 1 /* Export */) && (!enclosingDeclaration2 || !(enclosingDeclaration2.flags & 33554432 /* Ambient */)) && (isEnumDeclaration(node) || isVariableStatement(node) || isFunctionDeclaration(node) || isClassDeclaration(node) || isModuleDeclaration(node))) { newModifierFlags |= 2 /* Ambient */; } if (additionalModifierFlags & 1024 /* Default */ && (isClassDeclaration(node) || isInterfaceDeclaration(node) || isFunctionDeclaration(node))) { @@ -51952,8 +52391,8 @@ ${lanes.join("\n")} const baseTypes = getBaseTypes(interfaceType); const baseType = length(baseTypes) ? getIntersectionType(baseTypes) : void 0; const members = flatMap(getPropertiesOfType(interfaceType), (p) => serializePropertySymbolForInterface(p, baseType)); - const callSignatures = serializeSignatures(0 /* Call */, interfaceType, baseType, 178 /* CallSignature */); - const constructSignatures = serializeSignatures(1 /* Construct */, interfaceType, baseType, 179 /* ConstructSignature */); + const callSignatures = serializeSignatures(0 /* Call */, interfaceType, baseType, 179 /* CallSignature */); + const constructSignatures = serializeSignatures(1 /* Construct */, interfaceType, baseType, 180 /* ConstructSignature */); const indexSignatures = serializeIndexSignatures(interfaceType, baseType); const heritageClauses = !length(baseTypes) ? void 0 : [factory.createHeritageClause(96 /* ExtendsKeyword */, mapDefined(baseTypes, (b) => trySerializeAsTypeReference(b, 111551 /* Value */)))]; addResult(factory.createInterfaceDeclaration( @@ -51970,7 +52409,7 @@ ${lanes.join("\n")} return !exports ? [] : filter(arrayFrom(exports.values()), (m) => isNamespaceMember(m) && isIdentifierText(m.escapedName, 99 /* ESNext */)); } function isTypeOnlyNamespace(symbol) { - return every(getNamespaceMembersForSerialization(symbol), (m) => !(getAllSymbolFlags(resolveSymbol(m)) & 111551 /* Value */)); + return every(getNamespaceMembersForSerialization(symbol), (m) => !(getSymbolFlags(resolveSymbol(m)) & 111551 /* Value */)); } function serializeModule(symbol, symbolName2, modifierFlags) { const members = getNamespaceMembersForSerialization(symbol); @@ -52018,7 +52457,7 @@ ${lanes.join("\n")} void 0, factory.createIdentifier(localName), nsBody, - 16 /* Namespace */ + 32 /* Namespace */ ), 0 /* None */); } } @@ -52035,7 +52474,7 @@ ${lanes.join("\n")} function serializeAsFunctionNamespaceMerge(type, symbol, localName, modifierFlags) { const signatures = getSignaturesOfType(type, 0 /* Call */); for (const sig of signatures) { - const decl = signatureToSignatureDeclarationHelper(sig, 261 /* FunctionDeclaration */, context, { name: factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); + const decl = signatureToSignatureDeclarationHelper(sig, 262 /* FunctionDeclaration */, context, { name: factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); addResult(setTextRange(decl, getSignatureTextRangeLocation(sig)), modifierFlags); } if (!(symbol.flags & (512 /* ValueModule */ | 1024 /* NamespaceModule */) && !!symbol.exports && !!symbol.exports.size)) { @@ -52075,7 +52514,7 @@ ${lanes.join("\n")} void 0, factory.createIdentifier(localName), factory.createModuleBlock([]), - 16 /* Namespace */ + 32 /* Namespace */ ); setParent(fakespace, enclosingDeclaration); fakespace.locals = createSymbolTable(props); @@ -52219,7 +52658,7 @@ ${lanes.join("\n")} [], /*body*/ void 0 - )] : serializeSignatures(1 /* Construct */, staticType, staticBaseType, 175 /* Constructor */); + )] : serializeSignatures(1 /* Construct */, staticType, staticBaseType, 176 /* Constructor */); const indexSignatures = serializeIndexSignatures(classType, baseTypes[0]); context.enclosingDeclaration = oldEnclosing; addResult(setTextRange(factory.createClassDeclaration( @@ -52271,8 +52710,8 @@ ${lanes.join("\n")} const targetName = getInternalSymbolName(target, verbatimTargetName); includePrivateSymbol(target); switch (node.kind) { - case 207 /* BindingElement */: - if (((_b = (_a = node.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.kind) === 259 /* VariableDeclaration */) { + case 208 /* BindingElement */: + if (((_b = (_a = node.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.kind) === 260 /* VariableDeclaration */) { const specifier2 = getSpecifierForModuleSymbol(target.parent || target, context); const { propertyName } = node; addResult(factory.createImportDeclaration( @@ -52298,15 +52737,15 @@ ${lanes.join("\n")} } Debug.failBadSyntaxKind(((_c = node.parent) == null ? void 0 : _c.parent) || node, "Unhandled binding element grandparent kind in declaration serialization"); break; - case 303 /* ShorthandPropertyAssignment */: - if (((_e = (_d = node.parent) == null ? void 0 : _d.parent) == null ? void 0 : _e.kind) === 225 /* BinaryExpression */) { + case 304 /* ShorthandPropertyAssignment */: + if (((_e = (_d = node.parent) == null ? void 0 : _d.parent) == null ? void 0 : _e.kind) === 226 /* BinaryExpression */) { serializeExportSpecifier( unescapeLeadingUnderscores(symbol.escapedName), targetName ); } break; - case 259 /* VariableDeclaration */: + case 260 /* VariableDeclaration */: if (isPropertyAccessExpression(node.initializer)) { const initializer = node.initializer; const uniqueName = factory.createUniqueName(localName); @@ -52329,7 +52768,7 @@ ${lanes.join("\n")} ), modifierFlags); break; } - case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportEqualsDeclaration */: if (target.escapedName === "export=" /* ExportEquals */ && some(target.declarations, (d) => isSourceFile(d) && isJsonSourceFile(d))) { serializeMaybeAliasAssignment(symbol); break; @@ -52350,10 +52789,10 @@ ${lanes.join("\n")} ) : factory.createExternalModuleReference(factory.createStringLiteral(getSpecifierForModuleSymbol(target, context))) ), isLocalImport ? modifierFlags : 0 /* None */); break; - case 269 /* NamespaceExportDeclaration */: + case 270 /* NamespaceExportDeclaration */: addResult(factory.createNamespaceExportDeclaration(idText(node.name)), 0 /* None */); break; - case 272 /* ImportClause */: { + case 273 /* ImportClause */: { const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context); const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.moduleSpecifier; addResult(factory.createImportDeclaration( @@ -52371,7 +52810,7 @@ ${lanes.join("\n")} ), 0 /* None */); break; } - case 273 /* NamespaceImport */: { + case 274 /* NamespaceImport */: { const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context); const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.moduleSpecifier; addResult(factory.createImportDeclaration( @@ -52389,7 +52828,7 @@ ${lanes.join("\n")} ), 0 /* None */); break; } - case 279 /* NamespaceExport */: + case 280 /* NamespaceExport */: addResult(factory.createExportDeclaration( /*modifiers*/ void 0, @@ -52399,7 +52838,7 @@ ${lanes.join("\n")} factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)) ), 0 /* None */); break; - case 275 /* ImportSpecifier */: { + case 276 /* ImportSpecifier */: { const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context); const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.parent.moduleSpecifier; addResult(factory.createImportDeclaration( @@ -52424,7 +52863,7 @@ ${lanes.join("\n")} ), 0 /* None */); break; } - case 280 /* ExportSpecifier */: + case 281 /* ExportSpecifier */: const specifier = node.parent.parent.moduleSpecifier; serializeExportSpecifier( unescapeLeadingUnderscores(symbol.escapedName), @@ -52432,12 +52871,12 @@ ${lanes.join("\n")} specifier && isStringLiteralLike(specifier) ? factory.createStringLiteral(specifier.text) : void 0 ); break; - case 276 /* ExportAssignment */: + case 277 /* ExportAssignment */: serializeMaybeAliasAssignment(symbol); break; - case 225 /* BinaryExpression */: - case 210 /* PropertyAccessExpression */: - case 211 /* ElementAccessExpression */: + case 226 /* BinaryExpression */: + case 211 /* PropertyAccessExpression */: + case 212 /* ElementAccessExpression */: if (symbol.escapedName === "default" /* Default */ || symbol.escapedName === "export=" /* ExportEquals */) { serializeMaybeAliasAssignment(symbol); } else { @@ -52544,7 +52983,7 @@ ${lanes.join("\n")} void 0, serializeTypeForDeclaration(context, typeToSerialize, symbol, enclosingDeclaration, includePrivateSymbol, bundled) ) - ], ((_a = context.enclosingDeclaration) == null ? void 0 : _a.kind) === 266 /* ModuleDeclaration */ ? 1 /* Let */ : 2 /* Const */) + ], ((_a = context.enclosingDeclaration) == null ? void 0 : _a.kind) === 267 /* ModuleDeclaration */ ? 1 /* Let */ : 2 /* Const */) ); addResult( statement, @@ -52917,10 +53356,10 @@ ${lanes.join("\n")} return void 0; } function isTopLevelInExternalModuleAugmentation(node) { - return node && node.parent && node.parent.kind === 267 /* ModuleBlock */ && isExternalModuleAugmentation(node.parent.parent); + return node && node.parent && node.parent.kind === 268 /* ModuleBlock */ && isExternalModuleAugmentation(node.parent.parent); } function isDefaultBindingContext(location) { - return location.kind === 311 /* SourceFile */ || isAmbientModule(location); + return location.kind === 312 /* SourceFile */ || isAmbientModule(location); } function getNameOfSymbolFromNameType(symbol, context) { const nameType = getSymbolLinks(symbol).nameType; @@ -52968,17 +53407,17 @@ ${lanes.join("\n")} if (!declaration) { declaration = symbol.declarations[0]; } - if (declaration.parent && declaration.parent.kind === 259 /* VariableDeclaration */) { + if (declaration.parent && declaration.parent.kind === 260 /* VariableDeclaration */) { return declarationNameToString(declaration.parent.name); } switch (declaration.kind) { - case 230 /* ClassExpression */: - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: + case 231 /* ClassExpression */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: if (context && !context.encounteredError && !(context.flags & 131072 /* AllowAnonymousIdentifier */)) { context.encounteredError = true; } - return declaration.kind === 230 /* ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)"; + return declaration.kind === 231 /* ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)"; } } const name = getNameOfSymbolFromNameType(symbol, context); @@ -52995,66 +53434,66 @@ ${lanes.join("\n")} return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 344 /* JSDocCallbackTag */: - case 352 /* JSDocTypedefTag */: - case 346 /* JSDocEnumTag */: + case 345 /* JSDocCallbackTag */: + case 353 /* JSDocTypedefTag */: + case 347 /* JSDocEnumTag */: return !!(node.parent && node.parent.parent && node.parent.parent.parent && isSourceFile(node.parent.parent.parent)); - case 207 /* BindingElement */: + case 208 /* BindingElement */: return isDeclarationVisible(node.parent.parent); - case 259 /* VariableDeclaration */: + case 260 /* VariableDeclaration */: if (isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 266 /* ModuleDeclaration */: - case 262 /* ClassDeclaration */: - case 263 /* InterfaceDeclaration */: - case 264 /* TypeAliasDeclaration */: - case 261 /* FunctionDeclaration */: - case 265 /* EnumDeclaration */: - case 270 /* ImportEqualsDeclaration */: + case 267 /* ModuleDeclaration */: + case 263 /* ClassDeclaration */: + case 264 /* InterfaceDeclaration */: + case 265 /* TypeAliasDeclaration */: + case 262 /* FunctionDeclaration */: + case 266 /* EnumDeclaration */: + case 271 /* ImportEqualsDeclaration */: if (isExternalModuleAugmentation(node)) { return true; } const parent2 = getDeclarationContainer(node); - if (!(getCombinedModifierFlags(node) & 1 /* Export */) && !(node.kind !== 270 /* ImportEqualsDeclaration */ && parent2.kind !== 311 /* SourceFile */ && parent2.flags & 16777216 /* Ambient */)) { + if (!(getCombinedModifierFlagsCached(node) & 1 /* Export */) && !(node.kind !== 271 /* ImportEqualsDeclaration */ && parent2.kind !== 312 /* SourceFile */ && parent2.flags & 33554432 /* Ambient */)) { return isGlobalSourceFile(parent2); } return isDeclarationVisible(parent2); - case 171 /* PropertyDeclaration */: - case 170 /* PropertySignature */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: + case 172 /* PropertyDeclaration */: + case 171 /* PropertySignature */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: if (hasEffectiveModifier(node, 8 /* Private */ | 16 /* Protected */)) { return false; } - case 175 /* Constructor */: - case 179 /* ConstructSignature */: - case 178 /* CallSignature */: - case 180 /* IndexSignature */: - case 168 /* Parameter */: - case 267 /* ModuleBlock */: - case 183 /* FunctionType */: - case 184 /* ConstructorType */: - case 186 /* TypeLiteral */: - case 182 /* TypeReference */: - case 187 /* ArrayType */: - case 188 /* TupleType */: - case 191 /* UnionType */: - case 192 /* IntersectionType */: - case 195 /* ParenthesizedType */: - case 201 /* NamedTupleMember */: + case 176 /* Constructor */: + case 180 /* ConstructSignature */: + case 179 /* CallSignature */: + case 181 /* IndexSignature */: + case 169 /* Parameter */: + case 268 /* ModuleBlock */: + case 184 /* FunctionType */: + case 185 /* ConstructorType */: + case 187 /* TypeLiteral */: + case 183 /* TypeReference */: + case 188 /* ArrayType */: + case 189 /* TupleType */: + case 192 /* UnionType */: + case 193 /* IntersectionType */: + case 196 /* ParenthesizedType */: + case 202 /* NamedTupleMember */: return isDeclarationVisible(node.parent); - case 272 /* ImportClause */: - case 273 /* NamespaceImport */: - case 275 /* ImportSpecifier */: + case 273 /* ImportClause */: + case 274 /* NamespaceImport */: + case 276 /* ImportSpecifier */: return false; - case 167 /* TypeParameter */: - case 311 /* SourceFile */: - case 269 /* NamespaceExportDeclaration */: + case 168 /* TypeParameter */: + case 312 /* SourceFile */: + case 270 /* NamespaceExportDeclaration */: return true; - case 276 /* ExportAssignment */: + case 277 /* ExportAssignment */: return false; default: return false; @@ -53063,7 +53502,7 @@ ${lanes.join("\n")} } function collectLinkedAliases(node, setVisibility) { let exportSymbol; - if (node.parent && node.parent.kind === 276 /* ExportAssignment */) { + if (node.parent && node.parent.kind === 277 /* ExportAssignment */) { exportSymbol = resolveName( node, node.escapedText, @@ -53074,7 +53513,7 @@ ${lanes.join("\n")} /*isUse*/ false ); - } else if (node.parent.kind === 280 /* ExportSpecifier */) { + } else if (node.parent.kind === 281 /* ExportSpecifier */) { exportSymbol = getTargetOfExportSpecifier(node.parent, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */); } let result; @@ -53178,12 +53617,12 @@ ${lanes.join("\n")} function getDeclarationContainer(node) { return findAncestor(getRootDeclaration(node), (node2) => { switch (node2.kind) { - case 259 /* VariableDeclaration */: - case 260 /* VariableDeclarationList */: - case 275 /* ImportSpecifier */: - case 274 /* NamedImports */: - case 273 /* NamespaceImport */: - case 272 /* ImportClause */: + case 260 /* VariableDeclaration */: + case 261 /* VariableDeclarationList */: + case 276 /* ImportSpecifier */: + case 275 /* NamedImports */: + case 274 /* NamespaceImport */: + case 273 /* ImportClause */: return false; default: return true; @@ -53202,6 +53641,17 @@ ${lanes.join("\n")} var _a; return getTypeOfPropertyOfType(type, name) || ((_a = getApplicableIndexInfoForName(type, name)) == null ? void 0 : _a.type) || unknownType; } + function getTypeOfPropertyOrIndexSignatureOfType(type, name) { + var _a; + let propType; + return getTypeOfPropertyOfType(type, name) || (propType = (_a = getApplicableIndexInfoForName(type, name)) == null ? void 0 : _a.type) && addOptionality( + propType, + /*isProperty*/ + true, + /*isOptional*/ + true + ); + } function isTypeAny(type) { return type && (type.flags & 1 /* Any */) !== 0; } @@ -53301,23 +53751,23 @@ ${lanes.join("\n")} function getParentElementAccess(node) { const ancestor = node.parent.parent; switch (ancestor.kind) { - case 207 /* BindingElement */: - case 302 /* PropertyAssignment */: + case 208 /* BindingElement */: + case 303 /* PropertyAssignment */: return getSyntheticElementAccess(ancestor); - case 208 /* ArrayLiteralExpression */: + case 209 /* ArrayLiteralExpression */: return getSyntheticElementAccess(node.parent); - case 259 /* VariableDeclaration */: + case 260 /* VariableDeclaration */: return ancestor.initializer; - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: return ancestor.right; } } function getDestructuringPropertyName(node) { const parent2 = node.parent; - if (node.kind === 207 /* BindingElement */ && parent2.kind === 205 /* ObjectBindingPattern */) { + if (node.kind === 208 /* BindingElement */ && parent2.kind === 206 /* ObjectBindingPattern */) { return getLiteralPropertyNameText(node.propertyName || node.name); } - if (node.kind === 302 /* PropertyAssignment */ || node.kind === 303 /* ShorthandPropertyAssignment */) { + if (node.kind === 303 /* PropertyAssignment */ || node.kind === 304 /* ShorthandPropertyAssignment */) { return getLiteralPropertyNameText(node.name); } return "" + parent2.elements.indexOf(node); @@ -53336,17 +53786,17 @@ ${lanes.join("\n")} return parentType; } const pattern = declaration.parent; - if (strictNullChecks && declaration.flags & 16777216 /* Ambient */ && isParameterDeclaration(declaration)) { + if (strictNullChecks && declaration.flags & 33554432 /* Ambient */ && isParameterDeclaration(declaration)) { parentType = getNonNullableType(parentType); } else if (strictNullChecks && pattern.parent.initializer && !(getTypeFacts(getTypeOfInitializer(pattern.parent.initializer)) & 65536 /* EQUndefined */)) { parentType = getTypeWithFacts(parentType, 524288 /* NEUndefined */); } let type; - if (pattern.kind === 205 /* ObjectBindingPattern */) { + if (pattern.kind === 206 /* ObjectBindingPattern */) { if (declaration.dotDotDotToken) { parentType = getReducedType(parentType); if (parentType.flags & 2 /* Unknown */ || !isValidSpreadType(parentType)) { - error(declaration, Diagnostics.Rest_types_may_only_be_created_from_object_types); + error2(declaration, Diagnostics.Rest_types_may_only_be_created_from_object_types); return errorType; } const literalMembers = []; @@ -53406,13 +53856,13 @@ ${lanes.join("\n")} /*excludeJSDocTypeAssertions*/ true ); - return expr.kind === 208 /* ArrayLiteralExpression */ && expr.elements.length === 0; + return expr.kind === 209 /* ArrayLiteralExpression */ && expr.elements.length === 0; } function addOptionality(type, isProperty = false, isOptional = true) { return strictNullChecks && isOptional ? getOptionalType(type, isProperty) : type; } function getTypeForVariableLikeDeclaration(declaration, includeOptionality, checkMode) { - if (isVariableDeclaration(declaration) && declaration.parent.parent.kind === 248 /* ForInStatement */) { + if (isVariableDeclaration(declaration) && declaration.parent.parent.kind === 249 /* ForInStatement */) { const indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression( declaration.parent.parent.expression, /*checkMode*/ @@ -53420,7 +53870,7 @@ ${lanes.join("\n")} ))); return indexType.flags & (262144 /* TypeParameter */ | 4194304 /* Index */) ? getExtractStringType(indexType) : stringType; } - if (isVariableDeclaration(declaration) && declaration.parent.parent.kind === 249 /* ForOfStatement */) { + if (isVariableDeclaration(declaration) && declaration.parent.parent.kind === 250 /* ForOfStatement */) { const forOfStatement = declaration.parent.parent; return checkRightHandSideOfForOf(forOfStatement) || anyType; } @@ -53439,8 +53889,8 @@ ${lanes.join("\n")} if (declaredType) { return addOptionality(declaredType, isProperty, isOptional); } - if ((noImplicitAny || isInJSFile(declaration)) && isVariableDeclaration(declaration) && !isBindingPattern(declaration.name) && !(getCombinedModifierFlags(declaration) & 1 /* Export */) && !(declaration.flags & 16777216 /* Ambient */)) { - if (!(getCombinedNodeFlags(declaration) & 2 /* Const */) && (!declaration.initializer || isNullOrUndefined3(declaration.initializer))) { + if ((noImplicitAny || isInJSFile(declaration)) && isVariableDeclaration(declaration) && !isBindingPattern(declaration.name) && !(getCombinedModifierFlagsCached(declaration) & 1 /* Export */) && !(declaration.flags & 33554432 /* Ambient */)) { + if (!(getCombinedNodeFlagsCached(declaration) & 6 /* Constant */) && (!declaration.initializer || isNullOrUndefined3(declaration.initializer))) { return autoType; } if (declaration.initializer && isEmptyArrayLiteral2(declaration.initializer)) { @@ -53449,8 +53899,8 @@ ${lanes.join("\n")} } if (isParameter(declaration)) { const func = declaration.parent; - if (func.kind === 177 /* SetAccessor */ && hasBindableName(func)) { - const getter = getDeclarationOfKind(getSymbolOfDeclaration(declaration.parent), 176 /* GetAccessor */); + if (func.kind === 178 /* SetAccessor */ && hasBindableName(func)) { + const getter = getDeclarationOfKind(getSymbolOfDeclaration(declaration.parent), 177 /* GetAccessor */); if (getter) { const getterSignature = getSignatureFromDeclaration(getter); const thisParameter = getAccessorThisParameter(func); @@ -53524,7 +53974,7 @@ ${lanes.join("\n")} const links = getSymbolLinks(symbol); if (links.isConstructorDeclaredProperty === void 0) { links.isConstructorDeclaredProperty = false; - links.isConstructorDeclaredProperty = !!getDeclaringConstructor(symbol) && every(symbol.declarations, (declaration) => isBinaryExpression(declaration) && isPossiblyAliasedThisProperty(declaration) && (declaration.left.kind !== 211 /* ElementAccessExpression */ || isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && !getAnnotatedTypeForAssignmentDeclaration( + links.isConstructorDeclaredProperty = !!getDeclaringConstructor(symbol) && every(symbol.declarations, (declaration) => isBinaryExpression(declaration) && isPossiblyAliasedThisProperty(declaration) && (declaration.left.kind !== 212 /* ElementAccessExpression */ || isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && !getAnnotatedTypeForAssignmentDeclaration( /*declaredType*/ void 0, declaration, @@ -53552,7 +54002,7 @@ ${lanes.join("\n")} /*includeClassComputedPropertyName*/ false ); - if (container && (container.kind === 175 /* Constructor */ || isJSConstructor(container))) { + if (container && (container.kind === 176 /* Constructor */ || isJSConstructor(container))) { return container; } } @@ -53579,7 +54029,7 @@ ${lanes.join("\n")} reference.flowNode = staticBlock.returnFlowNode; const flowType = getFlowTypeOfProperty(reference, symbol); if (noImplicitAny && (flowType === autoType || flowType === autoArrayType)) { - error(symbol.valueDeclaration, Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType)); + error2(symbol.valueDeclaration, Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType)); } if (everyType(flowType, isNullableType)) { continue; @@ -53595,7 +54045,7 @@ ${lanes.join("\n")} reference.flowNode = constructor.returnFlowNode; const flowType = getFlowTypeOfProperty(reference, symbol); if (noImplicitAny && (flowType === autoType || flowType === autoArrayType)) { - error(symbol.valueDeclaration, Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType)); + error2(symbol.valueDeclaration, Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType)); } return everyType(flowType, isNullableType) ? void 0 : convertAutoToAny(flowType); } @@ -53667,7 +54117,7 @@ ${lanes.join("\n")} false, definedInMethod && !definedInConstructor )); - if (symbol.valueDeclaration && filterType(widened, (t) => !!(t.flags & ~98304 /* Nullable */)) === neverType) { + if (symbol.valueDeclaration && isInJSFile(symbol.valueDeclaration) && filterType(widened, (t) => !!(t.flags & ~98304 /* Nullable */)) === neverType) { reportImplicitAny(symbol.valueDeclaration, anyType); return anyType; } @@ -53770,11 +54220,11 @@ ${lanes.join("\n")} const unescapedName = unescapeLeadingUnderscores(s.escapedName); const exportedMemberName = ((_a = tryCast(exportedMember.valueDeclaration, isNamedDeclaration)) == null ? void 0 : _a.name) || exportedMember.valueDeclaration; addRelatedInfo( - error(s.valueDeclaration, Diagnostics.Duplicate_identifier_0, unescapedName), + error2(s.valueDeclaration, Diagnostics.Duplicate_identifier_0, unescapedName), createDiagnosticForNode(exportedMemberName, Diagnostics._0_was_also_declared_here, unescapedName) ); addRelatedInfo( - error(exportedMemberName, Diagnostics.Duplicate_identifier_0, unescapedName), + error2(exportedMemberName, Diagnostics.Duplicate_identifier_0, unescapedName), createDiagnosticForNode(s.valueDeclaration, Diagnostics._0_was_also_declared_here, unescapedName) ); } @@ -53832,7 +54282,7 @@ ${lanes.join("\n")} /*includeClassComputedPropertyName*/ false ); - return thisContainer.kind === 175 /* Constructor */ || thisContainer.kind === 261 /* FunctionDeclaration */ || thisContainer.kind === 217 /* FunctionExpression */ && !isPrototypePropertyAssignment(thisContainer.parent); + return thisContainer.kind === 176 /* Constructor */ || thisContainer.kind === 262 /* FunctionDeclaration */ || thisContainer.kind === 218 /* FunctionExpression */ && !isPrototypePropertyAssignment(thisContainer.parent); } function getConstructorDefinedThisAssignmentTypes(types, declarations) { Debug.assert(types.length === declarations.length); @@ -53906,7 +54356,7 @@ ${lanes.join("\n")} function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors2) { const elements = pattern.elements; const lastElement = lastOrUndefined(elements); - const restElement = lastElement && lastElement.kind === 207 /* BindingElement */ && lastElement.dotDotDotToken ? lastElement : void 0; + const restElement = lastElement && lastElement.kind === 208 /* BindingElement */ && lastElement.dotDotDotToken ? lastElement : void 0; if (elements.length === 0 || elements.length === 1 && restElement) { return languageVersion >= 2 /* ES2015 */ ? createIterableType(anyType) : anyArrayType; } @@ -53922,7 +54372,7 @@ ${lanes.join("\n")} return result; } function getTypeFromBindingPattern(pattern, includePatternInType = false, reportErrors2 = false) { - return pattern.kind === 205 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors2) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors2); + return pattern.kind === 206 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors2) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors2); } function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors2) { return widenTypeForVariableLikeDeclaration(getTypeForVariableLikeDeclaration( @@ -53963,7 +54413,7 @@ ${lanes.join("\n")} } function declarationBelongsToPrivateAmbientMember(declaration) { const root = getRootDeclaration(declaration); - const memberDeclaration = root.kind === 168 /* Parameter */ ? root.parent : root; + const memberDeclaration = root.kind === 169 /* Parameter */ ? root.parent : root; return isPrivateWithinAmbient(memberDeclaration); } function tryGetTypeFromEffectiveTypeNode(node) { @@ -54037,7 +54487,7 @@ ${lanes.join("\n")} return reportCircularityError(symbol); } let type; - if (declaration.kind === 276 /* ExportAssignment */) { + if (declaration.kind === 277 /* ExportAssignment */) { type = widenTypeForVariableLikeDeclaration(tryGetTypeFromEffectiveTypeNode(declaration) || checkExpressionCached(declaration.expression), declaration); } else if (isBinaryExpression(declaration) || isInJSFile(declaration) && (isCallExpression(declaration) || (isPropertyAccessExpression(declaration) || isBindableStaticElementAccessExpression(declaration)) && isBinaryExpression(declaration.parent))) { type = getWidenedTypeForAssignmentDeclaration(symbol); @@ -54078,13 +54528,13 @@ ${lanes.join("\n")} function getAnnotatedAccessorTypeNode(accessor) { if (accessor) { switch (accessor.kind) { - case 176 /* GetAccessor */: + case 177 /* GetAccessor */: const getterTypeAnnotation = getEffectiveReturnTypeNode(accessor); return getterTypeAnnotation; - case 177 /* SetAccessor */: + case 178 /* SetAccessor */: const setterTypeAnnotation = getEffectiveSetAccessorTypeAnnotationNode(accessor); return setterTypeAnnotation; - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: Debug.assert(hasAccessorModifier(accessor)); const accessorTypeAnnotation = getEffectiveTypeAnnotationNode(accessor); return accessorTypeAnnotation; @@ -54109,9 +54559,9 @@ ${lanes.join("\n")} if (!pushTypeResolution(symbol, 0 /* Type */)) { return errorType; } - const getter = getDeclarationOfKind(symbol, 176 /* GetAccessor */); - const setter = getDeclarationOfKind(symbol, 177 /* SetAccessor */); - const accessor = tryCast(getDeclarationOfKind(symbol, 171 /* PropertyDeclaration */), isAutoAccessorPropertyDeclaration); + const getter = getDeclarationOfKind(symbol, 177 /* GetAccessor */); + const setter = getDeclarationOfKind(symbol, 178 /* SetAccessor */); + const accessor = tryCast(getDeclarationOfKind(symbol, 172 /* PropertyDeclaration */), isAutoAccessorPropertyDeclaration); let type = getter && isInJSFile(getter) && getTypeForDeclarationFromJSDocComment(getter) || getAnnotatedAccessorType(getter) || getAnnotatedAccessorType(setter) || getAnnotatedAccessorType(accessor) || getter && getter.body && getReturnTypeFromBody(getter) || accessor && accessor.initializer && getWidenedTypeForVariableLikeDeclaration( accessor, /*reportErrors*/ @@ -54129,13 +54579,13 @@ ${lanes.join("\n")} } if (!popTypeResolution()) { if (getAnnotatedAccessorTypeNode(getter)) { - error(getter, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + error2(getter, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); } else if (getAnnotatedAccessorTypeNode(setter)) { - error(setter, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + error2(setter, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); } else if (getAnnotatedAccessorTypeNode(accessor)) { - error(setter, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + error2(setter, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); } else if (getter && noImplicitAny) { - error(getter, 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)); + error2(getter, 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)); } type = anyType; } @@ -54149,11 +54599,11 @@ ${lanes.join("\n")} if (!pushTypeResolution(symbol, 8 /* WriteType */)) { return errorType; } - const setter = getDeclarationOfKind(symbol, 177 /* SetAccessor */) ?? tryCast(getDeclarationOfKind(symbol, 171 /* PropertyDeclaration */), isAutoAccessorPropertyDeclaration); + const setter = getDeclarationOfKind(symbol, 178 /* SetAccessor */) ?? tryCast(getDeclarationOfKind(symbol, 172 /* PropertyDeclaration */), isAutoAccessorPropertyDeclaration); let writeType = getAnnotatedAccessorType(setter); if (!popTypeResolution()) { if (getAnnotatedAccessorTypeNode(setter)) { - error(setter, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + error2(setter, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); } writeType = anyType; } @@ -54189,7 +54639,7 @@ ${lanes.join("\n")} const declaration = symbol.valueDeclaration; if (symbol.flags & 1536 /* Module */ && isShorthandAmbientModuleSymbol(symbol)) { return anyType; - } else if (declaration && (declaration.kind === 225 /* BinaryExpression */ || isAccessExpression(declaration) && declaration.parent.kind === 225 /* BinaryExpression */)) { + } else if (declaration && (declaration.kind === 226 /* BinaryExpression */ || isAccessExpression(declaration) && declaration.parent.kind === 226 /* BinaryExpression */)) { return getWidenedTypeForAssignmentDeclaration(symbol); } else if (symbol.flags & 512 /* ValueModule */ && declaration && isSourceFile(declaration) && declaration.commonJsModuleIndicator) { const resolvedModule = resolveExternalModuleSymbol(symbol); @@ -54231,7 +54681,7 @@ ${lanes.join("\n")} true ); const declaredType = firstDefined(exportSymbol == null ? void 0 : exportSymbol.declarations, (d) => isExportAssignment(d) ? tryGetTypeFromEffectiveTypeNode(d) : void 0); - links.type = (exportSymbol == null ? void 0 : exportSymbol.declarations) && isDuplicatedCommonJSExport(exportSymbol.declarations) && symbol.declarations.length ? getFlowTypeFromCommonJSExport(exportSymbol) : isDuplicatedCommonJSExport(symbol.declarations) ? autoType : declaredType ? declaredType : getAllSymbolFlags(targetSymbol) & 111551 /* Value */ ? getTypeOfSymbol(targetSymbol) : errorType; + links.type = (exportSymbol == null ? void 0 : exportSymbol.declarations) && isDuplicatedCommonJSExport(exportSymbol.declarations) && symbol.declarations.length ? getFlowTypeFromCommonJSExport(exportSymbol) : isDuplicatedCommonJSExport(symbol.declarations) ? autoType : declaredType ? declaredType : getSymbolFlags(targetSymbol) & 111551 /* Value */ ? getTypeOfSymbol(targetSymbol) : errorType; } return links.type; } @@ -54246,15 +54696,15 @@ ${lanes.join("\n")} function reportCircularityError(symbol) { const declaration = symbol.valueDeclaration; if (getEffectiveTypeAnnotationNode(declaration)) { - error( + error2( symbol.valueDeclaration, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol) ); return errorType; } - if (noImplicitAny && (declaration.kind !== 168 /* Parameter */ || declaration.initializer)) { - error( + if (noImplicitAny && (declaration.kind !== 169 /* Parameter */ || declaration.initializer)) { + error2( symbol.valueDeclaration, 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) @@ -54367,43 +54817,43 @@ ${lanes.join("\n")} return void 0; } switch (node.kind) { - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: - case 263 /* InterfaceDeclaration */: - case 178 /* CallSignature */: - case 179 /* ConstructSignature */: - case 172 /* MethodSignature */: - case 183 /* FunctionType */: - case 184 /* ConstructorType */: - case 323 /* JSDocFunctionType */: - case 261 /* FunctionDeclaration */: - case 173 /* MethodDeclaration */: - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: - case 264 /* TypeAliasDeclaration */: - case 351 /* JSDocTemplateTag */: - case 352 /* JSDocTypedefTag */: - case 346 /* JSDocEnumTag */: - case 344 /* JSDocCallbackTag */: - case 199 /* MappedType */: - case 193 /* ConditionalType */: { + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: + case 264 /* InterfaceDeclaration */: + case 179 /* CallSignature */: + case 180 /* ConstructSignature */: + case 173 /* MethodSignature */: + case 184 /* FunctionType */: + case 185 /* ConstructorType */: + case 324 /* JSDocFunctionType */: + case 262 /* FunctionDeclaration */: + case 174 /* MethodDeclaration */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: + case 265 /* TypeAliasDeclaration */: + case 352 /* JSDocTemplateTag */: + case 353 /* JSDocTypedefTag */: + case 347 /* JSDocEnumTag */: + case 345 /* JSDocCallbackTag */: + case 200 /* MappedType */: + case 194 /* ConditionalType */: { const outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); - if (node.kind === 199 /* MappedType */) { + if (node.kind === 200 /* MappedType */) { return append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(node.typeParameter))); - } else if (node.kind === 193 /* ConditionalType */) { + } else if (node.kind === 194 /* ConditionalType */) { return concatenate(outerTypeParameters, getInferTypeParameters(node)); } const outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, getEffectiveTypeParameterDeclarations(node)); - const thisType = includeThisTypes && (node.kind === 262 /* ClassDeclaration */ || node.kind === 230 /* ClassExpression */ || node.kind === 263 /* InterfaceDeclaration */ || isJSConstructor(node)) && getDeclaredTypeOfClassOrInterface(getSymbolOfDeclaration(node)).thisType; + const thisType = includeThisTypes && (node.kind === 263 /* ClassDeclaration */ || node.kind === 231 /* ClassExpression */ || node.kind === 264 /* InterfaceDeclaration */ || isJSConstructor(node)) && getDeclaredTypeOfClassOrInterface(getSymbolOfDeclaration(node)).thisType; return thisType ? append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters; } - case 347 /* JSDocParameterTag */: + case 348 /* JSDocParameterTag */: const paramSymbol = getParameterSymbolFromJSDoc(node); if (paramSymbol) { node = paramSymbol.valueDeclaration; } break; - case 326 /* JSDoc */: { + case 327 /* JSDoc */: { const outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); return node.tags ? appendTypeParameters(outerTypeParameters, flatMap(node.tags, (t) => isJSDocTemplateTag(t) ? t.typeParameters : void 0)) : outerTypeParameters; } @@ -54413,14 +54863,14 @@ ${lanes.join("\n")} function getOuterTypeParametersOfClassOrInterface(symbol) { var _a; const declaration = symbol.flags & 32 /* Class */ || symbol.flags & 16 /* Function */ ? symbol.valueDeclaration : (_a = symbol.declarations) == null ? void 0 : _a.find((decl) => { - if (decl.kind === 263 /* InterfaceDeclaration */) { + if (decl.kind === 264 /* InterfaceDeclaration */) { return true; } - if (decl.kind !== 259 /* VariableDeclaration */) { + if (decl.kind !== 260 /* VariableDeclaration */) { return false; } const initializer = decl.initializer; - return !!initializer && (initializer.kind === 217 /* FunctionExpression */ || initializer.kind === 218 /* ArrowFunction */); + return !!initializer && (initializer.kind === 218 /* FunctionExpression */ || initializer.kind === 219 /* ArrowFunction */); }); Debug.assert(!!declaration, "Class was missing valueDeclaration -OR- non-class had no interface declarations"); return getOuterTypeParameters(declaration); @@ -54431,7 +54881,7 @@ ${lanes.join("\n")} } let result; for (const node of symbol.declarations) { - if (node.kind === 263 /* InterfaceDeclaration */ || node.kind === 262 /* ClassDeclaration */ || node.kind === 230 /* ClassExpression */ || isJSConstructor(node) || isTypeAlias(node)) { + if (node.kind === 264 /* InterfaceDeclaration */ || node.kind === 263 /* ClassDeclaration */ || node.kind === 231 /* ClassExpression */ || isJSConstructor(node) || isTypeAlias(node)) { const declaration = node; result = appendTypeParameters(result, getEffectiveTypeParameterDeclarations(declaration)); } @@ -54499,11 +54949,11 @@ ${lanes.join("\n")} resolveStructuredTypeMembers(baseConstructorType); } if (!popTypeResolution()) { - error(type.symbol.valueDeclaration, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_base_expression, symbolToString(type.symbol)); + error2(type.symbol.valueDeclaration, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_base_expression, symbolToString(type.symbol)); return type.resolvedBaseConstructorType = errorType; } if (!(baseConstructorType.flags & 1 /* Any */) && baseConstructorType !== nullWideningType && !isConstructorType(baseConstructorType)) { - const err = error(baseTypeNode.expression, Diagnostics.Type_0_is_not_a_constructor_function_type, typeToString(baseConstructorType)); + const err = error2(baseTypeNode.expression, Diagnostics.Type_0_is_not_a_constructor_function_type, typeToString(baseConstructorType)); if (baseConstructorType.flags & 262144 /* TypeParameter */) { const constraint = getConstraintFromTypeParameter(baseConstructorType); let ctorReturn = unknownType; @@ -54545,7 +54995,7 @@ ${lanes.join("\n")} return resolvedImplementsTypes; } function reportCircularBaseType(node, type) { - error(node, Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString( + error2(node, Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString( type, /*enclosingDeclaration*/ void 0, @@ -54569,7 +55019,7 @@ ${lanes.join("\n")} } if (!popTypeResolution() && type.symbol.declarations) { for (const declaration of type.symbol.declarations) { - if (declaration.kind === 262 /* ClassDeclaration */ || declaration.kind === 263 /* InterfaceDeclaration */) { + if (declaration.kind === 263 /* ClassDeclaration */ || declaration.kind === 264 /* InterfaceDeclaration */) { reportCircularBaseType(declaration, type); } } @@ -54599,7 +55049,7 @@ ${lanes.join("\n")} } else { const constructors = getInstantiatedConstructorsForTypeArguments(baseConstructorType, baseTypeNode.typeArguments, baseTypeNode); if (!constructors.length) { - error(baseTypeNode.expression, Diagnostics.No_base_constructor_has_the_specified_number_of_type_arguments); + error2(baseTypeNode.expression, Diagnostics.No_base_constructor_has_the_specified_number_of_type_arguments); return type.resolvedBaseTypes = emptyArray; } baseType = getReturnTypeOfSignature(constructors[0]); @@ -54619,7 +55069,7 @@ ${lanes.join("\n")} return type.resolvedBaseTypes = emptyArray; } if (type === reducedBaseType || hasBaseType(reducedBaseType, type)) { - error( + error2( type.symbol.valueDeclaration, Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString( @@ -54658,7 +55108,7 @@ ${lanes.join("\n")} type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; if (type.symbol.declarations) { for (const declaration of type.symbol.declarations) { - if (declaration.kind === 263 /* InterfaceDeclaration */ && getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 264 /* InterfaceDeclaration */ && getInterfaceBaseTypeNodes(declaration)) { for (const node of getInterfaceBaseTypeNodes(declaration)) { const baseType = getReducedType(getTypeFromTypeNode(node)); if (!isErrorType(baseType)) { @@ -54673,7 +55123,7 @@ ${lanes.join("\n")} reportCircularBaseType(declaration, type); } } else { - error(node, Diagnostics.An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_members); + error2(node, Diagnostics.An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_members); } } } @@ -54686,8 +55136,8 @@ ${lanes.join("\n")} return true; } for (const declaration of symbol.declarations) { - if (declaration.kind === 263 /* InterfaceDeclaration */) { - if (declaration.flags & 128 /* ContainsThis */) { + if (declaration.kind === 264 /* InterfaceDeclaration */) { + if (declaration.flags & 256 /* ContainsThis */) { return false; } const baseTypeNodes = getInterfaceBaseTypeNodes(declaration); @@ -54758,10 +55208,10 @@ ${lanes.join("\n")} } } else { type = errorType; - if (declaration.kind === 346 /* JSDocEnumTag */) { - error(declaration.typeExpression.type, Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); + if (declaration.kind === 347 /* JSDocEnumTag */) { + error2(declaration.typeExpression.type, Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } else { - error(isNamedDeclaration(declaration) ? declaration.name || declaration : declaration, Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); + error2(isNamedDeclaration(declaration) ? declaration.name || declaration : declaration, Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } } links.declaredType = type; @@ -54777,7 +55227,7 @@ ${lanes.join("\n")} const memberTypeList = []; if (symbol.declarations) { for (const declaration of symbol.declarations) { - if (declaration.kind === 265 /* EnumDeclaration */) { + if (declaration.kind === 266 /* EnumDeclaration */) { for (const member of declaration.members) { if (hasBindableName(member)) { const memberSymbol = getSymbolOfDeclaration(member); @@ -54862,18 +55312,18 @@ ${lanes.join("\n")} case 159 /* UnknownKeyword */: case 154 /* StringKeyword */: case 150 /* NumberKeyword */: - case 162 /* BigIntKeyword */: + case 163 /* BigIntKeyword */: case 136 /* BooleanKeyword */: case 155 /* SymbolKeyword */: case 151 /* ObjectKeyword */: case 116 /* VoidKeyword */: case 157 /* UndefinedKeyword */: case 146 /* NeverKeyword */: - case 200 /* LiteralType */: + case 201 /* LiteralType */: return true; - case 187 /* ArrayType */: + case 188 /* ArrayType */: return isThislessType(node.elementType); - case 182 /* TypeReference */: + case 183 /* TypeReference */: return !node.typeArguments || node.typeArguments.every(isThislessType); } return false; @@ -54889,21 +55339,21 @@ ${lanes.join("\n")} function isThislessFunctionLikeDeclaration(node) { const returnType = getEffectiveReturnTypeNode(node); const typeParameters = getEffectiveTypeParameterDeclarations(node); - return (node.kind === 175 /* Constructor */ || !!returnType && isThislessType(returnType)) && node.parameters.every(isThislessVariableLikeDeclaration) && typeParameters.every(isThislessTypeParameter); + return (node.kind === 176 /* Constructor */ || !!returnType && isThislessType(returnType)) && node.parameters.every(isThislessVariableLikeDeclaration) && typeParameters.every(isThislessTypeParameter); } function isThisless(symbol) { if (symbol.declarations && symbol.declarations.length === 1) { const declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { - case 171 /* PropertyDeclaration */: - case 170 /* PropertySignature */: + case 172 /* PropertyDeclaration */: + case 171 /* PropertySignature */: return isThislessVariableLikeDeclaration(declaration); - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: - case 175 /* Constructor */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: + case 176 /* Constructor */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: return isThislessFunctionLikeDeclaration(declaration); } } @@ -54946,9 +55396,6 @@ ${lanes.join("\n")} } return type; } - function isTypeUsableAsPropertyName(type) { - return !!(type.flags & 8576 /* StringOrNumberLiteralOrUnique */); - } function isLateBindableName(node) { if (!isComputedPropertyName(node) && !isElementAccessExpression(node)) { return false; @@ -54969,15 +55416,6 @@ ${lanes.join("\n")} function isNonBindableDynamicName(node) { return isDynamicName(node) && !isLateBindableName(node); } - function getPropertyNameFromType(type) { - if (type.flags & 8192 /* UniqueESSymbol */) { - return type.escapedName; - } - if (type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) { - return escapeLeadingUnderscores("" + type.value); - } - return Debug.fail(); - } function addDeclarationToLateBoundSymbol(symbol, member, symbolFlags) { Debug.assert(!!(getCheckFlags(symbol) & 4096 /* Late */), "Expected a late-bound symbol."); symbol.flags |= symbolFlags; @@ -55010,8 +55448,8 @@ ${lanes.join("\n")} if (lateSymbol.flags & getExcludedSymbolFlags(symbolFlags) || earlySymbol) { const declarations = earlySymbol ? concatenate(earlySymbol.declarations, lateSymbol.declarations) : lateSymbol.declarations; const name = !(type.flags & 8192 /* UniqueESSymbol */) && unescapeLeadingUnderscores(memberName) || declarationNameToString(declName); - forEach(declarations, (declaration) => error(getNameOfDeclaration(declaration) || declaration, Diagnostics.Property_0_was_also_declared_here, name)); - error(declName || decl, Diagnostics.Duplicate_property_0, name); + forEach(declarations, (declaration) => error2(getNameOfDeclaration(declaration) || declaration, Diagnostics.Property_0_was_also_declared_here, name)); + error2(declName || decl, Diagnostics.Duplicate_property_0, name); lateSymbol = createSymbol(0 /* None */, memberName, 4096 /* Late */); } lateSymbol.links.nameType = type; @@ -55027,6 +55465,7 @@ ${lanes.join("\n")} return links.resolvedSymbol; } function getResolvedMembersOrExportsOfSymbol(symbol, resolutionKind) { + var _a, _b, _c; const links = getSymbolLinks(symbol); if (!links[resolutionKind]) { const isStatic2 = resolutionKind === "resolvedExports" /* resolvedExports */; @@ -55045,7 +55484,7 @@ ${lanes.join("\n")} } } } - const assignments = symbol.assignmentDeclarationMembers; + const assignments = (((_a = symbol.valueDeclaration) == null ? void 0 : _a.kind) === 219 /* ArrowFunction */ || ((_b = symbol.valueDeclaration) == null ? void 0 : _b.kind) === 218 /* FunctionExpression */) && ((_c = getSymbolOfNode(symbol.valueDeclaration.parent)) == null ? void 0 : _c.assignmentDeclarationMembers) || symbol.assignmentDeclarationMembers; if (assignments) { const decls = arrayFrom(assignments.values()); for (const member of decls) { @@ -55084,19 +55523,13 @@ ${lanes.join("\n")} if (getObjectFlags(type) & 4 /* Reference */) { const target = type.target; const typeArguments = getTypeArguments(type); - if (length(target.typeParameters) === length(typeArguments)) { - const ref = createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType])); - return needApparentType ? getApparentType(ref) : ref; - } + return length(target.typeParameters) === length(typeArguments) ? createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType])) : type; } else if (type.flags & 2097152 /* Intersection */) { const types = sameMap(type.types, (t) => getTypeWithThisArgument(t, thisArgument, needApparentType)); return types !== type.types ? getIntersectionType(types) : type; } return needApparentType ? getApparentType(type) : type; } - function getThisArgument(type) { - return getObjectFlags(type) & 4 /* Reference */ && length(getTypeArguments(type)) > getTypeReferenceArity(type) ? last(getTypeArguments(type)) : type; - } function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) { let mapper; let members; @@ -55180,7 +55613,7 @@ ${lanes.join("\n")} /*resolvedTypePredicate*/ void 0, sig.minArgumentCount, - sig.flags & 39 /* PropagatingFlags */ + sig.flags & 167 /* PropagatingFlags */ ); result.target = sig.target; result.mapper = sig.mapper; @@ -55218,17 +55651,18 @@ ${lanes.join("\n")} function getExpandedParameters(sig, skipUnionExpanding) { if (signatureHasRestParameter(sig)) { const restIndex = sig.parameters.length - 1; + const restName = sig.parameters[restIndex].escapedName; const restType = getTypeOfSymbol(sig.parameters[restIndex]); if (isTupleType(restType)) { - return [expandSignatureParametersWithTupleMembers(restType, restIndex)]; + return [expandSignatureParametersWithTupleMembers(restType, restIndex, restName)]; } else if (!skipUnionExpanding && restType.flags & 1048576 /* Union */ && every(restType.types, isTupleType)) { - return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex)); + return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex, restName)); } } return [sig.parameters]; - function expandSignatureParametersWithTupleMembers(restType, restIndex) { - const elementTypes = getElementTypes(restType); - const associatedNames = getUniqAssociatedNamesFromTupleType(restType); + function expandSignatureParametersWithTupleMembers(restType, restIndex, restName) { + const elementTypes = getTypeArguments(restType); + const associatedNames = getUniqAssociatedNamesFromTupleType(restType, restName); const restParams = map(elementTypes, (t, i) => { const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType); const flags = restType.target.elementFlags[i]; @@ -55239,10 +55673,10 @@ ${lanes.join("\n")} }); return concatenate(sig.parameters.slice(0, restIndex), restParams); } - function getUniqAssociatedNamesFromTupleType(type) { + function getUniqAssociatedNamesFromTupleType(type, restName) { const associatedNamesMap = /* @__PURE__ */ new Map(); - return map(type.target.labeledElementDeclarations, (labeledElement) => { - const name = getTupleElementLabel(labeledElement); + return map(type.target.labeledElementDeclarations, (labeledElement, i) => { + const name = getTupleElementLabel(labeledElement, i, restName); const prevCounter = associatedNamesMap.get(name); if (prevCounter === void 0) { associatedNamesMap.set(name, 1); @@ -55480,7 +55914,7 @@ ${lanes.join("\n")} /*resolvedTypePredicate*/ void 0, minArgCount, - (left.flags | right.flags) & 39 /* PropagatingFlags */ + (left.flags | right.flags) & 167 /* PropagatingFlags */ ); result.compositeKind = 1048576 /* Union */; result.compositeSignatures = concatenate(left.compositeKind !== 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]); @@ -55628,20 +56062,17 @@ ${lanes.join("\n")} setStructuredTypeMembers(type, members2, callSignatures, constructSignatures, indexInfos2); return; } - let members = emptySymbols; + let members = getExportsOfSymbol(symbol); let indexInfos; - if (symbol.exports) { - members = getExportsOfSymbol(symbol); - if (symbol === globalThisSymbol) { - const varsOnly = /* @__PURE__ */ new Map(); - members.forEach((p) => { - var _a; - if (!(p.flags & 418 /* BlockScoped */) && !(p.flags & 512 /* ValueModule */ && ((_a = p.declarations) == null ? void 0 : _a.length) && every(p.declarations, isAmbientModule))) { - varsOnly.set(p.escapedName, p); - } - }); - members = varsOnly; - } + if (symbol === globalThisSymbol) { + const varsOnly = /* @__PURE__ */ new Map(); + members.forEach((p) => { + var _a; + if (!(p.flags & 418 /* BlockScoped */) && !(p.flags & 512 /* ValueModule */ && ((_a = p.declarations) == null ? void 0 : _a.length) && every(p.declarations, isAmbientModule))) { + varsOnly.set(p.escapedName, p); + } + }); + members = varsOnly; } let baseConstructorIndexInfo; setStructuredTypeMembers(type, members, emptyArray, emptyArray, emptyArray); @@ -55690,7 +56121,7 @@ ${lanes.join("\n")} /*resolvedTypePredicate*/ void 0, sig.minArgumentCount, - sig.flags & 39 /* PropagatingFlags */ + sig.flags & 167 /* PropagatingFlags */ ) : void 0 )); } @@ -55857,7 +56288,7 @@ ${lanes.join("\n")} true ) : symbol.links.checkFlags & 524288 /* StripOptional */ ? removeMissingOrUndefinedType(propType) : propType; if (!popTypeResolution()) { - error(currentNode, Diagnostics.Type_of_property_0_circularly_references_itself_in_mapped_type_1, symbolToString(symbol), typeToString(mappedType)); + error2(currentNode, Diagnostics.Type_of_property_0_circularly_references_itself_in_mapped_type_1, symbolToString(symbol), typeToString(mappedType)); type = errorType; } symbol.links.type = type; @@ -55886,7 +56317,7 @@ ${lanes.join("\n")} } function isMappedTypeWithKeyofConstraintDeclaration(type) { const constraintDeclaration = getConstraintDeclarationForMappedType(type); - return constraintDeclaration.kind === 197 /* TypeOperator */ && constraintDeclaration.operator === 143 /* KeyOfKeyword */; + return constraintDeclaration.kind === 198 /* TypeOperator */ && constraintDeclaration.operator === 143 /* KeyOfKeyword */; } function getModifiersTypeFromMappedType(type) { if (!type.modifiersType) { @@ -56041,9 +56472,9 @@ ${lanes.join("\n")} function getConstraintOfTypeParameter(typeParameter) { return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : void 0; } - function isConstTypeVariable(type) { + function isConstTypeVariable(type, depth = 0) { var _a; - return !!(type && (type.flags & 262144 /* TypeParameter */ && some((_a = type.symbol) == null ? void 0 : _a.declarations, (d) => hasSyntacticModifier(d, 2048 /* Const */)) || type.flags & 1048576 /* Union */ && some(type.types, isConstTypeVariable) || type.flags & 8388608 /* IndexedAccess */ && isConstTypeVariable(type.objectType) || type.flags & 16777216 /* Conditional */ && isConstTypeVariable(getConstraintOfConditionalType(type)) || type.flags & 33554432 /* Substitution */ && isConstTypeVariable(type.baseType) || isGenericTupleType(type) && findIndex(getElementTypes(type), (t, i) => !!(type.target.elementFlags[i] & 8 /* Variadic */) && isConstTypeVariable(t)) >= 0)); + return depth < 5 && !!(type && (type.flags & 262144 /* TypeParameter */ && some((_a = type.symbol) == null ? void 0 : _a.declarations, (d) => hasSyntacticModifier(d, 2048 /* Const */)) || type.flags & 1048576 /* Union */ && some(type.types, (t) => isConstTypeVariable(t, depth)) || type.flags & 8388608 /* IndexedAccess */ && isConstTypeVariable(type.objectType, depth + 1) || type.flags & 16777216 /* Conditional */ && isConstTypeVariable(getConstraintOfConditionalType(type), depth + 1) || type.flags & 33554432 /* Substitution */ && isConstTypeVariable(type.baseType, depth) || isGenericTupleType(type) && findIndex(getElementTypes(type), (t, i) => !!(type.target.elementFlags[i] & 8 /* Variadic */) && isConstTypeVariable(t, depth)) >= 0)); } function getConstraintOfIndexedAccess(type) { return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : void 0; @@ -56162,7 +56593,7 @@ ${lanes.join("\n")} return type.resolvedBaseConstraint; } const stack = []; - return type.resolvedBaseConstraint = getTypeWithThisArgument(getImmediateBaseConstraint(type), getThisArgument(type)); + return type.resolvedBaseConstraint = getImmediateBaseConstraint(type); function getImmediateBaseConstraint(t) { if (!t.immediateBaseConstraint) { if (!pushTypeResolution(t, 4 /* ImmediateBaseConstraint */)) { @@ -56183,7 +56614,7 @@ ${lanes.join("\n")} if (t.flags & 262144 /* TypeParameter */) { const errorNode = getConstraintDeclaration(t); if (errorNode) { - const diagnostic = error(errorNode, Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(t)); + const diagnostic = error2(errorNode, Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(t)); if (currentNode && !isNodeDescendantOf(errorNode, currentNode) && !isNodeDescendantOf(currentNode, errorNode)) { addRelatedInfo(diagnostic, createDiagnosticForNode(currentNode, Diagnostics.Circularity_originates_in_type_at_this_location)); } @@ -56254,18 +56685,18 @@ ${lanes.join("\n")} } if (isGenericTupleType(t)) { const newElements = map(getElementTypes(t), (v, i) => { - const constraint = t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v; - return constraint && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v; + const constraint = v.flags & 262144 /* TypeParameter */ && t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v; + return constraint !== v && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v; }); return createTupleType(newElements, t.target.elementFlags, t.target.readonly, t.target.labeledElementDeclarations); } return t; } } - function getApparentTypeOfIntersectionType(type) { + function getApparentTypeOfIntersectionType(type, thisArgument) { return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument( type, - type, + thisArgument, /*needApparentType*/ true )); @@ -56316,8 +56747,9 @@ ${lanes.join("\n")} return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType); } function getApparentType(type) { - const t = !(type.flags & 465829888 /* Instantiable */) ? type : getBaseConstraintOfType(type) || unknownType; - return getObjectFlags(t) & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? keyofConstraintType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t; + const t = type.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type; + const objectFlags = getObjectFlags(t); + return objectFlags & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : objectFlags & 4 /* Reference */ && t !== type ? getTypeWithThisArgument(t, type) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t, type) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? keyofConstraintType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t; } function getReducedApparentType(type) { return getReducedType(getApparentType(getReducedType(type))); @@ -56599,7 +57031,35 @@ ${lanes.join("\n")} return emptyArray; } function getSignaturesOfType(type, kind) { - return getSignaturesOfStructuredType(getReducedApparentType(type), kind); + const result = getSignaturesOfStructuredType(getReducedApparentType(type), kind); + if (kind === 0 /* Call */ && !length(result) && type.flags & 1048576 /* Union */) { + if (type.arrayFallbackSignatures) { + return type.arrayFallbackSignatures; + } + let memberName; + if (everyType(type, (t) => { + var _a; + return !!((_a = t.symbol) == null ? void 0 : _a.parent) && isArrayOrTupleSymbol(t.symbol.parent) && (!memberName ? (memberName = t.symbol.escapedName, true) : memberName === t.symbol.escapedName); + })) { + const arrayArg = mapType(type, (t) => getMappedType((isReadonlyArraySymbol(t.symbol.parent) ? globalReadonlyArrayType : globalArrayType).typeParameters[0], t.mapper)); + const arrayType = createArrayType(arrayArg, someType(type, (t) => isReadonlyArraySymbol(t.symbol.parent))); + return type.arrayFallbackSignatures = getSignaturesOfType(getTypeOfPropertyOfType(arrayType, memberName), kind); + } + type.arrayFallbackSignatures = result; + } + return result; + } + function isArrayOrTupleSymbol(symbol) { + if (!symbol || !globalArrayType.symbol || !globalReadonlyArrayType.symbol) { + return false; + } + return !!getSymbolIfSameReference(symbol, globalArrayType.symbol) || !!getSymbolIfSameReference(symbol, globalReadonlyArrayType.symbol); + } + function isReadonlyArraySymbol(symbol) { + if (!symbol || !globalReadonlyArrayType.symbol) { + return false; + } + return !!getSymbolIfSameReference(symbol, globalReadonlyArrayType.symbol); } function findIndexInfo(indexInfos, keyType) { return find(indexInfos, (info) => info.keyType === keyType); @@ -56778,7 +57238,7 @@ ${lanes.join("\n")} } else { parameters.push(paramSymbol); } - if (type && type.kind === 200 /* LiteralType */) { + if (type && type.kind === 201 /* LiteralType */) { flags |= 2 /* HasLiteralTypes */; } const isOptionalParameter2 = isOptionalJSDocPropertyLikeTag(param) || param.initializer || param.questionToken || isRestParameter(param) || iife && parameters.length > iife.arguments.length && !type || isJSDocOptionalParameter(param); @@ -56786,8 +57246,8 @@ ${lanes.join("\n")} minArgumentCount = parameters.length; } } - if ((declaration.kind === 176 /* GetAccessor */ || declaration.kind === 177 /* SetAccessor */) && hasBindableName(declaration) && (!hasThisParameter2 || !thisParameter)) { - const otherKind = declaration.kind === 176 /* GetAccessor */ ? 177 /* SetAccessor */ : 176 /* GetAccessor */; + if ((declaration.kind === 177 /* GetAccessor */ || declaration.kind === 178 /* SetAccessor */) && hasBindableName(declaration) && (!hasThisParameter2 || !thisParameter)) { + const otherKind = declaration.kind === 177 /* GetAccessor */ ? 178 /* SetAccessor */ : 177 /* GetAccessor */; const other = getDeclarationOfKind(getSymbolOfDeclaration(declaration), otherKind); if (other) { thisParameter = getAnnotatedAccessorThisParameter(other); @@ -56878,15 +57338,15 @@ ${lanes.join("\n")} switch (node.kind) { case 80 /* Identifier */: return node.escapedText === argumentsSymbol.escapedName && getReferencedValueSymbol(node) === argumentsSymbol; - case 171 /* PropertyDeclaration */: - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - return node.name.kind === 166 /* ComputedPropertyName */ && traverse(node.name); - case 210 /* PropertyAccessExpression */: - case 211 /* ElementAccessExpression */: + case 172 /* PropertyDeclaration */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + return node.name.kind === 167 /* ComputedPropertyName */ && traverse(node.name); + case 211 /* PropertyAccessExpression */: + case 212 /* ElementAccessExpression */: return traverse(node.expression); - case 302 /* PropertyAssignment */: + case 303 /* PropertyAssignment */: return traverse(node.initializer); default: return !nodeStartsNewLexicalEnvironment(node) && !isPartOfTypeNode(node) && !!forEachChild(node, traverse); @@ -56973,7 +57433,7 @@ ${lanes.join("\n")} function createTypePredicateFromTypePredicateNode(node, signature) { const parameterName = node.parameterName; const type = node.type && getTypeFromTypeNode(node.type); - return parameterName.kind === 196 /* ThisType */ ? createTypePredicate( + return parameterName.kind === 197 /* ThisType */ ? createTypePredicate( node.assertsModifier ? 2 /* AssertsThis */ : 0 /* This */, /*parameterName*/ void 0, @@ -57005,14 +57465,14 @@ ${lanes.join("\n")} if (signature.declaration) { const typeNode = getEffectiveReturnTypeNode(signature.declaration); if (typeNode) { - error(typeNode, Diagnostics.Return_type_annotation_circularly_references_itself); + error2(typeNode, Diagnostics.Return_type_annotation_circularly_references_itself); } else if (noImplicitAny) { const declaration = signature.declaration; const name = getNameOfDeclaration(declaration); if (name) { - error(name, 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, declarationNameToString(name)); + error2(name, 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, declarationNameToString(name)); } else { - error(declaration, Diagnostics.Function_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); + error2(declaration, Diagnostics.Function_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); } } } @@ -57023,7 +57483,7 @@ ${lanes.join("\n")} return signature.resolvedReturnType; } function getReturnTypeFromAnnotation(declaration) { - if (declaration.kind === 175 /* Constructor */) { + if (declaration.kind === 176 /* Constructor */) { return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)); } const typeNode = getEffectiveReturnTypeNode(declaration); @@ -57039,12 +57499,12 @@ ${lanes.join("\n")} if (typeNode) { return getTypeFromTypeNode(typeNode); } - if (declaration.kind === 176 /* GetAccessor */ && hasBindableName(declaration)) { + if (declaration.kind === 177 /* GetAccessor */ && hasBindableName(declaration)) { const jsDocType = isInJSFile(declaration) && getTypeForDeclarationFromJSDocComment(declaration); if (jsDocType) { return jsDocType; } - const setter = getDeclarationOfKind(getSymbolOfDeclaration(declaration), 177 /* SetAccessor */); + const setter = getDeclarationOfKind(getSymbolOfDeclaration(declaration), 178 /* SetAccessor */); const setterType = getAnnotatedAccessorType(setter); if (setterType) { return setterType; @@ -57053,7 +57513,7 @@ ${lanes.join("\n")} return getReturnTypeOfTypeTag(declaration); } function isResolvingReturnTypeOfSignature(signature) { - return !signature.resolvedReturnType && findResolutionCycleStartIndex(signature, 3 /* ResolvedReturnType */) >= 0; + return signature.compositeSignatures && some(signature.compositeSignatures, isResolvingReturnTypeOfSignature) || !signature.resolvedReturnType && findResolutionCycleStartIndex(signature, 3 /* ResolvedReturnType */) >= 0; } function getRestTypeOfSignature(signature) { return tryGetRestTypeOfSignature(signature) || anyType; @@ -57147,7 +57607,7 @@ ${lanes.join("\n")} var _a; if (!signature.isolatedSignatureType) { const kind = (_a = signature.declaration) == null ? void 0 : _a.kind; - const isConstructor = kind === void 0 || kind === 175 /* Constructor */ || kind === 179 /* ConstructSignature */ || kind === 184 /* ConstructorType */; + const isConstructor = kind === void 0 || kind === 176 /* Constructor */ || kind === 180 /* ConstructSignature */ || kind === 185 /* ConstructorType */; const type = createObjectType(16 /* Anonymous */); type.members = emptySymbols; type.properties = emptyArray; @@ -57206,9 +57666,9 @@ ${lanes.join("\n")} let inferences; if ((_a = typeParameter.symbol) == null ? void 0 : _a.declarations) { for (const declaration of typeParameter.symbol.declarations) { - if (declaration.parent.kind === 194 /* InferType */) { + if (declaration.parent.kind === 195 /* InferType */) { const [childTypeParameter = declaration.parent, grandParent] = walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent); - if (grandParent.kind === 182 /* TypeReference */ && !omitTypeReferences) { + if (grandParent.kind === 183 /* TypeReference */ && !omitTypeReferences) { const typeReference = grandParent; const typeParameters = getTypeParametersForTypeReferenceOrImport(typeReference); if (typeParameters) { @@ -57226,13 +57686,13 @@ ${lanes.join("\n")} } } } - } else if (grandParent.kind === 168 /* Parameter */ && grandParent.dotDotDotToken || grandParent.kind === 190 /* RestType */ || grandParent.kind === 201 /* NamedTupleMember */ && grandParent.dotDotDotToken) { + } else if (grandParent.kind === 169 /* Parameter */ && grandParent.dotDotDotToken || grandParent.kind === 191 /* RestType */ || grandParent.kind === 202 /* NamedTupleMember */ && grandParent.dotDotDotToken) { inferences = append(inferences, createArrayType(unknownType)); - } else if (grandParent.kind === 203 /* TemplateLiteralTypeSpan */) { + } else if (grandParent.kind === 204 /* TemplateLiteralTypeSpan */) { inferences = append(inferences, stringType); - } else if (grandParent.kind === 167 /* TypeParameter */ && grandParent.parent.kind === 199 /* MappedType */) { + } else if (grandParent.kind === 168 /* TypeParameter */ && grandParent.parent.kind === 200 /* MappedType */) { inferences = append(inferences, keyofConstraintType); - } else if (grandParent.kind === 199 /* MappedType */ && grandParent.type && skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 193 /* ConditionalType */ && grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 199 /* MappedType */ && grandParent.parent.checkType.type) { + } else if (grandParent.kind === 200 /* MappedType */ && grandParent.type && skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 194 /* ConditionalType */ && grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 200 /* MappedType */ && grandParent.parent.checkType.type) { const checkMappedType2 = grandParent.parent.checkType; const nodeType = getTypeFromTypeNode(checkMappedType2.type); inferences = append(inferences, instantiateType( @@ -57257,7 +57717,7 @@ ${lanes.join("\n")} } else { let type = getTypeFromTypeNode(constraintDeclaration); if (type.flags & 1 /* Any */ && !isErrorType(type)) { - type = constraintDeclaration.parent.parent.kind === 199 /* MappedType */ ? keyofConstraintType : unknownType; + type = constraintDeclaration.parent.parent.kind === 200 /* MappedType */ ? keyofConstraintType : unknownType; } typeParameter.constraint = type; } @@ -57266,7 +57726,7 @@ ${lanes.join("\n")} return typeParameter.constraint === noConstraintType ? void 0 : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - const tp = getDeclarationOfKind(typeParameter.symbol, 167 /* TypeParameter */); + const tp = getDeclarationOfKind(typeParameter.symbol, 168 /* TypeParameter */); const host2 = isJSDocTemplateTag(tp.parent) ? getEffectiveContainerForJSDocTemplateTag(tp.parent) : tp.parent; return host2 && getSymbolOfNode(host2); } @@ -57351,12 +57811,12 @@ ${lanes.join("\n")} return ((_a = type.target.localTypeParameters) == null ? void 0 : _a.map(() => errorType)) || emptyArray; } const node = type.node; - const typeArguments = !node ? emptyArray : node.kind === 182 /* TypeReference */ ? concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments2(node, type.target.localTypeParameters)) : node.kind === 187 /* ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : map(node.elements, getTypeFromTypeNode); + const typeArguments = !node ? emptyArray : node.kind === 183 /* TypeReference */ ? concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments2(node, type.target.localTypeParameters)) : node.kind === 188 /* ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : map(node.elements, getTypeFromTypeNode); if (popTypeResolution()) { type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments; } else { type.resolvedTypeArguments = ((_b = type.target.localTypeParameters) == null ? void 0 : _b.map(() => errorType)) || emptyArray; - error( + error2( type.node || currentNode, type.target.symbol ? Diagnostics.Type_arguments_for_0_circularly_reference_themselves : Diagnostics.Tuple_type_arguments_circularly_reference_themselves, type.target.symbol && symbolToString(type.target.symbol) @@ -57385,12 +57845,12 @@ ${lanes.join("\n")} void 0, 2 /* WriteArrayAsGenericType */ ); - error(node, diag2, typeStr, minTypeArgumentCount, typeParameters.length); + error2(node, diag2, typeStr, minTypeArgumentCount, typeParameters.length); if (!isJs) { return errorType; } } - if (node.kind === 182 /* TypeReference */ && isDeferredTypeReferenceNode(node, length(node.typeArguments) !== typeParameters.length)) { + if (node.kind === 183 /* TypeReference */ && isDeferredTypeReferenceNode(node, length(node.typeArguments) !== typeParameters.length)) { return createDeferredTypeReference( type, node, @@ -57441,7 +57901,7 @@ ${lanes.join("\n")} const numTypeArguments = length(node.typeArguments); const minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); if (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length) { - error( + error2( node, minTypeArgumentCount === typeParameters.length ? Diagnostics.Generic_type_0_requires_1_type_argument_s : Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments, symbolToString(symbol), @@ -57481,9 +57941,9 @@ ${lanes.join("\n")} } function getTypeReferenceName(node) { switch (node.kind) { - case 182 /* TypeReference */: + case 183 /* TypeReference */: return node.typeName; - case 232 /* ExpressionWithTypeArguments */: + case 233 /* ExpressionWithTypeArguments */: const expr = node.expression; if (isEntityNameExpression(expr)) { return expr; @@ -57495,10 +57955,10 @@ ${lanes.join("\n")} return symbol.parent ? `${getSymbolPath(symbol.parent)}.${symbol.escapedName}` : symbol.escapedName; } function getUnresolvedSymbolForEntityName(name) { - const identifier = name.kind === 165 /* QualifiedName */ ? name.right : name.kind === 210 /* PropertyAccessExpression */ ? name.name : name; + const identifier = name.kind === 166 /* QualifiedName */ ? name.right : name.kind === 211 /* PropertyAccessExpression */ ? name.name : name; const text = identifier.escapedText; if (text) { - const parentSymbol = name.kind === 165 /* QualifiedName */ ? getUnresolvedSymbolForEntityName(name.left) : name.kind === 210 /* PropertyAccessExpression */ ? getUnresolvedSymbolForEntityName(name.expression) : void 0; + const parentSymbol = name.kind === 166 /* QualifiedName */ ? getUnresolvedSymbolForEntityName(name.left) : name.kind === 211 /* PropertyAccessExpression */ ? getUnresolvedSymbolForEntityName(name.expression) : void 0; const path = parentSymbol ? `${getSymbolPath(parentSymbol)}.${text}` : text; let result = unresolvedSymbols.get(path); if (!result) { @@ -57550,7 +58010,7 @@ ${lanes.join("\n")} const valueType = getTypeOfSymbol(symbol); let typeType = valueType; if (symbol.valueDeclaration) { - const isImportTypeWithQualifier = node.kind === 204 /* ImportType */ && node.qualifier; + const isImportTypeWithQualifier = node.kind === 205 /* ImportType */ && node.qualifier; if (valueType.symbol && valueType.symbol !== symbol && isImportTypeWithQualifier) { typeType = getTypeReferenceType(node, valueType.symbol); } @@ -57578,7 +58038,7 @@ ${lanes.join("\n")} return getIntersectionType([substitutionType.constraint, substitutionType.baseType]); } function isUnaryTupleTypeNode(node) { - return node.kind === 188 /* TupleType */ && node.elements.length === 1; + return node.kind === 189 /* TupleType */ && node.elements.length === 1; } function getImpliedConstraint(type, checkNode, extendsNode) { return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(type, checkNode.elements[0], extendsNode.elements[0]) : getActualTypeVariable(getTypeFromTypeNode(checkNode)) === getActualTypeVariable(type) ? getTypeFromTypeNode(extendsNode) : void 0; @@ -57586,17 +58046,17 @@ ${lanes.join("\n")} function getConditionalFlowTypeOfType(type, node) { let constraints; let covariant = true; - while (node && !isStatement(node) && node.kind !== 326 /* JSDoc */) { + while (node && !isStatement(node) && node.kind !== 327 /* JSDoc */) { const parent2 = node.parent; - if (parent2.kind === 168 /* Parameter */) { + if (parent2.kind === 169 /* Parameter */) { covariant = !covariant; } - if ((covariant || type.flags & 8650752 /* TypeVariable */) && parent2.kind === 193 /* ConditionalType */ && node === parent2.trueType) { + if ((covariant || type.flags & 8650752 /* TypeVariable */) && parent2.kind === 194 /* ConditionalType */ && node === parent2.trueType) { const constraint = getImpliedConstraint(type, parent2.checkType, parent2.extendsType); if (constraint) { constraints = append(constraints, constraint); } - } else if (type.flags & 262144 /* TypeParameter */ && parent2.kind === 199 /* MappedType */ && node === parent2.type) { + } else if (type.flags & 262144 /* TypeParameter */ && parent2.kind === 200 /* MappedType */ && node === parent2.type) { const mappedType = getTypeFromTypeNode(parent2); if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) { const typeParameter = getHomomorphicTypeVariable(mappedType); @@ -57613,11 +58073,11 @@ ${lanes.join("\n")} return constraints ? getSubstitutionType(type, getIntersectionType(constraints)) : type; } function isJSDocTypeReference(node) { - return !!(node.flags & 8388608 /* JSDoc */) && (node.kind === 182 /* TypeReference */ || node.kind === 204 /* ImportType */); + return !!(node.flags & 16777216 /* JSDoc */) && (node.kind === 183 /* TypeReference */ || node.kind === 205 /* ImportType */); } function checkNoTypeArguments(node, symbol) { if (node.typeArguments) { - error(node, Diagnostics.Type_0_is_not_generic, symbol ? symbolToString(symbol) : node.typeName ? declarationNameToString(node.typeName) : anon); + error2(node, Diagnostics.Type_0_is_not_generic, symbol ? symbolToString(symbol) : node.typeName ? declarationNameToString(node.typeName) : anon); return false; } return true; @@ -57736,9 +58196,9 @@ ${lanes.join("\n")} if (declarations) { for (const declaration of declarations) { switch (declaration.kind) { - case 262 /* ClassDeclaration */: - case 263 /* InterfaceDeclaration */: - case 265 /* EnumDeclaration */: + case 263 /* ClassDeclaration */: + case 264 /* InterfaceDeclaration */: + case 266 /* EnumDeclaration */: return declaration; } } @@ -57749,11 +58209,11 @@ ${lanes.join("\n")} } const type = getDeclaredTypeOfSymbol(symbol); if (!(type.flags & 524288 /* Object */)) { - error(getTypeDeclaration(symbol), Diagnostics.Global_type_0_must_be_a_class_or_interface_type, symbolName(symbol)); + error2(getTypeDeclaration(symbol), Diagnostics.Global_type_0_must_be_a_class_or_interface_type, symbolName(symbol)); return arity ? emptyGenericType : emptyObjectType; } if (length(type.typeParameters) !== arity) { - error(getTypeDeclaration(symbol), Diagnostics.Global_type_0_must_have_1_type_parameter_s, symbolName(symbol), arity); + error2(getTypeDeclaration(symbol), Diagnostics.Global_type_0_must_have_1_type_parameter_s, symbolName(symbol), arity); return arity ? emptyGenericType : emptyObjectType; } return type; @@ -57770,7 +58230,7 @@ ${lanes.join("\n")} getDeclaredTypeOfSymbol(symbol); if (length(getSymbolLinks(symbol).typeParameters) !== arity) { const decl = symbol.declarations && find(symbol.declarations, isTypeAliasDeclaration); - error(decl, Diagnostics.Global_type_0_must_have_1_type_parameter_s, symbolName(symbol), arity); + error2(decl, Diagnostics.Global_type_0_must_have_1_type_parameter_s, symbolName(symbol), arity); return void 0; } } @@ -57966,6 +58426,22 @@ ${lanes.join("\n")} reportErrors2 )) || emptyGenericType; } + function getGlobalDisposableType(reportErrors2) { + return deferredGlobalDisposableType || (deferredGlobalDisposableType = getGlobalType( + "Disposable", + /*arity*/ + 0, + reportErrors2 + )) || emptyObjectType; + } + function getGlobalAsyncDisposableType(reportErrors2) { + return deferredGlobalAsyncDisposableType || (deferredGlobalAsyncDisposableType = getGlobalType( + "AsyncDisposable", + /*arity*/ + 0, + reportErrors2 + )) || emptyObjectType; + } function getGlobalTypeOrUndefined(name, arity = 0) { const symbol = getGlobalSymbol( name, @@ -58111,11 +58587,11 @@ ${lanes.join("\n")} } function getTupleElementFlags(node) { switch (node.kind) { - case 189 /* OptionalType */: + case 190 /* OptionalType */: return 2 /* Optional */; - case 190 /* RestType */: + case 191 /* RestType */: return getRestTypeElementFlags(node); - case 201 /* NamedTupleMember */: + case 202 /* NamedTupleMember */: return node.questionToken ? 2 /* Optional */ : node.dotDotDotToken ? getRestTypeElementFlags(node) : 1 /* Required */; default: return 1 /* Required */; @@ -58131,60 +58607,57 @@ ${lanes.join("\n")} return readonly ? globalReadonlyArrayType : globalArrayType; } const elementFlags = map(node.elements, getTupleElementFlags); - const missingName = some(node.elements, (e) => e.kind !== 201 /* NamedTupleMember */); - return getTupleTargetType( - elementFlags, - readonly, - /*associatedNames*/ - missingName ? void 0 : node.elements - ); + return getTupleTargetType(elementFlags, readonly, map(node.elements, memberIfLabeledElementDeclaration)); + } + function memberIfLabeledElementDeclaration(member) { + return isNamedTupleMember(member) || isParameter(member) ? member : void 0; } function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) { - return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 187 /* ArrayType */ ? mayResolveTypeAlias(node.elementType) : node.kind === 188 /* TupleType */ ? some(node.elements, mayResolveTypeAlias) : hasDefaultTypeArguments || some(node.typeArguments, mayResolveTypeAlias)); + return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 188 /* ArrayType */ ? mayResolveTypeAlias(node.elementType) : node.kind === 189 /* TupleType */ ? some(node.elements, mayResolveTypeAlias) : hasDefaultTypeArguments || some(node.typeArguments, mayResolveTypeAlias)); } function isResolvedByTypeAlias(node) { const parent2 = node.parent; switch (parent2.kind) { - case 195 /* ParenthesizedType */: - case 201 /* NamedTupleMember */: - case 182 /* TypeReference */: - case 191 /* UnionType */: - case 192 /* IntersectionType */: - case 198 /* IndexedAccessType */: - case 193 /* ConditionalType */: - case 197 /* TypeOperator */: - case 187 /* ArrayType */: - case 188 /* TupleType */: + case 196 /* ParenthesizedType */: + case 202 /* NamedTupleMember */: + case 183 /* TypeReference */: + case 192 /* UnionType */: + case 193 /* IntersectionType */: + case 199 /* IndexedAccessType */: + case 194 /* ConditionalType */: + case 198 /* TypeOperator */: + case 188 /* ArrayType */: + case 189 /* TupleType */: return isResolvedByTypeAlias(parent2); - case 264 /* TypeAliasDeclaration */: + case 265 /* TypeAliasDeclaration */: return true; } return false; } function mayResolveTypeAlias(node) { switch (node.kind) { - case 182 /* TypeReference */: + case 183 /* TypeReference */: return isJSDocTypeReference(node) || !!(resolveTypeReferenceName(node, 788968 /* Type */).flags & 524288 /* TypeAlias */); - case 185 /* TypeQuery */: + case 186 /* TypeQuery */: return true; - case 197 /* TypeOperator */: + case 198 /* TypeOperator */: return node.operator !== 158 /* UniqueKeyword */ && mayResolveTypeAlias(node.type); - case 195 /* ParenthesizedType */: - case 189 /* OptionalType */: - case 201 /* NamedTupleMember */: - case 322 /* JSDocOptionalType */: - case 320 /* JSDocNullableType */: - case 321 /* JSDocNonNullableType */: - case 315 /* JSDocTypeExpression */: + case 196 /* ParenthesizedType */: + case 190 /* OptionalType */: + case 202 /* NamedTupleMember */: + case 323 /* JSDocOptionalType */: + case 321 /* JSDocNullableType */: + case 322 /* JSDocNonNullableType */: + case 316 /* JSDocTypeExpression */: return mayResolveTypeAlias(node.type); - case 190 /* RestType */: - return node.type.kind !== 187 /* ArrayType */ || mayResolveTypeAlias(node.type.elementType); - case 191 /* UnionType */: - case 192 /* IntersectionType */: + case 191 /* RestType */: + return node.type.kind !== 188 /* ArrayType */ || mayResolveTypeAlias(node.type.elementType); + case 192 /* UnionType */: + case 193 /* IntersectionType */: return some(node.types, mayResolveTypeAlias); - case 198 /* IndexedAccessType */: + case 199 /* IndexedAccessType */: return mayResolveTypeAlias(node.objectType) || mayResolveTypeAlias(node.indexType); - case 193 /* ConditionalType */: + case 194 /* ConditionalType */: return mayResolveTypeAlias(node.checkType) || mayResolveTypeAlias(node.extendsType) || mayResolveTypeAlias(node.trueType) || mayResolveTypeAlias(node.falseType); } return false; @@ -58195,15 +58668,15 @@ ${lanes.join("\n")} const target = getArrayOrTupleTargetType(node); if (target === emptyGenericType) { links.resolvedType = emptyObjectType; - } else if (!(node.kind === 188 /* TupleType */ && some(node.elements, (e) => !!(getTupleElementFlags(e) & 8 /* Variadic */))) && isDeferredTypeReferenceNode(node)) { - links.resolvedType = node.kind === 188 /* TupleType */ && node.elements.length === 0 ? target : createDeferredTypeReference( + } else if (!(node.kind === 189 /* TupleType */ && some(node.elements, (e) => !!(getTupleElementFlags(e) & 8 /* Variadic */))) && isDeferredTypeReferenceNode(node)) { + links.resolvedType = node.kind === 189 /* TupleType */ && node.elements.length === 0 ? target : createDeferredTypeReference( target, node, /*mapper*/ void 0 ); } else { - const elementTypes = node.kind === 187 /* ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : map(node.elements, getTypeFromTypeNode); + const elementTypes = node.kind === 188 /* ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : map(node.elements, getTypeFromTypeNode); links.resolvedType = createNormalizedTypeReference(target, elementTypes); } } @@ -58212,7 +58685,7 @@ ${lanes.join("\n")} function isReadonlyTypeOperator(node) { return isTypeOperatorNode(node) && node.operator === 148 /* ReadonlyKeyword */; } - function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations) { + function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations = []) { const tupleTarget = getTupleTargetType(elementFlags || map(elementTypes, (_) => 1 /* Required */), readonly, namedMemberDeclarations); return tupleTarget === emptyGenericType ? emptyObjectType : elementTypes.length ? createNormalizedTypeReference(tupleTarget, elementTypes) : tupleTarget; } @@ -58220,7 +58693,8 @@ ${lanes.join("\n")} if (elementFlags.length === 1 && elementFlags[0] & 4 /* Rest */) { return readonly ? globalReadonlyArrayType : globalArrayType; } - const key = map(elementFlags, (f) => f & 1 /* Required */ ? "#" : f & 2 /* Optional */ ? "?" : f & 4 /* Rest */ ? "." : "*").join() + (readonly ? "R" : "") + (namedMemberDeclarations && namedMemberDeclarations.length ? "," + map(namedMemberDeclarations, getNodeId).join(",") : ""); + const memberIds = mapDefined(namedMemberDeclarations, (node) => node ? getNodeId(node) : void 0); + const key = map(elementFlags, (f) => f & 1 /* Required */ ? "#" : f & 2 /* Optional */ ? "?" : f & 4 /* Rest */ ? "." : "*").join() + (readonly ? "R" : "") + (memberIds.length ? "," + memberIds.join(",") : ""); let type = tupleTypes.get(key); if (!type) { tupleTypes.set(key, type = createTupleTargetType(elementFlags, readonly, namedMemberDeclarations)); @@ -58302,7 +58776,7 @@ ${lanes.join("\n")} } const expandedTypes = []; const expandedFlags = []; - let expandedDeclarations = []; + const expandedDeclarations = []; let lastRequiredIndex = -1; let firstRestIndex = -1; let lastOptionalOrRestIndex = -1; @@ -58315,7 +58789,7 @@ ${lanes.join("\n")} } else if (isTupleType(type)) { const elements = getElementTypes(type); if (elements.length + expandedTypes.length >= 1e4) { - error(currentNode, isPartOfTypeNode(currentNode) ? Diagnostics.Type_produces_a_tuple_type_that_is_too_large_to_represent : Diagnostics.Expression_produces_a_tuple_type_that_is_too_large_to_represent); + error2(currentNode, isPartOfTypeNode(currentNode) ? Diagnostics.Type_produces_a_tuple_type_that_is_too_large_to_represent : Diagnostics.Expression_produces_a_tuple_type_that_is_too_large_to_represent); return errorType; } forEach(elements, (t, n) => { @@ -58340,7 +58814,7 @@ ${lanes.join("\n")} )); expandedTypes.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex); expandedFlags.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex); - expandedDeclarations == null ? void 0 : expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex); + expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex); } const tupleTarget = getTupleTargetType(expandedFlags, target.readonly, expandedDeclarations); return tupleTarget === emptyGenericType ? emptyObjectType : expandedFlags.length ? createTypeReference(tupleTarget, expandedTypes) : tupleTarget; @@ -58360,11 +58834,7 @@ ${lanes.join("\n")} true ) : type); expandedFlags.push(flags); - if (expandedDeclarations && declaration) { - expandedDeclarations.push(declaration); - } else { - expandedDeclarations = void 0; - } + expandedDeclarations.push(declaration); } } function sliceTupleType(type, index, endSkipCount = 0) { @@ -58391,6 +58861,9 @@ ${lanes.join("\n")} function getEndElementCount(type, flags) { return type.elementFlags.length - findLastIndex(type.elementFlags, (f) => !(f & flags)) - 1; } + function getTotalFixedElementCount(type) { + return type.fixedLength + getEndElementCount(type, 3 /* Fixed */); + } function getElementTypes(type) { const typeArguments = getTypeArguments(type); const arity = getTypeReferenceArity(type); @@ -58480,7 +58953,7 @@ ${lanes.join("\n")} const estimatedCount = count / (len - i) * len; if (estimatedCount > 1e6) { (_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "removeSubtypes_DepthLimit", { typeIds: types.map((t) => t.id) }); - error(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent); + error2(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent); return void 0; } } @@ -58889,7 +59362,7 @@ ${lanes.join("\n")} const size = getCrossProductUnionSize(types); if (size >= 1e5) { (_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "checkCrossProductUnion_DepthLimit", { typeIds: types.map((t) => t.id), size }); - error(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent); + error2(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent); return false; } return true; @@ -59241,12 +59714,12 @@ ${lanes.join("\n")} if (isCallLikeExpression(parent2)) { return isCallOrNewExpression(parent2) && isIdentifier(node) && hasMatchingArgument(parent2, node); } - return every(symbol.declarations, (d) => !isFunctionLike(d) || !!(getCombinedNodeFlags(d) & 268435456 /* Deprecated */)); + return every(symbol.declarations, (d) => !isFunctionLike(d) || isDeprecatedDeclaration2(d)); } return true; } function getPropertyTypeForIndexType(originalObjectType, objectType, indexType, fullIndexType, accessNode, accessFlags) { - const accessExpression = accessNode && accessNode.kind === 211 /* ElementAccessExpression */ ? accessNode : void 0; + const accessExpression = accessNode && accessNode.kind === 212 /* ElementAccessExpression */ ? accessNode : void 0; const propName = accessNode && isPrivateIdentifier(accessNode) ? void 0 : getPropertyNameFromIndex(indexType, accessNode); if (propName !== void 0) { if (accessFlags & 256 /* Contextual */) { @@ -59261,7 +59734,7 @@ ${lanes.join("\n")} if (accessExpression) { markPropertyAsReferenced(prop, accessExpression, isSelfTypeAccess(accessExpression.expression, objectType.symbol)); if (isAssignmentToReadonlyEntity(accessExpression, prop, getAssignmentTargetKind(accessExpression))) { - error(accessExpression.argumentExpression, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(prop)); + error2(accessExpression.argumentExpression, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(prop)); return void 0; } if (accessFlags & 8 /* CacheSymbol */) { @@ -59280,10 +59753,10 @@ ${lanes.join("\n")} const indexNode = getIndexNodeForAccessExpression(accessNode); if (isTupleType(objectType)) { if (index < 0) { - error(indexNode, Diagnostics.A_tuple_type_cannot_be_indexed_with_a_negative_value); + error2(indexNode, Diagnostics.A_tuple_type_cannot_be_indexed_with_a_negative_value); return undefinedType; } - error( + error2( indexNode, Diagnostics.Tuple_type_0_of_length_1_has_no_element_at_index_2, typeToString(objectType), @@ -59291,15 +59764,12 @@ ${lanes.join("\n")} unescapeLeadingUnderscores(propName) ); } else { - error(indexNode, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(propName), typeToString(objectType)); + error2(indexNode, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(propName), typeToString(objectType)); } } if (index >= 0) { errorIfWritingToReadonlyIndex(getIndexInfoOfType(objectType, numberType)); - return mapType(objectType, (t) => { - const restType = getRestTypeOfTupleType(t) || undefinedType; - return accessFlags & 1 /* IncludeUndefined */ ? getUnionType([restType, missingType]) : restType; - }); + return getTupleElementTypeOutOfStartCount(objectType, index, accessFlags & 1 /* IncludeUndefined */ ? missingType : void 0); } } } @@ -59311,13 +59781,13 @@ ${lanes.join("\n")} if (indexInfo) { if (accessFlags & 2 /* NoIndexSignatures */ && indexInfo.keyType !== numberType) { if (accessExpression) { - error(accessExpression, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(originalObjectType)); + error2(accessExpression, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(originalObjectType)); } return void 0; } if (accessNode && indexInfo.keyType === stringType && !isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) { const indexNode = getIndexNodeForAccessExpression(accessNode); - error(indexNode, Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType)); + error2(indexNode, Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType)); return accessFlags & 1 /* IncludeUndefined */ ? getUnionType([indexInfo.type, missingType]) : indexInfo.type; } errorIfWritingToReadonlyIndex(indexInfo); @@ -59345,23 +59815,23 @@ ${lanes.join("\n")} } } if (objectType.symbol === globalThisSymbol && propName !== void 0 && globalThisSymbol.exports.has(propName) && globalThisSymbol.exports.get(propName).flags & 418 /* BlockScoped */) { - error(accessExpression, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(propName), typeToString(objectType)); + error2(accessExpression, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(propName), typeToString(objectType)); } else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !(accessFlags & 128 /* SuppressNoImplicitAnyError */)) { if (propName !== void 0 && typeHasStaticProperty(propName, objectType)) { const typeName = typeToString(objectType); - error(accessExpression, Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_to_access_the_static_member_2_instead, propName, typeName, typeName + "[" + getTextOfNode(accessExpression.argumentExpression) + "]"); + error2(accessExpression, Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_to_access_the_static_member_2_instead, propName, typeName, typeName + "[" + getTextOfNode(accessExpression.argumentExpression) + "]"); } else if (getIndexTypeOfType(objectType, numberType)) { - error(accessExpression.argumentExpression, Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number); + error2(accessExpression.argumentExpression, Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number); } else { let suggestion; if (propName !== void 0 && (suggestion = getSuggestionForNonexistentProperty(propName, objectType))) { if (suggestion !== void 0) { - error(accessExpression.argumentExpression, Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2, propName, typeToString(objectType), suggestion); + error2(accessExpression.argumentExpression, Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2, propName, typeToString(objectType), suggestion); } } else { const suggestion2 = getSuggestionForNonexistentIndexSignature(objectType, accessExpression, indexType); if (suggestion2 !== void 0) { - error(accessExpression, Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1, typeToString(objectType), suggestion2); + error2(accessExpression, Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1, typeToString(objectType), suggestion2); } else { let errorInfo; if (indexType.flags & 1024 /* EnumLiteral */) { @@ -59426,11 +59896,11 @@ ${lanes.join("\n")} if (accessNode) { const indexNode = getIndexNodeForAccessExpression(accessNode); if (indexType.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) { - error(indexNode, Diagnostics.Property_0_does_not_exist_on_type_1, "" + indexType.value, typeToString(objectType)); + error2(indexNode, Diagnostics.Property_0_does_not_exist_on_type_1, "" + indexType.value, typeToString(objectType)); } else if (indexType.flags & (4 /* String */ | 8 /* Number */)) { - error(indexNode, Diagnostics.Type_0_has_no_matching_index_signature_for_type_1, typeToString(objectType), typeToString(indexType)); + error2(indexNode, Diagnostics.Type_0_has_no_matching_index_signature_for_type_1, typeToString(objectType), typeToString(indexType)); } else { - error(indexNode, Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType)); + error2(indexNode, Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType)); } } if (isTypeAny(indexType)) { @@ -59439,12 +59909,12 @@ ${lanes.join("\n")} return void 0; function errorIfWritingToReadonlyIndex(indexInfo) { if (indexInfo && indexInfo.isReadonly && accessExpression && (isAssignmentTarget(accessExpression) || isDeleteTarget(accessExpression))) { - error(accessExpression, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); + error2(accessExpression, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); } } } function getIndexNodeForAccessExpression(accessNode) { - return accessNode.kind === 211 /* ElementAccessExpression */ ? accessNode.argumentExpression : accessNode.kind === 198 /* IndexedAccessType */ ? accessNode.indexType : accessNode.kind === 166 /* ComputedPropertyName */ ? accessNode.expression : accessNode; + return accessNode.kind === 212 /* ElementAccessExpression */ ? accessNode.argumentExpression : accessNode.kind === 199 /* IndexedAccessType */ ? accessNode.indexType : accessNode.kind === 167 /* ComputedPropertyName */ ? accessNode.expression : accessNode; } function isPatternLiteralPlaceholderType(type) { if (type.flags & 2097152 /* Intersection */) { @@ -59584,7 +60054,7 @@ ${lanes.join("\n")} } if (compilerOptions.noUncheckedIndexedAccess && accessFlags & 32 /* ExpressionPosition */) accessFlags |= 1 /* IncludeUndefined */; - if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 198 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)) || isGenericReducibleType(objectType))) { + if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 199 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, getTotalFixedElementCount(objectType.target)) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, getTotalFixedElementCount(objectType.target))) || isGenericReducibleType(objectType))) { if (objectType.flags & 3 /* AnyOrUnknown */) { return objectType; } @@ -59664,7 +60134,7 @@ ${lanes.join("\n")} let tailCount = 0; while (true) { if (tailCount === 1e3) { - error(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite); + error2(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite); return errorType; } const checkType = instantiateType(getActualTypeVariable(root.checkType), mapper); @@ -59689,9 +60159,9 @@ ${lanes.join("\n")} ); if (freshMapper) { const freshCombinedMapper = combineTypeMappers(mapper, freshMapper); - for (const p of freshParams) { - if (root.inferTypeParameters.indexOf(p) === -1) { - p.mapper = freshCombinedMapper; + for (let i = 0; i < freshParams.length; i++) { + if (freshParams[i] !== root.inferTypeParameters[i]) { + freshParams[i].mapper = freshCombinedMapper; } } } @@ -59842,11 +60312,11 @@ ${lanes.join("\n")} const links = getNodeLinks(node); if (!links.resolvedType) { if (!isLiteralImportTypeNode(node)) { - error(node.argument, Diagnostics.String_literal_expected); + error2(node.argument, Diagnostics.String_literal_expected); links.resolvedSymbol = unknownSymbol; return links.resolvedType = errorType; } - const targetMeaning = node.isTypeOf ? 111551 /* Value */ : node.flags & 8388608 /* JSDoc */ ? 111551 /* Value */ | 788968 /* Type */ : 788968 /* Type */; + const targetMeaning = node.isTypeOf ? 111551 /* Value */ : node.flags & 16777216 /* JSDoc */ ? 111551 /* Value */ | 788968 /* Type */ : 788968 /* Type */; const innerModuleSymbol = resolveExternalModuleName(node, node.argument.literal); if (!innerModuleSymbol) { links.resolvedSymbol = unknownSymbol; @@ -59876,7 +60346,7 @@ ${lanes.join("\n")} const symbolFromModule = node.isTypeOf ? void 0 : getSymbol2(getExportsOfSymbol(mergedResolvedSymbol), current.escapedText, meaning); const next = symbolFromModule ?? symbolFromVariable; if (!next) { - error(current, Diagnostics.Namespace_0_has_no_exported_member_1, getFullyQualifiedName(currentNamespace), declarationNameToString(current)); + error2(current, Diagnostics.Namespace_0_has_no_exported_member_1, getFullyQualifiedName(currentNamespace), declarationNameToString(current)); return links.resolvedType = errorType; } getNodeLinks(current).resolvedSymbol = next; @@ -59889,7 +60359,7 @@ ${lanes.join("\n")} links.resolvedType = resolveImportSymbolType(node, links, moduleSymbol, targetMeaning); } else { const errorMessage = targetMeaning === 111551 /* Value */ ? Diagnostics.Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here : Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0; - error(node, errorMessage, node.argument.literal.text); + error2(node, errorMessage, node.argument.literal.text); links.resolvedSymbol = unknownSymbol; links.resolvedType = errorType; } @@ -60152,7 +60622,7 @@ ${lanes.join("\n")} false ); const parent2 = container && container.parent; - if (parent2 && (isClassLike(parent2) || parent2.kind === 263 /* InterfaceDeclaration */)) { + if (parent2 && (isClassLike(parent2) || parent2.kind === 264 /* InterfaceDeclaration */)) { if (!isStatic(container) && (!isConstructorDeclaration(container) || isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfDeclaration(parent2)).thisType; } @@ -60160,14 +60630,14 @@ ${lanes.join("\n")} if (parent2 && isObjectLiteralExpression(parent2) && isBinaryExpression(parent2.parent) && getAssignmentDeclarationKind(parent2.parent) === 6 /* Prototype */) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent2.parent.left).parent).thisType; } - const host2 = node.flags & 8388608 /* JSDoc */ ? getHostSignatureFromJSDoc(node) : void 0; + const host2 = node.flags & 16777216 /* JSDoc */ ? getHostSignatureFromJSDoc(node) : void 0; if (host2 && isFunctionExpression(host2) && isBinaryExpression(host2.parent) && getAssignmentDeclarationKind(host2.parent) === 3 /* PrototypeProperty */) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(host2.parent.left).parent).thisType; } if (isJSConstructor(container) && isNodeDescendantOf(node, container.body)) { return getDeclaredTypeOfClassOrInterface(getSymbolOfDeclaration(container)).thisType; } - error(node, Diagnostics.A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface); + error2(node, Diagnostics.A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface); return errorType; } function getTypeFromThisTypeNode(node) { @@ -60182,17 +60652,17 @@ ${lanes.join("\n")} } function getArrayElementTypeNode(node) { switch (node.kind) { - case 195 /* ParenthesizedType */: + case 196 /* ParenthesizedType */: return getArrayElementTypeNode(node.type); - case 188 /* TupleType */: + case 189 /* TupleType */: if (node.elements.length === 1) { node = node.elements[0]; - if (node.kind === 190 /* RestType */ || node.kind === 201 /* NamedTupleMember */ && node.dotDotDotToken) { + if (node.kind === 191 /* RestType */ || node.kind === 202 /* NamedTupleMember */ && node.dotDotDotToken) { return getArrayElementTypeNode(node.type); } } break; - case 187 /* ArrayType */: + case 188 /* ArrayType */: return node.elementType; } return void 0; @@ -60212,8 +60682,8 @@ ${lanes.join("\n")} function getTypeFromTypeNodeWorker(node) { switch (node.kind) { case 133 /* AnyKeyword */: - case 318 /* JSDocAllType */: - case 319 /* JSDocUnknownType */: + case 319 /* JSDocAllType */: + case 320 /* JSDocUnknownType */: return anyType; case 159 /* UnknownKeyword */: return unknownType; @@ -60221,7 +60691,7 @@ ${lanes.join("\n")} return stringType; case 150 /* NumberKeyword */: return numberType; - case 162 /* BigIntKeyword */: + case 163 /* BigIntKeyword */: return bigintType; case 136 /* BooleanKeyword */: return booleanType; @@ -60236,69 +60706,69 @@ ${lanes.join("\n")} case 146 /* NeverKeyword */: return neverType; case 151 /* ObjectKeyword */: - return node.flags & 262144 /* JavaScriptFile */ && !noImplicitAny ? anyType : nonPrimitiveType; + return node.flags & 524288 /* JavaScriptFile */ && !noImplicitAny ? anyType : nonPrimitiveType; case 141 /* IntrinsicKeyword */: return intrinsicMarkerType; - case 196 /* ThisType */: + case 197 /* ThisType */: case 110 /* ThisKeyword */: return getTypeFromThisTypeNode(node); - case 200 /* LiteralType */: + case 201 /* LiteralType */: return getTypeFromLiteralTypeNode(node); - case 182 /* TypeReference */: + case 183 /* TypeReference */: return getTypeFromTypeReference(node); - case 181 /* TypePredicate */: + case 182 /* TypePredicate */: return node.assertsModifier ? voidType : booleanType; - case 232 /* ExpressionWithTypeArguments */: + case 233 /* ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); - case 185 /* TypeQuery */: + case 186 /* TypeQuery */: return getTypeFromTypeQueryNode(node); - case 187 /* ArrayType */: - case 188 /* TupleType */: + case 188 /* ArrayType */: + case 189 /* TupleType */: return getTypeFromArrayOrTupleTypeNode(node); - case 189 /* OptionalType */: + case 190 /* OptionalType */: return getTypeFromOptionalTypeNode(node); - case 191 /* UnionType */: + case 192 /* UnionType */: return getTypeFromUnionTypeNode(node); - case 192 /* IntersectionType */: + case 193 /* IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 320 /* JSDocNullableType */: + case 321 /* JSDocNullableType */: return getTypeFromJSDocNullableTypeNode(node); - case 322 /* JSDocOptionalType */: + case 323 /* JSDocOptionalType */: return addOptionality(getTypeFromTypeNode(node.type)); - case 201 /* NamedTupleMember */: + case 202 /* NamedTupleMember */: return getTypeFromNamedTupleTypeNode(node); - case 195 /* ParenthesizedType */: - case 321 /* JSDocNonNullableType */: - case 315 /* JSDocTypeExpression */: + case 196 /* ParenthesizedType */: + case 322 /* JSDocNonNullableType */: + case 316 /* JSDocTypeExpression */: return getTypeFromTypeNode(node.type); - case 190 /* RestType */: + case 191 /* RestType */: return getTypeFromRestTypeNode(node); - case 324 /* JSDocVariadicType */: + case 325 /* JSDocVariadicType */: return getTypeFromJSDocVariadicType(node); - case 183 /* FunctionType */: - case 184 /* ConstructorType */: - case 186 /* TypeLiteral */: - case 328 /* JSDocTypeLiteral */: - case 323 /* JSDocFunctionType */: - case 329 /* JSDocSignature */: + case 184 /* FunctionType */: + case 185 /* ConstructorType */: + case 187 /* TypeLiteral */: + case 329 /* JSDocTypeLiteral */: + case 324 /* JSDocFunctionType */: + case 330 /* JSDocSignature */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 197 /* TypeOperator */: + case 198 /* TypeOperator */: return getTypeFromTypeOperatorNode(node); - case 198 /* IndexedAccessType */: + case 199 /* IndexedAccessType */: return getTypeFromIndexedAccessTypeNode(node); - case 199 /* MappedType */: + case 200 /* MappedType */: return getTypeFromMappedTypeNode(node); - case 193 /* ConditionalType */: + case 194 /* ConditionalType */: return getTypeFromConditionalTypeNode(node); - case 194 /* InferType */: + case 195 /* InferType */: return getTypeFromInferTypeNode(node); - case 202 /* TemplateLiteralType */: + case 203 /* TemplateLiteralType */: return getTypeFromTemplateTypeNode(node); - case 204 /* ImportType */: + case 205 /* ImportType */: return getTypeFromImportTypeNode(node); case 80 /* Identifier */: - case 165 /* QualifiedName */: - case 210 /* PropertyAccessExpression */: + case 166 /* QualifiedName */: + case 211 /* PropertyAccessExpression */: const symbol = getSymbolAtLocation(node); return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType; default: @@ -60434,7 +60904,7 @@ ${lanes.join("\n")} /*resolvedTypePredicate*/ void 0, signature.minArgumentCount, - signature.flags & 39 /* PropagatingFlags */ + signature.flags & 167 /* PropagatingFlags */ ); result.target = signature; result.mapper = mapper; @@ -60496,23 +60966,31 @@ ${lanes.join("\n")} if (!result) { const newMapper = createTypeMapper(typeParameters, typeArguments); result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments); - if (result.flags & 138117121 /* ObjectFlagsType */ && !(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) { - result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (some(typeArguments, couldContainTypeVariables) ? 1048576 /* CouldContainTypeVariables */ : 0); - } target.instantiations.set(id, result); + const resultObjectFlags = getObjectFlags(result); + if (result.flags & 138117121 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) { + const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables); + if (!(getObjectFlags(result) & 524288 /* CouldContainTypeVariablesComputed */)) { + if (resultObjectFlags & (32 /* Mapped */ | 16 /* Anonymous */ | 4 /* Reference */)) { + result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (resultCouldContainTypeVariables ? 1048576 /* CouldContainTypeVariables */ : 0); + } else { + result.objectFlags |= !resultCouldContainTypeVariables ? 524288 /* CouldContainTypeVariablesComputed */ : 0; + } + } + } } return result; } return type; } function maybeTypeParameterReference(node) { - return !(node.parent.kind === 182 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName || node.parent.kind === 204 /* ImportType */ && node.parent.typeArguments && node === node.parent.qualifier); + return !(node.parent.kind === 183 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName || node.parent.kind === 205 /* ImportType */ && node.parent.typeArguments && node === node.parent.qualifier); } function isTypeParameterPossiblyReferenced(tp, node) { if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) { const container = tp.symbol.declarations[0].parent; for (let n = node; n !== container; n = n.parent) { - if (!n || n.kind === 240 /* Block */ || n.kind === 193 /* ConditionalType */ && forEachChild(n.extendsType, containsReference)) { + if (!n || n.kind === 241 /* Block */ || n.kind === 194 /* ConditionalType */ && forEachChild(n.extendsType, containsReference)) { return true; } } @@ -60521,17 +60999,17 @@ ${lanes.join("\n")} return true; function containsReference(node2) { switch (node2.kind) { - case 196 /* ThisType */: + case 197 /* ThisType */: return !!tp.isThisType; case 80 /* Identifier */: return !tp.isThisType && isPartOfTypeNode(node2) && maybeTypeParameterReference(node2) && getTypeFromTypeNodeWorker(node2) === tp; - case 185 /* TypeQuery */: + case 186 /* TypeQuery */: const entityName = node2.exprName; const firstIdentifier = getFirstIdentifier(entityName); if (!isThisIdentifier(firstIdentifier)) { const firstIdentifierSymbol = getResolvedSymbol(firstIdentifier); const tpDeclaration = tp.symbol.declarations[0]; - const tpScope = tpDeclaration.kind === 167 /* TypeParameter */ ? tpDeclaration.parent : ( + const tpScope = tpDeclaration.kind === 168 /* TypeParameter */ ? tpDeclaration.parent : ( // Type parameter is a regular type parameter, e.g. foo tp.isThisType ? tpDeclaration : ( // Type parameter is the this type, and its declaration is the class declaration. @@ -60543,8 +61021,8 @@ ${lanes.join("\n")} } } return true; - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: return !node2.type && !!node2.body || some(node2.typeParameters, containsReference) || some(node2.parameters, containsReference) || !!node2.type && containsReference(node2.type); } return !!forEachChild(node2, containsReference); @@ -60594,6 +61072,9 @@ ${lanes.join("\n")} const elementFlags = tupleType.target.elementFlags; const elementTypes = map(getElementTypes(tupleType), (t, i) => { const singleton = elementFlags[i] & 8 /* Variadic */ ? t : elementFlags[i] & 4 /* Rest */ ? createArrayType(t) : createTupleType([t], [elementFlags[i]]); + if (singleton === typeVariable) { + return mappedType; + } return instantiateMappedType(mappedType, prependTypeMapping(typeVariable, singleton, mapper)); }); const newReadonly = getModifiedReadonlyState(tupleType.target.readonly, getMappedTypeModifiers(mappedType)); @@ -60681,7 +61162,7 @@ ${lanes.join("\n")} } if (instantiationDepth === 100 || instantiationCount >= 5e6) { (_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "instantiateType_DepthLimit", { typeId: type.id, instantiationDepth, instantiationCount }); - error(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite); + error2(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite); return errorType; } totalInstantiationCount++; @@ -60797,32 +61278,32 @@ ${lanes.join("\n")} return createIndexInfo(info.keyType, instantiateType(info.type, mapper), info.isReadonly, info.declaration); } function isContextSensitive(node) { - Debug.assert(node.kind !== 173 /* MethodDeclaration */ || isObjectLiteralMethod(node)); + Debug.assert(node.kind !== 174 /* MethodDeclaration */ || isObjectLiteralMethod(node)); switch (node.kind) { - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: - case 173 /* MethodDeclaration */: - case 261 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: + case 174 /* MethodDeclaration */: + case 262 /* FunctionDeclaration */: return isContextSensitiveFunctionLikeDeclaration(node); - case 209 /* ObjectLiteralExpression */: + case 210 /* ObjectLiteralExpression */: return some(node.properties, isContextSensitive); - case 208 /* ArrayLiteralExpression */: + case 209 /* ArrayLiteralExpression */: return some(node.elements, isContextSensitive); - case 226 /* ConditionalExpression */: + case 227 /* ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: return (node.operatorToken.kind === 57 /* BarBarToken */ || node.operatorToken.kind === 61 /* QuestionQuestionToken */) && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 302 /* PropertyAssignment */: + case 303 /* PropertyAssignment */: return isContextSensitive(node.initializer); - case 216 /* ParenthesizedExpression */: + case 217 /* ParenthesizedExpression */: return isContextSensitive(node.expression); - case 291 /* JsxAttributes */: + case 292 /* JsxAttributes */: return some(node.properties, isContextSensitive) || isJsxOpeningElement(node.parent) && some(node.parent.parent.children, isContextSensitive); - case 290 /* JsxAttribute */: { + case 291 /* JsxAttribute */: { const { initializer } = node; return !!initializer && isContextSensitive(initializer); } - case 293 /* JsxExpression */: { + case 294 /* JsxExpression */: { const { expression } = node; return !!expression && isContextSensitive(expression); } @@ -60836,7 +61317,7 @@ ${lanes.join("\n")} if (node.typeParameters || getEffectiveReturnTypeNode(node) || !node.body) { return false; } - if (node.body.kind !== 240 /* Block */) { + if (node.body.kind !== 241 /* Block */) { return isContextSensitive(node.body); } return !!forEachReturnStatement(node.body, (statement) => !!statement.expression && isContextSensitive(statement.expression)); @@ -60931,23 +61412,27 @@ ${lanes.join("\n")} return true; } switch (node.kind) { - case 293 /* JsxExpression */: - case 216 /* ParenthesizedExpression */: + case 234 /* AsExpression */: + if (!isConstAssertion(node)) { + break; + } + case 294 /* JsxExpression */: + case 217 /* ParenthesizedExpression */: return elaborateError(node.expression, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: switch (node.operatorToken.kind) { case 64 /* EqualsToken */: case 28 /* CommaToken */: return elaborateError(node.right, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); } break; - case 209 /* ObjectLiteralExpression */: + case 210 /* ObjectLiteralExpression */: return elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 208 /* ArrayLiteralExpression */: + case 209 /* ArrayLiteralExpression */: return elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 291 /* JsxAttributes */: + case 292 /* JsxAttributes */: return elaborateJsxComponents(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 218 /* ArrowFunction */: + case 219 /* ArrowFunction */: return elaborateArrowFunction(node, source, target, relation, containingMessageChain, errorOutputContainer); } return false; @@ -61247,16 +61732,16 @@ ${lanes.join("\n")} } function getElaborationElementForJsxChild(child, nameType, getInvalidTextDiagnostic) { switch (child.kind) { - case 293 /* JsxExpression */: + case 294 /* JsxExpression */: return { errorNode: child, innerExpression: child.expression, nameType }; case 12 /* JsxText */: if (child.containsOnlyTriviaWhiteSpaces) { break; } return { errorNode: child, innerExpression: void 0, nameType, errorMessage: getInvalidTextDiagnostic() }; - case 283 /* JsxElement */: - case 284 /* JsxSelfClosingElement */: - case 287 /* JsxFragment */: + case 284 /* JsxElement */: + case 285 /* JsxSelfClosingElement */: + case 288 /* JsxFragment */: return { errorNode: child, innerExpression: child, nameType }; default: return Debug.assertNever(child, "Found invalid jsx child"); @@ -61297,7 +61782,7 @@ ${lanes.join("\n")} result = elaborateIterableOrArrayLikeTargetElementwise(children, realSource, arrayLikeTargetParts, relation, containingMessageChain, errorOutputContainer) || result; } else if (!isTypeRelatedTo(getIndexedAccessType(source, childrenNameType), childrenTargetType, relation)) { result = true; - const diag2 = error( + const diag2 = error2( containingElement.openingElement.tagName, Diagnostics.This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided, childrenPropName, @@ -61325,7 +61810,7 @@ ${lanes.join("\n")} } } else if (!isTypeRelatedTo(getIndexedAccessType(source, childrenNameType), childrenTargetType, relation)) { result = true; - const diag2 = error( + const diag2 = error2( containingElement.openingElement.tagName, Diagnostics.This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_provided, childrenPropName, @@ -61406,13 +61891,13 @@ ${lanes.join("\n")} continue; } switch (prop.kind) { - case 177 /* SetAccessor */: - case 176 /* GetAccessor */: - case 173 /* MethodDeclaration */: - case 303 /* ShorthandPropertyAssignment */: + case 178 /* SetAccessor */: + case 177 /* GetAccessor */: + case 174 /* MethodDeclaration */: + case 304 /* ShorthandPropertyAssignment */: yield { errorNode: prop.name, innerExpression: void 0, nameType: type }; break; - case 302 /* PropertyAssignment */: + case 303 /* PropertyAssignment */: yield { errorNode: prop.name, innerExpression: prop.initializer, nameType: type, errorMessage: isComputedNonLiteralName(prop.name) ? Diagnostics.Type_of_computed_property_s_value_is_0_which_is_not_assignable_to_type_1 : void 0 }; break; default: @@ -61487,7 +61972,7 @@ ${lanes.join("\n")} void instantiateType(sourceRestType || targetRestType, reportUnreliableMarkers); } const kind = target.declaration ? target.declaration.kind : 0 /* Unknown */; - const strictVariance = !(checkMode & 3 /* Callback */) && strictFunctionTypes && kind !== 173 /* MethodDeclaration */ && kind !== 172 /* MethodSignature */ && kind !== 175 /* Constructor */; + const strictVariance = !(checkMode & 3 /* Callback */) && strictFunctionTypes && kind !== 174 /* MethodDeclaration */ && kind !== 173 /* MethodSignature */ && kind !== 176 /* Constructor */; let result = -1 /* True */; const sourceThisType = getThisTypeOfSignature(source); if (sourceThisType && sourceThisType !== voidType) { @@ -61806,6 +62291,7 @@ ${lanes.join("\n")} let errorInfo; let relatedInfo; let maybeKeys; + let maybeKeysSet; let sourceStack; let targetStack; let maybeCount = 0; @@ -61830,7 +62316,7 @@ ${lanes.join("\n")} } if (overflow) { (_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "checkTypeRelatedTo_DepthLimit", { sourceId: source.id, targetId: target.id, depth: sourceDepth, targetDepth }); - const diag2 = error(errorNode || currentNode, Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target)); + const diag2 = error2(errorNode || currentNode, Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target)); if (errorOutputContainer) { (errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag2); } @@ -62675,9 +63161,13 @@ ${lanes.join("\n")} } if (!maybeKeys) { maybeKeys = []; + maybeKeysSet = /* @__PURE__ */ new Set(); sourceStack = []; targetStack = []; } else { + if (maybeKeysSet.has(id)) { + return 3 /* Maybe */; + } const broadestEquivalentId = id.startsWith("*") ? getRelationKey( source2, target2, @@ -62686,10 +63176,8 @@ ${lanes.join("\n")} /*ignoreConstraints*/ true ) : void 0; - for (let i = 0; i < maybeCount; i++) { - if (id === maybeKeys[i] || broadestEquivalentId && broadestEquivalentId === maybeKeys[i]) { - return 3 /* Maybe */; - } + if (broadestEquivalentId && maybeKeysSet.has(broadestEquivalentId)) { + return 3 /* Maybe */; } if (sourceDepth === 100 || targetDepth === 100) { overflow = true; @@ -62698,6 +63186,7 @@ ${lanes.join("\n")} } const maybeStart = maybeCount; maybeKeys[maybeCount] = id; + maybeKeysSet.add(id); maybeCount++; const saveExpandingFlags = expandingFlags; if (recursionFlags & 1 /* Source */) { @@ -62750,17 +63239,34 @@ ${lanes.join("\n")} if (result2) { if (result2 === -1 /* True */ || sourceDepth === 0 && targetDepth === 0) { if (result2 === -1 /* True */ || result2 === 3 /* Maybe */) { - for (let i = maybeStart; i < maybeCount; i++) { - relation.set(maybeKeys[i], 1 /* Succeeded */ | propagatingVarianceFlags); - } + resetMaybeStack( + /*markAllAsSucceeded*/ + true + ); + } else { + resetMaybeStack( + /*markAllAsSucceeded*/ + false + ); } - maybeCount = maybeStart; } } else { relation.set(id, (reportErrors2 ? 4 /* Reported */ : 0) | 2 /* Failed */ | propagatingVarianceFlags); - maybeCount = maybeStart; + resetMaybeStack( + /*markAllAsSucceeded*/ + false + ); } return result2; + function resetMaybeStack(markAllAsSucceeded) { + for (let i = maybeStart; i < maybeCount; i++) { + maybeKeysSet.delete(maybeKeys[i]); + if (markAllAsSucceeded) { + relation.set(maybeKeys[i], 1 /* Succeeded */ | propagatingVarianceFlags); + } + } + maybeCount = maybeStart; + } } function structuredTypeRelatedTo(source2, target2, reportErrors2, intersectionState) { const saveErrorInfo = captureErrorCalculationState(); @@ -63023,7 +63529,6 @@ ${lanes.join("\n")} } else if (targetFlags & 8388608 /* IndexedAccess */) { if (sourceFlags & 8388608 /* IndexedAccess */) { if (result2 = isRelatedTo(source2.objectType, target2.objectType, 3 /* Both */, reportErrors2)) { - instantiateType(source2.objectType, reportUnreliableMapper); result2 &= isRelatedTo(source2.indexType, target2.indexType, 3 /* Both */, reportErrors2); } if (result2) { @@ -63103,7 +63608,7 @@ ${lanes.join("\n")} return 3 /* Maybe */; } const c = target2; - if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) { + if (!c.root.inferTypeParameters && !isDistributionDependent(c.root) && !(source2.flags & 16777216 /* Conditional */ && source2.root === c.root)) { const skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType)); const skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType)); if (result2 = skipTrue ? -1 /* True */ : isRelatedTo( @@ -63173,26 +63678,6 @@ ${lanes.join("\n")} )) { return result2; } - if (sourceFlags & 8388608 /* IndexedAccess */) { - const indexType = source2.indexType; - if (indexType.flags & 4194304 /* Index */) { - const unresolvedIndexConstraint = getBaseConstraintOfType(indexType.type); - const indexConstraint = unresolvedIndexConstraint && unresolvedIndexConstraint !== noConstraintType ? getIndexType(unresolvedIndexConstraint) : keyofConstraintType; - const constraint2 = getIndexedAccessType(source2.objectType, indexConstraint); - if (result2 = isRelatedTo( - constraint2, - target2, - 1 /* Source */, - /*reportErrors*/ - false, - /*headMessage*/ - void 0, - intersectionState - )) { - return result2; - } - } - } if (isMappedTypeGenericIndexedAccess(source2)) { const indexConstraint = getConstraintOfType(source2.indexType); if (indexConstraint) { @@ -63878,7 +64363,7 @@ ${lanes.join("\n")} const sourceSignature = first(sourceSignatures); const targetSignature = first(targetSignatures); result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, intersectionState, incompatibleReporter(sourceSignature, targetSignature)); - if (!result2 && reportErrors2 && kind === 1 /* Construct */ && sourceObjectFlags & targetObjectFlags && (((_a2 = targetSignature.declaration) == null ? void 0 : _a2.kind) === 175 /* Constructor */ || ((_b = sourceSignature.declaration) == null ? void 0 : _b.kind) === 175 /* Constructor */)) { + if (!result2 && reportErrors2 && kind === 1 /* Construct */ && sourceObjectFlags & targetObjectFlags && (((_a2 = targetSignature.declaration) == null ? void 0 : _a2.kind) === 176 /* Constructor */ || ((_b = sourceSignature.declaration) == null ? void 0 : _b.kind) === 176 /* Constructor */)) { const constructSignatureToString = (signature) => signatureToString( signature, /*enclosingDeclaration*/ @@ -64164,7 +64649,7 @@ ${lanes.join("\n")} let matched = false; for (let i = 0; i < types.length; i++) { if (include[i]) { - const targetType = getTypeOfPropertyOfType(types[i], propertyName); + const targetType = getTypeOfPropertyOrIndexSignatureOfType(types[i], propertyName); if (targetType && related(getDiscriminatingType(), targetType)) { matched = true; } else { @@ -64178,7 +64663,7 @@ ${lanes.join("\n")} } } } - const filtered = contains(include, 0 /* False */) ? getUnionType(types.filter((_, i) => include[i])) : target; + const filtered = contains(include, 0 /* False */) ? getUnionType(types.filter((_, i) => include[i]), 0 /* None */) : target; return filtered.flags & 131072 /* Never */ ? target : filtered; } function isWeakType(type) { @@ -64382,7 +64867,7 @@ ${lanes.join("\n")} } function getRecursionIdentity(type) { if (type.flags & 524288 /* Object */ && !isObjectOrArrayLiteralType(type)) { - if (getObjectFlags(type) && 4 /* Reference */ && type.node) { + if (getObjectFlags(type) & 4 /* Reference */ && type.node) { return type.node; } if (type.symbol && !(getObjectFlags(type) & 16 /* Anonymous */ && type.symbol.flags & 32 /* Class */)) { @@ -64563,7 +65048,7 @@ ${lanes.join("\n")} const target = type.target; if (getObjectFlags(target) & 1 /* Class */) { const baseTypeNode = getBaseTypeNodeOfClass(target); - if (baseTypeNode && baseTypeNode.expression.kind !== 80 /* Identifier */ && baseTypeNode.expression.kind !== 210 /* PropertyAccessExpression */) { + if (baseTypeNode && baseTypeNode.expression.kind !== 80 /* Identifier */ && baseTypeNode.expression.kind !== 211 /* PropertyAccessExpression */) { return void 0; } } @@ -64589,7 +65074,8 @@ ${lanes.join("\n")} return !!elementType && isEmptyLiteralType(elementType); } function isTupleLikeType(type) { - return isTupleType(type) || !!getPropertyOfType(type, "0"); + let lengthType; + return isTupleType(type) || !!getPropertyOfType(type, "0") || isArrayLikeType(type) && !!(lengthType = getTypeOfPropertyOfType(type, "length")) && everyType(lengthType, (t) => !!(t.flags & 256 /* NumberLiteral */)); } function isArrayOrTupleLikeType(type) { return isArrayLikeType(type) || isTupleLikeType(type); @@ -64600,17 +65086,7 @@ ${lanes.join("\n")} return propType; } if (everyType(type, isTupleType)) { - return mapType(type, (t) => { - const tupleType = t; - const restType = getRestTypeOfTupleType(tupleType); - if (!restType) { - return undefinedType; - } - if (compilerOptions.noUncheckedIndexedAccess && index >= tupleType.target.fixedLength + getEndElementCount(tupleType.target, 3 /* Fixed */)) { - return getUnionType([restType, undefinedType]); - } - return restType; - }); + return getTupleElementTypeOutOfStartCount(type, index, compilerOptions.noUncheckedIndexedAccess ? undefinedType : void 0); } return void 0; } @@ -64678,6 +65154,19 @@ ${lanes.join("\n")} function getRestTypeOfTupleType(type) { return getElementTypeOfSliceOfTupleType(type, type.target.fixedLength); } + function getTupleElementTypeOutOfStartCount(type, index, undefinedOrMissingType2) { + return mapType(type, (t) => { + const tupleType = t; + const restType = getRestTypeOfTupleType(tupleType); + if (!restType) { + return undefinedType; + } + if (undefinedOrMissingType2 && index >= getTotalFixedElementCount(tupleType.target)) { + return getUnionType([restType, undefinedOrMissingType2]); + } + return restType; + }); + } function getRestArrayTypeOfTupleType(type) { const restType = getRestTypeOfTupleType(type); return restType && createArrayType(restType); @@ -64946,7 +65435,7 @@ ${lanes.join("\n")} const t = getTypeOfSymbol(p); if (getObjectFlags(t) & 65536 /* ContainsWideningType */) { if (!reportWideningErrorsInType(t)) { - error(p.valueDeclaration, Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, symbolToString(p), typeToString(getWidenedType(t))); + error2(p.valueDeclaration, Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, symbolToString(p), typeToString(getWidenedType(t))); } errorReported = true; } @@ -64962,12 +65451,12 @@ ${lanes.join("\n")} } let diagnostic; switch (declaration.kind) { - case 225 /* BinaryExpression */: - case 171 /* PropertyDeclaration */: - case 170 /* PropertySignature */: + case 226 /* BinaryExpression */: + case 172 /* PropertyDeclaration */: + case 171 /* PropertySignature */: diagnostic = noImplicitAny ? Diagnostics.Member_0_implicitly_has_an_1_type : Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 168 /* Parameter */: + case 169 /* Parameter */: const param = declaration; if (isIdentifier(param.name)) { const originalKeywordKind = identifierToKeywordKind(param.name); @@ -64989,40 +65478,40 @@ ${lanes.join("\n")} } diagnostic = declaration.dotDotDotToken ? noImplicitAny ? Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage : noImplicitAny ? Diagnostics.Parameter_0_implicitly_has_an_1_type : Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 207 /* BindingElement */: + case 208 /* BindingElement */: diagnostic = Diagnostics.Binding_element_0_implicitly_has_an_1_type; if (!noImplicitAny) { return; } break; - case 323 /* JSDocFunctionType */: - error(declaration, Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); + case 324 /* JSDocFunctionType */: + error2(declaration, Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; - case 329 /* JSDocSignature */: + case 330 /* JSDocSignature */: if (noImplicitAny && isJSDocOverloadTag(declaration.parent)) { - error(declaration.parent.tagName, Diagnostics.This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation, typeAsString); + error2(declaration.parent.tagName, Diagnostics.This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation, typeAsString); } return; - case 261 /* FunctionDeclaration */: - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: + case 262 /* FunctionDeclaration */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: if (noImplicitAny && !declaration.name) { if (wideningKind === 3 /* GeneratorYield */) { - error(declaration, Diagnostics.Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation, typeAsString); + error2(declaration, Diagnostics.Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation, typeAsString); } else { - error(declaration, Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); + error2(declaration, Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); } return; } diagnostic = !noImplicitAny ? Diagnostics._0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage : wideningKind === 3 /* GeneratorYield */ ? Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type : Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; break; - case 199 /* MappedType */: + case 200 /* MappedType */: if (noImplicitAny) { - error(declaration, Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type); + error2(declaration, Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type); } return; default: @@ -65117,7 +65606,7 @@ ${lanes.join("\n")} function inferFromIntraExpressionSites(context) { if (context.intraExpressionInferenceSites) { for (const { node, type } of context.intraExpressionInferenceSites) { - const contextualType = node.kind === 173 /* MethodDeclaration */ ? getContextualTypeForObjectLiteralMethod(node, 2 /* NoConstraints */) : getContextualType2(node, 2 /* NoConstraints */); + const contextualType = node.kind === 174 /* MethodDeclaration */ ? getContextualTypeForObjectLiteralMethod(node, 2 /* NoConstraints */) : getContextualType2(node, 2 /* NoConstraints */); if (contextualType) { inferTypes(context.inferences, type, contextualType); } @@ -65169,8 +65658,8 @@ ${lanes.join("\n")} } function isNonGenericTopLevelType(type) { if (type.aliasSymbol && !type.aliasTypeArguments) { - const declaration = getDeclarationOfKind(type.aliasSymbol, 264 /* TypeAliasDeclaration */); - return !!(declaration && findAncestor(declaration.parent, (n) => n.kind === 311 /* SourceFile */ ? true : n.kind === 266 /* ModuleDeclaration */ ? false : "quit")); + const declaration = getDeclarationOfKind(type.aliasSymbol, 265 /* TypeAliasDeclaration */); + return !!(declaration && findAncestor(declaration.parent, (n) => n.kind === 312 /* SourceFile */ ? true : n.kind === 267 /* ModuleDeclaration */ ? false : "quit")); } return false; } @@ -65212,17 +65701,18 @@ ${lanes.join("\n")} ); } function inferTypeForHomomorphicMappedType(source, target, constraint) { - if (inInferTypeForHomomorphicMappedType) { - return void 0; + const cacheKey = source.id + "," + target.id + "," + constraint.id; + if (reverseMappedCache.has(cacheKey)) { + return reverseMappedCache.get(cacheKey); } - const key = source.id + "," + target.id + "," + constraint.id; - if (reverseMappedCache.has(key)) { - return reverseMappedCache.get(key); + const recursionKey = source.id + "," + (target.target || target).id; + if (contains(homomorphicMappedTypeInferenceStack, recursionKey)) { + return void 0; } - inInferTypeForHomomorphicMappedType = true; + homomorphicMappedTypeInferenceStack.push(recursionKey); const type = createReverseMappedType(source, target, constraint); - inInferTypeForHomomorphicMappedType = false; - reverseMappedCache.set(key, type); + homomorphicMappedTypeInferenceStack.pop(); + reverseMappedCache.set(cacheKey, type); return type; } function isPartiallyInferableType(type) { @@ -65995,7 +66485,7 @@ ${lanes.join("\n")} if (!(source.flags & 64 /* IsNonInferrable */)) { const saveBivariant = bivariant; const kind = target.declaration ? target.declaration.kind : 0 /* Unknown */; - bivariant = bivariant || kind === 173 /* MethodDeclaration */ || kind === 172 /* MethodSignature */ || kind === 175 /* Constructor */; + bivariant = bivariant || kind === 174 /* MethodDeclaration */ || kind === 173 /* MethodSignature */ || kind === 176 /* Constructor */; applyToParameterTypes(source, target, inferFromContravariantTypesIfStrictFunctionTypes); bivariant = saveBivariant; } @@ -66095,7 +66585,7 @@ ${lanes.join("\n")} const constraint = getConstraintOfTypeParameter(inference.typeParameter); if (constraint) { const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper); - if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) { + if (!inferredType || inferredType === wildcardType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) { inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint; } } @@ -66153,7 +66643,7 @@ ${lanes.join("\n")} return Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function; } default: - if (node.parent.kind === 303 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 304 /* ShorthandPropertyAssignment */) { return Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer; } else { return Diagnostics.Cannot_find_name_0; @@ -66176,14 +66666,8 @@ ${lanes.join("\n")} } return links.resolvedSymbol; } - function isInTypeQuery(node) { - return !!findAncestor( - node, - (n) => n.kind === 185 /* TypeQuery */ ? true : n.kind === 80 /* Identifier */ || n.kind === 165 /* QualifiedName */ ? false : "quit" - ); - } function isInAmbientOrTypeNode(node) { - return !!(node.flags & 16777216 /* Ambient */ || findAncestor(node, (n) => isInterfaceDeclaration(n) || isTypeAliasDeclaration(n) || isTypeLiteralNode(n))); + return !!(node.flags & 33554432 /* Ambient */ || findAncestor(node, (n) => isInterfaceDeclaration(n) || isTypeAliasDeclaration(n) || isTypeLiteralNode(n))); } function getFlowCacheKey(node, declaredType, initialType, flowContainer) { switch (node.kind) { @@ -66194,41 +66678,41 @@ ${lanes.join("\n")} } case 110 /* ThisKeyword */: return `0|${flowContainer ? getNodeId(flowContainer) : "-1"}|${getTypeId(declaredType)}|${getTypeId(initialType)}`; - case 234 /* NonNullExpression */: - case 216 /* ParenthesizedExpression */: + case 235 /* NonNullExpression */: + case 217 /* ParenthesizedExpression */: return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); - case 165 /* QualifiedName */: + case 166 /* QualifiedName */: const left = getFlowCacheKey(node.left, declaredType, initialType, flowContainer); return left && left + "." + node.right.escapedText; - case 210 /* PropertyAccessExpression */: - case 211 /* ElementAccessExpression */: + case 211 /* PropertyAccessExpression */: + case 212 /* ElementAccessExpression */: const propName = getAccessedPropertyName(node); if (propName !== void 0) { const key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); return key && key + "." + propName; } break; - case 205 /* ObjectBindingPattern */: - case 206 /* ArrayBindingPattern */: - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: - case 173 /* MethodDeclaration */: + case 206 /* ObjectBindingPattern */: + case 207 /* ArrayBindingPattern */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: + case 174 /* MethodDeclaration */: return `${getNodeId(node)}#${getTypeId(declaredType)}`; } return void 0; } function isMatchingReference(source, target) { switch (target.kind) { - case 216 /* ParenthesizedExpression */: - case 234 /* NonNullExpression */: + case 217 /* ParenthesizedExpression */: + case 235 /* NonNullExpression */: return isMatchingReference(source, target.expression); - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: return isAssignmentExpression(target) && isMatchingReference(source, target.left) || isBinaryExpression(target) && target.operatorToken.kind === 28 /* CommaToken */ && isMatchingReference(source, target.right); } switch (source.kind) { - case 235 /* MetaProperty */: - return target.kind === 235 /* MetaProperty */ && source.keywordToken === target.keywordToken && source.name.escapedText === target.name.escapedText; + case 236 /* MetaProperty */: + return target.kind === 236 /* MetaProperty */ && source.keywordToken === target.keywordToken && source.name.escapedText === target.name.escapedText; case 80 /* Identifier */: case 81 /* PrivateIdentifier */: return isThisInTypeQuery(source) ? target.kind === 110 /* ThisKeyword */ : target.kind === 80 /* Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) || (isVariableDeclaration(target) || isBindingElement(target)) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfDeclaration(target); @@ -66236,17 +66720,17 @@ ${lanes.join("\n")} return target.kind === 110 /* ThisKeyword */; case 108 /* SuperKeyword */: return target.kind === 108 /* SuperKeyword */; - case 234 /* NonNullExpression */: - case 216 /* ParenthesizedExpression */: + case 235 /* NonNullExpression */: + case 217 /* ParenthesizedExpression */: return isMatchingReference(source.expression, target); - case 210 /* PropertyAccessExpression */: - case 211 /* ElementAccessExpression */: + case 211 /* PropertyAccessExpression */: + case 212 /* ElementAccessExpression */: const sourcePropertyName = getAccessedPropertyName(source); const targetPropertyName = isAccessExpression(target) ? getAccessedPropertyName(target) : void 0; return sourcePropertyName !== void 0 && targetPropertyName !== void 0 && targetPropertyName === sourcePropertyName && isMatchingReference(source.expression, target.expression); - case 165 /* QualifiedName */: + case 166 /* QualifiedName */: return isAccessExpression(target) && source.right.escapedText === getAccessedPropertyName(target) && isMatchingReference(source.left, target.expression); - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: return isBinaryExpression(source) && source.operatorToken.kind === 28 /* CommaToken */ && isMatchingReference(source.right, target); } return false; @@ -66280,7 +66764,7 @@ ${lanes.join("\n")} /*ignoreErrors*/ true ); - if (!symbol || !(isConstVariable(symbol) || symbol.flags & 8 /* EnumMember */)) + if (!symbol || !(isConstantVariable(symbol) || symbol.flags & 8 /* EnumMember */)) return void 0; const declaration = symbol.valueDeclaration; if (declaration === void 0) @@ -66399,7 +66883,7 @@ ${lanes.join("\n")} } function getMatchingUnionConstituentForObjectLiteral(unionType, node) { const keyPropertyName = getKeyPropertyName(unionType); - const propNode = keyPropertyName && find(node.properties, (p) => p.symbol && p.kind === 302 /* PropertyAssignment */ && p.symbol.escapedName === keyPropertyName && isPossiblyDiscriminantValue(p.initializer)); + const propNode = keyPropertyName && find(node.properties, (p) => p.symbol && p.kind === 303 /* PropertyAssignment */ && p.symbol.escapedName === keyPropertyName && isPossiblyDiscriminantValue(p.initializer)); const propType = propNode && getContextFreeTypeOfExpression(propNode.initializer); return propType && getConstituentTypeForKeyType(unionType, propType); } @@ -66414,7 +66898,7 @@ ${lanes.join("\n")} } } } - if (expression.expression.kind === 210 /* PropertyAccessExpression */ && isOrContainsMatchingReference(reference, expression.expression.expression)) { + if (expression.expression.kind === 211 /* PropertyAccessExpression */ && isOrContainsMatchingReference(reference, expression.expression.expression)) { return true; } return false; @@ -66586,11 +67070,11 @@ ${lanes.join("\n")} ) || errorType); } function getAssignedTypeOfBinaryExpression(node) { - const isDestructuringDefaultAssignment = node.parent.kind === 208 /* ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || node.parent.kind === 302 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); + const isDestructuringDefaultAssignment = node.parent.kind === 209 /* ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || node.parent.kind === 303 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } function isDestructuringAssignmentTarget(parent2) { - return parent2.parent.kind === 225 /* BinaryExpression */ && parent2.parent.left === parent2 || parent2.parent.kind === 249 /* ForOfStatement */ && parent2.parent.initializer === parent2; + return parent2.parent.kind === 226 /* BinaryExpression */ && parent2.parent.left === parent2 || parent2.parent.kind === 250 /* ForOfStatement */ && parent2.parent.initializer === parent2; } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element)); @@ -66607,21 +67091,21 @@ ${lanes.join("\n")} function getAssignedType(node) { const { parent: parent2 } = node; switch (parent2.kind) { - case 248 /* ForInStatement */: + case 249 /* ForInStatement */: return stringType; - case 249 /* ForOfStatement */: + case 250 /* ForOfStatement */: return checkRightHandSideOfForOf(parent2) || errorType; - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: return getAssignedTypeOfBinaryExpression(parent2); - case 219 /* DeleteExpression */: + case 220 /* DeleteExpression */: return undefinedType; - case 208 /* ArrayLiteralExpression */: + case 209 /* ArrayLiteralExpression */: return getAssignedTypeOfArrayLiteralElement(parent2, node); - case 229 /* SpreadElement */: + case 230 /* SpreadElement */: return getAssignedTypeOfSpreadExpression(parent2); - case 302 /* PropertyAssignment */: + case 303 /* PropertyAssignment */: return getAssignedTypeOfPropertyAssignment(parent2); - case 303 /* ShorthandPropertyAssignment */: + case 304 /* ShorthandPropertyAssignment */: return getAssignedTypeOfShorthandPropertyAssignment(parent2); } return errorType; @@ -66629,7 +67113,7 @@ ${lanes.join("\n")} function getInitialTypeOfBindingElement(node) { const pattern = node.parent; const parentType = getInitialType(pattern.parent); - const type = pattern.kind === 205 /* ObjectBindingPattern */ ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) : getTypeOfDestructuredSpreadExpression(parentType); + const type = pattern.kind === 206 /* ObjectBindingPattern */ ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) : getTypeOfDestructuredSpreadExpression(parentType); return getTypeWithDefault(type, node.initializer); } function getTypeOfInitializer(node) { @@ -66640,25 +67124,25 @@ ${lanes.join("\n")} if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 248 /* ForInStatement */) { + if (node.parent.parent.kind === 249 /* ForInStatement */) { return stringType; } - if (node.parent.parent.kind === 249 /* ForOfStatement */) { + if (node.parent.parent.kind === 250 /* ForOfStatement */) { return checkRightHandSideOfForOf(node.parent.parent) || errorType; } return errorType; } function getInitialType(node) { - return node.kind === 259 /* VariableDeclaration */ ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); + return node.kind === 260 /* VariableDeclaration */ ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function isEmptyArrayAssignment(node) { - return node.kind === 259 /* VariableDeclaration */ && node.initializer && isEmptyArrayLiteral2(node.initializer) || node.kind !== 207 /* BindingElement */ && node.parent.kind === 225 /* BinaryExpression */ && isEmptyArrayLiteral2(node.parent.right); + return node.kind === 260 /* VariableDeclaration */ && node.initializer && isEmptyArrayLiteral2(node.initializer) || node.kind !== 208 /* BindingElement */ && node.parent.kind === 226 /* BinaryExpression */ && isEmptyArrayLiteral2(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 216 /* ParenthesizedExpression */: + case 217 /* ParenthesizedExpression */: return getReferenceCandidate(node.expression); - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: switch (node.operatorToken.kind) { case 64 /* EqualsToken */: case 76 /* BarBarEqualsToken */: @@ -66673,10 +67157,10 @@ ${lanes.join("\n")} } function getReferenceRoot(node) { const { parent: parent2 } = node; - return parent2.kind === 216 /* ParenthesizedExpression */ || parent2.kind === 225 /* BinaryExpression */ && parent2.operatorToken.kind === 64 /* EqualsToken */ && parent2.left === node || parent2.kind === 225 /* BinaryExpression */ && parent2.operatorToken.kind === 28 /* CommaToken */ && parent2.right === node ? getReferenceRoot(parent2) : node; + return parent2.kind === 217 /* ParenthesizedExpression */ || parent2.kind === 226 /* BinaryExpression */ && parent2.operatorToken.kind === 64 /* EqualsToken */ && parent2.left === node || parent2.kind === 226 /* BinaryExpression */ && parent2.operatorToken.kind === 28 /* CommaToken */ && parent2.right === node ? getReferenceRoot(parent2) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 295 /* CaseClause */) { + if (clause.kind === 296 /* CaseClause */) { return getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); } return neverType; @@ -66692,12 +67176,12 @@ ${lanes.join("\n")} return links.switchTypes; } function getSwitchClauseTypeOfWitnesses(switchStatement) { - if (some(switchStatement.caseBlock.clauses, (clause) => clause.kind === 295 /* CaseClause */ && !isStringLiteralLike(clause.expression))) { + if (some(switchStatement.caseBlock.clauses, (clause) => clause.kind === 296 /* CaseClause */ && !isStringLiteralLike(clause.expression))) { return void 0; } const witnesses = []; for (const clause of switchStatement.caseBlock.clauses) { - const text = clause.kind === 295 /* CaseClause */ ? clause.expression.text : void 0; + const text = clause.kind === 296 /* CaseClause */ ? clause.expression.text : void 0; witnesses.push(text && !contains(witnesses, text) ? text : void 0); } return witnesses; @@ -66855,8 +67339,8 @@ ${lanes.join("\n")} function isEvolvingArrayOperationTarget(node) { const root = getReferenceRoot(node); const parent2 = root.parent; - const isLengthPushOrUnshift = isPropertyAccessExpression(parent2) && (parent2.name.escapedText === "length" || parent2.parent.kind === 212 /* CallExpression */ && isIdentifier(parent2.name) && isPushOrUnshiftIdentifier(parent2.name)); - const isElementAssignment = parent2.kind === 211 /* ElementAccessExpression */ && parent2.expression === root && parent2.parent.kind === 225 /* BinaryExpression */ && parent2.parent.operatorToken.kind === 64 /* EqualsToken */ && parent2.parent.left === parent2 && !isAssignmentTarget(parent2.parent) && isTypeAssignableToKind(getTypeOfExpression(parent2.argumentExpression), 296 /* NumberLike */); + const isLengthPushOrUnshift = isPropertyAccessExpression(parent2) && (parent2.name.escapedText === "length" || parent2.parent.kind === 213 /* CallExpression */ && isIdentifier(parent2.name) && isPushOrUnshiftIdentifier(parent2.name)); + const isElementAssignment = parent2.kind === 212 /* ElementAccessExpression */ && parent2.expression === root && parent2.parent.kind === 226 /* BinaryExpression */ && parent2.parent.operatorToken.kind === 64 /* EqualsToken */ && parent2.parent.left === parent2 && !isAssignmentTarget(parent2.parent) && isTypeAssignableToKind(getTypeOfExpression(parent2.argumentExpression), 296 /* NumberLike */); return isLengthPushOrUnshift || isElementAssignment; } function isDeclarationWithExplicitTypeAnnotation(node) { @@ -66879,7 +67363,7 @@ ${lanes.join("\n")} if (isDeclarationWithExplicitTypeAnnotation(declaration)) { return getTypeOfSymbol(symbol); } - if (isVariableDeclaration(declaration) && declaration.parent.parent.kind === 249 /* ForOfStatement */) { + if (isVariableDeclaration(declaration) && declaration.parent.parent.kind === 250 /* ForOfStatement */) { const statement = declaration.parent.parent; const expressionType = getTypeOfDottedName( statement.expression, @@ -66904,7 +67388,7 @@ ${lanes.join("\n")} } } function getTypeOfDottedName(node, diagnostic) { - if (!(node.flags & 33554432 /* InWithStatement */)) { + if (!(node.flags & 67108864 /* InWithStatement */)) { switch (node.kind) { case 80 /* Identifier */: const symbol = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(node)); @@ -66913,7 +67397,7 @@ ${lanes.join("\n")} return getExplicitThisType(node); case 108 /* SuperKeyword */: return checkSuperExpression(node); - case 210 /* PropertyAccessExpression */: { + case 211 /* PropertyAccessExpression */: { const type = getTypeOfDottedName(node.expression, diagnostic); if (type) { const name = node.name; @@ -66930,7 +67414,7 @@ ${lanes.join("\n")} } return void 0; } - case 216 /* ParenthesizedExpression */: + case 217 /* ParenthesizedExpression */: return getTypeOfDottedName(node.expression, diagnostic); } } @@ -66940,7 +67424,7 @@ ${lanes.join("\n")} let signature = links.effectsSignature; if (signature === void 0) { let funcType; - if (node.parent.kind === 243 /* ExpressionStatement */) { + if (node.parent.kind === 244 /* ExpressionStatement */) { funcType = getTypeOfDottedName( node.expression, /*diagnostic*/ @@ -66994,7 +67478,7 @@ ${lanes.join("\n")} /*excludeJSDocTypeAssertions*/ true ); - return node.kind === 97 /* FalseKeyword */ || node.kind === 225 /* BinaryExpression */ && (node.operatorToken.kind === 56 /* AmpersandAmpersandToken */ && (isFalseExpression(node.left) || isFalseExpression(node.right)) || node.operatorToken.kind === 57 /* BarBarToken */ && isFalseExpression(node.left) && isFalseExpression(node.right)); + return node.kind === 97 /* FalseKeyword */ || node.kind === 226 /* BinaryExpression */ && (node.operatorToken.kind === 56 /* AmpersandAmpersandToken */ && (isFalseExpression(node.left) || isFalseExpression(node.right)) || node.operatorToken.kind === 57 /* BarBarToken */ && isFalseExpression(node.left) && isFalseExpression(node.right)); } function isReachableFlowNodeWorker(flow, noCacheCheck) { while (true) { @@ -67113,14 +67597,16 @@ ${lanes.join("\n")} } function isConstantReference(node) { switch (node.kind) { + case 110 /* ThisKeyword */: + return true; case 80 /* Identifier */: if (!isThisInTypeQuery(node)) { const symbol = getResolvedSymbol(node); - return isConstVariable(symbol) || isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol); + return isConstantVariable(symbol) || isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol); } break; - case 210 /* PropertyAccessExpression */: - case 211 /* ElementAccessExpression */: + case 211 /* PropertyAccessExpression */: + case 212 /* ElementAccessExpression */: return isConstantReference(node.expression) && isReadonlySymbol(getNodeLinks(node).resolvedSymbol || unknownSymbol); } return false; @@ -67140,7 +67626,7 @@ ${lanes.join("\n")} const evolvedType = getTypeFromFlowType(getTypeAtFlowNode(flowNode)); sharedFlowCount = sharedFlowStart; const resultType = getObjectFlags(evolvedType) & 256 /* EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType); - if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 234 /* NonNullExpression */ && !(resultType.flags & 131072 /* Never */) && getTypeWithFacts(resultType, 2097152 /* NEUndefinedOrNull */).flags & 131072 /* Never */) { + if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 235 /* NonNullExpression */ && !(resultType.flags & 131072 /* Never */) && getTypeWithFacts(resultType, 2097152 /* NEUndefinedOrNull */).flags & 131072 /* Never */) { return declaredType; } return resultType === nonNullUnknownType ? unknownType : resultType; @@ -67209,7 +67695,7 @@ ${lanes.join("\n")} target.antecedents = saveAntecedents; } else if (flags & 2 /* Start */) { const container = flow.node; - if (container && container !== flowContainer && reference.kind !== 210 /* PropertyAccessExpression */ && reference.kind !== 211 /* ElementAccessExpression */ && reference.kind !== 110 /* ThisKeyword */) { + if (container && container !== flowContainer && reference.kind !== 211 /* PropertyAccessExpression */ && reference.kind !== 212 /* ElementAccessExpression */ && !(reference.kind === 110 /* ThisKeyword */ && container.kind !== 219 /* ArrowFunction */)) { flow = container.flowNode; continue; } @@ -67228,7 +67714,7 @@ ${lanes.join("\n")} } function getInitialOrAssignedType(flow) { const node = flow.node; - return getNarrowableTypeForReference(node.kind === 259 /* VariableDeclaration */ || node.kind === 207 /* BindingElement */ ? getInitialType(node) : getAssignedType(node), reference); + return getNarrowableTypeForReference(node.kind === 260 /* VariableDeclaration */ || node.kind === 208 /* BindingElement */ ? getInitialType(node) : getAssignedType(node), reference); } function getTypeAtFlowAssignment(flow) { const node = flow.node; @@ -67256,15 +67742,15 @@ ${lanes.join("\n")} if (!isReachableFlowNode(flow)) { return unreachableNeverType; } - if (isVariableDeclaration(node) && (isInJSFile(node) || isVarConst(node))) { + if (isVariableDeclaration(node) && (isInJSFile(node) || isVarConstLike(node))) { const init = getDeclaredExpandoInitializer(node); - if (init && (init.kind === 217 /* FunctionExpression */ || init.kind === 218 /* ArrowFunction */)) { + if (init && (init.kind === 218 /* FunctionExpression */ || init.kind === 219 /* ArrowFunction */)) { return getTypeAtFlowNode(flow.antecedent); } } return declaredType; } - if (isVariableDeclaration(node) && node.parent.parent.kind === 248 /* ForInStatement */ && (isMatchingReference(reference, node.parent.parent.expression) || optionalChainContainsReference(node.parent.parent.expression, reference))) { + if (isVariableDeclaration(node) && node.parent.parent.kind === 249 /* ForInStatement */ && (isMatchingReference(reference, node.parent.parent.expression) || optionalChainContainsReference(node.parent.parent.expression, reference))) { return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)))); } return void 0; @@ -67278,7 +67764,7 @@ ${lanes.join("\n")} if (node.kind === 97 /* FalseKeyword */) { return unreachableNeverType; } - if (node.kind === 225 /* BinaryExpression */) { + if (node.kind === 226 /* BinaryExpression */) { if (node.operatorToken.kind === 56 /* AmpersandAmpersandToken */) { return narrowTypeByAssertion(narrowTypeByAssertion(type, node.left), node.right); } @@ -67318,13 +67804,13 @@ ${lanes.join("\n")} function getTypeAtFlowArrayMutation(flow) { if (declaredType === autoType || declaredType === autoArrayType) { const node = flow.node; - const expr = node.kind === 212 /* CallExpression */ ? node.expression.expression : node.left.expression; + const expr = node.kind === 213 /* CallExpression */ ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { const flowType = getTypeAtFlowNode(flow.antecedent); const type = getTypeFromFlowType(flowType); if (getObjectFlags(type) & 256 /* EvolvingArray */) { let evolvedType2 = type; - if (node.kind === 212 /* CallExpression */) { + if (node.kind === 213 /* CallExpression */) { for (const arg of node.arguments) { evolvedType2 = addEvolvingArrayElementType(evolvedType2, arg); } @@ -67361,7 +67847,7 @@ ${lanes.join("\n")} let type = getTypeFromFlowType(flowType); if (isMatchingReference(reference, expr)) { type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); - } else if (expr.kind === 220 /* TypeOfExpression */ && isMatchingReference(reference, expr.expression)) { + } else if (expr.kind === 221 /* TypeOfExpression */ && isMatchingReference(reference, expr.expression)) { type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } else { if (strictNullChecks) { @@ -67373,7 +67859,7 @@ ${lanes.join("\n")} flow.clauseEnd, (t) => !(t.flags & (32768 /* Undefined */ | 131072 /* Never */)) ); - } else if (expr.kind === 220 /* TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) { + } else if (expr.kind === 221 /* TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) { type = narrowTypeBySwitchOptionalChainContainment( type, flow.switchStatement, @@ -67518,7 +68004,7 @@ ${lanes.join("\n")} } } else if (isIdentifier(expr)) { const symbol = getResolvedSymbol(expr); - if (isConstVariable(symbol)) { + if (isConstantVariable(symbol)) { const declaration = symbol.valueDeclaration; if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) { return declaration.initializer; @@ -67636,10 +68122,10 @@ ${lanes.join("\n")} const operator = expr.operatorToken.kind; const left = getReferenceCandidate(expr.left); const right = getReferenceCandidate(expr.right); - if (left.kind === 220 /* TypeOfExpression */ && isStringLiteralLike(right)) { + if (left.kind === 221 /* TypeOfExpression */ && isStringLiteralLike(right)) { return narrowTypeByTypeof(type, left, operator, right, assumeTrue); } - if (right.kind === 220 /* TypeOfExpression */ && isStringLiteralLike(left)) { + if (right.kind === 221 /* TypeOfExpression */ && isStringLiteralLike(left)) { return narrowTypeByTypeof(type, right, operator, left, assumeTrue); } if (isMatchingReference(reference, left)) { @@ -67677,12 +68163,15 @@ ${lanes.join("\n")} return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue); } const target = getReferenceCandidate(expr.right); - const leftType = getTypeOfExpression(expr.left); - if (leftType.flags & 8576 /* StringOrNumberLiteralOrUnique */) { - if (containsMissingType(type) && isAccessExpression(reference) && isMatchingReference(reference.expression, target) && getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) { + if (containsMissingType(type) && isAccessExpression(reference) && isMatchingReference(reference.expression, target)) { + const leftType = getTypeOfExpression(expr.left); + if (isTypeUsableAsPropertyName(leftType) && getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) { return getTypeWithFacts(type, assumeTrue ? 524288 /* NEUndefined */ : 65536 /* EQUndefined */); } - if (isMatchingReference(reference, target)) { + } + if (isMatchingReference(reference, target)) { + const leftType = getTypeOfExpression(expr.left); + if (isTypeUsableAsPropertyName(leftType)) { return narrowTypeByInKeyword(type, leftType, assumeTrue); } } @@ -67898,7 +68387,7 @@ ${lanes.join("\n")} if (!witnesses) { return type; } - const defaultIndex = findIndex(switchStatement.caseBlock.clauses, (clause) => clause.kind === 296 /* DefaultClause */); + const defaultIndex = findIndex(switchStatement.caseBlock.clauses, (clause) => clause.kind === 297 /* DefaultClause */); const hasDefaultClause = clauseStart === clauseEnd || defaultIndex >= clauseStart && defaultIndex < clauseEnd; if (hasDefaultClause) { const notEqualFacts = getNotEqualFactsFromTypeofSwitch(clauseStart, clauseEnd, witnesses); @@ -68062,7 +68551,7 @@ ${lanes.join("\n")} case 80 /* Identifier */: if (!isMatchingReference(reference, expr) && inlineLevel < 5) { const symbol = getResolvedSymbol(expr); - if (isConstVariable(symbol)) { + if (isConstantVariable(symbol)) { const declaration = symbol.valueDeclaration; if (declaration && isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isConstantReference(reference)) { inlineLevel++; @@ -68074,17 +68563,17 @@ ${lanes.join("\n")} } case 110 /* ThisKeyword */: case 108 /* SuperKeyword */: - case 210 /* PropertyAccessExpression */: - case 211 /* ElementAccessExpression */: + case 211 /* PropertyAccessExpression */: + case 212 /* ElementAccessExpression */: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 212 /* CallExpression */: + case 213 /* CallExpression */: return narrowTypeByCallExpression(type, expr, assumeTrue); - case 216 /* ParenthesizedExpression */: - case 234 /* NonNullExpression */: + case 217 /* ParenthesizedExpression */: + case 235 /* NonNullExpression */: return narrowType(type, expr.expression, assumeTrue); - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 223 /* PrefixUnaryExpression */: + case 224 /* PrefixUnaryExpression */: if (expr.operator === 54 /* ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } @@ -68110,7 +68599,7 @@ ${lanes.join("\n")} location = location.parent; } if (isExpressionNode(location) && (!isAssignmentTarget(location) || isWriteAccess(location))) { - const type = getTypeOfExpression(location); + const type = removeOptionalTypeMarker(getTypeOfExpression(location)); if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) { return type; } @@ -68122,7 +68611,7 @@ ${lanes.join("\n")} return getNonMissingTypeOfSymbol(symbol); } function getControlFlowContainer(node) { - return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 267 /* ModuleBlock */ || node2.kind === 311 /* SourceFile */ || node2.kind === 171 /* PropertyDeclaration */); + return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 268 /* ModuleBlock */ || node2.kind === 312 /* SourceFile */ || node2.kind === 172 /* PropertyDeclaration */); } function isSymbolAssigned(symbol) { if (!symbol.valueDeclaration) { @@ -68130,8 +68619,8 @@ ${lanes.join("\n")} } const parent2 = getRootDeclaration(symbol.valueDeclaration).parent; const links = getNodeLinks(parent2); - if (!(links.flags & 524288 /* AssignmentsMarked */)) { - links.flags |= 524288 /* AssignmentsMarked */; + if (!(links.flags & 131072 /* AssignmentsMarked */)) { + links.flags |= 131072 /* AssignmentsMarked */; if (!hasParentWithAssignmentsMarked(parent2)) { markNodeAssignments(parent2); } @@ -68139,7 +68628,7 @@ ${lanes.join("\n")} return symbol.isAssigned || false; } function hasParentWithAssignmentsMarked(node) { - return !!findAncestor(node.parent, (node2) => (isFunctionLike(node2) || isCatchClause(node2)) && !!(getNodeLinks(node2).flags & 524288 /* AssignmentsMarked */)); + return !!findAncestor(node.parent, (node2) => (isFunctionLike(node2) || isCatchClause(node2)) && !!(getNodeLinks(node2).flags & 131072 /* AssignmentsMarked */)); } function markNodeAssignments(node) { if (node.kind === 80 /* Identifier */) { @@ -68153,8 +68642,8 @@ ${lanes.join("\n")} forEachChild(node, markNodeAssignments); } } - function isConstVariable(symbol) { - return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 2 /* Const */) !== 0; + function isConstantVariable(symbol) { + return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 6 /* Constant */) !== 0; } function parameterInitializerContainsUndefined(declaration) { const links = getNodeLinks(declaration); @@ -68173,12 +68662,12 @@ ${lanes.join("\n")} return links.parameterInitializerContainsUndefined; } function removeOptionalityFromDeclaredType(declaredType, declaration) { - const removeUndefined = strictNullChecks && declaration.kind === 168 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !parameterInitializerContainsUndefined(declaration); + const removeUndefined = strictNullChecks && declaration.kind === 169 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !parameterInitializerContainsUndefined(declaration); return removeUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType; } function isConstraintPosition(type, node) { const parent2 = node.parent; - return parent2.kind === 210 /* PropertyAccessExpression */ || parent2.kind === 165 /* QualifiedName */ || parent2.kind === 212 /* CallExpression */ && parent2.expression === node || parent2.kind === 211 /* ElementAccessExpression */ && parent2.expression === node && !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent2.argumentExpression))); + return parent2.kind === 211 /* PropertyAccessExpression */ || parent2.kind === 166 /* QualifiedName */ || parent2.kind === 213 /* CallExpression */ && parent2.expression === node || parent2.kind === 212 /* ElementAccessExpression */ && parent2.expression === node && !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent2.argumentExpression))); } function isGenericTypeWithUnionConstraint(type) { return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithUnionConstraint) : !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */)); @@ -68221,9 +68710,13 @@ ${lanes.join("\n")} symbol, /*excludes*/ 111551 /* Value */ - ) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* Value */)) { + ) && !isInTypeQuery(location)) { const target = resolveAlias(symbol); - if (getAllSymbolFlags(target) & (111551 /* Value */ | 1048576 /* ExportValue */)) { + if (getSymbolFlags( + symbol, + /*excludeTypeOnlyMeanings*/ + true + ) & (111551 /* Value */ | 1048576 /* ExportValue */)) { if (getIsolatedModules(compilerOptions) || shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location) || !isConstEnumOrConstEnumOnlyModule(getExportSymbolOfValueSymbolIfExported(target))) { markAliasSymbolAsReferenced(symbol); } else { @@ -68239,14 +68732,14 @@ ${lanes.join("\n")} if (declaration) { if (isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) { const parent2 = declaration.parent.parent; - if (parent2.kind === 259 /* VariableDeclaration */ && getCombinedNodeFlags(declaration) & 2 /* Const */ || parent2.kind === 168 /* Parameter */) { + if (parent2.kind === 260 /* VariableDeclaration */ && getCombinedNodeFlagsCached(declaration) & 6 /* Constant */ || parent2.kind === 169 /* Parameter */) { const links = getNodeLinks(parent2); - if (!(links.flags & 16777216 /* InCheckIdentifier */)) { - links.flags |= 16777216 /* InCheckIdentifier */; + if (!(links.flags & 4194304 /* InCheckIdentifier */)) { + links.flags |= 4194304 /* InCheckIdentifier */; const parentType = getTypeForBindingElementParent(parent2, 0 /* Normal */); const parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType); - links.flags &= ~16777216 /* InCheckIdentifier */; - if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* Union */ && !(parent2.kind === 168 /* Parameter */ && isSymbolAssigned(symbol))) { + links.flags &= ~4194304 /* InCheckIdentifier */; + if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* Union */ && !(parent2.kind === 169 /* Parameter */ && isSymbolAssigned(symbol))) { const pattern = declaration.parent; const narrowedType = getFlowTypeOfReference( pattern, @@ -68298,15 +68791,15 @@ ${lanes.join("\n")} } if (symbol === argumentsSymbol) { if (isInPropertyInitializerOrClassStaticBlock(node)) { - error(node, Diagnostics.arguments_cannot_be_referenced_in_property_initializers); + error2(node, Diagnostics.arguments_cannot_be_referenced_in_property_initializers); return errorType; } const container = getContainingFunction(node); if (languageVersion < 2 /* ES2015 */) { - if (container.kind === 218 /* ArrowFunction */) { - error(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); + if (container.kind === 219 /* ArrowFunction */) { + error2(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } else if (hasSyntacticModifier(container, 512 /* Async */)) { - error(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); + error2(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); } } getNodeLinks(container).flags |= 512 /* CaptureArguments */; @@ -68322,17 +68815,7 @@ ${lanes.join("\n")} } let declaration = localOrExportSymbol.valueDeclaration; if (declaration && localOrExportSymbol.flags & 32 /* Class */) { - if (declaration.kind === 262 /* ClassDeclaration */ && nodeIsDecorated(legacyDecorators, declaration)) { - let container = getContainingClass(node); - while (container !== void 0) { - if (container === declaration && container.name !== node) { - getNodeLinks(declaration).flags |= 1048576 /* ClassWithConstructorReference */; - getNodeLinks(node).flags |= 2097152 /* ConstructorReferenceInClass */; - break; - } - container = getContainingClass(container); - } - } else if (declaration.kind === 230 /* ClassExpression */) { + if (isClassLike(declaration) && declaration.name !== node) { let container = getThisContainer( node, /*includeArrowFunctions*/ @@ -68340,14 +68823,7 @@ ${lanes.join("\n")} /*includeClassComputedPropertyName*/ false ); - while (container.kind !== 311 /* SourceFile */) { - if (container.parent === declaration) { - if (isPropertyDeclaration(container) && isStatic(container) || isClassStaticBlockDeclaration(container)) { - getNodeLinks(declaration).flags |= 1048576 /* ClassWithConstructorReference */; - getNodeLinks(node).flags |= 2097152 /* ConstructorReferenceInClass */; - } - break; - } + while (container.kind !== 312 /* SourceFile */ && container.parent !== declaration) { container = getThisContainer( container, /*includeArrowFunctions*/ @@ -68356,6 +68832,11 @@ ${lanes.join("\n")} false ); } + if (container.kind !== 312 /* SourceFile */) { + getNodeLinks(declaration).flags |= 262144 /* ContainsConstructorReference */; + getNodeLinks(container).flags |= 262144 /* ContainsConstructorReference */; + getNodeLinks(node).flags |= 536870912 /* ConstructorReference */; + } } } checkNestedBlockScopedBinding(node, symbol); @@ -68364,14 +68845,14 @@ ${lanes.join("\n")} if (assignmentKind) { if (!(localOrExportSymbol.flags & 3 /* Variable */) && !(isInJSFile(node) && localOrExportSymbol.flags & 512 /* ValueModule */)) { const assignmentError = localOrExportSymbol.flags & 384 /* Enum */ ? Diagnostics.Cannot_assign_to_0_because_it_is_an_enum : localOrExportSymbol.flags & 32 /* Class */ ? Diagnostics.Cannot_assign_to_0_because_it_is_a_class : localOrExportSymbol.flags & 1536 /* Module */ ? Diagnostics.Cannot_assign_to_0_because_it_is_a_namespace : localOrExportSymbol.flags & 16 /* Function */ ? Diagnostics.Cannot_assign_to_0_because_it_is_a_function : localOrExportSymbol.flags & 2097152 /* Alias */ ? Diagnostics.Cannot_assign_to_0_because_it_is_an_import : Diagnostics.Cannot_assign_to_0_because_it_is_not_a_variable; - error(node, assignmentError, symbolToString(symbol)); + error2(node, assignmentError, symbolToString(symbol)); return errorType; } if (isReadonlySymbol(localOrExportSymbol)) { if (localOrExportSymbol.flags & 3 /* Variable */) { - error(node, Diagnostics.Cannot_assign_to_0_because_it_is_a_constant, symbolToString(symbol)); + error2(node, Diagnostics.Cannot_assign_to_0_because_it_is_a_constant, symbolToString(symbol)); } else { - error(node, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(symbol)); + error2(node, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(symbol)); } return errorType; } @@ -68390,30 +68871,30 @@ ${lanes.join("\n")} return type; } type = getNarrowableTypeForReference(type, node, checkMode); - const isParameter2 = getRootDeclaration(declaration).kind === 168 /* Parameter */; + const isParameter2 = getRootDeclaration(declaration).kind === 169 /* Parameter */; const declarationContainer = getControlFlowContainer(declaration); let flowContainer = getControlFlowContainer(node); const isOuterVariable = flowContainer !== declarationContainer; const isSpreadDestructuringAssignmentTarget = node.parent && node.parent.parent && isSpreadAssignment(node.parent) && isDestructuringAssignmentTarget(node.parent.parent); const isModuleExports = symbol.flags & 134217728 /* ModuleExports */; const typeIsAutomatic = type === autoType || type === autoArrayType; - const isAutomaticTypeInNonNull = typeIsAutomatic && node.parent.kind === 234 /* NonNullExpression */; - while (flowContainer !== declarationContainer && (flowContainer.kind === 217 /* FunctionExpression */ || flowContainer.kind === 218 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter2 && !isSymbolAssigned(localOrExportSymbol))) { + const isAutomaticTypeInNonNull = typeIsAutomatic && node.parent.kind === 235 /* NonNullExpression */; + while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType || isParameter2 && !isSymbolAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } - const assumeInitialized = isParameter2 || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 280 /* ExportSpecifier */) || node.parent.kind === 234 /* NonNullExpression */ || declaration.kind === 259 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* Ambient */; + const assumeInitialized = isParameter2 || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 281 /* ExportSpecifier */) || node.parent.kind === 235 /* NonNullExpression */ || declaration.kind === 260 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 33554432 /* Ambient */; const initialType = isAutomaticTypeInNonNull ? undefinedType : assumeInitialized ? isParameter2 ? removeOptionalityFromDeclaredType(type, declaration) : type : typeIsAutomatic ? undefinedType : getOptionalType(type); const flowType = isAutomaticTypeInNonNull ? getNonNullableType(getFlowTypeOfReference(node, type, initialType, flowContainer)) : getFlowTypeOfReference(node, type, initialType, flowContainer); if (!isEvolvingArrayOperationTarget(node) && (type === autoType || type === autoArrayType)) { if (flowType === autoType || flowType === autoArrayType) { if (noImplicitAny) { - error(getNameOfDeclaration(declaration), Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined, symbolToString(symbol), typeToString(flowType)); - error(node, Diagnostics.Variable_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType)); + error2(getNameOfDeclaration(declaration), Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined, symbolToString(symbol), typeToString(flowType)); + error2(node, Diagnostics.Variable_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType)); } return convertAutoToAny(flowType); } } else if (!assumeInitialized && !containsUndefinedType(type) && containsUndefinedType(flowType)) { - error(node, Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol)); + error2(node, Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol)); return type; } return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType; @@ -68455,7 +68936,7 @@ ${lanes.join("\n")} )); } function checkNestedBlockScopedBinding(node, symbol) { - if (languageVersion >= 2 /* ES2015 */ || (symbol.flags & (2 /* BlockScopedVariable */ | 32 /* Class */)) === 0 || !symbol.valueDeclaration || isSourceFile(symbol.valueDeclaration) || symbol.valueDeclaration.parent.kind === 298 /* CatchClause */) { + if (languageVersion >= 2 /* ES2015 */ || (symbol.flags & (2 /* BlockScopedVariable */ | 32 /* Class */)) === 0 || !symbol.valueDeclaration || isSourceFile(symbol.valueDeclaration) || symbol.valueDeclaration.parent.kind === 299 /* CatchClause */) { return; } const container = getEnclosingBlockScopeContainer(symbol.valueDeclaration); @@ -68465,7 +68946,7 @@ ${lanes.join("\n")} if (isCaptured) { let capturesBlockScopeBindingInLoopBody = true; if (isForStatement(container)) { - const varDeclList = getAncestor(symbol.valueDeclaration, 260 /* VariableDeclarationList */); + const varDeclList = getAncestor(symbol.valueDeclaration, 261 /* VariableDeclarationList */); if (varDeclList && varDeclList.parent === container) { const part = getPartOfForStatementContainingNode(node.parent, container); if (part) { @@ -68484,9 +68965,9 @@ ${lanes.join("\n")} } } if (isForStatement(container)) { - const varDeclList = getAncestor(symbol.valueDeclaration, 260 /* VariableDeclarationList */); + const varDeclList = getAncestor(symbol.valueDeclaration, 261 /* VariableDeclarationList */); if (varDeclList && varDeclList.parent === container && isAssignedInBodyOfForStatement(node, container)) { - getNodeLinks(symbol.valueDeclaration).flags |= 262144 /* NeedsLoopOutParameter */; + getNodeLinks(symbol.valueDeclaration).flags |= 65536 /* NeedsLoopOutParameter */; } } getNodeLinks(symbol.valueDeclaration).flags |= 32768 /* BlockScopedBindingInLoop */; @@ -68501,13 +68982,13 @@ ${lanes.join("\n")} } function isAssignedInBodyOfForStatement(node, container) { let current = node; - while (current.parent.kind === 216 /* ParenthesizedExpression */) { + while (current.parent.kind === 217 /* ParenthesizedExpression */) { current = current.parent; } let isAssigned = false; if (isAssignmentTarget(current)) { isAssigned = true; - } else if (current.parent.kind === 223 /* PrefixUnaryExpression */ || current.parent.kind === 224 /* PostfixUnaryExpression */) { + } else if (current.parent.kind === 224 /* PrefixUnaryExpression */ || current.parent.kind === 225 /* PostfixUnaryExpression */) { const expr = current.parent; isAssigned = expr.operator === 46 /* PlusPlusToken */ || expr.operator === 47 /* MinusMinusToken */; } @@ -68518,7 +68999,7 @@ ${lanes.join("\n")} } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2 /* LexicalThis */; - if (container.kind === 171 /* PropertyDeclaration */ || container.kind === 175 /* Constructor */) { + if (container.kind === 172 /* PropertyDeclaration */ || container.kind === 176 /* Constructor */) { const classNode = container.parent; getNodeLinks(classNode).flags |= 4 /* CaptureThis */; } else { @@ -68543,13 +69024,13 @@ ${lanes.join("\n")} /*noCacheCheck*/ false )) { - error(node, diagnosticMessage); + error2(node, diagnosticMessage); } } } function checkThisInStaticClassFieldInitializerInDecoratedClass(thisExpression, container) { if (isPropertyDeclaration(container) && hasStaticModifier(container) && legacyDecorators && container.initializer && textRangeContainsPositionInclusive(container.initializer, thisExpression.pos) && hasDecorators(container.parent)) { - error(thisExpression, Diagnostics.Cannot_use_this_in_a_static_property_initializer_of_a_decorated_class); + error2(thisExpression, Diagnostics.Cannot_use_this_in_a_static_property_initializer_of_a_decorated_class); } } function checkThisExpression(node) { @@ -68563,11 +69044,11 @@ ${lanes.join("\n")} ); let capturedByArrowFunction = false; let thisInComputedPropertyName = false; - if (container.kind === 175 /* Constructor */) { + if (container.kind === 176 /* Constructor */) { checkThisBeforeSuper(node, container, Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } while (true) { - if (container.kind === 218 /* ArrowFunction */) { + if (container.kind === 219 /* ArrowFunction */) { container = getThisContainer( container, /*includeArrowFunctions*/ @@ -68576,7 +69057,7 @@ ${lanes.join("\n")} ); capturedByArrowFunction = true; } - if (container.kind === 166 /* ComputedPropertyName */) { + if (container.kind === 167 /* ComputedPropertyName */) { container = getThisContainer( container, !capturedByArrowFunction, @@ -68590,18 +69071,18 @@ ${lanes.join("\n")} } checkThisInStaticClassFieldInitializerInDecoratedClass(node, container); if (thisInComputedPropertyName) { - error(node, Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); + error2(node, Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); } else { switch (container.kind) { - case 266 /* ModuleDeclaration */: - error(node, Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); + case 267 /* ModuleDeclaration */: + error2(node, Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); break; - case 265 /* EnumDeclaration */: - error(node, Diagnostics.this_cannot_be_referenced_in_current_location); + case 266 /* EnumDeclaration */: + error2(node, Diagnostics.this_cannot_be_referenced_in_current_location); break; - case 175 /* Constructor */: + case 176 /* Constructor */: if (isInConstructorArgumentInitializer(node, container)) { - error(node, Diagnostics.this_cannot_be_referenced_in_constructor_arguments); + error2(node, Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; } @@ -68618,9 +69099,9 @@ ${lanes.join("\n")} if (noImplicitThis) { const globalThisType2 = getTypeOfSymbol(globalThisSymbol); if (type === globalThisType2 && capturedByArrowFunction) { - error(node, Diagnostics.The_containing_arrow_function_captures_the_global_value_of_this); + error2(node, Diagnostics.The_containing_arrow_function_captures_the_global_value_of_this); } else if (!type) { - const diag2 = error(node, Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation); + const diag2 = error2(node, Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation); if (!isSourceFile(container)) { const outsideThis = tryGetThisTypeAt(container); if (outsideThis && outsideThis !== globalThisType2) { @@ -68693,36 +69174,33 @@ ${lanes.join("\n")} } } function getClassNameFromPrototypeMethod(container) { - if (container.kind === 217 /* FunctionExpression */ && isBinaryExpression(container.parent) && getAssignmentDeclarationKind(container.parent) === 3 /* PrototypeProperty */) { + if (container.kind === 218 /* FunctionExpression */ && isBinaryExpression(container.parent) && getAssignmentDeclarationKind(container.parent) === 3 /* PrototypeProperty */) { return container.parent.left.expression.expression; - } else if (container.kind === 173 /* MethodDeclaration */ && container.parent.kind === 209 /* ObjectLiteralExpression */ && isBinaryExpression(container.parent.parent) && getAssignmentDeclarationKind(container.parent.parent) === 6 /* Prototype */) { + } else if (container.kind === 174 /* MethodDeclaration */ && container.parent.kind === 210 /* ObjectLiteralExpression */ && isBinaryExpression(container.parent.parent) && getAssignmentDeclarationKind(container.parent.parent) === 6 /* Prototype */) { return container.parent.parent.left.expression; - } else if (container.kind === 217 /* FunctionExpression */ && container.parent.kind === 302 /* PropertyAssignment */ && container.parent.parent.kind === 209 /* ObjectLiteralExpression */ && isBinaryExpression(container.parent.parent.parent) && getAssignmentDeclarationKind(container.parent.parent.parent) === 6 /* Prototype */) { + } else if (container.kind === 218 /* FunctionExpression */ && container.parent.kind === 303 /* PropertyAssignment */ && container.parent.parent.kind === 210 /* ObjectLiteralExpression */ && isBinaryExpression(container.parent.parent.parent) && getAssignmentDeclarationKind(container.parent.parent.parent) === 6 /* Prototype */) { return container.parent.parent.parent.left.expression; - } else if (container.kind === 217 /* FunctionExpression */ && isPropertyAssignment(container.parent) && isIdentifier(container.parent.name) && (container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") && isObjectLiteralExpression(container.parent.parent) && isCallExpression(container.parent.parent.parent) && container.parent.parent.parent.arguments[2] === container.parent.parent && getAssignmentDeclarationKind(container.parent.parent.parent) === 9 /* ObjectDefinePrototypeProperty */) { + } else if (container.kind === 218 /* FunctionExpression */ && isPropertyAssignment(container.parent) && isIdentifier(container.parent.name) && (container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") && isObjectLiteralExpression(container.parent.parent) && isCallExpression(container.parent.parent.parent) && container.parent.parent.parent.arguments[2] === container.parent.parent && getAssignmentDeclarationKind(container.parent.parent.parent) === 9 /* ObjectDefinePrototypeProperty */) { return container.parent.parent.parent.arguments[0].expression; } else if (isMethodDeclaration(container) && isIdentifier(container.name) && (container.name.escapedText === "value" || container.name.escapedText === "get" || container.name.escapedText === "set") && isObjectLiteralExpression(container.parent) && isCallExpression(container.parent.parent) && container.parent.parent.arguments[2] === container.parent && getAssignmentDeclarationKind(container.parent.parent) === 9 /* ObjectDefinePrototypeProperty */) { return container.parent.parent.arguments[0].expression; } } function getTypeForThisExpressionFromJSDoc(node) { - const jsdocType = getJSDocType(node); - if (jsdocType && jsdocType.kind === 323 /* JSDocFunctionType */) { - const jsDocFunctionType = jsdocType; - if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && jsDocFunctionType.parameters[0].name.escapedText === "this" /* This */) { - return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); - } - } const thisTag = getJSDocThisTag(node); if (thisTag && thisTag.typeExpression) { return getTypeFromTypeNode(thisTag.typeExpression); } + const signature = getSignatureOfTypeTag(node); + if (signature) { + return getThisTypeOfSignature(signature); + } } function isInConstructorArgumentInitializer(node, constructorDecl) { - return !!findAncestor(node, (n) => isFunctionLikeDeclaration(n) ? "quit" : n.kind === 168 /* Parameter */ && n.parent === constructorDecl); + return !!findAncestor(node, (n) => isFunctionLikeDeclaration(n) ? "quit" : n.kind === 169 /* Parameter */ && n.parent === constructorDecl); } function checkSuperExpression(node) { - const isCallExpression2 = node.parent.kind === 212 /* CallExpression */ && node.parent.expression === node; + const isCallExpression2 = node.parent.kind === 213 /* CallExpression */ && node.parent.expression === node; const immediateContainer = getSuperContainer( node, /*stopOnFunctions*/ @@ -68732,7 +69210,7 @@ ${lanes.join("\n")} let needToCaptureLexicalThis = false; let inAsyncFunction = false; if (!isCallExpression2) { - while (container && container.kind === 218 /* ArrowFunction */) { + while (container && container.kind === 219 /* ArrowFunction */) { if (hasSyntacticModifier(container, 512 /* Async */)) inAsyncFunction = true; container = getSuperContainer( @@ -68747,19 +69225,19 @@ ${lanes.join("\n")} } let nodeCheckFlag = 0; if (!container || !isLegalUsageOfSuperExpression(container)) { - const current = findAncestor(node, (n) => n === container ? "quit" : n.kind === 166 /* ComputedPropertyName */); - if (current && current.kind === 166 /* ComputedPropertyName */) { - error(node, Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); + const current = findAncestor(node, (n) => n === container ? "quit" : n.kind === 167 /* ComputedPropertyName */); + if (current && current.kind === 167 /* ComputedPropertyName */) { + error2(node, Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression2) { - error(node, Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); - } else if (!container || !container.parent || !(isClassLike(container.parent) || container.parent.kind === 209 /* ObjectLiteralExpression */)) { - error(node, Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); + error2(node, Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); + } else if (!container || !container.parent || !(isClassLike(container.parent) || container.parent.kind === 210 /* ObjectLiteralExpression */)) { + error2(node, Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { - error(node, Diagnostics.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class); + error2(node, Diagnostics.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class); } return errorType; } - if (!isCallExpression2 && immediateContainer.kind === 175 /* Constructor */) { + if (!isCallExpression2 && immediateContainer.kind === 176 /* Constructor */) { checkThisBeforeSuper(node, container, Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); } if (isStatic(container) || isCallExpression2) { @@ -68767,7 +69245,7 @@ ${lanes.join("\n")} if (!isCallExpression2 && languageVersion >= 2 /* ES2015 */ && languageVersion <= 8 /* ES2021 */ && (isPropertyDeclaration(container) || isClassStaticBlockDeclaration(container))) { forEachEnclosingBlockScopeContainer(node.parent, (current) => { if (!isSourceFile(current) || isExternalOrCommonJsModule(current)) { - getNodeLinks(current).flags |= 8388608 /* ContainsSuperPropertyInStaticInitializer */; + getNodeLinks(current).flags |= 2097152 /* ContainsSuperPropertyInStaticInitializer */; } }); } @@ -68775,7 +69253,7 @@ ${lanes.join("\n")} nodeCheckFlag = 16 /* SuperInstance */; } getNodeLinks(node).flags |= nodeCheckFlag; - if (container.kind === 173 /* MethodDeclaration */ && inAsyncFunction) { + if (container.kind === 174 /* MethodDeclaration */ && inAsyncFunction) { if (isSuperProperty(node.parent) && isAssignmentTarget(node.parent)) { getNodeLinks(container).flags |= 256 /* MethodWithSuperPropertyAssignmentInAsync */; } else { @@ -68785,9 +69263,9 @@ ${lanes.join("\n")} if (needToCaptureLexicalThis) { captureLexicalThis(node.parent, container); } - if (container.parent.kind === 209 /* ObjectLiteralExpression */) { + if (container.parent.kind === 210 /* ObjectLiteralExpression */) { if (languageVersion < 2 /* ES2015 */) { - error(node, Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); + error2(node, Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return errorType; } else { return anyType; @@ -68795,7 +69273,7 @@ ${lanes.join("\n")} } const classLikeDeclaration = container.parent; if (!getClassExtendsHeritageElement(classLikeDeclaration)) { - error(node, Diagnostics.super_can_only_be_referenced_in_a_derived_class); + error2(node, Diagnostics.super_can_only_be_referenced_in_a_derived_class); return errorType; } const classType = getDeclaredTypeOfSymbol(getSymbolOfDeclaration(classLikeDeclaration)); @@ -68803,20 +69281,20 @@ ${lanes.join("\n")} if (!baseClassType) { return errorType; } - if (container.kind === 175 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { - error(node, Diagnostics.super_cannot_be_referenced_in_constructor_arguments); + if (container.kind === 176 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { + error2(node, Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return errorType; } return nodeCheckFlag === 32 /* SuperStatic */ ? getBaseConstructorTypeOfClass(classType) : getTypeWithThisArgument(baseClassType, classType.thisType); function isLegalUsageOfSuperExpression(container2) { if (isCallExpression2) { - return container2.kind === 175 /* Constructor */; + return container2.kind === 176 /* Constructor */; } else { - if (isClassLike(container2.parent) || container2.parent.kind === 209 /* ObjectLiteralExpression */) { + if (isClassLike(container2.parent) || container2.parent.kind === 210 /* ObjectLiteralExpression */) { if (isStatic(container2)) { - return container2.kind === 173 /* MethodDeclaration */ || container2.kind === 172 /* MethodSignature */ || container2.kind === 176 /* GetAccessor */ || container2.kind === 177 /* SetAccessor */ || container2.kind === 171 /* PropertyDeclaration */ || container2.kind === 174 /* ClassStaticBlockDeclaration */; + return container2.kind === 174 /* MethodDeclaration */ || container2.kind === 173 /* MethodSignature */ || container2.kind === 177 /* GetAccessor */ || container2.kind === 178 /* SetAccessor */ || container2.kind === 172 /* PropertyDeclaration */ || container2.kind === 175 /* ClassStaticBlockDeclaration */; } else { - return container2.kind === 173 /* MethodDeclaration */ || container2.kind === 172 /* MethodSignature */ || container2.kind === 176 /* GetAccessor */ || container2.kind === 177 /* SetAccessor */ || container2.kind === 171 /* PropertyDeclaration */ || container2.kind === 170 /* PropertySignature */ || container2.kind === 175 /* Constructor */; + return container2.kind === 174 /* MethodDeclaration */ || container2.kind === 173 /* MethodSignature */ || container2.kind === 177 /* GetAccessor */ || container2.kind === 178 /* SetAccessor */ || container2.kind === 172 /* PropertyDeclaration */ || container2.kind === 171 /* PropertySignature */ || container2.kind === 176 /* Constructor */; } } } @@ -68824,7 +69302,7 @@ ${lanes.join("\n")} } } function getContainingObjectLiteral(func) { - return (func.kind === 173 /* MethodDeclaration */ || func.kind === 176 /* GetAccessor */ || func.kind === 177 /* SetAccessor */) && func.parent.kind === 209 /* ObjectLiteralExpression */ ? func.parent : func.kind === 217 /* FunctionExpression */ && func.parent.kind === 302 /* PropertyAssignment */ ? func.parent.parent : void 0; + return (func.kind === 174 /* MethodDeclaration */ || func.kind === 177 /* GetAccessor */ || func.kind === 178 /* SetAccessor */) && func.parent.kind === 210 /* ObjectLiteralExpression */ ? func.parent : func.kind === 218 /* FunctionExpression */ && func.parent.kind === 303 /* PropertyAssignment */ ? func.parent.parent : void 0; } function getThisTypeArgument(type) { return getObjectFlags(type) & 4 /* Reference */ && type.target === globalThisType ? getTypeArguments(type)[0] : void 0; @@ -68834,8 +69312,27 @@ ${lanes.join("\n")} return t.flags & 2097152 /* Intersection */ ? forEach(t.types, getThisTypeArgument) : getThisTypeArgument(t); }); } + function getThisTypeOfObjectLiteralFromContextualType(containingLiteral, contextualType) { + let literal = containingLiteral; + let type = contextualType; + while (type) { + const thisType = getThisTypeFromContextualType(type); + if (thisType) { + return thisType; + } + if (literal.parent.kind !== 303 /* PropertyAssignment */) { + break; + } + literal = literal.parent.parent; + type = getApparentTypeOfContextualType( + literal, + /*contextFlags*/ + void 0 + ); + } + } function getContextualThisParameterType(func) { - if (func.kind === 218 /* ArrowFunction */) { + if (func.kind === 219 /* ArrowFunction */) { return void 0; } if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { @@ -68856,27 +69353,14 @@ ${lanes.join("\n")} /*contextFlags*/ void 0 ); - let literal = containingLiteral; - let type = contextualType; - while (type) { - const thisType = getThisTypeFromContextualType(type); - if (thisType) { - return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral))); - } - if (literal.parent.kind !== 302 /* PropertyAssignment */) { - break; - } - literal = literal.parent.parent; - type = getApparentTypeOfContextualType( - literal, - /*contextFlags*/ - void 0 - ); + const thisType = getThisTypeOfObjectLiteralFromContextualType(containingLiteral, contextualType); + if (thisType) { + return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral))); } return getWidenedType(contextualType ? getNonNullableType(contextualType) : checkExpressionCached(containingLiteral)); } const parent2 = walkUpParenthesizedExpressions(func.parent); - if (parent2.kind === 225 /* BinaryExpression */ && parent2.operatorToken.kind === 64 /* EqualsToken */) { + if (parent2.kind === 226 /* BinaryExpression */ && parent2.operatorToken.kind === 64 /* EqualsToken */) { const target = parent2.left; if (isAccessExpression(target)) { const { expression } = target; @@ -68931,11 +69415,11 @@ ${lanes.join("\n")} return getTypeFromTypeNode(typeNode); } switch (declaration.kind) { - case 168 /* Parameter */: + case 169 /* Parameter */: return getContextuallyTypedParameterType(declaration); - case 207 /* BindingElement */: + case 208 /* BindingElement */: return getContextualTypeForBindingElement(declaration, contextFlags); - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: if (isStatic(declaration)) { return getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags); } @@ -68944,10 +69428,10 @@ ${lanes.join("\n")} function getContextualTypeForBindingElement(declaration, contextFlags) { const parent2 = declaration.parent.parent; const name = declaration.propertyName || declaration.name; - const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */); + const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 208 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */); if (!parentType || isBindingPattern(name) || isComputedNonLiteralName(name)) return void 0; - if (parent2.name.kind === 206 /* ArrayBindingPattern */) { + if (parent2.name.kind === 207 /* ArrayBindingPattern */) { const index = indexOfNode(declaration.parent.elements, declaration); if (index < 0) return void 0; @@ -69097,7 +69581,7 @@ ${lanes.join("\n")} return signature ? getOrCreateTypeFromSignature(signature) : void 0; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 214 /* TaggedTemplateExpression */) { + if (template.parent.kind === 215 /* TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return void 0; @@ -69315,7 +69799,7 @@ ${lanes.join("\n")} } function getContextualTypeForObjectLiteralMethod(node, contextFlags) { Debug.assert(isObjectLiteralMethod(node)); - if (node.flags & 33554432 /* InWithStatement */) { + if (node.flags & 67108864 /* InWithStatement */) { return void 0; } return getContextualTypeForObjectLiteralElement(node, contextFlags); @@ -69451,16 +69935,17 @@ ${lanes.join("\n")} case 9 /* NumericLiteral */: case 10 /* BigIntLiteral */: case 15 /* NoSubstitutionTemplateLiteral */: + case 228 /* TemplateExpression */: case 112 /* TrueKeyword */: case 97 /* FalseKeyword */: case 106 /* NullKeyword */: case 80 /* Identifier */: case 157 /* UndefinedKeyword */: return true; - case 210 /* PropertyAccessExpression */: - case 216 /* ParenthesizedExpression */: + case 211 /* PropertyAccessExpression */: + case 217 /* ParenthesizedExpression */: return isPossiblyDiscriminantValue(node.expression); - case 293 /* JsxExpression */: + case 294 /* JsxExpression */: return !node.expression || isPossiblyDiscriminantValue(node.expression); } return false; @@ -69470,7 +69955,7 @@ ${lanes.join("\n")} contextualType, concatenate( map( - filter(node.properties, (p) => !!p.symbol && p.kind === 302 /* PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName)), + filter(node.properties, (p) => !!p.symbol && p.kind === 303 /* PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName)), (prop) => [() => getContextFreeTypeOfExpression(prop.initializer), prop.symbol.escapedName] ), map( @@ -69490,7 +69975,7 @@ ${lanes.join("\n")} contextualType, concatenate( map( - filter(node.properties, (p) => !!p.symbol && p.kind === 290 /* JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer))), + filter(node.properties, (p) => !!p.symbol && p.kind === 291 /* JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer))), (prop) => [!prop.initializer ? () => trueType : () => getContextFreeTypeOfExpression(prop.initializer), prop.symbol.escapedName] ), map( @@ -69555,7 +70040,7 @@ ${lanes.join("\n")} } function getContextualType2(node, contextFlags) { var _a; - if (node.flags & 33554432 /* InWithStatement */) { + if (node.flags & 67108864 /* InWithStatement */) { return void 0; } const index = findContextualNode( @@ -69568,47 +70053,47 @@ ${lanes.join("\n")} } const { parent: parent2 } = node; switch (parent2.kind) { - case 259 /* VariableDeclaration */: - case 168 /* Parameter */: - case 171 /* PropertyDeclaration */: - case 170 /* PropertySignature */: - case 207 /* BindingElement */: + case 260 /* VariableDeclaration */: + case 169 /* Parameter */: + case 172 /* PropertyDeclaration */: + case 171 /* PropertySignature */: + case 208 /* BindingElement */: return getContextualTypeForInitializerExpression(node, contextFlags); - case 218 /* ArrowFunction */: - case 252 /* ReturnStatement */: + case 219 /* ArrowFunction */: + case 253 /* ReturnStatement */: return getContextualTypeForReturnExpression(node, contextFlags); - case 228 /* YieldExpression */: + case 229 /* YieldExpression */: return getContextualTypeForYieldOperand(parent2, contextFlags); - case 222 /* AwaitExpression */: + case 223 /* AwaitExpression */: return getContextualTypeForAwaitOperand(parent2, contextFlags); - case 212 /* CallExpression */: - case 213 /* NewExpression */: + case 213 /* CallExpression */: + case 214 /* NewExpression */: return getContextualTypeForArgument(parent2, node); - case 169 /* Decorator */: + case 170 /* Decorator */: return getContextualTypeForDecorator(parent2); - case 215 /* TypeAssertionExpression */: - case 233 /* AsExpression */: + case 216 /* TypeAssertionExpression */: + case 234 /* AsExpression */: return isConstTypeReference(parent2.type) ? getContextualType2(parent2, contextFlags) : getTypeFromTypeNode(parent2.type); - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node, contextFlags); - case 302 /* PropertyAssignment */: - case 303 /* ShorthandPropertyAssignment */: + case 303 /* PropertyAssignment */: + case 304 /* ShorthandPropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent2, contextFlags); - case 304 /* SpreadAssignment */: + case 305 /* SpreadAssignment */: return getContextualType2(parent2.parent, contextFlags); - case 208 /* ArrayLiteralExpression */: { + case 209 /* ArrayLiteralExpression */: { const arrayLiteral = parent2; const type = getApparentTypeOfContextualType(arrayLiteral, contextFlags); const elementIndex = indexOfNode(arrayLiteral.elements, node); const spreadIndices = (_a = getNodeLinks(arrayLiteral)).spreadIndices ?? (_a.spreadIndices = getSpreadIndices(arrayLiteral.elements)); return getContextualTypeForElementExpression(type, elementIndex, arrayLiteral.elements.length, spreadIndices.first, spreadIndices.last); } - case 226 /* ConditionalExpression */: + case 227 /* ConditionalExpression */: return getContextualTypeForConditionalOperand(node, contextFlags); - case 238 /* TemplateSpan */: - Debug.assert(parent2.parent.kind === 227 /* TemplateExpression */); + case 239 /* TemplateSpan */: + Debug.assert(parent2.parent.kind === 228 /* TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent2.parent, node); - case 216 /* ParenthesizedExpression */: { + case 217 /* ParenthesizedExpression */: { if (isInJSFile(parent2)) { if (isJSDocSatisfiesExpression(parent2)) { return getTypeFromTypeNode(getJSDocSatisfiesExpressionType(parent2)); @@ -69620,19 +70105,19 @@ ${lanes.join("\n")} } return getContextualType2(parent2, contextFlags); } - case 234 /* NonNullExpression */: + case 235 /* NonNullExpression */: return getContextualType2(parent2, contextFlags); - case 237 /* SatisfiesExpression */: + case 238 /* SatisfiesExpression */: return getTypeFromTypeNode(parent2.type); - case 276 /* ExportAssignment */: + case 277 /* ExportAssignment */: return tryGetTypeFromEffectiveTypeNode(parent2); - case 293 /* JsxExpression */: + case 294 /* JsxExpression */: return getContextualTypeForJsxExpression(parent2, contextFlags); - case 290 /* JsxAttribute */: - case 292 /* JsxSpreadAttribute */: + case 291 /* JsxAttribute */: + case 293 /* JsxSpreadAttribute */: return getContextualTypeForJsxAttribute(parent2, contextFlags); - case 285 /* JsxOpeningElement */: - case 284 /* JsxSelfClosingElement */: + case 286 /* JsxOpeningElement */: + case 285 /* JsxSelfClosingElement */: return getContextualJsxElementAttributesType(parent2, contextFlags); } return void 0; @@ -69759,7 +70244,7 @@ ${lanes.join("\n")} let attributesType = forcedLookupLocation === void 0 ? getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType) : forcedLookupLocation === "" ? getReturnTypeOfSignature(sig) : getJsxPropsTypeForSignatureFromMember(sig, forcedLookupLocation); if (!attributesType) { if (!!forcedLookupLocation && !!length(context.attributes.properties)) { - error(context, Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, unescapeLeadingUnderscores(forcedLookupLocation)); + error2(context, Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, unescapeLeadingUnderscores(forcedLookupLocation)); } return unknownType; } @@ -69861,7 +70346,7 @@ ${lanes.join("\n")} /*resolvedTypePredicate*/ void 0, minArgCount, - (left.flags | right.flags) & 39 /* PropagatingFlags */ + (left.flags | right.flags) & 167 /* PropagatingFlags */ ); result.compositeKind = 2097152 /* Intersection */; result.compositeSignatures = concatenate(left.compositeKind === 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]); @@ -69892,7 +70377,7 @@ ${lanes.join("\n")} return isFunctionExpressionOrArrowFunction(node) || isObjectLiteralMethod(node) ? getContextualSignature(node) : void 0; } function getContextualSignature(node) { - Debug.assert(node.kind !== 173 /* MethodDeclaration */ || isObjectLiteralMethod(node)); + Debug.assert(node.kind !== 174 /* MethodDeclaration */ || isObjectLiteralMethod(node)); const typeTagSignature = getSignatureOfTypeTag(node); if (typeTagSignature) { return typeTagSignature; @@ -69943,7 +70428,11 @@ ${lanes.join("\n")} return node.isSpread ? getIndexedAccessType(node.type, numberType) : node.type; } function hasDefaultValue(node) { - return node.kind === 207 /* BindingElement */ && !!node.initializer || node.kind === 225 /* BinaryExpression */ && node.operatorToken.kind === 64 /* EqualsToken */; + return node.kind === 208 /* BindingElement */ && !!node.initializer || node.kind === 226 /* BinaryExpression */ && node.operatorToken.kind === 64 /* EqualsToken */; + } + function isSpreadIntoCallOrNew(node) { + const parent2 = walkUpParenthesizedExpressions(node.parent); + return isSpreadElement(parent2) && isCallOrNewExpression(parent2.parent); } function checkArrayLiteral(node, checkMode, forceTuple) { const elements = node.elements; @@ -69952,18 +70441,17 @@ ${lanes.join("\n")} const elementFlags = []; pushCachedContextualType(node); const inDestructuringPattern = isAssignmentTarget(node); - const isSpreadIntoCallOrNew = isSpreadElement(node.parent) && isCallOrNewExpression(node.parent.parent); - const inConstContext = isSpreadIntoCallOrNew || isConstContext(node); + const inConstContext = isConstContext(node); const contextualType = getApparentTypeOfContextualType( node, /*contextFlags*/ void 0 ); - const inTupleContext = isSpreadIntoCallOrNew || !!contextualType && someType(contextualType, isTupleLikeType); + const inTupleContext = isSpreadIntoCallOrNew(node) || !!contextualType && someType(contextualType, isTupleLikeType); let hasOmittedExpression = false; for (let i = 0; i < elementCount; i++) { const e = elements[i]; - if (e.kind === 229 /* SpreadElement */) { + if (e.kind === 230 /* SpreadElement */) { if (languageVersion < 2 /* ES2015 */) { checkExternalEmitHelpers(e, compilerOptions.downlevelIteration ? 1536 /* SpreadIncludes */ : 1024 /* SpreadArray */); } @@ -69987,7 +70475,7 @@ ${lanes.join("\n")} elementTypes.push(checkIteratedTypeOrElementType(33 /* Spread */, spreadType, undefinedType, e.expression)); elementFlags.push(4 /* Rest */); } - } else if (exactOptionalPropertyTypes && e.kind === 231 /* OmittedExpression */) { + } else if (exactOptionalPropertyTypes && e.kind === 232 /* OmittedExpression */) { hasOmittedExpression = true; elementTypes.push(undefinedOrMissingType); elementFlags.push(2 /* Optional */); @@ -70034,7 +70522,7 @@ ${lanes.join("\n")} } function isNumericName(name) { switch (name.kind) { - case 166 /* ComputedPropertyName */: + case 167 /* ComputedPropertyName */: return isNumericComputedName(name); case 80 /* Identifier */: return isNumericLiteralName(name.escapedText); @@ -70051,7 +70539,7 @@ ${lanes.join("\n")} function checkComputedPropertyName(node) { const links = getNodeLinks(node.expression); if (!links.resolvedType) { - if ((isTypeLiteralNode(node.parent.parent) || isClassLike(node.parent.parent) || isInterfaceDeclaration(node.parent.parent)) && isBinaryExpression(node.expression) && node.expression.operatorToken.kind === 103 /* InKeyword */ && node.parent.kind !== 176 /* GetAccessor */ && node.parent.kind !== 177 /* SetAccessor */) { + if ((isTypeLiteralNode(node.parent.parent) || isClassLike(node.parent.parent) || isInterfaceDeclaration(node.parent.parent)) && isBinaryExpression(node.expression) && node.expression.operatorToken.kind === 103 /* InKeyword */ && node.parent.kind !== 177 /* GetAccessor */ && node.parent.kind !== 178 /* SetAccessor */) { return links.resolvedType = errorType; } links.resolvedType = checkExpression(node.expression); @@ -70065,7 +70553,7 @@ ${lanes.join("\n")} } } if (links.resolvedType.flags & 98304 /* Nullable */ || !isTypeAssignableToKind(links.resolvedType, 402653316 /* StringLike */ | 296 /* NumberLike */ | 12288 /* ESSymbolLike */) && !isTypeAssignableTo(links.resolvedType, stringNumberSymbolType)) { - error(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); + error2(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); } } return links.resolvedType; @@ -70120,7 +70608,7 @@ ${lanes.join("\n")} /*contextFlags*/ void 0 ); - const contextualTypeHasPattern = contextualType && contextualType.pattern && (contextualType.pattern.kind === 205 /* ObjectBindingPattern */ || contextualType.pattern.kind === 209 /* ObjectLiteralExpression */); + const contextualTypeHasPattern = contextualType && contextualType.pattern && (contextualType.pattern.kind === 206 /* ObjectBindingPattern */ || contextualType.pattern.kind === 210 /* ObjectLiteralExpression */); const inConstContext = isConstContext(node); const checkFlags = inConstContext ? 8 /* Readonly */ : 0; const isInJavascript = isInJSFile(node) && !isInJsonFile(node); @@ -70139,13 +70627,13 @@ ${lanes.join("\n")} let offset = 0; for (const memberDecl of node.properties) { let member = getSymbolOfDeclaration(memberDecl); - const computedNameType = memberDecl.name && memberDecl.name.kind === 166 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0; - if (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 303 /* ShorthandPropertyAssignment */ || isObjectLiteralMethod(memberDecl)) { - let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : ( + const computedNameType = memberDecl.name && memberDecl.name.kind === 167 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0; + if (memberDecl.kind === 303 /* PropertyAssignment */ || memberDecl.kind === 304 /* ShorthandPropertyAssignment */ || isObjectLiteralMethod(memberDecl)) { + let type = memberDecl.kind === 303 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : ( // avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring // for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`. // we don't want to say "could not find 'a'". - memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode) + memberDecl.kind === 304 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode) ); if (isInJavascript) { const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl); @@ -70163,7 +70651,7 @@ ${lanes.join("\n")} prop.links.nameType = nameType; } if (inDestructuringPattern) { - const isOptional = memberDecl.kind === 302 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer) || memberDecl.kind === 303 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer; + const isOptional = memberDecl.kind === 303 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer) || memberDecl.kind === 304 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer; if (isOptional) { prop.flags |= 16777216 /* Optional */; } @@ -70172,7 +70660,7 @@ ${lanes.join("\n")} if (impliedProp) { prop.flags |= impliedProp.flags & 16777216 /* Optional */; } else if (!compilerOptions.suppressExcessPropertyErrors && !getIndexInfoOfType(contextualType, stringType)) { - error( + error2( memberDecl.name, Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), @@ -70189,13 +70677,13 @@ ${lanes.join("\n")} prop.links.target = member; member = prop; allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop); - if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl)) { + if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && (memberDecl.kind === 303 /* PropertyAssignment */ || memberDecl.kind === 174 /* MethodDeclaration */) && isContextSensitive(memberDecl)) { const inferenceContext = getInferenceContext(node); Debug.assert(inferenceContext); - const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl; + const inferenceNode = memberDecl.kind === 303 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl; addIntraExpressionInferenceSite(inferenceContext, inferenceNode, type); } - } else if (memberDecl.kind === 304 /* SpreadAssignment */) { + } else if (memberDecl.kind === 305 /* SpreadAssignment */) { if (languageVersion < 2 /* ES2015 */) { checkExternalEmitHelpers(memberDecl, 2 /* Assign */); } @@ -70219,12 +70707,12 @@ ${lanes.join("\n")} } spread = getSpreadType(spread, mergedType, node.symbol, objectFlags, inConstContext); } else { - error(memberDecl, Diagnostics.Spread_types_may_only_be_created_from_object_types); + error2(memberDecl, Diagnostics.Spread_types_may_only_be_created_from_object_types); spread = errorType; } continue; } else { - Debug.assert(memberDecl.kind === 176 /* GetAccessor */ || memberDecl.kind === 177 /* SetAccessor */); + Debug.assert(memberDecl.kind === 177 /* GetAccessor */ || memberDecl.kind === 178 /* SetAccessor */); checkNodeDeferred(memberDecl); } if (computedNameType && !(computedNameType.flags & 8576 /* StringOrNumberLiteralOrUnique */)) { @@ -70249,17 +70737,17 @@ ${lanes.join("\n")} if (contextualTypeHasPattern) { const rootPatternParent = findAncestor( contextualType.pattern.parent, - (n) => n.kind === 259 /* VariableDeclaration */ || n.kind === 225 /* BinaryExpression */ || n.kind === 168 /* Parameter */ + (n) => n.kind === 260 /* VariableDeclaration */ || n.kind === 226 /* BinaryExpression */ || n.kind === 169 /* Parameter */ ); const spreadOrOutsideRootObject = findAncestor( node, - (n) => n === rootPatternParent || n.kind === 304 /* SpreadAssignment */ + (n) => n === rootPatternParent || n.kind === 305 /* SpreadAssignment */ ); - if (spreadOrOutsideRootObject.kind !== 304 /* SpreadAssignment */) { + if (spreadOrOutsideRootObject.kind !== 305 /* SpreadAssignment */) { for (const prop of getPropertiesOfType(contextualType)) { if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) { if (!(prop.flags & 16777216 /* Optional */)) { - error( + error2( prop.valueDeclaration || ((_a = tryCast(prop, isTransientSymbol)) == null ? void 0 : _a.links.bindingElement), Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value ); @@ -70334,7 +70822,7 @@ ${lanes.join("\n")} checkJsxOpeningLikeElementOrOpeningFragment(node.openingFragment); const nodeSourceFile = getSourceFileOfNode(node); if (getJSXTransformEnabled(compilerOptions) && (compilerOptions.jsxFactory || nodeSourceFile.pragmas.has("jsx")) && !compilerOptions.jsxFragmentFactory && !nodeSourceFile.pragmas.has("jsxfrag")) { - error(node, compilerOptions.jsxFactory ? Diagnostics.The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_compiler_option : Diagnostics.An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments); + error2(node, compilerOptions.jsxFactory ? Diagnostics.The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_compiler_option : Diagnostics.An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments); } checkJsxChildren(node); return getJsxElementTypeAt(node) || anyType; @@ -70390,7 +70878,7 @@ ${lanes.join("\n")} addIntraExpressionInferenceSite(inferenceContext, inferenceNode, exprType); } } else { - Debug.assert(attributeDecl.kind === 292 /* JsxSpreadAttribute */); + Debug.assert(attributeDecl.kind === 293 /* JsxSpreadAttribute */); if (attributesTable.size > 0) { spread = getSpreadType( spread, @@ -70419,7 +70907,7 @@ ${lanes.join("\n")} checkSpreadPropOverrides(exprType, allAttributesTable, attributeDecl); } } else { - error(attributeDecl.expression, Diagnostics.Spread_types_may_only_be_created_from_object_types); + error2(attributeDecl.expression, Diagnostics.Spread_types_may_only_be_created_from_object_types); typeToIntersect = typeToIntersect ? getIntersectionType([typeToIntersect, exprType]) : exprType; } } @@ -70436,12 +70924,12 @@ ${lanes.join("\n")} ); } } - const parent2 = openingLikeElement.parent.kind === 283 /* JsxElement */ ? openingLikeElement.parent : void 0; + const parent2 = openingLikeElement.parent.kind === 284 /* JsxElement */ ? openingLikeElement.parent : void 0; if (parent2 && parent2.openingElement === openingLikeElement && parent2.children.length > 0) { const childrenTypes = checkJsxChildren(parent2, checkMode); if (!hasSpreadAnyType && jsxChildrenPropertyName && jsxChildrenPropertyName !== "") { if (explicitlySpecifyChildrenAttribute) { - error(attributes, Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, unescapeLeadingUnderscores(jsxChildrenPropertyName)); + error2(attributes, Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, unescapeLeadingUnderscores(jsxChildrenPropertyName)); } const contextualType2 = getApparentTypeOfContextualType( openingLikeElement.attributes, @@ -70495,7 +70983,7 @@ ${lanes.join("\n")} if (!child.containsOnlyTriviaWhiteSpaces) { childrenTypes.push(stringType); } - } else if (child.kind === 293 /* JsxExpression */ && !child.expression) { + } else if (child.kind === 294 /* JsxExpression */ && !child.expression) { continue; } else { childrenTypes.push(checkExpressionForMutableLocation(child, checkMode)); @@ -70508,7 +70996,7 @@ ${lanes.join("\n")} if (!(right.flags & 16777216 /* Optional */)) { const left = props.get(right.escapedName); if (left) { - const diagnostic = error(left.valueDeclaration, Diagnostics._0_is_specified_more_than_once_so_this_usage_will_be_overwritten, unescapeLeadingUnderscores(left.escapedName)); + const diagnostic = error2(left.valueDeclaration, Diagnostics._0_is_specified_more_than_once_so_this_usage_will_be_overwritten, unescapeLeadingUnderscores(left.escapedName)); addRelatedInfo(diagnostic, createDiagnosticForNode(spread, Diagnostics.This_spread_always_overwrites_this_property)); } } @@ -70540,11 +71028,11 @@ ${lanes.join("\n")} links.jsxFlags |= 2 /* IntrinsicIndexedElement */; return links.resolvedSymbol = intrinsicElementsType.symbol; } - error(node, Diagnostics.Property_0_does_not_exist_on_type_1, intrinsicTagNameToString(node.tagName), "JSX." + JsxNames.IntrinsicElements); + error2(node, Diagnostics.Property_0_does_not_exist_on_type_1, intrinsicTagNameToString(node.tagName), "JSX." + JsxNames.IntrinsicElements); return links.resolvedSymbol = unknownSymbol; } else { if (noImplicitAny) { - error(node, Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, unescapeLeadingUnderscores(JsxNames.IntrinsicElements)); + error2(node, Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, unescapeLeadingUnderscores(JsxNames.IntrinsicElements)); } return links.resolvedSymbol = unknownSymbol; } @@ -70627,7 +71115,7 @@ ${lanes.join("\n")} } else if (propertiesOfJsxElementAttribPropInterface.length === 1) { return propertiesOfJsxElementAttribPropInterface[0].escapedName; } else if (propertiesOfJsxElementAttribPropInterface.length > 1 && jsxElementAttribPropInterfaceSym.declarations) { - error(jsxElementAttribPropInterfaceSym.declarations[0], Diagnostics.The_global_type_JSX_0_may_not_have_more_than_one_property, unescapeLeadingUnderscores(nameOfAttribPropContainer)); + error2(jsxElementAttribPropInterfaceSym.declarations[0], Diagnostics.The_global_type_JSX_0_may_not_have_more_than_one_property, unescapeLeadingUnderscores(nameOfAttribPropContainer)); } } return void 0; @@ -70650,7 +71138,7 @@ ${lanes.join("\n")} } else if (elementType.flags & 128 /* StringLiteral */) { const intrinsicType = getIntrinsicAttributesTypeFromStringLiteralType(elementType, caller); if (!intrinsicType) { - error(caller, Diagnostics.Property_0_does_not_exist_on_type_1, elementType.value, "JSX." + JsxNames.IntrinsicElements); + error2(caller, Diagnostics.Property_0_does_not_exist_on_type_1, elementType.value, "JSX." + JsxNames.IntrinsicElements); return emptyArray; } else { const fakeSignature = createSignatureForJSXIntrinsic(caller, intrinsicType); @@ -70776,11 +71264,11 @@ ${lanes.join("\n")} } function checkJsxPreconditions(errorNode) { if ((compilerOptions.jsx || 0 /* None */) === 0 /* None */) { - error(errorNode, Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided); + error2(errorNode, Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided); } if (getJsxElementTypeAt(errorNode) === void 0) { if (noImplicitAny) { - error(errorNode, Diagnostics.JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist); + error2(errorNode, Diagnostics.JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist); } } } @@ -70872,7 +71360,7 @@ ${lanes.join("\n")} if (node.expression) { const type = checkExpression(node.expression, checkMode); if (node.dotDotDotToken && type !== anyType && !isArrayType(type)) { - error(node, Diagnostics.JSX_spread_child_must_be_an_array_type); + error2(node, Diagnostics.JSX_spread_child_must_be_an_array_type); } return type; } else { @@ -70880,7 +71368,7 @@ ${lanes.join("\n")} } } function getDeclarationNodeFlagsFromSymbol(s) { - return s.valueDeclaration ? getCombinedNodeFlags(s.valueDeclaration) : 0; + return s.valueDeclaration ? getCombinedNodeFlagsCached(s.valueDeclaration) : 0; } function isPrototypeProperty(symbol) { if (symbol.flags & 8192 /* Method */ || getCheckFlags(symbol) & 4 /* SyntheticMethod */) { @@ -70892,7 +71380,7 @@ ${lanes.join("\n")} } } function checkPropertyAccessibility(node, isSuper, writing, type, prop, reportError = true) { - const errorNode = !reportError ? void 0 : node.kind === 165 /* QualifiedName */ ? node.right : node.kind === 204 /* ImportType */ ? node : node.kind === 207 /* BindingElement */ && node.propertyName ? node.propertyName : node.name; + const errorNode = !reportError ? void 0 : node.kind === 166 /* QualifiedName */ ? node.right : node.kind === 205 /* ImportType */ ? node : node.kind === 208 /* BindingElement */ && node.propertyName ? node.propertyName : node.name; return checkPropertyAccessibilityAtLocation(node, isSuper, writing, type, prop, errorNode); } function checkPropertyAccessibilityAtLocation(location, isSuper, writing, containingType, prop, errorNode) { @@ -70901,14 +71389,14 @@ ${lanes.join("\n")} if (languageVersion < 2 /* ES2015 */) { if (symbolHasNonMethodDeclaration(prop)) { if (errorNode) { - error(errorNode, Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); + error2(errorNode, Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); } return false; } } if (flags & 256 /* Abstract */) { if (errorNode) { - error( + error2( errorNode, Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), @@ -70922,7 +71410,7 @@ ${lanes.join("\n")} const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); if (declaringClassDeclaration && isNodeUsedDuringClassInitialization(location)) { if (errorNode) { - error( + error2( errorNode, Diagnostics.Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor, symbolToString(prop), @@ -70939,7 +71427,7 @@ ${lanes.join("\n")} const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); if (!isNodeWithinClass(location, declaringClassDeclaration)) { if (errorNode) { - error( + error2( errorNode, Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), @@ -70962,7 +71450,7 @@ ${lanes.join("\n")} enclosingClass = enclosingClass && isClassDerivedFromDeclaringClasses(enclosingClass, prop, writing); if (flags & 32 /* Static */ || !enclosingClass) { if (errorNode) { - error( + error2( errorNode, Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), @@ -70980,7 +71468,7 @@ ${lanes.join("\n")} } if (!containingType || !hasBaseType(containingType, enclosingClass)) { if (errorNode) { - error( + error2( errorNode, Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_This_is_an_instance_of_class_2, symbolToString(prop), @@ -71028,28 +71516,28 @@ ${lanes.join("\n")} function reportObjectPossiblyNullOrUndefinedError(node, facts) { const nodeText2 = isEntityNameExpression(node) ? entityNameToString(node) : void 0; if (node.kind === 106 /* NullKeyword */) { - error(node, Diagnostics.The_value_0_cannot_be_used_here, "null"); + error2(node, Diagnostics.The_value_0_cannot_be_used_here, "null"); return; } if (nodeText2 !== void 0 && nodeText2.length < 100) { if (isIdentifier(node) && nodeText2 === "undefined") { - error(node, Diagnostics.The_value_0_cannot_be_used_here, "undefined"); + error2(node, Diagnostics.The_value_0_cannot_be_used_here, "undefined"); return; } - error( + error2( node, facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ? Diagnostics._0_is_possibly_null_or_undefined : Diagnostics._0_is_possibly_undefined : Diagnostics._0_is_possibly_null, nodeText2 ); } else { - error( + error2( node, facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ? Diagnostics.Object_is_possibly_null_or_undefined : Diagnostics.Object_is_possibly_undefined : Diagnostics.Object_is_possibly_null ); } } function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) { - error( + error2( node, facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ? Diagnostics.Cannot_invoke_an_object_which_is_possibly_null_or_undefined : Diagnostics.Cannot_invoke_an_object_which_is_possibly_undefined : Diagnostics.Cannot_invoke_an_object_which_is_possibly_null ); @@ -71059,11 +71547,11 @@ ${lanes.join("\n")} if (isEntityNameExpression(node)) { const nodeText2 = entityNameToString(node); if (nodeText2.length < 100) { - error(node, Diagnostics._0_is_of_type_unknown, nodeText2); + error2(node, Diagnostics._0_is_of_type_unknown, nodeText2); return errorType; } } - error(node, Diagnostics.Object_is_of_type_unknown); + error2(node, Diagnostics.Object_is_of_type_unknown); return errorType; } const facts = getTypeFacts(type); @@ -71083,20 +71571,20 @@ ${lanes.join("\n")} if (isEntityNameExpression(node)) { const nodeText2 = entityNameToString(node); if (isIdentifier(node) && nodeText2 === "undefined") { - error(node, Diagnostics.The_value_0_cannot_be_used_here, nodeText2); + error2(node, Diagnostics.The_value_0_cannot_be_used_here, nodeText2); return nonNullType; } if (nodeText2.length < 100) { - error(node, Diagnostics._0_is_possibly_undefined, nodeText2); + error2(node, Diagnostics._0_is_possibly_undefined, nodeText2); return nonNullType; } } - error(node, Diagnostics.Object_is_possibly_undefined); + error2(node, Diagnostics.Object_is_possibly_undefined); } return nonNullType; } function checkPropertyAccessExpression(node, checkMode, writeOnly) { - return node.flags & 32 /* OptionalChain */ ? checkPropertyAccessChain(node, checkMode) : checkPropertyAccessExpressionOrQualifiedName(node, node.expression, checkNonNullExpression(node.expression), node.name, checkMode, writeOnly); + return node.flags & 64 /* OptionalChain */ ? checkPropertyAccessChain(node, checkMode) : checkPropertyAccessExpressionOrQualifiedName(node, node.expression, checkNonNullExpression(node.expression), node.name, checkMode, writeOnly); } function checkPropertyAccessChain(node, checkMode) { const leftType = checkExpression(node.expression); @@ -71108,13 +71596,13 @@ ${lanes.join("\n")} return checkPropertyAccessExpressionOrQualifiedName(node, node.left, leftType, node.right, checkMode); } function isMethodAccessForCall(node) { - while (node.parent.kind === 216 /* ParenthesizedExpression */) { + while (node.parent.kind === 217 /* ParenthesizedExpression */) { node = node.parent; } return isCallOrNewExpression(node.parent) && node.parent.expression === node; } function lookupSymbolForPrivateIdentifierDeclaration(propName, location) { - for (let containingClass = getContainingClass(location); !!containingClass; containingClass = getContainingClass(containingClass)) { + for (let containingClass = getContainingClassExcludingClassDecorators(location); !!containingClass; containingClass = getContainingClass(containingClass)) { const { symbol } = containingClass; const name = getSymbolNameForPrivateIdentifier(symbol, propName); const prop = symbol.members && symbol.members.get(name) || symbol.exports && symbol.exports.get(name); @@ -71186,7 +71674,7 @@ ${lanes.join("\n")} const lexicalClass = getContainingClass(lexicalValueDecl); Debug.assert(!!lexicalClass); if (findAncestor(lexicalClass, (n) => typeClass === n)) { - const diagnostic = error( + const diagnostic = error2( right, Diagnostics.The_property_0_cannot_be_accessed_on_type_1_within_this_class_because_it_is_shadowed_by_another_private_identifier_with_the_same_spelling, diagName, @@ -71208,7 +71696,7 @@ ${lanes.join("\n")} return true; } } - error( + error2( right, Diagnostics.Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier, diagName, @@ -71250,18 +71738,24 @@ ${lanes.join("\n")} if (lexicallyScopedSymbol) { return isErrorType(apparentType) ? errorType : apparentType; } - if (!getContainingClass(right)) { + if (getContainingClassExcludingClassDecorators(right) === void 0) { grammarErrorOnNode(right, Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies); return anyType; } } - prop = lexicallyScopedSymbol ? getPrivateIdentifierPropertyOfType(leftType, lexicallyScopedSymbol) : void 0; - if (!prop && checkPrivateIdentifierPropertyAccess(leftType, right, lexicallyScopedSymbol)) { - return errorType; + prop = lexicallyScopedSymbol && getPrivateIdentifierPropertyOfType(leftType, lexicallyScopedSymbol); + if (prop === void 0) { + if (checkPrivateIdentifierPropertyAccess(leftType, right, lexicallyScopedSymbol)) { + return errorType; + } + const containingClass = getContainingClassExcludingClassDecorators(right); + if (containingClass && isPlainJsFile(getSourceFileOfNode(containingClass), compilerOptions.checkJs)) { + grammarErrorOnNode(right, Diagnostics.Private_field_0_must_be_declared_in_an_enclosing_class, idText(right)); + } } else { - const isSetonlyAccessor = prop && prop.flags & 65536 /* SetAccessor */ && !(prop.flags & 32768 /* GetAccessor */); + const isSetonlyAccessor = prop.flags & 65536 /* SetAccessor */ && !(prop.flags & 32768 /* GetAccessor */); if (isSetonlyAccessor && assignmentKind !== 1 /* Definite */) { - error(node, Diagnostics.Private_accessor_was_defined_without_a_getter); + error2(node, Diagnostics.Private_accessor_was_defined_without_a_getter); } } } else { @@ -71277,10 +71771,10 @@ ${lanes.join("\n")} /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ - node.kind === 165 /* QualifiedName */ + node.kind === 166 /* QualifiedName */ ); } - if (isIdentifier(left) && parentSymbol && (getIsolatedModules(compilerOptions) || !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* EnumMember */ && node.parent.kind === 305 /* EnumMember */)) || shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) { + if (isIdentifier(left) && parentSymbol && (getIsolatedModules(compilerOptions) || !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* EnumMember */ && node.parent.kind === 306 /* EnumMember */)) || shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) { markAliasReferenced(parentSymbol, node); } let propType; @@ -71298,9 +71792,9 @@ ${lanes.join("\n")} } if (leftType.symbol === globalThisSymbol) { if (globalThisSymbol.exports.has(right.escapedText) && globalThisSymbol.exports.get(right.escapedText).flags & 418 /* BlockScoped */) { - error(right, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(right.escapedText), typeToString(leftType)); + error2(right, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(right.escapedText), typeToString(leftType)); } else if (noImplicitAny) { - error(right, Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature, typeToString(leftType)); + error2(right, Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature, typeToString(leftType)); } return anyType; } @@ -71310,13 +71804,13 @@ ${lanes.join("\n")} return errorType; } if (indexInfo.isReadonly && (isAssignmentTarget(node) || isDeleteTarget(node))) { - error(node, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(apparentType)); + error2(node, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(apparentType)); } propType = compilerOptions.noUncheckedIndexedAccess && !isAssignmentTarget(node) ? getUnionType([indexInfo.type, missingType]) : indexInfo.type; if (compilerOptions.noPropertyAccessFromIndexSignature && isPropertyAccessExpression(node)) { - error(right, Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0, unescapeLeadingUnderscores(right.escapedText)); + error2(right, Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0, unescapeLeadingUnderscores(right.escapedText)); } - if (indexInfo.declaration && getCombinedNodeFlags(indexInfo.declaration) & 268435456 /* Deprecated */) { + if (indexInfo.declaration && isDeprecatedDeclaration2(indexInfo.declaration)) { addDeprecatedSuggestion(right, [indexInfo.declaration], right.escapedText); } } else { @@ -71329,7 +71823,7 @@ ${lanes.join("\n")} getNodeLinks(node).resolvedSymbol = prop; checkPropertyAccessibility(node, left.kind === 108 /* SuperKeyword */, isWriteAccess(node), apparentType, prop); if (isAssignmentToReadonlyEntity(node, prop, assignmentKind)) { - error(right, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, idText(right)); + error2(right, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, idText(right)); return errorType; } propType = isThisPropertyAccessInConstructor(node, prop) ? autoType : writeOnly || isWriteOnlyAccess(node) ? getWriteTypeOfSymbol(prop) : getTypeOfSymbol(prop); @@ -71364,7 +71858,7 @@ ${lanes.join("\n")} if (declaration && isPropertyWithoutInitializer(declaration)) { if (!isStatic(declaration)) { const flowContainer = getControlFlowContainer(node); - if (flowContainer.kind === 175 /* Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216 /* Ambient */)) { + if (flowContainer.kind === 176 /* Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 33554432 /* Ambient */)) { assumeUninitialized = true; } } @@ -71374,7 +71868,7 @@ ${lanes.join("\n")} } const flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType); if (assumeUninitialized && !containsUndefinedType(propType) && containsUndefinedType(flowType)) { - error(errorNode, Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop)); + error2(errorNode, Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop)); return propType; } return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType; @@ -71386,10 +71880,10 @@ ${lanes.join("\n")} } let diagnosticMessage; const declarationName = idText(right); - if (isInPropertyInitializerOrClassStaticBlock(node) && !isOptionalPropertyDeclaration(valueDeclaration) && !(isAccessExpression(node) && isAccessExpression(node.expression)) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) && !(isMethodDeclaration(valueDeclaration) && getCombinedModifierFlags(valueDeclaration) & 32 /* Static */) && (compilerOptions.useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) { - diagnosticMessage = error(right, Diagnostics.Property_0_is_used_before_its_initialization, declarationName); - } else if (valueDeclaration.kind === 262 /* ClassDeclaration */ && node.parent.kind !== 182 /* TypeReference */ && !(valueDeclaration.flags & 16777216 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) { - diagnosticMessage = error(right, Diagnostics.Class_0_used_before_its_declaration, declarationName); + if (isInPropertyInitializerOrClassStaticBlock(node) && !isOptionalPropertyDeclaration(valueDeclaration) && !(isAccessExpression(node) && isAccessExpression(node.expression)) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) && !(isMethodDeclaration(valueDeclaration) && getCombinedModifierFlagsCached(valueDeclaration) & 32 /* Static */) && (useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) { + diagnosticMessage = error2(right, Diagnostics.Property_0_is_used_before_its_initialization, declarationName); + } else if (valueDeclaration.kind === 263 /* ClassDeclaration */ && node.parent.kind !== 183 /* TypeReference */ && !(valueDeclaration.flags & 33554432 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) { + diagnosticMessage = error2(right, Diagnostics.Class_0_used_before_its_declaration, declarationName); } if (diagnosticMessage) { addRelatedInfo( @@ -71401,25 +71895,25 @@ ${lanes.join("\n")} function isInPropertyInitializerOrClassStaticBlock(node) { return !!findAncestor(node, (node2) => { switch (node2.kind) { - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: return true; - case 302 /* PropertyAssignment */: - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 304 /* SpreadAssignment */: - case 166 /* ComputedPropertyName */: - case 238 /* TemplateSpan */: - case 293 /* JsxExpression */: - case 290 /* JsxAttribute */: - case 291 /* JsxAttributes */: - case 292 /* JsxSpreadAttribute */: - case 285 /* JsxOpeningElement */: - case 232 /* ExpressionWithTypeArguments */: - case 297 /* HeritageClause */: + case 303 /* PropertyAssignment */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 305 /* SpreadAssignment */: + case 167 /* ComputedPropertyName */: + case 239 /* TemplateSpan */: + case 294 /* JsxExpression */: + case 291 /* JsxAttribute */: + case 292 /* JsxAttributes */: + case 293 /* JsxSpreadAttribute */: + case 286 /* JsxOpeningElement */: + case 233 /* ExpressionWithTypeArguments */: + case 298 /* HeritageClause */: return false; - case 218 /* ArrowFunction */: - case 243 /* ExpressionStatement */: + case 219 /* ArrowFunction */: + case 244 /* ExpressionStatement */: return isBlock(node2.parent) && isClassStaticBlockDeclaration(node2.parent.parent) ? true : "quit"; default: return isExpressionNode(node2) ? false : "quit"; @@ -71664,9 +72158,9 @@ ${lanes.join("\n")} } function isValidPropertyAccess(node, propertyName) { switch (node.kind) { - case 210 /* PropertyAccessExpression */: + case 211 /* PropertyAccessExpression */: return isValidPropertyAccessWithType(node, node.expression.kind === 108 /* SuperKeyword */, propertyName, getWidenedType(checkExpression(node.expression))); - case 165 /* QualifiedName */: + case 166 /* QualifiedName */: return isValidPropertyAccessWithType( node, /*isSuper*/ @@ -71674,7 +72168,7 @@ ${lanes.join("\n")} propertyName, getWidenedType(checkExpression(node.left)) ); - case 204 /* ImportType */: + case 205 /* ImportType */: return isValidPropertyAccessWithType( node, /*isSuper*/ @@ -71687,7 +72181,7 @@ ${lanes.join("\n")} function isValidPropertyAccessForCompletions(node, type, property) { return isPropertyAccessible( node, - node.kind === 210 /* PropertyAccessExpression */ && node.expression.kind === 108 /* SuperKeyword */, + node.kind === 211 /* PropertyAccessExpression */ && node.expression.kind === 108 /* SuperKeyword */, /*isWrite*/ false, type, @@ -71720,7 +72214,7 @@ ${lanes.join("\n")} } function getForInVariableSymbol(node) { const initializer = node.initializer; - if (initializer.kind === 260 /* VariableDeclarationList */) { + if (initializer.kind === 261 /* VariableDeclarationList */) { const variable = initializer.declarations[0]; if (variable && !isBindingPattern(variable.name)) { return getSymbolOfDeclaration(variable); @@ -71741,7 +72235,7 @@ ${lanes.join("\n")} let child = expr; let node = expr.parent; while (node) { - if (node.kind === 248 /* ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { + if (node.kind === 249 /* ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { return true; } child = node; @@ -71752,7 +72246,7 @@ ${lanes.join("\n")} return false; } function checkIndexedAccess(node, checkMode) { - return node.flags & 32 /* OptionalChain */ ? checkElementAccessChain(node, checkMode) : checkElementAccessExpression(node, checkNonNullExpression(node.expression), checkMode); + return node.flags & 64 /* OptionalChain */ ? checkElementAccessChain(node, checkMode) : checkElementAccessExpression(node, checkNonNullExpression(node.expression), checkMode); } function checkElementAccessChain(node, checkMode) { const exprType = checkExpression(node.expression); @@ -71767,7 +72261,7 @@ ${lanes.join("\n")} return objectType; } if (isConstEnumObjectType(objectType) && !isStringLiteralLike(indexExpression)) { - error(indexExpression, Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); + error2(indexExpression, Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return errorType; } const effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType; @@ -71782,11 +72276,11 @@ ${lanes.join("\n")} if (callLikeExpressionMayHaveTypeArguments(node)) { forEach(node.typeArguments, checkSourceElement); } - if (node.kind === 214 /* TaggedTemplateExpression */) { + if (node.kind === 215 /* TaggedTemplateExpression */) { checkExpression(node.template); } else if (isJsxOpeningLikeElement(node)) { checkExpression(node.attributes); - } else if (node.kind !== 169 /* Decorator */) { + } else if (node.kind !== 170 /* Decorator */) { forEach(node.arguments, (argument) => { checkExpression(argument); }); @@ -71831,7 +72325,7 @@ ${lanes.join("\n")} } } function isSpreadArgument(arg) { - return !!arg && (arg.kind === 229 /* SpreadElement */ || arg.kind === 236 /* SyntheticExpression */ && arg.isSpread); + return !!arg && (arg.kind === 230 /* SpreadElement */ || arg.kind === 237 /* SyntheticExpression */ && arg.isSpread); } function getSpreadArgumentIndex(args) { return findIndex(args, isSpreadArgument); @@ -71847,9 +72341,9 @@ ${lanes.join("\n")} let callIsIncomplete = false; let effectiveParameterCount = getParameterCount(signature); let effectiveMinimumArguments = getMinArgumentCount(signature); - if (node.kind === 214 /* TaggedTemplateExpression */) { + if (node.kind === 215 /* TaggedTemplateExpression */) { argCount = args.length; - if (node.template.kind === 227 /* TemplateExpression */) { + if (node.template.kind === 228 /* TemplateExpression */) { const lastSpan = last(node.template.templateSpans); callIsIncomplete = nodeIsMissing(lastSpan.literal) || !!lastSpan.literal.isUnterminated; } else { @@ -71857,7 +72351,7 @@ ${lanes.join("\n")} Debug.assert(templateLiteral.kind === 15 /* NoSubstitutionTemplateLiteral */); callIsIncomplete = !!templateLiteral.isUnterminated; } - } else if (node.kind === 169 /* Decorator */) { + } else if (node.kind === 170 /* Decorator */) { argCount = getDecoratorArgumentCount(node, signature); } else if (isJsxOpeningLikeElement(node)) { callIsIncomplete = node.attributes.end === node.end; @@ -71868,7 +72362,7 @@ ${lanes.join("\n")} effectiveParameterCount = args.length === 0 ? effectiveParameterCount : 1; effectiveMinimumArguments = Math.min(effectiveMinimumArguments, 1); } else if (!node.arguments) { - Debug.assert(node.kind === 213 /* NewExpression */); + Debug.assert(node.kind === 214 /* NewExpression */); return getMinArgumentCount(signature) === 0; } else { argCount = signatureHelpTrailingComma ? args.length + 1 : args.length; @@ -71964,7 +72458,7 @@ ${lanes.join("\n")} if (isJsxOpeningLikeElement(node)) { return inferJsxTypeArguments(node, signature, checkMode, context); } - if (node.kind !== 169 /* Decorator */) { + if (node.kind !== 170 /* Decorator */) { const skipBindingPatterns = every(signature.typeParameters, (p) => !!getDefaultFromTypeParameter(p)); const contextualType = getContextualType2(node, skipBindingPatterns ? 8 /* SkipBindingPatterns */ : 0 /* None */); if (contextualType) { @@ -72001,7 +72495,7 @@ ${lanes.join("\n")} } for (let i = 0; i < argCount; i++) { const arg = args[i]; - if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 32 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) { + if (arg.kind !== 232 /* OmittedExpression */) { const paramType = getTypeAtPosition(signature, i); if (couldContainTypeVariables(paramType)) { const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode); @@ -72029,11 +72523,11 @@ ${lanes.join("\n")} if (index >= argCount - 1) { const arg = args[argCount - 1]; if (isSpreadArgument(arg)) { - const spreadType = arg.kind === 236 /* SyntheticExpression */ ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context, checkMode); + const spreadType = arg.kind === 237 /* SyntheticExpression */ ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context, checkMode); if (isArrayLikeType(spreadType)) { return getMutableArrayOrTupleType(spreadType); } - return createArrayType(checkIteratedTypeOrElementType(33 /* Spread */, spreadType, undefinedType, arg.kind === 229 /* SpreadElement */ ? arg.expression : arg), inConstContext); + return createArrayType(checkIteratedTypeOrElementType(33 /* Spread */, spreadType, undefinedType, arg.kind === 230 /* SpreadElement */ ? arg.expression : arg), inConstContext); } } const types = []; @@ -72042,12 +72536,12 @@ ${lanes.join("\n")} for (let i = index; i < argCount; i++) { const arg = args[i]; if (isSpreadArgument(arg)) { - const spreadType = arg.kind === 236 /* SyntheticExpression */ ? arg.type : checkExpression(arg.expression); + const spreadType = arg.kind === 237 /* SyntheticExpression */ ? arg.type : checkExpression(arg.expression); if (isArrayLikeType(spreadType)) { types.push(spreadType); flags.push(8 /* Variadic */); } else { - types.push(checkIteratedTypeOrElementType(33 /* Spread */, spreadType, undefinedType, arg.kind === 229 /* SpreadElement */ ? arg.expression : arg)); + types.push(checkIteratedTypeOrElementType(33 /* Spread */, spreadType, undefinedType, arg.kind === 230 /* SpreadElement */ ? arg.expression : arg)); flags.push(4 /* Rest */); } } else { @@ -72057,7 +72551,7 @@ ${lanes.join("\n")} types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType)); flags.push(1 /* Required */); } - if (arg.kind === 236 /* SyntheticExpression */ && arg.tupleNameSource) { + if (arg.kind === 237 /* SyntheticExpression */ && arg.tupleNameSource) { names.push(arg.tupleNameSource); } } @@ -72117,8 +72611,9 @@ ${lanes.join("\n")} void 0, checkMode ); + const checkAttributesType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(attributesType) : attributesType; return checkTagNameDoesNotExpectTooManyArguments() && checkTypeRelatedToAndOptionallyElaborate( - attributesType, + checkAttributesType, paramType, relation, reportErrors2 ? node.tagName : void 0, @@ -72234,7 +72729,7 @@ ${lanes.join("\n")} const argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length; for (let i = 0; i < argCount; i++) { const arg = args[i]; - if (arg.kind !== 231 /* OmittedExpression */) { + if (arg.kind !== 232 /* OmittedExpression */) { const paramType = getTypeAtPosition(signature, i); const argType = checkExpressionWithContextualType( arg, @@ -72292,7 +72787,7 @@ ${lanes.join("\n")} } } function getThisArgumentOfCall(node) { - const expression = node.kind === 212 /* CallExpression */ ? node.expression : node.kind === 214 /* TaggedTemplateExpression */ ? node.tag : void 0; + const expression = node.kind === 213 /* CallExpression */ ? node.expression : node.kind === 215 /* TaggedTemplateExpression */ ? node.tag : node.kind === 170 /* Decorator */ && !legacyDecorators ? node.expression : void 0; if (expression) { const callee = skipOuterExpressions(expression); if (isAccessExpression(callee)) { @@ -72307,17 +72802,17 @@ ${lanes.join("\n")} return result; } function getEffectiveCallArguments(node) { - if (node.kind === 214 /* TaggedTemplateExpression */) { + if (node.kind === 215 /* TaggedTemplateExpression */) { const template = node.template; const args2 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())]; - if (template.kind === 227 /* TemplateExpression */) { + if (template.kind === 228 /* TemplateExpression */) { forEach(template.templateSpans, (span) => { args2.push(span.expression); }); } return args2; } - if (node.kind === 169 /* Decorator */) { + if (node.kind === 170 /* Decorator */) { return getEffectiveDecoratorArguments(node); } if (isJsxOpeningLikeElement(node)) { @@ -72329,7 +72824,7 @@ ${lanes.join("\n")} const effectiveArgs = args.slice(0, spreadIndex); for (let i = spreadIndex; i < args.length; i++) { const arg = args[i]; - const spreadType = arg.kind === 229 /* SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); + const spreadType = arg.kind === 230 /* SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); if (spreadType && isTupleType(spreadType)) { forEach(getElementTypes(spreadType), (t, i2) => { var _a; @@ -72368,16 +72863,16 @@ ${lanes.join("\n")} } function getLegacyDecoratorArgumentCount(node, signature) { switch (node.parent.kind) { - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: return 1; - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: return hasAccessorModifier(node.parent) ? 3 : 2; - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: return languageVersion === 0 /* ES3 */ || signature.parameters.length <= 2 ? 2 : 3; - case 168 /* Parameter */: + case 169 /* Parameter */: return 3; default: return Debug.fail(); @@ -72473,7 +72968,7 @@ ${lanes.join("\n")} if (isVoidPromiseError && isInJSFile(node)) { return getDiagnosticForCallNode(node, Diagnostics.Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments); } - const error2 = isDecorator(node) ? hasRestParameter2 ? Diagnostics.The_runtime_will_invoke_the_decorator_with_1_arguments_but_the_decorator_expects_at_least_0 : Diagnostics.The_runtime_will_invoke_the_decorator_with_1_arguments_but_the_decorator_expects_0 : hasRestParameter2 ? Diagnostics.Expected_at_least_0_arguments_but_got_1 : isVoidPromiseError ? Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise : Diagnostics.Expected_0_arguments_but_got_1; + const error3 = isDecorator(node) ? hasRestParameter2 ? Diagnostics.The_runtime_will_invoke_the_decorator_with_1_arguments_but_the_decorator_expects_at_least_0 : Diagnostics.The_runtime_will_invoke_the_decorator_with_1_arguments_but_the_decorator_expects_0 : hasRestParameter2 ? Diagnostics.Expected_at_least_0_arguments_but_got_1 : isVoidPromiseError ? Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise : Diagnostics.Expected_0_arguments_but_got_1; if (min2 < args.length && args.length < max) { if (headMessage) { let chain = chainDiagnosticMessages( @@ -72494,14 +72989,14 @@ ${lanes.join("\n")} let chain = chainDiagnosticMessages( /*details*/ void 0, - error2, + error3, parameterRange, args.length ); chain = chainDiagnosticMessages(chain, headMessage); diagnostic = getDiagnosticForCallNode(node, chain); } else { - diagnostic = getDiagnosticForCallNode(node, error2, parameterRange, args.length); + diagnostic = getDiagnosticForCallNode(node, error3, parameterRange, args.length); } const parameter = (_a = closestSignature == null ? void 0 : closestSignature.declaration) == null ? void 0 : _a.parameters[closestSignature.thisParameter ? args.length + 1 : args.length]; if (parameter) { @@ -72522,14 +73017,14 @@ ${lanes.join("\n")} let chain = chainDiagnosticMessages( /*details*/ void 0, - error2, + error3, parameterRange, args.length ); chain = chainDiagnosticMessages(chain, headMessage); return createDiagnosticForNodeArrayFromMessageChain(getSourceFileOfNode(node), errorSpan, chain); } - return createDiagnosticForNodeArray(getSourceFileOfNode(node), errorSpan, error2, parameterRange, args.length); + return createDiagnosticForNodeArray(getSourceFileOfNode(node), errorSpan, error3, parameterRange, args.length); } } function getTypeArgumentArityError(node, signatures, typeArguments, headMessage) { @@ -72591,8 +73086,8 @@ ${lanes.join("\n")} return createDiagnosticForNodeArray(getSourceFileOfNode(node), typeArguments, Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount); } function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags, headMessage) { - const isTaggedTemplate = node.kind === 214 /* TaggedTemplateExpression */; - const isDecorator2 = node.kind === 169 /* Decorator */; + const isTaggedTemplate = node.kind === 215 /* TaggedTemplateExpression */; + const isDecorator2 = node.kind === 170 /* Decorator */; const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node); const reportErrors2 = !isInferencePartiallyBlocked && !candidatesOutArray; let typeArguments; @@ -72604,21 +73099,15 @@ ${lanes.join("\n")} } const candidates = candidatesOutArray || []; reorderCandidates(signatures, candidates, callChainFlags); - if (!candidates.length) { - if (reportErrors2) { - diagnostics.add(getDiagnosticForCallNode(node, Diagnostics.Call_target_does_not_contain_any_signatures)); - } - return resolveErrorCall(node); - } + Debug.assert(candidates.length, "Revert #54442 and add a testcase with whatever triggered this"); const args = getEffectiveCallArguments(node); const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters; let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */; - argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */; let candidatesForArgumentError; let candidateForArgumentArityError; let candidateForTypeArgumentError; let result; - const signatureHelpTrailingComma = !!(checkMode & 16 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma; + const signatureHelpTrailingComma = !!(checkMode & 16 /* IsForSignatureHelp */) && node.kind === 213 /* CallExpression */ && node.arguments.hasTrailingComma; if (candidates.length > 1) { result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma); } @@ -72837,7 +73326,7 @@ ${lanes.join("\n")} continue; } if (argCheckMode) { - argCheckMode = checkMode & 32 /* IsForStringLiteralArgumentCompletions */; + argCheckMode = 0 /* Normal */; if (inferenceContext) { const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext); checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters); @@ -72886,7 +73375,7 @@ ${lanes.join("\n")} parameters.push(createCombinedSymbolFromTypes(symbols, mapDefined(candidates, (candidate) => tryGetTypeAtPosition(candidate, i)))); } const restParameterSymbols = mapDefined(candidates, (c) => signatureHasRestParameter(c) ? last(c.parameters) : void 0); - let flags = 0 /* None */; + let flags = 128 /* IsSignatureCandidateForOverloadFailure */; if (restParameterSymbols.length !== 0) { const type = createArrayType(getUnionType(mapDefined(candidates, tryGetRestTypeOfSignature), 2 /* Subtype */)); parameters.push(createCombinedSymbolForOverloadFailure(restParameterSymbols, type)); @@ -73011,13 +73500,13 @@ ${lanes.join("\n")} const numConstructSignatures = getSignaturesOfType(apparentType, 1 /* Construct */).length; if (isUntypedFunctionCall(funcType, apparentType, callSignatures.length, numConstructSignatures)) { if (!isErrorType(funcType) && node.typeArguments) { - error(node, Diagnostics.Untyped_function_calls_may_not_accept_type_arguments); + error2(node, Diagnostics.Untyped_function_calls_may_not_accept_type_arguments); } return resolveUntypedCall(node); } if (!callSignatures.length) { if (numConstructSignatures) { - error(node, Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType)); + error2(node, Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType)); } else { let relatedInformation; if (node.arguments.length === 1) { @@ -73040,7 +73529,7 @@ ${lanes.join("\n")} return resolvingSignature; } if (callSignatures.some((sig) => isInJSFile(sig.declaration) && !!getJSDocClassTag(sig.declaration))) { - error(node, Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType)); + error2(node, Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType)); return resolveErrorCall(node); } return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags); @@ -73055,7 +73544,7 @@ ${lanes.join("\n")} if (node.arguments && languageVersion < 1 /* ES5 */) { const spreadIndex = getSpreadArgumentIndex(node.arguments); if (spreadIndex >= 0) { - error(node.arguments[spreadIndex], Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher); + error2(node.arguments[spreadIndex], Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher); } } let expressionType = checkNonNullExpression(node.expression); @@ -73068,7 +73557,7 @@ ${lanes.join("\n")} } if (isTypeAny(expressionType)) { if (node.typeArguments) { - error(node, Diagnostics.Untyped_function_calls_may_not_accept_type_arguments); + error2(node, Diagnostics.Untyped_function_calls_may_not_accept_type_arguments); } return resolveUntypedCall(node); } @@ -73078,12 +73567,12 @@ ${lanes.join("\n")} return resolveErrorCall(node); } if (someSignature(constructSignatures, (signature) => !!(signature.flags & 4 /* Abstract */))) { - error(node, Diagnostics.Cannot_create_an_instance_of_an_abstract_class); + error2(node, Diagnostics.Cannot_create_an_instance_of_an_abstract_class); return resolveErrorCall(node); } const valueDecl = expressionType.symbol && getClassLikeDeclarationOfSymbol(expressionType.symbol); if (valueDecl && hasSyntacticModifier(valueDecl, 256 /* Abstract */)) { - error(node, Diagnostics.Cannot_create_an_instance_of_an_abstract_class); + error2(node, Diagnostics.Cannot_create_an_instance_of_an_abstract_class); return resolveErrorCall(node); } return resolveCall(node, constructSignatures, candidatesOutArray, checkMode, 0 /* None */); @@ -73093,10 +73582,10 @@ ${lanes.join("\n")} const signature = resolveCall(node, callSignatures, candidatesOutArray, checkMode, 0 /* None */); if (!noImplicitAny) { if (signature.declaration && !isJSConstructor(signature.declaration) && getReturnTypeOfSignature(signature) !== voidType) { - error(node, Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword); + error2(node, Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword); } if (getThisTypeOfSignature(signature) === voidType) { - error(node, Diagnostics.A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void); + error2(node, Diagnostics.A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void); } } return signature; @@ -73146,7 +73635,7 @@ ${lanes.join("\n")} } const declaration = signature.declaration; const modifiers = getSelectedEffectiveModifierFlags(declaration, 24 /* NonPublicAccessibilityModifier */); - if (!modifiers || declaration.kind !== 175 /* Constructor */) { + if (!modifiers || declaration.kind !== 176 /* Constructor */) { return true; } const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(declaration.parent.symbol); @@ -73160,10 +73649,10 @@ ${lanes.join("\n")} } } if (modifiers & 8 /* Private */) { - error(node, Diagnostics.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration, typeToString(declaringClass)); + error2(node, Diagnostics.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration, typeToString(declaringClass)); } if (modifiers & 16 /* Protected */) { - error(node, Diagnostics.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration, typeToString(declaringClass)); + error2(node, Diagnostics.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration, typeToString(declaringClass)); } return false; } @@ -73293,16 +73782,16 @@ ${lanes.join("\n")} } function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: return Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 168 /* Parameter */: + case 169 /* Parameter */: return Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: return Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: return Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; default: return Debug.fail(); @@ -73325,7 +73814,7 @@ ${lanes.join("\n")} /*includeTrivia*/ false ); - error(node, Diagnostics._0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0, nodeStr); + error2(node, Diagnostics._0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0, nodeStr); return resolveErrorCall(node); } const headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); @@ -73415,7 +73904,7 @@ ${lanes.join("\n")} return resolveUntypedCall(node); } if (signatures.length === 0) { - error(node.tagName, Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, getTextOfNode(node.tagName)); + error2(node.tagName, Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, getTextOfNode(node.tagName)); return resolveErrorCall(node); } return resolveCall(node, signatures, candidatesOutArray, checkMode, 0 /* None */); @@ -73425,16 +73914,16 @@ ${lanes.join("\n")} } function resolveSignature(node, candidatesOutArray, checkMode) { switch (node.kind) { - case 212 /* CallExpression */: + case 213 /* CallExpression */: return resolveCallExpression(node, candidatesOutArray, checkMode); - case 213 /* NewExpression */: + case 214 /* NewExpression */: return resolveNewExpression(node, candidatesOutArray, checkMode); - case 214 /* TaggedTemplateExpression */: + case 215 /* TaggedTemplateExpression */: return resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode); - case 169 /* Decorator */: + case 170 /* Decorator */: return resolveDecorator(node, candidatesOutArray, checkMode); - case 285 /* JsxOpeningElement */: - case 284 /* JsxSelfClosingElement */: + case 286 /* JsxOpeningElement */: + case 285 /* JsxSelfClosingElement */: return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode); } Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable."); @@ -73510,7 +73999,7 @@ ${lanes.join("\n")} let name; let decl; if (isVariableDeclaration(node.parent) && node.parent.initializer === node) { - if (!isInJSFile(node) && !(isVarConst(node.parent) && isFunctionLikeDeclaration(node))) { + if (!isInJSFile(node) && !(isVarConstLike(node.parent) && isFunctionLikeDeclaration(node))) { return void 0; } name = node.parent.name; @@ -73547,7 +74036,7 @@ ${lanes.join("\n")} return false; } let parent2 = node.parent; - while (parent2 && parent2.kind === 210 /* PropertyAccessExpression */) { + while (parent2 && parent2.kind === 211 /* PropertyAccessExpression */) { parent2 = parent2.parent; } if (parent2 && isBinaryExpression(parent2) && isPrototypeAccess(parent2.left) && parent2.operatorToken.kind === 64 /* EqualsToken */) { @@ -73571,11 +74060,11 @@ ${lanes.join("\n")} if (node.expression.kind === 108 /* SuperKeyword */) { return voidType; } - if (node.kind === 213 /* NewExpression */) { + if (node.kind === 214 /* NewExpression */) { const declaration = signature.declaration; - if (declaration && declaration.kind !== 175 /* Constructor */ && declaration.kind !== 179 /* ConstructSignature */ && declaration.kind !== 184 /* ConstructorType */ && !(isJSDocSignature(declaration) && ((_b = (_a = getJSDocRoot(declaration)) == null ? void 0 : _a.parent) == null ? void 0 : _b.kind) === 175 /* Constructor */) && !isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) { + if (declaration && declaration.kind !== 176 /* Constructor */ && declaration.kind !== 180 /* ConstructSignature */ && declaration.kind !== 185 /* ConstructorType */ && !(isJSDocSignature(declaration) && ((_b = (_a = getJSDocRoot(declaration)) == null ? void 0 : _a.parent) == null ? void 0 : _b.kind) === 176 /* Constructor */) && !isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) { if (noImplicitAny) { - error(node, Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); + error2(node, Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } return anyType; } @@ -73587,11 +74076,11 @@ ${lanes.join("\n")} if (returnType.flags & 12288 /* ESSymbolLike */ && isSymbolOrSymbolForCall(node)) { return getESSymbolLikeTypeForNode(walkUpParenthesizedExpressions(node.parent)); } - if (node.kind === 212 /* CallExpression */ && !node.questionDotToken && node.parent.kind === 243 /* ExpressionStatement */ && returnType.flags & 16384 /* Void */ && getTypePredicateOfSignature(signature)) { + if (node.kind === 213 /* CallExpression */ && !node.questionDotToken && node.parent.kind === 244 /* ExpressionStatement */ && returnType.flags & 16384 /* Void */ && getTypePredicateOfSignature(signature)) { if (!isDottedName(node.expression)) { - error(node.expression, Diagnostics.Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name); + error2(node.expression, Diagnostics.Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name); } else if (!getEffectsSignature(node)) { - const diagnostic = error(node.expression, Diagnostics.Assertions_require_every_name_in_the_call_target_to_be_declared_with_an_explicit_type_annotation); + const diagnostic = error2(node.expression, Diagnostics.Assertions_require_every_name_in_the_call_target_to_be_declared_with_an_explicit_type_annotation); getTypeOfDottedName(node.expression, diagnostic); } } @@ -73610,7 +74099,9 @@ ${lanes.join("\n")} return returnType; } function checkDeprecatedSignature(signature, node) { - if (signature.declaration && signature.declaration.flags & 268435456 /* Deprecated */) { + if (signature.flags & 128 /* IsSignatureCandidateForOverloadFailure */) + return; + if (signature.declaration && signature.declaration.flags & 536870912 /* Deprecated */) { const suggestionNode = getDeprecatedSuggestionNode(node); const name = tryGetPropertyAccessOrIdentifierToString(getInvokedExpression(node)); addDeprecatedSuggestionWithSignature(suggestionNode, signature.declaration, name, signatureToString(signature)); @@ -73619,20 +74110,20 @@ ${lanes.join("\n")} function getDeprecatedSuggestionNode(node) { node = skipParentheses(node); switch (node.kind) { - case 212 /* CallExpression */: - case 169 /* Decorator */: - case 213 /* NewExpression */: + case 213 /* CallExpression */: + case 170 /* Decorator */: + case 214 /* NewExpression */: return getDeprecatedSuggestionNode(node.expression); - case 214 /* TaggedTemplateExpression */: + case 215 /* TaggedTemplateExpression */: return getDeprecatedSuggestionNode(node.tag); - case 285 /* JsxOpeningElement */: - case 284 /* JsxSelfClosingElement */: + case 286 /* JsxOpeningElement */: + case 285 /* JsxSelfClosingElement */: return getDeprecatedSuggestionNode(node.tagName); - case 211 /* ElementAccessExpression */: + case 212 /* ElementAccessExpression */: return node.argumentExpression; - case 210 /* PropertyAccessExpression */: + case 211 /* PropertyAccessExpression */: return node.name; - case 182 /* TypeReference */: + case 183 /* TypeReference */: const typeReference = node; return isQualifiedName(typeReference.typeName) ? typeReference.typeName.right : typeReference; default: @@ -73680,7 +74171,7 @@ ${lanes.join("\n")} checkExpressionCached(node.arguments[i]); } if (specifierType.flags & 32768 /* Undefined */ || specifierType.flags & 65536 /* Null */ || !isTypeAssignableTo(specifierType, stringType)) { - error(specifier, Diagnostics.Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0, typeToString(specifierType)); + error2(specifier, Diagnostics.Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0, typeToString(specifierType)); } if (optionsType) { const importCallOptionsType = getGlobalImportCallOptionsType( @@ -73792,10 +74283,10 @@ ${lanes.join("\n")} if (resolvedRequire.flags & 2097152 /* Alias */) { return false; } - const targetDeclarationKind = resolvedRequire.flags & 16 /* Function */ ? 261 /* FunctionDeclaration */ : resolvedRequire.flags & 3 /* Variable */ ? 259 /* VariableDeclaration */ : 0 /* Unknown */; + const targetDeclarationKind = resolvedRequire.flags & 16 /* Function */ ? 262 /* FunctionDeclaration */ : resolvedRequire.flags & 3 /* Variable */ ? 260 /* VariableDeclaration */ : 0 /* Unknown */; if (targetDeclarationKind !== 0 /* Unknown */) { const decl = getDeclarationOfKind(resolvedRequire, targetDeclarationKind); - return !!decl && !!(decl.flags & 16777216 /* Ambient */); + return !!decl && !!(decl.flags & 33554432 /* Ambient */); } return false; } @@ -73810,7 +74301,7 @@ ${lanes.join("\n")} return getReturnTypeOfSignature(signature); } function checkAssertion(node, checkMode) { - if (node.kind === 215 /* TypeAssertionExpression */) { + if (node.kind === 216 /* TypeAssertionExpression */) { const file = getSourceFileOfNode(node); if (file && fileExtensionIsOneOf(file.fileName, [".cts" /* Cts */, ".mts" /* Mts */])) { grammarErrorOnNode(node, Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead); @@ -73826,18 +74317,18 @@ ${lanes.join("\n")} case 10 /* BigIntLiteral */: case 112 /* TrueKeyword */: case 97 /* FalseKeyword */: - case 208 /* ArrayLiteralExpression */: - case 209 /* ObjectLiteralExpression */: - case 227 /* TemplateExpression */: + case 209 /* ArrayLiteralExpression */: + case 210 /* ObjectLiteralExpression */: + case 228 /* TemplateExpression */: return true; - case 216 /* ParenthesizedExpression */: + case 217 /* ParenthesizedExpression */: return isValidConstAssertionArgument(node.expression); - case 223 /* PrefixUnaryExpression */: + case 224 /* PrefixUnaryExpression */: const op = node.operator; const arg = node.operand; return op === 41 /* MinusToken */ && (arg.kind === 9 /* NumericLiteral */ || arg.kind === 10 /* BigIntLiteral */) || op === 40 /* PlusToken */ && arg.kind === 9 /* NumericLiteral */; - case 210 /* PropertyAccessExpression */: - case 211 /* ElementAccessExpression */: + case 211 /* PropertyAccessExpression */: + case 212 /* ElementAccessExpression */: const expr = skipParentheses(node.expression); const symbol = isEntityNameExpression(expr) ? resolveEntityName( expr, @@ -73854,7 +74345,7 @@ ${lanes.join("\n")} const exprType = checkExpression(expression, checkMode); if (isConstTypeReference(type)) { if (!isValidConstAssertionArgument(expression)) { - error(expression, Diagnostics.A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals); + error2(expression, Diagnostics.A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals); } return getRegularTypeOfLiteralType(exprType); } @@ -73868,12 +74359,12 @@ ${lanes.join("\n")} let type; let expression; switch (node.kind) { - case 233 /* AsExpression */: - case 215 /* TypeAssertionExpression */: + case 234 /* AsExpression */: + case 216 /* TypeAssertionExpression */: type = node.type; expression = node.expression; break; - case 216 /* ParenthesizedExpression */: + case 217 /* ParenthesizedExpression */: type = getJSDocTypeAssertionType(node); expression = node.expression; break; @@ -73907,18 +74398,18 @@ ${lanes.join("\n")} return propagateOptionalTypeMarker(getNonNullableType(nonOptionalType), node, nonOptionalType !== leftType); } function checkNonNullAssertion(node) { - return node.flags & 32 /* OptionalChain */ ? checkNonNullChain(node) : getNonNullableType(checkExpression(node.expression)); + return node.flags & 64 /* OptionalChain */ ? checkNonNullChain(node) : getNonNullableType(checkExpression(node.expression)); } function checkExpressionWithTypeArguments(node) { checkGrammarExpressionWithTypeArguments(node); forEach(node.typeArguments, checkSourceElement); - if (node.kind === 232 /* ExpressionWithTypeArguments */) { + if (node.kind === 233 /* ExpressionWithTypeArguments */) { const parent2 = walkUpParenthesizedExpressions(node.parent); - if (parent2.kind === 225 /* BinaryExpression */ && parent2.operatorToken.kind === 104 /* InstanceOfKeyword */ && isNodeDescendantOf(node, parent2.right)) { - error(node, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression); + if (parent2.kind === 226 /* BinaryExpression */ && parent2.operatorToken.kind === 104 /* InstanceOfKeyword */ && isNodeDescendantOf(node, parent2.right)) { + error2(node, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression); } } - const exprType = node.kind === 232 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName); + const exprType = node.kind === 233 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName); return getInstantiationExpressionType(exprType, node); } function getInstantiationExpressionType(exprType, node) { @@ -74002,7 +74493,7 @@ ${lanes.join("\n")} if (isErrorType(targetType)) { return targetType; } - const errorNode = findAncestor(target.parent, (n) => n.kind === 237 /* SatisfiesExpression */ || n.kind === 356 /* JSDocSatisfiesTag */); + const errorNode = findAncestor(target.parent, (n) => n.kind === 238 /* SatisfiesExpression */ || n.kind === 357 /* JSDocSatisfiesTag */); checkTypeAssignableToAndOptionallyElaborate(exprType, targetType, errorNode, expression, Diagnostics.Type_0_does_not_satisfy_the_expected_type_1); return exprType; } @@ -74030,9 +74521,9 @@ ${lanes.join("\n")} function checkNewTargetMetaProperty(node) { const container = getNewTargetContainer(node); if (!container) { - error(node, Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); + error2(node, 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 === 175 /* Constructor */) { + } else if (container.kind === 176 /* Constructor */) { const symbol = getSymbolOfDeclaration(container.parent); return getTypeOfSymbol(symbol); } else { @@ -74043,13 +74534,13 @@ ${lanes.join("\n")} function checkImportMetaProperty(node) { if (moduleKind === 100 /* Node16 */ || moduleKind === 199 /* NodeNext */) { if (getSourceFileOfNode(node).impliedNodeFormat !== 99 /* ESNext */) { - error(node, Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output); + error2(node, Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output); } } else if (moduleKind < 6 /* ES2020 */ && moduleKind !== 4 /* System */) { - error(node, Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext); + error2(node, Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext); } const file = getSourceFileOfNode(node); - Debug.assert(!!(file.flags & 4194304 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag."); + Debug.assert(!!(file.flags & 8388608 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag."); return node.name.escapedText === "meta" ? getGlobalImportMetaType() : errorType; } function getTypeOfParameter(symbol) { @@ -74062,7 +74553,10 @@ ${lanes.join("\n")} } return type; } - function getTupleElementLabel(d) { + function getTupleElementLabel(d, index, restParameterName = "arg") { + if (!d) { + return `${restParameterName}_${index}`; + } Debug.assert(isIdentifier(d.name)); return d.name.escapedText; } @@ -74076,22 +74570,28 @@ ${lanes.join("\n")} if (isTupleType(restType)) { const associatedNames = restType.target.labeledElementDeclarations; const index = pos - paramCount; - return associatedNames && getTupleElementLabel(associatedNames[index]) || restParameter.escapedName + "_" + index; + return getTupleElementLabel(associatedNames == null ? void 0 : associatedNames[index], index, restParameter.escapedName); } return restParameter.escapedName; } - function getParameterIdentifierNameAtPosition(signature, pos) { + function getParameterIdentifierInfoAtPosition(signature, pos) { var _a; - if (((_a = signature.declaration) == null ? void 0 : _a.kind) === 323 /* JSDocFunctionType */) { + if (((_a = signature.declaration) == null ? void 0 : _a.kind) === 324 /* JSDocFunctionType */) { return void 0; } const paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); if (pos < paramCount) { const param = signature.parameters[pos]; - return isParameterDeclarationWithIdentifierName(param) ? [param.escapedName, false] : void 0; + const paramIdent = getParameterDeclarationIdentifier(param); + return paramIdent ? { + parameter: paramIdent, + parameterName: param.escapedName, + isRestParameter: false + } : void 0; } const restParameter = signature.parameters[paramCount] || unknownSymbol; - if (!isParameterDeclarationWithIdentifierName(restParameter)) { + const restIdent = getParameterDeclarationIdentifier(restParameter); + if (!restIdent) { return void 0; } const restType = getTypeOfSymbol(restParameter); @@ -74100,21 +74600,22 @@ ${lanes.join("\n")} const index = pos - paramCount; const associatedName = associatedNames == null ? void 0 : associatedNames[index]; const isRestTupleElement = !!(associatedName == null ? void 0 : associatedName.dotDotDotToken); - return associatedName ? [ - getTupleElementLabel(associatedName), - isRestTupleElement - ] : void 0; + if (associatedName) { + Debug.assert(isIdentifier(associatedName.name)); + return { parameter: associatedName.name, parameterName: associatedName.name.escapedText, isRestParameter: isRestTupleElement }; + } + return void 0; } if (pos === paramCount) { - return [restParameter.escapedName, true]; + return { parameter: restIdent, parameterName: restParameter.escapedName, isRestParameter: true }; } return void 0; } - function isParameterDeclarationWithIdentifierName(symbol) { - return symbol.valueDeclaration && isParameter(symbol.valueDeclaration) && isIdentifier(symbol.valueDeclaration.name); + function getParameterDeclarationIdentifier(symbol) { + return symbol.valueDeclaration && isParameter(symbol.valueDeclaration) && isIdentifier(symbol.valueDeclaration.name) && symbol.valueDeclaration.name; } function isValidDeclarationForTupleLabel(d) { - return d.kind === 201 /* NamedTupleMember */ || isParameter(d) && d.name && isIdentifier(d.name); + return d.kind === 202 /* NamedTupleMember */ || isParameter(d) && d.name && isIdentifier(d.name); } function getNameableDeclarationAtPosition(signature, pos) { const paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -74450,17 +74951,17 @@ ${lanes.join("\n")} if (!links.decoratorSignature) { links.decoratorSignature = anySignature; switch (parent2.kind) { - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: { + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: { const node = parent2; const targetType = getTypeOfSymbol(getSymbolOfDeclaration(node)); const contextType = createClassDecoratorContextType(targetType); links.decoratorSignature = createESDecoratorCallSignature(targetType, contextType, targetType); break; } - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: { + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: { const node = parent2; if (!isClassLike(node.parent)) break; @@ -74472,7 +74973,7 @@ ${lanes.join("\n")} links.decoratorSignature = createESDecoratorCallSignature(targetType, contextType, returnType); break; } - case 171 /* PropertyDeclaration */: { + case 172 /* PropertyDeclaration */: { const node = parent2; if (!isClassLike(node.parent)) break; @@ -74494,8 +74995,8 @@ ${lanes.join("\n")} if (!links.decoratorSignature) { links.decoratorSignature = anySignature; switch (parent2.kind) { - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: { + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: { const node = parent2; const targetType = getTypeOfSymbol(getSymbolOfDeclaration(node)); const targetParam = createParameter("target", targetType); @@ -74509,7 +75010,7 @@ ${lanes.join("\n")} ); break; } - case 168 /* Parameter */: { + case 169 /* Parameter */: { const node = parent2; if (!isConstructorDeclaration(node.parent) && !(isMethodDeclaration(node.parent) || isSetAccessorDeclaration(node.parent) && isClassLike(node.parent.parent))) { break; @@ -74535,10 +75036,10 @@ ${lanes.join("\n")} ); break; } - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 171 /* PropertyDeclaration */: { + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 172 /* PropertyDeclaration */: { const node = parent2; if (!isClassLike(node.parent)) break; @@ -74603,13 +75104,13 @@ ${lanes.join("\n")} function createPromiseReturnType(func, promisedType) { const promiseType = createPromiseType(promisedType); if (promiseType === unknownType) { - error(func, isImportCall(func) ? Diagnostics.A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option : 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); + error2(func, isImportCall(func) ? Diagnostics.A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option : 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); return errorType; } else if (!getGlobalPromiseConstructorSymbol( /*reportErrors*/ true )) { - error(func, isImportCall(func) ? Diagnostics.A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option : 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); + error2(func, isImportCall(func) ? Diagnostics.A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option : 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); } return promiseType; } @@ -74633,7 +75134,7 @@ ${lanes.join("\n")} let yieldType; let nextType; let fallbackReturnType = voidType; - if (func.body.kind !== 240 /* Block */) { + if (func.body.kind !== 241 /* Block */) { returnType = checkExpressionCached(func.body, checkMode && checkMode & ~8 /* SkipGenericFunctions */); if (isAsync) { returnType = unwrapAwaitedType(checkAwaitedType( @@ -74816,7 +75317,7 @@ ${lanes.join("\n")} return links.isExhaustive; } function computeExhaustiveSwitchStatement(node) { - if (node.expression.kind === 220 /* TypeOfExpression */) { + if (node.expression.kind === 221 /* TypeOfExpression */) { const witnesses = getSwitchClauseTypeOfWitnesses(node); if (!witnesses) { return false; @@ -74849,7 +75350,7 @@ ${lanes.join("\n")} forEachReturnStatement(func.body, (returnStatement) => { const expr = returnStatement.expression; if (expr) { - if (expr.kind === 212 /* CallExpression */ && expr.expression.kind === 80 /* Identifier */ && checkExpressionCached(expr.expression).symbol === func.symbol) { + if (expr.kind === 213 /* CallExpression */ && expr.expression.kind === 80 /* Identifier */ && checkExpressionCached(expr.expression).symbol === func.symbol) { hasReturnOfTypeNever = true; return; } @@ -74881,11 +75382,11 @@ ${lanes.join("\n")} } function mayReturnNever(func) { switch (func.kind) { - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: return true; - case 173 /* MethodDeclaration */: - return func.parent.kind === 209 /* ObjectLiteralExpression */; + case 174 /* MethodDeclaration */: + return func.parent.kind === 210 /* ObjectLiteralExpression */; default: return false; } @@ -74899,17 +75400,17 @@ ${lanes.join("\n")} if (type && (maybeTypeOfKind(type, 16384 /* Void */) || type.flags & (1 /* Any */ | 32768 /* Undefined */))) { return; } - if (func.kind === 172 /* MethodSignature */ || nodeIsMissing(func.body) || func.body.kind !== 240 /* Block */ || !functionHasImplicitReturn(func)) { + if (func.kind === 173 /* MethodSignature */ || nodeIsMissing(func.body) || func.body.kind !== 241 /* Block */ || !functionHasImplicitReturn(func)) { return; } - const hasExplicitReturn = func.flags & 512 /* HasExplicitReturn */; + const hasExplicitReturn = func.flags & 1024 /* HasExplicitReturn */; const errorNode = getEffectiveReturnTypeNode(func) || func; if (type && type.flags & 131072 /* Never */) { - error(errorNode, Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point); + error2(errorNode, Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point); } else if (type && !hasExplicitReturn) { - error(errorNode, Diagnostics.A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value); + error2(errorNode, Diagnostics.A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value); } else if (type && strictNullChecks && !isTypeAssignableTo(undefinedType, type)) { - error(errorNode, Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined); + error2(errorNode, Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined); } else if (compilerOptions.noImplicitReturns) { if (!type) { if (!hasExplicitReturn) { @@ -74920,12 +75421,12 @@ ${lanes.join("\n")} return; } } - error(errorNode, Diagnostics.Not_all_code_paths_return_a_value); + error2(errorNode, Diagnostics.Not_all_code_paths_return_a_value); } } } function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) { - Debug.assert(node.kind !== 173 /* MethodDeclaration */ || isObjectLiteralMethod(node)); + Debug.assert(node.kind !== 174 /* MethodDeclaration */ || isObjectLiteralMethod(node)); checkNodeDeferred(node); if (isFunctionExpression(node)) { checkCollisionsForDeclarationName(node, node.name); @@ -74961,7 +75462,7 @@ ${lanes.join("\n")} return anyFunctionType; } const hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 217 /* FunctionExpression */) { + if (!hasGrammarError && node.kind === 218 /* FunctionExpression */) { checkGrammarForGenerator(node); } contextuallyCheckFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -75010,7 +75511,7 @@ ${lanes.join("\n")} } } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - Debug.assert(node.kind !== 173 /* MethodDeclaration */ || isObjectLiteralMethod(node)); + Debug.assert(node.kind !== 174 /* MethodDeclaration */ || isObjectLiteralMethod(node)); const functionFlags = getFunctionFlags(node); const returnType = getReturnTypeFromAnnotation(node); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); @@ -75018,7 +75519,7 @@ ${lanes.join("\n")} if (!getEffectiveReturnTypeNode(node)) { getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 240 /* Block */) { + if (node.body.kind === 241 /* Block */) { checkSourceElement(node.body); } else { const exprType = checkExpression(node.body); @@ -75080,7 +75581,7 @@ ${lanes.join("\n")} return !setProp; } function isReadonlySymbol(symbol) { - return !!(getCheckFlags(symbol) & 8 /* Readonly */ || symbol.flags & 4 /* Property */ && getDeclarationModifierFlagsFromSymbol(symbol) & 64 /* Readonly */ || symbol.flags & 3 /* Variable */ && getDeclarationNodeFlagsFromSymbol(symbol) & 2 /* Const */ || symbol.flags & 98304 /* Accessor */ && !(symbol.flags & 65536 /* SetAccessor */) || symbol.flags & 8 /* EnumMember */ || some(symbol.declarations, isReadonlyAssignmentDeclaration)); + return !!(getCheckFlags(symbol) & 8 /* Readonly */ || symbol.flags & 4 /* Property */ && getDeclarationModifierFlagsFromSymbol(symbol) & 64 /* Readonly */ || symbol.flags & 3 /* Variable */ && getDeclarationNodeFlagsFromSymbol(symbol) & 6 /* Constant */ || symbol.flags & 98304 /* Accessor */ && !(symbol.flags & 65536 /* SetAccessor */) || symbol.flags & 8 /* EnumMember */ || some(symbol.declarations, isReadonlyAssignmentDeclaration)); } function isAssignmentToReadonlyEntity(expr, symbol, assignmentKind) { var _a, _b; @@ -75090,7 +75591,7 @@ ${lanes.join("\n")} if (isReadonlySymbol(symbol)) { if (symbol.flags & 4 /* Property */ && isAccessExpression(expr) && expr.expression.kind === 110 /* ThisKeyword */) { const ctor = getContainingFunction(expr); - if (!(ctor && (ctor.kind === 175 /* Constructor */ || isJSConstructor(ctor)))) { + if (!(ctor && (ctor.kind === 176 /* Constructor */ || isJSConstructor(ctor)))) { return true; } if (symbol.valueDeclaration) { @@ -75111,7 +75612,7 @@ ${lanes.join("\n")} const symbol2 = getNodeLinks(node).resolvedSymbol; if (symbol2.flags & 2097152 /* Alias */) { const declaration = getDeclarationOfAliasSymbol(symbol2); - return !!declaration && declaration.kind === 273 /* NamespaceImport */; + return !!declaration && declaration.kind === 274 /* NamespaceImport */; } } } @@ -75120,11 +75621,11 @@ ${lanes.join("\n")} function checkReferenceExpression(expr, invalidReferenceMessage, invalidOptionalChainMessage) { const node = skipOuterExpressions(expr, 6 /* Assertions */ | 1 /* Parentheses */); if (node.kind !== 80 /* Identifier */ && !isAccessExpression(node)) { - error(expr, invalidReferenceMessage); + error2(expr, invalidReferenceMessage); return false; } - if (node.flags & 32 /* OptionalChain */) { - error(expr, invalidOptionalChainMessage); + if (node.flags & 64 /* OptionalChain */) { + error2(expr, invalidOptionalChainMessage); return false; } return true; @@ -75133,17 +75634,17 @@ ${lanes.join("\n")} checkExpression(node.expression); const expr = skipParentheses(node.expression); if (!isAccessExpression(expr)) { - error(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference); + error2(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference); return booleanType; } if (isPropertyAccessExpression(expr) && isPrivateIdentifier(expr.name)) { - error(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_private_identifier); + error2(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_private_identifier); } const links = getNodeLinks(expr); const symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol); if (symbol) { if (isReadonlySymbol(symbol)) { - error(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property); + error2(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property); } checkDeleteExpressionMustBeOptional(expr, symbol); } @@ -75152,7 +75653,7 @@ ${lanes.join("\n")} function checkDeleteExpressionMustBeOptional(expr, symbol) { const type = getTypeOfSymbol(symbol); if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getTypeFacts(type) & 16777216 /* IsUndefined */)) { - error(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_optional); + error2(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_optional); } } function checkTypeOfExpression(node) { @@ -75163,24 +75664,24 @@ ${lanes.join("\n")} checkExpression(node.expression); return undefinedWideningType; } - function checkAwaitExpressionGrammar(node) { + function checkAwaitGrammar(node) { + let hasError = false; const container = getContainingFunctionOrClassStaticBlock(node); if (container && isClassStaticBlockDeclaration(container)) { - error(node, Diagnostics.Await_expression_cannot_be_used_inside_a_class_static_block); - } else if (!(node.flags & 32768 /* AwaitContext */)) { + const message = isAwaitExpression(node) ? Diagnostics.await_expression_cannot_be_used_inside_a_class_static_block : Diagnostics.await_using_statements_cannot_be_used_inside_a_class_static_block; + error2(node, message); + hasError = true; + } else if (!(node.flags & 65536 /* AwaitContext */)) { if (isInTopLevelContext(node)) { const sourceFile = getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) { let span; if (!isEffectiveExternalModule(sourceFile, compilerOptions)) { span ?? (span = getSpanOfTokenAtPosition(sourceFile, node.pos)); - const diagnostic = createFileDiagnostic( - sourceFile, - span.start, - span.length, - Diagnostics.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module - ); + const message = isAwaitExpression(node) ? Diagnostics.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module : Diagnostics.await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module; + const diagnostic = createFileDiagnostic(sourceFile, span.start, span.length, message); diagnostics.add(diagnostic); + hasError = true; } switch (moduleKind) { case 100 /* Node16 */: @@ -75190,6 +75691,7 @@ ${lanes.join("\n")} diagnostics.add( createFileDiagnostic(sourceFile, span.start, span.length, Diagnostics.The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level) ); + hasError = true; break; } case 7 /* ES2022 */: @@ -75200,14 +75702,9 @@ ${lanes.join("\n")} } default: span ?? (span = getSpanOfTokenAtPosition(sourceFile, node.pos)); - diagnostics.add( - createFileDiagnostic( - sourceFile, - span.start, - span.length, - Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher - ) - ); + const message = isAwaitExpression(node) ? Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher : Diagnostics.Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher; + diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message)); + hasError = true; break; } } @@ -75215,21 +75712,25 @@ ${lanes.join("\n")} const sourceFile = getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) { const span = getSpanOfTokenAtPosition(sourceFile, node.pos); - const diagnostic = createFileDiagnostic(sourceFile, span.start, span.length, Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); - if (container && container.kind !== 175 /* Constructor */ && (getFunctionFlags(container) & 2 /* Async */) === 0) { + const message = isAwaitExpression(node) ? Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules : Diagnostics.await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules; + const diagnostic = createFileDiagnostic(sourceFile, span.start, span.length, message); + if (container && container.kind !== 176 /* Constructor */ && (getFunctionFlags(container) & 2 /* Async */) === 0) { const relatedInfo = createDiagnosticForNode(container, Diagnostics.Did_you_mean_to_mark_this_function_as_async); addRelatedInfo(diagnostic, relatedInfo); } diagnostics.add(diagnostic); + hasError = true; } } } - if (isInParameterInitializerBeforeContainingFunction(node)) { - error(node, Diagnostics.await_expressions_cannot_be_used_in_a_parameter_initializer); + if (isAwaitExpression(node) && isInParameterInitializerBeforeContainingFunction(node)) { + error2(node, Diagnostics.await_expressions_cannot_be_used_in_a_parameter_initializer); + hasError = true; } + return hasError; } function checkAwaitExpression(node) { - addLazyDiagnostic(() => checkAwaitExpressionGrammar(node)); + addLazyDiagnostic(() => checkAwaitGrammar(node)); const operandType = checkExpression(node.expression); const awaitedType = checkAwaitedType( operandType, @@ -75275,11 +75776,11 @@ ${lanes.join("\n")} case 55 /* TildeToken */: checkNonNullType(operandType, node.operand); if (maybeTypeOfKindConsideringBaseConstraint(operandType, 12288 /* ESSymbolLike */)) { - error(node.operand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(node.operator)); + error2(node.operand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(node.operator)); } if (node.operator === 40 /* PlusToken */) { if (maybeTypeOfKindConsideringBaseConstraint(operandType, 2112 /* BigIntLike */)) { - error(node.operand, Diagnostics.Operator_0_cannot_be_applied_to_type_1, tokenToString(node.operator), typeToString(getBaseTypeOfLiteralType(operandType))); + error2(node.operand, Diagnostics.Operator_0_cannot_be_applied_to_type_1, tokenToString(node.operator), typeToString(getBaseTypeOfLiteralType(operandType))); } return numberType; } @@ -75375,10 +75876,10 @@ ${lanes.join("\n")} return silentNeverType; } if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 402784252 /* Primitive */)) { - error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); + error2(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) { - error(right, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); + error2(right, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); } return booleanType; } @@ -75407,7 +75908,7 @@ ${lanes.join("\n")} } if (checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right)) { if (hasEmptyObjectIntersection(rightType)) { - error(right, Diagnostics.Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator, typeToString(rightType)); + error2(right, Diagnostics.Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator, typeToString(rightType)); } } return booleanType; @@ -75425,7 +75926,7 @@ ${lanes.join("\n")} function checkObjectLiteralDestructuringPropertyAssignment(node, objectLiteralType, propertyIndex, allProperties, rightIsThis = false) { const properties = node.properties; const property = properties[propertyIndex]; - if (property.kind === 302 /* PropertyAssignment */ || property.kind === 303 /* ShorthandPropertyAssignment */) { + if (property.kind === 303 /* PropertyAssignment */ || property.kind === 304 /* ShorthandPropertyAssignment */) { const name = property.name; const exprType = getLiteralTypeFromPropertyName(name); if (isTypeUsableAsPropertyName(exprType)) { @@ -75446,10 +75947,10 @@ ${lanes.join("\n")} } const elementType = getIndexedAccessType(objectLiteralType, exprType, 32 /* ExpressionPosition */, name); const type = getFlowTypeOfDestructuring(property, elementType); - return checkDestructuringAssignment(property.kind === 303 /* ShorthandPropertyAssignment */ ? property : property.initializer, type); - } else if (property.kind === 304 /* SpreadAssignment */) { + return checkDestructuringAssignment(property.kind === 304 /* ShorthandPropertyAssignment */ ? property : property.initializer, type); + } else if (property.kind === 305 /* SpreadAssignment */) { if (propertyIndex < properties.length - 1) { - error(property, Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); + error2(property, Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } else { if (languageVersion < 99 /* ESNext */) { checkExternalEmitHelpers(property, 4 /* Rest */); @@ -75467,7 +75968,7 @@ ${lanes.join("\n")} return checkDestructuringAssignment(property.expression, type); } } else { - error(property, Diagnostics.Property_assignment_expected); + error2(property, Diagnostics.Property_assignment_expected); } } function checkArrayLiteralAssignment(node, sourceType, checkMode) { @@ -75479,7 +75980,7 @@ ${lanes.join("\n")} let inBoundsType = compilerOptions.noUncheckedIndexedAccess ? void 0 : possiblyOutOfBoundsType; for (let i = 0; i < elements.length; i++) { let type = possiblyOutOfBoundsType; - if (node.elements[i].kind === 229 /* SpreadElement */) { + if (node.elements[i].kind === 230 /* SpreadElement */) { type = inBoundsType = inBoundsType ?? (checkIteratedTypeOrElementType(65 /* Destructuring */, sourceType, undefinedType, node) || errorType); } checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, type, checkMode); @@ -75489,8 +75990,8 @@ ${lanes.join("\n")} function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) { const elements = node.elements; const element = elements[elementIndex]; - if (element.kind !== 231 /* OmittedExpression */) { - if (element.kind !== 229 /* SpreadElement */) { + if (element.kind !== 232 /* OmittedExpression */) { + if (element.kind !== 230 /* SpreadElement */) { const indexType = getNumberLiteralType(elementIndex); if (isArrayLikeType(sourceType)) { const accessFlags = 32 /* ExpressionPosition */ | (hasDefaultValue(element) ? 16 /* NoTupleBoundsCheck */ : 0); @@ -75502,11 +76003,11 @@ ${lanes.join("\n")} return checkDestructuringAssignment(element, elementType, checkMode); } if (elementIndex < elements.length - 1) { - error(element, Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); + error2(element, Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } else { const restExpression = element.expression; - if (restExpression.kind === 225 /* BinaryExpression */ && restExpression.operatorToken.kind === 64 /* EqualsToken */) { - error(restExpression.operatorToken, Diagnostics.A_rest_element_cannot_have_an_initializer); + if (restExpression.kind === 226 /* BinaryExpression */ && restExpression.operatorToken.kind === 64 /* EqualsToken */) { + error2(restExpression.operatorToken, Diagnostics.A_rest_element_cannot_have_an_initializer); } else { checkGrammarForDisallowedTrailingComma(node.elements, Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); const type = everyType(sourceType, isTupleType) ? mapType(sourceType, (t) => sliceTupleType(t, elementIndex)) : createArrayType(elementType); @@ -75518,7 +76019,7 @@ ${lanes.join("\n")} } function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode, rightIsThis) { let target; - if (exprOrAssignment.kind === 303 /* ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 304 /* ShorthandPropertyAssignment */) { const prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { if (strictNullChecks && !(getTypeFacts(checkExpression(prop.objectAssignmentInitializer)) & 16777216 /* IsUndefined */)) { @@ -75530,26 +76031,26 @@ ${lanes.join("\n")} } else { target = exprOrAssignment; } - if (target.kind === 225 /* BinaryExpression */ && target.operatorToken.kind === 64 /* EqualsToken */) { + if (target.kind === 226 /* BinaryExpression */ && target.operatorToken.kind === 64 /* EqualsToken */) { checkBinaryExpression(target, checkMode); target = target.left; if (strictNullChecks) { sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */); } } - if (target.kind === 209 /* ObjectLiteralExpression */) { + if (target.kind === 210 /* ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType, rightIsThis); } - if (target.kind === 208 /* ArrayLiteralExpression */) { + if (target.kind === 209 /* ArrayLiteralExpression */) { return checkArrayLiteralAssignment(target, sourceType, checkMode); } return checkReferenceAssignment(target, sourceType, checkMode); } function checkReferenceAssignment(target, sourceType, checkMode) { const targetType = checkExpression(target, checkMode); - const error2 = target.parent.kind === 304 /* SpreadAssignment */ ? Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; - const optionalError = target.parent.kind === 304 /* SpreadAssignment */ ? Diagnostics.The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access : Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access; - if (checkReferenceExpression(target, error2, optionalError)) { + const error3 = target.parent.kind === 305 /* SpreadAssignment */ ? Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; + const optionalError = target.parent.kind === 305 /* SpreadAssignment */ ? Diagnostics.The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access : Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access; + if (checkReferenceExpression(target, error3, optionalError)) { checkTypeAssignableToAndOptionallyElaborate(sourceType, targetType, target, target); } if (isPrivateIdentifierPropertyAccessExpression(target)) { @@ -75563,8 +76064,8 @@ ${lanes.join("\n")} case 80 /* Identifier */: case 11 /* StringLiteral */: case 14 /* RegularExpressionLiteral */: - case 214 /* TaggedTemplateExpression */: - case 227 /* TemplateExpression */: + case 215 /* TaggedTemplateExpression */: + case 228 /* TemplateExpression */: case 15 /* NoSubstitutionTemplateLiteral */: case 9 /* NumericLiteral */: case 10 /* BigIntLiteral */: @@ -75572,25 +76073,25 @@ ${lanes.join("\n")} case 97 /* FalseKeyword */: case 106 /* NullKeyword */: case 157 /* UndefinedKeyword */: - case 217 /* FunctionExpression */: - case 230 /* ClassExpression */: - case 218 /* ArrowFunction */: - case 208 /* ArrayLiteralExpression */: - case 209 /* ObjectLiteralExpression */: - case 220 /* TypeOfExpression */: - case 234 /* NonNullExpression */: - case 284 /* JsxSelfClosingElement */: - case 283 /* JsxElement */: + case 218 /* FunctionExpression */: + case 231 /* ClassExpression */: + case 219 /* ArrowFunction */: + case 209 /* ArrayLiteralExpression */: + case 210 /* ObjectLiteralExpression */: + case 221 /* TypeOfExpression */: + case 235 /* NonNullExpression */: + case 285 /* JsxSelfClosingElement */: + case 284 /* JsxElement */: return true; - case 226 /* ConditionalExpression */: + case 227 /* ConditionalExpression */: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: if (isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 223 /* PrefixUnaryExpression */: - case 224 /* PostfixUnaryExpression */: + case 224 /* PrefixUnaryExpression */: + case 225 /* PostfixUnaryExpression */: switch (node.operator) { case 54 /* ExclamationToken */: case 40 /* PlusToken */: @@ -75599,9 +76100,9 @@ ${lanes.join("\n")} return true; } return false; - case 221 /* VoidExpression */: - case 215 /* TypeAssertionExpression */: - case 233 /* AsExpression */: + case 222 /* VoidExpression */: + case 216 /* TypeAssertionExpression */: + case 234 /* AsExpression */: default: return false; } @@ -75645,7 +76146,7 @@ ${lanes.join("\n")} } checkGrammarNullishCoalesceWithLogicalExpression(node); const operator = node.operatorToken.kind; - if (operator === 64 /* EqualsToken */ && (node.left.kind === 209 /* ObjectLiteralExpression */ || node.left.kind === 208 /* ArrayLiteralExpression */)) { + if (operator === 64 /* EqualsToken */ && (node.left.kind === 210 /* ObjectLiteralExpression */ || node.left.kind === 209 /* ArrayLiteralExpression */)) { state.skip = true; setLastResult(state, checkDestructuringAssignment(node.left, checkExpression(node.right, checkMode), checkMode, node.right.kind === 110 /* ThisKeyword */)); return state; @@ -75670,7 +76171,7 @@ ${lanes.join("\n")} const operator = operatorToken.kind; if (isLogicalOrCoalescingBinaryOperator(operator)) { let parent2 = node.parent; - while (parent2.kind === 216 /* ParenthesizedExpression */ || isLogicalOrCoalescingBinaryExpression(parent2)) { + while (parent2.kind === 217 /* ParenthesizedExpression */ || isLogicalOrCoalescingBinaryExpression(parent2)) { parent2 = parent2.parent; } if (operator === 56 /* AmpersandAmpersandToken */ || isIfStatement(parent2)) { @@ -75694,7 +76195,7 @@ ${lanes.join("\n")} Debug.assertIsDefined(leftType); const rightType = getLastResult(state); Debug.assertIsDefined(rightType); - result = checkBinaryLikeExpressionWorker(node.left, node.operatorToken, node.right, leftType, rightType, node); + result = checkBinaryLikeExpressionWorker(node.left, node.operatorToken, node.right, leftType, rightType, state.checkMode, node); } state.skip = false; setLeftType( @@ -75746,7 +76247,7 @@ ${lanes.join("\n")} } function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) { const operator = operatorToken.kind; - if (operator === 64 /* EqualsToken */ && (left.kind === 209 /* ObjectLiteralExpression */ || left.kind === 208 /* ArrayLiteralExpression */)) { + if (operator === 64 /* EqualsToken */ && (left.kind === 210 /* ObjectLiteralExpression */ || left.kind === 209 /* ArrayLiteralExpression */)) { return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 110 /* ThisKeyword */); } let leftType; @@ -75756,9 +76257,9 @@ ${lanes.join("\n")} leftType = checkExpression(left, checkMode); } const rightType = checkExpression(right, checkMode); - return checkBinaryLikeExpressionWorker(left, operatorToken, right, leftType, rightType, errorNode); + return checkBinaryLikeExpressionWorker(left, operatorToken, right, leftType, rightType, checkMode, errorNode); } - function checkBinaryLikeExpressionWorker(left, operatorToken, right, leftType, rightType, errorNode) { + function checkBinaryLikeExpressionWorker(left, operatorToken, right, leftType, rightType, checkMode, errorNode) { const operator = operatorToken.kind; switch (operator) { case 42 /* AsteriskToken */: @@ -75790,7 +76291,7 @@ ${lanes.join("\n")} rightType = checkNonNullType(rightType, right); let suggestedOperator; if (leftType.flags & 528 /* BooleanLike */ && rightType.flags & 528 /* BooleanLike */ && (suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind)) !== void 0) { - error(errorNode || operatorToken, Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, tokenToString(operatorToken.kind), tokenToString(suggestedOperator)); + error2(errorNode || operatorToken, Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, tokenToString(operatorToken.kind), tokenToString(suggestedOperator)); return numberType; } else { const leftOk = checkArithmeticOperandType( @@ -75820,7 +76321,7 @@ ${lanes.join("\n")} case 43 /* AsteriskAsteriskToken */: case 68 /* AsteriskAsteriskEqualsToken */: if (languageVersion < 3 /* ES2016 */) { - error(errorNode, Diagnostics.Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_later); + error2(errorNode, Diagnostics.Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_later); } } resultType2 = bigintType; @@ -75915,12 +76416,15 @@ ${lanes.join("\n")} case 36 /* ExclamationEqualsToken */: case 37 /* EqualsEqualsEqualsToken */: case 38 /* ExclamationEqualsEqualsToken */: - if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) { - const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */; - error(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true"); + if (!(checkMode && checkMode & 128 /* TypeOnly */)) { + if ((isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) && // only report for === and !== in JS, not == or != + (!isInJSFile(left) || (operator === 37 /* EqualsEqualsEqualsToken */ || operator === 38 /* ExclamationEqualsEqualsToken */))) { + const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */; + error2(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true"); + } + checkNaNEquality(errorNode, operator, left, right); + reportOperatorErrorUnless((left2, right2) => isTypeEqualityComparableTo(left2, right2) || isTypeEqualityComparableTo(right2, left2)); } - checkNaNEquality(errorNode, operator, left, right); - reportOperatorErrorUnless((left2, right2) => isTypeEqualityComparableTo(left2, right2) || isTypeEqualityComparableTo(right2, left2)); return booleanType; case 104 /* InstanceOfKeyword */: return checkInstanceOfExpression(left, right, leftType, rightType); @@ -75973,7 +76477,7 @@ ${lanes.join("\n")} return textSpanContainsPosition(diag2, start); }); if (!isInDiag2657) - error(left, Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects); + error2(left, Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects); } return rightType; default: @@ -76007,13 +76511,13 @@ ${lanes.join("\n")} } } function isIndirectCall(node) { - return node.parent.kind === 216 /* ParenthesizedExpression */ && isNumericLiteral(node.left) && node.left.text === "0" && (isCallExpression(node.parent.parent) && node.parent.parent.expression === node.parent || node.parent.parent.kind === 214 /* TaggedTemplateExpression */) && // special-case for "eval" because it's the only non-access case where an indirect call actually affects behavior. + return node.parent.kind === 217 /* ParenthesizedExpression */ && isNumericLiteral(node.left) && node.left.text === "0" && (isCallExpression(node.parent.parent) && node.parent.parent.expression === node.parent || node.parent.parent.kind === 215 /* TaggedTemplateExpression */) && // special-case for "eval" because it's the only non-access case where an indirect call actually affects behavior. (isAccessExpression(node.right) || isIdentifier(node.right) && node.right.escapedText === "eval"); } function checkForDisallowedESSymbolOperand(operator2) { const offendingSymbolOperand = maybeTypeOfKindConsideringBaseConstraint(leftType, 12288 /* ESSymbolLike */) ? left : maybeTypeOfKindConsideringBaseConstraint(rightType, 12288 /* ESSymbolLike */) ? right : void 0; if (offendingSymbolOperand) { - error(offendingSymbolOperand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(operator2)); + error2(offendingSymbolOperand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(operator2)); return false; } return true; @@ -76039,7 +76543,7 @@ ${lanes.join("\n")} } function checkAssignmentOperatorWorker() { let assigneeType = leftType; - if (isCompoundAssignment(operatorToken.kind) && left.kind === 210 /* PropertyAccessExpression */) { + if (isCompoundAssignment(operatorToken.kind) && left.kind === 211 /* PropertyAccessExpression */) { assigneeType = checkPropertyAccessExpression( left, /*checkMode*/ @@ -76134,7 +76638,7 @@ ${lanes.join("\n")} const isLeftNaN = isGlobalNaN(skipParentheses(left2)); const isRightNaN = isGlobalNaN(skipParentheses(right2)); if (isLeftNaN || isRightNaN) { - const err = error( + const err = error2( errorNode2, Diagnostics.This_condition_will_always_return_0, tokenToString(operator2 === 37 /* EqualsEqualsEqualsToken */ || operator2 === 35 /* EqualsEqualsToken */ ? 97 /* FalseKeyword */ : 112 /* TrueKeyword */) @@ -76215,23 +76719,23 @@ ${lanes.join("\n")} void 0 ); if (!contextualType || isTypeAny(contextualType)) { - error(node, Diagnostics.yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation); + error2(node, Diagnostics.yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation); } } }); } return type; function checkYieldExpressionGrammar() { - if (!(node.flags & 8192 /* YieldContext */)) { + if (!(node.flags & 16384 /* YieldContext */)) { grammarErrorOnFirstToken(node, Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body); } if (isInParameterInitializerBeforeContainingFunction(node)) { - error(node, Diagnostics.yield_expressions_cannot_be_used_in_a_parameter_initializer); + error2(node, Diagnostics.yield_expressions_cannot_be_used_in_a_parameter_initializer); } } } function checkConditionalExpression(node, checkMode) { - const type = checkTruthinessExpression(node.condition); + const type = checkTruthinessExpression(node.condition, checkMode); checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue); const type1 = checkExpression(node.whenTrue, checkMode); const type2 = checkExpression(node.whenFalse, checkMode); @@ -76247,16 +76751,20 @@ ${lanes.join("\n")} for (const span of node.templateSpans) { const type = checkExpression(span.expression); if (maybeTypeOfKindConsideringBaseConstraint(type, 12288 /* ESSymbolLike */)) { - error(span.expression, Diagnostics.Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_in_String); + error2(span.expression, Diagnostics.Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_in_String); } texts.push(span.literal.text); types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType); } - return isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType2( + if (isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType2( node, /*contextFlags*/ void 0 - ) || unknownType, isTemplateLiteralContextualType) ? getTemplateLiteralType(texts, types) : stringType; + ) || unknownType, isTemplateLiteralContextualType)) { + return getTemplateLiteralType(texts, types); + } + const evaluated = node.parent.kind !== 215 /* TaggedTemplateExpression */ && evaluateTemplateExpression(node); + return evaluated ? getFreshTypeOfLiteralType(getStringLiteralType(evaluated)) : stringType; } function isTemplateLiteralContextualType(type) { return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */)); @@ -76312,7 +76820,7 @@ ${lanes.join("\n")} /*excludeJSDocTypeAssertions*/ true ); - return node.kind === 215 /* TypeAssertionExpression */ || node.kind === 233 /* AsExpression */ || isJSDocTypeAssertion(node); + return node.kind === 216 /* TypeAssertionExpression */ || node.kind === 234 /* AsExpression */ || isJSDocTypeAssertion(node); } function checkDeclarationInitializer(declaration, checkMode, contextualType) { const initializer = getEffectiveInitializer(declaration); @@ -76329,7 +76837,7 @@ ${lanes.join("\n")} void 0, checkMode || 0 /* Normal */ ) : checkExpressionCached(initializer, checkMode)); - return isParameter(declaration) && declaration.name.kind === 206 /* ArrayBindingPattern */ && isTupleType(type) && !type.target.hasRestElement && getTypeReferenceArity(type) < declaration.name.elements.length ? padTupleType(type, declaration.name) : type; + return isParameter(declaration) && declaration.name.kind === 207 /* ArrayBindingPattern */ && isTupleType(type) && !type.target.hasRestElement && getTypeReferenceArity(type) < declaration.name.elements.length ? padTupleType(type, declaration.name) : type; } function padTupleType(type, pattern) { const patternElements = pattern.elements; @@ -76337,7 +76845,7 @@ ${lanes.join("\n")} const elementFlags = type.target.elementFlags.slice(); for (let i = getTypeReferenceArity(type); i < patternElements.length; i++) { const e = patternElements[i]; - if (i < patternElements.length - 1 || !(e.kind === 207 /* BindingElement */ && e.dotDotDotToken)) { + if (i < patternElements.length - 1 || !(e.kind === 208 /* BindingElement */ && e.dotDotDotToken)) { elementTypes.push(!isOmittedExpression(e) && hasDefaultValue(e) ? getTypeFromBindingElement( e, /*includePatternInType*/ @@ -76354,7 +76862,7 @@ ${lanes.join("\n")} return createTupleType(elementTypes, elementFlags, type.target.readonly); } function widenTypeInferredFromInitializer(declaration, type) { - const widened = getCombinedNodeFlags(declaration) & 2 /* Const */ || isDeclarationReadonly(declaration) ? type : getWidenedLiteralType(type); + const widened = getCombinedNodeFlagsCached(declaration) & 6 /* Constant */ || isDeclarationReadonly(declaration) ? type : getWidenedLiteralType(type); if (isInJSFile(declaration)) { if (isEmptyLiteralType(widened)) { reportImplicitAny(declaration, anyType); @@ -76398,14 +76906,14 @@ ${lanes.join("\n")} )); } function checkPropertyAssignment(node, checkMode) { - if (node.name.kind === 166 /* ComputedPropertyName */) { + if (node.name.kind === 167 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } return checkExpressionForMutableLocation(node.initializer, checkMode); } function checkObjectLiteralMethod(node, checkMode) { checkGrammarMethod(node); - if (node.name.kind === 166 /* ComputedPropertyName */) { + if (node.name.kind === 167 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } const uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -76561,18 +77069,18 @@ ${lanes.join("\n")} if (quickType) { return quickType; } - if (node.flags & 134217728 /* TypeCached */ && flowTypeCache) { + if (node.flags & 268435456 /* TypeCached */ && flowTypeCache) { const cachedType = flowTypeCache[getNodeId(node)]; if (cachedType) { return cachedType; } } const startInvocationCount = flowInvocationCount; - const type = checkExpression(node); + const type = checkExpression(node, 128 /* TypeOnly */); if (flowInvocationCount !== startInvocationCount) { const cache = flowTypeCache || (flowTypeCache = []); cache[getNodeId(node)] = type; - setNodeFlags(node, node.flags | 134217728 /* TypeCached */); + setNodeFlags(node, node.flags | 268435456 /* TypeCached */); } return type; } @@ -76637,15 +77145,15 @@ ${lanes.join("\n")} return type; } function checkConstEnumAccess(node, type) { - const ok = node.parent.kind === 210 /* PropertyAccessExpression */ && node.parent.expression === node || node.parent.kind === 211 /* ElementAccessExpression */ && node.parent.expression === node || ((node.kind === 80 /* Identifier */ || node.kind === 165 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || node.parent.kind === 185 /* TypeQuery */ && node.parent.exprName === node) || node.parent.kind === 280 /* ExportSpecifier */; + const ok = node.parent.kind === 211 /* PropertyAccessExpression */ && node.parent.expression === node || node.parent.kind === 212 /* ElementAccessExpression */ && node.parent.expression === node || ((node.kind === 80 /* Identifier */ || node.kind === 166 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || node.parent.kind === 186 /* TypeQuery */ && node.parent.exprName === node) || node.parent.kind === 281 /* ExportSpecifier */; if (!ok) { - error(node, 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); + error2(node, 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); } if (getIsolatedModules(compilerOptions)) { Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */)); const constEnumDeclaration = type.symbol.valueDeclaration; - if (constEnumDeclaration.flags & 16777216 /* Ambient */) { - error(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName); + if (constEnumDeclaration.flags & 33554432 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node)) { + error2(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName); } } } @@ -76664,9 +77172,9 @@ ${lanes.join("\n")} const kind = node.kind; if (cancellationToken) { switch (kind) { - case 230 /* ClassExpression */: - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: + case 231 /* ClassExpression */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } } @@ -76683,7 +77191,7 @@ ${lanes.join("\n")} return nullWideningType; case 15 /* NoSubstitutionTemplateLiteral */: case 11 /* StringLiteral */: - return hasSkipDirectInferenceFlag(node) ? anyType : getFreshTypeOfLiteralType(getStringLiteralType(node.text)); + return hasSkipDirectInferenceFlag(node) ? wildcardType : getFreshTypeOfLiteralType(getStringLiteralType(node.text)); case 9 /* NumericLiteral */: checkGrammarNumericLiteral(node); return getFreshTypeOfLiteralType(getNumberLiteralType(+node.text)); @@ -76697,81 +77205,81 @@ ${lanes.join("\n")} return trueType; case 97 /* FalseKeyword */: return falseType; - case 227 /* TemplateExpression */: + case 228 /* TemplateExpression */: return checkTemplateExpression(node); case 14 /* RegularExpressionLiteral */: return globalRegExpType; - case 208 /* ArrayLiteralExpression */: + case 209 /* ArrayLiteralExpression */: return checkArrayLiteral(node, checkMode, forceTuple); - case 209 /* ObjectLiteralExpression */: + case 210 /* ObjectLiteralExpression */: return checkObjectLiteral(node, checkMode); - case 210 /* PropertyAccessExpression */: + case 211 /* PropertyAccessExpression */: return checkPropertyAccessExpression(node, checkMode); - case 165 /* QualifiedName */: + case 166 /* QualifiedName */: return checkQualifiedName(node, checkMode); - case 211 /* ElementAccessExpression */: + case 212 /* ElementAccessExpression */: return checkIndexedAccess(node, checkMode); - case 212 /* CallExpression */: + case 213 /* CallExpression */: if (node.expression.kind === 102 /* ImportKeyword */) { return checkImportCallExpression(node); } - case 213 /* NewExpression */: + case 214 /* NewExpression */: return checkCallExpression(node, checkMode); - case 214 /* TaggedTemplateExpression */: + case 215 /* TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 216 /* ParenthesizedExpression */: + case 217 /* ParenthesizedExpression */: return checkParenthesizedExpression(node, checkMode); - case 230 /* ClassExpression */: + case 231 /* ClassExpression */: return checkClassExpression(node); - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); - case 220 /* TypeOfExpression */: + case 221 /* TypeOfExpression */: return checkTypeOfExpression(node); - case 215 /* TypeAssertionExpression */: - case 233 /* AsExpression */: + case 216 /* TypeAssertionExpression */: + case 234 /* AsExpression */: return checkAssertion(node, checkMode); - case 234 /* NonNullExpression */: + case 235 /* NonNullExpression */: return checkNonNullAssertion(node); - case 232 /* ExpressionWithTypeArguments */: + case 233 /* ExpressionWithTypeArguments */: return checkExpressionWithTypeArguments(node); - case 237 /* SatisfiesExpression */: + case 238 /* SatisfiesExpression */: return checkSatisfiesExpression(node); - case 235 /* MetaProperty */: + case 236 /* MetaProperty */: return checkMetaProperty(node); - case 219 /* DeleteExpression */: + case 220 /* DeleteExpression */: return checkDeleteExpression(node); - case 221 /* VoidExpression */: + case 222 /* VoidExpression */: return checkVoidExpression(node); - case 222 /* AwaitExpression */: + case 223 /* AwaitExpression */: return checkAwaitExpression(node); - case 223 /* PrefixUnaryExpression */: + case 224 /* PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 224 /* PostfixUnaryExpression */: + case 225 /* PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: return checkBinaryExpression(node, checkMode); - case 226 /* ConditionalExpression */: + case 227 /* ConditionalExpression */: return checkConditionalExpression(node, checkMode); - case 229 /* SpreadElement */: + case 230 /* SpreadElement */: return checkSpreadExpression(node, checkMode); - case 231 /* OmittedExpression */: + case 232 /* OmittedExpression */: return undefinedWideningType; - case 228 /* YieldExpression */: + case 229 /* YieldExpression */: return checkYieldExpression(node); - case 236 /* SyntheticExpression */: + case 237 /* SyntheticExpression */: return checkSyntheticExpression(node); - case 293 /* JsxExpression */: + case 294 /* JsxExpression */: return checkJsxExpression(node, checkMode); - case 283 /* JsxElement */: + case 284 /* JsxElement */: return checkJsxElement(node, checkMode); - case 284 /* JsxSelfClosingElement */: + case 285 /* JsxSelfClosingElement */: return checkJsxSelfClosingElement(node, checkMode); - case 287 /* JsxFragment */: + case 288 /* JsxFragment */: return checkJsxFragment(node); - case 291 /* JsxAttributes */: + case 292 /* JsxAttributes */: return checkJsxAttributes(node, checkMode); - case 285 /* JsxOpeningElement */: + case 286 /* JsxOpeningElement */: Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return errorType; @@ -76786,7 +77294,7 @@ ${lanes.join("\n")} const typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(node)); getBaseConstraintOfType(typeParameter); if (!hasNonCircularTypeParameterDefault(typeParameter)) { - error(node.default, Diagnostics.Type_parameter_0_has_a_circular_default, typeToString(typeParameter)); + error2(node.default, Diagnostics.Type_parameter_0_has_a_circular_default, typeToString(typeParameter)); } const constraintType = getConstraintOfTypeParameter(typeParameter); const defaultType = getDefaultFromTypeParameter(typeParameter); @@ -76804,7 +77312,7 @@ ${lanes.join("\n")} if (modifiers) { const symbol = getSymbolOfDeclaration(node.parent); if (isTypeAliasDeclaration(node.parent) && !(getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (16 /* Anonymous */ | 32 /* Mapped */))) { - error(node, Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types); + error2(node, Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types); } else if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) { (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.CheckTypes, "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) }); const source = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSubTypeForCheck : markerSuperTypeForCheck); @@ -76823,38 +77331,38 @@ ${lanes.join("\n")} checkVariableLikeDeclaration(node); const func = getContainingFunction(node); if (hasSyntacticModifier(node, 16476 /* ParameterPropertyModifier */)) { - if (!(func.kind === 175 /* Constructor */ && nodeIsPresent(func.body))) { - error(node, Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); + if (!(func.kind === 176 /* Constructor */ && nodeIsPresent(func.body))) { + error2(node, Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } - if (func.kind === 175 /* Constructor */ && isIdentifier(node.name) && node.name.escapedText === "constructor") { - error(node.name, Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name); + if (func.kind === 176 /* Constructor */ && isIdentifier(node.name) && node.name.escapedText === "constructor") { + error2(node.name, Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name); } } if (!node.initializer && isOptionalDeclaration(node) && isBindingPattern(node.name) && func.body) { - error(node, Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature); + error2(node, Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature); } if (node.name && isIdentifier(node.name) && (node.name.escapedText === "this" || node.name.escapedText === "new")) { if (func.parameters.indexOf(node) !== 0) { - error(node, Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText); + error2(node, Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText); } - if (func.kind === 175 /* Constructor */ || func.kind === 179 /* ConstructSignature */ || func.kind === 184 /* ConstructorType */) { - error(node, Diagnostics.A_constructor_cannot_have_a_this_parameter); + if (func.kind === 176 /* Constructor */ || func.kind === 180 /* ConstructSignature */ || func.kind === 185 /* ConstructorType */) { + error2(node, Diagnostics.A_constructor_cannot_have_a_this_parameter); } - if (func.kind === 218 /* ArrowFunction */) { - error(node, Diagnostics.An_arrow_function_cannot_have_a_this_parameter); + if (func.kind === 219 /* ArrowFunction */) { + error2(node, Diagnostics.An_arrow_function_cannot_have_a_this_parameter); } - if (func.kind === 176 /* GetAccessor */ || func.kind === 177 /* SetAccessor */) { - error(node, Diagnostics.get_and_set_accessors_cannot_declare_this_parameters); + if (func.kind === 177 /* GetAccessor */ || func.kind === 178 /* SetAccessor */) { + error2(node, Diagnostics.get_and_set_accessors_cannot_declare_this_parameters); } } if (node.dotDotDotToken && !isBindingPattern(node.name) && !isTypeAssignableTo(getReducedType(getTypeOfSymbol(node.symbol)), anyReadonlyArrayType)) { - error(node, Diagnostics.A_rest_parameter_must_be_of_an_array_type); + error2(node, Diagnostics.A_rest_parameter_must_be_of_an_array_type); } } function checkTypePredicate(node) { const parent2 = getTypePredicateParent(node); if (!parent2) { - error(node, Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods); + error2(node, Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods); return; } const signature = getSignatureFromDeclaration(parent2); @@ -76869,7 +77377,7 @@ ${lanes.join("\n")} } else { if (typePredicate.parameterIndex >= 0) { if (signatureHasRestParameter(signature) && typePredicate.parameterIndex === signature.parameters.length - 1) { - error(parameterName, Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter); + error2(parameterName, Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter); } else { if (typePredicate.type) { const leadingError = () => chainDiagnosticMessages( @@ -76896,20 +77404,20 @@ ${lanes.join("\n")} } } if (!hasReportedError) { - error(node.parameterName, Diagnostics.Cannot_find_parameter_0, typePredicate.parameterName); + error2(node.parameterName, Diagnostics.Cannot_find_parameter_0, typePredicate.parameterName); } } } } function getTypePredicateParent(node) { switch (node.parent.kind) { - case 218 /* ArrowFunction */: - case 178 /* CallSignature */: - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 183 /* FunctionType */: - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: + case 219 /* ArrowFunction */: + case 179 /* CallSignature */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 184 /* FunctionType */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: const parent2 = node.parent; if (node === parent2.type) { return parent2; @@ -76923,13 +77431,13 @@ ${lanes.join("\n")} } const name = element.name; if (name.kind === 80 /* Identifier */ && name.escapedText === predicateVariableName) { - error( + error2( predicateVariableNode, Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName ); return true; - } else if (name.kind === 206 /* ArrayBindingPattern */ || name.kind === 205 /* ObjectBindingPattern */) { + } else if (name.kind === 207 /* ArrayBindingPattern */ || name.kind === 206 /* ObjectBindingPattern */) { if (checkIfTypePredicateVariableIsDeclaredInBindingPattern( name, predicateVariableNode, @@ -76941,9 +77449,9 @@ ${lanes.join("\n")} } } function checkSignatureDeclaration(node) { - if (node.kind === 180 /* IndexSignature */) { + if (node.kind === 181 /* IndexSignature */) { checkGrammarIndexSignature(node); - } else if (node.kind === 183 /* FunctionType */ || node.kind === 261 /* FunctionDeclaration */ || node.kind === 184 /* ConstructorType */ || node.kind === 178 /* CallSignature */ || node.kind === 175 /* Constructor */ || node.kind === 179 /* ConstructSignature */) { + } else if (node.kind === 184 /* FunctionType */ || node.kind === 262 /* FunctionDeclaration */ || node.kind === 185 /* ConstructorType */ || node.kind === 179 /* CallSignature */ || node.kind === 176 /* Constructor */ || node.kind === 180 /* ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } const functionFlags = getFunctionFlags(node); @@ -76967,35 +77475,46 @@ ${lanes.join("\n")} addLazyDiagnostic(checkSignatureDeclarationDiagnostics); function checkSignatureDeclarationDiagnostics() { checkCollisionWithArgumentsInGeneratedCode(node); - const returnTypeNode = getEffectiveReturnTypeNode(node); + let returnTypeNode = getEffectiveReturnTypeNode(node); + let returnTypeErrorLocation = returnTypeNode; + if (isInJSFile(node)) { + const typeTag = getJSDocTypeTag(node); + if (typeTag && typeTag.typeExpression && isTypeReferenceNode(typeTag.typeExpression.type)) { + const signature = getSingleCallSignature(getTypeFromTypeNode(typeTag.typeExpression)); + if (signature && signature.declaration) { + returnTypeNode = getEffectiveReturnTypeNode(signature.declaration); + returnTypeErrorLocation = typeTag.typeExpression.type; + } + } + } if (noImplicitAny && !returnTypeNode) { switch (node.kind) { - case 179 /* ConstructSignature */: - error(node, Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); + case 180 /* ConstructSignature */: + error2(node, Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 178 /* CallSignature */: - error(node, Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); + case 179 /* CallSignature */: + error2(node, Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } } - if (returnTypeNode) { + if (returnTypeNode && returnTypeErrorLocation) { const functionFlags2 = getFunctionFlags(node); if ((functionFlags2 & (4 /* Invalid */ | 1 /* Generator */)) === 1 /* Generator */) { const returnType = getTypeFromTypeNode(returnTypeNode); if (returnType === voidType) { - error(returnTypeNode, Diagnostics.A_generator_cannot_have_a_void_type_annotation); + error2(returnTypeErrorLocation, Diagnostics.A_generator_cannot_have_a_void_type_annotation); } else { const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || anyType; const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || generatorYieldType; const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || unknownType; const generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags2 & 2 /* Async */)); - checkTypeAssignableTo(generatorInstantiation, returnType, returnTypeNode); + checkTypeAssignableTo(generatorInstantiation, returnType, returnTypeErrorLocation); } } else if ((functionFlags2 & 3 /* AsyncGenerator */) === 2 /* Async */) { - checkAsyncFunctionReturnType(node, returnTypeNode); + checkAsyncFunctionReturnType(node, returnTypeNode, returnTypeErrorLocation); } } - if (node.kind !== 180 /* IndexSignature */ && node.kind !== 323 /* JSDocFunctionType */) { + if (node.kind !== 181 /* IndexSignature */ && node.kind !== 324 /* JSDocFunctionType */) { registerForUnusedIdentifiersCheck(node); } } @@ -77005,7 +77524,7 @@ ${lanes.join("\n")} const staticNames = /* @__PURE__ */ new Map(); const privateIdentifiers = /* @__PURE__ */ new Map(); for (const member of node.members) { - if (member.kind === 175 /* Constructor */) { + if (member.kind === 176 /* Constructor */) { for (const param of member.parameters) { if (isParameterPropertyDeclaration(param, member) && !isBindingPattern(param.name)) { addName(instanceNames, param.name, param.name.escapedText, 3 /* GetOrSetAccessor */); @@ -77023,16 +77542,16 @@ ${lanes.join("\n")} const memberName = name && getPropertyNameForPropertyNameNode(name); if (memberName) { switch (member.kind) { - case 176 /* GetAccessor */: + case 177 /* GetAccessor */: addName(names, name, memberName, 1 /* GetAccessor */ | privateStaticFlags); break; - case 177 /* SetAccessor */: + case 178 /* SetAccessor */: addName(names, name, memberName, 2 /* SetAccessor */ | privateStaticFlags); break; - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: addName(names, name, memberName, 3 /* GetOrSetAccessor */ | privateStaticFlags); break; - case 173 /* MethodDeclaration */: + case 174 /* MethodDeclaration */: addName(names, name, memberName, 8 /* Method */ | privateStaticFlags); break; } @@ -77043,16 +77562,16 @@ ${lanes.join("\n")} const prev = names.get(name); if (prev) { if ((prev & 16 /* PrivateStatic */) !== (meaning & 16 /* PrivateStatic */)) { - error(location, Diagnostics.Duplicate_identifier_0_Static_and_instance_elements_cannot_share_the_same_private_name, getTextOfNode(location)); + error2(location, Diagnostics.Duplicate_identifier_0_Static_and_instance_elements_cannot_share_the_same_private_name, getTextOfNode(location)); } else { const prevIsMethod = !!(prev & 8 /* Method */); const isMethod = !!(meaning & 8 /* Method */); if (prevIsMethod || isMethod) { if (prevIsMethod !== isMethod) { - error(location, Diagnostics.Duplicate_identifier_0, getTextOfNode(location)); + error2(location, Diagnostics.Duplicate_identifier_0, getTextOfNode(location)); } } else if (prev & meaning & ~16 /* PrivateStatic */) { - error(location, Diagnostics.Duplicate_identifier_0, getTextOfNode(location)); + error2(location, Diagnostics.Duplicate_identifier_0, getTextOfNode(location)); } else { names.set(name, prev | meaning); } @@ -77073,10 +77592,13 @@ ${lanes.join("\n")} case "length": case "caller": case "arguments": + if (useDefineForClassFields) { + break; + } case "prototype": const message = Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1; const className = getNameOfSymbolAsWritten(getSymbolOfDeclaration(node)); - error(memberNameNode, message, memberName, className); + error2(memberNameNode, message, memberName, className); break; } } @@ -77085,7 +77607,7 @@ ${lanes.join("\n")} function checkObjectTypeForDuplicateDeclarations(node) { const names = /* @__PURE__ */ new Map(); for (const member of node.members) { - if (member.kind === 170 /* PropertySignature */) { + if (member.kind === 171 /* PropertySignature */) { let memberName; const name = member.name; switch (name.kind) { @@ -77100,8 +77622,8 @@ ${lanes.join("\n")} continue; } if (names.get(memberName)) { - error(getNameOfDeclaration(member.symbol.valueDeclaration), Diagnostics.Duplicate_identifier_0, memberName); - error(member.name, Diagnostics.Duplicate_identifier_0, memberName); + error2(getNameOfDeclaration(member.symbol.valueDeclaration), Diagnostics.Duplicate_identifier_0, memberName); + error2(member.name, Diagnostics.Duplicate_identifier_0, memberName); } else { names.set(memberName, true); } @@ -77109,7 +77631,7 @@ ${lanes.join("\n")} } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 263 /* InterfaceDeclaration */) { + if (node.kind === 264 /* InterfaceDeclaration */) { const nodeSymbol = getSymbolOfDeclaration(node); if (nodeSymbol.declarations && nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -77133,7 +77655,7 @@ ${lanes.join("\n")} indexSignatureMap.forEach((entry) => { if (entry.declarations.length > 1) { for (const declaration of entry.declarations) { - error(declaration, Diagnostics.Duplicate_index_signature_for_type_0, typeToString(entry.type)); + error2(declaration, Diagnostics.Duplicate_index_signature_for_type_0, typeToString(entry.type)); } } }); @@ -77144,13 +77666,13 @@ ${lanes.join("\n")} checkGrammarComputedPropertyName(node.name); checkVariableLikeDeclaration(node); setNodeLinksForPrivateIdentifierScope(node); - if (hasSyntacticModifier(node, 256 /* Abstract */) && node.kind === 171 /* PropertyDeclaration */ && node.initializer) { - error(node, Diagnostics.Property_0_cannot_have_an_initializer_because_it_is_marked_abstract, declarationNameToString(node.name)); + if (hasSyntacticModifier(node, 256 /* Abstract */) && node.kind === 172 /* PropertyDeclaration */ && node.initializer) { + error2(node, Diagnostics.Property_0_cannot_have_an_initializer_because_it_is_marked_abstract, declarationNameToString(node.name)); } } function checkPropertySignature(node) { if (isPrivateIdentifier(node.name)) { - error(node, Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies); + error2(node, Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies); } return checkPropertyDeclaration(node); } @@ -77158,21 +77680,21 @@ ${lanes.join("\n")} if (!checkGrammarMethod(node)) checkGrammarComputedPropertyName(node.name); if (isMethodDeclaration(node) && node.asteriskToken && isIdentifier(node.name) && idText(node.name) === "constructor") { - error(node.name, Diagnostics.Class_constructor_may_not_be_a_generator); + error2(node.name, Diagnostics.Class_constructor_may_not_be_a_generator); } checkFunctionOrMethodDeclaration(node); - if (hasSyntacticModifier(node, 256 /* Abstract */) && node.kind === 173 /* MethodDeclaration */ && node.body) { - error(node, Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, declarationNameToString(node.name)); + if (hasSyntacticModifier(node, 256 /* Abstract */) && node.kind === 174 /* MethodDeclaration */ && node.body) { + error2(node, Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, declarationNameToString(node.name)); } if (isPrivateIdentifier(node.name) && !getContainingClass(node)) { - error(node, Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies); + error2(node, Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies); } setNodeLinksForPrivateIdentifierScope(node); } function setNodeLinksForPrivateIdentifierScope(node) { if (isPrivateIdentifier(node.name) && languageVersion < 99 /* ESNext */) { for (let lexicalScope = getEnclosingBlockScopeContainer(node); !!lexicalScope; lexicalScope = getEnclosingBlockScopeContainer(lexicalScope)) { - getNodeLinks(lexicalScope).flags |= 4194304 /* ContainsClassWithPrivateIdentifiers */; + getNodeLinks(lexicalScope).flags |= 1048576 /* ContainsClassWithPrivateIdentifiers */; } if (isClassExpression(node.parent)) { const enclosingIterationStatement = getEnclosingIterationStatement(node.parent); @@ -77206,7 +77728,7 @@ ${lanes.join("\n")} if (isPrivateIdentifierClassElementDeclaration(n)) { return true; } - return n.kind === 171 /* PropertyDeclaration */ && !isStatic(n) && !!n.initializer; + return n.kind === 172 /* PropertyDeclaration */ && !isStatic(n) && !!n.initializer; } function checkConstructorDeclarationDiagnostics() { const containingClassDecl = node.parent; @@ -77216,12 +77738,12 @@ ${lanes.join("\n")} const superCall = findFirstSuperCall(node.body); if (superCall) { if (classExtendsNull) { - error(superCall, Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null); + error2(superCall, Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null); } - const superCallShouldBeRootLevel = (getEmitScriptTarget(compilerOptions) !== 99 /* ESNext */ || !useDefineForClassFields) && (some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) || some(node.parameters, (p) => hasSyntacticModifier(p, 16476 /* ParameterPropertyModifier */))); + const superCallShouldBeRootLevel = !emitStandardClassFields && (some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) || some(node.parameters, (p) => hasSyntacticModifier(p, 16476 /* ParameterPropertyModifier */))); if (superCallShouldBeRootLevel) { if (!superCallIsRootLevelInConstructor(superCall, node.body)) { - error(superCall, Diagnostics.A_super_call_must_be_a_root_level_statement_within_a_constructor_of_a_derived_class_that_contains_initialized_properties_parameter_properties_or_private_identifiers); + error2(superCall, Diagnostics.A_super_call_must_be_a_root_level_statement_within_a_constructor_of_a_derived_class_that_contains_initialized_properties_parameter_properties_or_private_identifiers); } else { let superCallStatement; for (const statement of node.body.statements) { @@ -77234,12 +77756,12 @@ ${lanes.join("\n")} } } if (superCallStatement === void 0) { - error(node, Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_to_refer_to_super_or_this_when_a_derived_class_contains_initialized_properties_parameter_properties_or_private_identifiers); + error2(node, Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_to_refer_to_super_or_this_when_a_derived_class_contains_initialized_properties_parameter_properties_or_private_identifiers); } } } } else if (!classExtendsNull) { - error(node, Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call); + error2(node, Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call); } } } @@ -77259,7 +77781,7 @@ ${lanes.join("\n")} } function checkAccessorDeclaration(node) { if (isIdentifier(node.name) && idText(node.name) === "constructor" && isClassLike(node.parent)) { - error(node.name, Diagnostics.Class_constructor_may_not_be_an_accessor); + error2(node.name, Diagnostics.Class_constructor_may_not_be_an_accessor); } addLazyDiagnostic(checkAccessorDeclarationDiagnostics); checkSourceElement(node.body); @@ -77269,36 +77791,36 @@ ${lanes.join("\n")} checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 176 /* GetAccessor */) { - if (!(node.flags & 16777216 /* Ambient */) && nodeIsPresent(node.body) && node.flags & 256 /* HasImplicitReturn */) { - if (!(node.flags & 512 /* HasExplicitReturn */)) { - error(node.name, Diagnostics.A_get_accessor_must_return_a_value); + if (node.kind === 177 /* GetAccessor */) { + if (!(node.flags & 33554432 /* Ambient */) && nodeIsPresent(node.body) && node.flags & 512 /* HasImplicitReturn */) { + if (!(node.flags & 1024 /* HasExplicitReturn */)) { + error2(node.name, Diagnostics.A_get_accessor_must_return_a_value); } } } - if (node.name.kind === 166 /* ComputedPropertyName */) { + if (node.name.kind === 167 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } if (hasBindableName(node)) { const symbol = getSymbolOfDeclaration(node); - const getter = getDeclarationOfKind(symbol, 176 /* GetAccessor */); - const setter = getDeclarationOfKind(symbol, 177 /* SetAccessor */); + const getter = getDeclarationOfKind(symbol, 177 /* GetAccessor */); + const setter = getDeclarationOfKind(symbol, 178 /* SetAccessor */); if (getter && setter && !(getNodeCheckFlags(getter) & 1 /* TypeChecked */)) { getNodeLinks(getter).flags |= 1 /* TypeChecked */; const getterFlags = getEffectiveModifierFlags(getter); const setterFlags = getEffectiveModifierFlags(setter); if ((getterFlags & 256 /* Abstract */) !== (setterFlags & 256 /* Abstract */)) { - error(getter.name, Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); - error(setter.name, Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); + error2(getter.name, Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); + error2(setter.name, Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); } if (getterFlags & 16 /* Protected */ && !(setterFlags & (16 /* Protected */ | 8 /* Private */)) || getterFlags & 8 /* Private */ && !(setterFlags & 8 /* Private */)) { - error(getter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter); - error(setter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter); + error2(getter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter); + error2(setter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter); } } } const returnType = getTypeOfAccessors(getSymbolOfDeclaration(node)); - if (node.kind === 176 /* GetAccessor */) { + if (node.kind === 177 /* GetAccessor */) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); } } @@ -77359,7 +77881,7 @@ ${lanes.join("\n")} } function checkTypeReferenceNode(node) { checkGrammarTypeArguments(node, node.typeArguments); - if (node.kind === 182 /* TypeReference */ && !isInJSFile(node) && !isInJSDoc(node) && node.typeArguments && node.typeName.end !== node.typeArguments.pos) { + if (node.kind === 183 /* TypeReference */ && !isInJSFile(node) && !isInJSDoc(node) && node.typeArguments && node.typeName.end !== node.typeArguments.pos) { const sourceFile = getSourceFileOfNode(node); if (scanTokenAtPosition(sourceFile, node.typeName.end) === 25 /* DotToken */) { grammarErrorAtPos(node, skipTrivia(sourceFile.text, node.typeName.end), 1, Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments); @@ -77381,7 +77903,7 @@ ${lanes.join("\n")} } const symbol = getNodeLinks(node).resolvedSymbol; if (symbol) { - if (some(symbol.declarations, (d) => isTypeDeclaration(d) && !!(d.flags & 268435456 /* Deprecated */))) { + if (some(symbol.declarations, (d) => isTypeDeclaration(d) && !!(d.flags & 536870912 /* Deprecated */))) { addDeprecatedSuggestion( getDeprecatedSuggestionNode(node), symbol.declarations, @@ -77421,17 +77943,12 @@ ${lanes.join("\n")} const elementTypes = node.elements; let seenOptionalElement = false; let seenRestElement = false; - const hasNamedElement = some(elementTypes, isNamedTupleMember); for (const e of elementTypes) { - if (e.kind !== 201 /* NamedTupleMember */ && hasNamedElement) { - grammarErrorOnNode(e, Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names); - break; - } const flags = getTupleElementFlags(e); if (flags & 8 /* Variadic */) { const type = getTypeFromTypeNode(e.type); if (!isArrayLikeType(type)) { - error(e, Diagnostics.A_rest_element_type_must_be_an_array_type); + error2(e, Diagnostics.A_rest_element_type_must_be_an_array_type); break; } if (isArrayType(type) || isTupleType(type) && type.target.combinedFlags & 4 /* Rest */) { @@ -77468,8 +77985,8 @@ ${lanes.join("\n")} const objectType = type.objectType; const indexType = type.indexType; if (isTypeAssignableTo(indexType, getIndexType(objectType, 0 /* None */))) { - if (accessNode.kind === 211 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) { - error(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); + if (accessNode.kind === 212 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) { + error2(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); } return type; } @@ -77482,12 +77999,12 @@ ${lanes.join("\n")} if (propertyName) { const propertySymbol = forEachType(apparentObjectType, (t) => getPropertyOfType(t, propertyName)); if (propertySymbol && getDeclarationModifierFlagsFromSymbol(propertySymbol) & 24 /* NonPublicAccessibilityModifier */) { - error(accessNode, Diagnostics.Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter, unescapeLeadingUnderscores(propertyName)); + error2(accessNode, Diagnostics.Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter, unescapeLeadingUnderscores(propertyName)); return errorType; } } } - error(accessNode, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); + error2(accessNode, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); return errorType; } function checkIndexedAccessType(node) { @@ -77529,7 +78046,7 @@ ${lanes.join("\n")} forEachChild(node, checkSourceElement); } function checkInferType(node) { - if (!findAncestor(node, (n) => n.parent && n.parent.kind === 193 /* ConditionalType */ && n.parent.extendsType === n)) { + if (!findAncestor(node, (n) => n.parent && n.parent.kind === 194 /* ConditionalType */ && n.parent.extendsType === n)) { grammarErrorOnNode(node, Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type); } checkSourceElement(node.typeParameter); @@ -77539,11 +78056,11 @@ ${lanes.join("\n")} if (!links.typeParametersChecked) { links.typeParametersChecked = true; const typeParameter = getDeclaredTypeOfTypeParameter(symbol); - const declarations = getDeclarationsOfKind(symbol, 167 /* TypeParameter */); + const declarations = getDeclarationsOfKind(symbol, 168 /* TypeParameter */); if (!areTypeParametersIdentical(declarations, [typeParameter], (decl) => [decl])) { const name = symbolToString(symbol); for (const declaration of declarations) { - error(declaration.name, Diagnostics.All_declarations_of_0_must_have_identical_constraints, name); + error2(declaration.name, Diagnostics.All_declarations_of_0_must_have_identical_constraints, name); } } } @@ -77577,22 +78094,23 @@ ${lanes.join("\n")} if (node.dotDotDotToken && node.questionToken) { grammarErrorOnNode(node, Diagnostics.A_tuple_member_cannot_be_both_optional_and_rest); } - if (node.type.kind === 189 /* OptionalType */) { + if (node.type.kind === 190 /* OptionalType */) { grammarErrorOnNode(node.type, Diagnostics.A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type); } - if (node.type.kind === 190 /* RestType */) { + if (node.type.kind === 191 /* RestType */) { grammarErrorOnNode(node.type, Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type); } checkSourceElement(node.type); getTypeFromTypeNode(node); } function isPrivateWithinAmbient(node) { - return (hasEffectiveModifier(node, 8 /* Private */) || isPrivateIdentifierClassElementDeclaration(node)) && !!(node.flags & 16777216 /* Ambient */); + return (hasEffectiveModifier(node, 8 /* Private */) || isPrivateIdentifierClassElementDeclaration(node)) && !!(node.flags & 33554432 /* Ambient */); } function getEffectiveDeclarationFlags(n, flagsToCheck) { - let flags = getCombinedModifierFlags(n); - if (n.parent.kind !== 263 /* InterfaceDeclaration */ && n.parent.kind !== 262 /* ClassDeclaration */ && n.parent.kind !== 230 /* ClassExpression */ && n.flags & 16777216 /* Ambient */) { - if (!(flags & 2 /* Ambient */) && !(isModuleBlock(n.parent) && isModuleDeclaration(n.parent.parent) && isGlobalScopeAugmentation(n.parent.parent))) { + let flags = getCombinedModifierFlagsCached(n); + if (n.parent.kind !== 264 /* InterfaceDeclaration */ && n.parent.kind !== 263 /* ClassDeclaration */ && n.parent.kind !== 231 /* ClassExpression */ && n.flags & 33554432 /* Ambient */) { + const container = getEnclosingContainer(n); + if (container && container.flags & 128 /* ExportContext */ && !(flags & 2 /* Ambient */) && !(isModuleBlock(n.parent) && isModuleDeclaration(n.parent.parent) && isGlobalScopeAugmentation(n.parent.parent))) { flags |= 1 /* Export */; } flags |= 2 /* Ambient */; @@ -77614,13 +78132,13 @@ ${lanes.join("\n")} forEach(overloads, (o) => { const deviation = getEffectiveDeclarationFlags(o, flagsToCheck2) ^ canonicalFlags; if (deviation & 1 /* Export */) { - error(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported); + error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported); } else if (deviation & 2 /* Ambient */) { - error(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient); + error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient); } else if (deviation & (8 /* Private */ | 16 /* Protected */)) { - error(getNameOfDeclaration(o) || o, Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); + error2(getNameOfDeclaration(o) || o, Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); } else if (deviation & 256 /* Abstract */) { - error(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract); + error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract); } }); } @@ -77631,7 +78149,7 @@ ${lanes.join("\n")} forEach(overloads, (o) => { const deviation = hasQuestionToken(o) !== canonicalHasQuestionToken; if (deviation) { - error(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_optional_or_required); + error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_optional_or_required); } }); } @@ -77667,27 +78185,27 @@ ${lanes.join("\n")} (isPrivateIdentifier(node.name) && isPrivateIdentifier(subsequentName) && node.name.escapedText === subsequentName.escapedText || // Both are computed property names isComputedPropertyName(node.name) && isComputedPropertyName(subsequentName) && isTypeIdenticalTo(checkComputedPropertyName(node.name), checkComputedPropertyName(subsequentName)) || // Both are literal property names that are the same. isPropertyNameLiteral(node.name) && isPropertyNameLiteral(subsequentName) && getEscapedTextOfIdentifierOrLiteral(node.name) === getEscapedTextOfIdentifierOrLiteral(subsequentName))) { - const reportError = (node.kind === 173 /* MethodDeclaration */ || node.kind === 172 /* MethodSignature */) && isStatic(node) !== isStatic(subsequentNode); + const reportError = (node.kind === 174 /* MethodDeclaration */ || node.kind === 173 /* MethodSignature */) && isStatic(node) !== isStatic(subsequentNode); if (reportError) { const diagnostic = isStatic(node) ? Diagnostics.Function_overload_must_be_static : Diagnostics.Function_overload_must_not_be_static; - error(errorNode2, diagnostic); + error2(errorNode2, diagnostic); } return; } if (nodeIsPresent(subsequentNode.body)) { - error(errorNode2, Diagnostics.Function_implementation_name_must_be_0, declarationNameToString(node.name)); + error2(errorNode2, Diagnostics.Function_implementation_name_must_be_0, declarationNameToString(node.name)); return; } } } const errorNode = node.name || node; if (isConstructor) { - error(errorNode, Diagnostics.Constructor_implementation_is_missing); + error2(errorNode, Diagnostics.Constructor_implementation_is_missing); } else { if (hasSyntacticModifier(node, 256 /* Abstract */)) { - error(errorNode, Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive); + error2(errorNode, Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive); } else { - error(errorNode, Diagnostics.Function_implementation_is_missing_or_not_immediately_following_the_declaration); + error2(errorNode, Diagnostics.Function_implementation_is_missing_or_not_immediately_following_the_declaration); } } } @@ -77698,15 +78216,15 @@ ${lanes.join("\n")} if (declarations) { for (const current of declarations) { const node = current; - const inAmbientContext = node.flags & 16777216 /* Ambient */; - const inAmbientContextOrInterface = node.parent && (node.parent.kind === 263 /* InterfaceDeclaration */ || node.parent.kind === 186 /* TypeLiteral */) || inAmbientContext; + const inAmbientContext = node.flags & 33554432 /* Ambient */; + const inAmbientContextOrInterface = node.parent && (node.parent.kind === 264 /* InterfaceDeclaration */ || node.parent.kind === 187 /* TypeLiteral */) || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = void 0; } - if ((node.kind === 262 /* ClassDeclaration */ || node.kind === 230 /* ClassExpression */) && !inAmbientContext) { + if ((node.kind === 263 /* ClassDeclaration */ || node.kind === 231 /* ClassExpression */) && !inAmbientContext) { hasNonAmbientClass = true; } - if (node.kind === 261 /* FunctionDeclaration */ || node.kind === 173 /* MethodDeclaration */ || node.kind === 172 /* MethodSignature */ || node.kind === 175 /* Constructor */) { + if (node.kind === 262 /* FunctionDeclaration */ || node.kind === 174 /* MethodDeclaration */ || node.kind === 173 /* MethodSignature */ || node.kind === 176 /* Constructor */) { functionDeclarations.push(node); const currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; @@ -77750,21 +78268,21 @@ ${lanes.join("\n")} } if (multipleConstructorImplementation) { forEach(functionDeclarations, (declaration) => { - error(declaration, Diagnostics.Multiple_constructor_implementations_are_not_allowed); + error2(declaration, Diagnostics.Multiple_constructor_implementations_are_not_allowed); }); } if (duplicateFunctionDeclaration) { forEach(functionDeclarations, (declaration) => { - error(getNameOfDeclaration(declaration) || declaration, Diagnostics.Duplicate_function_implementation); + error2(getNameOfDeclaration(declaration) || declaration, Diagnostics.Duplicate_function_implementation); }); } if (hasNonAmbientClass && !isConstructor && symbol.flags & 16 /* Function */ && declarations) { - const relatedDiagnostics = filter(declarations, (d) => d.kind === 262 /* ClassDeclaration */).map((d) => createDiagnosticForNode(d, Diagnostics.Consider_adding_a_declare_modifier_to_this_class)); + const relatedDiagnostics = filter(declarations, (d) => d.kind === 263 /* ClassDeclaration */).map((d) => createDiagnosticForNode(d, Diagnostics.Consider_adding_a_declare_modifier_to_this_class)); forEach(declarations, (declaration) => { - const diagnostic = declaration.kind === 262 /* ClassDeclaration */ ? Diagnostics.Class_declaration_cannot_implement_overload_list_for_0 : declaration.kind === 261 /* FunctionDeclaration */ ? Diagnostics.Function_with_bodies_can_only_merge_with_classes_that_are_ambient : void 0; + const diagnostic = declaration.kind === 263 /* ClassDeclaration */ ? Diagnostics.Class_declaration_cannot_implement_overload_list_for_0 : declaration.kind === 262 /* FunctionDeclaration */ ? Diagnostics.Function_with_bodies_can_only_merge_with_classes_that_are_ambient : void 0; if (diagnostic) { addRelatedInfo( - error(getNameOfDeclaration(declaration) || declaration, diagnostic, symbolName(symbol)), + error2(getNameOfDeclaration(declaration) || declaration, diagnostic, symbolName(symbol)), ...relatedDiagnostics ); } @@ -77785,7 +78303,7 @@ ${lanes.join("\n")} if (!isImplementationCompatibleWithOverload(bodySignature, signature)) { const errorNode = signature.declaration && isJSDocSignature(signature.declaration) ? signature.declaration.parent.tagName : signature.declaration; addRelatedInfo( - error(errorNode, Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature), + error2(errorNode, Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature), createDiagnosticForNode(bodyDeclaration, Diagnostics.The_implementation_signature_is_declared_here) ); break; @@ -77832,54 +78350,54 @@ ${lanes.join("\n")} const declarationSpaces = getDeclarationSpaces(d); const name = getNameOfDeclaration(d); if (declarationSpaces & commonDeclarationSpacesForDefaultAndNonDefault) { - error(name, Diagnostics.Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead, declarationNameToString(name)); + error2(name, Diagnostics.Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead, declarationNameToString(name)); } else if (declarationSpaces & commonDeclarationSpacesForExportsAndLocals) { - error(name, Diagnostics.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local, declarationNameToString(name)); + error2(name, Diagnostics.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local, declarationNameToString(name)); } } } function getDeclarationSpaces(decl) { let d = decl; switch (d.kind) { - case 263 /* InterfaceDeclaration */: - case 264 /* TypeAliasDeclaration */: - case 352 /* JSDocTypedefTag */: - case 344 /* JSDocCallbackTag */: - case 346 /* JSDocEnumTag */: + case 264 /* InterfaceDeclaration */: + case 265 /* TypeAliasDeclaration */: + case 353 /* JSDocTypedefTag */: + case 345 /* JSDocCallbackTag */: + case 347 /* JSDocEnumTag */: return 2 /* ExportType */; - case 266 /* ModuleDeclaration */: + case 267 /* ModuleDeclaration */: return isAmbientModule(d) || getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 4 /* ExportNamespace */ | 1 /* ExportValue */ : 4 /* ExportNamespace */; - case 262 /* ClassDeclaration */: - case 265 /* EnumDeclaration */: - case 305 /* EnumMember */: + case 263 /* ClassDeclaration */: + case 266 /* EnumDeclaration */: + case 306 /* EnumMember */: return 2 /* ExportType */ | 1 /* ExportValue */; - case 311 /* SourceFile */: + case 312 /* SourceFile */: return 2 /* ExportType */ | 1 /* ExportValue */ | 4 /* ExportNamespace */; - case 276 /* ExportAssignment */: - case 225 /* BinaryExpression */: + case 277 /* ExportAssignment */: + case 226 /* BinaryExpression */: const node2 = d; const expression = isExportAssignment(node2) ? node2.expression : node2.right; if (!isEntityNameExpression(expression)) { return 1 /* ExportValue */; } d = expression; - case 270 /* ImportEqualsDeclaration */: - case 273 /* NamespaceImport */: - case 272 /* ImportClause */: + case 271 /* ImportEqualsDeclaration */: + case 274 /* NamespaceImport */: + case 273 /* ImportClause */: let result = 0 /* None */; const target = resolveAlias(getSymbolOfDeclaration(d)); forEach(target.declarations, (d2) => { result |= getDeclarationSpaces(d2); }); return result; - case 259 /* VariableDeclaration */: - case 207 /* BindingElement */: - case 261 /* FunctionDeclaration */: - case 275 /* ImportSpecifier */: + case 260 /* VariableDeclaration */: + case 208 /* BindingElement */: + case 262 /* FunctionDeclaration */: + case 276 /* ImportSpecifier */: case 80 /* Identifier */: return 1 /* ExportValue */; - case 172 /* MethodSignature */: - case 170 /* PropertySignature */: + case 173 /* MethodSignature */: + case 171 /* PropertySignature */: return 2 /* ExportType */; default: return Debug.failBadSyntaxKind(d); @@ -77914,7 +78432,7 @@ ${lanes.join("\n")} const thenSignatures = thenFunction ? getSignaturesOfType(thenFunction, 0 /* Call */) : emptyArray; if (thenSignatures.length === 0) { if (errorNode) { - error(errorNode, Diagnostics.A_promise_must_have_a_then_method); + error2(errorNode, Diagnostics.A_promise_must_have_a_then_method); } return void 0; } @@ -77934,7 +78452,7 @@ ${lanes.join("\n")} thisTypeForErrorOut.value = thisTypeForError; } if (errorNode) { - error(errorNode, Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1, typeToString(type), typeToString(thisTypeForError)); + error2(errorNode, Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1, typeToString(type), typeToString(thisTypeForError)); } return void 0; } @@ -77945,7 +78463,7 @@ ${lanes.join("\n")} const onfulfilledParameterSignatures = getSignaturesOfType(onfulfilledParameterType, 0 /* Call */); if (onfulfilledParameterSignatures.length === 0) { if (errorNode) { - error(errorNode, Diagnostics.The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback); + error2(errorNode, Diagnostics.The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback); } return void 0; } @@ -78026,7 +78544,7 @@ ${lanes.join("\n")} if (type.flags & 1048576 /* Union */) { if (awaitedTypeStack.lastIndexOf(type.id) >= 0) { if (errorNode) { - error(errorNode, Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method); + error2(errorNode, Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method); } return void 0; } @@ -78049,7 +78567,7 @@ ${lanes.join("\n")} if (promisedType) { if (type.id === promisedType.id || awaitedTypeStack.lastIndexOf(promisedType.id) >= 0) { if (errorNode) { - error(errorNode, Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method); + error2(errorNode, Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method); } return void 0; } @@ -78075,7 +78593,7 @@ ${lanes.join("\n")} } return typeAsAwaitable.awaitedTypeOfType = type; } - function checkAsyncFunctionReturnType(node, returnTypeNode) { + function checkAsyncFunctionReturnType(node, returnTypeNode, returnTypeErrorLocation) { const returnType = getTypeFromTypeNode(returnTypeNode); if (languageVersion >= 2 /* ES2015 */) { if (isErrorType(returnType)) { @@ -78086,7 +78604,7 @@ ${lanes.join("\n")} true ); if (globalPromiseType !== emptyGenericType && !isReferenceToType2(returnType, globalPromiseType)) { - error(returnTypeNode, Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0, typeToString(getAwaitedTypeNoAlias(returnType) || voidType)); + reportErrorForInvalidReturnType(Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0, returnTypeNode, returnTypeErrorLocation, typeToString(getAwaitedTypeNoAlias(returnType) || voidType)); return; } } else { @@ -78096,7 +78614,7 @@ ${lanes.join("\n")} } const promiseConstructorName = getEntityNameFromTypeNode(returnTypeNode); if (promiseConstructorName === void 0) { - error(returnTypeNode, Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, typeToString(returnType)); + reportErrorForInvalidReturnType(Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, returnTypeNode, returnTypeErrorLocation, typeToString(returnType)); return; } const promiseConstructorSymbol = resolveEntityName( @@ -78111,9 +78629,9 @@ ${lanes.join("\n")} /*reportErrors*/ false )) { - error(returnTypeNode, 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); + error2(returnTypeErrorLocation, 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 { - error(returnTypeNode, Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, entityNameToString(promiseConstructorName)); + reportErrorForInvalidReturnType(Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, returnTypeNode, returnTypeErrorLocation, entityNameToString(promiseConstructorName)); } return; } @@ -78122,21 +78640,22 @@ ${lanes.join("\n")} true ); if (globalPromiseConstructorLikeType === emptyObjectType) { - error(returnTypeNode, Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, entityNameToString(promiseConstructorName)); + reportErrorForInvalidReturnType(Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, returnTypeNode, returnTypeErrorLocation, entityNameToString(promiseConstructorName)); return; } - if (!checkTypeAssignableTo( - promiseConstructorType, - globalPromiseConstructorLikeType, - returnTypeNode, - Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value - )) { + const headMessage = Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value; + const errorInfo = () => returnTypeNode === returnTypeErrorLocation ? void 0 : chainDiagnosticMessages( + /*details*/ + void 0, + Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type + ); + if (!checkTypeAssignableTo(promiseConstructorType, globalPromiseConstructorLikeType, returnTypeErrorLocation, headMessage, errorInfo)) { return; } const rootName = promiseConstructorName && getFirstIdentifier(promiseConstructorName); const collidingSymbol = getSymbol2(node.locals, rootName.escapedText, 111551 /* Value */); if (collidingSymbol) { - error( + error2( collidingSymbol.valueDeclaration, Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, idText(rootName), @@ -78152,6 +78671,14 @@ ${lanes.join("\n")} node, Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member ); + function reportErrorForInvalidReturnType(message, returnTypeNode2, returnTypeErrorLocation2, typeName) { + if (returnTypeNode2 === returnTypeErrorLocation2) { + error2(returnTypeErrorLocation2, message, typeName); + } else { + const diag2 = error2(returnTypeErrorLocation2, Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type); + addRelatedInfo(diag2, createDiagnosticForNode(returnTypeNode2, message, typeName)); + } + } } function checkDecorator(node) { const signature = getResolvedSignature(node); @@ -78166,21 +78693,21 @@ ${lanes.join("\n")} let headMessage; const expectedReturnType = decoratorSignature.resolvedReturnType; switch (node.parent.kind) { - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: headMessage = Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; break; - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: if (!legacyDecorators) { headMessage = Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; break; } - case 168 /* Parameter */: + case 169 /* Parameter */: headMessage = Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any; break; - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: headMessage = Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; break; default: @@ -78249,7 +78776,7 @@ ${lanes.join("\n")} if (canCollectSymbolAliasAccessabilityData && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) { markAliasSymbolAsReferenced(rootSymbol); } else if (forDecoratorMetadata && getIsolatedModules(compilerOptions) && getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */ && !symbolIsValue(rootSymbol) && !some(rootSymbol.declarations, isTypeOnlyImportOrExportDeclaration)) { - const diag2 = error(typeName, Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled); + const diag2 = error2(typeName, Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled); const aliasDeclaration = find(rootSymbol.declarations || emptyArray, isAliasSymbolDeclaration2); if (aliasDeclaration) { addRelatedInfo(diag2, createDiagnosticForNode(aliasDeclaration, Diagnostics._0_was_imported_here, idText(rootName))); @@ -78270,15 +78797,15 @@ ${lanes.join("\n")} function getEntityNameForDecoratorMetadata(node) { if (node) { switch (node.kind) { - case 192 /* IntersectionType */: - case 191 /* UnionType */: + case 193 /* IntersectionType */: + case 192 /* UnionType */: return getEntityNameForDecoratorMetadataFromTypeList(node.types); - case 193 /* ConditionalType */: + case 194 /* ConditionalType */: return getEntityNameForDecoratorMetadataFromTypeList([node.trueType, node.falseType]); - case 195 /* ParenthesizedType */: - case 201 /* NamedTupleMember */: + case 196 /* ParenthesizedType */: + case 202 /* NamedTupleMember */: return getEntityNameForDecoratorMetadata(node.type); - case 182 /* TypeReference */: + case 183 /* TypeReference */: return node.typeName; } } @@ -78286,13 +78813,13 @@ ${lanes.join("\n")} function getEntityNameForDecoratorMetadataFromTypeList(types) { let commonEntityName; for (let typeNode of types) { - while (typeNode.kind === 195 /* ParenthesizedType */ || typeNode.kind === 201 /* NamedTupleMember */) { + while (typeNode.kind === 196 /* ParenthesizedType */ || typeNode.kind === 202 /* NamedTupleMember */) { typeNode = typeNode.type; } if (typeNode.kind === 146 /* NeverKeyword */) { continue; } - if (!strictNullChecks && (typeNode.kind === 200 /* LiteralType */ && typeNode.literal.kind === 106 /* NullKeyword */ || typeNode.kind === 157 /* UndefinedKeyword */)) { + if (!strictNullChecks && (typeNode.kind === 201 /* LiteralType */ && typeNode.literal.kind === 106 /* NullKeyword */ || typeNode.kind === 157 /* UndefinedKeyword */)) { continue; } const individualEntityName = getEntityNameForDecoratorMetadata(typeNode); @@ -78323,7 +78850,7 @@ ${lanes.join("\n")} } if (legacyDecorators) { checkExternalEmitHelpers(firstDecorator, 8 /* Decorate */); - if (node.kind === 168 /* Parameter */) { + if (node.kind === 169 /* Parameter */) { checkExternalEmitHelpers(firstDecorator, 32 /* Param */); } } else if (languageVersion < 99 /* ESNext */) { @@ -78349,7 +78876,7 @@ ${lanes.join("\n")} if (compilerOptions.emitDecoratorMetadata) { checkExternalEmitHelpers(firstDecorator, 16 /* Metadata */); switch (node.kind) { - case 262 /* ClassDeclaration */: + case 263 /* ClassDeclaration */: const constructor = getFirstConstructorWithBody(node); if (constructor) { for (const parameter of constructor.parameters) { @@ -78357,27 +78884,28 @@ ${lanes.join("\n")} } } break; - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - const otherKind = node.kind === 176 /* GetAccessor */ ? 177 /* SetAccessor */ : 176 /* GetAccessor */; + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + const otherKind = node.kind === 177 /* GetAccessor */ ? 178 /* SetAccessor */ : 177 /* GetAccessor */; const otherAccessor = getDeclarationOfKind(getSymbolOfDeclaration(node), otherKind); markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor)); break; - case 173 /* MethodDeclaration */: + case 174 /* MethodDeclaration */: for (const parameter of node.parameters) { markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveReturnTypeNode(node)); break; - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveTypeAnnotationNode(node)); break; - case 168 /* Parameter */: + case 169 /* Parameter */: markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); const containingSignature = node.parent; for (const parameter of containingSignature.parameters) { markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } + markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveReturnTypeNode(containingSignature)); break; } } @@ -78397,7 +78925,7 @@ ${lanes.join("\n")} } function checkJSDocTypeAliasTag(node) { if (!node.typeExpression) { - error(node.name, Diagnostics.JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags); + error2(node.name, Diagnostics.JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags); } if (node.name) { checkTypeNameIsReserved(node.name, Diagnostics.Type_alias_name_cannot_be_0); @@ -78422,7 +78950,7 @@ ${lanes.join("\n")} if (length(tags) > 1) { for (let i = 1; i < length(tags); i++) { const tagName = tags[i].tagName; - error(tagName, Diagnostics._0_tag_already_specified, idText(tagName)); + error2(tagName, Diagnostics._0_tag_already_specified, idText(tagName)); } } } @@ -78454,40 +78982,40 @@ ${lanes.join("\n")} function checkJSDocImplementsTag(node) { const classLike = getEffectiveJSDocHost(node); if (!classLike || !isClassDeclaration(classLike) && !isClassExpression(classLike)) { - error(classLike, Diagnostics.JSDoc_0_is_not_attached_to_a_class, idText(node.tagName)); + error2(classLike, Diagnostics.JSDoc_0_is_not_attached_to_a_class, idText(node.tagName)); } } function checkJSDocAugmentsTag(node) { const classLike = getEffectiveJSDocHost(node); if (!classLike || !isClassDeclaration(classLike) && !isClassExpression(classLike)) { - error(classLike, Diagnostics.JSDoc_0_is_not_attached_to_a_class, idText(node.tagName)); + error2(classLike, Diagnostics.JSDoc_0_is_not_attached_to_a_class, idText(node.tagName)); return; } const augmentsTags = getJSDocTags(classLike).filter(isJSDocAugmentsTag); Debug.assert(augmentsTags.length > 0); if (augmentsTags.length > 1) { - error(augmentsTags[1], Diagnostics.Class_declarations_cannot_have_more_than_one_augments_or_extends_tag); + error2(augmentsTags[1], Diagnostics.Class_declarations_cannot_have_more_than_one_augments_or_extends_tag); } const name = getIdentifierFromEntityNameExpression(node.class.expression); const extend2 = getClassExtendsHeritageElement(classLike); if (extend2) { const className = getIdentifierFromEntityNameExpression(extend2.expression); if (className && name.escapedText !== className.escapedText) { - error(name, Diagnostics.JSDoc_0_1_does_not_match_the_extends_2_clause, idText(node.tagName), idText(name), idText(className)); + error2(name, Diagnostics.JSDoc_0_1_does_not_match_the_extends_2_clause, idText(node.tagName), idText(name), idText(className)); } } } function checkJSDocAccessibilityModifiers(node) { const host2 = getJSDocHost(node); if (host2 && isPrivateIdentifierClassElementDeclaration(host2)) { - error(node, Diagnostics.An_accessibility_modifier_cannot_be_used_with_a_private_identifier); + error2(node, Diagnostics.An_accessibility_modifier_cannot_be_used_with_a_private_identifier); } } function getIdentifierFromEntityNameExpression(node) { switch (node.kind) { case 80 /* Identifier */: return node; - case 210 /* PropertyAccessExpression */: + case 211 /* PropertyAccessExpression */: return node.name; default: return void 0; @@ -78498,7 +79026,7 @@ ${lanes.join("\n")} checkDecorators(node); checkSignatureDeclaration(node); const functionFlags = getFunctionFlags(node); - if (node.name && node.name.kind === 166 /* ComputedPropertyName */) { + if (node.name && node.name.kind === 167 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } if (hasBindableName(node)) { @@ -78506,7 +79034,7 @@ ${lanes.join("\n")} const localSymbol = node.localSymbol || symbol; const firstDeclaration = (_a = localSymbol.declarations) == null ? void 0 : _a.find( // Get first non javascript function declaration - (declaration) => declaration.kind === node.kind && !(declaration.flags & 262144 /* JavaScriptFile */) + (declaration) => declaration.kind === node.kind && !(declaration.flags & 524288 /* JavaScriptFile */) ); if (node === firstDeclaration) { checkFunctionOrConstructorSymbol(localSymbol); @@ -78515,14 +79043,14 @@ ${lanes.join("\n")} checkFunctionOrConstructorSymbol(symbol); } } - const body = node.kind === 172 /* MethodSignature */ ? void 0 : node.body; + const body = node.kind === 173 /* MethodSignature */ ? void 0 : node.body; checkSourceElement(body); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, getReturnTypeFromAnnotation(node)); addLazyDiagnostic(checkFunctionOrMethodDeclarationDiagnostics); if (isInJSFile(node)) { const typeTag = getJSDocTypeTag(node); if (typeTag && typeTag.typeExpression && !getContextualCallSignature(getTypeFromTypeNode(typeTag.typeExpression), node)) { - error(typeTag.typeExpression.type, Diagnostics.The_type_of_a_function_declaration_must_match_the_function_s_signature); + error2(typeTag.typeExpression.type, Diagnostics.The_type_of_a_function_declaration_must_match_the_function_s_signature); } } function checkFunctionOrMethodDeclarationDiagnostics() { @@ -78551,42 +79079,42 @@ ${lanes.join("\n")} function checkUnusedIdentifiers(potentiallyUnusedIdentifiers, addDiagnostic) { for (const node of potentiallyUnusedIdentifiers) { switch (node.kind) { - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: checkUnusedClassMembers(node, addDiagnostic); checkUnusedTypeParameters(node, addDiagnostic); break; - case 311 /* SourceFile */: - case 266 /* ModuleDeclaration */: - case 240 /* Block */: - case 268 /* CaseBlock */: - case 247 /* ForStatement */: - case 248 /* ForInStatement */: - case 249 /* ForOfStatement */: + case 312 /* SourceFile */: + case 267 /* ModuleDeclaration */: + case 241 /* Block */: + case 269 /* CaseBlock */: + case 248 /* ForStatement */: + case 249 /* ForInStatement */: + case 250 /* ForOfStatement */: checkUnusedLocalsAndParameters(node, addDiagnostic); break; - case 175 /* Constructor */: - case 217 /* FunctionExpression */: - case 261 /* FunctionDeclaration */: - case 218 /* ArrowFunction */: - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 176 /* Constructor */: + case 218 /* FunctionExpression */: + case 262 /* FunctionDeclaration */: + case 219 /* ArrowFunction */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: if (node.body) { checkUnusedLocalsAndParameters(node, addDiagnostic); } checkUnusedTypeParameters(node, addDiagnostic); break; - case 172 /* MethodSignature */: - case 178 /* CallSignature */: - case 179 /* ConstructSignature */: - case 183 /* FunctionType */: - case 184 /* ConstructorType */: - case 264 /* TypeAliasDeclaration */: - case 263 /* InterfaceDeclaration */: + case 173 /* MethodSignature */: + case 179 /* CallSignature */: + case 180 /* ConstructSignature */: + case 184 /* FunctionType */: + case 185 /* ConstructorType */: + case 265 /* TypeAliasDeclaration */: + case 264 /* InterfaceDeclaration */: checkUnusedTypeParameters(node, addDiagnostic); break; - case 194 /* InferType */: + case 195 /* InferType */: checkUnusedInferTypeParameter(node, addDiagnostic); break; default: @@ -78605,28 +79133,28 @@ ${lanes.join("\n")} function checkUnusedClassMembers(node, addDiagnostic) { for (const member of node.members) { switch (member.kind) { - case 173 /* MethodDeclaration */: - case 171 /* PropertyDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - if (member.kind === 177 /* SetAccessor */ && member.symbol.flags & 32768 /* GetAccessor */) { + case 174 /* MethodDeclaration */: + case 172 /* PropertyDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + if (member.kind === 178 /* SetAccessor */ && member.symbol.flags & 32768 /* GetAccessor */) { break; } const symbol = getSymbolOfDeclaration(member); - if (!symbol.isReferenced && (hasEffectiveModifier(member, 8 /* Private */) || isNamedDeclaration(member) && isPrivateIdentifier(member.name)) && !(member.flags & 16777216 /* Ambient */)) { + if (!symbol.isReferenced && (hasEffectiveModifier(member, 8 /* Private */) || isNamedDeclaration(member) && isPrivateIdentifier(member.name)) && !(member.flags & 33554432 /* Ambient */)) { addDiagnostic(member, 0 /* Local */, createDiagnosticForNode(member.name, Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol))); } break; - case 175 /* Constructor */: + case 176 /* Constructor */: for (const parameter of member.parameters) { if (!parameter.symbol.isReferenced && hasSyntacticModifier(parameter, 8 /* Private */)) { addDiagnostic(parameter, 0 /* Local */, createDiagnosticForNode(parameter.name, Diagnostics.Property_0_is_declared_but_its_value_is_never_read, symbolName(parameter.symbol))); } } break; - case 180 /* IndexSignature */: - case 239 /* SemicolonClassElement */: - case 174 /* ClassStaticBlockDeclaration */: + case 181 /* IndexSignature */: + case 240 /* SemicolonClassElement */: + case 175 /* ClassStaticBlockDeclaration */: break; default: Debug.fail("Unexpected class member"); @@ -78650,7 +79178,7 @@ ${lanes.join("\n")} continue; const name = idText(typeParameter.name); const { parent: parent2 } = typeParameter; - if (parent2.kind !== 194 /* InferType */ && parent2.typeParameters.every(isTypeParameterUnused)) { + if (parent2.kind !== 195 /* InferType */ && parent2.typeParameters.every(isTypeParameterUnused)) { if (tryAddToSet(seenParentsWithEveryUnused, parent2)) { const sourceFile = getSourceFileOfNode(parent2); const range = isJSDocTemplateTag(parent2) ? rangeOfNode(parent2) : rangeOfTypeParameters(sourceFile, parent2.typeParameters); @@ -78708,7 +79236,11 @@ ${lanes.join("\n")} addToGroup(unusedDestructures, declaration.parent, declaration, getNodeId); } } else if (isVariableDeclaration(declaration)) { - addToGroup(unusedVariables, declaration.parent, declaration, getNodeId); + const blockScopeKind = getCombinedNodeFlagsCached(declaration) & 7 /* BlockScoped */; + const name = getNameOfDeclaration(declaration); + if (blockScopeKind !== 4 /* Using */ && blockScopeKind !== 6 /* AwaitUsing */ || !name || !isIdentifierThatStartsWithUnderscore(name)) { + addToGroup(unusedVariables, declaration.parent, declaration, getNodeId); + } } else { const parameter = local.valueDeclaration && tryGetRootParameterDeclaration(local.valueDeclaration); const name = local.valueDeclaration && getNameOfDeclaration(local.valueDeclaration); @@ -78729,7 +79261,7 @@ ${lanes.join("\n")} }); unusedImports.forEach(([importClause, unuseds]) => { const importDecl = importClause.parent; - const nDeclarations = (importClause.name ? 1 : 0) + (importClause.namedBindings ? importClause.namedBindings.kind === 273 /* NamespaceImport */ ? 1 : importClause.namedBindings.elements.length : 0); + const nDeclarations = (importClause.name ? 1 : 0) + (importClause.namedBindings ? importClause.namedBindings.kind === 274 /* NamespaceImport */ ? 1 : importClause.namedBindings.elements.length : 0); if (nDeclarations === unuseds.length) { addDiagnostic(importDecl, 0 /* Local */, unuseds.length === 1 ? createDiagnosticForNode(importDecl, Diagnostics._0_is_declared_but_its_value_is_never_read, idText(first(unuseds).name)) : createDiagnosticForNode(importDecl, Diagnostics.All_imports_in_import_declaration_are_unused)); } else { @@ -78740,7 +79272,7 @@ ${lanes.join("\n")} unusedDestructures.forEach(([bindingPattern, bindingElements]) => { const kind = tryGetRootParameterDeclaration(bindingPattern.parent) ? 1 /* Parameter */ : 0 /* Local */; if (bindingPattern.elements.length === bindingElements.length) { - if (bindingElements.length === 1 && bindingPattern.parent.kind === 259 /* VariableDeclaration */ && bindingPattern.parent.parent.kind === 260 /* VariableDeclarationList */) { + if (bindingElements.length === 1 && bindingPattern.parent.kind === 260 /* VariableDeclaration */ && bindingPattern.parent.parent.kind === 261 /* VariableDeclarationList */) { addToGroup(unusedVariables, bindingPattern.parent.parent, bindingPattern.parent, getNodeId); } else { addDiagnostic(bindingPattern, kind, bindingElements.length === 1 ? createDiagnosticForNode(bindingPattern, Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(first(bindingElements).name)) : createDiagnosticForNode(bindingPattern, Diagnostics.All_destructured_elements_are_unused)); @@ -78753,7 +79285,7 @@ ${lanes.join("\n")} }); unusedVariables.forEach(([declarationList, declarations]) => { if (declarationList.declarations.length === declarations.length) { - addDiagnostic(declarationList, 0 /* Local */, declarations.length === 1 ? createDiagnosticForNode(first(declarations).name, Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(first(declarations).name)) : createDiagnosticForNode(declarationList.parent.kind === 242 /* VariableStatement */ ? declarationList.parent : declarationList, Diagnostics.All_variables_are_unused)); + addDiagnostic(declarationList, 0 /* Local */, declarations.length === 1 ? createDiagnosticForNode(first(declarations).name, Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(first(declarations).name)) : createDiagnosticForNode(declarationList.parent.kind === 243 /* VariableStatement */ ? declarationList.parent : declarationList, Diagnostics.All_variables_are_unused)); } else { for (const decl of declarations) { addDiagnostic(decl, 0 /* Local */, createDiagnosticForNode(decl, Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(decl.name))); @@ -78782,21 +79314,21 @@ ${lanes.join("\n")} switch (name.kind) { case 80 /* Identifier */: return idText(name); - case 206 /* ArrayBindingPattern */: - case 205 /* ObjectBindingPattern */: + case 207 /* ArrayBindingPattern */: + case 206 /* ObjectBindingPattern */: return bindingNameText(cast(first(name.elements), isBindingElement).name); default: return Debug.assertNever(name); } } function isImportedDeclaration(node) { - return node.kind === 272 /* ImportClause */ || node.kind === 275 /* ImportSpecifier */ || node.kind === 273 /* NamespaceImport */; + return node.kind === 273 /* ImportClause */ || node.kind === 276 /* ImportSpecifier */ || node.kind === 274 /* NamespaceImport */; } function importClauseFromImported(decl) { - return decl.kind === 272 /* ImportClause */ ? decl : decl.kind === 273 /* NamespaceImport */ ? decl.parent : decl.parent.parent; + return decl.kind === 273 /* ImportClause */ ? decl : decl.kind === 274 /* NamespaceImport */ ? decl.parent : decl.parent.parent; } function checkBlock(node) { - if (node.kind === 240 /* Block */) { + if (node.kind === 241 /* Block */) { checkGrammarStatementInAmbientContext(node); } if (isFunctionOrModuleBlock(node)) { @@ -78811,7 +79343,7 @@ ${lanes.join("\n")} } } function checkCollisionWithArgumentsInGeneratedCode(node) { - if (languageVersion >= 2 /* ES2015 */ || !hasRestParameter(node) || node.flags & 16777216 /* Ambient */ || nodeIsMissing(node.body)) { + if (languageVersion >= 2 /* ES2015 */ || !hasRestParameter(node) || node.flags & 33554432 /* Ambient */ || nodeIsMissing(node.body)) { return; } forEach(node.parameters, (p) => { @@ -78824,10 +79356,10 @@ ${lanes.join("\n")} if ((identifier == null ? void 0 : identifier.escapedText) !== name) { return false; } - if (node.kind === 171 /* PropertyDeclaration */ || node.kind === 170 /* PropertySignature */ || node.kind === 173 /* MethodDeclaration */ || node.kind === 172 /* MethodSignature */ || node.kind === 176 /* GetAccessor */ || node.kind === 177 /* SetAccessor */ || node.kind === 302 /* PropertyAssignment */) { + if (node.kind === 172 /* PropertyDeclaration */ || node.kind === 171 /* PropertySignature */ || node.kind === 174 /* MethodDeclaration */ || node.kind === 173 /* MethodSignature */ || node.kind === 177 /* GetAccessor */ || node.kind === 178 /* SetAccessor */ || node.kind === 303 /* PropertyAssignment */) { return false; } - if (node.flags & 16777216 /* Ambient */) { + if (node.flags & 33554432 /* Ambient */) { return false; } if (isImportClause(node) || isImportEqualsDeclaration(node) || isImportSpecifier(node)) { @@ -78846,9 +79378,9 @@ ${lanes.join("\n")} if (getNodeCheckFlags(current) & 4 /* CaptureThis */) { const isDeclaration2 = node.kind !== 80 /* Identifier */; if (isDeclaration2) { - error(getNameOfDeclaration(node), Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); + error2(getNameOfDeclaration(node), Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); } else { - error(node, Diagnostics.Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference); + error2(node, Diagnostics.Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference); } return true; } @@ -78860,9 +79392,9 @@ ${lanes.join("\n")} if (getNodeCheckFlags(current) & 8 /* CaptureNewTarget */) { const isDeclaration2 = node.kind !== 80 /* Identifier */; if (isDeclaration2) { - error(getNameOfDeclaration(node), Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference); + error2(getNameOfDeclaration(node), Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference); } else { - error(node, Diagnostics.Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference); + error2(node, Diagnostics.Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference); } return true; } @@ -78880,7 +79412,7 @@ ${lanes.join("\n")} return; } const parent2 = getDeclarationContainer(node); - if (parent2.kind === 311 /* SourceFile */ && isExternalOrCommonJsModule(parent2)) { + if (parent2.kind === 312 /* SourceFile */ && isExternalOrCommonJsModule(parent2)) { errorSkippedOn( "noEmit", name, @@ -78898,7 +79430,7 @@ ${lanes.join("\n")} return; } const parent2 = getDeclarationContainer(node); - if (parent2.kind === 311 /* SourceFile */ && isExternalOrCommonJsModule(parent2) && parent2.flags & 2048 /* HasAsyncFunctions */) { + if (parent2.kind === 312 /* SourceFile */ && isExternalOrCommonJsModule(parent2) && parent2.flags & 4096 /* HasAsyncFunctions */) { errorSkippedOn( "noEmit", name, @@ -78915,7 +79447,7 @@ ${lanes.join("\n")} } function checkWeakMapSetCollision(node) { const enclosingBlockScope = getEnclosingBlockScopeContainer(node); - if (getNodeCheckFlags(enclosingBlockScope) & 4194304 /* ContainsClassWithPrivateIdentifiers */) { + if (getNodeCheckFlags(enclosingBlockScope) & 1048576 /* ContainsClassWithPrivateIdentifiers */) { Debug.assert(isNamedDeclaration(node) && isIdentifier(node.name) && typeof node.name.escapedText === "string", "The target of a WeakMap/WeakSet collision check should be an identifier"); errorSkippedOn("noEmit", node, Diagnostics.Compiler_reserves_name_0_when_emitting_private_identifier_downlevel, node.name.escapedText); } @@ -78929,18 +79461,18 @@ ${lanes.join("\n")} let hasCollision = false; if (isClassExpression(node)) { for (const member of node.members) { - if (getNodeCheckFlags(member) & 8388608 /* ContainsSuperPropertyInStaticInitializer */) { + if (getNodeCheckFlags(member) & 2097152 /* ContainsSuperPropertyInStaticInitializer */) { hasCollision = true; break; } } } else if (isFunctionExpression(node)) { - if (getNodeCheckFlags(node) & 8388608 /* ContainsSuperPropertyInStaticInitializer */) { + if (getNodeCheckFlags(node) & 2097152 /* ContainsSuperPropertyInStaticInitializer */) { hasCollision = true; } } else { const container = getEnclosingBlockScopeContainer(node); - if (container && getNodeCheckFlags(container) & 8388608 /* ContainsSuperPropertyInStaticInitializer */) { + if (container && getNodeCheckFlags(container) & 2097152 /* ContainsSuperPropertyInStaticInitializer */) { hasCollision = true; } } @@ -78964,7 +79496,7 @@ ${lanes.join("\n")} recordPotentialCollisionWithReflectInGeneratedCode(node, name); if (isClassLike(node)) { checkTypeNameIsReserved(name, Diagnostics.Class_name_cannot_be_0); - if (!(node.flags & 16777216 /* Ambient */)) { + if (!(node.flags & 33554432 /* Ambient */)) { checkClassNameCollisionWithObject(name); } } else if (isEnumDeclaration(node)) { @@ -78972,10 +79504,7 @@ ${lanes.join("\n")} } } function checkVarDeclaredNamesNotShadowed(node) { - if ((getCombinedNodeFlags(node) & 3 /* BlockScoped */) !== 0 || isParameterDeclaration(node)) { - return; - } - if (node.kind === 259 /* VariableDeclaration */ && !node.initializer) { + if ((getCombinedNodeFlagsCached(node) & 7 /* BlockScoped */) !== 0 || isParameterDeclaration(node)) { return; } const symbol = getSymbolOfDeclaration(node); @@ -78994,13 +79523,13 @@ ${lanes.join("\n")} false ); if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) { - if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* BlockScoped */) { - const varDeclList = getAncestor(localDeclarationSymbol.valueDeclaration, 260 /* VariableDeclarationList */); - const container = varDeclList.parent.kind === 242 /* VariableStatement */ && varDeclList.parent.parent ? varDeclList.parent.parent : void 0; - const namesShareScope = container && (container.kind === 240 /* Block */ && isFunctionLike(container.parent) || container.kind === 267 /* ModuleBlock */ || container.kind === 266 /* ModuleDeclaration */ || container.kind === 311 /* SourceFile */); + if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 7 /* BlockScoped */) { + const varDeclList = getAncestor(localDeclarationSymbol.valueDeclaration, 261 /* VariableDeclarationList */); + const container = varDeclList.parent.kind === 243 /* VariableStatement */ && varDeclList.parent.parent ? varDeclList.parent.parent : void 0; + const namesShareScope = container && (container.kind === 241 /* Block */ && isFunctionLike(container.parent) || container.kind === 268 /* ModuleBlock */ || container.kind === 267 /* ModuleDeclaration */ || container.kind === 312 /* SourceFile */); if (!namesShareScope) { const name = symbolToString(localDeclarationSymbol); - error(node, Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); + error2(node, Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); } } } @@ -79018,7 +79547,7 @@ ${lanes.join("\n")} if (!node.name) { return; } - if (node.name.kind === 166 /* ComputedPropertyName */) { + if (node.name.kind === 167 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); if (hasOnlyExpressionInitializer(node) && node.initializer) { checkExpressionCached(node.initializer); @@ -79032,7 +79561,7 @@ ${lanes.join("\n")} if (isObjectBindingPattern(node.parent) && node.dotDotDotToken && languageVersion < 5 /* ES2018 */) { checkExternalEmitHelpers(node, 4 /* Rest */); } - if (node.propertyName && node.propertyName.kind === 166 /* ComputedPropertyName */) { + if (node.propertyName && node.propertyName.kind === 167 /* ComputedPropertyName */) { checkComputedPropertyName(node.propertyName); } const parent2 = node.parent.parent; @@ -79065,20 +79594,20 @@ ${lanes.join("\n")} } } if (isBindingPattern(node.name)) { - if (node.name.kind === 206 /* ArrayBindingPattern */ && languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) { + if (node.name.kind === 207 /* ArrayBindingPattern */ && languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) { checkExternalEmitHelpers(node, 512 /* Read */); } forEach(node.name.elements, checkSourceElement); } if (isParameter(node) && node.initializer && nodeIsMissing(getContainingFunction(node).body)) { - error(node, Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); + error2(node, Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } if (isBindingPattern(node.name)) { if (isInAmbientOrTypeNode(node)) { return; } - const needCheckInitializer = hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 248 /* ForInStatement */; + const needCheckInitializer = hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 249 /* ForInStatement */; const needCheckWidenedType = !some(node.name.elements, not(isOmittedExpression)); if (needCheckInitializer || needCheckWidenedType) { const widenedType = getWidenedTypeForVariableLikeDeclaration(node); @@ -79110,20 +79639,45 @@ ${lanes.join("\n")} const initializer = hasOnlyExpressionInitializer(node) && getEffectiveInitializer(node); if (initializer) { const isJSObjectLiteralInitializer = isInJSFile(node) && isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAccess(node.name)) && !!((_a = symbol.exports) == null ? void 0 : _a.size); - if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 248 /* ForInStatement */) { + if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 249 /* ForInStatement */) { + const initializerType = checkExpressionCached(initializer); checkTypeAssignableToAndOptionallyElaborate( - checkExpressionCached(initializer), + initializerType, type, node, initializer, /*headMessage*/ void 0 ); + const blockScopeKind = getCombinedNodeFlagsCached(node) & 7 /* BlockScoped */; + if (blockScopeKind === 6 /* AwaitUsing */) { + const globalAsyncDisposableType = getGlobalAsyncDisposableType( + /*reportErrors*/ + true + ); + const globalDisposableType = getGlobalDisposableType( + /*reportErrors*/ + true + ); + if (globalAsyncDisposableType !== emptyObjectType && globalDisposableType !== emptyObjectType) { + const optionalDisposableType = getUnionType([globalAsyncDisposableType, globalDisposableType, nullType, undefinedType]); + checkTypeAssignableTo(initializerType, optionalDisposableType, initializer, Diagnostics.The_initializer_of_an_await_using_declaration_must_be_either_an_object_with_a_Symbol_asyncDispose_or_Symbol_dispose_method_or_be_null_or_undefined); + } + } else if (blockScopeKind === 4 /* Using */) { + const globalDisposableType = getGlobalDisposableType( + /*reportErrors*/ + true + ); + if (globalDisposableType !== emptyObjectType) { + const optionalDisposableType = getUnionType([globalDisposableType, nullType, undefinedType]); + checkTypeAssignableTo(initializerType, optionalDisposableType, initializer, Diagnostics.The_initializer_of_a_using_declaration_must_be_either_an_object_with_a_Symbol_dispose_method_or_be_null_or_undefined); + } + } } } if (symbol.declarations && symbol.declarations.length > 1) { if (some(symbol.declarations, (d) => d !== node && isVariableLike(d) && !areDeclarationFlagsIdentical(d, node))) { - error(node.name, Diagnostics.All_declarations_of_0_must_have_identical_modifiers, declarationNameToString(node.name)); + error2(node.name, Diagnostics.All_declarations_of_0_must_have_identical_modifiers, declarationNameToString(node.name)); } } } else { @@ -79142,12 +79696,12 @@ ${lanes.join("\n")} ); } if (symbol.valueDeclaration && !areDeclarationFlagsIdentical(node, symbol.valueDeclaration)) { - error(node.name, Diagnostics.All_declarations_of_0_must_have_identical_modifiers, declarationNameToString(node.name)); + error2(node.name, Diagnostics.All_declarations_of_0_must_have_identical_modifiers, declarationNameToString(node.name)); } } - if (node.kind !== 171 /* PropertyDeclaration */ && node.kind !== 170 /* PropertySignature */) { + if (node.kind !== 172 /* PropertyDeclaration */ && node.kind !== 171 /* PropertySignature */) { checkExportsOnMergedDeclarations(node); - if (node.kind === 259 /* VariableDeclaration */ || node.kind === 207 /* BindingElement */) { + if (node.kind === 260 /* VariableDeclaration */ || node.kind === 208 /* BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionsForDeclarationName(node, node.name); @@ -79155,9 +79709,9 @@ ${lanes.join("\n")} } function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration, firstType, nextDeclaration, nextType) { const nextDeclarationName = getNameOfDeclaration(nextDeclaration); - const message = nextDeclaration.kind === 171 /* PropertyDeclaration */ || nextDeclaration.kind === 170 /* PropertySignature */ ? Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2 : Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2; + const message = nextDeclaration.kind === 172 /* PropertyDeclaration */ || nextDeclaration.kind === 171 /* PropertySignature */ ? Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2 : Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2; const declName = declarationNameToString(nextDeclarationName); - const err = error( + const err = error2( nextDeclarationName, message, declName, @@ -79172,7 +79726,7 @@ ${lanes.join("\n")} } } function areDeclarationFlagsIdentical(left, right) { - if (left.kind === 168 /* Parameter */ && right.kind === 259 /* VariableDeclaration */ || left.kind === 259 /* VariableDeclaration */ && right.kind === 168 /* Parameter */) { + if (left.kind === 169 /* Parameter */ && right.kind === 260 /* VariableDeclaration */ || left.kind === 260 /* VariableDeclaration */ && right.kind === 169 /* Parameter */) { return true; } if (hasQuestionToken(left) !== hasQuestionToken(right)) { @@ -79192,10 +79746,17 @@ ${lanes.join("\n")} checkGrammarBindingElement(node); return checkVariableLikeDeclaration(node); } + function checkVariableDeclarationList(node) { + const blockScopeKind = getCombinedNodeFlags(node) & 7 /* BlockScoped */; + if (blockScopeKind === 4 /* Using */ || blockScopeKind === 6 /* AwaitUsing */) { + checkExternalEmitHelpers(node, 33554432 /* AddDisposableResourceAndDisposeResources */); + } + forEach(node.declarations, checkSourceElement); + } function checkVariableStatement(node) { if (!checkGrammarModifiers(node) && !checkGrammarVariableDeclarationList(node.declarationList)) - checkGrammarForDisallowedLetOrConstStatement(node); - forEach(node.declarationList.declarations, checkSourceElement); + checkGrammarForDisallowedBlockScopedVariableStatement(node); + checkVariableDeclarationList(node.declarationList); } function checkExpressionStatement(node) { checkGrammarStatementInAmbientContext(node); @@ -79206,8 +79767,8 @@ ${lanes.join("\n")} const type = checkTruthinessExpression(node.expression); checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 241 /* EmptyStatement */) { - error(node.thenStatement, Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); + if (node.thenStatement.kind === 242 /* EmptyStatement */) { + error2(node.thenStatement, Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); } @@ -79257,7 +79818,7 @@ ${lanes.join("\n")} getTypeNameForErrorDisplay(type) ); } else { - error(location, Diagnostics.This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead); + error2(location, Diagnostics.This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead); } } } @@ -79323,7 +79884,7 @@ ${lanes.join("\n")} } function checkTruthinessOfType(type, node) { if (type.flags & 16384 /* Void */) { - error(node, Diagnostics.An_expression_of_type_void_cannot_be_tested_for_truthiness); + error2(node, Diagnostics.An_expression_of_type_void_cannot_be_tested_for_truthiness); } return type; } @@ -79332,13 +79893,13 @@ ${lanes.join("\n")} } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 260 /* VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 261 /* VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 260 /* VariableDeclarationList */) { - forEach(node.initializer.declarations, checkVariableDeclaration); + if (node.initializer.kind === 261 /* VariableDeclarationList */) { + checkVariableDeclarationList(node.initializer); } else { checkExpression(node.initializer); } @@ -79357,7 +79918,7 @@ ${lanes.join("\n")} const container = getContainingFunctionOrClassStaticBlock(node); if (node.awaitModifier) { if (container && isClassStaticBlockDeclaration(container)) { - grammarErrorOnNode(node.awaitModifier, Diagnostics.For_await_loops_cannot_be_used_inside_a_class_static_block); + grammarErrorOnNode(node.awaitModifier, Diagnostics.for_await_loops_cannot_be_used_inside_a_class_static_block); } else { const functionFlags = getFunctionFlags(container); if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 99 /* ESNext */) { @@ -79367,12 +79928,12 @@ ${lanes.join("\n")} } else if (compilerOptions.downlevelIteration && languageVersion < 2 /* ES2015 */) { checkExternalEmitHelpers(node, 256 /* ForOfIncludes */); } - if (node.initializer.kind === 260 /* VariableDeclarationList */) { - checkForInOrForOfVariableDeclaration(node); + if (node.initializer.kind === 261 /* VariableDeclarationList */) { + checkVariableDeclarationList(node.initializer); } else { const varExpr = node.initializer; const iteratedType = checkRightHandSideOfForOf(node); - if (varExpr.kind === 208 /* ArrayLiteralExpression */ || varExpr.kind === 209 /* ObjectLiteralExpression */) { + if (varExpr.kind === 209 /* ArrayLiteralExpression */ || varExpr.kind === 210 /* ObjectLiteralExpression */) { checkDestructuringAssignment(varExpr, iteratedType || errorType); } else { const leftType = checkExpression(varExpr); @@ -79394,19 +79955,19 @@ ${lanes.join("\n")} function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); const rightType = getNonNullableTypeIfNeeded(checkExpression(node.expression)); - if (node.initializer.kind === 260 /* VariableDeclarationList */) { + if (node.initializer.kind === 261 /* VariableDeclarationList */) { const variable = node.initializer.declarations[0]; if (variable && isBindingPattern(variable.name)) { - error(variable.name, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); + error2(variable.name, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } - checkForInOrForOfVariableDeclaration(node); + checkVariableDeclarationList(node.initializer); } else { const varExpr = node.initializer; const leftType = checkExpression(varExpr); - if (varExpr.kind === 208 /* ArrayLiteralExpression */ || varExpr.kind === 209 /* ObjectLiteralExpression */) { - error(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); + if (varExpr.kind === 209 /* ArrayLiteralExpression */ || varExpr.kind === 210 /* ObjectLiteralExpression */) { + error2(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { - error(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); + error2(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); } else { checkReferenceExpression( varExpr, @@ -79416,20 +79977,13 @@ ${lanes.join("\n")} } } if (rightType === neverType || !isTypeAssignableToKind(rightType, 67108864 /* NonPrimitive */ | 58982400 /* InstantiableNonPrimitive */)) { - error(node.expression, Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0, typeToString(rightType)); + error2(node.expression, Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0, typeToString(rightType)); } checkSourceElement(node.statement); if (node.locals) { registerForUnusedIdentifiersCheck(node); } } - function checkForInOrForOfVariableDeclaration(iterationStatement) { - const variableDeclarationList = iterationStatement.initializer; - if (variableDeclarationList.declarations.length >= 1) { - const decl = variableDeclarationList.declarations[0]; - checkVariableDeclaration(decl); - } - } function checkRightHandSideOfForOf(statement) { const use = statement.awaitModifier ? 15 /* ForAwaitOf */ : 13 /* ForOf */; return checkIteratedTypeOrElementType(use, checkNonNullExpression(statement.expression), undefinedType, statement.expression); @@ -79487,7 +80041,7 @@ ${lanes.join("\n")} if (hasStringConstituent) { if (languageVersion < 1 /* ES5 */) { if (errorNode) { - error(errorNode, Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher); + error2(errorNode, Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher); reportedError = true; } } @@ -79947,7 +80501,7 @@ ${lanes.join("\n")} errorOutputContainer.errors ?? (errorOutputContainer.errors = []); errorOutputContainer.errors.push(createDiagnosticForNode(errorNode, diagnostic, methodName)); } else { - error(errorNode, diagnostic, methodName); + error2(errorNode, diagnostic, methodName); } } return methodName === "next" ? noIterationTypes : void 0; @@ -80002,7 +80556,7 @@ ${lanes.join("\n")} errorOutputContainer.errors ?? (errorOutputContainer.errors = []); errorOutputContainer.errors.push(createDiagnosticForNode(errorNode, resolver.mustHaveAValueDiagnostic, methodName)); } else { - error(errorNode, resolver.mustHaveAValueDiagnostic, methodName); + error2(errorNode, resolver.mustHaveAValueDiagnostic, methodName); } } yieldType = anyType; @@ -80086,13 +80640,13 @@ ${lanes.join("\n")} const functionFlags = getFunctionFlags(container); if (strictNullChecks || node.expression || returnType.flags & 131072 /* Never */) { const exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; - if (container.kind === 177 /* SetAccessor */) { + if (container.kind === 178 /* SetAccessor */) { if (node.expression) { - error(node, Diagnostics.Setters_cannot_return_a_value); + error2(node, Diagnostics.Setters_cannot_return_a_value); } - } else if (container.kind === 175 /* Constructor */) { + } else if (container.kind === 176 /* Constructor */) { if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) { - error(node, Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); + error2(node, Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } } else if (getReturnTypeFromAnnotation(container)) { const unwrappedReturnType = unwrapReturnType(returnType, functionFlags) ?? returnType; @@ -80107,13 +80661,13 @@ ${lanes.join("\n")} checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, node, node.expression); } } - } else if (container.kind !== 175 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeUndefinedVoidOrAny(container, returnType)) { - error(node, Diagnostics.Not_all_code_paths_return_a_value); + } else if (container.kind !== 176 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeUndefinedVoidOrAny(container, returnType)) { + error2(node, Diagnostics.Not_all_code_paths_return_a_value); } } function checkWithStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.flags & 32768 /* AwaitContext */) { + if (node.flags & 65536 /* AwaitContext */) { grammarErrorOnFirstToken(node, Diagnostics.with_statements_are_not_allowed_in_an_async_function_block); } } @@ -80131,7 +80685,7 @@ ${lanes.join("\n")} let hasDuplicateDefaultClause = false; const expressionType = checkExpression(node.expression); forEach(node.caseBlock.clauses, (clause) => { - if (clause.kind === 296 /* DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 297 /* DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === void 0) { firstDefaultClause = clause; } else { @@ -80139,12 +80693,12 @@ ${lanes.join("\n")} hasDuplicateDefaultClause = true; } } - if (clause.kind === 295 /* CaseClause */) { + if (clause.kind === 296 /* CaseClause */) { addLazyDiagnostic(createLazyCaseClauseDiagnostics(clause)); } forEach(clause.statements, checkSourceElement); if (compilerOptions.noFallthroughCasesInSwitch && clause.fallthroughFlowNode && isReachableFlowNode(clause.fallthroughFlowNode)) { - error(clause, Diagnostics.Fallthrough_case_in_switch); + error2(clause, Diagnostics.Fallthrough_case_in_switch); } function createLazyCaseClauseDiagnostics(clause2) { return () => { @@ -80171,7 +80725,7 @@ ${lanes.join("\n")} if (isFunctionLike(current)) { return "quit"; } - if (current.kind === 255 /* LabeledStatement */ && current.label.escapedText === node.label.escapedText) { + if (current.kind === 256 /* LabeledStatement */ && current.label.escapedText === node.label.escapedText) { grammarErrorOnNode(node.label, Diagnostics.Duplicate_label_0, getTextOfNode(node.label)); return true; } @@ -80261,8 +80815,8 @@ ${lanes.join("\n")} return; } const indexInfos = getApplicableIndexInfos(type, propNameType); - const interfaceDeclaration = getObjectFlags(type) & 2 /* Interface */ ? getDeclarationOfKind(type.symbol, 263 /* InterfaceDeclaration */) : void 0; - const propDeclaration = declaration && declaration.kind === 225 /* BinaryExpression */ || name && name.kind === 166 /* ComputedPropertyName */ ? declaration : void 0; + const interfaceDeclaration = getObjectFlags(type) & 2 /* Interface */ ? getDeclarationOfKind(type.symbol, 264 /* InterfaceDeclaration */) : void 0; + const propDeclaration = declaration && declaration.kind === 226 /* BinaryExpression */ || name && name.kind === 167 /* ComputedPropertyName */ ? declaration : void 0; const localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : void 0; for (const info of indexInfos) { const localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfDeclaration(info.declaration)) === type.symbol ? info.declaration : void 0; @@ -80286,7 +80840,7 @@ ${lanes.join("\n")} function checkIndexConstraintForIndexSignature(type, checkInfo) { const declaration = checkInfo.declaration; const indexInfos = getApplicableIndexInfos(type, checkInfo.keyType); - const interfaceDeclaration = getObjectFlags(type) & 2 /* Interface */ ? getDeclarationOfKind(type.symbol, 263 /* InterfaceDeclaration */) : void 0; + const interfaceDeclaration = getObjectFlags(type) & 2 /* Interface */ ? getDeclarationOfKind(type.symbol, 264 /* InterfaceDeclaration */) : void 0; const localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfDeclaration(declaration)) === type.symbol ? declaration : void 0; for (const info of indexInfos) { if (info === checkInfo) @@ -80294,7 +80848,7 @@ ${lanes.join("\n")} const localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfDeclaration(info.declaration)) === type.symbol ? info.declaration : void 0; const errorNode = localCheckDeclaration || localIndexDeclaration || (interfaceDeclaration && !some(getBaseTypes(type), (base) => !!getIndexInfoOfType(base, checkInfo.keyType) && !!getIndexTypeOfType(base, info.keyType)) ? interfaceDeclaration : void 0); if (errorNode && !isTypeAssignableTo(checkInfo.type, info.type)) { - error( + error2( errorNode, Diagnostics._0_index_type_1_is_not_assignable_to_2_index_type_3, typeToString(checkInfo.keyType), @@ -80317,12 +80871,12 @@ ${lanes.join("\n")} case "symbol": case "void": case "object": - error(name, message, name.escapedText); + error2(name, message, name.escapedText); } } function checkClassNameCollisionWithObject(name) { if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(name).impliedNodeFormat === 1 /* CommonJS */)) { - error(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ModuleKind[moduleKind]); + error2(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ModuleKind[moduleKind]); } } function checkUnmatchedJSDocParameters(node) { @@ -80345,7 +80899,7 @@ ${lanes.join("\n")} const lastJSDocParamIndex = jsdocParameters.length - 1; const lastJSDocParam = jsdocParameters[lastJSDocParamIndex]; if (isJs && lastJSDocParam && isIdentifier(lastJSDocParam.name) && lastJSDocParam.typeExpression && lastJSDocParam.typeExpression.type && !parameters.has(lastJSDocParam.name.escapedText) && !excludedParameters.has(lastJSDocParamIndex) && !isArrayType(getTypeFromTypeNode(lastJSDocParam.typeExpression.type))) { - error(lastJSDocParam.name, 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, idText(lastJSDocParam.name)); + error2(lastJSDocParam.name, 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, idText(lastJSDocParam.name)); } } else { forEach(jsdocParameters, ({ name, isNameFirst }, index) => { @@ -80354,7 +80908,7 @@ ${lanes.join("\n")} } if (isQualifiedName(name)) { if (isJs) { - error(name, Diagnostics.Qualified_name_0_is_not_allowed_without_a_leading_param_object_1, entityNameToString(name), entityNameToString(name.left)); + error2(name, Diagnostics.Qualified_name_0_is_not_allowed_without_a_leading_param_object_1, entityNameToString(name), entityNameToString(name.left)); } } else { if (!isNameFirst) { @@ -80379,11 +80933,11 @@ ${lanes.join("\n")} seenDefault = true; checkTypeParametersNotReferenced(node.default, typeParameterDeclarations, i); } else if (seenDefault) { - error(node, Diagnostics.Required_type_parameters_may_not_follow_optional_type_parameters); + error2(node, Diagnostics.Required_type_parameters_may_not_follow_optional_type_parameters); } for (let j = 0; j < i; j++) { if (typeParameterDeclarations[j].symbol === node.symbol) { - error(node.name, Diagnostics.Duplicate_identifier_0, declarationNameToString(node.name)); + error2(node.name, Diagnostics.Duplicate_identifier_0, declarationNameToString(node.name)); } } }; @@ -80392,12 +80946,12 @@ ${lanes.join("\n")} function checkTypeParametersNotReferenced(root, typeParameters, index) { visit(root); function visit(node) { - if (node.kind === 182 /* TypeReference */) { + if (node.kind === 183 /* TypeReference */) { const type = getTypeFromTypeReference(node); if (type.flags & 262144 /* TypeParameter */) { for (let i = index; i < typeParameters.length; i++) { if (type.symbol === getSymbolOfDeclaration(typeParameters[i])) { - error(node, Diagnostics.Type_parameter_defaults_can_only_reference_previously_declared_type_parameters); + error2(node, Diagnostics.Type_parameter_defaults_can_only_reference_previously_declared_type_parameters); } } } @@ -80420,7 +80974,7 @@ ${lanes.join("\n")} if (!areTypeParametersIdentical(declarations, type.localTypeParameters, getEffectiveTypeParameterDeclarations)) { const name = symbolToString(symbol); for (const declaration of declarations) { - error(declaration.name, Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, name); + error2(declaration.name, Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, name); } } } @@ -80462,7 +81016,7 @@ ${lanes.join("\n")} node ); const willTransformPrivateElementsOrClassStaticBlocks = languageVersion <= 9 /* ES2022 */; - const willTransformInitializers = !useDefineForClassFields || languageVersion < 9 /* ES2022 */; + const willTransformInitializers = !emitStandardClassFields; if (willTransformStaticElementsOfDecoratedClass || willTransformPrivateElementsOrClassStaticBlocks) { for (const member of node.members) { if (willTransformStaticElementsOfDecoratedClass && classElementOrClassElementParameterIsDecorated( @@ -80543,7 +81097,7 @@ ${lanes.join("\n")} checkTypeParameterListsIdentical(symbol); checkFunctionOrConstructorSymbol(symbol); checkClassForDuplicateDeclarations(node); - const nodeInAmbientContext = !!(node.flags & 16777216 /* Ambient */); + const nodeInAmbientContext = !!(node.flags & 33554432 /* Ambient */); if (!nodeInAmbientContext) { checkClassForStaticPropertyNameConflicts(node); } @@ -80591,18 +81145,18 @@ ${lanes.join("\n")} } if (baseConstructorType.flags & 8650752 /* TypeVariable */) { if (!isMixinConstructorType(staticType)) { - error(node.name || node, Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any); + error2(node.name || node, Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any); } else { const constructSignatures = getSignaturesOfType(baseConstructorType, 1 /* Construct */); if (constructSignatures.some((signature) => signature.flags & 4 /* Abstract */) && !hasSyntacticModifier(node, 256 /* Abstract */)) { - error(node.name || node, Diagnostics.A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract); + error2(node.name || node, Diagnostics.A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract); } } } if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32 /* Class */) && !(baseConstructorType.flags & 8650752 /* TypeVariable */)) { const constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode); if (forEach(constructors, (sig) => !isJSConstructor(sig.declaration) && !isTypeIdenticalTo(getReturnTypeOfSignature(sig), baseType))) { - error(baseTypeNode.expression, Diagnostics.Base_constructors_must_all_have_the_same_return_type); + error2(baseTypeNode.expression, Diagnostics.Base_constructors_must_all_have_the_same_return_type); } } checkKindsOfPropertyMemberOverrides(type, baseType); @@ -80614,7 +81168,7 @@ ${lanes.join("\n")} if (implementedTypeNodes) { for (const typeRefNode of implementedTypeNodes) { if (!isEntityNameExpression(typeRefNode.expression) || isOptionalChain(typeRefNode.expression)) { - error(typeRefNode.expression, Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments); + error2(typeRefNode.expression, Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments); } checkTypeReferenceNode(typeRefNode); addLazyDiagnostic(createImplementsDiagnostics(typeRefNode)); @@ -80647,7 +81201,7 @@ ${lanes.join("\n")} issueMemberSpecificError(node, typeWithThis, baseWithThis, genericDiag); } } else { - error(typeRefNode, Diagnostics.A_class_can_only_implement_an_object_type_or_intersection_of_object_types_with_statically_known_members); + error2(typeRefNode, Diagnostics.A_class_can_only_implement_an_object_type_or_intersection_of_object_types_with_statically_known_members); } } }; @@ -80714,7 +81268,7 @@ ${lanes.join("\n")} } function checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, memberHasOverrideModifier, memberHasAbstractModifier, memberIsStatic, memberIsParameterProperty, memberName, errorNode) { const isJs = isInJSFile(node); - const nodeInAmbientContext = !!(node.flags & 16777216 /* Ambient */); + const nodeInAmbientContext = !!(node.flags & 33554432 /* Ambient */); if (baseWithThis && (memberHasOverrideModifier || compilerOptions.noImplicitOverride)) { const memberEscapedName = escapeLeadingUnderscores(memberName); const thisType = memberIsStatic ? staticType : typeWithThis; @@ -80725,12 +81279,12 @@ ${lanes.join("\n")} if (prop && !baseProp && memberHasOverrideModifier) { if (errorNode) { const suggestion = getSuggestedSymbolForNonexistentClassMember(memberName, baseType); - suggestion ? error( + suggestion ? error2( errorNode, isJs ? Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1 : Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1, baseClassName, symbolToString(suggestion) - ) : error( + ) : error2( errorNode, isJs ? Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0 : Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0, baseClassName @@ -80745,12 +81299,12 @@ ${lanes.join("\n")} if (!baseHasAbstract) { if (errorNode) { const diag2 = memberIsParameterProperty ? isJs ? Diagnostics.This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 : Diagnostics.This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0 : isJs ? Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 : Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0; - error(errorNode, diag2, baseClassName); + error2(errorNode, diag2, baseClassName); } return 1 /* NeedsOverride */; } else if (memberHasAbstractModifier && baseHasAbstract) { if (errorNode) { - error(errorNode, Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0, baseClassName); + error2(errorNode, Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0, baseClassName); } return 1 /* NeedsOverride */; } @@ -80758,7 +81312,7 @@ ${lanes.join("\n")} } else if (memberHasOverrideModifier) { if (errorNode) { const className = typeToString(type); - error( + error2( errorNode, isJs ? Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class : Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class, className @@ -80811,7 +81365,7 @@ ${lanes.join("\n")} if (declaration && hasEffectiveModifier(declaration, 8 /* Private */)) { const typeClassDeclaration = getClassLikeDeclarationOfSymbol(type.symbol); if (!isNodeWithinClass(node, typeClassDeclaration)) { - error(node, Diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private, getFullyQualifiedName(type.symbol)); + error2(node, Diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private, getFullyQualifiedName(type.symbol)); } } } @@ -80848,7 +81402,7 @@ ${lanes.join("\n")} return getCheckFlags(s) & 1 /* Instantiated */ ? s.links.target : s; } function getClassOrInterfaceDeclarationsOfSymbol(symbol) { - return filter(symbol.declarations, (d) => d.kind === 262 /* ClassDeclaration */ || d.kind === 263 /* InterfaceDeclaration */); + return filter(symbol.declarations, (d) => d.kind === 263 /* ClassDeclaration */ || d.kind === 264 /* InterfaceDeclaration */); } function checkKindsOfPropertyMemberOverrides(type, baseType) { var _a, _b, _c, _d; @@ -80880,14 +81434,14 @@ ${lanes.join("\n")} } } if (!inheritedAbstractMemberNotImplementedError) { - inheritedAbstractMemberNotImplementedError = error( + inheritedAbstractMemberNotImplementedError = error2( derivedClassDecl, Diagnostics.Non_abstract_class_0_does_not_implement_all_abstract_members_of_1, typeToString(type), typeToString(baseType) ); } - if (derivedClassDecl.kind === 230 /* ClassExpression */) { + if (derivedClassDecl.kind === 231 /* ClassExpression */) { addRelatedInfo( inheritedAbstractMemberNotImplementedError, createDiagnosticForNode( @@ -80926,15 +81480,15 @@ ${lanes.join("\n")} const overriddenInstanceAccessor = basePropertyFlags === 4 /* Property */ && derivedPropertyFlags !== 4 /* Property */; if (overriddenInstanceProperty || overriddenInstanceAccessor) { const errorMessage2 = overriddenInstanceProperty ? Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property : Diagnostics._0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor; - error(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage2, symbolToString(base), typeToString(baseType), typeToString(type)); + error2(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage2, symbolToString(base), typeToString(baseType), typeToString(type)); } else if (useDefineForClassFields) { - const uninitialized = (_c = derived.declarations) == null ? void 0 : _c.find((d) => d.kind === 171 /* PropertyDeclaration */ && !d.initializer); - if (uninitialized && !(derived.flags & 33554432 /* Transient */) && !(baseDeclarationFlags & 256 /* Abstract */) && !(derivedDeclarationFlags & 256 /* Abstract */) && !((_d = derived.declarations) == null ? void 0 : _d.some((d) => !!(d.flags & 16777216 /* Ambient */)))) { + const uninitialized = (_c = derived.declarations) == null ? void 0 : _c.find((d) => d.kind === 172 /* PropertyDeclaration */ && !d.initializer); + if (uninitialized && !(derived.flags & 33554432 /* Transient */) && !(baseDeclarationFlags & 256 /* Abstract */) && !(derivedDeclarationFlags & 256 /* Abstract */) && !((_d = derived.declarations) == null ? void 0 : _d.some((d) => !!(d.flags & 33554432 /* Ambient */)))) { const constructor = findConstructorDeclaration(getClassLikeDeclarationOfSymbol(type.symbol)); const propName = uninitialized.name; if (uninitialized.exclamationToken || !constructor || !isIdentifier(propName) || !strictNullChecks || !isPropertyInitializedInConstructor(propName, type, constructor)) { const errorMessage2 = Diagnostics.Property_0_will_overwrite_the_base_property_in_1_If_this_is_intentional_add_an_initializer_Otherwise_add_a_declare_modifier_or_remove_the_redundant_declaration; - error(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage2, symbolToString(base), typeToString(baseType)); + error2(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage2, symbolToString(base), typeToString(baseType)); } } } @@ -80951,7 +81505,7 @@ ${lanes.join("\n")} } else { errorMessage = Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; } - error(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type)); + error2(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type)); } } } @@ -81016,7 +81570,7 @@ ${lanes.join("\n")} return ok; } function checkPropertyInitialization(node) { - if (!strictNullChecks || !strictPropertyInitialization || node.flags & 16777216 /* Ambient */) { + if (!strictNullChecks || !strictPropertyInitialization || node.flags & 33554432 /* Ambient */) { return; } const constructor = findConstructorDeclaration(node); @@ -81030,7 +81584,7 @@ ${lanes.join("\n")} const type = getTypeOfSymbol(getSymbolOfDeclaration(member)); if (!(type.flags & 3 /* AnyOrUnknown */ || containsUndefinedType(type))) { if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) { - error(member.name, Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor, declarationNameToString(propName)); + error2(member.name, Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor, declarationNameToString(propName)); } } } @@ -81038,7 +81592,7 @@ ${lanes.join("\n")} } } function isPropertyWithoutInitializer(node) { - return node.kind === 171 /* PropertyDeclaration */ && !hasAbstractModifier(node) && !node.exclamationToken && !node.initializer; + return node.kind === 172 /* PropertyDeclaration */ && !hasAbstractModifier(node) && !node.exclamationToken && !node.initializer; } function isPropertyInitializedInStaticBlocks(propName, propType, staticBlocks, startPos, endPos) { for (const staticBlock of staticBlocks) { @@ -81072,7 +81626,7 @@ ${lanes.join("\n")} checkExportsOnMergedDeclarations(node); const symbol = getSymbolOfDeclaration(node); checkTypeParameterListsIdentical(symbol); - const firstInterfaceDecl = getDeclarationOfKind(symbol, 263 /* InterfaceDeclaration */); + const firstInterfaceDecl = getDeclarationOfKind(symbol, 264 /* InterfaceDeclaration */); if (node === firstInterfaceDecl) { const type = getDeclaredTypeOfSymbol(symbol); const typeWithThis = getTypeWithThisArgument(type); @@ -81087,7 +81641,7 @@ ${lanes.join("\n")} }); forEach(getInterfaceBaseTypeNodes(node), (heritageElement) => { if (!isEntityNameExpression(heritageElement.expression) || isOptionalChain(heritageElement.expression)) { - error(heritageElement.expression, Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments); + error2(heritageElement.expression, Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments); } checkTypeReferenceNode(heritageElement); }); @@ -81104,7 +81658,7 @@ ${lanes.join("\n")} checkTypeParameters(node.typeParameters); if (node.type.kind === 141 /* IntrinsicKeyword */) { if (!intrinsicTypeKinds.has(node.name.escapedText) || length(node.typeParameters) !== 1) { - error(node.type, Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types); + error2(node.type, Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types); } } else { checkSourceElement(node.type); @@ -81125,23 +81679,23 @@ ${lanes.join("\n")} } function computeMemberValue(member, autoValue) { if (isComputedNonLiteralName(member.name)) { - error(member.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums); + error2(member.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums); } else { const text = getTextOfPropertyName(member.name); if (isNumericLiteralName(text) && !isInfinityOrNaNString(text)) { - error(member.name, Diagnostics.An_enum_member_cannot_have_a_numeric_name); + error2(member.name, Diagnostics.An_enum_member_cannot_have_a_numeric_name); } } if (member.initializer) { return computeConstantValue(member); } - if (member.parent.flags & 16777216 /* Ambient */ && !isEnumConst(member.parent)) { + if (member.parent.flags & 33554432 /* Ambient */ && !isEnumConst(member.parent)) { return void 0; } if (autoValue !== void 0) { return autoValue; } - error(member.name, Diagnostics.Enum_member_must_have_initializer); + error2(member.name, Diagnostics.Enum_member_must_have_initializer); return void 0; } function computeConstantValue(member) { @@ -81150,12 +81704,12 @@ ${lanes.join("\n")} const value = evaluate(initializer, member); if (value !== void 0) { if (isConstEnum && typeof value === "number" && !isFinite(value)) { - error(initializer, isNaN(value) ? Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN : Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value); + error2(initializer, isNaN(value) ? Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN : Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value); } } else if (isConstEnum) { - error(initializer, Diagnostics.const_enum_member_initializers_must_be_constant_expressions); - } else if (member.parent.flags & 16777216 /* Ambient */) { - error(initializer, Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression); + error2(initializer, Diagnostics.const_enum_member_initializers_must_be_constant_expressions); + } else if (member.parent.flags & 33554432 /* Ambient */) { + error2(initializer, Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression); } else { checkTypeAssignableTo(checkExpression(initializer), numberType, initializer, Diagnostics.Type_0_is_not_assignable_to_type_1_as_required_for_computed_enum_member_values); } @@ -81163,7 +81717,7 @@ ${lanes.join("\n")} } function evaluate(expr, location) { switch (expr.kind) { - case 223 /* PrefixUnaryExpression */: + case 224 /* PrefixUnaryExpression */: const value = evaluate(expr.operand, location); if (typeof value === "number") { switch (expr.operator) { @@ -81176,7 +81730,7 @@ ${lanes.join("\n")} } } break; - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: const left = evaluate(expr.left, location); const right = evaluate(expr.right, location); if (typeof left === "number" && typeof right === "number") { @@ -81213,18 +81767,30 @@ ${lanes.join("\n")} case 11 /* StringLiteral */: case 15 /* NoSubstitutionTemplateLiteral */: return expr.text; - case 227 /* TemplateExpression */: + case 228 /* TemplateExpression */: return evaluateTemplateExpression(expr, location); case 9 /* NumericLiteral */: checkGrammarNumericLiteral(expr); return +expr.text; - case 216 /* ParenthesizedExpression */: + case 217 /* ParenthesizedExpression */: return evaluate(expr.expression, location); - case 80 /* Identifier */: - if (isInfinityOrNaNString(expr.escapedText)) { - return +expr.escapedText; + case 80 /* Identifier */: { + const identifier = expr; + if (isInfinityOrNaNString(identifier.escapedText) && resolveEntityName( + identifier, + 111551 /* Value */, + /*ignoreErrors*/ + true + ) === getGlobalSymbol( + identifier.escapedText, + 111551 /* Value */, + /*diagnostic*/ + void 0 + )) { + return +identifier.escapedText; } - case 210 /* PropertyAccessExpression */: + } + case 211 /* PropertyAccessExpression */: if (isEntityNameExpression(expr)) { const symbol = resolveEntityName( expr, @@ -81234,18 +81800,18 @@ ${lanes.join("\n")} ); if (symbol) { if (symbol.flags & 8 /* EnumMember */) { - return evaluateEnumMember(expr, symbol, location); + return location ? evaluateEnumMember(expr, symbol, location) : getEnumMemberValue(symbol.valueDeclaration); } - if (isConstVariable(symbol)) { + if (isConstantVariable(symbol)) { const declaration = symbol.valueDeclaration; - if (declaration && !declaration.type && declaration.initializer && declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location)) { + if (declaration && !declaration.type && declaration.initializer && (!location || declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location))) { return evaluate(declaration.initializer, declaration); } } } } break; - case 211 /* ElementAccessExpression */: + case 212 /* ElementAccessExpression */: const root = expr.expression; if (isEntityNameExpression(root) && isStringLiteralLike(expr.argumentExpression)) { const rootSymbol = resolveEntityName( @@ -81258,7 +81824,7 @@ ${lanes.join("\n")} const name = escapeLeadingUnderscores(expr.argumentExpression.text); const member = rootSymbol.exports.get(name); if (member) { - return evaluateEnumMember(expr, member, location); + return location ? evaluateEnumMember(expr, member, location) : getEnumMemberValue(member.valueDeclaration); } } } @@ -81269,11 +81835,11 @@ ${lanes.join("\n")} function evaluateEnumMember(expr, symbol, location) { const declaration = symbol.valueDeclaration; if (!declaration || declaration === location) { - error(expr, Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(symbol)); + error2(expr, Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(symbol)); return void 0; } if (!isBlockScopedNameDeclaredBeforeUse(declaration, location)) { - error(expr, Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums); + error2(expr, Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums); return 0; } return getEnumMemberValue(declaration); @@ -81306,13 +81872,13 @@ ${lanes.join("\n")} const enumIsConst = isEnumConst(node); forEach(enumSymbol.declarations, (decl) => { if (isEnumDeclaration(decl) && isEnumConst(decl) !== enumIsConst) { - error(getNameOfDeclaration(decl), Diagnostics.Enum_declarations_must_all_be_const_or_non_const); + error2(getNameOfDeclaration(decl), Diagnostics.Enum_declarations_must_all_be_const_or_non_const); } }); } let seenEnumMissingInitialInitializer = false; forEach(enumSymbol.declarations, (declaration) => { - if (declaration.kind !== 265 /* EnumDeclaration */) { + if (declaration.kind !== 266 /* EnumDeclaration */) { return false; } const enumDeclaration = declaration; @@ -81322,7 +81888,7 @@ ${lanes.join("\n")} const firstEnumMember = enumDeclaration.members[0]; if (!firstEnumMember.initializer) { if (seenEnumMissingInitialInitializer) { - error(firstEnumMember.name, Diagnostics.In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element); + error2(firstEnumMember.name, Diagnostics.In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element); } else { seenEnumMissingInitialInitializer = true; } @@ -81332,7 +81898,7 @@ ${lanes.join("\n")} } function checkEnumMember(node) { if (isPrivateIdentifier(node.name)) { - error(node, Diagnostics.An_enum_member_cannot_be_named_with_a_private_identifier); + error2(node, Diagnostics.An_enum_member_cannot_be_named_with_a_private_identifier); } if (node.initializer) { checkExpression(node.initializer); @@ -81342,7 +81908,7 @@ ${lanes.join("\n")} const declarations = symbol.declarations; if (declarations) { for (const declaration of declarations) { - if ((declaration.kind === 262 /* ClassDeclaration */ || declaration.kind === 261 /* FunctionDeclaration */ && nodeIsPresent(declaration.body)) && !(declaration.flags & 16777216 /* Ambient */)) { + if ((declaration.kind === 263 /* ClassDeclaration */ || declaration.kind === 262 /* FunctionDeclaration */ && nodeIsPresent(declaration.body)) && !(declaration.flags & 33554432 /* Ambient */)) { return declaration; } } @@ -81371,9 +81937,9 @@ ${lanes.join("\n")} function checkModuleDeclarationDiagnostics() { var _a, _b; const isGlobalAugmentation = isGlobalScopeAugmentation(node); - const inAmbientContext = node.flags & 16777216 /* Ambient */; + const inAmbientContext = node.flags & 33554432 /* Ambient */; if (isGlobalAugmentation && !inAmbientContext) { - error(node.name, Diagnostics.Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context); + error2(node.name, Diagnostics.Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context); } const isAmbientExternalModule = isAmbientModule(node); const contextErrorMessage = isAmbientExternalModule ? Diagnostics.An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file : Diagnostics.A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module; @@ -81392,26 +81958,26 @@ ${lanes.join("\n")} const symbol = getSymbolOfDeclaration(node); if (symbol.flags & 512 /* ValueModule */ && !inAmbientContext && isInstantiatedModule(node, shouldPreserveConstEnums(compilerOptions))) { if (getIsolatedModules(compilerOptions) && !getSourceFileOfNode(node).externalModuleIndicator) { - error(node.name, Diagnostics.Namespaces_are_not_allowed_in_global_script_files_when_0_is_enabled_If_this_file_is_not_intended_to_be_a_global_script_set_moduleDetection_to_force_or_add_an_empty_export_statement, isolatedModulesLikeFlagName); + error2(node.name, Diagnostics.Namespaces_are_not_allowed_in_global_script_files_when_0_is_enabled_If_this_file_is_not_intended_to_be_a_global_script_set_moduleDetection_to_force_or_add_an_empty_export_statement, isolatedModulesLikeFlagName); } if (((_a = symbol.declarations) == null ? void 0 : _a.length) > 1) { const firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (firstNonAmbientClassOrFunc) { if (getSourceFileOfNode(node) !== getSourceFileOfNode(firstNonAmbientClassOrFunc)) { - error(node.name, Diagnostics.A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged); + error2(node.name, Diagnostics.A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged); } else if (node.pos < firstNonAmbientClassOrFunc.pos) { - error(node.name, Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); + error2(node.name, Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); } } - const mergedClass = getDeclarationOfKind(symbol, 262 /* ClassDeclaration */); + const mergedClass = getDeclarationOfKind(symbol, 263 /* ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */; } } - if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 311 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || node.parent.impliedNodeFormat === 1 /* CommonJS */)) { + if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 312 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || node.parent.impliedNodeFormat === 1 /* CommonJS */)) { const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 95 /* ExportKeyword */); if (exportModifier) { - error(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled); + error2(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled); } } } @@ -81425,15 +81991,15 @@ ${lanes.join("\n")} } } else if (isGlobalSourceFile(node.parent)) { if (isGlobalAugmentation) { - error(node.name, Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations); + error2(node.name, Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations); } else if (isExternalModuleNameRelative(getTextOfIdentifierOrLiteral(node.name))) { - error(node.name, Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name); + error2(node.name, Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name); } } else { if (isGlobalAugmentation) { - error(node.name, Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations); + error2(node.name, Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations); } else { - error(node.name, Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces); + error2(node.name, Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces); } } } @@ -81441,21 +82007,21 @@ ${lanes.join("\n")} } function checkModuleAugmentationElement(node, isGlobalAugmentation) { switch (node.kind) { - case 242 /* VariableStatement */: + case 243 /* VariableStatement */: for (const decl of node.declarationList.declarations) { checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 276 /* ExportAssignment */: - case 277 /* ExportDeclaration */: + case 277 /* ExportAssignment */: + case 278 /* ExportDeclaration */: grammarErrorOnFirstToken(node, Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 270 /* ImportEqualsDeclaration */: - case 271 /* ImportDeclaration */: + case 271 /* ImportEqualsDeclaration */: + case 272 /* ImportDeclaration */: grammarErrorOnFirstToken(node, Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 207 /* BindingElement */: - case 259 /* VariableDeclaration */: + case 208 /* BindingElement */: + case 260 /* VariableDeclaration */: const name = node.name; if (isBindingPattern(name)) { for (const el of name.elements) { @@ -81463,12 +82029,12 @@ ${lanes.join("\n")} } break; } - case 262 /* ClassDeclaration */: - case 265 /* EnumDeclaration */: - case 261 /* FunctionDeclaration */: - case 263 /* InterfaceDeclaration */: - case 266 /* ModuleDeclaration */: - case 264 /* TypeAliasDeclaration */: + case 263 /* ClassDeclaration */: + case 266 /* EnumDeclaration */: + case 262 /* FunctionDeclaration */: + case 264 /* InterfaceDeclaration */: + case 267 /* ModuleDeclaration */: + case 265 /* TypeAliasDeclaration */: if (isGlobalAugmentation) { return; } @@ -81479,12 +82045,12 @@ ${lanes.join("\n")} switch (node.kind) { case 80 /* Identifier */: return node; - case 165 /* QualifiedName */: + case 166 /* QualifiedName */: do { node = node.left; } while (node.kind !== 80 /* Identifier */); return node; - case 210 /* PropertyAccessExpression */: + case 211 /* PropertyAccessExpression */: do { if (isModuleExportsAccessExpression(node.expression) && !isPrivateIdentifier(node.name)) { return node.name; @@ -81500,17 +82066,17 @@ ${lanes.join("\n")} return false; } if (!isStringLiteral(moduleName)) { - error(moduleName, Diagnostics.String_literal_expected); + error2(moduleName, Diagnostics.String_literal_expected); return false; } - const inAmbientExternalModule = node.parent.kind === 267 /* ModuleBlock */ && isAmbientModule(node.parent.parent); - if (node.parent.kind !== 311 /* SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 277 /* ExportDeclaration */ ? Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); + const inAmbientExternalModule = node.parent.kind === 268 /* ModuleBlock */ && isAmbientModule(node.parent.parent); + if (node.parent.kind !== 312 /* SourceFile */ && !inAmbientExternalModule) { + error2(moduleName, node.kind === 278 /* ExportDeclaration */ ? Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; } if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) { if (!isTopLevelInExternalModuleAugmentation(node)) { - error(node, Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name); + error2(node, Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name); return false; } } @@ -81519,7 +82085,7 @@ ${lanes.join("\n")} for (const clause of node.assertClause.elements) { if (!isStringLiteral(clause.value)) { hasError = true; - error(clause.value, Diagnostics.Import_assertion_values_must_be_string_literal_expressions); + error2(clause.value, Diagnostics.Import_assertion_values_must_be_string_literal_expressions); } } return !hasError; @@ -81534,9 +82100,9 @@ ${lanes.join("\n")} symbol = getMergedSymbol(symbol.exportSymbol || symbol); if (isInJSFile(node) && !(target.flags & 111551 /* Value */) && !isTypeOnlyImportOrExportDeclaration(node)) { const errorNode = isImportOrExportSpecifier(node) ? node.propertyName || node.name : isNamedDeclaration(node) ? node.name : node; - Debug.assert(node.kind !== 279 /* NamespaceExport */); - if (node.kind === 280 /* ExportSpecifier */) { - const diag2 = error(errorNode, Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files); + Debug.assert(node.kind !== 280 /* NamespaceExport */); + if (node.kind === 281 /* ExportSpecifier */) { + const diag2 = error2(errorNode, Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files); const alreadyExportedSymbol = (_b = (_a = getSourceFileOfNode(node).symbol) == null ? void 0 : _a.exports) == null ? void 0 : _b.get((node.propertyName || node.name).escapedText); if (alreadyExportedSymbol === target) { const exportingDeclaration = (_c = alreadyExportedSymbol.declarations) == null ? void 0 : _c.find(isJSDocNode); @@ -81549,11 +82115,11 @@ ${lanes.join("\n")} } } } else { - Debug.assert(node.kind !== 259 /* VariableDeclaration */); + Debug.assert(node.kind !== 260 /* VariableDeclaration */); const importDeclaration = findAncestor(node, or(isImportDeclaration, isImportEqualsDeclaration)); const moduleSpecifier = (importDeclaration && ((_d = tryGetModuleSpecifierFromDeclaration(importDeclaration)) == null ? void 0 : _d.text)) ?? "..."; const importedIdentifier = unescapeLeadingUnderscores(isIdentifier(errorNode) ? errorNode.escapedText : symbol.escapedName); - error( + error2( errorNode, Diagnostics._0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation, importedIdentifier, @@ -81562,47 +82128,47 @@ ${lanes.join("\n")} } return; } - const targetFlags = getAllSymbolFlags(target); + const targetFlags = getSymbolFlags(target); const excludedMeanings = (symbol.flags & (111551 /* Value */ | 1048576 /* ExportValue */) ? 111551 /* Value */ : 0) | (symbol.flags & 788968 /* Type */ ? 788968 /* Type */ : 0) | (symbol.flags & 1920 /* Namespace */ ? 1920 /* Namespace */ : 0); if (targetFlags & excludedMeanings) { - const message = node.kind === 280 /* ExportSpecifier */ ? Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; - error(node, message, symbolToString(symbol)); + const message = node.kind === 281 /* ExportSpecifier */ ? Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; + error2(node, message, symbolToString(symbol)); } - if (getIsolatedModules(compilerOptions) && !isTypeOnlyImportOrExportDeclaration(node) && !(node.flags & 16777216 /* Ambient */)) { + if (getIsolatedModules(compilerOptions) && !isTypeOnlyImportOrExportDeclaration(node) && !(node.flags & 33554432 /* Ambient */)) { const typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol); const isType = !(targetFlags & 111551 /* Value */); if (isType || typeOnlyAlias) { switch (node.kind) { - case 272 /* ImportClause */: - case 275 /* ImportSpecifier */: - case 270 /* ImportEqualsDeclaration */: { + case 273 /* ImportClause */: + case 276 /* ImportSpecifier */: + case 271 /* ImportEqualsDeclaration */: { if (compilerOptions.preserveValueImports || compilerOptions.verbatimModuleSyntax) { Debug.assertIsDefined(node.name, "An ImportClause with a symbol should have a name"); const message = compilerOptions.verbatimModuleSyntax && isInternalModuleImportEqualsDeclaration(node) ? Diagnostics.An_import_alias_cannot_resolve_to_a_type_or_type_only_declaration_when_verbatimModuleSyntax_is_enabled : isType ? compilerOptions.verbatimModuleSyntax ? Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled : Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled : compilerOptions.verbatimModuleSyntax ? Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled : Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled; - const name = idText(node.kind === 275 /* ImportSpecifier */ ? node.propertyName || node.name : node.name); + const name = idText(node.kind === 276 /* ImportSpecifier */ ? node.propertyName || node.name : node.name); addTypeOnlyDeclarationRelatedInfo( - error(node, message, name), + error2(node, message, name), isType ? void 0 : typeOnlyAlias, name ); } - if (isType && node.kind === 270 /* ImportEqualsDeclaration */ && hasEffectiveModifier(node, 1 /* Export */)) { - error(node, Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_0_is_enabled, isolatedModulesLikeFlagName); + if (isType && node.kind === 271 /* ImportEqualsDeclaration */ && hasEffectiveModifier(node, 1 /* Export */)) { + error2(node, Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_0_is_enabled, isolatedModulesLikeFlagName); } break; } - case 280 /* ExportSpecifier */: { + case 281 /* ExportSpecifier */: { if (compilerOptions.verbatimModuleSyntax || getSourceFileOfNode(typeOnlyAlias) !== getSourceFileOfNode(node)) { const name = idText(node.propertyName || node.name); - const diagnostic = isType ? error(node, Diagnostics.Re_exporting_a_type_when_0_is_enabled_requires_using_export_type, isolatedModulesLikeFlagName) : error(node, Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_1_is_enabled, name, isolatedModulesLikeFlagName); + const diagnostic = isType ? error2(node, Diagnostics.Re_exporting_a_type_when_0_is_enabled_requires_using_export_type, isolatedModulesLikeFlagName) : error2(node, Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_1_is_enabled, name, isolatedModulesLikeFlagName); addTypeOnlyDeclarationRelatedInfo(diagnostic, isType ? void 0 : typeOnlyAlias, name); break; } } } } - if (compilerOptions.verbatimModuleSyntax && node.kind !== 270 /* ImportEqualsDeclaration */ && !isInJSFile(node) && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) { - error(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled); + if (compilerOptions.verbatimModuleSyntax && node.kind !== 271 /* ImportEqualsDeclaration */ && !isInJSFile(node) && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) { + error2(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled); } } if (isImportSpecifier(node)) { @@ -81644,7 +82210,7 @@ ${lanes.join("\n")} function checkImportBinding(node) { checkCollisionsForDeclarationName(node, node.name); checkAliasSymbol(node); - if (node.kind === 275 /* ImportSpecifier */ && idText(node.propertyName || node.name) === "default" && getESModuleInterop(compilerOptions) && moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) { + if (node.kind === 276 /* ImportSpecifier */ && idText(node.propertyName || node.name) === "default" && getESModuleInterop(compilerOptions) && moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) { checkExternalEmitHelpers(node, 131072 /* ImportDefault */); } } @@ -81691,7 +82257,7 @@ ${lanes.join("\n")} checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 273 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 274 /* NamespaceImport */) { checkImportBinding(importClause.namedBindings); if (moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */) && getESModuleInterop(compilerOptions)) { checkExternalEmitHelpers(node, 65536 /* ImportStar */); @@ -81717,14 +82283,14 @@ ${lanes.join("\n")} if (hasSyntacticModifier(node, 1 /* Export */)) { markExportAsReferenced(node); } - if (node.moduleReference.kind !== 282 /* ExternalModuleReference */) { + if (node.moduleReference.kind !== 283 /* ExternalModuleReference */) { const target = resolveAlias(getSymbolOfDeclaration(node)); if (target !== unknownSymbol) { - const targetFlags = getAllSymbolFlags(target); + const targetFlags = getSymbolFlags(target); if (targetFlags & 111551 /* Value */) { const moduleName = getFirstIdentifier(node.moduleReference); if (!(resolveEntityName(moduleName, 111551 /* Value */ | 1920 /* Namespace */).flags & 1920 /* Namespace */)) { - error(moduleName, Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, declarationNameToString(moduleName)); + error2(moduleName, Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, declarationNameToString(moduleName)); } } if (targetFlags & 788968 /* Type */) { @@ -81735,7 +82301,7 @@ ${lanes.join("\n")} grammarErrorOnNode(node, Diagnostics.An_import_alias_cannot_use_import_type); } } else { - if (moduleKind >= 5 /* ES2015 */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 16777216 /* Ambient */)) { + if (moduleKind >= 5 /* ES2015 */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) { grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead); } } @@ -81755,15 +82321,15 @@ ${lanes.join("\n")} if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause && !isNamespaceExport(node.exportClause)) { forEach(node.exportClause.elements, checkExportSpecifier); - const inAmbientExternalModule = node.parent.kind === 267 /* ModuleBlock */ && isAmbientModule(node.parent.parent); - const inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 267 /* ModuleBlock */ && !node.moduleSpecifier && node.flags & 16777216 /* Ambient */; - if (node.parent.kind !== 311 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { - error(node, Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); + const inAmbientExternalModule = node.parent.kind === 268 /* ModuleBlock */ && isAmbientModule(node.parent.parent); + const inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 268 /* ModuleBlock */ && !node.moduleSpecifier && node.flags & 33554432 /* Ambient */; + if (node.parent.kind !== 312 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { + error2(node, Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } else { const moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); if (moduleSymbol && hasExportAssignmentSymbol(moduleSymbol)) { - error(node.moduleSpecifier, Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol)); + error2(node.moduleSpecifier, Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol)); } else if (node.exportClause) { checkAliasSymbol(node.exportClause); } @@ -81782,13 +82348,13 @@ ${lanes.join("\n")} } function checkGrammarExportDeclaration(node) { var _a; - if (node.isTypeOnly && ((_a = node.exportClause) == null ? void 0 : _a.kind) === 278 /* NamedExports */) { + if (node.isTypeOnly && ((_a = node.exportClause) == null ? void 0 : _a.kind) === 279 /* NamedExports */) { return checkGrammarNamedImportsOrExports(node.exportClause); } return false; } function checkGrammarModuleElementContext(node, errorMessage) { - const isInAppropriateContext = node.parent.kind === 311 /* SourceFile */ || node.parent.kind === 267 /* ModuleBlock */ || node.parent.kind === 266 /* ModuleDeclaration */; + const isInAppropriateContext = node.parent.kind === 312 /* SourceFile */ || node.parent.kind === 268 /* ModuleBlock */ || node.parent.kind === 267 /* ModuleDeclaration */; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -81824,7 +82390,7 @@ ${lanes.join("\n")} } for (const statement of sourceFile.statements) { if (canConvertImportDeclarationToTypeOnly(statement) || canConvertImportEqualsDeclarationToTypeOnly(statement)) { - error( + error2( statement, Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error ); @@ -81854,13 +82420,13 @@ ${lanes.join("\n")} true ); if (symbol && (symbol === undefinedSymbol || symbol === globalThisSymbol || symbol.declarations && isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) { - error(exportedName, Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, idText(exportedName)); + error2(exportedName, Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, idText(exportedName)); } else { if (!node.isTypeOnly && !node.parent.parent.isTypeOnly) { markExportAsReferenced(node); } const target = symbol && (symbol.flags & 2097152 /* Alias */ ? resolveAlias(symbol) : symbol); - if (!target || getAllSymbolFlags(target) & 111551 /* Value */) { + if (!target || getSymbolFlags(target) & 111551 /* Value */) { checkExpressionCached(node.propertyName || node.name); } } @@ -81875,12 +82441,12 @@ ${lanes.join("\n")} if (checkGrammarModuleElementContext(node, illegalContextMessage)) { return; } - const container = node.parent.kind === 311 /* SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 266 /* ModuleDeclaration */ && !isAmbientModule(container)) { + const container = node.parent.kind === 312 /* SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 267 /* ModuleDeclaration */ && !isAmbientModule(container)) { if (node.isExportEquals) { - error(node, Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); + error2(node, Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); } else { - error(node, Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); + error2(node, Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); } return; } @@ -81891,7 +82457,7 @@ ${lanes.join("\n")} if (typeAnnotationNode) { checkTypeAssignableTo(checkExpressionCached(node.expression), getTypeFromTypeNode(typeAnnotationNode), node.expression); } - const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */); + const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */); if (node.expression.kind === 80 /* Identifier */) { const id = node.expression; const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName( @@ -81905,17 +82471,17 @@ ${lanes.join("\n")} )); if (sym) { markAliasReferenced(sym, id); - if (getAllSymbolFlags(sym) & 111551 /* Value */) { + if (getSymbolFlags(sym) & 111551 /* Value */) { checkExpressionCached(id); - if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) { - error( + if (!isIllegalExportDefaultInCJS && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) { + error2( id, node.isExportEquals ? Diagnostics.An_export_declaration_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration : Diagnostics.An_export_default_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration, idText(id) ); } - } else if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax) { - error( + } else if (!isIllegalExportDefaultInCJS && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax) { + error2( id, node.isExportEquals ? Diagnostics.An_export_declaration_must_reference_a_value_when_verbatimModuleSyntax_is_enabled_but_0_only_refers_to_a_type : Diagnostics.An_export_default_must_reference_a_value_when_verbatimModuleSyntax_is_enabled_but_0_only_refers_to_a_type, idText(id) @@ -81935,16 +82501,16 @@ ${lanes.join("\n")} checkExpressionCached(node.expression); } if (isIllegalExportDefaultInCJS) { - error(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled); + error2(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled); } checkExternalModuleExports(container); - if (node.flags & 16777216 /* Ambient */ && !isEntityNameExpression(node.expression)) { + if (node.flags & 33554432 /* Ambient */ && !isEntityNameExpression(node.expression)) { grammarErrorOnNode(node.expression, Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context); } if (node.isExportEquals) { - if (moduleKind >= 5 /* ES2015 */ && (node.flags & 16777216 /* Ambient */ && getSourceFileOfNode(node).impliedNodeFormat === 99 /* ESNext */ || !(node.flags & 16777216 /* Ambient */) && getSourceFileOfNode(node).impliedNodeFormat !== 1 /* CommonJS */)) { + if (moduleKind >= 5 /* ES2015 */ && (node.flags & 33554432 /* Ambient */ && getSourceFileOfNode(node).impliedNodeFormat === 99 /* ESNext */ || !(node.flags & 33554432 /* Ambient */) && getSourceFileOfNode(node).impliedNodeFormat !== 1 /* CommonJS */)) { grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead); - } else if (moduleKind === 4 /* System */ && !(node.flags & 16777216 /* Ambient */)) { + } else if (moduleKind === 4 /* System */ && !(node.flags & 33554432 /* Ambient */)) { grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system); } } @@ -81960,7 +82526,7 @@ ${lanes.join("\n")} if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) { const declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration; if (declaration && !isTopLevelInExternalModuleAugmentation(declaration) && !isInJSFile(declaration)) { - error(declaration, Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements); + error2(declaration, Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements); } } const exports = getExportsOfModule(moduleSymbol); @@ -82017,182 +82583,182 @@ ${lanes.join("\n")} const kind = node.kind; if (cancellationToken) { switch (kind) { - case 266 /* ModuleDeclaration */: - case 262 /* ClassDeclaration */: - case 263 /* InterfaceDeclaration */: - case 261 /* FunctionDeclaration */: + case 267 /* ModuleDeclaration */: + case 263 /* ClassDeclaration */: + case 264 /* InterfaceDeclaration */: + case 262 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } - if (kind >= 242 /* FirstStatement */ && kind <= 258 /* LastStatement */ && canHaveFlowNode(node) && node.flowNode && !isReachableFlowNode(node.flowNode)) { + if (kind >= 243 /* FirstStatement */ && kind <= 259 /* LastStatement */ && canHaveFlowNode(node) && node.flowNode && !isReachableFlowNode(node.flowNode)) { errorOrSuggestion(compilerOptions.allowUnreachableCode === false, node, Diagnostics.Unreachable_code_detected); } switch (kind) { - case 167 /* TypeParameter */: + case 168 /* TypeParameter */: return checkTypeParameter(node); - case 168 /* Parameter */: + case 169 /* Parameter */: return checkParameter(node); - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: return checkPropertyDeclaration(node); - case 170 /* PropertySignature */: + case 171 /* PropertySignature */: return checkPropertySignature(node); - case 184 /* ConstructorType */: - case 183 /* FunctionType */: - case 178 /* CallSignature */: - case 179 /* ConstructSignature */: - case 180 /* IndexSignature */: + case 185 /* ConstructorType */: + case 184 /* FunctionType */: + case 179 /* CallSignature */: + case 180 /* ConstructSignature */: + case 181 /* IndexSignature */: return checkSignatureDeclaration(node); - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: return checkMethodDeclaration(node); - case 174 /* ClassStaticBlockDeclaration */: + case 175 /* ClassStaticBlockDeclaration */: return checkClassStaticBlockDeclaration(node); - case 175 /* Constructor */: + case 176 /* Constructor */: return checkConstructorDeclaration(node); - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: return checkAccessorDeclaration(node); - case 182 /* TypeReference */: + case 183 /* TypeReference */: return checkTypeReferenceNode(node); - case 181 /* TypePredicate */: + case 182 /* TypePredicate */: return checkTypePredicate(node); - case 185 /* TypeQuery */: + case 186 /* TypeQuery */: return checkTypeQuery(node); - case 186 /* TypeLiteral */: + case 187 /* TypeLiteral */: return checkTypeLiteral(node); - case 187 /* ArrayType */: + case 188 /* ArrayType */: return checkArrayType(node); - case 188 /* TupleType */: + case 189 /* TupleType */: return checkTupleType(node); - case 191 /* UnionType */: - case 192 /* IntersectionType */: + case 192 /* UnionType */: + case 193 /* IntersectionType */: return checkUnionOrIntersectionType(node); - case 195 /* ParenthesizedType */: - case 189 /* OptionalType */: - case 190 /* RestType */: + case 196 /* ParenthesizedType */: + case 190 /* OptionalType */: + case 191 /* RestType */: return checkSourceElement(node.type); - case 196 /* ThisType */: + case 197 /* ThisType */: return checkThisType(node); - case 197 /* TypeOperator */: + case 198 /* TypeOperator */: return checkTypeOperator(node); - case 193 /* ConditionalType */: + case 194 /* ConditionalType */: return checkConditionalType(node); - case 194 /* InferType */: + case 195 /* InferType */: return checkInferType(node); - case 202 /* TemplateLiteralType */: + case 203 /* TemplateLiteralType */: return checkTemplateLiteralType(node); - case 204 /* ImportType */: + case 205 /* ImportType */: return checkImportType(node); - case 201 /* NamedTupleMember */: + case 202 /* NamedTupleMember */: return checkNamedTupleMember(node); - case 334 /* JSDocAugmentsTag */: + case 335 /* JSDocAugmentsTag */: return checkJSDocAugmentsTag(node); - case 335 /* JSDocImplementsTag */: + case 336 /* JSDocImplementsTag */: return checkJSDocImplementsTag(node); - case 352 /* JSDocTypedefTag */: - case 344 /* JSDocCallbackTag */: - case 346 /* JSDocEnumTag */: + case 353 /* JSDocTypedefTag */: + case 345 /* JSDocCallbackTag */: + case 347 /* JSDocEnumTag */: return checkJSDocTypeAliasTag(node); - case 351 /* JSDocTemplateTag */: + case 352 /* JSDocTemplateTag */: return checkJSDocTemplateTag(node); - case 350 /* JSDocTypeTag */: + case 351 /* JSDocTypeTag */: return checkJSDocTypeTag(node); - case 330 /* JSDocLink */: - case 331 /* JSDocLinkCode */: - case 332 /* JSDocLinkPlain */: + case 331 /* JSDocLink */: + case 332 /* JSDocLinkCode */: + case 333 /* JSDocLinkPlain */: return checkJSDocLinkLikeTag(node); - case 347 /* JSDocParameterTag */: + case 348 /* JSDocParameterTag */: return checkJSDocParameterTag(node); - case 354 /* JSDocPropertyTag */: + case 355 /* JSDocPropertyTag */: return checkJSDocPropertyTag(node); - case 323 /* JSDocFunctionType */: + case 324 /* JSDocFunctionType */: checkJSDocFunctionType(node); - case 321 /* JSDocNonNullableType */: - case 320 /* JSDocNullableType */: - case 318 /* JSDocAllType */: - case 319 /* JSDocUnknownType */: - case 328 /* JSDocTypeLiteral */: + case 322 /* JSDocNonNullableType */: + case 321 /* JSDocNullableType */: + case 319 /* JSDocAllType */: + case 320 /* JSDocUnknownType */: + case 329 /* JSDocTypeLiteral */: checkJSDocTypeIsInJsFile(node); forEachChild(node, checkSourceElement); return; - case 324 /* JSDocVariadicType */: + case 325 /* JSDocVariadicType */: checkJSDocVariadicType(node); return; - case 315 /* JSDocTypeExpression */: + case 316 /* JSDocTypeExpression */: return checkSourceElement(node.type); - case 339 /* JSDocPublicTag */: - case 341 /* JSDocProtectedTag */: - case 340 /* JSDocPrivateTag */: + case 340 /* JSDocPublicTag */: + case 342 /* JSDocProtectedTag */: + case 341 /* JSDocPrivateTag */: return checkJSDocAccessibilityModifiers(node); - case 356 /* JSDocSatisfiesTag */: + case 357 /* JSDocSatisfiesTag */: return checkJSDocSatisfiesTag(node); - case 198 /* IndexedAccessType */: + case 199 /* IndexedAccessType */: return checkIndexedAccessType(node); - case 199 /* MappedType */: + case 200 /* MappedType */: return checkMappedType(node); - case 261 /* FunctionDeclaration */: + case 262 /* FunctionDeclaration */: return checkFunctionDeclaration(node); - case 240 /* Block */: - case 267 /* ModuleBlock */: + case 241 /* Block */: + case 268 /* ModuleBlock */: return checkBlock(node); - case 242 /* VariableStatement */: + case 243 /* VariableStatement */: return checkVariableStatement(node); - case 243 /* ExpressionStatement */: + case 244 /* ExpressionStatement */: return checkExpressionStatement(node); - case 244 /* IfStatement */: + case 245 /* IfStatement */: return checkIfStatement(node); - case 245 /* DoStatement */: + case 246 /* DoStatement */: return checkDoStatement(node); - case 246 /* WhileStatement */: + case 247 /* WhileStatement */: return checkWhileStatement(node); - case 247 /* ForStatement */: + case 248 /* ForStatement */: return checkForStatement(node); - case 248 /* ForInStatement */: + case 249 /* ForInStatement */: return checkForInStatement(node); - case 249 /* ForOfStatement */: + case 250 /* ForOfStatement */: return checkForOfStatement(node); - case 250 /* ContinueStatement */: - case 251 /* BreakStatement */: + case 251 /* ContinueStatement */: + case 252 /* BreakStatement */: return checkBreakOrContinueStatement(node); - case 252 /* ReturnStatement */: + case 253 /* ReturnStatement */: return checkReturnStatement(node); - case 253 /* WithStatement */: + case 254 /* WithStatement */: return checkWithStatement(node); - case 254 /* SwitchStatement */: + case 255 /* SwitchStatement */: return checkSwitchStatement(node); - case 255 /* LabeledStatement */: + case 256 /* LabeledStatement */: return checkLabeledStatement(node); - case 256 /* ThrowStatement */: + case 257 /* ThrowStatement */: return checkThrowStatement(node); - case 257 /* TryStatement */: + case 258 /* TryStatement */: return checkTryStatement(node); - case 259 /* VariableDeclaration */: + case 260 /* VariableDeclaration */: return checkVariableDeclaration(node); - case 207 /* BindingElement */: + case 208 /* BindingElement */: return checkBindingElement(node); - case 262 /* ClassDeclaration */: + case 263 /* ClassDeclaration */: return checkClassDeclaration(node); - case 263 /* InterfaceDeclaration */: + case 264 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 264 /* TypeAliasDeclaration */: + case 265 /* TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 265 /* EnumDeclaration */: + case 266 /* EnumDeclaration */: return checkEnumDeclaration(node); - case 266 /* ModuleDeclaration */: + case 267 /* ModuleDeclaration */: return checkModuleDeclaration(node); - case 271 /* ImportDeclaration */: + case 272 /* ImportDeclaration */: return checkImportDeclaration(node); - case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 277 /* ExportDeclaration */: + case 278 /* ExportDeclaration */: return checkExportDeclaration(node); - case 276 /* ExportAssignment */: + case 277 /* ExportAssignment */: return checkExportAssignment(node); - case 241 /* EmptyStatement */: - case 258 /* DebuggerStatement */: + case 242 /* EmptyStatement */: + case 259 /* DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 281 /* MissingDeclaration */: + case 282 /* MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -82226,16 +82792,16 @@ ${lanes.join("\n")} const { parent: parent2 } = node; if (isParameter(parent2) && isJSDocFunctionType(parent2.parent)) { if (last(parent2.parent.parameters) !== parent2) { - error(node, Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list); + error2(node, Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list); } return; } if (!isJSDocTypeExpression(parent2)) { - error(node, Diagnostics.JSDoc_may_only_appear_in_the_last_parameter_of_a_signature); + error2(node, Diagnostics.JSDoc_may_only_appear_in_the_last_parameter_of_a_signature); } const paramTag = node.parent.parent; if (!isJSDocParameterTag(paramTag)) { - error(node, Diagnostics.JSDoc_may_only_appear_in_the_last_parameter_of_a_signature); + error2(node, Diagnostics.JSDoc_may_only_appear_in_the_last_parameter_of_a_signature); return; } const param = getParameterSymbolFromJSDoc(paramTag); @@ -82244,7 +82810,7 @@ ${lanes.join("\n")} } const host2 = getHostSignatureFromJSDoc(paramTag); if (!host2 || last(host2.parameters).symbol !== param) { - error(node, Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list); + error2(node, Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list); } } function getTypeFromJSDocVariadicType(node) { @@ -82291,38 +82857,38 @@ ${lanes.join("\n")} currentNode = node; instantiationCount = 0; switch (node.kind) { - case 212 /* CallExpression */: - case 213 /* NewExpression */: - case 214 /* TaggedTemplateExpression */: - case 169 /* Decorator */: - case 285 /* JsxOpeningElement */: + case 213 /* CallExpression */: + case 214 /* NewExpression */: + case 215 /* TaggedTemplateExpression */: + case 170 /* Decorator */: + case 286 /* JsxOpeningElement */: resolveUntypedCall(node); break; - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: checkAccessorDeclaration(node); break; - case 230 /* ClassExpression */: + case 231 /* ClassExpression */: checkClassExpressionDeferred(node); break; - case 167 /* TypeParameter */: + case 168 /* TypeParameter */: checkTypeParameterDeferred(node); break; - case 284 /* JsxSelfClosingElement */: + case 285 /* JsxSelfClosingElement */: checkJsxSelfClosingElementDeferred(node); break; - case 283 /* JsxElement */: + case 284 /* JsxElement */: checkJsxElementDeferred(node); break; - case 215 /* TypeAssertionExpression */: - case 233 /* AsExpression */: - case 216 /* ParenthesizedExpression */: + case 216 /* TypeAssertionExpression */: + case 234 /* AsExpression */: + case 217 /* ParenthesizedExpression */: checkAssertionDeferred(node); } currentNode = saveCurrentNode; @@ -82380,7 +82946,7 @@ ${lanes.join("\n")} addLazyDiagnostic(() => { if (!node.isDeclarationFile && (compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters)) { checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(node), (containingNode, kind, diag2) => { - if (!containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 16777216 /* Ambient */))) { + if (!containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 33554432 /* Ambient */))) { diagnostics.add(diag2); } }); @@ -82459,7 +83025,7 @@ ${lanes.join("\n")} return diagnostics.getGlobalDiagnostics(); } function getSymbolsInScope(location, meaning) { - if (location.flags & 33554432 /* InWithStatement */) { + if (location.flags & 67108864 /* InWithStatement */) { return []; } const symbols = createSymbolTable(); @@ -82473,27 +83039,27 @@ ${lanes.join("\n")} copySymbols(location.locals, meaning); } switch (location.kind) { - case 311 /* SourceFile */: + case 312 /* SourceFile */: if (!isExternalModule(location)) break; - case 266 /* ModuleDeclaration */: + case 267 /* ModuleDeclaration */: copyLocallyVisibleExportSymbols(getSymbolOfDeclaration(location).exports, meaning & 2623475 /* ModuleMember */); break; - case 265 /* EnumDeclaration */: + case 266 /* EnumDeclaration */: copySymbols(getSymbolOfDeclaration(location).exports, meaning & 8 /* EnumMember */); break; - case 230 /* ClassExpression */: + case 231 /* ClassExpression */: const className = location.name; if (className) { copySymbol(location.symbol, meaning); } - case 262 /* ClassDeclaration */: - case 263 /* InterfaceDeclaration */: + case 263 /* ClassDeclaration */: + case 264 /* InterfaceDeclaration */: if (!isStaticSymbol) { copySymbols(getMembersOfSymbol(getSymbolOfDeclaration(location)), meaning & 788968 /* Type */); } break; - case 217 /* FunctionExpression */: + case 218 /* FunctionExpression */: const funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -82526,7 +83092,7 @@ ${lanes.join("\n")} function copyLocallyVisibleExportSymbols(source, meaning2) { if (meaning2) { source.forEach((symbol) => { - if (!getDeclarationOfKind(symbol, 280 /* ExportSpecifier */) && !getDeclarationOfKind(symbol, 279 /* NamespaceExport */)) { + if (!getDeclarationOfKind(symbol, 281 /* ExportSpecifier */) && !getDeclarationOfKind(symbol, 280 /* NamespaceExport */) && symbol.escapedName !== "default" /* Default */) { copySymbol(symbol, meaning2); } }); @@ -82537,16 +83103,16 @@ ${lanes.join("\n")} return name.kind === 80 /* Identifier */ && isTypeDeclaration(name.parent) && getNameOfDeclaration(name.parent) === name; } function isTypeReferenceIdentifier(node) { - while (node.parent.kind === 165 /* QualifiedName */) { + while (node.parent.kind === 166 /* QualifiedName */) { node = node.parent; } - return node.parent.kind === 182 /* TypeReference */; + return node.parent.kind === 183 /* TypeReference */; } function isInNameOfExpressionWithTypeArguments(node) { - while (node.parent.kind === 210 /* PropertyAccessExpression */) { + while (node.parent.kind === 211 /* PropertyAccessExpression */) { node = node.parent; } - return node.parent.kind === 232 /* ExpressionWithTypeArguments */; + return node.parent.kind === 233 /* ExpressionWithTypeArguments */; } function forEachEnclosingClass(node, callback) { let result; @@ -82572,13 +83138,13 @@ ${lanes.join("\n")} return !!forEachEnclosingClass(node, (n) => n === classDeclaration); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 165 /* QualifiedName */) { + while (nodeOnRightSide.parent.kind === 166 /* QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 270 /* ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 271 /* ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide ? nodeOnRightSide.parent : void 0; } - if (nodeOnRightSide.parent.kind === 276 /* ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 277 /* ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide ? nodeOnRightSide.parent : void 0; } return void 0; @@ -82604,7 +83170,7 @@ ${lanes.join("\n")} node = parent2; parent2 = parent2.parent; } - if (parent2 && parent2.kind === 204 /* ImportType */ && parent2.qualifier === node) { + if (parent2 && parent2.kind === 205 /* ImportType */ && parent2.qualifier === node) { return parent2; } return void 0; @@ -82626,7 +83192,7 @@ ${lanes.join("\n")} /*contextFlags*/ void 0 ); - const type = contextualType && getThisTypeFromContextualType(contextualType); + const type = getThisTypeOfObjectLiteralFromContextualType(containingLiteral, contextualType); return type && !isTypeAny(type); } } @@ -82636,7 +83202,7 @@ ${lanes.join("\n")} if (isDeclarationName(name)) { return getSymbolOfNode(name.parent); } - if (isInJSFile(name) && name.parent.kind === 210 /* PropertyAccessExpression */ && name.parent === name.parent.parent.left) { + if (isInJSFile(name) && name.parent.kind === 211 /* PropertyAccessExpression */ && name.parent === name.parent.parent.left) { if (!isPrivateIdentifier(name) && !isJSDocMemberName(name) && !isThisPropertyAndThisTyped(name.parent)) { const specialPropertyAssignmentSymbol = getSpecialPropertyAssignmentSymbolFromEntityName(name); if (specialPropertyAssignmentSymbol) { @@ -82644,7 +83210,7 @@ ${lanes.join("\n")} } } } - if (name.parent.kind === 276 /* ExportAssignment */ && isEntityNameExpression(name)) { + if (name.parent.kind === 277 /* ExportAssignment */ && isEntityNameExpression(name)) { const success = resolveEntityName( name, /*all meanings*/ @@ -82656,7 +83222,7 @@ ${lanes.join("\n")} return success; } } else if (isEntityName(name) && isInRightSideOfImportOrExportAssignment(name)) { - const importEqualsDeclaration = getAncestor(name, 270 /* ImportEqualsDeclaration */); + const importEqualsDeclaration = getAncestor(name, 271 /* ImportEqualsDeclaration */); Debug.assert(importEqualsDeclaration !== void 0); return getSymbolOfPartOfRightHandSideOfImportEquals( name, @@ -82677,7 +83243,7 @@ ${lanes.join("\n")} } if (isInNameOfExpressionWithTypeArguments(name)) { let meaning = 0 /* None */; - if (name.parent.kind === 232 /* ExpressionWithTypeArguments */) { + if (name.parent.kind === 233 /* ExpressionWithTypeArguments */) { meaning = isPartOfTypeNode(name) ? 788968 /* Type */ : 111551 /* Value */; if (isExpressionWithTypeArgumentsInClassExtendsClause(name.parent)) { meaning |= 111551 /* Value */; @@ -82696,10 +83262,10 @@ ${lanes.join("\n")} return entityNameSymbol; } } - if (name.parent.kind === 347 /* JSDocParameterTag */) { + if (name.parent.kind === 348 /* JSDocParameterTag */) { return getParameterSymbolFromJSDoc(name.parent); } - if (name.parent.kind === 167 /* TypeParameter */ && name.parent.parent.kind === 351 /* JSDocTemplateTag */) { + if (name.parent.kind === 168 /* TypeParameter */ && name.parent.parent.kind === 352 /* JSDocTemplateTag */) { Debug.assert(!isInJSFile(name)); const typeParameter = getTypeParameterFromJsDoc(name.parent); return typeParameter && typeParameter.symbol; @@ -82752,12 +83318,12 @@ ${lanes.join("\n")} return result; } else if (isPrivateIdentifier(name)) { return getSymbolForPrivateIdentifierExpression(name); - } else if (name.kind === 210 /* PropertyAccessExpression */ || name.kind === 165 /* QualifiedName */) { + } else if (name.kind === 211 /* PropertyAccessExpression */ || name.kind === 166 /* QualifiedName */) { const links = getNodeLinks(name); if (links.resolvedSymbol) { return links.resolvedSymbol; } - if (name.kind === 210 /* PropertyAccessExpression */) { + if (name.kind === 211 /* PropertyAccessExpression */) { checkPropertyAccessExpression(name, 0 /* Normal */); if (!links.resolvedSymbol) { const expressionType = checkExpressionCached(name.expression); @@ -82797,7 +83363,7 @@ ${lanes.join("\n")} return resolveJSDocMemberName(name); } } else if (isTypeReferenceIdentifier(name)) { - const meaning = name.parent.kind === 182 /* TypeReference */ ? 788968 /* Type */ : 1920 /* Namespace */; + const meaning = name.parent.kind === 183 /* TypeReference */ ? 788968 /* Type */ : 1920 /* Namespace */; const symbol = resolveEntityName( name, meaning, @@ -82808,7 +83374,7 @@ ${lanes.join("\n")} ); return symbol && symbol !== unknownSymbol ? symbol : getUnresolvedSymbolForEntityName(name); } - if (name.parent.kind === 181 /* TypePredicate */) { + if (name.parent.kind === 182 /* TypePredicate */) { return resolveEntityName( name, /*meaning*/ @@ -82849,7 +83415,7 @@ ${lanes.join("\n")} } const { parent: parent2 } = node; const grandParent = parent2.parent; - if (node.flags & 33554432 /* InWithStatement */) { + if (node.flags & 67108864 /* InWithStatement */) { return void 0; } if (isDeclarationNameOrImportPropertyName(node)) { @@ -82861,7 +83427,7 @@ ${lanes.join("\n")} if (node.kind === 80 /* Identifier */) { if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); - } else if (parent2.kind === 207 /* BindingElement */ && grandParent.kind === 205 /* ObjectBindingPattern */ && node === parent2.propertyName) { + } else if (parent2.kind === 208 /* BindingElement */ && grandParent.kind === 206 /* ObjectBindingPattern */ && node === parent2.propertyName) { const typeOfPattern = getTypeOfNode(grandParent); const propertyDeclaration = getPropertyOfType(typeOfPattern, node.escapedText); if (propertyDeclaration) { @@ -82880,8 +83446,8 @@ ${lanes.join("\n")} switch (node.kind) { case 80 /* Identifier */: case 81 /* PrivateIdentifier */: - case 210 /* PropertyAccessExpression */: - case 165 /* QualifiedName */: + case 211 /* PropertyAccessExpression */: + case 166 /* QualifiedName */: if (!isThisInTypeQuery(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); } @@ -82902,19 +83468,19 @@ ${lanes.join("\n")} if (isInExpressionContext(node)) { return checkExpression(node).symbol; } - case 196 /* ThisType */: + case 197 /* ThisType */: return getTypeFromThisTypeNode(node).symbol; case 108 /* SuperKeyword */: return checkExpression(node).symbol; case 137 /* ConstructorKeyword */: const constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 175 /* Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 176 /* Constructor */) { return constructorDeclaration.parent.symbol; } return void 0; case 11 /* StringLiteral */: case 15 /* NoSubstitutionTemplateLiteral */: - if (isExternalModuleImportEqualsDeclaration(node.parent.parent) && getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node || (node.parent.kind === 271 /* ImportDeclaration */ || node.parent.kind === 277 /* ExportDeclaration */) && node.parent.moduleSpecifier === node || (isInJSFile(node) && getEmitModuleResolutionKind(compilerOptions) !== 100 /* Bundler */ && isRequireCall( + if (isExternalModuleImportEqualsDeclaration(node.parent.parent) && getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node || (node.parent.kind === 272 /* ImportDeclaration */ || node.parent.kind === 278 /* ExportDeclaration */) && node.parent.moduleSpecifier === node || (isInJSFile(node) && getEmitModuleResolutionKind(compilerOptions) !== 100 /* Bundler */ && isRequireCall( node.parent, /*requireStringLiteralLikeArgument*/ false @@ -82932,16 +83498,16 @@ ${lanes.join("\n")} case 39 /* EqualsGreaterThanToken */: case 86 /* ClassKeyword */: return getSymbolOfNode(node.parent); - case 204 /* ImportType */: + case 205 /* ImportType */: return isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal, ignoreErrors) : void 0; case 95 /* ExportKeyword */: return isExportAssignment(node.parent) ? Debug.checkDefined(node.parent.symbol) : void 0; case 102 /* ImportKeyword */: case 105 /* NewKeyword */: return isMetaProperty(node.parent) ? checkMetaPropertyKeyword(node.parent).symbol : void 0; - case 235 /* MetaProperty */: + case 236 /* MetaProperty */: return checkExpression(node).symbol; - case 294 /* JsxNamespacedName */: + case 295 /* JsxNamespacedName */: if (isJSXTagName(node) && isJsxIntrinsicTagName(node)) { const symbol = getIntrinsicTagSymbol(node.parent); return symbol === unknownSymbol ? void 0 : symbol; @@ -82960,7 +83526,7 @@ ${lanes.join("\n")} return void 0; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 303 /* ShorthandPropertyAssignment */) { + if (location && location.kind === 304 /* ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 111551 /* Value */ | 2097152 /* Alias */); } return void 0; @@ -82976,7 +83542,7 @@ ${lanes.join("\n")} if (isSourceFile(node) && !isExternalModule(node)) { return errorType; } - if (node.flags & 33554432 /* InWithStatement */) { + if (node.flags & 67108864 /* InWithStatement */) { return errorType; } const classDecl = tryGetClassImplementingOrExtendingExpressionWithTypeArguments(node); @@ -83040,16 +83606,16 @@ ${lanes.join("\n")} return errorType; } function getTypeOfAssignmentPattern(expr) { - Debug.assert(expr.kind === 209 /* ObjectLiteralExpression */ || expr.kind === 208 /* ArrayLiteralExpression */); - if (expr.parent.kind === 249 /* ForOfStatement */) { + Debug.assert(expr.kind === 210 /* ObjectLiteralExpression */ || expr.kind === 209 /* ArrayLiteralExpression */); + if (expr.parent.kind === 250 /* ForOfStatement */) { const iteratedType = checkRightHandSideOfForOf(expr.parent); return checkDestructuringAssignment(expr, iteratedType || errorType); } - if (expr.parent.kind === 225 /* BinaryExpression */) { + if (expr.parent.kind === 226 /* BinaryExpression */) { const iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || errorType); } - if (expr.parent.kind === 302 /* PropertyAssignment */) { + if (expr.parent.kind === 303 /* PropertyAssignment */) { const node2 = cast(expr.parent.parent, isObjectLiteralExpression); const typeOfParentObjectLiteral = getTypeOfAssignmentPattern(node2) || errorType; const propertyIndex = indexOfNode(node2.properties, expr.parent); @@ -83082,7 +83648,7 @@ ${lanes.join("\n")} case 9 /* NumericLiteral */: case 11 /* StringLiteral */: return getStringLiteralType(name.text); - case 166 /* ComputedPropertyName */: + case 167 /* ComputedPropertyName */: const nameType = checkComputedPropertyName(name); return isTypeAssignableToKind(nameType, 12288 /* ESSymbolLike */) ? nameType : stringType; default: @@ -83152,7 +83718,7 @@ ${lanes.join("\n")} return symbolLinks2.exportsSomeValue; function isValue(s) { s = resolveSymbol(s); - return s && !!(getAllSymbolFlags(s) & 111551 /* Value */); + return s && !!(getSymbolFlags(s) & 111551 /* Value */); } } function isNameOfModuleOrEnumDeclaration(node) { @@ -83177,7 +83743,7 @@ ${lanes.join("\n")} } const parentSymbol = getParentOfSymbol(symbol); if (parentSymbol) { - if (parentSymbol.flags & 512 /* ValueModule */ && ((_a = parentSymbol.valueDeclaration) == null ? void 0 : _a.kind) === 311 /* SourceFile */) { + if (parentSymbol.flags & 512 /* ValueModule */ && ((_a = parentSymbol.valueDeclaration) == null ? void 0 : _a.kind) === 312 /* SourceFile */) { const symbolFile = parentSymbol.valueDeclaration; const referenceFile = getSourceFileOfNode(node); const symbolIsUmdExport = symbolFile !== referenceFile; @@ -83207,7 +83773,7 @@ ${lanes.join("\n")} return void 0; } function isSymbolOfDestructuredElementOfCatchBinding(symbol) { - return symbol.valueDeclaration && isBindingElement(symbol.valueDeclaration) && walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 298 /* CatchClause */; + return symbol.valueDeclaration && isBindingElement(symbol.valueDeclaration) && walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 299 /* CatchClause */; } function isSymbolOfDeclarationWithCollidingName(symbol) { if (symbol.flags & 418 /* BlockScoped */ && symbol.valueDeclaration && !isSourceFile(symbol.valueDeclaration)) { @@ -83235,7 +83801,7 @@ ${lanes.join("\n")} /*lookInLabeledStatements*/ false ); - const inLoopBodyBlock = container.kind === 240 /* Block */ && isIterationStatement( + const inLoopBodyBlock = container.kind === 241 /* Block */ && isIterationStatement( container.parent, /*lookInLabeledStatements*/ false @@ -83275,31 +83841,35 @@ ${lanes.join("\n")} function isValueAliasDeclaration(node) { Debug.assert(canCollectSymbolAliasAccessabilityData); switch (node.kind) { - case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportEqualsDeclaration */: return isAliasResolvedToValue(getSymbolOfDeclaration(node)); - case 272 /* ImportClause */: - case 273 /* NamespaceImport */: - case 275 /* ImportSpecifier */: - case 280 /* ExportSpecifier */: + case 273 /* ImportClause */: + case 274 /* NamespaceImport */: + case 276 /* ImportSpecifier */: + case 281 /* ExportSpecifier */: const symbol = getSymbolOfDeclaration(node); - return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* Value */); - case 277 /* ExportDeclaration */: + return !!symbol && isAliasResolvedToValue( + symbol, + /*excludeTypeOnlyValues*/ + true + ); + case 278 /* ExportDeclaration */: const exportClause = node.exportClause; return !!exportClause && (isNamespaceExport(exportClause) || some(exportClause.elements, isValueAliasDeclaration)); - case 276 /* ExportAssignment */: + case 277 /* ExportAssignment */: return node.expression && node.expression.kind === 80 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfDeclaration(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(nodeIn) { const node = getParseTreeNode(nodeIn, isImportEqualsDeclaration); - if (node === void 0 || node.parent.kind !== 311 /* SourceFile */ || !isInternalModuleImportEqualsDeclaration(node)) { + if (node === void 0 || node.parent.kind !== 312 /* SourceFile */ || !isInternalModuleImportEqualsDeclaration(node)) { return false; } const isValue = isAliasResolvedToValue(getSymbolOfDeclaration(node)); return isValue && node.moduleReference && !nodeIsMissing(node.moduleReference); } - function isAliasResolvedToValue(symbol) { + function isAliasResolvedToValue(symbol, excludeTypeOnlyValues) { if (!symbol) { return false; } @@ -83307,7 +83877,12 @@ ${lanes.join("\n")} if (target === unknownSymbol) { return true; } - return !!((getAllSymbolFlags(target) ?? -1) & 111551 /* Value */) && (shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target)); + return !!(getSymbolFlags( + symbol, + excludeTypeOnlyValues, + /*excludeLocalMeanings*/ + true + ) & 111551 /* Value */) && (shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target)); } function isConstEnumOrConstEnumOnlyModule(s) { return isConstEnumSymbol(s) || !!s.constEnumOnlyModule; @@ -83321,7 +83896,7 @@ ${lanes.join("\n")} return true; } const target = getSymbolLinks(symbol).aliasTarget; - if (target && getEffectiveModifierFlags(node) & 1 /* Export */ && getAllSymbolFlags(target) & 111551 /* Value */ && (shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) { + if (target && getEffectiveModifierFlags(node) & 1 /* Export */ && getSymbolFlags(target) & 111551 /* Value */ && (shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) { return true; } } @@ -83383,15 +83958,15 @@ ${lanes.join("\n")} } function canHaveConstantValue(node) { switch (node.kind) { - case 305 /* EnumMember */: - case 210 /* PropertyAccessExpression */: - case 211 /* ElementAccessExpression */: + case 306 /* EnumMember */: + case 211 /* PropertyAccessExpression */: + case 212 /* ElementAccessExpression */: return true; } return false; } function getConstantValue2(node) { - if (node.kind === 305 /* EnumMember */) { + if (node.kind === 306 /* EnumMember */) { return getEnumMemberValue(node); } const symbol = getNodeLinks(node).resolvedSymbol; @@ -83591,24 +84166,24 @@ ${lanes.join("\n")} if (symbol) { return filter(getExportSymbolOfValueSymbolIfExported(symbol).declarations, (declaration) => { switch (declaration.kind) { - case 259 /* VariableDeclaration */: - case 168 /* Parameter */: - case 207 /* BindingElement */: - case 171 /* PropertyDeclaration */: - case 302 /* PropertyAssignment */: - case 303 /* ShorthandPropertyAssignment */: - case 305 /* EnumMember */: - case 209 /* ObjectLiteralExpression */: - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: - case 265 /* EnumDeclaration */: - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 266 /* ModuleDeclaration */: + case 260 /* VariableDeclaration */: + case 169 /* Parameter */: + case 208 /* BindingElement */: + case 172 /* PropertyDeclaration */: + case 303 /* PropertyAssignment */: + case 304 /* ShorthandPropertyAssignment */: + case 306 /* EnumMember */: + case 210 /* ObjectLiteralExpression */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: + case 266 /* EnumDeclaration */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 267 /* ModuleDeclaration */: return true; } return false; @@ -83619,7 +84194,7 @@ ${lanes.join("\n")} return void 0; } function isLiteralConstDeclaration(node) { - if (isDeclarationReadonly(node) || isVariableDeclaration(node) && isVarConst(node)) { + if (isDeclarationReadonly(node) || isVariableDeclaration(node) && isVarConstLike(node)) { return isFreshLiteralType(getTypeOfSymbol(getSymbolOfDeclaration(node))); } return false; @@ -83737,12 +84312,12 @@ ${lanes.join("\n")} getJsxFragmentFactoryEntity, getAllAccessorDeclarations(accessor) { accessor = getParseTreeNode(accessor, isGetOrSetAccessorDeclaration); - const otherKind = accessor.kind === 177 /* SetAccessor */ ? 176 /* GetAccessor */ : 177 /* SetAccessor */; + const otherKind = accessor.kind === 178 /* SetAccessor */ ? 177 /* GetAccessor */ : 178 /* SetAccessor */; const otherAccessor = getDeclarationOfKind(getSymbolOfDeclaration(accessor), otherKind); const firstAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? otherAccessor : accessor; const secondAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? accessor : otherAccessor; - const setAccessor = accessor.kind === 177 /* SetAccessor */ ? accessor : otherAccessor; - const getAccessor = accessor.kind === 176 /* GetAccessor */ ? accessor : otherAccessor; + const setAccessor = accessor.kind === 178 /* SetAccessor */ ? accessor : otherAccessor; + const getAccessor = accessor.kind === 177 /* GetAccessor */ ? accessor : otherAccessor; return { firstAccessor, secondAccessor, @@ -83763,7 +84338,7 @@ ${lanes.join("\n")} }, getDeclarationStatementsForSourceFile: (node, flags, tracker, bundled) => { const n = getParseTreeNode(node); - Debug.assert(n && n.kind === 311 /* SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile"); + Debug.assert(n && n.kind === 312 /* SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile"); const sym = getSymbolOfDeclaration(node); if (!sym) { return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker, bundled); @@ -83798,18 +84373,18 @@ ${lanes.join("\n")} return false; } function isInHeritageClause(node) { - return node.parent && node.parent.kind === 232 /* ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 297 /* HeritageClause */; + return node.parent && node.parent.kind === 233 /* ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 298 /* HeritageClause */; } function getTypeReferenceDirectivesForEntityName(node) { if (!fileToDirective) { return void 0; } let meaning; - if (node.parent.kind === 166 /* ComputedPropertyName */) { + if (node.parent.kind === 167 /* ComputedPropertyName */) { meaning = 111551 /* Value */ | 1048576 /* ExportValue */; } else { meaning = 788968 /* Type */ | 1920 /* Namespace */; - if (node.kind === 80 /* Identifier */ && isInTypeQuery(node) || node.kind === 210 /* PropertyAccessExpression */ && !isInHeritageClause(node)) { + if (node.kind === 80 /* Identifier */ && isInTypeQuery(node) || node.kind === 211 /* PropertyAccessExpression */ && !isInHeritageClause(node)) { meaning = 111551 /* Value */ | 1048576 /* ExportValue */; } } @@ -83852,7 +84427,7 @@ ${lanes.join("\n")} break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 311 /* SourceFile */ && current.flags & 512 /* ValueModule */) { + if (current.valueDeclaration && current.valueDeclaration.kind === 312 /* SourceFile */ && current.flags & 512 /* ValueModule */) { return false; } for (const decl of symbol.declarations) { @@ -83877,7 +84452,7 @@ ${lanes.join("\n")} } } function getExternalModuleFileFromDeclaration(declaration) { - const specifier = declaration.kind === 266 /* ModuleDeclaration */ ? tryCast(declaration.name, isStringLiteral) : getExternalModuleName(declaration); + const specifier = declaration.kind === 267 /* ModuleDeclaration */ ? tryCast(declaration.name, isStringLiteral) : getExternalModuleName(declaration); const moduleSymbol = resolveExternalModuleNameWorker( specifier, specifier, @@ -83887,7 +84462,7 @@ ${lanes.join("\n")} if (!moduleSymbol) { return void 0; } - return getDeclarationOfKind(moduleSymbol, 311 /* SourceFile */); + return getDeclarationOfKind(moduleSymbol, 312 /* SourceFile */); } function initializeTypeChecker() { for (const file of host.getSourceFiles()) { @@ -84069,11 +84644,11 @@ ${lanes.join("\n")} function checkExternalEmitHelpers(location, helpers) { if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) { const sourceFile = getSourceFileOfNode(location); - if (isEffectiveExternalModule(sourceFile, compilerOptions) && !(location.flags & 16777216 /* Ambient */)) { + if (isEffectiveExternalModule(sourceFile, compilerOptions) && !(location.flags & 33554432 /* Ambient */)) { const helpersModule = resolveHelpersModule(sourceFile, location); if (helpersModule !== unknownSymbol) { const uncheckedHelpers = helpers & ~requestedExternalEmitHelpers; - for (let helper = 1 /* FirstEmitHelper */; helper <= 16777216 /* LastEmitHelper */; helper <<= 1) { + for (let helper = 1 /* FirstEmitHelper */; helper <= 33554432 /* LastEmitHelper */; helper <<= 1) { if (uncheckedHelpers & helper) { for (const name of getHelperNames(helper)) { if (requestedExternalEmitHelperNames.has(name)) @@ -84081,18 +84656,18 @@ ${lanes.join("\n")} requestedExternalEmitHelperNames.add(name); const symbol = resolveSymbol(getSymbol2(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */)); if (!symbol) { - error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name); + error2(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name); } else if (helper & 524288 /* ClassPrivateFieldGet */) { if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 3)) { - error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 4); + error2(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 4); } } else if (helper & 1048576 /* ClassPrivateFieldSet */) { if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 4)) { - error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 5); + error2(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 5); } } else if (helper & 1024 /* SpreadArray */) { if (!some(getSignaturesOfSymbol(symbol), (signature) => getParameterCount(signature) > 2)) { - error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 3); + error2(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 3); } } } @@ -84155,6 +84730,8 @@ ${lanes.join("\n")} return ["__setFunctionName"]; case 16777216 /* PropKey */: return ["__propKey"]; + case 33554432 /* AddDisposableResourceAndDisposeResources */: + return ["__addDisposableResource", "__disposeResources"]; default: return Debug.fail("Unrecognized helper"); } @@ -84173,6 +84750,7 @@ ${lanes.join("\n")} if (isParameter(node) && parameterIsThisKeyword(node)) { return grammarErrorOnFirstToken(node, Diagnostics.Neither_decorators_nor_modifiers_may_be_applied_to_this_parameters); } + const blockScopeKind = isVariableStatement(node) ? node.declarationList.flags & 7 /* BlockScoped */ : 0 /* None */; let lastStatic, lastDeclare, lastAsync, lastOverride, firstDecorator; let flags = 0 /* None */; let sawExportBeforeDecorators = false; @@ -84180,12 +84758,12 @@ ${lanes.join("\n")} for (const modifier of node.modifiers) { if (isDecorator(modifier)) { if (!nodeCanBeDecorated(legacyDecorators, node, node.parent, node.parent.parent)) { - if (node.kind === 173 /* MethodDeclaration */ && !nodeIsPresent(node.body)) { + if (node.kind === 174 /* MethodDeclaration */ && !nodeIsPresent(node.body)) { return grammarErrorOnFirstToken(node, Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); } else { return grammarErrorOnFirstToken(node, Diagnostics.Decorators_are_not_valid_here); } - } else if (legacyDecorators && (node.kind === 176 /* GetAccessor */ || node.kind === 177 /* SetAccessor */)) { + } else if (legacyDecorators && (node.kind === 177 /* GetAccessor */ || node.kind === 178 /* SetAccessor */)) { const accessors = getAllAccessorDeclarations(node.parent.members, node); if (hasDecorators(accessors.firstAccessor) && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -84199,7 +84777,7 @@ ${lanes.join("\n")} const sourceFile = getSourceFileOfNode(modifier); if (!hasParseDiagnostics(sourceFile)) { addRelatedInfo( - error(modifier, Diagnostics.Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export), + error2(modifier, Diagnostics.Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export), createDiagnosticForNode(firstDecorator, Diagnostics.Decorator_used_before_export_here) ); return true; @@ -84215,29 +84793,29 @@ ${lanes.join("\n")} firstDecorator ?? (firstDecorator = modifier); } else { if (modifier.kind !== 148 /* ReadonlyKeyword */) { - if (node.kind === 170 /* PropertySignature */ || node.kind === 172 /* MethodSignature */) { + if (node.kind === 171 /* PropertySignature */ || node.kind === 173 /* MethodSignature */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_type_member, tokenToString(modifier.kind)); } - if (node.kind === 180 /* IndexSignature */ && (modifier.kind !== 126 /* StaticKeyword */ || !isClassLike(node.parent))) { + if (node.kind === 181 /* IndexSignature */ && (modifier.kind !== 126 /* StaticKeyword */ || !isClassLike(node.parent))) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_an_index_signature, tokenToString(modifier.kind)); } } if (modifier.kind !== 103 /* InKeyword */ && modifier.kind !== 147 /* OutKeyword */ && modifier.kind !== 87 /* ConstKeyword */) { - if (node.kind === 167 /* TypeParameter */) { + if (node.kind === 168 /* TypeParameter */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_type_parameter, tokenToString(modifier.kind)); } } switch (modifier.kind) { case 87 /* ConstKeyword */: - if (node.kind !== 265 /* EnumDeclaration */ && node.kind !== 167 /* TypeParameter */) { + if (node.kind !== 266 /* EnumDeclaration */ && node.kind !== 168 /* TypeParameter */) { return grammarErrorOnNode(node, Diagnostics.A_class_member_cannot_have_the_0_keyword, tokenToString(87 /* ConstKeyword */)); } const parent2 = node.parent; - if (node.kind === 167 /* TypeParameter */ && !(isFunctionLikeDeclaration(parent2) || isClassLike(parent2) || isFunctionTypeNode(parent2) || isConstructorTypeNode(parent2) || isCallSignatureDeclaration(parent2) || isConstructSignatureDeclaration(parent2) || isMethodSignature(parent2))) { + if (node.kind === 168 /* TypeParameter */ && !(isFunctionLikeDeclaration(parent2) || isClassLike(parent2) || isFunctionTypeNode(parent2) || isConstructorTypeNode(parent2) || isCallSignatureDeclaration(parent2) || isConstructSignatureDeclaration(parent2) || isMethodSignature(parent2))) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_function_method_or_class, tokenToString(modifier.kind)); } break; - case 163 /* OverrideKeyword */: + case 164 /* OverrideKeyword */: if (flags & 16384 /* Override */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "override"); } else if (flags & 2 /* Ambient */) { @@ -84268,7 +84846,7 @@ ${lanes.join("\n")} return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly"); } else if (flags & 512 /* Async */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); - } else if (node.parent.kind === 267 /* ModuleBlock */ || node.parent.kind === 311 /* SourceFile */) { + } else if (node.parent.kind === 268 /* ModuleBlock */ || node.parent.kind === 312 /* SourceFile */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 256 /* Abstract */) { if (modifier.kind === 123 /* PrivateKeyword */) { @@ -84290,9 +84868,9 @@ ${lanes.join("\n")} return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } else if (flags & 128 /* Accessor */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "accessor"); - } else if (node.parent.kind === 267 /* ModuleBlock */ || node.parent.kind === 311 /* SourceFile */) { + } else if (node.parent.kind === 268 /* ModuleBlock */ || node.parent.kind === 312 /* SourceFile */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); - } else if (node.kind === 168 /* Parameter */) { + } else if (node.kind === 169 /* Parameter */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 256 /* Abstract */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); @@ -84309,7 +84887,7 @@ ${lanes.join("\n")} return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "readonly"); } else if (flags & 2 /* Ambient */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "declare"); - } else if (node.kind !== 171 /* PropertyDeclaration */) { + } else if (node.kind !== 172 /* PropertyDeclaration */) { return grammarErrorOnNode(modifier, Diagnostics.accessor_modifier_can_only_appear_on_a_property_declaration); } flags |= 128 /* Accessor */; @@ -84317,7 +84895,7 @@ ${lanes.join("\n")} case 148 /* ReadonlyKeyword */: if (flags & 64 /* Readonly */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "readonly"); - } else if (node.kind !== 171 /* PropertyDeclaration */ && node.kind !== 170 /* PropertySignature */ && node.kind !== 180 /* IndexSignature */ && node.kind !== 168 /* Parameter */) { + } else if (node.kind !== 172 /* PropertyDeclaration */ && node.kind !== 171 /* PropertySignature */ && node.kind !== 181 /* IndexSignature */ && node.kind !== 169 /* Parameter */) { return grammarErrorOnNode(modifier, Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } else if (flags & 128 /* Accessor */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "readonly", "accessor"); @@ -84325,8 +84903,8 @@ ${lanes.join("\n")} flags |= 64 /* Readonly */; break; case 95 /* ExportKeyword */: - if (compilerOptions.verbatimModuleSyntax && !(node.flags & 16777216 /* Ambient */) && node.kind !== 264 /* TypeAliasDeclaration */ && node.kind !== 263 /* InterfaceDeclaration */ && // ModuleDeclaration needs to be checked that it is uninstantiated later - node.kind !== 266 /* ModuleDeclaration */ && node.parent.kind === 311 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) { + if (compilerOptions.verbatimModuleSyntax && !(node.flags & 33554432 /* Ambient */) && node.kind !== 265 /* TypeAliasDeclaration */ && node.kind !== 264 /* InterfaceDeclaration */ && // ModuleDeclaration needs to be checked that it is uninstantiated later + node.kind !== 267 /* ModuleDeclaration */ && node.parent.kind === 312 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) { return grammarErrorOnNode(modifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled); } if (flags & 1 /* Export */) { @@ -84339,15 +84917,23 @@ ${lanes.join("\n")} return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } else if (isClassLike(node.parent)) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "export"); - } else if (node.kind === 168 /* Parameter */) { + } else if (node.kind === 169 /* Parameter */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); + } else if (blockScopeKind === 4 /* Using */) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_using_declaration, "export"); + } else if (blockScopeKind === 6 /* AwaitUsing */) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_an_await_using_declaration, "export"); } flags |= 1 /* Export */; break; case 90 /* DefaultKeyword */: - const container = node.parent.kind === 311 /* SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 266 /* ModuleDeclaration */ && !isAmbientModule(container)) { + const container = node.parent.kind === 312 /* SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 267 /* ModuleDeclaration */ && !isAmbientModule(container)) { return grammarErrorOnNode(modifier, Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); + } else if (blockScopeKind === 4 /* Using */) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_using_declaration, "default"); + } else if (blockScopeKind === 6 /* AwaitUsing */) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_an_await_using_declaration, "default"); } else if (!(flags & 1 /* Export */)) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "export", "default"); } else if (sawExportBeforeDecorators) { @@ -84364,9 +84950,13 @@ ${lanes.join("\n")} return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "override"); } else if (isClassLike(node.parent) && !isPropertyDeclaration(node)) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "declare"); - } else if (node.kind === 168 /* Parameter */) { + } else if (node.kind === 169 /* Parameter */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); - } else if (node.parent.flags & 16777216 /* Ambient */ && node.parent.kind === 267 /* ModuleBlock */) { + } else if (blockScopeKind === 4 /* Using */) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_using_declaration, "declare"); + } else if (blockScopeKind === 6 /* AwaitUsing */) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_an_await_using_declaration, "declare"); + } else if (node.parent.flags & 33554432 /* Ambient */ && node.parent.kind === 268 /* ModuleBlock */) { return grammarErrorOnNode(modifier, Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } else if (isPrivateIdentifierClassElementDeclaration(node)) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "declare"); @@ -84380,12 +84970,12 @@ ${lanes.join("\n")} if (flags & 256 /* Abstract */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 262 /* ClassDeclaration */ && node.kind !== 184 /* ConstructorType */) { - if (node.kind !== 173 /* MethodDeclaration */ && node.kind !== 171 /* PropertyDeclaration */ && node.kind !== 176 /* GetAccessor */ && node.kind !== 177 /* SetAccessor */) { + if (node.kind !== 263 /* ClassDeclaration */ && node.kind !== 185 /* ConstructorType */) { + if (node.kind !== 174 /* MethodDeclaration */ && node.kind !== 172 /* PropertyDeclaration */ && node.kind !== 177 /* GetAccessor */ && node.kind !== 178 /* SetAccessor */) { return grammarErrorOnNode(modifier, Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 262 /* ClassDeclaration */ && hasSyntacticModifier(node.parent, 256 /* Abstract */))) { - const message = node.kind === 171 /* PropertyDeclaration */ ? Diagnostics.Abstract_properties_can_only_appear_within_an_abstract_class : Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class; + if (!(node.parent.kind === 263 /* ClassDeclaration */ && hasSyntacticModifier(node.parent, 256 /* Abstract */))) { + const message = node.kind === 172 /* PropertyDeclaration */ ? Diagnostics.Abstract_properties_can_only_appear_within_an_abstract_class : Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class; return grammarErrorOnNode(modifier, message); } if (flags & 32 /* Static */) { @@ -84412,9 +85002,9 @@ ${lanes.join("\n")} case 134 /* AsyncKeyword */: if (flags & 512 /* Async */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "async"); - } else if (flags & 2 /* Ambient */ || node.parent.flags & 16777216 /* Ambient */) { + } else if (flags & 2 /* Ambient */ || node.parent.flags & 33554432 /* Ambient */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); - } else if (node.kind === 168 /* Parameter */) { + } else if (node.kind === 169 /* Parameter */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } if (flags & 256 /* Abstract */) { @@ -84427,7 +85017,7 @@ ${lanes.join("\n")} case 147 /* OutKeyword */: const inOutFlag = modifier.kind === 103 /* InKeyword */ ? 32768 /* In */ : 65536 /* Out */; const inOutText = modifier.kind === 103 /* InKeyword */ ? "in" : "out"; - if (node.kind !== 167 /* TypeParameter */ || !(isInterfaceDeclaration(node.parent) || isClassLike(node.parent) || isTypeAliasDeclaration(node.parent))) { + if (node.kind !== 168 /* TypeParameter */ || !(isInterfaceDeclaration(node.parent) || isClassLike(node.parent) || isTypeAliasDeclaration(node.parent))) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText); } if (flags & inOutFlag) { @@ -84441,7 +85031,7 @@ ${lanes.join("\n")} } } } - if (node.kind === 175 /* Constructor */) { + if (node.kind === 176 /* Constructor */) { if (flags & 32 /* Static */) { return grammarErrorOnNode(lastStatic, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -84452,11 +85042,11 @@ ${lanes.join("\n")} return grammarErrorOnNode(lastAsync, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async"); } return false; - } else if ((node.kind === 271 /* ImportDeclaration */ || node.kind === 270 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { + } else if ((node.kind === 272 /* ImportDeclaration */ || node.kind === 271 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { return grammarErrorOnNode(lastDeclare, Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); - } else if (node.kind === 168 /* Parameter */ && flags & 16476 /* ParameterPropertyModifier */ && isBindingPattern(node.name)) { + } else if (node.kind === 169 /* Parameter */ && flags & 16476 /* ParameterPropertyModifier */ && isBindingPattern(node.name)) { return grammarErrorOnNode(node, Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern); - } else if (node.kind === 168 /* Parameter */ && flags & 16476 /* ParameterPropertyModifier */ && node.dotDotDotToken) { + } else if (node.kind === 169 /* Parameter */ && flags & 16476 /* ParameterPropertyModifier */ && node.dotDotDotToken) { return grammarErrorOnNode(node, Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter); } if (flags & 512 /* Async */) { @@ -84476,46 +85066,47 @@ ${lanes.join("\n")} } function findFirstIllegalModifier(node) { switch (node.kind) { - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 175 /* Constructor */: - case 171 /* PropertyDeclaration */: - case 170 /* PropertySignature */: - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: - case 180 /* IndexSignature */: - case 266 /* ModuleDeclaration */: - case 271 /* ImportDeclaration */: - case 270 /* ImportEqualsDeclaration */: - case 277 /* ExportDeclaration */: - case 276 /* ExportAssignment */: - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: - case 168 /* Parameter */: - case 167 /* TypeParameter */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 176 /* Constructor */: + case 172 /* PropertyDeclaration */: + case 171 /* PropertySignature */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: + case 181 /* IndexSignature */: + case 267 /* ModuleDeclaration */: + case 272 /* ImportDeclaration */: + case 271 /* ImportEqualsDeclaration */: + case 278 /* ExportDeclaration */: + case 277 /* ExportAssignment */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: + case 169 /* Parameter */: + case 168 /* TypeParameter */: return void 0; - case 174 /* ClassStaticBlockDeclaration */: - case 302 /* PropertyAssignment */: - case 303 /* ShorthandPropertyAssignment */: - case 269 /* NamespaceExportDeclaration */: - case 281 /* MissingDeclaration */: + case 175 /* ClassStaticBlockDeclaration */: + case 303 /* PropertyAssignment */: + case 304 /* ShorthandPropertyAssignment */: + case 270 /* NamespaceExportDeclaration */: + case 282 /* MissingDeclaration */: return find(node.modifiers, isModifier); default: - if (node.parent.kind === 267 /* ModuleBlock */ || node.parent.kind === 311 /* SourceFile */) { + if (node.parent.kind === 268 /* ModuleBlock */ || node.parent.kind === 312 /* SourceFile */) { return void 0; } switch (node.kind) { - case 261 /* FunctionDeclaration */: + case 262 /* FunctionDeclaration */: return findFirstModifierExcept(node, 134 /* AsyncKeyword */); - case 262 /* ClassDeclaration */: - case 184 /* ConstructorType */: + case 263 /* ClassDeclaration */: + case 185 /* ConstructorType */: return findFirstModifierExcept(node, 128 /* AbstractKeyword */); - case 230 /* ClassExpression */: - case 263 /* InterfaceDeclaration */: - case 242 /* VariableStatement */: - case 264 /* TypeAliasDeclaration */: + case 231 /* ClassExpression */: + case 264 /* InterfaceDeclaration */: + case 265 /* TypeAliasDeclaration */: return find(node.modifiers, isModifier); - case 265 /* EnumDeclaration */: + case 243 /* VariableStatement */: + return node.declarationList.flags & 4 /* Using */ ? findFirstModifierExcept(node, 135 /* AwaitKeyword */) : find(node.modifiers, isModifier); + case 266 /* EnumDeclaration */: return findFirstModifierExcept(node, 87 /* ConstKeyword */); default: Debug.assertNever(node); @@ -84531,10 +85122,10 @@ ${lanes.join("\n")} } function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { - case 173 /* MethodDeclaration */: - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: + case 174 /* MethodDeclaration */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: return false; } return grammarErrorOnNode(asyncModifier, Diagnostics._0_modifier_cannot_be_used_here, "async"); @@ -84562,7 +85153,7 @@ ${lanes.join("\n")} if (i !== parameterCount - 1) { return grammarErrorOnNode(parameter.dotDotDotToken, Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list); } - if (!(parameter.flags & 16777216 /* Ambient */)) { + if (!(parameter.flags & 33554432 /* Ambient */)) { checkGrammarForDisallowedTrailingComma(parameters, Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); } if (parameter.questionToken) { @@ -84592,12 +85183,12 @@ ${lanes.join("\n")} if (length(nonSimpleParameters)) { forEach(nonSimpleParameters, (parameter) => { addRelatedInfo( - error(parameter, Diagnostics.This_parameter_is_not_allowed_with_use_strict_directive), + error2(parameter, Diagnostics.This_parameter_is_not_allowed_with_use_strict_directive), createDiagnosticForNode(useStrictDirective, Diagnostics.use_strict_directive_used_here) ); }); const diagnostics2 = nonSimpleParameters.map((parameter, index) => index === 0 ? createDiagnosticForNode(parameter, Diagnostics.Non_simple_parameter_declared_here) : createDiagnosticForNode(parameter, Diagnostics.and_here)); - addRelatedInfo(error(useStrictDirective, Diagnostics.use_strict_directive_cannot_be_used_with_non_simple_parameter_list), ...diagnostics2); + addRelatedInfo(error2(useStrictDirective, Diagnostics.use_strict_directive_cannot_be_used_with_non_simple_parameter_list), ...diagnostics2); return true; } } @@ -84679,7 +85270,7 @@ ${lanes.join("\n")} return checkGrammarForDisallowedTrailingComma(typeArguments) || checkGrammarForAtLeastOneTypeArgument(node, typeArguments); } function checkGrammarTaggedTemplateChain(node) { - if (node.questionDotToken || node.flags & 32 /* OptionalChain */) { + if (node.questionDotToken || node.flags & 64 /* OptionalChain */) { return grammarErrorOnNode(node.template, Diagnostics.Tagged_template_expressions_are_not_permitted_in_an_optional_chain); } return false; @@ -84747,11 +85338,11 @@ ${lanes.join("\n")} return false; } function checkGrammarComputedPropertyName(node) { - if (node.kind !== 166 /* ComputedPropertyName */) { + if (node.kind !== 167 /* ComputedPropertyName */) { return false; } const computedPropertyName = node; - if (computedPropertyName.expression.kind === 225 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 28 /* CommaToken */) { + if (computedPropertyName.expression.kind === 226 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 28 /* CommaToken */) { return grammarErrorOnNode(computedPropertyName.expression, Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } return false; @@ -84759,9 +85350,9 @@ ${lanes.join("\n")} function checkGrammarForGenerator(node) { if (node.asteriskToken) { Debug.assert( - node.kind === 261 /* FunctionDeclaration */ || node.kind === 217 /* FunctionExpression */ || node.kind === 173 /* MethodDeclaration */ + node.kind === 262 /* FunctionDeclaration */ || node.kind === 218 /* FunctionExpression */ || node.kind === 174 /* MethodDeclaration */ ); - if (node.flags & 16777216 /* Ambient */) { + if (node.flags & 33554432 /* Ambient */) { return grammarErrorOnNode(node.asteriskToken, Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } if (!node.body) { @@ -84778,7 +85369,7 @@ ${lanes.join("\n")} function checkGrammarObjectLiteralExpression(node, inDestructuring) { const seen = /* @__PURE__ */ new Map(); for (const prop of node.properties) { - if (prop.kind === 304 /* SpreadAssignment */) { + if (prop.kind === 305 /* SpreadAssignment */) { if (inDestructuring) { const expression = skipParentheses(prop.expression); if (isArrayLiteralExpression(expression) || isObjectLiteralExpression(expression)) { @@ -84788,10 +85379,10 @@ ${lanes.join("\n")} continue; } const name = prop.name; - if (name.kind === 166 /* ComputedPropertyName */) { + if (name.kind === 167 /* ComputedPropertyName */) { checkGrammarComputedPropertyName(name); } - if (prop.kind === 303 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 304 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { grammarErrorOnNode(prop.equalsToken, Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern); } if (name.kind === 81 /* PrivateIdentifier */) { @@ -84799,7 +85390,7 @@ ${lanes.join("\n")} } if (canHaveModifiers(prop) && prop.modifiers) { for (const mod of prop.modifiers) { - if (isModifier(mod) && (mod.kind !== 134 /* AsyncKeyword */ || prop.kind !== 173 /* MethodDeclaration */)) { + if (isModifier(mod) && (mod.kind !== 134 /* AsyncKeyword */ || prop.kind !== 174 /* MethodDeclaration */)) { grammarErrorOnNode(mod, Diagnostics._0_modifier_cannot_be_used_here, getTextOfNode(mod)); } } @@ -84812,8 +85403,8 @@ ${lanes.join("\n")} } let currentKind; switch (prop.kind) { - case 303 /* ShorthandPropertyAssignment */: - case 302 /* PropertyAssignment */: + case 304 /* ShorthandPropertyAssignment */: + case 303 /* PropertyAssignment */: checkGrammarForInvalidExclamationToken(prop.exclamationToken, Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context); checkGrammarForInvalidQuestionMark(prop.questionToken, Diagnostics.An_object_member_cannot_be_declared_optional); if (name.kind === 9 /* NumericLiteral */) { @@ -84821,13 +85412,13 @@ ${lanes.join("\n")} } currentKind = 4 /* PropertyAssignment */; break; - case 173 /* MethodDeclaration */: + case 174 /* MethodDeclaration */: currentKind = 8 /* Method */; break; - case 176 /* GetAccessor */: + case 177 /* GetAccessor */: currentKind = 1 /* GetAccessor */; break; - case 177 /* SetAccessor */: + case 178 /* SetAccessor */: currentKind = 2 /* SetAccessor */; break; default: @@ -84864,7 +85455,7 @@ ${lanes.join("\n")} checkGrammarTypeArguments(node, node.typeArguments); const seen = /* @__PURE__ */ new Map(); for (const attr of node.attributes.properties) { - if (attr.kind === 292 /* JsxSpreadAttribute */) { + if (attr.kind === 293 /* JsxSpreadAttribute */) { continue; } const { name, initializer } = attr; @@ -84874,7 +85465,7 @@ ${lanes.join("\n")} } else { return grammarErrorOnNode(name, Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } - if (initializer && initializer.kind === 293 /* JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 294 /* JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(initializer, Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -84896,8 +85487,8 @@ ${lanes.join("\n")} if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.kind === 249 /* ForOfStatement */ && forInOrOfStatement.awaitModifier) { - if (!(forInOrOfStatement.flags & 32768 /* AwaitContext */)) { + if (forInOrOfStatement.kind === 250 /* ForOfStatement */ && forInOrOfStatement.awaitModifier) { + if (!(forInOrOfStatement.flags & 65536 /* AwaitContext */)) { const sourceFile = getSourceFileOfNode(forInOrOfStatement); if (isInTopLevelContext(forInOrOfStatement)) { if (!hasParseDiagnostics(sourceFile)) { @@ -84936,7 +85527,7 @@ ${lanes.join("\n")} if (!hasParseDiagnostics(sourceFile)) { const diagnostic = createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); const func = getContainingFunction(forInOrOfStatement); - if (func && func.kind !== 175 /* Constructor */) { + if (func && func.kind !== 176 /* Constructor */) { Debug.assert((getFunctionFlags(func) & 2 /* Async */) === 0, "Enclosing function should never be an async function."); const relatedInfo = createDiagnosticForNode(func, Diagnostics.Did_you_mean_to_mark_this_function_as_async); addRelatedInfo(diagnostic, relatedInfo); @@ -84948,11 +85539,11 @@ ${lanes.join("\n")} return false; } } - if (isForOfStatement(forInOrOfStatement) && !(forInOrOfStatement.flags & 32768 /* AwaitContext */) && isIdentifier(forInOrOfStatement.initializer) && forInOrOfStatement.initializer.escapedText === "async") { + if (isForOfStatement(forInOrOfStatement) && !(forInOrOfStatement.flags & 65536 /* AwaitContext */) && isIdentifier(forInOrOfStatement.initializer) && forInOrOfStatement.initializer.escapedText === "async") { grammarErrorOnNode(forInOrOfStatement.initializer, Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async); return false; } - if (forInOrOfStatement.initializer.kind === 260 /* VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 261 /* VariableDeclarationList */) { const variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { const declarations = variableList.declarations; @@ -84960,16 +85551,16 @@ ${lanes.join("\n")} return false; } if (declarations.length > 1) { - const diagnostic = forInOrOfStatement.kind === 248 /* ForInStatement */ ? Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; + const diagnostic = forInOrOfStatement.kind === 249 /* ForInStatement */ ? Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } const firstDeclaration = declarations[0]; if (firstDeclaration.initializer) { - const diagnostic = forInOrOfStatement.kind === 248 /* ForInStatement */ ? Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; + const diagnostic = forInOrOfStatement.kind === 249 /* ForInStatement */ ? Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - const diagnostic = forInOrOfStatement.kind === 248 /* ForInStatement */ ? Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; + const diagnostic = forInOrOfStatement.kind === 249 /* ForInStatement */ ? Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); } } @@ -84977,7 +85568,7 @@ ${lanes.join("\n")} return false; } function checkGrammarAccessor(accessor) { - if (!(accessor.flags & 16777216 /* Ambient */) && accessor.parent.kind !== 186 /* TypeLiteral */ && accessor.parent.kind !== 263 /* InterfaceDeclaration */) { + if (!(accessor.flags & 33554432 /* Ambient */) && accessor.parent.kind !== 187 /* TypeLiteral */ && accessor.parent.kind !== 264 /* InterfaceDeclaration */) { if (languageVersion < 1 /* ES5 */) { return grammarErrorOnNode(accessor.name, Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); } @@ -84992,7 +85583,7 @@ ${lanes.join("\n")} if (hasSyntacticModifier(accessor, 256 /* Abstract */)) { return grammarErrorOnNode(accessor, Diagnostics.An_abstract_accessor_cannot_have_an_implementation); } - if (accessor.parent.kind === 186 /* TypeLiteral */ || accessor.parent.kind === 263 /* InterfaceDeclaration */) { + if (accessor.parent.kind === 187 /* TypeLiteral */ || accessor.parent.kind === 264 /* InterfaceDeclaration */) { return grammarErrorOnNode(accessor.body, Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } } @@ -85002,10 +85593,10 @@ ${lanes.join("\n")} if (!doesAccessorHaveCorrectParameterCount(accessor)) { return grammarErrorOnNode( accessor.name, - accessor.kind === 176 /* GetAccessor */ ? Diagnostics.A_get_accessor_cannot_have_parameters : Diagnostics.A_set_accessor_must_have_exactly_one_parameter + accessor.kind === 177 /* GetAccessor */ ? Diagnostics.A_get_accessor_cannot_have_parameters : Diagnostics.A_set_accessor_must_have_exactly_one_parameter ); } - if (accessor.kind === 177 /* SetAccessor */) { + if (accessor.kind === 178 /* SetAccessor */) { if (accessor.type) { return grammarErrorOnNode(accessor.name, Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -85023,10 +85614,10 @@ ${lanes.join("\n")} return false; } function doesAccessorHaveCorrectParameterCount(accessor) { - return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 176 /* GetAccessor */ ? 0 : 1); + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 177 /* GetAccessor */ ? 0 : 1); } function getAccessorThisParameter(accessor) { - if (accessor.parameters.length === (accessor.kind === 176 /* GetAccessor */ ? 1 : 2)) { + if (accessor.parameters.length === (accessor.kind === 177 /* GetAccessor */ ? 1 : 2)) { return getThisParameter(accessor); } } @@ -85043,7 +85634,7 @@ ${lanes.join("\n")} } } switch (parent2.kind) { - case 259 /* VariableDeclaration */: + case 260 /* VariableDeclaration */: const decl = parent2; if (decl.name.kind !== 80 /* Identifier */) { return grammarErrorOnNode(node, Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name); @@ -85055,12 +85646,12 @@ ${lanes.join("\n")} return grammarErrorOnNode(parent2.name, Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const); } break; - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: if (!isStatic(parent2) || !hasEffectiveReadonlyModifier(parent2)) { return grammarErrorOnNode(parent2.name, Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly); } break; - case 170 /* PropertySignature */: + case 171 /* PropertySignature */: if (!hasSyntacticModifier(parent2, 64 /* Readonly */)) { return grammarErrorOnNode(parent2.name, Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly); } @@ -85069,7 +85660,7 @@ ${lanes.join("\n")} return grammarErrorOnNode(node, Diagnostics.unique_symbol_types_are_not_allowed_here); } } else if (node.operator === 148 /* ReadonlyKeyword */) { - if (node.type.kind !== 187 /* ArrayType */ && node.type.kind !== 188 /* TupleType */) { + if (node.type.kind !== 188 /* ArrayType */ && node.type.kind !== 189 /* TupleType */) { return grammarErrorOnFirstToken(node, Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, tokenToString(155 /* SymbolKeyword */)); } } @@ -85083,8 +85674,8 @@ ${lanes.join("\n")} if (checkGrammarFunctionLikeDeclaration(node)) { return true; } - if (node.kind === 173 /* MethodDeclaration */) { - if (node.parent.kind === 209 /* ObjectLiteralExpression */) { + if (node.kind === 174 /* MethodDeclaration */) { + if (node.parent.kind === 210 /* ObjectLiteralExpression */) { if (node.modifiers && !(node.modifiers.length === 1 && first(node.modifiers).kind === 134 /* AsyncKeyword */)) { return grammarErrorOnFirstToken(node, Diagnostics.Modifiers_cannot_appear_here); } else if (checkGrammarForInvalidQuestionMark(node.questionToken, Diagnostics.An_object_member_cannot_be_declared_optional)) { @@ -85103,14 +85694,14 @@ ${lanes.join("\n")} if (languageVersion < 2 /* ES2015 */ && isPrivateIdentifier(node.name)) { return grammarErrorOnNode(node.name, Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); } - if (node.flags & 16777216 /* Ambient */) { + if (node.flags & 33554432 /* Ambient */) { return checkGrammarForInvalidDynamicName(node.name, 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 === 173 /* MethodDeclaration */ && !node.body) { + } else if (node.kind === 174 /* MethodDeclaration */ && !node.body) { return checkGrammarForInvalidDynamicName(node.name, 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 === 263 /* InterfaceDeclaration */) { + } else if (node.parent.kind === 264 /* InterfaceDeclaration */) { return checkGrammarForInvalidDynamicName(node.name, 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 === 186 /* TypeLiteral */) { + } else if (node.parent.kind === 187 /* TypeLiteral */) { return checkGrammarForInvalidDynamicName(node.name, 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); } } @@ -85121,9 +85712,9 @@ ${lanes.join("\n")} return grammarErrorOnNode(node, Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 255 /* LabeledStatement */: + case 256 /* LabeledStatement */: if (node.label && current.label.escapedText === node.label.escapedText) { - const isMisplacedContinueLabel = node.kind === 250 /* ContinueStatement */ && !isIterationStatement( + const isMisplacedContinueLabel = node.kind === 251 /* ContinueStatement */ && !isIterationStatement( current.statement, /*lookInLabeledStatements*/ true @@ -85134,8 +85725,8 @@ ${lanes.join("\n")} return false; } break; - case 254 /* SwitchStatement */: - if (node.kind === 251 /* BreakStatement */ && !node.label) { + case 255 /* SwitchStatement */: + if (node.kind === 252 /* BreakStatement */ && !node.label) { return false; } break; @@ -85152,10 +85743,10 @@ ${lanes.join("\n")} current = current.parent; } if (node.label) { - const message = node.kind === 251 /* BreakStatement */ ? Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; + const message = node.kind === 252 /* BreakStatement */ ? Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - const message = node.kind === 251 /* BreakStatement */ ? Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; + const message = node.kind === 252 /* BreakStatement */ ? Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } } @@ -85175,10 +85766,10 @@ ${lanes.join("\n")} } } function isStringOrNumberLiteralExpression(expr) { - return isStringOrNumericLiteralLike(expr) || expr.kind === 223 /* PrefixUnaryExpression */ && expr.operator === 41 /* MinusToken */ && expr.operand.kind === 9 /* NumericLiteral */; + return isStringOrNumericLiteralLike(expr) || expr.kind === 224 /* PrefixUnaryExpression */ && expr.operator === 41 /* MinusToken */ && expr.operand.kind === 9 /* NumericLiteral */; } function isBigIntLiteralExpression(expr) { - return expr.kind === 10 /* BigIntLiteral */ || expr.kind === 223 /* PrefixUnaryExpression */ && expr.operator === 41 /* MinusToken */ && expr.operand.kind === 10 /* BigIntLiteral */; + return expr.kind === 10 /* BigIntLiteral */ || expr.kind === 224 /* PrefixUnaryExpression */ && expr.operator === 41 /* MinusToken */ && expr.operand.kind === 10 /* BigIntLiteral */; } function isSimpleLiteralEnumReference(expr) { if ((isPropertyAccessExpression(expr) || isElementAccessExpression(expr) && isStringOrNumberLiteralExpression(expr.argumentExpression)) && isEntityNameExpression(expr.expression)) { @@ -85189,7 +85780,7 @@ ${lanes.join("\n")} const initializer = node.initializer; if (initializer) { const isInvalidInitializer = !(isStringOrNumberLiteralExpression(initializer) || isSimpleLiteralEnumReference(initializer) || initializer.kind === 112 /* TrueKeyword */ || initializer.kind === 97 /* FalseKeyword */ || isBigIntLiteralExpression(initializer)); - const isConstOrReadonly = isDeclarationReadonly(node) || isVariableDeclaration(node) && isVarConst(node); + const isConstOrReadonly = isDeclarationReadonly(node) || isVariableDeclaration(node) && isVarConstLike(node); if (isConstOrReadonly && !node.type) { if (isInvalidInitializer) { return grammarErrorOnNode(initializer, Diagnostics.A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_or_literal_enum_reference); @@ -85200,27 +85791,41 @@ ${lanes.join("\n")} } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 248 /* ForInStatement */ && node.parent.parent.kind !== 249 /* ForOfStatement */) { - if (node.flags & 16777216 /* Ambient */) { + const nodeFlags = getCombinedNodeFlagsCached(node); + const blockScopeKind = nodeFlags & 7 /* BlockScoped */; + if (isBindingPattern(node.name)) { + switch (blockScopeKind) { + case 6 /* AwaitUsing */: + return grammarErrorOnNode(node, Diagnostics._0_declarations_may_not_have_binding_patterns, "await using"); + case 4 /* Using */: + return grammarErrorOnNode(node, Diagnostics._0_declarations_may_not_have_binding_patterns, "using"); + } + } + if (node.parent.parent.kind !== 249 /* ForInStatement */ && node.parent.parent.kind !== 250 /* ForOfStatement */) { + if (nodeFlags & 33554432 /* Ambient */) { checkAmbientInitializer(node); } else if (!node.initializer) { if (isBindingPattern(node.name) && !isBindingPattern(node.parent)) { return grammarErrorOnNode(node, Diagnostics.A_destructuring_declaration_must_have_an_initializer); } - if (isVarConst(node)) { - return grammarErrorOnNode(node, Diagnostics.const_declarations_must_be_initialized); + switch (blockScopeKind) { + case 6 /* AwaitUsing */: + return grammarErrorOnNode(node, Diagnostics._0_declarations_must_be_initialized, "await using"); + case 4 /* Using */: + return grammarErrorOnNode(node, Diagnostics._0_declarations_must_be_initialized, "using"); + case 2 /* Const */: + return grammarErrorOnNode(node, Diagnostics._0_declarations_must_be_initialized, "const"); } } } - if (node.exclamationToken && (node.parent.parent.kind !== 242 /* VariableStatement */ || !node.type || node.initializer || node.flags & 16777216 /* Ambient */)) { + if (node.exclamationToken && (node.parent.parent.kind !== 243 /* VariableStatement */ || !node.type || node.initializer || nodeFlags & 33554432 /* Ambient */)) { const message = node.initializer ? Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions : !node.type ? Diagnostics.Declarations_with_definite_assignment_assertions_must_also_have_type_annotations : Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context; return grammarErrorOnNode(node.exclamationToken, message); } - if ((moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */) && moduleKind !== 4 /* System */ && !(node.parent.parent.flags & 16777216 /* Ambient */) && hasSyntacticModifier(node.parent.parent, 1 /* Export */)) { + if ((moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */) && moduleKind !== 4 /* System */ && !(node.parent.parent.flags & 33554432 /* Ambient */) && hasSyntacticModifier(node.parent.parent, 1 /* Export */)) { checkESModuleMarker(node.name); } - const checkLetConstNames = isLet(node) || isVarConst(node); - return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name); + return !!blockScopeKind && checkGrammarNameInLetOrConstDeclarations(node.name); } function checkESModuleMarker(name) { if (name.kind === 80 /* Identifier */) { @@ -85260,29 +85865,39 @@ ${lanes.join("\n")} if (!declarationList.declarations.length) { return grammarErrorAtPos(declarationList, declarations.pos, declarations.end - declarations.pos, Diagnostics.Variable_declaration_list_cannot_be_empty); } + const blockScopeFlags = declarationList.flags & 7 /* BlockScoped */; + if ((blockScopeFlags === 4 /* Using */ || blockScopeFlags === 6 /* AwaitUsing */) && isForInStatement(declarationList.parent)) { + return grammarErrorOnNode( + declarationList, + blockScopeFlags === 4 /* Using */ ? Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_using_declaration : Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_an_await_using_declaration + ); + } + if (blockScopeFlags === 6 /* AwaitUsing */) { + return checkAwaitGrammar(declarationList); + } return false; } function allowLetAndConstDeclarations(parent2) { switch (parent2.kind) { - case 244 /* IfStatement */: - case 245 /* DoStatement */: - case 246 /* WhileStatement */: - case 253 /* WithStatement */: - case 247 /* ForStatement */: - case 248 /* ForInStatement */: - case 249 /* ForOfStatement */: + case 245 /* IfStatement */: + case 246 /* DoStatement */: + case 247 /* WhileStatement */: + case 254 /* WithStatement */: + case 248 /* ForStatement */: + case 249 /* ForInStatement */: + case 250 /* ForOfStatement */: return false; - case 255 /* LabeledStatement */: + case 256 /* LabeledStatement */: return allowLetAndConstDeclarations(parent2.parent); } return true; } - function checkGrammarForDisallowedLetOrConstStatement(node) { + function checkGrammarForDisallowedBlockScopedVariableStatement(node) { if (!allowLetAndConstDeclarations(node.parent)) { - if (isLet(node.declarationList)) { - return grammarErrorOnNode(node, Diagnostics.let_declarations_can_only_be_declared_inside_a_block); - } else if (isVarConst(node.declarationList)) { - return grammarErrorOnNode(node, Diagnostics.const_declarations_can_only_be_declared_inside_a_block); + const blockScopeKind = getCombinedNodeFlagsCached(node.declarationList) & 7 /* BlockScoped */; + if (blockScopeKind) { + const keyword = blockScopeKind === 1 /* Let */ ? "let" : blockScopeKind === 2 /* Const */ ? "const" : blockScopeKind === 4 /* Using */ ? "using" : blockScopeKind === 6 /* AwaitUsing */ ? "await using" : Debug.fail("Unknown BlockScope flag"); + return grammarErrorOnNode(node, Diagnostics._0_declarations_can_only_be_declared_inside_a_block, keyword); } } } @@ -85371,7 +85986,7 @@ ${lanes.join("\n")} if (isAutoAccessorPropertyDeclaration(node) && checkGrammarForInvalidQuestionMark(node.questionToken, Diagnostics.An_accessor_property_cannot_be_declared_optional)) { return true; } - } else if (node.parent.kind === 263 /* InterfaceDeclaration */) { + } else if (node.parent.kind === 264 /* InterfaceDeclaration */) { if (checkGrammarForInvalidDynamicName(node.name, 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; } @@ -85388,23 +86003,23 @@ ${lanes.join("\n")} return grammarErrorOnNode(node.initializer, Diagnostics.A_type_literal_property_cannot_have_an_initializer); } } - if (node.flags & 16777216 /* Ambient */) { + if (node.flags & 33554432 /* Ambient */) { checkAmbientInitializer(node); } - if (isPropertyDeclaration(node) && node.exclamationToken && (!isClassLike(node.parent) || !node.type || node.initializer || node.flags & 16777216 /* Ambient */ || isStatic(node) || hasAbstractModifier(node))) { + if (isPropertyDeclaration(node) && node.exclamationToken && (!isClassLike(node.parent) || !node.type || node.initializer || node.flags & 33554432 /* Ambient */ || isStatic(node) || hasAbstractModifier(node))) { const message = node.initializer ? Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions : !node.type ? Diagnostics.Declarations_with_definite_assignment_assertions_must_also_have_type_annotations : Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context; return grammarErrorOnNode(node.exclamationToken, message); } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 263 /* InterfaceDeclaration */ || node.kind === 264 /* TypeAliasDeclaration */ || node.kind === 271 /* ImportDeclaration */ || node.kind === 270 /* ImportEqualsDeclaration */ || node.kind === 277 /* ExportDeclaration */ || node.kind === 276 /* ExportAssignment */ || node.kind === 269 /* NamespaceExportDeclaration */ || hasSyntacticModifier(node, 2 /* Ambient */ | 1 /* Export */ | 1024 /* Default */)) { + if (node.kind === 264 /* InterfaceDeclaration */ || node.kind === 265 /* TypeAliasDeclaration */ || node.kind === 272 /* ImportDeclaration */ || node.kind === 271 /* ImportEqualsDeclaration */ || node.kind === 278 /* ExportDeclaration */ || node.kind === 277 /* ExportAssignment */ || node.kind === 270 /* NamespaceExportDeclaration */ || hasSyntacticModifier(node, 2 /* Ambient */ | 1 /* Export */ | 1024 /* Default */)) { return false; } return grammarErrorOnFirstToken(node, Diagnostics.Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier); } function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (const decl of file.statements) { - if (isDeclaration(decl) || decl.kind === 242 /* VariableStatement */) { + if (isDeclaration(decl) || decl.kind === 243 /* VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -85413,15 +86028,15 @@ ${lanes.join("\n")} return false; } function checkGrammarSourceFile(node) { - return !!(node.flags & 16777216 /* Ambient */) && checkGrammarTopLevelElementsForRequiredDeclareModifier(node); + return !!(node.flags & 33554432 /* Ambient */) && checkGrammarTopLevelElementsForRequiredDeclareModifier(node); } function checkGrammarStatementInAmbientContext(node) { - if (node.flags & 16777216 /* Ambient */) { + if (node.flags & 33554432 /* Ambient */) { const links = getNodeLinks(node); if (!links.hasReportedStatementInAmbientContext && (isFunctionLike(node.parent) || isAccessor(node.parent))) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 240 /* Block */ || node.parent.kind === 267 /* ModuleBlock */ || node.parent.kind === 311 /* SourceFile */) { + if (node.parent.kind === 241 /* Block */ || node.parent.kind === 268 /* ModuleBlock */ || node.parent.kind === 312 /* SourceFile */) { const links2 = getNodeLinks(node.parent); if (!links2.hasReportedStatementInAmbientContext) { return links2.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -85490,7 +86105,7 @@ ${lanes.join("\n")} if (node.isTypeOnly && node.name && node.namedBindings) { return grammarErrorOnNode(node, Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both); } - if (node.isTypeOnly && ((_a = node.namedBindings) == null ? void 0 : _a.kind) === 274 /* NamedImports */) { + if (node.isTypeOnly && ((_a = node.namedBindings) == null ? void 0 : _a.kind) === 275 /* NamedImports */) { return checkGrammarNamedImportsOrExports(node.namedBindings); } return false; @@ -85500,7 +86115,7 @@ ${lanes.join("\n")} if (specifier.isTypeOnly) { return grammarErrorOnFirstToken( specifier, - specifier.kind === 275 /* ImportSpecifier */ ? Diagnostics.The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement : Diagnostics.The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement + specifier.kind === 276 /* ImportSpecifier */ ? Diagnostics.The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement : Diagnostics.The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement ); } }); @@ -85614,17 +86229,37 @@ ${lanes.join("\n")} const name = getPropertyNameForPropertyNameNode(node); return name ? name : isComputedPropertyName(node) && isEntityNameExpression(node.expression) ? tryGetNameFromEntityNameExpression(node.expression) : void 0; } + function getCombinedModifierFlagsCached(node) { + if (lastGetCombinedModifierFlagsNode === node) { + return lastGetCombinedModifierFlagsResult; + } + lastGetCombinedModifierFlagsNode = node; + lastGetCombinedModifierFlagsResult = getCombinedModifierFlags(node); + return lastGetCombinedModifierFlagsResult; + } + function getCombinedNodeFlagsCached(node) { + if (lastGetCombinedNodeFlagsNode === node) { + return lastGetCombinedNodeFlagsResult; + } + lastGetCombinedNodeFlagsNode = node; + lastGetCombinedNodeFlagsResult = getCombinedNodeFlags(node); + return lastGetCombinedNodeFlagsResult; + } + function isVarConstLike(node) { + const blockScopeKind = getCombinedNodeFlagsCached(node) & 7 /* BlockScoped */; + return blockScopeKind === 2 /* Const */ || blockScopeKind === 4 /* Using */ || blockScopeKind === 6 /* AwaitUsing */; + } } function isNotAccessor(declaration) { return !isAccessor(declaration); } function isNotOverload(declaration) { - return declaration.kind !== 261 /* FunctionDeclaration */ && declaration.kind !== 173 /* MethodDeclaration */ || !!declaration.body; + return declaration.kind !== 262 /* FunctionDeclaration */ && declaration.kind !== 174 /* MethodDeclaration */ || !!declaration.body; } function isDeclarationNameOrImportPropertyName(name) { switch (name.parent.kind) { - case 275 /* ImportSpecifier */: - case 280 /* ExportSpecifier */: + case 276 /* ImportSpecifier */: + case 281 /* ExportSpecifier */: return isIdentifier(name); default: return isDeclarationName(name); @@ -85775,6 +86410,7 @@ ${lanes.join("\n")} CheckMode3[CheckMode3["IsForSignatureHelp"] = 16] = "IsForSignatureHelp"; CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 32] = "IsForStringLiteralArgumentCompletions"; CheckMode3[CheckMode3["RestBindingElement"] = 64] = "RestBindingElement"; + CheckMode3[CheckMode3["TypeOnly"] = 128] = "TypeOnly"; return CheckMode3; })(CheckMode || {}); SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => { @@ -85808,13 +86444,13 @@ ${lanes.join("\n")} JsxNames2.IntrinsicClassAttributes = "IntrinsicClassAttributes"; JsxNames2.LibraryManagedAttributes = "LibraryManagedAttributes"; })(JsxNames || (JsxNames = {})); - SymbolTrackerImpl = class { + SymbolTrackerImpl = class _SymbolTrackerImpl { constructor(context, tracker, moduleResolverHost) { this.moduleResolverHost = void 0; this.inner = void 0; this.disableTrackSymbol = false; var _a; - while (tracker instanceof SymbolTrackerImpl) { + while (tracker instanceof _SymbolTrackerImpl) { tracker = tracker.inner; } this.inner = tracker; @@ -86183,21 +86819,21 @@ ${lanes.join("\n")} "use strict"; init_ts2(); visitEachChildTable = { - [165 /* QualifiedName */]: function visitEachChildOfQualifiedName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [166 /* QualifiedName */]: function visitEachChildOfQualifiedName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateQualifiedName( node, Debug.checkDefined(nodeVisitor(node.left, visitor, isEntityName)), Debug.checkDefined(nodeVisitor(node.right, visitor, isIdentifier)) ); }, - [166 /* ComputedPropertyName */]: function visitEachChildOfComputedPropertyName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [167 /* ComputedPropertyName */]: function visitEachChildOfComputedPropertyName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateComputedPropertyName( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, // Signature elements - [167 /* TypeParameter */]: function visitEachChildOfTypeParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [168 /* TypeParameter */]: function visitEachChildOfTypeParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateTypeParameterDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifier), @@ -86206,7 +86842,7 @@ ${lanes.join("\n")} nodeVisitor(node.default, visitor, isTypeNode) ); }, - [168 /* Parameter */]: function visitEachChildOfParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + [169 /* Parameter */]: function visitEachChildOfParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updateParameterDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -86217,14 +86853,14 @@ ${lanes.join("\n")} nodeVisitor(node.initializer, visitor, isExpression) ); }, - [169 /* Decorator */]: function visitEachChildOfDecorator(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [170 /* Decorator */]: function visitEachChildOfDecorator(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateDecorator( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, // Type elements - [170 /* PropertySignature */]: function visitEachChildOfPropertySignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + [171 /* PropertySignature */]: function visitEachChildOfPropertySignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updatePropertySignature( node, nodesVisitor(node.modifiers, visitor, isModifier), @@ -86233,7 +86869,7 @@ ${lanes.join("\n")} nodeVisitor(node.type, visitor, isTypeNode) ); }, - [171 /* PropertyDeclaration */]: function visitEachChildOfPropertyDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + [172 /* PropertyDeclaration */]: function visitEachChildOfPropertyDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updatePropertyDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -86244,7 +86880,7 @@ ${lanes.join("\n")} nodeVisitor(node.initializer, visitor, isExpression) ); }, - [172 /* MethodSignature */]: function visitEachChildOfMethodSignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + [173 /* MethodSignature */]: function visitEachChildOfMethodSignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updateMethodSignature( node, nodesVisitor(node.modifiers, visitor, isModifier), @@ -86255,7 +86891,7 @@ ${lanes.join("\n")} nodeVisitor(node.type, visitor, isTypeNode) ); }, - [173 /* MethodDeclaration */]: function visitEachChildOfMethodDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + [174 /* MethodDeclaration */]: function visitEachChildOfMethodDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updateMethodDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -86268,7 +86904,7 @@ ${lanes.join("\n")} visitFunctionBody(node.body, visitor, context, nodeVisitor) ); }, - [175 /* Constructor */]: function visitEachChildOfConstructorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [176 /* Constructor */]: function visitEachChildOfConstructorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateConstructorDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -86276,7 +86912,7 @@ ${lanes.join("\n")} visitFunctionBody(node.body, visitor, context, nodeVisitor) ); }, - [176 /* GetAccessor */]: function visitEachChildOfGetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [177 /* GetAccessor */]: function visitEachChildOfGetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateGetAccessorDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -86286,7 +86922,7 @@ ${lanes.join("\n")} visitFunctionBody(node.body, visitor, context, nodeVisitor) ); }, - [177 /* SetAccessor */]: function visitEachChildOfSetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [178 /* SetAccessor */]: function visitEachChildOfSetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateSetAccessorDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -86295,7 +86931,7 @@ ${lanes.join("\n")} visitFunctionBody(node.body, visitor, context, nodeVisitor) ); }, - [174 /* ClassStaticBlockDeclaration */]: function visitEachChildOfClassStaticBlockDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [175 /* ClassStaticBlockDeclaration */]: function visitEachChildOfClassStaticBlockDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { context.startLexicalEnvironment(); context.suspendLexicalEnvironment(); return context.factory.updateClassStaticBlockDeclaration( @@ -86303,7 +86939,7 @@ ${lanes.join("\n")} visitFunctionBody(node.body, visitor, context, nodeVisitor) ); }, - [178 /* CallSignature */]: function visitEachChildOfCallSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [179 /* CallSignature */]: function visitEachChildOfCallSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateCallSignature( node, nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration), @@ -86311,7 +86947,7 @@ ${lanes.join("\n")} nodeVisitor(node.type, visitor, isTypeNode) ); }, - [179 /* ConstructSignature */]: function visitEachChildOfConstructSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [180 /* ConstructSignature */]: function visitEachChildOfConstructSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateConstructSignature( node, nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration), @@ -86319,7 +86955,7 @@ ${lanes.join("\n")} nodeVisitor(node.type, visitor, isTypeNode) ); }, - [180 /* IndexSignature */]: function visitEachChildOfIndexSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [181 /* IndexSignature */]: function visitEachChildOfIndexSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateIndexSignature( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -86328,7 +86964,7 @@ ${lanes.join("\n")} ); }, // Types - [181 /* TypePredicate */]: function visitEachChildOfTypePredicateNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [182 /* TypePredicate */]: function visitEachChildOfTypePredicateNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateTypePredicateNode( node, nodeVisitor(node.assertsModifier, visitor, isAssertsKeyword), @@ -86336,14 +86972,14 @@ ${lanes.join("\n")} nodeVisitor(node.type, visitor, isTypeNode) ); }, - [182 /* TypeReference */]: function visitEachChildOfTypeReferenceNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [183 /* TypeReference */]: function visitEachChildOfTypeReferenceNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateTypeReferenceNode( node, Debug.checkDefined(nodeVisitor(node.typeName, visitor, isEntityName)), nodesVisitor(node.typeArguments, visitor, isTypeNode) ); }, - [183 /* FunctionType */]: function visitEachChildOfFunctionTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [184 /* FunctionType */]: function visitEachChildOfFunctionTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateFunctionTypeNode( node, nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration), @@ -86351,7 +86987,7 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) ); }, - [184 /* ConstructorType */]: function visitEachChildOfConstructorTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [185 /* ConstructorType */]: function visitEachChildOfConstructorTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateConstructorTypeNode( node, nodesVisitor(node.modifiers, visitor, isModifier), @@ -86360,56 +86996,56 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) ); }, - [185 /* TypeQuery */]: function visitEachChildOfTypeQueryNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [186 /* TypeQuery */]: function visitEachChildOfTypeQueryNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateTypeQueryNode( node, Debug.checkDefined(nodeVisitor(node.exprName, visitor, isEntityName)), nodesVisitor(node.typeArguments, visitor, isTypeNode) ); }, - [186 /* TypeLiteral */]: function visitEachChildOfTypeLiteralNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [187 /* TypeLiteral */]: function visitEachChildOfTypeLiteralNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateTypeLiteralNode( node, nodesVisitor(node.members, visitor, isTypeElement) ); }, - [187 /* ArrayType */]: function visitEachChildOfArrayTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [188 /* ArrayType */]: function visitEachChildOfArrayTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateArrayTypeNode( node, Debug.checkDefined(nodeVisitor(node.elementType, visitor, isTypeNode)) ); }, - [188 /* TupleType */]: function visitEachChildOfTupleTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [189 /* TupleType */]: function visitEachChildOfTupleTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateTupleTypeNode( node, nodesVisitor(node.elements, visitor, isTypeNode) ); }, - [189 /* OptionalType */]: function visitEachChildOfOptionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [190 /* OptionalType */]: function visitEachChildOfOptionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateOptionalTypeNode( node, Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) ); }, - [190 /* RestType */]: function visitEachChildOfRestTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [191 /* RestType */]: function visitEachChildOfRestTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateRestTypeNode( node, Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) ); }, - [191 /* UnionType */]: function visitEachChildOfUnionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [192 /* UnionType */]: function visitEachChildOfUnionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateUnionTypeNode( node, nodesVisitor(node.types, visitor, isTypeNode) ); }, - [192 /* IntersectionType */]: function visitEachChildOfIntersectionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [193 /* IntersectionType */]: function visitEachChildOfIntersectionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateIntersectionTypeNode( node, nodesVisitor(node.types, visitor, isTypeNode) ); }, - [193 /* ConditionalType */]: function visitEachChildOfConditionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [194 /* ConditionalType */]: function visitEachChildOfConditionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateConditionalTypeNode( node, Debug.checkDefined(nodeVisitor(node.checkType, visitor, isTypeNode)), @@ -86418,13 +87054,13 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.falseType, visitor, isTypeNode)) ); }, - [194 /* InferType */]: function visitEachChildOfInferTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [195 /* InferType */]: function visitEachChildOfInferTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateInferTypeNode( node, Debug.checkDefined(nodeVisitor(node.typeParameter, visitor, isTypeParameterDeclaration)) ); }, - [204 /* ImportType */]: function visitEachChildOfImportTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [205 /* ImportType */]: function visitEachChildOfImportTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateImportTypeNode( node, Debug.checkDefined(nodeVisitor(node.argument, visitor, isTypeNode)), @@ -86434,14 +87070,14 @@ ${lanes.join("\n")} node.isTypeOf ); }, - [301 /* ImportTypeAssertionContainer */]: function visitEachChildOfImportTypeAssertionContainer(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [302 /* ImportTypeAssertionContainer */]: function visitEachChildOfImportTypeAssertionContainer(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateImportTypeAssertionContainer( node, Debug.checkDefined(nodeVisitor(node.assertClause, visitor, isAssertClause)), node.multiLine ); }, - [201 /* NamedTupleMember */]: function visitEachChildOfNamedTupleMember(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + [202 /* NamedTupleMember */]: function visitEachChildOfNamedTupleMember(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updateNamedTupleMember( node, tokenVisitor ? nodeVisitor(node.dotDotDotToken, tokenVisitor, isDotDotDotToken) : node.dotDotDotToken, @@ -86450,26 +87086,26 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) ); }, - [195 /* ParenthesizedType */]: function visitEachChildOfParenthesizedType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [196 /* ParenthesizedType */]: function visitEachChildOfParenthesizedType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateParenthesizedType( node, Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) ); }, - [197 /* TypeOperator */]: function visitEachChildOfTypeOperatorNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [198 /* TypeOperator */]: function visitEachChildOfTypeOperatorNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateTypeOperatorNode( node, Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) ); }, - [198 /* IndexedAccessType */]: function visitEachChildOfIndexedAccessType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [199 /* IndexedAccessType */]: function visitEachChildOfIndexedAccessType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateIndexedAccessTypeNode( node, Debug.checkDefined(nodeVisitor(node.objectType, visitor, isTypeNode)), Debug.checkDefined(nodeVisitor(node.indexType, visitor, isTypeNode)) ); }, - [199 /* MappedType */]: function visitEachChildOfMappedType(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + [200 /* MappedType */]: function visitEachChildOfMappedType(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updateMappedTypeNode( node, tokenVisitor ? nodeVisitor(node.readonlyToken, tokenVisitor, isReadonlyKeywordOrPlusOrMinusToken) : node.readonlyToken, @@ -86480,20 +87116,20 @@ ${lanes.join("\n")} nodesVisitor(node.members, visitor, isTypeElement) ); }, - [200 /* LiteralType */]: function visitEachChildOfLiteralTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [201 /* LiteralType */]: function visitEachChildOfLiteralTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateLiteralTypeNode( node, Debug.checkDefined(nodeVisitor(node.literal, visitor, isLiteralTypeLiteral)) ); }, - [202 /* TemplateLiteralType */]: function visitEachChildOfTemplateLiteralType(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [203 /* TemplateLiteralType */]: function visitEachChildOfTemplateLiteralType(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateTemplateLiteralType( node, Debug.checkDefined(nodeVisitor(node.head, visitor, isTemplateHead)), nodesVisitor(node.templateSpans, visitor, isTemplateLiteralTypeSpan) ); }, - [203 /* TemplateLiteralTypeSpan */]: function visitEachChildOfTemplateLiteralTypeSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [204 /* TemplateLiteralTypeSpan */]: function visitEachChildOfTemplateLiteralTypeSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateTemplateLiteralTypeSpan( node, Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)), @@ -86501,19 +87137,19 @@ ${lanes.join("\n")} ); }, // Binding patterns - [205 /* ObjectBindingPattern */]: function visitEachChildOfObjectBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [206 /* ObjectBindingPattern */]: function visitEachChildOfObjectBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateObjectBindingPattern( node, nodesVisitor(node.elements, visitor, isBindingElement) ); }, - [206 /* ArrayBindingPattern */]: function visitEachChildOfArrayBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [207 /* ArrayBindingPattern */]: function visitEachChildOfArrayBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateArrayBindingPattern( node, nodesVisitor(node.elements, visitor, isArrayBindingElement) ); }, - [207 /* BindingElement */]: function visitEachChildOfBindingElement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + [208 /* BindingElement */]: function visitEachChildOfBindingElement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updateBindingElement( node, tokenVisitor ? nodeVisitor(node.dotDotDotToken, tokenVisitor, isDotDotDotToken) : node.dotDotDotToken, @@ -86523,19 +87159,19 @@ ${lanes.join("\n")} ); }, // Expression - [208 /* ArrayLiteralExpression */]: function visitEachChildOfArrayLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [209 /* ArrayLiteralExpression */]: function visitEachChildOfArrayLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateArrayLiteralExpression( node, nodesVisitor(node.elements, visitor, isExpression) ); }, - [209 /* ObjectLiteralExpression */]: function visitEachChildOfObjectLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [210 /* ObjectLiteralExpression */]: function visitEachChildOfObjectLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateObjectLiteralExpression( node, nodesVisitor(node.properties, visitor, isObjectLiteralElementLike) ); }, - [210 /* PropertyAccessExpression */]: function visitEachChildOfPropertyAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + [211 /* PropertyAccessExpression */]: function visitEachChildOfPropertyAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { return isPropertyAccessChain(node) ? context.factory.updatePropertyAccessChain( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), @@ -86547,7 +87183,7 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.name, visitor, isMemberName)) ); }, - [211 /* ElementAccessExpression */]: function visitEachChildOfElementAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + [212 /* ElementAccessExpression */]: function visitEachChildOfElementAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { return isElementAccessChain(node) ? context.factory.updateElementAccessChain( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), @@ -86559,7 +87195,7 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.argumentExpression, visitor, isExpression)) ); }, - [212 /* CallExpression */]: function visitEachChildOfCallExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + [213 /* CallExpression */]: function visitEachChildOfCallExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { return isCallChain(node) ? context.factory.updateCallChain( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), @@ -86573,7 +87209,7 @@ ${lanes.join("\n")} nodesVisitor(node.arguments, visitor, isExpression) ); }, - [213 /* NewExpression */]: function visitEachChildOfNewExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [214 /* NewExpression */]: function visitEachChildOfNewExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateNewExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), @@ -86581,7 +87217,7 @@ ${lanes.join("\n")} nodesVisitor(node.arguments, visitor, isExpression) ); }, - [214 /* TaggedTemplateExpression */]: function visitEachChildOfTaggedTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [215 /* TaggedTemplateExpression */]: function visitEachChildOfTaggedTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateTaggedTemplateExpression( node, Debug.checkDefined(nodeVisitor(node.tag, visitor, isExpression)), @@ -86589,20 +87225,20 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.template, visitor, isTemplateLiteral)) ); }, - [215 /* TypeAssertionExpression */]: function visitEachChildOfTypeAssertionExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [216 /* TypeAssertionExpression */]: function visitEachChildOfTypeAssertionExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateTypeAssertion( node, Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)), Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, - [216 /* ParenthesizedExpression */]: function visitEachChildOfParenthesizedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [217 /* ParenthesizedExpression */]: function visitEachChildOfParenthesizedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateParenthesizedExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, - [217 /* FunctionExpression */]: function visitEachChildOfFunctionExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + [218 /* FunctionExpression */]: function visitEachChildOfFunctionExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updateFunctionExpression( node, nodesVisitor(node.modifiers, visitor, isModifier), @@ -86614,7 +87250,7 @@ ${lanes.join("\n")} visitFunctionBody(node.body, visitor, context, nodeVisitor) ); }, - [218 /* ArrowFunction */]: function visitEachChildOfArrowFunction(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + [219 /* ArrowFunction */]: function visitEachChildOfArrowFunction(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updateArrowFunction( node, nodesVisitor(node.modifiers, visitor, isModifier), @@ -86625,43 +87261,43 @@ ${lanes.join("\n")} visitFunctionBody(node.body, visitor, context, nodeVisitor) ); }, - [219 /* DeleteExpression */]: function visitEachChildOfDeleteExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [220 /* DeleteExpression */]: function visitEachChildOfDeleteExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateDeleteExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, - [220 /* TypeOfExpression */]: function visitEachChildOfTypeOfExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [221 /* TypeOfExpression */]: function visitEachChildOfTypeOfExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateTypeOfExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, - [221 /* VoidExpression */]: function visitEachChildOfVoidExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [222 /* VoidExpression */]: function visitEachChildOfVoidExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateVoidExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, - [222 /* AwaitExpression */]: function visitEachChildOfAwaitExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [223 /* AwaitExpression */]: function visitEachChildOfAwaitExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateAwaitExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, - [223 /* PrefixUnaryExpression */]: function visitEachChildOfPrefixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [224 /* PrefixUnaryExpression */]: function visitEachChildOfPrefixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updatePrefixUnaryExpression( node, Debug.checkDefined(nodeVisitor(node.operand, visitor, isExpression)) ); }, - [224 /* PostfixUnaryExpression */]: function visitEachChildOfPostfixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [225 /* PostfixUnaryExpression */]: function visitEachChildOfPostfixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updatePostfixUnaryExpression( node, Debug.checkDefined(nodeVisitor(node.operand, visitor, isExpression)) ); }, - [225 /* BinaryExpression */]: function visitEachChildOfBinaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + [226 /* BinaryExpression */]: function visitEachChildOfBinaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updateBinaryExpression( node, Debug.checkDefined(nodeVisitor(node.left, visitor, isExpression)), @@ -86669,7 +87305,7 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.right, visitor, isExpression)) ); }, - [226 /* ConditionalExpression */]: function visitEachChildOfConditionalExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + [227 /* ConditionalExpression */]: function visitEachChildOfConditionalExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updateConditionalExpression( node, Debug.checkDefined(nodeVisitor(node.condition, visitor, isExpression)), @@ -86679,27 +87315,27 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.whenFalse, visitor, isExpression)) ); }, - [227 /* TemplateExpression */]: function visitEachChildOfTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [228 /* TemplateExpression */]: function visitEachChildOfTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateTemplateExpression( node, Debug.checkDefined(nodeVisitor(node.head, visitor, isTemplateHead)), nodesVisitor(node.templateSpans, visitor, isTemplateSpan) ); }, - [228 /* YieldExpression */]: function visitEachChildOfYieldExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + [229 /* YieldExpression */]: function visitEachChildOfYieldExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updateYieldExpression( node, tokenVisitor ? nodeVisitor(node.asteriskToken, tokenVisitor, isAsteriskToken) : node.asteriskToken, nodeVisitor(node.expression, visitor, isExpression) ); }, - [229 /* SpreadElement */]: function visitEachChildOfSpreadElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [230 /* SpreadElement */]: function visitEachChildOfSpreadElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateSpreadElement( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, - [230 /* ClassExpression */]: function visitEachChildOfClassExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [231 /* ClassExpression */]: function visitEachChildOfClassExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateClassExpression( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -86709,28 +87345,28 @@ ${lanes.join("\n")} nodesVisitor(node.members, visitor, isClassElement) ); }, - [232 /* ExpressionWithTypeArguments */]: function visitEachChildOfExpressionWithTypeArguments(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [233 /* ExpressionWithTypeArguments */]: function visitEachChildOfExpressionWithTypeArguments(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateExpressionWithTypeArguments( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), nodesVisitor(node.typeArguments, visitor, isTypeNode) ); }, - [233 /* AsExpression */]: function visitEachChildOfAsExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [234 /* AsExpression */]: function visitEachChildOfAsExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateAsExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) ); }, - [237 /* SatisfiesExpression */]: function visitEachChildOfSatisfiesExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [238 /* SatisfiesExpression */]: function visitEachChildOfSatisfiesExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateSatisfiesExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) ); }, - [234 /* NonNullExpression */]: function visitEachChildOfNonNullExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [235 /* NonNullExpression */]: function visitEachChildOfNonNullExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return isOptionalChain(node) ? context.factory.updateNonNullChain( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) @@ -86739,14 +87375,14 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, - [235 /* MetaProperty */]: function visitEachChildOfMetaProperty(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [236 /* MetaProperty */]: function visitEachChildOfMetaProperty(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateMetaProperty( node, Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)) ); }, // Misc - [238 /* TemplateSpan */]: function visitEachChildOfTemplateSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [239 /* TemplateSpan */]: function visitEachChildOfTemplateSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateTemplateSpan( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), @@ -86754,26 +87390,26 @@ ${lanes.join("\n")} ); }, // Element - [240 /* Block */]: function visitEachChildOfBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [241 /* Block */]: function visitEachChildOfBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateBlock( node, nodesVisitor(node.statements, visitor, isStatement) ); }, - [242 /* VariableStatement */]: function visitEachChildOfVariableStatement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [243 /* VariableStatement */]: function visitEachChildOfVariableStatement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateVariableStatement( node, nodesVisitor(node.modifiers, visitor, isModifierLike), Debug.checkDefined(nodeVisitor(node.declarationList, visitor, isVariableDeclarationList)) ); }, - [243 /* ExpressionStatement */]: function visitEachChildOfExpressionStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [244 /* ExpressionStatement */]: function visitEachChildOfExpressionStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateExpressionStatement( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, - [244 /* IfStatement */]: function visitEachChildOfIfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [245 /* IfStatement */]: function visitEachChildOfIfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateIfStatement( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), @@ -86781,21 +87417,21 @@ ${lanes.join("\n")} nodeVisitor(node.elseStatement, visitor, isStatement, context.factory.liftToBlock) ); }, - [245 /* DoStatement */]: function visitEachChildOfDoStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [246 /* DoStatement */]: function visitEachChildOfDoStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateDoStatement( node, visitIterationBody(node.statement, visitor, context, nodeVisitor), Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, - [246 /* WhileStatement */]: function visitEachChildOfWhileStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [247 /* WhileStatement */]: function visitEachChildOfWhileStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateWhileStatement( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), visitIterationBody(node.statement, visitor, context, nodeVisitor) ); }, - [247 /* ForStatement */]: function visitEachChildOfForStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [248 /* ForStatement */]: function visitEachChildOfForStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateForStatement( node, nodeVisitor(node.initializer, visitor, isForInitializer), @@ -86804,7 +87440,7 @@ ${lanes.join("\n")} visitIterationBody(node.statement, visitor, context, nodeVisitor) ); }, - [248 /* ForInStatement */]: function visitEachChildOfForInStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [249 /* ForInStatement */]: function visitEachChildOfForInStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateForInStatement( node, Debug.checkDefined(nodeVisitor(node.initializer, visitor, isForInitializer)), @@ -86812,7 +87448,7 @@ ${lanes.join("\n")} visitIterationBody(node.statement, visitor, context, nodeVisitor) ); }, - [249 /* ForOfStatement */]: function visitEachChildOfForOfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + [250 /* ForOfStatement */]: function visitEachChildOfForOfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updateForOfStatement( node, tokenVisitor ? nodeVisitor(node.awaitModifier, tokenVisitor, isAwaitKeyword) : node.awaitModifier, @@ -86821,52 +87457,52 @@ ${lanes.join("\n")} visitIterationBody(node.statement, visitor, context, nodeVisitor) ); }, - [250 /* ContinueStatement */]: function visitEachChildOfContinueStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [251 /* ContinueStatement */]: function visitEachChildOfContinueStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateContinueStatement( node, nodeVisitor(node.label, visitor, isIdentifier) ); }, - [251 /* BreakStatement */]: function visitEachChildOfBreakStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [252 /* BreakStatement */]: function visitEachChildOfBreakStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateBreakStatement( node, nodeVisitor(node.label, visitor, isIdentifier) ); }, - [252 /* ReturnStatement */]: function visitEachChildOfReturnStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [253 /* ReturnStatement */]: function visitEachChildOfReturnStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateReturnStatement( node, nodeVisitor(node.expression, visitor, isExpression) ); }, - [253 /* WithStatement */]: function visitEachChildOfWithStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [254 /* WithStatement */]: function visitEachChildOfWithStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateWithStatement( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), Debug.checkDefined(nodeVisitor(node.statement, visitor, isStatement, context.factory.liftToBlock)) ); }, - [254 /* SwitchStatement */]: function visitEachChildOfSwitchStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [255 /* SwitchStatement */]: function visitEachChildOfSwitchStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateSwitchStatement( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), Debug.checkDefined(nodeVisitor(node.caseBlock, visitor, isCaseBlock)) ); }, - [255 /* LabeledStatement */]: function visitEachChildOfLabeledStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [256 /* LabeledStatement */]: function visitEachChildOfLabeledStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateLabeledStatement( node, Debug.checkDefined(nodeVisitor(node.label, visitor, isIdentifier)), Debug.checkDefined(nodeVisitor(node.statement, visitor, isStatement, context.factory.liftToBlock)) ); }, - [256 /* ThrowStatement */]: function visitEachChildOfThrowStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [257 /* ThrowStatement */]: function visitEachChildOfThrowStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateThrowStatement( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, - [257 /* TryStatement */]: function visitEachChildOfTryStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [258 /* TryStatement */]: function visitEachChildOfTryStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateTryStatement( node, Debug.checkDefined(nodeVisitor(node.tryBlock, visitor, isBlock)), @@ -86874,7 +87510,7 @@ ${lanes.join("\n")} nodeVisitor(node.finallyBlock, visitor, isBlock) ); }, - [259 /* VariableDeclaration */]: function visitEachChildOfVariableDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + [260 /* VariableDeclaration */]: function visitEachChildOfVariableDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updateVariableDeclaration( node, Debug.checkDefined(nodeVisitor(node.name, visitor, isBindingName)), @@ -86883,13 +87519,13 @@ ${lanes.join("\n")} nodeVisitor(node.initializer, visitor, isExpression) ); }, - [260 /* VariableDeclarationList */]: function visitEachChildOfVariableDeclarationList(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [261 /* VariableDeclarationList */]: function visitEachChildOfVariableDeclarationList(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateVariableDeclarationList( node, nodesVisitor(node.declarations, visitor, isVariableDeclaration) ); }, - [261 /* FunctionDeclaration */]: function visitEachChildOfFunctionDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + [262 /* FunctionDeclaration */]: function visitEachChildOfFunctionDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updateFunctionDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifier), @@ -86901,7 +87537,7 @@ ${lanes.join("\n")} visitFunctionBody(node.body, visitor, context, nodeVisitor) ); }, - [262 /* ClassDeclaration */]: function visitEachChildOfClassDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [263 /* ClassDeclaration */]: function visitEachChildOfClassDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateClassDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -86911,7 +87547,7 @@ ${lanes.join("\n")} nodesVisitor(node.members, visitor, isClassElement) ); }, - [263 /* InterfaceDeclaration */]: function visitEachChildOfInterfaceDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [264 /* InterfaceDeclaration */]: function visitEachChildOfInterfaceDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateInterfaceDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -86921,7 +87557,7 @@ ${lanes.join("\n")} nodesVisitor(node.members, visitor, isTypeElement) ); }, - [264 /* TypeAliasDeclaration */]: function visitEachChildOfTypeAliasDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [265 /* TypeAliasDeclaration */]: function visitEachChildOfTypeAliasDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateTypeAliasDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -86930,7 +87566,7 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) ); }, - [265 /* EnumDeclaration */]: function visitEachChildOfEnumDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [266 /* EnumDeclaration */]: function visitEachChildOfEnumDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateEnumDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -86938,7 +87574,7 @@ ${lanes.join("\n")} nodesVisitor(node.members, visitor, isEnumMember) ); }, - [266 /* ModuleDeclaration */]: function visitEachChildOfModuleDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [267 /* ModuleDeclaration */]: function visitEachChildOfModuleDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateModuleDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -86946,25 +87582,25 @@ ${lanes.join("\n")} nodeVisitor(node.body, visitor, isModuleBody) ); }, - [267 /* ModuleBlock */]: function visitEachChildOfModuleBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [268 /* ModuleBlock */]: function visitEachChildOfModuleBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateModuleBlock( node, nodesVisitor(node.statements, visitor, isStatement) ); }, - [268 /* CaseBlock */]: function visitEachChildOfCaseBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [269 /* CaseBlock */]: function visitEachChildOfCaseBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateCaseBlock( node, nodesVisitor(node.clauses, visitor, isCaseOrDefaultClause) ); }, - [269 /* NamespaceExportDeclaration */]: function visitEachChildOfNamespaceExportDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [270 /* NamespaceExportDeclaration */]: function visitEachChildOfNamespaceExportDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateNamespaceExportDeclaration( node, Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)) ); }, - [270 /* ImportEqualsDeclaration */]: function visitEachChildOfImportEqualsDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [271 /* ImportEqualsDeclaration */]: function visitEachChildOfImportEqualsDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateImportEqualsDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -86973,7 +87609,7 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.moduleReference, visitor, isModuleReference)) ); }, - [271 /* ImportDeclaration */]: function visitEachChildOfImportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [272 /* ImportDeclaration */]: function visitEachChildOfImportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateImportDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -86982,21 +87618,21 @@ ${lanes.join("\n")} nodeVisitor(node.assertClause, visitor, isAssertClause) ); }, - [299 /* AssertClause */]: function visitEachChildOfAssertClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [300 /* AssertClause */]: function visitEachChildOfAssertClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateAssertClause( node, nodesVisitor(node.elements, visitor, isAssertEntry), node.multiLine ); }, - [300 /* AssertEntry */]: function visitEachChildOfAssertEntry(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [301 /* AssertEntry */]: function visitEachChildOfAssertEntry(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateAssertEntry( node, Debug.checkDefined(nodeVisitor(node.name, visitor, isAssertionKey)), Debug.checkDefined(nodeVisitor(node.value, visitor, isExpression)) ); }, - [272 /* ImportClause */]: function visitEachChildOfImportClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [273 /* ImportClause */]: function visitEachChildOfImportClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateImportClause( node, node.isTypeOnly, @@ -87004,25 +87640,25 @@ ${lanes.join("\n")} nodeVisitor(node.namedBindings, visitor, isNamedImportBindings) ); }, - [273 /* NamespaceImport */]: function visitEachChildOfNamespaceImport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [274 /* NamespaceImport */]: function visitEachChildOfNamespaceImport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateNamespaceImport( node, Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)) ); }, - [279 /* NamespaceExport */]: function visitEachChildOfNamespaceExport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [280 /* NamespaceExport */]: function visitEachChildOfNamespaceExport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateNamespaceExport( node, Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)) ); }, - [274 /* NamedImports */]: function visitEachChildOfNamedImports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [275 /* NamedImports */]: function visitEachChildOfNamedImports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateNamedImports( node, nodesVisitor(node.elements, visitor, isImportSpecifier) ); }, - [275 /* ImportSpecifier */]: function visitEachChildOfImportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [276 /* ImportSpecifier */]: function visitEachChildOfImportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateImportSpecifier( node, node.isTypeOnly, @@ -87030,14 +87666,14 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)) ); }, - [276 /* ExportAssignment */]: function visitEachChildOfExportAssignment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [277 /* ExportAssignment */]: function visitEachChildOfExportAssignment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateExportAssignment( node, nodesVisitor(node.modifiers, visitor, isModifierLike), Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, - [277 /* ExportDeclaration */]: function visitEachChildOfExportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [278 /* ExportDeclaration */]: function visitEachChildOfExportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateExportDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -87047,13 +87683,13 @@ ${lanes.join("\n")} nodeVisitor(node.assertClause, visitor, isAssertClause) ); }, - [278 /* NamedExports */]: function visitEachChildOfNamedExports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [279 /* NamedExports */]: function visitEachChildOfNamedExports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateNamedExports( node, nodesVisitor(node.elements, visitor, isExportSpecifier) ); }, - [280 /* ExportSpecifier */]: function visitEachChildOfExportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [281 /* ExportSpecifier */]: function visitEachChildOfExportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateExportSpecifier( node, node.isTypeOnly, @@ -87062,14 +87698,14 @@ ${lanes.join("\n")} ); }, // Module references - [282 /* ExternalModuleReference */]: function visitEachChildOfExternalModuleReference(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [283 /* ExternalModuleReference */]: function visitEachChildOfExternalModuleReference(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateExternalModuleReference( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, // JSX - [283 /* JsxElement */]: function visitEachChildOfJsxElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [284 /* JsxElement */]: function visitEachChildOfJsxElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateJsxElement( node, Debug.checkDefined(nodeVisitor(node.openingElement, visitor, isJsxOpeningElement)), @@ -87077,7 +87713,7 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.closingElement, visitor, isJsxClosingElement)) ); }, - [284 /* JsxSelfClosingElement */]: function visitEachChildOfJsxSelfClosingElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [285 /* JsxSelfClosingElement */]: function visitEachChildOfJsxSelfClosingElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateJsxSelfClosingElement( node, Debug.checkDefined(nodeVisitor(node.tagName, visitor, isJsxTagNameExpression)), @@ -87085,7 +87721,7 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.attributes, visitor, isJsxAttributes)) ); }, - [285 /* JsxOpeningElement */]: function visitEachChildOfJsxOpeningElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [286 /* JsxOpeningElement */]: function visitEachChildOfJsxOpeningElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateJsxOpeningElement( node, Debug.checkDefined(nodeVisitor(node.tagName, visitor, isJsxTagNameExpression)), @@ -87093,20 +87729,20 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.attributes, visitor, isJsxAttributes)) ); }, - [286 /* JsxClosingElement */]: function visitEachChildOfJsxClosingElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [287 /* JsxClosingElement */]: function visitEachChildOfJsxClosingElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateJsxClosingElement( node, Debug.checkDefined(nodeVisitor(node.tagName, visitor, isJsxTagNameExpression)) ); }, - [294 /* JsxNamespacedName */]: function forEachChildInJsxNamespacedName2(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [295 /* JsxNamespacedName */]: function forEachChildInJsxNamespacedName2(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateJsxNamespacedName( node, Debug.checkDefined(nodeVisitor(node.namespace, visitor, isIdentifier)), Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)) ); }, - [287 /* JsxFragment */]: function visitEachChildOfJsxFragment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [288 /* JsxFragment */]: function visitEachChildOfJsxFragment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateJsxFragment( node, Debug.checkDefined(nodeVisitor(node.openingFragment, visitor, isJsxOpeningFragment)), @@ -87114,52 +87750,52 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.closingFragment, visitor, isJsxClosingFragment)) ); }, - [290 /* JsxAttribute */]: function visitEachChildOfJsxAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [291 /* JsxAttribute */]: function visitEachChildOfJsxAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateJsxAttribute( node, Debug.checkDefined(nodeVisitor(node.name, visitor, isJsxAttributeName)), nodeVisitor(node.initializer, visitor, isStringLiteralOrJsxExpression) ); }, - [291 /* JsxAttributes */]: function visitEachChildOfJsxAttributes(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [292 /* JsxAttributes */]: function visitEachChildOfJsxAttributes(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateJsxAttributes( node, nodesVisitor(node.properties, visitor, isJsxAttributeLike) ); }, - [292 /* JsxSpreadAttribute */]: function visitEachChildOfJsxSpreadAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [293 /* JsxSpreadAttribute */]: function visitEachChildOfJsxSpreadAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateJsxSpreadAttribute( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, - [293 /* JsxExpression */]: function visitEachChildOfJsxExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [294 /* JsxExpression */]: function visitEachChildOfJsxExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateJsxExpression( node, nodeVisitor(node.expression, visitor, isExpression) ); }, // Clauses - [295 /* CaseClause */]: function visitEachChildOfCaseClause(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [296 /* CaseClause */]: function visitEachChildOfCaseClause(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateCaseClause( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), nodesVisitor(node.statements, visitor, isStatement) ); }, - [296 /* DefaultClause */]: function visitEachChildOfDefaultClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [297 /* DefaultClause */]: function visitEachChildOfDefaultClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateDefaultClause( node, nodesVisitor(node.statements, visitor, isStatement) ); }, - [297 /* HeritageClause */]: function visitEachChildOfHeritageClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [298 /* HeritageClause */]: function visitEachChildOfHeritageClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateHeritageClause( node, nodesVisitor(node.types, visitor, isExpressionWithTypeArguments) ); }, - [298 /* CatchClause */]: function visitEachChildOfCatchClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [299 /* CatchClause */]: function visitEachChildOfCatchClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateCatchClause( node, nodeVisitor(node.variableDeclaration, visitor, isVariableDeclaration), @@ -87167,28 +87803,28 @@ ${lanes.join("\n")} ); }, // Property assignments - [302 /* PropertyAssignment */]: function visitEachChildOfPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [303 /* PropertyAssignment */]: function visitEachChildOfPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updatePropertyAssignment( node, Debug.checkDefined(nodeVisitor(node.name, visitor, isPropertyName)), Debug.checkDefined(nodeVisitor(node.initializer, visitor, isExpression)) ); }, - [303 /* ShorthandPropertyAssignment */]: function visitEachChildOfShorthandPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [304 /* ShorthandPropertyAssignment */]: function visitEachChildOfShorthandPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateShorthandPropertyAssignment( node, Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)), nodeVisitor(node.objectAssignmentInitializer, visitor, isExpression) ); }, - [304 /* SpreadAssignment */]: function visitEachChildOfSpreadAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [305 /* SpreadAssignment */]: function visitEachChildOfSpreadAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateSpreadAssignment( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, // Enum - [305 /* EnumMember */]: function visitEachChildOfEnumMember(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [306 /* EnumMember */]: function visitEachChildOfEnumMember(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateEnumMember( node, Debug.checkDefined(nodeVisitor(node.name, visitor, isPropertyName)), @@ -87196,20 +87832,20 @@ ${lanes.join("\n")} ); }, // Top-level nodes - [311 /* SourceFile */]: function visitEachChildOfSourceFile(node, visitor, context, _nodesVisitor, _nodeVisitor, _tokenVisitor) { + [312 /* SourceFile */]: function visitEachChildOfSourceFile(node, visitor, context, _nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateSourceFile( node, visitLexicalEnvironment(node.statements, visitor, context) ); }, // Transformation nodes - [359 /* PartiallyEmittedExpression */]: function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [360 /* PartiallyEmittedExpression */]: function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updatePartiallyEmittedExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, - [360 /* CommaListExpression */]: function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [361 /* CommaListExpression */]: function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateCommaListExpression( node, nodesVisitor(node.elements, visitor, isExpression) @@ -87502,13 +88138,13 @@ ${lanes.join("\n")} let sourceLine = 0; let sourceCharacter = 0; let nameIndex = 0; - let error; + let error2; return { get pos() { return pos; }, get error() { - return error; + return error2; }, get state() { return captureMapping( @@ -87593,8 +88229,8 @@ ${lanes.join("\n")} return { value: void 0, done: true }; } function setError(message) { - if (error === void 0) { - error = message; + if (error2 === void 0) { + error2 = message; } } function setErrorAndStopIterating(message) { @@ -87602,7 +88238,7 @@ ${lanes.join("\n")} return stopIterating(); } function hasReportedError() { - return error !== void 0; + return error2 !== void 0; } function isSourceMappingSegmentEnd() { return pos === mappings.length || mappings.charCodeAt(pos) === 44 /* comma */ || mappings.charCodeAt(pos) === 59 /* semicolon */; @@ -87810,7 +88446,7 @@ ${lanes.join("\n")} function chainBundle(context, transformSourceFile) { return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - return node.kind === 311 /* SourceFile */ ? transformSourceFile(node) : transformBundle(node); + return node.kind === 312 /* SourceFile */ ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(map(node.sourceFiles, transformSourceFile), node.prepends); @@ -87840,9 +88476,11 @@ ${lanes.join("\n")} function getImportNeedsImportDefaultHelper(node) { return !getImportNeedsImportStarHelper(node) && (isDefaultImport(node) || !!node.importClause && isNamedImports(node.importClause.namedBindings) && containsDefaultReference(node.importClause.namedBindings)); } - function collectExternalModuleInfo(context, sourceFile, resolver, compilerOptions) { + function collectExternalModuleInfo(context, sourceFile) { + const resolver = context.getEmitResolver(); + const compilerOptions = context.getCompilerOptions(); const externalImports = []; - const exportSpecifiers = createMultiMap(); + const exportSpecifiers = new IdentifierNameMultiMap(); const exportedBindings = []; const uniqueExports = /* @__PURE__ */ new Map(); let exportedNames; @@ -87853,7 +88491,7 @@ ${lanes.join("\n")} let hasImportDefault = false; for (const node of sourceFile.statements) { switch (node.kind) { - case 271 /* ImportDeclaration */: + case 272 /* ImportDeclaration */: externalImports.push(node); if (!hasImportStar && getImportNeedsImportStarHelper(node)) { hasImportStar = true; @@ -87862,12 +88500,12 @@ ${lanes.join("\n")} hasImportDefault = true; } break; - case 270 /* ImportEqualsDeclaration */: - if (node.moduleReference.kind === 282 /* ExternalModuleReference */) { + case 271 /* ImportEqualsDeclaration */: + if (node.moduleReference.kind === 283 /* ExternalModuleReference */) { externalImports.push(node); } break; - case 277 /* ExportDeclaration */: + case 278 /* ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { externalImports.push(node); @@ -87890,19 +88528,19 @@ ${lanes.join("\n")} addExportedNamesForExportDeclaration(node); } break; - case 276 /* ExportAssignment */: + case 277 /* ExportAssignment */: if (node.isExportEquals && !exportEquals) { exportEquals = node; } break; - case 242 /* VariableStatement */: + case 243 /* VariableStatement */: if (hasSyntacticModifier(node, 1 /* Export */)) { for (const decl of node.declarationList.declarations) { exportedNames = collectExportedVariableInfo(decl, uniqueExports, exportedNames, exportedBindings); } } break; - case 261 /* FunctionDeclaration */: + case 262 /* FunctionDeclaration */: if (hasSyntacticModifier(node, 1 /* Export */)) { if (hasSyntacticModifier(node, 1024 /* Default */)) { if (!hasExportDefault) { @@ -87919,7 +88557,7 @@ ${lanes.join("\n")} } } break; - case 262 /* ClassDeclaration */: + case 263 /* ClassDeclaration */: if (hasSyntacticModifier(node, 1 /* Export */)) { if (hasSyntacticModifier(node, 1024 /* Default */)) { if (!hasExportDefault) { @@ -87948,7 +88586,7 @@ ${lanes.join("\n")} if (!uniqueExports.get(idText(specifier.name))) { const name = specifier.propertyName || specifier.name; if (!node.moduleSpecifier) { - exportSpecifiers.add(idText(name), specifier); + exportSpecifiers.add(name, specifier); } const decl = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name); if (decl) { @@ -88038,14 +88676,23 @@ ${lanes.join("\n")} const expression = skipParentheses(statement.expression); return isSuperCall(expression) ? expression : void 0; } - function findSuperStatementIndex(statements, indexAfterLastPrologueStatement) { - for (let i = indexAfterLastPrologueStatement; i < statements.length; i += 1) { + function findSuperStatementIndexPathWorker(statements, start, indices) { + for (let i = start; i < statements.length; i += 1) { const statement = statements[i]; if (getSuperCallFromStatement(statement)) { - return i; + indices.unshift(i); + return true; + } else if (isTryStatement(statement) && findSuperStatementIndexPathWorker(statement.tryBlock.statements, 0, indices)) { + indices.unshift(i); + return true; } } - return -1; + return false; + } + function findSuperStatementIndexPath(statements, start) { + const indices = []; + findSuperStatementIndexPathWorker(statements, start, indices); + return indices; } function getProperties(node, requireInitializer, isStatic2) { return filter(node.members, (m) => isInitializedOrStaticProperty(m, requireInitializer, isStatic2)); @@ -88063,7 +88710,7 @@ ${lanes.join("\n")} return isPropertyDeclaration(member) && hasStaticModifier(member); } function isInitializedProperty(member) { - return member.kind === 171 /* PropertyDeclaration */ && member.initializer !== void 0; + return member.kind === 172 /* PropertyDeclaration */ && member.initializer !== void 0; } function isNonStaticMethodOrAccessorWithPrivateName(member) { return !isStatic(member) && (isMethodOrAccessor(member) || isAutoAccessorPropertyDeclaration(member)) && isPrivateIdentifier(member.name); @@ -88100,15 +88747,15 @@ ${lanes.join("\n")} } function getAllDecoratorsOfClassElement(member, parent2, useLegacyDecorators) { switch (member.kind) { - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: if (!useLegacyDecorators) { return getAllDecoratorsOfMethod(member); } return getAllDecoratorsOfAccessors(member, parent2); - case 173 /* MethodDeclaration */: + case 174 /* MethodDeclaration */: return getAllDecoratorsOfMethod(member); - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: return getAllDecoratorsOfProperty(member); default: return void 0; @@ -88180,10 +88827,90 @@ ${lanes.join("\n")} function accessPrivateIdentifier(env, name) { return walkUpLexicalEnvironments(env, (env2) => getPrivateIdentifier(env2.privateEnv, name)); } + var IdentifierNameMap, IdentifierNameMultiMap; var init_utilities3 = __esm({ "src/compiler/transformers/utilities.ts"() { "use strict"; init_ts2(); + IdentifierNameMap = class _IdentifierNameMap { + constructor() { + this._map = /* @__PURE__ */ new Map(); + } + get size() { + return this._map.size; + } + has(key) { + return this._map.has(_IdentifierNameMap.toKey(key)); + } + get(key) { + return this._map.get(_IdentifierNameMap.toKey(key)); + } + set(key, value) { + this._map.set(_IdentifierNameMap.toKey(key), value); + return this; + } + delete(key) { + var _a; + return ((_a = this._map) == null ? void 0 : _a.delete(_IdentifierNameMap.toKey(key))) ?? false; + } + clear() { + this._map.clear(); + } + values() { + return this._map.values(); + } + static toKey(name) { + if (isGeneratedPrivateIdentifier(name) || isGeneratedIdentifier(name)) { + const autoGenerate = name.emitNode.autoGenerate; + if ((autoGenerate.flags & 7 /* KindMask */) === 4 /* Node */) { + const node = getNodeForGeneratedName(name); + const baseName = isMemberName(node) && node !== name ? _IdentifierNameMap.toKey(node) : `(generated@${getNodeId(node)})`; + return formatGeneratedName( + /*privateName*/ + false, + autoGenerate.prefix, + baseName, + autoGenerate.suffix, + _IdentifierNameMap.toKey + ); + } else { + const baseName = `(auto@${autoGenerate.id})`; + return formatGeneratedName( + /*privateName*/ + false, + autoGenerate.prefix, + baseName, + autoGenerate.suffix, + _IdentifierNameMap.toKey + ); + } + } + if (isPrivateIdentifier(name)) { + return idText(name).slice(1); + } + return idText(name); + } + }; + IdentifierNameMultiMap = class extends IdentifierNameMap { + add(key, value) { + let values = this.get(key); + if (values) { + values.push(value); + } else { + this.set(key, values = [value]); + } + return values; + } + remove(key, value) { + const values = this.get(key); + if (values) { + unorderedRemoveItem(values, value); + if (!values.length) { + this.delete(key); + } + } + } + }; } }); @@ -88655,6 +89382,287 @@ ${lanes.join("\n")} } }); + // src/compiler/transformers/classThis.ts + function createClassThisAssignmentBlock(factory2, classThis, thisExpression = factory2.createThis()) { + const expression = factory2.createAssignment(classThis, thisExpression); + const statement = factory2.createExpressionStatement(expression); + const body = factory2.createBlock( + [statement], + /*multiLine*/ + false + ); + const block = factory2.createClassStaticBlockDeclaration(body); + getOrCreateEmitNode(block).classThis = classThis; + return block; + } + function isClassThisAssignmentBlock(node) { + var _a; + if (!isClassStaticBlockDeclaration(node) || node.body.statements.length !== 1) { + return false; + } + const statement = node.body.statements[0]; + return isExpressionStatement(statement) && isAssignmentExpression( + statement.expression, + /*excludeCompoundAssignment*/ + true + ) && isIdentifier(statement.expression.left) && ((_a = node.emitNode) == null ? void 0 : _a.classThis) === statement.expression.left && statement.expression.right.kind === 110 /* ThisKeyword */; + } + function classHasClassThisAssignment(node) { + var _a; + return !!((_a = node.emitNode) == null ? void 0 : _a.classThis) && some(node.members, isClassThisAssignmentBlock); + } + function injectClassThisAssignmentIfMissing(factory2, node, classThis, thisExpression) { + if (classHasClassThisAssignment(node)) { + return node; + } + const staticBlock = createClassThisAssignmentBlock(factory2, classThis, thisExpression); + if (node.name) { + setSourceMapRange(staticBlock.body.statements[0], node.name); + } + const members = factory2.createNodeArray([staticBlock, ...node.members]); + setTextRange(members, node.members); + const updatedNode = isClassDeclaration(node) ? factory2.updateClassDeclaration( + node, + node.modifiers, + node.name, + node.typeParameters, + node.heritageClauses, + members + ) : factory2.updateClassExpression( + node, + node.modifiers, + node.name, + node.typeParameters, + node.heritageClauses, + members + ); + getOrCreateEmitNode(updatedNode).classThis = classThis; + return updatedNode; + } + var init_classThis = __esm({ + "src/compiler/transformers/classThis.ts"() { + "use strict"; + init_ts2(); + } + }); + + // src/compiler/transformers/namedEvaluation.ts + function getAssignedNameOfIdentifier(factory2, name, expression) { + const original = getOriginalNode(skipOuterExpressions(expression)); + if ((isClassDeclaration(original) || isFunctionDeclaration(original)) && !original.name && hasSyntacticModifier(original, 1024 /* Default */)) { + return factory2.createStringLiteral("default"); + } + return factory2.createStringLiteralFromNode(name); + } + function getAssignedNameOfPropertyName(context, name, assignedNameText) { + const { factory: factory2 } = context; + if (assignedNameText !== void 0) { + const assignedName2 = factory2.createStringLiteral(assignedNameText); + return { assignedName: assignedName2, name }; + } + if (isPropertyNameLiteral(name) || isPrivateIdentifier(name)) { + const assignedName2 = factory2.createStringLiteralFromNode(name); + return { assignedName: assignedName2, name }; + } + if (isPropertyNameLiteral(name.expression) && !isIdentifier(name.expression)) { + const assignedName2 = factory2.createStringLiteralFromNode(name.expression); + return { assignedName: assignedName2, name }; + } + const assignedName = factory2.getGeneratedNameForNode(name); + context.hoistVariableDeclaration(assignedName); + const key = context.getEmitHelperFactory().createPropKeyHelper(name.expression); + const assignment = factory2.createAssignment(assignedName, key); + const updatedName = factory2.updateComputedPropertyName(name, assignment); + return { assignedName, name: updatedName }; + } + function createClassNamedEvaluationHelperBlock(context, assignedName, thisExpression = context.factory.createThis()) { + const { factory: factory2 } = context; + const expression = context.getEmitHelperFactory().createSetFunctionNameHelper(thisExpression, assignedName); + const statement = factory2.createExpressionStatement(expression); + const body = factory2.createBlock( + [statement], + /*multiLine*/ + false + ); + const block = factory2.createClassStaticBlockDeclaration(body); + getOrCreateEmitNode(block).assignedName = assignedName; + return block; + } + function isClassNamedEvaluationHelperBlock(node) { + var _a; + if (!isClassStaticBlockDeclaration(node) || node.body.statements.length !== 1) { + return false; + } + const statement = node.body.statements[0]; + return isExpressionStatement(statement) && isCallToHelper(statement.expression, "___setFunctionName") && statement.expression.arguments.length >= 2 && statement.expression.arguments[1] === ((_a = node.emitNode) == null ? void 0 : _a.assignedName); + } + function classHasExplicitlyAssignedName(node) { + var _a; + return !!((_a = node.emitNode) == null ? void 0 : _a.assignedName) && some(node.members, isClassNamedEvaluationHelperBlock); + } + function classHasDeclaredOrExplicitlyAssignedName(node) { + return !!node.name || classHasExplicitlyAssignedName(node); + } + function injectClassNamedEvaluationHelperBlockIfMissing(context, node, assignedName, thisExpression) { + if (classHasExplicitlyAssignedName(node)) { + return node; + } + const { factory: factory2 } = context; + const namedEvaluationBlock = createClassNamedEvaluationHelperBlock(context, assignedName, thisExpression); + if (node.name) { + setSourceMapRange(namedEvaluationBlock.body.statements[0], node.name); + } + const insertionIndex = findIndex(node.members, isClassThisAssignmentBlock) + 1; + const leading = node.members.slice(0, insertionIndex); + const trailing = node.members.slice(insertionIndex); + const members = factory2.createNodeArray([...leading, namedEvaluationBlock, ...trailing]); + setTextRange(members, node.members); + node = isClassDeclaration(node) ? factory2.updateClassDeclaration( + node, + node.modifiers, + node.name, + node.typeParameters, + node.heritageClauses, + members + ) : factory2.updateClassExpression( + node, + node.modifiers, + node.name, + node.typeParameters, + node.heritageClauses, + members + ); + getOrCreateEmitNode(node).assignedName = assignedName; + return node; + } + function finishTransformNamedEvaluation(context, expression, assignedName, ignoreEmptyStringLiteral) { + if (ignoreEmptyStringLiteral && isStringLiteral(assignedName) && isEmptyStringLiteral(assignedName)) { + return expression; + } + const { factory: factory2 } = context; + const innerExpression = skipOuterExpressions(expression); + const updatedExpression = isClassExpression(innerExpression) ? cast(injectClassNamedEvaluationHelperBlockIfMissing(context, innerExpression, assignedName), isClassExpression) : context.getEmitHelperFactory().createSetFunctionNameHelper(innerExpression, assignedName); + return factory2.restoreOuterExpressions(expression, updatedExpression); + } + function transformNamedEvaluationOfPropertyAssignment(context, node, ignoreEmptyStringLiteral, assignedNameText) { + const { factory: factory2 } = context; + const { assignedName, name } = getAssignedNameOfPropertyName(context, node.name, assignedNameText); + const initializer = finishTransformNamedEvaluation(context, node.initializer, assignedName, ignoreEmptyStringLiteral); + return factory2.updatePropertyAssignment( + node, + name, + initializer + ); + } + function transformNamedEvaluationOfShorthandAssignmentProperty(context, node, ignoreEmptyStringLiteral, assignedNameText) { + const { factory: factory2 } = context; + const assignedName = assignedNameText !== void 0 ? factory2.createStringLiteral(assignedNameText) : getAssignedNameOfIdentifier(factory2, node.name, node.objectAssignmentInitializer); + const objectAssignmentInitializer = finishTransformNamedEvaluation(context, node.objectAssignmentInitializer, assignedName, ignoreEmptyStringLiteral); + return factory2.updateShorthandPropertyAssignment( + node, + node.name, + objectAssignmentInitializer + ); + } + function transformNamedEvaluationOfVariableDeclaration(context, node, ignoreEmptyStringLiteral, assignedNameText) { + const { factory: factory2 } = context; + const assignedName = assignedNameText !== void 0 ? factory2.createStringLiteral(assignedNameText) : getAssignedNameOfIdentifier(factory2, node.name, node.initializer); + const initializer = finishTransformNamedEvaluation(context, node.initializer, assignedName, ignoreEmptyStringLiteral); + return factory2.updateVariableDeclaration( + node, + node.name, + node.exclamationToken, + node.type, + initializer + ); + } + function transformNamedEvaluationOfParameterDeclaration(context, node, ignoreEmptyStringLiteral, assignedNameText) { + const { factory: factory2 } = context; + const assignedName = assignedNameText !== void 0 ? factory2.createStringLiteral(assignedNameText) : getAssignedNameOfIdentifier(factory2, node.name, node.initializer); + const initializer = finishTransformNamedEvaluation(context, node.initializer, assignedName, ignoreEmptyStringLiteral); + return factory2.updateParameterDeclaration( + node, + node.modifiers, + node.dotDotDotToken, + node.name, + node.questionToken, + node.type, + initializer + ); + } + function transformNamedEvaluationOfBindingElement(context, node, ignoreEmptyStringLiteral, assignedNameText) { + const { factory: factory2 } = context; + const assignedName = assignedNameText !== void 0 ? factory2.createStringLiteral(assignedNameText) : getAssignedNameOfIdentifier(factory2, node.name, node.initializer); + const initializer = finishTransformNamedEvaluation(context, node.initializer, assignedName, ignoreEmptyStringLiteral); + return factory2.updateBindingElement( + node, + node.dotDotDotToken, + node.propertyName, + node.name, + initializer + ); + } + function transformNamedEvaluationOfPropertyDeclaration(context, node, ignoreEmptyStringLiteral, assignedNameText) { + const { factory: factory2 } = context; + const { assignedName, name } = getAssignedNameOfPropertyName(context, node.name, assignedNameText); + const initializer = finishTransformNamedEvaluation(context, node.initializer, assignedName, ignoreEmptyStringLiteral); + return factory2.updatePropertyDeclaration( + node, + node.modifiers, + name, + node.questionToken ?? node.exclamationToken, + node.type, + initializer + ); + } + function transformNamedEvaluationOfAssignmentExpression(context, node, ignoreEmptyStringLiteral, assignedNameText) { + const { factory: factory2 } = context; + const assignedName = assignedNameText !== void 0 ? factory2.createStringLiteral(assignedNameText) : getAssignedNameOfIdentifier(factory2, node.left, node.right); + const right = finishTransformNamedEvaluation(context, node.right, assignedName, ignoreEmptyStringLiteral); + return factory2.updateBinaryExpression( + node, + node.left, + node.operatorToken, + right + ); + } + function transformNamedEvaluationOfExportAssignment(context, node, ignoreEmptyStringLiteral, assignedNameText) { + const { factory: factory2 } = context; + const assignedName = assignedNameText !== void 0 ? factory2.createStringLiteral(assignedNameText) : factory2.createStringLiteral(node.isExportEquals ? "" : "default"); + const expression = finishTransformNamedEvaluation(context, node.expression, assignedName, ignoreEmptyStringLiteral); + return factory2.updateExportAssignment( + node, + node.modifiers, + expression + ); + } + function transformNamedEvaluation(context, node, ignoreEmptyStringLiteral, assignedName) { + switch (node.kind) { + case 303 /* PropertyAssignment */: + return transformNamedEvaluationOfPropertyAssignment(context, node, ignoreEmptyStringLiteral, assignedName); + case 304 /* ShorthandPropertyAssignment */: + return transformNamedEvaluationOfShorthandAssignmentProperty(context, node, ignoreEmptyStringLiteral, assignedName); + case 260 /* VariableDeclaration */: + return transformNamedEvaluationOfVariableDeclaration(context, node, ignoreEmptyStringLiteral, assignedName); + case 169 /* Parameter */: + return transformNamedEvaluationOfParameterDeclaration(context, node, ignoreEmptyStringLiteral, assignedName); + case 208 /* BindingElement */: + return transformNamedEvaluationOfBindingElement(context, node, ignoreEmptyStringLiteral, assignedName); + case 172 /* PropertyDeclaration */: + return transformNamedEvaluationOfPropertyDeclaration(context, node, ignoreEmptyStringLiteral, assignedName); + case 226 /* BinaryExpression */: + return transformNamedEvaluationOfAssignmentExpression(context, node, ignoreEmptyStringLiteral, assignedName); + case 277 /* ExportAssignment */: + return transformNamedEvaluationOfExportAssignment(context, node, ignoreEmptyStringLiteral, assignedName); + } + } + var init_namedEvaluation = __esm({ + "src/compiler/transformers/namedEvaluation.ts"() { + "use strict"; + init_ts2(); + } + }); + // src/compiler/transformers/taggedTemplate.ts function processTaggedTemplateExpression(context, node, visitor, currentSourceFile, recordTaggedTemplateString, level) { const tag = visitNode(node.tag, visitor, isExpression); @@ -88753,8 +89761,8 @@ ${lanes.join("\n")} const previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(210 /* PropertyAccessExpression */); - context.enableSubstitution(211 /* ElementAccessExpression */); + context.enableSubstitution(211 /* PropertyAccessExpression */); + context.enableSubstitution(212 /* ElementAccessExpression */); let currentSourceFile; let currentNamespace; let currentNamespaceContainerName; @@ -88765,14 +89773,14 @@ ${lanes.join("\n")} let applicableSubstitutions; return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - if (node.kind === 312 /* Bundle */) { + if (node.kind === 313 /* Bundle */) { return transformBundle(node); } return transformSourceFile(node); } function transformBundle(node) { return factory2.createBundle(node.sourceFiles.map(transformSourceFile), mapDefined(node.prepends, (prepend) => { - if (prepend.kind === 314 /* InputFiles */) { + if (prepend.kind === 315 /* InputFiles */) { return createUnparsedSourceFile(prepend, "js"); } return prepend; @@ -88803,22 +89811,22 @@ ${lanes.join("\n")} } function onBeforeVisitNode(node) { switch (node.kind) { - case 311 /* SourceFile */: - case 268 /* CaseBlock */: - case 267 /* ModuleBlock */: - case 240 /* Block */: + case 312 /* SourceFile */: + case 269 /* CaseBlock */: + case 268 /* ModuleBlock */: + case 241 /* Block */: currentLexicalScope = node; currentScopeFirstDeclarationsOfName = void 0; break; - case 262 /* ClassDeclaration */: - case 261 /* FunctionDeclaration */: + case 263 /* ClassDeclaration */: + case 262 /* FunctionDeclaration */: if (hasSyntacticModifier(node, 2 /* Ambient */)) { break; } if (node.name) { recordEmittedDeclarationInScope(node); } else { - Debug.assert(node.kind === 262 /* ClassDeclaration */ || hasSyntacticModifier(node, 1024 /* Default */)); + Debug.assert(node.kind === 263 /* ClassDeclaration */ || hasSyntacticModifier(node, 1024 /* Default */)); } break; } @@ -88837,10 +89845,10 @@ ${lanes.join("\n")} } function sourceElementVisitorWorker(node) { switch (node.kind) { - case 271 /* ImportDeclaration */: - case 270 /* ImportEqualsDeclaration */: - case 276 /* ExportAssignment */: - case 277 /* ExportDeclaration */: + case 272 /* ImportDeclaration */: + case 271 /* ImportEqualsDeclaration */: + case 277 /* ExportAssignment */: + case 278 /* ExportDeclaration */: return visitElidableStatement(node); default: return visitorWorker(node); @@ -88855,13 +89863,13 @@ ${lanes.join("\n")} return node; } switch (node.kind) { - case 271 /* ImportDeclaration */: + case 272 /* ImportDeclaration */: return visitImportDeclaration(node); - case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 276 /* ExportAssignment */: + case 277 /* ExportAssignment */: return visitExportAssignment(node); - case 277 /* ExportDeclaration */: + case 278 /* ExportDeclaration */: return visitExportDeclaration(node); default: Debug.fail("Unhandled ellided statement"); @@ -88871,7 +89879,7 @@ ${lanes.join("\n")} return saveStateAndInvoke(node, namespaceElementVisitorWorker); } function namespaceElementVisitorWorker(node) { - if (node.kind === 277 /* ExportDeclaration */ || node.kind === 271 /* ImportDeclaration */ || node.kind === 272 /* ImportClause */ || node.kind === 270 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 282 /* ExternalModuleReference */) { + if (node.kind === 278 /* ExportDeclaration */ || node.kind === 272 /* ImportDeclaration */ || node.kind === 273 /* ImportClause */ || node.kind === 271 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 283 /* ExternalModuleReference */) { return void 0; } else if (node.transformFlags & 1 /* ContainsTypeScript */ || hasSyntacticModifier(node, 1 /* Export */)) { return visitTypeScript(node); @@ -88883,21 +89891,21 @@ ${lanes.join("\n")} } function classElementVisitorWorker(node, parent2) { switch (node.kind) { - case 175 /* Constructor */: + case 176 /* Constructor */: return visitConstructor(node); - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: return visitPropertyDeclaration(node, parent2); - case 176 /* GetAccessor */: + case 177 /* GetAccessor */: return visitGetAccessor(node, parent2); - case 177 /* SetAccessor */: + case 178 /* SetAccessor */: return visitSetAccessor(node, parent2); - case 173 /* MethodDeclaration */: + case 174 /* MethodDeclaration */: return visitMethodDeclaration(node, parent2); - case 174 /* ClassStaticBlockDeclaration */: + case 175 /* ClassStaticBlockDeclaration */: return visitEachChild(node, visitor, context); - case 239 /* SemicolonClassElement */: + case 240 /* SemicolonClassElement */: return node; - case 180 /* IndexSignature */: + case 181 /* IndexSignature */: return; default: return Debug.failBadSyntaxKind(node); @@ -88908,15 +89916,15 @@ ${lanes.join("\n")} } function objectLiteralElementVisitorWorker(node, parent2) { switch (node.kind) { - case 302 /* PropertyAssignment */: - case 303 /* ShorthandPropertyAssignment */: - case 304 /* SpreadAssignment */: + case 303 /* PropertyAssignment */: + case 304 /* ShorthandPropertyAssignment */: + case 305 /* SpreadAssignment */: return visitor(node); - case 176 /* GetAccessor */: + case 177 /* GetAccessor */: return visitGetAccessor(node, parent2); - case 177 /* SetAccessor */: + case 178 /* SetAccessor */: return visitSetAccessor(node, parent2); - case 173 /* MethodDeclaration */: + case 174 /* MethodDeclaration */: return visitMethodDeclaration(node, parent2); default: return Debug.failBadSyntaxKind(node); @@ -88950,19 +89958,19 @@ ${lanes.join("\n")} case 123 /* PrivateKeyword */: case 124 /* ProtectedKeyword */: case 128 /* AbstractKeyword */: - case 163 /* OverrideKeyword */: + case 164 /* OverrideKeyword */: case 87 /* ConstKeyword */: case 138 /* DeclareKeyword */: case 148 /* ReadonlyKeyword */: case 103 /* InKeyword */: case 147 /* OutKeyword */: - case 187 /* ArrayType */: - case 188 /* TupleType */: - case 189 /* OptionalType */: - case 190 /* RestType */: - case 186 /* TypeLiteral */: - case 181 /* TypePredicate */: - case 167 /* TypeParameter */: + case 188 /* ArrayType */: + case 189 /* TupleType */: + case 190 /* OptionalType */: + case 191 /* RestType */: + case 187 /* TypeLiteral */: + case 182 /* TypePredicate */: + case 168 /* TypeParameter */: case 133 /* AnyKeyword */: case 159 /* UnknownKeyword */: case 136 /* BooleanKeyword */: @@ -88971,80 +89979,80 @@ ${lanes.join("\n")} case 146 /* NeverKeyword */: case 116 /* VoidKeyword */: case 155 /* SymbolKeyword */: - case 184 /* ConstructorType */: - case 183 /* FunctionType */: - case 185 /* TypeQuery */: - case 182 /* TypeReference */: - case 191 /* UnionType */: - case 192 /* IntersectionType */: - case 193 /* ConditionalType */: - case 195 /* ParenthesizedType */: - case 196 /* ThisType */: - case 197 /* TypeOperator */: - case 198 /* IndexedAccessType */: - case 199 /* MappedType */: - case 200 /* LiteralType */: - case 180 /* IndexSignature */: + case 185 /* ConstructorType */: + case 184 /* FunctionType */: + case 186 /* TypeQuery */: + case 183 /* TypeReference */: + case 192 /* UnionType */: + case 193 /* IntersectionType */: + case 194 /* ConditionalType */: + case 196 /* ParenthesizedType */: + case 197 /* ThisType */: + case 198 /* TypeOperator */: + case 199 /* IndexedAccessType */: + case 200 /* MappedType */: + case 201 /* LiteralType */: + case 181 /* IndexSignature */: return void 0; - case 264 /* TypeAliasDeclaration */: + case 265 /* TypeAliasDeclaration */: return factory2.createNotEmittedStatement(node); - case 269 /* NamespaceExportDeclaration */: + case 270 /* NamespaceExportDeclaration */: return void 0; - case 263 /* InterfaceDeclaration */: + case 264 /* InterfaceDeclaration */: return factory2.createNotEmittedStatement(node); - case 262 /* ClassDeclaration */: + case 263 /* ClassDeclaration */: return visitClassDeclaration(node); - case 230 /* ClassExpression */: + case 231 /* ClassExpression */: return visitClassExpression(node); - case 297 /* HeritageClause */: + case 298 /* HeritageClause */: return visitHeritageClause(node); - case 232 /* ExpressionWithTypeArguments */: + case 233 /* ExpressionWithTypeArguments */: return visitExpressionWithTypeArguments(node); - case 209 /* ObjectLiteralExpression */: + case 210 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 175 /* Constructor */: - case 171 /* PropertyDeclaration */: - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 174 /* ClassStaticBlockDeclaration */: + case 176 /* Constructor */: + case 172 /* PropertyDeclaration */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 175 /* ClassStaticBlockDeclaration */: return Debug.fail("Class and object literal elements must be visited with their respective visitors"); - case 261 /* FunctionDeclaration */: + case 262 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 217 /* FunctionExpression */: + case 218 /* FunctionExpression */: return visitFunctionExpression(node); - case 218 /* ArrowFunction */: + case 219 /* ArrowFunction */: return visitArrowFunction(node); - case 168 /* Parameter */: + case 169 /* Parameter */: return visitParameter(node); - case 216 /* ParenthesizedExpression */: + case 217 /* ParenthesizedExpression */: return visitParenthesizedExpression(node); - case 215 /* TypeAssertionExpression */: - case 233 /* AsExpression */: + case 216 /* TypeAssertionExpression */: + case 234 /* AsExpression */: return visitAssertionExpression(node); - case 237 /* SatisfiesExpression */: + case 238 /* SatisfiesExpression */: return visitSatisfiesExpression(node); - case 212 /* CallExpression */: + case 213 /* CallExpression */: return visitCallExpression(node); - case 213 /* NewExpression */: + case 214 /* NewExpression */: return visitNewExpression(node); - case 214 /* TaggedTemplateExpression */: + case 215 /* TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 234 /* NonNullExpression */: + case 235 /* NonNullExpression */: return visitNonNullExpression(node); - case 265 /* EnumDeclaration */: + case 266 /* EnumDeclaration */: return visitEnumDeclaration(node); - case 242 /* VariableStatement */: + case 243 /* VariableStatement */: return visitVariableStatement(node); - case 259 /* VariableDeclaration */: + case 260 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 266 /* ModuleDeclaration */: + case 267 /* ModuleDeclaration */: return visitModuleDeclaration(node); - case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 284 /* JsxSelfClosingElement */: + case 285 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement(node); - case 285 /* JsxOpeningElement */: + case 286 /* JsxOpeningElement */: return visitJsxJsxOpeningElement(node); default: return visitEachChild(node, visitor, context); @@ -89154,25 +90162,25 @@ ${lanes.join("\n")} insertStatementsAfterStandardPrologue(statements, context.endLexicalEnvironment()); const iife = factory2.createImmediatelyInvokedArrowFunction(statements); setInternalEmitFlags(iife, 1 /* TypeScriptClassWrapper */); - const modifiers2 = facts & 16 /* IsNamedExternalExport */ ? factory2.createModifiersFromModifierFlags(1 /* Export */) : void 0; + const varDecl = factory2.createVariableDeclaration( + factory2.getLocalName( + node, + /*allowComments*/ + false, + /*allowSourceMaps*/ + false + ), + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + iife + ); + setOriginalNode(varDecl, node); const varStatement = factory2.createVariableStatement( - modifiers2, - factory2.createVariableDeclarationList([ - factory2.createVariableDeclaration( - factory2.getLocalName( - node, - /*allowComments*/ - false, - /*allowSourceMaps*/ - false - ), - /*exclamationToken*/ - void 0, - /*type*/ - void 0, - iife - ) - ], 1 /* Let */) + /*modifiers*/ + void 0, + factory2.createVariableDeclarationList([varDecl], 1 /* Let */) ); setOriginalNode(varStatement, node); setCommentRange(varStatement, node); @@ -89201,10 +90209,10 @@ ${lanes.join("\n")} )) ]; } - if (facts & 16 /* IsNamedExternalExport */ && !promoteToIIFE) { + if (facts & 16 /* IsNamedExternalExport */) { return [ statement, - factory2.createExternalModuleExport(factory2.getLocalName( + factory2.createExternalModuleExport(factory2.getDeclarationName( node, /*allowComments*/ false, @@ -89368,19 +90376,19 @@ ${lanes.join("\n")} } function shouldAddTypeMetadata(node) { const kind = node.kind; - return kind === 173 /* MethodDeclaration */ || kind === 176 /* GetAccessor */ || kind === 177 /* SetAccessor */ || kind === 171 /* PropertyDeclaration */; + return kind === 174 /* MethodDeclaration */ || kind === 177 /* GetAccessor */ || kind === 178 /* SetAccessor */ || kind === 172 /* PropertyDeclaration */; } function shouldAddReturnTypeMetadata(node) { - return node.kind === 173 /* MethodDeclaration */; + return node.kind === 174 /* MethodDeclaration */; } function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: return getFirstConstructorWithBody(node) !== void 0; - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: return true; } return false; @@ -89429,7 +90437,7 @@ ${lanes.join("\n")} return !nodeIsMissing(node.body); } function visitPropertyDeclaration(node, parent2) { - const isAmbient = node.flags & 16777216 /* Ambient */ || hasSyntacticModifier(node, 256 /* Abstract */); + const isAmbient = node.flags & 33554432 /* Ambient */ || hasSyntacticModifier(node, 256 /* Abstract */); if (isAmbient && !(legacyDecorators && hasDecorators(node))) { return void 0; } @@ -89471,6 +90479,35 @@ ${lanes.join("\n")} transformConstructorBody(node.body, node) ); } + function transformConstructorBodyWorker(statementsOut, statementsIn, statementOffset, superPath, superPathDepth, initializerStatements) { + const superStatementIndex = superPath[superPathDepth]; + const superStatement = statementsIn[superStatementIndex]; + addRange(statementsOut, visitNodes2(statementsIn, visitor, isStatement, statementOffset, superStatementIndex - statementOffset)); + if (isTryStatement(superStatement)) { + const tryBlockStatements = []; + transformConstructorBodyWorker( + tryBlockStatements, + superStatement.tryBlock.statements, + /*statementOffset*/ + 0, + superPath, + superPathDepth + 1, + initializerStatements + ); + const tryBlockStatementsArray = factory2.createNodeArray(tryBlockStatements); + setTextRange(tryBlockStatementsArray, superStatement.tryBlock.statements); + statementsOut.push(factory2.updateTryStatement( + superStatement, + factory2.updateBlock(superStatement.tryBlock, tryBlockStatements), + visitNode(superStatement.catchClause, visitor, isCatchClause), + visitNode(superStatement.finallyBlock, visitor, isBlock) + )); + } else { + addRange(statementsOut, visitNodes2(statementsIn, visitor, isStatement, superStatementIndex, 1)); + addRange(statementsOut, initializerStatements); + } + addRange(statementsOut, visitNodes2(statementsIn, visitor, isStatement, superStatementIndex + 1)); + } function transformConstructorBody(body, constructor) { const parametersWithPropertyAssignments = constructor && filter(constructor.parameters, (p) => isParameterPropertyDeclaration(p, constructor)); if (!some(parametersWithPropertyAssignments)) { @@ -89485,25 +90522,22 @@ ${lanes.join("\n")} false, visitor ); - const superStatementIndex = findSuperStatementIndex(body.statements, prologueStatementCount); - if (superStatementIndex >= 0) { - addRange( + const superPath = findSuperStatementIndexPath(body.statements, prologueStatementCount); + const parameterPropertyAssignments = mapDefined(parametersWithPropertyAssignments, transformParameterWithPropertyAssignment); + if (superPath.length) { + transformConstructorBodyWorker( statements, - visitNodes2(body.statements, visitor, isStatement, prologueStatementCount, superStatementIndex + 1 - prologueStatementCount) + body.statements, + prologueStatementCount, + superPath, + /*superPathDepth*/ + 0, + parameterPropertyAssignments ); - } - const parameterPropertyAssignments = mapDefined(parametersWithPropertyAssignments, transformParameterWithPropertyAssignment); - if (superStatementIndex >= 0) { - addRange(statements, parameterPropertyAssignments); } else { - statements = [ - ...statements.slice(0, prologueStatementCount), - ...parameterPropertyAssignments, - ...statements.slice(prologueStatementCount) - ]; + addRange(statements, parameterPropertyAssignments); + addRange(statements, visitNodes2(body.statements, visitor, isStatement, prologueStatementCount)); } - const start = superStatementIndex >= 0 ? superStatementIndex + 1 : prologueStatementCount; - addRange(statements, visitNodes2(body.statements, visitor, isStatement, start)); statements = factory2.mergeLexicalEnvironment(statements, endLexicalEnvironment()); const block = factory2.createBlock( setTextRange(factory2.createNodeArray(statements), body.statements), @@ -89999,7 +91033,7 @@ ${lanes.join("\n")} /*allowSourceMaps*/ true )); - const varFlags = currentLexicalScope.kind === 311 /* SourceFile */ ? 0 /* None */ : 1 /* Let */; + const varFlags = currentLexicalScope.kind === 312 /* SourceFile */ ? 0 /* None */ : 1 /* Let */; const statement = factory2.createVariableStatement( visitNodes2(node.modifiers, modifierVisitor, isModifier), factory2.createVariableDeclarationList([varDecl], varFlags) @@ -90010,7 +91044,7 @@ ${lanes.join("\n")} setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { - if (node.kind === 265 /* EnumDeclaration */) { + if (node.kind === 266 /* EnumDeclaration */) { setSourceMapRange(statement.declarationList, node); } else { setSourceMapRange(statement, node); @@ -90118,7 +91152,7 @@ ${lanes.join("\n")} let statementsLocation; let blockLocation; if (node.body) { - if (node.body.kind === 267 /* ModuleBlock */) { + if (node.body.kind === 268 /* ModuleBlock */) { saveStateAndInvoke(node.body, (body) => addRange(statements, visitNodes2(body.statements, namespaceElementVisitor, isStatement))); statementsLocation = node.body.statements; blockLocation = node.body; @@ -90149,13 +91183,13 @@ ${lanes.join("\n")} true ); setTextRange(block, blockLocation); - if (!node.body || node.body.kind !== 267 /* ModuleBlock */) { + if (!node.body || node.body.kind !== 268 /* ModuleBlock */) { setEmitFlags(block, getEmitFlags(block) | 3072 /* NoComments */); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 266 /* ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 267 /* ModuleDeclaration */) { const recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -90190,7 +91224,7 @@ ${lanes.join("\n")} ) : void 0; } function visitNamedImportBindings(node) { - if (node.kind === 273 /* NamespaceImport */) { + if (node.kind === 274 /* NamespaceImport */) { return shouldEmitAliasDeclaration(node) ? node : void 0; } else { const allowEmpty = compilerOptions.verbatimModuleSyntax || compilerOptions.preserveValueImports && (compilerOptions.importsNotUsedAsValues === 1 /* Preserve */ || compilerOptions.importsNotUsedAsValues === 2 /* Error */); @@ -90388,15 +91422,15 @@ ${lanes.join("\n")} if ((enabledSubstitutions & 2 /* NamespaceExports */) === 0) { enabledSubstitutions |= 2 /* NamespaceExports */; context.enableSubstitution(80 /* Identifier */); - context.enableSubstitution(303 /* ShorthandPropertyAssignment */); - context.enableEmitNotification(266 /* ModuleDeclaration */); + context.enableSubstitution(304 /* ShorthandPropertyAssignment */); + context.enableEmitNotification(267 /* ModuleDeclaration */); } } function isTransformedModuleDeclaration(node) { - return getOriginalNode(node).kind === 266 /* ModuleDeclaration */; + return getOriginalNode(node).kind === 267 /* ModuleDeclaration */; } function isTransformedEnumDeclaration(node) { - return getOriginalNode(node).kind === 265 /* EnumDeclaration */; + return getOriginalNode(node).kind === 266 /* EnumDeclaration */; } function onEmitNode(hint, node, emitCallback) { const savedApplicableSubstitutions = applicableSubstitutions; @@ -90441,9 +91475,9 @@ ${lanes.join("\n")} switch (node.kind) { case 80 /* Identifier */: return substituteExpressionIdentifier(node); - case 210 /* PropertyAccessExpression */: + case 211 /* PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 211 /* ElementAccessExpression */: + case 212 /* ElementAccessExpression */: return substituteElementAccessExpression(node); } return node; @@ -90458,8 +91492,8 @@ ${lanes.join("\n")} /*prefixLocals*/ false ); - if (container && container.kind !== 311 /* SourceFile */) { - const substitute = applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 266 /* ModuleDeclaration */ || applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 265 /* EnumDeclaration */; + if (container && container.kind !== 312 /* SourceFile */) { + const substitute = applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 267 /* ModuleDeclaration */ || applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 266 /* EnumDeclaration */; if (substitute) { return setTextRange( factory2.createPropertyAccessExpression(factory2.getGeneratedNameForNode(container), node), @@ -90484,7 +91518,7 @@ ${lanes.join("\n")} const constantValue = tryGetConstEnumValue(node); if (constantValue !== void 0) { setConstantValue(node, constantValue); - const substitute = typeof constantValue === "string" ? factory2.createStringLiteral(constantValue) : factory2.createNumericLiteral(constantValue); + const substitute = typeof constantValue === "string" ? factory2.createStringLiteral(constantValue) : constantValue < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(Math.abs(constantValue))) : factory2.createNumericLiteral(constantValue); if (!compilerOptions.removeComments) { const originalNode = getOriginalNode(node, isAccessExpression); addSyntheticTrailingComment(substitute, 3 /* MultiLineCommentTrivia */, ` ${safeMultiLineComment(getTextOfNode(originalNode))} `); @@ -90547,8 +91581,9 @@ ${lanes.join("\n")} let pendingStatements; let lexicalEnvironment; const lexicalEnvironmentMap = /* @__PURE__ */ new Map(); + const noSubstitution = /* @__PURE__ */ new Set(); let currentClassContainer; - let currentStaticPropertyDeclarationOrStaticBlock; + let currentClassElement; let shouldSubstituteThisWithClassThis = false; let previousShouldSubstituteThisWithClassThis = false; return chainBundle(context, transformSourceFile); @@ -90580,76 +91615,77 @@ ${lanes.join("\n")} switch (node.kind) { case 129 /* AccessorKeyword */: return Debug.fail("Use `modifierVisitor` instead."); - case 262 /* ClassDeclaration */: + case 263 /* ClassDeclaration */: return visitClassDeclaration(node); - case 230 /* ClassExpression */: - return visitClassExpression( - node, - /*referencedName*/ - void 0 - ); - case 174 /* ClassStaticBlockDeclaration */: - case 171 /* PropertyDeclaration */: + case 231 /* ClassExpression */: + return visitClassExpression(node); + case 175 /* ClassStaticBlockDeclaration */: + case 172 /* PropertyDeclaration */: return Debug.fail("Use `classElementVisitor` instead."); - case 302 /* PropertyAssignment */: + case 303 /* PropertyAssignment */: return visitPropertyAssignment(node); - case 242 /* VariableStatement */: + case 243 /* VariableStatement */: return visitVariableStatement(node); - case 259 /* VariableDeclaration */: + case 260 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 168 /* Parameter */: + case 169 /* Parameter */: return visitParameterDeclaration(node); - case 207 /* BindingElement */: + case 208 /* BindingElement */: return visitBindingElement(node); - case 276 /* ExportAssignment */: + case 277 /* ExportAssignment */: return visitExportAssignment(node); case 81 /* PrivateIdentifier */: return visitPrivateIdentifier(node); - case 210 /* PropertyAccessExpression */: + case 211 /* PropertyAccessExpression */: return visitPropertyAccessExpression(node); - case 211 /* ElementAccessExpression */: + case 212 /* ElementAccessExpression */: return visitElementAccessExpression(node); - case 223 /* PrefixUnaryExpression */: - case 224 /* PostfixUnaryExpression */: + case 224 /* PrefixUnaryExpression */: + case 225 /* PostfixUnaryExpression */: return visitPreOrPostfixUnaryExpression( node, /*discarded*/ false ); - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: return visitBinaryExpression( node, /*discarded*/ false ); - case 216 /* ParenthesizedExpression */: + case 217 /* ParenthesizedExpression */: return visitParenthesizedExpression( node, /*discarded*/ - false, - /*referencedName*/ - void 0 + false ); - case 212 /* CallExpression */: + case 213 /* CallExpression */: return visitCallExpression(node); - case 243 /* ExpressionStatement */: + case 244 /* ExpressionStatement */: return visitExpressionStatement(node); - case 214 /* TaggedTemplateExpression */: + case 215 /* TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 247 /* ForStatement */: + case 248 /* ForStatement */: return visitForStatement(node); - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 175 /* Constructor */: - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: { - return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( - /*current*/ + case 110 /* ThisKeyword */: + return visitThisExpression(node); + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + return setCurrentClassElementAnd( + /*classElement*/ void 0, fallbackVisitor, node ); + case 176 /* Constructor */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: { + return setCurrentClassElementAnd( + node, + fallbackVisitor, + node + ); } default: return fallbackVisitor(node); @@ -90658,56 +91694,32 @@ ${lanes.join("\n")} function fallbackVisitor(node) { return visitEachChild(node, visitor, context); } - function namedEvaluationVisitor(node, referencedName) { - switch (node.kind) { - case 359 /* PartiallyEmittedExpression */: - return visitPartiallyEmittedExpression( - node, - /*discarded*/ - false, - referencedName - ); - case 216 /* ParenthesizedExpression */: - return visitParenthesizedExpression( - node, - /*discarded*/ - false, - referencedName - ); - case 230 /* ClassExpression */: - return visitClassExpression(node, referencedName); - default: - return visitor(node); - } - } function discardedValueVisitor(node) { switch (node.kind) { - case 223 /* PrefixUnaryExpression */: - case 224 /* PostfixUnaryExpression */: + case 224 /* PrefixUnaryExpression */: + case 225 /* PostfixUnaryExpression */: return visitPreOrPostfixUnaryExpression( node, /*discarded*/ true ); - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: return visitBinaryExpression( node, /*discarded*/ true ); - case 360 /* CommaListExpression */: + case 361 /* CommaListExpression */: return visitCommaListExpression( node, /*discarded*/ true ); - case 216 /* ParenthesizedExpression */: + case 217 /* ParenthesizedExpression */: return visitParenthesizedExpression( node, /*discarded*/ - true, - /*referencedName*/ - void 0 + true ); default: return visitor(node); @@ -90715,9 +91727,9 @@ ${lanes.join("\n")} } function heritageClauseVisitor(node) { switch (node.kind) { - case 297 /* HeritageClause */: + case 298 /* HeritageClause */: return visitEachChild(node, heritageClauseVisitor, context); - case 232 /* ExpressionWithTypeArguments */: + case 233 /* ExpressionWithTypeArguments */: return visitExpressionWithTypeArgumentsInHeritageClause(node); default: return visitor(node); @@ -90725,8 +91737,8 @@ ${lanes.join("\n")} } function assignmentTargetVisitor(node) { switch (node.kind) { - case 209 /* ObjectLiteralExpression */: - case 208 /* ArrayLiteralExpression */: + case 210 /* ObjectLiteralExpression */: + case 209 /* ArrayLiteralExpression */: return visitAssignmentPattern(node); default: return visitor(node); @@ -90734,29 +91746,35 @@ ${lanes.join("\n")} } function classElementVisitor(node) { switch (node.kind) { - case 175 /* Constructor */: - return visitConstructorDeclaration(node); - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 173 /* MethodDeclaration */: - return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( - /*current*/ - void 0, + case 176 /* Constructor */: + return setCurrentClassElementAnd( + node, + visitConstructorDeclaration, + node + ); + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 174 /* MethodDeclaration */: + return setCurrentClassElementAnd( + node, visitMethodOrAccessorDeclaration, node ); - case 171 /* PropertyDeclaration */: - return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( - /*current*/ - void 0, + case 172 /* PropertyDeclaration */: + return setCurrentClassElementAnd( + node, visitPropertyDeclaration, node ); - case 174 /* ClassStaticBlockDeclaration */: - return visitClassStaticBlockDeclaration(node); - case 166 /* ComputedPropertyName */: + case 175 /* ClassStaticBlockDeclaration */: + return setCurrentClassElementAnd( + node, + visitClassStaticBlockDeclaration, + node + ); + case 167 /* ComputedPropertyName */: return visitComputedPropertyName(node); - case 239 /* SemicolonClassElement */: + case 240 /* SemicolonClassElement */: return node; default: return isModifierLike(node) ? modifierVisitor(node) : visitor(node); @@ -90764,7 +91782,7 @@ ${lanes.join("\n")} } function propertyNameVisitor(node) { switch (node.kind) { - case 166 /* ComputedPropertyName */: + case 167 /* ComputedPropertyName */: return visitComputedPropertyName(node); default: return visitor(node); @@ -90772,10 +91790,10 @@ ${lanes.join("\n")} } function accessorFieldResultVisitor(node) { switch (node.kind) { - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: return transformFieldInitializer(node); - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: return classElementVisitor(node); default: Debug.assertMissingNode(node, "Expected node to either be a PropertyDeclaration, GetAccessorDeclaration, or SetAccessorDeclaration"); @@ -90804,9 +91822,7 @@ ${lanes.join("\n")} } function visitPropertyAssignment(node) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - const { referencedName, name } = visitReferencedPropertyName(node.name); - const initializer = visitNode(node.initializer, (node2) => namedEvaluationVisitor(node2, referencedName), isExpression); - return factory2.updatePropertyAssignment(node, name, initializer); + node = transformNamedEvaluation(context, node); } return visitEachChild(node, visitor, context); } @@ -90818,71 +91834,33 @@ ${lanes.join("\n")} pendingStatements = savedPendingStatements; return statement; } - function getAssignedNameOfIdentifier(name, initializer) { - const originalClass = getOriginalNode(initializer, isClassLike); - return originalClass && !originalClass.name && hasSyntacticModifier(originalClass, 1024 /* Default */) ? factory2.createStringLiteral("default") : factory2.createStringLiteralFromNode(name); - } function visitVariableDeclaration(node) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - const assignedName = getAssignedNameOfIdentifier(node.name, node.initializer); - const name = visitNode(node.name, visitor, isBindingName); - const initializer = visitNode(node.initializer, (node2) => namedEvaluationVisitor(node2, assignedName), isExpression); - return factory2.updateVariableDeclaration( - node, - name, - /*exclamationToken*/ - void 0, - /*type*/ - void 0, - initializer - ); + node = transformNamedEvaluation(context, node); } return visitEachChild(node, visitor, context); } function visitParameterDeclaration(node) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - const assignedName = getAssignedNameOfIdentifier(node.name, node.initializer); - const name = visitNode(node.name, visitor, isBindingName); - const initializer = visitNode(node.initializer, (node2) => namedEvaluationVisitor(node2, assignedName), isExpression); - return factory2.updateParameterDeclaration( - node, - /*modifiers*/ - void 0, - /*dotDotDotToken*/ - void 0, - name, - /*questionToken*/ - void 0, - /*type*/ - void 0, - initializer - ); + node = transformNamedEvaluation(context, node); } return visitEachChild(node, visitor, context); } function visitBindingElement(node) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - const assignedName = getAssignedNameOfIdentifier(node.name, node.initializer); - const propertyName = visitNode(node.propertyName, visitor, isPropertyName); - const name = visitNode(node.name, visitor, isBindingName); - const initializer = visitNode(node.initializer, (node2) => namedEvaluationVisitor(node2, assignedName), isExpression); - return factory2.updateBindingElement( - node, - /*dotDotDotToken*/ - void 0, - propertyName, - name, - initializer - ); + node = transformNamedEvaluation(context, node); } return visitEachChild(node, visitor, context); } function visitExportAssignment(node) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - const assignedName = factory2.createStringLiteral(node.isExportEquals ? "" : "default"); - const modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifier); - const expression = visitNode(node.expression, (node2) => namedEvaluationVisitor(node2, assignedName), isExpression); - return factory2.updateExportAssignment(node, modifiers, expression); + node = transformNamedEvaluation( + context, + node, + /*ignoreEmptyStringLiteral*/ + true, + node.isExportEquals ? "" : "default" + ); } return visitEachChild(node, visitor, context); } @@ -90947,12 +91925,15 @@ ${lanes.join("\n")} } return void 0; } - function setCurrentStaticPropertyDeclarationOrStaticBlockAnd(current, visitor2, arg) { - const savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = current; - const result = visitor2(arg); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; - return result; + function setCurrentClassElementAnd(classElement, visitor2, arg) { + if (classElement !== currentClassElement) { + const savedCurrentClassElement = currentClassElement; + currentClassElement = classElement; + const result = visitor2(arg); + currentClassElement = savedCurrentClassElement; + return result; + } + return visitor2(arg); } function getHoistedFunctionName(node) { Debug.assert(isPrivateIdentifier(node.name)); @@ -90970,6 +91951,11 @@ ${lanes.join("\n")} } } } + function getClassThis() { + const lex = getClassLexicalEnvironment(); + const classThis = lex.classThis ?? lex.classConstructor ?? (currentClassContainer == null ? void 0 : currentClassContainer.name); + return Debug.checkDefined(classThis); + } function transformAutoAccessor(node) { const commentRange = getCommentRange(node); const sourceMapRange = getSourceMapRange(node); @@ -90996,11 +91982,13 @@ ${lanes.join("\n")} setOriginalNode(backingField, node); setEmitFlags(backingField, 3072 /* NoComments */); setSourceMapRange(backingField, sourceMapRange); - const getter = createAccessorPropertyGetRedirector(factory2, node, modifiers, getterName); + const receiver = isStatic(node) ? getClassThis() : factory2.createThis(); + const getter = createAccessorPropertyGetRedirector(factory2, node, modifiers, getterName, receiver); setOriginalNode(getter, node); setCommentRange(getter, commentRange); setSourceMapRange(getter, sourceMapRange); - const setter = createAccessorPropertySetRedirector(factory2, node, modifiers, setterName); + const setterModifiers = factory2.createModifiersFromModifierFlags(modifiersToFlags(modifiers)); + const setter = createAccessorPropertySetRedirector(factory2, node, setterModifiers, setterName, receiver); setOriginalNode(setter, node); setEmitFlags(setter, 3072 /* NoComments */); setSourceMapRange(setter, sourceMapRange); @@ -91039,17 +92027,7 @@ ${lanes.join("\n")} ); } if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - const { referencedName, name } = visitReferencedPropertyName(node.name); - return factory2.updatePropertyDeclaration( - node, - visitNodes2(node.modifiers, modifierVisitor, isModifier), - name, - /*questionOrExclamationToken*/ - void 0, - /*type*/ - void 0, - visitNode(node.initializer, (child) => namedEvaluationVisitor(child, referencedName), isExpression) - ); + node = transformNamedEvaluation(context, node); } return factory2.updatePropertyDeclaration( node, @@ -91067,9 +92045,7 @@ ${lanes.join("\n")} const expr = getPropertyNameExpressionIfNeeded( node.name, /*shouldHoist*/ - !!node.initializer || useDefineForClassFields, - /*captureReferencedName*/ - isNamedEvaluation(node, isAnonymousClassNeedingAssignedName) + !!node.initializer || useDefineForClassFields ); if (expr) { getPendingExpressions().push(...flattenCommaList(expr)); @@ -91114,8 +92090,21 @@ ${lanes.join("\n")} } return transformFieldInitializer(node); } + function shouldForceDynamicThis() { + return !!currentClassElement && hasStaticModifier(currentClassElement) && isAccessor(currentClassElement) && isAutoAccessorPropertyDeclaration(getOriginalNode(currentClassElement)); + } + function ensureDynamicThisIfNeeded(node) { + if (shouldForceDynamicThis()) { + const innerExpression = skipOuterExpressions(node); + if (innerExpression.kind === 110 /* ThisKeyword */) { + noSubstitution.add(innerExpression); + } + } + } function createPrivateIdentifierAccess(info, receiver) { - return createPrivateIdentifierAccessHelper(info, visitNode(receiver, visitor, isExpression)); + receiver = visitNode(receiver, visitor, isExpression); + ensureDynamicThisIfNeeded(receiver); + return createPrivateIdentifierAccessHelper(info, receiver); } function createPrivateIdentifierAccessHelper(info, receiver) { setCommentRange(receiver, moveRangePos(receiver, -1)); @@ -91160,7 +92149,7 @@ ${lanes.join("\n")} ); } } - if (shouldTransformSuperInStaticInitializers && isSuperProperty(node) && isIdentifier(node.name) && currentStaticPropertyDeclarationOrStaticBlock && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) { + if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node) && isIdentifier(node.name) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) { const { classConstructor, superClassReference, facts } = lexicalEnvironment.data; if (facts & 1 /* ClassWasDecorated */) { return visitInvalidSuperProperty(node); @@ -91179,7 +92168,7 @@ ${lanes.join("\n")} return visitEachChild(node, visitor, context); } function visitElementAccessExpression(node) { - if (shouldTransformSuperInStaticInitializers && isSuperProperty(node) && currentStaticPropertyDeclarationOrStaticBlock && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) { + if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) { const { classConstructor, superClassReference, facts } = lexicalEnvironment.data; if (facts & 1 /* ClassWasDecorated */) { return visitInvalidSuperProperty(node); @@ -91204,6 +92193,7 @@ ${lanes.join("\n")} let info; if (info = accessPrivateIdentifier2(operand.name)) { const receiver = visitNode(operand.expression, visitor, isExpression); + ensureDynamicThisIfNeeded(receiver); const { readExpression, initializeExpression } = createCopiableReceiverExpr(receiver); let expression = createPrivateIdentifierAccess(info, readExpression); const temp = isPrefixUnaryExpression(node) || discarded ? void 0 : factory2.createTempVariable(hoistVariableDeclaration); @@ -91222,7 +92212,7 @@ ${lanes.join("\n")} } return expression; } - } else if (shouldTransformSuperInStaticInitializers && isSuperProperty(operand) && currentStaticPropertyDeclarationOrStaticBlock && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) { + } else if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(operand) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) { const { classConstructor, superClassReference, facts } = lexicalEnvironment.data; if (facts & 1 /* ClassWasDecorated */) { const expression = visitInvalidSuperProperty(operand); @@ -91279,6 +92269,9 @@ ${lanes.join("\n")} } function createCopiableReceiverExpr(receiver) { const clone2 = nodeIsSynthesized(receiver) ? receiver : factory2.cloneNode(receiver); + if (receiver.kind === 110 /* ThisKeyword */ && noSubstitution.has(receiver)) { + noSubstitution.add(clone2); + } if (isSimpleInlineableExpression(receiver)) { return { readExpression: clone2, initializeExpression: void 0 }; } @@ -91309,7 +92302,7 @@ ${lanes.join("\n")} [visitNode(thisArg, visitor, isExpression), ...visitNodes2(node.arguments, visitor, isExpression)] ); } - if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.expression) && currentStaticPropertyDeclarationOrStaticBlock && ((_a = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a.classConstructor)) { + if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node.expression) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && ((_a = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a.classConstructor)) { const invocation = factory2.createFunctionCallCall( visitNode(node.expression, visitor, isExpression), lexicalEnvironment.data.classConstructor, @@ -91338,7 +92331,7 @@ ${lanes.join("\n")} visitNode(node.template, visitor, isTemplateLiteral) ); } - if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.tag) && currentStaticPropertyDeclarationOrStaticBlock && ((_a = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a.classConstructor)) { + if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node.tag) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && ((_a = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a.classConstructor)) { const invocation = factory2.createFunctionBindCall( visitNode(node.tag, visitor, isExpression), lexicalEnvironment.data.classConstructor, @@ -91361,30 +92354,40 @@ ${lanes.join("\n")} lexicalEnvironmentMap.set(getOriginalNode(node), lexicalEnvironment); } if (shouldTransformPrivateElementsOrClassStaticBlocks) { + if (isClassThisAssignmentBlock(node)) { + const result = visitNode(node.body.statements[0].expression, visitor, isExpression); + if (isAssignmentExpression( + result, + /*excludeCompoundAssignment*/ + true + ) && result.left === result.right) { + return void 0; + } + return result; + } + if (isClassNamedEvaluationHelperBlock(node)) { + return visitNode(node.body.statements[0].expression, visitor, isExpression); + } startLexicalEnvironment(); - let statements = setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + let statements = setCurrentClassElementAnd( node, (statements2) => visitNodes2(statements2, visitor, isStatement), node.body.statements ); statements = factory2.mergeLexicalEnvironment(statements, endLexicalEnvironment()); const iife = factory2.createImmediatelyInvokedArrowFunction(statements); + setOriginalNode(skipParentheses(iife.expression), node); + addEmitFlags(skipParentheses(iife.expression), 4 /* AdviseOnEmitNode */); setOriginalNode(iife, node); setTextRange(iife, node); - addEmitFlags(iife, 4 /* AdviseOnEmitNode */); return iife; } } function isAnonymousClassNeedingAssignedName(node) { if (isClassExpression(node) && !node.name) { const staticPropertiesOrClassStaticBlocks = getStaticPropertiesAndClassStaticBlock(node); - const classStaticBlock = find(staticPropertiesOrClassStaticBlocks, isClassStaticBlockDeclaration); - if (classStaticBlock) { - for (const statement of classStaticBlock.body.statements) { - if (isExpressionStatement(statement) && isCallToHelper(statement.expression, "___setFunctionName")) { - return false; - } - } + if (some(staticPropertiesOrClassStaticBlocks, isClassNamedEvaluationHelperBlock)) { + return false; } const hasTransformableStatics = (shouldTransformPrivateElementsOrClassStaticBlocks || !!(getInternalEmitFlags(node) && 32 /* TransformPrivateStaticElements */)) && some(staticPropertiesOrClassStaticBlocks, (node2) => isClassStaticBlockDeclaration(node2) || isPrivateIdentifierClassElementDeclaration(node2) || shouldTransformInitializers && isInitializedProperty(node2)); return hasTransformableStatics; @@ -91407,10 +92410,8 @@ ${lanes.join("\n")} } if (isAssignmentExpression(node)) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - const assignedName = getAssignedNameOfIdentifier(node.left, node.right); - const left2 = visitNode(node.left, visitor, isExpression); - const right = visitNode(node.right, (node2) => namedEvaluationVisitor(node2, assignedName), isExpression); - return factory2.updateBinaryExpression(node, left2, node.operatorToken, right); + node = transformNamedEvaluation(context, node); + Debug.assertNode(node, isAssignmentExpression); } const left = skipOuterExpressions(node.left, 8 /* PartiallyEmittedExpressions */ | 1 /* Parentheses */); if (isPrivateIdentifierPropertyAccessExpression(left)) { @@ -91424,7 +92425,7 @@ ${lanes.join("\n")} node ); } - } else if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.left) && currentStaticPropertyDeclarationOrStaticBlock && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) { + } else if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node.left) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) { const { classConstructor, superClassReference, facts } = lexicalEnvironment.data; if (facts & 1 /* ClassWasDecorated */) { return factory2.updateBinaryExpression( @@ -91489,36 +92490,15 @@ ${lanes.join("\n")} const elements = discarded ? visitCommaListElements(node.elements, discardedValueVisitor) : visitCommaListElements(node.elements, visitor, discardedValueVisitor); return factory2.updateCommaListExpression(node, elements); } - function visitParenthesizedExpression(node, discarded, referencedName) { - const visitorFunc = discarded ? discardedValueVisitor : referencedName ? (node2) => namedEvaluationVisitor(node2, referencedName) : visitor; + function visitParenthesizedExpression(node, discarded) { + const visitorFunc = discarded ? discardedValueVisitor : visitor; const expression = visitNode(node.expression, visitorFunc, isExpression); return factory2.updateParenthesizedExpression(node, expression); } - function visitPartiallyEmittedExpression(node, discarded, referencedName) { - const visitorFunc = discarded ? discardedValueVisitor : referencedName ? (node2) => namedEvaluationVisitor(node2, referencedName) : visitor; - const expression = visitNode(node.expression, visitorFunc, isExpression); - return factory2.updatePartiallyEmittedExpression(node, expression); - } - function visitReferencedPropertyName(node) { - if (isPropertyNameLiteral(node) || isPrivateIdentifier(node)) { - const referencedName2 = factory2.createStringLiteralFromNode(node); - const name2 = visitNode(node, visitor, isPropertyName); - return { referencedName: referencedName2, name: name2 }; - } - if (isPropertyNameLiteral(node.expression) && !isIdentifier(node.expression)) { - const referencedName2 = factory2.createStringLiteralFromNode(node.expression); - const name2 = visitNode(node, visitor, isPropertyName); - return { referencedName: referencedName2, name: name2 }; - } - const referencedName = factory2.createTempVariable(hoistVariableDeclaration); - const key = emitHelpers().createPropKeyHelper(visitNode(node.expression, visitor, isExpression)); - const assignment = factory2.createAssignment(referencedName, key); - const name = factory2.updateComputedPropertyName(node, injectPendingExpressions(assignment)); - return { referencedName, name }; - } function createPrivateIdentifierAssignment(info, receiver, right, operator) { receiver = visitNode(receiver, visitor, isExpression); right = visitNode(right, visitor, isExpression); + ensureDynamicThisIfNeeded(receiver); if (isCompoundAssignment(operator)) { const { readExpression, initializeExpression } = createCopiableReceiverExpr(receiver); receiver = initializeExpression || readExpression; @@ -91565,11 +92545,15 @@ ${lanes.join("\n")} return filter(node.members, isNonStaticMethodOrAccessorWithPrivateName); } function getClassFacts(node) { + var _a; let facts = 0 /* None */; const original = getOriginalNode(node); if (isClassDeclaration(original) && classOrConstructorParameterIsDecorated(legacyDecorators, original)) { facts |= 1 /* ClassWasDecorated */; } + if (shouldTransformPrivateElementsOrClassStaticBlocks && (classHasClassThisAssignment(node) || classHasExplicitlyAssignedName(node))) { + facts |= 2 /* NeedsClassConstructorReference */; + } let containsPublicInstanceFields = false; let containsInitializedPublicInstanceFields = false; let containsInstancePrivateElements = false; @@ -91578,6 +92562,8 @@ ${lanes.join("\n")} if (isStatic(member)) { if (member.name && (isPrivateIdentifier(member.name) || isAutoAccessorPropertyDeclaration(member)) && shouldTransformPrivateElementsOrClassStaticBlocks) { facts |= 2 /* NeedsClassConstructorReference */; + } else if (isAutoAccessorPropertyDeclaration(member) && shouldTransformAutoAccessors === -1 /* True */ && !node.name && !((_a = node.emitNode) == null ? void 0 : _a.classThis)) { + facts |= 2 /* NeedsClassConstructorReference */; } if (isPropertyDeclaration(member) || isClassStaticBlockDeclaration(member)) { if (shouldTransformThisInStaticInitializers && member.transformFlags & 16384 /* ContainsLexicalThis */) { @@ -91598,6 +92584,9 @@ ${lanes.join("\n")} containsInstancePrivateElements || (containsInstancePrivateElements = isPrivateIdentifierClassElementDeclaration(member)); } else if (isPrivateIdentifierClassElementDeclaration(member)) { containsInstancePrivateElements = true; + if (resolver.getNodeCheckFlags(member) & 262144 /* ContainsConstructorReference */) { + facts |= 2 /* NeedsClassConstructorReference */; + } } else if (isPropertyDeclaration(member)) { containsPublicInstanceFields = true; containsInitializedPublicInstanceFields || (containsInitializedPublicInstanceFields = !!member.initializer); @@ -91632,7 +92621,8 @@ ${lanes.join("\n")} } return visitEachChild(node, visitor, context); } - function visitInNewClassLexicalEnvironment(node, referencedName, visitor2) { + function visitInNewClassLexicalEnvironment(node, visitor2) { + var _a; const savedCurrentClassContainer = currentClassContainer; const savedPendingExpressions = pendingExpressions; const savedLexicalEnvironment = lexicalEnvironment; @@ -91644,6 +92634,15 @@ ${lanes.join("\n")} const name = getNameOfDeclaration(node); if (name && isIdentifier(name)) { getPrivateIdentifierEnvironment().data.className = name; + } else if ((_a = node.emitNode) == null ? void 0 : _a.assignedName) { + if (isStringLiteral(node.emitNode.assignedName)) { + if (node.emitNode.assignedName.textSourceNode && isIdentifier(node.emitNode.assignedName.textSourceNode)) { + getPrivateIdentifierEnvironment().data.className = node.emitNode.assignedName.textSourceNode; + } else if (isIdentifierText(node.emitNode.assignedName.text, languageVersion)) { + const prefixName = factory2.createIdentifier(node.emitNode.assignedName.text); + getPrivateIdentifierEnvironment().data.className = prefixName; + } + } } } if (shouldTransformPrivateElementsOrClassStaticBlocks) { @@ -91662,7 +92661,7 @@ ${lanes.join("\n")} if (facts & 8 /* NeedsSubstitutionForThisInClassStaticField */) { enableSubstitutionForClassStaticThisOrSuperReference(); } - const result = visitor2(node, facts, referencedName); + const result = visitor2(node, facts); endClassLexicalEnvironment(); Debug.assert(lexicalEnvironment === savedLexicalEnvironment); currentClassContainer = savedCurrentClassContainer; @@ -91670,12 +92669,7 @@ ${lanes.join("\n")} return result; } function visitClassDeclaration(node) { - return visitInNewClassLexicalEnvironment( - node, - /*referencedName*/ - void 0, - visitClassDeclarationInNewClassLexicalEnvironment - ); + return visitInNewClassLexicalEnvironment(node, visitClassDeclarationInNewClassLexicalEnvironment); } function visitClassDeclarationInNewClassLexicalEnvironment(node, facts) { var _a, _b; @@ -91693,10 +92687,11 @@ ${lanes.join("\n")} getClassLexicalEnvironment().classConstructor = factory2.cloneNode(temp); pendingClassReferenceAssignment = factory2.createAssignment(temp, factory2.getInternalName(node)); } - if ((_b = node.emitNode) == null ? void 0 : _b.classThis) { - getClassLexicalEnvironment().classThis = node.emitNode.classThis; - } } + if ((_b = node.emitNode) == null ? void 0 : _b.classThis) { + getClassLexicalEnvironment().classThis = node.emitNode.classThis; + } + const isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 262144 /* ContainsConstructorReference */; const isExport = hasSyntacticModifier(node, 1 /* Export */); const isDefault = hasSyntacticModifier(node, 1024 /* Default */); let modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifier); @@ -91731,6 +92726,11 @@ ${lanes.join("\n")} ) )); } + const alias = getClassLexicalEnvironment().classConstructor; + if (isClassWithConstructorReference && alias) { + enableSubstitutionForClassAliases(); + classAliases[getOriginalNodeId(node)] = alias; + } const classDecl = factory2.updateClassDeclaration( node, modifiers, @@ -91746,24 +92746,27 @@ ${lanes.join("\n")} } return statements; } - function visitClassExpression(node, referencedName) { - return visitInNewClassLexicalEnvironment(node, referencedName, visitClassExpressionInNewClassLexicalEnvironment); + function visitClassExpression(node) { + return visitInNewClassLexicalEnvironment(node, visitClassExpressionInNewClassLexicalEnvironment); } - function visitClassExpressionInNewClassLexicalEnvironment(node, facts, referencedName) { - var _a, _b, _c, _d; + function visitClassExpressionInNewClassLexicalEnvironment(node, facts) { + var _a, _b, _c; const isDecoratedClassDeclaration = !!(facts & 1 /* ClassWasDecorated */); const staticPropertiesOrClassStaticBlocks = getStaticPropertiesAndClassStaticBlock(node); - const isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 1048576 /* ClassWithConstructorReference */; + const classCheckFlags = resolver.getNodeCheckFlags(node); + const isClassWithConstructorReference = classCheckFlags & 262144 /* ContainsConstructorReference */; let temp; function createClassTempVar() { var _a2; if (shouldTransformPrivateElementsOrClassStaticBlocks && ((_a2 = node.emitNode) == null ? void 0 : _a2.classThis)) { return getClassLexicalEnvironment().classConstructor = node.emitNode.classThis; } - const classCheckFlags = resolver.getNodeCheckFlags(node); - const isClassWithConstructorReference2 = classCheckFlags & 1048576 /* ClassWithConstructorReference */; const requiresBlockScopedVar = classCheckFlags & 32768 /* BlockScopedBindingInLoop */; - const temp2 = factory2.createTempVariable(requiresBlockScopedVar ? addBlockScopedVariable : hoistVariableDeclaration, !!isClassWithConstructorReference2); + const temp2 = factory2.createTempVariable( + requiresBlockScopedVar ? addBlockScopedVariable : hoistVariableDeclaration, + /*reservedInNestedScopes*/ + true + ); getClassLexicalEnvironment().classConstructor = factory2.cloneNode(temp2); return temp2; } @@ -91776,7 +92779,7 @@ ${lanes.join("\n")} const modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifier); const heritageClauses = visitNodes2(node.heritageClauses, heritageClauseVisitor, isHeritageClause); const { members, prologue } = transformClassMembers(node); - let classExpression = factory2.updateClassExpression( + const classExpression = factory2.updateClassExpression( node, modifiers, node.name, @@ -91790,41 +92793,18 @@ ${lanes.join("\n")} expressions.push(prologue); } const hasTransformableStatics = (shouldTransformPrivateElementsOrClassStaticBlocks || getInternalEmitFlags(node) & 32 /* TransformPrivateStaticElements */) && some(staticPropertiesOrClassStaticBlocks, (node2) => isClassStaticBlockDeclaration(node2) || isPrivateIdentifierClassElementDeclaration(node2) || shouldTransformInitializers && isInitializedProperty(node2)); - if (hasTransformableStatics || some(pendingExpressions) || referencedName) { + if (hasTransformableStatics || some(pendingExpressions)) { if (isDecoratedClassDeclaration) { Debug.assertIsDefined(pendingStatements, "Decorated classes transformed by TypeScript are expected to be within a variable declaration."); if (some(pendingExpressions)) { addRange(pendingStatements, map(pendingExpressions, factory2.createExpressionStatement)); } - if (referencedName) { - if (shouldTransformPrivateElementsOrClassStaticBlocks) { - const setNameExpression = emitHelpers().createSetFunctionNameHelper(temp ?? ((_b = node.emitNode) == null ? void 0 : _b.classThis) ?? factory2.getInternalName(node), referencedName); - pendingStatements.push(factory2.createExpressionStatement(setNameExpression)); - } else { - const setNameExpression = emitHelpers().createSetFunctionNameHelper(factory2.createThis(), referencedName); - classExpression = factory2.updateClassExpression( - classExpression, - classExpression.modifiers, - classExpression.name, - classExpression.typeParameters, - classExpression.heritageClauses, - [ - factory2.createClassStaticBlockDeclaration( - factory2.createBlock([ - factory2.createExpressionStatement(setNameExpression) - ]) - ), - ...classExpression.members - ] - ); - } - } if (some(staticPropertiesOrClassStaticBlocks)) { - addPropertyOrClassStaticBlockStatements(pendingStatements, staticPropertiesOrClassStaticBlocks, ((_c = node.emitNode) == null ? void 0 : _c.classThis) ?? factory2.getInternalName(node)); + addPropertyOrClassStaticBlockStatements(pendingStatements, staticPropertiesOrClassStaticBlocks, ((_b = node.emitNode) == null ? void 0 : _b.classThis) ?? factory2.getInternalName(node)); } if (temp) { expressions.push(factory2.createAssignment(temp, classExpression)); - } else if (shouldTransformPrivateElementsOrClassStaticBlocks && ((_d = node.emitNode) == null ? void 0 : _d.classThis)) { + } else if (shouldTransformPrivateElementsOrClassStaticBlocks && ((_c = node.emitNode) == null ? void 0 : _c.classThis)) { expressions.push(factory2.createAssignment(node.emitNode.classThis, classExpression)); } else { expressions.push(classExpression); @@ -91839,9 +92819,6 @@ ${lanes.join("\n")} } expressions.push(factory2.createAssignment(temp, classExpression)); addRange(expressions, pendingExpressions); - if (referencedName) { - expressions.push(emitHelpers().createSetFunctionNameHelper(temp, referencedName)); - } addRange(expressions, generateInitializedPropertyExpressionsOrClassStaticBlock(staticPropertiesOrClassStaticBlocks, temp)); expressions.push(factory2.cloneNode(temp)); } @@ -91860,6 +92837,13 @@ ${lanes.join("\n")} } return void 0; } + function visitThisExpression(node) { + if (shouldTransformThisInStaticInitializers && currentClassElement && isClassStaticBlockDeclaration(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) { + const { classThis, classConstructor } = lexicalEnvironment.data; + return classThis ?? classConstructor ?? node; + } + return node; + } function transformClassMembers(node) { const shouldTransformPrivateStaticElementsInClass = !!(getInternalEmitFlags(node) & 32 /* TransformPrivateStaticElements */); if (shouldTransformPrivateElementsOrClassStaticBlocks || shouldTransformPrivateStaticElementsInFile) { @@ -91939,9 +92923,14 @@ ${lanes.join("\n")} } if (syntheticConstructor || syntheticStaticBlock) { let membersArray; + const classThisAssignmentBlock = find(members, isClassThisAssignmentBlock); + const classNamedEvaluationHelperBlock = find(members, isClassNamedEvaluationHelperBlock); + membersArray = append(membersArray, classThisAssignmentBlock); + membersArray = append(membersArray, classNamedEvaluationHelperBlock); membersArray = append(membersArray, syntheticConstructor); membersArray = append(membersArray, syntheticStaticBlock); - membersArray = addRange(membersArray, members); + const remainingMembers = classThisAssignmentBlock || classNamedEvaluationHelperBlock ? filter(members, (member) => member !== classThisAssignmentBlock && member !== classNamedEvaluationHelperBlock) : members; + membersArray = addRange(membersArray, remainingMembers); members = setTextRange( factory2.createNodeArray(membersArray), /*location*/ @@ -92002,8 +92991,46 @@ ${lanes.join("\n")} ) ); } + function transformConstructorBodyWorker(statementsOut, statementsIn, statementOffset, superPath, superPathDepth, initializerStatements, constructor) { + const superStatementIndex = superPath[superPathDepth]; + const superStatement = statementsIn[superStatementIndex]; + addRange(statementsOut, visitNodes2(statementsIn, visitor, isStatement, statementOffset, superStatementIndex - statementOffset)); + statementOffset = superStatementIndex + 1; + if (isTryStatement(superStatement)) { + const tryBlockStatements = []; + transformConstructorBodyWorker( + tryBlockStatements, + superStatement.tryBlock.statements, + /*statementOffset*/ + 0, + superPath, + superPathDepth + 1, + initializerStatements, + constructor + ); + const tryBlockStatementsArray = factory2.createNodeArray(tryBlockStatements); + setTextRange(tryBlockStatementsArray, superStatement.tryBlock.statements); + statementsOut.push(factory2.updateTryStatement( + superStatement, + factory2.updateBlock(superStatement.tryBlock, tryBlockStatements), + visitNode(superStatement.catchClause, visitor, isCatchClause), + visitNode(superStatement.finallyBlock, visitor, isBlock) + )); + } else { + addRange(statementsOut, visitNodes2(statementsIn, visitor, isStatement, superStatementIndex, 1)); + while (statementOffset < statementsIn.length) { + const statement = statementsIn[statementOffset]; + if (isParameterPropertyDeclaration(getOriginalNode(statement), constructor)) { + statementOffset++; + } else { + break; + } + } + addRange(statementsOut, initializerStatements); + } + addRange(statementsOut, visitNodes2(statementsIn, visitor, isStatement, statementOffset)); + } function transformConstructorBody(node, constructor, isDerivedClass) { - var _a; const instanceProperties = getProperties( node, /*requireInitializer*/ @@ -92027,68 +93054,65 @@ ${lanes.join("\n")} } resumeLexicalEnvironment(); const needsSyntheticConstructor = !constructor && isDerivedClass; - let indexOfFirstStatementAfterSuperAndPrologue = 0; - let prologueStatementCount = 0; - let superStatementIndex = -1; + let statementOffset = 0; let statements = []; - if ((_a = constructor == null ? void 0 : constructor.body) == null ? void 0 : _a.statements) { - prologueStatementCount = factory2.copyPrologue( + const initializerStatements = []; + const receiver = factory2.createThis(); + addInstanceMethodStatements(initializerStatements, privateMethodsAndAccessors, receiver); + if (constructor) { + const parameterProperties = filter(instanceProperties, (prop) => isParameterPropertyDeclaration(getOriginalNode(prop), constructor)); + const nonParameterProperties = filter(properties, (prop) => !isParameterPropertyDeclaration(getOriginalNode(prop), constructor)); + addPropertyOrClassStaticBlockStatements(initializerStatements, parameterProperties, receiver); + addPropertyOrClassStaticBlockStatements(initializerStatements, nonParameterProperties, receiver); + } else { + addPropertyOrClassStaticBlockStatements(initializerStatements, properties, receiver); + } + if (constructor == null ? void 0 : constructor.body) { + statementOffset = factory2.copyPrologue( constructor.body.statements, statements, /*ensureUseStrict*/ false, visitor ); - superStatementIndex = findSuperStatementIndex(constructor.body.statements, prologueStatementCount); - if (superStatementIndex >= 0) { - indexOfFirstStatementAfterSuperAndPrologue = superStatementIndex + 1; - statements = [ - ...statements.slice(0, prologueStatementCount), - ...visitNodes2(constructor.body.statements, visitor, isStatement, prologueStatementCount, indexOfFirstStatementAfterSuperAndPrologue - prologueStatementCount), - ...statements.slice(prologueStatementCount) - ]; - } else if (prologueStatementCount >= 0) { - indexOfFirstStatementAfterSuperAndPrologue = prologueStatementCount; - } - } - if (needsSyntheticConstructor) { - statements.push( - factory2.createExpressionStatement( - factory2.createCallExpression( - factory2.createSuper(), - /*typeArguments*/ - void 0, - [factory2.createSpreadElement(factory2.createIdentifier("arguments"))] - ) - ) - ); - } - let parameterPropertyDeclarationCount = 0; - if (constructor == null ? void 0 : constructor.body) { - for (let i = indexOfFirstStatementAfterSuperAndPrologue; i < constructor.body.statements.length; i++) { - const statement = constructor.body.statements[i]; - if (isParameterPropertyDeclaration(getOriginalNode(statement), constructor)) { - parameterPropertyDeclarationCount++; - } else { - break; + const superStatementIndices = findSuperStatementIndexPath(constructor.body.statements, statementOffset); + if (superStatementIndices.length) { + transformConstructorBodyWorker( + statements, + constructor.body.statements, + statementOffset, + superStatementIndices, + /*superPathDepth*/ + 0, + initializerStatements, + constructor + ); + } else { + while (statementOffset < constructor.body.statements.length) { + const statement = constructor.body.statements[statementOffset]; + if (isParameterPropertyDeclaration(getOriginalNode(statement), constructor)) { + statementOffset++; + } else { + break; + } } + addRange(statements, initializerStatements); + addRange(statements, visitNodes2(constructor.body.statements, visitor, isStatement, statementOffset)); } - if (parameterPropertyDeclarationCount > 0) { - indexOfFirstStatementAfterSuperAndPrologue += parameterPropertyDeclarationCount; - } - } - const receiver = factory2.createThis(); - addInstanceMethodStatements(statements, privateMethodsAndAccessors, receiver); - if (constructor) { - const parameterProperties = filter(instanceProperties, (prop) => isParameterPropertyDeclaration(getOriginalNode(prop), constructor)); - const nonParameterProperties = filter(properties, (prop) => !isParameterPropertyDeclaration(getOriginalNode(prop), constructor)); - addPropertyOrClassStaticBlockStatements(statements, parameterProperties, receiver); - addPropertyOrClassStaticBlockStatements(statements, nonParameterProperties, receiver); } else { - addPropertyOrClassStaticBlockStatements(statements, properties, receiver); - } - if (constructor) { - addRange(statements, visitNodes2(constructor.body.statements, visitor, isStatement, indexOfFirstStatementAfterSuperAndPrologue)); + if (needsSyntheticConstructor) { + statements.push( + factory2.createExpressionStatement( + factory2.createCallExpression( + factory2.createSuper(), + /*typeArguments*/ + void 0, + [factory2.createSpreadElement(factory2.createIdentifier("arguments"))] + ) + ) + ); + } + addRange(statements, initializerStatements); } statements = factory2.mergeLexicalEnvironment(statements, endLexicalEnvironment()); if (statements.length === 0 && !constructor) { @@ -92121,7 +93145,7 @@ ${lanes.join("\n")} } } function transformPropertyOrClassStaticBlock(property, receiver) { - const expression = isClassStaticBlockDeclaration(property) ? transformClassStaticBlockDeclaration(property) : transformProperty(property, receiver); + const expression = isClassStaticBlockDeclaration(property) ? setCurrentClassElementAnd(property, transformClassStaticBlockDeclaration, property) : transformProperty(property, receiver); if (!expression) { return void 0; } @@ -92146,7 +93170,12 @@ ${lanes.join("\n")} function generateInitializedPropertyExpressionsOrClassStaticBlock(propertiesOrClassStaticBlocks, receiver) { const expressions = []; for (const property of propertiesOrClassStaticBlocks) { - const expression = isClassStaticBlockDeclaration(property) ? transformClassStaticBlockDeclaration(property) : transformProperty(property, receiver); + const expression = isClassStaticBlockDeclaration(property) ? setCurrentClassElementAnd(property, transformClassStaticBlockDeclaration, property) : setCurrentClassElementAnd( + property, + () => transformProperty(property, receiver), + /*arg*/ + void 0 + ); if (!expression) { continue; } @@ -92161,7 +93190,7 @@ ${lanes.join("\n")} } function transformProperty(property, receiver) { var _a; - const savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; + const savedCurrentClassElement = currentClassElement; const transformed = transformPropertyWorker(property, receiver); if (transformed && hasStaticModifier(property) && ((_a = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a.facts)) { setOriginalNode(transformed, property); @@ -92169,26 +93198,18 @@ ${lanes.join("\n")} setSourceMapRange(transformed, getSourceMapRange(property.name)); lexicalEnvironmentMap.set(getOriginalNode(property), lexicalEnvironment); } - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; + currentClassElement = savedCurrentClassElement; return transformed; } function transformPropertyWorker(property, receiver) { const emitAssignment = !useDefineForClassFields; - let referencedName; if (isNamedEvaluation(property, isAnonymousClassNeedingAssignedName)) { - if (isPropertyNameLiteral(property.name) || isPrivateIdentifier(property.name)) { - referencedName = factory2.createStringLiteralFromNode(property.name); - } else if (isPropertyNameLiteral(property.name.expression) && !isIdentifier(property.name.expression)) { - referencedName = factory2.createStringLiteralFromNode(property.name.expression); - } else { - referencedName = factory2.getGeneratedNameForNode(property.name); - } + property = transformNamedEvaluation(context, property); } const propertyName = hasAccessorModifier(property) ? factory2.getGeneratedPrivateNameForNode(property.name) : isComputedPropertyName(property.name) && !isSimpleInlineableExpression(property.name.expression) ? factory2.updateComputedPropertyName(property.name, factory2.getGeneratedNameForNode(property.name)) : property.name; if (hasStaticModifier(property)) { - currentStaticPropertyDeclarationOrStaticBlock = property; + currentClassElement = property; } - const initializerVisitor = referencedName ? (child) => namedEvaluationVisitor(child, referencedName) : visitor; if (isPrivateIdentifier(propertyName) && shouldTransformClassElementToWeakMap(property)) { const privateIdentifierInfo = accessPrivateIdentifier2(propertyName); if (privateIdentifierInfo) { @@ -92197,14 +93218,14 @@ ${lanes.join("\n")} return createPrivateInstanceFieldInitializer( factory2, receiver, - visitNode(property.initializer, initializerVisitor, isExpression), + visitNode(property.initializer, visitor, isExpression), privateIdentifierInfo.brandCheckIdentifier ); } else { return createPrivateStaticFieldInitializer( factory2, privateIdentifierInfo.variableName, - visitNode(property.initializer, initializerVisitor, isExpression) + visitNode(property.initializer, visitor, isExpression) ); } } else { @@ -92221,7 +93242,7 @@ ${lanes.join("\n")} if (hasSyntacticModifier(propertyOriginalNode, 256 /* Abstract */)) { return void 0; } - let initializer = visitNode(property.initializer, initializerVisitor, isExpression); + let initializer = visitNode(property.initializer, visitor, isExpression); if (isParameterPropertyDeclaration(propertyOriginalNode, propertyOriginalNode.parent) && isIdentifier(propertyName)) { const localName = factory2.cloneNode(propertyName); if (initializer) { @@ -92266,14 +93287,14 @@ ${lanes.join("\n")} if ((enabledSubstitutions & 2 /* ClassStaticThisOrSuperReference */) === 0) { enabledSubstitutions |= 2 /* ClassStaticThisOrSuperReference */; context.enableSubstitution(110 /* ThisKeyword */); - context.enableEmitNotification(261 /* FunctionDeclaration */); - context.enableEmitNotification(217 /* FunctionExpression */); - context.enableEmitNotification(175 /* Constructor */); - context.enableEmitNotification(176 /* GetAccessor */); - context.enableEmitNotification(177 /* SetAccessor */); - context.enableEmitNotification(173 /* MethodDeclaration */); - context.enableEmitNotification(171 /* PropertyDeclaration */); - context.enableEmitNotification(166 /* ComputedPropertyName */); + context.enableEmitNotification(262 /* FunctionDeclaration */); + context.enableEmitNotification(218 /* FunctionExpression */); + context.enableEmitNotification(176 /* Constructor */); + context.enableEmitNotification(177 /* GetAccessor */); + context.enableEmitNotification(178 /* SetAccessor */); + context.enableEmitNotification(174 /* MethodDeclaration */); + context.enableEmitNotification(172 /* PropertyDeclaration */); + context.enableEmitNotification(167 /* ComputedPropertyName */); } } function addInstanceMethodStatements(statements, methods, receiver) { @@ -92299,10 +93320,10 @@ ${lanes.join("\n")} visitNode(node.argumentExpression, visitor, isExpression) ); } - function getPropertyNameExpressionIfNeeded(name, shouldHoist, captureReferencedName) { + function getPropertyNameExpressionIfNeeded(name, shouldHoist) { if (isComputedPropertyName(name)) { const cacheAssignment = findComputedPropertyNameCacheAssignment(name); - let expression = visitNode(name.expression, visitor, isExpression); + const expression = visitNode(name.expression, visitor, isExpression); const innerExpression = skipPartiallyEmittedExpressions(expression); const inlinable = isSimpleInlineableExpression(innerExpression); const alreadyTransformed = !!cacheAssignment || isAssignmentExpression(innerExpression) && isGeneratedIdentifier(innerExpression.left); @@ -92313,9 +93334,6 @@ ${lanes.join("\n")} } else { hoistVariableDeclaration(generatedName); } - if (captureReferencedName) { - expression = emitHelpers().createPropKeyHelper(expression); - } return factory2.createAssignment(generatedName, expression); } return inlinable || isIdentifier(innerExpression) ? void 0 : expression; @@ -92511,7 +93529,7 @@ ${lanes.join("\n")} } if (isPrivateIdentifierPropertyAccessExpression(node)) { return wrapPrivateIdentifierForDestructuringTarget(node); - } else if (shouldTransformSuperInStaticInitializers && isSuperProperty(node) && currentStaticPropertyDeclarationOrStaticBlock && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) { + } else if (shouldTransformSuperInStaticInitializers && currentClassElement && isSuperProperty(node) && isStaticPropertyDeclarationOrClassStaticBlock(currentClassElement) && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) { const { classConstructor, superClassReference, facts } = lexicalEnvironment.data; if (facts & 1 /* ClassWasDecorated */) { return visitInvalidSuperProperty(node); @@ -92538,10 +93556,7 @@ ${lanes.join("\n")} } function visitAssignmentElement(node) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - const left = visitDestructuringAssignmentTarget(node.left); - const assignedName = getAssignedNameOfIdentifier(node.left, node.right); - const right = visitNode(node.right, (node2) => namedEvaluationVisitor(node2, assignedName), isExpression); - return factory2.updateBinaryExpression(node, left, node.operatorToken, right); + node = transformNamedEvaluation(context, node); } if (isAssignmentExpression( node, @@ -92588,9 +93603,7 @@ ${lanes.join("\n")} } function visitShorthandAssignmentProperty(node) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - const assignedName = getAssignedNameOfIdentifier(node.name, node.objectAssignmentInitializer); - const objectAssignmentInitializer = visitNode(node.objectAssignmentInitializer, (node2) => namedEvaluationVisitor(node2, assignedName), isExpression); - return factory2.updateShorthandPropertyAssignment(node, node.name, objectAssignmentInitializer); + node = transformNamedEvaluation(context, node); } return visitEachChild(node, visitor, context); } @@ -92640,16 +93653,16 @@ ${lanes.join("\n")} return; } switch (node.kind) { - case 217 /* FunctionExpression */: + case 218 /* FunctionExpression */: if (isArrowFunction(original) || getEmitFlags(node) & 524288 /* AsyncFunctionBody */) { break; } - case 261 /* FunctionDeclaration */: - case 175 /* Constructor */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 173 /* MethodDeclaration */: - case 171 /* PropertyDeclaration */: { + case 262 /* FunctionDeclaration */: + case 176 /* Constructor */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 174 /* MethodDeclaration */: + case 172 /* PropertyDeclaration */: { const savedLexicalEnvironment = lexicalEnvironment; const savedPreviousShouldSubstituteThisWithClassThis = previousShouldSubstituteThisWithClassThis; lexicalEnvironment = void 0; @@ -92661,7 +93674,7 @@ ${lanes.join("\n")} lexicalEnvironment = savedLexicalEnvironment; return; } - case 166 /* ComputedPropertyName */: { + case 167 /* ComputedPropertyName */: { const savedLexicalEnvironment = lexicalEnvironment; const savedShouldSubstituteThisWithClassThis = shouldSubstituteThisWithClassThis; lexicalEnvironment = lexicalEnvironment == null ? void 0 : lexicalEnvironment.previous; @@ -92691,11 +93704,8 @@ ${lanes.join("\n")} return node; } function substituteThisExpression(node) { - if (enabledSubstitutions & 2 /* ClassStaticThisOrSuperReference */ && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data)) { + if (enabledSubstitutions & 2 /* ClassStaticThisOrSuperReference */ && (lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) && !noSubstitution.has(node)) { const { facts, classConstructor, classThis } = lexicalEnvironment.data; - if (facts & 1 /* ClassWasDecorated */ && legacyDecorators) { - return factory2.createParenthesizedExpression(factory2.createVoidZero()); - } const substituteThis = shouldSubstituteThisWithClassThis ? classThis ?? classConstructor : classConstructor; if (substituteThis) { return setTextRange( @@ -92706,6 +93716,9 @@ ${lanes.join("\n")} node ); } + if (facts & 1 /* ClassWasDecorated */ && legacyDecorators) { + return factory2.createParenthesizedExpression(factory2.createVoidZero()); + } } return node; } @@ -92714,7 +93727,7 @@ ${lanes.join("\n")} } function trySubstituteClassAlias(node) { if (enabledSubstitutions & 1 /* ClassAliases */) { - if (resolver.getNodeCheckFlags(node) & 2097152 /* ConstructorReferenceInClass */) { + if (resolver.getNodeCheckFlags(node) & 536870912 /* ConstructorReference */) { const declaration = resolver.getReferencedValueDeclaration(node); if (declaration) { const classAlias = classAliases[declaration.id]; @@ -92760,6 +93773,12 @@ ${lanes.join("\n")} function isPrivateIdentifierInExpression(node) { return isPrivateIdentifier(node.left) && node.operatorToken.kind === 103 /* InKeyword */; } + function isStaticPropertyDeclaration2(node) { + return isPropertyDeclaration(node) && hasStaticModifier(node); + } + function isStaticPropertyDeclarationOrClassStaticBlock(node) { + return isClassStaticBlockDeclaration(node) || isStaticPropertyDeclaration2(node); + } var init_classFields = __esm({ "src/compiler/transformers/classFields.ts"() { "use strict"; @@ -92801,15 +93820,15 @@ ${lanes.join("\n")} } function serializeTypeOfNode(node) { switch (node.kind) { - case 171 /* PropertyDeclaration */: - case 168 /* Parameter */: + case 172 /* PropertyDeclaration */: + case 169 /* Parameter */: return serializeTypeNode(node.type); - case 177 /* SetAccessor */: - case 176 /* GetAccessor */: + case 178 /* SetAccessor */: + case 177 /* GetAccessor */: return serializeTypeNode(getAccessorTypeNode(node)); - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: - case 173 /* MethodDeclaration */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: + case 174 /* MethodDeclaration */: return factory2.createIdentifier("Function"); default: return factory2.createVoidZero(); @@ -92836,7 +93855,7 @@ ${lanes.join("\n")} return factory2.createArrayLiteralExpression(expressions); } function getParametersOfDecoratedDeclaration(node, container) { - if (container && node.kind === 176 /* GetAccessor */) { + if (container && node.kind === 177 /* GetAccessor */) { const { setAccessor } = getAllAccessorDeclarations(container.members, node); if (setAccessor) { return setAccessor.parameters; @@ -92862,72 +93881,72 @@ ${lanes.join("\n")} case 157 /* UndefinedKeyword */: case 146 /* NeverKeyword */: return factory2.createVoidZero(); - case 183 /* FunctionType */: - case 184 /* ConstructorType */: + case 184 /* FunctionType */: + case 185 /* ConstructorType */: return factory2.createIdentifier("Function"); - case 187 /* ArrayType */: - case 188 /* TupleType */: + case 188 /* ArrayType */: + case 189 /* TupleType */: return factory2.createIdentifier("Array"); - case 181 /* TypePredicate */: + case 182 /* TypePredicate */: return node.assertsModifier ? factory2.createVoidZero() : factory2.createIdentifier("Boolean"); case 136 /* BooleanKeyword */: return factory2.createIdentifier("Boolean"); - case 202 /* TemplateLiteralType */: + case 203 /* TemplateLiteralType */: case 154 /* StringKeyword */: return factory2.createIdentifier("String"); case 151 /* ObjectKeyword */: return factory2.createIdentifier("Object"); - case 200 /* LiteralType */: + case 201 /* LiteralType */: return serializeLiteralOfLiteralTypeNode(node.literal); case 150 /* NumberKeyword */: return factory2.createIdentifier("Number"); - case 162 /* BigIntKeyword */: + case 163 /* BigIntKeyword */: return getGlobalConstructor("BigInt", 7 /* ES2020 */); case 155 /* SymbolKeyword */: return getGlobalConstructor("Symbol", 2 /* ES2015 */); - case 182 /* TypeReference */: + case 183 /* TypeReference */: return serializeTypeReferenceNode(node); - case 192 /* IntersectionType */: + case 193 /* IntersectionType */: return serializeUnionOrIntersectionConstituents( node.types, /*isIntersection*/ true ); - case 191 /* UnionType */: + case 192 /* UnionType */: return serializeUnionOrIntersectionConstituents( node.types, /*isIntersection*/ false ); - case 193 /* ConditionalType */: + case 194 /* ConditionalType */: return serializeUnionOrIntersectionConstituents( [node.trueType, node.falseType], /*isIntersection*/ false ); - case 197 /* TypeOperator */: + case 198 /* TypeOperator */: if (node.operator === 148 /* ReadonlyKeyword */) { return serializeTypeNode(node.type); } break; - case 185 /* TypeQuery */: - case 198 /* IndexedAccessType */: - case 199 /* MappedType */: - case 186 /* TypeLiteral */: + case 186 /* TypeQuery */: + case 199 /* IndexedAccessType */: + case 200 /* MappedType */: + case 187 /* TypeLiteral */: case 133 /* AnyKeyword */: case 159 /* UnknownKeyword */: - case 196 /* ThisType */: - case 204 /* ImportType */: + case 197 /* ThisType */: + case 205 /* ImportType */: break; - case 318 /* JSDocAllType */: - case 319 /* JSDocUnknownType */: - case 323 /* JSDocFunctionType */: - case 324 /* JSDocVariadicType */: - case 325 /* JSDocNamepathType */: + case 319 /* JSDocAllType */: + case 320 /* JSDocUnknownType */: + case 324 /* JSDocFunctionType */: + case 325 /* JSDocVariadicType */: + case 326 /* JSDocNamepathType */: break; - case 320 /* JSDocNullableType */: - case 321 /* JSDocNonNullableType */: - case 322 /* JSDocOptionalType */: + case 321 /* JSDocNullableType */: + case 322 /* JSDocNonNullableType */: + case 323 /* JSDocOptionalType */: return serializeTypeNode(node.type); default: return Debug.failBadSyntaxKind(node); @@ -92939,7 +93958,7 @@ ${lanes.join("\n")} case 11 /* StringLiteral */: case 15 /* NoSubstitutionTemplateLiteral */: return factory2.createIdentifier("String"); - case 223 /* PrefixUnaryExpression */: { + case 224 /* PrefixUnaryExpression */: { const operand = node.operand; switch (operand.kind) { case 9 /* NumericLiteral */: @@ -93098,7 +94117,7 @@ ${lanes.join("\n")} name.original = void 0; setParent(name, getParseTreeNode(currentLexicalScope)); return name; - case 165 /* QualifiedName */: + case 166 /* QualifiedName */: return serializeQualifiedNameAsExpression(node); } } @@ -93154,23 +94173,23 @@ ${lanes.join("\n")} return node; } switch (node.kind) { - case 169 /* Decorator */: + case 170 /* Decorator */: return void 0; - case 262 /* ClassDeclaration */: + case 263 /* ClassDeclaration */: return visitClassDeclaration(node); - case 230 /* ClassExpression */: + case 231 /* ClassExpression */: return visitClassExpression(node); - case 175 /* Constructor */: + case 176 /* Constructor */: return visitConstructorDeclaration(node); - case 173 /* MethodDeclaration */: + case 174 /* MethodDeclaration */: return visitMethodDeclaration(node); - case 177 /* SetAccessor */: + case 178 /* SetAccessor */: return visitSetAccessorDeclaration(node); - case 176 /* GetAccessor */: + case 177 /* GetAccessor */: return visitGetAccessorDeclaration(node); - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: return visitPropertyDeclaration(node); - case 168 /* Parameter */: + case 169 /* Parameter */: return visitParameterDeclaration(node); default: return visitEachChild(node, visitor, context); @@ -93310,39 +94329,36 @@ ${lanes.join("\n")} ); setOriginalNode(classExpression, node); setTextRange(classExpression, location); + const varInitializer = classAlias && !assignClassAliasInStaticBlock ? factory2.createAssignment(classAlias, classExpression) : classExpression; const varDecl = factory2.createVariableDeclaration( declName, /*exclamationToken*/ void 0, /*type*/ void 0, - classAlias && !assignClassAliasInStaticBlock ? factory2.createAssignment(classAlias, classExpression) : classExpression + varInitializer ); setOriginalNode(varDecl, node); - let varModifiers; - if (isExport && !isDefault) { - varModifiers = factory2.createModifiersFromModifierFlags(1 /* Export */); - } - const statement = factory2.createVariableStatement( - varModifiers, - factory2.createVariableDeclarationList([ - varDecl - ], 1 /* Let */) + const varDeclList = factory2.createVariableDeclarationList([varDecl], 1 /* Let */); + const varStatement = factory2.createVariableStatement( + /*modifiers*/ + void 0, + varDeclList ); - setOriginalNode(statement, node); - setTextRange(statement, location); - setCommentRange(statement, node); - const statements = [statement]; + setOriginalNode(varStatement, node); + setTextRange(varStatement, location); + setCommentRange(varStatement, node); + const statements = [varStatement]; addRange(statements, decorationStatements); addConstructorDecorationStatement(statements, node); - if (isExport && isDefault) { - statements.push(factory2.createExportAssignment( - /*modifiers*/ - void 0, - /*isExportEquals*/ - false, - declName - )); + if (isExport) { + if (isDefault) { + const exportStatement = factory2.createExportDefault(declName); + statements.push(exportStatement); + } else { + const exportStatement = factory2.createExternalModuleExport(factory2.getDeclarationName(node)); + statements.push(exportStatement); + } } return statements; } @@ -93409,7 +94425,7 @@ ${lanes.join("\n")} ), node); } function visitPropertyDeclaration(node) { - if (node.flags & 16777216 /* Ambient */ || hasSyntacticModifier(node, 2 /* Ambient */)) { + if (node.flags & 33554432 /* Ambient */ || hasSyntacticModifier(node, 2 /* Ambient */)) { return void 0; } return finishClassElement(factory2.updatePropertyDeclaration( @@ -93577,7 +94593,7 @@ ${lanes.join("\n")} } } function getClassAliasIfNeeded(node) { - if (resolver.getNodeCheckFlags(node) & 1048576 /* ClassWithConstructorReference */) { + if (resolver.getNodeCheckFlags(node) & 262144 /* ContainsConstructorReference */) { enableSubstitutionForClassAliases(); const classAlias = factory2.createUniqueName(node.name && !isGeneratedIdentifier(node.name) ? idText(node.name) : "default"); classAliases[getOriginalNodeId(node)] = classAlias; @@ -93610,7 +94626,7 @@ ${lanes.join("\n")} } function trySubstituteClassAlias(node) { if (classAliases) { - if (resolver.getNodeCheckFlags(node) & 2097152 /* ConstructorReferenceInClass */) { + if (resolver.getNodeCheckFlags(node) & 536870912 /* ConstructorReference */) { const declaration = resolver.getReferencedValueDeclaration(node); if (declaration) { const classAlias = classAliases[declaration.id]; @@ -93642,8 +94658,7 @@ ${lanes.join("\n")} endLexicalEnvironment, hoistVariableDeclaration } = context; - const compilerOptions = context.getCompilerOptions(); - const languageVersion = getEmitScriptTarget(compilerOptions); + const languageVersion = getEmitScriptTarget(context.getCompilerOptions()); let top; let classInfo; let classThis; @@ -93755,86 +94770,78 @@ ${lanes.join("\n")} return node; } switch (node.kind) { - case 169 /* Decorator */: + case 170 /* Decorator */: return Debug.fail("Use `modifierVisitor` instead."); - case 262 /* ClassDeclaration */: + case 263 /* ClassDeclaration */: return visitClassDeclaration(node); - case 230 /* ClassExpression */: - return visitClassExpression( - node, - /*referencedName*/ - void 0 - ); - case 175 /* Constructor */: - case 171 /* PropertyDeclaration */: - case 174 /* ClassStaticBlockDeclaration */: + case 231 /* ClassExpression */: + return visitClassExpression(node); + case 176 /* Constructor */: + case 172 /* PropertyDeclaration */: + case 175 /* ClassStaticBlockDeclaration */: return Debug.fail("Not supported outside of a class. Use 'classElementVisitor' instead."); - case 168 /* Parameter */: + case 169 /* Parameter */: return visitParameterDeclaration(node); - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: return visitBinaryExpression( node, /*discarded*/ false ); - case 302 /* PropertyAssignment */: + case 303 /* PropertyAssignment */: return visitPropertyAssignment(node); - case 259 /* VariableDeclaration */: + case 260 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 207 /* BindingElement */: + case 208 /* BindingElement */: return visitBindingElement(node); - case 276 /* ExportAssignment */: + case 277 /* ExportAssignment */: return visitExportAssignment(node); case 110 /* ThisKeyword */: return visitThisExpression(node); - case 247 /* ForStatement */: + case 248 /* ForStatement */: return visitForStatement(node); - case 243 /* ExpressionStatement */: + case 244 /* ExpressionStatement */: return visitExpressionStatement(node); - case 360 /* CommaListExpression */: + case 361 /* CommaListExpression */: return visitCommaListExpression( node, /*discarded*/ false ); - case 216 /* ParenthesizedExpression */: + case 217 /* ParenthesizedExpression */: return visitParenthesizedExpression( node, /*discarded*/ - false, - /*referencedName*/ - void 0 + false ); - case 359 /* PartiallyEmittedExpression */: + case 360 /* PartiallyEmittedExpression */: return visitPartiallyEmittedExpression( node, /*discarded*/ - false, - /*referencedName*/ - void 0 + false ); - case 212 /* CallExpression */: + case 213 /* CallExpression */: return visitCallExpression(node); - case 214 /* TaggedTemplateExpression */: + case 215 /* TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 223 /* PrefixUnaryExpression */: - case 224 /* PostfixUnaryExpression */: + case 224 /* PrefixUnaryExpression */: + case 225 /* PostfixUnaryExpression */: return visitPreOrPostfixUnaryExpression( node, /*discarded*/ false ); - case 210 /* PropertyAccessExpression */: + case 211 /* PropertyAccessExpression */: return visitPropertyAccessExpression(node); - case 211 /* ElementAccessExpression */: + case 212 /* ElementAccessExpression */: return visitElementAccessExpression(node); - case 166 /* ComputedPropertyName */: + case 167 /* ComputedPropertyName */: return visitComputedPropertyName(node); - case 173 /* MethodDeclaration */: - case 177 /* SetAccessor */: - case 176 /* GetAccessor */: - case 217 /* FunctionExpression */: - case 261 /* FunctionDeclaration */: { + case 174 /* MethodDeclaration */: + case 178 /* SetAccessor */: + case 177 /* GetAccessor */: + case 218 /* FunctionExpression */: + case 262 /* FunctionDeclaration */: { enterOther(); const result = visitEachChild(node, fallbackVisitor, context); exitOther(); @@ -93846,7 +94853,7 @@ ${lanes.join("\n")} } function fallbackVisitor(node) { switch (node.kind) { - case 169 /* Decorator */: + case 170 /* Decorator */: return void 0; default: return visitor(node); @@ -93854,7 +94861,7 @@ ${lanes.join("\n")} } function modifierVisitor(node) { switch (node.kind) { - case 169 /* Decorator */: + case 170 /* Decorator */: return void 0; default: return node; @@ -93862,72 +94869,48 @@ ${lanes.join("\n")} } function classElementVisitor(node) { switch (node.kind) { - case 175 /* Constructor */: + case 176 /* Constructor */: return visitConstructorDeclaration(node); - case 173 /* MethodDeclaration */: + case 174 /* MethodDeclaration */: return visitMethodDeclaration(node); - case 176 /* GetAccessor */: + case 177 /* GetAccessor */: return visitGetAccessorDeclaration(node); - case 177 /* SetAccessor */: + case 178 /* SetAccessor */: return visitSetAccessorDeclaration(node); - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: return visitPropertyDeclaration(node); - case 174 /* ClassStaticBlockDeclaration */: + case 175 /* ClassStaticBlockDeclaration */: return visitClassStaticBlockDeclaration(node); default: return visitor(node); } } - function namedEvaluationVisitor(node, referencedName) { - switch (node.kind) { - case 359 /* PartiallyEmittedExpression */: - return visitPartiallyEmittedExpression( - node, - /*discarded*/ - false, - referencedName - ); - case 216 /* ParenthesizedExpression */: - return visitParenthesizedExpression( - node, - /*discarded*/ - false, - referencedName - ); - case 230 /* ClassExpression */: - return visitClassExpression(node, referencedName); - default: - return visitor(node); - } - } function discardedValueVisitor(node) { switch (node.kind) { - case 223 /* PrefixUnaryExpression */: - case 224 /* PostfixUnaryExpression */: + case 224 /* PrefixUnaryExpression */: + case 225 /* PostfixUnaryExpression */: return visitPreOrPostfixUnaryExpression( node, /*discarded*/ true ); - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: return visitBinaryExpression( node, /*discarded*/ true ); - case 360 /* CommaListExpression */: + case 361 /* CommaListExpression */: return visitCommaListExpression( node, /*discarded*/ true ); - case 216 /* ParenthesizedExpression */: + case 217 /* ParenthesizedExpression */: return visitParenthesizedExpression( node, /*discarded*/ - true, - /*referencedName*/ - void 0 + true ); default: return visitor(node); @@ -93965,6 +94948,7 @@ ${lanes.join("\n")} ); } function createClassInfo(node) { + const metadataReference = factory2.createUniqueName("_metadata", 16 /* Optimistic */ | 32 /* FileLevel */); let instanceExtraInitializersName; let staticExtraInitializersName; let hasStaticInitializers = false; @@ -93978,13 +94962,15 @@ ${lanes.join("\n")} node )) { if (hasStaticModifier(member)) { - staticExtraInitializersName ?? (staticExtraInitializersName = factory2.createUniqueName("_staticExtraInitializers", 16 /* Optimistic */)); + staticExtraInitializersName ?? (staticExtraInitializersName = factory2.createUniqueName("_staticExtraInitializers", 16 /* Optimistic */ | 32 /* FileLevel */)); } else { - instanceExtraInitializersName ?? (instanceExtraInitializersName = factory2.createUniqueName("_instanceExtraInitializers", 16 /* Optimistic */)); + instanceExtraInitializersName ?? (instanceExtraInitializersName = factory2.createUniqueName("_instanceExtraInitializers", 16 /* Optimistic */ | 32 /* FileLevel */)); } } if (isClassStaticBlockDeclaration(member)) { - hasStaticInitializers = true; + if (!isClassNamedEvaluationHelperBlock(member)) { + hasStaticInitializers = true; + } } else if (isPropertyDeclaration(member)) { if (hasStaticModifier(member)) { hasStaticInitializers || (hasStaticInitializers = !!member.initializer || hasDecorators(member)); @@ -94001,6 +94987,7 @@ ${lanes.join("\n")} } return { class: node, + metadataReference, instanceExtraInitializersName, staticExtraInitializersName, hasStaticInitializers, @@ -94008,19 +94995,15 @@ ${lanes.join("\n")} hasStaticPrivateClassElements }; } - function containsLexicalSuperInStaticInitializer(node) { - for (const member of node.members) { - if (isClassStaticBlockDeclaration(member) || isPropertyDeclaration(member) && hasStaticModifier(member)) { - if (member.transformFlags & 134217728 /* ContainsLexicalSuper */) { - return true; - } - } - } - return false; - } - function transformClassLike(node, className) { - var _a; + function transformClassLike(node) { startLexicalEnvironment(); + if (!classHasDeclaredOrExplicitlyAssignedName(node) && classOrConstructorParameterIsDecorated( + /*useLegacyDecorators*/ + false, + node + )) { + node = injectClassNamedEvaluationHelperBlockIfMissing(context, node, factory2.createStringLiteral("")); + } const classReference = factory2.getLocalName( node, /*allowComments*/ @@ -94039,10 +95022,11 @@ ${lanes.join("\n")} let shouldTransformPrivateStaticElementsInClass = false; const classDecorators = transformAllDecoratorsOfDeclaration(getAllDecoratorsOfClass(node)); if (classDecorators) { - classInfo2.classDecoratorsName = factory2.createUniqueName("_classDecorators", 16 /* Optimistic */); - classInfo2.classDescriptorName = factory2.createUniqueName("_classDescriptor", 16 /* Optimistic */); - classInfo2.classExtraInitializersName = factory2.createUniqueName("_classExtraInitializers", 16 /* Optimistic */); - classInfo2.classThis = factory2.createUniqueName("_classThis", 16 /* Optimistic */); + classInfo2.classDecoratorsName = factory2.createUniqueName("_classDecorators", 16 /* Optimistic */ | 32 /* FileLevel */); + classInfo2.classDescriptorName = factory2.createUniqueName("_classDescriptor", 16 /* Optimistic */ | 32 /* FileLevel */); + classInfo2.classExtraInitializersName = factory2.createUniqueName("_classExtraInitializers", 16 /* Optimistic */ | 32 /* FileLevel */); + const needsUniqueClassThis = some(node.members, (member) => (isPrivateIdentifierClassElementDeclaration(member) || isAutoAccessorPropertyDeclaration(member)) && hasStaticModifier(member)); + classInfo2.classThis = factory2.createUniqueName("_classThis", needsUniqueClassThis ? 16 /* Optimistic */ | 8 /* ReservedInNestedScopes */ : 16 /* Optimistic */ | 32 /* FileLevel */); classDefinitionStatements.push( createLet(classInfo2.classDecoratorsName, factory2.createArrayLiteralExpression(classDecorators)), createLet(classInfo2.classDescriptorName), @@ -94054,34 +95038,26 @@ ${lanes.join("\n")} shouldTransformPrivateStaticElementsInFile = true; } } - if (classDecorators && containsLexicalSuperInStaticInitializer(node)) { - const extendsClause = getHeritageClause(node.heritageClauses, 96 /* ExtendsKeyword */); - const extendsElement = extendsClause && firstOrUndefined(extendsClause.types); - const extendsExpression = extendsElement && visitNode(extendsElement.expression, visitor, isExpression); - if (extendsExpression) { - classInfo2.classSuper = factory2.createUniqueName("_classSuper", 16 /* Optimistic */); - const unwrapped = skipOuterExpressions(extendsExpression); - const safeExtendsExpression = isClassExpression(unwrapped) && !unwrapped.name || isFunctionExpression(unwrapped) && !unwrapped.name || isArrowFunction(unwrapped) ? factory2.createComma(factory2.createNumericLiteral(0), extendsExpression) : extendsExpression; - classDefinitionStatements.push(createLet(classInfo2.classSuper, safeExtendsExpression)); - const updatedExtendsElement = factory2.updateExpressionWithTypeArguments( - extendsElement, - classInfo2.classSuper, - /*typeArguments*/ - void 0 - ); - const updatedExtendsClause = factory2.updateHeritageClause(extendsClause, [updatedExtendsElement]); - heritageClauses = factory2.createNodeArray([updatedExtendsClause]); - } - } else { - heritageClauses = visitNodes2(node.heritageClauses, visitor, isHeritageClause); + const extendsClause = getHeritageClause(node.heritageClauses, 96 /* ExtendsKeyword */); + const extendsElement = extendsClause && firstOrUndefined(extendsClause.types); + const extendsExpression = extendsElement && visitNode(extendsElement.expression, visitor, isExpression); + if (extendsExpression) { + classInfo2.classSuper = factory2.createUniqueName("_classSuper", 16 /* Optimistic */ | 32 /* FileLevel */); + const unwrapped = skipOuterExpressions(extendsExpression); + const safeExtendsExpression = isClassExpression(unwrapped) && !unwrapped.name || isFunctionExpression(unwrapped) && !unwrapped.name || isArrowFunction(unwrapped) ? factory2.createComma(factory2.createNumericLiteral(0), extendsExpression) : extendsExpression; + classDefinitionStatements.push(createLet(classInfo2.classSuper, safeExtendsExpression)); + const updatedExtendsElement = factory2.updateExpressionWithTypeArguments( + extendsElement, + classInfo2.classSuper, + /*typeArguments*/ + void 0 + ); + const updatedExtendsClause = factory2.updateHeritageClause(extendsClause, [updatedExtendsElement]); + heritageClauses = factory2.createNodeArray([updatedExtendsClause]); } const renamedClassThis = classInfo2.classThis ?? factory2.createThis(); - const needsSetNameHelper = !((_a = getOriginalNode(node, isClassLike)) == null ? void 0 : _a.name) && (classDecorators || !isStringLiteral(className) || !isEmptyStringLiteral(className)); - if (needsSetNameHelper) { - const setNameExpr = emitHelpers().createSetFunctionNameHelper(factory2.createThis(), className); - leadingBlockStatements = append(leadingBlockStatements, factory2.createExpressionStatement(setNameExpr)); - } enterClass(classInfo2); + leadingBlockStatements = append(leadingBlockStatements, createMetadata(classInfo2.metadataReference, classInfo2.classSuper)); let members = visitNodes2(node.members, classElementVisitor, isClassElement); if (pendingExpressions) { let outerThis; @@ -94179,15 +95155,15 @@ ${lanes.join("\n")} leadingBlockStatements = addRange(leadingBlockStatements, classInfo2.nonStaticFieldDecorationStatements); if (classInfo2.classDescriptorName && classInfo2.classDecoratorsName && classInfo2.classExtraInitializersName && classInfo2.classThis) { leadingBlockStatements ?? (leadingBlockStatements = []); - const valueProperty = factory2.createPropertyAssignment("value", factory2.createThis()); + const valueProperty = factory2.createPropertyAssignment("value", renamedClassThis); const classDescriptor = factory2.createObjectLiteralExpression([valueProperty]); const classDescriptorAssignment = factory2.createAssignment(classInfo2.classDescriptorName, classDescriptor); - const classNameReference = factory2.createPropertyAccessExpression(factory2.createThis(), "name"); + const classNameReference = factory2.createPropertyAccessExpression(renamedClassThis, "name"); const esDecorateHelper2 = emitHelpers().createESDecorateHelper( factory2.createNull(), classDescriptorAssignment, classInfo2.classDecoratorsName, - { kind: "class", name: classNameReference }, + { kind: "class", name: classNameReference, metadata: classInfo2.metadataReference }, factory2.createNull(), classInfo2.classExtraInitializersName ); @@ -94199,6 +95175,7 @@ ${lanes.join("\n")} const classReferenceAssignment = factory2.createAssignment(classReference, classThisAssignment); leadingBlockStatements.push(factory2.createExpressionStatement(classReferenceAssignment)); } + leadingBlockStatements.push(createSymbolMetadata(renamedClassThis, classInfo2.metadataReference)); if (classInfo2.staticExtraInitializersName) { const runStaticInitializersHelper = emitHelpers().createRunInitializersHelper(renamedClassThis, classInfo2.staticExtraInitializersName); const runStaticInitializersStatement = factory2.createExpressionStatement(runStaticInitializersHelper); @@ -94215,32 +95192,35 @@ ${lanes.join("\n")} addRange(leadingBlockStatements, trailingBlockStatements); trailingBlockStatements = void 0; } - let newMembers = members; - if (leadingBlockStatements) { - const leadingStaticBlockBody = factory2.createBlock( - leadingBlockStatements, - /*multiLine*/ - true - ); - const leadingStaticBlock = factory2.createClassStaticBlockDeclaration(leadingStaticBlockBody); - if (shouldTransformPrivateStaticElementsInClass) { - setInternalEmitFlags(leadingStaticBlock, 32 /* TransformPrivateStaticElements */); - } - newMembers = [leadingStaticBlock, ...newMembers]; - } - if (syntheticConstructor) { - newMembers = [...newMembers, syntheticConstructor]; - } - if (trailingBlockStatements) { - const trailingStaticBlockBody = factory2.createBlock( - trailingBlockStatements, - /*multiLine*/ - true - ); - const trailingStaticBlock = factory2.createClassStaticBlockDeclaration(trailingStaticBlockBody); - newMembers = [...newMembers, trailingStaticBlock]; + const leadingStaticBlock = leadingBlockStatements && factory2.createClassStaticBlockDeclaration(factory2.createBlock( + leadingBlockStatements, + /*multiLine*/ + true + )); + if (leadingStaticBlock && shouldTransformPrivateStaticElementsInClass) { + setInternalEmitFlags(leadingStaticBlock, 32 /* TransformPrivateStaticElements */); } - if (newMembers !== members) { + const trailingStaticBlock = trailingBlockStatements && factory2.createClassStaticBlockDeclaration(factory2.createBlock( + trailingBlockStatements, + /*multiLine*/ + true + )); + if (leadingStaticBlock || syntheticConstructor || trailingStaticBlock) { + const newMembers = []; + const existingNamedEvaluationHelperBlockIndex = members.findIndex(isClassNamedEvaluationHelperBlock); + if (leadingStaticBlock) { + addRange(newMembers, members, 0, existingNamedEvaluationHelperBlockIndex + 1); + newMembers.push(leadingStaticBlock); + addRange(newMembers, members, existingNamedEvaluationHelperBlockIndex + 1); + } else { + addRange(newMembers, members); + } + if (syntheticConstructor) { + newMembers.push(syntheticConstructor); + } + if (trailingStaticBlock) { + newMembers.push(trailingStaticBlock); + } members = setTextRange(factory2.createNodeArray(newMembers), members); } const lexicalEnvironment = endLexicalEnvironment(); @@ -94256,6 +95236,9 @@ ${lanes.join("\n")} heritageClauses, members ); + if (classInfo2.classThis) { + classExpression = injectClassThisAssignmentIfMissing(factory2, classExpression, classInfo2.classThis); + } const classReferenceDeclaration = factory2.createVariableDeclaration( classReference, /*exclamationToken*/ @@ -94295,7 +95278,6 @@ ${lanes.join("\n")} } } setOriginalNode(classExpression, node); - getOrCreateEmitNode(classExpression).classThis = classInfo2.classThis; return factory2.createImmediatelyInvokedArrowFunction(factory2.mergeLexicalEnvironment(classDefinitionStatements, lexicalEnvironment)); } function isDecoratedClassLike(node) { @@ -94311,26 +95293,51 @@ ${lanes.join("\n")} } function visitClassDeclaration(node) { if (isDecoratedClassLike(node)) { - if (hasSyntacticModifier(node, 1 /* Export */) && hasSyntacticModifier(node, 1024 /* Default */)) { - const originalClass = getOriginalNode(node, isClassLike) ?? node; - const className = originalClass.name ? factory2.createStringLiteralFromNode(originalClass.name) : factory2.createStringLiteral("default"); - const iife = transformClassLike(node, className); - const statement = factory2.createExportDefault(iife); - setOriginalNode(statement, node); - setCommentRange(statement, getCommentRange(node)); - setSourceMapRange(statement, moveRangePastDecorators(node)); - return statement; + const statements = []; + const originalClass = getOriginalNode(node, isClassLike) ?? node; + const className = originalClass.name ? factory2.createStringLiteralFromNode(originalClass.name) : factory2.createStringLiteral("default"); + const isExport = hasSyntacticModifier(node, 1 /* Export */); + const isDefault = hasSyntacticModifier(node, 1024 /* Default */); + if (!node.name) { + node = injectClassNamedEvaluationHelperBlockIfMissing(context, node, className); + } + if (isExport && isDefault) { + const iife = transformClassLike(node); + if (node.name) { + const varDecl = factory2.createVariableDeclaration( + factory2.getLocalName(node), + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + iife + ); + setOriginalNode(varDecl, node); + const varDecls = factory2.createVariableDeclarationList([varDecl], 1 /* Let */); + const varStatement = factory2.createVariableStatement( + /*modifiers*/ + void 0, + varDecls + ); + statements.push(varStatement); + const exportStatement = factory2.createExportDefault(factory2.getDeclarationName(node)); + setOriginalNode(exportStatement, node); + setCommentRange(exportStatement, getCommentRange(node)); + setSourceMapRange(exportStatement, moveRangePastDecorators(node)); + statements.push(exportStatement); + } else { + const exportStatement = factory2.createExportDefault(iife); + setOriginalNode(exportStatement, node); + setCommentRange(exportStatement, getCommentRange(node)); + setSourceMapRange(exportStatement, moveRangePastDecorators(node)); + statements.push(exportStatement); + } } else { Debug.assertIsDefined(node.name, "A class declaration that is not a default export must have a name."); - const iife = transformClassLike(node, factory2.createStringLiteralFromNode(node.name)); - const modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifier); - const declName = languageVersion <= 2 /* ES2015 */ ? factory2.getInternalName( - node, - /*allowComments*/ - false, - /*allowSourceMaps*/ - true - ) : factory2.getLocalName( + const iife = transformClassLike(node); + const modifierVisitorNoExport = isExport ? (node2) => isExportModifier(node2) ? void 0 : modifierVisitor(node2) : modifierVisitor; + const modifiers = visitNodes2(node.modifiers, modifierVisitorNoExport, isModifier); + const declName = factory2.getLocalName( node, /*allowComments*/ false, @@ -94347,11 +95354,17 @@ ${lanes.join("\n")} ); setOriginalNode(varDecl, node); const varDecls = factory2.createVariableDeclarationList([varDecl], 1 /* Let */); - const statement = factory2.createVariableStatement(modifiers, varDecls); - setOriginalNode(statement, node); - setCommentRange(statement, getCommentRange(node)); - return statement; + const varStatement = factory2.createVariableStatement(modifiers, varDecls); + setOriginalNode(varStatement, node); + setCommentRange(varStatement, getCommentRange(node)); + statements.push(varStatement); + if (isExport) { + const exportStatement = factory2.createExternalModuleExport(declName); + setOriginalNode(exportStatement, node); + statements.push(exportStatement); + } } + return singleOrMany(statements); } else { const modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifier); const heritageClauses = visitNodes2(node.heritageClauses, visitor, isHeritageClause); @@ -94372,10 +95385,9 @@ ${lanes.join("\n")} ); } } - function visitClassExpression(node, referencedName) { + function visitClassExpression(node) { if (isDecoratedClassLike(node)) { - const className = node.name ? factory2.createStringLiteralFromNode(node.name) : referencedName ?? factory2.createStringLiteral(""); - const iife = transformClassLike(node, className); + const iife = transformClassLike(node); setOriginalNode(iife, node); return iife; } else { @@ -94412,6 +95424,35 @@ ${lanes.join("\n")} return statements; } } + function transformConstructorBodyWorker(statementsOut, statementsIn, statementOffset, superPath, superPathDepth, initializerStatements) { + const superStatementIndex = superPath[superPathDepth]; + const superStatement = statementsIn[superStatementIndex]; + addRange(statementsOut, visitNodes2(statementsIn, visitor, isStatement, statementOffset, superStatementIndex - statementOffset)); + if (isTryStatement(superStatement)) { + const tryBlockStatements = []; + transformConstructorBodyWorker( + tryBlockStatements, + superStatement.tryBlock.statements, + /*statementOffset*/ + 0, + superPath, + superPathDepth + 1, + initializerStatements + ); + const tryBlockStatementsArray = factory2.createNodeArray(tryBlockStatements); + setTextRange(tryBlockStatementsArray, superStatement.tryBlock.statements); + statementsOut.push(factory2.updateTryStatement( + superStatement, + factory2.updateBlock(superStatement.tryBlock, tryBlockStatements), + visitNode(superStatement.catchClause, visitor, isCatchClause), + visitNode(superStatement.finallyBlock, visitor, isBlock) + )); + } else { + addRange(statementsOut, visitNodes2(statementsIn, visitor, isStatement, superStatementIndex, 1)); + addRange(statementsOut, initializerStatements); + } + addRange(statementsOut, visitNodes2(statementsIn, visitor, isStatement, superStatementIndex + 1)); + } function visitConstructorDeclaration(node) { enterClassElement(node); const modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifier); @@ -94428,11 +95469,9 @@ ${lanes.join("\n")} false, visitor ); - const superStatementIndex = findSuperStatementIndex(node.body.statements, nonPrologueStart); - if (superStatementIndex >= 0) { - addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, nonPrologueStart, superStatementIndex + 1 - nonPrologueStart)); - addRange(statements, initializerStatements); - addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, superStatementIndex + 1)); + const superStatementIndices = findSuperStatementIndexPath(node.body.statements, nonPrologueStart); + if (superStatementIndices.length > 0) { + transformConstructorBodyWorker(statements, node.body.statements, nonPrologueStart, superStatementIndices, 0, initializerStatements); } else { addRange(statements, initializerStatements); addRange(statements, visitNodes2(node.body.statements, visitor, isStatement)); @@ -94457,7 +95496,7 @@ ${lanes.join("\n")} } return updated; } - function partialTransformClassElement(member, useNamedEvaluation, classInfo2, createDescriptor) { + function partialTransformClassElement(member, classInfo2, createDescriptor) { let referencedName; let name; let initializersName; @@ -94466,11 +95505,7 @@ ${lanes.join("\n")} if (!classInfo2) { const modifiers2 = visitNodes2(member.modifiers, modifierVisitor, isModifier); enterName(); - if (useNamedEvaluation) { - ({ referencedName, name } = visitReferencedPropertyName(member.name)); - } else { - name = visitPropertyName(member.name); - } + name = visitPropertyName(member.name); exitName(); return { modifiers: modifiers2, referencedName, name, initializersName, descriptorName, thisArg }; } @@ -94519,9 +95554,10 @@ ${lanes.join("\n")} get: isPropertyDeclaration(member) || isGetAccessorDeclaration(member) || isMethodDeclaration(member), // 3. If _kind_ is ~field~, ~accessor~, or ~setter~, then ... set: isPropertyDeclaration(member) || isSetAccessorDeclaration(member) - } + }, + metadata: classInfo2.metadataReference }; - const extraInitializers = isStatic(member) ? classInfo2.staticExtraInitializersName ?? (classInfo2.staticExtraInitializersName = factory2.createUniqueName("_staticExtraInitializers", 16 /* Optimistic */)) : classInfo2.instanceExtraInitializersName ?? (classInfo2.instanceExtraInitializersName = factory2.createUniqueName("_instanceExtraInitializers", 16 /* Optimistic */)); + const extraInitializers = isStatic(member) ? classInfo2.staticExtraInitializersName ?? (classInfo2.staticExtraInitializersName = factory2.createUniqueName("_staticExtraInitializers", 16 /* Optimistic */ | 32 /* FileLevel */)) : classInfo2.instanceExtraInitializersName ?? (classInfo2.instanceExtraInitializersName = factory2.createUniqueName("_instanceExtraInitializers", 16 /* Optimistic */ | 32 /* FileLevel */)); if (isMethodOrAccessor(member)) { let descriptor; if (isPrivateIdentifierClassElementDeclaration(member) && createDescriptor) { @@ -94563,11 +95599,7 @@ ${lanes.join("\n")} } if (name === void 0) { enterName(); - if (useNamedEvaluation) { - ({ referencedName, name } = visitReferencedPropertyName(member.name)); - } else { - name = visitPropertyName(member.name); - } + name = visitPropertyName(member.name); exitName(); } if (!some(modifiers) && (isMethodDeclaration(member) || isPropertyDeclaration(member))) { @@ -94577,13 +95609,7 @@ ${lanes.join("\n")} } function visitMethodDeclaration(node) { enterClassElement(node); - const { modifiers, name, descriptorName } = partialTransformClassElement( - node, - /*useNamedEvaluation*/ - false, - classInfo, - createMethodDescriptorObject - ); + const { modifiers, name, descriptorName } = partialTransformClassElement(node, classInfo, createMethodDescriptorObject); if (descriptorName) { exitClassElement(); return finishClassElement(createMethodDescriptorForwarder(modifiers, name, descriptorName), node); @@ -94609,13 +95635,7 @@ ${lanes.join("\n")} } function visitGetAccessorDeclaration(node) { enterClassElement(node); - const { modifiers, name, descriptorName } = partialTransformClassElement( - node, - /*useNamedEvaluation*/ - false, - classInfo, - createGetAccessorDescriptorObject - ); + const { modifiers, name, descriptorName } = partialTransformClassElement(node, classInfo, createGetAccessorDescriptorObject); if (descriptorName) { exitClassElement(); return finishClassElement(createGetAccessorDescriptorForwarder(modifiers, name, descriptorName), node); @@ -94636,13 +95656,7 @@ ${lanes.join("\n")} } function visitSetAccessorDeclaration(node) { enterClassElement(node); - const { modifiers, name, descriptorName } = partialTransformClassElement( - node, - /*useNamedEvaluation*/ - false, - classInfo, - createSetAccessorDescriptorObject - ); + const { modifiers, name, descriptorName } = partialTransformClassElement(node, classInfo, createSetAccessorDescriptorObject); if (descriptorName) { exitClassElement(); return finishClassElement(createSetAccessorDescriptorForwarder(modifiers, name, descriptorName), node); @@ -94655,19 +95669,31 @@ ${lanes.join("\n")} } function visitClassStaticBlockDeclaration(node) { enterClassElement(node); - if (classInfo) - classInfo.hasStaticInitializers = true; - const result = visitEachChild(node, visitor, context); + let result; + if (isClassNamedEvaluationHelperBlock(node)) { + result = visitEachChild(node, visitor, context); + } else if (isClassThisAssignmentBlock(node)) { + const savedClassThis = classThis; + classThis = void 0; + result = visitEachChild(node, visitor, context); + classThis = savedClassThis; + } else { + if (classInfo) + classInfo.hasStaticInitializers = true; + result = visitEachChild(node, visitor, context); + } exitClassElement(); return result; } function visitPropertyDeclaration(node) { + if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { + node = transformNamedEvaluation(context, node, canIgnoreEmptyStringLiteralInAssignedName(node.initializer)); + } enterClassElement(node); Debug.assert(!isAmbientPropertyDeclaration(node), "Not yet implemented."); - const useNamedEvaluation = isNamedEvaluation(node, isAnonymousClassNeedingAssignedName); - const { modifiers, name, referencedName, initializersName, descriptorName, thisArg } = partialTransformClassElement(node, useNamedEvaluation, classInfo, hasAccessorModifier(node) ? createAccessorPropertyDescriptorObject : void 0); + const { modifiers, name, initializersName, descriptorName, thisArg } = partialTransformClassElement(node, classInfo, hasAccessorModifier(node) ? createAccessorPropertyDescriptorObject : void 0); startLexicalEnvironment(); - let initializer = referencedName ? visitNode(node.initializer, (node2) => namedEvaluationVisitor(node2, referencedName), isExpression) : visitNode(node.initializer, visitor, isExpression); + let initializer = visitNode(node.initializer, visitor, isExpression); if (initializersName) { initializer = emitHelpers().createRunInitializersHelper( thisArg ?? factory2.createThis(), @@ -94797,38 +95823,21 @@ ${lanes.join("\n")} return visitEachChild(node, visitor, context); } function visitParameterDeclaration(node) { - let updated; if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - const assignedName = getAssignedNameOfIdentifier(node.name, node.initializer); - const name = visitNode(node.name, visitor, isBindingName); - const initializer = visitNode(node.initializer, (node2) => namedEvaluationVisitor(node2, assignedName), isExpression); - updated = factory2.updateParameterDeclaration( - node, - /*modifiers*/ - void 0, - /*dotDotDotToken*/ - void 0, - name, - /*questionToken*/ - void 0, - /*type*/ - void 0, - initializer - ); - } else { - updated = factory2.updateParameterDeclaration( - node, - /*modifiers*/ - void 0, - node.dotDotDotToken, - visitNode(node.name, visitor, isBindingName), - /*questionToken*/ - void 0, - /*type*/ - void 0, - visitNode(node.initializer, visitor, isExpression) - ); + node = transformNamedEvaluation(context, node, canIgnoreEmptyStringLiteralInAssignedName(node.initializer)); } + const updated = factory2.updateParameterDeclaration( + node, + /*modifiers*/ + void 0, + node.dotDotDotToken, + visitNode(node.name, visitor, isBindingName), + /*questionToken*/ + void 0, + /*type*/ + void 0, + visitNode(node.initializer, visitor, isExpression) + ); if (updated !== node) { setCommentRange(updated, node); setTextRange(updated, moveRangePastModifiers(node)); @@ -94840,6 +95849,14 @@ ${lanes.join("\n")} function isAnonymousClassNeedingAssignedName(node) { return isClassExpression(node) && !node.name && isDecoratedClassLike(node); } + function canIgnoreEmptyStringLiteralInAssignedName(node) { + const innerExpression = skipOuterExpressions(node); + return isClassExpression(innerExpression) && !innerExpression.name && !classOrConstructorParameterIsDecorated( + /*useLegacyDecorators*/ + false, + innerExpression + ); + } function visitForStatement(node) { return factory2.updateForStatement( node, @@ -94860,10 +95877,8 @@ ${lanes.join("\n")} } if (isAssignmentExpression(node)) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - const assignedName = getAssignedNameOfIdentifier(node.left, node.right); - const left = visitNode(node.left, visitor, isExpression); - const right = visitNode(node.right, (node2) => namedEvaluationVisitor(node2, assignedName), isExpression); - return factory2.updateBinaryExpression(node, left, node.operatorToken, right); + node = transformNamedEvaluation(context, node, canIgnoreEmptyStringLiteralInAssignedName(node.right)); + return visitEachChild(node, visitor, context); } if (isSuperProperty(node.left) && classThis && classSuper) { let setterName = isElementAccessExpression(node.left) ? visitNode(node.left.argumentExpression, visitor, isExpression) : isIdentifier(node.left.name) ? factory2.createStringLiteralFromNode(node.left.name) : void 0; @@ -94983,43 +95998,19 @@ ${lanes.join("\n")} } function visitPropertyAssignment(node) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - const { referencedName, name } = visitReferencedPropertyName(node.name); - const initializer = visitNode(node.initializer, (node2) => namedEvaluationVisitor(node2, referencedName), isExpression); - return factory2.updatePropertyAssignment(node, name, initializer); + node = transformNamedEvaluation(context, node, canIgnoreEmptyStringLiteralInAssignedName(node.initializer)); } return visitEachChild(node, visitor, context); } function visitVariableDeclaration(node) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - const assignedName = getAssignedNameOfIdentifier(node.name, node.initializer); - const name = visitNode(node.name, visitor, isBindingName); - const initializer = visitNode(node.initializer, (node2) => namedEvaluationVisitor(node2, assignedName), isExpression); - return factory2.updateVariableDeclaration( - node, - name, - /*exclamationToken*/ - void 0, - /*type*/ - void 0, - initializer - ); + node = transformNamedEvaluation(context, node, canIgnoreEmptyStringLiteralInAssignedName(node.initializer)); } return visitEachChild(node, visitor, context); } function visitBindingElement(node) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - const assignedName = getAssignedNameOfIdentifier(node.name, node.initializer); - const propertyName = visitNode(node.propertyName, visitor, isPropertyName); - const name = visitNode(node.name, visitor, isBindingName); - const initializer = visitNode(node.initializer, (node2) => namedEvaluationVisitor(node2, assignedName), isExpression); - return factory2.updateBindingElement( - node, - /*dotDotDotToken*/ - void 0, - propertyName, - name, - initializer - ); + node = transformNamedEvaluation(context, node, canIgnoreEmptyStringLiteralInAssignedName(node.initializer)); } return visitEachChild(node, visitor, context); } @@ -95056,14 +96047,11 @@ ${lanes.join("\n")} /*excludeCompoundAssignment*/ true )) { - const assignmentTarget = visitDestructuringAssignmentTarget(node.left); - let initializer; if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - const assignedName = getAssignedNameOfIdentifier(node.left, node.right); - initializer = visitNode(node.right, (node2) => namedEvaluationVisitor(node2, assignedName), isExpression); - } else { - initializer = visitNode(node.right, visitor, isExpression); + node = transformNamedEvaluation(context, node, canIgnoreEmptyStringLiteralInAssignedName(node.right)); } + const assignmentTarget = visitDestructuringAssignmentTarget(node.left); + const initializer = visitNode(node.right, visitor, isExpression); return factory2.updateBinaryExpression(node, assignmentTarget, node.operatorToken, initializer); } else { return visitDestructuringAssignmentTarget(node); @@ -95102,10 +96090,7 @@ ${lanes.join("\n")} } function visitShorthandAssignmentProperty(node) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - const assignedName = getAssignedNameOfIdentifier(node.name, node.objectAssignmentInitializer); - const name = visitNode(node.name, visitor, isIdentifier); - const objectAssignmentInitializer = visitNode(node.objectAssignmentInitializer, (node2) => namedEvaluationVisitor(node2, assignedName), isExpression); - return factory2.updateShorthandPropertyAssignment(node, name, objectAssignmentInitializer); + node = transformNamedEvaluation(context, node, canIgnoreEmptyStringLiteralInAssignedName(node.objectAssignmentInitializer)); } return visitEachChild(node, visitor, context); } @@ -95137,20 +96122,17 @@ ${lanes.join("\n")} } function visitExportAssignment(node) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { - const referencedName = factory2.createStringLiteral(node.isExportEquals ? "" : "default"); - const modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifier); - const expression = visitNode(node.expression, (node2) => namedEvaluationVisitor(node2, referencedName), isExpression); - return factory2.updateExportAssignment(node, modifiers, expression); + node = transformNamedEvaluation(context, node, canIgnoreEmptyStringLiteralInAssignedName(node.expression)); } return visitEachChild(node, visitor, context); } - function visitParenthesizedExpression(node, discarded, referencedName) { - const visitorFunc = discarded ? discardedValueVisitor : referencedName ? (node2) => namedEvaluationVisitor(node2, referencedName) : visitor; + function visitParenthesizedExpression(node, discarded) { + const visitorFunc = discarded ? discardedValueVisitor : visitor; const expression = visitNode(node.expression, visitorFunc, isExpression); return factory2.updateParenthesizedExpression(node, expression); } - function visitPartiallyEmittedExpression(node, discarded, referencedName) { - const visitorFunc = discarded ? discardedValueVisitor : referencedName ? (node2) => namedEvaluationVisitor(node2, referencedName) : visitor; + function visitPartiallyEmittedExpression(node, discarded) { + const visitorFunc = discarded ? discardedValueVisitor : visitor; const expression = visitNode(node.expression, visitorFunc, isExpression); return factory2.updatePartiallyEmittedExpression(node, expression); } @@ -95178,6 +96160,17 @@ ${lanes.join("\n")} function transformDecorator(decorator) { const expression = visitNode(decorator.expression, visitor, isExpression); setEmitFlags(expression, 3072 /* NoComments */); + const innerExpression = skipOuterExpressions(expression); + if (isAccessExpression(innerExpression)) { + const { target, thisArg } = factory2.createCallBinding( + expression, + hoistVariableDeclaration, + languageVersion, + /*cacheIdentifiers*/ + true + ); + return factory2.restoreOuterExpressions(expression, factory2.createFunctionBindCall(target, thisArg, [])); + } return expression; } function createDescriptorMethod(original, name, modifiers, asteriskToken, kind, parameters, body) { @@ -95363,9 +96356,59 @@ ${lanes.join("\n")} ]) ); } - function getAssignedNameOfIdentifier(name, initializer) { - const originalClass = getOriginalNode(initializer, isClassLike); - return originalClass && !originalClass.name && hasSyntacticModifier(originalClass, 1024 /* Default */) ? factory2.createStringLiteral("default") : factory2.createStringLiteralFromNode(name); + function createMetadata(name, classSuper2) { + const varDecl = factory2.createVariableDeclaration( + name, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + factory2.createConditionalExpression( + factory2.createLogicalAnd( + factory2.createTypeCheck(factory2.createIdentifier("Symbol"), "function"), + factory2.createPropertyAccessExpression(factory2.createIdentifier("Symbol"), "metadata") + ), + factory2.createToken(58 /* QuestionToken */), + factory2.createCallExpression( + factory2.createPropertyAccessExpression(factory2.createIdentifier("Object"), "create"), + /*typeArguments*/ + void 0, + [classSuper2 ? createSymbolMetadataReference(classSuper2) : factory2.createNull()] + ), + factory2.createToken(59 /* ColonToken */), + factory2.createVoidZero() + ) + ); + return factory2.createVariableStatement( + /*modifiers*/ + void 0, + factory2.createVariableDeclarationList([varDecl], 2 /* Const */) + ); + } + function createSymbolMetadata(target, value) { + const defineProperty = factory2.createObjectDefinePropertyCall( + target, + factory2.createPropertyAccessExpression(factory2.createIdentifier("Symbol"), "metadata"), + factory2.createPropertyDescriptor( + { configurable: true, writable: true, enumerable: true, value }, + /*singleLine*/ + true + ) + ); + return setEmitFlags( + factory2.createIfStatement(value, factory2.createExpressionStatement(defineProperty)), + 1 /* SingleLine */ + ); + } + function createSymbolMetadataReference(classSuper2) { + return factory2.createBinaryExpression( + factory2.createElementAccessExpression( + classSuper2, + factory2.createPropertyAccessExpression(factory2.createIdentifier("Symbol"), "metadata") + ), + 61 /* QuestionQuestionToken */, + factory2.createNull() + ); } } var init_esDecorators = __esm({ @@ -95449,34 +96492,34 @@ ${lanes.join("\n")} switch (node.kind) { case 134 /* AsyncKeyword */: return void 0; - case 222 /* AwaitExpression */: + case 223 /* AwaitExpression */: return visitAwaitExpression(node); - case 173 /* MethodDeclaration */: + case 174 /* MethodDeclaration */: return doWithContext(1 /* NonTopLevel */ | 2 /* HasLexicalThis */, visitMethodDeclaration, node); - case 261 /* FunctionDeclaration */: + case 262 /* FunctionDeclaration */: return doWithContext(1 /* NonTopLevel */ | 2 /* HasLexicalThis */, visitFunctionDeclaration, node); - case 217 /* FunctionExpression */: + case 218 /* FunctionExpression */: return doWithContext(1 /* NonTopLevel */ | 2 /* HasLexicalThis */, visitFunctionExpression, node); - case 218 /* ArrowFunction */: + case 219 /* ArrowFunction */: return doWithContext(1 /* NonTopLevel */, visitArrowFunction, node); - case 210 /* PropertyAccessExpression */: + case 211 /* PropertyAccessExpression */: if (capturedSuperProperties && isPropertyAccessExpression(node) && node.expression.kind === 108 /* SuperKeyword */) { capturedSuperProperties.add(node.name.escapedText); } return visitEachChild(node, visitor, context); - case 211 /* ElementAccessExpression */: + case 212 /* ElementAccessExpression */: if (capturedSuperProperties && node.expression.kind === 108 /* SuperKeyword */) { hasSuperElementAccess = true; } return visitEachChild(node, visitor, context); - case 176 /* GetAccessor */: + case 177 /* GetAccessor */: return doWithContext(1 /* NonTopLevel */ | 2 /* HasLexicalThis */, visitGetAccessorDeclaration, node); - case 177 /* SetAccessor */: + case 178 /* SetAccessor */: return doWithContext(1 /* NonTopLevel */ | 2 /* HasLexicalThis */, visitSetAccessorDeclaration, node); - case 175 /* Constructor */: + case 176 /* Constructor */: return doWithContext(1 /* NonTopLevel */ | 2 /* HasLexicalThis */, visitConstructorDeclaration, node); - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: return doWithContext(1 /* NonTopLevel */ | 2 /* HasLexicalThis */, visitDefault, node); default: return visitEachChild(node, visitor, context); @@ -95485,27 +96528,27 @@ ${lanes.join("\n")} function asyncBodyVisitor(node) { if (isNodeWithPossibleHoistedDeclaration(node)) { switch (node.kind) { - case 242 /* VariableStatement */: + case 243 /* VariableStatement */: return visitVariableStatementInAsyncBody(node); - case 247 /* ForStatement */: + case 248 /* ForStatement */: return visitForStatementInAsyncBody(node); - case 248 /* ForInStatement */: + case 249 /* ForInStatement */: return visitForInStatementInAsyncBody(node); - case 249 /* ForOfStatement */: + case 250 /* ForOfStatement */: return visitForOfStatementInAsyncBody(node); - case 298 /* CatchClause */: + case 299 /* CatchClause */: return visitCatchClauseInAsyncBody(node); - case 240 /* Block */: - case 254 /* SwitchStatement */: - case 268 /* CaseBlock */: - case 295 /* CaseClause */: - case 296 /* DefaultClause */: - case 257 /* TryStatement */: - case 245 /* DoStatement */: - case 246 /* WhileStatement */: - case 244 /* IfStatement */: - case 253 /* WithStatement */: - case 255 /* LabeledStatement */: + case 241 /* Block */: + case 255 /* SwitchStatement */: + case 269 /* CaseBlock */: + case 296 /* CaseClause */: + case 297 /* DefaultClause */: + case 258 /* TryStatement */: + case 246 /* DoStatement */: + case 247 /* WhileStatement */: + case 245 /* IfStatement */: + case 254 /* WithStatement */: + case 256 /* LabeledStatement */: return visitEachChild(node, asyncBodyVisitor, context); default: return Debug.assertNever(node, "Unhandled node."); @@ -95698,7 +96741,7 @@ ${lanes.join("\n")} } } function isVariableDeclarationListWithCollidingName(node) { - return !!node && isVariableDeclarationList(node) && !(node.flags & 3 /* BlockScoped */) && node.declarations.some(collidesWithParameterName); + return !!node && isVariableDeclarationList(node) && !(node.flags & 7 /* BlockScoped */) && node.declarations.some(collidesWithParameterName); } function visitVariableDeclarationListWithCollidingNames(node, hasReceiver) { hoistVariableDeclarationList(node); @@ -95782,7 +96825,7 @@ ${lanes.join("\n")} const original = getOriginalNode(node, isFunctionLike); const nodeType = original.type; const promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : void 0; - const isArrowFunction2 = node.kind === 218 /* ArrowFunction */; + const isArrowFunction2 = node.kind === 219 /* ArrowFunction */; const hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 512 /* CaptureArguments */) !== 0; const savedEnclosingFunctionParameterNames = enclosingFunctionParameterNames; enclosingFunctionParameterNames = /* @__PURE__ */ new Set(); @@ -95881,15 +96924,15 @@ ${lanes.join("\n")} function enableSubstitutionForAsyncMethodsWithSuper() { if ((enabledSubstitutions & 1 /* AsyncMethodsWithSuper */) === 0) { enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */; - context.enableSubstitution(212 /* CallExpression */); - context.enableSubstitution(210 /* PropertyAccessExpression */); - context.enableSubstitution(211 /* ElementAccessExpression */); - context.enableEmitNotification(262 /* ClassDeclaration */); - context.enableEmitNotification(173 /* MethodDeclaration */); - context.enableEmitNotification(176 /* GetAccessor */); - context.enableEmitNotification(177 /* SetAccessor */); - context.enableEmitNotification(175 /* Constructor */); - context.enableEmitNotification(242 /* VariableStatement */); + context.enableSubstitution(213 /* CallExpression */); + context.enableSubstitution(211 /* PropertyAccessExpression */); + context.enableSubstitution(212 /* ElementAccessExpression */); + context.enableEmitNotification(263 /* ClassDeclaration */); + context.enableEmitNotification(174 /* MethodDeclaration */); + context.enableEmitNotification(177 /* GetAccessor */); + context.enableEmitNotification(178 /* SetAccessor */); + context.enableEmitNotification(176 /* Constructor */); + context.enableEmitNotification(243 /* VariableStatement */); } } function onEmitNode(hint, node, emitCallback) { @@ -95920,11 +96963,11 @@ ${lanes.join("\n")} } function substituteExpression(node) { switch (node.kind) { - case 210 /* PropertyAccessExpression */: + case 211 /* PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 211 /* ElementAccessExpression */: + case 212 /* ElementAccessExpression */: return substituteElementAccessExpression(node); - case 212 /* CallExpression */: + case 213 /* CallExpression */: return substituteCallExpression(node); } return node; @@ -95968,7 +97011,7 @@ ${lanes.join("\n")} } function isSuperContainer(node) { const kind = node.kind; - return kind === 262 /* ClassDeclaration */ || kind === 175 /* Constructor */ || kind === 173 /* MethodDeclaration */ || kind === 176 /* GetAccessor */ || kind === 177 /* SetAccessor */; + return kind === 263 /* ClassDeclaration */ || kind === 176 /* Constructor */ || kind === 174 /* MethodDeclaration */ || kind === 177 /* GetAccessor */ || kind === 178 /* SetAccessor */; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { if (enclosingSuperContainerFlags & 256 /* MethodWithSuperPropertyAssignmentInAsync */) { @@ -96214,119 +97257,119 @@ ${lanes.join("\n")} return node; } switch (node.kind) { - case 222 /* AwaitExpression */: + case 223 /* AwaitExpression */: return visitAwaitExpression(node); - case 228 /* YieldExpression */: + case 229 /* YieldExpression */: return visitYieldExpression(node); - case 252 /* ReturnStatement */: + case 253 /* ReturnStatement */: return visitReturnStatement(node); - case 255 /* LabeledStatement */: + case 256 /* LabeledStatement */: return visitLabeledStatement(node); - case 209 /* ObjectLiteralExpression */: + case 210 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: return visitBinaryExpression(node, expressionResultIsUnused2); - case 360 /* CommaListExpression */: + case 361 /* CommaListExpression */: return visitCommaListExpression(node, expressionResultIsUnused2); - case 298 /* CatchClause */: + case 299 /* CatchClause */: return visitCatchClause(node); - case 242 /* VariableStatement */: + case 243 /* VariableStatement */: return visitVariableStatement(node); - case 259 /* VariableDeclaration */: + case 260 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 245 /* DoStatement */: - case 246 /* WhileStatement */: - case 248 /* ForInStatement */: + case 246 /* DoStatement */: + case 247 /* WhileStatement */: + case 249 /* ForInStatement */: return doWithHierarchyFacts( visitDefault, node, 0 /* IterationStatementExcludes */, 2 /* IterationStatementIncludes */ ); - case 249 /* ForOfStatement */: + case 250 /* ForOfStatement */: return visitForOfStatement( node, /*outermostLabeledStatement*/ void 0 ); - case 247 /* ForStatement */: + case 248 /* ForStatement */: return doWithHierarchyFacts( visitForStatement, node, 0 /* IterationStatementExcludes */, 2 /* IterationStatementIncludes */ ); - case 221 /* VoidExpression */: + case 222 /* VoidExpression */: return visitVoidExpression(node); - case 175 /* Constructor */: + case 176 /* Constructor */: return doWithHierarchyFacts( visitConstructorDeclaration, node, 2 /* ClassOrFunctionExcludes */, 1 /* ClassOrFunctionIncludes */ ); - case 173 /* MethodDeclaration */: + case 174 /* MethodDeclaration */: return doWithHierarchyFacts( visitMethodDeclaration, node, 2 /* ClassOrFunctionExcludes */, 1 /* ClassOrFunctionIncludes */ ); - case 176 /* GetAccessor */: + case 177 /* GetAccessor */: return doWithHierarchyFacts( visitGetAccessorDeclaration, node, 2 /* ClassOrFunctionExcludes */, 1 /* ClassOrFunctionIncludes */ ); - case 177 /* SetAccessor */: + case 178 /* SetAccessor */: return doWithHierarchyFacts( visitSetAccessorDeclaration, node, 2 /* ClassOrFunctionExcludes */, 1 /* ClassOrFunctionIncludes */ ); - case 261 /* FunctionDeclaration */: + case 262 /* FunctionDeclaration */: return doWithHierarchyFacts( visitFunctionDeclaration, node, 2 /* ClassOrFunctionExcludes */, 1 /* ClassOrFunctionIncludes */ ); - case 217 /* FunctionExpression */: + case 218 /* FunctionExpression */: return doWithHierarchyFacts( visitFunctionExpression, node, 2 /* ClassOrFunctionExcludes */, 1 /* ClassOrFunctionIncludes */ ); - case 218 /* ArrowFunction */: + case 219 /* ArrowFunction */: return doWithHierarchyFacts( visitArrowFunction, node, 2 /* ArrowFunctionExcludes */, 0 /* ArrowFunctionIncludes */ ); - case 168 /* Parameter */: + case 169 /* Parameter */: return visitParameter(node); - case 243 /* ExpressionStatement */: + case 244 /* ExpressionStatement */: return visitExpressionStatement(node); - case 216 /* ParenthesizedExpression */: + case 217 /* ParenthesizedExpression */: return visitParenthesizedExpression(node, expressionResultIsUnused2); - case 214 /* TaggedTemplateExpression */: + case 215 /* TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 210 /* PropertyAccessExpression */: + case 211 /* PropertyAccessExpression */: if (capturedSuperProperties && isPropertyAccessExpression(node) && node.expression.kind === 108 /* SuperKeyword */) { capturedSuperProperties.add(node.name.escapedText); } return visitEachChild(node, visitor, context); - case 211 /* ElementAccessExpression */: + case 212 /* ElementAccessExpression */: if (capturedSuperProperties && node.expression.kind === 108 /* SuperKeyword */) { hasSuperElementAccess = true; } return visitEachChild(node, visitor, context); - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: return doWithHierarchyFacts( visitDefault, node, @@ -96411,7 +97454,7 @@ ${lanes.join("\n")} function visitLabeledStatement(node) { if (enclosingFunctionFlags & 2 /* Async */) { const statement = unwrapInnermostStatementOfLabel(node); - if (statement.kind === 249 /* ForOfStatement */ && statement.awaitModifier) { + if (statement.kind === 250 /* ForOfStatement */ && statement.awaitModifier) { return visitForOfStatement(statement, node); } return factory2.restoreEnclosingLabel(visitNode(statement, visitor, isStatement, factory2.liftToBlock), node); @@ -96422,7 +97465,7 @@ ${lanes.join("\n")} let chunkObject; const objects = []; for (const e of elements) { - if (e.kind === 304 /* SpreadAssignment */) { + if (e.kind === 305 /* SpreadAssignment */) { if (chunkObject) { objects.push(factory2.createObjectLiteralExpression(chunkObject)); chunkObject = void 0; @@ -96430,7 +97473,7 @@ ${lanes.join("\n")} const target = e.expression; objects.push(visitNode(target, visitor, isExpression)); } else { - chunkObject = append(chunkObject, e.kind === 302 /* PropertyAssignment */ ? factory2.createPropertyAssignment(e.name, visitNode(e.initializer, visitor, isExpression)) : visitNode(e, visitor, isObjectLiteralElementLike)); + chunkObject = append(chunkObject, e.kind === 303 /* PropertyAssignment */ ? factory2.createPropertyAssignment(e.name, visitNode(e.initializer, visitor, isExpression)) : visitNode(e, visitor, isObjectLiteralElementLike)); } } if (chunkObject) { @@ -96441,7 +97484,7 @@ ${lanes.join("\n")} function visitObjectLiteralExpression(node) { if (node.transformFlags & 65536 /* ContainsObjectRestOrSpread */) { const objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 209 /* ObjectLiteralExpression */) { + if (objects.length && objects[0].kind !== 210 /* ObjectLiteralExpression */) { objects.unshift(factory2.createObjectLiteralExpression()); } let expression = objects[0]; @@ -97210,15 +98253,15 @@ ${lanes.join("\n")} function enableSubstitutionForAsyncMethodsWithSuper() { if ((enabledSubstitutions & 1 /* AsyncMethodsWithSuper */) === 0) { enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */; - context.enableSubstitution(212 /* CallExpression */); - context.enableSubstitution(210 /* PropertyAccessExpression */); - context.enableSubstitution(211 /* ElementAccessExpression */); - context.enableEmitNotification(262 /* ClassDeclaration */); - context.enableEmitNotification(173 /* MethodDeclaration */); - context.enableEmitNotification(176 /* GetAccessor */); - context.enableEmitNotification(177 /* SetAccessor */); - context.enableEmitNotification(175 /* Constructor */); - context.enableEmitNotification(242 /* VariableStatement */); + context.enableSubstitution(213 /* CallExpression */); + context.enableSubstitution(211 /* PropertyAccessExpression */); + context.enableSubstitution(212 /* ElementAccessExpression */); + context.enableEmitNotification(263 /* ClassDeclaration */); + context.enableEmitNotification(174 /* MethodDeclaration */); + context.enableEmitNotification(177 /* GetAccessor */); + context.enableEmitNotification(178 /* SetAccessor */); + context.enableEmitNotification(176 /* Constructor */); + context.enableEmitNotification(243 /* VariableStatement */); } } function onEmitNode(hint, node, emitCallback) { @@ -97249,11 +98292,11 @@ ${lanes.join("\n")} } function substituteExpression(node) { switch (node.kind) { - case 210 /* PropertyAccessExpression */: + case 211 /* PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 211 /* ElementAccessExpression */: + case 212 /* ElementAccessExpression */: return substituteElementAccessExpression(node); - case 212 /* CallExpression */: + case 213 /* CallExpression */: return substituteCallExpression(node); } return node; @@ -97297,7 +98340,7 @@ ${lanes.join("\n")} } function isSuperContainer(node) { const kind = node.kind; - return kind === 262 /* ClassDeclaration */ || kind === 175 /* Constructor */ || kind === 173 /* MethodDeclaration */ || kind === 176 /* GetAccessor */ || kind === 177 /* SetAccessor */; + return kind === 263 /* ClassDeclaration */ || kind === 176 /* Constructor */ || kind === 174 /* MethodDeclaration */ || kind === 177 /* GetAccessor */ || kind === 178 /* SetAccessor */; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { if (enclosingSuperContainerFlags & 256 /* MethodWithSuperPropertyAssignmentInAsync */) { @@ -97348,7 +98391,7 @@ ${lanes.join("\n")} return node; } switch (node.kind) { - case 298 /* CatchClause */: + case 299 /* CatchClause */: return visitCatchClause(node); default: return visitEachChild(node, visitor, context); @@ -97393,7 +98436,7 @@ ${lanes.join("\n")} return node; } switch (node.kind) { - case 212 /* CallExpression */: { + case 213 /* CallExpression */: { const updated = visitNonOptionalCallExpression( node, /*captureThisArg*/ @@ -97402,8 +98445,8 @@ ${lanes.join("\n")} Debug.assertNotNode(updated, isSyntheticReference); return updated; } - case 210 /* PropertyAccessExpression */: - case 211 /* ElementAccessExpression */: + case 211 /* PropertyAccessExpression */: + case 212 /* ElementAccessExpression */: if (isOptionalChain(node)) { const updated = visitOptionalExpression( node, @@ -97416,12 +98459,12 @@ ${lanes.join("\n")} return updated; } return visitEachChild(node, visitor, context); - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: if (node.operatorToken.kind === 61 /* QuestionQuestionToken */) { return transformNullishCoalescingExpression(node); } return visitEachChild(node, visitor, context); - case 219 /* DeleteExpression */: + case 220 /* DeleteExpression */: return visitDeleteExpression(node); default: return visitEachChild(node, visitor, context); @@ -97459,7 +98502,7 @@ ${lanes.join("\n")} thisArg = expression; } } - expression = node.kind === 210 /* PropertyAccessExpression */ ? factory2.updatePropertyAccessExpression(node, expression, visitNode(node.name, visitor, isIdentifier)) : factory2.updateElementAccessExpression(node, expression, visitNode(node.argumentExpression, visitor, isExpression)); + expression = node.kind === 211 /* PropertyAccessExpression */ ? factory2.updatePropertyAccessExpression(node, expression, visitNode(node.name, visitor, isIdentifier)) : factory2.updateElementAccessExpression(node, expression, visitNode(node.argumentExpression, visitor, isExpression)); return thisArg ? factory2.createSyntheticReferenceExpression(expression, thisArg) : expression; } function visitNonOptionalCallExpression(node, captureThisArg) { @@ -97495,12 +98538,12 @@ ${lanes.join("\n")} } function visitNonOptionalExpression(node, captureThisArg, isDelete) { switch (node.kind) { - case 216 /* ParenthesizedExpression */: + case 217 /* ParenthesizedExpression */: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete); - case 210 /* PropertyAccessExpression */: - case 211 /* ElementAccessExpression */: + case 211 /* PropertyAccessExpression */: + case 212 /* ElementAccessExpression */: return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete); - case 212 /* CallExpression */: + case 213 /* CallExpression */: return visitNonOptionalCallExpression(node, captureThisArg); default: return visitNode(node, visitor, isExpression); @@ -97526,8 +98569,8 @@ ${lanes.join("\n")} for (let i = 0; i < chain.length; i++) { const segment = chain[i]; switch (segment.kind) { - case 210 /* PropertyAccessExpression */: - case 211 /* ElementAccessExpression */: + case 211 /* PropertyAccessExpression */: + case 212 /* ElementAccessExpression */: if (i === chain.length - 1 && captureThisArg) { if (!isSimpleCopiableExpression(rightExpression)) { thisArg = factory2.createTempVariable(hoistVariableDeclaration); @@ -97536,9 +98579,9 @@ ${lanes.join("\n")} thisArg = rightExpression; } } - rightExpression = segment.kind === 210 /* PropertyAccessExpression */ ? factory2.createPropertyAccessExpression(rightExpression, visitNode(segment.name, visitor, isIdentifier)) : factory2.createElementAccessExpression(rightExpression, visitNode(segment.argumentExpression, visitor, isExpression)); + rightExpression = segment.kind === 211 /* PropertyAccessExpression */ ? factory2.createPropertyAccessExpression(rightExpression, visitNode(segment.name, visitor, isIdentifier)) : factory2.createElementAccessExpression(rightExpression, visitNode(segment.argumentExpression, visitor, isExpression)); break; - case 212 /* CallExpression */: + case 213 /* CallExpression */: if (i === 0 && leftThisArg) { if (!isGeneratedIdentifier(leftThisArg)) { leftThisArg = factory2.cloneNode(leftThisArg); @@ -97721,22 +98764,636 @@ ${lanes.join("\n")} // src/compiler/transformers/esnext.ts function transformESNext(context) { + const { + factory: factory2, + getEmitHelperFactory: emitHelpers, + hoistVariableDeclaration, + startLexicalEnvironment, + endLexicalEnvironment + } = context; + let exportBindings; + let exportVars; + let defaultExportBinding; + let exportEqualsBinding; return chainBundle(context, transformSourceFile); function transformSourceFile(node) { if (node.isDeclarationFile) { return node; } - return visitEachChild(node, visitor, context); + const visited = visitNode(node, visitor, isSourceFile); + addEmitHelpers(visited, context.readEmitHelpers()); + exportVars = void 0; + exportBindings = void 0; + defaultExportBinding = void 0; + return visited; } function visitor(node) { if ((node.transformFlags & 4 /* ContainsESNext */) === 0) { return node; } switch (node.kind) { + case 312 /* SourceFile */: + return visitSourceFile(node); + case 241 /* Block */: + return visitBlock(node); + case 248 /* ForStatement */: + return visitForStatement(node); + case 250 /* ForOfStatement */: + return visitForOfStatement(node); + case 255 /* SwitchStatement */: + return visitSwitchStatement(node); default: return visitEachChild(node, visitor, context); } } + function visitSourceFile(node) { + const usingKind = getUsingKindOfStatements(node.statements); + if (usingKind) { + startLexicalEnvironment(); + exportBindings = new IdentifierNameMap(); + exportVars = []; + const prologueCount = countPrologueStatements(node.statements); + const topLevelStatements = []; + addRange(topLevelStatements, visitArray(node.statements, visitor, isStatement, 0, prologueCount)); + let pos = prologueCount; + while (pos < node.statements.length) { + const statement = node.statements[pos]; + if (getUsingKind(statement) !== 0 /* None */) { + if (pos > prologueCount) { + addRange(topLevelStatements, visitNodes2(node.statements, visitor, isStatement, prologueCount, pos - prologueCount)); + } + break; + } + pos++; + } + Debug.assert(pos < node.statements.length, "Should have encountered at least one 'using' statement."); + const envBinding = createEnvBinding(); + const bodyStatements = transformUsingDeclarations(node.statements, pos, node.statements.length, envBinding, topLevelStatements); + if (exportBindings.size) { + append(topLevelStatements, factory2.createExportDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + false, + factory2.createNamedExports(arrayFrom(exportBindings.values())) + )); + } + addRange(topLevelStatements, endLexicalEnvironment()); + if (exportVars.length) { + topLevelStatements.push(factory2.createVariableStatement( + factory2.createModifiersFromModifierFlags(1 /* Export */), + factory2.createVariableDeclarationList( + exportVars, + 1 /* Let */ + ) + )); + } + addRange(topLevelStatements, createDownlevelUsingStatements(bodyStatements, envBinding, usingKind === 2 /* Async */)); + if (exportEqualsBinding) { + topLevelStatements.push(factory2.createExportAssignment( + /*modifiers*/ + void 0, + /*isExportEquals*/ + true, + exportEqualsBinding + )); + } + return factory2.updateSourceFile(node, topLevelStatements); + } + return visitEachChild(node, visitor, context); + } + function visitBlock(node) { + const usingKind = getUsingKindOfStatements(node.statements); + if (usingKind) { + const prologueCount = countPrologueStatements(node.statements); + const envBinding = createEnvBinding(); + return factory2.updateBlock( + node, + [ + ...visitArray(node.statements, visitor, isStatement, 0, prologueCount), + ...createDownlevelUsingStatements( + transformUsingDeclarations( + node.statements, + prologueCount, + node.statements.length, + envBinding, + /*topLevelStatements*/ + void 0 + ), + envBinding, + usingKind === 2 /* Async */ + ) + ] + ); + } + return visitEachChild(node, visitor, context); + } + function visitForStatement(node) { + if (node.initializer && isUsingVariableDeclarationList(node.initializer)) { + return visitNode( + factory2.createBlock([ + factory2.createVariableStatement( + /*modifiers*/ + void 0, + node.initializer + ), + factory2.updateForStatement( + node, + /*initializer*/ + void 0, + node.condition, + node.incrementor, + node.statement + ) + ]), + visitor, + isStatement + ); + } + return visitEachChild(node, visitor, context); + } + function visitForOfStatement(node) { + if (isUsingVariableDeclarationList(node.initializer)) { + const forInitializer = node.initializer; + Debug.assertNode(forInitializer, isUsingVariableDeclarationList); + Debug.assert(forInitializer.declarations.length === 1, "ForInitializer may only have one declaration"); + const forDecl = forInitializer.declarations[0]; + Debug.assert(!forDecl.initializer, "ForInitializer may not have an initializer"); + const isAwaitUsing = getUsingKindOfVariableDeclarationList(forInitializer) === 2 /* Async */; + const temp = factory2.getGeneratedNameForNode(forDecl.name); + const usingVar = factory2.updateVariableDeclaration( + forDecl, + forDecl.name, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + temp + ); + const usingVarList = factory2.createVariableDeclarationList([usingVar], isAwaitUsing ? 6 /* AwaitUsing */ : 4 /* Using */); + const usingVarStatement = factory2.createVariableStatement( + /*modifiers*/ + void 0, + usingVarList + ); + return visitNode( + factory2.updateForOfStatement( + node, + node.awaitModifier, + factory2.createVariableDeclarationList([ + factory2.createVariableDeclaration(temp) + ], 2 /* Const */), + node.expression, + isBlock(node.statement) ? factory2.updateBlock(node.statement, [ + usingVarStatement, + ...node.statement.statements + ]) : factory2.createBlock( + [ + usingVarStatement, + node.statement + ], + /*multiLine*/ + true + ) + ), + visitor, + isStatement + ); + } + return visitEachChild(node, visitor, context); + } + function visitCaseOrDefaultClause(node, envBinding) { + if (getUsingKindOfStatements(node.statements) !== 0 /* None */) { + if (isCaseClause(node)) { + return factory2.updateCaseClause( + node, + visitNode(node.expression, visitor, isExpression), + transformUsingDeclarations( + node.statements, + /*start*/ + 0, + node.statements.length, + envBinding, + /*topLevelStatements*/ + void 0 + ) + ); + } else { + return factory2.updateDefaultClause( + node, + transformUsingDeclarations( + node.statements, + /*start*/ + 0, + node.statements.length, + envBinding, + /*topLevelStatements*/ + void 0 + ) + ); + } + } + return visitEachChild(node, visitor, context); + } + function visitSwitchStatement(node) { + const usingKind = getUsingKindOfCaseOrDefaultClauses(node.caseBlock.clauses); + if (usingKind) { + const envBinding = createEnvBinding(); + return createDownlevelUsingStatements( + [ + factory2.updateSwitchStatement( + node, + visitNode(node.expression, visitor, isExpression), + factory2.updateCaseBlock( + node.caseBlock, + node.caseBlock.clauses.map((clause) => visitCaseOrDefaultClause(clause, envBinding)) + ) + ) + ], + envBinding, + usingKind === 2 /* Async */ + ); + } + return visitEachChild(node, visitor, context); + } + function transformUsingDeclarations(statementsIn, start, end, envBinding, topLevelStatements) { + const statements = []; + for (let i = start; i < end; i++) { + const statement = statementsIn[i]; + const usingKind = getUsingKind(statement); + if (usingKind) { + Debug.assertNode(statement, isVariableStatement); + const declarations = []; + for (let declaration of statement.declarationList.declarations) { + if (!isIdentifier(declaration.name)) { + declarations.length = 0; + break; + } + if (isNamedEvaluation(declaration)) { + declaration = transformNamedEvaluation(context, declaration); + } + const initializer = visitNode(declaration.initializer, visitor, isExpression) ?? factory2.createVoidZero(); + declarations.push(factory2.updateVariableDeclaration( + declaration, + declaration.name, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + emitHelpers().createAddDisposableResourceHelper( + envBinding, + initializer, + usingKind === 2 /* Async */ + ) + )); + } + if (declarations.length) { + const varList = factory2.createVariableDeclarationList(declarations, 2 /* Const */); + setOriginalNode(varList, statement.declarationList); + setTextRange(varList, statement.declarationList); + hoistOrAppendNode(factory2.updateVariableStatement( + statement, + /*modifiers*/ + void 0, + varList + )); + continue; + } + } + const result = visitor(statement); + if (isArray(result)) { + result.forEach(hoistOrAppendNode); + } else if (result) { + hoistOrAppendNode(result); + } + } + return statements; + function hoistOrAppendNode(node) { + Debug.assertNode(node, isStatement); + append(statements, hoist(node)); + } + function hoist(node) { + if (!topLevelStatements) + return node; + switch (node.kind) { + case 272 /* ImportDeclaration */: + case 271 /* ImportEqualsDeclaration */: + case 278 /* ExportDeclaration */: + case 262 /* FunctionDeclaration */: + return hoistImportOrExportOrHoistedDeclaration(node, topLevelStatements); + case 277 /* ExportAssignment */: + return hoistExportAssignment(node); + case 263 /* ClassDeclaration */: + return hoistClassDeclaration(node); + case 243 /* VariableStatement */: + return hoistVariableStatement(node); + } + return node; + } + } + function hoistImportOrExportOrHoistedDeclaration(node, topLevelStatements) { + topLevelStatements.push(node); + return void 0; + } + function hoistExportAssignment(node) { + return node.isExportEquals ? hoistExportEquals(node) : hoistExportDefault(node); + } + function hoistExportDefault(node) { + if (defaultExportBinding) { + return node; + } + defaultExportBinding = factory2.createUniqueName("_default", 8 /* ReservedInNestedScopes */ | 32 /* FileLevel */ | 16 /* Optimistic */); + hoistBindingIdentifier( + defaultExportBinding, + /*isExport*/ + true, + "default", + node + ); + let expression = node.expression; + let innerExpression = skipOuterExpressions(expression); + if (isNamedEvaluation(innerExpression)) { + innerExpression = transformNamedEvaluation( + context, + innerExpression, + /*ignoreEmptyStringLiteral*/ + false, + "default" + ); + expression = factory2.restoreOuterExpressions(expression, innerExpression); + } + const assignment = factory2.createAssignment(defaultExportBinding, expression); + return factory2.createExpressionStatement(assignment); + } + function hoistExportEquals(node) { + if (exportEqualsBinding) { + return node; + } + exportEqualsBinding = factory2.createUniqueName("_default", 8 /* ReservedInNestedScopes */ | 32 /* FileLevel */ | 16 /* Optimistic */); + hoistVariableDeclaration(exportEqualsBinding); + const assignment = factory2.createAssignment(exportEqualsBinding, node.expression); + return factory2.createExpressionStatement(assignment); + } + function hoistClassDeclaration(node) { + if (!node.name && defaultExportBinding) { + return node; + } + const isExported2 = hasSyntacticModifier(node, 1 /* Export */); + const isDefault = hasSyntacticModifier(node, 1024 /* Default */); + let expression = factory2.converters.convertToClassExpression(node); + if (node.name) { + hoistBindingIdentifier( + factory2.getLocalName(node), + isExported2 && !isDefault, + /*exportAlias*/ + void 0, + node + ); + expression = factory2.createAssignment(factory2.getDeclarationName(node), expression); + if (isNamedEvaluation(expression)) { + expression = transformNamedEvaluation( + context, + expression, + /*ignoreEmptyStringLiteral*/ + false + ); + } + setOriginalNode(expression, node); + setSourceMapRange(expression, node); + setCommentRange(expression, node); + } + if (isDefault && !defaultExportBinding) { + defaultExportBinding = factory2.createUniqueName("_default", 8 /* ReservedInNestedScopes */ | 32 /* FileLevel */ | 16 /* Optimistic */); + hoistBindingIdentifier( + defaultExportBinding, + /*isExport*/ + true, + "default", + node + ); + expression = factory2.createAssignment(defaultExportBinding, expression); + if (isNamedEvaluation(expression)) { + expression = transformNamedEvaluation( + context, + expression, + /*ignoreEmptyStringLiteral*/ + false, + "default" + ); + } + setOriginalNode(expression, node); + } + return factory2.createExpressionStatement(expression); + } + function hoistVariableStatement(node) { + let expressions; + const isExported2 = hasSyntacticModifier(node, 1 /* Export */); + for (const variable of node.declarationList.declarations) { + hoistBindingElement(variable, isExported2, variable); + if (variable.initializer) { + expressions = append(expressions, hoistInitializedVariable(variable)); + } + } + if (expressions) { + const statement = factory2.createExpressionStatement(factory2.inlineExpressions(expressions)); + setOriginalNode(statement, node); + setCommentRange(statement, node); + setSourceMapRange(statement, node); + return statement; + } + return void 0; + } + function hoistInitializedVariable(node) { + Debug.assertIsDefined(node.initializer); + let target; + if (isIdentifier(node.name)) { + target = factory2.cloneNode(node.name); + setEmitFlags(target, getEmitFlags(target) & ~(32768 /* LocalName */ | 16384 /* ExportName */ | 65536 /* InternalName */)); + } else { + target = factory2.converters.convertToAssignmentPattern(node.name); + } + const assignment = factory2.createAssignment(target, node.initializer); + setOriginalNode(assignment, node); + setCommentRange(assignment, node); + setSourceMapRange(assignment, node); + return assignment; + } + function hoistBindingElement(node, isExportedDeclaration, original) { + if (isBindingPattern(node.name)) { + for (const element of node.name.elements) { + if (!isOmittedExpression(element)) { + hoistBindingElement(element, isExportedDeclaration, original); + } + } + } else { + hoistBindingIdentifier( + node.name, + isExportedDeclaration, + /*exportAlias*/ + void 0, + original + ); + } + } + function hoistBindingIdentifier(node, isExport, exportAlias, original) { + const name = isGeneratedIdentifier(node) ? node : factory2.cloneNode(node); + if (isExport) { + if (exportAlias === void 0 && !isLocalName(name)) { + const varDecl = factory2.createVariableDeclaration(name); + if (original) { + setOriginalNode(varDecl, original); + } + exportVars.push(varDecl); + return; + } + const localName = exportAlias !== void 0 ? name : void 0; + const exportName = exportAlias !== void 0 ? exportAlias : name; + const specifier = factory2.createExportSpecifier( + /*isTypeOnly*/ + false, + localName, + exportName + ); + if (original) { + setOriginalNode(specifier, original); + } + exportBindings.set(name, specifier); + } + hoistVariableDeclaration(name); + } + function createEnvBinding() { + return factory2.createUniqueName("env"); + } + function createDownlevelUsingStatements(bodyStatements, envBinding, async) { + const statements = []; + const envObject = factory2.createObjectLiteralExpression([ + factory2.createPropertyAssignment("stack", factory2.createArrayLiteralExpression()), + factory2.createPropertyAssignment("error", factory2.createVoidZero()), + factory2.createPropertyAssignment("hasError", factory2.createFalse()) + ]); + const envVar = factory2.createVariableDeclaration( + envBinding, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + envObject + ); + const envVarList = factory2.createVariableDeclarationList([envVar], 2 /* Const */); + const envVarStatement = factory2.createVariableStatement( + /*modifiers*/ + void 0, + envVarList + ); + statements.push(envVarStatement); + const tryBlock = factory2.createBlock( + bodyStatements, + /*multiLine*/ + true + ); + const bodyCatchBinding = factory2.createUniqueName("e"); + const catchClause = factory2.createCatchClause( + bodyCatchBinding, + factory2.createBlock( + [ + factory2.createExpressionStatement( + factory2.createAssignment( + factory2.createPropertyAccessExpression(envBinding, "error"), + bodyCatchBinding + ) + ), + factory2.createExpressionStatement( + factory2.createAssignment( + factory2.createPropertyAccessExpression(envBinding, "hasError"), + factory2.createTrue() + ) + ) + ], + /*multiLine*/ + true + ) + ); + let finallyBlock; + if (async) { + const result = factory2.createUniqueName("result"); + finallyBlock = factory2.createBlock( + [ + factory2.createVariableStatement( + /*modifiers*/ + void 0, + factory2.createVariableDeclarationList([ + factory2.createVariableDeclaration( + result, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + emitHelpers().createDisposeResourcesHelper(envBinding) + ) + ], 2 /* Const */) + ), + factory2.createIfStatement(result, factory2.createExpressionStatement(factory2.createAwaitExpression(result))) + ], + /*multiLine*/ + true + ); + } else { + finallyBlock = factory2.createBlock( + [ + factory2.createExpressionStatement( + emitHelpers().createDisposeResourcesHelper(envBinding) + ) + ], + /*multiLine*/ + true + ); + } + const tryStatement = factory2.createTryStatement(tryBlock, catchClause, finallyBlock); + statements.push(tryStatement); + return statements; + } + } + function countPrologueStatements(statements) { + for (let i = 0; i < statements.length; i++) { + if (!isPrologueDirective(statements[i]) && !isCustomPrologue(statements[i])) { + return i; + } + } + return 0; + } + function isUsingVariableDeclarationList(node) { + return isVariableDeclarationList(node) && getUsingKindOfVariableDeclarationList(node) !== 0 /* None */; + } + function getUsingKindOfVariableDeclarationList(node) { + return (node.flags & 7 /* BlockScoped */) === 6 /* AwaitUsing */ ? 2 /* Async */ : (node.flags & 7 /* BlockScoped */) === 4 /* Using */ ? 1 /* Sync */ : 0 /* None */; + } + function getUsingKindOfVariableStatement(node) { + return getUsingKindOfVariableDeclarationList(node.declarationList); + } + function getUsingKind(statement) { + return isVariableStatement(statement) ? getUsingKindOfVariableStatement(statement) : 0 /* None */; + } + function getUsingKindOfStatements(statements) { + let result = 0 /* None */; + for (const statement of statements) { + const usingKind = getUsingKind(statement); + if (usingKind === 2 /* Async */) + return 2 /* Async */; + if (usingKind > result) + result = usingKind; + } + return result; + } + function getUsingKindOfCaseOrDefaultClauses(clauses) { + let result = 0 /* None */; + for (const clause of clauses) { + const usingKind = getUsingKindOfStatements(clause.statements); + if (usingKind === 2 /* Async */) + return 2 /* Async */; + if (usingKind > result) + result = usingKind; + } + return result; } var init_esnext = __esm({ "src/compiler/transformers/esnext.ts"() { @@ -97896,25 +99553,25 @@ ${lanes.join("\n")} } function visitorWorker(node) { switch (node.kind) { - case 283 /* JsxElement */: + case 284 /* JsxElement */: return visitJsxElement( node, /*isChild*/ false ); - case 284 /* JsxSelfClosingElement */: + case 285 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement( node, /*isChild*/ false ); - case 287 /* JsxFragment */: + case 288 /* JsxFragment */: return visitJsxFragment( node, /*isChild*/ false ); - case 293 /* JsxExpression */: + case 294 /* JsxExpression */: return visitJsxExpression(node); default: return visitEachChild(node, visitor, context); @@ -97924,21 +99581,21 @@ ${lanes.join("\n")} switch (node.kind) { case 12 /* JsxText */: return visitJsxText(node); - case 293 /* JsxExpression */: + case 294 /* JsxExpression */: return visitJsxExpression(node); - case 283 /* JsxElement */: + case 284 /* JsxElement */: return visitJsxElement( node, /*isChild*/ true ); - case 284 /* JsxSelfClosingElement */: + case 285 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement( node, /*isChild*/ true ); - case 287 /* JsxFragment */: + case 288 /* JsxFragment */: return visitJsxFragment( node, /*isChild*/ @@ -98146,15 +99803,15 @@ ${lanes.join("\n")} for (const prop of attr.expression.properties) { if (isSpreadAssignment(prop)) { finishObjectLiteralIfNeeded(); - expressions.push(prop.expression); + expressions.push(Debug.checkDefined(visitNode(prop.expression, visitor, isExpression))); continue; } - properties.push(prop); + properties.push(Debug.checkDefined(visitNode(prop, visitor))); } continue; } finishObjectLiteralIfNeeded(); - expressions.push(attr.expression); + expressions.push(Debug.checkDefined(visitNode(attr.expression, visitor, isExpression))); continue; } properties.push(transformJsxAttributeToObjectLiteralElement(attr)); @@ -98188,7 +99845,7 @@ ${lanes.join("\n")} const literal = factory2.createStringLiteral(tryDecodeEntities(node.text) || node.text, singleQuote); return setTextRange(literal, node); } - if (node.kind === 293 /* JsxExpression */) { + if (node.kind === 294 /* JsxExpression */) { if (node.expression === void 0) { return factory2.createTrue(); } @@ -98262,7 +99919,7 @@ ${lanes.join("\n")} return decoded === text ? void 0 : decoded; } function getTagName(node) { - if (node.kind === 283 /* JsxElement */) { + if (node.kind === 284 /* JsxElement */) { return getTagName(node.openingElement); } else { const tagName = node.tagName; @@ -98569,7 +100226,7 @@ ${lanes.join("\n")} return node; } switch (node.kind) { - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: return visitBinaryExpression(node); default: return visitEachChild(node, visitor, context); @@ -98703,7 +100360,7 @@ ${lanes.join("\n")} hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -32768 /* SubtreeFactsMask */ | ancestorFacts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { - return (hierarchyFacts & 8192 /* ConstructorWithCapturedSuper */) !== 0 && node.kind === 252 /* ReturnStatement */ && !node.expression; + return (hierarchyFacts & 8192 /* ConstructorWithCapturedSuper */) !== 0 && node.kind === 253 /* ReturnStatement */ && !node.expression; } function isOrMayContainReturnCompletion(node) { return node.transformFlags & 4194304 /* ContainsHoistedDeclarationOrCompletion */ && (isReturnStatement(node) || isIfStatement(node) || isWithStatement(node) || isSwitchStatement(node) || isCaseBlock(node) || isCaseClause(node) || isDefaultClause(node) || isTryStatement(node) || isCatchClause(node) || isLabeledStatement(node) || isIterationStatement( @@ -98770,85 +100427,85 @@ ${lanes.join("\n")} switch (node.kind) { case 126 /* StaticKeyword */: return void 0; - case 262 /* ClassDeclaration */: + case 263 /* ClassDeclaration */: return visitClassDeclaration(node); - case 230 /* ClassExpression */: + case 231 /* ClassExpression */: return visitClassExpression(node); - case 168 /* Parameter */: + case 169 /* Parameter */: return visitParameter(node); - case 261 /* FunctionDeclaration */: + case 262 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 218 /* ArrowFunction */: + case 219 /* ArrowFunction */: return visitArrowFunction(node); - case 217 /* FunctionExpression */: + case 218 /* FunctionExpression */: return visitFunctionExpression(node); - case 259 /* VariableDeclaration */: + case 260 /* VariableDeclaration */: return visitVariableDeclaration(node); case 80 /* Identifier */: return visitIdentifier(node); - case 260 /* VariableDeclarationList */: + case 261 /* VariableDeclarationList */: return visitVariableDeclarationList(node); - case 254 /* SwitchStatement */: + case 255 /* SwitchStatement */: return visitSwitchStatement(node); - case 268 /* CaseBlock */: + case 269 /* CaseBlock */: return visitCaseBlock(node); - case 240 /* Block */: + case 241 /* Block */: return visitBlock( node, /*isFunctionBody*/ false ); - case 251 /* BreakStatement */: - case 250 /* ContinueStatement */: + case 252 /* BreakStatement */: + case 251 /* ContinueStatement */: return visitBreakOrContinueStatement(node); - case 255 /* LabeledStatement */: + case 256 /* LabeledStatement */: return visitLabeledStatement(node); - case 245 /* DoStatement */: - case 246 /* WhileStatement */: + case 246 /* DoStatement */: + case 247 /* WhileStatement */: return visitDoOrWhileStatement( node, /*outermostLabeledStatement*/ void 0 ); - case 247 /* ForStatement */: + case 248 /* ForStatement */: return visitForStatement( node, /*outermostLabeledStatement*/ void 0 ); - case 248 /* ForInStatement */: + case 249 /* ForInStatement */: return visitForInStatement( node, /*outermostLabeledStatement*/ void 0 ); - case 249 /* ForOfStatement */: + case 250 /* ForOfStatement */: return visitForOfStatement( node, /*outermostLabeledStatement*/ void 0 ); - case 243 /* ExpressionStatement */: + case 244 /* ExpressionStatement */: return visitExpressionStatement(node); - case 209 /* ObjectLiteralExpression */: + case 210 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 298 /* CatchClause */: + case 299 /* CatchClause */: return visitCatchClause(node); - case 303 /* ShorthandPropertyAssignment */: + case 304 /* ShorthandPropertyAssignment */: return visitShorthandPropertyAssignment(node); - case 166 /* ComputedPropertyName */: + case 167 /* ComputedPropertyName */: return visitComputedPropertyName(node); - case 208 /* ArrayLiteralExpression */: + case 209 /* ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 212 /* CallExpression */: + case 213 /* CallExpression */: return visitCallExpression(node); - case 213 /* NewExpression */: + case 214 /* NewExpression */: return visitNewExpression(node); - case 216 /* ParenthesizedExpression */: + case 217 /* ParenthesizedExpression */: return visitParenthesizedExpression(node, expressionResultIsUnused2); - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: return visitBinaryExpression(node, expressionResultIsUnused2); - case 360 /* CommaListExpression */: + case 361 /* CommaListExpression */: return visitCommaListExpression(node, expressionResultIsUnused2); case 15 /* NoSubstitutionTemplateLiteral */: case 16 /* TemplateHead */: @@ -98859,13 +100516,13 @@ ${lanes.join("\n")} return visitStringLiteral(node); case 9 /* NumericLiteral */: return visitNumericLiteral(node); - case 214 /* TaggedTemplateExpression */: + case 215 /* TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 227 /* TemplateExpression */: + case 228 /* TemplateExpression */: return visitTemplateExpression(node); - case 228 /* YieldExpression */: + case 229 /* YieldExpression */: return visitYieldExpression(node); - case 229 /* SpreadElement */: + case 230 /* SpreadElement */: return visitSpreadElement(node); case 108 /* SuperKeyword */: return visitSuperKeyword( @@ -98874,18 +100531,18 @@ ${lanes.join("\n")} ); case 110 /* ThisKeyword */: return visitThisKeyword(node); - case 235 /* MetaProperty */: + case 236 /* MetaProperty */: return visitMetaProperty(node); - case 173 /* MethodDeclaration */: + case 174 /* MethodDeclaration */: return visitMethodDeclaration(node); - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: return visitAccessorDeclaration(node); - case 242 /* VariableStatement */: + case 243 /* VariableStatement */: return visitVariableStatement(node); - case 252 /* ReturnStatement */: + case 253 /* ReturnStatement */: return visitReturnStatement(node); - case 221 /* VoidExpression */: + case 222 /* VoidExpression */: return visitVoidExpression(node); default: return visitEachChild(node, visitor, context); @@ -98983,7 +100640,7 @@ ${lanes.join("\n")} return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = factory2.createUniqueName("arguments")); } } - if (node.flags & 128 /* IdentifierHasExtendedUnicodeEscape */) { + if (node.flags & 256 /* IdentifierHasExtendedUnicodeEscape */) { return setOriginalNode(setTextRange( factory2.createIdentifier(unescapeLeadingUnderscores(node.escapedText)), node @@ -98993,13 +100650,13 @@ ${lanes.join("\n")} } function visitBreakOrContinueStatement(node) { if (convertedLoopState) { - const jump = node.kind === 251 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; + const jump = node.kind === 252 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; const canUseBreakOrContinue = node.label && convertedLoopState.labels && convertedLoopState.labels.get(idText(node.label)) || !node.label && convertedLoopState.allowedNonLabeledJumps & jump; if (!canUseBreakOrContinue) { let labelMarker; const label = node.label; if (!label) { - if (node.kind === 251 /* BreakStatement */) { + if (node.kind === 252 /* BreakStatement */) { convertedLoopState.nonLocalJumps |= 2 /* Break */; labelMarker = "break"; } else { @@ -99007,7 +100664,7 @@ ${lanes.join("\n")} labelMarker = "continue"; } } else { - if (node.kind === 251 /* BreakStatement */) { + if (node.kind === 252 /* BreakStatement */) { labelMarker = `break-${label.escapedText}`; setLabeledJump( convertedLoopState, @@ -99213,6 +100870,104 @@ ${lanes.join("\n")} setEmitFlags(block, 3072 /* NoComments */); return block; } + function transformConstructorBodyWorker(prologueOut, statementsOut, statementsIn, statementOffset, superPath, superPathDepth, constructor, isDerivedClass, hasSynthesizedSuper, isFirstStatement) { + let mayReplaceThis = false; + const superStatementIndex = superPathDepth < superPath.length ? superPath[superPathDepth] : -1; + const leadingStatementsEnd = superStatementIndex >= 0 ? superStatementIndex : statementsIn.length; + if (isFirstStatement && superStatementIndex >= 0) { + let firstMaterialIndex = statementOffset; + while (isFirstStatement && firstMaterialIndex < superStatementIndex) { + const statement = constructor.body.statements[firstMaterialIndex]; + if (!isUninitializedVariableStatement(statement) && !isUsingDeclarationStateVariableStatement(statement)) + break; + firstMaterialIndex++; + } + isFirstStatement = superStatementIndex === firstMaterialIndex; + } + addRange(statementsOut, visitNodes2(statementsIn, visitor, isStatement, statementOffset, leadingStatementsEnd - statementOffset)); + const superStatement = superStatementIndex >= 0 ? statementsIn[superStatementIndex] : void 0; + if (superStatement && isTryStatement(superStatement)) { + const tryBlockStatements = []; + mayReplaceThis = transformConstructorBodyWorker( + prologueOut, + tryBlockStatements, + superStatement.tryBlock.statements, + /*statementOffset*/ + 0, + superPath, + superPathDepth + 1, + constructor, + isDerivedClass, + hasSynthesizedSuper, + isFirstStatement + ); + const tryBlockStatementsArray = factory2.createNodeArray(tryBlockStatements); + setTextRange(tryBlockStatementsArray, superStatement.tryBlock.statements); + statementsOut.push(factory2.updateTryStatement( + superStatement, + factory2.updateBlock(superStatement.tryBlock, tryBlockStatements), + visitNode(superStatement.catchClause, visitor, isCatchClause), + visitNode(superStatement.finallyBlock, visitor, isBlock) + )); + } else { + const superCall = superStatement && getSuperCallFromStatement(superStatement); + let superCallExpression; + if (hasSynthesizedSuper) { + superCallExpression = createDefaultSuperCallOrThis(); + hierarchyFacts |= 8192 /* ConstructorWithCapturedSuper */; + } else if (superCall) { + superCallExpression = visitSuperCallInBody(superCall); + hierarchyFacts |= 8192 /* ConstructorWithCapturedSuper */; + } + if (isDerivedClass || superCallExpression) { + if (superCallExpression && superStatementIndex === statementsIn.length - 1 && !(constructor.body.transformFlags & 16384 /* ContainsLexicalThis */)) { + const superCall2 = cast(cast(superCallExpression, isBinaryExpression).left, isCallExpression); + const returnStatement = factory2.createReturnStatement(superCallExpression); + setCommentRange(returnStatement, getCommentRange(superCall2)); + setEmitFlags(superCall2, 3072 /* NoComments */); + statementsOut.push(returnStatement); + return false; + } else { + if (isFirstStatement) { + insertCaptureThisForNode(statementsOut, constructor, superCallExpression || createActualThis()); + } else { + insertCaptureThisForNode(prologueOut, constructor, createActualThis()); + if (superCallExpression) { + addSuperThisCaptureThisForNode(statementsOut, superCallExpression); + } + } + mayReplaceThis = true; + } + } else { + insertCaptureThisForNodeIfNeeded(prologueOut, constructor); + } + } + if (superStatementIndex >= 0) { + addRange(statementsOut, visitNodes2(statementsIn, visitor, isStatement, superStatementIndex + 1)); + } + return mayReplaceThis; + } + function isUninitializedVariableStatement(node) { + return isVariableStatement(node) && every(node.declarationList.declarations, (decl) => isIdentifier(decl.name) && !decl.initializer); + } + function isUsingDeclarationStateVariableStatement(node) { + if (!isVariableStatement(node) || node.declarationList.declarations.length !== 1) + return false; + const varDecl = node.declarationList.declarations[0]; + if (!isIdentifier(varDecl.name) || !varDecl.initializer) + return false; + const initializer = varDecl.initializer; + if (!isObjectLiteralExpression(initializer) || initializer.properties.length !== 3) + return false; + const [stackProp, errorProp, hasErrorProp] = initializer.properties; + if (!isPropertyAssignment(stackProp) || !isIdentifier(stackProp.name) || idText(stackProp.name) !== "stack" || !isArrayLiteralExpression(stackProp.initializer)) + return false; + if (!isPropertyAssignment(errorProp) || !isIdentifier(errorProp.name) || idText(errorProp.name) !== "error" || !isVoidExpression(errorProp.initializer) || !isNumericLiteral(errorProp.initializer.expression)) + return false; + if (!isPropertyAssignment(hasErrorProp) || !isIdentifier(hasErrorProp.name) || idText(hasErrorProp.name) !== "hasError" || hasErrorProp.initializer.kind !== 97 /* FalseKeyword */) + return false; + return true; + } function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) { const isDerivedClass = !!extendsClauseElement && skipOuterExpressions(extendsClauseElement.expression).kind !== 106 /* NullKeyword */; if (!constructor) @@ -99220,82 +100975,43 @@ ${lanes.join("\n")} const prologue = []; const statements = []; resumeLexicalEnvironment(); - const existingPrologue = takeWhile(constructor.body.statements, isPrologueDirective); - const { superCall, superStatementIndex } = findSuperCallAndStatementIndex(constructor.body.statements, existingPrologue); - const postSuperStatementsStart = superStatementIndex === -1 ? existingPrologue.length : superStatementIndex + 1; - let statementOffset = postSuperStatementsStart; - if (!hasSynthesizedSuper) - statementOffset = factory2.copyStandardPrologue( - constructor.body.statements, - prologue, - statementOffset, - /*ensureUseStrict*/ - false - ); - if (!hasSynthesizedSuper) - statementOffset = factory2.copyCustomPrologue( - constructor.body.statements, - statements, - statementOffset, - visitor, - /*filter*/ - void 0 - ); - let superCallExpression; - if (hasSynthesizedSuper) { - superCallExpression = createDefaultSuperCallOrThis(); - } else if (superCall) { - superCallExpression = visitSuperCallInBody(superCall); - } - if (superCallExpression) { + const standardPrologueEnd = factory2.copyStandardPrologue( + constructor.body.statements, + prologue, + /*statementOffset*/ + 0 + ); + const superStatementIndices = findSuperStatementIndexPath(constructor.body.statements, standardPrologueEnd); + if (hasSynthesizedSuper || superStatementIndices.length > 0) { hierarchyFacts |= 8192 /* ConstructorWithCapturedSuper */; } - addDefaultValueAssignmentsIfNeeded2(prologue, constructor); - addRestParameterIfNeeded(prologue, constructor, hasSynthesizedSuper); - addRange(statements, visitNodes2( - constructor.body.statements, - visitor, - isStatement, - /*start*/ - statementOffset - )); - factory2.mergeLexicalEnvironment(prologue, endLexicalEnvironment()); - insertCaptureNewTargetIfNeeded( + const mayReplaceThis = transformConstructorBodyWorker( prologue, + statements, + constructor.body.statements, + standardPrologueEnd, + superStatementIndices, + /*superPathDepth*/ + 0, constructor, - /*copyOnWrite*/ - false + isDerivedClass, + hasSynthesizedSuper, + /*isFirstStatement*/ + true + // NOTE: this will be recalculated inside of transformConstructorBodyWorker ); - if (isDerivedClass || superCallExpression) { - if (superCallExpression && postSuperStatementsStart === constructor.body.statements.length && !(constructor.body.transformFlags & 16384 /* ContainsLexicalThis */)) { - const superCall2 = cast(cast(superCallExpression, isBinaryExpression).left, isCallExpression); - const returnStatement = factory2.createReturnStatement(superCallExpression); - setCommentRange(returnStatement, getCommentRange(superCall2)); - setEmitFlags(superCall2, 3072 /* NoComments */); - statements.push(returnStatement); - } else { - if (superStatementIndex <= existingPrologue.length) { - insertCaptureThisForNode(statements, constructor, superCallExpression || createActualThis()); - } else { - insertCaptureThisForNode(prologue, constructor, createActualThis()); - if (superCallExpression) { - insertSuperThisCaptureThisForNode(statements, superCallExpression); - } - } - if (!isSufficientlyCoveredByReturnStatements(constructor.body)) { - statements.push(factory2.createReturnStatement(factory2.createUniqueName("_this", 16 /* Optimistic */ | 32 /* FileLevel */))); - } - } - } else { - insertCaptureThisForNodeIfNeeded(prologue, constructor); + addDefaultValueAssignmentsIfNeeded2(prologue, constructor); + addRestParameterIfNeeded(prologue, constructor, hasSynthesizedSuper); + insertCaptureNewTargetIfNeeded(prologue, constructor); + factory2.mergeLexicalEnvironment(prologue, endLexicalEnvironment()); + if (mayReplaceThis && !isSufficientlyCoveredByReturnStatements(constructor.body)) { + statements.push(factory2.createReturnStatement(factory2.createUniqueName("_this", 16 /* Optimistic */ | 32 /* FileLevel */))); } const body = factory2.createBlock( setTextRange( factory2.createNodeArray( [ - ...existingPrologue, ...prologue, - ...superStatementIndex <= existingPrologue.length ? emptyArray : visitNodes2(constructor.body.statements, visitor, isStatement, existingPrologue.length, superStatementIndex - existingPrologue.length), ...statements ] ), @@ -99308,29 +101024,15 @@ ${lanes.join("\n")} setTextRange(body, constructor.body); return body; } - function findSuperCallAndStatementIndex(originalBodyStatements, existingPrologue) { - for (let i = existingPrologue.length; i < originalBodyStatements.length; i += 1) { - const superCall = getSuperCallFromStatement(originalBodyStatements[i]); - if (superCall) { - return { - superCall, - superStatementIndex: i - }; - } - } - return { - superStatementIndex: -1 - }; - } function isSufficientlyCoveredByReturnStatements(statement) { - if (statement.kind === 252 /* ReturnStatement */) { + if (statement.kind === 253 /* ReturnStatement */) { return true; - } else if (statement.kind === 244 /* IfStatement */) { + } else if (statement.kind === 245 /* IfStatement */) { const ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement); } - } else if (statement.kind === 240 /* Block */) { + } else if (statement.kind === 241 /* Block */) { const lastStatement = lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -99604,13 +101306,13 @@ ${lanes.join("\n")} return true; } function insertCaptureThisForNodeIfNeeded(statements, node) { - if (hierarchyFacts & 65536 /* CapturedLexicalThis */ && node.kind !== 218 /* ArrowFunction */) { + if (hierarchyFacts & 65536 /* CapturedLexicalThis */ && node.kind !== 219 /* ArrowFunction */) { insertCaptureThisForNode(statements, node, factory2.createThis()); return true; } return false; } - function insertSuperThisCaptureThisForNode(statements, superExpression) { + function addSuperThisCaptureThisForNode(statements, superExpression) { enableSubstitutionsForCapturedThis(); const assignSuperExpression = factory2.createExpressionStatement( factory2.createBinaryExpression( @@ -99619,7 +101321,7 @@ ${lanes.join("\n")} superExpression ) ); - insertStatementAfterCustomPrologue(statements, assignSuperExpression); + statements.push(assignSuperExpression); setCommentRange(assignSuperExpression, getOriginalNode(superExpression).parent); } function insertCaptureThisForNode(statements, node, initializer) { @@ -99642,25 +101344,25 @@ ${lanes.join("\n")} setSourceMapRange(captureThisStatement, node); insertStatementAfterCustomPrologue(statements, captureThisStatement); } - function insertCaptureNewTargetIfNeeded(statements, node, copyOnWrite) { + function insertCaptureNewTargetIfNeeded(statements, node) { if (hierarchyFacts & 32768 /* NewTarget */) { let newTarget; switch (node.kind) { - case 218 /* ArrowFunction */: + case 219 /* ArrowFunction */: return statements; - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: newTarget = factory2.createVoidZero(); break; - case 175 /* Constructor */: + case 176 /* Constructor */: newTarget = factory2.createPropertyAccessExpression( setEmitFlags(factory2.createThis(), 8 /* NoSubstitution */), "constructor" ); break; - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: newTarget = factory2.createConditionalExpression( factory2.createLogicalAnd( setEmitFlags(factory2.createThis(), 8 /* NoSubstitution */), @@ -99699,9 +101401,6 @@ ${lanes.join("\n")} ]) ); setEmitFlags(captureNewTargetStatement, 3072 /* NoComments */ | 2097152 /* CustomPrologue */); - if (copyOnWrite) { - statements = statements.slice(); - } insertStatementAfterCustomPrologue(statements, captureNewTargetStatement); } return statements; @@ -99709,21 +101408,21 @@ ${lanes.join("\n")} function addClassMembers(statements, node) { for (const member of node.members) { switch (member.kind) { - case 239 /* SemicolonClassElement */: + case 240 /* SemicolonClassElement */: statements.push(transformSemicolonClassElementToStatement(member)); break; - case 173 /* MethodDeclaration */: + case 174 /* MethodDeclaration */: statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: const accessors = getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; - case 175 /* Constructor */: - case 174 /* ClassStaticBlockDeclaration */: + case 176 /* Constructor */: + case 175 /* ClassStaticBlockDeclaration */: break; default: Debug.failBadSyntaxKind(member, currentSourceFile && currentSourceFile.fileName); @@ -99930,7 +101629,7 @@ ${lanes.join("\n")} const ancestorFacts = container && isClassLike(container) && !isStatic(node) ? enterSubtree(32670 /* FunctionExcludes */, 65 /* FunctionIncludes */ | 8 /* NonStaticClassElement */) : enterSubtree(32670 /* FunctionExcludes */, 65 /* FunctionIncludes */); const parameters = visitParameterList(node.parameters, visitor, context); const body = transformFunctionBody2(node); - if (hierarchyFacts & 32768 /* NewTarget */ && !name && (node.kind === 261 /* FunctionDeclaration */ || node.kind === 217 /* FunctionExpression */)) { + if (hierarchyFacts & 32768 /* NewTarget */ && !name && (node.kind === 262 /* FunctionDeclaration */ || node.kind === 218 /* FunctionExpression */)) { name = factory2.getGeneratedNameForNode(node); } exitSubtree(ancestorFacts, 98304 /* FunctionSubtreeExcludes */, 0 /* None */); @@ -99991,7 +101690,7 @@ ${lanes.join("\n")} multiLine = true; } } else { - Debug.assert(node.kind === 218 /* ArrowFunction */); + Debug.assert(node.kind === 219 /* ArrowFunction */); statementsLocation = moveRangeEnd(body, -1); const equalsGreaterThanToken = node.equalsGreaterThanToken; if (!nodeIsSynthesized(equalsGreaterThanToken) && !nodeIsSynthesized(body)) { @@ -100010,12 +101709,7 @@ ${lanes.join("\n")} closeBraceLocation = body; } factory2.mergeLexicalEnvironment(prologue, endLexicalEnvironment()); - insertCaptureNewTargetIfNeeded( - prologue, - node, - /*copyOnWrite*/ - false - ); + insertCaptureNewTargetIfNeeded(prologue, node); insertCaptureThisForNodeIfNeeded(prologue, node); if (some(prologue)) { multiLine = true; @@ -100093,7 +101787,7 @@ ${lanes.join("\n")} function visitVariableStatement(node) { const ancestorFacts = enterSubtree(0 /* None */, hasSyntacticModifier(node, 1 /* Export */) ? 32 /* ExportedVariableStatement */ : 0 /* None */); let updated; - if (convertedLoopState && (node.declarationList.flags & 3 /* BlockScoped */) === 0 && !isVariableStatementOfTypeScriptClassWrapper(node)) { + if (convertedLoopState && (node.declarationList.flags & 7 /* BlockScoped */) === 0 && !isVariableStatementOfTypeScriptClassWrapper(node)) { let assignments; for (const decl of node.declarationList.declarations) { hoistVariableDeclarationDeclaredInConvertedLoop(convertedLoopState, decl); @@ -100125,8 +101819,8 @@ ${lanes.join("\n")} return updated; } function visitVariableDeclarationList(node) { - if (node.flags & 3 /* BlockScoped */ || node.transformFlags & 524288 /* ContainsBindingPattern */) { - if (node.flags & 3 /* BlockScoped */) { + if (node.flags & 7 /* BlockScoped */ || node.transformFlags & 524288 /* ContainsBindingPattern */) { + if (node.flags & 7 /* BlockScoped */) { enableSubstitutionsForBlockScopedBindings(); } const declarations = visitNodes2(node.declarations, node.flags & 1 /* Let */ ? visitVariableDeclarationInLetDeclarationList : visitVariableDeclaration, isVariableDeclaration); @@ -100217,14 +101911,14 @@ ${lanes.join("\n")} } function visitIterationStatement(node, outermostLabeledStatement) { switch (node.kind) { - case 245 /* DoStatement */: - case 246 /* WhileStatement */: + case 246 /* DoStatement */: + case 247 /* WhileStatement */: return visitDoOrWhileStatement(node, outermostLabeledStatement); - case 247 /* ForStatement */: + case 248 /* ForStatement */: return visitForStatement(node, outermostLabeledStatement); - case 248 /* ForInStatement */: + case 249 /* ForInStatement */: return visitForInStatement(node, outermostLabeledStatement); - case 249 /* ForOfStatement */: + case 250 /* ForOfStatement */: return visitForOfStatement(node, outermostLabeledStatement); } } @@ -100280,7 +101974,7 @@ ${lanes.join("\n")} const statements = []; const initializer = node.initializer; if (isVariableDeclarationList(initializer)) { - if (node.initializer.flags & 3 /* BlockScoped */) { + if (node.initializer.flags & 7 /* BlockScoped */) { enableSubstitutionsForBlockScopedBindings(); } const firstOriginalDeclaration = firstOrUndefined(initializer.declarations); @@ -100574,7 +102268,7 @@ ${lanes.join("\n")} let numInitialProperties = -1, hasComputed = false; for (let i = 0; i < properties.length; i++) { const property = properties[i]; - if (property.transformFlags & 1048576 /* ContainsYield */ && hierarchyFacts & 4 /* AsyncFunctionBody */ || (hasComputed = Debug.checkDefined(property.name).kind === 166 /* ComputedPropertyName */)) { + if (property.transformFlags & 1048576 /* ContainsYield */ && hierarchyFacts & 4 /* AsyncFunctionBody */ || (hasComputed = Debug.checkDefined(property.name).kind === 167 /* ComputedPropertyName */)) { numInitialProperties = i; break; } @@ -100696,15 +102390,15 @@ ${lanes.join("\n")} } function convertIterationStatementCore(node, initializerFunction, convertedLoopBody) { switch (node.kind) { - case 247 /* ForStatement */: + case 248 /* ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody); - case 248 /* ForInStatement */: + case 249 /* ForInStatement */: return convertForInStatement(node, convertedLoopBody); - case 249 /* ForOfStatement */: + case 250 /* ForOfStatement */: return convertForOfStatement(node, convertedLoopBody); - case 245 /* DoStatement */: + case 246 /* DoStatement */: return convertDoStatement(node, convertedLoopBody); - case 246 /* WhileStatement */: + case 247 /* WhileStatement */: return convertWhileStatement(node, convertedLoopBody); default: return Debug.failBadSyntaxKind(node, "IterationStatement expected"); @@ -100756,18 +102450,18 @@ ${lanes.join("\n")} function createConvertedLoopState(node) { let loopInitializer; switch (node.kind) { - case 247 /* ForStatement */: - case 248 /* ForInStatement */: - case 249 /* ForOfStatement */: + case 248 /* ForStatement */: + case 249 /* ForInStatement */: + case 250 /* ForOfStatement */: const initializer = node.initializer; - if (initializer && initializer.kind === 260 /* VariableDeclarationList */) { + if (initializer && initializer.kind === 261 /* VariableDeclarationList */) { loopInitializer = initializer; } break; } const loopParameters = []; const loopOutParameters = []; - if (loopInitializer && getCombinedNodeFlags(loopInitializer) & 3 /* BlockScoped */) { + if (loopInitializer && getCombinedNodeFlags(loopInitializer) & 7 /* BlockScoped */) { const hasCapturedBindingsInForHead = shouldConvertInitializerOfForStatement(node) || shouldConvertConditionOfForStatement(node) || shouldConvertIncrementorOfForStatement(node); for (const decl of loopInitializer.declarations) { processLoopVariableDeclaration(node, decl, loopParameters, loopOutParameters, hasCapturedBindingsInForHead); @@ -101175,10 +102869,10 @@ ${lanes.join("\n")} name )); const checkFlags = resolver.getNodeCheckFlags(decl); - if (checkFlags & 262144 /* NeedsLoopOutParameter */ || hasCapturedBindingsInForHead) { + if (checkFlags & 65536 /* NeedsLoopOutParameter */ || hasCapturedBindingsInForHead) { const outParamName = factory2.createUniqueName("out_" + idText(name)); let flags = 0 /* None */; - if (checkFlags & 262144 /* NeedsLoopOutParameter */) { + if (checkFlags & 65536 /* NeedsLoopOutParameter */) { flags |= 1 /* Body */; } if (isForStatement(container)) { @@ -101199,20 +102893,20 @@ ${lanes.join("\n")} for (let i = start; i < numProperties; i++) { const property = properties[i]; switch (property.kind) { - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: const accessors = getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { expressions.push(transformAccessorsToExpression(receiver, accessors, node, !!node.multiLine)); } break; - case 173 /* MethodDeclaration */: + case 174 /* MethodDeclaration */: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 302 /* PropertyAssignment */: + case 303 /* PropertyAssignment */: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 303 /* ShorthandPropertyAssignment */: + case 304 /* ShorthandPropertyAssignment */: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -101338,7 +103032,7 @@ ${lanes.join("\n")} let updated; const parameters = visitParameterList(node.parameters, visitor, context); const body = transformFunctionBody2(node); - if (node.kind === 176 /* GetAccessor */) { + if (node.kind === 177 /* GetAccessor */) { updated = factory2.updateGetAccessorDeclaration(node, node.modifiers, node.name, parameters, node.type, body); } else { updated = factory2.updateSetAccessorDeclaration(node, node.modifiers, node.name, parameters, body); @@ -101702,13 +103396,13 @@ ${lanes.join("\n")} if ((enabledSubstitutions & 1 /* CapturedThis */) === 0) { enabledSubstitutions |= 1 /* CapturedThis */; context.enableSubstitution(110 /* ThisKeyword */); - context.enableEmitNotification(175 /* Constructor */); - context.enableEmitNotification(173 /* MethodDeclaration */); - context.enableEmitNotification(176 /* GetAccessor */); - context.enableEmitNotification(177 /* SetAccessor */); - context.enableEmitNotification(218 /* ArrowFunction */); - context.enableEmitNotification(217 /* FunctionExpression */); - context.enableEmitNotification(261 /* FunctionDeclaration */); + context.enableEmitNotification(176 /* Constructor */); + context.enableEmitNotification(174 /* MethodDeclaration */); + context.enableEmitNotification(177 /* GetAccessor */); + context.enableEmitNotification(178 /* SetAccessor */); + context.enableEmitNotification(219 /* ArrowFunction */); + context.enableEmitNotification(218 /* FunctionExpression */); + context.enableEmitNotification(262 /* FunctionDeclaration */); } } function onSubstituteNode(hint, node) { @@ -101732,10 +103426,10 @@ ${lanes.join("\n")} } function isNameOfDeclarationWithCollidingName(node) { switch (node.parent.kind) { - case 207 /* BindingElement */: - case 262 /* ClassDeclaration */: - case 265 /* EnumDeclaration */: - case 259 /* VariableDeclaration */: + case 208 /* BindingElement */: + case 263 /* ClassDeclaration */: + case 266 /* EnumDeclaration */: + case 260 /* VariableDeclaration */: return node.parent.name === node && resolver.isDeclarationWithCollidingName(node.parent); } return false; @@ -101792,11 +103486,11 @@ ${lanes.join("\n")} return false; } const statement = firstOrUndefined(constructor.body.statements); - if (!statement || !nodeIsSynthesized(statement) || statement.kind !== 243 /* ExpressionStatement */) { + if (!statement || !nodeIsSynthesized(statement) || statement.kind !== 244 /* ExpressionStatement */) { return false; } const statementExpression = statement.expression; - if (!nodeIsSynthesized(statementExpression) || statementExpression.kind !== 212 /* CallExpression */) { + if (!nodeIsSynthesized(statementExpression) || statementExpression.kind !== 213 /* CallExpression */) { return false; } const callTarget = statementExpression.expression; @@ -101804,7 +103498,7 @@ ${lanes.join("\n")} return false; } const callArgument = singleOrUndefined(statementExpression.arguments); - if (!callArgument || !nodeIsSynthesized(callArgument) || callArgument.kind !== 229 /* SpreadElement */) { + if (!callArgument || !nodeIsSynthesized(callArgument) || callArgument.kind !== 230 /* SpreadElement */) { return false; } const expression = callArgument.expression; @@ -101827,24 +103521,24 @@ ${lanes.join("\n")} if (compilerOptions.jsx === 1 /* Preserve */ || compilerOptions.jsx === 3 /* ReactNative */) { previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; - context.enableEmitNotification(285 /* JsxOpeningElement */); - context.enableEmitNotification(286 /* JsxClosingElement */); - context.enableEmitNotification(284 /* JsxSelfClosingElement */); + context.enableEmitNotification(286 /* JsxOpeningElement */); + context.enableEmitNotification(287 /* JsxClosingElement */); + context.enableEmitNotification(285 /* JsxSelfClosingElement */); noSubstitution = []; } const previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(210 /* PropertyAccessExpression */); - context.enableSubstitution(302 /* PropertyAssignment */); + context.enableSubstitution(211 /* PropertyAccessExpression */); + context.enableSubstitution(303 /* PropertyAssignment */); return chainBundle(context, transformSourceFile); function transformSourceFile(node) { return node; } function onEmitNode(hint, node, emitCallback) { switch (node.kind) { - case 285 /* JsxOpeningElement */: - case 286 /* JsxClosingElement */: - case 284 /* JsxSelfClosingElement */: + case 286 /* JsxOpeningElement */: + case 287 /* JsxClosingElement */: + case 285 /* JsxSelfClosingElement */: const tagName = node.tagName; noSubstitution[getOriginalNodeId(tagName)] = true; break; @@ -101976,13 +103670,13 @@ ${lanes.join("\n")} } function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 245 /* DoStatement */: + case 246 /* DoStatement */: return visitDoStatement(node); - case 246 /* WhileStatement */: + case 247 /* WhileStatement */: return visitWhileStatement(node); - case 254 /* SwitchStatement */: + case 255 /* SwitchStatement */: return visitSwitchStatement(node); - case 255 /* LabeledStatement */: + case 256 /* LabeledStatement */: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -101990,24 +103684,24 @@ ${lanes.join("\n")} } function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 261 /* FunctionDeclaration */: + case 262 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 217 /* FunctionExpression */: + case 218 /* FunctionExpression */: return visitFunctionExpression(node); - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: return visitAccessorDeclaration(node); - case 242 /* VariableStatement */: + case 243 /* VariableStatement */: return visitVariableStatement(node); - case 247 /* ForStatement */: + case 248 /* ForStatement */: return visitForStatement(node); - case 248 /* ForInStatement */: + case 249 /* ForInStatement */: return visitForInStatement(node); - case 251 /* BreakStatement */: + case 252 /* BreakStatement */: return visitBreakStatement(node); - case 250 /* ContinueStatement */: + case 251 /* ContinueStatement */: return visitContinueStatement(node); - case 252 /* ReturnStatement */: + case 253 /* ReturnStatement */: return visitReturnStatement(node); default: if (node.transformFlags & 1048576 /* ContainsYield */) { @@ -102021,23 +103715,23 @@ ${lanes.join("\n")} } function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: return visitBinaryExpression(node); - case 360 /* CommaListExpression */: + case 361 /* CommaListExpression */: return visitCommaListExpression(node); - case 226 /* ConditionalExpression */: + case 227 /* ConditionalExpression */: return visitConditionalExpression(node); - case 228 /* YieldExpression */: + case 229 /* YieldExpression */: return visitYieldExpression(node); - case 208 /* ArrayLiteralExpression */: + case 209 /* ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 209 /* ObjectLiteralExpression */: + case 210 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 211 /* ElementAccessExpression */: + case 212 /* ElementAccessExpression */: return visitElementAccessExpression(node); - case 212 /* CallExpression */: + case 213 /* CallExpression */: return visitCallExpression(node); - case 213 /* NewExpression */: + case 214 /* NewExpression */: return visitNewExpression(node); default: return visitEachChild(node, visitor, context); @@ -102045,9 +103739,9 @@ ${lanes.join("\n")} } function visitGenerator(node) { switch (node.kind) { - case 261 /* FunctionDeclaration */: + case 262 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 217 /* FunctionExpression */: + case 218 /* FunctionExpression */: return visitFunctionExpression(node); default: return Debug.failBadSyntaxKind(node); @@ -102232,14 +103926,14 @@ ${lanes.join("\n")} if (containsYield(right)) { let target; switch (left.kind) { - case 210 /* PropertyAccessExpression */: + case 211 /* PropertyAccessExpression */: target = factory2.updatePropertyAccessExpression( left, cacheExpression(Debug.checkDefined(visitNode(left.expression, visitor, isLeftHandSideExpression))), left.name ); break; - case 211 /* ElementAccessExpression */: + case 212 /* ElementAccessExpression */: target = factory2.updateElementAccessExpression( left, cacheExpression(Debug.checkDefined(visitNode(left.expression, visitor, isLeftHandSideExpression))), @@ -102572,35 +104266,35 @@ ${lanes.join("\n")} } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 240 /* Block */: + case 241 /* Block */: return transformAndEmitBlock(node); - case 243 /* ExpressionStatement */: + case 244 /* ExpressionStatement */: return transformAndEmitExpressionStatement(node); - case 244 /* IfStatement */: + case 245 /* IfStatement */: return transformAndEmitIfStatement(node); - case 245 /* DoStatement */: + case 246 /* DoStatement */: return transformAndEmitDoStatement(node); - case 246 /* WhileStatement */: + case 247 /* WhileStatement */: return transformAndEmitWhileStatement(node); - case 247 /* ForStatement */: + case 248 /* ForStatement */: return transformAndEmitForStatement(node); - case 248 /* ForInStatement */: + case 249 /* ForInStatement */: return transformAndEmitForInStatement(node); - case 250 /* ContinueStatement */: + case 251 /* ContinueStatement */: return transformAndEmitContinueStatement(node); - case 251 /* BreakStatement */: + case 252 /* BreakStatement */: return transformAndEmitBreakStatement(node); - case 252 /* ReturnStatement */: + case 253 /* ReturnStatement */: return transformAndEmitReturnStatement(node); - case 253 /* WithStatement */: + case 254 /* WithStatement */: return transformAndEmitWithStatement(node); - case 254 /* SwitchStatement */: + case 255 /* SwitchStatement */: return transformAndEmitSwitchStatement(node); - case 255 /* LabeledStatement */: + case 256 /* LabeledStatement */: return transformAndEmitLabeledStatement(node); - case 256 /* ThrowStatement */: + case 257 /* ThrowStatement */: return transformAndEmitThrowStatement(node); - case 257 /* TryStatement */: + case 258 /* TryStatement */: return transformAndEmitTryStatement(node); default: return emitStatement(visitNode(node, visitor, isStatement)); @@ -102952,7 +104646,7 @@ ${lanes.join("\n")} for (let i = 0; i < numClauses; i++) { const clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 296 /* DefaultClause */ && defaultClauseIndex === -1) { + if (clause.kind === 297 /* DefaultClause */ && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -102962,7 +104656,7 @@ ${lanes.join("\n")} let defaultClausesSkipped = 0; for (let i = clausesWritten; i < numClauses; i++) { const clause = caseBlock.clauses[i]; - if (clause.kind === 295 /* CaseClause */) { + if (clause.kind === 296 /* CaseClause */) { if (containsYield(clause.expression) && pendingClauses.length > 0) { break; } @@ -103935,12 +105629,12 @@ ${lanes.join("\n")} const previousOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(212 /* CallExpression */); - context.enableSubstitution(214 /* TaggedTemplateExpression */); + context.enableSubstitution(213 /* CallExpression */); + context.enableSubstitution(215 /* TaggedTemplateExpression */); context.enableSubstitution(80 /* Identifier */); - context.enableSubstitution(225 /* BinaryExpression */); - context.enableSubstitution(303 /* ShorthandPropertyAssignment */); - context.enableEmitNotification(311 /* SourceFile */); + context.enableSubstitution(226 /* BinaryExpression */); + context.enableSubstitution(304 /* ShorthandPropertyAssignment */); + context.enableEmitNotification(312 /* SourceFile */); const moduleInfoMap = []; let currentSourceFile; let currentModuleInfo; @@ -103952,7 +105646,7 @@ ${lanes.join("\n")} return node; } currentSourceFile = node; - currentModuleInfo = collectExternalModuleInfo(context, node, resolver, compilerOptions); + currentModuleInfo = collectExternalModuleInfo(context, node); moduleInfoMap[getOriginalNodeId(node)] = currentModuleInfo; const transformModule2 = getTransformModuleDelegate(moduleKind); const updated = transformModule2(node); @@ -104352,63 +106046,59 @@ ${lanes.join("\n")} } function topLevelVisitor(node) { switch (node.kind) { - case 271 /* ImportDeclaration */: - return visitImportDeclaration(node); - case 270 /* ImportEqualsDeclaration */: - return visitImportEqualsDeclaration(node); - case 277 /* ExportDeclaration */: - return visitExportDeclaration(node); - case 276 /* ExportAssignment */: - return visitExportAssignment(node); - case 261 /* FunctionDeclaration */: - return visitFunctionDeclaration(node); - case 262 /* ClassDeclaration */: - return visitClassDeclaration(node); + case 272 /* ImportDeclaration */: + return visitTopLevelImportDeclaration(node); + case 271 /* ImportEqualsDeclaration */: + return visitTopLevelImportEqualsDeclaration(node); + case 278 /* ExportDeclaration */: + return visitTopLevelExportDeclaration(node); + case 277 /* ExportAssignment */: + return visitTopLevelExportAssignment(node); default: return topLevelNestedVisitor(node); } } function topLevelNestedVisitor(node) { switch (node.kind) { - case 242 /* VariableStatement */: + case 243 /* VariableStatement */: return visitVariableStatement(node); - case 261 /* FunctionDeclaration */: + case 262 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 262 /* ClassDeclaration */: + case 263 /* ClassDeclaration */: return visitClassDeclaration(node); - case 247 /* ForStatement */: + case 248 /* ForStatement */: return visitForStatement( node, /*isTopLevel*/ true ); - case 248 /* ForInStatement */: + case 249 /* ForInStatement */: return visitForInStatement(node); - case 249 /* ForOfStatement */: + case 250 /* ForOfStatement */: return visitForOfStatement(node); - case 245 /* DoStatement */: + case 246 /* DoStatement */: return visitDoStatement(node); - case 246 /* WhileStatement */: + case 247 /* WhileStatement */: return visitWhileStatement(node); - case 255 /* LabeledStatement */: + case 256 /* LabeledStatement */: return visitLabeledStatement(node); - case 253 /* WithStatement */: + case 254 /* WithStatement */: return visitWithStatement(node); - case 244 /* IfStatement */: + case 245 /* IfStatement */: return visitIfStatement(node); - case 254 /* SwitchStatement */: + case 255 /* SwitchStatement */: return visitSwitchStatement(node); - case 268 /* CaseBlock */: + case 269 /* CaseBlock */: return visitCaseBlock(node); - case 295 /* CaseClause */: + case 296 /* CaseClause */: return visitCaseClause(node); - case 296 /* DefaultClause */: + case 297 /* DefaultClause */: return visitDefaultClause(node); - case 257 /* TryStatement */: + case 258 /* TryStatement */: return visitTryStatement(node); - case 298 /* CatchClause */: + case 299 /* CatchClause */: return visitCatchClause(node); - case 240 /* Block */: + case 241 /* Block */: return visitBlock(node); default: return visitor(node); @@ -104419,30 +106109,30 @@ ${lanes.join("\n")} return node; } switch (node.kind) { - case 247 /* ForStatement */: + case 248 /* ForStatement */: return visitForStatement( node, /*isTopLevel*/ false ); - case 243 /* ExpressionStatement */: + case 244 /* ExpressionStatement */: return visitExpressionStatement(node); - case 216 /* ParenthesizedExpression */: + case 217 /* ParenthesizedExpression */: return visitParenthesizedExpression(node, valueIsDiscarded); - case 359 /* PartiallyEmittedExpression */: + case 360 /* PartiallyEmittedExpression */: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 212 /* CallExpression */: + case 213 /* CallExpression */: if (isImportCall(node) && currentSourceFile.impliedNodeFormat === void 0) { return visitImportCallExpression(node); } break; - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: if (isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 223 /* PrefixUnaryExpression */: - case 224 /* PostfixUnaryExpression */: + case 224 /* PrefixUnaryExpression */: + case 225 /* PostfixUnaryExpression */: return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); } return visitEachChild(node, visitor, context); @@ -104465,24 +106155,24 @@ ${lanes.join("\n")} if (isObjectLiteralExpression(node)) { for (const elem of node.properties) { switch (elem.kind) { - case 302 /* PropertyAssignment */: + case 303 /* PropertyAssignment */: if (destructuringNeedsFlattening(elem.initializer)) { return true; } break; - case 303 /* ShorthandPropertyAssignment */: + case 304 /* ShorthandPropertyAssignment */: if (destructuringNeedsFlattening(elem.name)) { return true; } break; - case 304 /* SpreadAssignment */: + case 305 /* SpreadAssignment */: if (destructuringNeedsFlattening(elem.expression)) { return true; } break; - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: return false; default: Debug.assertNever(elem, "Unhandled object member kind"); @@ -104510,7 +106200,7 @@ ${lanes.join("\n")} return visitEachChild(node, visitor, context); } function visitForStatement(node, isTopLevel) { - if (isTopLevel && node.initializer && isVariableDeclarationList(node.initializer) && !(node.initializer.flags & 3 /* BlockScoped */)) { + if (isTopLevel && node.initializer && isVariableDeclarationList(node.initializer) && !(node.initializer.flags & 7 /* BlockScoped */)) { const exportStatements = appendExportsOfVariableDeclarationList( /*statements*/ void 0, @@ -104551,7 +106241,7 @@ ${lanes.join("\n")} ); } function visitForInStatement(node) { - if (isVariableDeclarationList(node.initializer) && !(node.initializer.flags & 3 /* BlockScoped */)) { + if (isVariableDeclarationList(node.initializer) && !(node.initializer.flags & 7 /* BlockScoped */)) { const exportStatements = appendExportsOfVariableDeclarationList( /*statements*/ void 0, @@ -104579,7 +106269,7 @@ ${lanes.join("\n")} ); } function visitForOfStatement(node) { - if (isVariableDeclarationList(node.initializer) && !(node.initializer.flags & 3 /* BlockScoped */)) { + if (isVariableDeclarationList(node.initializer) && !(node.initializer.flags & 7 /* BlockScoped */)) { const exportStatements = appendExportsOfVariableDeclarationList( /*statements*/ void 0, @@ -104959,7 +106649,7 @@ ${lanes.join("\n")} } return innerExpr; } - function visitImportDeclaration(node) { + function visitTopLevelImportDeclaration(node) { let statements; const namespaceDeclaration = getNamespaceDeclarationNode(node); if (moduleKind !== 2 /* AMD */) { @@ -105068,7 +106758,7 @@ ${lanes.join("\n")} args ); } - function visitImportEqualsDeclaration(node) { + function visitTopLevelImportEqualsDeclaration(node) { Debug.assert(isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer."); let statements; if (moduleKind !== 2 /* AMD */) { @@ -105136,7 +106826,7 @@ ${lanes.join("\n")} statements = appendExportsOfImportEqualsDeclaration(statements, node); return singleOrMany(statements); } - function visitExportDeclaration(node) { + function visitTopLevelExportDeclaration(node) { if (!node.moduleSpecifier) { return void 0; } @@ -105238,7 +106928,7 @@ ${lanes.join("\n")} ); } } - function visitExportAssignment(node) { + function visitTopLevelExportAssignment(node) { if (node.isExportEquals) { return void 0; } @@ -105442,19 +107132,21 @@ ${lanes.join("\n")} if (!importClause) { return statements; } + const seen = new IdentifierNameMap(); if (importClause.name) { - statements = appendExportsOfDeclaration(statements, importClause); + statements = appendExportsOfDeclaration(statements, seen, importClause); } const namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 273 /* NamespaceImport */: - statements = appendExportsOfDeclaration(statements, namedBindings); + case 274 /* NamespaceImport */: + statements = appendExportsOfDeclaration(statements, seen, namedBindings); break; - case 274 /* NamedImports */: + case 275 /* NamedImports */: for (const importBinding of namedBindings.elements) { statements = appendExportsOfDeclaration( statements, + seen, importBinding, /*liveBinding*/ true @@ -105469,7 +107161,7 @@ ${lanes.join("\n")} if (currentModuleInfo.exportEquals) { return statements; } - return appendExportsOfDeclaration(statements, decl); + return appendExportsOfDeclaration(statements, new IdentifierNameMap(), decl); } function appendExportsOfVariableStatement(statements, node) { return appendExportsOfVariableDeclarationList( @@ -105499,7 +107191,7 @@ ${lanes.join("\n")} } } } else if (!isGeneratedIdentifier(decl.name) && (!isVariableDeclaration(decl) || decl.initializer || isForInOrOfInitializer)) { - statements = appendExportsOfDeclaration(statements, decl); + statements = appendExportsOfDeclaration(statements, new IdentifierNameMap(), decl); } return statements; } @@ -105507,10 +107199,12 @@ ${lanes.join("\n")} if (currentModuleInfo.exportEquals) { return statements; } + const seen = new IdentifierNameMap(); if (hasSyntacticModifier(decl, 1 /* Export */)) { const exportName = hasSyntacticModifier(decl, 1024 /* Default */) ? factory2.createIdentifier("default") : factory2.getDeclarationName(decl); statements = appendExportStatement( statements, + seen, exportName, factory2.getLocalName(decl), /*location*/ @@ -105518,17 +107212,18 @@ ${lanes.join("\n")} ); } if (decl.name) { - statements = appendExportsOfDeclaration(statements, decl); + statements = appendExportsOfDeclaration(statements, seen, decl); } return statements; } - function appendExportsOfDeclaration(statements, decl, liveBinding) { + function appendExportsOfDeclaration(statements, seen, decl, liveBinding) { const name = factory2.getDeclarationName(decl); - const exportSpecifiers = currentModuleInfo.exportSpecifiers.get(idText(name)); + const exportSpecifiers = currentModuleInfo.exportSpecifiers.get(name); if (exportSpecifiers) { for (const exportSpecifier of exportSpecifiers) { statements = appendExportStatement( statements, + seen, exportSpecifier.name, name, /*location*/ @@ -105541,8 +107236,11 @@ ${lanes.join("\n")} } return statements; } - function appendExportStatement(statements, exportName, expression, location, allowComments, liveBinding) { - statements = append(statements, createExportStatement(exportName, expression, location, allowComments, liveBinding)); + function appendExportStatement(statements, seen, exportName, expression, location, allowComments, liveBinding) { + if (!seen.has(exportName)) { + seen.set(exportName, true); + statements = append(statements, createExportStatement(exportName, expression, location, allowComments, liveBinding)); + } return statements; } function createUnderscoreUnderscoreESModule() { @@ -105637,7 +107335,7 @@ ${lanes.join("\n")} return node; } function onEmitNode(hint, node, emitCallback) { - if (node.kind === 311 /* SourceFile */) { + if (node.kind === 312 /* SourceFile */) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[getOriginalNodeId(currentSourceFile)]; previousOnEmitNode(hint, node, emitCallback); @@ -105675,11 +107373,11 @@ ${lanes.join("\n")} switch (node.kind) { case 80 /* Identifier */: return substituteExpressionIdentifier(node); - case 212 /* CallExpression */: + case 213 /* CallExpression */: return substituteCallExpression(node); - case 214 /* TaggedTemplateExpression */: + case 215 /* TaggedTemplateExpression */: return substituteTaggedTemplateExpression(node); - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: return substituteBinaryExpression(node); } return node; @@ -105732,7 +107430,7 @@ ${lanes.join("\n")} return node; } else if (!(isGeneratedIdentifier(node) && !(node.emitNode.autoGenerate.flags & 64 /* AllowNameSubstitution */)) && !isLocalName(node)) { const exportContainer = resolver.getReferencedExportContainer(node, isExportName(node)); - if (exportContainer && exportContainer.kind === 311 /* SourceFile */) { + if (exportContainer && exportContainer.kind === 312 /* SourceFile */) { return setTextRange( factory2.createPropertyAccessExpression( factory2.createIdentifier("exports"), @@ -105769,7 +107467,7 @@ ${lanes.join("\n")} return node; } function substituteBinaryExpression(node) { - if (isAssignmentOperator(node.operatorToken.kind) && isIdentifier(node.left) && !isGeneratedIdentifier(node.left) && !isLocalName(node.left)) { + if (isAssignmentOperator(node.operatorToken.kind) && isIdentifier(node.left) && (!isGeneratedIdentifier(node.left) || isFileLevelReservedGeneratedIdentifier(node.left)) && !isLocalName(node.left)) { const exportedNames = getExports(node.left); if (exportedNames) { let expression = node; @@ -105808,6 +107506,15 @@ ${lanes.join("\n")} return arrayFrom(bindingsSet); } } + } else if (isFileLevelReservedGeneratedIdentifier(name)) { + const exportSpecifiers = currentModuleInfo == null ? void 0 : currentModuleInfo.exportSpecifiers.get(name); + if (exportSpecifiers) { + const exportedNames = []; + for (const exportSpecifier of exportSpecifiers) { + exportedNames.push(exportSpecifier.name); + } + return exportedNames; + } } } } @@ -105841,10 +107548,10 @@ ${lanes.join("\n")} context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(80 /* Identifier */); - context.enableSubstitution(303 /* ShorthandPropertyAssignment */); - context.enableSubstitution(225 /* BinaryExpression */); - context.enableSubstitution(235 /* MetaProperty */); - context.enableEmitNotification(311 /* SourceFile */); + context.enableSubstitution(304 /* ShorthandPropertyAssignment */); + context.enableSubstitution(226 /* BinaryExpression */); + context.enableSubstitution(236 /* MetaProperty */); + context.enableEmitNotification(312 /* SourceFile */); const moduleInfoMap = []; const exportFunctionsMap = []; const noSubstitutionMap = []; @@ -105864,7 +107571,7 @@ ${lanes.join("\n")} const id = getOriginalNodeId(node); currentSourceFile = node; enclosingBlockScopedContainer = node; - moduleInfo = moduleInfoMap[id] = collectExternalModuleInfo(context, node, resolver, compilerOptions); + moduleInfo = moduleInfoMap[id] = collectExternalModuleInfo(context, node); exportFunction = factory2.createUniqueName("exports"); exportFunctionsMap[id] = exportFunction; contextObject = contextObjectMap[id] = factory2.createUniqueName("context"); @@ -106031,7 +107738,7 @@ ${lanes.join("\n")} if (!moduleInfo.exportedNames && moduleInfo.exportSpecifiers.size === 0) { let hasExportDeclarationWithExportClause = false; for (const externalImport of moduleInfo.externalImports) { - if (externalImport.kind === 277 /* ExportDeclaration */ && externalImport.exportClause) { + if (externalImport.kind === 278 /* ExportDeclaration */ && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -106179,11 +107886,11 @@ ${lanes.join("\n")} for (const entry of group2.externalImports) { const importVariableName = getLocalNameForExternalImport(factory2, entry, currentSourceFile); switch (entry.kind) { - case 271 /* ImportDeclaration */: + case 272 /* ImportDeclaration */: if (!entry.importClause) { break; } - case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportEqualsDeclaration */: Debug.assert(importVariableName !== void 0); statements.push( factory2.createExpressionStatement( @@ -106206,7 +107913,7 @@ ${lanes.join("\n")} ); } break; - case 277 /* ExportDeclaration */: + case 278 /* ExportDeclaration */: Debug.assert(importVariableName !== void 0); if (entry.exportClause) { if (isNamedExports(entry.exportClause)) { @@ -106301,13 +108008,13 @@ ${lanes.join("\n")} } function topLevelVisitor(node) { switch (node.kind) { - case 271 /* ImportDeclaration */: + case 272 /* ImportDeclaration */: return visitImportDeclaration(node); - case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 277 /* ExportDeclaration */: + case 278 /* ExportDeclaration */: return visitExportDeclaration(node); - case 276 /* ExportAssignment */: + case 277 /* ExportAssignment */: return visitExportAssignment(node); default: return topLevelNestedVisitor(node); @@ -106404,18 +108111,43 @@ ${lanes.join("\n")} if (!shouldHoistVariableDeclarationList(node.declarationList)) { return visitNode(node, visitor, isStatement); } - let expressions; - const isExportedDeclaration = hasSyntacticModifier(node, 1 /* Export */); - for (const variable of node.declarationList.declarations) { - if (variable.initializer) { - expressions = append(expressions, transformInitializedVariable(variable, isExportedDeclaration)); - } else { - hoistBindingElement(variable); - } - } let statements; - if (expressions) { - statements = append(statements, setTextRange(factory2.createExpressionStatement(factory2.inlineExpressions(expressions)), node)); + if (isVarUsing(node.declarationList) || isVarAwaitUsing(node.declarationList)) { + const modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifierLike); + const declarations = []; + for (const variable of node.declarationList.declarations) { + declarations.push(factory2.updateVariableDeclaration( + variable, + factory2.getGeneratedNameForNode(variable.name), + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + transformInitializedVariable( + variable, + /*isExportedDeclaration*/ + false + ) + )); + } + const declarationList = factory2.updateVariableDeclarationList( + node.declarationList, + declarations + ); + statements = append(statements, factory2.updateVariableStatement(node, modifiers, declarationList)); + } else { + let expressions; + const isExportedDeclaration = hasSyntacticModifier(node, 1 /* Export */); + for (const variable of node.declarationList.declarations) { + if (variable.initializer) { + expressions = append(expressions, transformInitializedVariable(variable, isExportedDeclaration)); + } else { + hoistBindingElement(variable); + } + } + if (expressions) { + statements = append(statements, setTextRange(factory2.createExpressionStatement(factory2.inlineExpressions(expressions)), node)); + } } statements = appendExportsOfVariableStatement( statements, @@ -106437,7 +108169,7 @@ ${lanes.join("\n")} } } function shouldHoistVariableDeclarationList(node) { - return (getEmitFlags(node) & 4194304 /* NoHoisting */) === 0 && (enclosingBlockScopedContainer.kind === 311 /* SourceFile */ || (getOriginalNode(node).flags & 3 /* BlockScoped */) === 0); + return (getEmitFlags(node) & 4194304 /* NoHoisting */) === 0 && (enclosingBlockScopedContainer.kind === 312 /* SourceFile */ || (getOriginalNode(node).flags & 7 /* BlockScoped */) === 0); } function transformInitializedVariable(node, isExportedDeclaration) { const createAssignment = isExportedDeclaration ? createExportedVariableAssignment : createNonExportedVariableAssignment; @@ -106487,10 +108219,10 @@ ${lanes.join("\n")} const namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 273 /* NamespaceImport */: + case 274 /* NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 274 /* NamedImports */: + case 275 /* NamedImports */: for (const importBinding of namedBindings.elements) { statements = appendExportsOfDeclaration(statements, importBinding); } @@ -106556,7 +108288,7 @@ ${lanes.join("\n")} return statements; } const name = factory2.getDeclarationName(decl); - const exportSpecifiers = moduleInfo.exportSpecifiers.get(idText(name)); + const exportSpecifiers = moduleInfo.exportSpecifiers.get(name); if (exportSpecifiers) { for (const exportSpecifier of exportSpecifiers) { if (exportSpecifier.name.escapedText !== excludeName) { @@ -106590,45 +108322,45 @@ ${lanes.join("\n")} } function topLevelNestedVisitor(node) { switch (node.kind) { - case 242 /* VariableStatement */: + case 243 /* VariableStatement */: return visitVariableStatement(node); - case 261 /* FunctionDeclaration */: + case 262 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 262 /* ClassDeclaration */: + case 263 /* ClassDeclaration */: return visitClassDeclaration(node); - case 247 /* ForStatement */: + case 248 /* ForStatement */: return visitForStatement( node, /*isTopLevel*/ true ); - case 248 /* ForInStatement */: + case 249 /* ForInStatement */: return visitForInStatement(node); - case 249 /* ForOfStatement */: + case 250 /* ForOfStatement */: return visitForOfStatement(node); - case 245 /* DoStatement */: + case 246 /* DoStatement */: return visitDoStatement(node); - case 246 /* WhileStatement */: + case 247 /* WhileStatement */: return visitWhileStatement(node); - case 255 /* LabeledStatement */: + case 256 /* LabeledStatement */: return visitLabeledStatement(node); - case 253 /* WithStatement */: + case 254 /* WithStatement */: return visitWithStatement(node); - case 244 /* IfStatement */: + case 245 /* IfStatement */: return visitIfStatement(node); - case 254 /* SwitchStatement */: + case 255 /* SwitchStatement */: return visitSwitchStatement(node); - case 268 /* CaseBlock */: + case 269 /* CaseBlock */: return visitCaseBlock(node); - case 295 /* CaseClause */: + case 296 /* CaseClause */: return visitCaseClause(node); - case 296 /* DefaultClause */: + case 297 /* DefaultClause */: return visitDefaultClause(node); - case 257 /* TryStatement */: + case 258 /* TryStatement */: return visitTryStatement(node); - case 298 /* CatchClause */: + case 299 /* CatchClause */: return visitCatchClause(node); - case 240 /* Block */: + case 241 /* Block */: return visitBlock(node); default: return visitor(node); @@ -106782,30 +108514,30 @@ ${lanes.join("\n")} return node; } switch (node.kind) { - case 247 /* ForStatement */: + case 248 /* ForStatement */: return visitForStatement( node, /*isTopLevel*/ false ); - case 243 /* ExpressionStatement */: + case 244 /* ExpressionStatement */: return visitExpressionStatement(node); - case 216 /* ParenthesizedExpression */: + case 217 /* ParenthesizedExpression */: return visitParenthesizedExpression(node, valueIsDiscarded); - case 359 /* PartiallyEmittedExpression */: + case 360 /* PartiallyEmittedExpression */: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: if (isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 212 /* CallExpression */: + case 213 /* CallExpression */: if (isImportCall(node)) { return visitImportCallExpression(node); } break; - case 223 /* PrefixUnaryExpression */: - case 224 /* PostfixUnaryExpression */: + case 224 /* PrefixUnaryExpression */: + case 225 /* PostfixUnaryExpression */: return visitPrefixOrPostfixUnaryExpression(node, valueIsDiscarded); } return visitEachChild(node, visitor, context); @@ -106878,7 +108610,7 @@ ${lanes.join("\n")} return hasExportedReferenceInDestructuringTarget(node.initializer); } else if (isIdentifier(node)) { const container = resolver.getReferencedExportContainer(node); - return container !== void 0 && container.kind === 311 /* SourceFile */; + return container !== void 0 && container.kind === 312 /* SourceFile */; } else { return false; } @@ -106922,7 +108654,7 @@ ${lanes.join("\n")} return node; } function onEmitNode(hint, node, emitCallback) { - if (node.kind === 311 /* SourceFile */) { + if (node.kind === 312 /* SourceFile */) { const id = getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -106956,7 +108688,7 @@ ${lanes.join("\n")} } function substituteUnspecified(node) { switch (node.kind) { - case 303 /* ShorthandPropertyAssignment */: + case 304 /* ShorthandPropertyAssignment */: return substituteShorthandPropertyAssignment(node); } return node; @@ -107000,9 +108732,9 @@ ${lanes.join("\n")} switch (node.kind) { case 80 /* Identifier */: return substituteExpressionIdentifier(node); - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: return substituteBinaryExpression(node); - case 235 /* MetaProperty */: + case 236 /* MetaProperty */: return substituteMetaProperty(node); } return node; @@ -107043,7 +108775,7 @@ ${lanes.join("\n")} return node; } function substituteBinaryExpression(node) { - if (isAssignmentOperator(node.operatorToken.kind) && isIdentifier(node.left) && !isGeneratedIdentifier(node.left) && !isLocalName(node.left)) { + if (isAssignmentOperator(node.operatorToken.kind) && isIdentifier(node.left) && (!isGeneratedIdentifier(node.left) || isFileLevelReservedGeneratedIdentifier(node.left)) && !isLocalName(node.left)) { const exportedNames = getExports(node.left); if (exportedNames) { let expression = node; @@ -107070,10 +108802,19 @@ ${lanes.join("\n")} /*prefixLocals*/ false ); - if (exportContainer && exportContainer.kind === 311 /* SourceFile */) { + if (exportContainer && exportContainer.kind === 312 /* SourceFile */) { exportedNames = append(exportedNames, factory2.getDeclarationName(valueDeclaration)); } exportedNames = addRange(exportedNames, moduleInfo == null ? void 0 : moduleInfo.exportedBindings[getOriginalNodeId(valueDeclaration)]); + } else if (isGeneratedIdentifier(name) && isFileLevelReservedGeneratedIdentifier(name)) { + const exportSpecifiers = moduleInfo == null ? void 0 : moduleInfo.exportSpecifiers.get(name); + if (exportSpecifiers) { + const exportedNames2 = []; + for (const exportSpecifier of exportSpecifiers) { + exportedNames2.push(exportSpecifier.name); + } + return exportedNames2; + } } return exportedNames; } @@ -107126,7 +108867,7 @@ ${lanes.join("\n")} const previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(311 /* SourceFile */); + context.enableEmitNotification(312 /* SourceFile */); context.enableSubstitution(80 /* Identifier */); let helperNameSubstitutions; let currentSourceFile; @@ -107174,11 +108915,11 @@ ${lanes.join("\n")} } function visitor(node) { switch (node.kind) { - case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportEqualsDeclaration */: return getEmitModuleKind(compilerOptions) >= 100 /* Node16 */ ? visitImportEqualsDeclaration(node) : void 0; - case 276 /* ExportAssignment */: + case 277 /* ExportAssignment */: return visitExportAssignment(node); - case 277 /* ExportDeclaration */: + case 278 /* ExportDeclaration */: const exportDecl = node; return visitExportDeclaration(exportDecl); } @@ -107389,8 +109130,8 @@ ${lanes.join("\n")} const cjsOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(311 /* SourceFile */); - context.enableEmitNotification(311 /* SourceFile */); + context.enableSubstitution(312 /* SourceFile */); + context.enableEmitNotification(312 /* SourceFile */); let currentSourceFile; return transformSourceFileOrBundle; function onSubstituteNode(hint, node) { @@ -107433,7 +109174,7 @@ ${lanes.join("\n")} return result; } function transformSourceFileOrBundle(node) { - return node.kind === 311 /* SourceFile */ ? transformSourceFile(node) : transformBundle(node); + return node.kind === 312 /* SourceFile */ ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(map(node.sourceFiles, transformSourceFile), node.prepends); @@ -107469,7 +109210,7 @@ ${lanes.join("\n")} function getAccessorNameVisibilityDiagnosticMessage(symbolAccessibilityResult) { if (isStatic(node)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; - } else if (node.parent.kind === 262 /* ClassDeclaration */) { + } else if (node.parent.kind === 263 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { return symbolAccessibilityResult.errorModuleName ? Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; @@ -107486,7 +109227,7 @@ ${lanes.join("\n")} function getMethodNameVisibilityDiagnosticMessage(symbolAccessibilityResult) { if (isStatic(node)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1; - } else if (node.parent.kind === 262 /* ClassDeclaration */) { + } else if (node.parent.kind === 263 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Public_method_0_of_exported_class_has_or_is_using_private_name_1; } else { return symbolAccessibilityResult.errorModuleName ? Diagnostics.Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Method_0_of_exported_interface_has_or_is_using_private_name_1; @@ -107517,12 +109258,12 @@ ${lanes.join("\n")} return Debug.assertNever(node, `Attempted to set a declaration diagnostic context for unhandled node kind: ${Debug.formatSyntaxKind(node.kind)}`); } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 259 /* VariableDeclaration */ || node.kind === 207 /* BindingElement */) { + if (node.kind === 260 /* VariableDeclaration */ || node.kind === 208 /* BindingElement */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; - } else if (node.kind === 171 /* PropertyDeclaration */ || node.kind === 210 /* PropertyAccessExpression */ || node.kind === 211 /* ElementAccessExpression */ || node.kind === 225 /* BinaryExpression */ || node.kind === 170 /* PropertySignature */ || node.kind === 168 /* Parameter */ && hasSyntacticModifier(node.parent, 8 /* Private */)) { + } else if (node.kind === 172 /* PropertyDeclaration */ || node.kind === 211 /* PropertyAccessExpression */ || node.kind === 212 /* ElementAccessExpression */ || node.kind === 226 /* BinaryExpression */ || node.kind === 171 /* PropertySignature */ || node.kind === 169 /* Parameter */ && hasSyntacticModifier(node.parent, 8 /* Private */)) { if (isStatic(node)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; - } else if (node.parent.kind === 262 /* ClassDeclaration */ || node.kind === 168 /* Parameter */) { + } else if (node.parent.kind === 263 /* ClassDeclaration */ || node.kind === 169 /* Parameter */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { return symbolAccessibilityResult.errorModuleName ? Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; @@ -107539,7 +109280,7 @@ ${lanes.join("\n")} } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { let diagnosticMessage; - if (node.kind === 177 /* SetAccessor */) { + if (node.kind === 178 /* SetAccessor */) { if (isStatic(node)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? Diagnostics.Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_private_name_1; } else { @@ -107561,26 +109302,26 @@ ${lanes.join("\n")} function getReturnTypeVisibilityError(symbolAccessibilityResult) { let diagnosticMessage; switch (node.kind) { - case 179 /* ConstructSignature */: + case 180 /* ConstructSignature */: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 178 /* CallSignature */: + case 179 /* CallSignature */: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 180 /* IndexSignature */: + case 181 /* IndexSignature */: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: if (isStatic(node)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; - } else if (node.parent.kind === 262 /* ClassDeclaration */) { + } else if (node.parent.kind === 263 /* ClassDeclaration */) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; } else { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 261 /* FunctionDeclaration */: + case 262 /* FunctionDeclaration */: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; break; default: @@ -107601,29 +109342,29 @@ ${lanes.join("\n")} } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 175 /* Constructor */: + case 176 /* Constructor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 179 /* ConstructSignature */: - case 184 /* ConstructorType */: + case 180 /* ConstructSignature */: + case 185 /* ConstructorType */: return symbolAccessibilityResult.errorModuleName ? Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 178 /* CallSignature */: + case 179 /* CallSignature */: return symbolAccessibilityResult.errorModuleName ? Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 180 /* IndexSignature */: + case 181 /* IndexSignature */: return symbolAccessibilityResult.errorModuleName ? Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: if (isStatic(node.parent)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; - } else if (node.parent.parent.kind === 262 /* ClassDeclaration */) { + } else if (node.parent.parent.kind === 263 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { return symbolAccessibilityResult.errorModuleName ? Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 261 /* FunctionDeclaration */: - case 183 /* FunctionType */: + case 262 /* FunctionDeclaration */: + case 184 /* FunctionType */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; - case 177 /* SetAccessor */: - case 176 /* GetAccessor */: + case 178 /* SetAccessor */: + case 177 /* GetAccessor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_0_of_accessor_has_or_is_using_private_name_1; default: return Debug.fail(`Unknown parent for parameter: ${Debug.formatSyntaxKind(node.parent.kind)}`); @@ -107632,40 +109373,40 @@ ${lanes.join("\n")} function getTypeParameterConstraintVisibilityError() { let diagnosticMessage; switch (node.parent.kind) { - case 262 /* ClassDeclaration */: + case 263 /* ClassDeclaration */: diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 263 /* InterfaceDeclaration */: + case 264 /* InterfaceDeclaration */: diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 199 /* MappedType */: + case 200 /* MappedType */: diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1; break; - case 184 /* ConstructorType */: - case 179 /* ConstructSignature */: + case 185 /* ConstructorType */: + case 180 /* ConstructSignature */: diagnosticMessage = Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 178 /* CallSignature */: + case 179 /* CallSignature */: diagnosticMessage = Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: if (isStatic(node.parent)) { diagnosticMessage = Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; - } else if (node.parent.parent.kind === 262 /* ClassDeclaration */) { + } else if (node.parent.parent.kind === 263 /* ClassDeclaration */) { diagnosticMessage = Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 183 /* FunctionType */: - case 261 /* FunctionDeclaration */: + case 184 /* FunctionType */: + case 262 /* FunctionDeclaration */: diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 194 /* InferType */: + case 195 /* InferType */: diagnosticMessage = Diagnostics.Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1; break; - case 264 /* TypeAliasDeclaration */: + case 265 /* TypeAliasDeclaration */: diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -107733,7 +109474,7 @@ ${lanes.join("\n")} } function isInternalDeclaration(node, currentSourceFile) { const parseTreeNode = getParseTreeNode(node); - if (parseTreeNode && parseTreeNode.kind === 168 /* Parameter */) { + if (parseTreeNode && parseTreeNode.kind === 169 /* Parameter */) { const paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode); const previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : void 0; const text = currentSourceFile.text; @@ -107964,10 +109705,10 @@ ${lanes.join("\n")} return result; } function transformRoot(node) { - if (node.kind === 311 /* SourceFile */ && node.isDeclarationFile) { + if (node.kind === 312 /* SourceFile */ && node.isDeclarationFile) { return node; } - if (node.kind === 312 /* Bundle */) { + if (node.kind === 313 /* Bundle */) { isBundledEmit = true; refs = /* @__PURE__ */ new Map(); libs2 = /* @__PURE__ */ new Map(); @@ -108034,7 +109775,7 @@ ${lanes.join("\n")} ); } ), mapDefined(node.prepends, (prepend) => { - if (prepend.kind === 314 /* InputFiles */) { + if (prepend.kind === 315 /* InputFiles */) { const sourceFile = createUnparsedSourceFile(prepend, "dts", stripInternal); hasNoDefaultLib = hasNoDefaultLib || !!sourceFile.hasNoDefaultLib; collectReferences(sourceFile, refs); @@ -108202,14 +109943,14 @@ ${lanes.join("\n")} if (name.kind === 80 /* Identifier */) { return name; } else { - if (name.kind === 206 /* ArrayBindingPattern */) { + if (name.kind === 207 /* ArrayBindingPattern */) { return factory2.updateArrayBindingPattern(name, visitNodes2(name.elements, visitBindingElement, isArrayBindingElement)); } else { return factory2.updateObjectBindingPattern(name, visitNodes2(name.elements, visitBindingElement, isBindingElement)); } } function visitBindingElement(elem) { - if (elem.kind === 231 /* OmittedExpression */) { + if (elem.kind === 232 /* OmittedExpression */) { return elem; } if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced && !isIdentifierANonContextualKeyword(elem.propertyName)) { @@ -108273,14 +110014,14 @@ ${lanes.join("\n")} if (shouldPrintWithInitializer(node)) { return; } - const shouldUseResolverType = node.kind === 168 /* Parameter */ && (resolver.isRequiredInitializedParameter(node) || resolver.isOptionalUninitializedParameterProperty(node)); + const shouldUseResolverType = node.kind === 169 /* Parameter */ && (resolver.isRequiredInitializedParameter(node) || resolver.isOptionalUninitializedParameterProperty(node)); if (type && !shouldUseResolverType) { return visitNode(type, visitDeclarationSubtree, isTypeNode); } if (!getParseTreeNode(node)) { return type ? visitNode(type, visitDeclarationSubtree, isTypeNode) : factory2.createKeywordTypeNode(133 /* AnyKeyword */); } - if (node.kind === 177 /* SetAccessor */) { + if (node.kind === 178 /* SetAccessor */) { return factory2.createKeywordTypeNode(133 /* AnyKeyword */); } errorNameNode = node.name; @@ -108289,10 +110030,10 @@ ${lanes.join("\n")} oldDiag = getSymbolAccessibilityDiagnostic; getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(node); } - if (node.kind === 259 /* VariableDeclaration */ || node.kind === 207 /* BindingElement */) { + if (node.kind === 260 /* VariableDeclaration */ || node.kind === 208 /* BindingElement */) { return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); } - if (node.kind === 168 /* Parameter */ || node.kind === 171 /* PropertyDeclaration */ || node.kind === 170 /* PropertySignature */) { + if (node.kind === 169 /* Parameter */ || node.kind === 172 /* PropertyDeclaration */ || node.kind === 171 /* PropertySignature */) { if (isPropertySignature(node) || !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)); @@ -108309,21 +110050,21 @@ ${lanes.join("\n")} function isDeclarationAndNotVisible(node) { node = getParseTreeNode(node); switch (node.kind) { - case 261 /* FunctionDeclaration */: - case 266 /* ModuleDeclaration */: - case 263 /* InterfaceDeclaration */: - case 262 /* ClassDeclaration */: - case 264 /* TypeAliasDeclaration */: - case 265 /* EnumDeclaration */: + case 262 /* FunctionDeclaration */: + case 267 /* ModuleDeclaration */: + case 264 /* InterfaceDeclaration */: + case 263 /* ClassDeclaration */: + case 265 /* TypeAliasDeclaration */: + case 266 /* EnumDeclaration */: return !resolver.isDeclarationVisible(node); - case 259 /* VariableDeclaration */: + case 260 /* VariableDeclaration */: return !getBindingNameVisible(node); - case 270 /* ImportEqualsDeclaration */: - case 271 /* ImportDeclaration */: - case 277 /* ExportDeclaration */: - case 276 /* ExportAssignment */: + case 271 /* ImportEqualsDeclaration */: + case 272 /* ImportDeclaration */: + case 278 /* ExportDeclaration */: + case 277 /* ExportAssignment */: return false; - case 174 /* ClassStaticBlockDeclaration */: + case 175 /* ClassStaticBlockDeclaration */: return true; } return false; @@ -108411,7 +110152,7 @@ ${lanes.join("\n")} function rewriteModuleSpecifier(parent2, input) { if (!input) return void 0; - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent2.kind !== 266 /* ModuleDeclaration */ && parent2.kind !== 204 /* ImportType */; + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent2.kind !== 267 /* ModuleDeclaration */ && parent2.kind !== 205 /* ImportType */; if (isStringLiteralLike(input)) { if (isBundledEmit) { const newName = getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent2); @@ -108430,7 +110171,7 @@ ${lanes.join("\n")} function transformImportEqualsDeclaration(decl) { if (!resolver.isDeclarationVisible(decl)) return; - if (decl.moduleReference.kind === 282 /* ExternalModuleReference */) { + if (decl.moduleReference.kind === 283 /* ExternalModuleReference */) { const specifier = getExternalModuleImportEqualsDeclarationExpression(decl); return factory2.updateImportEqualsDeclaration( decl, @@ -108467,7 +110208,7 @@ ${lanes.join("\n")} void 0 ), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)); } - if (decl.importClause.namedBindings.kind === 273 /* NamespaceImport */) { + if (decl.importClause.namedBindings.kind === 274 /* NamespaceImport */) { const namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : ( /*namedBindings*/ void 0 @@ -108570,7 +110311,7 @@ ${lanes.join("\n")} const oldDiag = getSymbolAccessibilityDiagnostic; const canProduceDiagnostic = canProduceDiagnostics(input); const oldWithinObjectLiteralType = suppressNewDiagnosticContexts; - let shouldEnterSuppressNewDiagnosticsContextContext = (input.kind === 186 /* TypeLiteral */ || input.kind === 199 /* MappedType */) && input.parent.kind !== 264 /* TypeAliasDeclaration */; + let shouldEnterSuppressNewDiagnosticsContextContext = (input.kind === 187 /* TypeLiteral */ || input.kind === 200 /* MappedType */) && input.parent.kind !== 265 /* TypeAliasDeclaration */; if (isMethodDeclaration(input) || isMethodSignature(input)) { if (hasEffectiveModifier(input, 8 /* Private */)) { if (input.symbol && input.symbol.declarations && input.symbol.declarations[0] !== input) @@ -108598,26 +110339,26 @@ ${lanes.join("\n")} } if (isProcessedComponent(input)) { switch (input.kind) { - case 232 /* ExpressionWithTypeArguments */: { + case 233 /* ExpressionWithTypeArguments */: { if (isEntityName(input.expression) || isEntityNameExpression(input.expression)) { checkEntityNameVisibility(input.expression, enclosingDeclaration); } const node = visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory2.updateExpressionWithTypeArguments(node, node.expression, node.typeArguments)); } - case 182 /* TypeReference */: { + case 183 /* TypeReference */: { checkEntityNameVisibility(input.typeName, enclosingDeclaration); const node = visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory2.updateTypeReferenceNode(node, node.typeName, node.typeArguments)); } - case 179 /* ConstructSignature */: + case 180 /* ConstructSignature */: return cleanup(factory2.updateConstructSignature( input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type) )); - case 175 /* Constructor */: { + case 176 /* Constructor */: { const ctor = factory2.createConstructorDeclaration( /*modifiers*/ ensureModifiers(input), @@ -108627,7 +110368,7 @@ ${lanes.join("\n")} ); return cleanup(ctor); } - case 173 /* MethodDeclaration */: { + case 174 /* MethodDeclaration */: { if (isPrivateIdentifier(input.name)) { return cleanup( /*returnValue*/ @@ -108648,7 +110389,7 @@ ${lanes.join("\n")} ); return cleanup(sig); } - case 176 /* GetAccessor */: { + case 177 /* GetAccessor */: { if (isPrivateIdentifier(input.name)) { return cleanup( /*returnValue*/ @@ -108666,7 +110407,7 @@ ${lanes.join("\n")} void 0 )); } - case 177 /* SetAccessor */: { + case 178 /* SetAccessor */: { if (isPrivateIdentifier(input.name)) { return cleanup( /*returnValue*/ @@ -108682,7 +110423,7 @@ ${lanes.join("\n")} void 0 )); } - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: if (isPrivateIdentifier(input.name)) { return cleanup( /*returnValue*/ @@ -108697,7 +110438,7 @@ ${lanes.join("\n")} ensureType(input, input.type), ensureNoInitializer(input) )); - case 170 /* PropertySignature */: + case 171 /* PropertySignature */: if (isPrivateIdentifier(input.name)) { return cleanup( /*returnValue*/ @@ -108711,7 +110452,7 @@ ${lanes.join("\n")} input.questionToken, ensureType(input, input.type) )); - case 172 /* MethodSignature */: { + case 173 /* MethodSignature */: { if (isPrivateIdentifier(input.name)) { return cleanup( /*returnValue*/ @@ -108728,7 +110469,7 @@ ${lanes.join("\n")} ensureType(input, input.type) )); } - case 178 /* CallSignature */: { + case 179 /* CallSignature */: { return cleanup(factory2.updateCallSignature( input, ensureTypeParams(input, input.typeParameters), @@ -108736,7 +110477,7 @@ ${lanes.join("\n")} ensureType(input, input.type) )); } - case 180 /* IndexSignature */: { + case 181 /* IndexSignature */: { return cleanup(factory2.updateIndexSignature( input, ensureModifiers(input), @@ -108744,7 +110485,7 @@ ${lanes.join("\n")} visitNode(input.type, visitDeclarationSubtree, isTypeNode) || factory2.createKeywordTypeNode(133 /* AnyKeyword */) )); } - case 259 /* VariableDeclaration */: { + case 260 /* VariableDeclaration */: { if (isBindingPattern(input.name)) { return recreateBindingPattern(input.name); } @@ -108759,7 +110500,7 @@ ${lanes.join("\n")} ensureNoInitializer(input) )); } - case 167 /* TypeParameter */: { + case 168 /* TypeParameter */: { if (isPrivateMethodTypeParameter(input) && (input.default || input.constraint)) { return cleanup(factory2.updateTypeParameterDeclaration( input, @@ -108773,7 +110514,7 @@ ${lanes.join("\n")} } return cleanup(visitEachChild(input, visitDeclarationSubtree, context)); } - case 193 /* ConditionalType */: { + case 194 /* ConditionalType */: { const checkType = visitNode(input.checkType, visitDeclarationSubtree, isTypeNode); const extendsType = visitNode(input.extendsType, visitDeclarationSubtree, isTypeNode); const oldEnclosingDecl = enclosingDeclaration; @@ -108787,13 +110528,13 @@ ${lanes.join("\n")} Debug.assert(falseType); return cleanup(factory2.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType)); } - case 183 /* FunctionType */: { + case 184 /* FunctionType */: { return cleanup(factory2.updateFunctionTypeNode(input, visitNodes2(input.typeParameters, visitDeclarationSubtree, isTypeParameterDeclaration), updateParamsList(input, input.parameters), Debug.checkDefined(visitNode(input.type, visitDeclarationSubtree, isTypeNode)))); } - case 184 /* ConstructorType */: { + case 185 /* ConstructorType */: { return cleanup(factory2.updateConstructorTypeNode(input, ensureModifiers(input), visitNodes2(input.typeParameters, visitDeclarationSubtree, isTypeParameterDeclaration), updateParamsList(input, input.parameters), Debug.checkDefined(visitNode(input.type, visitDeclarationSubtree, isTypeNode)))); } - case 204 /* ImportType */: { + case 205 /* ImportType */: { if (!isLiteralImportTypeNode(input)) return cleanup(input); return cleanup(factory2.updateImportTypeNode( @@ -108833,7 +110574,7 @@ ${lanes.join("\n")} } } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 173 /* MethodDeclaration */ && hasEffectiveModifier(node.parent, 8 /* Private */); + return node.parent.kind === 174 /* MethodDeclaration */ && hasEffectiveModifier(node.parent, 8 /* Private */); } function visitDeclarationStatements(input) { if (!isPreservedDeclarationStatement(input)) { @@ -108842,7 +110583,7 @@ ${lanes.join("\n")} if (shouldStripInternal(input)) return; switch (input.kind) { - case 277 /* ExportDeclaration */: { + case 278 /* ExportDeclaration */: { if (isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; } @@ -108856,7 +110597,7 @@ ${lanes.join("\n")} getResolutionModeOverrideForClause(input.assertClause) ? input.assertClause : void 0 ); } - case 276 /* ExportAssignment */: { + case 277 /* ExportAssignment */: { if (isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; } @@ -108897,6 +110638,21 @@ ${lanes.join("\n")} const modifiers = factory2.createModifiersFromModifierFlags(getEffectiveModifierFlags(statement) & (258047 /* All */ ^ 1 /* Export */)); return factory2.updateModifiers(statement, modifiers); } + function updateModuleDeclarationAndKeyword(node, modifiers, name, body) { + const updated = factory2.updateModuleDeclaration(node, modifiers, name, body); + if (isAmbientModule(updated) || updated.flags & 32 /* Namespace */) { + return updated; + } + const fixed = factory2.createModuleDeclaration( + updated.modifiers, + updated.name, + updated.body, + updated.flags | 32 /* Namespace */ + ); + setOriginalNode(fixed, updated); + setTextRange(fixed, updated); + return fixed; + } function transformTopLevelDeclaration(input) { if (lateMarkedStatements) { while (orderedRemoveItem(lateMarkedStatements, input)) @@ -108905,10 +110661,10 @@ ${lanes.join("\n")} if (shouldStripInternal(input)) return; switch (input.kind) { - case 270 /* ImportEqualsDeclaration */: { + case 271 /* ImportEqualsDeclaration */: { return transformImportEqualsDeclaration(input); } - case 271 /* ImportDeclaration */: { + case 272 /* ImportDeclaration */: { return transformImportDeclaration(input); } } @@ -108928,7 +110684,7 @@ ${lanes.join("\n")} } const previousNeedsDeclare = needsDeclare; switch (input.kind) { - case 264 /* TypeAliasDeclaration */: { + case 265 /* TypeAliasDeclaration */: { needsDeclare = false; const clean2 = cleanup(factory2.updateTypeAliasDeclaration( input, @@ -108940,7 +110696,7 @@ ${lanes.join("\n")} needsDeclare = previousNeedsDeclare; return clean2; } - case 263 /* InterfaceDeclaration */: { + case 264 /* InterfaceDeclaration */: { return cleanup(factory2.updateInterfaceDeclaration( input, ensureModifiers(input), @@ -108950,7 +110706,7 @@ ${lanes.join("\n")} visitNodes2(input.members, visitDeclarationSubtree, isTypeElement) )); } - case 261 /* FunctionDeclaration */: { + case 262 /* FunctionDeclaration */: { const clean2 = cleanup(factory2.updateFunctionDeclaration( input, ensureModifiers(input), @@ -108970,7 +110726,7 @@ ${lanes.join("\n")} void 0, clean2.name || factory2.createIdentifier("_default"), factory2.createModuleBlock([]), - 16 /* Namespace */ + 32 /* Namespace */ ); setParent(fakespace, enclosingDeclaration); fakespace.locals = createSymbolTable(props); @@ -109020,7 +110776,7 @@ ${lanes.join("\n")} })) )); } - const namespaceDecl = factory2.createModuleDeclaration(ensureModifiers(input), input.name, factory2.createModuleBlock(declarations), 16 /* Namespace */); + const namespaceDecl = factory2.createModuleDeclaration(ensureModifiers(input), input.name, factory2.createModuleBlock(declarations), 32 /* Namespace */); if (!hasEffectiveModifier(clean2, 1024 /* Default */)) { return [clean2, namespaceDecl]; } @@ -109059,17 +110815,17 @@ ${lanes.join("\n")} return clean2; } } - case 266 /* ModuleDeclaration */: { + case 267 /* ModuleDeclaration */: { needsDeclare = false; const inner = input.body; - if (inner && inner.kind === 267 /* ModuleBlock */) { + if (inner && inner.kind === 268 /* ModuleBlock */) { const oldNeedsScopeFix = needsScopeFixMarker; const oldHasScopeFix = resultHasScopeMarker; resultHasScopeMarker = false; needsScopeFixMarker = false; const statements = visitNodes2(inner.statements, visitDeclarationStatements, isStatement); let lateStatements = transformAndReplaceLatePaintedStatements(statements); - if (input.flags & 16777216 /* Ambient */) { + if (input.flags & 33554432 /* Ambient */) { needsScopeFixMarker = false; } if (!isGlobalScopeAugmentation(input) && !hasScopeMarker2(lateStatements) && !resultHasScopeMarker) { @@ -109084,7 +110840,7 @@ ${lanes.join("\n")} needsScopeFixMarker = oldNeedsScopeFix; resultHasScopeMarker = oldHasScopeFix; const mods = ensureModifiers(input); - return cleanup(factory2.updateModuleDeclaration( + return cleanup(updateModuleDeclarationAndKeyword( input, mods, isExternalModuleAugmentation(input) ? rewriteModuleSpecifier(input, input.name) : input.name, @@ -109098,7 +110854,7 @@ ${lanes.join("\n")} const id = getOriginalNodeId(inner); const body = lateStatementReplacementMap.get(id); lateStatementReplacementMap.delete(id); - return cleanup(factory2.updateModuleDeclaration( + return cleanup(updateModuleDeclarationAndKeyword( input, mods, input.name, @@ -109106,7 +110862,7 @@ ${lanes.join("\n")} )); } } - case 262 /* ClassDeclaration */: { + case 263 /* ClassDeclaration */: { errorNameNode = input.name; errorFallbackNode = input; const modifiers = factory2.createNodeArray(ensureModifiers(input)); @@ -109222,10 +110978,10 @@ ${lanes.join("\n")} )); } } - case 242 /* VariableStatement */: { + case 243 /* VariableStatement */: { return cleanup(transformVariableStatement(input)); } - case 265 /* EnumDeclaration */: { + case 266 /* EnumDeclaration */: { return cleanup(factory2.updateEnumDeclaration(input, factory2.createNodeArray(ensureModifiers(input)), input.name, factory2.createNodeArray(mapDefined(input.members, (m) => { if (shouldStripInternal(m)) return; @@ -109242,7 +110998,7 @@ ${lanes.join("\n")} if (canProdiceDiagnostic) { getSymbolAccessibilityDiagnostic = oldDiag; } - if (input.kind === 266 /* ModuleDeclaration */) { + if (input.kind === 267 /* ModuleDeclaration */) { needsDeclare = previousNeedsDeclare; } if (node === input) { @@ -109259,13 +111015,23 @@ ${lanes.join("\n")} const nodes = visitNodes2(input.declarationList.declarations, visitDeclarationSubtree, isVariableDeclaration); if (!length(nodes)) return; - return factory2.updateVariableStatement(input, factory2.createNodeArray(ensureModifiers(input)), factory2.updateVariableDeclarationList(input.declarationList, nodes)); + const modifiers = factory2.createNodeArray(ensureModifiers(input)); + let declList; + if (isVarUsing(input.declarationList) || isVarAwaitUsing(input.declarationList)) { + declList = factory2.createVariableDeclarationList(nodes, 2 /* Const */); + setOriginalNode(declList, input.declarationList); + setTextRange(declList, input.declarationList); + setCommentRange(declList, input.declarationList); + } else { + declList = factory2.updateVariableDeclarationList(input.declarationList, nodes); + } + return factory2.updateVariableStatement(input, modifiers, declList); } function recreateBindingPattern(d) { return flatten(mapDefined(d.elements, (e) => recreateBindingElement(e))); } function recreateBindingElement(e) { - if (e.kind === 231 /* OmittedExpression */) { + if (e.kind === 232 /* OmittedExpression */) { return; } if (e.name) { @@ -109325,7 +111091,7 @@ ${lanes.join("\n")} function ensureModifierFlags(node) { let mask2 = 258047 /* All */ ^ (4 /* Public */ | 512 /* Async */ | 16384 /* Override */); let additions = needsDeclare && !isAlwaysType(node) ? 2 /* Ambient */ : 0 /* None */; - const parentIsFile = node.parent.kind === 311 /* SourceFile */; + const parentIsFile = node.parent.kind === 312 /* SourceFile */; if (!parentIsFile || isBundledEmit && parentIsFile && isExternalModule(node.parent)) { mask2 ^= 2 /* Ambient */; additions = 0 /* None */; @@ -109351,7 +111117,7 @@ ${lanes.join("\n")} } } function isAlwaysType(node) { - if (node.kind === 263 /* InterfaceDeclaration */) { + if (node.kind === 264 /* InterfaceDeclaration */) { return true; } return false; @@ -109371,57 +111137,57 @@ ${lanes.join("\n")} } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 176 /* GetAccessor */ ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type : void 0; + return accessor.kind === 177 /* GetAccessor */ ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type : void 0; } } function canHaveLiteralInitializer(node) { switch (node.kind) { - case 171 /* PropertyDeclaration */: - case 170 /* PropertySignature */: + case 172 /* PropertyDeclaration */: + case 171 /* PropertySignature */: return !hasEffectiveModifier(node, 8 /* Private */); - case 168 /* Parameter */: - case 259 /* VariableDeclaration */: + case 169 /* Parameter */: + case 260 /* VariableDeclaration */: return true; } return false; } function isPreservedDeclarationStatement(node) { switch (node.kind) { - case 261 /* FunctionDeclaration */: - case 266 /* ModuleDeclaration */: - case 270 /* ImportEqualsDeclaration */: - case 263 /* InterfaceDeclaration */: - case 262 /* ClassDeclaration */: - case 264 /* TypeAliasDeclaration */: - case 265 /* EnumDeclaration */: - case 242 /* VariableStatement */: - case 271 /* ImportDeclaration */: - case 277 /* ExportDeclaration */: - case 276 /* ExportAssignment */: + case 262 /* FunctionDeclaration */: + case 267 /* ModuleDeclaration */: + case 271 /* ImportEqualsDeclaration */: + case 264 /* InterfaceDeclaration */: + case 263 /* ClassDeclaration */: + case 265 /* TypeAliasDeclaration */: + case 266 /* EnumDeclaration */: + case 243 /* VariableStatement */: + case 272 /* ImportDeclaration */: + case 278 /* ExportDeclaration */: + case 277 /* ExportAssignment */: return true; } return false; } function isProcessedComponent(node) { switch (node.kind) { - case 179 /* ConstructSignature */: - case 175 /* Constructor */: - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 171 /* PropertyDeclaration */: - case 170 /* PropertySignature */: - case 172 /* MethodSignature */: - case 178 /* CallSignature */: - case 180 /* IndexSignature */: - case 259 /* VariableDeclaration */: - case 167 /* TypeParameter */: - case 232 /* ExpressionWithTypeArguments */: - case 182 /* TypeReference */: - case 193 /* ConditionalType */: - case 183 /* FunctionType */: - case 184 /* ConstructorType */: - case 204 /* ImportType */: + case 180 /* ConstructSignature */: + case 176 /* Constructor */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 172 /* PropertyDeclaration */: + case 171 /* PropertySignature */: + case 173 /* MethodSignature */: + case 179 /* CallSignature */: + case 181 /* IndexSignature */: + case 260 /* VariableDeclaration */: + case 168 /* TypeParameter */: + case 233 /* ExpressionWithTypeArguments */: + case 183 /* TypeReference */: + case 194 /* ConditionalType */: + case 184 /* FunctionType */: + case 185 /* ConstructorType */: + case 205 /* ImportType */: return true; } return false; @@ -109470,16 +111236,17 @@ ${lanes.join("\n")} transformers.push(transformTypeScript); if (compilerOptions.experimentalDecorators) { transformers.push(transformLegacyDecorators); - } else if (languageVersion < 99 /* ESNext */ || !useDefineForClassFields) { - transformers.push(transformESDecorators); } - transformers.push(transformClassFields); if (getJSXTransformEnabled(compilerOptions)) { transformers.push(transformJsx); } if (languageVersion < 99 /* ESNext */) { transformers.push(transformESNext); } + if (!compilerOptions.experimentalDecorators && (languageVersion < 99 /* ESNext */ || !useDefineForClassFields)) { + transformers.push(transformESDecorators); + } + transformers.push(transformClassFields); if (languageVersion < 8 /* ES2021 */) { transformers.push(transformES2021); } @@ -109538,7 +111305,7 @@ ${lanes.join("\n")} } function transformNodes(resolver, host, factory2, options, nodes, transformers, allowDtsFiles) { var _a, _b; - const enabledSyntaxKindFeatures = new Array(362 /* Count */); + const enabledSyntaxKindFeatures = new Array(363 /* Count */); let lexicalEnvironmentVariableDeclarations; let lexicalEnvironmentFunctionDeclarations; let lexicalEnvironmentStatements; @@ -109617,7 +111384,7 @@ ${lanes.join("\n")} state = 1 /* Initialized */; const transformed = []; for (const node of nodes) { - (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Emit, "transformNodes", node.kind === 311 /* SourceFile */ ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); + (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Emit, "transformNodes", node.kind === 312 /* SourceFile */ ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); transformed.push((allowDtsFiles ? transformation : transformRoot)(node)); (_b = tracing) == null ? void 0 : _b.pop(); } @@ -109945,7 +111712,7 @@ ${lanes.join("\n")} } function getOutputPathsFor(sourceFile, host, forceDtsPaths) { const options = host.getCompilerOptions(); - if (sourceFile.kind === 312 /* Bundle */) { + if (sourceFile.kind === 313 /* Bundle */) { return getOutputPathsForBundle(options, forceDtsPaths); } else { const ownOutputFilePath = getOwnEmitOutputFilePath(sourceFile.fileName, host, getOutputExtension(sourceFile.fileName, options)); @@ -110337,8 +112104,8 @@ ${lanes.join("\n")} } function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform2, printer, mapOptions) { const sourceFileOrBundle = transform2.transformed[0]; - const bundle = sourceFileOrBundle.kind === 312 /* Bundle */ ? sourceFileOrBundle : void 0; - const sourceFile = sourceFileOrBundle.kind === 311 /* SourceFile */ ? sourceFileOrBundle : void 0; + const bundle = sourceFileOrBundle.kind === 313 /* Bundle */ ? sourceFileOrBundle : void 0; + const sourceFile = sourceFileOrBundle.kind === 312 /* SourceFile */ ? sourceFileOrBundle : void 0; const sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; let sourceMapGenerator; if (shouldEmitSourceMaps(mapOptions, sourceFileOrBundle)) { @@ -110400,7 +112167,7 @@ ${lanes.join("\n")} writer.clear(); } function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) { - return (mapOptions.sourceMap || mapOptions.inlineSourceMap) && (sourceFileOrBundle.kind !== 311 /* SourceFile */ || !fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Json */)); + return (mapOptions.sourceMap || mapOptions.inlineSourceMap) && (sourceFileOrBundle.kind !== 312 /* SourceFile */ || !fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Json */)); } function getSourceRoot(mapOptions) { const sourceRoot = normalizeSlashes(mapOptions.sourceRoot || ""); @@ -110720,11 +112487,11 @@ ${lanes.join("\n")} break; } switch (node.kind) { - case 311 /* SourceFile */: + case 312 /* SourceFile */: return printFile(node); - case 312 /* Bundle */: + case 313 /* Bundle */: return printBundle(node); - case 313 /* UnparsedSource */: + case 314 /* UnparsedSource */: return printUnparsedSource(node); } writeNode(hint, node, sourceFile, beginPrint()); @@ -111103,301 +112870,301 @@ ${lanes.join("\n")} return emitIdentifier(node); case 81 /* PrivateIdentifier */: return emitPrivateIdentifier(node); - case 165 /* QualifiedName */: + case 166 /* QualifiedName */: return emitQualifiedName(node); - case 166 /* ComputedPropertyName */: + case 167 /* ComputedPropertyName */: return emitComputedPropertyName(node); - case 167 /* TypeParameter */: + case 168 /* TypeParameter */: return emitTypeParameter(node); - case 168 /* Parameter */: + case 169 /* Parameter */: return emitParameter(node); - case 169 /* Decorator */: + case 170 /* Decorator */: return emitDecorator(node); - case 170 /* PropertySignature */: + case 171 /* PropertySignature */: return emitPropertySignature(node); - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: return emitPropertyDeclaration(node); - case 172 /* MethodSignature */: + case 173 /* MethodSignature */: return emitMethodSignature(node); - case 173 /* MethodDeclaration */: + case 174 /* MethodDeclaration */: return emitMethodDeclaration(node); - case 174 /* ClassStaticBlockDeclaration */: + case 175 /* ClassStaticBlockDeclaration */: return emitClassStaticBlockDeclaration(node); - case 175 /* Constructor */: + case 176 /* Constructor */: return emitConstructor(node); - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: return emitAccessorDeclaration(node); - case 178 /* CallSignature */: + case 179 /* CallSignature */: return emitCallSignature(node); - case 179 /* ConstructSignature */: + case 180 /* ConstructSignature */: return emitConstructSignature(node); - case 180 /* IndexSignature */: + case 181 /* IndexSignature */: return emitIndexSignature(node); - case 181 /* TypePredicate */: + case 182 /* TypePredicate */: return emitTypePredicate(node); - case 182 /* TypeReference */: + case 183 /* TypeReference */: return emitTypeReference(node); - case 183 /* FunctionType */: + case 184 /* FunctionType */: return emitFunctionType(node); - case 184 /* ConstructorType */: + case 185 /* ConstructorType */: return emitConstructorType(node); - case 185 /* TypeQuery */: + case 186 /* TypeQuery */: return emitTypeQuery(node); - case 186 /* TypeLiteral */: + case 187 /* TypeLiteral */: return emitTypeLiteral(node); - case 187 /* ArrayType */: + case 188 /* ArrayType */: return emitArrayType(node); - case 188 /* TupleType */: + case 189 /* TupleType */: return emitTupleType(node); - case 189 /* OptionalType */: + case 190 /* OptionalType */: return emitOptionalType(node); - case 191 /* UnionType */: + case 192 /* UnionType */: return emitUnionType(node); - case 192 /* IntersectionType */: + case 193 /* IntersectionType */: return emitIntersectionType(node); - case 193 /* ConditionalType */: + case 194 /* ConditionalType */: return emitConditionalType(node); - case 194 /* InferType */: + case 195 /* InferType */: return emitInferType(node); - case 195 /* ParenthesizedType */: + case 196 /* ParenthesizedType */: return emitParenthesizedType(node); - case 232 /* ExpressionWithTypeArguments */: + case 233 /* ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 196 /* ThisType */: + case 197 /* ThisType */: return emitThisType(); - case 197 /* TypeOperator */: + case 198 /* TypeOperator */: return emitTypeOperator(node); - case 198 /* IndexedAccessType */: + case 199 /* IndexedAccessType */: return emitIndexedAccessType(node); - case 199 /* MappedType */: + case 200 /* MappedType */: return emitMappedType(node); - case 200 /* LiteralType */: + case 201 /* LiteralType */: return emitLiteralType(node); - case 201 /* NamedTupleMember */: + case 202 /* NamedTupleMember */: return emitNamedTupleMember(node); - case 202 /* TemplateLiteralType */: + case 203 /* TemplateLiteralType */: return emitTemplateType(node); - case 203 /* TemplateLiteralTypeSpan */: + case 204 /* TemplateLiteralTypeSpan */: return emitTemplateTypeSpan(node); - case 204 /* ImportType */: + case 205 /* ImportType */: return emitImportTypeNode(node); - case 205 /* ObjectBindingPattern */: + case 206 /* ObjectBindingPattern */: return emitObjectBindingPattern(node); - case 206 /* ArrayBindingPattern */: + case 207 /* ArrayBindingPattern */: return emitArrayBindingPattern(node); - case 207 /* BindingElement */: + case 208 /* BindingElement */: return emitBindingElement(node); - case 238 /* TemplateSpan */: + case 239 /* TemplateSpan */: return emitTemplateSpan(node); - case 239 /* SemicolonClassElement */: + case 240 /* SemicolonClassElement */: return emitSemicolonClassElement(); - case 240 /* Block */: + case 241 /* Block */: return emitBlock(node); - case 242 /* VariableStatement */: + case 243 /* VariableStatement */: return emitVariableStatement(node); - case 241 /* EmptyStatement */: + case 242 /* EmptyStatement */: return emitEmptyStatement( /*isEmbeddedStatement*/ false ); - case 243 /* ExpressionStatement */: + case 244 /* ExpressionStatement */: return emitExpressionStatement(node); - case 244 /* IfStatement */: + case 245 /* IfStatement */: return emitIfStatement(node); - case 245 /* DoStatement */: + case 246 /* DoStatement */: return emitDoStatement(node); - case 246 /* WhileStatement */: + case 247 /* WhileStatement */: return emitWhileStatement(node); - case 247 /* ForStatement */: + case 248 /* ForStatement */: return emitForStatement(node); - case 248 /* ForInStatement */: + case 249 /* ForInStatement */: return emitForInStatement(node); - case 249 /* ForOfStatement */: + case 250 /* ForOfStatement */: return emitForOfStatement(node); - case 250 /* ContinueStatement */: + case 251 /* ContinueStatement */: return emitContinueStatement(node); - case 251 /* BreakStatement */: + case 252 /* BreakStatement */: return emitBreakStatement(node); - case 252 /* ReturnStatement */: + case 253 /* ReturnStatement */: return emitReturnStatement(node); - case 253 /* WithStatement */: + case 254 /* WithStatement */: return emitWithStatement(node); - case 254 /* SwitchStatement */: + case 255 /* SwitchStatement */: return emitSwitchStatement(node); - case 255 /* LabeledStatement */: + case 256 /* LabeledStatement */: return emitLabeledStatement(node); - case 256 /* ThrowStatement */: + case 257 /* ThrowStatement */: return emitThrowStatement(node); - case 257 /* TryStatement */: + case 258 /* TryStatement */: return emitTryStatement(node); - case 258 /* DebuggerStatement */: + case 259 /* DebuggerStatement */: return emitDebuggerStatement(node); - case 259 /* VariableDeclaration */: + case 260 /* VariableDeclaration */: return emitVariableDeclaration(node); - case 260 /* VariableDeclarationList */: + case 261 /* VariableDeclarationList */: return emitVariableDeclarationList(node); - case 261 /* FunctionDeclaration */: + case 262 /* FunctionDeclaration */: return emitFunctionDeclaration(node); - case 262 /* ClassDeclaration */: + case 263 /* ClassDeclaration */: return emitClassDeclaration(node); - case 263 /* InterfaceDeclaration */: + case 264 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 264 /* TypeAliasDeclaration */: + case 265 /* TypeAliasDeclaration */: return emitTypeAliasDeclaration(node); - case 265 /* EnumDeclaration */: + case 266 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 266 /* ModuleDeclaration */: + case 267 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 267 /* ModuleBlock */: + case 268 /* ModuleBlock */: return emitModuleBlock(node); - case 268 /* CaseBlock */: + case 269 /* CaseBlock */: return emitCaseBlock(node); - case 269 /* NamespaceExportDeclaration */: + case 270 /* NamespaceExportDeclaration */: return emitNamespaceExportDeclaration(node); - case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 271 /* ImportDeclaration */: + case 272 /* ImportDeclaration */: return emitImportDeclaration(node); - case 272 /* ImportClause */: + case 273 /* ImportClause */: return emitImportClause(node); - case 273 /* NamespaceImport */: + case 274 /* NamespaceImport */: return emitNamespaceImport(node); - case 279 /* NamespaceExport */: + case 280 /* NamespaceExport */: return emitNamespaceExport(node); - case 274 /* NamedImports */: + case 275 /* NamedImports */: return emitNamedImports(node); - case 275 /* ImportSpecifier */: + case 276 /* ImportSpecifier */: return emitImportSpecifier(node); - case 276 /* ExportAssignment */: + case 277 /* ExportAssignment */: return emitExportAssignment(node); - case 277 /* ExportDeclaration */: + case 278 /* ExportDeclaration */: return emitExportDeclaration(node); - case 278 /* NamedExports */: + case 279 /* NamedExports */: return emitNamedExports(node); - case 280 /* ExportSpecifier */: + case 281 /* ExportSpecifier */: return emitExportSpecifier(node); - case 299 /* AssertClause */: + case 300 /* AssertClause */: return emitAssertClause(node); - case 300 /* AssertEntry */: + case 301 /* AssertEntry */: return emitAssertEntry(node); - case 281 /* MissingDeclaration */: + case 282 /* MissingDeclaration */: return; - case 282 /* ExternalModuleReference */: + case 283 /* ExternalModuleReference */: return emitExternalModuleReference(node); case 12 /* JsxText */: return emitJsxText(node); - case 285 /* JsxOpeningElement */: - case 288 /* JsxOpeningFragment */: + case 286 /* JsxOpeningElement */: + case 289 /* JsxOpeningFragment */: return emitJsxOpeningElementOrFragment(node); - case 286 /* JsxClosingElement */: - case 289 /* JsxClosingFragment */: + case 287 /* JsxClosingElement */: + case 290 /* JsxClosingFragment */: return emitJsxClosingElementOrFragment(node); - case 290 /* JsxAttribute */: + case 291 /* JsxAttribute */: return emitJsxAttribute(node); - case 291 /* JsxAttributes */: + case 292 /* JsxAttributes */: return emitJsxAttributes(node); - case 292 /* JsxSpreadAttribute */: + case 293 /* JsxSpreadAttribute */: return emitJsxSpreadAttribute(node); - case 293 /* JsxExpression */: + case 294 /* JsxExpression */: return emitJsxExpression(node); - case 294 /* JsxNamespacedName */: + case 295 /* JsxNamespacedName */: return emitJsxNamespacedName(node); - case 295 /* CaseClause */: + case 296 /* CaseClause */: return emitCaseClause(node); - case 296 /* DefaultClause */: + case 297 /* DefaultClause */: return emitDefaultClause(node); - case 297 /* HeritageClause */: + case 298 /* HeritageClause */: return emitHeritageClause(node); - case 298 /* CatchClause */: + case 299 /* CatchClause */: return emitCatchClause(node); - case 302 /* PropertyAssignment */: + case 303 /* PropertyAssignment */: return emitPropertyAssignment(node); - case 303 /* ShorthandPropertyAssignment */: + case 304 /* ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 304 /* SpreadAssignment */: + case 305 /* SpreadAssignment */: return emitSpreadAssignment(node); - case 305 /* EnumMember */: + case 306 /* EnumMember */: return emitEnumMember(node); - case 306 /* UnparsedPrologue */: + case 307 /* UnparsedPrologue */: return writeUnparsedNode(node); - case 313 /* UnparsedSource */: - case 307 /* UnparsedPrepend */: + case 314 /* UnparsedSource */: + case 308 /* UnparsedPrepend */: return emitUnparsedSourceOrPrepend(node); - case 308 /* UnparsedText */: - case 309 /* UnparsedInternalText */: + case 309 /* UnparsedText */: + case 310 /* UnparsedInternalText */: return emitUnparsedTextLike(node); - case 310 /* UnparsedSyntheticReference */: + case 311 /* UnparsedSyntheticReference */: return emitUnparsedSyntheticReference(node); - case 311 /* SourceFile */: + case 312 /* SourceFile */: return emitSourceFile(node); - case 312 /* Bundle */: + case 313 /* Bundle */: return Debug.fail("Bundles should be printed using printBundle"); - case 314 /* InputFiles */: + case 315 /* InputFiles */: return Debug.fail("InputFiles should not be printed"); - case 315 /* JSDocTypeExpression */: + case 316 /* JSDocTypeExpression */: return emitJSDocTypeExpression(node); - case 316 /* JSDocNameReference */: + case 317 /* JSDocNameReference */: return emitJSDocNameReference(node); - case 318 /* JSDocAllType */: + case 319 /* JSDocAllType */: return writePunctuation("*"); - case 319 /* JSDocUnknownType */: + case 320 /* JSDocUnknownType */: return writePunctuation("?"); - case 320 /* JSDocNullableType */: + case 321 /* JSDocNullableType */: return emitJSDocNullableType(node); - case 321 /* JSDocNonNullableType */: + case 322 /* JSDocNonNullableType */: return emitJSDocNonNullableType(node); - case 322 /* JSDocOptionalType */: + case 323 /* JSDocOptionalType */: return emitJSDocOptionalType(node); - case 323 /* JSDocFunctionType */: + case 324 /* JSDocFunctionType */: return emitJSDocFunctionType(node); - case 190 /* RestType */: - case 324 /* JSDocVariadicType */: + case 191 /* RestType */: + case 325 /* JSDocVariadicType */: return emitRestOrJSDocVariadicType(node); - case 325 /* JSDocNamepathType */: + case 326 /* JSDocNamepathType */: return; - case 326 /* JSDoc */: + case 327 /* JSDoc */: return emitJSDoc(node); - case 328 /* JSDocTypeLiteral */: + case 329 /* JSDocTypeLiteral */: return emitJSDocTypeLiteral(node); - case 329 /* JSDocSignature */: + case 330 /* JSDocSignature */: return emitJSDocSignature(node); - case 333 /* JSDocTag */: - case 338 /* JSDocClassTag */: - case 343 /* JSDocOverrideTag */: + case 334 /* JSDocTag */: + case 339 /* JSDocClassTag */: + case 344 /* JSDocOverrideTag */: return emitJSDocSimpleTag(node); - case 334 /* JSDocAugmentsTag */: - case 335 /* JSDocImplementsTag */: + case 335 /* JSDocAugmentsTag */: + case 336 /* JSDocImplementsTag */: return emitJSDocHeritageTag(node); - case 336 /* JSDocAuthorTag */: - case 337 /* JSDocDeprecatedTag */: + case 337 /* JSDocAuthorTag */: + case 338 /* JSDocDeprecatedTag */: return; - case 339 /* JSDocPublicTag */: - case 340 /* JSDocPrivateTag */: - case 341 /* JSDocProtectedTag */: - case 342 /* JSDocReadonlyTag */: + case 340 /* JSDocPublicTag */: + case 341 /* JSDocPrivateTag */: + case 342 /* JSDocProtectedTag */: + case 343 /* JSDocReadonlyTag */: return; - case 344 /* JSDocCallbackTag */: + case 345 /* JSDocCallbackTag */: return emitJSDocCallbackTag(node); - case 345 /* JSDocOverloadTag */: + case 346 /* JSDocOverloadTag */: return emitJSDocOverloadTag(node); - case 347 /* JSDocParameterTag */: - case 354 /* JSDocPropertyTag */: + case 348 /* JSDocParameterTag */: + case 355 /* JSDocPropertyTag */: return emitJSDocPropertyLikeTag(node); - case 346 /* JSDocEnumTag */: - case 348 /* JSDocReturnTag */: - case 349 /* JSDocThisTag */: - case 350 /* JSDocTypeTag */: - case 355 /* JSDocThrowsTag */: - case 356 /* JSDocSatisfiesTag */: + case 347 /* JSDocEnumTag */: + case 349 /* JSDocReturnTag */: + case 350 /* JSDocThisTag */: + case 351 /* JSDocTypeTag */: + case 356 /* JSDocThrowsTag */: + case 357 /* JSDocSatisfiesTag */: return emitJSDocSimpleTypedTag(node); - case 351 /* JSDocTemplateTag */: + case 352 /* JSDocTemplateTag */: return emitJSDocTemplateTag(node); - case 352 /* JSDocTypedefTag */: + case 353 /* JSDocTypedefTag */: return emitJSDocTypedefTag(node); - case 353 /* JSDocSeeTag */: + case 354 /* JSDocSeeTag */: return emitJSDocSeeTag(node); - case 358 /* NotEmittedStatement */: + case 359 /* NotEmittedStatement */: return; } if (isExpression(node)) { @@ -111430,83 +113197,83 @@ ${lanes.join("\n")} return emitIdentifier(node); case 81 /* PrivateIdentifier */: return emitPrivateIdentifier(node); - case 208 /* ArrayLiteralExpression */: + case 209 /* ArrayLiteralExpression */: return emitArrayLiteralExpression(node); - case 209 /* ObjectLiteralExpression */: + case 210 /* ObjectLiteralExpression */: return emitObjectLiteralExpression(node); - case 210 /* PropertyAccessExpression */: + case 211 /* PropertyAccessExpression */: return emitPropertyAccessExpression(node); - case 211 /* ElementAccessExpression */: + case 212 /* ElementAccessExpression */: return emitElementAccessExpression(node); - case 212 /* CallExpression */: + case 213 /* CallExpression */: return emitCallExpression(node); - case 213 /* NewExpression */: + case 214 /* NewExpression */: return emitNewExpression(node); - case 214 /* TaggedTemplateExpression */: + case 215 /* TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 215 /* TypeAssertionExpression */: + case 216 /* TypeAssertionExpression */: return emitTypeAssertionExpression(node); - case 216 /* ParenthesizedExpression */: + case 217 /* ParenthesizedExpression */: return emitParenthesizedExpression(node); - case 217 /* FunctionExpression */: + case 218 /* FunctionExpression */: return emitFunctionExpression(node); - case 218 /* ArrowFunction */: + case 219 /* ArrowFunction */: return emitArrowFunction(node); - case 219 /* DeleteExpression */: + case 220 /* DeleteExpression */: return emitDeleteExpression(node); - case 220 /* TypeOfExpression */: + case 221 /* TypeOfExpression */: return emitTypeOfExpression(node); - case 221 /* VoidExpression */: + case 222 /* VoidExpression */: return emitVoidExpression(node); - case 222 /* AwaitExpression */: + case 223 /* AwaitExpression */: return emitAwaitExpression(node); - case 223 /* PrefixUnaryExpression */: + case 224 /* PrefixUnaryExpression */: return emitPrefixUnaryExpression(node); - case 224 /* PostfixUnaryExpression */: + case 225 /* PostfixUnaryExpression */: return emitPostfixUnaryExpression(node); - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: return emitBinaryExpression(node); - case 226 /* ConditionalExpression */: + case 227 /* ConditionalExpression */: return emitConditionalExpression(node); - case 227 /* TemplateExpression */: + case 228 /* TemplateExpression */: return emitTemplateExpression(node); - case 228 /* YieldExpression */: + case 229 /* YieldExpression */: return emitYieldExpression(node); - case 229 /* SpreadElement */: + case 230 /* SpreadElement */: return emitSpreadElement(node); - case 230 /* ClassExpression */: + case 231 /* ClassExpression */: return emitClassExpression(node); - case 231 /* OmittedExpression */: + case 232 /* OmittedExpression */: return; - case 233 /* AsExpression */: + case 234 /* AsExpression */: return emitAsExpression(node); - case 234 /* NonNullExpression */: + case 235 /* NonNullExpression */: return emitNonNullExpression(node); - case 232 /* ExpressionWithTypeArguments */: + case 233 /* ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 237 /* SatisfiesExpression */: + case 238 /* SatisfiesExpression */: return emitSatisfiesExpression(node); - case 235 /* MetaProperty */: + case 236 /* MetaProperty */: return emitMetaProperty(node); - case 236 /* SyntheticExpression */: + case 237 /* SyntheticExpression */: return Debug.fail("SyntheticExpression should never be printed."); - case 281 /* MissingDeclaration */: + case 282 /* MissingDeclaration */: return; - case 283 /* JsxElement */: + case 284 /* JsxElement */: return emitJsxElement(node); - case 284 /* JsxSelfClosingElement */: + case 285 /* JsxSelfClosingElement */: return emitJsxSelfClosingElement(node); - case 287 /* JsxFragment */: + case 288 /* JsxFragment */: return emitJsxFragment(node); - case 357 /* SyntaxList */: + case 358 /* SyntaxList */: return Debug.fail("SyntaxList should not be printed"); - case 358 /* NotEmittedStatement */: + case 359 /* NotEmittedStatement */: return; - case 359 /* PartiallyEmittedExpression */: + case 360 /* PartiallyEmittedExpression */: return emitPartiallyEmittedExpression(node); - case 360 /* CommaListExpression */: + case 361 /* CommaListExpression */: return emitCommaList(node); - case 361 /* SyntheticReferenceExpression */: + case 362 /* SyntheticReferenceExpression */: return Debug.fail("SyntheticReferenceExpression should not be printed"); } } @@ -111552,7 +113319,7 @@ ${lanes.join("\n")} } function emitHelpers(node) { let helpersEmitted = false; - const bundle = node.kind === 312 /* Bundle */ ? node : void 0; + const bundle = node.kind === 313 /* Bundle */ ? node : void 0; if (bundle && moduleKind === 0 /* None */) { return; } @@ -111627,7 +113394,7 @@ ${lanes.join("\n")} updateOrPushBundleFileTextLike( pos, writer.getTextPos(), - unparsed.kind === 308 /* UnparsedText */ ? "text" /* Text */ : "internal" /* Internal */ + unparsed.kind === 309 /* UnparsedText */ ? "text" /* Text */ : "internal" /* Internal */ ); } } @@ -111663,7 +113430,7 @@ ${lanes.join("\n")} } function emitTabStop(hint, node, snippet) { Debug.assert( - node.kind === 241 /* EmptyStatement */, + node.kind === 242 /* EmptyStatement */, `A tab stop cannot be attached to a node of kind ${Debug.formatSyntaxKind(node.kind)}.` ); Debug.assert( @@ -111735,7 +113502,7 @@ ${lanes.join("\n")} emit(node.dotDotDotToken); emitNodeWithWriter(node.name, writeParameter); emit(node.questionToken); - if (node.parent && node.parent.kind === 323 /* JSDocFunctionType */ && !node.name) { + if (node.parent && node.parent.kind === 324 /* JSDocFunctionType */ && !node.name) { emit(node.type); } else { emitTypeAnnotation(node.type); @@ -111811,7 +113578,7 @@ ${lanes.join("\n")} /*allowDecorators*/ true ); - const token = node.kind === 176 /* GetAccessor */ ? 139 /* GetKeyword */ : 153 /* SetKeyword */; + const token = node.kind === 177 /* GetAccessor */ ? 139 /* GetKeyword */ : 153 /* SetKeyword */; emitTokenWithComment(token, pos, writeKeyword, node); writeSpace(); emit(node.name); @@ -112165,7 +113932,7 @@ ${lanes.join("\n")} return !(expression.numericLiteralFlags & 448 /* WithSpecifier */) && !stringContains(text, tokenToString(25 /* DotToken */)) && !stringContains(text, String.fromCharCode(69 /* E */)) && !stringContains(text, String.fromCharCode(101 /* e */)); } else if (isAccessExpression(expression)) { const constantValue = getConstantValue(expression); - return typeof constantValue === "number" && isFinite(constantValue) && Math.floor(constantValue) === constantValue; + return typeof constantValue === "number" && isFinite(constantValue) && constantValue >= 0 && Math.floor(constantValue) === constantValue; } } function emitElementAccessExpression(node) { @@ -112276,7 +114043,7 @@ ${lanes.join("\n")} } function shouldEmitWhitespaceBeforeOperand(node) { const operand = node.operand; - return operand.kind === 223 /* PrefixUnaryExpression */ && (node.operator === 40 /* PlusToken */ && (operand.operator === 40 /* PlusToken */ || operand.operator === 46 /* PlusPlusToken */) || node.operator === 41 /* MinusToken */ && (operand.operator === 41 /* MinusToken */ || operand.operator === 47 /* MinusMinusToken */)); + return operand.kind === 224 /* PrefixUnaryExpression */ && (node.operator === 40 /* PlusToken */ && (operand.operator === 40 /* PlusToken */ || operand.operator === 46 /* PlusPlusToken */) || node.operator === 41 /* MinusToken */ && (operand.operator === 41 /* MinusToken */ || operand.operator === 47 /* MinusMinusToken */)); } function emitPostfixUnaryExpression(node) { emitExpression(node.operand, parenthesizer.parenthesizeOperandOfPostfixUnary); @@ -112535,7 +114302,7 @@ ${lanes.join("\n")} if (node.elseStatement) { writeLineOrSpace(node, node.thenStatement, node.elseStatement); emitTokenWithComment(93 /* ElseKeyword */, node.thenStatement.end, writeKeyword, node); - if (node.elseStatement.kind === 244 /* IfStatement */) { + if (node.elseStatement.kind === 245 /* IfStatement */) { writeSpace(); emit(node.elseStatement); } else { @@ -112602,7 +114369,7 @@ ${lanes.join("\n")} emitTokenWithComment(21 /* OpenParenToken */, openParenPos, writePunctuation, node); emitForBinding(node.initializer); writeSpace(); - emitTokenWithComment(164 /* OfKeyword */, node.initializer.end, writeKeyword, node); + emitTokenWithComment(165 /* OfKeyword */, node.initializer.end, writeKeyword, node); writeSpace(); emitExpression(node.expression); emitTokenWithComment(22 /* CloseParenToken */, node.expression.end, writePunctuation, node); @@ -112610,7 +114377,7 @@ ${lanes.join("\n")} } function emitForBinding(node) { if (node !== void 0) { - if (node.kind === 260 /* VariableDeclarationList */) { + if (node.kind === 261 /* VariableDeclarationList */) { emit(node); } else { emitExpression(node); @@ -112646,7 +114413,7 @@ ${lanes.join("\n")} } pos = writeTokenText(token, writer2, pos); if (isSimilarNode && contextNode.end !== pos) { - const isJsxExprContext = contextNode.kind === 293 /* JsxExpression */; + const isJsxExprContext = contextNode.kind === 294 /* JsxExpression */; emitTrailingCommentsOfPosition( pos, /*prefixSpace*/ @@ -112758,7 +114525,14 @@ ${lanes.join("\n")} emitInitializer(node.initializer, ((_a = node.type) == null ? void 0 : _a.end) ?? ((_c = (_b = node.name.emitNode) == null ? void 0 : _b.typeNode) == null ? void 0 : _c.end) ?? node.name.end, node, parenthesizer.parenthesizeExpressionForDisallowedComma); } function emitVariableDeclarationList(node) { - writeKeyword(isLet(node) ? "let" : isVarConst(node) ? "const" : "var"); + if (isVarAwaitUsing(node)) { + writeKeyword("await"); + writeSpace(); + writeKeyword("using"); + } else { + const head = isLet(node) ? "let" : isVarConst(node) ? "const" : isVarUsing(node) ? "using" : "var"; + writeKeyword(head); + } writeSpace(); emitList(node, node.declarations, 528 /* VariableDeclarationList */); } @@ -112967,8 +114741,8 @@ ${lanes.join("\n")} /*allowDecorators*/ false ); - if (~node.flags & 1024 /* GlobalAugmentation */) { - writeKeyword(node.flags & 16 /* Namespace */ ? "namespace" : "module"); + if (~node.flags & 2048 /* GlobalAugmentation */) { + writeKeyword(node.flags & 32 /* Namespace */ ? "namespace" : "module"); writeSpace(); } emit(node.name); @@ -113044,7 +114818,7 @@ ${lanes.join("\n")} if (node.importClause) { emit(node.importClause); writeSpace(); - emitTokenWithComment(160 /* FromKeyword */, node.importClause.end, writeKeyword, node); + emitTokenWithComment(161 /* FromKeyword */, node.importClause.end, writeKeyword, node); writeSpace(); } emitExpression(node.moduleSpecifier); @@ -113111,7 +114885,7 @@ ${lanes.join("\n")} if (node.moduleSpecifier) { writeSpace(); const fromPos = node.exportClause ? node.exportClause.end : nextPos; - emitTokenWithComment(160 /* FromKeyword */, fromPos, writeKeyword, node); + emitTokenWithComment(161 /* FromKeyword */, fromPos, writeKeyword, node); writeSpace(); emitExpression(node.moduleSpecifier); } @@ -113366,7 +115140,7 @@ ${lanes.join("\n")} } } if (node.tags) { - if (node.tags.length === 1 && node.tags[0].kind === 350 /* JSDocTypeTag */ && !node.comment) { + if (node.tags.length === 1 && node.tags[0].kind === 351 /* JSDocTypeTag */ && !node.comment) { writeSpace(); emit(node.tags[0]); } else { @@ -113410,7 +115184,7 @@ ${lanes.join("\n")} function emitJSDocTypedefTag(tag) { emitJSDocTagName(tag.tagName); if (tag.typeExpression) { - if (tag.typeExpression.kind === 315 /* JSDocTypeExpression */) { + if (tag.typeExpression.kind === 316 /* JSDocTypeExpression */) { emitJSDocTypeExpression(tag.typeExpression); } else { writeSpace(); @@ -113428,7 +115202,7 @@ ${lanes.join("\n")} emit(tag.fullName); } emitJSDocComment(tag.comment); - if (tag.typeExpression && tag.typeExpression.kind === 328 /* JSDocTypeLiteral */) { + if (tag.typeExpression && tag.typeExpression.kind === 329 /* JSDocTypeLiteral */) { emitJSDocTypeLiteral(tag.typeExpression); } } @@ -114311,7 +116085,7 @@ ${lanes.join("\n")} return block.statements.length === 0 && (!currentSourceFile || rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile)); } function skipSynthesizedParentheses(node) { - while (node.kind === 216 /* ParenthesizedExpression */ && nodeIsSynthesized(node)) { + while (node.kind === 217 /* ParenthesizedExpression */ && nodeIsSynthesized(node)) { node = node.expression; } return node; @@ -114398,84 +116172,84 @@ ${lanes.join("\n")} if (!node) return; switch (node.kind) { - case 240 /* Block */: + case 241 /* Block */: forEach(node.statements, generateNames); break; - case 255 /* LabeledStatement */: - case 253 /* WithStatement */: - case 245 /* DoStatement */: - case 246 /* WhileStatement */: + case 256 /* LabeledStatement */: + case 254 /* WithStatement */: + case 246 /* DoStatement */: + case 247 /* WhileStatement */: generateNames(node.statement); break; - case 244 /* IfStatement */: + case 245 /* IfStatement */: generateNames(node.thenStatement); generateNames(node.elseStatement); break; - case 247 /* ForStatement */: - case 249 /* ForOfStatement */: - case 248 /* ForInStatement */: + case 248 /* ForStatement */: + case 250 /* ForOfStatement */: + case 249 /* ForInStatement */: generateNames(node.initializer); generateNames(node.statement); break; - case 254 /* SwitchStatement */: + case 255 /* SwitchStatement */: generateNames(node.caseBlock); break; - case 268 /* CaseBlock */: + case 269 /* CaseBlock */: forEach(node.clauses, generateNames); break; - case 295 /* CaseClause */: - case 296 /* DefaultClause */: + case 296 /* CaseClause */: + case 297 /* DefaultClause */: forEach(node.statements, generateNames); break; - case 257 /* TryStatement */: + case 258 /* TryStatement */: generateNames(node.tryBlock); generateNames(node.catchClause); generateNames(node.finallyBlock); break; - case 298 /* CatchClause */: + case 299 /* CatchClause */: generateNames(node.variableDeclaration); generateNames(node.block); break; - case 242 /* VariableStatement */: + case 243 /* VariableStatement */: generateNames(node.declarationList); break; - case 260 /* VariableDeclarationList */: + case 261 /* VariableDeclarationList */: forEach(node.declarations, generateNames); break; - case 259 /* VariableDeclaration */: - case 168 /* Parameter */: - case 207 /* BindingElement */: - case 262 /* ClassDeclaration */: + case 260 /* VariableDeclaration */: + case 169 /* Parameter */: + case 208 /* BindingElement */: + case 263 /* ClassDeclaration */: generateNameIfNeeded(node.name); break; - case 261 /* FunctionDeclaration */: + case 262 /* FunctionDeclaration */: generateNameIfNeeded(node.name); if (getEmitFlags(node) & 1048576 /* ReuseTempVariableScope */) { forEach(node.parameters, generateNames); generateNames(node.body); } break; - case 205 /* ObjectBindingPattern */: - case 206 /* ArrayBindingPattern */: + case 206 /* ObjectBindingPattern */: + case 207 /* ArrayBindingPattern */: forEach(node.elements, generateNames); break; - case 271 /* ImportDeclaration */: + case 272 /* ImportDeclaration */: generateNames(node.importClause); break; - case 272 /* ImportClause */: + case 273 /* ImportClause */: generateNameIfNeeded(node.name); generateNames(node.namedBindings); break; - case 273 /* NamespaceImport */: + case 274 /* NamespaceImport */: generateNameIfNeeded(node.name); break; - case 279 /* NamespaceExport */: + case 280 /* NamespaceExport */: generateNameIfNeeded(node.name); break; - case 274 /* NamedImports */: + case 275 /* NamedImports */: forEach(node.elements, generateNames); break; - case 275 /* ImportSpecifier */: + case 276 /* ImportSpecifier */: generateNameIfNeeded(node.propertyName || node.name); break; } @@ -114484,12 +116258,12 @@ ${lanes.join("\n")} if (!node) return; switch (node.kind) { - case 302 /* PropertyAssignment */: - case 303 /* ShorthandPropertyAssignment */: - case 171 /* PropertyDeclaration */: - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 303 /* PropertyAssignment */: + case 304 /* ShorthandPropertyAssignment */: + case 172 /* PropertyDeclaration */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: generateNameIfNeeded(node.name); break; } @@ -114747,16 +116521,16 @@ ${lanes.join("\n")} prefix, suffix ); - case 266 /* ModuleDeclaration */: - case 265 /* EnumDeclaration */: + case 267 /* ModuleDeclaration */: + case 266 /* EnumDeclaration */: Debug.assert(!prefix && !suffix && !privateName); return generateNameForModuleOrEnum(node); - case 271 /* ImportDeclaration */: - case 277 /* ExportDeclaration */: + case 272 /* ImportDeclaration */: + case 278 /* ExportDeclaration */: Debug.assert(!prefix && !suffix && !privateName); return generateNameForImportOrExportDeclaration(node); - case 261 /* FunctionDeclaration */: - case 262 /* ClassDeclaration */: { + case 262 /* FunctionDeclaration */: + case 263 /* ClassDeclaration */: { Debug.assert(!prefix && !suffix && !privateName); const name = node.name; if (name && !isGeneratedIdentifier(name)) { @@ -114771,17 +116545,17 @@ ${lanes.join("\n")} } return generateNameForExportDefault(); } - case 276 /* ExportAssignment */: + case 277 /* ExportAssignment */: Debug.assert(!prefix && !suffix && !privateName); return generateNameForExportDefault(); - case 230 /* ClassExpression */: + case 231 /* ClassExpression */: Debug.assert(!prefix && !suffix && !privateName); return generateNameForClassExpression(); - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: return generateNameForMethodOrAccessor(node, privateName, prefix, suffix); - case 166 /* ComputedPropertyName */: + case 167 /* ComputedPropertyName */: return makeTempVariableName( 0 /* Auto */, /*reservedInNestedScopes*/ @@ -114875,7 +116649,7 @@ ${lanes.join("\n")} emitLeadingComments( pos, /*isEmittedNode*/ - node.kind !== 358 /* NotEmittedStatement */ + node.kind !== 359 /* NotEmittedStatement */ ); } if (!skipLeadingComments || pos >= 0 && (emitFlags & 1024 /* NoLeadingComments */) !== 0) { @@ -114883,7 +116657,7 @@ ${lanes.join("\n")} } if (!skipTrailingComments || end >= 0 && (emitFlags & 2048 /* NoTrailingComments */) !== 0) { containerEnd = end; - if (node.kind === 260 /* VariableDeclarationList */) { + if (node.kind === 261 /* VariableDeclarationList */) { declarationListContainerEnd = end; } } @@ -114899,7 +116673,7 @@ ${lanes.join("\n")} containerPos = savedContainerPos; containerEnd = savedContainerEnd; declarationListContainerEnd = savedDeclarationListContainerEnd; - if (!skipTrailingComments && node.kind !== 358 /* NotEmittedStatement */) { + if (!skipTrailingComments && node.kind !== 359 /* NotEmittedStatement */) { emitTrailingComments(end); } } @@ -115171,7 +116945,7 @@ ${lanes.join("\n")} } } else { const source = sourceMapRange.source || sourceMapSource; - if (node.kind !== 358 /* NotEmittedStatement */ && (emitFlags & 32 /* NoLeadingSourceMap */) === 0 && sourceMapRange.pos >= 0) { + if (node.kind !== 359 /* NotEmittedStatement */ && (emitFlags & 32 /* NoLeadingSourceMap */) === 0 && sourceMapRange.pos >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, skipSourceTrivia(source, sourceMapRange.pos)); } if (emitFlags & 128 /* NoNestedSourceMaps */) { @@ -115186,7 +116960,7 @@ ${lanes.join("\n")} if (emitFlags & 128 /* NoNestedSourceMaps */) { sourceMapsDisabled = false; } - if (node.kind !== 358 /* NotEmittedStatement */ && (emitFlags & 64 /* NoTrailingSourceMap */) === 0 && sourceMapRange.end >= 0) { + if (node.kind !== 359 /* NotEmittedStatement */ && (emitFlags & 64 /* NoTrailingSourceMap */) === 0 && sourceMapRange.end >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, sourceMapRange.end); } } @@ -115353,14 +117127,14 @@ ${lanes.join("\n")} }); // src/compiler/watchUtilities.ts - function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensitiveFileNames) { + function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensitiveFileNames2) { if (!host.getDirectories || !host.readDirectory) { return void 0; } const cachedReadDirectoryResult = /* @__PURE__ */ new Map(); - const getCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames); + const getCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames2); return { - useCaseSensitiveFileNames, + useCaseSensitiveFileNames: useCaseSensitiveFileNames2, fileExists, readFile: (path, encoding) => host.readFile(path, encoding), directoryExists: host.directoryExists && directoryExists, @@ -115482,7 +117256,7 @@ ${lanes.join("\n")} const rootResult = tryReadDirectory2(rootDir, rootDirPath); let rootSymLinkResult; if (rootResult !== void 0) { - return matchFiles(rootDir, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries, realpath); + return matchFiles(rootDir, extensions, excludes, includes, useCaseSensitiveFileNames2, currentDirectory, depth, getFileSystemEntries, realpath); } return host.readDirectory(rootDir, extensions, excludes, includes, depth); function getFileSystemEntries(dir) { @@ -115677,7 +117451,7 @@ ${lanes.join("\n")} program, extraFileExtensions, currentDirectory, - useCaseSensitiveFileNames, + useCaseSensitiveFileNames: useCaseSensitiveFileNames2, writeLog, toPath: toPath3 }) { @@ -115693,7 +117467,7 @@ ${lanes.join("\n")} writeLog(`Project: ${configFileName} Detected file add/remove of non supported extension: ${fileOrDirectory}`); return true; } - if (isExcludedFile(fileOrDirectory, options.configFile.configFileSpecs, getNormalizedAbsolutePath(getDirectoryPath(configFileName), currentDirectory), useCaseSensitiveFileNames, currentDirectory)) { + if (isExcludedFile(fileOrDirectory, options.configFile.configFileSpecs, getNormalizedAbsolutePath(getDirectoryPath(configFileName), currentDirectory), useCaseSensitiveFileNames2, currentDirectory)) { writeLog(`Project: ${configFileName} Detected excluded file: ${fileOrDirectory}`); return true; } @@ -115750,7 +117524,7 @@ ${lanes.join("\n")} function createExcludeHandlingAddWatch(key) { return (file, cb, flags, options, detailInfo1, detailInfo2) => { var _a; - return !matchesExclude(file, key === "watchFile" ? options == null ? void 0 : options.excludeFiles : options == null ? void 0 : options.excludeDirectories, useCaseSensitiveFileNames(), ((_a = host.getCurrentDirectory) == null ? void 0 : _a.call(host)) || "") ? factory2[key].call( + return !matchesExclude(file, key === "watchFile" ? options == null ? void 0 : options.excludeFiles : options == null ? void 0 : options.excludeDirectories, useCaseSensitiveFileNames2(), ((_a = host.getCurrentDirectory) == null ? void 0 : _a.call(host)) || "") ? factory2[key].call( /*thisArgs*/ void 0, file, @@ -115762,7 +117536,7 @@ ${lanes.join("\n")} ) : excludeWatcherFactory(file, flags, options, detailInfo1, detailInfo2); }; } - function useCaseSensitiveFileNames() { + function useCaseSensitiveFileNames2() { return typeof host.useCaseSensitiveFileNames === "boolean" ? host.useCaseSensitiveFileNames : host.useCaseSensitiveFileNames(); } function createExcludeWatcherWithLogging(file, flags, options, detailInfo1, detailInfo2) { @@ -117263,13 +119037,13 @@ ${lanes.join("\n")} sourceFileOptions, /*onError*/ void 0, - shouldCreateNewSourceFile || sourceFileOptions.impliedNodeFormat !== oldSourceFile.impliedNodeFormat + shouldCreateNewSourceFile ) : host.getSourceFile( oldSourceFile.fileName, sourceFileOptions, /*onError*/ void 0, - shouldCreateNewSourceFile || sourceFileOptions.impliedNodeFormat !== oldSourceFile.impliedNodeFormat + shouldCreateNewSourceFile ); if (!newSourceFile) { return 0 /* Not */; @@ -117320,7 +119094,7 @@ ${lanes.join("\n")} structureIsReused = 1 /* SafeModules */; } else if (!arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) { structureIsReused = 1 /* SafeModules */; - } else if ((oldSourceFile.flags & 6291456 /* PermanentlySetIncrementalFlags */) !== (newSourceFile.flags & 6291456 /* PermanentlySetIncrementalFlags */)) { + } else if ((oldSourceFile.flags & 12582912 /* PermanentlySetIncrementalFlags */) !== (newSourceFile.flags & 12582912 /* PermanentlySetIncrementalFlags */)) { structureIsReused = 1 /* SafeModules */; } else if (!arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) { structureIsReused = 1 /* SafeModules */; @@ -117711,89 +119485,97 @@ ${lanes.join("\n")} return diagnostics; function walk(node, parent2) { switch (parent2.kind) { - case 168 /* Parameter */: - case 171 /* PropertyDeclaration */: - case 173 /* MethodDeclaration */: + case 169 /* Parameter */: + case 172 /* PropertyDeclaration */: + case 174 /* MethodDeclaration */: if (parent2.questionToken === node) { diagnostics.push(createDiagnosticForNode2(node, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?")); return "skip"; } - case 172 /* MethodSignature */: - case 175 /* Constructor */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 217 /* FunctionExpression */: - case 261 /* FunctionDeclaration */: - case 218 /* ArrowFunction */: - case 259 /* VariableDeclaration */: + case 173 /* MethodSignature */: + case 176 /* Constructor */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 218 /* FunctionExpression */: + case 262 /* FunctionDeclaration */: + case 219 /* ArrowFunction */: + case 260 /* VariableDeclaration */: if (parent2.type === node) { diagnostics.push(createDiagnosticForNode2(node, Diagnostics.Type_annotations_can_only_be_used_in_TypeScript_files)); return "skip"; } } switch (node.kind) { - case 272 /* ImportClause */: + case 273 /* ImportClause */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode2(parent2, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "import type")); return "skip"; } break; - case 277 /* ExportDeclaration */: + case 278 /* ExportDeclaration */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode2(node, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "export type")); return "skip"; } break; - case 275 /* ImportSpecifier */: - case 280 /* ExportSpecifier */: + case 276 /* ImportSpecifier */: + case 281 /* ExportSpecifier */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode2(node, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, isImportSpecifier(node) ? "import...type" : "export...type")); return "skip"; } break; - case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportEqualsDeclaration */: diagnostics.push(createDiagnosticForNode2(node, Diagnostics.import_can_only_be_used_in_TypeScript_files)); return "skip"; - case 276 /* ExportAssignment */: + case 277 /* ExportAssignment */: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode2(node, Diagnostics.export_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 297 /* HeritageClause */: + case 298 /* HeritageClause */: const heritageClause = node; if (heritageClause.token === 119 /* ImplementsKeyword */) { diagnostics.push(createDiagnosticForNode2(node, Diagnostics.implements_clauses_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 263 /* InterfaceDeclaration */: + case 264 /* InterfaceDeclaration */: const interfaceKeyword = tokenToString(120 /* InterfaceKeyword */); Debug.assertIsDefined(interfaceKeyword); diagnostics.push(createDiagnosticForNode2(node, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, interfaceKeyword)); return "skip"; - case 266 /* ModuleDeclaration */: - const moduleKeyword = node.flags & 16 /* Namespace */ ? tokenToString(145 /* NamespaceKeyword */) : tokenToString(144 /* ModuleKeyword */); + case 267 /* ModuleDeclaration */: + const moduleKeyword = node.flags & 32 /* Namespace */ ? tokenToString(145 /* NamespaceKeyword */) : tokenToString(144 /* ModuleKeyword */); Debug.assertIsDefined(moduleKeyword); diagnostics.push(createDiagnosticForNode2(node, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, moduleKeyword)); return "skip"; - case 264 /* TypeAliasDeclaration */: + case 265 /* TypeAliasDeclaration */: diagnostics.push(createDiagnosticForNode2(node, Diagnostics.Type_aliases_can_only_be_used_in_TypeScript_files)); return "skip"; - case 265 /* EnumDeclaration */: + case 176 /* Constructor */: + case 174 /* MethodDeclaration */: + case 262 /* FunctionDeclaration */: + if (!node.body) { + diagnostics.push(createDiagnosticForNode2(node, Diagnostics.Signature_declarations_can_only_be_used_in_TypeScript_files)); + return "skip"; + } + return; + case 266 /* EnumDeclaration */: const enumKeyword = Debug.checkDefined(tokenToString(94 /* EnumKeyword */)); diagnostics.push(createDiagnosticForNode2(node, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, enumKeyword)); return "skip"; - case 234 /* NonNullExpression */: + case 235 /* NonNullExpression */: diagnostics.push(createDiagnosticForNode2(node, Diagnostics.Non_null_assertions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 233 /* AsExpression */: + case 234 /* AsExpression */: diagnostics.push(createDiagnosticForNode2(node.type, Diagnostics.Type_assertion_expressions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 237 /* SatisfiesExpression */: + case 238 /* SatisfiesExpression */: diagnostics.push(createDiagnosticForNode2(node.type, Diagnostics.Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 215 /* TypeAssertionExpression */: + case 216 /* TypeAssertionExpression */: Debug.fail(); } } @@ -117828,26 +119610,26 @@ ${lanes.join("\n")} } } switch (parent2.kind) { - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: - case 173 /* MethodDeclaration */: - case 175 /* Constructor */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 217 /* FunctionExpression */: - case 261 /* FunctionDeclaration */: - case 218 /* ArrowFunction */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: + case 174 /* MethodDeclaration */: + case 176 /* Constructor */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 218 /* FunctionExpression */: + case 262 /* FunctionDeclaration */: + case 219 /* ArrowFunction */: if (nodes === parent2.typeParameters) { diagnostics.push(createDiagnosticForNodeArray2(nodes, Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files)); return "skip"; } - case 242 /* VariableStatement */: + case 243 /* VariableStatement */: if (nodes === parent2.modifiers) { - checkModifiers(parent2.modifiers, parent2.kind === 242 /* VariableStatement */); + checkModifiers(parent2.modifiers, parent2.kind === 243 /* VariableStatement */); return "skip"; } break; - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: if (nodes === parent2.modifiers) { for (const modifier of nodes) { if (isModifier(modifier) && modifier.kind !== 126 /* StaticKeyword */ && modifier.kind !== 129 /* AccessorKeyword */) { @@ -117857,18 +119639,18 @@ ${lanes.join("\n")} return "skip"; } break; - case 168 /* Parameter */: + case 169 /* Parameter */: if (nodes === parent2.modifiers && some(nodes, isModifier)) { diagnostics.push(createDiagnosticForNodeArray2(nodes, Diagnostics.Parameter_modifiers_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 212 /* CallExpression */: - case 213 /* NewExpression */: - case 232 /* ExpressionWithTypeArguments */: - case 284 /* JsxSelfClosingElement */: - case 285 /* JsxOpeningElement */: - case 214 /* TaggedTemplateExpression */: + case 213 /* CallExpression */: + case 214 /* NewExpression */: + case 233 /* ExpressionWithTypeArguments */: + case 285 /* JsxSelfClosingElement */: + case 286 /* JsxOpeningElement */: + case 215 /* TaggedTemplateExpression */: if (nodes === parent2.typeArguments) { diagnostics.push(createDiagnosticForNodeArray2(nodes, Diagnostics.Type_arguments_can_only_be_used_in_TypeScript_files)); return "skip"; @@ -117889,7 +119671,7 @@ ${lanes.join("\n")} case 148 /* ReadonlyKeyword */: case 138 /* DeclareKeyword */: case 128 /* AbstractKeyword */: - case 163 /* OverrideKeyword */: + case 164 /* OverrideKeyword */: case 103 /* InKeyword */: case 147 /* OutKeyword */: diagnostics.push(createDiagnosticForNode2(modifier, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, tokenToString(modifier.kind))); @@ -117987,8 +119769,8 @@ ${lanes.join("\n")} addInternalEmitFlags(importDecl, 2 /* NeverApplyImportHelper */); setParent(externalHelpersModuleReference, importDecl); setParent(importDecl, file); - externalHelpersModuleReference.flags &= ~8 /* Synthesized */; - importDecl.flags &= ~8 /* Synthesized */; + externalHelpersModuleReference.flags &= ~16 /* Synthesized */; + importDecl.flags &= ~16 /* Synthesized */; return externalHelpersModuleReference; } function collectExternalModuleReferences(file) { @@ -118017,7 +119799,7 @@ ${lanes.join("\n")} ); } const shouldProcessRequires = isJavaScriptFile && shouldResolveJsRequire(options); - if (file.flags & 2097152 /* PossiblyContainsDynamicImport */ || shouldProcessRequires) { + if (file.flags & 4194304 /* PossiblyContainsDynamicImport */ || shouldProcessRequires) { collectDynamicImportOrRequireCalls(file); } file.imports = imports || emptyArray; @@ -118225,7 +120007,7 @@ ${lanes.join("\n")} return typeof result === "object" ? { ...result, languageVersion, setExternalModuleIndicator: setExternalModuleIndicator2 } : { languageVersion, impliedNodeFormat: result, setExternalModuleIndicator: setExternalModuleIndicator2 }; } function findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) { - var _a2, _b2; + var _a2; const path = toPath3(fileName); if (useSourceOfProjectReferenceRedirect) { let source = getSourceOfProjectReferenceRedirect(path); @@ -118304,7 +120086,7 @@ ${lanes.join("\n")} Diagnostics.Cannot_read_file_0_Colon_1, [fileName, hostErrorMessage] ), - shouldCreateNewSourceFile || ((_a2 = oldProgram == null ? void 0 : oldProgram.getSourceFileByPath(toPath3(fileName))) == null ? void 0 : _a2.impliedNodeFormat) !== sourceFileOptions.impliedNodeFormat + shouldCreateNewSourceFile ); if (packageId) { const packageIdKey = packageIdToString(packageId); @@ -118329,7 +120111,7 @@ ${lanes.join("\n")} file.path = path; file.resolvedPath = toPath3(fileName); file.originalFileName = originalFileName; - file.packageJsonLocations = ((_b2 = sourceFileOptions.packageJsonLocations) == null ? void 0 : _b2.length) ? sourceFileOptions.packageJsonLocations : void 0; + file.packageJsonLocations = ((_a2 = sourceFileOptions.packageJsonLocations) == null ? void 0 : _a2.length) ? sourceFileOptions.packageJsonLocations : void 0; file.packageJsonScope = sourceFileOptions.packageJsonScope; addFileIncludeReason(file, reason); if (host.useCaseSensitiveFileNames()) { @@ -118639,7 +120421,7 @@ ${lanes.join("\n")} currentNodeModulesDepth++; } const elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModuleJsDepth; - const shouldAddFile = resolvedFileName && !getResolutionDiagnostic(optionsForFile, resolution, file) && !optionsForFile.noResolve && index < file.imports.length && !elideImport && !(isJsFile && !getAllowJSCompilerOption(optionsForFile)) && (isInJSFile(file.imports[index]) || !(file.imports[index].flags & 8388608 /* JSDoc */)); + const shouldAddFile = resolvedFileName && !getResolutionDiagnostic(optionsForFile, resolution, file) && !optionsForFile.noResolve && index < file.imports.length && !elideImport && !(isJsFile && !getAllowJSCompilerOption(optionsForFile)) && (isInJSFile(file.imports[index]) || !(file.imports[index].flags & 16777216 /* JSDoc */)); if (elideImport) { modulesWithElidedImports.set(file.path, true); } else if (shouldAddFile) { @@ -118998,6 +120780,13 @@ ${lanes.join("\n")} if (moduleResolution === 100 /* Bundler */ && !emitModuleKindIsNonNodeESM(moduleKind)) { createOptionValueDiagnostic("moduleResolution", Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later, "bundler"); } + if (ModuleKind[moduleKind] && (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) && !(3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */)) { + const moduleKindName = ModuleKind[moduleKind]; + createOptionValueDiagnostic("moduleResolution", Diagnostics.Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1, moduleKindName, moduleKindName); + } else if (ModuleResolutionKind[moduleResolution] && (3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */) && !(100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */)) { + const moduleResolutionName = ModuleResolutionKind[moduleResolution]; + createOptionValueDiagnostic("module", Diagnostics.Option_module_must_be_set_to_0_when_option_moduleResolution_is_set_to_1, moduleResolutionName, moduleResolutionName); + } if (!options.noEmit && !options.suppressOutputPathCheck) { const emitHost = getEmitHost(); const emitFilesSeen = /* @__PURE__ */ new Set(); @@ -119687,6 +121476,9 @@ ${lanes.join("\n")} return directoryStructureHost.readDirectory(root, extensions, excludes, includes, depth); }, readFile: (f) => directoryStructureHost.readFile(f), + directoryExists: maybeBind(directoryStructureHost, directoryStructureHost.directoryExists), + getDirectories: maybeBind(directoryStructureHost, directoryStructureHost.getDirectories), + realpath: maybeBind(directoryStructureHost, directoryStructureHost.realpath), useCaseSensitiveFileNames: host.useCaseSensitiveFileNames(), getCurrentDirectory: () => host.getCurrentDirectory(), onUnRecoverableConfigFileDiagnostic: host.onUnRecoverableConfigFileDiagnostic || returnUndefined, @@ -119863,7 +121655,7 @@ ${lanes.join("\n")} Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern.code, Diagnostics.Duplicate_label_0.code, Diagnostics.Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments.code, - Diagnostics.For_await_loops_cannot_be_used_inside_a_class_static_block.code, + Diagnostics.for_await_loops_cannot_be_used_inside_a_class_static_block.code, Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression.code, Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name.code, Diagnostics.JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array.code, @@ -119893,14 +121685,17 @@ ${lanes.join("\n")} Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind.code, Diagnostics._0_modifier_cannot_be_used_here.code, Diagnostics._0_modifier_must_precede_1_modifier.code, - Diagnostics.const_declarations_can_only_be_declared_inside_a_block.code, - Diagnostics.const_declarations_must_be_initialized.code, + Diagnostics._0_declarations_can_only_be_declared_inside_a_block.code, + Diagnostics._0_declarations_must_be_initialized.code, Diagnostics.extends_clause_already_seen.code, - Diagnostics.let_declarations_can_only_be_declared_inside_a_block.code, Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code, Diagnostics.Class_constructor_may_not_be_a_generator.code, Diagnostics.Class_constructor_may_not_be_an_accessor.code, - Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code + Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code, + Diagnostics.await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code, + Diagnostics.Private_field_0_must_be_declared_in_an_enclosing_class.code, + // Type errors + Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value.code ]); emitSkippedWithNoDiagnostics = { diagnostics: emptyArray, sourceMaps: void 0, emittedFiles: void 0, emitSkipped: true }; } @@ -122736,17 +124531,17 @@ ${lanes.join("\n")} function getWatchErrorSummaryDiagnosticMessage(errorCount) { return errorCount === 1 ? Diagnostics.Found_1_error_Watching_for_file_changes : Diagnostics.Found_0_errors_Watching_for_file_changes; } - function prettyPathForFileError(error, cwd) { - const line = formatColorAndReset(":" + error.line, "\x1B[90m" /* Grey */); - if (pathIsAbsolute(error.fileName) && pathIsAbsolute(cwd)) { + function prettyPathForFileError(error2, cwd) { + const line = formatColorAndReset(":" + error2.line, "\x1B[90m" /* Grey */); + if (pathIsAbsolute(error2.fileName) && pathIsAbsolute(cwd)) { return getRelativePathFromDirectory( cwd, - error.fileName, + error2.fileName, /*ignoreCase*/ false ) + line; } - return error.fileName + line; + return error2.fileName + line; } function getErrorSummaryText(errorCount, filesInError, newLine, host) { if (errorCount === 0) @@ -122879,12 +124674,12 @@ ${lanes.join("\n")} return true; const isJsonFile = fileExtensionIs(fileName, ".json" /* Json */); const basePath = getDirectoryPath(getNormalizedAbsolutePath(configFile.fileName, program.getCurrentDirectory())); - const useCaseSensitiveFileNames = program.useCaseSensitiveFileNames(); + const useCaseSensitiveFileNames2 = program.useCaseSensitiveFileNames(); return find((_b = configFile == null ? void 0 : configFile.configFileSpecs) == null ? void 0 : _b.validatedIncludeSpecs, (includeSpec) => { if (isJsonFile && !endsWith(includeSpec, ".json" /* Json */)) return false; const pattern = getPatternFromSpec(includeSpec, basePath, "files"); - return !!pattern && getRegexFromPattern(`(${pattern})$`, useCaseSensitiveFileNames).test(fileName); + return !!pattern && getRegexFromPattern(`(${pattern})$`, useCaseSensitiveFileNames2).test(fileName); }); } function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) { @@ -123088,7 +124883,7 @@ ${lanes.join("\n")} return result; } function createCompilerHostFromProgramHost(host, getCompilerOptions, directoryStructureHost = host) { - const useCaseSensitiveFileNames = host.useCaseSensitiveFileNames(); + const useCaseSensitiveFileNames2 = host.useCaseSensitiveFileNames(); const compilerHost = { getSourceFile: createGetSourceFile( (fileName, encoding) => !encoding ? compilerHost.readFile(fileName) : host.readFile(fileName, encoding), @@ -123104,8 +124899,8 @@ ${lanes.join("\n")} (path) => host.directoryExists(path) ), getCurrentDirectory: memoize(() => host.getCurrentDirectory()), - useCaseSensitiveFileNames: () => useCaseSensitiveFileNames, - getCanonicalFileName: createGetCanonicalFileName(useCaseSensitiveFileNames), + useCaseSensitiveFileNames: () => useCaseSensitiveFileNames2, + getCanonicalFileName: createGetCanonicalFileName(useCaseSensitiveFileNames2), getNewLine: () => getNewLineCharacter(getCompilerOptions()), fileExists: (f) => host.fileExists(f), readFile: (f) => host.readFile(f), @@ -123386,7 +125181,7 @@ ${lanes.join("\n")} const sourceFilesCache = /* @__PURE__ */ new Map(); let missingFilePathsRequestedForRelease; let hasChangedCompilerOptions = false; - const useCaseSensitiveFileNames = host.useCaseSensitiveFileNames(); + const useCaseSensitiveFileNames2 = host.useCaseSensitiveFileNames(); const currentDirectory = host.getCurrentDirectory(); const { configFileName, optionsToExtend: optionsToExtendForConfigFile = {}, watchOptionsToExtend, extraFileExtensions, createProgram: createProgram2 } = host; let { rootFiles: rootFileNames, options: compilerOptions, watchOptions, projectReferences } = host; @@ -123394,7 +125189,7 @@ ${lanes.join("\n")} let configFileParsingDiagnostics; let canConfigFileJsonReportNoInputFiles = false; let hasChangedConfigFileParsingErrors = false; - const cachedDirectoryStructureHost = configFileName === void 0 ? void 0 : createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensitiveFileNames); + const cachedDirectoryStructureHost = configFileName === void 0 ? void 0 : createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensitiveFileNames2); const directoryStructureHost = cachedDirectoryStructureHost || host; const parseConfigFileHost = parseConfigHostFromCompilerHostLike(host, directoryStructureHost); let newLine = updateNewLine(); @@ -123412,8 +125207,8 @@ ${lanes.join("\n")} Debug.assert(compilerOptions); Debug.assert(rootFileNames); const { watchFile: watchFile2, watchDirectory, writeLog } = createWatchFactory(host, compilerOptions); - const getCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames); - writeLog(`Current directory: ${currentDirectory} CaseSensitiveFileNames: ${useCaseSensitiveFileNames}`); + const getCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames2); + writeLog(`Current directory: ${currentDirectory} CaseSensitiveFileNames: ${useCaseSensitiveFileNames2}`); let configFileWatcher; if (configFileName) { configFileWatcher = watchFile2(configFileName, scheduleProgramReload, 2e3 /* High */, watchOptions, WatchType.ConfigFile); @@ -123522,7 +125317,6 @@ ${lanes.join("\n")} if (hasChangedCompilerOptions) { newLine = updateNewLine(); if (program && changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions)) { - debugger; resolutionCache.onChangesAffectModuleResolution(); } } @@ -123627,7 +125421,8 @@ ${lanes.join("\n")} if (isFileMissingOnHost(hostSourceFile)) { return void 0; } - if (hostSourceFile === void 0 || shouldCreateNewSourceFile || isFilePresenceUnknownOnHost(hostSourceFile)) { + const impliedNodeFormat = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions.impliedNodeFormat : void 0; + if (hostSourceFile === void 0 || shouldCreateNewSourceFile || isFilePresenceUnknownOnHost(hostSourceFile) || hostSourceFile.sourceFile.impliedNodeFormat !== impliedNodeFormat) { const sourceFile = getNewSourceFile(fileName, languageVersionOrOptions, onError); if (hostSourceFile) { if (sourceFile) { @@ -123918,7 +125713,7 @@ ${lanes.join("\n")} options: compilerOptions, program: getCurrentBuilderProgram() || rootFileNames, currentDirectory, - useCaseSensitiveFileNames, + useCaseSensitiveFileNames: useCaseSensitiveFileNames2, writeLog, toPath: toPath3 })) @@ -124008,7 +125803,7 @@ ${lanes.join("\n")} options: config.parsedCommandLine.options, program: config.parsedCommandLine.fileNames, currentDirectory, - useCaseSensitiveFileNames, + useCaseSensitiveFileNames: useCaseSensitiveFileNames2, writeLog, toPath: toPath3 })) @@ -126128,6 +127923,8 @@ ${lanes.join("\n")} init_sourcemap(); init_utilities3(); init_destructuring(); + init_classThis(); + init_namedEvaluation(); init_taggedTemplate(); init_ts(); init_classFields(); @@ -126784,6 +128581,8 @@ ${lanes.join("\n")} ScriptElementKind2["enumMemberElement"] = "enum member"; ScriptElementKind2["variableElement"] = "var"; ScriptElementKind2["localVariableElement"] = "local var"; + ScriptElementKind2["variableUsingElement"] = "using"; + ScriptElementKind2["variableAwaitUsingElement"] = "await using"; ScriptElementKind2["functionElement"] = "function"; ScriptElementKind2["localFunctionElement"] = "local function"; ScriptElementKind2["memberFunctionElement"] = "method"; @@ -126897,36 +128696,36 @@ ${lanes.join("\n")} // src/services/utilities.ts function getMeaningFromDeclaration(node) { switch (node.kind) { - case 259 /* VariableDeclaration */: + case 260 /* VariableDeclaration */: return isInJSFile(node) && getJSDocEnumTag(node) ? 7 /* All */ : 1 /* Value */; - case 168 /* Parameter */: - case 207 /* BindingElement */: - case 171 /* PropertyDeclaration */: - case 170 /* PropertySignature */: - case 302 /* PropertyAssignment */: - case 303 /* ShorthandPropertyAssignment */: - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: - case 175 /* Constructor */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: - case 298 /* CatchClause */: - case 290 /* JsxAttribute */: + case 169 /* Parameter */: + case 208 /* BindingElement */: + case 172 /* PropertyDeclaration */: + case 171 /* PropertySignature */: + case 303 /* PropertyAssignment */: + case 304 /* ShorthandPropertyAssignment */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: + case 176 /* Constructor */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: + case 299 /* CatchClause */: + case 291 /* JsxAttribute */: return 1 /* Value */; - case 167 /* TypeParameter */: - case 263 /* InterfaceDeclaration */: - case 264 /* TypeAliasDeclaration */: - case 186 /* TypeLiteral */: + case 168 /* TypeParameter */: + case 264 /* InterfaceDeclaration */: + case 265 /* TypeAliasDeclaration */: + case 187 /* TypeLiteral */: return 2 /* Type */; - case 352 /* JSDocTypedefTag */: + case 353 /* JSDocTypedefTag */: return node.name === void 0 ? 1 /* Value */ | 2 /* Type */ : 2 /* Type */; - case 305 /* EnumMember */: - case 262 /* ClassDeclaration */: + case 306 /* EnumMember */: + case 263 /* ClassDeclaration */: return 1 /* Value */ | 2 /* Type */; - case 266 /* ModuleDeclaration */: + case 267 /* ModuleDeclaration */: if (isAmbientModule(node)) { return 4 /* Namespace */ | 1 /* Value */; } else if (getModuleInstanceState(node) === 1 /* Instantiated */) { @@ -126934,15 +128733,15 @@ ${lanes.join("\n")} } else { return 4 /* Namespace */; } - case 265 /* EnumDeclaration */: - case 274 /* NamedImports */: - case 275 /* ImportSpecifier */: - case 270 /* ImportEqualsDeclaration */: - case 271 /* ImportDeclaration */: - case 276 /* ExportAssignment */: - case 277 /* ExportDeclaration */: + case 266 /* EnumDeclaration */: + case 275 /* NamedImports */: + case 276 /* ImportSpecifier */: + case 271 /* ImportEqualsDeclaration */: + case 272 /* ImportDeclaration */: + case 277 /* ExportAssignment */: + case 278 /* ExportDeclaration */: return 7 /* All */; - case 311 /* SourceFile */: + case 312 /* SourceFile */: return 4 /* Namespace */ | 1 /* Value */; } return 7 /* All */; @@ -126950,7 +128749,7 @@ ${lanes.join("\n")} function getMeaningFromLocation(node) { node = getAdjustedReferenceLocation(node); const parent2 = node.parent; - if (node.kind === 311 /* SourceFile */) { + if (node.kind === 312 /* SourceFile */) { return 1 /* Value */; } else if (isExportAssignment(parent2) || isExportSpecifier(parent2) || isExternalModuleReference(parent2) || isImportSpecifier(parent2) || isImportClause(parent2) || isImportEqualsDeclaration(parent2) && node === parent2.name) { return 7 /* All */; @@ -126974,11 +128773,11 @@ ${lanes.join("\n")} } } function getMeaningFromRightHandSideOfImportEquals(node) { - const name = node.kind === 165 /* QualifiedName */ ? node : isQualifiedName(node.parent) && node.parent.right === node ? node.parent : void 0; - return name && name.parent.kind === 270 /* ImportEqualsDeclaration */ ? 7 /* All */ : 4 /* Namespace */; + const name = node.kind === 166 /* QualifiedName */ ? node : isQualifiedName(node.parent) && node.parent.right === node ? node.parent : void 0; + return name && name.parent.kind === 271 /* ImportEqualsDeclaration */ ? 7 /* All */ : 4 /* Namespace */; } function isInRightSideOfInternalImportEqualsDeclaration(node) { - while (node.parent.kind === 165 /* QualifiedName */) { + while (node.parent.kind === 166 /* QualifiedName */) { node = node.parent; } return isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; @@ -126989,26 +128788,26 @@ ${lanes.join("\n")} function isQualifiedNameNamespaceReference(node) { let root = node; let isLastClause = true; - if (root.parent.kind === 165 /* QualifiedName */) { - while (root.parent && root.parent.kind === 165 /* QualifiedName */) { + if (root.parent.kind === 166 /* QualifiedName */) { + while (root.parent && root.parent.kind === 166 /* QualifiedName */) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 182 /* TypeReference */ && !isLastClause; + return root.parent.kind === 183 /* TypeReference */ && !isLastClause; } function isPropertyAccessNamespaceReference(node) { let root = node; let isLastClause = true; - if (root.parent.kind === 210 /* PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 210 /* PropertyAccessExpression */) { + if (root.parent.kind === 211 /* PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 211 /* PropertyAccessExpression */) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 232 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 297 /* HeritageClause */) { + if (!isLastClause && root.parent.kind === 233 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 298 /* HeritageClause */) { const decl = root.parent.parent.parent; - return decl.kind === 262 /* ClassDeclaration */ && root.parent.parent.token === 119 /* ImplementsKeyword */ || decl.kind === 263 /* InterfaceDeclaration */ && root.parent.parent.token === 96 /* ExtendsKeyword */; + return decl.kind === 263 /* ClassDeclaration */ && root.parent.parent.token === 119 /* ImplementsKeyword */ || decl.kind === 264 /* InterfaceDeclaration */ && root.parent.parent.token === 96 /* ExtendsKeyword */; } return false; } @@ -127019,15 +128818,15 @@ ${lanes.join("\n")} switch (node.kind) { case 110 /* ThisKeyword */: return !isExpressionNode(node); - case 196 /* ThisType */: + case 197 /* ThisType */: return true; } switch (node.parent.kind) { - case 182 /* TypeReference */: + case 183 /* TypeReference */: return true; - case 204 /* ImportType */: + case 205 /* ImportType */: return !node.parent.isTypeOf; - case 232 /* ExpressionWithTypeArguments */: + case 233 /* ExpressionWithTypeArguments */: return isPartOfTypeNode(node.parent); } return false; @@ -127074,7 +128873,7 @@ ${lanes.join("\n")} } function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 255 /* LabeledStatement */ && referenceNode.label.escapedText === labelName) { + if (referenceNode.kind === 256 /* LabeledStatement */ && referenceNode.label.escapedText === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -127124,22 +128923,22 @@ ${lanes.join("\n")} } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { switch (node.parent.kind) { - case 171 /* PropertyDeclaration */: - case 170 /* PropertySignature */: - case 302 /* PropertyAssignment */: - case 305 /* EnumMember */: - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 266 /* ModuleDeclaration */: + case 172 /* PropertyDeclaration */: + case 171 /* PropertySignature */: + case 303 /* PropertyAssignment */: + case 306 /* EnumMember */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 267 /* ModuleDeclaration */: return getNameOfDeclaration(node.parent) === node; - case 211 /* ElementAccessExpression */: + case 212 /* ElementAccessExpression */: return node.parent.argumentExpression === node; - case 166 /* ComputedPropertyName */: + case 167 /* ComputedPropertyName */: return true; - case 200 /* LiteralType */: - return node.parent.parent.kind === 198 /* IndexedAccessType */; + case 201 /* LiteralType */: + return node.parent.parent.kind === 199 /* IndexedAccessType */; default: return false; } @@ -127157,83 +128956,83 @@ ${lanes.join("\n")} return void 0; } switch (node.kind) { - case 311 /* SourceFile */: - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 262 /* ClassDeclaration */: - case 263 /* InterfaceDeclaration */: - case 265 /* EnumDeclaration */: - case 266 /* ModuleDeclaration */: + case 312 /* SourceFile */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 263 /* ClassDeclaration */: + case 264 /* InterfaceDeclaration */: + case 266 /* EnumDeclaration */: + case 267 /* ModuleDeclaration */: return node; } } } function getNodeKind(node) { switch (node.kind) { - case 311 /* SourceFile */: + case 312 /* SourceFile */: return isExternalModule(node) ? "module" /* moduleElement */ : "script" /* scriptElement */; - case 266 /* ModuleDeclaration */: + case 267 /* ModuleDeclaration */: return "module" /* moduleElement */; - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: return "class" /* classElement */; - case 263 /* InterfaceDeclaration */: + case 264 /* InterfaceDeclaration */: return "interface" /* interfaceElement */; - case 264 /* TypeAliasDeclaration */: - case 344 /* JSDocCallbackTag */: - case 352 /* JSDocTypedefTag */: + case 265 /* TypeAliasDeclaration */: + case 345 /* JSDocCallbackTag */: + case 353 /* JSDocTypedefTag */: return "type" /* typeElement */; - case 265 /* EnumDeclaration */: + case 266 /* EnumDeclaration */: return "enum" /* enumElement */; - case 259 /* VariableDeclaration */: + case 260 /* VariableDeclaration */: return getKindOfVariableDeclaration(node); - case 207 /* BindingElement */: + case 208 /* BindingElement */: return getKindOfVariableDeclaration(getRootDeclaration(node)); - case 218 /* ArrowFunction */: - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: + case 219 /* ArrowFunction */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: return "function" /* functionElement */; - case 176 /* GetAccessor */: + case 177 /* GetAccessor */: return "getter" /* memberGetAccessorElement */; - case 177 /* SetAccessor */: + case 178 /* SetAccessor */: return "setter" /* memberSetAccessorElement */; - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: return "method" /* memberFunctionElement */; - case 302 /* PropertyAssignment */: + case 303 /* PropertyAssignment */: const { initializer } = node; return isFunctionLike(initializer) ? "method" /* memberFunctionElement */ : "property" /* memberVariableElement */; - case 171 /* PropertyDeclaration */: - case 170 /* PropertySignature */: - case 303 /* ShorthandPropertyAssignment */: - case 304 /* SpreadAssignment */: + case 172 /* PropertyDeclaration */: + case 171 /* PropertySignature */: + case 304 /* ShorthandPropertyAssignment */: + case 305 /* SpreadAssignment */: return "property" /* memberVariableElement */; - case 180 /* IndexSignature */: + case 181 /* IndexSignature */: return "index" /* indexSignatureElement */; - case 179 /* ConstructSignature */: + case 180 /* ConstructSignature */: return "construct" /* constructSignatureElement */; - case 178 /* CallSignature */: + case 179 /* CallSignature */: return "call" /* callSignatureElement */; - case 175 /* Constructor */: - case 174 /* ClassStaticBlockDeclaration */: + case 176 /* Constructor */: + case 175 /* ClassStaticBlockDeclaration */: return "constructor" /* constructorImplementationElement */; - case 167 /* TypeParameter */: + case 168 /* TypeParameter */: return "type parameter" /* typeParameterElement */; - case 305 /* EnumMember */: + case 306 /* EnumMember */: return "enum member" /* enumMemberElement */; - case 168 /* Parameter */: + case 169 /* Parameter */: return hasSyntacticModifier(node, 16476 /* ParameterPropertyModifier */) ? "property" /* memberVariableElement */ : "parameter" /* parameterElement */; - case 270 /* ImportEqualsDeclaration */: - case 275 /* ImportSpecifier */: - case 280 /* ExportSpecifier */: - case 273 /* NamespaceImport */: - case 279 /* NamespaceExport */: + case 271 /* ImportEqualsDeclaration */: + case 276 /* ImportSpecifier */: + case 281 /* ExportSpecifier */: + case 274 /* NamespaceImport */: + case 280 /* NamespaceExport */: return "alias" /* alias */; - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: const kind = getAssignmentDeclarationKind(node); const { right } = node; switch (kind) { @@ -127261,7 +129060,7 @@ ${lanes.join("\n")} } case 80 /* Identifier */: return isImportClause(node.parent) ? "alias" /* alias */ : "" /* unknown */; - case 276 /* ExportAssignment */: + case 277 /* ExportAssignment */: const scriptKind = getNodeKind(node.expression); return scriptKind === "" /* unknown */ ? "const" /* constElement */ : scriptKind; default: @@ -127276,7 +129075,7 @@ ${lanes.join("\n")} case 110 /* ThisKeyword */: return true; case 80 /* Identifier */: - return identifierIsThisKeyword(node) && node.parent.kind === 168 /* Parameter */; + return identifierIsThisKeyword(node) && node.parent.kind === 169 /* Parameter */; default: return false; } @@ -127324,41 +129123,41 @@ ${lanes.join("\n")} return false; } switch (n.kind) { - case 262 /* ClassDeclaration */: - case 263 /* InterfaceDeclaration */: - case 265 /* EnumDeclaration */: - case 209 /* ObjectLiteralExpression */: - case 205 /* ObjectBindingPattern */: - case 186 /* TypeLiteral */: - case 240 /* Block */: - case 267 /* ModuleBlock */: - case 268 /* CaseBlock */: - case 274 /* NamedImports */: - case 278 /* NamedExports */: + case 263 /* ClassDeclaration */: + case 264 /* InterfaceDeclaration */: + case 266 /* EnumDeclaration */: + case 210 /* ObjectLiteralExpression */: + case 206 /* ObjectBindingPattern */: + case 187 /* TypeLiteral */: + case 241 /* Block */: + case 268 /* ModuleBlock */: + case 269 /* CaseBlock */: + case 275 /* NamedImports */: + case 279 /* NamedExports */: return nodeEndsWith(n, 20 /* CloseBraceToken */, sourceFile); - case 298 /* CatchClause */: + case 299 /* CatchClause */: return isCompletedNode(n.block, sourceFile); - case 213 /* NewExpression */: + case 214 /* NewExpression */: if (!n.arguments) { return true; } - case 212 /* CallExpression */: - case 216 /* ParenthesizedExpression */: - case 195 /* ParenthesizedType */: + case 213 /* CallExpression */: + case 217 /* ParenthesizedExpression */: + case 196 /* ParenthesizedType */: return nodeEndsWith(n, 22 /* CloseParenToken */, sourceFile); - case 183 /* FunctionType */: - case 184 /* ConstructorType */: + case 184 /* FunctionType */: + case 185 /* ConstructorType */: return isCompletedNode(n.type, sourceFile); - case 175 /* Constructor */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: - case 179 /* ConstructSignature */: - case 178 /* CallSignature */: - case 218 /* ArrowFunction */: + case 176 /* Constructor */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: + case 180 /* ConstructSignature */: + case 179 /* CallSignature */: + case 219 /* ArrowFunction */: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -127366,60 +129165,60 @@ ${lanes.join("\n")} return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 22 /* CloseParenToken */, sourceFile); - case 266 /* ModuleDeclaration */: + case 267 /* ModuleDeclaration */: return !!n.body && isCompletedNode(n.body, sourceFile); - case 244 /* IfStatement */: + case 245 /* IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 243 /* ExpressionStatement */: + case 244 /* ExpressionStatement */: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 27 /* SemicolonToken */, sourceFile); - case 208 /* ArrayLiteralExpression */: - case 206 /* ArrayBindingPattern */: - case 211 /* ElementAccessExpression */: - case 166 /* ComputedPropertyName */: - case 188 /* TupleType */: + case 209 /* ArrayLiteralExpression */: + case 207 /* ArrayBindingPattern */: + case 212 /* ElementAccessExpression */: + case 167 /* ComputedPropertyName */: + case 189 /* TupleType */: return nodeEndsWith(n, 24 /* CloseBracketToken */, sourceFile); - case 180 /* IndexSignature */: + case 181 /* IndexSignature */: if (n.type) { return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 24 /* CloseBracketToken */, sourceFile); - case 295 /* CaseClause */: - case 296 /* DefaultClause */: + case 296 /* CaseClause */: + case 297 /* DefaultClause */: return false; - case 247 /* ForStatement */: - case 248 /* ForInStatement */: - case 249 /* ForOfStatement */: - case 246 /* WhileStatement */: + case 248 /* ForStatement */: + case 249 /* ForInStatement */: + case 250 /* ForOfStatement */: + case 247 /* WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 245 /* DoStatement */: + case 246 /* DoStatement */: return hasChildOfKind(n, 117 /* WhileKeyword */, sourceFile) ? nodeEndsWith(n, 22 /* CloseParenToken */, sourceFile) : isCompletedNode(n.statement, sourceFile); - case 185 /* TypeQuery */: + case 186 /* TypeQuery */: return isCompletedNode(n.exprName, sourceFile); - case 220 /* TypeOfExpression */: - case 219 /* DeleteExpression */: - case 221 /* VoidExpression */: - case 228 /* YieldExpression */: - case 229 /* SpreadElement */: + case 221 /* TypeOfExpression */: + case 220 /* DeleteExpression */: + case 222 /* VoidExpression */: + case 229 /* YieldExpression */: + case 230 /* SpreadElement */: const unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 214 /* TaggedTemplateExpression */: + case 215 /* TaggedTemplateExpression */: return isCompletedNode(n.template, sourceFile); - case 227 /* TemplateExpression */: + case 228 /* TemplateExpression */: const lastSpan = lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 238 /* TemplateSpan */: + case 239 /* TemplateSpan */: return nodeIsPresent(n.literal); - case 277 /* ExportDeclaration */: - case 271 /* ImportDeclaration */: + case 278 /* ExportDeclaration */: + case 272 /* ImportDeclaration */: return nodeIsPresent(n.moduleSpecifier); - case 223 /* PrefixUnaryExpression */: + case 224 /* PrefixUnaryExpression */: return isCompletedNode(n.operand, sourceFile); - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: return isCompletedNode(n.right, sourceFile); - case 226 /* ConditionalExpression */: + case 227 /* ConditionalExpression */: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -127510,7 +129309,7 @@ ${lanes.join("\n")} return lastTypeNode; } function getContextualTypeFromParentOrAncestorTypeNode(node, checker) { - if (node.flags & (8388608 /* JSDoc */ & ~262144 /* JavaScriptFile */)) + if (node.flags & (16777216 /* JSDoc */ & ~524288 /* JavaScriptFile */)) return void 0; const contextualType = getContextualTypeFromParent(node, checker); if (contextualType) @@ -127521,13 +129320,13 @@ ${lanes.join("\n")} function getAdjustedLocationForDeclaration(node, forRename) { if (!forRename) { switch (node.kind) { - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: return getAdjustedLocationForClass(node); - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: return getAdjustedLocationForFunction(node); - case 175 /* Constructor */: + case 176 /* Constructor */: return node; } } @@ -127636,7 +129435,7 @@ ${lanes.join("\n")} if (node.kind === 149 /* RequireKeyword */ && isExternalModuleReference(parent2)) { return parent2.expression; } - if (node.kind === 160 /* FromKeyword */ && (isImportDeclaration(parent2) || isExportDeclaration(parent2)) && parent2.moduleSpecifier) { + if (node.kind === 161 /* FromKeyword */ && (isImportDeclaration(parent2) || isExportDeclaration(parent2)) && parent2.moduleSpecifier) { return parent2.moduleSpecifier; } if ((node.kind === 96 /* ExtendsKeyword */ || node.kind === 119 /* ImplementsKeyword */) && isHeritageClause(parent2) && parent2.token === node.kind) { @@ -127677,7 +129476,7 @@ ${lanes.join("\n")} if (node.kind === 130 /* AsKeyword */ && isAsExpression(parent2) && isTypeReferenceNode(parent2.type)) { return parent2.type.typeName; } - if (node.kind === 103 /* InKeyword */ && isForInStatement(parent2) || node.kind === 164 /* OfKeyword */ && isForOfStatement(parent2)) { + if (node.kind === 103 /* InKeyword */ && isForInStatement(parent2) || node.kind === 165 /* OfKeyword */ && isForOfStatement(parent2)) { return skipOuterExpressions(parent2.expression); } } @@ -127870,7 +129669,7 @@ ${lanes.join("\n")} } } } - Debug.assert(startNode2 !== void 0 || n.kind === 311 /* SourceFile */ || n.kind === 1 /* EndOfFileToken */ || isJSDocCommentContainingNode(n)); + Debug.assert(startNode2 !== void 0 || n.kind === 312 /* SourceFile */ || n.kind === 1 /* EndOfFileToken */ || isJSDocCommentContainingNode(n)); const candidate = findRightmostChildNodeWithTokens( children, /*exclusiveStartPosition*/ @@ -127905,7 +129704,7 @@ ${lanes.join("\n")} for (let i = exclusiveStartPosition - 1; i >= 0; i--) { const child = children[i]; if (isWhiteSpaceOnlyJsxText(child)) { - if (i === 0 && (parentKind === 12 /* JsxText */ || parentKind === 284 /* JsxSelfClosingElement */)) { + if (i === 0 && (parentKind === 12 /* JsxText */ || parentKind === 285 /* JsxSelfClosingElement */)) { Debug.fail("`JsxText` tokens should not be the first child of `JsxElement | JsxSelfClosingElement`"); } } else if (nodeHasTokens(children[i], sourceFile)) { @@ -127937,13 +129736,13 @@ ${lanes.join("\n")} if (token.kind === 30 /* LessThanToken */ && token.parent.kind === 12 /* JsxText */) { return true; } - if (token.kind === 30 /* LessThanToken */ && token.parent.kind === 293 /* JsxExpression */) { + if (token.kind === 30 /* LessThanToken */ && token.parent.kind === 294 /* JsxExpression */) { return true; } - if (token && token.kind === 20 /* CloseBraceToken */ && token.parent.kind === 293 /* JsxExpression */) { + if (token && token.kind === 20 /* CloseBraceToken */ && token.parent.kind === 294 /* JsxExpression */) { return true; } - if (token.kind === 30 /* LessThanToken */ && token.parent.kind === 286 /* JsxClosingElement */) { + if (token.kind === 30 /* LessThanToken */ && token.parent.kind === 287 /* JsxClosingElement */) { return true; } return false; @@ -127971,9 +129770,9 @@ ${lanes.join("\n")} function isInsideJsxElement(sourceFile, position) { function isInsideJsxElementTraversal(node) { while (node) { - if (node.kind >= 284 /* JsxSelfClosingElement */ && node.kind <= 293 /* JsxExpression */ || node.kind === 12 /* JsxText */ || node.kind === 30 /* LessThanToken */ || node.kind === 32 /* GreaterThanToken */ || node.kind === 80 /* Identifier */ || node.kind === 20 /* CloseBraceToken */ || node.kind === 19 /* OpenBraceToken */ || node.kind === 44 /* SlashToken */) { + if (node.kind >= 285 /* JsxSelfClosingElement */ && node.kind <= 294 /* JsxExpression */ || node.kind === 12 /* JsxText */ || node.kind === 30 /* LessThanToken */ || node.kind === 32 /* GreaterThanToken */ || node.kind === 80 /* Identifier */ || node.kind === 20 /* CloseBraceToken */ || node.kind === 19 /* OpenBraceToken */ || node.kind === 44 /* SlashToken */) { node = node.parent; - } else if (node.kind === 283 /* JsxElement */) { + } else if (node.kind === 284 /* JsxElement */) { if (position > node.getStart(sourceFile)) return true; node = node.parent; @@ -128143,17 +129942,17 @@ ${lanes.join("\n")} result.push("export" /* exportedModifier */); if (flags & 8192 /* Deprecated */) result.push("deprecated" /* deprecatedModifier */); - if (node.flags & 16777216 /* Ambient */) + if (node.flags & 33554432 /* Ambient */) result.push("declare" /* ambientModifier */); - if (node.kind === 276 /* ExportAssignment */) + if (node.kind === 277 /* ExportAssignment */) result.push("export" /* exportedModifier */); return result.length > 0 ? result.join(",") : "" /* none */; } function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 182 /* TypeReference */ || node.kind === 212 /* CallExpression */) { + if (node.kind === 183 /* TypeReference */ || node.kind === 213 /* CallExpression */) { return node.typeArguments; } - if (isFunctionLike(node) || node.kind === 262 /* ClassDeclaration */ || node.kind === 263 /* InterfaceDeclaration */) { + if (isFunctionLike(node) || node.kind === 263 /* ClassDeclaration */ || node.kind === 264 /* InterfaceDeclaration */) { return node.typeParameters; } return void 0; @@ -128195,14 +129994,14 @@ ${lanes.join("\n")} return result; } function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { - if (node.kind === 208 /* ArrayLiteralExpression */ || node.kind === 209 /* ObjectLiteralExpression */) { - if (node.parent.kind === 225 /* BinaryExpression */ && node.parent.left === node && node.parent.operatorToken.kind === 64 /* EqualsToken */) { + if (node.kind === 209 /* ArrayLiteralExpression */ || node.kind === 210 /* ObjectLiteralExpression */) { + if (node.parent.kind === 226 /* BinaryExpression */ && node.parent.left === node && node.parent.operatorToken.kind === 64 /* EqualsToken */) { return true; } - if (node.parent.kind === 249 /* ForOfStatement */ && node.parent.initializer === node) { + if (node.parent.kind === 250 /* ForOfStatement */ && node.parent.initializer === node) { return true; } - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 302 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 303 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { return true; } } @@ -128300,7 +130099,7 @@ ${lanes.join("\n")} return type.isTypeParameter() ? type.getConstraint() || type : type; } function getNameFromPropertyName(name) { - return name.kind === 166 /* ComputedPropertyName */ ? isStringOrNumericLiteralLike(name.expression) ? name.expression.text : void 0 : isPrivateIdentifier(name) ? idText(name) : getTextOfIdentifierOrLiteral(name); + return name.kind === 167 /* ComputedPropertyName */ ? isStringOrNumericLiteralLike(name.expression) ? name.expression.text : void 0 : isPrivateIdentifier(name) ? idText(name) : getTextOfIdentifierOrLiteral(name); } function programContainsModules(program) { return program.getSourceFiles().some((s) => !s.isDeclarationFile && !program.isSourceFileFromExternalLibrary(s) && !!(s.externalModuleIndicator || s.commonJsModuleIndicator)); @@ -128422,7 +130221,7 @@ ${lanes.join("\n")} } function insertImports(changes, sourceFile, imports, blankLineBetween, preferences) { const decl = isArray(imports) ? imports[0] : imports; - const importKindPredicate = decl.kind === 242 /* VariableStatement */ ? isRequireVariableStatement : isAnyImportSyntax; + const importKindPredicate = decl.kind === 243 /* VariableStatement */ ? isRequireVariableStatement : isAnyImportSyntax; const existingImportStatements = filter(sourceFile.statements, importKindPredicate); let sortKind = isArray(imports) ? ts_OrganizeImports_exports.detectImportDeclarationSorting(imports, preferences) : 3 /* Both */; const comparer = ts_OrganizeImports_exports.getOrganizeImportsComparer(preferences, sortKind === 2 /* CaseInsensitive */); @@ -128992,13 +130791,13 @@ ${lanes.join("\n")} function getContextualTypeFromParent(node, checker, contextFlags) { const parent2 = walkUpParenthesizedExpressions(node.parent); switch (parent2.kind) { - case 213 /* NewExpression */: + case 214 /* NewExpression */: return checker.getContextualType(parent2, contextFlags); - case 225 /* BinaryExpression */: { + case 226 /* BinaryExpression */: { const { left, operatorToken, right } = parent2; return isEqualityOperatorKind(operatorToken.kind) ? checker.getTypeAtLocation(node === right ? left : right) : checker.getContextualType(node, contextFlags); } - case 295 /* CaseClause */: + case 296 /* CaseClause */: return getSwitchedType(parent2, checker); default: return checker.getContextualType(node, contextFlags); @@ -129024,8 +130823,8 @@ ${lanes.join("\n")} switch (node.kind) { case 11 /* StringLiteral */: case 15 /* NoSubstitutionTemplateLiteral */: - case 227 /* TemplateExpression */: - case 214 /* TaggedTemplateExpression */: + case 228 /* TemplateExpression */: + case 215 /* TaggedTemplateExpression */: return true; default: return false; @@ -129060,16 +130859,16 @@ ${lanes.join("\n")} return typeIsAccessible ? res : void 0; } function syntaxRequiresTrailingCommaOrSemicolonOrASI(kind) { - return kind === 178 /* CallSignature */ || kind === 179 /* ConstructSignature */ || kind === 180 /* IndexSignature */ || kind === 170 /* PropertySignature */ || kind === 172 /* MethodSignature */; + return kind === 179 /* CallSignature */ || kind === 180 /* ConstructSignature */ || kind === 181 /* IndexSignature */ || kind === 171 /* PropertySignature */ || kind === 173 /* MethodSignature */; } function syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI(kind) { - return kind === 261 /* FunctionDeclaration */ || kind === 175 /* Constructor */ || kind === 173 /* MethodDeclaration */ || kind === 176 /* GetAccessor */ || kind === 177 /* SetAccessor */; + return kind === 262 /* FunctionDeclaration */ || kind === 176 /* Constructor */ || kind === 174 /* MethodDeclaration */ || kind === 177 /* GetAccessor */ || kind === 178 /* SetAccessor */; } function syntaxRequiresTrailingModuleBlockOrSemicolonOrASI(kind) { - return kind === 266 /* ModuleDeclaration */; + return kind === 267 /* ModuleDeclaration */; } function syntaxRequiresTrailingSemicolonOrASI(kind) { - return kind === 242 /* VariableStatement */ || kind === 243 /* ExpressionStatement */ || kind === 245 /* DoStatement */ || kind === 250 /* ContinueStatement */ || kind === 251 /* BreakStatement */ || kind === 252 /* ReturnStatement */ || kind === 256 /* ThrowStatement */ || kind === 258 /* DebuggerStatement */ || kind === 171 /* PropertyDeclaration */ || kind === 264 /* TypeAliasDeclaration */ || kind === 271 /* ImportDeclaration */ || kind === 270 /* ImportEqualsDeclaration */ || kind === 277 /* ExportDeclaration */ || kind === 269 /* NamespaceExportDeclaration */ || kind === 276 /* ExportAssignment */; + return kind === 243 /* VariableStatement */ || kind === 244 /* ExpressionStatement */ || kind === 246 /* DoStatement */ || kind === 251 /* ContinueStatement */ || kind === 252 /* BreakStatement */ || kind === 253 /* ReturnStatement */ || kind === 257 /* ThrowStatement */ || kind === 259 /* DebuggerStatement */ || kind === 172 /* PropertyDeclaration */ || kind === 265 /* TypeAliasDeclaration */ || kind === 272 /* ImportDeclaration */ || kind === 271 /* ImportEqualsDeclaration */ || kind === 278 /* ExportDeclaration */ || kind === 270 /* NamespaceExportDeclaration */ || kind === 277 /* ExportAssignment */; } function nodeIsASICandidate(node, sourceFile) { const lastToken = node.getLastToken(sourceFile); @@ -129093,7 +130892,7 @@ ${lanes.join("\n")} } else if (!syntaxRequiresTrailingSemicolonOrASI(node.kind)) { return false; } - if (node.kind === 245 /* DoStatement */) { + if (node.kind === 246 /* DoStatement */) { return true; } const topNode = findAncestor(node, (ancestor) => !ancestor.parent); @@ -129471,13 +131270,16 @@ ${lanes.join("\n")} return !(symbol.flags & 33554432 /* Transient */) && (symbol.escapedName === "export=" /* ExportEquals */ || symbol.escapedName === "default" /* Default */); } function getDefaultLikeExportNameFromDeclaration(symbol) { - return firstDefined( - symbol.declarations, - (d) => { - var _a, _b; - return isExportAssignment(d) ? (_a = tryCast(skipOuterExpressions(d.expression), isIdentifier)) == null ? void 0 : _a.text : (_b = tryCast(getNameOfDeclaration(d), isIdentifier)) == null ? void 0 : _b.text; + return firstDefined(symbol.declarations, (d) => { + var _a, _b, _c; + if (isExportAssignment(d)) { + return (_a = tryCast(skipOuterExpressions(d.expression), isIdentifier)) == null ? void 0 : _a.text; } - ); + if (isExportSpecifier(d) && d.symbol.flags === 2097152 /* Alias */) { + return (_b = tryCast(d.propertyName, isIdentifier)) == null ? void 0 : _b.text; + } + return (_c = tryCast(getNameOfDeclaration(d), isIdentifier)) == null ? void 0 : _c.text; + }); } function getSymbolParentOrFail(symbol) { var _a; @@ -129657,7 +131459,7 @@ ${lanes.join("\n")} typeKeywords = [ 133 /* AnyKeyword */, 131 /* AssertsKeyword */, - 162 /* BigIntKeyword */, + 163 /* BigIntKeyword */, 136 /* BooleanKeyword */, 97 /* FalseKeyword */, 140 /* InferKeyword */, @@ -129917,10 +131719,10 @@ ${lanes.join("\n")} } function forEachExternalModuleToImportFrom(program, host, preferences, useAutoImportProvider, cb) { var _a, _b; - const useCaseSensitiveFileNames = hostUsesCaseSensitiveFileNames(host); + const useCaseSensitiveFileNames2 = hostUsesCaseSensitiveFileNames(host); const excludePatterns = preferences.autoImportFileExcludePatterns && mapDefined(preferences.autoImportFileExcludePatterns, (spec) => { const pattern = getPatternFromSpec(spec, "", "exclude"); - return pattern ? getRegexFromPattern(pattern, useCaseSensitiveFileNames) : void 0; + return pattern ? getRegexFromPattern(pattern, useCaseSensitiveFileNames2) : void 0; }); forEachExternalModule(program.getTypeChecker(), program.getSourceFiles(), excludePatterns, (module2, file) => cb( module2, @@ -130455,13 +132257,13 @@ ${lanes.join("\n")} } function checkForClassificationCancellation(cancellationToken, kind) { switch (kind) { - case 266 /* ModuleDeclaration */: - case 262 /* ClassDeclaration */: - case 263 /* InterfaceDeclaration */: - case 261 /* FunctionDeclaration */: - case 230 /* ClassExpression */: - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: + case 267 /* ModuleDeclaration */: + case 263 /* ClassDeclaration */: + case 264 /* InterfaceDeclaration */: + case 262 /* FunctionDeclaration */: + case 231 /* ClassExpression */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } } @@ -130677,49 +132479,49 @@ ${lanes.join("\n")} pos = tag.tagName.end; let commentStart = tag.tagName.end; switch (tag.kind) { - case 347 /* JSDocParameterTag */: + case 348 /* JSDocParameterTag */: const param = tag; processJSDocParameterTag(param); commentStart = param.isNameFirst && ((_a = param.typeExpression) == null ? void 0 : _a.end) || param.name.end; break; - case 354 /* JSDocPropertyTag */: + case 355 /* JSDocPropertyTag */: const prop = tag; commentStart = prop.isNameFirst && ((_b = prop.typeExpression) == null ? void 0 : _b.end) || prop.name.end; break; - case 351 /* JSDocTemplateTag */: + case 352 /* JSDocTemplateTag */: processJSDocTemplateTag(tag); pos = tag.end; commentStart = tag.typeParameters.end; break; - case 352 /* JSDocTypedefTag */: + case 353 /* JSDocTypedefTag */: const type = tag; - commentStart = ((_c = type.typeExpression) == null ? void 0 : _c.kind) === 315 /* JSDocTypeExpression */ && ((_d = type.fullName) == null ? void 0 : _d.end) || ((_e = type.typeExpression) == null ? void 0 : _e.end) || commentStart; + commentStart = ((_c = type.typeExpression) == null ? void 0 : _c.kind) === 316 /* JSDocTypeExpression */ && ((_d = type.fullName) == null ? void 0 : _d.end) || ((_e = type.typeExpression) == null ? void 0 : _e.end) || commentStart; break; - case 344 /* JSDocCallbackTag */: + case 345 /* JSDocCallbackTag */: commentStart = tag.typeExpression.end; break; - case 350 /* JSDocTypeTag */: + case 351 /* JSDocTypeTag */: processElement(tag.typeExpression); pos = tag.end; commentStart = tag.typeExpression.end; break; - case 349 /* JSDocThisTag */: - case 346 /* JSDocEnumTag */: + case 350 /* JSDocThisTag */: + case 347 /* JSDocEnumTag */: commentStart = tag.typeExpression.end; break; - case 348 /* JSDocReturnTag */: + case 349 /* JSDocReturnTag */: processElement(tag.typeExpression); pos = tag.end; commentStart = ((_f = tag.typeExpression) == null ? void 0 : _f.end) || commentStart; break; - case 353 /* JSDocSeeTag */: + case 354 /* JSDocSeeTag */: commentStart = ((_g = tag.name) == null ? void 0 : _g.end) || commentStart; break; - case 334 /* JSDocAugmentsTag */: - case 335 /* JSDocImplementsTag */: + case 335 /* JSDocAugmentsTag */: + case 336 /* JSDocImplementsTag */: commentStart = tag.class.end; break; - case 355 /* JSDocThrowsTag */: + case 356 /* JSDocThrowsTag */: processElement(tag.typeExpression); pos = tag.end; commentStart = ((_h = tag.typeExpression) == null ? void 0 : _h.end) || commentStart; @@ -130864,22 +132666,22 @@ ${lanes.join("\n")} } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 285 /* JsxOpeningElement */: + case 286 /* JsxOpeningElement */: if (token.parent.tagName === token) { return 19 /* jsxOpenTagName */; } break; - case 286 /* JsxClosingElement */: + case 287 /* JsxClosingElement */: if (token.parent.tagName === token) { return 20 /* jsxCloseTagName */; } break; - case 284 /* JsxSelfClosingElement */: + case 285 /* JsxSelfClosingElement */: if (token.parent.tagName === token) { return 21 /* jsxSelfClosingTagName */; } break; - case 290 /* JsxAttribute */: + case 291 /* JsxAttribute */: if (token.parent.name === token) { return 22 /* jsxAttribute */; } @@ -130900,11 +132702,11 @@ ${lanes.join("\n")} if (token) { const parent2 = token.parent; if (tokenKind === 64 /* EqualsToken */) { - if (parent2.kind === 259 /* VariableDeclaration */ || parent2.kind === 171 /* PropertyDeclaration */ || parent2.kind === 168 /* Parameter */ || parent2.kind === 290 /* JsxAttribute */) { + if (parent2.kind === 260 /* VariableDeclaration */ || parent2.kind === 172 /* PropertyDeclaration */ || parent2.kind === 169 /* Parameter */ || parent2.kind === 291 /* JsxAttribute */) { return 5 /* operator */; } } - if (parent2.kind === 225 /* BinaryExpression */ || parent2.kind === 223 /* PrefixUnaryExpression */ || parent2.kind === 224 /* PostfixUnaryExpression */ || parent2.kind === 226 /* ConditionalExpression */) { + if (parent2.kind === 226 /* BinaryExpression */ || parent2.kind === 224 /* PrefixUnaryExpression */ || parent2.kind === 225 /* PostfixUnaryExpression */ || parent2.kind === 227 /* ConditionalExpression */) { return 5 /* operator */; } } @@ -130914,7 +132716,7 @@ ${lanes.join("\n")} } else if (tokenKind === 10 /* BigIntLiteral */) { return 25 /* bigintLiteral */; } else if (tokenKind === 11 /* StringLiteral */) { - return token && token.parent.kind === 290 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; + return token && token.parent.kind === 291 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; } else if (tokenKind === 14 /* RegularExpressionLiteral */) { return 6 /* stringLiteral */; } else if (isTemplateLiteralKind(tokenKind)) { @@ -130924,32 +132726,32 @@ ${lanes.join("\n")} } else if (tokenKind === 80 /* Identifier */) { if (token) { switch (token.parent.kind) { - case 262 /* ClassDeclaration */: + case 263 /* ClassDeclaration */: if (token.parent.name === token) { return 11 /* className */; } return; - case 167 /* TypeParameter */: + case 168 /* TypeParameter */: if (token.parent.name === token) { return 15 /* typeParameterName */; } return; - case 263 /* InterfaceDeclaration */: + case 264 /* InterfaceDeclaration */: if (token.parent.name === token) { return 13 /* interfaceName */; } return; - case 265 /* EnumDeclaration */: + case 266 /* EnumDeclaration */: if (token.parent.name === token) { return 12 /* enumName */; } return; - case 266 /* ModuleDeclaration */: + case 267 /* ModuleDeclaration */: if (token.parent.name === token) { return 14 /* moduleName */; } return; - case 168 /* Parameter */: + case 169 /* Parameter */: if (token.parent.name === token) { return isThisIdentifier(token) ? 3 /* keyword */ : 17 /* parameterName */; } @@ -131134,7 +132936,7 @@ ${lanes.join("\n")} let child = throwStatement; while (child.parent) { const parent2 = child.parent; - if (isFunctionBlock(parent2) || parent2.kind === 311 /* SourceFile */) { + if (isFunctionBlock(parent2) || parent2.kind === 312 /* SourceFile */) { return parent2; } if (isTryStatement(parent2) && parent2.tryBlock === child && parent2.catchClause) { @@ -131164,15 +132966,15 @@ ${lanes.join("\n")} function getBreakOrContinueOwner(statement) { return findAncestor(statement, (node) => { switch (node.kind) { - case 254 /* SwitchStatement */: - if (statement.kind === 250 /* ContinueStatement */) { + case 255 /* SwitchStatement */: + if (statement.kind === 251 /* ContinueStatement */) { return false; } - case 247 /* ForStatement */: - case 248 /* ForInStatement */: - case 249 /* ForOfStatement */: - case 246 /* WhileStatement */: - case 245 /* DoStatement */: + case 248 /* ForStatement */: + case 249 /* ForInStatement */: + case 250 /* ForOfStatement */: + case 247 /* WhileStatement */: + case 246 /* DoStatement */: return !statement.label || isLabeledBy(node, statement.label.escapedText); default: return isFunctionLike(node) && "quit"; @@ -131185,24 +132987,24 @@ ${lanes.join("\n")} function getNodesToSearchForModifier(declaration, modifierFlag) { const container = declaration.parent; switch (container.kind) { - case 267 /* ModuleBlock */: - case 311 /* SourceFile */: - case 240 /* Block */: - case 295 /* CaseClause */: - case 296 /* DefaultClause */: + case 268 /* ModuleBlock */: + case 312 /* SourceFile */: + case 241 /* Block */: + case 296 /* CaseClause */: + case 297 /* DefaultClause */: if (modifierFlag & 256 /* Abstract */ && isClassDeclaration(declaration)) { return [...declaration.members, declaration]; } else { return container.statements; } - case 175 /* Constructor */: - case 173 /* MethodDeclaration */: - case 261 /* FunctionDeclaration */: + case 176 /* Constructor */: + case 174 /* MethodDeclaration */: + case 262 /* FunctionDeclaration */: return [...container.parameters, ...isClassLike(container.parent) ? container.parent.members : []]; - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: - case 263 /* InterfaceDeclaration */: - case 186 /* TypeLiteral */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: + case 264 /* InterfaceDeclaration */: + case 187 /* TypeLiteral */: const nodes = container.members; if (modifierFlag & (28 /* AccessibilityModifier */ | 64 /* Readonly */)) { const constructor = find(container.members, isConstructorDeclaration); @@ -131213,7 +133015,7 @@ ${lanes.join("\n")} return [...nodes, container]; } return nodes; - case 209 /* ObjectLiteralExpression */: + case 210 /* ObjectLiteralExpression */: return void 0; default: Debug.assertNever(container, "Invalid container kind."); @@ -131229,7 +133031,7 @@ ${lanes.join("\n")} function getLoopBreakContinueOccurrences(loopNode) { const keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 99 /* ForKeyword */, 117 /* WhileKeyword */, 92 /* DoKeyword */)) { - if (loopNode.kind === 245 /* DoStatement */) { + if (loopNode.kind === 246 /* DoStatement */) { const loopTokens = loopNode.getChildren(); for (let i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 117 /* WhileKeyword */)) { @@ -131249,13 +133051,13 @@ ${lanes.join("\n")} const owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 247 /* ForStatement */: - case 248 /* ForInStatement */: - case 249 /* ForOfStatement */: - case 245 /* DoStatement */: - case 246 /* WhileStatement */: + case 248 /* ForStatement */: + case 249 /* ForInStatement */: + case 250 /* ForOfStatement */: + case 246 /* DoStatement */: + case 247 /* WhileStatement */: return getLoopBreakContinueOccurrences(owner); - case 254 /* SwitchStatement */: + case 255 /* SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); } } @@ -131416,12 +133218,12 @@ ${lanes.join("\n")} function isDocumentRegistryEntry(entry) { return !!entry.sourceFile; } - function createDocumentRegistry(useCaseSensitiveFileNames, currentDirectory) { - return createDocumentRegistryInternal(useCaseSensitiveFileNames, currentDirectory); + function createDocumentRegistry(useCaseSensitiveFileNames2, currentDirectory) { + return createDocumentRegistryInternal(useCaseSensitiveFileNames2, currentDirectory); } - function createDocumentRegistryInternal(useCaseSensitiveFileNames, currentDirectory = "", externalCache) { + function createDocumentRegistryInternal(useCaseSensitiveFileNames2, currentDirectory = "", externalCache) { const buckets = /* @__PURE__ */ new Map(); - const getCanonicalFileName = createGetCanonicalFileName(!!useCaseSensitiveFileNames); + const getCanonicalFileName = createGetCanonicalFileName(!!useCaseSensitiveFileNames2); function reportStats() { const bucketInfoArray = arrayFrom(buckets.keys()).filter((name) => name && name.charAt(0) === "_").map((name) => { const entries = buckets.get(name); @@ -131602,13 +133404,6 @@ ${lanes.join("\n")} } } } - function getLanguageServiceRefCounts(path, scriptKind) { - return arrayFrom(buckets.entries(), ([key, bucket]) => { - const bucketEntry = bucket.get(path); - const entry = bucketEntry && getDocumentRegistryEntry(bucketEntry, scriptKind); - return [key, entry && entry.languageServiceRefCount]; - }); - } return { acquireDocument, acquireDocumentWithKey, @@ -131616,9 +133411,10 @@ ${lanes.join("\n")} updateDocumentWithKey, releaseDocument, releaseDocumentWithKey, - getLanguageServiceRefCounts, + getKeyForCompilationSettings, + getDocumentRegistryBucketKeyWithMode, reportStats, - getKeyForCompilationSettings + getBuckets: () => buckets }; } function getKeyForCompilationSettings(settings) { @@ -131636,12 +133432,12 @@ ${lanes.join("\n")} // src/services/getEditsForFileRename.ts function getEditsForFileRename(program, oldFileOrDirPath, newFileOrDirPath, host, formatContext, preferences, sourceMapper) { - const useCaseSensitiveFileNames = hostUsesCaseSensitiveFileNames(host); - const getCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames); + const useCaseSensitiveFileNames2 = hostUsesCaseSensitiveFileNames(host); + const getCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames2); const oldToNew = getPathUpdater(oldFileOrDirPath, newFileOrDirPath, getCanonicalFileName, sourceMapper); const newToOld = getPathUpdater(newFileOrDirPath, oldFileOrDirPath, getCanonicalFileName, sourceMapper); return ts_textChanges_exports.ChangeTracker.with({ host, formatContext, preferences }, (changeTracker) => { - updateTsconfigFiles(program, changeTracker, oldToNew, oldFileOrDirPath, newFileOrDirPath, host.getCurrentDirectory(), useCaseSensitiveFileNames); + updateTsconfigFiles(program, changeTracker, oldToNew, oldFileOrDirPath, newFileOrDirPath, host.getCurrentDirectory(), useCaseSensitiveFileNames2); updateImports(program, changeTracker, oldToNew, newToOld, host, getCanonicalFileName); }); } @@ -131663,7 +133459,7 @@ ${lanes.join("\n")} const rel = getRelativePathFromFile(a0, b0, getCanonicalFileName); return combinePathsSafe(getDirectoryPath(a1), rel); } - function updateTsconfigFiles(program, changeTracker, oldToNew, oldFileOrDirPath, newFileOrDirPath, currentDirectory, useCaseSensitiveFileNames) { + function updateTsconfigFiles(program, changeTracker, oldToNew, oldFileOrDirPath, newFileOrDirPath, currentDirectory, useCaseSensitiveFileNames2) { const { configFile } = program.getCompilerOptions(); if (!configFile) return; @@ -131687,10 +133483,10 @@ ${lanes.join("\n")} /*excludes*/ [], includes, - useCaseSensitiveFileNames, + useCaseSensitiveFileNames2, currentDirectory ); - if (getRegexFromPattern(Debug.checkDefined(matchers.includeFilePattern), useCaseSensitiveFileNames).test(oldFileOrDirPath) && !getRegexFromPattern(Debug.checkDefined(matchers.includeFilePattern), useCaseSensitiveFileNames).test(newFileOrDirPath)) { + if (getRegexFromPattern(Debug.checkDefined(matchers.includeFilePattern), useCaseSensitiveFileNames2).test(oldFileOrDirPath) && !getRegexFromPattern(Debug.checkDefined(matchers.includeFilePattern), useCaseSensitiveFileNames2).test(newFileOrDirPath)) { changeTracker.insertNodeAfter(configFile, last(property.initializer.elements), factory.createStringLiteral(relativePath(newFileOrDirPath))); } return; @@ -131738,7 +133534,7 @@ ${lanes.join("\n")} configDir, path, /*ignoreCase*/ - !useCaseSensitiveFileNames + !useCaseSensitiveFileNames2 ); } } @@ -132285,7 +134081,7 @@ ${lanes.join("\n")} if (token === 156 /* TypeKeyword */) { const skipTypeKeyword = scanner.lookAhead(() => { const token2 = scanner.scan(); - return token2 !== 160 /* FromKeyword */ && (token2 === 42 /* AsteriskToken */ || token2 === 19 /* OpenBraceToken */ || token2 === 80 /* Identifier */ || isKeyword(token2)); + return token2 !== 161 /* FromKeyword */ && (token2 === 42 /* AsteriskToken */ || token2 === 19 /* OpenBraceToken */ || token2 === 80 /* Identifier */ || isKeyword(token2)); }); if (skipTypeKeyword) { token = nextToken(); @@ -132293,7 +134089,7 @@ ${lanes.join("\n")} } if (token === 80 /* Identifier */ || isKeyword(token)) { token = nextToken(); - if (token === 160 /* FromKeyword */) { + if (token === 161 /* FromKeyword */) { token = nextToken(); if (token === 11 /* StringLiteral */) { recordModuleName(); @@ -132319,7 +134115,7 @@ ${lanes.join("\n")} } if (token === 20 /* CloseBraceToken */) { token = nextToken(); - if (token === 160 /* FromKeyword */) { + if (token === 161 /* FromKeyword */) { token = nextToken(); if (token === 11 /* StringLiteral */) { recordModuleName(); @@ -132332,7 +134128,7 @@ ${lanes.join("\n")} token = nextToken(); if (token === 80 /* Identifier */ || isKeyword(token)) { token = nextToken(); - if (token === 160 /* FromKeyword */) { + if (token === 161 /* FromKeyword */) { token = nextToken(); if (token === 11 /* StringLiteral */) { recordModuleName(); @@ -132367,7 +134163,7 @@ ${lanes.join("\n")} } if (token === 20 /* CloseBraceToken */) { token = nextToken(); - if (token === 160 /* FromKeyword */) { + if (token === 161 /* FromKeyword */) { token = nextToken(); if (token === 11 /* StringLiteral */) { recordModuleName(); @@ -132376,7 +134172,7 @@ ${lanes.join("\n")} } } else if (token === 42 /* AsteriskToken */) { token = nextToken(); - if (token === 160 /* FromKeyword */) { + if (token === 161 /* FromKeyword */) { token = nextToken(); if (token === 11 /* StringLiteral */) { recordModuleName(); @@ -132690,7 +134486,7 @@ ${lanes.join("\n")} "src/services/sourcemaps.ts"() { "use strict"; init_ts4(); - base64UrlRegExp = /^data:(?:application\/json(?:;charset=[uU][tT][fF]-8);base64,([A-Za-z0-9+\/=]+)$)?/; + base64UrlRegExp = /^data:(?:application\/json(?:;charset=[uU][tT][fF]-8);base64,([A-Za-z0-9+/=]+)$)?/; } }); @@ -132738,8 +134534,8 @@ ${lanes.join("\n")} diags.push(createDiagnosticForNode(init, Diagnostics.require_call_may_be_converted_to_an_import)); } } - const jsdocTypedefNode = ts_codefix_exports.getJSDocTypedefNode(node); - if (jsdocTypedefNode) { + const jsdocTypedefNodes = ts_codefix_exports.getJSDocTypedefNodes(node); + for (const jsdocTypedefNode of jsdocTypedefNodes) { diags.push(createDiagnosticForNode(jsdocTypedefNode, Diagnostics.JSDoc_typedef_may_be_converted_to_TypeScript_type)); } if (ts_codefix_exports.parameterShouldGetTypeFromJSDoc(node)) { @@ -132755,13 +134551,13 @@ ${lanes.join("\n")} function containsTopLevelCommonjs(sourceFile) { return sourceFile.statements.some((statement) => { switch (statement.kind) { - case 242 /* VariableStatement */: + case 243 /* VariableStatement */: return statement.declarationList.declarations.some((decl) => !!decl.initializer && isRequireCall( propertyAccessLeftHandSide(decl.initializer), /*requireStringLiteralLikeArgument*/ true )); - case 243 /* ExpressionStatement */: { + case 244 /* ExpressionStatement */: { const { expression } = statement; if (!isBinaryExpression(expression)) return isRequireCall( @@ -132782,10 +134578,10 @@ ${lanes.join("\n")} } function importNameForConvertToDefaultImport(node) { switch (node.kind) { - case 271 /* ImportDeclaration */: + case 272 /* ImportDeclaration */: const { importClause, moduleSpecifier } = node; - return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 273 /* NamespaceImport */ && isStringLiteral(moduleSpecifier) ? importClause.namedBindings.name : void 0; - case 270 /* ImportEqualsDeclaration */: + return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 274 /* NamespaceImport */ && isStringLiteral(moduleSpecifier) ? importClause.namedBindings.name : void 0; + case 271 /* ImportEqualsDeclaration */: return node.name; default: return void 0; @@ -132849,18 +134645,18 @@ ${lanes.join("\n")} } function isFixablePromiseArgument(arg, checker) { switch (arg.kind) { - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: const functionFlags = getFunctionFlags(arg); if (functionFlags & 1 /* Generator */) { return false; } - case 218 /* ArrowFunction */: + case 219 /* ArrowFunction */: visitedNestedConvertibleFunctions.set(getKeyFromNode(arg), true); case 106 /* NullKeyword */: return true; case 80 /* Identifier */: - case 210 /* PropertyAccessExpression */: { + case 211 /* PropertyAccessExpression */: { const symbol = checker.getSymbolAtLocation(arg); if (!symbol) { return false; @@ -132894,10 +134690,10 @@ ${lanes.join("\n")} } function canBeConvertedToAsync(node) { switch (node.kind) { - case 261 /* FunctionDeclaration */: - case 173 /* MethodDeclaration */: - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: + case 262 /* FunctionDeclaration */: + case 174 /* MethodDeclaration */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: return true; default: return false; @@ -133080,9 +134876,9 @@ ${lanes.join("\n")} } function shouldKeepItem(declaration, checker) { switch (declaration.kind) { - case 272 /* ImportClause */: - case 275 /* ImportSpecifier */: - case 270 /* ImportEqualsDeclaration */: + case 273 /* ImportClause */: + case 276 /* ImportSpecifier */: + case 271 /* ImportEqualsDeclaration */: const importer = checker.getSymbolAtLocation(declaration.name); const imported = checker.getAliasedSymbol(importer); return importer.escapedName !== imported.escapedName; @@ -133092,7 +134888,7 @@ ${lanes.join("\n")} } function tryAddSingleDeclarationName(declaration, containers) { const name = getNameOfDeclaration(declaration); - return !!name && (pushLiteral(name, containers) || name.kind === 166 /* ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers)); + return !!name && (pushLiteral(name, containers) || name.kind === 167 /* ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers)); } function tryAddComputedPropertyName(expression, containers) { return pushLiteral(expression, containers) || isPropertyAccessExpression(expression) && (containers.push(expression.name.text), true) && tryAddComputedPropertyName(expression.expression, containers); @@ -133103,7 +134899,7 @@ ${lanes.join("\n")} function getContainers(declaration) { const containers = []; const name = getNameOfDeclaration(declaration); - if (name && name.kind === 166 /* ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) { + if (name && name.kind === 167 /* ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) { return emptyArray; } containers.shift(); @@ -133276,7 +135072,7 @@ ${lanes.join("\n")} } } function hasNavigationBarName(node) { - return !hasDynamicName(node) || node.kind !== 225 /* BinaryExpression */ && isPropertyAccessExpression(node.name.expression) && isIdentifier(node.name.expression.expression) && idText(node.name.expression.expression) === "Symbol"; + return !hasDynamicName(node) || node.kind !== 226 /* BinaryExpression */ && isPropertyAccessExpression(node.name.expression) && isIdentifier(node.name.expression.expression) && idText(node.name.expression.expression) === "Symbol"; } function addChildrenRecursively(node) { curCancellationToken.throwIfCancellationRequested(); @@ -133284,7 +135080,7 @@ ${lanes.join("\n")} return; } switch (node.kind) { - case 175 /* Constructor */: + case 176 /* Constructor */: const ctr = node; addNodeWithRecursiveChild(ctr, ctr.body); for (const param of ctr.parameters) { @@ -133293,32 +135089,32 @@ ${lanes.join("\n")} } } break; - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 172 /* MethodSignature */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 173 /* MethodSignature */: if (hasNavigationBarName(node)) { addNodeWithRecursiveChild(node, node.body); } break; - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: if (hasNavigationBarName(node)) { addNodeWithRecursiveInitializer(node); } break; - case 170 /* PropertySignature */: + case 171 /* PropertySignature */: if (hasNavigationBarName(node)) { addLeafNode(node); } break; - case 272 /* ImportClause */: + case 273 /* ImportClause */: const importClause = node; if (importClause.name) { addLeafNode(importClause.name); } const { namedBindings } = importClause; if (namedBindings) { - if (namedBindings.kind === 273 /* NamespaceImport */) { + if (namedBindings.kind === 274 /* NamespaceImport */) { addLeafNode(namedBindings); } else { for (const element of namedBindings.elements) { @@ -133327,16 +135123,16 @@ ${lanes.join("\n")} } } break; - case 303 /* ShorthandPropertyAssignment */: + case 304 /* ShorthandPropertyAssignment */: addNodeWithRecursiveChild(node, node.name); break; - case 304 /* SpreadAssignment */: + case 305 /* SpreadAssignment */: const { expression } = node; isIdentifier(expression) ? addLeafNode(node, expression) : addLeafNode(node); break; - case 207 /* BindingElement */: - case 302 /* PropertyAssignment */: - case 259 /* VariableDeclaration */: { + case 208 /* BindingElement */: + case 303 /* PropertyAssignment */: + case 260 /* VariableDeclaration */: { const child = node; if (isBindingPattern(child.name)) { addChildrenRecursively(child.name); @@ -133345,18 +135141,18 @@ ${lanes.join("\n")} } break; } - case 261 /* FunctionDeclaration */: + case 262 /* FunctionDeclaration */: const nameNode = node.name; if (nameNode && isIdentifier(nameNode)) { addTrackedEs5Class(nameNode.text); } addNodeWithRecursiveChild(node, node.body); break; - case 218 /* ArrowFunction */: - case 217 /* FunctionExpression */: + case 219 /* ArrowFunction */: + case 218 /* FunctionExpression */: addNodeWithRecursiveChild(node, node.body); break; - case 265 /* EnumDeclaration */: + case 266 /* EnumDeclaration */: startNode(node); for (const member of node.members) { if (!isComputedProperty(member)) { @@ -133365,19 +135161,19 @@ ${lanes.join("\n")} } endNode(); break; - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: - case 263 /* InterfaceDeclaration */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: + case 264 /* InterfaceDeclaration */: startNode(node); for (const member of node.members) { addChildrenRecursively(member); } endNode(); break; - case 266 /* ModuleDeclaration */: + case 267 /* ModuleDeclaration */: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case 276 /* ExportAssignment */: { + case 277 /* ExportAssignment */: { const expression2 = node.expression; const child = isObjectLiteralExpression(expression2) || isCallExpression(expression2) ? expression2 : isArrowFunction(expression2) || isFunctionExpression(expression2) ? expression2.body : void 0; if (child) { @@ -133389,16 +135185,16 @@ ${lanes.join("\n")} } break; } - case 280 /* ExportSpecifier */: - case 270 /* ImportEqualsDeclaration */: - case 180 /* IndexSignature */: - case 178 /* CallSignature */: - case 179 /* ConstructSignature */: - case 264 /* TypeAliasDeclaration */: + case 281 /* ExportSpecifier */: + case 271 /* ImportEqualsDeclaration */: + case 181 /* IndexSignature */: + case 179 /* CallSignature */: + case 180 /* ConstructSignature */: + case 265 /* TypeAliasDeclaration */: addLeafNode(node); break; - case 212 /* CallExpression */: - case 225 /* BinaryExpression */: { + case 213 /* CallExpression */: + case 226 /* BinaryExpression */: { const special = getAssignmentDeclarationKind(node); switch (special) { case 1 /* ExportsProperty */: @@ -133608,19 +135404,19 @@ ${lanes.join("\n")} return false; } switch (a.kind) { - case 171 /* PropertyDeclaration */: - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 172 /* PropertyDeclaration */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: return isStatic(a) === isStatic(b); - case 266 /* ModuleDeclaration */: + case 267 /* ModuleDeclaration */: return areSameModule(a, b) && getFullyQualifiedModuleName(a) === getFullyQualifiedModuleName(b); default: return true; } } function isSynthesized(node) { - return !!(node.flags & 8 /* Synthesized */); + return !!(node.flags & 16 /* Synthesized */); } function isOwnChild(n, parent2) { const par = isModuleBlock(n.parent) ? n.parent.parent : n.parent; @@ -133630,7 +135426,7 @@ ${lanes.join("\n")} if (!a.body || !b.body) { return a.body === b.body; } - return a.body.kind === b.body.kind && (a.body.kind !== 266 /* ModuleDeclaration */ || areSameModule(a.body, b.body)); + return a.body.kind === b.body.kind && (a.body.kind !== 267 /* ModuleDeclaration */ || areSameModule(a.body, b.body)); } function merge(target, source) { target.additionalNodes = target.additionalNodes || []; @@ -133651,7 +135447,7 @@ ${lanes.join("\n")} return compareStringsCaseSensitiveUI(tryGetName(child1.node), tryGetName(child2.node)) || compareValues(navigationBarNodeKind(child1), navigationBarNodeKind(child2)); } function tryGetName(node) { - if (node.kind === 266 /* ModuleDeclaration */) { + if (node.kind === 267 /* ModuleDeclaration */) { return getModuleName(node); } const declName = getNameOfDeclaration(node); @@ -133660,16 +135456,16 @@ ${lanes.join("\n")} return propertyName && unescapeLeadingUnderscores(propertyName); } switch (node.kind) { - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: - case 230 /* ClassExpression */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: + case 231 /* ClassExpression */: return getFunctionOrClassName(node); default: return void 0; } } function getItemName(node, name) { - if (node.kind === 266 /* ModuleDeclaration */) { + if (node.kind === 267 /* ModuleDeclaration */) { return cleanText(getModuleName(node)); } if (name) { @@ -133679,27 +135475,27 @@ ${lanes.join("\n")} } } switch (node.kind) { - case 311 /* SourceFile */: + case 312 /* SourceFile */: const sourceFile = node; return isExternalModule(sourceFile) ? `"${escapeString(getBaseFileName(removeFileExtension(normalizePath(sourceFile.fileName))))}"` : ""; - case 276 /* ExportAssignment */: + case 277 /* ExportAssignment */: return isExportAssignment(node) && node.isExportEquals ? "export=" /* ExportEquals */ : "default" /* Default */; - case 218 /* ArrowFunction */: - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: + case 219 /* ArrowFunction */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: if (getSyntacticModifierFlags(node) & 1024 /* Default */) { return "default"; } return getFunctionOrClassName(node); - case 175 /* Constructor */: + case 176 /* Constructor */: return "constructor"; - case 179 /* ConstructSignature */: + case 180 /* ConstructSignature */: return "new()"; - case 178 /* CallSignature */: + case 179 /* CallSignature */: return "()"; - case 180 /* IndexSignature */: + case 181 /* IndexSignature */: return "[]"; default: return ""; @@ -133724,19 +135520,19 @@ ${lanes.join("\n")} return true; } switch (navigationBarNodeKind(item)) { - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: - case 265 /* EnumDeclaration */: - case 263 /* InterfaceDeclaration */: - case 266 /* ModuleDeclaration */: - case 311 /* SourceFile */: - case 264 /* TypeAliasDeclaration */: - case 352 /* JSDocTypedefTag */: - case 344 /* JSDocCallbackTag */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: + case 266 /* EnumDeclaration */: + case 264 /* InterfaceDeclaration */: + case 267 /* ModuleDeclaration */: + case 312 /* SourceFile */: + case 265 /* TypeAliasDeclaration */: + case 353 /* JSDocTypedefTag */: + case 345 /* JSDocCallbackTag */: return true; - case 218 /* ArrowFunction */: - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: + case 219 /* ArrowFunction */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: return isTopLevelFunctionDeclaration(item); default: return false; @@ -133746,10 +135542,10 @@ ${lanes.join("\n")} return false; } switch (navigationBarNodeKind(item2.parent)) { - case 267 /* ModuleBlock */: - case 311 /* SourceFile */: - case 173 /* MethodDeclaration */: - case 175 /* Constructor */: + case 268 /* ModuleBlock */: + case 312 /* SourceFile */: + case 174 /* MethodDeclaration */: + case 176 /* Constructor */: return true; default: return false; @@ -133808,7 +135604,7 @@ ${lanes.join("\n")} } function getFullyQualifiedModuleName(moduleDeclaration) { const result = [getTextOfIdentifierOrLiteral(moduleDeclaration.name)]; - while (moduleDeclaration.body && moduleDeclaration.body.kind === 266 /* ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 267 /* ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(getTextOfIdentifierOrLiteral(moduleDeclaration.name)); } @@ -133818,13 +135614,13 @@ ${lanes.join("\n")} return decl.body && isModuleDeclaration(decl.body) ? getInteriorModule(decl.body) : decl; } function isComputedProperty(member) { - return !member.name || member.name.kind === 166 /* ComputedPropertyName */; + return !member.name || member.name.kind === 167 /* ComputedPropertyName */; } function getNodeSpan(node) { - return node.kind === 311 /* SourceFile */ ? createTextSpanFromRange(node) : createTextSpanFromNode(node, curSourceFile); + return node.kind === 312 /* SourceFile */ ? createTextSpanFromRange(node) : createTextSpanFromNode(node, curSourceFile); } function getModifiers2(node) { - if (node.parent && node.parent.kind === 259 /* VariableDeclaration */) { + if (node.parent && node.parent.kind === 260 /* VariableDeclaration */) { node = node.parent; } return getNodeModifiers(node); @@ -133869,9 +135665,9 @@ ${lanes.join("\n")} } function isFunctionOrClassExpression(node) { switch (node.kind) { - case 218 /* ArrowFunction */: - case 217 /* FunctionExpression */: - case 230 /* ClassExpression */: + case 219 /* ArrowFunction */: + case 218 /* FunctionExpression */: + case 231 /* ClassExpression */: return true; default: return false; @@ -133929,8 +135725,8 @@ ${lanes.join("\n")} return context.cancellationToken && context.cancellationToken.isCancellationRequested() || !((_a = refactor.kinds) == null ? void 0 : _a.some((kind) => refactorKindBeginsWith(kind, context.kind))) ? void 0 : refactor.getAvailableActions(context, includeInteractiveActions); })); } - function getEditsForRefactor(context, refactorName13, actionName2, interactiveRefactorArguments) { - const refactor = refactors.get(refactorName13); + function getEditsForRefactor(context, refactorName14, actionName2, interactiveRefactorArguments) { + const refactor = refactors.get(refactorName14); return refactor && refactor.getEditsForAction(context, actionName2, interactiveRefactorArguments); } var refactors; @@ -133961,18 +135757,18 @@ ${lanes.join("\n")} } const noSymbolError = (id) => isIdentifier(id) && checker.getSymbolAtLocation(id) ? void 0 : { error: getLocaleSpecificMessage(Diagnostics.Can_only_convert_named_export) }; switch (exportNode.kind) { - case 261 /* FunctionDeclaration */: - case 262 /* ClassDeclaration */: - case 263 /* InterfaceDeclaration */: - case 265 /* EnumDeclaration */: - case 264 /* TypeAliasDeclaration */: - case 266 /* ModuleDeclaration */: { + case 262 /* FunctionDeclaration */: + case 263 /* ClassDeclaration */: + case 264 /* InterfaceDeclaration */: + case 266 /* EnumDeclaration */: + case 265 /* TypeAliasDeclaration */: + case 267 /* ModuleDeclaration */: { const node = exportNode; if (!node.name) return void 0; return noSymbolError(node.name) || { exportNode: node, exportName: node.name, wasDefault, exportingModuleSymbol }; } - case 242 /* VariableStatement */: { + case 243 /* VariableStatement */: { const vs = exportNode; if (!(vs.declarationList.flags & 2 /* Const */) || vs.declarationList.declarations.length !== 1) { return void 0; @@ -133983,7 +135779,7 @@ ${lanes.join("\n")} Debug.assert(!wasDefault, "Can't have a default flag here"); return noSymbolError(decl.name) || { exportNode: vs, exportName: decl.name, wasDefault, exportingModuleSymbol }; } - case 276 /* ExportAssignment */: { + case 277 /* ExportAssignment */: { const node = exportNode; if (node.isExportEquals) return void 0; @@ -134015,20 +135811,20 @@ ${lanes.join("\n")} } else { const exportKeyword = Debug.checkDefined(findModifier(exportNode, 95 /* ExportKeyword */), "Should find an export keyword in modifier list"); switch (exportNode.kind) { - case 261 /* FunctionDeclaration */: - case 262 /* ClassDeclaration */: - case 263 /* InterfaceDeclaration */: + case 262 /* FunctionDeclaration */: + case 263 /* ClassDeclaration */: + case 264 /* InterfaceDeclaration */: changes.insertNodeAfter(exportingSourceFile, exportKeyword, factory.createToken(90 /* DefaultKeyword */)); break; - case 242 /* VariableStatement */: + case 243 /* VariableStatement */: const decl = first(exportNode.declarationList.declarations); if (!ts_FindAllReferences_exports.Core.isSymbolReferencedInFile(exportName, checker, exportingSourceFile) && !decl.type) { changes.replaceNode(exportingSourceFile, exportNode, factory.createExportDefault(Debug.checkDefined(decl.initializer, "Initializer was previously known to be present"))); break; } - case 265 /* EnumDeclaration */: - case 264 /* TypeAliasDeclaration */: - case 266 /* ModuleDeclaration */: + case 266 /* EnumDeclaration */: + case 265 /* TypeAliasDeclaration */: + case 267 /* ModuleDeclaration */: changes.deleteModifier(exportingSourceFile, exportKeyword); changes.insertNodeAfter(exportingSourceFile, exportNode, factory.createExportDefault(factory.createIdentifier(exportName.text))); break; @@ -134054,23 +135850,23 @@ ${lanes.join("\n")} function changeDefaultToNamedImport(importingSourceFile, ref, changes, exportName) { const { parent: parent2 } = ref; switch (parent2.kind) { - case 210 /* PropertyAccessExpression */: + case 211 /* PropertyAccessExpression */: changes.replaceNode(importingSourceFile, ref, factory.createIdentifier(exportName)); break; - case 275 /* ImportSpecifier */: - case 280 /* ExportSpecifier */: { + case 276 /* ImportSpecifier */: + case 281 /* ExportSpecifier */: { const spec = parent2; changes.replaceNode(importingSourceFile, spec, makeImportSpecifier(exportName, spec.name.text)); break; } - case 272 /* ImportClause */: { + case 273 /* ImportClause */: { const clause = parent2; Debug.assert(clause.name === ref, "Import clause name should match provided ref"); const spec = makeImportSpecifier(exportName, ref.text); const { namedBindings } = clause; if (!namedBindings) { changes.replaceNode(importingSourceFile, ref, factory.createNamedImports([spec])); - } else if (namedBindings.kind === 273 /* NamespaceImport */) { + } else if (namedBindings.kind === 274 /* NamespaceImport */) { changes.deleteRange(importingSourceFile, { pos: ref.getStart(importingSourceFile), end: namedBindings.getStart(importingSourceFile) }); const quotePreference = isStringLiteral(clause.parent.moduleSpecifier) ? quotePreferenceFromString(clause.parent.moduleSpecifier, importingSourceFile) : 1 /* Double */; const newImport = makeImport( @@ -134087,7 +135883,7 @@ ${lanes.join("\n")} } break; } - case 204 /* ImportType */: + case 205 /* ImportType */: const importTypeNode = parent2; changes.replaceNode(importingSourceFile, parent2, factory.createImportTypeNode(importTypeNode.argument, importTypeNode.assertions, factory.createIdentifier(exportName), importTypeNode.typeArguments, importTypeNode.isTypeOf)); break; @@ -134098,10 +135894,10 @@ ${lanes.join("\n")} function changeNamedToDefaultImport(importingSourceFile, ref, changes) { const parent2 = ref.parent; switch (parent2.kind) { - case 210 /* PropertyAccessExpression */: + case 211 /* PropertyAccessExpression */: changes.replaceNode(importingSourceFile, ref, factory.createIdentifier("default")); break; - case 275 /* ImportSpecifier */: { + case 276 /* ImportSpecifier */: { const defaultImport = factory.createIdentifier(parent2.name.text); if (parent2.parent.elements.length === 1) { changes.replaceNode(importingSourceFile, parent2.parent, defaultImport); @@ -134111,7 +135907,7 @@ ${lanes.join("\n")} } break; } - case 280 /* ExportSpecifier */: { + case 281 /* ExportSpecifier */: { changes.replaceNode(importingSourceFile, parent2, makeExportSpecifier("default", parent2.name.text)); break; } @@ -134154,12 +135950,12 @@ ${lanes.join("\n")} refactorName = "Convert export"; defaultToNamedAction = { name: "Convert default export to named export", - description: Diagnostics.Convert_default_export_to_named_export.message, + description: getLocaleSpecificMessage(Diagnostics.Convert_default_export_to_named_export), kind: "refactor.rewrite.export.named" }; namedToDefaultAction = { name: "Convert named export to default export", - description: Diagnostics.Convert_named_export_to_default_export.message, + description: getLocaleSpecificMessage(Diagnostics.Convert_named_export_to_default_export), kind: "refactor.rewrite.export.default" }; registerRefactor(refactorName, { @@ -134177,7 +135973,7 @@ ${lanes.join("\n")} } if (context.preferences.provideRefactorNotApplicableReason) { return [ - { name: refactorName, description: Diagnostics.Convert_default_export_to_named_export.message, actions: [ + { name: refactorName, description: getLocaleSpecificMessage(Diagnostics.Convert_default_export_to_named_export), actions: [ { ...defaultToNamedAction, notApplicableReason: info.error }, { ...namedToDefaultAction, notApplicableReason: info.error } ] } @@ -134215,7 +136011,7 @@ ${lanes.join("\n")} if (!importClause.namedBindings) { return { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_namespace_import_or_named_imports) }; } - if (importClause.namedBindings.kind === 273 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 274 /* NamespaceImport */) { return { convertTo: 0 /* Named */, import: importClause.namedBindings }; } const shouldUseDefault = getShouldUseDefault(context.program, importClause); @@ -134379,17 +136175,17 @@ ${lanes.join("\n")} actions = { [0 /* Named */]: { name: "Convert namespace import to named imports", - description: Diagnostics.Convert_namespace_import_to_named_imports.message, + description: getLocaleSpecificMessage(Diagnostics.Convert_namespace_import_to_named_imports), kind: "refactor.rewrite.import.named" }, [2 /* Namespace */]: { name: "Convert named imports to namespace import", - description: Diagnostics.Convert_named_imports_to_namespace_import.message, + description: getLocaleSpecificMessage(Diagnostics.Convert_named_imports_to_namespace_import), kind: "refactor.rewrite.import.namespace" }, [1 /* Default */]: { name: "Convert named imports to default import", - description: Diagnostics.Convert_named_imports_to_default_import.message, + description: getLocaleSpecificMessage(Diagnostics.Convert_named_imports_to_default_import), kind: "refactor.rewrite.import.default" } }; @@ -134736,6 +136532,158 @@ ${lanes.join("\n")} } }); + // src/services/refactors/inlineVariable.ts + function getInliningInfo(file, startPosition, tryWithReferenceToken, program) { + var _a, _b; + const checker = program.getTypeChecker(); + const token = getTouchingPropertyName(file, startPosition); + const parent2 = token.parent; + if (!isIdentifier(token)) { + return void 0; + } + if (isInitializedVariable(parent2) && isVariableDeclarationInVariableStatement(parent2) && isIdentifier(parent2.name)) { + if (((_a = checker.getMergedSymbol(parent2.symbol).declarations) == null ? void 0 : _a.length) !== 1) { + return { error: getLocaleSpecificMessage(Diagnostics.Variables_with_multiple_declarations_cannot_be_inlined) }; + } + if (isDeclarationExported(parent2)) { + return void 0; + } + const references = getReferenceNodes(parent2, checker, file); + return references && { references, declaration: parent2, replacement: parent2.initializer }; + } + if (tryWithReferenceToken) { + let definition = checker.resolveName( + token.text, + token, + 111551 /* Value */, + /*excludeGlobals*/ + false + ); + definition = definition && checker.getMergedSymbol(definition); + if (((_b = definition == null ? void 0 : definition.declarations) == null ? void 0 : _b.length) !== 1) { + return { error: getLocaleSpecificMessage(Diagnostics.Variables_with_multiple_declarations_cannot_be_inlined) }; + } + const declaration = definition.declarations[0]; + if (!isInitializedVariable(declaration) || !isVariableDeclarationInVariableStatement(declaration) || !isIdentifier(declaration.name)) { + return void 0; + } + if (isDeclarationExported(declaration)) { + return void 0; + } + const references = getReferenceNodes(declaration, checker, file); + return references && { references, declaration, replacement: declaration.initializer }; + } + return { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_variable_to_inline) }; + } + function isDeclarationExported(declaration) { + const variableStatement = cast(declaration.parent.parent, isVariableStatement); + return some(variableStatement.modifiers, isExportModifier); + } + function getReferenceNodes(declaration, checker, file) { + const references = []; + const cannotInline = ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(declaration.name, checker, file, (ref) => { + if (ts_FindAllReferences_exports.isWriteAccessForReference(ref)) { + return true; + } + if (isExportSpecifier(ref.parent) || isExportAssignment(ref.parent)) { + return true; + } + if (isTypeQueryNode(ref.parent)) { + return true; + } + if (textRangeContainsPositionInclusive(declaration, ref.pos)) { + return true; + } + references.push(ref); + }); + return references.length === 0 || cannotInline ? void 0 : references; + } + function getReplacementExpression(reference, replacement) { + replacement = getSynthesizedDeepClone(replacement); + const { parent: parent2 } = reference; + if (isExpression(parent2) && (getExpressionPrecedence(replacement) < getExpressionPrecedence(parent2) || needsParentheses(parent2))) { + return factory.createParenthesizedExpression(replacement); + } + if (isFunctionLike(replacement) && (isCallLikeExpression(parent2) || isPropertyAccessExpression(parent2))) { + return factory.createParenthesizedExpression(replacement); + } + if (isPropertyAccessExpression(parent2) && (isNumericLiteral(replacement) || isObjectLiteralExpression(replacement))) { + return factory.createParenthesizedExpression(replacement); + } + return replacement; + } + var refactorName4, refactorDescription, inlineVariableAction; + var init_inlineVariable = __esm({ + "src/services/refactors/inlineVariable.ts"() { + "use strict"; + init_ts4(); + init_ts_refactor(); + refactorName4 = "Inline variable"; + refactorDescription = getLocaleSpecificMessage(Diagnostics.Inline_variable); + inlineVariableAction = { + name: refactorName4, + description: refactorDescription, + kind: "refactor.inline.variable" + }; + registerRefactor(refactorName4, { + kinds: [inlineVariableAction.kind], + getAvailableActions(context) { + const { + file, + program, + preferences, + startPosition, + triggerReason + } = context; + const info = getInliningInfo(file, startPosition, triggerReason === "invoked", program); + if (!info) { + return emptyArray; + } + if (!ts_refactor_exports.isRefactorErrorInfo(info)) { + return [{ + name: refactorName4, + description: refactorDescription, + actions: [inlineVariableAction] + }]; + } + if (preferences.provideRefactorNotApplicableReason) { + return [{ + name: refactorName4, + description: refactorDescription, + actions: [{ + ...inlineVariableAction, + notApplicableReason: info.error + }] + }]; + } + return emptyArray; + }, + getEditsForAction(context, actionName2) { + Debug.assert(actionName2 === refactorName4, "Unexpected refactor invoked"); + const { file, program, startPosition } = context; + const info = getInliningInfo( + file, + startPosition, + /*tryWithReferenceToken*/ + true, + program + ); + if (!info || ts_refactor_exports.isRefactorErrorInfo(info)) { + return void 0; + } + const { references, declaration, replacement } = info; + const edits = ts_textChanges_exports.ChangeTracker.with(context, (tracker) => { + for (const node of references) { + tracker.replaceNode(file, node, getReplacementExpression(node, replacement)); + } + tracker.delete(file, declaration); + }); + return { edits }; + } + }); + } + }); + // src/services/refactors/moveToNewFile.ts function doChange3(oldFile, program, toMove, changes, host, preferences, context) { const checker = program.getTypeChecker(); @@ -134817,29 +136765,29 @@ ${lanes.join("\n")} append(copiedOldImports, makeImportOrRequire(oldFile, oldFileDefault, oldFileNamedImports, getBaseFileName(oldFile.fileName), program, host, useEsModuleSyntax, quotePreference)); return copiedOldImports; } - var refactorName4, description, moveToNewFileAction; + var refactorName5, description, moveToNewFileAction; var init_moveToNewFile = __esm({ "src/services/refactors/moveToNewFile.ts"() { "use strict"; init_ts4(); init_ts_refactor(); - refactorName4 = "Move to a new file"; + refactorName5 = "Move to a new file"; description = getLocaleSpecificMessage(Diagnostics.Move_to_a_new_file); moveToNewFileAction = { - name: refactorName4, + name: refactorName5, description, kind: "refactor.move.newFile" }; - registerRefactor(refactorName4, { + registerRefactor(refactorName5, { kinds: [moveToNewFileAction.kind], getAvailableActions: function getRefactorActionsToMoveToNewFile(context) { const statements = getStatementsToMove(context); if (context.preferences.allowTextChangesInNewFiles && statements) { - return [{ name: refactorName4, description, actions: [moveToNewFileAction] }]; + return [{ name: refactorName5, description, actions: [moveToNewFileAction] }]; } if (context.preferences.provideRefactorNotApplicableReason) { return [{ - name: refactorName4, + name: refactorName5, description, actions: [{ ...moveToNewFileAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Selection_is_not_a_valid_statement_or_statements) }] }]; @@ -134847,7 +136795,7 @@ ${lanes.join("\n")} return emptyArray; }, getEditsForAction: function getRefactorEditsToMoveToNewFile(context, actionName2) { - Debug.assert(actionName2 === refactorName4, "Wrong refactor invoked"); + Debug.assert(actionName2 === refactorName5, "Wrong refactor invoked"); const statements = Debug.checkDefined(getStatementsToMove(context)); const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange3(context.file, context.program, statements, t, context.host, context.preferences, context)); return { edits, renameFilename: void 0, renameLocation: void 0 }; @@ -134857,6 +136805,9 @@ ${lanes.join("\n")} }); // src/services/refactors/moveToFile.ts + function error(notApplicableReason) { + return { edits: [], renameFilename: void 0, renameLocation: void 0, notApplicableReason }; + } function doChange4(context, oldFile, targetFile, program, toMove, changes, host, preferences) { const checker = program.getTypeChecker(); const usage = getUsageInfo(oldFile, toMove.all, checker); @@ -134897,7 +136848,7 @@ ${lanes.join("\n")} const body = addExports(oldFile, toMove.all, usage.oldFileImportsFromTargetFile, useEsModuleSyntax); if (typeof targetFile !== "string") { if (targetFile.statements.length > 0) { - changes.insertNodesAfter(targetFile, targetFile.statements[targetFile.statements.length - 1], body); + moveStatementsToTargetFile(changes, program, body, targetFile, toMove); } else { changes.insertNodesAtEndOfFile( targetFile, @@ -134918,7 +136869,7 @@ ${lanes.join("\n")} } } if (importAdder) { - importAdder.writeFixes(changes); + importAdder.writeFixes(changes, quotePreference); } if (imports.length && body.length) { return [ @@ -135048,11 +136999,11 @@ ${lanes.join("\n")} } function getNamespaceLikeImport(node) { switch (node.kind) { - case 271 /* ImportDeclaration */: - return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 273 /* NamespaceImport */ ? node.importClause.namedBindings.name : void 0; - case 270 /* ImportEqualsDeclaration */: + case 272 /* ImportDeclaration */: + return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 274 /* NamespaceImport */ ? node.importClause.namedBindings.name : void 0; + case 271 /* ImportEqualsDeclaration */: return node.name; - case 259 /* VariableDeclaration */: + case 260 /* VariableDeclaration */: return tryCast(node.name, isIdentifier); default: return Debug.assertNever(node, `Unexpected node kind ${node.kind}`); @@ -135088,7 +137039,7 @@ ${lanes.join("\n")} const newNamespaceId = factory.createIdentifier(newNamespaceName); const newModuleString = makeStringLiteral(newModuleSpecifier, quotePreference); switch (node.kind) { - case 271 /* ImportDeclaration */: + case 272 /* ImportDeclaration */: return factory.createImportDeclaration( /*modifiers*/ void 0, @@ -135103,7 +137054,7 @@ ${lanes.join("\n")} /*assertClause*/ void 0 ); - case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportEqualsDeclaration */: return factory.createImportEqualsDeclaration( /*modifiers*/ void 0, @@ -135112,7 +137063,7 @@ ${lanes.join("\n")} newNamespaceId, factory.createExternalModuleReference(newModuleString) ); - case 259 /* VariableDeclaration */: + case 260 /* VariableDeclaration */: return factory.createVariableDeclaration( newNamespaceId, /*exclamationToken*/ @@ -135134,7 +137085,7 @@ ${lanes.join("\n")} ); } function moduleSpecifierFromImport(i) { - return i.kind === 271 /* ImportDeclaration */ ? i.moduleSpecifier : i.kind === 270 /* ImportEqualsDeclaration */ ? i.moduleReference.expression : i.initializer.arguments[0]; + return i.kind === 272 /* ImportDeclaration */ ? i.moduleSpecifier : i.kind === 271 /* ImportEqualsDeclaration */ ? i.moduleReference.expression : i.initializer.arguments[0]; } function forEachImportInStatement(statement, cb) { if (isImportDeclaration(statement)) { @@ -135232,15 +137183,15 @@ ${lanes.join("\n")} } function deleteUnusedImports(sourceFile, importDecl, changes, isUnused) { switch (importDecl.kind) { - case 271 /* ImportDeclaration */: + case 272 /* ImportDeclaration */: deleteUnusedImportsInDeclaration(sourceFile, importDecl, changes, isUnused); break; - case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportEqualsDeclaration */: if (isUnused(importDecl.name)) { changes.delete(sourceFile, importDecl); } break; - case 259 /* VariableDeclaration */: + case 260 /* VariableDeclaration */: deleteUnusedImportsInVariableDeclaration(sourceFile, importDecl, changes, isUnused); break; default: @@ -135252,7 +137203,7 @@ ${lanes.join("\n")} return; const { name, namedBindings } = importDecl.importClause; const defaultUnused = !name || isUnused(name); - const namedBindingsUnused = !namedBindings || (namedBindings.kind === 273 /* NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every((e) => isUnused(e.name))); + const namedBindingsUnused = !namedBindings || (namedBindings.kind === 274 /* NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every((e) => isUnused(e.name))); if (defaultUnused && namedBindingsUnused) { changes.delete(sourceFile, importDecl); } else { @@ -135272,7 +137223,7 @@ ${lanes.join("\n")} void 0 ) ); - } else if (namedBindings.kind === 274 /* NamedImports */) { + } else if (namedBindings.kind === 275 /* NamedImports */) { for (const element of namedBindings.elements) { if (isUnused(element.name)) changes.delete(sourceFile, element); @@ -135300,9 +137251,9 @@ ${lanes.join("\n")} } } break; - case 206 /* ArrayBindingPattern */: + case 207 /* ArrayBindingPattern */: break; - case 205 /* ObjectBindingPattern */: + case 206 /* ObjectBindingPattern */: if (name.elements.every((e) => isIdentifier(e.name) && isUnused(e.name))) { changes.delete( sourceFile, @@ -135328,24 +137279,24 @@ ${lanes.join("\n")} function addEs6Export(d) { const modifiers = canHaveModifiers(d) ? concatenate([factory.createModifier(95 /* ExportKeyword */)], getModifiers(d)) : void 0; switch (d.kind) { - case 261 /* FunctionDeclaration */: + case 262 /* FunctionDeclaration */: return factory.updateFunctionDeclaration(d, modifiers, d.asteriskToken, d.name, d.typeParameters, d.parameters, d.type, d.body); - case 262 /* ClassDeclaration */: + case 263 /* ClassDeclaration */: const decorators = canHaveDecorators(d) ? getDecorators(d) : void 0; return factory.updateClassDeclaration(d, concatenate(decorators, modifiers), d.name, d.typeParameters, d.heritageClauses, d.members); - case 242 /* VariableStatement */: + case 243 /* VariableStatement */: return factory.updateVariableStatement(d, modifiers, d.declarationList); - case 266 /* ModuleDeclaration */: + case 267 /* ModuleDeclaration */: return factory.updateModuleDeclaration(d, modifiers, d.name, d.body); - case 265 /* EnumDeclaration */: + case 266 /* EnumDeclaration */: return factory.updateEnumDeclaration(d, modifiers, d.name, d.members); - case 264 /* TypeAliasDeclaration */: + case 265 /* TypeAliasDeclaration */: return factory.updateTypeAliasDeclaration(d, modifiers, d.name, d.typeParameters, d.type); - case 263 /* InterfaceDeclaration */: + case 264 /* InterfaceDeclaration */: return factory.updateInterfaceDeclaration(d, modifiers, d.name, d.typeParameters, d.heritageClauses, d.members); - case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportEqualsDeclaration */: return factory.updateImportEqualsDeclaration(d, modifiers, d.isTypeOnly, d.name, d.moduleReference); - case 243 /* ExpressionStatement */: + case 244 /* ExpressionStatement */: return Debug.fail(); default: return Debug.assertNever(d, `Unexpected declaration kind ${d.kind}`); @@ -135365,18 +137316,18 @@ ${lanes.join("\n")} } function getNamesToExportInCommonJS(decl) { switch (decl.kind) { - case 261 /* FunctionDeclaration */: - case 262 /* ClassDeclaration */: + case 262 /* FunctionDeclaration */: + case 263 /* ClassDeclaration */: return [decl.name.text]; - case 242 /* VariableStatement */: + case 243 /* VariableStatement */: return mapDefined(decl.declarationList.declarations, (d) => isIdentifier(d.name) ? d.name.text : void 0); - case 266 /* ModuleDeclaration */: - case 265 /* EnumDeclaration */: - case 264 /* TypeAliasDeclaration */: - case 263 /* InterfaceDeclaration */: - case 270 /* ImportEqualsDeclaration */: + case 267 /* ModuleDeclaration */: + case 266 /* EnumDeclaration */: + case 265 /* TypeAliasDeclaration */: + case 264 /* InterfaceDeclaration */: + case 271 /* ImportEqualsDeclaration */: return emptyArray; - case 243 /* ExpressionStatement */: + case 244 /* ExpressionStatement */: return Debug.fail("Can't export an ExpressionStatement"); default: return Debug.assertNever(decl, `Unexpected decl kind ${decl.kind}`); @@ -135384,7 +137335,7 @@ ${lanes.join("\n")} } function filterImport(i, moduleSpecifier, keep) { switch (i.kind) { - case 271 /* ImportDeclaration */: { + case 272 /* ImportDeclaration */: { const clause = i.importClause; if (!clause) return void 0; @@ -135399,9 +137350,9 @@ ${lanes.join("\n")} void 0 ) : void 0; } - case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportEqualsDeclaration */: return keep(i.name) ? i : void 0; - case 259 /* VariableDeclaration */: { + case 260 /* VariableDeclaration */: { const name = filterBindingName(i.name, keep); return name ? makeVariableStatement(name, i.type, createRequireCall(moduleSpecifier), i.parent.flags) : void 0; } @@ -135410,7 +137361,7 @@ ${lanes.join("\n")} } } function filterNamedBindings(namedBindings, keep) { - if (namedBindings.kind === 273 /* NamespaceImport */) { + if (namedBindings.kind === 274 /* NamespaceImport */) { return keep(namedBindings.name) ? namedBindings : void 0; } else { const newElements = namedBindings.elements.filter((e) => keep(e.name)); @@ -135421,9 +137372,9 @@ ${lanes.join("\n")} switch (name.kind) { case 80 /* Identifier */: return keep(name) ? name : void 0; - case 206 /* ArrayBindingPattern */: + case 207 /* ArrayBindingPattern */: return name; - case 205 /* ObjectBindingPattern */: { + case 206 /* ObjectBindingPattern */: { const newElements = name.elements.filter((prop) => prop.propertyName || !isIdentifier(prop.name) || keep(prop.name)); return newElements.length ? factory.createObjectBindingPattern(newElements) : void 0; } @@ -135434,9 +137385,9 @@ ${lanes.join("\n")} } function getTopLevelDeclarationStatement(d) { switch (d.kind) { - case 259 /* VariableDeclaration */: + case 260 /* VariableDeclaration */: return d.parent.parent; - case 207 /* BindingElement */: + case 208 /* BindingElement */: return getTopLevelDeclarationStatement( cast(d.parent.parent, (p) => isVariableDeclaration(p) || isBindingElement(p)) ); @@ -135484,21 +137435,25 @@ ${lanes.join("\n")} const { file } = context; const range = createTextRangeFromSpan(getRefactorContextSpan(context)); const { statements } = file; - const startNodeIndex = findIndex(statements, (s) => s.end > range.pos); + let startNodeIndex = findIndex(statements, (s) => s.end > range.pos); if (startNodeIndex === -1) return void 0; const startStatement = statements[startNodeIndex]; - if (isNamedDeclaration(startStatement) && startStatement.name && rangeContainsRange(startStatement.name, range)) { - return { toMove: [statements[startNodeIndex]], afterLast: statements[startNodeIndex + 1] }; + const overloadRangeToMove = getOverloadRangeToMove(file, startStatement); + if (overloadRangeToMove) { + startNodeIndex = overloadRangeToMove.start; + } + let endNodeIndex = findIndex(statements, (s) => s.end >= range.end, startNodeIndex); + if (endNodeIndex !== -1 && range.end <= statements[endNodeIndex].getStart()) { + endNodeIndex--; + } + const endingOverloadRangeToMove = getOverloadRangeToMove(file, statements[endNodeIndex]); + if (endingOverloadRangeToMove) { + endNodeIndex = endingOverloadRangeToMove.end; } - if (range.pos > startStatement.getStart(file)) - return void 0; - const afterEndNodeIndex = findIndex(statements, (s) => s.end > range.end, startNodeIndex); - if (afterEndNodeIndex !== -1 && (afterEndNodeIndex === 0 || statements[afterEndNodeIndex].getStart(file) < range.end)) - return void 0; return { - toMove: statements.slice(startNodeIndex, afterEndNodeIndex === -1 ? statements.length : afterEndNodeIndex), - afterLast: afterEndNodeIndex === -1 ? void 0 : statements[afterEndNodeIndex] + toMove: statements.slice(startNodeIndex, endNodeIndex === -1 ? statements.length : endNodeIndex + 1), + afterLast: endNodeIndex === -1 ? void 0 : statements[endNodeIndex + 1] }; } function getStatementsToMove(context) { @@ -135520,11 +137475,11 @@ ${lanes.join("\n")} } function isPureImport(node) { switch (node.kind) { - case 271 /* ImportDeclaration */: + case 272 /* ImportDeclaration */: return true; - case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportEqualsDeclaration */: return !hasSyntacticModifier(node, 1 /* Export */); - case 242 /* VariableStatement */: + case 243 /* VariableStatement */: return node.declarationList.declarations.every((d) => !!d.initializer && isRequireCall( d.initializer, /*requireStringLiteralLikeArgument*/ @@ -135617,17 +137572,17 @@ ${lanes.join("\n")} } function forEachTopLevelDeclaration(statement, cb) { switch (statement.kind) { - case 261 /* FunctionDeclaration */: - case 262 /* ClassDeclaration */: - case 266 /* ModuleDeclaration */: - case 265 /* EnumDeclaration */: - case 264 /* TypeAliasDeclaration */: - case 263 /* InterfaceDeclaration */: - case 270 /* ImportEqualsDeclaration */: + case 262 /* FunctionDeclaration */: + case 263 /* ClassDeclaration */: + case 267 /* ModuleDeclaration */: + case 266 /* EnumDeclaration */: + case 265 /* TypeAliasDeclaration */: + case 264 /* InterfaceDeclaration */: + case 271 /* ImportEqualsDeclaration */: return cb(statement); - case 242 /* VariableStatement */: + case 243 /* VariableStatement */: return firstDefined(statement.declarationList.declarations, (decl) => forEachTopLevelDeclarationInBindingName(decl.name, cb)); - case 243 /* ExpressionStatement */: { + case 244 /* ExpressionStatement */: { const { expression } = statement; return isBinaryExpression(expression) && getAssignmentDeclarationKind(expression) === 1 /* ExportsProperty */ ? cb(statement) : void 0; } @@ -135635,14 +137590,14 @@ ${lanes.join("\n")} } function isInImport(decl) { switch (decl.kind) { - case 270 /* ImportEqualsDeclaration */: - case 275 /* ImportSpecifier */: - case 272 /* ImportClause */: - case 273 /* NamespaceImport */: + case 271 /* ImportEqualsDeclaration */: + case 276 /* ImportSpecifier */: + case 273 /* ImportClause */: + case 274 /* NamespaceImport */: return true; - case 259 /* VariableDeclaration */: + case 260 /* VariableDeclaration */: return isVariableDeclarationInImport(decl); - case 207 /* BindingElement */: + case 208 /* BindingElement */: return isVariableDeclaration(decl.parent.parent) && isVariableDeclarationInImport(decl.parent.parent); default: return false; @@ -135665,8 +137620,8 @@ ${lanes.join("\n")} switch (name.kind) { case 80 /* Identifier */: return cb(cast(name.parent, (x) => isVariableDeclaration(x) || isBindingElement(x))); - case 206 /* ArrayBindingPattern */: - case 205 /* ObjectBindingPattern */: + case 207 /* ArrayBindingPattern */: + case 206 /* ObjectBindingPattern */: return firstDefined(name.elements, (em) => isOmittedExpression(em) ? void 0 : forEachTopLevelDeclarationInBindingName(em.name, cb)); default: return Debug.assertNever(name, `Unexpected name kind ${name.kind}`); @@ -135674,18 +137629,94 @@ ${lanes.join("\n")} } function isNonVariableTopLevelDeclaration(node) { switch (node.kind) { - case 261 /* FunctionDeclaration */: - case 262 /* ClassDeclaration */: - case 266 /* ModuleDeclaration */: - case 265 /* EnumDeclaration */: - case 264 /* TypeAliasDeclaration */: - case 263 /* InterfaceDeclaration */: - case 270 /* ImportEqualsDeclaration */: + case 262 /* FunctionDeclaration */: + case 263 /* ClassDeclaration */: + case 267 /* ModuleDeclaration */: + case 266 /* EnumDeclaration */: + case 265 /* TypeAliasDeclaration */: + case 264 /* InterfaceDeclaration */: + case 271 /* ImportEqualsDeclaration */: return true; default: return false; } } + function moveStatementsToTargetFile(changes, program, statements, targetFile, toMove) { + var _a; + const removedExports = /* @__PURE__ */ new Set(); + const targetExports = (_a = targetFile.symbol) == null ? void 0 : _a.exports; + if (targetExports) { + const checker = program.getTypeChecker(); + const targetToSourceExports = /* @__PURE__ */ new Map(); + for (const node of toMove.all) { + if (isTopLevelDeclarationStatement(node) && hasSyntacticModifier(node, 1 /* Export */)) { + forEachTopLevelDeclaration(node, (declaration) => { + var _a2; + const targetDeclarations = canHaveSymbol(declaration) ? (_a2 = targetExports.get(declaration.symbol.escapedName)) == null ? void 0 : _a2.declarations : void 0; + const exportDeclaration = firstDefined(targetDeclarations, (d) => isExportDeclaration(d) ? d : isExportSpecifier(d) ? tryCast(d.parent.parent, isExportDeclaration) : void 0); + if (exportDeclaration && exportDeclaration.moduleSpecifier) { + targetToSourceExports.set( + exportDeclaration, + (targetToSourceExports.get(exportDeclaration) || /* @__PURE__ */ new Set()).add(declaration) + ); + } + }); + } + } + for (const [exportDeclaration, topLevelDeclarations] of arrayFrom(targetToSourceExports)) { + if (exportDeclaration.exportClause && isNamedExports(exportDeclaration.exportClause) && length(exportDeclaration.exportClause.elements)) { + const elements = exportDeclaration.exportClause.elements; + const updatedElements = filter(elements, (elem) => find(skipAlias(elem.symbol, checker).declarations, (d) => isTopLevelDeclaration(d) && topLevelDeclarations.has(d)) === void 0); + if (length(updatedElements) === 0) { + changes.deleteNode(targetFile, exportDeclaration); + removedExports.add(exportDeclaration); + continue; + } + if (length(updatedElements) < length(elements)) { + changes.replaceNode( + targetFile, + exportDeclaration, + factory.updateExportDeclaration( + exportDeclaration, + exportDeclaration.modifiers, + exportDeclaration.isTypeOnly, + factory.updateNamedExports(exportDeclaration.exportClause, factory.createNodeArray(updatedElements, elements.hasTrailingComma)), + exportDeclaration.moduleSpecifier, + exportDeclaration.assertClause + ) + ); + } + } + } + } + const lastReExport = findLast(targetFile.statements, (n) => isExportDeclaration(n) && !!n.moduleSpecifier && !removedExports.has(n)); + if (lastReExport) { + changes.insertNodesBefore( + targetFile, + lastReExport, + statements, + /*blankLineBetween*/ + true + ); + } else { + changes.insertNodesAfter(targetFile, targetFile.statements[targetFile.statements.length - 1], statements); + } + } + function getOverloadRangeToMove(sourceFile, statement) { + if (isFunctionLikeDeclaration(statement)) { + const declarations = statement.symbol.declarations; + if (declarations === void 0 || length(declarations) <= 1 || !contains(declarations, statement)) { + return void 0; + } + const firstDecl = declarations[0]; + const lastDecl = declarations[length(declarations) - 1]; + const statementsToMove = mapDefined(declarations, (d) => getSourceFileOfNode(d) === sourceFile && isStatement(d) ? d : void 0); + const end = findIndex(sourceFile.statements, (s) => s.end >= lastDecl.end); + const start = findIndex(sourceFile.statements, (s) => s.end >= firstDecl.end); + return { toMove: statementsToMove, start, end }; + } + return void 0; + } var refactorNameForMoveToFile, description2, moveToFileAction; var init_moveToFile = __esm({ "src/services/refactors/moveToFile.ts"() { @@ -135722,13 +137753,17 @@ ${lanes.join("\n")} getEditsForAction: function getRefactorEditsToMoveToFile(context, actionName2, interactiveRefactorArguments) { Debug.assert(actionName2 === refactorNameForMoveToFile, "Wrong refactor invoked"); const statements = Debug.checkDefined(getStatementsToMove(context)); + const { host, program } = context; Debug.assert(interactiveRefactorArguments, "No interactive refactor arguments available"); const targetFile = interactiveRefactorArguments.targetFile; if (hasJSFileExtension(targetFile) || hasTSFileExtension(targetFile)) { + if (host.fileExists(targetFile) && program.getSourceFile(targetFile) === void 0) { + return error(getLocaleSpecificMessage(Diagnostics.Cannot_move_statements_to_the_selected_file)); + } const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(context, context.file, interactiveRefactorArguments.targetFile, context.program, statements, t, context.host, context.preferences)); return { edits, renameFilename: void 0, renameLocation: void 0 }; } - return { edits: [], renameFilename: void 0, renameLocation: void 0, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Cannot_move_to_file_selected_file_is_invalid) }; + return error(getLocaleSpecificMessage(Diagnostics.Cannot_move_to_file_selected_file_is_invalid)); } }); } @@ -135741,8 +137776,8 @@ ${lanes.join("\n")} if (!info) return emptyArray; return [{ - name: refactorName5, - description: refactorDescription, + name: refactorName6, + description: refactorDescription2, actions: [functionOverloadAction] }]; } @@ -135755,7 +137790,7 @@ ${lanes.join("\n")} const lastDeclaration = signatureDecls[signatureDecls.length - 1]; let updated = lastDeclaration; switch (lastDeclaration.kind) { - case 172 /* MethodSignature */: { + case 173 /* MethodSignature */: { updated = factory.updateMethodSignature( lastDeclaration, lastDeclaration.modifiers, @@ -135767,7 +137802,7 @@ ${lanes.join("\n")} ); break; } - case 173 /* MethodDeclaration */: { + case 174 /* MethodDeclaration */: { updated = factory.updateMethodDeclaration( lastDeclaration, lastDeclaration.modifiers, @@ -135781,7 +137816,7 @@ ${lanes.join("\n")} ); break; } - case 178 /* CallSignature */: { + case 179 /* CallSignature */: { updated = factory.updateCallSignature( lastDeclaration, lastDeclaration.typeParameters, @@ -135790,7 +137825,7 @@ ${lanes.join("\n")} ); break; } - case 175 /* Constructor */: { + case 176 /* Constructor */: { updated = factory.updateConstructorDeclaration( lastDeclaration, lastDeclaration.modifiers, @@ -135799,7 +137834,7 @@ ${lanes.join("\n")} ); break; } - case 179 /* ConstructSignature */: { + case 180 /* ConstructSignature */: { updated = factory.updateConstructSignature( lastDeclaration, lastDeclaration.typeParameters, @@ -135808,7 +137843,7 @@ ${lanes.join("\n")} ); break; } - case 261 /* FunctionDeclaration */: { + case 262 /* FunctionDeclaration */: { updated = factory.updateFunctionDeclaration( lastDeclaration, lastDeclaration.modifiers, @@ -135881,12 +137916,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function isConvertableSignatureDeclaration(d) { switch (d.kind) { - case 172 /* MethodSignature */: - case 173 /* MethodDeclaration */: - case 178 /* CallSignature */: - case 175 /* Constructor */: - case 179 /* ConstructSignature */: - case 261 /* FunctionDeclaration */: + case 173 /* MethodSignature */: + case 174 /* MethodDeclaration */: + case 179 /* CallSignature */: + case 176 /* Constructor */: + case 180 /* ConstructSignature */: + case 262 /* FunctionDeclaration */: return true; } return false; @@ -135933,20 +137968,20 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return signatureDecls; } - var refactorName5, refactorDescription, functionOverloadAction; + var refactorName6, refactorDescription2, functionOverloadAction; var init_convertOverloadListToSingleSignature = __esm({ "src/services/refactors/convertOverloadListToSingleSignature.ts"() { "use strict"; init_ts4(); init_ts_refactor(); - refactorName5 = "Convert overload list to single signature"; - refactorDescription = Diagnostics.Convert_overload_list_to_single_signature.message; + refactorName6 = "Convert overload list to single signature"; + refactorDescription2 = getLocaleSpecificMessage(Diagnostics.Convert_overload_list_to_single_signature); functionOverloadAction = { - name: refactorName5, - description: refactorDescription, + name: refactorName6, + description: refactorDescription2, kind: "refactor.rewrite.function.overloadList" }; - registerRefactor(refactorName5, { + registerRefactor(refactorName6, { kinds: [functionOverloadAction.kind], getEditsForAction: getRefactorEditsToConvertOverloadsToOneSignature, getAvailableActions: getRefactorActionsToConvertOverloadsToOneSignature @@ -135962,8 +137997,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return emptyArray; if (!isRefactorErrorInfo(info)) { return [{ - name: refactorName6, - description: refactorDescription2, + name: refactorName7, + description: refactorDescription3, actions: [ info.addBraces ? addBracesAction : removeBracesAction ] @@ -135971,8 +138006,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } if (context.preferences.provideRefactorNotApplicableReason) { return [{ - name: refactorName6, - description: refactorDescription2, + name: refactorName7, + description: refactorDescription3, actions: [ { ...addBracesAction, notApplicableReason: info.error }, { ...removeBracesAction, notApplicableReason: info.error } @@ -136063,25 +138098,25 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return void 0; } - var refactorName6, refactorDescription2, addBracesAction, removeBracesAction; + var refactorName7, refactorDescription3, addBracesAction, removeBracesAction; var init_addOrRemoveBracesToArrowFunction = __esm({ "src/services/refactors/addOrRemoveBracesToArrowFunction.ts"() { "use strict"; init_ts4(); init_ts_refactor(); - refactorName6 = "Add or remove braces in an arrow function"; - refactorDescription2 = Diagnostics.Add_or_remove_braces_in_an_arrow_function.message; + refactorName7 = "Add or remove braces in an arrow function"; + refactorDescription3 = getLocaleSpecificMessage(Diagnostics.Add_or_remove_braces_in_an_arrow_function); addBracesAction = { name: "Add braces to arrow function", - description: Diagnostics.Add_braces_to_arrow_function.message, + description: getLocaleSpecificMessage(Diagnostics.Add_braces_to_arrow_function), kind: "refactor.rewrite.arrow.braces.add" }; removeBracesAction = { name: "Remove braces from arrow function", - description: Diagnostics.Remove_braces_from_arrow_function.message, + description: getLocaleSpecificMessage(Diagnostics.Remove_braces_from_arrow_function), kind: "refactor.rewrite.arrow.braces.remove" }; - registerRefactor(refactorName6, { + registerRefactor(refactorName7, { kinds: [removeBracesAction.kind], getEditsForAction: getRefactorEditsToRemoveFunctionBraces, getAvailableActions: getRefactorActionsToRemoveFunctionBraces @@ -136109,32 +138144,32 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const possibleActions = []; const errors = []; if (refactorKindBeginsWith(toNamedFunctionAction.kind, kind)) { - const error = selectedVariableDeclaration || isArrowFunction(func) && isVariableDeclaration(func.parent) ? void 0 : getLocaleSpecificMessage(Diagnostics.Could_not_convert_to_named_function); - if (error) { - errors.push({ ...toNamedFunctionAction, notApplicableReason: error }); + const error2 = selectedVariableDeclaration || isArrowFunction(func) && isVariableDeclaration(func.parent) ? void 0 : getLocaleSpecificMessage(Diagnostics.Could_not_convert_to_named_function); + if (error2) { + errors.push({ ...toNamedFunctionAction, notApplicableReason: error2 }); } else { possibleActions.push(toNamedFunctionAction); } } if (refactorKindBeginsWith(toAnonymousFunctionAction.kind, kind)) { - const error = !selectedVariableDeclaration && isArrowFunction(func) ? void 0 : getLocaleSpecificMessage(Diagnostics.Could_not_convert_to_anonymous_function); - if (error) { - errors.push({ ...toAnonymousFunctionAction, notApplicableReason: error }); + const error2 = !selectedVariableDeclaration && isArrowFunction(func) ? void 0 : getLocaleSpecificMessage(Diagnostics.Could_not_convert_to_anonymous_function); + if (error2) { + errors.push({ ...toAnonymousFunctionAction, notApplicableReason: error2 }); } else { possibleActions.push(toAnonymousFunctionAction); } } if (refactorKindBeginsWith(toArrowFunctionAction.kind, kind)) { - const error = isFunctionExpression(func) ? void 0 : getLocaleSpecificMessage(Diagnostics.Could_not_convert_to_arrow_function); - if (error) { - errors.push({ ...toArrowFunctionAction, notApplicableReason: error }); + const error2 = isFunctionExpression(func) ? void 0 : getLocaleSpecificMessage(Diagnostics.Could_not_convert_to_arrow_function); + if (error2) { + errors.push({ ...toArrowFunctionAction, notApplicableReason: error2 }); } else { possibleActions.push(toArrowFunctionAction); } } return [{ - name: refactorName7, - description: refactorDescription3, + name: refactorName8, + description: refactorDescription4, actions: possibleActions.length === 0 && context.preferences.provideRefactorNotApplicableReason ? errors : possibleActions }]; } @@ -136294,14 +138329,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function isFunctionReferencedInFile(sourceFile, typeChecker, node) { return !!node.name && ts_FindAllReferences_exports.Core.isSymbolReferencedInFile(node.name, typeChecker, sourceFile); } - var refactorName7, refactorDescription3, toAnonymousFunctionAction, toNamedFunctionAction, toArrowFunctionAction; + var refactorName8, refactorDescription4, toAnonymousFunctionAction, toNamedFunctionAction, toArrowFunctionAction; var init_convertArrowFunctionOrFunctionExpression = __esm({ "src/services/refactors/convertArrowFunctionOrFunctionExpression.ts"() { "use strict"; init_ts4(); init_ts_refactor(); - refactorName7 = "Convert arrow function or function expression"; - refactorDescription3 = getLocaleSpecificMessage(Diagnostics.Convert_arrow_function_or_function_expression); + refactorName8 = "Convert arrow function or function expression"; + refactorDescription4 = getLocaleSpecificMessage(Diagnostics.Convert_arrow_function_or_function_expression); toAnonymousFunctionAction = { name: "Convert to anonymous function", description: getLocaleSpecificMessage(Diagnostics.Convert_to_anonymous_function), @@ -136317,7 +138352,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} description: getLocaleSpecificMessage(Diagnostics.Convert_to_arrow_function), kind: "refactor.rewrite.function.arrow" }; - registerRefactor(refactorName7, { + registerRefactor(refactorName8, { kinds: [ toAnonymousFunctionAction.kind, toNamedFunctionAction.kind, @@ -136348,13 +138383,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (!functionDeclaration) return emptyArray; return [{ - name: refactorName8, - description: refactorDescription4, + name: refactorName9, + description: refactorDescription5, actions: [toDestructuredAction] }]; } function getRefactorEditsToConvertParametersToDestructuredObject(context, actionName2) { - Debug.assert(actionName2 === refactorName8, "Unexpected action name"); + Debug.assert(actionName2 === refactorName9, "Unexpected action name"); const { file, startPosition, program, cancellationToken, host } = context; const functionDeclaration = getFunctionDeclarationAtPosition(file, startPosition, program.getTypeChecker()); if (!functionDeclaration || !cancellationToken) @@ -136540,14 +138575,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const functionReference = entry.node; const parent2 = functionReference.parent; switch (parent2.kind) { - case 212 /* CallExpression */: - case 213 /* NewExpression */: + case 213 /* CallExpression */: + case 214 /* NewExpression */: const callOrNewExpression = tryCast(parent2, isCallOrNewExpression); if (callOrNewExpression && callOrNewExpression.expression === functionReference) { return callOrNewExpression; } break; - case 210 /* PropertyAccessExpression */: + case 211 /* PropertyAccessExpression */: const propertyAccessExpression = tryCast(parent2, isPropertyAccessExpression); if (propertyAccessExpression && propertyAccessExpression.parent && propertyAccessExpression.name === functionReference) { const callOrNewExpression2 = tryCast(propertyAccessExpression.parent, isCallOrNewExpression); @@ -136556,7 +138591,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } break; - case 211 /* ElementAccessExpression */: + case 212 /* ElementAccessExpression */: const elementAccessExpression = tryCast(parent2, isElementAccessExpression); if (elementAccessExpression && elementAccessExpression.parent && elementAccessExpression.argumentExpression === functionReference) { const callOrNewExpression2 = tryCast(elementAccessExpression.parent, isCallOrNewExpression); @@ -136574,13 +138609,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const reference = entry.node; const parent2 = reference.parent; switch (parent2.kind) { - case 210 /* PropertyAccessExpression */: + case 211 /* PropertyAccessExpression */: const propertyAccessExpression = tryCast(parent2, isPropertyAccessExpression); if (propertyAccessExpression && propertyAccessExpression.expression === reference) { return propertyAccessExpression; } break; - case 211 /* ElementAccessExpression */: + case 212 /* ElementAccessExpression */: const elementAccessExpression = tryCast(parent2, isElementAccessExpression); if (elementAccessExpression && elementAccessExpression.expression === reference) { return elementAccessExpression; @@ -136622,22 +138657,22 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (!isValidParameterNodeArray(functionDeclaration.parameters, checker)) return false; switch (functionDeclaration.kind) { - case 261 /* FunctionDeclaration */: + case 262 /* FunctionDeclaration */: return hasNameOrDefault(functionDeclaration) && isSingleImplementation(functionDeclaration, checker); - case 173 /* MethodDeclaration */: + case 174 /* MethodDeclaration */: if (isObjectLiteralExpression(functionDeclaration.parent)) { const contextualSymbol = getSymbolForContextualType(functionDeclaration.name, checker); return ((_a = contextualSymbol == null ? void 0 : contextualSymbol.declarations) == null ? void 0 : _a.length) === 1 && isSingleImplementation(functionDeclaration, checker); } return isSingleImplementation(functionDeclaration, checker); - case 175 /* Constructor */: + case 176 /* Constructor */: if (isClassDeclaration(functionDeclaration.parent)) { return hasNameOrDefault(functionDeclaration.parent) && isSingleImplementation(functionDeclaration, checker); } else { return isValidVariableDeclaration(functionDeclaration.parent.parent) && isSingleImplementation(functionDeclaration, checker); } - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: return isValidVariableDeclaration(functionDeclaration.parent); } return false; @@ -136814,7 +138849,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function getClassNames(constructorDeclaration) { switch (constructorDeclaration.parent.kind) { - case 262 /* ClassDeclaration */: + case 263 /* ClassDeclaration */: const classDeclaration = constructorDeclaration.parent; if (classDeclaration.name) return [classDeclaration.name]; @@ -136823,7 +138858,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} "Nameless class declaration should be a default export" ); return [defaultModifier]; - case 230 /* ClassExpression */: + case 231 /* ClassExpression */: const classExpression = constructorDeclaration.parent; const variableDeclaration = constructorDeclaration.parent.parent; const className = classExpression.name; @@ -136834,7 +138869,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function getFunctionNames(functionDeclaration) { switch (functionDeclaration.kind) { - case 261 /* FunctionDeclaration */: + case 262 /* FunctionDeclaration */: if (functionDeclaration.name) return [functionDeclaration.name]; const defaultModifier = Debug.checkDefined( @@ -136842,21 +138877,21 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} "Nameless function declaration should be a default export" ); return [defaultModifier]; - case 173 /* MethodDeclaration */: + case 174 /* MethodDeclaration */: return [functionDeclaration.name]; - case 175 /* Constructor */: + case 176 /* Constructor */: const ctrKeyword = Debug.checkDefined( findChildOfKind(functionDeclaration, 137 /* ConstructorKeyword */, functionDeclaration.getSourceFile()), "Constructor declaration should have constructor keyword" ); - if (functionDeclaration.parent.kind === 230 /* ClassExpression */) { + if (functionDeclaration.parent.kind === 231 /* ClassExpression */) { const variableDeclaration = functionDeclaration.parent.parent; return [variableDeclaration.name, ctrKeyword]; } return [ctrKeyword]; - case 218 /* ArrowFunction */: + case 219 /* ArrowFunction */: return [functionDeclaration.parent.name]; - case 217 /* FunctionExpression */: + case 218 /* FunctionExpression */: if (functionDeclaration.name) return [functionDeclaration.name, functionDeclaration.parent.name]; return [functionDeclaration.parent.name]; @@ -136864,21 +138899,21 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return Debug.assertNever(functionDeclaration, `Unexpected function declaration kind ${functionDeclaration.kind}`); } } - var refactorName8, minimumParameterLength, refactorDescription4, toDestructuredAction; + var refactorName9, minimumParameterLength, refactorDescription5, toDestructuredAction; var init_convertParamsToDestructuredObject = __esm({ "src/services/refactors/convertParamsToDestructuredObject.ts"() { "use strict"; init_ts4(); init_ts_refactor(); - refactorName8 = "Convert parameters to destructured object"; + refactorName9 = "Convert parameters to destructured object"; minimumParameterLength = 1; - refactorDescription4 = getLocaleSpecificMessage(Diagnostics.Convert_parameters_to_destructured_object); + refactorDescription5 = getLocaleSpecificMessage(Diagnostics.Convert_parameters_to_destructured_object); toDestructuredAction = { - name: refactorName8, - description: refactorDescription4, + name: refactorName9, + description: refactorDescription5, kind: "refactor.rewrite.parameters.toDestructured" }; - registerRefactor(refactorName8, { + registerRefactor(refactorName9, { kinds: [toDestructuredAction.kind], getEditsForAction: getRefactorEditsToConvertParametersToDestructuredObject, getAvailableActions: getRefactorActionsToConvertParametersToDestructuredObject @@ -136900,7 +138935,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const { file, startPosition } = context; const node = getNodeOrParentOfParentheses(file, startPosition); const maybeBinary = getParentBinaryExpression(node); - const refactorInfo = { name: refactorName9, description: refactorDescription5, actions: [] }; + const refactorInfo = { name: refactorName10, description: refactorDescription6, actions: [] }; if (isBinaryExpression(maybeBinary) && treeToArray(maybeBinary).isValidConcatenation) { refactorInfo.actions.push(convertStringAction); return [refactorInfo]; @@ -136926,7 +138961,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const { file, startPosition } = context; const node = getNodeOrParentOfParentheses(file, startPosition); switch (actionName2) { - case refactorDescription5: + case refactorDescription6: return { edits: getEditsForToTemplateLiteral(context, node) }; default: return Debug.fail("invalid action"); @@ -136949,16 +138984,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } function isNotEqualsOperator(node) { - return node.operatorToken.kind !== 64 /* EqualsToken */; + return !(node.operatorToken.kind === 64 /* EqualsToken */ || node.operatorToken.kind === 65 /* PlusEqualsToken */); } function getParentBinaryExpression(expr) { const container = findAncestor(expr.parent, (n) => { switch (n.kind) { - case 210 /* PropertyAccessExpression */: - case 211 /* ElementAccessExpression */: + case 211 /* PropertyAccessExpression */: + case 212 /* ElementAccessExpression */: return false; - case 227 /* TemplateExpression */: - case 225 /* BinaryExpression */: + case 228 /* TemplateExpression */: + case 226 /* BinaryExpression */: return !(isBinaryExpression(n.parent) && isNotEqualsOperator(n.parent)); default: return "quit"; @@ -137077,20 +139112,20 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return node; } - var refactorName9, refactorDescription5, convertStringAction, copyTrailingOperatorComments, copyCommentFromMultiNode; + var refactorName10, refactorDescription6, convertStringAction, copyTrailingOperatorComments, copyCommentFromMultiNode; var init_convertStringOrTemplateLiteral = __esm({ "src/services/refactors/convertStringOrTemplateLiteral.ts"() { "use strict"; init_ts4(); init_ts_refactor(); - refactorName9 = "Convert to template string"; - refactorDescription5 = getLocaleSpecificMessage(Diagnostics.Convert_to_template_string); + refactorName10 = "Convert to template string"; + refactorDescription6 = getLocaleSpecificMessage(Diagnostics.Convert_to_template_string); convertStringAction = { - name: refactorName9, - description: refactorDescription5, + name: refactorName10, + description: refactorDescription6, kind: "refactor.rewrite.string" }; - registerRefactor(refactorName9, { + registerRefactor(refactorName10, { kinds: [convertStringAction.kind], getEditsForAction: getRefactorEditsToConvertToTemplateString, getAvailableActions: getRefactorActionsToConvertToTemplateString @@ -137140,14 +139175,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return emptyArray; if (!isRefactorErrorInfo(info)) { return [{ - name: refactorName10, + name: refactorName11, description: convertToOptionalChainExpressionMessage, actions: [toOptionalChainAction] }]; } if (context.preferences.provideRefactorNotApplicableReason) { return [{ - name: refactorName10, + name: refactorName11, description: convertToOptionalChainExpressionMessage, actions: [{ ...toOptionalChainAction, notApplicableReason: info.error }] }]; @@ -137331,20 +139366,20 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } } - var refactorName10, convertToOptionalChainExpressionMessage, toOptionalChainAction; + var refactorName11, convertToOptionalChainExpressionMessage, toOptionalChainAction; var init_convertToOptionalChainExpression = __esm({ "src/services/refactors/convertToOptionalChainExpression.ts"() { "use strict"; init_ts4(); init_ts_refactor(); - refactorName10 = "Convert to optional chain expression"; + refactorName11 = "Convert to optional chain expression"; convertToOptionalChainExpressionMessage = getLocaleSpecificMessage(Diagnostics.Convert_to_optional_chain_expression); toOptionalChainAction = { - name: refactorName10, + name: refactorName11, description: convertToOptionalChainExpressionMessage, kind: "refactor.rewrite.expression.optionalChain" }; - registerRefactor(refactorName10, { + registerRefactor(refactorName11, { kinds: [toOptionalChainAction.kind], getEditsForAction: getRefactorEditsToConvertToOptionalChain, getAvailableActions: getRefactorActionsToConvertToOptionalChain @@ -137373,14 +139408,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const errors = []; if (refactorKindBeginsWith(extractFunctionAction.kind, requestedRefactor)) { errors.push({ - name: refactorName11, + name: refactorName12, description: extractFunctionAction.description, actions: [{ ...extractFunctionAction, notApplicableReason: getStringError(rangeToExtract.errors) }] }); } if (refactorKindBeginsWith(extractConstantAction.kind, requestedRefactor)) { errors.push({ - name: refactorName11, + name: refactorName12, description: extractConstantAction.description, actions: [{ ...extractConstantAction, notApplicableReason: getStringError(rangeToExtract.errors) }] }); @@ -137444,37 +139479,37 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const infos = []; if (functionActions.length) { infos.push({ - name: refactorName11, + name: refactorName12, description: getLocaleSpecificMessage(Diagnostics.Extract_function), actions: functionActions }); } else if (context.preferences.provideRefactorNotApplicableReason && innermostErrorFunctionAction) { infos.push({ - name: refactorName11, + name: refactorName12, description: getLocaleSpecificMessage(Diagnostics.Extract_function), actions: [innermostErrorFunctionAction] }); } if (constantActions.length) { infos.push({ - name: refactorName11, + name: refactorName12, description: getLocaleSpecificMessage(Diagnostics.Extract_constant), actions: constantActions }); } else if (context.preferences.provideRefactorNotApplicableReason && innermostErrorConstantAction) { infos.push({ - name: refactorName11, + name: refactorName12, description: getLocaleSpecificMessage(Diagnostics.Extract_constant), actions: [innermostErrorConstantAction] }); } return infos.length ? infos : emptyArray; function getStringError(errors) { - let error = errors[0].messageText; - if (typeof error !== "string") { - error = error.messageText; + let error2 = errors[0].messageText; + if (typeof error2 !== "string") { + error2 = error2.messageText; } - return error; + return error2; } } function getRefactorEditsToExtractSymbol(context, actionName2) { @@ -137510,7 +139545,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (!start || !end) { return { errors: [createFileDiagnostic(sourceFile, span.start, length2, Messages.cannotExtractRange)] }; } - if (start.flags & 8388608 /* JSDoc */) { + if (start.flags & 16777216 /* JSDoc */) { return { errors: [createFileDiagnostic(sourceFile, span.start, length2, Messages.cannotExtractJSDoc)] }; } if (start.parent !== end.parent) { @@ -137581,18 +139616,18 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function checkForStaticContext(nodeToCheck, containingClass) { let current = nodeToCheck; while (current !== containingClass) { - if (current.kind === 171 /* PropertyDeclaration */) { + if (current.kind === 172 /* PropertyDeclaration */) { if (isStatic(current)) { rangeFacts |= 32 /* InStaticRegion */; } break; - } else if (current.kind === 168 /* Parameter */) { + } else if (current.kind === 169 /* Parameter */) { const ctorOrMethod = getContainingFunction(current); - if (ctorOrMethod.kind === 175 /* Constructor */) { + if (ctorOrMethod.kind === 176 /* Constructor */) { rangeFacts |= 32 /* InStaticRegion */; } break; - } else if (current.kind === 173 /* MethodDeclaration */) { + } else if (current.kind === 174 /* MethodDeclaration */) { if (isStatic(current)) { rangeFacts |= 32 /* InStaticRegion */; } @@ -137613,7 +139648,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (!isStatement(nodeToCheck) && !(isExpressionNode(nodeToCheck) && isExtractableExpression(nodeToCheck)) && !isStringLiteralJsxAttribute(nodeToCheck)) { return [createDiagnosticForNode(nodeToCheck, Messages.statementOrExpressionExpected)]; } - if (nodeToCheck.flags & 16777216 /* Ambient */) { + if (nodeToCheck.flags & 33554432 /* Ambient */) { return [createDiagnosticForNode(nodeToCheck, Messages.cannotExtractAmbientBlock)]; } const containingClass = getContainingClass(nodeToCheck); @@ -137632,7 +139667,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} /*includeClassComputedPropertyName*/ false ); - if (container.kind === 261 /* FunctionDeclaration */ || container.kind === 173 /* MethodDeclaration */ && container.parent.kind === 209 /* ObjectLiteralExpression */ || container.kind === 217 /* FunctionExpression */) { + if (container.kind === 262 /* FunctionDeclaration */ || container.kind === 174 /* MethodDeclaration */ && container.parent.kind === 210 /* ObjectLiteralExpression */ || container.kind === 218 /* FunctionExpression */) { rangeFacts |= 16 /* UsesThisInFunction */; } } @@ -137642,21 +139677,21 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return true; } if (isDeclaration(node2)) { - const declaringNode = node2.kind === 259 /* VariableDeclaration */ ? node2.parent.parent : node2; + const declaringNode = node2.kind === 260 /* VariableDeclaration */ ? node2.parent.parent : node2; if (hasSyntacticModifier(declaringNode, 1 /* Export */)) { (errors2 || (errors2 = [])).push(createDiagnosticForNode(node2, Messages.cannotExtractExportedEntity)); return true; } } switch (node2.kind) { - case 271 /* ImportDeclaration */: + case 272 /* ImportDeclaration */: (errors2 || (errors2 = [])).push(createDiagnosticForNode(node2, Messages.cannotExtractImport)); return true; - case 276 /* ExportAssignment */: + case 277 /* ExportAssignment */: (errors2 || (errors2 = [])).push(createDiagnosticForNode(node2, Messages.cannotExtractExportedEntity)); return true; case 108 /* SuperKeyword */: - if (node2.parent.kind === 212 /* CallExpression */) { + if (node2.parent.kind === 213 /* CallExpression */) { const containingClass2 = getContainingClass(node2); if (containingClass2 === void 0 || containingClass2.pos < span.start || containingClass2.end >= span.start + span.length) { (errors2 || (errors2 = [])).push(createDiagnosticForNode(node2, Messages.cannotExtractSuper)); @@ -137667,7 +139702,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} thisNode = node2; } break; - case 218 /* ArrowFunction */: + case 219 /* ArrowFunction */: forEachChild(node2, function check(n) { if (isThis(n)) { rangeFacts |= 8 /* UsesThis */; @@ -137678,34 +139713,34 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} forEachChild(n, check); } }); - case 262 /* ClassDeclaration */: - case 261 /* FunctionDeclaration */: + case 263 /* ClassDeclaration */: + case 262 /* FunctionDeclaration */: if (isSourceFile(node2.parent) && node2.parent.externalModuleIndicator === void 0) { (errors2 || (errors2 = [])).push(createDiagnosticForNode(node2, Messages.functionWillNotBeVisibleInTheNewScope)); } - case 230 /* ClassExpression */: - case 217 /* FunctionExpression */: - case 173 /* MethodDeclaration */: - case 175 /* Constructor */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 231 /* ClassExpression */: + case 218 /* FunctionExpression */: + case 174 /* MethodDeclaration */: + case 176 /* Constructor */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: return false; } const savedPermittedJumps = permittedJumps; switch (node2.kind) { - case 244 /* IfStatement */: + case 245 /* IfStatement */: permittedJumps &= ~4 /* Return */; break; - case 257 /* TryStatement */: + case 258 /* TryStatement */: permittedJumps = 0 /* None */; break; - case 240 /* Block */: - if (node2.parent && node2.parent.kind === 257 /* TryStatement */ && node2.parent.finallyBlock === node2) { + case 241 /* Block */: + if (node2.parent && node2.parent.kind === 258 /* TryStatement */ && node2.parent.finallyBlock === node2) { permittedJumps = 4 /* Return */; } break; - case 296 /* DefaultClause */: - case 295 /* CaseClause */: + case 297 /* DefaultClause */: + case 296 /* CaseClause */: permittedJumps |= 1 /* Break */; break; default: @@ -137719,39 +139754,39 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} break; } switch (node2.kind) { - case 196 /* ThisType */: + case 197 /* ThisType */: case 110 /* ThisKeyword */: rangeFacts |= 8 /* UsesThis */; thisNode = node2; break; - case 255 /* LabeledStatement */: { + case 256 /* LabeledStatement */: { const label = node2.label; (seenLabels || (seenLabels = [])).push(label.escapedText); forEachChild(node2, visit); seenLabels.pop(); break; } - case 251 /* BreakStatement */: - case 250 /* ContinueStatement */: { + case 252 /* BreakStatement */: + case 251 /* ContinueStatement */: { const label = node2.label; if (label) { if (!contains(seenLabels, label.escapedText)) { (errors2 || (errors2 = [])).push(createDiagnosticForNode(node2, Messages.cannotExtractRangeContainingLabeledBreakOrContinueStatementWithTargetOutsideOfTheRange)); } } else { - if (!(permittedJumps & (node2.kind === 251 /* BreakStatement */ ? 1 /* Break */ : 2 /* Continue */))) { + if (!(permittedJumps & (node2.kind === 252 /* BreakStatement */ ? 1 /* Break */ : 2 /* Continue */))) { (errors2 || (errors2 = [])).push(createDiagnosticForNode(node2, Messages.cannotExtractRangeContainingConditionalBreakOrContinueStatements)); } } break; } - case 222 /* AwaitExpression */: + case 223 /* AwaitExpression */: rangeFacts |= 4 /* IsAsyncFunction */; break; - case 228 /* YieldExpression */: + case 229 /* YieldExpression */: rangeFacts |= 2 /* IsGenerator */; break; - case 252 /* ReturnStatement */: + case 253 /* ReturnStatement */: if (permittedJumps & 4 /* Return */) { rangeFacts |= 1 /* HasReturn */; } else { @@ -137801,12 +139836,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const scopes = []; while (true) { current = current.parent; - if (current.kind === 168 /* Parameter */) { + if (current.kind === 169 /* Parameter */) { current = findAncestor(current, (parent2) => isFunctionLikeDeclaration(parent2)).parent; } if (isScope(current)) { scopes.push(current); - if (current.kind === 311 /* SourceFile */) { + if (current.kind === 312 /* SourceFile */) { return scopes; } } @@ -137882,28 +139917,28 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function getDescriptionForFunctionLikeDeclaration(scope) { switch (scope.kind) { - case 175 /* Constructor */: + case 176 /* Constructor */: return "constructor"; - case 217 /* FunctionExpression */: - case 261 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 262 /* FunctionDeclaration */: return scope.name ? `function '${scope.name.text}'` : ANONYMOUS; - case 218 /* ArrowFunction */: + case 219 /* ArrowFunction */: return "arrow function"; - case 173 /* MethodDeclaration */: + case 174 /* MethodDeclaration */: return `method '${scope.name.getText()}'`; - case 176 /* GetAccessor */: + case 177 /* GetAccessor */: return `'get ${scope.name.getText()}'`; - case 177 /* SetAccessor */: + case 178 /* SetAccessor */: return `'set ${scope.name.getText()}'`; default: Debug.assertNever(scope, `Unexpected scope kind ${scope.kind}`); } } function getDescriptionForClassLikeDeclaration(scope) { - return scope.kind === 262 /* ClassDeclaration */ ? scope.name ? `class '${scope.name.text}'` : "anonymous class declaration" : scope.name ? `class expression '${scope.name.text}'` : "anonymous class expression"; + return scope.kind === 263 /* 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 === 267 /* ModuleBlock */ ? `namespace '${scope.parent.name.getText()}'` : scope.externalModuleIndicator ? 0 /* Module */ : 1 /* Global */; + return scope.kind === 268 /* ModuleBlock */ ? `namespace '${scope.parent.name.getText()}'` : scope.externalModuleIndicator ? 0 /* Module */ : 1 /* Global */; } function extractFunctionInScope(node, scope, { usages: usagesInScope, typeParameterUsages, substitutions }, exposedVariableDeclarations, range, context) { const checker = context.program.getTypeChecker(); @@ -138280,7 +140315,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} changeTracker.insertNodeBefore(context.file, oldVariableDeclaration, newVariableDeclaration); const localReference = factory.createIdentifier(localNameText); changeTracker.replaceNode(context.file, node, localReference); - } else if (node.parent.kind === 243 /* ExpressionStatement */ && scope === findAncestor(node, isScope)) { + } else if (node.parent.kind === 244 /* ExpressionStatement */ && scope === findAncestor(node, isScope)) { const newVariableStatement = factory.createVariableStatement( /*modifiers*/ void 0, @@ -138310,7 +140345,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} false ); } - if (node.parent.kind === 243 /* ExpressionStatement */) { + if (node.parent.kind === 244 /* ExpressionStatement */) { changeTracker.delete(context.file, node.parent); } else { let localReference = factory.createIdentifier(localNameText); @@ -138862,27 +140897,27 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function isExtractableExpression(node) { const { parent: parent2 } = node; switch (parent2.kind) { - case 305 /* EnumMember */: + case 306 /* EnumMember */: return false; } switch (node.kind) { case 11 /* StringLiteral */: - return parent2.kind !== 271 /* ImportDeclaration */ && parent2.kind !== 275 /* ImportSpecifier */; - case 229 /* SpreadElement */: - case 205 /* ObjectBindingPattern */: - case 207 /* BindingElement */: + return parent2.kind !== 272 /* ImportDeclaration */ && parent2.kind !== 276 /* ImportSpecifier */; + case 230 /* SpreadElement */: + case 206 /* ObjectBindingPattern */: + case 208 /* BindingElement */: return false; case 80 /* Identifier */: - return parent2.kind !== 207 /* BindingElement */ && parent2.kind !== 275 /* ImportSpecifier */ && parent2.kind !== 280 /* ExportSpecifier */; + return parent2.kind !== 208 /* BindingElement */ && parent2.kind !== 276 /* ImportSpecifier */ && parent2.kind !== 281 /* ExportSpecifier */; } return true; } function isBlockLike(node) { switch (node.kind) { - case 240 /* Block */: - case 311 /* SourceFile */: - case 267 /* ModuleBlock */: - case 295 /* CaseClause */: + case 241 /* Block */: + case 312 /* SourceFile */: + case 268 /* ModuleBlock */: + case 296 /* CaseClause */: return true; default: return false; @@ -138894,13 +140929,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function isStringLiteralJsxAttribute(node) { return isStringLiteral(node) && node.parent && isJsxAttribute(node.parent); } - var refactorName11, extractConstantAction, extractFunctionAction, Messages, RangeFacts; + var refactorName12, extractConstantAction, extractFunctionAction, Messages, RangeFacts; var init_extractSymbol = __esm({ "src/services/refactors/extractSymbol.ts"() { "use strict"; init_ts4(); init_ts_refactor(); - refactorName11 = "Extract Symbol"; + refactorName12 = "Extract Symbol"; extractConstantAction = { name: "Extract Constant", description: getLocaleSpecificMessage(Diagnostics.Extract_constant), @@ -138911,7 +140946,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} description: getLocaleSpecificMessage(Diagnostics.Extract_function), kind: "refactor.extract.function" }; - registerRefactor(refactorName11, { + registerRefactor(refactorName12, { kinds: [ extractConstantAction.kind, extractFunctionAction.kind @@ -138984,7 +141019,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} init_ts4(); init_ts_refactor(); actionName = "Generate 'get' and 'set' accessors"; - actionDescription = Diagnostics.Generate_get_and_set_accessors.message; + actionDescription = getLocaleSpecificMessage(Diagnostics.Generate_get_and_set_accessors); generateGetSetAction = { name: actionName, description: actionDescription, @@ -139062,15 +141097,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return emptyArray; if (!isRefactorErrorInfo(info)) { return [{ - name: refactorName12, - description: refactorDescription6, + name: refactorName13, + description: refactorDescription7, actions: [inferReturnTypeAction] }]; } if (context.preferences.provideRefactorNotApplicableReason) { return [{ - name: refactorName12, - description: refactorDescription6, + name: refactorName13, + description: refactorDescription7, actions: [{ ...inferReturnTypeAction, notApplicableReason: info.error }] }]; } @@ -139108,10 +141143,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function isConvertibleDeclaration(node) { switch (node.kind) { - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: - case 173 /* MethodDeclaration */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: + case 174 /* MethodDeclaration */: return true; default: return false; @@ -139129,20 +141164,20 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return typeChecker.getReturnTypeOfSignature(signature); } } - var refactorName12, refactorDescription6, inferReturnTypeAction; + var refactorName13, refactorDescription7, inferReturnTypeAction; var init_inferFunctionReturnType = __esm({ "src/services/refactors/inferFunctionReturnType.ts"() { "use strict"; init_ts4(); init_ts_refactor(); - refactorName12 = "Infer function return type"; - refactorDescription6 = Diagnostics.Infer_function_return_type.message; + refactorName13 = "Infer function return type"; + refactorDescription7 = getLocaleSpecificMessage(Diagnostics.Infer_function_return_type); inferReturnTypeAction = { - name: refactorName12, - description: refactorDescription6, + name: refactorName13, + description: refactorDescription7, kind: "refactor.rewrite.function.returnType" }; - registerRefactor(refactorName12, { + registerRefactor(refactorName13, { kinds: [inferReturnTypeAction.kind], getEditsForAction: getRefactorEditsToInferReturnType, getAvailableActions: getRefactorActionsToInferReturnType @@ -139203,6 +141238,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} init_convertImport(); init_extractType(); init_helpers(); + init_inlineVariable(); init_moveToNewFile(); init_moveToFile(); init_ts_refactor_addOrRemoveBracesToArrowFunction(); @@ -139251,13 +141287,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} let inJSXElement = false; function visit(node) { switch (node.kind) { - case 266 /* ModuleDeclaration */: - case 262 /* ClassDeclaration */: - case 263 /* InterfaceDeclaration */: - case 261 /* FunctionDeclaration */: - case 230 /* ClassExpression */: - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: + case 267 /* ModuleDeclaration */: + case 263 /* ClassDeclaration */: + case 264 /* InterfaceDeclaration */: + case 262 /* FunctionDeclaration */: + case 231 /* ClassExpression */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } if (!node || !textSpanIntersectsWith(span, node.pos, node.getFullWidth()) || node.getFullWidth() === 0) { @@ -139428,25 +141464,25 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return TokenModifier2; })(TokenModifier || {}); tokenFromDeclarationMapping = /* @__PURE__ */ new Map([ - [259 /* VariableDeclaration */, 7 /* variable */], - [168 /* Parameter */, 6 /* parameter */], - [171 /* PropertyDeclaration */, 9 /* property */], - [266 /* ModuleDeclaration */, 3 /* namespace */], - [265 /* EnumDeclaration */, 1 /* enum */], - [305 /* EnumMember */, 8 /* enumMember */], - [262 /* ClassDeclaration */, 0 /* class */], - [173 /* MethodDeclaration */, 11 /* member */], - [261 /* FunctionDeclaration */, 10 /* function */], - [217 /* FunctionExpression */, 10 /* function */], - [172 /* MethodSignature */, 11 /* member */], - [176 /* GetAccessor */, 9 /* property */], - [177 /* SetAccessor */, 9 /* property */], - [170 /* PropertySignature */, 9 /* property */], - [263 /* InterfaceDeclaration */, 2 /* interface */], - [264 /* TypeAliasDeclaration */, 5 /* type */], - [167 /* TypeParameter */, 4 /* typeParameter */], - [302 /* PropertyAssignment */, 9 /* property */], - [303 /* ShorthandPropertyAssignment */, 9 /* property */] + [260 /* VariableDeclaration */, 7 /* variable */], + [169 /* Parameter */, 6 /* parameter */], + [172 /* PropertyDeclaration */, 9 /* property */], + [267 /* ModuleDeclaration */, 3 /* namespace */], + [266 /* EnumDeclaration */, 1 /* enum */], + [306 /* EnumMember */, 8 /* enumMember */], + [263 /* ClassDeclaration */, 0 /* class */], + [174 /* MethodDeclaration */, 11 /* member */], + [262 /* FunctionDeclaration */, 10 /* function */], + [218 /* FunctionExpression */, 10 /* function */], + [173 /* MethodSignature */, 11 /* member */], + [177 /* GetAccessor */, 9 /* property */], + [178 /* SetAccessor */, 9 /* property */], + [171 /* PropertySignature */, 9 /* property */], + [264 /* InterfaceDeclaration */, 2 /* interface */], + [265 /* TypeAliasDeclaration */, 5 /* type */], + [168 /* TypeParameter */, 4 /* typeParameter */], + [303 /* PropertyAssignment */, 9 /* property */], + [304 /* ShorthandPropertyAssignment */, 9 /* property */] ]); } }); @@ -139455,7 +141491,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function createNode(kind, pos, end, parent2) { const node = isNodeKind(kind) ? new NodeObject(kind, pos, end) : kind === 80 /* Identifier */ ? new IdentifierObject(80 /* Identifier */, pos, end) : kind === 81 /* PrivateIdentifier */ ? new PrivateIdentifierObject(81 /* PrivateIdentifier */, pos, end) : new TokenObject(kind, pos, end); node.parent = parent2; - node.flags = parent2.flags & 50720768 /* ContextFlags */; + node.flags = parent2.flags & 101441536 /* ContextFlags */; return node; } function createChildren(node, sourceFile) { @@ -139509,7 +141545,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } function createSyntaxList(nodes, parent2) { - const list = createNode(357 /* SyntaxList */, nodes.pos, nodes.end, parent2); + const list = createNode(358 /* SyntaxList */, nodes.pos, nodes.end, parent2); list._children = []; let pos = nodes.pos; for (const node of nodes) { @@ -139534,7 +141570,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} var _a; if (!seenSymbols.has(symbol)) { seenSymbols.add(symbol); - if (declaration.kind === 176 /* GetAccessor */ || declaration.kind === 177 /* SetAccessor */) { + if (declaration.kind === 177 /* GetAccessor */ || declaration.kind === 178 /* SetAccessor */) { return symbol.getContextualJsDocTags(declaration, checker); } return ((_a = symbol.declarations) == null ? void 0 : _a.length) === 1 ? symbol.getJsDocTags() : void 0; @@ -139557,7 +141593,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const inheritedDocs = findBaseOfDeclaration(checker, declaration, (symbol) => { if (!seenSymbols.has(symbol)) { seenSymbols.add(symbol); - if (declaration.kind === 176 /* GetAccessor */ || declaration.kind === 177 /* SetAccessor */) { + if (declaration.kind === 177 /* GetAccessor */ || declaration.kind === 178 /* SetAccessor */) { return symbol.getContextualDocumentationComment(declaration, checker); } return symbol.getDocumentationComment(checker); @@ -139571,7 +141607,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function findBaseOfDeclaration(checker, declaration, cb) { var _a; - const classOrInterfaceDeclaration = ((_a = declaration.parent) == null ? void 0 : _a.kind) === 175 /* Constructor */ ? declaration.parent.parent : declaration.parent; + const classOrInterfaceDeclaration = ((_a = declaration.parent) == null ? void 0 : _a.kind) === 176 /* Constructor */ ? declaration.parent.parent : declaration.parent; if (!classOrInterfaceDeclaration) return; const isStaticMember = hasStaticModifier(declaration); @@ -139703,10 +141739,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} host.log(message); } } - const useCaseSensitiveFileNames = hostUsesCaseSensitiveFileNames(host); - const getCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames); + const useCaseSensitiveFileNames2 = hostUsesCaseSensitiveFileNames(host); + const getCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames2); const sourceMapper = getSourceMapper({ - useCaseSensitiveFileNames: () => useCaseSensitiveFileNames, + useCaseSensitiveFileNames: () => useCaseSensitiveFileNames2, getCurrentDirectory: () => currentDirectory, getProgram, fileExists: maybeBind(host, host.fileExists), @@ -139718,9 +141754,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function getValidSourceFile(fileName) { const sourceFile = program.getSourceFile(fileName); if (!sourceFile) { - const error = new Error(`Could not find source file: '${fileName}'.`); - error.ProgramFiles = program.getSourceFiles().map((f) => f.fileName); - throw error; + const error2 = new Error(`Could not find source file: '${fileName}'.`); + error2.ProgramFiles = program.getSourceFiles().map((f) => f.fileName); + throw error2; } return sourceFile; } @@ -139754,7 +141790,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} getSourceFileByPath: getOrCreateSourceFileByPath, getCancellationToken: () => cancellationToken, getCanonicalFileName, - useCaseSensitiveFileNames: () => useCaseSensitiveFileNames, + useCaseSensitiveFileNames: () => useCaseSensitiveFileNames2, getNewLine: () => getNewLineCharacter(newSettings), getDefaultLibFileName: (options2) => host.getDefaultLibFileName(options2), writeFile: noop, @@ -139798,9 +141834,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} compilerHost.getSourceFile = getSourceFileWithCache; (_c = host.setCompilerHost) == null ? void 0 : _c.call(host, compilerHost); const parseConfigHost = { - useCaseSensitiveFileNames, + useCaseSensitiveFileNames: useCaseSensitiveFileNames2, fileExists: (fileName) => compilerHost.fileExists(fileName), readFile: (fileName) => compilerHost.readFile(fileName), + directoryExists: (f) => compilerHost.directoryExists(f), + getDirectories: (f) => compilerHost.getDirectories(f), + realpath: compilerHost.realpath, readDirectory: (...args) => compilerHost.readDirectory(...args), trace: compilerHost.trace, getCurrentDirectory: compilerHost.getCurrentDirectory, @@ -139953,14 +141992,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } function cleanupSemanticCache() { - program = void 0; - } - function dispose() { if (program) { const key = documentRegistry.getKeyForCompilationSettings(program.getCompilerOptions()); forEach(program.getSourceFiles(), (f) => documentRegistry.releaseDocumentWithKey(f.resolvedPath, key, f.scriptKind, f.impliedNodeFormat)); program = void 0; } + } + function dispose() { + cleanupSemanticCache(); host = void 0; } function getSyntacticDiagnostics(fileName) { @@ -140079,15 +142118,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} switch (node.kind) { case 80 /* Identifier */: return !isLabelName(node) && !isTagName(node) && !isConstTypeReference(node.parent); - case 210 /* PropertyAccessExpression */: - case 165 /* QualifiedName */: + case 211 /* PropertyAccessExpression */: + case 166 /* QualifiedName */: return !isInComment(sourceFile, position); case 110 /* ThisKeyword */: - case 196 /* ThisType */: + case 197 /* ThisType */: case 108 /* SuperKeyword */: - case 201 /* NamedTupleMember */: + case 202 /* NamedTupleMember */: return true; - case 235 /* MetaProperty */: + case 236 /* MetaProperty */: return isImportMeta(node); default: return false; @@ -140187,15 +142226,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return void 0; } switch (node.kind) { - case 210 /* PropertyAccessExpression */: - case 165 /* QualifiedName */: + case 211 /* PropertyAccessExpression */: + case 166 /* QualifiedName */: case 11 /* StringLiteral */: case 97 /* FalseKeyword */: case 112 /* TrueKeyword */: case 106 /* NullKeyword */: case 108 /* SuperKeyword */: case 110 /* ThisKeyword */: - case 196 /* ThisType */: + case 197 /* ThisType */: case 80 /* Identifier */: break; default: @@ -140206,7 +142245,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (isRightSideOfPropertyAccess(nodeForStartPos) || isRightSideOfQualifiedName(nodeForStartPos)) { nodeForStartPos = nodeForStartPos.parent; } else if (isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 266 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { + if (nodeForStartPos.parent.parent.kind === 267 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } else { break; @@ -140383,7 +142422,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function getLinkedEditingRangeAtPosition(fileName, position) { const sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); const token = findPrecedingToken(position, sourceFile); - if (!token || token.parent.kind === 311 /* SourceFile */) + if (!token || token.parent.kind === 312 /* SourceFile */) return void 0; const jsxTagWordPattern = "[a-zA-Z0-9:\\-\\._$]*"; if (isJsxFragment(token.parent.parent)) { @@ -140631,7 +142670,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return !tagNamesAreEquivalent(openingElement.tagName, closingElement.tagName) || isJsxElement(parent2) && tagNamesAreEquivalent(openingElement.tagName, parent2.openingElement.tagName) && isUnclosedTag(parent2); } function isUnclosedFragment({ closingFragment, parent: parent2 }) { - return !!(closingFragment.flags & 131072 /* ThisNodeHasError */) || isJsxFragment(parent2) && isUnclosedFragment(parent2); + return !!(closingFragment.flags & 262144 /* ThisNodeHasError */) || isJsxFragment(parent2) && isUnclosedFragment(parent2); } function getSpanOfEnclosingComment(fileName, position, onlyMultiLine) { const sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); @@ -140673,7 +142712,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return result; function escapeRegExp(str) { - return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); + return str.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&"); } function getTodoCommentsRegExp() { const singleLineCommentStart = /(?:\/\/+\s*)/.source; @@ -140741,10 +142780,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const newFileName = createNewFileName(sourceFile, program, getRefactorContext(sourceFile, positionOrRange, preferences, emptyOptions), host); return { newFileName, files }; } - function getEditsForRefactor2(fileName, formatOptions, positionOrRange, refactorName13, actionName2, preferences = emptyOptions, interactiveRefactorArguments) { + function getEditsForRefactor2(fileName, formatOptions, positionOrRange, refactorName14, actionName2, preferences = emptyOptions, interactiveRefactorArguments) { synchronizeHostData(); const file = getValidSourceFile(fileName); - return ts_refactor_exports.getEditsForRefactor(getRefactorContext(file, positionOrRange, preferences, formatOptions), refactorName13, actionName2, interactiveRefactorArguments); + return ts_refactor_exports.getEditsForRefactor(getRefactorContext(file, positionOrRange, preferences, formatOptions), refactorName14, actionName2, interactiveRefactorArguments); } function toLineColumnOffset(fileName, position) { if (position === 0) { @@ -140892,7 +142931,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} }); } function literalIsName(node) { - return isDeclarationName(node) || node.parent.kind === 282 /* ExternalModuleReference */ || isArgumentOfElementAccessExpression(node) || isLiteralComputedPropertyDeclarationName(node); + return isDeclarationName(node) || node.parent.kind === 283 /* ExternalModuleReference */ || isArgumentOfElementAccessExpression(node) || isLiteralComputedPropertyDeclarationName(node); } function getContainingObjectLiteralElement(node) { const element = getContainingObjectLiteralElementWorker(node); @@ -140903,11 +142942,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} case 11 /* StringLiteral */: case 15 /* NoSubstitutionTemplateLiteral */: case 9 /* NumericLiteral */: - if (node.parent.kind === 166 /* ComputedPropertyName */) { + if (node.parent.kind === 167 /* ComputedPropertyName */) { return isObjectLiteralElement(node.parent.parent) ? node.parent.parent : void 0; } case 80 /* Identifier */: - return isObjectLiteralElement(node.parent) && (node.parent.parent.kind === 209 /* ObjectLiteralExpression */ || node.parent.parent.kind === 291 /* JsxAttributes */) && node.parent.name === node ? node.parent : void 0; + return isObjectLiteralElement(node.parent) && (node.parent.parent.kind === 210 /* ObjectLiteralExpression */ || node.parent.parent.kind === 292 /* JsxAttributes */) && node.parent.name === node ? node.parent : void 0; } return void 0; } @@ -140948,7 +142987,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return discriminatedPropertySymbols; } function isArgumentOfElementAccessExpression(node) { - return node && node.parent && node.parent.kind === 211 /* ElementAccessExpression */ && node.parent.argumentExpression === node; + return node && node.parent && node.parent.kind === 212 /* ElementAccessExpression */ && node.parent.argumentExpression === node; } function getDefaultLibFilePath(options) { if (sys) { @@ -141034,8 +143073,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (!children.length) { return void 0; } - const child = find(children, (kid) => kid.kind < 315 /* FirstJSDocNode */ || kid.kind > 356 /* LastJSDocNode */); - return child.kind < 165 /* FirstNode */ ? child : child.getFirstToken(sourceFile); + const child = find(children, (kid) => kid.kind < 316 /* FirstJSDocNode */ || kid.kind > 357 /* LastJSDocNode */); + return child.kind < 166 /* FirstNode */ ? child : child.getFirstToken(sourceFile); } getLastToken(sourceFile) { this.assertHasRealPosition(); @@ -141044,7 +143083,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (!child) { return void 0; } - return child.kind < 165 /* FirstNode */ ? child : child.getLastToken(sourceFile); + return child.kind < 166 /* FirstNode */ ? child : child.getLastToken(sourceFile); } forEachChild(cbNode, cbNodeArray) { return forEachChild(this, cbNode, cbNodeArray); @@ -141345,7 +143384,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} SourceFileObject = class extends NodeObject { constructor(kind, pos, end) { super(kind, pos, end); - this.kind = 311 /* SourceFile */; + this.kind = 312 /* SourceFile */; } update(newText, textChangeRange) { return updateSourceFile(this, newText, textChangeRange); @@ -141401,10 +143440,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function visit(node) { switch (node.kind) { - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: const functionDeclaration = node; const declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -141420,29 +143459,29 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } forEachChild(node, visit); break; - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: - case 263 /* InterfaceDeclaration */: - case 264 /* TypeAliasDeclaration */: - case 265 /* EnumDeclaration */: - case 266 /* ModuleDeclaration */: - case 270 /* ImportEqualsDeclaration */: - case 280 /* ExportSpecifier */: - case 275 /* ImportSpecifier */: - case 272 /* ImportClause */: - case 273 /* NamespaceImport */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 186 /* TypeLiteral */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: + case 264 /* InterfaceDeclaration */: + case 265 /* TypeAliasDeclaration */: + case 266 /* EnumDeclaration */: + case 267 /* ModuleDeclaration */: + case 271 /* ImportEqualsDeclaration */: + case 281 /* ExportSpecifier */: + case 276 /* ImportSpecifier */: + case 273 /* ImportClause */: + case 274 /* NamespaceImport */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 187 /* TypeLiteral */: addDeclaration(node); forEachChild(node, visit); break; - case 168 /* Parameter */: + case 169 /* Parameter */: if (!hasSyntacticModifier(node, 16476 /* ParameterPropertyModifier */)) { break; } - case 259 /* VariableDeclaration */: - case 207 /* BindingElement */: { + case 260 /* VariableDeclaration */: + case 208 /* BindingElement */: { const decl = node; if (isBindingPattern(decl.name)) { forEachChild(decl.name, visit); @@ -141452,12 +143491,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} visit(decl.initializer); } } - case 305 /* EnumMember */: - case 171 /* PropertyDeclaration */: - case 170 /* PropertySignature */: + case 306 /* EnumMember */: + case 172 /* PropertyDeclaration */: + case 171 /* PropertySignature */: addDeclaration(node); break; - case 277 /* ExportDeclaration */: + case 278 /* ExportDeclaration */: const exportDeclaration = node; if (exportDeclaration.exportClause) { if (isNamedExports(exportDeclaration.exportClause)) { @@ -141467,14 +143506,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } break; - case 271 /* ImportDeclaration */: + case 272 /* ImportDeclaration */: const importClause = node.importClause; if (importClause) { if (importClause.name) { addDeclaration(importClause.name); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 273 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 274 /* NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { forEach(importClause.namedBindings.elements, visit); @@ -141482,7 +143521,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } break; - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: if (getAssignmentDeclarationKind(node) !== 0 /* None */) { addDeclaration(node); } @@ -142618,7 +144657,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } tokenAtLocation = preceding; } - if (tokenAtLocation.flags & 16777216 /* Ambient */) { + if (tokenAtLocation.flags & 33554432 /* Ambient */) { return void 0; } return spanInNode(tokenAtLocation); @@ -142661,89 +144700,89 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (node) { const { parent: parent2 } = node; switch (node.kind) { - case 242 /* VariableStatement */: + case 243 /* VariableStatement */: return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 259 /* VariableDeclaration */: - case 171 /* PropertyDeclaration */: - case 170 /* PropertySignature */: + case 260 /* VariableDeclaration */: + case 172 /* PropertyDeclaration */: + case 171 /* PropertySignature */: return spanInVariableDeclaration(node); - case 168 /* Parameter */: + case 169 /* Parameter */: return spanInParameterDeclaration(node); - case 261 /* FunctionDeclaration */: - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 175 /* Constructor */: - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: + case 262 /* FunctionDeclaration */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 176 /* Constructor */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: return spanInFunctionDeclaration(node); - case 240 /* Block */: + case 241 /* Block */: if (isFunctionBlock(node)) { return spanInFunctionBlock(node); } - case 267 /* ModuleBlock */: + case 268 /* ModuleBlock */: return spanInBlock(node); - case 298 /* CatchClause */: + case 299 /* CatchClause */: return spanInBlock(node.block); - case 243 /* ExpressionStatement */: + case 244 /* ExpressionStatement */: return textSpan(node.expression); - case 252 /* ReturnStatement */: + case 253 /* ReturnStatement */: return textSpan(node.getChildAt(0), node.expression); - case 246 /* WhileStatement */: + case 247 /* WhileStatement */: return textSpanEndingAtNextToken(node, node.expression); - case 245 /* DoStatement */: + case 246 /* DoStatement */: return spanInNode(node.statement); - case 258 /* DebuggerStatement */: + case 259 /* DebuggerStatement */: return textSpan(node.getChildAt(0)); - case 244 /* IfStatement */: + case 245 /* IfStatement */: return textSpanEndingAtNextToken(node, node.expression); - case 255 /* LabeledStatement */: + case 256 /* LabeledStatement */: return spanInNode(node.statement); - case 251 /* BreakStatement */: - case 250 /* ContinueStatement */: + case 252 /* BreakStatement */: + case 251 /* ContinueStatement */: return textSpan(node.getChildAt(0), node.label); - case 247 /* ForStatement */: + case 248 /* ForStatement */: return spanInForStatement(node); - case 248 /* ForInStatement */: + case 249 /* ForInStatement */: return textSpanEndingAtNextToken(node, node.expression); - case 249 /* ForOfStatement */: + case 250 /* ForOfStatement */: return spanInInitializerOfForLike(node); - case 254 /* SwitchStatement */: + case 255 /* SwitchStatement */: return textSpanEndingAtNextToken(node, node.expression); - case 295 /* CaseClause */: - case 296 /* DefaultClause */: + case 296 /* CaseClause */: + case 297 /* DefaultClause */: return spanInNode(node.statements[0]); - case 257 /* TryStatement */: + case 258 /* TryStatement */: return spanInBlock(node.tryBlock); - case 256 /* ThrowStatement */: + case 257 /* ThrowStatement */: return textSpan(node, node.expression); - case 276 /* ExportAssignment */: + case 277 /* ExportAssignment */: return textSpan(node, node.expression); - case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportEqualsDeclaration */: return textSpan(node, node.moduleReference); - case 271 /* ImportDeclaration */: + case 272 /* ImportDeclaration */: return textSpan(node, node.moduleSpecifier); - case 277 /* ExportDeclaration */: + case 278 /* ExportDeclaration */: return textSpan(node, node.moduleSpecifier); - case 266 /* ModuleDeclaration */: + case 267 /* ModuleDeclaration */: if (getModuleInstanceState(node) !== 1 /* Instantiated */) { return void 0; } - case 262 /* ClassDeclaration */: - case 265 /* EnumDeclaration */: - case 305 /* EnumMember */: - case 207 /* BindingElement */: + case 263 /* ClassDeclaration */: + case 266 /* EnumDeclaration */: + case 306 /* EnumMember */: + case 208 /* BindingElement */: return textSpan(node); - case 253 /* WithStatement */: + case 254 /* WithStatement */: return spanInNode(node.statement); - case 169 /* Decorator */: + case 170 /* Decorator */: return spanInNodeArray(parent2.modifiers, node, isDecorator); - case 205 /* ObjectBindingPattern */: - case 206 /* ArrayBindingPattern */: + case 206 /* ObjectBindingPattern */: + case 207 /* ArrayBindingPattern */: return spanInBindingPattern(node); - case 263 /* InterfaceDeclaration */: - case 264 /* TypeAliasDeclaration */: + case 264 /* InterfaceDeclaration */: + case 265 /* TypeAliasDeclaration */: return void 0; case 27 /* SemicolonToken */: case 1 /* EndOfFileToken */: @@ -142771,16 +144810,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} case 85 /* CatchKeyword */: case 98 /* FinallyKeyword */: return spanInNextNode(node); - case 164 /* OfKeyword */: + case 165 /* OfKeyword */: return spanInOfKeyword(node); default: if (isArrayLiteralOrObjectLiteralDestructuringPattern(node)) { return spanInArrayLiteralOrObjectLiteralDestructuringPattern(node); } - if ((node.kind === 80 /* Identifier */ || node.kind === 229 /* SpreadElement */ || node.kind === 302 /* PropertyAssignment */ || node.kind === 303 /* ShorthandPropertyAssignment */) && isArrayLiteralOrObjectLiteralDestructuringPattern(parent2)) { + if ((node.kind === 80 /* Identifier */ || node.kind === 230 /* SpreadElement */ || node.kind === 303 /* PropertyAssignment */ || node.kind === 304 /* ShorthandPropertyAssignment */) && isArrayLiteralOrObjectLiteralDestructuringPattern(parent2)) { return textSpan(node); } - if (node.kind === 225 /* BinaryExpression */) { + if (node.kind === 226 /* BinaryExpression */) { const { left, operatorToken } = node; if (isArrayLiteralOrObjectLiteralDestructuringPattern(left)) { return spanInArrayLiteralOrObjectLiteralDestructuringPattern( @@ -142796,19 +144835,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } if (isExpressionNode(node)) { switch (parent2.kind) { - case 245 /* DoStatement */: + case 246 /* DoStatement */: return spanInPreviousNode(node); - case 169 /* Decorator */: + case 170 /* Decorator */: return spanInNode(node.parent); - case 247 /* ForStatement */: - case 249 /* ForOfStatement */: + case 248 /* ForStatement */: + case 250 /* ForOfStatement */: return textSpan(node); - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: if (node.parent.operatorToken.kind === 28 /* CommaToken */) { return textSpan(node); } break; - case 218 /* ArrowFunction */: + case 219 /* ArrowFunction */: if (node.parent.body === node) { return textSpan(node); } @@ -142816,25 +144855,25 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } switch (node.parent.kind) { - case 302 /* PropertyAssignment */: + case 303 /* PropertyAssignment */: if (node.parent.name === node && !isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); } break; - case 215 /* TypeAssertionExpression */: + case 216 /* TypeAssertionExpression */: if (node.parent.type === node) { return spanInNextNode(node.parent.type); } break; - case 259 /* VariableDeclaration */: - case 168 /* Parameter */: { + case 260 /* VariableDeclaration */: + case 169 /* Parameter */: { const { initializer, type } = node.parent; if (initializer === node || type === node || isAssignmentOperator(node.kind)) { return spanInPreviousNode(node); } break; } - case 225 /* BinaryExpression */: { + case 226 /* BinaryExpression */: { const { left } = node.parent; if (isArrayLiteralOrObjectLiteralDestructuringPattern(left) && node !== left) { return spanInPreviousNode(node); @@ -142857,14 +144896,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.parent.kind === 248 /* ForInStatement */) { + if (variableDeclaration.parent.parent.kind === 249 /* ForInStatement */) { return spanInNode(variableDeclaration.parent.parent); } const parent2 = variableDeclaration.parent; if (isBindingPattern(variableDeclaration.name)) { return spanInBindingPattern(variableDeclaration.name); } - if (hasOnlyExpressionInitializer(variableDeclaration) && variableDeclaration.initializer || hasSyntacticModifier(variableDeclaration, 1 /* Export */) || parent2.parent.kind === 249 /* ForOfStatement */) { + if (hasOnlyExpressionInitializer(variableDeclaration) && variableDeclaration.initializer || hasSyntacticModifier(variableDeclaration, 1 /* Export */) || parent2.parent.kind === 250 /* ForOfStatement */) { return textSpanFromVariableDeclaration(variableDeclaration); } if (isVariableDeclarationList(variableDeclaration.parent) && variableDeclaration.parent.declarations[0] !== variableDeclaration) { @@ -142891,7 +144930,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { - return hasSyntacticModifier(functionDeclaration, 1 /* Export */) || functionDeclaration.parent.kind === 262 /* ClassDeclaration */ && functionDeclaration.kind !== 175 /* Constructor */; + return hasSyntacticModifier(functionDeclaration, 1 /* Export */) || functionDeclaration.parent.kind === 263 /* ClassDeclaration */ && functionDeclaration.kind !== 176 /* Constructor */; } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -142911,22 +144950,22 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function spanInBlock(block) { switch (block.parent.kind) { - case 266 /* ModuleDeclaration */: + case 267 /* ModuleDeclaration */: if (getModuleInstanceState(block.parent) !== 1 /* Instantiated */) { return void 0; } - case 246 /* WhileStatement */: - case 244 /* IfStatement */: - case 248 /* ForInStatement */: + case 247 /* WhileStatement */: + case 245 /* IfStatement */: + case 249 /* ForInStatement */: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); - case 247 /* ForStatement */: - case 249 /* ForOfStatement */: + case 248 /* ForStatement */: + case 250 /* ForOfStatement */: return spanInNodeIfStartsOnSameLine(findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } return spanInNode(block.statements[0]); } function spanInInitializerOfForLike(forLikeStatement) { - if (forLikeStatement.initializer.kind === 260 /* VariableDeclarationList */) { + if (forLikeStatement.initializer.kind === 261 /* VariableDeclarationList */) { const variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); @@ -142949,64 +144988,64 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function spanInBindingPattern(bindingPattern) { const firstBindingElement = forEach( bindingPattern.elements, - (element) => element.kind !== 231 /* OmittedExpression */ ? element : void 0 + (element) => element.kind !== 232 /* OmittedExpression */ ? element : void 0 ); if (firstBindingElement) { return spanInNode(firstBindingElement); } - if (bindingPattern.parent.kind === 207 /* BindingElement */) { + if (bindingPattern.parent.kind === 208 /* BindingElement */) { return textSpan(bindingPattern.parent); } return textSpanFromVariableDeclaration(bindingPattern.parent); } function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node2) { - Debug.assert(node2.kind !== 206 /* ArrayBindingPattern */ && node2.kind !== 205 /* ObjectBindingPattern */); - const elements = node2.kind === 208 /* ArrayLiteralExpression */ ? node2.elements : node2.properties; + Debug.assert(node2.kind !== 207 /* ArrayBindingPattern */ && node2.kind !== 206 /* ObjectBindingPattern */); + const elements = node2.kind === 209 /* ArrayLiteralExpression */ ? node2.elements : node2.properties; const firstBindingElement = forEach( elements, - (element) => element.kind !== 231 /* OmittedExpression */ ? element : void 0 + (element) => element.kind !== 232 /* OmittedExpression */ ? element : void 0 ); if (firstBindingElement) { return spanInNode(firstBindingElement); } - return textSpan(node2.parent.kind === 225 /* BinaryExpression */ ? node2.parent : node2); + return textSpan(node2.parent.kind === 226 /* BinaryExpression */ ? node2.parent : node2); } function spanInOpenBraceToken(node2) { switch (node2.parent.kind) { - case 265 /* EnumDeclaration */: + case 266 /* EnumDeclaration */: const enumDeclaration = node2.parent; return spanInNodeIfStartsOnSameLine(findPrecedingToken(node2.pos, sourceFile, node2.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 262 /* ClassDeclaration */: + case 263 /* ClassDeclaration */: const classDeclaration = node2.parent; return spanInNodeIfStartsOnSameLine(findPrecedingToken(node2.pos, sourceFile, node2.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 268 /* CaseBlock */: + case 269 /* CaseBlock */: return spanInNodeIfStartsOnSameLine(node2.parent.parent, node2.parent.clauses[0]); } return spanInNode(node2.parent); } function spanInCloseBraceToken(node2) { switch (node2.parent.kind) { - case 267 /* ModuleBlock */: + case 268 /* ModuleBlock */: if (getModuleInstanceState(node2.parent.parent) !== 1 /* Instantiated */) { return void 0; } - case 265 /* EnumDeclaration */: - case 262 /* ClassDeclaration */: + case 266 /* EnumDeclaration */: + case 263 /* ClassDeclaration */: return textSpan(node2); - case 240 /* Block */: + case 241 /* Block */: if (isFunctionBlock(node2.parent)) { return textSpan(node2); } - case 298 /* CatchClause */: + case 299 /* CatchClause */: return spanInNode(lastOrUndefined(node2.parent.statements)); - case 268 /* CaseBlock */: + case 269 /* CaseBlock */: const caseBlock = node2.parent; const lastClause = lastOrUndefined(caseBlock.clauses); if (lastClause) { return spanInNode(lastOrUndefined(lastClause.statements)); } return void 0; - case 205 /* ObjectBindingPattern */: + case 206 /* ObjectBindingPattern */: const bindingPattern = node2.parent; return spanInNode(lastOrUndefined(bindingPattern.elements) || bindingPattern); default: @@ -143019,7 +145058,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function spanInCloseBracketToken(node2) { switch (node2.parent.kind) { - case 206 /* ArrayBindingPattern */: + case 207 /* ArrayBindingPattern */: const bindingPattern = node2.parent; return textSpan(lastOrUndefined(bindingPattern.elements) || bindingPattern); default: @@ -143031,57 +145070,57 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } function spanInOpenParenToken(node2) { - if (node2.parent.kind === 245 /* DoStatement */ || // Go to while keyword and do action instead - node2.parent.kind === 212 /* CallExpression */ || node2.parent.kind === 213 /* NewExpression */) { + if (node2.parent.kind === 246 /* DoStatement */ || // Go to while keyword and do action instead + node2.parent.kind === 213 /* CallExpression */ || node2.parent.kind === 214 /* NewExpression */) { return spanInPreviousNode(node2); } - if (node2.parent.kind === 216 /* ParenthesizedExpression */) { + if (node2.parent.kind === 217 /* ParenthesizedExpression */) { return spanInNextNode(node2); } return spanInNode(node2.parent); } function spanInCloseParenToken(node2) { switch (node2.parent.kind) { - case 217 /* FunctionExpression */: - case 261 /* FunctionDeclaration */: - case 218 /* ArrowFunction */: - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 175 /* Constructor */: - case 246 /* WhileStatement */: - case 245 /* DoStatement */: - case 247 /* ForStatement */: - case 249 /* ForOfStatement */: - case 212 /* CallExpression */: - case 213 /* NewExpression */: - case 216 /* ParenthesizedExpression */: + case 218 /* FunctionExpression */: + case 262 /* FunctionDeclaration */: + case 219 /* ArrowFunction */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 176 /* Constructor */: + case 247 /* WhileStatement */: + case 246 /* DoStatement */: + case 248 /* ForStatement */: + case 250 /* ForOfStatement */: + case 213 /* CallExpression */: + case 214 /* NewExpression */: + case 217 /* ParenthesizedExpression */: return spanInPreviousNode(node2); default: return spanInNode(node2.parent); } } function spanInColonToken(node2) { - if (isFunctionLike(node2.parent) || node2.parent.kind === 302 /* PropertyAssignment */ || node2.parent.kind === 168 /* Parameter */) { + if (isFunctionLike(node2.parent) || node2.parent.kind === 303 /* PropertyAssignment */ || node2.parent.kind === 169 /* Parameter */) { return spanInPreviousNode(node2); } return spanInNode(node2.parent); } function spanInGreaterThanOrLessThanToken(node2) { - if (node2.parent.kind === 215 /* TypeAssertionExpression */) { + if (node2.parent.kind === 216 /* TypeAssertionExpression */) { return spanInNextNode(node2); } return spanInNode(node2.parent); } function spanInWhileKeyword(node2) { - if (node2.parent.kind === 245 /* DoStatement */) { + if (node2.parent.kind === 246 /* DoStatement */) { return textSpanEndingAtNextToken(node2, node2.parent.expression); } return spanInNode(node2.parent); } function spanInOfKeyword(node2) { - if (node2.parent.kind === 249 /* ForOfStatement */) { + if (node2.parent.kind === 250 /* ForOfStatement */) { return spanInNextNode(node2); } return spanInNode(node2.parent); @@ -143179,16 +145218,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return; } switch (node.kind) { - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 173 /* MethodDeclaration */: - if (node.parent.kind === 209 /* ObjectLiteralExpression */) { + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 174 /* MethodDeclaration */: + if (node.parent.kind === 210 /* ObjectLiteralExpression */) { return (_a = getAssignedName(node.parent)) == null ? void 0 : _a.getText(); } return (_b = getNameOfDeclaration(node.parent)) == null ? void 0 : _b.getText(); - case 261 /* FunctionDeclaration */: - case 262 /* ClassDeclaration */: - case 266 /* ModuleDeclaration */: + case 262 /* FunctionDeclaration */: + case 263 /* ClassDeclaration */: + case 267 /* ModuleDeclaration */: if (isModuleBlock(node.parent) && isIdentifier(node.parent.parent.name)) { return node.parent.parent.name.getText(); } @@ -143390,7 +145429,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function collect(node) { if (!node) return; - if (node.flags & 16777216 /* Ambient */) { + if (node.flags & 33554432 /* Ambient */) { return; } if (isValidCallHierarchyDeclaration(node)) { @@ -143405,55 +145444,55 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } switch (node.kind) { case 80 /* Identifier */: - case 270 /* ImportEqualsDeclaration */: - case 271 /* ImportDeclaration */: - case 277 /* ExportDeclaration */: - case 263 /* InterfaceDeclaration */: - case 264 /* TypeAliasDeclaration */: + case 271 /* ImportEqualsDeclaration */: + case 272 /* ImportDeclaration */: + case 278 /* ExportDeclaration */: + case 264 /* InterfaceDeclaration */: + case 265 /* TypeAliasDeclaration */: return; - case 174 /* ClassStaticBlockDeclaration */: + case 175 /* ClassStaticBlockDeclaration */: recordCallSite(node); return; - case 215 /* TypeAssertionExpression */: - case 233 /* AsExpression */: + case 216 /* TypeAssertionExpression */: + case 234 /* AsExpression */: collect(node.expression); return; - case 259 /* VariableDeclaration */: - case 168 /* Parameter */: + case 260 /* VariableDeclaration */: + case 169 /* Parameter */: collect(node.name); collect(node.initializer); return; - case 212 /* CallExpression */: + case 213 /* CallExpression */: recordCallSite(node); collect(node.expression); forEach(node.arguments, collect); return; - case 213 /* NewExpression */: + case 214 /* NewExpression */: recordCallSite(node); collect(node.expression); forEach(node.arguments, collect); return; - case 214 /* TaggedTemplateExpression */: + case 215 /* TaggedTemplateExpression */: recordCallSite(node); collect(node.tag); collect(node.template); return; - case 285 /* JsxOpeningElement */: - case 284 /* JsxSelfClosingElement */: + case 286 /* JsxOpeningElement */: + case 285 /* JsxSelfClosingElement */: recordCallSite(node); collect(node.tagName); collect(node.attributes); return; - case 169 /* Decorator */: + case 170 /* Decorator */: recordCallSite(node); collect(node.expression); return; - case 210 /* PropertyAccessExpression */: - case 211 /* ElementAccessExpression */: + case 211 /* PropertyAccessExpression */: + case 212 /* ElementAccessExpression */: recordCallSite(node); forEachChild(node, collect); break; - case 237 /* SatisfiesExpression */: + case 238 /* SatisfiesExpression */: collect(node.expression); return; } @@ -143506,25 +145545,25 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const callSites = []; const collect = createCallSiteCollector(program, callSites); switch (node.kind) { - case 311 /* SourceFile */: + case 312 /* SourceFile */: collectCallSitesOfSourceFile(node, collect); break; - case 266 /* ModuleDeclaration */: + case 267 /* ModuleDeclaration */: collectCallSitesOfModuleDeclaration(node, collect); break; - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: collectCallSitesOfFunctionLikeDeclaration(program.getTypeChecker(), node, collect); break; - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: collectCallSitesOfClassLikeDeclaration(node, collect); break; - case 174 /* ClassStaticBlockDeclaration */: + case 175 /* ClassStaticBlockDeclaration */: collectCallSitesOfClassStaticBlockDeclaration(node, collect); break; default: @@ -143539,7 +145578,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return createCallHierarchyOutgoingCall(createCallHierarchyItem(program, entries[0].declaration), map(entries, (entry) => createTextSpanFromRange(entry.range))); } function getOutgoingCalls(program, declaration) { - if (declaration.flags & 16777216 /* Ambient */ || isMethodSignature(declaration)) { + if (declaration.flags & 33554432 /* Ambient */ || isMethodSignature(declaration)) { return []; } return group(collectCallSites(program, declaration), getCallSiteGroupKey, (entries) => convertCallSiteGroupToOutgoingCall(program, entries)); @@ -143616,9 +145655,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return { fixName: fixName8, description: description3, changes, fixId: fixId52, fixAllDescription, commands: command ? [command] : void 0 }; } function registerCodeFix(reg) { - for (const error of reg.errorCodes) { + for (const error2 of reg.errorCodes) { errorCodeToFixesArray = void 0; - errorCodeToFixes.add(String(error), reg); + errorCodeToFixes.add(String(error2), reg); } if (reg.fixIds) { for (const fixId52 of reg.fixIds) { @@ -143734,6 +145773,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} registerCodeFix({ errorCodes: [ Diagnostics.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module.code, + Diagnostics.await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module.code, Diagnostics.for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module.code ], getCodeActions: function getCodeActionsToAddEmptyExportDeclaration(context) { @@ -143885,7 +145925,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } const declaration = tryCast(symbol.valueDeclaration, isVariableDeclaration); const variableName = declaration && tryCast(declaration.name, isIdentifier); - const variableStatement = getAncestor(declaration, 242 /* VariableStatement */); + const variableStatement = getAncestor(declaration, 243 /* VariableStatement */); if (!declaration || !variableStatement || declaration.type || !declaration.initializer || variableStatement.getSourceFile() !== sourceFile || hasSyntacticModifier(variableStatement, 1 /* Export */) || !variableName || !isInsideAwaitableBody(declaration.initializer)) { isCompleteFix = false; continue; @@ -143944,7 +145984,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} checker.getTypeAtLocation(errorNode).flags & 1 /* Any */; } function isInsideAwaitableBody(node) { - return node.kind & 32768 /* AwaitContext */ || !!findAncestor(node, (ancestor) => ancestor.parent && isArrowFunction(ancestor.parent) && ancestor.parent.body === ancestor || isBlock(ancestor) && (ancestor.parent.kind === 261 /* FunctionDeclaration */ || ancestor.parent.kind === 217 /* FunctionExpression */ || ancestor.parent.kind === 218 /* ArrowFunction */ || ancestor.parent.kind === 173 /* MethodDeclaration */)); + return node.kind & 65536 /* AwaitContext */ || !!findAncestor(node, (ancestor) => ancestor.parent && isArrowFunction(ancestor.parent) && ancestor.parent.body === ancestor || isBlock(ancestor) && (ancestor.parent.kind === 262 /* FunctionDeclaration */ || ancestor.parent.kind === 218 /* FunctionExpression */ || ancestor.parent.kind === 219 /* ArrowFunction */ || ancestor.parent.kind === 174 /* MethodDeclaration */)); } function makeChange3(changeTracker, errorCode, sourceFile, checker, insertionSite, fixedDeclarations) { if (isForOfStatement(insertionSite.parent) && !insertionSite.parent.awaitModifier) { @@ -144110,10 +146150,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function isPossiblyPartOfDestructuring(node) { switch (node.kind) { case 80 /* Identifier */: - case 208 /* ArrayLiteralExpression */: - case 209 /* ObjectLiteralExpression */: - case 302 /* PropertyAssignment */: - case 303 /* ShorthandPropertyAssignment */: + case 209 /* ArrayLiteralExpression */: + case 210 /* ObjectLiteralExpression */: + case 303 /* PropertyAssignment */: + case 304 /* ShorthandPropertyAssignment */: return true; default: return false; @@ -144130,7 +146170,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function isPossiblyPartOfCommaSeperatedInitializer(node) { switch (node.kind) { case 80 /* Identifier */: - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: case 28 /* CommaToken */: return true; default: @@ -144181,7 +146221,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return; } const declaration = token.parent; - if (declaration.kind === 171 /* PropertyDeclaration */ && (!fixedNodes || tryAddToSet(fixedNodes, declaration))) { + if (declaration.kind === 172 /* PropertyDeclaration */ && (!fixedNodes || tryAddToSet(fixedNodes, declaration))) { changeTracker.insertModifierBefore(sourceFile, 138 /* DeclareKeyword */, declaration); } } @@ -144348,7 +146388,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const d = add.valueDeclaration; if (d && (isPropertySignature(d) || isPropertyDeclaration(d)) && d.type) { const t = factory.createUnionTypeNode([ - ...d.type.kind === 191 /* UnionType */ ? d.type.types : [d.type], + ...d.type.kind === 192 /* UnionType */ ? d.type.types : [d.type], factory.createTypeReferenceNode("undefined") ]); changes.replaceNode(d.getSourceFile(), d.type, t); @@ -144425,26 +146465,26 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } function isDeclarationWithType(node) { - return isFunctionLikeDeclaration(node) || node.kind === 259 /* VariableDeclaration */ || node.kind === 170 /* PropertySignature */ || node.kind === 171 /* PropertyDeclaration */; + return isFunctionLikeDeclaration(node) || node.kind === 260 /* VariableDeclaration */ || node.kind === 171 /* PropertySignature */ || node.kind === 172 /* PropertyDeclaration */; } function transformJSDocType(node) { switch (node.kind) { - case 318 /* JSDocAllType */: - case 319 /* JSDocUnknownType */: + case 319 /* JSDocAllType */: + case 320 /* JSDocUnknownType */: return factory.createTypeReferenceNode("any", emptyArray); - case 322 /* JSDocOptionalType */: + case 323 /* JSDocOptionalType */: return transformJSDocOptionalType(node); - case 321 /* JSDocNonNullableType */: + case 322 /* JSDocNonNullableType */: return transformJSDocType(node.type); - case 320 /* JSDocNullableType */: + case 321 /* JSDocNullableType */: return transformJSDocNullableType(node); - case 324 /* JSDocVariadicType */: + case 325 /* JSDocVariadicType */: return transformJSDocVariadicType(node); - case 323 /* JSDocFunctionType */: + case 324 /* JSDocFunctionType */: return transformJSDocFunctionType(node); - case 182 /* TypeReference */: + case 183 /* TypeReference */: return transformJSDocTypeReference(node); - case 328 /* JSDocTypeLiteral */: + case 329 /* JSDocTypeLiteral */: return transformJSDocTypeLiteral(node); default: const visited = visitEachChild(node, transformJSDocType, nullTransformationContext); @@ -144477,7 +146517,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function transformJSDocParameter(node) { const index = node.parent.parameters.indexOf(node); - const isRest = node.type.kind === 324 /* JSDocVariadicType */ && index === node.parent.parameters.length - 1; + const isRest = node.type.kind === 325 /* JSDocVariadicType */ && index === node.parent.parameters.length - 1; const name = node.name || (isRest ? "rest" : "arg" + index); const dotdotdot = isRest ? factory.createToken(26 /* DotDotDotToken */) : node.dotDotDotToken; return factory.createParameterDeclaration(node.modifiers, dotdotdot, name, node.questionToken, visitNode(node.type, transformJSDocType, isTypeNode), node.initializer); @@ -144659,7 +146699,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} })) { return; } - const nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 243 /* ExpressionStatement */ ? assignmentBinaryExpression.parent : assignmentBinaryExpression; + const nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 244 /* ExpressionStatement */ ? assignmentBinaryExpression.parent : assignmentBinaryExpression; changes.delete(sourceFile, nodeToDelete); if (!assignmentExpr) { members.push(factory.createPropertyDeclaration( @@ -144744,7 +146784,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function createArrowFunctionExpressionMember(members2, arrowFunction, name) { const arrowFunctionBody = arrowFunction.body; let bodyBlock; - if (arrowFunctionBody.kind === 240 /* Block */) { + if (arrowFunctionBody.kind === 241 /* Block */) { bodyBlock = arrowFunctionBody; } else { bodyBlock = factory.createBlock([factory.createReturnStatement(arrowFunctionBody)]); @@ -145307,7 +147347,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} switch (func.kind) { case 106 /* NullKeyword */: break; - case 210 /* PropertyAccessExpression */: + case 211 /* PropertyAccessExpression */: case 80 /* Identifier */: if (!inputArgName) { break; @@ -145332,8 +147372,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} continuationArgName.types.push(transformer.checker.getAwaitedType(returnType) || returnType); } return varDeclOrAssignment; - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: { + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: { const funcBody = func.body; const returnType2 = (_a = getLastCallSignature(transformer.checker.getTypeAtLocation(func), transformer.checker)) == null ? void 0 : _a.getReturnType(); if (isBlock(funcBody)) { @@ -145575,7 +147615,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } const importNode = importFromModuleSpecifier(moduleSpecifier); switch (importNode.kind) { - case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportEqualsDeclaration */: changes.replaceNode(importingFile, importNode, makeImport( importNode.name, /*namedImports*/ @@ -145584,7 +147624,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} quotePreference )); break; - case 212 /* CallExpression */: + case 213 /* CallExpression */: if (isRequireCall( importNode, /*requireStringLiteralLikeArgument*/ @@ -145653,13 +147693,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function convertStatement(sourceFile, statement, checker, changes, identifiers, target, exports, useSitesToUnqualify, quotePreference) { switch (statement.kind) { - case 242 /* VariableStatement */: + case 243 /* VariableStatement */: convertVariableStatement(sourceFile, statement, changes, checker, identifiers, target, quotePreference); return false; - case 243 /* ExpressionStatement */: { + case 244 /* ExpressionStatement */: { const { expression } = statement; switch (expression.kind) { - case 212 /* CallExpression */: { + case 213 /* CallExpression */: { if (isRequireCall( expression, /*requireStringLiteralLikeArgument*/ @@ -145676,7 +147716,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return false; } - case 225 /* BinaryExpression */: { + case 226 /* BinaryExpression */: { const { operatorToken } = expression; return operatorToken.kind === 64 /* EqualsToken */ && convertAssignment(sourceFile, checker, expression, changes, exports, useSitesToUnqualify); } @@ -145730,8 +147770,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function convertPropertyAccessImport(name, propertyName, moduleSpecifier, identifiers, quotePreference) { switch (name.kind) { - case 205 /* ObjectBindingPattern */: - case 206 /* ArrayBindingPattern */: { + case 206 /* ObjectBindingPattern */: + case 207 /* ArrayBindingPattern */: { const tmp = makeUniqueName(propertyName, identifiers); return convertedImports([ makeSingleImport(tmp, propertyName, moduleSpecifier, quotePreference), @@ -145779,14 +147819,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function tryChangeModuleExportsObject(object, useSitesToUnqualify) { const statements = mapAllOrFail(object.properties, (prop) => { switch (prop.kind) { - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 303 /* ShorthandPropertyAssignment */: - case 304 /* SpreadAssignment */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 304 /* ShorthandPropertyAssignment */: + case 305 /* SpreadAssignment */: return void 0; - case 302 /* PropertyAssignment */: + case 303 /* PropertyAssignment */: return !isIdentifier(prop.name) ? void 0 : convertExportsDotXEquals_replaceNode(prop.name.text, prop.initializer, useSitesToUnqualify); - case 173 /* MethodDeclaration */: + case 174 /* MethodDeclaration */: return !isIdentifier(prop.name) ? void 0 : functionExpressionToDeclaration(prop.name.text, [factory.createToken(95 /* ExportKeyword */)], prop, useSitesToUnqualify); default: Debug.assertNever(prop, `Convert to ES6 got invalid prop kind ${prop.kind}`); @@ -145864,15 +147904,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function convertExportsDotXEquals_replaceNode(name, exported, useSitesToUnqualify) { const modifiers = [factory.createToken(95 /* ExportKeyword */)]; switch (exported.kind) { - case 217 /* FunctionExpression */: { + case 218 /* FunctionExpression */: { const { name: expressionName } = exported; if (expressionName && expressionName.text !== name) { return exportConst(); } } - case 218 /* ArrowFunction */: + case 219 /* ArrowFunction */: return functionExpressionToDeclaration(name, modifiers, exported, useSitesToUnqualify); - case 230 /* ClassExpression */: + case 231 /* ClassExpression */: return classExpressionToDeclaration(name, modifiers, exported, useSitesToUnqualify); default: return exportConst(); @@ -145897,7 +147937,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} replaceNode ); function replaceNode(original) { - if (original.kind === 210 /* PropertyAccessExpression */) { + if (original.kind === 211 /* PropertyAccessExpression */) { const replacement = useSitesToUnqualify.get(original); useSitesToUnqualify.delete(original); return replacement; @@ -145906,7 +147946,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function convertSingleImport(name, moduleSpecifier, checker, identifiers, target, quotePreference) { switch (name.kind) { - case 205 /* ObjectBindingPattern */: { + case 206 /* ObjectBindingPattern */: { const importSpecifiers = mapAllOrFail(name.elements, (e) => e.dotDotDotToken || e.initializer || e.propertyName && !isIdentifier(e.propertyName) || !isIdentifier(e.name) ? void 0 : makeImportSpecifier2(e.propertyName && e.propertyName.text, e.name.text)); if (importSpecifiers) { return convertedImports([makeImport( @@ -145918,7 +147958,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} )]); } } - case 206 /* ArrayBindingPattern */: { + case 207 /* ArrayBindingPattern */: { const tmp = makeUniqueName(moduleSpecifierToValidIdentifier(moduleSpecifier.text, target), identifiers); return convertedImports([ makeImport( @@ -146005,11 +148045,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function isFreeIdentifier(node) { const { parent: parent2 } = node; switch (parent2.kind) { - case 210 /* PropertyAccessExpression */: + case 211 /* PropertyAccessExpression */: return parent2.name !== node; - case 207 /* BindingElement */: + case 208 /* BindingElement */: return parent2.propertyName !== node; - case 275 /* ImportSpecifier */: + case 276 /* ImportSpecifier */: return parent2.propertyName !== node; default: return true; @@ -146250,7 +148290,27 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const { parent: parent2 } = getTokenAtPosition(sourceFile, pos); return isImportSpecifier(parent2) || isImportDeclaration(parent2) && parent2.importClause ? parent2 : void 0; } + function canConvertImportDeclarationForSpecifier(specifier, sourceFile, program) { + if (specifier.parent.parent.name) { + return false; + } + const nonTypeOnlySpecifiers = specifier.parent.elements.filter((e) => !e.isTypeOnly); + if (nonTypeOnlySpecifiers.length === 1) { + return true; + } + const checker = program.getTypeChecker(); + for (const specifier2 of nonTypeOnlySpecifiers) { + const isUsedAsValue = ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(specifier2.name, checker, sourceFile, (usage) => { + return !isValidTypeOnlyAliasUseSite(usage); + }); + if (isUsedAsValue) { + return false; + } + } + return true; + } function doChange11(changes, sourceFile, declaration) { + var _a; if (isImportSpecifier(declaration)) { changes.replaceNode(sourceFile, declaration, factory.updateImportSpecifier( declaration, @@ -146321,6 +148381,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ) ]); } else { + const newNamedBindings = ((_a = importClause.namedBindings) == null ? void 0 : _a.kind) === 275 /* NamedImports */ ? factory.updateNamedImports( + importClause.namedBindings, + sameMap(importClause.namedBindings.elements, (e) => factory.updateImportSpecifier( + e, + /*isTypeOnly*/ + false, + e.propertyName, + e.name + )) + ) : importClause.namedBindings; const importDeclaration = factory.updateImportDeclaration( declaration, declaration.modifiers, @@ -146329,7 +148399,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} /*isTypeOnly*/ true, importClause.name, - importClause.namedBindings + newNamedBindings ), declaration.moduleSpecifier, declaration.assertClause @@ -146352,19 +148422,41 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} registerCodeFix({ errorCodes: errorCodes14, getCodeActions: function getCodeActionsToConvertToTypeOnlyImport(context) { + var _a; const declaration = getDeclaration2(context.sourceFile, context.span.start); if (declaration) { const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, context.sourceFile, declaration)); - return [createCodeFixAction(fixId13, changes, Diagnostics.Convert_to_type_only_import, fixId13, Diagnostics.Convert_all_imports_not_used_as_a_value_to_type_only_imports)]; + const importDeclarationChanges = declaration.kind === 276 /* ImportSpecifier */ && canConvertImportDeclarationForSpecifier(declaration, context.sourceFile, context.program) ? ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, context.sourceFile, declaration.parent.parent.parent)) : void 0; + const mainAction = createCodeFixAction( + fixId13, + changes, + declaration.kind === 276 /* ImportSpecifier */ ? [Diagnostics.Use_type_0, ((_a = declaration.propertyName) == null ? void 0 : _a.text) ?? declaration.name.text] : Diagnostics.Use_import_type, + fixId13, + Diagnostics.Fix_all_with_type_only_imports + ); + if (some(importDeclarationChanges)) { + return [ + createCodeFixActionWithoutFixAll(fixId13, importDeclarationChanges, Diagnostics.Use_import_type), + mainAction + ]; + } + return [mainAction]; } return void 0; }, fixIds: [fixId13], getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyImport(context) { + const fixedImportDeclarations = /* @__PURE__ */ new Set(); return codeFixAll(context, errorCodes14, (changes, diag2) => { - const declaration = getDeclaration2(diag2.file, diag2.start); - if (declaration) { - doChange11(changes, diag2.file, declaration); + const errorDeclaration = getDeclaration2(diag2.file, diag2.start); + if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 272 /* ImportDeclaration */ && !fixedImportDeclarations.has(errorDeclaration)) { + doChange11(changes, diag2.file, errorDeclaration); + fixedImportDeclarations.add(errorDeclaration); + } else if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 276 /* ImportSpecifier */ && !fixedImportDeclarations.has(errorDeclaration.parent.parent.parent) && canConvertImportDeclarationForSpecifier(errorDeclaration, diag2.file, context.program)) { + doChange11(changes, diag2.file, errorDeclaration.parent.parent.parent); + fixedImportDeclarations.add(errorDeclaration.parent.parent.parent); + } else if ((errorDeclaration == null ? void 0 : errorDeclaration.kind) === 276 /* ImportSpecifier */) { + doChange11(changes, diag2.file, errorDeclaration); } }); } @@ -146373,23 +148465,60 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} }); // src/services/codefixes/convertTypedefToType.ts - function doChange12(changes, node, sourceFile) { - if (isJSDocTypedefTag(node)) { - fixSingleTypeDef(changes, node, sourceFile); - } - } - function fixSingleTypeDef(changes, typeDefNode, sourceFile) { - if (!typeDefNode) + function doChange12(changes, node, sourceFile, newLine, fixAll = false) { + if (!isJSDocTypedefTag(node)) return; - const declaration = createDeclaration(typeDefNode); + const declaration = createDeclaration(node); if (!declaration) return; - const comment = typeDefNode.parent; - changes.replaceNode( - sourceFile, - comment, - declaration + const commentNode = node.parent; + const { leftSibling, rightSibling } = getLeftAndRightSiblings(node); + let pos = commentNode.getStart(); + let prefix = ""; + if (!leftSibling && commentNode.comment) { + pos = findEndOfTextBetween(commentNode, commentNode.getStart(), node.getStart()); + prefix = `${newLine} */${newLine}`; + } + if (leftSibling) { + if (fixAll && isJSDocTypedefTag(leftSibling)) { + pos = node.getStart(); + prefix = ""; + } else { + pos = findEndOfTextBetween(commentNode, leftSibling.getStart(), node.getStart()); + prefix = `${newLine} */${newLine}`; + } + } + let end = commentNode.getEnd(); + let suffix = ""; + if (rightSibling) { + if (fixAll && isJSDocTypedefTag(rightSibling)) { + end = rightSibling.getStart(); + suffix = `${newLine}${newLine}`; + } else { + end = rightSibling.getStart(); + suffix = `${newLine}/**${newLine} * `; + } + } + changes.replaceRange(sourceFile, { pos, end }, declaration, { prefix, suffix }); + } + function getLeftAndRightSiblings(typedefNode) { + const commentNode = typedefNode.parent; + const maxChildIndex = commentNode.getChildCount() - 1; + const currentNodeIndex = commentNode.getChildren().findIndex( + (n) => n.getStart() === typedefNode.getStart() && n.getEnd() === typedefNode.getEnd() ); + const leftSibling = currentNodeIndex > 0 ? commentNode.getChildAt(currentNodeIndex - 1) : void 0; + const rightSibling = currentNodeIndex < maxChildIndex ? commentNode.getChildAt(currentNodeIndex + 1) : void 0; + return { leftSibling, rightSibling }; + } + function findEndOfTextBetween(jsDocComment, from, to) { + const comment = jsDocComment.getText().substring(from - jsDocComment.getStart(), to - jsDocComment.getStart()); + for (let i = comment.length; i > 0; i--) { + if (!/[*/\s]/g.test(comment.substring(i - 1, i))) { + return from + i; + } + } + return to; } function createDeclaration(tag) { var _a; @@ -146399,10 +148528,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const typeName = (_a = tag.name) == null ? void 0 : _a.getText(); if (!typeName) return; - if (typeExpression.kind === 328 /* JSDocTypeLiteral */) { + if (typeExpression.kind === 329 /* JSDocTypeLiteral */) { return createInterfaceForTypeLiteral(typeName, typeExpression); } - if (typeExpression.kind === 315 /* JSDocTypeExpression */) { + if (typeExpression.kind === 316 /* JSDocTypeExpression */) { return createTypeAliasForTypeExpression(typeName, typeExpression); } } @@ -146410,7 +148539,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const propertySignatures = createSignatureFromTypeLiteral(typeLiteral); if (!some(propertySignatures)) return; - const interfaceDeclaration = factory.createInterfaceDeclaration( + return factory.createInterfaceDeclaration( /*modifiers*/ void 0, typeName, @@ -146420,13 +148549,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} void 0, propertySignatures ); - return interfaceDeclaration; } function createTypeAliasForTypeExpression(typeName, typeExpression) { const typeReference = getSynthesizedDeepClone(typeExpression.type); if (!typeReference) return; - const declaration = factory.createTypeAliasDeclaration( + return factory.createTypeAliasDeclaration( /*modifiers*/ void 0, factory.createIdentifier(typeName), @@ -146434,7 +148562,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} void 0, typeReference ); - return declaration; } function createSignatureFromTypeLiteral(typeLiteral) { const propertyTags = typeLiteral.jsDocPropertyTags; @@ -146454,30 +148581,28 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } if (typeReference && name) { const questionToken = isOptional ? factory.createToken(58 /* QuestionToken */) : void 0; - const prop = factory.createPropertySignature( + return factory.createPropertySignature( /*modifiers*/ void 0, name, questionToken, typeReference ); - return prop; } }; - const props = mapDefined(propertyTags, getSignature); - return props; + return mapDefined(propertyTags, getSignature); } function getPropertyName(tag) { return tag.name.kind === 80 /* Identifier */ ? tag.name.text : tag.name.right.text; } - function getJSDocTypedefNode(node) { + function getJSDocTypedefNodes(node) { if (hasJSDocNodes(node)) { - return forEach(node.jsDoc, (node2) => { + return flatMap(node.jsDoc, (doc) => { var _a; - return (_a = node2.tags) == null ? void 0 : _a.find(isJSDocTypedefTag); + return (_a = doc.tags) == null ? void 0 : _a.filter((tag) => isJSDocTypedefTag(tag)); }); } - return void 0; + return []; } var fixId14, errorCodes15; var init_convertTypedefToType = __esm({ @@ -146491,13 +148616,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} fixIds: [fixId14], errorCodes: errorCodes15, getCodeActions(context) { + const newLineCharacter = getNewLineOrDefaultFromHost(context.host, context.formatContext.options); const node = getTokenAtPosition( context.sourceFile, context.span.start ); if (!node) return; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange12(t, node, context.sourceFile)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange12(t, node, context.sourceFile, newLineCharacter)); if (changes.length > 0) { return [ createCodeFixAction( @@ -146510,11 +148636,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ]; } }, - getAllCodeActions: (context) => codeFixAll(context, errorCodes15, (changes, diag2) => { - const node = getTokenAtPosition(diag2.file, diag2.start); - if (node) - doChange12(changes, node, diag2.file); - }) + getAllCodeActions: (context) => codeFixAll( + context, + errorCodes15, + (changes, diag2) => { + const newLineCharacter = getNewLineOrDefaultFromHost(context.host, context.formatContext.options); + const node = getTokenAtPosition(diag2.file, diag2.start); + const fixAll = true; + if (node) + doChange12(changes, node, diag2.file, newLineCharacter, fixAll); + } + ) }); } }); @@ -146827,8 +148959,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return `${topLevelTypeOnly ? 1 : 0}|${moduleSpecifier}`; } } - function writeFixes(changeTracker) { - const quotePreference = getQuotePreference(sourceFile, preferences); + function writeFixes(changeTracker, oldFileQuotePreference) { + let quotePreference; + if (sourceFile.imports.length === 0 && oldFileQuotePreference !== void 0) { + quotePreference = oldFileQuotePreference; + } else { + quotePreference = getQuotePreference(sourceFile, preferences); + } for (const fix of addToNamespace) { addNamespaceQualifier(changeTracker, sourceFile, fix); } @@ -147016,11 +149153,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function getNamespaceLikeImportText(declaration) { var _a, _b, _c; switch (declaration.kind) { - case 259 /* VariableDeclaration */: + case 260 /* VariableDeclaration */: return (_a = tryCast(declaration.name, isIdentifier)) == null ? void 0 : _a.text; - case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportEqualsDeclaration */: return declaration.name.text; - case 271 /* ImportDeclaration */: + case 272 /* ImportDeclaration */: return (_c = tryCast((_b = declaration.importClause) == null ? void 0 : _b.namedBindings, isNamespaceImport)) == null ? void 0 : _c.name.text; default: return Debug.assertNever(declaration); @@ -147052,11 +149189,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return best; function getAddToExistingImportFix({ declaration, importKind, symbol, targetFlags }) { - if (importKind === 3 /* CommonJS */ || importKind === 2 /* Namespace */ || declaration.kind === 270 /* ImportEqualsDeclaration */) { + if (importKind === 3 /* CommonJS */ || importKind === 2 /* Namespace */ || declaration.kind === 271 /* ImportEqualsDeclaration */) { return void 0; } - if (declaration.kind === 259 /* VariableDeclaration */) { - return (importKind === 0 /* Named */ || importKind === 1 /* Default */) && declaration.name.kind === 205 /* ObjectBindingPattern */ ? { kind: 2 /* AddToExisting */, importClauseOrBindingPattern: declaration.name, importKind, moduleSpecifier: declaration.initializer.arguments[0].text, addAsTypeOnly: 4 /* NotAllowed */ } : void 0; + if (declaration.kind === 260 /* VariableDeclaration */) { + return (importKind === 0 /* Named */ || importKind === 1 /* Default */) && declaration.name.kind === 206 /* ObjectBindingPattern */ ? { kind: 2 /* AddToExisting */, importClauseOrBindingPattern: declaration.name, importKind, moduleSpecifier: declaration.initializer.arguments[0].text, addAsTypeOnly: 4 /* NotAllowed */ } : void 0; } const { importClause } = declaration; if (!importClause || !isStringLiteralLike(declaration.moduleSpecifier)) { @@ -147079,7 +149216,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} addAsTypeOnly === 2 /* Required */ && namedBindings)) { return void 0; } - if (importKind === 0 /* Named */ && (namedBindings == null ? void 0 : namedBindings.kind) === 273 /* NamespaceImport */) { + if (importKind === 0 /* Named */ && (namedBindings == null ? void 0 : namedBindings.kind) === 274 /* NamespaceImport */) { return void 0; } return { @@ -147100,7 +149237,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (moduleSymbol) { (importMap || (importMap = createMultiMap())).add(getSymbolId(moduleSymbol), i.parent); } - } else if (i.kind === 271 /* ImportDeclaration */ || i.kind === 270 /* ImportEqualsDeclaration */) { + } else if (i.kind === 272 /* ImportDeclaration */ || i.kind === 271 /* ImportEqualsDeclaration */) { const moduleSymbol = checker.getSymbolAtLocation(moduleSpecifier); if (moduleSymbol) { (importMap || (importMap = createMultiMap())).add(getSymbolId(moduleSymbol), i); @@ -147131,6 +149268,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (compilerOptions.configFile) { return getEmitModuleKind(compilerOptions) < 5 /* ES2015 */; } + if (sourceFile.impliedNodeFormat === 1 /* CommonJS */) + return true; + if (sourceFile.impliedNodeFormat === 99 /* ESNext */) + return false; for (const otherFile of program.getSourceFiles()) { if (otherFile === sourceFile || !isSourceFileJS(otherFile) || program.isSourceFileFromExternalLibrary(otherFile)) continue; @@ -147552,7 +149693,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} case 4 /* PromoteTypeOnly */: { const { typeOnlyAliasDeclaration } = fix; const promotedDeclaration = promoteFromTypeOnly(changes, typeOnlyAliasDeclaration, compilerOptions, sourceFile, preferences); - return promotedDeclaration.kind === 275 /* ImportSpecifier */ ? [Diagnostics.Remove_type_from_import_of_0_from_1, symbolName2, getModuleSpecifierText(promotedDeclaration.parent.parent)] : [Diagnostics.Remove_type_from_import_declaration_from_0, getModuleSpecifierText(promotedDeclaration)]; + return promotedDeclaration.kind === 276 /* ImportSpecifier */ ? [Diagnostics.Remove_type_from_import_of_0_from_1, symbolName2, getModuleSpecifierText(promotedDeclaration.parent.parent)] : [Diagnostics.Remove_type_from_import_declaration_from_0, getModuleSpecifierText(promotedDeclaration)]; } default: return Debug.assertNever(fix, `Unexpected fix kind ${fix.kind}`); @@ -147560,12 +149701,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function getModuleSpecifierText(promotedDeclaration) { var _a, _b; - return promotedDeclaration.kind === 270 /* ImportEqualsDeclaration */ ? ((_b = tryCast((_a = tryCast(promotedDeclaration.moduleReference, isExternalModuleReference)) == null ? void 0 : _a.expression, isStringLiteralLike)) == null ? void 0 : _b.text) || promotedDeclaration.moduleReference.getText() : cast(promotedDeclaration.parent.moduleSpecifier, isStringLiteral).text; + return promotedDeclaration.kind === 271 /* ImportEqualsDeclaration */ ? ((_b = tryCast((_a = tryCast(promotedDeclaration.moduleReference, isExternalModuleReference)) == null ? void 0 : _a.expression, isStringLiteralLike)) == null ? void 0 : _b.text) || promotedDeclaration.moduleReference.getText() : cast(promotedDeclaration.parent.moduleSpecifier, isStringLiteral).text; } function promoteFromTypeOnly(changes, aliasDeclaration, compilerOptions, sourceFile, preferences) { const convertExistingToTypeOnly = importNameElisionDisabled(compilerOptions); switch (aliasDeclaration.kind) { - case 275 /* ImportSpecifier */: + case 276 /* ImportSpecifier */: if (aliasDeclaration.isTypeOnly) { const sortKind = ts_OrganizeImports_exports.detectImportSpecifierSorting(aliasDeclaration.parent.elements, preferences); if (aliasDeclaration.parent.elements.length > 1 && sortKind) { @@ -147589,13 +149730,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} promoteImportClause(aliasDeclaration.parent.parent); return aliasDeclaration.parent.parent; } - case 272 /* ImportClause */: + case 273 /* ImportClause */: promoteImportClause(aliasDeclaration); return aliasDeclaration; - case 273 /* NamespaceImport */: + case 274 /* NamespaceImport */: promoteImportClause(aliasDeclaration.parent); return aliasDeclaration.parent; - case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportEqualsDeclaration */: changes.deleteRange(sourceFile, aliasDeclaration.getChildAt(1)); return aliasDeclaration; default: @@ -147603,10 +149744,18 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function promoteImportClause(importClause) { changes.delete(sourceFile, getTypeKeywordOfTypeOnlyImport(importClause, sourceFile)); + if (!compilerOptions.allowImportingTsExtensions) { + const moduleSpecifier = tryGetModuleSpecifierFromDeclaration(importClause.parent); + const resolvedModule = moduleSpecifier && getResolvedModule(sourceFile, moduleSpecifier.text, getModeForUsageLocation(sourceFile, moduleSpecifier)); + if (resolvedModule == null ? void 0 : resolvedModule.resolvedUsingTsExtension) { + const changedExtension = changeAnyExtension(moduleSpecifier.text, getOutputExtension(moduleSpecifier.text, compilerOptions)); + changes.replaceNode(sourceFile, moduleSpecifier, factory.createStringLiteral(changedExtension)); + } + } if (convertExistingToTypeOnly) { const namedImports = tryCast(importClause.namedBindings, isNamedImports); if (namedImports && namedImports.elements.length > 1) { - if (ts_OrganizeImports_exports.detectImportSpecifierSorting(namedImports.elements, preferences) && aliasDeclaration.kind === 275 /* ImportSpecifier */ && namedImports.elements.indexOf(aliasDeclaration) !== 0) { + if (ts_OrganizeImports_exports.detectImportSpecifierSorting(namedImports.elements, preferences) && aliasDeclaration.kind === 276 /* ImportSpecifier */ && namedImports.elements.indexOf(aliasDeclaration) !== 0) { changes.delete(sourceFile, aliasDeclaration); changes.insertImportSpecifierAtIndex(sourceFile, aliasDeclaration, namedImports, 0); } @@ -147621,7 +149770,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImports, preferences) { var _a; - if (clause.kind === 205 /* ObjectBindingPattern */) { + if (clause.kind === 206 /* ObjectBindingPattern */) { if (defaultImport) { addElementToBindingPattern(clause, defaultImport.name, "default"); } @@ -148057,7 +150206,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const lastDecorator = findLast(modifiers, isDecorator); const modifierPos = abstractModifier ? abstractModifier.end : staticModifier ? staticModifier.end : accessibilityModifier ? accessibilityModifier.end : lastDecorator ? skipTrivia(sourceFile.text, lastDecorator.end) : classElement.getStart(sourceFile); const options = accessibilityModifier || staticModifier || abstractModifier ? { prefix: " " } : { suffix: " " }; - changeTracker.insertModifierAt(sourceFile, modifierPos, 163 /* OverrideKeyword */, options); + changeTracker.insertModifierAt(sourceFile, modifierPos, 164 /* OverrideKeyword */, options); } function doRemoveOverrideModifierChange(changeTracker, sourceFile, pos) { const classElement = findContainerClassElementLike(sourceFile, pos); @@ -148071,13 +150220,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function isClassElementLikeHasJSDoc(node) { switch (node.kind) { - case 175 /* Constructor */: - case 171 /* PropertyDeclaration */: - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 176 /* Constructor */: + case 172 /* PropertyDeclaration */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: return true; - case 168 /* Parameter */: + case 169 /* Parameter */: return isParameterPropertyDeclaration(node, node.parent); default: return false; @@ -148483,7 +150632,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} // src/services/codefixes/fixIncorrectNamedTupleSyntax.ts function getNamedTupleMember(sourceFile, pos) { const token = getTokenAtPosition(sourceFile, pos); - return findAncestor(token, (t) => t.kind === 201 /* NamedTupleMember */); + return findAncestor(token, (t) => t.kind === 202 /* NamedTupleMember */); } function doChange17(changes, sourceFile, namedTupleMember) { if (!namedTupleMember) { @@ -148492,10 +150641,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} let unwrappedType = namedTupleMember.type; let sawOptional = false; let sawRest = false; - while (unwrappedType.kind === 189 /* OptionalType */ || unwrappedType.kind === 190 /* RestType */ || unwrappedType.kind === 195 /* ParenthesizedType */) { - if (unwrappedType.kind === 189 /* OptionalType */) { + while (unwrappedType.kind === 190 /* OptionalType */ || unwrappedType.kind === 191 /* RestType */ || unwrappedType.kind === 196 /* ParenthesizedType */) { + if (unwrappedType.kind === 190 /* OptionalType */) { sawOptional = true; - } else if (unwrappedType.kind === 190 /* RestType */) { + } else if (unwrappedType.kind === 191 /* RestType */) { sawRest = true; } unwrappedType = unwrappedType.type; @@ -148547,7 +150696,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (isPropertyAccessExpression(parent2) && parent2.name === node) { Debug.assert(isMemberName(node), "Expected an identifier for spelling (property access)"); let containingType = checker.getTypeAtLocation(parent2.expression); - if (parent2.flags & 32 /* OptionalChain */) { + if (parent2.flags & 64 /* OptionalChain */) { containingType = checker.getNonNullableType(containingType); } suggestedSymbol = checker.getSuggestedSymbolForNonexistentProperty(node, containingType); @@ -148780,6 +150929,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (!declaration || !isCallExpression(declaration.parent) || !declaration.body) return void 0; const pos = declaration.parent.arguments.indexOf(declaration); + if (pos === -1) + return void 0; const type = checker.getContextualTypeForArgumentAtIndex(declaration.parent, pos); if (!type) return void 0; @@ -148808,19 +150959,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function getVariableLikeInitializer(declaration) { switch (declaration.kind) { - case 259 /* VariableDeclaration */: - case 168 /* Parameter */: - case 207 /* BindingElement */: - case 171 /* PropertyDeclaration */: - case 302 /* PropertyAssignment */: + case 260 /* VariableDeclaration */: + case 169 /* Parameter */: + case 208 /* BindingElement */: + case 172 /* PropertyDeclaration */: + case 303 /* PropertyAssignment */: return declaration.initializer; - case 290 /* JsxAttribute */: + case 291 /* JsxAttribute */: return declaration.initializer && (isJsxExpression(declaration.initializer) ? declaration.initializer.expression : void 0); - case 303 /* ShorthandPropertyAssignment */: - case 170 /* PropertySignature */: - case 305 /* EnumMember */: - case 354 /* JSDocPropertyTag */: - case 347 /* JSDocParameterTag */: + case 304 /* ShorthandPropertyAssignment */: + case 171 /* PropertySignature */: + case 306 /* EnumMember */: + case 355 /* JSDocPropertyTag */: + case 348 /* JSDocParameterTag */: return void 0; } } @@ -149048,7 +151199,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function addMissingMemberInJs(changeTracker, sourceFile, classDeclaration, token, makeStatic) { const tokenName = token.text; if (makeStatic) { - if (classDeclaration.kind === 230 /* ClassExpression */) { + if (classDeclaration.kind === 231 /* ClassExpression */) { return; } const className = classDeclaration.name.getText(); @@ -149101,7 +151252,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function getTypeNode2(checker, node, token) { let typeNode; - if (token.parent.parent.kind === 225 /* BinaryExpression */) { + if (token.parent.parent.kind === 226 /* BinaryExpression */) { const binaryExpression = token.parent.parent; const otherExpression = token.parent === binaryExpression.left ? binaryExpression.right : binaryExpression.left; const widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(otherExpression))); @@ -149179,9 +151330,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (call === void 0) { return void 0; } - if (isPrivateIdentifier(token)) { - return void 0; - } const methodName = token.text; const addMethodDeclarationChanges = (modifierFlags2) => ts_textChanges_exports.ChangeTracker.with(context, (t) => addMethodDeclaration(context, t, call, token, modifierFlags2, parentDeclaration, declSourceFile)); const actions2 = [createCodeFixAction(fixMissingMember, addMethodDeclarationChanges(modifierFlags & 32 /* Static */), [modifierFlags & 32 /* Static */ ? Diagnostics.Declare_static_method_0 : Diagnostics.Declare_method_0, methodName], fixMissingMember, Diagnostics.Add_all_missing_members)]; @@ -149192,7 +151340,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function addMethodDeclaration(context, changes, callExpression, name, modifierFlags, parentDeclaration, sourceFile) { const importAdder = createImportAdder(sourceFile, context.program, context.preferences, context.host); - const kind = isClassLike(parentDeclaration) ? 173 /* MethodDeclaration */ : 172 /* MethodSignature */; + const kind = isClassLike(parentDeclaration) ? 174 /* MethodDeclaration */ : 173 /* MethodSignature */; const signatureDeclaration = createSignatureDeclarationFromCallExpression(kind, context, importAdder, callExpression, name, modifierFlags, parentDeclaration); const containingMethodDeclaration = tryGetContainingMethodDeclaration(parentDeclaration, callExpression); if (containingMethodDeclaration) { @@ -149221,8 +151369,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function addFunctionDeclaration(changes, context, info) { const quotePreference = getQuotePreference(context.sourceFile, context.preferences); const importAdder = createImportAdder(context.sourceFile, context.program, context.preferences, context.host); - const functionDeclaration = info.kind === 2 /* Function */ ? createSignatureDeclarationFromCallExpression(261 /* FunctionDeclaration */, context, importAdder, info.call, idText(info.token), info.modifierFlags, info.parentDeclaration) : createSignatureDeclarationFromSignature( - 261 /* FunctionDeclaration */, + const functionDeclaration = info.kind === 2 /* Function */ ? createSignatureDeclarationFromCallExpression(262 /* FunctionDeclaration */, context, importAdder, info.call, idText(info.token), info.modifierFlags, info.parentDeclaration) : createSignatureDeclarationFromSignature( + 262 /* FunctionDeclaration */, context, quotePreference, info.signature, @@ -149371,7 +151519,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (signature === void 0) return createUndefined(); const func = createSignatureDeclarationFromSignature( - 217 /* FunctionExpression */, + 218 /* FunctionExpression */, context, quotePreference, signature[0], @@ -149879,7 +152027,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ); } function getSuggestion(messageText) { - const [_, suggestion] = flattenDiagnosticMessageText(messageText, "\n", 0).match(/\'(.*)\'/) || []; + const [_, suggestion] = flattenDiagnosticMessageText(messageText, "\n", 0).match(/'(.*)'/) || []; return suggestion; } var fixId28, errorCodes34; @@ -149925,6 +152073,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} registerCodeFix({ errorCodes: [ Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher.code, + Diagnostics.Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher.code, Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher.code ], getCodeActions: function getCodeActionsToFixModuleAndTarget(context) { @@ -150248,18 +152397,18 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} // src/services/codefixes/fixUnreferenceableDecoratorMetadata.ts function getImportDeclaration(sourceFile, program, start) { const identifier = tryCast(getTokenAtPosition(sourceFile, start), isIdentifier); - if (!identifier || identifier.parent.kind !== 182 /* TypeReference */) + if (!identifier || identifier.parent.kind !== 183 /* TypeReference */) return; const checker = program.getTypeChecker(); const symbol = checker.getSymbolAtLocation(identifier); return find((symbol == null ? void 0 : symbol.declarations) || emptyArray, or(isImportClause, isImportSpecifier, isImportEqualsDeclaration)); } function doTypeOnlyImportChange(changes, sourceFile, importDeclaration, program) { - if (importDeclaration.kind === 270 /* ImportEqualsDeclaration */) { + if (importDeclaration.kind === 271 /* ImportEqualsDeclaration */) { changes.insertModifierBefore(sourceFile, 156 /* TypeKeyword */, importDeclaration.name); return; } - const importClause = importDeclaration.kind === 272 /* ImportClause */ ? importDeclaration : importDeclaration.parent.parent; + const importClause = importDeclaration.kind === 273 /* ImportClause */ ? importDeclaration : importDeclaration.parent.parent; if (importClause.name && importClause.namedBindings) { return; } @@ -150290,14 +152439,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const importDeclaration = getImportDeclaration(context.sourceFile, context.program, context.span.start); if (!importDeclaration) return; - const namespaceChanges = ts_textChanges_exports.ChangeTracker.with(context, (t) => importDeclaration.kind === 275 /* ImportSpecifier */ && doNamespaceImportChange(t, context.sourceFile, importDeclaration, context.program)); + const namespaceChanges = ts_textChanges_exports.ChangeTracker.with(context, (t) => importDeclaration.kind === 276 /* ImportSpecifier */ && doNamespaceImportChange(t, context.sourceFile, importDeclaration, context.program)); const typeOnlyChanges = ts_textChanges_exports.ChangeTracker.with(context, (t) => doTypeOnlyImportChange(t, context.sourceFile, importDeclaration, context.program)); let actions2; if (namespaceChanges.length) { actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, namespaceChanges, Diagnostics.Convert_named_imports_to_namespace_import)); } if (typeOnlyChanges.length) { - actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, typeOnlyChanges, Diagnostics.Convert_to_type_only_import)); + actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, typeOnlyChanges, Diagnostics.Use_import_type)); } return actions2; }, @@ -150317,7 +152466,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} changes.delete(sourceFile, Debug.checkDefined(cast(token.parent, isDeclarationWithTypeParameterChildren).typeParameters, "The type parameter to delete should exist")); } function isImport(token) { - return token.kind === 102 /* ImportKeyword */ || token.kind === 80 /* Identifier */ && (token.parent.kind === 275 /* ImportSpecifier */ || token.parent.kind === 272 /* ImportClause */); + return token.kind === 102 /* ImportKeyword */ || token.kind === 80 /* Identifier */ && (token.parent.kind === 276 /* ImportSpecifier */ || token.parent.kind === 273 /* ImportClause */); } function tryGetFullImport(token) { return token.kind === 102 /* ImportKeyword */ ? tryCast(token.parent, isImportDeclaration) : void 0; @@ -150326,7 +152475,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return isVariableDeclarationList(token.parent) && first(token.parent.getChildren(sourceFile)) === token; } function deleteEntireVariableStatement(changes, sourceFile, node) { - changes.delete(sourceFile, node.parent.kind === 242 /* VariableStatement */ ? node.parent : node); + changes.delete(sourceFile, node.parent.kind === 243 /* VariableStatement */ ? node.parent : node); } function deleteDestructuringElements(changes, sourceFile, node) { forEach(node.elements, (n) => changes.delete(sourceFile, n)); @@ -150368,14 +152517,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function canPrefix(token) { switch (token.parent.kind) { - case 168 /* Parameter */: - case 167 /* TypeParameter */: + case 169 /* Parameter */: + case 168 /* TypeParameter */: return true; - case 259 /* VariableDeclaration */: { + case 260 /* VariableDeclaration */: { const varDecl = token.parent; switch (varDecl.parent.parent.kind) { - case 249 /* ForOfStatement */: - case 248 /* ForInStatement */: + case 250 /* ForOfStatement */: + case 249 /* ForInStatement */: return true; } } @@ -150424,8 +152573,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function mayDeleteParameter(checker, sourceFile, parameter, sourceFiles, program, cancellationToken, isFixAll) { const { parent: parent2 } = parameter; switch (parent2.kind) { - case 173 /* MethodDeclaration */: - case 175 /* Constructor */: + case 174 /* MethodDeclaration */: + case 176 /* Constructor */: const index = parent2.parameters.indexOf(parameter); const referent = isMethodDeclaration(parent2) ? parent2.name : parent2; const entries = ts_FindAllReferences_exports.Core.getReferencedSymbolsForNode(parent2.pos, referent, program, sourceFiles, cancellationToken); @@ -150443,18 +152592,18 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } return true; - case 261 /* FunctionDeclaration */: { + case 262 /* FunctionDeclaration */: { if (parent2.name && isCallbackLike(checker, sourceFile, parent2.name)) { return isLastParameter(parent2, parameter, isFixAll); } return true; } - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: return isLastParameter(parent2, parameter, isFixAll); - case 177 /* SetAccessor */: + case 178 /* SetAccessor */: return false; - case 176 /* GetAccessor */: + case 177 /* GetAccessor */: return true; default: return Debug.failBadSyntaxKind(parent2); @@ -150667,7 +152816,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const container = (isBlock(statement.parent) ? statement.parent : statement).parent; if (!isBlock(statement.parent) || statement === first(statement.parent.statements)) { switch (container.kind) { - case 244 /* IfStatement */: + case 245 /* IfStatement */: if (container.elseStatement) { if (isBlock(statement.parent)) { break; @@ -150676,8 +152825,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return; } - case 246 /* WhileStatement */: - case 247 /* ForStatement */: + case 247 /* WhileStatement */: + case 248 /* ForStatement */: changes.delete(sourceFile, container); return; } @@ -150773,22 +152922,22 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function isTypeContainer(node) { switch (node.kind) { - case 233 /* AsExpression */: - case 178 /* CallSignature */: - case 179 /* ConstructSignature */: - case 261 /* FunctionDeclaration */: - case 176 /* GetAccessor */: - case 180 /* IndexSignature */: - case 199 /* MappedType */: - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: - case 168 /* Parameter */: - case 171 /* PropertyDeclaration */: - case 170 /* PropertySignature */: - case 177 /* SetAccessor */: - case 264 /* TypeAliasDeclaration */: - case 215 /* TypeAssertionExpression */: - case 259 /* VariableDeclaration */: + case 234 /* AsExpression */: + case 179 /* CallSignature */: + case 180 /* ConstructSignature */: + case 262 /* FunctionDeclaration */: + case 177 /* GetAccessor */: + case 181 /* IndexSignature */: + case 200 /* MappedType */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: + case 169 /* Parameter */: + case 172 /* PropertyDeclaration */: + case 171 /* PropertySignature */: + case 178 /* SetAccessor */: + case 265 /* TypeAliasDeclaration */: + case 216 /* TypeAssertionExpression */: + case 260 /* VariableDeclaration */: return true; default: return false; @@ -150830,7 +152979,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const { typeNode, type } = info; const original = typeNode.getText(sourceFile); const actions2 = [fix(type, fixIdPlain, Diagnostics.Change_all_jsdoc_style_types_to_TypeScript)]; - if (typeNode.kind === 320 /* JSDocNullableType */) { + if (typeNode.kind === 321 /* JSDocNullableType */) { actions2.push(fix(type, fixIdNullable, Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types)); } return actions2; @@ -150848,7 +152997,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (!info) return; const { typeNode, type } = info; - const fixedType = typeNode.kind === 320 /* JSDocNullableType */ && fixId52 === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type; + const fixedType = typeNode.kind === 321 /* JSDocNullableType */ && fixId52 === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type; doChange28(changes, sourceFile, typeNode, fixedType, checker); }); } @@ -150921,14 +153070,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } let insertBefore; switch (containingFunction.kind) { - case 173 /* MethodDeclaration */: + case 174 /* MethodDeclaration */: insertBefore = containingFunction.name; break; - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: insertBefore = findChildOfKind(containingFunction, 100 /* FunctionKeyword */, sourceFile); break; - case 218 /* ArrowFunction */: + case 219 /* ArrowFunction */: const kind = containingFunction.typeParameters ? 30 /* LessThanToken */ : 21 /* OpenParenToken */; insertBefore = findChildOfKind(containingFunction, kind, sourceFile) || first(containingFunction.parameters); break; @@ -150958,6 +153107,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} fixId36 = "fixAwaitInSyncFunction"; errorCodes46 = [ Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code, + Diagnostics.await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code, Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code, Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function.code ]; @@ -151235,7 +153385,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function annotate(changes, importAdder, sourceFile, declaration, type, program, host) { const typeNode = getTypeNodeIfAccessible(type, declaration, program, host); if (typeNode) { - if (isInJSFile(sourceFile) && declaration.kind !== 170 /* PropertySignature */) { + if (isInJSFile(sourceFile) && declaration.kind !== 171 /* PropertySignature */) { const parent2 = isVariableDeclaration(declaration) ? tryCast(declaration.parent.parent, isVariableStatement) : declaration; if (!parent2) { return; @@ -151346,17 +153496,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function getFunctionReferences(containingFunction, sourceFile, program, cancellationToken) { let searchToken; switch (containingFunction.kind) { - case 175 /* Constructor */: + case 176 /* Constructor */: searchToken = findChildOfKind(containingFunction, 137 /* ConstructorKeyword */, sourceFile); break; - case 218 /* ArrowFunction */: - case 217 /* FunctionExpression */: + case 219 /* ArrowFunction */: + case 218 /* FunctionExpression */: const parent2 = containingFunction.parent; searchToken = (isVariableDeclaration(parent2) || isPropertyDeclaration(parent2)) && isIdentifier(parent2.name) ? parent2.name : containingFunction.name; break; - case 261 /* FunctionDeclaration */: - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: + case 262 /* FunctionDeclaration */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: searchToken = containingFunction.name; break; } @@ -151492,44 +153642,44 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} node = node.parent; } switch (node.parent.kind) { - case 243 /* ExpressionStatement */: + case 244 /* ExpressionStatement */: inferTypeFromExpressionStatement(node, usage); break; - case 224 /* PostfixUnaryExpression */: + case 225 /* PostfixUnaryExpression */: usage.isNumber = true; break; - case 223 /* PrefixUnaryExpression */: + case 224 /* PrefixUnaryExpression */: inferTypeFromPrefixUnaryExpression(node.parent, usage); break; - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: inferTypeFromBinaryExpression(node, node.parent, usage); break; - case 295 /* CaseClause */: - case 296 /* DefaultClause */: + case 296 /* CaseClause */: + case 297 /* DefaultClause */: inferTypeFromSwitchStatementLabel(node.parent, usage); break; - case 212 /* CallExpression */: - case 213 /* NewExpression */: + case 213 /* CallExpression */: + case 214 /* NewExpression */: if (node.parent.expression === node) { inferTypeFromCallExpression(node.parent, usage); } else { inferTypeFromContextualType(node, usage); } break; - case 210 /* PropertyAccessExpression */: + case 211 /* PropertyAccessExpression */: inferTypeFromPropertyAccessExpression(node.parent, usage); break; - case 211 /* ElementAccessExpression */: + case 212 /* ElementAccessExpression */: inferTypeFromPropertyElementExpression(node.parent, node, usage); break; - case 302 /* PropertyAssignment */: - case 303 /* ShorthandPropertyAssignment */: + case 303 /* PropertyAssignment */: + case 304 /* ShorthandPropertyAssignment */: inferTypeFromPropertyAssignment(node.parent, usage); break; - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: inferTypeFromPropertyDeclaration(node.parent, usage); break; - case 259 /* VariableDeclaration */: { + case 260 /* VariableDeclaration */: { const { name, initializer } = node.parent; if (node === name) { if (initializer) { @@ -151629,7 +153779,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} break; case 57 /* BarBarToken */: case 61 /* QuestionQuestionToken */: - if (node === parent2.left && (node.parent.parent.kind === 259 /* VariableDeclaration */ || isAssignmentExpression( + if (node === parent2.left && (node.parent.parent.kind === 260 /* VariableDeclaration */ || isAssignmentExpression( node.parent.parent, /*excludeCompoundAssignment*/ true @@ -151657,7 +153807,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } calculateUsageOfNode(parent2, call.return_); - if (parent2.kind === 212 /* CallExpression */) { + if (parent2.kind === 213 /* CallExpression */) { (usage.calls || (usage.calls = [])).push(call); } else { (usage.constructs || (usage.constructs = [])).push(call); @@ -152206,28 +154356,25 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, preserveOptional = 3 /* All */, isAmbient = false) { const declarations = symbol.getDeclarations(); - const declaration = declarations == null ? void 0 : declarations[0]; + const declaration = firstOrUndefined(declarations); const checker = context.program.getTypeChecker(); const scriptTarget = getEmitScriptTarget(context.program.getCompilerOptions()); - const kind = (declaration == null ? void 0 : declaration.kind) ?? 170 /* PropertySignature */; - const declarationName = getSynthesizedDeepClone( - getNameOfDeclaration(declaration), - /*includeTrivia*/ - false - ); + const kind = (declaration == null ? void 0 : declaration.kind) ?? 171 /* PropertySignature */; + const declarationName = createDeclarationName(symbol, declaration); const effectiveModifierFlags = declaration ? getEffectiveModifierFlags(declaration) : 0 /* None */; - let modifierFlags = effectiveModifierFlags & 4 /* Public */ ? 4 /* Public */ : effectiveModifierFlags & 16 /* Protected */ ? 16 /* Protected */ : 0 /* None */; + let modifierFlags = effectiveModifierFlags & 32 /* Static */; + modifierFlags |= effectiveModifierFlags & 4 /* Public */ ? 4 /* Public */ : effectiveModifierFlags & 16 /* Protected */ ? 16 /* Protected */ : 0 /* None */; if (declaration && isAutoAccessorPropertyDeclaration(declaration)) { modifierFlags |= 128 /* Accessor */; } const modifiers = createModifiers(); const type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration)); const optional = !!(symbol.flags & 16777216 /* Optional */); - const ambient = !!(enclosingDeclaration.flags & 16777216 /* Ambient */) || isAmbient; + const ambient = !!(enclosingDeclaration.flags & 33554432 /* Ambient */) || isAmbient; const quotePreference = getQuotePreference(sourceFile, preferences); switch (kind) { - case 170 /* PropertySignature */: - case 171 /* PropertyDeclaration */: + case 171 /* PropertySignature */: + case 172 /* PropertyDeclaration */: const flags = quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : void 0; let typeNode = checker.typeToTypeNode(type, enclosingDeclaration, flags, getNoopSymbolTrackerWithResolver(context)); if (importAdder) { @@ -152246,8 +154393,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} void 0 )); break; - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: { + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: { Debug.assertIsDefined(declarations); let typeNode2 = checker.typeToTypeNode( type, @@ -152295,8 +154442,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } break; } - case 172 /* MethodSignature */: - case 173 /* MethodDeclaration */: + case 173 /* MethodSignature */: + case 174 /* MethodDeclaration */: Debug.assertIsDefined(declarations); const signatures = type.isUnion() ? flatMap(type.types, (t) => t.getCallSignatures()) : type.getCallSignatures(); if (!some(signatures)) { @@ -152323,7 +154470,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} break; } function outputMethod(quotePreference2, signature, modifiers2, name, body2) { - const method = createSignatureDeclarationFromSignature(173 /* MethodDeclaration */, context, quotePreference2, signature, body2, name, modifiers2, optional && !!(preserveOptional & 1 /* Method */), enclosingDeclaration, importAdder); + const method = createSignatureDeclarationFromSignature(174 /* MethodDeclaration */, context, quotePreference2, signature, body2, name, modifiers2, optional && !!(preserveOptional & 1 /* Method */), enclosingDeclaration, importAdder); if (method) addClassElement(method); } @@ -152333,7 +154480,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} modifiers2 = combine(modifiers2, factory.createModifiersFromModifierFlags(modifierFlags)); } if (shouldAddOverrideKeyword()) { - modifiers2 = append(modifiers2, factory.createToken(163 /* OverrideKeyword */)); + modifiers2 = append(modifiers2, factory.createToken(164 /* OverrideKeyword */)); } return modifiers2 && factory.createNodeArray(modifiers2); } @@ -152364,6 +154511,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} false ); } + function createDeclarationName(symbol2, declaration2) { + if (getCheckFlags(symbol2) & 262144 /* Mapped */) { + const nameType = symbol2.links.nameType; + if (nameType && isTypeUsableAsPropertyName(nameType)) { + return factory.createIdentifier(unescapeLeadingUnderscores(getPropertyNameFromType(nameType))); + } + } + return getSynthesizedDeepClone( + getNameOfDeclaration(declaration2), + /*includeTrivia*/ + false + ); + } } function createSignatureDeclarationFromSignature(kind, context, quotePreference, signature, body, name, modifiers, optional, enclosingDeclaration, importAdder) { const program = context.program; @@ -152471,8 +154631,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} instanceTypes, contextNode, scriptTarget, - /*flags*/ - void 0, + 1 /* NoTruncation */, tracker ); const modifiers = modifierFlags ? factory.createNodeArray(factory.createModifiersFromModifierFlags(modifierFlags)) : void 0; @@ -152494,7 +154653,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} tracker ); switch (kind) { - case 173 /* MethodDeclaration */: + case 174 /* MethodDeclaration */: return factory.createMethodDeclaration( modifiers, asteriskToken, @@ -152506,7 +154665,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} type, createStubbedMethodBody(quotePreference) ); - case 172 /* MethodSignature */: + case 173 /* MethodSignature */: return factory.createMethodSignature( modifiers, name, @@ -152516,7 +154675,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} parameters, type === void 0 ? factory.createKeywordTypeNode(159 /* UnknownKeyword */) : type ); - case 261 /* FunctionDeclaration */: + case 262 /* FunctionDeclaration */: + Debug.assert(typeof name === "string" || isIdentifier(name), "Unexpected name"); return factory.createFunctionDeclaration( modifiers, asteriskToken, @@ -152921,7 +155081,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} isStatic: hasStaticModifier(declaration), isReadonly: hasEffectiveReadonlyModifier(declaration), type: getDeclarationType(declaration, program), - container: declaration.kind === 168 /* Parameter */ ? declaration.parent.parent : declaration.parent, + container: declaration.kind === 169 /* Parameter */ ? declaration.parent.parent : declaration.parent, originalName: declaration.name.text, declaration, fieldName, @@ -153093,7 +155253,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function getActionsForUsageOfInvalidImport(context) { const sourceFile = context.sourceFile; - const targetKind = Diagnostics.This_expression_is_not_callable.code === context.errorCode ? 212 /* CallExpression */ : 213 /* NewExpression */; + const targetKind = Diagnostics.This_expression_is_not_callable.code === context.errorCode ? 213 /* CallExpression */ : 214 /* NewExpression */; const node = findAncestor(getTokenAtPosition(sourceFile, context.span.start), (a) => a.kind === targetKind); if (!node) { return []; @@ -153498,7 +155658,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function getImportTypeNode(sourceFile, pos) { const token = getTokenAtPosition(sourceFile, pos); Debug.assert(token.kind === 102 /* ImportKeyword */, "This token should be an ImportKeyword"); - Debug.assert(token.parent.kind === 204 /* ImportType */, "Token parent should be an ImportType"); + Debug.assert(token.parent.kind === 205 /* ImportType */, "Token parent should be an ImportType"); return token.parent; } function doChange36(changes, sourceFile, importType) { @@ -153805,8 +155965,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return [createCodeFixAction(fixId48, changes, Diagnostics.Split_into_two_separate_import_declarations, fixId48, Diagnostics.Split_all_invalid_type_only_imports)]; } }, - getAllCodeActions: (context) => codeFixAll(context, errorCodes60, (changes, error) => { - splitTypeOnlyImport(changes, getImportDeclaration2(context.sourceFile, error), context); + getAllCodeActions: (context) => codeFixAll(context, errorCodes60, (changes, error2) => { + splitTypeOnlyImport(changes, getImportDeclaration2(context.sourceFile, error2), context); }) }); } @@ -154019,7 +156179,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} getFixes: () => getFixes, getImportCompletionAction: () => getImportCompletionAction, getImportKind: () => getImportKind, - getJSDocTypedefNode: () => getJSDocTypedefNode, + getJSDocTypedefNodes: () => getJSDocTypedefNodes, getNoopSymbolTrackerWithResolver: () => getNoopSymbolTrackerWithResolver, getPromoteTypeOnlyCompletionAction: () => getPromoteTypeOnlyCompletionAction, getSupportedErrorCodes: () => getSupportedErrorCodes, @@ -154864,14 +157024,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function typeNodeToExpression(typeNode, languageVersion, quotePreference) { switch (typeNode.kind) { - case 182 /* TypeReference */: + case 183 /* TypeReference */: const typeName = typeNode.typeName; return entityNameToExpression(typeName, languageVersion, quotePreference); - case 198 /* IndexedAccessType */: + case 199 /* IndexedAccessType */: const objectExpression = typeNodeToExpression(typeNode.objectType, languageVersion, quotePreference); const indexExpression = typeNodeToExpression(typeNode.indexType, languageVersion, quotePreference); return objectExpression && indexExpression && factory.createElementAccessExpression(objectExpression, indexExpression); - case 200 /* LiteralType */: + case 201 /* LiteralType */: const literal = typeNode.literal; switch (literal.kind) { case 11 /* StringLiteral */: @@ -154880,12 +157040,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return factory.createNumericLiteral(literal.text, literal.numericLiteralFlags); } return void 0; - case 195 /* ParenthesizedType */: + case 196 /* ParenthesizedType */: const exp = typeNodeToExpression(typeNode.type, languageVersion, quotePreference); return exp && (isIdentifier(exp) ? exp : factory.createParenthesizedExpression(exp)); - case 185 /* TypeQuery */: + case 186 /* TypeQuery */: return entityNameToExpression(typeNode.exprName, languageVersion, quotePreference); - case 204 /* ImportType */: + case 205 /* ImportType */: Debug.fail(`We should not get an import type after calling 'codefix.typeToAutoImportableTypeNode'.`); } return void 0; @@ -154920,12 +157080,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function getJsxClosingTagCompletion(location, sourceFile) { const jsxClosingElement = findAncestor(location, (node) => { switch (node.kind) { - case 286 /* JsxClosingElement */: + case 287 /* JsxClosingElement */: return true; case 44 /* SlashToken */: case 32 /* GreaterThanToken */: case 80 /* Identifier */: - case 210 /* PropertyAccessExpression */: + case 211 /* PropertyAccessExpression */: return false; default: return "quit"; @@ -154972,7 +157132,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority }; } function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, position, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol) { + var _a, _b; let insertText; + let filterText; let replacementSpan = getReplacementSpanForContextToken(replacementToken); let data; let isSnippet; @@ -155029,13 +157191,23 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if ((origin == null ? void 0 : origin.kind) === 64 /* TypeOnlyAlias */) { hasAction = true; } + if (completionKind === 0 /* ObjectPropertyDeclaration */ && contextToken && ((_a = findPrecedingToken(contextToken.pos, sourceFile, contextToken)) == null ? void 0 : _a.kind) !== 28 /* CommaToken */) { + if (isMethodDeclaration(contextToken.parent.parent) || isGetAccessorDeclaration(contextToken.parent.parent) || isSetAccessorDeclaration(contextToken.parent.parent) || isSpreadAssignment(contextToken.parent) || ((_b = findAncestor(contextToken.parent, isPropertyAssignment)) == null ? void 0 : _b.getLastToken(sourceFile)) === contextToken || isShorthandPropertyAssignment(contextToken.parent) && getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line !== getLineAndCharacterOfPosition(sourceFile, position).line) { + source = "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */; + hasAction = true; + } + } if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* MemberLike */ && isClassLikeMemberCompletion(symbol, location, sourceFile)) { let importAdder; - ({ insertText, isSnippet, importAdder, replacementSpan } = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext)); - sortText = SortText.ClassMemberSnippets; - if (importAdder == null ? void 0 : importAdder.hasFixes()) { - hasAction = true; - source = "ClassMemberSnippet/" /* ClassMemberSnippet */; + const memberCompletionEntry = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext); + if (memberCompletionEntry) { + ({ insertText, filterText, isSnippet, importAdder } = memberCompletionEntry); + if (importAdder == null ? void 0 : importAdder.hasFixes()) { + hasAction = true; + source = "ClassMemberSnippet/" /* ClassMemberSnippet */; + } + } else { + return void 0; } } if (origin && originIsObjectLiteralMethod(origin)) { @@ -155070,6 +157242,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} data = originToCompletionEntryData(origin); hasAction = !importStatementCompletion; } + const parentNamedImportOrExport = findAncestor(location, isNamedImportsOrExports); + if ((parentNamedImportOrExport == null ? void 0 : parentNamedImportOrExport.kind) === 275 /* NamedImports */) { + const possibleToken = stringToToken(name); + if (parentNamedImportOrExport && possibleToken && (possibleToken === 135 /* AwaitKeyword */ || isNonContextualKeyword(possibleToken))) { + insertText = `${name} as ${name}_`; + } + } return { name, kind: ts_SymbolDisplay_exports.getSymbolKind(typeChecker, symbol, location), @@ -155079,6 +157258,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} hasAction: hasAction ? true : void 0, isRecommended: isRecommendedCompletionMatch(symbol, recommendedCompletion, typeChecker) || void 0, insertText, + filterText, replacementSpan, sourceDisplay, labelDetails, @@ -155099,11 +157279,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext) { const classLikeDeclaration = findAncestor(location, isClassLike); if (!classLikeDeclaration) { - return { insertText: name }; + return void 0; } let isSnippet; - let replacementSpan; let insertText = name; + const filterText = name; const checker = program.getTypeChecker(); const sourceFile = location.getSourceFile(); const printer = createSnippetPrinter({ @@ -155132,9 +157312,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ); } let modifiers = 0 /* None */; - const { modifiers: presentModifiers, span: modifiersSpan } = getPresentModifiers(contextToken, sourceFile, position); - const isAbstract = !!(presentModifiers & 256 /* Abstract */); - const completionNodes = []; + const { modifiers: presentModifiers, range: eraseRange, decorators: presentDecorators } = getPresentModifiers(contextToken, sourceFile, position); + const isAbstract = presentModifiers & 256 /* Abstract */ && classLikeDeclaration.modifierFlagsCache & 256 /* Abstract */; + let completionNodes = []; ts_codefix_exports.addNewNodeForMemberSymbol( symbol, classLikeDeclaration, @@ -155158,18 +157338,42 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} requiredModifiers |= 16384 /* Override */; } if (!completionNodes.length) { - modifiers = node.modifierFlagsCache | requiredModifiers | presentModifiers; + modifiers = node.modifierFlagsCache | requiredModifiers; } node = factory.updateModifiers(node, modifiers); completionNodes.push(node); }, body, ts_codefix_exports.PreserveOptionalFlags.Property, - isAbstract + !!isAbstract ); if (completionNodes.length) { + const isMethod = symbol.flags & 8192 /* Method */; + let allowedModifiers = modifiers | 16384 /* Override */ | 4 /* Public */; + if (!isMethod) { + allowedModifiers |= 2 /* Ambient */ | 64 /* Readonly */; + } else { + allowedModifiers |= 512 /* Async */; + } + const allowedAndPresent = presentModifiers & allowedModifiers; + if (presentModifiers & ~allowedModifiers) { + return void 0; + } + if (modifiers & 16 /* Protected */ && allowedAndPresent & 4 /* Public */) { + modifiers &= ~16 /* Protected */; + } + if (allowedAndPresent !== 0 /* None */ && !(allowedAndPresent & 4 /* Public */)) { + modifiers &= ~4 /* Public */; + } + modifiers |= allowedAndPresent; + completionNodes = completionNodes.map((node) => factory.updateModifiers(node, modifiers)); + if (presentDecorators == null ? void 0 : presentDecorators.length) { + const lastNode = completionNodes[completionNodes.length - 1]; + if (canHaveDecorators(lastNode)) { + completionNodes[completionNodes.length - 1] = factory.updateModifierLike(lastNode, presentDecorators.concat(getModifiers(lastNode) || [])); + } + } const format = 1 /* MultiLine */ | 131072 /* NoTrailingNewLine */; - replacementSpan = modifiersSpan; if (formatContext) { insertText = printer.printAndFormatSnippetList( format, @@ -155185,24 +157389,29 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ); } } - return { insertText, isSnippet, importAdder, replacementSpan }; + return { insertText, filterText, isSnippet, importAdder, eraseRange }; } function getPresentModifiers(contextToken, sourceFile, position) { if (!contextToken || getLineAndCharacterOfPosition(sourceFile, position).line > getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line) { return { modifiers: 0 /* None */ }; } let modifiers = 0 /* None */; - let span; + let decorators; let contextMod; - if (contextMod = isModifierLike2(contextToken)) { - modifiers |= modifierToFlag(contextMod); - span = createTextSpanFromNode(contextToken); - } - if (isPropertyDeclaration(contextToken.parent)) { + const range = { pos: position, end: position }; + if (isPropertyDeclaration(contextToken.parent) && contextToken.parent.modifiers) { modifiers |= modifiersToFlags(contextToken.parent.modifiers) & 126975 /* Modifier */; - span = createTextSpanFromNode(contextToken.parent); + decorators = contextToken.parent.modifiers.filter(isDecorator) || []; + range.pos = Math.min(range.pos, contextToken.parent.modifiers.pos); } - return { modifiers, span }; + if (contextMod = isModifierLike2(contextToken)) { + const contextModifierFlag = modifierToFlag(contextMod); + if (!(modifiers & contextModifierFlag)) { + modifiers |= contextModifierFlag; + range.pos = Math.min(range.pos, contextToken.pos); + } + } + return { modifiers, decorators, range: range.pos !== position ? range : void 0 }; } function isModifierLike2(node) { if (isModifier(node)) { @@ -155279,10 +157488,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const quotePreference = getQuotePreference(sourceFile, preferences); const builderFlags = 33554432 /* OmitThisParameter */ | (quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : 0 /* None */); switch (declaration.kind) { - case 170 /* PropertySignature */: - case 171 /* PropertyDeclaration */: - case 172 /* MethodSignature */: - case 173 /* MethodDeclaration */: { + case 171 /* PropertySignature */: + case 172 /* PropertyDeclaration */: + case 173 /* MethodSignature */: + case 174 /* MethodDeclaration */: { let effectiveType = type.flags & 1048576 /* Union */ && type.types.length < 10 ? checker.getUnionType(type.types, 2 /* Subtype */) : type; if (effectiveType.flags & 1048576 /* Union */) { const functionTypes = filter(effectiveType.types, (type2) => checker.getSignaturesOfType(type2, 0 /* Call */).length > 0); @@ -155558,7 +157767,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol = false) { const start = timestamp(); - const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken); + const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken, location); const useSemicolons = probablyUsesSemicolons(sourceFile); const typeChecker = program.getTypeChecker(); const uniques = /* @__PURE__ */ new Map(); @@ -155725,7 +157934,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return firstDefined(symbols, (symbol, index) => { const origin = symbolToOriginInfoMap[index]; const info = getCompletionEntryDisplayNameForSymbol(symbol, getEmitScriptTarget(compilerOptions), origin, completionKind, completionData.isJsxIdentifierExpected); - return info && info.name === entryId.name && (entryId.source === "ClassMemberSnippet/" /* ClassMemberSnippet */ && symbol.flags & 106500 /* ClassMember */ || entryId.source === "ObjectLiteralMethodSnippet/" /* ObjectLiteralMethodSnippet */ && symbol.flags & (4 /* Property */ | 8192 /* Method */) || getSourceFromOrigin(origin) === entryId.source) ? { type: "symbol", symbol, location, origin, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation } : void 0; + return info && info.name === entryId.name && (entryId.source === "ClassMemberSnippet/" /* ClassMemberSnippet */ && symbol.flags & 106500 /* ClassMember */ || entryId.source === "ObjectLiteralMethodSnippet/" /* ObjectLiteralMethodSnippet */ && symbol.flags & (4 /* Property */ | 8192 /* Method */) || getSourceFromOrigin(origin) === entryId.source || entryId.source === "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */) ? { type: "symbol", symbol, location, origin, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation } : void 0; }) || { type: "none" }; } function getCompletionEntryDetails(program, log, sourceFile, position, entryId, host, formatContext, preferences, cancellationToken) { @@ -155820,12 +158029,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken) { if (data == null ? void 0 : data.moduleSpecifier) { - if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementSpan) { + if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken, sourceFile).replacementSpan) { return { codeActions: void 0, sourceDisplay: [textPart(data.moduleSpecifier)] }; } } if (source === "ClassMemberSnippet/" /* ClassMemberSnippet */) { - const { importAdder } = getEntryForMemberCompletion( + const { importAdder, eraseRange } = getEntryForMemberCompletion( host, program, compilerOptions, @@ -155837,10 +158046,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} contextToken, formatContext ); - if (importAdder) { + if (importAdder || eraseRange) { const changes = ts_textChanges_exports.ChangeTracker.with( { host, formatContext, preferences }, - importAdder.writeFixes + (tracker) => { + if (importAdder) { + importAdder.writeFixes(tracker); + } + if (eraseRange) { + tracker.deleteRange(sourceFile, eraseRange); + } + } ); return { sourceDisplay: void 0, @@ -155863,6 +158079,21 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} Debug.assertIsDefined(codeAction2, "Expected to have a code action for promoting type-only alias"); return { codeActions: [codeAction2], sourceDisplay: void 0 }; } + if (source === "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */ && contextToken) { + const changes = ts_textChanges_exports.ChangeTracker.with( + { host, formatContext, preferences }, + (tracker) => tracker.insertText(sourceFile, contextToken.end, ",") + ); + if (changes) { + return { + sourceDisplay: void 0, + codeActions: [{ + changes, + description: diagnosticToString([Diagnostics.Add_missing_comma_for_object_member_completion_0, name]) + }] + }; + } + } if (!origin || !(originIsExport(origin) || originIsResolvedExport(origin))) { return { codeActions: void 0, sourceDisplay: void 0 }; } @@ -155904,11 +158135,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return getContextualTypeFromParent(previousToken, checker); case 64 /* EqualsToken */: switch (parent2.kind) { - case 259 /* VariableDeclaration */: + case 260 /* VariableDeclaration */: return checker.getContextualType(parent2.initializer); - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: return checker.getTypeAtLocation(parent2.left); - case 290 /* JsxAttribute */: + case 291 /* JsxAttribute */: return checker.getContextualTypeForJsxAttribute(parent2); default: return void 0; @@ -155946,7 +158177,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function isModuleSymbol(symbol) { var _a; - return !!((_a = symbol.declarations) == null ? void 0 : _a.some((d) => d.kind === 311 /* SourceFile */)); + return !!((_a = symbol.declarations) == null ? void 0 : _a.some((d) => d.kind === 312 /* SourceFile */)); } function getCompletionData(program, log, sourceFile, compilerOptions, position, preferences, detailsEntryId, host, formatContext, cancellationToken) { const typeChecker = program.getTypeChecker(); @@ -155965,7 +158196,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return { kind: 1 /* JsDocTagName */ }; } else { const lineStart = getLineStartPositionForPosition(position, sourceFile); - if (!/[^\*|\s(/)]/.test(sourceFile.text.substring(lineStart, position))) { + if (!/[^*|\s(/)]/.test(sourceFile.text.substring(lineStart, position))) { return { kind: 2 /* JsDocTag */ }; } } @@ -155978,7 +158209,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const typeExpression = tryGetTypeExpressionFromTag(tag); if (typeExpression) { currentToken = getTokenAtPosition(sourceFile, position); - if (!currentToken || !isDeclarationName(currentToken) && (currentToken.parent.kind !== 354 /* JSDocPropertyTag */ || currentToken.parent.name !== currentToken)) { + if (!currentToken || !isDeclarationName(currentToken) && (currentToken.parent.kind !== 355 /* JSDocPropertyTag */ || currentToken.parent.name !== currentToken)) { insideJsDocTagTypeExpression = isCurrentlyEditingNode(typeExpression); } } @@ -156011,7 +158242,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} let isNewIdentifierLocation = false; let flags = 0 /* None */; if (contextToken) { - const importStatementCompletionInfo = getImportStatementCompletionInfo(contextToken); + const importStatementCompletionInfo = getImportStatementCompletionInfo(contextToken, sourceFile); if (importStatementCompletionInfo.keywordCompletion) { if (importStatementCompletionInfo.isKeywordOnlyCompletion) { return { @@ -156036,7 +158267,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} isRightOfDot = contextToken.kind === 25 /* DotToken */; isRightOfQuestionDot = contextToken.kind === 29 /* QuestionDotToken */; switch (parent2.kind) { - case 210 /* PropertyAccessExpression */: + case 211 /* PropertyAccessExpression */: propertyAccessToConvert = parent2; node = propertyAccessToConvert.expression; const leftmostAccessExpression = getLeftmostAccessExpression(propertyAccessToConvert); @@ -156044,16 +158275,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return void 0; } break; - case 165 /* QualifiedName */: + case 166 /* QualifiedName */: node = parent2.left; break; - case 266 /* ModuleDeclaration */: + case 267 /* ModuleDeclaration */: node = parent2.name; break; - case 204 /* ImportType */: + case 205 /* ImportType */: node = parent2; break; - case 235 /* MetaProperty */: + case 236 /* MetaProperty */: node = parent2.getFirstToken(sourceFile); Debug.assert(node.kind === 102 /* ImportKeyword */ || node.kind === 105 /* NewKeyword */); break; @@ -156061,51 +158292,51 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return void 0; } } else if (!importStatementCompletion) { - if (parent2 && parent2.kind === 210 /* PropertyAccessExpression */) { + if (parent2 && parent2.kind === 211 /* PropertyAccessExpression */) { contextToken = parent2; parent2 = parent2.parent; } if (currentToken.parent === location) { switch (currentToken.kind) { case 32 /* GreaterThanToken */: - if (currentToken.parent.kind === 283 /* JsxElement */ || currentToken.parent.kind === 285 /* JsxOpeningElement */) { + if (currentToken.parent.kind === 284 /* JsxElement */ || currentToken.parent.kind === 286 /* JsxOpeningElement */) { location = currentToken; } break; case 44 /* SlashToken */: - if (currentToken.parent.kind === 284 /* JsxSelfClosingElement */) { + if (currentToken.parent.kind === 285 /* JsxSelfClosingElement */) { location = currentToken; } break; } } switch (parent2.kind) { - case 286 /* JsxClosingElement */: + case 287 /* JsxClosingElement */: if (contextToken.kind === 44 /* SlashToken */) { isStartingCloseTag = true; location = contextToken; } break; - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: if (!binaryExpressionMayBeOpenTag(parent2)) { break; } - case 284 /* JsxSelfClosingElement */: - case 283 /* JsxElement */: - case 285 /* JsxOpeningElement */: + case 285 /* JsxSelfClosingElement */: + case 284 /* JsxElement */: + case 286 /* JsxOpeningElement */: isJsxIdentifierExpected = true; if (contextToken.kind === 30 /* LessThanToken */) { isRightOfOpenTag = true; location = contextToken; } break; - case 293 /* JsxExpression */: - case 292 /* JsxSpreadAttribute */: - if (previousToken.kind === 20 /* CloseBraceToken */ || previousToken.kind === 80 /* Identifier */ && previousToken.parent.kind === 290 /* JsxAttribute */) { + case 294 /* JsxExpression */: + case 293 /* JsxSpreadAttribute */: + if (previousToken.kind === 20 /* CloseBraceToken */ || previousToken.kind === 80 /* Identifier */ && previousToken.parent.kind === 291 /* JsxAttribute */) { isJsxIdentifierExpected = true; } break; - case 290 /* JsxAttribute */: + case 291 /* JsxAttribute */: if (parent2.initializer === previousToken && previousToken.end < position) { isJsxIdentifierExpected = true; break; @@ -156193,15 +158424,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} }; function isTagWithTypeExpression(tag) { switch (tag.kind) { - case 347 /* JSDocParameterTag */: - case 354 /* JSDocPropertyTag */: - case 348 /* JSDocReturnTag */: - case 350 /* JSDocTypeTag */: - case 352 /* JSDocTypedefTag */: - case 355 /* JSDocThrowsTag */: - case 356 /* JSDocSatisfiesTag */: + case 348 /* JSDocParameterTag */: + case 355 /* JSDocPropertyTag */: + case 349 /* JSDocReturnTag */: + case 351 /* JSDocTypeTag */: + case 353 /* JSDocTypedefTag */: + case 356 /* JSDocThrowsTag */: + case 357 /* JSDocSatisfiesTag */: return true; - case 351 /* JSDocTemplateTag */: + case 352 /* JSDocTemplateTag */: return !!tag.constraint; default: return false; @@ -156210,7 +158441,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function tryGetTypeExpressionFromTag(tag) { if (isTagWithTypeExpression(tag)) { const typeExpression = isJSDocTemplateTag(tag) ? tag.constraint : tag.typeExpression; - return typeExpression && typeExpression.kind === 315 /* JSDocTypeExpression */ ? typeExpression : void 0; + return typeExpression && typeExpression.kind === 316 /* JSDocTypeExpression */ ? typeExpression : void 0; } if (isJSDocAugmentsTag(tag) || isJSDocImplementsTag(tag)) { return tag.class; @@ -156246,7 +158477,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} symbols.push(exportedSymbol); } } - if (!isTypeLocation && !insideJsDocTagTypeExpression && symbol.declarations && symbol.declarations.some((d) => d.kind !== 311 /* SourceFile */ && d.kind !== 266 /* ModuleDeclaration */ && d.kind !== 265 /* EnumDeclaration */)) { + if (!isTypeLocation && !insideJsDocTagTypeExpression && symbol.declarations && symbol.declarations.some((d) => d.kind !== 312 /* SourceFile */ && d.kind !== 267 /* ModuleDeclaration */ && d.kind !== 266 /* EnumDeclaration */)) { let type = typeChecker.getTypeOfSymbolAtLocation(symbol, node).getNonOptionalType(); let insertQuestionDot = false; if (type.isNullableType()) { @@ -156258,30 +158489,40 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } } - addTypeProperties(type, !!(node.flags & 32768 /* AwaitContext */), insertQuestionDot); + addTypeProperties(type, !!(node.flags & 65536 /* AwaitContext */), insertQuestionDot); } return; } } } - if (!isTypeLocation) { + if (!isTypeLocation || isInTypeQuery(node)) { typeChecker.tryGetThisTypeAt( node, /*includeGlobalThis*/ false ); let type = typeChecker.getTypeAtLocation(node).getNonOptionalType(); - let insertQuestionDot = false; - if (type.isNullableType()) { - const canCorrectToQuestionDot = isRightOfDot && !isRightOfQuestionDot && preferences.includeAutomaticOptionalChainCompletions !== false; - if (canCorrectToQuestionDot || isRightOfQuestionDot) { - type = type.getNonNullableType(); - if (canCorrectToQuestionDot) { - insertQuestionDot = true; + if (!isTypeLocation) { + let insertQuestionDot = false; + if (type.isNullableType()) { + const canCorrectToQuestionDot = isRightOfDot && !isRightOfQuestionDot && preferences.includeAutomaticOptionalChainCompletions !== false; + if (canCorrectToQuestionDot || isRightOfQuestionDot) { + type = type.getNonNullableType(); + if (canCorrectToQuestionDot) { + insertQuestionDot = true; + } } } + addTypeProperties(type, !!(node.flags & 65536 /* AwaitContext */), insertQuestionDot); + } else { + addTypeProperties( + type.getNonNullableType(), + /*insertAwait*/ + false, + /*insertQuestionDot*/ + false + ); } - addTypeProperties(type, !!(node.flags & 32768 /* AwaitContext */), insertQuestionDot); } } function addTypeProperties(type, insertAwait, insertQuestionDot) { @@ -156289,7 +158530,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (isRightOfQuestionDot && some(type.getCallSignatures())) { isNewIdentifierLocation = true; } - const propertyAccess = node.kind === 204 /* ImportType */ ? node : node.parent; + const propertyAccess = node.kind === 205 /* ImportType */ ? node : node.parent; if (inCheckedFile) { for (const symbol of type.getApparentProperties()) { if (typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, symbol)) { @@ -156327,7 +158568,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const leftMostName = getLeftMostName(computedPropertyName.expression); const nameSymbol = leftMostName && typeChecker.getSymbolAtLocation(leftMostName); const firstAccessibleSymbol = nameSymbol && getFirstSymbolInChain(nameSymbol, contextToken, typeChecker); - if (firstAccessibleSymbol && addToSeen(seenPropertySymbols, getSymbolId(firstAccessibleSymbol))) { + const firstAccessibleSymbolId = firstAccessibleSymbol && getSymbolId(firstAccessibleSymbol); + if (firstAccessibleSymbolId && addToSeen(seenPropertySymbols, firstAccessibleSymbolId)) { const index = symbols.length; symbols.push(firstAccessibleSymbol); const moduleSymbol = firstAccessibleSymbol.parent; @@ -156357,6 +158599,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } } else if (preferences.includeCompletionsWithInsertText) { + if (firstAccessibleSymbolId && seenPropertySymbols.has(firstAccessibleSymbolId)) { + return; + } addSymbolOriginInfo(symbol); addSymbolSortInfo(symbol); symbols.push(symbol); @@ -156445,7 +158690,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } } - if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 311 /* SourceFile */) { + if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 312 /* SourceFile */) { const thisType = typeChecker.tryGetThisTypeAt( scopeNode, /*includeGlobalThis*/ @@ -156480,10 +158725,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function isSnippetScope(scopeNode) { switch (scopeNode.kind) { - case 311 /* SourceFile */: - case 227 /* TemplateExpression */: - case 293 /* JsxExpression */: - case 240 /* Block */: + case 312 /* SourceFile */: + case 228 /* TemplateExpression */: + case 294 /* JsxExpression */: + case 241 /* Block */: return true; default: return isStatement(scopeNode); @@ -156493,24 +158738,24 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return insideJsDocTagTypeExpression || !!importStatementCompletion && isTypeOnlyImportOrExportDeclaration(location.parent) || !isContextTokenValueLocation(contextToken) && (isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker) || isPartOfTypeNode(location) || isContextTokenTypeLocation(contextToken)); } function isContextTokenValueLocation(contextToken2) { - return contextToken2 && (contextToken2.kind === 114 /* TypeOfKeyword */ && (contextToken2.parent.kind === 185 /* TypeQuery */ || isTypeOfExpression(contextToken2.parent)) || contextToken2.kind === 131 /* AssertsKeyword */ && contextToken2.parent.kind === 181 /* TypePredicate */); + return contextToken2 && (contextToken2.kind === 114 /* TypeOfKeyword */ && (contextToken2.parent.kind === 186 /* TypeQuery */ || isTypeOfExpression(contextToken2.parent)) || contextToken2.kind === 131 /* AssertsKeyword */ && contextToken2.parent.kind === 182 /* TypePredicate */); } function isContextTokenTypeLocation(contextToken2) { if (contextToken2) { const parentKind = contextToken2.parent.kind; switch (contextToken2.kind) { case 59 /* ColonToken */: - return parentKind === 171 /* PropertyDeclaration */ || parentKind === 170 /* PropertySignature */ || parentKind === 168 /* Parameter */ || parentKind === 259 /* VariableDeclaration */ || isFunctionLikeKind(parentKind); + return parentKind === 172 /* PropertyDeclaration */ || parentKind === 171 /* PropertySignature */ || parentKind === 169 /* Parameter */ || parentKind === 260 /* VariableDeclaration */ || isFunctionLikeKind(parentKind); case 64 /* EqualsToken */: - return parentKind === 264 /* TypeAliasDeclaration */; + return parentKind === 265 /* TypeAliasDeclaration */; case 130 /* AsKeyword */: - return parentKind === 233 /* AsExpression */; + return parentKind === 234 /* AsExpression */; case 30 /* LessThanToken */: - return parentKind === 182 /* TypeReference */ || parentKind === 215 /* TypeAssertionExpression */; + return parentKind === 183 /* TypeReference */ || parentKind === 216 /* TypeAssertionExpression */; case 96 /* ExtendsKeyword */: - return parentKind === 167 /* TypeParameter */; + return parentKind === 168 /* TypeParameter */; case 152 /* SatisfiesKeyword */: - return parentKind === 237 /* SatisfiesExpression */; + return parentKind === 238 /* SatisfiesExpression */; } } return false; @@ -156688,14 +158933,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return true; } if (contextToken2.kind === 32 /* GreaterThanToken */ && contextToken2.parent) { - if (location === contextToken2.parent && (location.kind === 285 /* JsxOpeningElement */ || location.kind === 284 /* JsxSelfClosingElement */)) { + if (location === contextToken2.parent && (location.kind === 286 /* JsxOpeningElement */ || location.kind === 285 /* JsxSelfClosingElement */)) { return false; } - if (contextToken2.parent.kind === 285 /* JsxOpeningElement */) { - return location.parent.kind !== 285 /* JsxOpeningElement */; + if (contextToken2.parent.kind === 286 /* JsxOpeningElement */) { + return location.parent.kind !== 286 /* JsxOpeningElement */; } - if (contextToken2.parent.kind === 286 /* JsxClosingElement */ || contextToken2.parent.kind === 284 /* JsxSelfClosingElement */) { - return !!contextToken2.parent.parent && contextToken2.parent.parent.kind === 283 /* JsxElement */; + if (contextToken2.parent.kind === 287 /* JsxClosingElement */ || contextToken2.parent.kind === 285 /* JsxSelfClosingElement */) { + return !!contextToken2.parent.parent && contextToken2.parent.parent.kind === 284 /* JsxElement */; } } return false; @@ -156706,29 +158951,29 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const tokenKind = keywordForNode(contextToken); switch (tokenKind) { case 28 /* CommaToken */: - return containingNodeKind === 212 /* CallExpression */ || containingNodeKind === 175 /* Constructor */ || containingNodeKind === 213 /* NewExpression */ || containingNodeKind === 208 /* ArrayLiteralExpression */ || containingNodeKind === 225 /* BinaryExpression */ || containingNodeKind === 183 /* FunctionType */ || containingNodeKind === 209 /* ObjectLiteralExpression */; + return containingNodeKind === 213 /* CallExpression */ || containingNodeKind === 176 /* Constructor */ || containingNodeKind === 214 /* NewExpression */ || containingNodeKind === 209 /* ArrayLiteralExpression */ || containingNodeKind === 226 /* BinaryExpression */ || containingNodeKind === 184 /* FunctionType */ || containingNodeKind === 210 /* ObjectLiteralExpression */; case 21 /* OpenParenToken */: - return containingNodeKind === 212 /* CallExpression */ || containingNodeKind === 175 /* Constructor */ || containingNodeKind === 213 /* NewExpression */ || containingNodeKind === 216 /* ParenthesizedExpression */ || containingNodeKind === 195 /* ParenthesizedType */; + return containingNodeKind === 213 /* CallExpression */ || containingNodeKind === 176 /* Constructor */ || containingNodeKind === 214 /* NewExpression */ || containingNodeKind === 217 /* ParenthesizedExpression */ || containingNodeKind === 196 /* ParenthesizedType */; case 23 /* OpenBracketToken */: - return containingNodeKind === 208 /* ArrayLiteralExpression */ || containingNodeKind === 180 /* IndexSignature */ || containingNodeKind === 166 /* ComputedPropertyName */; + return containingNodeKind === 209 /* ArrayLiteralExpression */ || containingNodeKind === 181 /* IndexSignature */ || containingNodeKind === 167 /* ComputedPropertyName */; case 144 /* ModuleKeyword */: case 145 /* NamespaceKeyword */: case 102 /* ImportKeyword */: return true; case 25 /* DotToken */: - return containingNodeKind === 266 /* ModuleDeclaration */; + return containingNodeKind === 267 /* ModuleDeclaration */; case 19 /* OpenBraceToken */: - return containingNodeKind === 262 /* ClassDeclaration */ || containingNodeKind === 209 /* ObjectLiteralExpression */; + return containingNodeKind === 263 /* ClassDeclaration */ || containingNodeKind === 210 /* ObjectLiteralExpression */; case 64 /* EqualsToken */: - return containingNodeKind === 259 /* VariableDeclaration */ || containingNodeKind === 225 /* BinaryExpression */; + return containingNodeKind === 260 /* VariableDeclaration */ || containingNodeKind === 226 /* BinaryExpression */; case 16 /* TemplateHead */: - return containingNodeKind === 227 /* TemplateExpression */; + return containingNodeKind === 228 /* TemplateExpression */; case 17 /* TemplateMiddle */: - return containingNodeKind === 238 /* TemplateSpan */; + return containingNodeKind === 239 /* TemplateSpan */; case 134 /* AsyncKeyword */: - return containingNodeKind === 173 /* MethodDeclaration */ || containingNodeKind === 303 /* ShorthandPropertyAssignment */; + return containingNodeKind === 174 /* MethodDeclaration */ || containingNodeKind === 304 /* ShorthandPropertyAssignment */; case 42 /* AsteriskToken */: - return containingNodeKind === 173 /* MethodDeclaration */; + return containingNodeKind === 174 /* MethodDeclaration */; } if (isClassMemberCompletionKeyword(tokenKind)) { return true; @@ -156760,16 +159005,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function tryGetObjectLikeCompletionSymbols() { const symbolsStartIndex = symbols.length; - const objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken); + const objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken, position, sourceFile); if (!objectLikeContainer) return 0 /* Continue */; completionKind = 0 /* ObjectPropertyDeclaration */; let typeMembers; let existingMembers; - if (objectLikeContainer.kind === 209 /* ObjectLiteralExpression */) { + if (objectLikeContainer.kind === 210 /* ObjectLiteralExpression */) { const instantiatedType = tryGetObjectLiteralContextualType(objectLikeContainer, typeChecker); if (instantiatedType === void 0) { - if (objectLikeContainer.flags & 33554432 /* InWithStatement */) { + if (objectLikeContainer.flags & 67108864 /* InWithStatement */) { return 2 /* Fail */; } isNonContextualObjectLiteral = true; @@ -156788,16 +159033,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } } else { - Debug.assert(objectLikeContainer.kind === 205 /* ObjectBindingPattern */); + Debug.assert(objectLikeContainer.kind === 206 /* ObjectBindingPattern */); isNewIdentifierLocation = false; const rootDeclaration = getRootDeclaration(objectLikeContainer.parent); if (!isVariableLike(rootDeclaration)) return Debug.fail("Root declaration is not variable-like."); - let canGetType = hasInitializer(rootDeclaration) || !!getEffectiveTypeAnnotationNode(rootDeclaration) || rootDeclaration.parent.parent.kind === 249 /* ForOfStatement */; - if (!canGetType && rootDeclaration.kind === 168 /* Parameter */) { + let canGetType = hasInitializer(rootDeclaration) || !!getEffectiveTypeAnnotationNode(rootDeclaration) || rootDeclaration.parent.parent.kind === 250 /* ForOfStatement */; + if (!canGetType && rootDeclaration.kind === 169 /* Parameter */) { if (isExpression(rootDeclaration.parent)) { canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); - } else if (rootDeclaration.parent.kind === 173 /* MethodDeclaration */ || rootDeclaration.parent.kind === 177 /* SetAccessor */) { + } else if (rootDeclaration.parent.kind === 174 /* MethodDeclaration */ || rootDeclaration.parent.kind === 178 /* SetAccessor */) { canGetType = isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent); } } @@ -156823,7 +159068,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const filteredMembers = filterObjectMembersList(typeMembers, Debug.checkDefined(existingMembers)); symbols = concatenate(symbols, filteredMembers); setSortTextToOptionalMember(); - if (objectLikeContainer.kind === 209 /* ObjectLiteralExpression */ && preferences.includeCompletionsWithObjectLiteralMethodSnippets && preferences.includeCompletionsWithInsertText) { + if (objectLikeContainer.kind === 210 /* ObjectLiteralExpression */ && preferences.includeCompletionsWithObjectLiteralMethodSnippets && preferences.includeCompletionsWithInsertText) { transformObjectLiteralMembersSortText(symbolsStartIndex); collectObjectLiteralMethodSymbols(filteredMembers, objectLikeContainer); } @@ -156839,10 +159084,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (!isTypeKeywordTokenOrIdentifier(contextToken)) { keywordFilters = 8 /* TypeKeyword */; } - const { moduleSpecifier } = namedImportsOrExports.kind === 274 /* NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent; + const { moduleSpecifier } = namedImportsOrExports.kind === 275 /* NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent; if (!moduleSpecifier) { isNewIdentifierLocation = true; - return namedImportsOrExports.kind === 274 /* NamedImports */ ? 2 /* Fail */ : 0 /* Continue */; + return namedImportsOrExports.kind === 275 /* NamedImports */ ? 2 /* Fail */ : 0 /* Continue */; } const moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier); if (!moduleSpecifierSymbol) { @@ -156967,11 +159212,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} case 31 /* LessThanSlashToken */: case 44 /* SlashToken */: case 80 /* Identifier */: - case 210 /* PropertyAccessExpression */: - case 291 /* JsxAttributes */: - case 290 /* JsxAttribute */: - case 292 /* JsxSpreadAttribute */: - if (parent2 && (parent2.kind === 284 /* JsxSelfClosingElement */ || parent2.kind === 285 /* JsxOpeningElement */)) { + case 211 /* PropertyAccessExpression */: + case 292 /* JsxAttributes */: + case 291 /* JsxAttribute */: + case 293 /* JsxSpreadAttribute */: + if (parent2 && (parent2.kind === 285 /* JsxSelfClosingElement */ || parent2.kind === 286 /* JsxOpeningElement */)) { if (contextToken2.kind === 32 /* GreaterThanToken */) { const precedingToken = findPrecedingToken( contextToken2.pos, @@ -156983,20 +159228,20 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} break; } return parent2; - } else if (parent2.kind === 290 /* JsxAttribute */) { + } else if (parent2.kind === 291 /* JsxAttribute */) { return parent2.parent.parent; } break; case 11 /* StringLiteral */: - if (parent2 && (parent2.kind === 290 /* JsxAttribute */ || parent2.kind === 292 /* JsxSpreadAttribute */)) { + if (parent2 && (parent2.kind === 291 /* JsxAttribute */ || parent2.kind === 293 /* JsxSpreadAttribute */)) { return parent2.parent.parent; } break; case 20 /* CloseBraceToken */: - if (parent2 && parent2.kind === 293 /* JsxExpression */ && parent2.parent && parent2.parent.kind === 290 /* JsxAttribute */) { + if (parent2 && parent2.kind === 294 /* JsxExpression */ && parent2.parent && parent2.parent.kind === 291 /* JsxAttribute */) { return parent2.parent.parent.parent; } - if (parent2 && parent2.kind === 292 /* JsxSpreadAttribute */) { + if (parent2 && parent2.kind === 293 /* JsxSpreadAttribute */) { return parent2.parent.parent; } break; @@ -157009,44 +159254,44 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const containingNodeKind = parent2.kind; switch (contextToken2.kind) { case 28 /* CommaToken */: - return containingNodeKind === 259 /* VariableDeclaration */ || isVariableDeclarationListButNotTypeArgument(contextToken2) || containingNodeKind === 242 /* VariableStatement */ || containingNodeKind === 265 /* EnumDeclaration */ || // enum a { foo, | - isFunctionLikeButNotConstructor(containingNodeKind) || containingNodeKind === 263 /* InterfaceDeclaration */ || // interface A= contextToken2.pos; case 25 /* DotToken */: - return containingNodeKind === 206 /* ArrayBindingPattern */; + return containingNodeKind === 207 /* ArrayBindingPattern */; case 59 /* ColonToken */: - return containingNodeKind === 207 /* BindingElement */; + return containingNodeKind === 208 /* BindingElement */; case 23 /* OpenBracketToken */: - return containingNodeKind === 206 /* ArrayBindingPattern */; + return containingNodeKind === 207 /* ArrayBindingPattern */; case 21 /* OpenParenToken */: - return containingNodeKind === 298 /* CatchClause */ || isFunctionLikeButNotConstructor(containingNodeKind); + return containingNodeKind === 299 /* CatchClause */ || isFunctionLikeButNotConstructor(containingNodeKind); case 19 /* OpenBraceToken */: - return containingNodeKind === 265 /* EnumDeclaration */; + return containingNodeKind === 266 /* EnumDeclaration */; case 30 /* LessThanToken */: - return containingNodeKind === 262 /* ClassDeclaration */ || // class A< | - containingNodeKind === 230 /* ClassExpression */ || // var C = class D< | - containingNodeKind === 263 /* InterfaceDeclaration */ || // interface A< | - containingNodeKind === 264 /* TypeAliasDeclaration */ || // type List< | + return containingNodeKind === 263 /* ClassDeclaration */ || // class A< | + containingNodeKind === 231 /* ClassExpression */ || // var C = class D< | + containingNodeKind === 264 /* InterfaceDeclaration */ || // interface A< | + containingNodeKind === 265 /* TypeAliasDeclaration */ || // type List< | isFunctionLikeKind(containingNodeKind); case 126 /* StaticKeyword */: - return containingNodeKind === 171 /* PropertyDeclaration */ && !isClassLike(parent2.parent); + return containingNodeKind === 172 /* PropertyDeclaration */ && !isClassLike(parent2.parent); case 26 /* DotDotDotToken */: - return containingNodeKind === 168 /* Parameter */ || !!parent2.parent && parent2.parent.kind === 206 /* ArrayBindingPattern */; + return containingNodeKind === 169 /* Parameter */ || !!parent2.parent && parent2.parent.kind === 207 /* ArrayBindingPattern */; case 125 /* PublicKeyword */: case 123 /* PrivateKeyword */: case 124 /* ProtectedKeyword */: - return containingNodeKind === 168 /* Parameter */ && !isConstructorDeclaration(parent2.parent); + return containingNodeKind === 169 /* Parameter */ && !isConstructorDeclaration(parent2.parent); case 130 /* AsKeyword */: - return containingNodeKind === 275 /* ImportSpecifier */ || containingNodeKind === 280 /* ExportSpecifier */ || containingNodeKind === 273 /* NamespaceImport */; + return containingNodeKind === 276 /* ImportSpecifier */ || containingNodeKind === 281 /* ExportSpecifier */ || containingNodeKind === 274 /* NamespaceImport */; case 139 /* GetKeyword */: case 153 /* SetKeyword */: return !isFromObjectTypeDeclaration(contextToken2); case 80 /* Identifier */: - if (containingNodeKind === 275 /* ImportSpecifier */ && contextToken2 === parent2.name && contextToken2.text === "type") { + if (containingNodeKind === 276 /* ImportSpecifier */ && contextToken2 === parent2.name && contextToken2.text === "type") { return false; } break; @@ -157061,7 +159306,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} case 140 /* InferKeyword */: return true; case 156 /* TypeKeyword */: - return containingNodeKind !== 275 /* ImportSpecifier */; + return containingNodeKind !== 276 /* ImportSpecifier */; case 42 /* AsteriskToken */: return isFunctionLike(contextToken2.parent) && !isMethodDeclaration(contextToken2.parent); } @@ -157095,7 +159340,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (ancestorClassLike && contextToken2 === previousToken && isPreviousPropertyDeclarationTerminated(contextToken2, position)) { return false; } - const ancestorPropertyDeclaraion = getAncestor(contextToken2.parent, 171 /* PropertyDeclaration */); + const ancestorPropertyDeclaraion = getAncestor(contextToken2.parent, 172 /* PropertyDeclaration */); if (ancestorPropertyDeclaraion && contextToken2 !== previousToken && isClassLike(previousToken.parent.parent) && position <= previousToken.end) { if (isPreviousPropertyDeclarationTerminated(contextToken2, previousToken.end)) { return false; @@ -157109,7 +159354,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return contextToken2.kind !== 64 /* EqualsToken */ && (contextToken2.kind === 27 /* SemicolonToken */ || !positionsAreOnSameLine(contextToken2.end, position2, sourceFile)); } function isFunctionLikeButNotConstructor(kind) { - return isFunctionLikeKind(kind) && kind !== 175 /* Constructor */; + return isFunctionLikeKind(kind) && kind !== 176 /* Constructor */; } function isDotOfNumericLiteral(contextToken2) { if (contextToken2.kind === 9 /* NumericLiteral */) { @@ -157119,7 +159364,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return false; } function isVariableDeclarationListButNotTypeArgument(node2) { - return node2.parent.kind === 260 /* VariableDeclarationList */ && !isPossiblyTypeArgumentPosition(node2, sourceFile, typeChecker); + return node2.parent.kind === 261 /* VariableDeclarationList */ && !isPossiblyTypeArgumentPosition(node2, sourceFile, typeChecker); } function filterObjectMembersList(contextualMemberSymbols, existingMembers) { if (existingMembers.length === 0) { @@ -157128,7 +159373,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const membersDeclaredBySpreadAssignment = /* @__PURE__ */ new Set(); const existingMemberNames = /* @__PURE__ */ new Set(); for (const m of existingMembers) { - if (m.kind !== 302 /* PropertyAssignment */ && m.kind !== 303 /* ShorthandPropertyAssignment */ && m.kind !== 207 /* BindingElement */ && m.kind !== 173 /* MethodDeclaration */ && m.kind !== 176 /* GetAccessor */ && m.kind !== 177 /* SetAccessor */ && m.kind !== 304 /* SpreadAssignment */) { + if (m.kind !== 303 /* PropertyAssignment */ && m.kind !== 304 /* ShorthandPropertyAssignment */ && m.kind !== 208 /* BindingElement */ && m.kind !== 174 /* MethodDeclaration */ && m.kind !== 177 /* GetAccessor */ && m.kind !== 178 /* SetAccessor */ && m.kind !== 305 /* SpreadAssignment */) { continue; } if (isCurrentlyEditingNode(m)) { @@ -157206,7 +159451,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function filterClassMembersList(baseSymbols, existingMembers, currentClassElementModifierFlags) { const existingMemberNames = /* @__PURE__ */ new Set(); for (const m of existingMembers) { - if (m.kind !== 171 /* PropertyDeclaration */ && m.kind !== 173 /* MethodDeclaration */ && m.kind !== 176 /* GetAccessor */ && m.kind !== 177 /* SetAccessor */) { + if (m.kind !== 172 /* PropertyDeclaration */ && m.kind !== 174 /* MethodDeclaration */ && m.kind !== 177 /* GetAccessor */ && m.kind !== 178 /* SetAccessor */) { continue; } if (isCurrentlyEditingNode(m)) { @@ -157232,7 +159477,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (isCurrentlyEditingNode(attr)) { continue; } - if (attr.kind === 290 /* JsxAttribute */) { + if (attr.kind === 291 /* JsxAttribute */) { seenNames.add(getEscapedTextOfJsxAttributeName(attr.name)); } else if (isJsxSpreadAttribute(attr)) { setMembersDeclaredBySpreadAssignment(attr, membersDeclaredBySpreadAssignment); @@ -157246,7 +159491,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return node2.getStart(sourceFile) <= position && position <= node2.getEnd(); } } - function tryGetObjectLikeCompletionContainer(contextToken) { + function tryGetObjectLikeCompletionContainer(contextToken, position, sourceFile) { + var _a; if (contextToken) { const { parent: parent2 } = contextToken; switch (contextToken.kind) { @@ -157261,7 +159507,29 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} case 134 /* AsyncKeyword */: return tryCast(parent2.parent, isObjectLiteralExpression); case 80 /* Identifier */: - return contextToken.text === "async" && isShorthandPropertyAssignment(contextToken.parent) ? contextToken.parent.parent : void 0; + if (contextToken.text === "async" && isShorthandPropertyAssignment(contextToken.parent)) { + return contextToken.parent.parent; + } else { + if (isObjectLiteralExpression(contextToken.parent.parent) && (isSpreadAssignment(contextToken.parent) || isShorthandPropertyAssignment(contextToken.parent) && getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line !== getLineAndCharacterOfPosition(sourceFile, position).line)) { + return contextToken.parent.parent; + } + const ancestorNode2 = findAncestor(parent2, isPropertyAssignment); + if ((ancestorNode2 == null ? void 0 : ancestorNode2.getLastToken(sourceFile)) === contextToken && isObjectLiteralExpression(ancestorNode2.parent)) { + return ancestorNode2.parent; + } + } + break; + default: + if (((_a = parent2.parent) == null ? void 0 : _a.parent) && (isMethodDeclaration(parent2.parent) || isGetAccessorDeclaration(parent2.parent) || isSetAccessorDeclaration(parent2.parent)) && isObjectLiteralExpression(parent2.parent.parent)) { + return parent2.parent.parent; + } + if (isSpreadAssignment(parent2) && isObjectLiteralExpression(parent2.parent)) { + return parent2.parent; + } + const ancestorNode = findAncestor(parent2, isPropertyAssignment); + if (contextToken.kind !== 59 /* ColonToken */ && (ancestorNode == null ? void 0 : ancestorNode.getLastToken(sourceFile)) === contextToken && isObjectLiteralExpression(ancestorNode.parent)) { + return ancestorNode.parent; + } } } return void 0; @@ -157356,11 +159624,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} switch (kind) { case 128 /* AbstractKeyword */: case 133 /* AnyKeyword */: - case 162 /* BigIntKeyword */: + case 163 /* BigIntKeyword */: case 136 /* BooleanKeyword */: case 138 /* DeclareKeyword */: case 94 /* EnumKeyword */: - case 161 /* GlobalKeyword */: + case 162 /* GlobalKeyword */: case 119 /* ImplementsKeyword */: case 140 /* InferKeyword */: case 120 /* InterfaceKeyword */: @@ -157371,7 +159639,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} case 146 /* NeverKeyword */: case 150 /* NumberKeyword */: case 151 /* ObjectKeyword */: - case 163 /* OverrideKeyword */: + case 164 /* OverrideKeyword */: case 123 /* PrivateKeyword */: case 124 /* ProtectedKeyword */: case 125 /* PublicKeyword */: @@ -157398,7 +159666,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} case 153 /* SetKeyword */: case 134 /* AsyncKeyword */: case 138 /* DeclareKeyword */: - case 163 /* OverrideKeyword */: + case 164 /* OverrideKeyword */: return true; default: return isClassMemberModifier(kind); @@ -157455,7 +159723,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location, position) { switch (location.kind) { - case 357 /* SyntaxList */: + case 358 /* SyntaxList */: return tryCast(location.parent, isObjectTypeDeclaration); case 1 /* EndOfFileToken */: const cls = tryCast(lastOrUndefined(cast(location.parent, isSourceFile).statements), isObjectTypeDeclaration); @@ -157463,6 +159731,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return cls; } break; + case 81 /* PrivateIdentifier */: + if (tryCast(location.parent, isPropertyDeclaration)) { + return findAncestor(location, isClassLike); + } + break; case 80 /* Identifier */: { const originalKeywordKind = identifierToKeywordKind(location); if (originalKeywordKind) { @@ -157514,7 +159787,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} case 27 /* SemicolonToken */: case 28 /* CommaToken */: case 80 /* Identifier */: - if (parent2.kind === 170 /* PropertySignature */ && isTypeLiteralNode(parent2.parent)) { + if (parent2.kind === 171 /* PropertySignature */ && isTypeLiteralNode(parent2.parent)) { return parent2.parent; } break; @@ -157531,11 +159804,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (!t) return void 0; switch (node.kind) { - case 170 /* PropertySignature */: + case 171 /* PropertySignature */: return checker.getTypeOfPropertyOfContextualType(t, node.symbol.escapedName); - case 192 /* IntersectionType */: - case 186 /* TypeLiteral */: - case 191 /* UnionType */: + case 193 /* IntersectionType */: + case 187 /* TypeLiteral */: + case 192 /* UnionType */: return t; } } @@ -157558,7 +159831,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} case "/": return !!contextToken && (isStringLiteralLike(contextToken) ? !!tryGetImportFromModuleSpecifier(contextToken) : contextToken.kind === 44 /* SlashToken */ && isJsxClosingElement(contextToken.parent)); case " ": - return !!contextToken && isImportKeyword(contextToken) && contextToken.parent.kind === 311 /* SourceFile */; + return !!contextToken && isImportKeyword(contextToken) && contextToken.parent.kind === 312 /* SourceFile */; default: return Debug.assertNever(triggerCharacter); } @@ -157619,7 +159892,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return void 0; } - function getImportStatementCompletionInfo(contextToken) { + function getImportStatementCompletionInfo(contextToken, sourceFile) { var _a, _b, _c; let keywordCompletion; let isKeywordOnlyCompletion = false; @@ -157635,6 +159908,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function getCandidate() { const parent2 = contextToken.parent; if (isImportEqualsDeclaration(parent2)) { + const lastToken = parent2.getLastToken(sourceFile); + if (isIdentifier(contextToken) && lastToken !== contextToken) { + keywordCompletion = 161 /* FromKeyword */; + isKeywordOnlyCompletion = true; + return void 0; + } keywordCompletion = contextToken.kind === 156 /* TypeKeyword */ ? void 0 : 156 /* TypeKeyword */; return isModuleSpecifierMissingOrEmpty(parent2.moduleReference) ? parent2 : void 0; } @@ -157648,7 +159927,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (canCompleteFromNamedBindings(parent2)) { if (contextToken.kind === 20 /* CloseBraceToken */ || contextToken.kind === 80 /* Identifier */) { isKeywordOnlyCompletion = true; - keywordCompletion = 160 /* FromKeyword */; + keywordCompletion = 161 /* FromKeyword */; } else { return parent2.parent.parent; } @@ -157675,8 +159954,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (rangeIsOnSingleLine(top, sourceFile)) { return createTextSpanFromNode(top, sourceFile); } - Debug.assert(top.kind !== 102 /* ImportKeyword */ && top.kind !== 275 /* ImportSpecifier */); - const potentialSplitPoint = top.kind === 271 /* ImportDeclaration */ ? getPotentiallyInvalidImportSpecifier((_a = top.importClause) == null ? void 0 : _a.namedBindings) ?? top.moduleSpecifier : top.moduleReference; + Debug.assert(top.kind !== 102 /* ImportKeyword */ && top.kind !== 276 /* ImportSpecifier */); + const potentialSplitPoint = top.kind === 272 /* ImportDeclaration */ ? getPotentiallyInvalidImportSpecifier((_a = top.importClause) == null ? void 0 : _a.namedBindings) ?? top.moduleSpecifier : top.moduleReference; const withoutModuleSpecifier = { pos: top.getFirstToken().getStart(), end: potentialSplitPoint.pos @@ -157715,11 +159994,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return true; return !((_a = tryCast(isExternalModuleReference(specifier) ? specifier.expression : specifier, isStringLiteralLike)) == null ? void 0 : _a.text); } - function getVariableOrParameterDeclaration(contextToken) { + function getVariableOrParameterDeclaration(contextToken, location) { if (!contextToken) return; - const declaration = findAncestor(contextToken, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : isVariableDeclaration(node) || (isParameter(node) || isTypeParameterDeclaration(node)) && !isIndexSignatureDeclaration(node.parent)); - return declaration; + const possiblyParameterDeclaration = findAncestor(contextToken, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : (isParameter(node) || isTypeParameterDeclaration(node)) && !isIndexSignatureDeclaration(node.parent)); + const possiblyVariableDeclaration = findAncestor(location, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : isVariableDeclaration(node)); + return possiblyParameterDeclaration || possiblyVariableDeclaration; } function isArrowFunctionBody(node) { return node.parent && isArrowFunction(node.parent) && (node.parent.body === node || // const a = () => /**/; @@ -157803,6 +160083,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} CompletionSource2["TypeOnlyAlias"] = "TypeOnlyAlias/"; CompletionSource2["ObjectLiteralMethodSnippet"] = "ObjectLiteralMethodSnippet/"; CompletionSource2["SwitchCases"] = "SwitchCases/"; + CompletionSource2["ObjectLiteralMemberWithComma"] = "ObjectLiteralMemberWithComma/"; return CompletionSource2; })(CompletionSource || {}); SymbolOriginInfoKind = /* @__PURE__ */ ((SymbolOriginInfoKind2) => { @@ -157832,7 +160113,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} _keywordCompletions = []; allKeywordsCompletions = memoize(() => { const res = []; - for (let i = 83 /* FirstKeyword */; i <= 164 /* LastKeyword */; i++) { + for (let i = 83 /* FirstKeyword */; i <= 165 /* LastKeyword */; i++) { res.push({ name: tokenToString(i), kind: "keyword" /* keyword */, @@ -158002,37 +160283,37 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function getStringLiteralCompletionEntries(sourceFile, node, position, typeChecker, compilerOptions, host, preferences) { const parent2 = walkUpParentheses(node.parent); switch (parent2.kind) { - case 200 /* LiteralType */: { + case 201 /* LiteralType */: { const grandParent = walkUpParentheses(parent2.parent); - if (grandParent.kind === 204 /* ImportType */) { + if (grandParent.kind === 205 /* ImportType */) { return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) }; } return fromUnionableLiteralType(grandParent); } - case 302 /* PropertyAssignment */: + case 303 /* PropertyAssignment */: if (isObjectLiteralExpression(parent2.parent) && parent2.name === node) { return stringLiteralCompletionsForObjectLiteral(typeChecker, parent2.parent); } return fromContextualType() || fromContextualType(0 /* None */); - case 211 /* ElementAccessExpression */: { + case 212 /* ElementAccessExpression */: { const { expression, argumentExpression } = parent2; if (node === skipParentheses(argumentExpression)) { return stringLiteralCompletionsFromProperties(typeChecker.getTypeAtLocation(expression)); } return void 0; } - case 212 /* CallExpression */: - case 213 /* NewExpression */: - case 290 /* JsxAttribute */: + case 213 /* CallExpression */: + case 214 /* NewExpression */: + case 291 /* JsxAttribute */: if (!isRequireCallArgument(node) && !isImportCall(parent2)) { - const argumentInfo = ts_SignatureHelp_exports.getArgumentInfoForCompletions(parent2.kind === 290 /* JsxAttribute */ ? parent2.parent : node, position, sourceFile); - return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(); + const argumentInfo = ts_SignatureHelp_exports.getArgumentInfoForCompletions(parent2.kind === 291 /* JsxAttribute */ ? parent2.parent : node, position, sourceFile); + return argumentInfo && (getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker, 0 /* Normal */)) || fromContextualType(0 /* None */); } - case 271 /* ImportDeclaration */: - case 277 /* ExportDeclaration */: - case 282 /* ExternalModuleReference */: + case 272 /* ImportDeclaration */: + case 278 /* ExportDeclaration */: + case 283 /* ExternalModuleReference */: return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) }; - case 295 /* CaseClause */: + case 296 /* CaseClause */: const tracker = newCaseClauseTracker(typeChecker, parent2.parent.clauses); const contextualTypes = fromContextualType(); if (!contextualTypes) { @@ -158045,21 +160326,21 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function fromUnionableLiteralType(grandParent) { switch (grandParent.kind) { - case 232 /* ExpressionWithTypeArguments */: - case 182 /* TypeReference */: { + case 233 /* ExpressionWithTypeArguments */: + case 183 /* TypeReference */: { const typeArgument = findAncestor(parent2, (n) => n.parent === grandParent); if (typeArgument) { return { kind: 2 /* Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(typeArgument)), isNewIdentifier: false }; } return void 0; } - case 198 /* IndexedAccessType */: + case 199 /* IndexedAccessType */: const { indexType, objectType } = grandParent; if (!rangeContainsPosition(indexType, position)) { return void 0; } return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(objectType)); - case 191 /* UnionType */: { + case 192 /* UnionType */: { const result = fromUnionableLiteralType(walkUpParentheses(grandParent.parent)); if (!result) { return void 0; @@ -158084,9 +160365,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function walkUpParentheses(node) { switch (node.kind) { - case 195 /* ParenthesizedType */: + case 196 /* ParenthesizedType */: return walkUpParenthesizedTypes(node); - case 216 /* ParenthesizedExpression */: + case 217 /* ParenthesizedExpression */: return walkUpParenthesizedExpressions(node); default: return node; @@ -158095,12 +160376,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function getAlreadyUsedTypesInStringLiteralUnion(union, current) { return mapDefined(union.types, (type) => type !== current && isLiteralTypeNode(type) && isStringLiteral(type.literal) ? type.literal.text : void 0); } - function getStringLiteralCompletionsFromSignature(call, arg, argumentInfo, checker) { + function getStringLiteralCompletionsFromSignature(call, arg, argumentInfo, checker, checkMode = 32 /* IsForStringLiteralArgumentCompletions */) { let isNewIdentifier = false; const uniques = /* @__PURE__ */ new Map(); const candidates = []; const editingArgument = isJsxOpeningLikeElement(call) ? Debug.checkDefined(findAncestor(arg.parent, isJsxAttribute)) : arg; - checker.getResolvedSignatureForStringLiteralCompletions(call, editingArgument, candidates); + checker.getResolvedSignatureForStringLiteralCompletions(call, editingArgument, candidates, checkMode); const types = flatMap(candidates, (candidate) => { if (!signatureHasRestParameter(candidate) && argumentInfo.argumentCount > candidate.parameters.length) return; @@ -158200,7 +160481,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} extensionOptions, host, /*moduleSpecifierIsRelative*/ - false, + true, scriptPath ).values()); } @@ -158461,7 +160742,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } const keys = getOwnKeys(exports); const fragmentSubpath = components.join("/") + (components.length && hasTrailingDirectorySeparator(fragment) ? "/" : ""); - const conditions = mode === 99 /* ESNext */ ? ["node", "import", "types"] : ["node", "require", "types"]; + const conditions = getConditions(compilerOptions, mode === 99 /* ESNext */); addCompletionEntriesFromPathsOrExports( result, fragmentSubpath, @@ -158532,16 +160813,18 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const fragmentDirectory = fragmentHasPath ? hasTrailingDirectorySeparator(fragment) ? fragment : getDirectoryPath(fragment) : void 0; const expandedPrefixDirectory = fragmentHasPath ? combinePaths(normalizedPrefixDirectory, normalizedPrefixBase + fragmentDirectory) : normalizedPrefixDirectory; const normalizedSuffix = normalizePath(parsed.suffix); + const declarationExtension = normalizedSuffix && getDeclarationEmitExtensionForPath("_" + normalizedSuffix); + const matchingSuffixes = declarationExtension ? [changeExtension(normalizedSuffix, declarationExtension), normalizedSuffix] : [normalizedSuffix]; const baseDirectory = normalizePath(combinePaths(packageDirectory, expandedPrefixDirectory)); const completePrefix = fragmentHasPath ? baseDirectory : ensureTrailingDirectorySeparator(baseDirectory) + normalizedPrefixBase; - const includeGlob = normalizedSuffix ? "**/*" + normalizedSuffix : "./*"; + const includeGlobs = normalizedSuffix ? matchingSuffixes.map((suffix) => "**/*" + suffix) : ["./*"]; const matches = mapDefined(tryReadDirectory( host, baseDirectory, extensionOptions.extensionsToSearch, /*exclude*/ void 0, - [includeGlob] + includeGlobs ), (match) => { const trimmedWithPattern = trimPrefixAndSuffix(match); if (trimmedWithPattern) { @@ -158555,8 +160838,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const directories = normalizedSuffix ? emptyArray : mapDefined(tryGetDirectories(host, baseDirectory), (dir) => dir === "node_modules" ? void 0 : directoryResult(dir)); return [...matches, ...directories]; function trimPrefixAndSuffix(path) { - const inner = withoutStartAndEnd(normalizePath(path), completePrefix, normalizedSuffix); - return inner === void 0 ? void 0 : removeLeadingDirectorySeparator(inner); + return firstDefined(matchingSuffixes, (suffix) => { + const inner = withoutStartAndEnd(normalizePath(path), completePrefix, suffix); + return inner === void 0 ? void 0 : removeLeadingDirectorySeparator(inner); + }); } } function withoutStartAndEnd(s, start, end) { @@ -158780,14 +161065,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (cancellationToken) cancellationToken.throwIfCancellationRequested(); switch (direct.kind) { - case 212 /* CallExpression */: + case 213 /* CallExpression */: if (isImportCall(direct)) { handleImportCall(direct); break; } if (!isAvailableThroughGlobal) { const parent2 = direct.parent; - if (exportKind === 2 /* ExportEquals */ && parent2.kind === 259 /* VariableDeclaration */) { + if (exportKind === 2 /* ExportEquals */ && parent2.kind === 260 /* VariableDeclaration */) { const { name } = parent2; if (name.kind === 80 /* Identifier */) { directImports.push(name); @@ -158798,7 +161083,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} break; case 80 /* Identifier */: break; - case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportEqualsDeclaration */: handleNamespaceImport( direct, direct.name, @@ -158807,10 +161092,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} false ); break; - case 271 /* ImportDeclaration */: + case 272 /* ImportDeclaration */: directImports.push(direct); const namedBindings = direct.importClause && direct.importClause.namedBindings; - if (namedBindings && namedBindings.kind === 273 /* NamespaceImport */) { + if (namedBindings && namedBindings.kind === 274 /* NamespaceImport */) { handleNamespaceImport( direct, namedBindings.name, @@ -158823,10 +161108,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} addIndirectUser(getSourceFileLikeForImportDeclaration(direct)); } break; - case 277 /* ExportDeclaration */: + case 278 /* ExportDeclaration */: if (!direct.exportClause) { handleDirectImports(getContainingModuleSymbol(direct, checker)); - } else if (direct.exportClause.kind === 279 /* NamespaceExport */) { + } else if (direct.exportClause.kind === 280 /* NamespaceExport */) { addIndirectUser( getSourceFileLikeForImportDeclaration(direct), /*addTransitiveDependencies*/ @@ -158836,7 +161121,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} directImports.push(direct); } break; - case 204 /* ImportType */: + case 205 /* ImportType */: if (!isAvailableThroughGlobal && direct.isTypeOf && !direct.qualifier && isExported2(direct)) { addIndirectUser( direct.getSourceFile(), @@ -158877,7 +161162,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} directImports.push(importDeclaration); } else if (!isAvailableThroughGlobal) { const sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration); - Debug.assert(sourceFileLike.kind === 311 /* SourceFile */ || sourceFileLike.kind === 266 /* ModuleDeclaration */); + Debug.assert(sourceFileLike.kind === 312 /* SourceFile */ || sourceFileLike.kind === 267 /* ModuleDeclaration */); if (isReExport || findNamespaceReExports(sourceFileLike, name, checker)) { addIndirectUser( sourceFileLike, @@ -158931,7 +161216,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return { importSearches, singleReferences }; function handleImport(decl) { - if (decl.kind === 270 /* ImportEqualsDeclaration */) { + if (decl.kind === 271 /* ImportEqualsDeclaration */) { if (isExternalModuleImportEquals(decl)) { handleNamespaceImportLike(decl.name); } @@ -158941,7 +161226,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} handleNamespaceImportLike(decl); return; } - if (decl.kind === 204 /* ImportType */) { + if (decl.kind === 205 /* ImportType */) { if (decl.qualifier) { const firstIdentifier = getFirstIdentifier(decl.qualifier); if (firstIdentifier.escapedText === symbolName(exportSymbol)) { @@ -158955,7 +161240,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (decl.moduleSpecifier.kind !== 11 /* StringLiteral */) { return; } - if (decl.kind === 277 /* ExportDeclaration */) { + if (decl.kind === 278 /* ExportDeclaration */) { if (decl.exportClause && isNamedExports(decl.exportClause)) { searchForNamedImport(decl.exportClause); } @@ -158964,10 +161249,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const { name, namedBindings } = decl.importClause || { name: void 0, namedBindings: void 0 }; if (namedBindings) { switch (namedBindings.kind) { - case 273 /* NamespaceImport */: + case 274 /* NamespaceImport */: handleNamespaceImportLike(namedBindings.name); break; - case 274 /* NamedImports */: + case 275 /* NamedImports */: if (exportKind === 0 /* Named */ || exportKind === 1 /* Default */) { searchForNamedImport(namedBindings); } @@ -159001,7 +161286,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} addSearch(name, checker.getSymbolAtLocation(name)); } } else { - const localSymbol = element.kind === 280 /* ExportSpecifier */ && element.propertyName ? checker.getExportSpecifierLocalTargetSymbol(element) : checker.getSymbolAtLocation(name); + const localSymbol = element.kind === 281 /* ExportSpecifier */ && element.propertyName ? checker.getExportSpecifierLocalTargetSymbol(element) : checker.getSymbolAtLocation(name); addSearch(name, localSymbol); } } @@ -159025,7 +161310,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const checker = program.getTypeChecker(); for (const referencingFile of sourceFiles) { const searchSourceFile = searchModuleSymbol.valueDeclaration; - if ((searchSourceFile == null ? void 0 : searchSourceFile.kind) === 311 /* SourceFile */) { + if ((searchSourceFile == null ? void 0 : searchSourceFile.kind) === 312 /* SourceFile */) { for (const ref of referencingFile.referencedFiles) { if (program.getSourceFileFromReference(referencingFile, ref) === searchSourceFile) { refs.push({ kind: "reference", referencingFile, ref }); @@ -159067,7 +161352,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return map2; } function forEachPossibleImportOrExportStatement(sourceFileLike, action) { - return forEach(sourceFileLike.kind === 311 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, (statement) => ( + return forEach(sourceFileLike.kind === 312 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, (statement) => ( // TODO: GH#18217 action(statement) || isAmbientModuleDeclaration(statement) && forEach(statement.body && statement.body.statements, action) )); @@ -159080,15 +161365,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } else { forEachPossibleImportOrExportStatement(sourceFile, (statement) => { switch (statement.kind) { - case 277 /* ExportDeclaration */: - case 271 /* ImportDeclaration */: { + case 278 /* ExportDeclaration */: + case 272 /* ImportDeclaration */: { const decl = statement; if (decl.moduleSpecifier && isStringLiteral(decl.moduleSpecifier)) { action(decl, decl.moduleSpecifier); } break; } - case 270 /* ImportEqualsDeclaration */: { + case 271 /* ImportEqualsDeclaration */: { const decl = statement; if (isExternalModuleImportEquals(decl)) { action(decl, decl.moduleReference.expression); @@ -159106,7 +161391,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const { parent: parent2 } = node; const grandparent = parent2.parent; if (symbol.exportSymbol) { - if (parent2.kind === 210 /* PropertyAccessExpression */) { + if (parent2.kind === 211 /* PropertyAccessExpression */) { return ((_a = symbol.declarations) == null ? void 0 : _a.some((d) => d === parent2)) && isBinaryExpression(grandparent) ? getSpecialPropertyExport( grandparent, /*useLhsSymbol*/ @@ -159223,15 +161508,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function isNodeImport(node) { const { parent: parent2 } = node; switch (parent2.kind) { - case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportEqualsDeclaration */: return parent2.name === node && isExternalModuleImportEquals(parent2); - case 275 /* ImportSpecifier */: + case 276 /* ImportSpecifier */: return !parent2.propertyName; - case 272 /* ImportClause */: - case 273 /* NamespaceImport */: + case 273 /* ImportClause */: + case 274 /* NamespaceImport */: Debug.assert(parent2.name === node); return true; - case 207 /* BindingElement */: + case 208 /* BindingElement */: return isInJSFile(node) && isVariableDeclarationInitializedToBareOrAccessedRequire(parent2.parent.parent); default: return false; @@ -159262,21 +161547,21 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol); } function getSourceFileLikeForImportDeclaration(node) { - if (node.kind === 212 /* CallExpression */) { + if (node.kind === 213 /* CallExpression */) { return node.getSourceFile(); } const { parent: parent2 } = node; - if (parent2.kind === 311 /* SourceFile */) { + if (parent2.kind === 312 /* SourceFile */) { return parent2; } - Debug.assert(parent2.kind === 267 /* ModuleBlock */); + Debug.assert(parent2.kind === 268 /* ModuleBlock */); return cast(parent2.parent, isAmbientModuleDeclaration); } function isAmbientModuleDeclaration(node) { - return node.kind === 266 /* ModuleDeclaration */ && node.name.kind === 11 /* StringLiteral */; + return node.kind === 267 /* ModuleDeclaration */ && node.name.kind === 11 /* StringLiteral */; } function isExternalModuleImportEquals(eq) { - return eq.moduleReference.kind === 282 /* ExternalModuleReference */ && eq.moduleReference.expression.kind === 11 /* StringLiteral */; + return eq.moduleReference.kind === 283 /* ExternalModuleReference */ && eq.moduleReference.expression.kind === 11 /* StringLiteral */; } var ExportKind2, ImportExport; var init_importTracker = __esm({ @@ -159350,28 +161635,28 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (!node) return void 0; switch (node.kind) { - case 259 /* VariableDeclaration */: + case 260 /* VariableDeclaration */: return !isVariableDeclarationList(node.parent) || node.parent.declarations.length !== 1 ? node : isVariableStatement(node.parent.parent) ? node.parent.parent : isForInOrOfStatement(node.parent.parent) ? getContextNode(node.parent.parent) : node.parent; - case 207 /* BindingElement */: + case 208 /* BindingElement */: return getContextNode(node.parent.parent); - case 275 /* ImportSpecifier */: + case 276 /* ImportSpecifier */: return node.parent.parent.parent; - case 280 /* ExportSpecifier */: - case 273 /* NamespaceImport */: + case 281 /* ExportSpecifier */: + case 274 /* NamespaceImport */: return node.parent.parent; - case 272 /* ImportClause */: - case 279 /* NamespaceExport */: + case 273 /* ImportClause */: + case 280 /* NamespaceExport */: return node.parent; - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: return isExpressionStatement(node.parent) ? node.parent : node; - case 249 /* ForOfStatement */: - case 248 /* ForInStatement */: + case 250 /* ForOfStatement */: + case 249 /* ForInStatement */: return { start: node.initializer, end: node.expression }; - case 302 /* PropertyAssignment */: - case 303 /* ShorthandPropertyAssignment */: + case 303 /* PropertyAssignment */: + case 304 /* ShorthandPropertyAssignment */: return isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent) ? getContextNode( findAncestor( node.parent, @@ -159410,7 +161695,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const node = getTouchingPropertyName(sourceFile, position); let referenceEntries; const entries = getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position); - if (node.parent.kind === 210 /* PropertyAccessExpression */ || node.parent.kind === 207 /* BindingElement */ || node.parent.kind === 211 /* ElementAccessExpression */ || node.kind === 108 /* SuperKeyword */) { + if (node.parent.kind === 211 /* PropertyAccessExpression */ || node.parent.kind === 208 /* BindingElement */ || node.parent.kind === 212 /* ElementAccessExpression */ || node.kind === 108 /* SuperKeyword */) { referenceEntries = entries && [...entries]; } else if (entries) { const queue = createQueue(entries); @@ -159431,11 +161716,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return map(referenceEntries, (entry) => toImplementationLocation(entry, checker)); } function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position) { - if (node.kind === 311 /* SourceFile */) { + if (node.kind === 312 /* SourceFile */) { return void 0; } const checker = program.getTypeChecker(); - if (node.parent.kind === 303 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 304 /* ShorthandPropertyAssignment */) { const result = []; Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, (node2) => result.push(nodeEntry(node2))); return result; @@ -159630,12 +161915,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const symbol = checker.getSymbolAtLocation(isDeclaration(node) && node.name ? node.name : node); if (symbol) { return getDefinitionKindAndDisplayParts(symbol, checker, node); - } else if (node.kind === 209 /* ObjectLiteralExpression */) { + } else if (node.kind === 210 /* ObjectLiteralExpression */) { return { kind: "interface" /* interfaceElement */, displayParts: [punctuationPart(21 /* OpenParenToken */), textPart("object literal"), punctuationPart(22 /* CloseParenToken */)] }; - } else if (node.kind === 230 /* ClassExpression */) { + } else if (node.kind === 231 /* ClassExpression */) { return { kind: "local class" /* localClassElement */, displayParts: [punctuationPart(21 /* OpenParenToken */), textPart("anonymous local class"), punctuationPart(22 /* CloseParenToken */)] @@ -159690,49 +161975,49 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return !!(source && ((_a = target.declarations) == null ? void 0 : _a.some((d) => d === source || d === commonjsSource))); } function declarationIsWriteAccess(decl) { - if (!!(decl.flags & 16777216 /* Ambient */)) + if (!!(decl.flags & 33554432 /* Ambient */)) return true; switch (decl.kind) { - case 225 /* BinaryExpression */: - case 207 /* BindingElement */: - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: + case 226 /* BinaryExpression */: + case 208 /* BindingElement */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: case 90 /* DefaultKeyword */: - case 265 /* EnumDeclaration */: - case 305 /* EnumMember */: - case 280 /* ExportSpecifier */: - case 272 /* ImportClause */: - case 270 /* ImportEqualsDeclaration */: - case 275 /* ImportSpecifier */: - case 263 /* InterfaceDeclaration */: - case 344 /* JSDocCallbackTag */: - case 352 /* JSDocTypedefTag */: - case 290 /* JsxAttribute */: - case 266 /* ModuleDeclaration */: - case 269 /* NamespaceExportDeclaration */: - case 273 /* NamespaceImport */: - case 279 /* NamespaceExport */: - case 168 /* Parameter */: - case 303 /* ShorthandPropertyAssignment */: - case 264 /* TypeAliasDeclaration */: - case 167 /* TypeParameter */: + case 266 /* EnumDeclaration */: + case 306 /* EnumMember */: + case 281 /* ExportSpecifier */: + case 273 /* ImportClause */: + case 271 /* ImportEqualsDeclaration */: + case 276 /* ImportSpecifier */: + case 264 /* InterfaceDeclaration */: + case 345 /* JSDocCallbackTag */: + case 353 /* JSDocTypedefTag */: + case 291 /* JsxAttribute */: + case 267 /* ModuleDeclaration */: + case 270 /* NamespaceExportDeclaration */: + case 274 /* NamespaceImport */: + case 280 /* NamespaceExport */: + case 169 /* Parameter */: + case 304 /* ShorthandPropertyAssignment */: + case 265 /* TypeAliasDeclaration */: + case 168 /* TypeParameter */: return true; - case 302 /* PropertyAssignment */: + case 303 /* PropertyAssignment */: return !isArrayLiteralOrObjectLiteralDestructuringPattern(decl.parent); - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 175 /* Constructor */: - case 173 /* MethodDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 176 /* Constructor */: + case 174 /* MethodDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: return !!decl.body; - case 259 /* VariableDeclaration */: - case 171 /* PropertyDeclaration */: + case 260 /* VariableDeclaration */: + case 172 /* PropertyDeclaration */: return !!decl.initializer || isCatchClause(decl.parent); - case 172 /* MethodSignature */: - case 170 /* PropertySignature */: - case 354 /* JSDocPropertyTag */: - case 347 /* JSDocParameterTag */: + case 173 /* MethodSignature */: + case 171 /* PropertySignature */: + case 355 /* JSDocPropertyTag */: + case 348 /* JSDocParameterTag */: return false; default: return Debug.failBadSyntaxKind(decl); @@ -159985,9 +162270,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (symbol.declarations) { for (const decl of symbol.declarations) { switch (decl.kind) { - case 311 /* SourceFile */: + case 312 /* SourceFile */: break; - case 266 /* ModuleDeclaration */: + case 267 /* ModuleDeclaration */: if (sourceFilesSet.has(decl.getSourceFile().fileName)) { references.push(nodeEntry(decl.name)); } @@ -160111,7 +162396,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function getSpecialSearchKind(node) { switch (node.kind) { - case 175 /* Constructor */: + case 176 /* Constructor */: case 137 /* ConstructorKeyword */: return 1 /* Constructor */; case 80 /* Identifier */: @@ -160320,7 +162605,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function getSymbolScope(symbol) { const { declarations, flags, parent: parent2, valueDeclaration } = symbol; - if (valueDeclaration && (valueDeclaration.kind === 217 /* FunctionExpression */ || valueDeclaration.kind === 230 /* ClassExpression */)) { + if (valueDeclaration && (valueDeclaration.kind === 218 /* FunctionExpression */ || valueDeclaration.kind === 231 /* ClassExpression */)) { return valueDeclaration; } if (!declarations) { @@ -160329,7 +162614,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (flags & (4 /* Property */ | 8192 /* Method */)) { const privateDeclaration = find(declarations, (d) => hasEffectiveModifier(d, 8 /* Private */) || isPrivateIdentifierClassElementDeclaration(d)); if (privateDeclaration) { - return getAncestor(privateDeclaration, 262 /* ClassDeclaration */); + return getAncestor(privateDeclaration, 263 /* ClassDeclaration */); } return void 0; } @@ -160346,7 +162631,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (scope && scope !== container) { return void 0; } - if (!container || container.kind === 311 /* SourceFile */ && !isExternalOrCommonJsModule(container)) { + if (!container || container.kind === 312 /* SourceFile */ && !isExternalOrCommonJsModule(container)) { return void 0; } scope = container; @@ -160424,7 +162709,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } Core2.someSignatureUsage = someSignatureUsage; function getPossibleSymbolReferenceNodes(sourceFile, symbolName2, container = sourceFile) { - return getPossibleSymbolReferencePositions(sourceFile, symbolName2, container).map((pos) => getTouchingPropertyName(sourceFile, pos)); + return mapDefined(getPossibleSymbolReferencePositions(sourceFile, symbolName2, container), (pos) => { + const referenceLocation = getTouchingPropertyName(sourceFile, pos); + return referenceLocation === sourceFile ? void 0 : referenceLocation; + }); } function getPossibleSymbolReferencePositions(sourceFile, symbolName2, container = sourceFile) { const positions = []; @@ -160693,14 +162981,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (constructorSymbol && constructorSymbol.declarations) { for (const decl of constructorSymbol.declarations) { const ctrKeyword = findChildOfKind(decl, 137 /* ConstructorKeyword */, sourceFile); - Debug.assert(decl.kind === 175 /* Constructor */ && !!ctrKeyword); + Debug.assert(decl.kind === 176 /* Constructor */ && !!ctrKeyword); addNode(ctrKeyword); } } if (classSymbol.exports) { classSymbol.exports.forEach((member) => { const decl = member.valueDeclaration; - if (decl && decl.kind === 173 /* MethodDeclaration */) { + if (decl && decl.kind === 174 /* MethodDeclaration */) { const body = decl.body; if (body) { forEachDescendantOfKind(body, 110 /* ThisKeyword */, (thisKeyword) => { @@ -160722,7 +163010,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return; } for (const decl of constructor.declarations) { - Debug.assert(decl.kind === 175 /* Constructor */); + Debug.assert(decl.kind === 176 /* Constructor */); const body = decl.body; if (body) { forEachDescendantOfKind(body, 108 /* SuperKeyword */, (node) => { @@ -160757,12 +163045,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (refNode.kind !== 80 /* Identifier */) { return; } - if (refNode.parent.kind === 303 /* ShorthandPropertyAssignment */) { + if (refNode.parent.kind === 304 /* ShorthandPropertyAssignment */) { getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference2); } - const containingClass = getContainingClassIfInHeritageClause(refNode); - if (containingClass) { - addReference2(containingClass); + const containingNode = getContainingNodeIfInHeritageClause(refNode); + if (containingNode) { + addReference2(containingNode); return; } const typeNode = findAncestor(refNode, (a) => !isQualifiedName(a.parent) && !isTypeNode(a.parent) && !isTypeElement(a.parent)); @@ -160772,7 +163060,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} addIfImplementation(typeHavingNode.initializer); } else if (isFunctionLike(typeHavingNode) && typeHavingNode.body) { const body = typeHavingNode.body; - if (body.kind === 240 /* Block */) { + if (body.kind === 241 /* Block */) { forEachReturnStatement(body, (returnStatement) => { if (returnStatement.expression) addIfImplementation(returnStatement.expression); @@ -160789,18 +163077,18 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} addReference2(e); } } - function getContainingClassIfInHeritageClause(node) { - return isIdentifier(node) || isPropertyAccessExpression(node) ? getContainingClassIfInHeritageClause(node.parent) : isExpressionWithTypeArguments(node) ? tryCast(node.parent.parent, isClassLike) : void 0; + function getContainingNodeIfInHeritageClause(node) { + return isIdentifier(node) || isPropertyAccessExpression(node) ? getContainingNodeIfInHeritageClause(node.parent) : isExpressionWithTypeArguments(node) ? tryCast(node.parent.parent, or(isClassLike, isInterfaceDeclaration)) : void 0; } function isImplementationExpression(node) { switch (node.kind) { - case 216 /* ParenthesizedExpression */: + case 217 /* ParenthesizedExpression */: return isImplementationExpression(node.expression); - case 218 /* ArrowFunction */: - case 217 /* FunctionExpression */: - case 209 /* ObjectLiteralExpression */: - case 230 /* ClassExpression */: - case 208 /* ArrayLiteralExpression */: + case 219 /* ArrowFunction */: + case 218 /* FunctionExpression */: + case 210 /* ObjectLiteralExpression */: + case 231 /* ClassExpression */: + case 209 /* ArrayLiteralExpression */: return true; default: return false; @@ -160834,13 +163122,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } let staticFlag = 32 /* Static */; switch (searchSpaceNode.kind) { - case 171 /* PropertyDeclaration */: - case 170 /* PropertySignature */: - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: - case 175 /* Constructor */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 172 /* PropertyDeclaration */: + case 171 /* PropertySignature */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: + case 176 /* Constructor */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: staticFlag &= getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; break; @@ -160862,7 +163150,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return [{ definition: { type: 0 /* Symbol */, symbol: searchSpaceNode.symbol }, references }]; } function isParameterName(node) { - return node.kind === 80 /* Identifier */ && node.parent.kind === 168 /* Parameter */ && node.parent.name === node; + return node.kind === 80 /* Identifier */ && node.parent.kind === 169 /* Parameter */ && node.parent.name === node; } function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles, cancellationToken) { let searchSpaceNode = getThisContainer( @@ -160874,32 +163162,32 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ); let staticFlag = 32 /* Static */; switch (searchSpaceNode.kind) { - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: if (isObjectLiteralMethod(searchSpaceNode)) { staticFlag &= getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; break; } - case 171 /* PropertyDeclaration */: - case 170 /* PropertySignature */: - case 175 /* Constructor */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 172 /* PropertyDeclaration */: + case 171 /* PropertySignature */: + case 176 /* Constructor */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: staticFlag &= getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; break; - case 311 /* SourceFile */: + case 312 /* SourceFile */: if (isExternalModule(searchSpaceNode) || isParameterName(thisOrSuperKeyword)) { return void 0; } - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: break; default: return void 0; } - const references = flatMap(searchSpaceNode.kind === 311 /* SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], (sourceFile) => { + const references = flatMap(searchSpaceNode.kind === 312 /* SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], (sourceFile) => { cancellationToken.throwIfCancellationRequested(); return getPossibleSymbolReferenceNodes(sourceFile, "this", isSourceFile(searchSpaceNode) ? sourceFile : searchSpaceNode).filter((node) => { if (!isThis(node)) { @@ -160915,18 +163203,18 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (!canHaveSymbol(container)) return false; switch (searchSpaceNode.kind) { - case 217 /* FunctionExpression */: - case 261 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 262 /* FunctionDeclaration */: return searchSpaceNode.symbol === container.symbol; - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: return isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol; - case 230 /* ClassExpression */: - case 262 /* ClassDeclaration */: - case 209 /* ObjectLiteralExpression */: + case 231 /* ClassExpression */: + case 263 /* ClassDeclaration */: + case 210 /* ObjectLiteralExpression */: return container.parent && canHaveSymbol(container.parent) && searchSpaceNode.symbol === container.parent.symbol && isStatic(container) === !!staticFlag; - case 311 /* SourceFile */: - return container.kind === 311 /* SourceFile */ && !isExternalModule(container) && !isParameterName(node); + case 312 /* SourceFile */: + return container.kind === 312 /* SourceFile */ && !isExternalModule(container) && !isParameterName(node); } }); }).map((n) => nodeEntry(n)); @@ -161050,7 +163338,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} Debug.assert(paramProps.length === 2 && !!(paramProps[0].flags & 1 /* FunctionScopedVariable */) && !!(paramProps[1].flags & 4 /* Property */)); return fromRoot(symbol.flags & 1 /* FunctionScopedVariable */ ? paramProps[1] : paramProps[0]); } - const exportSpecifier = getDeclarationOfKind(symbol, 280 /* ExportSpecifier */); + const exportSpecifier = getDeclarationOfKind(symbol, 281 /* ExportSpecifier */); if (!isForRenamePopulateSearchSymbolSet || exportSpecifier && !exportSpecifier.propertyName) { const localSymbol = exportSpecifier && checker.getExportSpecifierLocalTargetSymbol(exportSpecifier); if (localSymbol) { @@ -161091,7 +163379,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ) || (rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */) && allowBaseTypes(rootSymbol) ? getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.name, checker, (base) => cbSymbol(sym, rootSymbol, base, kind)) : void 0)); } function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol2, checker2) { - const bindingElement = getDeclarationOfKind(symbol2, 207 /* BindingElement */); + const bindingElement = getDeclarationOfKind(symbol2, 208 /* BindingElement */); if (bindingElement && isObjectBindingElementWithoutPropertyName(bindingElement)) { return getPropertySymbolFromBindingElement(checker2, bindingElement); } @@ -161157,7 +163445,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } Core2.getIntersectingMeaningFromDeclarations = getIntersectingMeaningFromDeclarations; function isImplementation(node) { - return !!(node.flags & 16777216 /* Ambient */) ? !(isInterfaceDeclaration(node) || isTypeAliasDeclaration(node)) : isVariableLike(node) ? hasInitializer(node) : isFunctionLikeDeclaration(node) ? !!node.body : isClassLike(node) || isModuleOrEnumDeclaration(node); + return !!(node.flags & 33554432 /* Ambient */) ? !(isInterfaceDeclaration(node) || isTypeAliasDeclaration(node)) : isVariableLike(node) ? hasInitializer(node) : isFunctionLikeDeclaration(node) ? !!node.body : isClassLike(node) || isModuleOrEnumDeclaration(node); } function getReferenceEntriesForShorthandPropertyAssignment(node, checker, addReference2) { const refSymbol = checker.getSymbolAtLocation(node); @@ -161216,6 +163504,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} getTextSpanOfEntry: () => getTextSpanOfEntry, isContextWithStartAndEndNode: () => isContextWithStartAndEndNode, isDeclarationOfSymbol: () => isDeclarationOfSymbol, + isWriteAccessForReference: () => isWriteAccessForReference, nodeEntry: () => nodeEntry, toContextSpan: () => toContextSpan, toHighlightSpan: () => toHighlightSpan, @@ -161244,7 +163533,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } const { parent: parent2 } = node; const typeChecker = program.getTypeChecker(); - if (node.kind === 163 /* OverrideKeyword */ || isIdentifier(node) && isJSDocOverrideTag(parent2) && parent2.tagName === node) { + if (node.kind === 164 /* OverrideKeyword */ || isIdentifier(node) && isJSDocOverrideTag(parent2) && parent2.tagName === node) { return getDefinitionFromOverriddenMember(typeChecker, node) || emptyArray; } if (isJumpStatementTarget(node)) { @@ -161335,7 +163624,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return node.kind === 108 /* SuperKeyword */ ? [sigInfo, ...defs] : [...defs, sigInfo]; } } - if (node.parent.kind === 303 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 304 /* ShorthandPropertyAssignment */) { const shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); const definitions = (shorthandSymbol == null ? void 0 : shorthandSymbol.declarations) ? shorthandSymbol.declarations.map((decl) => createDefinitionInfo( decl, @@ -161436,6 +163725,55 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return void 0; } + function shouldUnwrapFirstTypeArgumentTypeDefinitionFromTypeReference(typeChecker, type) { + const referenceName = type.symbol.name; + if (!typesWithUnwrappedTypeArguments.has(referenceName)) { + return false; + } + const globalType = typeChecker.resolveName( + referenceName, + /*location*/ + void 0, + 788968 /* Type */, + /*excludeGlobals*/ + false + ); + return !!globalType && globalType === type.target.symbol; + } + function shouldUnwrapFirstTypeArgumentTypeDefinitionFromAlias(typeChecker, type) { + if (!type.aliasSymbol) { + return false; + } + const referenceName = type.aliasSymbol.name; + if (!typesWithUnwrappedTypeArguments.has(referenceName)) { + return false; + } + const globalType = typeChecker.resolveName( + referenceName, + /*location*/ + void 0, + 788968 /* Type */, + /*excludeGlobals*/ + false + ); + return !!globalType && globalType === type.aliasSymbol; + } + function getFirstTypeArgumentDefinitions(typeChecker, type, node, failedAliasResolution) { + var _a, _b; + if (!!(getObjectFlags(type) & 4 /* Reference */) && shouldUnwrapFirstTypeArgumentTypeDefinitionFromTypeReference(typeChecker, type)) { + return definitionFromType(typeChecker.getTypeArguments(type)[0], typeChecker, node, failedAliasResolution); + } + if (shouldUnwrapFirstTypeArgumentTypeDefinitionFromAlias(typeChecker, type) && type.aliasTypeArguments) { + return definitionFromType(type.aliasTypeArguments[0], typeChecker, node, failedAliasResolution); + } + if (getObjectFlags(type) & 32 /* Mapped */ && type.target && shouldUnwrapFirstTypeArgumentTypeDefinitionFromAlias(typeChecker, type.target)) { + const declaration = (_b = (_a = type.aliasSymbol) == null ? void 0 : _a.declarations) == null ? void 0 : _b[0]; + if (declaration && isTypeAliasDeclaration(declaration) && isTypeReferenceNode(declaration.type) && declaration.type.typeArguments) { + return definitionFromType(typeChecker.getTypeAtLocation(declaration.type.typeArguments[0]), typeChecker, node, failedAliasResolution); + } + } + return []; + } function getTypeDefinitionAtPosition(typeChecker, sourceFile, position) { const node = getTouchingPropertyName(sourceFile, position); if (node === sourceFile) { @@ -161461,8 +163799,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node); const returnType = tryGetReturnTypeOfFunction(symbol, typeAtLocation, typeChecker); const fromReturnType = returnType && definitionFromType(returnType, typeChecker, node, failedAliasResolution); - const typeDefinitions = fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node, failedAliasResolution); - return typeDefinitions.length ? typeDefinitions : !(symbol.flags & 111551 /* Value */) && symbol.flags & 788968 /* Type */ ? getDefinitionFromSymbol(typeChecker, skipAlias(symbol, typeChecker), node, failedAliasResolution) : void 0; + const [resolvedType, typeDefinitions] = fromReturnType && fromReturnType.length !== 0 ? [returnType, fromReturnType] : [typeAtLocation, definitionFromType(typeAtLocation, typeChecker, node, failedAliasResolution)]; + return typeDefinitions.length ? [...getFirstTypeArgumentDefinitions(typeChecker, resolvedType, node, failedAliasResolution), ...typeDefinitions] : !(symbol.flags & 111551 /* Value */) && symbol.flags & 788968 /* Type */ ? getDefinitionFromSymbol(typeChecker, skipAlias(symbol, typeChecker), node, failedAliasResolution) : void 0; } function definitionFromType(type, checker, node, failedAliasResolution) { return flatMap(type.isUnion() && !(type.flags & 32 /* Enum */) ? type.types : [type], (t) => t.symbol && getDefinitionFromSymbol(checker, t.symbol, node, failedAliasResolution)); @@ -161512,7 +163850,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (node.parent === declaration) { return true; } - if (declaration.kind === 273 /* NamespaceImport */) { + if (declaration.kind === 274 /* NamespaceImport */) { return false; } return true; @@ -161602,7 +163940,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ts_FindAllReferences_exports.getContextNode(declaration) ), isLocal: !isDefinitionVisible(checker, declaration), - isAmbient: !!(declaration.flags & 16777216 /* Ambient */), + isAmbient: !!(declaration.flags & 33554432 /* Ambient */), unverified, failedAliasResolution }; @@ -161615,19 +163953,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (hasInitializer(declaration.parent) && declaration.parent.initializer === declaration) return isDefinitionVisible(checker, declaration.parent); switch (declaration.kind) { - case 171 /* PropertyDeclaration */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 173 /* MethodDeclaration */: + case 172 /* PropertyDeclaration */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 174 /* MethodDeclaration */: if (hasEffectiveModifier(declaration, 8 /* Private */)) return false; - case 175 /* Constructor */: - case 302 /* PropertyAssignment */: - case 303 /* ShorthandPropertyAssignment */: - case 209 /* ObjectLiteralExpression */: - case 230 /* ClassExpression */: - case 218 /* ArrowFunction */: - case 217 /* FunctionExpression */: + case 176 /* Constructor */: + case 303 /* PropertyAssignment */: + case 304 /* ShorthandPropertyAssignment */: + case 210 /* ObjectLiteralExpression */: + case 231 /* ClassExpression */: + case 219 /* ArrowFunction */: + case 218 /* FunctionExpression */: return isDefinitionVisible(checker, declaration.parent); default: return false; @@ -161671,18 +164009,40 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function isConstructorLike(node) { switch (node.kind) { - case 175 /* Constructor */: - case 184 /* ConstructorType */: - case 179 /* ConstructSignature */: + case 176 /* Constructor */: + case 185 /* ConstructorType */: + case 180 /* ConstructSignature */: return true; default: return false; } } + var typesWithUnwrappedTypeArguments; var init_goToDefinition = __esm({ "src/services/goToDefinition.ts"() { "use strict"; init_ts4(); + typesWithUnwrappedTypeArguments = /* @__PURE__ */ new Set([ + "Array", + "ArrayLike", + "ReadonlyArray", + "Promise", + "PromiseLike", + "Iterable", + "IterableIterator", + "AsyncIterable", + "Set", + "WeakSet", + "ReadonlySet", + "Map", + "WeakMap", + "ReadonlyMap", + "Partial", + "Required", + "Readonly", + "Pick", + "Omit" + ]); } }); @@ -161710,6 +164070,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function shouldShowLiteralParameterNameHintsOnly(preferences) { return preferences.includeInlayParameterNameHints === "literals"; } + function shouldUseInteractiveInlayHints(preferences) { + return preferences.interactiveInlayHints === true; + } function provideInlayHints(context) { const { file, program, span, cancellationToken, preferences } = context; const sourceFileText = file.text; @@ -161723,14 +164086,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return; } switch (node.kind) { - case 266 /* ModuleDeclaration */: - case 262 /* ClassDeclaration */: - case 263 /* InterfaceDeclaration */: - case 261 /* FunctionDeclaration */: - case 230 /* ClassExpression */: - case 217 /* FunctionExpression */: - case 173 /* MethodDeclaration */: - case 218 /* ArrowFunction */: + case 267 /* ModuleDeclaration */: + case 263 /* ClassDeclaration */: + case 264 /* InterfaceDeclaration */: + case 262 /* FunctionDeclaration */: + case 231 /* ClassExpression */: + case 218 /* FunctionExpression */: + case 174 /* MethodDeclaration */: + case 219 /* ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } if (!textSpanIntersectsWith(span, node.pos, node.getFullWidth())) { @@ -161760,17 +164123,26 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function isSignatureSupportingReturnAnnotation(node) { return isArrowFunction(node) || isFunctionExpression(node) || isFunctionDeclaration(node) || isMethodDeclaration(node) || isGetAccessorDeclaration(node); } - function addParameterHints(text, position, isFirstVariadicArgument) { + function addParameterHints(text, parameter, position, isFirstVariadicArgument) { + let hintText = `${isFirstVariadicArgument ? "..." : ""}${text}`; + let displayParts; + if (shouldUseInteractiveInlayHints(preferences)) { + displayParts = [getNodeDisplayPart(hintText, parameter), { text: ":" }]; + hintText = ""; + } else { + hintText += ":"; + } result.push({ - text: `${isFirstVariadicArgument ? "..." : ""}${truncation(text, maxHintsLength)}:`, + text: hintText, position, kind: "Parameter" /* Parameter */, - whitespaceAfter: true + whitespaceAfter: true, + displayParts }); } function addTypeHints(text, position) { result.push({ - text: `: ${truncation(text, maxHintsLength)}`, + text: `: ${text.length > maxTypeHintLength ? text.substr(0, maxTypeHintLength - "...".length) + "..." : text}`, position, kind: "Type" /* Type */, whitespaceBefore: true @@ -161778,7 +164150,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function addEnumMemberValueHints(text, position) { result.push({ - text: `= ${truncation(text, maxHintsLength)}`, + text: `= ${text}`, position, kind: "Enum" /* Enum */, whitespaceBefore: true @@ -161827,15 +164199,31 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (!signature || !candidates.length) { return; } - for (let i = 0; i < args.length; ++i) { - const originalArg = args[i]; + let signatureParamPos = 0; + for (const originalArg of args) { const arg = skipParentheses(originalArg); if (shouldShowLiteralParameterNameHintsOnly(preferences) && !isHintableLiteral(arg)) { continue; } - const identifierNameInfo = checker.getParameterIdentifierNameAtPosition(signature, i); - if (identifierNameInfo) { - const [parameterName, isFirstVariadicArgument] = identifierNameInfo; + let spreadArgs = 0; + if (isSpreadElement(arg)) { + const spreadType = checker.getTypeAtLocation(arg.expression); + if (checker.isTupleType(spreadType)) { + const { elementFlags, fixedLength } = spreadType.target; + if (fixedLength === 0) { + continue; + } + const firstOptionalIndex = findIndex(elementFlags, (f) => !(f & 1 /* Required */)); + const requiredArgs = firstOptionalIndex < 0 ? fixedLength : firstOptionalIndex; + if (requiredArgs > 0) { + spreadArgs = firstOptionalIndex < 0 ? fixedLength : firstOptionalIndex; + } + } + } + const identifierInfo = checker.getParameterIdentifierInfoAtPosition(signature, signatureParamPos); + signatureParamPos = signatureParamPos + (spreadArgs || 1); + if (identifierInfo) { + const { parameter, parameterName, isRestParameter: isFirstVariadicArgument } = identifierInfo; const isParameterNameNotSameAsArgument = preferences.includeInlayParameterNameHintsWhenArgumentMatchesName || !identifierOrAccessExpressionPostfixMatchesParameterName(arg, parameterName); if (!isParameterNameNotSameAsArgument && !isFirstVariadicArgument) { continue; @@ -161844,7 +164232,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (leadingCommentsContainsParameterName(arg, name)) { continue; } - addParameterHints(name, originalArg.getStart(), isFirstVariadicArgument); + addParameterHints(name, parameter, originalArg.getStart(), isFirstVariadicArgument); } } } @@ -161870,7 +164258,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function isHintableLiteral(node) { switch (node.kind) { - case 223 /* PrefixUnaryExpression */: { + case 224 /* PrefixUnaryExpression */: { const operand = node.operand; return isLiteralExpression(operand) || isIdentifier(operand) && isInfinityOrNaNString(operand.escapedText); } @@ -161878,7 +164266,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} case 97 /* FalseKeyword */: case 106 /* NullKeyword */: case 15 /* NoSubstitutionTemplateLiteral */: - case 227 /* TemplateExpression */: + case 228 /* TemplateExpression */: return true; case 80 /* Identifier */: { const name = node.escapedText; @@ -161950,12 +164338,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return printTypeInSingleLine(signatureParamType); } - function truncation(text, maxLength2) { - if (text.length > maxLength2) { - return text.substr(0, maxLength2 - "...".length) + "..."; - } - return text; - } function printTypeInSingleLine(type) { const flags = 70221824 /* IgnoreErrors */ | 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */; const printer = createPrinterWithRemoveComments(); @@ -161986,13 +164368,21 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return true; } + function getNodeDisplayPart(text, node) { + const sourceFile = node.getSourceFile(); + return { + text, + span: createTextSpanFromNode(node, sourceFile), + file: sourceFile.fileName + }; + } } - var maxHintsLength, leadingParameterNameCommentRegexFactory; + var maxTypeHintLength, leadingParameterNameCommentRegexFactory; var init_inlayHints = __esm({ "src/services/inlayHints.ts"() { "use strict"; init_ts4(); - maxHintsLength = 30; + maxTypeHintLength = 30; leadingParameterNameCommentRegexFactory = (name) => { return new RegExp(`^\\s?/\\*\\*?\\s?${name}\\s?\\*\\/\\s?$`); }; @@ -162016,8 +164406,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const parts = []; forEachUnique(declarations, (declaration) => { for (const jsdoc of getCommentHavingNodes(declaration)) { - const inheritDoc = isJSDoc(jsdoc) && jsdoc.tags && find(jsdoc.tags, (t) => t.kind === 333 /* JSDocTag */ && (t.tagName.escapedText === "inheritDoc" || t.tagName.escapedText === "inheritdoc")); - if (jsdoc.comment === void 0 && !inheritDoc || isJSDoc(jsdoc) && declaration.kind !== 352 /* JSDocTypedefTag */ && declaration.kind !== 344 /* JSDocCallbackTag */ && jsdoc.tags && jsdoc.tags.some((t) => t.kind === 352 /* JSDocTypedefTag */ || t.kind === 344 /* JSDocCallbackTag */) && !jsdoc.tags.some((t) => t.kind === 347 /* JSDocParameterTag */ || t.kind === 348 /* JSDocReturnTag */)) { + const inheritDoc = isJSDoc(jsdoc) && jsdoc.tags && find(jsdoc.tags, (t) => t.kind === 334 /* JSDocTag */ && (t.tagName.escapedText === "inheritDoc" || t.tagName.escapedText === "inheritdoc")); + if (jsdoc.comment === void 0 && !inheritDoc || isJSDoc(jsdoc) && declaration.kind !== 353 /* JSDocTypedefTag */ && declaration.kind !== 345 /* JSDocCallbackTag */ && jsdoc.tags && jsdoc.tags.some((t) => t.kind === 353 /* JSDocTypedefTag */ || t.kind === 345 /* JSDocCallbackTag */) && !jsdoc.tags.some((t) => t.kind === 348 /* JSDocParameterTag */ || t.kind === 349 /* JSDocReturnTag */)) { continue; } let newparts = jsdoc.comment ? getDisplayPartsFromComment(jsdoc.comment, checker) : []; @@ -162036,11 +164426,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function getCommentHavingNodes(declaration) { switch (declaration.kind) { - case 347 /* JSDocParameterTag */: - case 354 /* JSDocPropertyTag */: + case 348 /* JSDocParameterTag */: + case 355 /* JSDocPropertyTag */: return [declaration]; - case 344 /* JSDocCallbackTag */: - case 352 /* JSDocTypedefTag */: + case 345 /* JSDocCallbackTag */: + case 353 /* JSDocTypedefTag */: return [declaration, declaration.parent]; default: return getJSDocCommentsAndTags(declaration); @@ -162050,7 +164440,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const infos = []; forEachUnique(declarations, (declaration) => { const tags = getJSDocTags(declaration); - if (tags.some((t) => t.kind === 352 /* JSDocTypedefTag */ || t.kind === 344 /* JSDocCallbackTag */) && !tags.some((t) => t.kind === 347 /* JSDocParameterTag */ || t.kind === 348 /* JSDocReturnTag */)) { + if (tags.some((t) => t.kind === 353 /* JSDocTypedefTag */ || t.kind === 345 /* JSDocCallbackTag */) && !tags.some((t) => t.kind === 348 /* JSDocParameterTag */ || t.kind === 349 /* JSDocReturnTag */)) { return; } for (const tag of tags) { @@ -162065,21 +164455,21 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return flatMap( comment, - (node) => node.kind === 327 /* JSDocText */ ? [textPart(node.text)] : buildLinkParts(node, checker) + (node) => node.kind === 328 /* JSDocText */ ? [textPart(node.text)] : buildLinkParts(node, checker) ); } function getCommentDisplayParts(tag, checker) { const { comment, kind } = tag; const namePart = getTagNameDisplayPart(kind); switch (kind) { - case 355 /* JSDocThrowsTag */: + case 356 /* JSDocThrowsTag */: const typeExpression = tag.typeExpression; return typeExpression ? withNode(typeExpression) : comment === void 0 ? void 0 : getDisplayPartsFromComment(comment, checker); - case 335 /* JSDocImplementsTag */: + case 336 /* JSDocImplementsTag */: return withNode(tag.class); - case 334 /* JSDocAugmentsTag */: + case 335 /* JSDocAugmentsTag */: return withNode(tag.class); - case 351 /* JSDocTemplateTag */: + case 352 /* JSDocTemplateTag */: const templateTag = tag; const displayParts = []; if (templateTag.constraint) { @@ -162101,14 +164491,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} displayParts.push(...[spacePart(), ...getDisplayPartsFromComment(comment, checker)]); } return displayParts; - case 350 /* JSDocTypeTag */: - case 356 /* JSDocSatisfiesTag */: + case 351 /* JSDocTypeTag */: + case 357 /* JSDocSatisfiesTag */: return withNode(tag.typeExpression); - case 352 /* JSDocTypedefTag */: - case 344 /* JSDocCallbackTag */: - case 354 /* JSDocPropertyTag */: - case 347 /* JSDocParameterTag */: - case 353 /* JSDocSeeTag */: + case 353 /* JSDocTypedefTag */: + case 345 /* JSDocCallbackTag */: + case 355 /* JSDocPropertyTag */: + case 348 /* JSDocParameterTag */: + case 354 /* JSDocSeeTag */: const { name } = tag; return name ? withNode(name) : comment === void 0 ? void 0 : getDisplayPartsFromComment(comment, checker); default: @@ -162131,14 +164521,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function getTagNameDisplayPart(kind) { switch (kind) { - case 347 /* JSDocParameterTag */: + case 348 /* JSDocParameterTag */: return parameterNamePart; - case 354 /* JSDocPropertyTag */: + case 355 /* JSDocPropertyTag */: return propertyNamePart; - case 351 /* JSDocTemplateTag */: + case 352 /* JSDocTemplateTag */: return typeParameterNamePart; - case 352 /* JSDocTypedefTag */: - case 344 /* JSDocCallbackTag */: + case 353 /* JSDocTypedefTag */: + case 345 /* JSDocCallbackTag */: return typeAliasNamePart; default: return textPart; @@ -162231,7 +164621,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const tags = (parameters ? parameterDocComments(parameters || [], isJavaScriptFile, indentationStr, newLine) : "") + (hasReturn2 ? returnsDocComment(indentationStr, newLine) : ""); const openComment = "/**"; const closeComment = " */"; - const hasTag = (commentOwnerJsDoc || []).some((jsDoc) => !!jsDoc.tags); + const hasTag = length(getJSDocTags(commentOwner)) > 0; if (tags && !hasTag) { const preamble = openComment + newLine + indentationStr + " * "; const endLine = tokenStart === position ? newLine + indentationStr : ""; @@ -162263,46 +164653,46 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function getCommentOwnerInfoWorker(commentOwner, options) { switch (commentOwner.kind) { - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 173 /* MethodDeclaration */: - case 175 /* Constructor */: - case 172 /* MethodSignature */: - case 218 /* ArrowFunction */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 174 /* MethodDeclaration */: + case 176 /* Constructor */: + case 173 /* MethodSignature */: + case 219 /* ArrowFunction */: const host = commentOwner; return { commentOwner, parameters: host.parameters, hasReturn: hasReturn(host, options) }; - case 302 /* PropertyAssignment */: + case 303 /* PropertyAssignment */: return getCommentOwnerInfoWorker(commentOwner.initializer, options); - case 262 /* ClassDeclaration */: - case 263 /* InterfaceDeclaration */: - case 265 /* EnumDeclaration */: - case 305 /* EnumMember */: - case 264 /* TypeAliasDeclaration */: + case 263 /* ClassDeclaration */: + case 264 /* InterfaceDeclaration */: + case 266 /* EnumDeclaration */: + case 306 /* EnumMember */: + case 265 /* TypeAliasDeclaration */: return { commentOwner }; - case 170 /* PropertySignature */: { + case 171 /* PropertySignature */: { const host2 = commentOwner; return host2.type && isFunctionTypeNode(host2.type) ? { commentOwner, parameters: host2.type.parameters, hasReturn: hasReturn(host2.type, options) } : { commentOwner }; } - case 242 /* VariableStatement */: { + case 243 /* VariableStatement */: { const varStatement = commentOwner; const varDeclarations = varStatement.declarationList.declarations; const host2 = varDeclarations.length === 1 && varDeclarations[0].initializer ? getRightHandSideOfAssignment(varDeclarations[0].initializer) : void 0; return host2 ? { commentOwner, parameters: host2.parameters, hasReturn: hasReturn(host2, options) } : { commentOwner }; } - case 311 /* SourceFile */: + case 312 /* SourceFile */: return "quit"; - case 266 /* ModuleDeclaration */: - return commentOwner.parent.kind === 266 /* ModuleDeclaration */ ? void 0 : { commentOwner }; - case 243 /* ExpressionStatement */: + case 267 /* ModuleDeclaration */: + return commentOwner.parent.kind === 267 /* ModuleDeclaration */ ? void 0 : { commentOwner }; + case 244 /* ExpressionStatement */: return getCommentOwnerInfoWorker(commentOwner.expression, options); - case 225 /* BinaryExpression */: { + case 226 /* BinaryExpression */: { const be = commentOwner; if (getAssignmentDeclarationKind(be) === 0 /* None */) { return "quit"; } return isFunctionLike(be.right) ? { commentOwner, parameters: be.right.parameters, hasReturn: hasReturn(be.right, options) } : { commentOwner }; } - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: const init = commentOwner.initializer; if (init && (isFunctionExpression(init) || isArrowFunction(init))) { return { commentOwner, parameters: init.parameters, hasReturn: hasReturn(init, options) }; @@ -162313,14 +164703,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return !!(options == null ? void 0 : options.generateReturnInDocTemplate) && (isFunctionTypeNode(node) || isArrowFunction(node) && isExpression(node.body) || isFunctionLikeDeclaration(node) && node.body && isBlock(node.body) && !!forEachReturnStatement(node.body, (n) => n)); } function getRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 216 /* ParenthesizedExpression */) { + while (rightHandSide.kind === 217 /* ParenthesizedExpression */) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: return rightHandSide; - case 230 /* ClassExpression */: + case 231 /* ClassExpression */: return find(rightHandSide.members, isConstructorDeclaration); } } @@ -162474,7 +164864,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (length(oldImportDecls) === 0) { return; } - suppressLeadingTrivia(oldImportDecls[0]); + setEmitFlags(oldImportDecls[0], 1024 /* NoLeadingComments */); const oldImportGroups = shouldCombine ? group(oldImportDecls, (importDecl) => getExternalModuleName2(importDecl.moduleSpecifier)) : [oldImportDecls]; const sortedImportGroups = shouldSort ? stableSort(oldImportGroups, (group1, group2) => compareModuleSpecifiersWorker(group1[0].moduleSpecifier, group2[0].moduleSpecifier, comparer)) : oldImportGroups; const newImportDecls = flatMap(sortedImportGroups, (importGroup) => getExternalModuleName2(importGroup[0].moduleSpecifier) || importGroup[0].moduleSpecifier === void 0 ? coalesce(importGroup) : importGroup); @@ -162797,11 +165187,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function getModuleSpecifierExpression(declaration) { var _a; switch (declaration.kind) { - case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportEqualsDeclaration */: return (_a = tryCast(declaration.moduleReference, isExternalModuleReference)) == null ? void 0 : _a.expression; - case 271 /* ImportDeclaration */: + case 272 /* ImportDeclaration */: return declaration.moduleSpecifier; - case 242 /* VariableStatement */: + case 243 /* VariableStatement */: return declaration.declarationList.declarations[0].initializer.arguments[0]; } } @@ -162901,19 +165291,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function getImportKindOrder(s1) { var _a; switch (s1.kind) { - case 271 /* ImportDeclaration */: + case 272 /* ImportDeclaration */: if (!s1.importClause) return 0; if (s1.importClause.isTypeOnly) return 1; - if (((_a = s1.importClause.namedBindings) == null ? void 0 : _a.kind) === 273 /* NamespaceImport */) + if (((_a = s1.importClause.namedBindings) == null ? void 0 : _a.kind) === 274 /* NamespaceImport */) return 2; if (s1.importClause.name) return 3; return 4; - case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportEqualsDeclaration */: return 5; - case 242 /* VariableStatement */: + case 243 /* VariableStatement */: return 6; } } @@ -163221,21 +165611,21 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function getOutliningSpanForNode(n, sourceFile) { switch (n.kind) { - case 240 /* Block */: + case 241 /* Block */: if (isFunctionLike(n.parent)) { return functionSpan(n.parent, n, sourceFile); } switch (n.parent.kind) { - case 245 /* DoStatement */: - case 248 /* ForInStatement */: - case 249 /* ForOfStatement */: - case 247 /* ForStatement */: - case 244 /* IfStatement */: - case 246 /* WhileStatement */: - case 253 /* WithStatement */: - case 298 /* CatchClause */: + case 246 /* DoStatement */: + case 249 /* ForInStatement */: + case 250 /* ForOfStatement */: + case 248 /* ForStatement */: + case 245 /* IfStatement */: + case 247 /* WhileStatement */: + case 254 /* WithStatement */: + case 299 /* CatchClause */: return spanForNode(n.parent); - case 257 /* TryStatement */: + case 258 /* TryStatement */: const tryStatement = n.parent; if (tryStatement.tryBlock === n) { return spanForNode(n.parent); @@ -163247,17 +165637,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} default: return createOutliningSpan(createTextSpanFromNode(n, sourceFile), "code" /* Code */); } - case 267 /* ModuleBlock */: + case 268 /* ModuleBlock */: return spanForNode(n.parent); - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: - case 263 /* InterfaceDeclaration */: - case 265 /* EnumDeclaration */: - case 268 /* CaseBlock */: - case 186 /* TypeLiteral */: - case 205 /* ObjectBindingPattern */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: + case 264 /* InterfaceDeclaration */: + case 266 /* EnumDeclaration */: + case 269 /* CaseBlock */: + case 187 /* TypeLiteral */: + case 206 /* ObjectBindingPattern */: return spanForNode(n); - case 188 /* TupleType */: + case 189 /* TupleType */: return spanForNode( n, /*autoCollapse*/ @@ -163266,24 +165656,24 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} !isTupleTypeNode(n.parent), 23 /* OpenBracketToken */ ); - case 295 /* CaseClause */: - case 296 /* DefaultClause */: + case 296 /* CaseClause */: + case 297 /* DefaultClause */: return spanForNodeArray(n.statements); - case 209 /* ObjectLiteralExpression */: + case 210 /* ObjectLiteralExpression */: return spanForObjectOrArrayLiteral(n); - case 208 /* ArrayLiteralExpression */: + case 209 /* ArrayLiteralExpression */: return spanForObjectOrArrayLiteral(n, 23 /* OpenBracketToken */); - case 283 /* JsxElement */: + case 284 /* JsxElement */: return spanForJSXElement(n); - case 287 /* JsxFragment */: + case 288 /* JsxFragment */: return spanForJSXFragment(n); - case 284 /* JsxSelfClosingElement */: - case 285 /* JsxOpeningElement */: + case 285 /* JsxSelfClosingElement */: + case 286 /* JsxOpeningElement */: return spanForJSXAttributes(n.attributes); - case 227 /* TemplateExpression */: + case 228 /* TemplateExpression */: case 15 /* NoSubstitutionTemplateLiteral */: return spanForTemplateLiteral(n); - case 206 /* ArrayBindingPattern */: + case 207 /* ArrayBindingPattern */: return spanForNode( n, /*autoCollapse*/ @@ -163292,15 +165682,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} !isBindingElement(n.parent), 23 /* OpenBracketToken */ ); - case 218 /* ArrowFunction */: + case 219 /* ArrowFunction */: return spanForArrowFunction(n); - case 212 /* CallExpression */: + case 213 /* CallExpression */: return spanForCallExpression(n); - case 216 /* ParenthesizedExpression */: + case 217 /* ParenthesizedExpression */: return spanForParenthesizedExpression(n); - case 274 /* NamedImports */: - case 278 /* NamedExports */: - case 299 /* AssertClause */: + case 275 /* NamedImports */: + case 279 /* NamedExports */: + case 300 /* AssertClause */: return spanForNamedImportsOrExportsOrAssertClause(n); } function spanForNamedImportsOrExportsOrAssertClause(node) { @@ -163421,7 +165811,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} node, sourceFile, /*autoCollapse*/ - node.kind !== 218 /* ArrowFunction */ + node.kind !== 219 /* ArrowFunction */ ); } function spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse = false, useFullStart = true) { @@ -163503,7 +165893,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return getRenameInfoError(wouldRenameNodeModules); } const kind = ts_SymbolDisplay_exports.getSymbolKind(typeChecker, symbol, node); - const specifierName = isImportOrExportSpecifierName(node) || isStringOrNumericLiteralLike(node) && node.parent.kind === 166 /* ComputedPropertyName */ ? stripQuotes(getTextOfIdentifierOrLiteral(node)) : void 0; + const specifierName = isImportOrExportSpecifierName(node) || isStringOrNumericLiteralLike(node) && node.parent.kind === 167 /* ComputedPropertyName */ ? stripQuotes(getTextOfIdentifierOrLiteral(node)) : void 0; const displayName = specifierName || typeChecker.symbolToString(symbol); const fullDisplayName = specifierName || typeChecker.getFullyQualifiedName(symbol); return getRenameInfoSuccess(displayName, fullDisplayName, kind, ts_SymbolDisplay_exports.getSymbolModifiers(typeChecker, symbol), node, sourceFile); @@ -163789,10 +166179,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ); } return void 0; - } else if (isTemplateHead(node) && parent2.parent.kind === 214 /* TaggedTemplateExpression */) { + } else if (isTemplateHead(node) && parent2.parent.kind === 215 /* TaggedTemplateExpression */) { const templateExpression = parent2; const tagExpression = templateExpression.parent; - Debug.assert(templateExpression.kind === 227 /* TemplateExpression */); + Debug.assert(templateExpression.kind === 228 /* TemplateExpression */); const argumentIndex = isInsideTemplateLiteral(node, position, sourceFile) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } else if (isTemplateSpan(parent2) && isTaggedTemplateExpression(parent2.parent.parent)) { @@ -163869,17 +166259,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} function getContextualSignatureLocationInfo(node, sourceFile, position, checker) { const { parent: parent2 } = node; switch (parent2.kind) { - case 216 /* ParenthesizedExpression */: - case 173 /* MethodDeclaration */: - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: + case 217 /* ParenthesizedExpression */: + case 174 /* MethodDeclaration */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: const info = getArgumentOrParameterListInfo(node, position, sourceFile); if (!info) return void 0; const { argumentIndex, argumentCount, argumentsSpan } = info; const contextualType = isMethodDeclaration(parent2) ? checker.getContextualTypeForObjectLiteralElement(parent2) : checker.getContextualType(parent2); return contextualType && { contextualType, argumentIndex, argumentCount, argumentsSpan }; - case 225 /* BinaryExpression */: { + case 226 /* BinaryExpression */: { const highestBinary = getHighestBinary(parent2); const contextualType2 = checker.getContextualType(highestBinary); const argumentIndex2 = node.kind === 21 /* OpenParenToken */ ? 0 : countBinaryExpressionParameters(parent2) - 1; @@ -163953,7 +166343,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const template = taggedTemplate.template; const applicableSpanStart = template.getStart(); let applicableSpanEnd = template.getEnd(); - if (template.kind === 227 /* TemplateExpression */) { + if (template.kind === 228 /* TemplateExpression */) { const lastSpan = last(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = skipTrivia( @@ -164266,7 +166656,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const groupedWithPlusMinusTokens = groupChildren(children, (child) => child === node.readonlyToken || child.kind === 148 /* ReadonlyKeyword */ || child === node.questionToken || child.kind === 58 /* QuestionToken */); const groupedWithBrackets = groupChildren( groupedWithPlusMinusTokens, - ({ kind }) => kind === 23 /* OpenBracketToken */ || kind === 167 /* TypeParameter */ || kind === 24 /* CloseBracketToken */ + ({ kind }) => kind === 23 /* OpenBracketToken */ || kind === 168 /* TypeParameter */ || kind === 24 /* CloseBracketToken */ ); return [ openBraceToken, @@ -164277,7 +166667,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } if (isPropertySignature(node)) { const children = groupChildren(node.getChildren(), (child) => child === node.name || contains(node.modifiers, child)); - const firstJSDocChild = ((_a = children[0]) == null ? void 0 : _a.kind) === 326 /* JSDoc */ ? children[0] : void 0; + const firstJSDocChild = ((_a = children[0]) == null ? void 0 : _a.kind) === 327 /* JSDoc */ ? children[0] : void 0; const withJSDocSeparated = firstJSDocChild ? children.slice(1) : children; const splittedChildren = splitChildren(withJSDocSeparated, ({ kind }) => kind === 59 /* ColonToken */); return firstJSDocChild ? [firstJSDocChild, createSyntaxList2(splittedChildren)] : splittedChildren; @@ -164338,19 +166728,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function isListOpener(token) { const kind = token && token.kind; - return kind === 19 /* OpenBraceToken */ || kind === 23 /* OpenBracketToken */ || kind === 21 /* OpenParenToken */ || kind === 285 /* JsxOpeningElement */; + return kind === 19 /* OpenBraceToken */ || kind === 23 /* OpenBracketToken */ || kind === 21 /* OpenParenToken */ || kind === 286 /* JsxOpeningElement */; } function isListCloser(token) { const kind = token && token.kind; - return kind === 20 /* CloseBraceToken */ || kind === 24 /* CloseBracketToken */ || kind === 22 /* CloseParenToken */ || kind === 286 /* JsxClosingElement */; + return kind === 20 /* CloseBraceToken */ || kind === 24 /* CloseBracketToken */ || kind === 22 /* CloseParenToken */ || kind === 287 /* JsxClosingElement */; } function getEndPos(sourceFile, node) { switch (node.kind) { - case 347 /* JSDocParameterTag */: - case 344 /* JSDocCallbackTag */: - case 354 /* JSDocPropertyTag */: - case 352 /* JSDocTypedefTag */: - case 349 /* JSDocThisTag */: + case 348 /* JSDocParameterTag */: + case 345 /* JSDocCallbackTag */: + case 355 /* JSDocPropertyTag */: + case 353 /* JSDocTypedefTag */: + case 350 /* JSDocThisTag */: return sourceFile.getLineEndOfPosition(node.getStart()); default: return node.getEnd(); @@ -164385,7 +166775,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } const flags = getCombinedLocalAndExportSymbolFlags(symbol); if (flags & 32 /* Class */) { - return getDeclarationOfKind(symbol, 230 /* ClassExpression */) ? "local class" /* localClassElement */ : "class" /* classElement */; + return getDeclarationOfKind(symbol, 231 /* ClassExpression */) ? "local class" /* localClassElement */ : "class" /* classElement */; } if (flags & 384 /* Enum */) return "enum" /* enumElement */; @@ -164423,6 +166813,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return "parameter" /* parameterElement */; } else if (symbol.valueDeclaration && isVarConst(symbol.valueDeclaration)) { return "const" /* constElement */; + } else if (symbol.valueDeclaration && isVarUsing(symbol.valueDeclaration)) { + return "using" /* variableUsingElement */; + } else if (symbol.valueDeclaration && isVarAwaitUsing(symbol.valueDeclaration)) { + return "await using" /* variableAwaitUsingElement */; } else if (forEach(symbol.declarations, isLet)) { return "let" /* letElement */; } @@ -164490,7 +166884,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } return modifiers.size > 0 ? arrayFrom(modifiers.values()).join(",") : "" /* none */; } - function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, enclosingDeclaration, location, semanticMeaning = getMeaningFromLocation(location), alias) { + function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symbol, sourceFile, enclosingDeclaration, location, type, semanticMeaning, alias) { var _a; const displayParts = []; let documentation = []; @@ -164499,7 +166893,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} let symbolKind = semanticMeaning & 1 /* Value */ ? getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location) : "" /* unknown */; let hasAddedSymbolInfo = false; const isThisExpression = location.kind === 110 /* ThisKeyword */ && isInExpressionContext(location) || isThisInTypeQuery(location); - let type; let documentationFromAlias; let tagsFromAlias; let hasMultipleSignatures = false; @@ -164511,13 +166904,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const declaration = find(symbol.declarations, (declaration2) => declaration2.name === location); if (declaration) { switch (declaration.kind) { - case 176 /* GetAccessor */: + case 177 /* GetAccessor */: symbolKind = "getter" /* memberGetAccessorElement */; break; - case 177 /* SetAccessor */: + case 178 /* SetAccessor */: symbolKind = "setter" /* memberSetAccessorElement */; break; - case 171 /* PropertyDeclaration */: + case 172 /* PropertyDeclaration */: symbolKind = "accessor" /* memberAccessorVariableElement */; break; default: @@ -164528,8 +166921,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } } let signature; - type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); - if (location.parent && location.parent.kind === 210 /* PropertyAccessExpression */) { + type ?? (type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location)); + if (location.parent && location.parent.kind === 211 /* PropertyAccessExpression */) { const right = location.parent.name; if (right === location || right && right.getFullWidth() === 0) { location = location.parent; @@ -164545,7 +166938,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } if (callExpressionLike) { signature = typeChecker.getResolvedSignature(callExpressionLike); - const useConstructSignatures = callExpressionLike.kind === 213 /* NewExpression */ || isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 108 /* SuperKeyword */; + const useConstructSignatures = callExpressionLike.kind === 214 /* NewExpression */ || isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 108 /* SuperKeyword */; const allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (signature && !contains(allSignatures, signature.target) && !contains(allSignatures, signature)) { signature = allSignatures.length ? allSignatures[0] : void 0; @@ -164608,21 +167001,21 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} hasMultipleSignatures = allSignatures.length > 1; } } else if (isNameOfFunctionDeclaration(location) && !(symbolFlags & 98304 /* Accessor */) || // name of function declaration - location.kind === 137 /* ConstructorKeyword */ && location.parent.kind === 175 /* Constructor */) { + location.kind === 137 /* ConstructorKeyword */ && location.parent.kind === 176 /* Constructor */) { const functionDeclaration = location.parent; const locationIsSymbolDeclaration = symbol.declarations && find(symbol.declarations, (declaration) => declaration === (location.kind === 137 /* ConstructorKeyword */ ? functionDeclaration.parent : functionDeclaration)); if (locationIsSymbolDeclaration) { - const allSignatures = functionDeclaration.kind === 175 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); + const allSignatures = functionDeclaration.kind === 176 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); } else { signature = allSignatures[0]; } - if (functionDeclaration.kind === 175 /* Constructor */) { + if (functionDeclaration.kind === 176 /* Constructor */) { symbolKind = "constructor" /* constructorImplementationElement */; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 178 /* CallSignature */ && !(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind); + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 179 /* CallSignature */ && !(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind); } if (signature) { addSignatureDisplayParts(signature, allSignatures); @@ -164634,7 +167027,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo && !isThisExpression) { addAliasPrefixIfNecessary(); - if (getDeclarationOfKind(symbol, 230 /* ClassExpression */)) { + if (getDeclarationOfKind(symbol, 231 /* ClassExpression */)) { pushSymbolKind("local class" /* localClassElement */); } else { displayParts.push(keywordPart(86 /* ClassKeyword */)); @@ -164673,7 +167066,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } if (symbolFlags & 1536 /* Module */ && !isThisExpression) { prefixNextMeaning(); - const declaration = getDeclarationOfKind(symbol, 266 /* ModuleDeclaration */); + const declaration = getDeclarationOfKind(symbol, 267 /* ModuleDeclaration */); const isNamespace = declaration && declaration.name && declaration.name.kind === 80 /* Identifier */; displayParts.push(keywordPart(isNamespace ? 145 /* NamespaceKeyword */ : 144 /* ModuleKeyword */)); displayParts.push(spacePart()); @@ -164691,7 +167084,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} addFullSymbolName(symbol.parent, enclosingDeclaration); writeTypeParametersOfSymbol(symbol.parent, enclosingDeclaration); } else { - const decl = getDeclarationOfKind(symbol, 167 /* TypeParameter */); + const decl = getDeclarationOfKind(symbol, 168 /* TypeParameter */); if (decl === void 0) return Debug.fail(); const declaration = decl.parent; @@ -164699,10 +167092,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (isFunctionLike(declaration)) { addInPrefix(); const signature = typeChecker.getSignatureFromDeclaration(declaration); - if (declaration.kind === 179 /* ConstructSignature */) { + if (declaration.kind === 180 /* ConstructSignature */) { displayParts.push(keywordPart(105 /* NewKeyword */)); displayParts.push(spacePart()); - } else if (declaration.kind !== 178 /* CallSignature */ && declaration.name) { + } else if (declaration.kind !== 179 /* CallSignature */ && declaration.name) { addFullSymbolName(declaration.symbol); } addRange(displayParts, signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */)); @@ -164720,7 +167113,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} symbolKind = "enum member" /* enumMemberElement */; addPrefixForAnyFunctionOrVar(symbol, "enum member"); const declaration = (_a = symbol.declarations) == null ? void 0 : _a[0]; - if ((declaration == null ? void 0 : declaration.kind) === 305 /* EnumMember */) { + if ((declaration == null ? void 0 : declaration.kind) === 306 /* EnumMember */) { const constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== void 0) { displayParts.push(spacePart()); @@ -164743,12 +167136,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (declarationName && !hasAddedSymbolInfo) { const isExternalModuleDeclaration = isModuleWithStringLiteralName(resolvedNode) && hasSyntacticModifier(resolvedNode, 2 /* Ambient */); const shouldUseAliasName = symbol.name !== "default" && !isExternalModuleDeclaration; - const resolvedInfo = getSymbolDisplayPartsDocumentationAndSymbolKind( + const resolvedInfo = getSymbolDisplayPartsDocumentationAndSymbolKindWorker( typeChecker, resolvedSymbol, getSourceFileOfNode(resolvedNode), resolvedNode, declarationName, + type, semanticMeaning, shouldUseAliasName ? symbol : resolvedSymbol ); @@ -164764,17 +167158,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } if (symbol.declarations) { switch (symbol.declarations[0].kind) { - case 269 /* NamespaceExportDeclaration */: + case 270 /* NamespaceExportDeclaration */: displayParts.push(keywordPart(95 /* ExportKeyword */)); displayParts.push(spacePart()); displayParts.push(keywordPart(145 /* NamespaceKeyword */)); break; - case 276 /* ExportAssignment */: + case 277 /* ExportAssignment */: displayParts.push(keywordPart(95 /* ExportKeyword */)); displayParts.push(spacePart()); displayParts.push(keywordPart(symbol.declarations[0].isExportEquals ? 64 /* EqualsToken */ : 90 /* DefaultKeyword */)); break; - case 280 /* ExportSpecifier */: + case 281 /* ExportSpecifier */: displayParts.push(keywordPart(95 /* ExportKeyword */)); break; default: @@ -164784,7 +167178,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} displayParts.push(spacePart()); addFullSymbolName(symbol); forEach(symbol.declarations, (declaration) => { - if (declaration.kind === 270 /* ImportEqualsDeclaration */) { + if (declaration.kind === 271 /* ImportEqualsDeclaration */) { const importEqualsDeclaration = declaration; if (isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(spacePart()); @@ -164816,7 +167210,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } else { addPrefixForAnyFunctionOrVar(symbol, symbolKind); } - if (symbolKind === "property" /* memberVariableElement */ || symbolKind === "accessor" /* memberAccessorVariableElement */ || symbolKind === "getter" /* memberGetAccessorElement */ || symbolKind === "setter" /* memberSetAccessorElement */ || symbolKind === "JSX attribute" /* jsxAttribute */ || symbolFlags & 3 /* Variable */ || symbolKind === "local var" /* localVariableElement */ || symbolKind === "index" /* indexSignatureElement */ || isThisExpression) { + if (symbolKind === "property" /* memberVariableElement */ || symbolKind === "accessor" /* memberAccessorVariableElement */ || symbolKind === "getter" /* memberGetAccessorElement */ || symbolKind === "setter" /* memberSetAccessorElement */ || symbolKind === "JSX attribute" /* jsxAttribute */ || symbolFlags & 3 /* Variable */ || symbolKind === "local var" /* localVariableElement */ || symbolKind === "index" /* indexSignatureElement */ || symbolKind === "using" /* variableUsingElement */ || symbolKind === "await using" /* variableAwaitUsingElement */ || isThisExpression) { displayParts.push(punctuationPart(59 /* ColonToken */)); displayParts.push(spacePart()); if (type.symbol && type.symbol.flags & 262144 /* TypeParameter */ && symbolKind !== "index" /* indexSignatureElement */) { @@ -164852,9 +167246,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} documentation = symbol.getContextualDocumentationComment(enclosingDeclaration, typeChecker); } if (documentation.length === 0 && symbolFlags & 4 /* Property */) { - if (symbol.parent && symbol.declarations && forEach(symbol.parent.declarations, (declaration) => declaration.kind === 311 /* SourceFile */)) { + if (symbol.parent && symbol.declarations && forEach(symbol.parent.declarations, (declaration) => declaration.kind === 312 /* SourceFile */)) { for (const declaration of symbol.declarations) { - if (!declaration.parent || declaration.parent.kind !== 225 /* BinaryExpression */) { + if (!declaration.parent || declaration.parent.kind !== 226 /* BinaryExpression */) { continue; } const rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right); @@ -164966,6 +167360,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} case "let" /* letElement */: case "const" /* constElement */: case "constructor" /* constructorImplementationElement */: + case "using" /* variableUsingElement */: + case "await using" /* variableAwaitUsingElement */: displayParts.push(textOrKeywordPart(symbolKind2)); return; default: @@ -165001,19 +167397,32 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} addRange(displayParts, typeParameterParts); } } + function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, enclosingDeclaration, location, semanticMeaning = getMeaningFromLocation(location), alias) { + return getSymbolDisplayPartsDocumentationAndSymbolKindWorker( + typeChecker, + symbol, + sourceFile, + enclosingDeclaration, + location, + /*type*/ + void 0, + semanticMeaning, + alias + ); + } function isLocalVariableOrFunction(symbol) { if (symbol.parent) { return false; } return forEach(symbol.declarations, (declaration) => { - if (declaration.kind === 217 /* FunctionExpression */) { + if (declaration.kind === 218 /* FunctionExpression */) { return true; } - if (declaration.kind !== 259 /* VariableDeclaration */ && declaration.kind !== 261 /* FunctionDeclaration */) { + if (declaration.kind !== 260 /* VariableDeclaration */ && declaration.kind !== 262 /* FunctionDeclaration */) { return false; } for (let parent2 = declaration.parent; !isFunctionBlock(parent2); parent2 = parent2.parent) { - if (parent2.kind === 311 /* SourceFile */ || parent2.kind === 267 /* ModuleBlock */) { + if (parent2.kind === 312 /* SourceFile */ || parent2.kind === 268 /* ModuleBlock */) { return false; } } @@ -165187,16 +167596,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return newEnd !== end && (trailingTriviaOption === 2 /* Include */ || isLineBreak(sourceFile.text.charCodeAt(newEnd - 1))) ? newEnd : end; } function isSeparator(node, candidate) { - return !!candidate && !!node.parent && (candidate.kind === 28 /* CommaToken */ || candidate.kind === 27 /* SemicolonToken */ && node.parent.kind === 209 /* ObjectLiteralExpression */); + return !!candidate && !!node.parent && (candidate.kind === 28 /* CommaToken */ || candidate.kind === 27 /* SemicolonToken */ && node.parent.kind === 210 /* ObjectLiteralExpression */); } function isThisTypeAnnotatable(containingFunction) { return isFunctionExpression(containingFunction) || isFunctionDeclaration(containingFunction); } function updateJSDocHost(parent2) { - if (parent2.kind !== 218 /* ArrowFunction */) { + if (parent2.kind !== 219 /* ArrowFunction */) { return parent2; } - const jsDocNode = parent2.parent.kind === 171 /* PropertyDeclaration */ ? parent2.parent : parent2.parent.parent; + const jsDocNode = parent2.parent.kind === 172 /* PropertyDeclaration */ ? parent2.parent : parent2.parent.parent; jsDocNode.jsDoc = parent2.jsDoc; return jsDocNode; } @@ -165205,7 +167614,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return void 0; } switch (oldTag.kind) { - case 347 /* JSDocParameterTag */: { + case 348 /* JSDocParameterTag */: { const oldParam = oldTag; const newParam = newTag; return isIdentifier(oldParam.name) && isIdentifier(newParam.name) && oldParam.name.escapedText === newParam.name.escapedText ? factory.createJSDocParameterTag( @@ -165219,14 +167628,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} oldParam.comment ) : void 0; } - case 348 /* JSDocReturnTag */: + case 349 /* JSDocReturnTag */: return factory.createJSDocReturnTag( /*tagName*/ void 0, newTag.typeExpression, oldTag.comment ); - case 350 /* JSDocTypeTag */: + case 351 /* JSDocTypeTag */: return factory.createJSDocTypeTag( /*tagName*/ void 0, @@ -165587,7 +167996,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return !isInComment(sourceFile, position) && !isInString(sourceFile, position) && !isInTemplateString(sourceFile, position) && !isInJSXText(sourceFile, position); } function needSemicolonBetween(a, b) { - return (isPropertySignature(a) || isPropertyDeclaration(a)) && isClassOrTypeElement(b) && b.name.kind === 166 /* ComputedPropertyName */ || isStatementButNotDeclaration(a) && isStatementButNotDeclaration(b); + return (isPropertySignature(a) || isPropertyDeclaration(a)) && isClassOrTypeElement(b) && b.name.kind === 167 /* ComputedPropertyName */ || isStatementButNotDeclaration(a) && isStatementButNotDeclaration(b); } function deleteNode(changes, sourceFile, node, options = { leadingTriviaOption: 1 /* IncludeAll */ }) { const startPosition = getAdjustedStartPosition(sourceFile, node, options); @@ -165631,7 +168040,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} leadingTriviaOption: 0 /* Exclude */, trailingTriviaOption: 0 /* Exclude */ }; - ChangeTracker = class { + ChangeTracker = class _ChangeTracker { /** Public for tests only. Other callers should use `ChangeTracker.with`. */ constructor(newLineCharacter, formatContext) { this.newLineCharacter = newLineCharacter; @@ -165642,10 +168051,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} this.deletedNodes = []; } static fromContext(context) { - return new ChangeTracker(getNewLineOrDefaultFromHost(context.host, context.formatContext.options), context.formatContext); + return new _ChangeTracker(getNewLineOrDefaultFromHost(context.host, context.formatContext.options), context.formatContext); } static with(context, cb) { - const tracker = ChangeTracker.fromContext(context); + const tracker = _ChangeTracker.fromContext(context); cb(tracker); return tracker.getChanges(); } @@ -165780,6 +168189,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} insertNodeBefore(sourceFile, before, newNode, blankLineBetween = false, options = {}) { this.insertNodeAt(sourceFile, getAdjustedStartPosition(sourceFile, before, options), newNode, this.getOptionsForInsertNodeBefore(before, newNode, blankLineBetween)); } + insertNodesBefore(sourceFile, before, newNodes, blankLineBetween = false, options = {}) { + this.insertNodesAt(sourceFile, getAdjustedStartPosition(sourceFile, before, options), newNodes, this.getOptionsForInsertNodeBefore(before, first(newNodes), blankLineBetween)); + } insertModifierAt(sourceFile, pos, modifier, options = {}) { this.insertNodeAt(sourceFile, pos, factory.createToken(modifier), options); } @@ -165852,7 +168264,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} endNode2 = first(node.parameters); } } else { - endNode2 = (node.kind === 259 /* VariableDeclaration */ ? node.exclamationToken : node.questionToken) ?? node.name; + endNode2 = (node.kind === 260 /* VariableDeclaration */ ? node.exclamationToken : node.questionToken) ?? node.name; } this.insertNodeAt(sourceFile, endNode2.end, type, { prefix: ": " }); return true; @@ -166000,18 +168412,18 @@ ${options.prefix}` : "\n" : options.prefix } getInsertNodeAfterOptionsWorker(node) { switch (node.kind) { - case 262 /* ClassDeclaration */: - case 266 /* ModuleDeclaration */: + case 263 /* ClassDeclaration */: + case 267 /* ModuleDeclaration */: return { prefix: this.newLineCharacter, suffix: this.newLineCharacter }; - case 259 /* VariableDeclaration */: + case 260 /* VariableDeclaration */: case 11 /* StringLiteral */: case 80 /* Identifier */: return { prefix: ", " }; - case 302 /* PropertyAssignment */: + case 303 /* PropertyAssignment */: return { suffix: "," + this.newLineCharacter }; case 95 /* ExportKeyword */: return { prefix: " " }; - case 168 /* Parameter */: + case 169 /* Parameter */: return {}; default: Debug.assert(isStatement(node) || isClassOrTypeElement(node)); @@ -166020,7 +168432,7 @@ ${options.prefix}` : "\n" : options.prefix } insertName(sourceFile, node, name) { Debug.assert(!node.name); - if (node.kind === 218 /* ArrowFunction */) { + if (node.kind === 219 /* ArrowFunction */) { const arrow = findChildOfKind(node, 39 /* EqualsGreaterThanToken */, sourceFile); const lparen = findChildOfKind(node, 21 /* OpenParenToken */, sourceFile); if (lparen) { @@ -166030,12 +168442,12 @@ ${options.prefix}` : "\n" : options.prefix this.insertText(sourceFile, first(node.parameters).getStart(sourceFile), `function ${name}(`); this.replaceRange(sourceFile, arrow, factory.createToken(22 /* CloseParenToken */)); } - if (node.body.kind !== 240 /* Block */) { + if (node.body.kind !== 241 /* Block */) { this.insertNodesAt(sourceFile, node.body.getStart(sourceFile), [factory.createToken(19 /* OpenBraceToken */), factory.createToken(107 /* ReturnKeyword */)], { joiner: " ", suffix: " " }); this.insertNodesAt(sourceFile, node.body.end, [factory.createToken(27 /* SemicolonToken */), factory.createToken(20 /* CloseBraceToken */)], { joiner: " " }); } } else { - const pos = findChildOfKind(node, node.kind === 217 /* FunctionExpression */ ? 100 /* FunctionKeyword */ : 86 /* ClassKeyword */, sourceFile).end; + const pos = findChildOfKind(node, node.kind === 218 /* FunctionExpression */ ? 100 /* FunctionKeyword */ : 86 /* ClassKeyword */, sourceFile).end; this.insertNodeAt(sourceFile, pos, factory.createIdentifier(name), { prefix: " " }); } } @@ -166270,7 +168682,7 @@ ${options.prefix}` : "\n" : options.prefix ((_deleteDeclaration) => { function deleteDeclaration2(changes, deletedNodesInLists, sourceFile, node) { switch (node.kind) { - case 168 /* Parameter */: { + case 169 /* Parameter */: { const oldFunction = node.parent; if (isArrowFunction(oldFunction) && oldFunction.parameters.length === 1 && !findChildOfKind(oldFunction, 21 /* OpenParenToken */, sourceFile)) { changes.replaceNodeWithText(sourceFile, node, "()"); @@ -166279,29 +168691,29 @@ ${options.prefix}` : "\n" : options.prefix } break; } - case 271 /* ImportDeclaration */: - case 270 /* ImportEqualsDeclaration */: + case 272 /* ImportDeclaration */: + case 271 /* ImportEqualsDeclaration */: const isFirstImport = sourceFile.imports.length && node === first(sourceFile.imports).parent || node === find(sourceFile.statements, isAnyImportSyntax); deleteNode(changes, sourceFile, node, { leadingTriviaOption: isFirstImport ? 0 /* Exclude */ : hasJSDocNodes(node) ? 2 /* JSDoc */ : 3 /* StartLine */ }); break; - case 207 /* BindingElement */: + case 208 /* BindingElement */: const pattern = node.parent; - const preserveComma = pattern.kind === 206 /* ArrayBindingPattern */ && node !== last(pattern.elements); + const preserveComma = pattern.kind === 207 /* ArrayBindingPattern */ && node !== last(pattern.elements); if (preserveComma) { deleteNode(changes, sourceFile, node); } else { deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } break; - case 259 /* VariableDeclaration */: + case 260 /* VariableDeclaration */: deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node); break; - case 167 /* TypeParameter */: + case 168 /* TypeParameter */: deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); break; - case 275 /* ImportSpecifier */: + case 276 /* ImportSpecifier */: const namedImports = node.parent; if (namedImports.elements.length === 1) { deleteImportBinding(changes, sourceFile, namedImports); @@ -166309,7 +168721,7 @@ ${options.prefix}` : "\n" : options.prefix deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } break; - case 273 /* NamespaceImport */: + case 274 /* NamespaceImport */: deleteImportBinding(changes, sourceFile, node); break; case 27 /* SemicolonToken */: @@ -166318,8 +168730,8 @@ ${options.prefix}` : "\n" : options.prefix case 100 /* FunctionKeyword */: deleteNode(changes, sourceFile, node, { leadingTriviaOption: 0 /* Exclude */ }); break; - case 262 /* ClassDeclaration */: - case 261 /* FunctionDeclaration */: + case 263 /* ClassDeclaration */: + case 262 /* FunctionDeclaration */: deleteNode(changes, sourceFile, node, { leadingTriviaOption: hasJSDocNodes(node) ? 2 /* JSDoc */ : 3 /* StartLine */ }); break; default: @@ -166361,13 +168773,13 @@ ${options.prefix}` : "\n" : options.prefix const previousToken = Debug.checkDefined(getTokenAtPosition(sourceFile, node.pos - 1)); changes.deleteRange(sourceFile, { pos: previousToken.getStart(sourceFile), end: node.end }); } else { - const importDecl = getAncestor(node, 271 /* ImportDeclaration */); + const importDecl = getAncestor(node, 272 /* ImportDeclaration */); deleteNode(changes, sourceFile, importDecl); } } function deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node) { const { parent: parent2 } = node; - if (parent2.kind === 298 /* CatchClause */) { + if (parent2.kind === 299 /* CatchClause */) { changes.deleteNodeRange(sourceFile, findChildOfKind(parent2, 21 /* OpenParenToken */, sourceFile), findChildOfKind(parent2, 22 /* CloseParenToken */, sourceFile)); return; } @@ -166377,14 +168789,14 @@ ${options.prefix}` : "\n" : options.prefix } const gp = parent2.parent; switch (gp.kind) { - case 249 /* ForOfStatement */: - case 248 /* ForInStatement */: + case 250 /* ForOfStatement */: + case 249 /* ForInStatement */: changes.replaceNode(sourceFile, node, factory.createObjectLiteralExpression()); break; - case 247 /* ForStatement */: + case 248 /* ForStatement */: deleteNode(changes, sourceFile, parent2); break; - case 242 /* VariableStatement */: + case 243 /* VariableStatement */: deleteNode(changes, sourceFile, gp, { leadingTriviaOption: hasJSDocNodes(gp) ? 2 /* JSDoc */ : 3 /* StartLine */ }); break; default: @@ -166567,10 +168979,10 @@ ${options.prefix}` : "\n" : options.prefix function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 290 /* JsxAttribute */: - case 285 /* JsxOpeningElement */: - case 286 /* JsxClosingElement */: - case 284 /* JsxSelfClosingElement */: + case 291 /* JsxAttribute */: + case 286 /* JsxOpeningElement */: + case 287 /* JsxClosingElement */: + case 285 /* JsxSelfClosingElement */: return isKeyword(node.kind) || node.kind === 80 /* Identifier */; } } @@ -166771,7 +169183,7 @@ ${options.prefix}` : "\n" : options.prefix // src/services/formatting/rules.ts function getAllRules() { const allTokens = []; - for (let token = 0 /* FirstToken */; token <= 164 /* LastToken */; token++) { + for (let token = 0 /* FirstToken */; token <= 165 /* LastToken */; token++) { if (token !== 1 /* EndOfFileToken */) { allTokens.push(token); } @@ -166782,12 +169194,12 @@ ${options.prefix}` : "\n" : options.prefix const anyToken = { tokens: allTokens, isSpecific: false }; const anyTokenIncludingMultilineComments = tokenRangeFrom([...allTokens, 3 /* MultiLineCommentTrivia */]); const anyTokenIncludingEOF = tokenRangeFrom([...allTokens, 1 /* EndOfFileToken */]); - const keywords = tokenRangeFromRange(83 /* FirstKeyword */, 164 /* LastKeyword */); + const keywords = tokenRangeFromRange(83 /* FirstKeyword */, 165 /* LastKeyword */); const binaryOperators = tokenRangeFromRange(30 /* FirstBinaryOperator */, 79 /* LastBinaryOperator */); const binaryKeywordOperators = [ 103 /* InKeyword */, 104 /* InstanceOfKeyword */, - 164 /* OfKeyword */, + 165 /* OfKeyword */, 130 /* AsKeyword */, 142 /* IsKeyword */, 152 /* SatisfiesKeyword */ @@ -166916,7 +169328,7 @@ ${options.prefix}` : "\n" : options.prefix 153 /* SetKeyword */, 126 /* StaticKeyword */, 156 /* TypeKeyword */, - 160 /* FromKeyword */, + 161 /* FromKeyword */, 143 /* KeyOfKeyword */, 140 /* InferKeyword */ ], @@ -166927,7 +169339,7 @@ ${options.prefix}` : "\n" : options.prefix rule( "SpaceBeforeCertainTypeScriptKeywords", anyToken, - [96 /* ExtendsKeyword */, 119 /* ImplementsKeyword */, 160 /* FromKeyword */], + [96 /* ExtendsKeyword */, 119 /* ImplementsKeyword */, 161 /* FromKeyword */], [isNonJsxSameLineTokenContext], 4 /* InsertSpace */ ), @@ -167117,40 +169529,40 @@ ${options.prefix}` : "\n" : options.prefix return (context) => !context.options || !hasProperty(context.options, optionName) || !!context.options[optionName]; } function isForContext(context) { - return context.contextNode.kind === 247 /* ForStatement */; + return context.contextNode.kind === 248 /* ForStatement */; } function isNotForContext(context) { return !isForContext(context); } function isBinaryOpContext(context) { switch (context.contextNode.kind) { - case 225 /* BinaryExpression */: + case 226 /* BinaryExpression */: return context.contextNode.operatorToken.kind !== 28 /* CommaToken */; - case 226 /* ConditionalExpression */: - case 193 /* ConditionalType */: - case 233 /* AsExpression */: - case 280 /* ExportSpecifier */: - case 275 /* ImportSpecifier */: - case 181 /* TypePredicate */: - case 191 /* UnionType */: - case 192 /* IntersectionType */: - case 237 /* SatisfiesExpression */: + case 227 /* ConditionalExpression */: + case 194 /* ConditionalType */: + case 234 /* AsExpression */: + case 281 /* ExportSpecifier */: + case 276 /* ImportSpecifier */: + case 182 /* TypePredicate */: + case 192 /* UnionType */: + case 193 /* IntersectionType */: + case 238 /* SatisfiesExpression */: return true; - case 207 /* BindingElement */: - case 264 /* TypeAliasDeclaration */: - case 270 /* ImportEqualsDeclaration */: - case 276 /* ExportAssignment */: - case 259 /* VariableDeclaration */: - case 168 /* Parameter */: - case 305 /* EnumMember */: - case 171 /* PropertyDeclaration */: - case 170 /* PropertySignature */: + case 208 /* BindingElement */: + case 265 /* TypeAliasDeclaration */: + case 271 /* ImportEqualsDeclaration */: + case 277 /* ExportAssignment */: + case 260 /* VariableDeclaration */: + case 169 /* Parameter */: + case 306 /* EnumMember */: + case 172 /* PropertyDeclaration */: + case 171 /* PropertySignature */: return context.currentTokenSpan.kind === 64 /* EqualsToken */ || context.nextTokenSpan.kind === 64 /* EqualsToken */; - case 248 /* ForInStatement */: - case 167 /* TypeParameter */: + case 249 /* ForInStatement */: + case 168 /* TypeParameter */: return context.currentTokenSpan.kind === 103 /* InKeyword */ || context.nextTokenSpan.kind === 103 /* InKeyword */ || context.currentTokenSpan.kind === 64 /* EqualsToken */ || context.nextTokenSpan.kind === 64 /* EqualsToken */; - case 249 /* ForOfStatement */: - return context.currentTokenSpan.kind === 164 /* OfKeyword */ || context.nextTokenSpan.kind === 164 /* OfKeyword */; + case 250 /* ForOfStatement */: + return context.currentTokenSpan.kind === 165 /* OfKeyword */ || context.nextTokenSpan.kind === 165 /* OfKeyword */; } return false; } @@ -167162,16 +169574,16 @@ ${options.prefix}` : "\n" : options.prefix } function isTypeAnnotationContext(context) { const contextKind = context.contextNode.kind; - return contextKind === 171 /* PropertyDeclaration */ || contextKind === 170 /* PropertySignature */ || contextKind === 168 /* Parameter */ || contextKind === 259 /* VariableDeclaration */ || isFunctionLikeKind(contextKind); + return contextKind === 172 /* PropertyDeclaration */ || contextKind === 171 /* PropertySignature */ || contextKind === 169 /* Parameter */ || contextKind === 260 /* VariableDeclaration */ || isFunctionLikeKind(contextKind); } function isConditionalOperatorContext(context) { - return context.contextNode.kind === 226 /* ConditionalExpression */ || context.contextNode.kind === 193 /* ConditionalType */; + return context.contextNode.kind === 227 /* ConditionalExpression */ || context.contextNode.kind === 194 /* ConditionalType */; } function isSameLineTokenOrBeforeBlockContext(context) { return context.TokensAreOnSameLine() || isBeforeBlockContext(context); } function isBraceWrappedContext(context) { - return context.contextNode.kind === 205 /* ObjectBindingPattern */ || context.contextNode.kind === 199 /* MappedType */ || isSingleLineBlockContext(context); + return context.contextNode.kind === 206 /* ObjectBindingPattern */ || context.contextNode.kind === 200 /* MappedType */ || isSingleLineBlockContext(context); } function isBeforeMultilineBlockContext(context) { return isBeforeBlockContext(context) && !(context.NextNodeAllOnSameLine() || context.NextNodeBlockIsOnOneLine()); @@ -167193,26 +169605,26 @@ ${options.prefix}` : "\n" : options.prefix return true; } switch (node.kind) { - case 240 /* Block */: - case 268 /* CaseBlock */: - case 209 /* ObjectLiteralExpression */: - case 267 /* ModuleBlock */: + case 241 /* Block */: + case 269 /* CaseBlock */: + case 210 /* ObjectLiteralExpression */: + case 268 /* ModuleBlock */: return true; } return false; } function isFunctionDeclContext(context) { switch (context.contextNode.kind) { - case 261 /* FunctionDeclaration */: - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - case 178 /* CallSignature */: - case 217 /* FunctionExpression */: - case 175 /* Constructor */: - case 218 /* ArrowFunction */: - case 263 /* InterfaceDeclaration */: + case 262 /* FunctionDeclaration */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + case 179 /* CallSignature */: + case 218 /* FunctionExpression */: + case 176 /* Constructor */: + case 219 /* ArrowFunction */: + case 264 /* InterfaceDeclaration */: return true; } return false; @@ -167221,39 +169633,39 @@ ${options.prefix}` : "\n" : options.prefix return !isFunctionDeclContext(context); } function isFunctionDeclarationOrFunctionExpressionContext(context) { - return context.contextNode.kind === 261 /* FunctionDeclaration */ || context.contextNode.kind === 217 /* FunctionExpression */; + return context.contextNode.kind === 262 /* FunctionDeclaration */ || context.contextNode.kind === 218 /* FunctionExpression */; } function isTypeScriptDeclWithBlockContext(context) { return nodeIsTypeScriptDeclWithBlockContext(context.contextNode); } function nodeIsTypeScriptDeclWithBlockContext(node) { switch (node.kind) { - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: - case 263 /* InterfaceDeclaration */: - case 265 /* EnumDeclaration */: - case 186 /* TypeLiteral */: - case 266 /* ModuleDeclaration */: - case 277 /* ExportDeclaration */: - case 278 /* NamedExports */: - case 271 /* ImportDeclaration */: - case 274 /* NamedImports */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: + case 264 /* InterfaceDeclaration */: + case 266 /* EnumDeclaration */: + case 187 /* TypeLiteral */: + case 267 /* ModuleDeclaration */: + case 278 /* ExportDeclaration */: + case 279 /* NamedExports */: + case 272 /* ImportDeclaration */: + case 275 /* NamedImports */: return true; } return false; } function isAfterCodeBlockContext(context) { switch (context.currentTokenParent.kind) { - case 262 /* ClassDeclaration */: - case 266 /* ModuleDeclaration */: - case 265 /* EnumDeclaration */: - case 298 /* CatchClause */: - case 267 /* ModuleBlock */: - case 254 /* SwitchStatement */: + case 263 /* ClassDeclaration */: + case 267 /* ModuleDeclaration */: + case 266 /* EnumDeclaration */: + case 299 /* CatchClause */: + case 268 /* ModuleBlock */: + case 255 /* SwitchStatement */: return true; - case 240 /* Block */: { + case 241 /* Block */: { const blockParent = context.currentTokenParent.parent; - if (!blockParent || blockParent.kind !== 218 /* ArrowFunction */ && blockParent.kind !== 217 /* FunctionExpression */) { + if (!blockParent || blockParent.kind !== 219 /* ArrowFunction */ && blockParent.kind !== 218 /* FunctionExpression */) { return true; } } @@ -167262,29 +169674,29 @@ ${options.prefix}` : "\n" : options.prefix } function isControlDeclContext(context) { switch (context.contextNode.kind) { - case 244 /* IfStatement */: - case 254 /* SwitchStatement */: - case 247 /* ForStatement */: - case 248 /* ForInStatement */: - case 249 /* ForOfStatement */: - case 246 /* WhileStatement */: - case 257 /* TryStatement */: - case 245 /* DoStatement */: - case 253 /* WithStatement */: - case 298 /* CatchClause */: + case 245 /* IfStatement */: + case 255 /* SwitchStatement */: + case 248 /* ForStatement */: + case 249 /* ForInStatement */: + case 250 /* ForOfStatement */: + case 247 /* WhileStatement */: + case 258 /* TryStatement */: + case 246 /* DoStatement */: + case 254 /* WithStatement */: + case 299 /* CatchClause */: return true; default: return false; } } function isObjectContext(context) { - return context.contextNode.kind === 209 /* ObjectLiteralExpression */; + return context.contextNode.kind === 210 /* ObjectLiteralExpression */; } function isFunctionCallContext(context) { - return context.contextNode.kind === 212 /* CallExpression */; + return context.contextNode.kind === 213 /* CallExpression */; } function isNewContext(context) { - return context.contextNode.kind === 213 /* NewExpression */; + return context.contextNode.kind === 214 /* NewExpression */; } function isFunctionCallOrNewContext(context) { return isFunctionCallContext(context) || isNewContext(context); @@ -167299,10 +169711,10 @@ ${options.prefix}` : "\n" : options.prefix return context.nextTokenSpan.kind !== 22 /* CloseParenToken */; } function isArrowFunctionContext(context) { - return context.contextNode.kind === 218 /* ArrowFunction */; + return context.contextNode.kind === 219 /* ArrowFunction */; } function isImportTypeContext(context) { - return context.contextNode.kind === 204 /* ImportType */; + return context.contextNode.kind === 205 /* ImportType */; } function isNonJsxSameLineTokenContext(context) { return context.TokensAreOnSameLine() && context.contextNode.kind !== 12 /* JsxText */; @@ -167311,19 +169723,19 @@ ${options.prefix}` : "\n" : options.prefix return context.contextNode.kind !== 12 /* JsxText */; } function isNonJsxElementOrFragmentContext(context) { - return context.contextNode.kind !== 283 /* JsxElement */ && context.contextNode.kind !== 287 /* JsxFragment */; + return context.contextNode.kind !== 284 /* JsxElement */ && context.contextNode.kind !== 288 /* JsxFragment */; } function isJsxExpressionContext(context) { - return context.contextNode.kind === 293 /* JsxExpression */ || context.contextNode.kind === 292 /* JsxSpreadAttribute */; + return context.contextNode.kind === 294 /* JsxExpression */ || context.contextNode.kind === 293 /* JsxSpreadAttribute */; } function isNextTokenParentJsxAttribute(context) { - return context.nextTokenParent.kind === 290 /* JsxAttribute */; + return context.nextTokenParent.kind === 291 /* JsxAttribute */; } function isJsxAttributeContext(context) { - return context.contextNode.kind === 290 /* JsxAttribute */; + return context.contextNode.kind === 291 /* JsxAttribute */; } function isJsxSelfClosingElementContext(context) { - return context.contextNode.kind === 284 /* JsxSelfClosingElement */; + return context.contextNode.kind === 285 /* JsxSelfClosingElement */; } function isNotBeforeBlockInFunctionDeclarationContext(context) { return !isFunctionDeclContext(context) && !isBeforeBlockContext(context); @@ -167335,44 +169747,44 @@ ${options.prefix}` : "\n" : options.prefix while (node && isExpression(node)) { node = node.parent; } - return node && node.kind === 169 /* Decorator */; + return node && node.kind === 170 /* Decorator */; } function isStartOfVariableDeclarationList(context) { - return context.currentTokenParent.kind === 260 /* VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; + return context.currentTokenParent.kind === 261 /* VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; } function isNotFormatOnEnter(context) { return context.formattingRequestKind !== 2 /* FormatOnEnter */; } function isModuleDeclContext(context) { - return context.contextNode.kind === 266 /* ModuleDeclaration */; + return context.contextNode.kind === 267 /* ModuleDeclaration */; } function isObjectTypeContext(context) { - return context.contextNode.kind === 186 /* TypeLiteral */; + return context.contextNode.kind === 187 /* TypeLiteral */; } function isConstructorSignatureContext(context) { - return context.contextNode.kind === 179 /* ConstructSignature */; + return context.contextNode.kind === 180 /* ConstructSignature */; } function isTypeArgumentOrParameterOrAssertion(token, parent2) { if (token.kind !== 30 /* LessThanToken */ && token.kind !== 32 /* GreaterThanToken */) { return false; } switch (parent2.kind) { - case 182 /* TypeReference */: - case 215 /* TypeAssertionExpression */: - case 264 /* TypeAliasDeclaration */: - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: - case 263 /* InterfaceDeclaration */: - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: - case 178 /* CallSignature */: - case 179 /* ConstructSignature */: - case 212 /* CallExpression */: - case 213 /* NewExpression */: - case 232 /* ExpressionWithTypeArguments */: + case 183 /* TypeReference */: + case 216 /* TypeAssertionExpression */: + case 265 /* TypeAliasDeclaration */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: + case 264 /* InterfaceDeclaration */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: + case 179 /* CallSignature */: + case 180 /* ConstructSignature */: + case 213 /* CallExpression */: + case 214 /* NewExpression */: + case 233 /* ExpressionWithTypeArguments */: return true; default: return false; @@ -167382,31 +169794,31 @@ ${options.prefix}` : "\n" : options.prefix return isTypeArgumentOrParameterOrAssertion(context.currentTokenSpan, context.currentTokenParent) || isTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); } function isTypeAssertionContext(context) { - return context.contextNode.kind === 215 /* TypeAssertionExpression */; + return context.contextNode.kind === 216 /* TypeAssertionExpression */; } function isNonTypeAssertionContext(context) { return !isTypeAssertionContext(context); } function isVoidOpContext(context) { - return context.currentTokenSpan.kind === 116 /* VoidKeyword */ && context.currentTokenParent.kind === 221 /* VoidExpression */; + return context.currentTokenSpan.kind === 116 /* VoidKeyword */ && context.currentTokenParent.kind === 222 /* VoidExpression */; } function isYieldOrYieldStarWithOperand(context) { - return context.contextNode.kind === 228 /* YieldExpression */ && context.contextNode.expression !== void 0; + return context.contextNode.kind === 229 /* YieldExpression */ && context.contextNode.expression !== void 0; } function isNonNullAssertionContext(context) { - return context.contextNode.kind === 234 /* NonNullExpression */; + return context.contextNode.kind === 235 /* NonNullExpression */; } function isNotStatementConditionContext(context) { return !isStatementConditionContext(context); } function isStatementConditionContext(context) { switch (context.contextNode.kind) { - case 244 /* IfStatement */: - case 247 /* ForStatement */: - case 248 /* ForInStatement */: - case 249 /* ForOfStatement */: - case 245 /* DoStatement */: - case 246 /* WhileStatement */: + case 245 /* IfStatement */: + case 248 /* ForStatement */: + case 249 /* ForInStatement */: + case 250 /* ForOfStatement */: + case 246 /* DoStatement */: + case 247 /* WhileStatement */: return true; default: return false; @@ -167432,16 +169844,16 @@ ${options.prefix}` : "\n" : options.prefix if (startLine === endLine) { return nextTokenKind === 20 /* CloseBraceToken */ || nextTokenKind === 1 /* EndOfFileToken */; } - if (nextTokenKind === 239 /* SemicolonClassElement */ || nextTokenKind === 27 /* SemicolonToken */) { + if (nextTokenKind === 240 /* SemicolonClassElement */ || nextTokenKind === 27 /* SemicolonToken */) { return false; } - if (context.contextNode.kind === 263 /* InterfaceDeclaration */ || context.contextNode.kind === 264 /* TypeAliasDeclaration */) { + if (context.contextNode.kind === 264 /* InterfaceDeclaration */ || context.contextNode.kind === 265 /* TypeAliasDeclaration */) { return !isPropertySignature(context.currentTokenParent) || !!context.currentTokenParent.type || nextTokenKind !== 21 /* OpenParenToken */; } if (isPropertyDeclaration(context.currentTokenParent)) { return !context.currentTokenParent.initializer; } - return context.currentTokenParent.kind !== 247 /* ForStatement */ && context.currentTokenParent.kind !== 241 /* EmptyStatement */ && context.currentTokenParent.kind !== 239 /* SemicolonClassElement */ && nextTokenKind !== 23 /* OpenBracketToken */ && nextTokenKind !== 21 /* OpenParenToken */ && nextTokenKind !== 40 /* PlusToken */ && nextTokenKind !== 41 /* MinusToken */ && nextTokenKind !== 44 /* SlashToken */ && nextTokenKind !== 14 /* RegularExpressionLiteral */ && nextTokenKind !== 28 /* CommaToken */ && nextTokenKind !== 227 /* TemplateExpression */ && nextTokenKind !== 16 /* TemplateHead */ && nextTokenKind !== 15 /* NoSubstitutionTemplateLiteral */ && nextTokenKind !== 25 /* DotToken */; + return context.currentTokenParent.kind !== 248 /* ForStatement */ && context.currentTokenParent.kind !== 242 /* EmptyStatement */ && context.currentTokenParent.kind !== 240 /* SemicolonClassElement */ && nextTokenKind !== 23 /* OpenBracketToken */ && nextTokenKind !== 21 /* OpenParenToken */ && nextTokenKind !== 40 /* PlusToken */ && nextTokenKind !== 41 /* MinusToken */ && nextTokenKind !== 44 /* SlashToken */ && nextTokenKind !== 14 /* RegularExpressionLiteral */ && nextTokenKind !== 28 /* CommaToken */ && nextTokenKind !== 228 /* TemplateExpression */ && nextTokenKind !== 16 /* TemplateHead */ && nextTokenKind !== 15 /* NoSubstitutionTemplateLiteral */ && nextTokenKind !== 25 /* DotToken */; } function isSemicolonInsertionContext(context) { return positionIsASICandidate(context.currentTokenSpan.end, context.currentTokenParent, context.sourceFile); @@ -167522,7 +169934,7 @@ ${options.prefix}` : "\n" : options.prefix return map2; } function getRuleBucketIndex(row, column) { - Debug.assert(row <= 164 /* LastKeyword */ && column <= 164 /* LastKeyword */, "Must compute formatting context from tokens"); + Debug.assert(row <= 165 /* LastKeyword */ && column <= 165 /* LastKeyword */, "Must compute formatting context from tokens"); return row * mapRowLength + column; } function addRule(rules, rule2, specificTokens, constructionState, rulesBucketIndex) { @@ -167552,7 +169964,7 @@ ${options.prefix}` : "\n" : options.prefix init_ts_formatting(); maskBitSize = 5; mask = 31; - mapRowLength = 164 /* LastToken */ + 1; + mapRowLength = 165 /* LastToken */ + 1; RulesPosition = ((RulesPosition2) => { RulesPosition2[RulesPosition2["StopRulesSpecific"] = 0] = "StopRulesSpecific"; RulesPosition2[RulesPosition2["StopRulesAny"] = maskBitSize * 1] = "StopRulesAny"; @@ -167644,17 +170056,17 @@ ${options.prefix}` : "\n" : options.prefix } function isListElement(parent2, node) { switch (parent2.kind) { - case 262 /* ClassDeclaration */: - case 263 /* InterfaceDeclaration */: + case 263 /* ClassDeclaration */: + case 264 /* InterfaceDeclaration */: return rangeContainsRange(parent2.members, node); - case 266 /* ModuleDeclaration */: + case 267 /* ModuleDeclaration */: const body = parent2.body; - return !!body && body.kind === 267 /* ModuleBlock */ && rangeContainsRange(body.statements, node); - case 311 /* SourceFile */: - case 240 /* Block */: - case 267 /* ModuleBlock */: + return !!body && body.kind === 268 /* ModuleBlock */ && rangeContainsRange(body.statements, node); + case 312 /* SourceFile */: + case 241 /* Block */: + case 268 /* ModuleBlock */: return rangeContainsRange(parent2.statements, node); - case 298 /* CatchClause */: + case 299 /* CatchClause */: return rangeContainsRange(parent2.block.statements, node); } return false; @@ -167686,11 +170098,11 @@ ${options.prefix}` : "\n" : options.prefix if (index >= sorted.length) { return false; } - const error = sorted[index]; - if (r.end <= error.start) { + const error2 = sorted[index]; + if (r.end <= error2.start) { return false; } - if (startEndOverlapsWithStartEnd(r.pos, r.end, error.start, error.start + error.length)) { + if (startEndOverlapsWithStartEnd(r.pos, r.end, error2.start, error2.start + error2.length)) { return true; } index++; @@ -167795,7 +170207,8 @@ ${options.prefix}` : "\n" : options.prefix } processNode(enclosingNode, enclosingNode, startLine, undecoratedStartLine, initialIndentation, delta); } - if (!formattingScanner.isOnToken()) { + const remainingTrivia = formattingScanner.getCurrentLeadingTrivia(); + if (remainingTrivia) { const indentation = SmartIndenter.nodeWillIndentChild( options, enclosingNode, @@ -167805,25 +170218,30 @@ ${options.prefix}` : "\n" : options.prefix /*indentByDefault*/ false ) ? initialIndentation + options.indentSize : initialIndentation; - const leadingTrivia = formattingScanner.getCurrentLeadingTrivia(); - if (leadingTrivia) { - indentTriviaItems( - leadingTrivia, - indentation, - /*indentNextTokenOrTrivia*/ - false, - (item) => processRange( + indentTriviaItems( + remainingTrivia, + indentation, + /*indentNextTokenOrTrivia*/ + true, + (item) => { + processRange( item, sourceFile.getLineAndCharacterOfPosition(item.pos), enclosingNode, enclosingNode, /*dynamicIndentation*/ void 0 - ) - ); - if (options.trimTrailingWhitespace !== false) { - trimTrailingWhitespacesForRemainingRange(leadingTrivia); + ); + insertIndentation( + item.pos, + indentation, + /*lineAdded*/ + false + ); } + ); + if (options.trimTrailingWhitespace !== false) { + trimTrailingWhitespacesForRemainingRange(remainingTrivia); } } if (previousRange && formattingScanner.getTokenFullStart() >= originalRange.end) { @@ -167886,24 +170304,24 @@ ${options.prefix}` : "\n" : options.prefix return modifier.kind; } switch (node.kind) { - case 262 /* ClassDeclaration */: + case 263 /* ClassDeclaration */: return 86 /* ClassKeyword */; - case 263 /* InterfaceDeclaration */: + case 264 /* InterfaceDeclaration */: return 120 /* InterfaceKeyword */; - case 261 /* FunctionDeclaration */: + case 262 /* FunctionDeclaration */: return 100 /* FunctionKeyword */; - case 265 /* EnumDeclaration */: - return 265 /* EnumDeclaration */; - case 176 /* GetAccessor */: + case 266 /* EnumDeclaration */: + return 266 /* EnumDeclaration */; + case 177 /* GetAccessor */: return 139 /* GetKeyword */; - case 177 /* SetAccessor */: + case 178 /* SetAccessor */: return 153 /* SetKeyword */; - case 173 /* MethodDeclaration */: + case 174 /* MethodDeclaration */: if (node.asteriskToken) { return 42 /* AsteriskToken */; } - case 171 /* PropertyDeclaration */: - case 168 /* Parameter */: + case 172 /* PropertyDeclaration */: + case 169 /* Parameter */: const name = getNameOfDeclaration(node); if (name) { return name.kind; @@ -167953,15 +170371,15 @@ ${options.prefix}` : "\n" : options.prefix case 44 /* SlashToken */: case 32 /* GreaterThanToken */: switch (container.kind) { - case 285 /* JsxOpeningElement */: - case 286 /* JsxClosingElement */: - case 284 /* JsxSelfClosingElement */: + case 286 /* JsxOpeningElement */: + case 287 /* JsxClosingElement */: + case 285 /* JsxSelfClosingElement */: return false; } break; case 23 /* OpenBracketToken */: case 24 /* CloseBracketToken */: - if (container.kind !== 199 /* MappedType */) { + if (container.kind !== 200 /* MappedType */) { return false; } break; @@ -168062,11 +170480,11 @@ ${options.prefix}` : "\n" : options.prefix return inheritedIndentation; } } - const effectiveParentStartLine = child.kind === 169 /* Decorator */ ? childStartLine : undecoratedParentStartLine; + const effectiveParentStartLine = child.kind === 170 /* Decorator */ ? childStartLine : undecoratedParentStartLine; const childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; - if (isFirstListItem && parent2.kind === 208 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) { + if (isFirstListItem && parent2.kind === 209 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) { inheritedIndentation = childIndentation.indentation; } return inheritedIndentation; @@ -168487,50 +170905,50 @@ ${options.prefix}` : "\n" : options.prefix } function getOpenTokenForList(node, list) { switch (node.kind) { - case 175 /* Constructor */: - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: - case 218 /* ArrowFunction */: - case 178 /* CallSignature */: - case 179 /* ConstructSignature */: - case 183 /* FunctionType */: - case 184 /* ConstructorType */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: + case 176 /* Constructor */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: + case 219 /* ArrowFunction */: + case 179 /* CallSignature */: + case 180 /* ConstructSignature */: + case 184 /* FunctionType */: + case 185 /* ConstructorType */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: if (node.typeParameters === list) { return 30 /* LessThanToken */; } else if (node.parameters === list) { return 21 /* OpenParenToken */; } break; - case 212 /* CallExpression */: - case 213 /* NewExpression */: + case 213 /* CallExpression */: + case 214 /* NewExpression */: if (node.typeArguments === list) { return 30 /* LessThanToken */; } else if (node.arguments === list) { return 21 /* OpenParenToken */; } break; - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: - case 263 /* InterfaceDeclaration */: - case 264 /* TypeAliasDeclaration */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: + case 264 /* InterfaceDeclaration */: + case 265 /* TypeAliasDeclaration */: if (node.typeParameters === list) { return 30 /* LessThanToken */; } break; - case 182 /* TypeReference */: - case 214 /* TaggedTemplateExpression */: - case 185 /* TypeQuery */: - case 232 /* ExpressionWithTypeArguments */: - case 204 /* ImportType */: + case 183 /* TypeReference */: + case 215 /* TaggedTemplateExpression */: + case 186 /* TypeQuery */: + case 233 /* ExpressionWithTypeArguments */: + case 205 /* ImportType */: if (node.typeArguments === list) { return 30 /* LessThanToken */; } break; - case 186 /* TypeLiteral */: + case 187 /* TypeLiteral */: return 19 /* OpenBraceToken */; } return 0 /* Unknown */; @@ -168630,11 +171048,11 @@ ${options.prefix}` : "\n" : options.prefix } const lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line; const currentToken = getTokenAtPosition(sourceFile, position); - const isObjectLiteral = currentToken.kind === 19 /* OpenBraceToken */ && currentToken.parent.kind === 209 /* ObjectLiteralExpression */; + const isObjectLiteral = currentToken.kind === 19 /* OpenBraceToken */ && currentToken.parent.kind === 210 /* ObjectLiteralExpression */; if (options.indentStyle === 1 /* Block */ || isObjectLiteral) { return getBlockIndent(sourceFile, position, options); } - if (precedingToken.kind === 28 /* CommaToken */ && precedingToken.parent.kind !== 225 /* BinaryExpression */) { + if (precedingToken.kind === 28 /* CommaToken */ && precedingToken.parent.kind !== 226 /* BinaryExpression */) { const actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1 /* Unknown */) { return actualIndentation; @@ -168642,7 +171060,7 @@ ${options.prefix}` : "\n" : options.prefix } const containerList = getListByPosition(position, precedingToken.parent, sourceFile); if (containerList && !rangeContainsRange(containerList, precedingToken)) { - const useTheSameBaseIndentation = [217 /* FunctionExpression */, 218 /* ArrowFunction */].indexOf(currentToken.parent.kind) !== -1; + const useTheSameBaseIndentation = [218 /* FunctionExpression */, 219 /* ArrowFunction */].indexOf(currentToken.parent.kind) !== -1; const indentSize = useTheSameBaseIndentation ? 0 : options.indentSize; return getActualIndentationForListStartLine(containerList, sourceFile, options) + indentSize; } @@ -168784,7 +171202,7 @@ ${options.prefix}` : "\n" : options.prefix } } function getActualIndentationForNode(current, parent2, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { - const useActualIndentation = (isDeclaration(current) || isStatementButNotDeclaration(current)) && (parent2.kind === 311 /* SourceFile */ || !parentAndChildShareLine); + const useActualIndentation = (isDeclaration(current) || isStatementButNotDeclaration(current)) && (parent2.kind === 312 /* SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Unknown */; } @@ -168822,7 +171240,7 @@ ${options.prefix}` : "\n" : options.prefix } SmartIndenter2.isArgumentAndStartLineOverlapsExpressionBeingCalled = isArgumentAndStartLineOverlapsExpressionBeingCalled; function childStartsOnTheSameLineWithElseInIfStatement(parent2, child, childStartLine, sourceFile) { - if (parent2.kind === 244 /* IfStatement */ && parent2.elseStatement === child) { + if (parent2.kind === 245 /* IfStatement */ && parent2.elseStatement === child) { const elseKeyword = findChildOfKind(parent2, 93 /* ElseKeyword */, sourceFile); Debug.assert(elseKeyword !== void 0); const elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -168873,42 +171291,42 @@ ${options.prefix}` : "\n" : options.prefix } function getListByRange(start, end, node, sourceFile) { switch (node.kind) { - case 182 /* TypeReference */: + case 183 /* TypeReference */: return getList(node.typeArguments); - case 209 /* ObjectLiteralExpression */: + case 210 /* ObjectLiteralExpression */: return getList(node.properties); - case 208 /* ArrayLiteralExpression */: + case 209 /* ArrayLiteralExpression */: return getList(node.elements); - case 186 /* TypeLiteral */: + case 187 /* TypeLiteral */: return getList(node.members); - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 218 /* ArrowFunction */: - case 173 /* MethodDeclaration */: - case 172 /* MethodSignature */: - case 178 /* CallSignature */: - case 175 /* Constructor */: - case 184 /* ConstructorType */: - case 179 /* ConstructSignature */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 219 /* ArrowFunction */: + case 174 /* MethodDeclaration */: + case 173 /* MethodSignature */: + case 179 /* CallSignature */: + case 176 /* Constructor */: + case 185 /* ConstructorType */: + case 180 /* ConstructSignature */: return getList(node.typeParameters) || getList(node.parameters); - case 176 /* GetAccessor */: + case 177 /* GetAccessor */: return getList(node.parameters); - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: - case 263 /* InterfaceDeclaration */: - case 264 /* TypeAliasDeclaration */: - case 351 /* JSDocTemplateTag */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: + case 264 /* InterfaceDeclaration */: + case 265 /* TypeAliasDeclaration */: + case 352 /* JSDocTemplateTag */: return getList(node.typeParameters); - case 213 /* NewExpression */: - case 212 /* CallExpression */: + case 214 /* NewExpression */: + case 213 /* CallExpression */: return getList(node.typeArguments) || getList(node.arguments); - case 260 /* VariableDeclarationList */: + case 261 /* VariableDeclarationList */: return getList(node.declarations); - case 274 /* NamedImports */: - case 278 /* NamedExports */: + case 275 /* NamedImports */: + case 279 /* NamedExports */: return getList(node.elements); - case 205 /* ObjectBindingPattern */: - case 206 /* ArrayBindingPattern */: + case 206 /* ObjectBindingPattern */: + case 207 /* ArrayBindingPattern */: return getList(node.elements); } function getList(list) { @@ -168931,7 +171349,7 @@ ${options.prefix}` : "\n" : options.prefix return findColumnForFirstNonWhitespaceCharacterInLine(sourceFile.getLineAndCharacterOfPosition(list.pos), sourceFile, options); } function getActualIndentationForListItem(node, sourceFile, options, listIndentsChild) { - if (node.parent && node.parent.kind === 260 /* VariableDeclarationList */) { + if (node.parent && node.parent.kind === 261 /* VariableDeclarationList */) { return -1 /* Unknown */; } const containingList = getContainingList(node, sourceFile); @@ -168992,96 +171410,96 @@ ${options.prefix}` : "\n" : options.prefix function nodeWillIndentChild(settings, parent2, child, sourceFile, indentByDefault) { const childKind = child ? child.kind : 0 /* Unknown */; switch (parent2.kind) { - case 243 /* ExpressionStatement */: - case 262 /* ClassDeclaration */: - case 230 /* ClassExpression */: - case 263 /* InterfaceDeclaration */: - case 265 /* EnumDeclaration */: - case 264 /* TypeAliasDeclaration */: - case 208 /* ArrayLiteralExpression */: - case 240 /* Block */: - case 267 /* ModuleBlock */: - case 209 /* ObjectLiteralExpression */: - case 186 /* TypeLiteral */: - case 199 /* MappedType */: - case 188 /* TupleType */: - case 216 /* ParenthesizedExpression */: - case 210 /* PropertyAccessExpression */: - case 212 /* CallExpression */: - case 213 /* NewExpression */: - case 242 /* VariableStatement */: - case 276 /* ExportAssignment */: - case 252 /* ReturnStatement */: - case 226 /* ConditionalExpression */: - case 206 /* ArrayBindingPattern */: - case 205 /* ObjectBindingPattern */: - case 285 /* JsxOpeningElement */: - case 288 /* JsxOpeningFragment */: - case 284 /* JsxSelfClosingElement */: - case 293 /* JsxExpression */: - case 172 /* MethodSignature */: - case 178 /* CallSignature */: - case 179 /* ConstructSignature */: - case 168 /* Parameter */: - case 183 /* FunctionType */: - case 184 /* ConstructorType */: - case 195 /* ParenthesizedType */: - case 214 /* TaggedTemplateExpression */: - case 222 /* AwaitExpression */: - case 278 /* NamedExports */: - case 274 /* NamedImports */: - case 280 /* ExportSpecifier */: - case 275 /* ImportSpecifier */: - case 171 /* PropertyDeclaration */: - case 295 /* CaseClause */: - case 296 /* DefaultClause */: + case 244 /* ExpressionStatement */: + case 263 /* ClassDeclaration */: + case 231 /* ClassExpression */: + case 264 /* InterfaceDeclaration */: + case 266 /* EnumDeclaration */: + case 265 /* TypeAliasDeclaration */: + case 209 /* ArrayLiteralExpression */: + case 241 /* Block */: + case 268 /* ModuleBlock */: + case 210 /* ObjectLiteralExpression */: + case 187 /* TypeLiteral */: + case 200 /* MappedType */: + case 189 /* TupleType */: + case 217 /* ParenthesizedExpression */: + case 211 /* PropertyAccessExpression */: + case 213 /* CallExpression */: + case 214 /* NewExpression */: + case 243 /* VariableStatement */: + case 277 /* ExportAssignment */: + case 253 /* ReturnStatement */: + case 227 /* ConditionalExpression */: + case 207 /* ArrayBindingPattern */: + case 206 /* ObjectBindingPattern */: + case 286 /* JsxOpeningElement */: + case 289 /* JsxOpeningFragment */: + case 285 /* JsxSelfClosingElement */: + case 294 /* JsxExpression */: + case 173 /* MethodSignature */: + case 179 /* CallSignature */: + case 180 /* ConstructSignature */: + case 169 /* Parameter */: + case 184 /* FunctionType */: + case 185 /* ConstructorType */: + case 196 /* ParenthesizedType */: + case 215 /* TaggedTemplateExpression */: + case 223 /* AwaitExpression */: + case 279 /* NamedExports */: + case 275 /* NamedImports */: + case 281 /* ExportSpecifier */: + case 276 /* ImportSpecifier */: + case 172 /* PropertyDeclaration */: + case 296 /* CaseClause */: + case 297 /* DefaultClause */: return true; - case 268 /* CaseBlock */: + case 269 /* CaseBlock */: return settings.indentSwitchCase ?? true; - case 259 /* VariableDeclaration */: - case 302 /* PropertyAssignment */: - case 225 /* BinaryExpression */: - if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 209 /* ObjectLiteralExpression */) { + case 260 /* VariableDeclaration */: + case 303 /* PropertyAssignment */: + case 226 /* BinaryExpression */: + if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 210 /* ObjectLiteralExpression */) { return rangeIsOnOneLine(sourceFile, child); } - if (parent2.kind === 225 /* BinaryExpression */ && sourceFile && child && childKind === 283 /* JsxElement */) { + if (parent2.kind === 226 /* BinaryExpression */ && sourceFile && child && childKind === 284 /* JsxElement */) { const parentStartLine = sourceFile.getLineAndCharacterOfPosition(skipTrivia(sourceFile.text, parent2.pos)).line; const childStartLine = sourceFile.getLineAndCharacterOfPosition(skipTrivia(sourceFile.text, child.pos)).line; return parentStartLine !== childStartLine; } - if (parent2.kind !== 225 /* BinaryExpression */) { + if (parent2.kind !== 226 /* BinaryExpression */) { return true; } break; - case 245 /* DoStatement */: - case 246 /* WhileStatement */: - case 248 /* ForInStatement */: - case 249 /* ForOfStatement */: - case 247 /* ForStatement */: - case 244 /* IfStatement */: - case 261 /* FunctionDeclaration */: - case 217 /* FunctionExpression */: - case 173 /* MethodDeclaration */: - case 175 /* Constructor */: - case 176 /* GetAccessor */: - case 177 /* SetAccessor */: - return childKind !== 240 /* Block */; - case 218 /* ArrowFunction */: - if (sourceFile && childKind === 216 /* ParenthesizedExpression */) { + case 246 /* DoStatement */: + case 247 /* WhileStatement */: + case 249 /* ForInStatement */: + case 250 /* ForOfStatement */: + case 248 /* ForStatement */: + case 245 /* IfStatement */: + case 262 /* FunctionDeclaration */: + case 218 /* FunctionExpression */: + case 174 /* MethodDeclaration */: + case 176 /* Constructor */: + case 177 /* GetAccessor */: + case 178 /* SetAccessor */: + return childKind !== 241 /* Block */; + case 219 /* ArrowFunction */: + if (sourceFile && childKind === 217 /* ParenthesizedExpression */) { return rangeIsOnOneLine(sourceFile, child); } - return childKind !== 240 /* Block */; - case 277 /* ExportDeclaration */: - return childKind !== 278 /* NamedExports */; - case 271 /* ImportDeclaration */: - return childKind !== 272 /* ImportClause */ || !!child.namedBindings && child.namedBindings.kind !== 274 /* NamedImports */; - case 283 /* JsxElement */: - return childKind !== 286 /* JsxClosingElement */; - case 287 /* JsxFragment */: - return childKind !== 289 /* JsxClosingFragment */; - case 192 /* IntersectionType */: - case 191 /* UnionType */: - if (childKind === 186 /* TypeLiteral */ || childKind === 188 /* TupleType */) { + return childKind !== 241 /* Block */; + case 278 /* ExportDeclaration */: + return childKind !== 279 /* NamedExports */; + case 272 /* ImportDeclaration */: + return childKind !== 273 /* ImportClause */ || !!child.namedBindings && child.namedBindings.kind !== 275 /* NamedImports */; + case 284 /* JsxElement */: + return childKind !== 287 /* JsxClosingElement */; + case 288 /* JsxFragment */: + return childKind !== 290 /* JsxClosingFragment */; + case 193 /* IntersectionType */: + case 192 /* UnionType */: + if (childKind === 187 /* TypeLiteral */ || childKind === 189 /* TupleType */) { return false; } break; @@ -169091,11 +171509,11 @@ ${options.prefix}` : "\n" : options.prefix SmartIndenter2.nodeWillIndentChild = nodeWillIndentChild; function isControlFlowEndingStatement(kind, parent2) { switch (kind) { - case 252 /* ReturnStatement */: - case 256 /* ThrowStatement */: - case 250 /* ContinueStatement */: - case 251 /* BreakStatement */: - return parent2.kind !== 240 /* Block */; + case 253 /* ReturnStatement */: + case 257 /* ThrowStatement */: + case 251 /* ContinueStatement */: + case 252 /* BreakStatement */: + return parent2.kind !== 241 /* Block */; default: return false; } @@ -169205,11 +171623,11 @@ ${options.prefix}` : "\n" : options.prefix function getTypeScriptVersion() { return typeScriptVersion2 ?? (typeScriptVersion2 = new Version(version)); } - function formatDeprecationMessage(name, error, errorAfter, since, message) { - let deprecationMessage = error ? "DeprecationError: " : "DeprecationWarning: "; + function formatDeprecationMessage(name, error2, errorAfter, since, message) { + let deprecationMessage = error2 ? "DeprecationError: " : "DeprecationWarning: "; deprecationMessage += `'${name}' `; deprecationMessage += since ? `has been deprecated since v${since}` : "is deprecated"; - deprecationMessage += error ? " and can no longer be used." : errorAfter ? ` and will no longer be usable after v${errorAfter}.` : "."; + deprecationMessage += error2 ? " and can no longer be used." : errorAfter ? ` and will no longer be usable after v${errorAfter}.` : "."; deprecationMessage += message ? ` ${formatStringFromArgs(message, [name], 0)}` : ""; return deprecationMessage; } @@ -169247,9 +171665,9 @@ ${options.prefix}` : "\n" : options.prefix const errorAfter = typeof options.errorAfter === "string" ? new Version(options.errorAfter) : options.errorAfter; const warnAfter = typeof options.warnAfter === "string" ? new Version(options.warnAfter) : options.warnAfter; const since = typeof options.since === "string" ? new Version(options.since) : options.since ?? warnAfter; - const error = options.error || errorAfter && version2.compareTo(errorAfter) >= 0; + const error2 = options.error || errorAfter && version2.compareTo(errorAfter) >= 0; const warn = !warnAfter || version2.compareTo(warnAfter) >= 0; - return error ? createErrorDeprecation(name, errorAfter, since, options.message) : warn ? createWarningDeprecation(name, errorAfter, since, options.message) : noop; + return error2 ? createErrorDeprecation(name, errorAfter, since, options.message) : warn ? createWarningDeprecation(name, errorAfter, since, options.message) : noop; } function wrapFunction(deprecation, func) { return function() { @@ -169329,9 +171747,9 @@ ${options.prefix}` : "\n" : options.prefix init_ts5(); init_deprecate(); addObjectAllocatorPatcher((objectAllocator2) => { - const Identifier74 = objectAllocator2.getIdentifierConstructor(); - if (!hasProperty(Identifier74.prototype, "originalKeywordKind")) { - Object.defineProperty(Identifier74.prototype, "originalKeywordKind", { + const Identifier78 = objectAllocator2.getIdentifierConstructor(); + if (!hasProperty(Identifier78.prototype, "originalKeywordKind")) { + Object.defineProperty(Identifier78.prototype, "originalKeywordKind", { get: deprecate(function() { return identifierToKeywordKind(this); }, { @@ -169343,10 +171761,10 @@ ${options.prefix}` : "\n" : options.prefix }) }); } - if (!hasProperty(Identifier74.prototype, "isInJSDocNamespace")) { - Object.defineProperty(Identifier74.prototype, "isInJSDocNamespace", { + if (!hasProperty(Identifier78.prototype, "isInJSDocNamespace")) { + Object.defineProperty(Identifier78.prototype, "isInJSDocNamespace", { get: deprecate(function() { - return this.flags & 2048 /* IdentifierIsInJSDocNamespace */ ? true : void 0; + return this.flags & 4096 /* IdentifierIsInJSDocNamespace */ ? true : void 0; }, { name: "isInJSDocNamespace", since: "5.0", @@ -169396,6 +171814,7 @@ ${options.prefix}` : "\n" : options.prefix CompletionTriggerKind: () => CompletionTriggerKind, Completions: () => ts_Completions_exports, ConfigFileProgramReloadLevel: () => ConfigFileProgramReloadLevel, + ContainerFlags: () => ContainerFlags, ContextFlags: () => ContextFlags, CoreServicesShimHostAdapter: () => CoreServicesShimHostAdapter, Debug: () => Debug, @@ -169425,6 +171844,8 @@ ${options.prefix}` : "\n" : options.prefix GetLiteralTextFlags: () => GetLiteralTextFlags, GoToDefinition: () => ts_GoToDefinition_exports, HighlightSpanKind: () => HighlightSpanKind, + IdentifierNameMap: () => IdentifierNameMap, + IdentifierNameMultiMap: () => IdentifierNameMultiMap, ImportKind: () => ImportKind, ImportsNotUsedAsValues: () => ImportsNotUsedAsValues, IndentStyle: () => IndentStyle, @@ -169529,6 +171950,7 @@ ${options.prefix}` : "\n" : options.prefix WatchLogLevel: () => WatchLogLevel, WatchType: () => WatchType, accessPrivateIdentifier: () => accessPrivateIdentifier, + addDisposableResourceHelper: () => addDisposableResourceHelper, addEmitFlags: () => addEmitFlags, addEmitHelper: () => addEmitHelper, addEmitHelpers: () => addEmitHelpers, @@ -169608,6 +172030,9 @@ ${options.prefix}` : "\n" : options.prefix changesAffectingProgramStructure: () => changesAffectingProgramStructure, childIsDecorated: () => childIsDecorated, classElementOrClassElementParameterIsDecorated: () => classElementOrClassElementParameterIsDecorated, + classHasClassThisAssignment: () => classHasClassThisAssignment, + classHasDeclaredOrExplicitlyAssignedName: () => classHasDeclaredOrExplicitlyAssignedName, + classHasExplicitlyAssignedName: () => classHasExplicitlyAssignedName, classOrConstructorParameterIsDecorated: () => classOrConstructorParameterIsDecorated, classPrivateFieldGetHelper: () => classPrivateFieldGetHelper, classPrivateFieldInHelper: () => classPrivateFieldInHelper, @@ -169705,6 +172130,8 @@ ${options.prefix}` : "\n" : options.prefix createCacheWithRedirects: () => createCacheWithRedirects, createCacheableExportInfoMap: () => createCacheableExportInfoMap, createCachedDirectoryStructureHost: () => createCachedDirectoryStructureHost, + createClassNamedEvaluationHelperBlock: () => createClassNamedEvaluationHelperBlock, + createClassThisAssignmentBlock: () => createClassThisAssignmentBlock, createClassifier: () => createClassifier, createCommentDirectivesMap: () => createCommentDirectivesMap, createCompilerDiagnostic: () => createCompilerDiagnostic, @@ -169837,6 +172264,7 @@ ${options.prefix}` : "\n" : options.prefix displayPart: () => displayPart, displayPartsToString: () => displayPartsToString, disposeEmitNodes: () => disposeEmitNodes, + disposeResourcesHelper: () => disposeResourcesHelper, documentSpansEqual: () => documentSpansEqual, dumpTracingLegend: () => dumpTracingLegend, elementAt: () => elementAt, @@ -169914,7 +172342,7 @@ ${options.prefix}` : "\n" : options.prefix findPackageJsons: () => findPackageJsons, findPrecedingMatchingToken: () => findPrecedingMatchingToken, findPrecedingToken: () => findPrecedingToken, - findSuperStatementIndex: () => findSuperStatementIndex, + findSuperStatementIndexPath: () => findSuperStatementIndexPath, findTokenOnLeftOfPosition: () => findTokenOnLeftOfPosition, findUseStrictPrologue: () => findUseStrictPrologue, first: () => first, @@ -169989,6 +172417,7 @@ ${options.prefix}` : "\n" : options.prefix getAreDeclarationMapsEnabled: () => getAreDeclarationMapsEnabled, getAssignedExpandoInitializer: () => getAssignedExpandoInitializer, getAssignedName: () => getAssignedName, + getAssignedNameOfIdentifier: () => getAssignedNameOfIdentifier, getAssignmentDeclarationKind: () => getAssignmentDeclarationKind, getAssignmentDeclarationPropertyAccessKind: () => getAssignmentDeclarationPropertyAccessKind, getAssignmentTargetKind: () => getAssignmentTargetKind, @@ -170016,8 +172445,10 @@ ${options.prefix}` : "\n" : options.prefix getConditions: () => getConditions, getConfigFileParsingDiagnostics: () => getConfigFileParsingDiagnostics, getConstantValue: () => getConstantValue, + getContainerFlags: () => getContainerFlags, getContainerNode: () => getContainerNode, getContainingClass: () => getContainingClass, + getContainingClassExcludingClassDecorators: () => getContainingClassExcludingClassDecorators, getContainingClassStaticBlock: () => getContainingClassStaticBlock, getContainingFunction: () => getContainingFunction, getContainingFunctionDeclaration: () => getContainingFunctionDeclaration, @@ -170075,7 +172506,9 @@ ${options.prefix}` : "\n" : options.prefix getEmitModuleKind: () => getEmitModuleKind, getEmitModuleResolutionKind: () => getEmitModuleResolutionKind, getEmitScriptTarget: () => getEmitScriptTarget, + getEmitStandardClassFields: () => getEmitStandardClassFields, getEnclosingBlockScopeContainer: () => getEnclosingBlockScopeContainer, + getEnclosingContainer: () => getEnclosingContainer, getEncodedSemanticClassifications: () => getEncodedSemanticClassifications, getEncodedSyntacticClassifications: () => getEncodedSyntacticClassifications, getEndLinePosition: () => getEndLinePosition, @@ -170293,6 +172726,7 @@ ${options.prefix}` : "\n" : options.prefix getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression, getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode, getPropertyNameForUniqueESSymbol: () => getPropertyNameForUniqueESSymbol, + getPropertyNameFromType: () => getPropertyNameFromType, getPropertyNameOfBindingOrAssignmentElement: () => getPropertyNameOfBindingOrAssignmentElement, getPropertySymbolFromBindingElement: () => getPropertySymbolFromBindingElement, getPropertySymbolsFromContextualType: () => getPropertySymbolsFromContextualType, @@ -170473,6 +172907,8 @@ ${options.prefix}` : "\n" : options.prefix indexOfNode: () => indexOfNode, indicesOf: () => indicesOf, inferredTypesContainingFile: () => inferredTypesContainingFile, + injectClassNamedEvaluationHelperBlockIfMissing: () => injectClassNamedEvaluationHelperBlockIfMissing, + injectClassThisAssignmentIfMissing: () => injectClassThisAssignmentIfMissing, insertImports: () => insertImports, insertLeadingStatement: () => insertLeadingStatement, insertSorted: () => insertSorted, @@ -170575,8 +173011,10 @@ ${options.prefix}` : "\n" : options.prefix isClassExpression: () => isClassExpression, isClassLike: () => isClassLike, isClassMemberModifier: () => isClassMemberModifier, + isClassNamedEvaluationHelperBlock: () => isClassNamedEvaluationHelperBlock, isClassOrTypeElement: () => isClassOrTypeElement, isClassStaticBlockDeclaration: () => isClassStaticBlockDeclaration, + isClassThisAssignmentBlock: () => isClassThisAssignmentBlock, isCollapsedRange: () => isCollapsedRange, isColonToken: () => isColonToken, isCommaExpression: () => isCommaExpression, @@ -170622,6 +173060,7 @@ ${options.prefix}` : "\n" : options.prefix isDiagnosticWithLocation: () => isDiagnosticWithLocation, isDiskPathRoot: () => isDiskPathRoot, isDoStatement: () => isDoStatement, + isDocumentRegistryEntry: () => isDocumentRegistryEntry, isDotDotDotToken: () => isDotDotDotToken, isDottedName: () => isDottedName, isDynamicName: () => isDynamicName, @@ -170672,6 +173111,7 @@ ${options.prefix}` : "\n" : options.prefix isExternalModuleReference: () => isExternalModuleReference, isExternalModuleSymbol: () => isExternalModuleSymbol, isExternalOrCommonJsModule: () => isExternalOrCommonJsModule, + isFileLevelReservedGeneratedIdentifier: () => isFileLevelReservedGeneratedIdentifier, isFileLevelUniqueName: () => isFileLevelUniqueName, isFileProbablyExternalModule: () => isFileProbablyExternalModule, isFirstDeclarationOfSymbolParameter: () => isFirstDeclarationOfSymbolParameter, @@ -170742,6 +173182,7 @@ ${options.prefix}` : "\n" : options.prefix isInString: () => isInString, isInTemplateString: () => isInTemplateString, isInTopLevelContext: () => isInTopLevelContext, + isInTypeQuery: () => isInTypeQuery, isIncrementalCompilation: () => isIncrementalCompilation, isIndexSignatureDeclaration: () => isIndexSignatureDeclaration, isIndexedAccessTypeNode: () => isIndexedAccessTypeNode, @@ -171119,6 +173560,7 @@ ${options.prefix}` : "\n" : options.prefix isTypeQueryNode: () => isTypeQueryNode, isTypeReferenceNode: () => isTypeReferenceNode, isTypeReferenceType: () => isTypeReferenceType, + isTypeUsableAsPropertyName: () => isTypeUsableAsPropertyName, isUMDExportSymbol: () => isUMDExportSymbol, isUnaryExpression: () => isUnaryExpression, isUnaryExpressionWithWrite: () => isUnaryExpressionWithWrite, @@ -171133,7 +173575,9 @@ ${options.prefix}` : "\n" : options.prefix isValidESSymbolDeclaration: () => isValidESSymbolDeclaration, isValidTypeOnlyAliasUseSite: () => isValidTypeOnlyAliasUseSite, isValueSignatureDeclaration: () => isValueSignatureDeclaration, + isVarAwaitUsing: () => isVarAwaitUsing, isVarConst: () => isVarConst, + isVarUsing: () => isVarUsing, isVariableDeclaration: () => isVariableDeclaration, isVariableDeclarationInVariableStatement: () => isVariableDeclarationInVariableStatement, isVariableDeclarationInitializedToBareOrAccessedRequire: () => isVariableDeclarationInitializedToBareOrAccessedRequire, @@ -171545,6 +173989,7 @@ ${options.prefix}` : "\n" : options.prefix transformJsx: () => transformJsx, transformLegacyDecorators: () => transformLegacyDecorators, transformModule: () => transformModule, + transformNamedEvaluation: () => transformNamedEvaluation, transformNodeModule: () => transformNodeModule, transformNodes: () => transformNodes, transformSystemModule: () => transformSystemModule, diff --git a/packages/schematics/angular/utility/latest-versions/package.json b/packages/schematics/angular/utility/latest-versions/package.json index 56da93869aa1..b278db7140f4 100644 --- a/packages/schematics/angular/utility/latest-versions/package.json +++ b/packages/schematics/angular/utility/latest-versions/package.json @@ -18,7 +18,7 @@ "rxjs": "~7.8.0", "tslib": "^2.3.0", "ts-node": "~10.9.0", - "typescript": "~5.1.3", + "typescript": "~5.2.2", "zone.js": "~0.13.0" } } diff --git a/tests/legacy-cli/e2e/tests/build/material.ts b/tests/legacy-cli/e2e/tests/build/material.ts index a010ea834791..92bb46d54b66 100644 --- a/tests/legacy-cli/e2e/tests/build/material.ts +++ b/tests/legacy-cli/e2e/tests/build/material.ts @@ -7,6 +7,9 @@ import { isPrereleaseCli, updateJsonFile } from '../../utils/project'; const snapshots = require('../../ng-snapshot/package.json'); export default async function () { + // TODO(crisbeto): temporarily disabled until Material is updated to TS 5.2 + return; + let tag = (await isPrereleaseCli()) ? '@next' : ''; await ng('add', `@angular/material${tag}`, '--skip-confirmation'); diff --git a/tests/legacy-cli/e2e/tests/commands/add/add-material.ts b/tests/legacy-cli/e2e/tests/commands/add/add-material.ts index bca90ca6c032..56aa2d21f185 100644 --- a/tests/legacy-cli/e2e/tests/commands/add/add-material.ts +++ b/tests/legacy-cli/e2e/tests/commands/add/add-material.ts @@ -5,6 +5,9 @@ import { ng } from '../../../utils/process'; import { isPrereleaseCli } from '../../../utils/project'; export default async function () { + // TODO(crisbeto): temporarily disabled until Material is updated to TS 5.2 + return; + // forcibly remove in case another test doesn't clean itself up await rimraf('node_modules/@angular/material'); diff --git a/tests/legacy-cli/e2e/tests/misc/invalid-schematic-dependencies.ts b/tests/legacy-cli/e2e/tests/misc/invalid-schematic-dependencies.ts index 432f21167cdb..17f5be189ac5 100644 --- a/tests/legacy-cli/e2e/tests/misc/invalid-schematic-dependencies.ts +++ b/tests/legacy-cli/e2e/tests/misc/invalid-schematic-dependencies.ts @@ -4,6 +4,9 @@ import { installPackage, uninstallPackage } from '../../utils/packages'; import { isPrereleaseCli } from '../../utils/project'; export default async function () { + // TODO(crisbeto): temporarily disabled until Material is updated to TS 5.2 + return; + // Must publish old version to local registry to allow install. This is especially important // for release commits as npm will try to request tooling packages that are not on the npm registry yet await publishOutdated('@schematics/angular@7'); diff --git a/yarn.lock b/yarn.lock index 38384cee26c7..d05ad59854f7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12179,6 +12179,11 @@ typescript@5.1.6: resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.6.tgz#02f8ac202b6dad2c0dd5e0913745b47a37998274" integrity sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA== +typescript@5.2.2: + version "5.2.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78" + integrity sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w== + typescript@~4.9.0: version "4.9.5" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a"