typescript 5.0.0-dev.20230223 → 5.0.0-dev.20230225
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +88 -58
- package/lib/tsserver.js +100 -62
- package/lib/tsserverlibrary.js +100 -62
- package/lib/typescript.js +100 -62
- package/lib/typingsInstaller.js +80 -48
- package/package.json +1 -1
package/lib/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.0";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230225`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -8176,12 +8176,10 @@ ${lanes.join("\n")}
|
|
|
8176
8176
|
The_root_value_of_a_0_file_must_be_an_object: diag(5092, 1 /* Error */, "The_root_value_of_a_0_file_must_be_an_object_5092", "The root value of a '{0}' file must be an object."),
|
|
8177
8177
|
Compiler_option_0_may_only_be_used_with_build: diag(5093, 1 /* Error */, "Compiler_option_0_may_only_be_used_with_build_5093", "Compiler option '--{0}' may only be used with '--build'."),
|
|
8178
8178
|
Compiler_option_0_may_not_be_used_with_build: diag(5094, 1 /* Error */, "Compiler_option_0_may_not_be_used_with_build_5094", "Compiler option '--{0}' may not be used with '--build'."),
|
|
8179
|
-
|
|
8179
|
+
Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later: diag(5095, 1 /* Error */, "Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later_5095", "Option '{0}' can only be used when 'module' is set to 'es2015' or later."),
|
|
8180
8180
|
Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set: diag(5096, 1 /* Error */, "Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set_5096", "Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set."),
|
|
8181
8181
|
An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled: diag(5097, 1 /* Error */, "An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled_5097", "An import path can only end with a '{0}' extension when 'allowImportingTsExtensions' is enabled."),
|
|
8182
8182
|
Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler: diag(5098, 1 /* Error */, "Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler_5098", "Option '{0}' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'."),
|
|
8183
|
-
Import_assignment_is_not_allowed_when_moduleResolution_is_set_to_bundler_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: diag(5099, 1 /* Error */, "Import_assignment_is_not_allowed_when_moduleResolution_is_set_to_bundler_Consider_using_import_Aster_5099", `Import assignment is not allowed when 'moduleResolution' is set to 'bundler'. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.`),
|
|
8184
|
-
Export_assignment_cannot_be_used_when_moduleResolution_is_set_to_bundler_Consider_using_export_default_or_another_module_format_instead: diag(5100, 1 /* Error */, "Export_assignment_cannot_be_used_when_moduleResolution_is_set_to_bundler_Consider_using_export_defau_5100", "Export assignment cannot be used when 'moduleResolution' is set to 'bundler'. Consider using 'export default' or another module format instead."),
|
|
8185
8183
|
Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error: diag(5101, 1 /* Error */, "Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecat_5101", `Flag '{0}' is deprecated and will stop functioning in TypeScript {1}. Specify compilerOption '"ignoreDeprecations": "{2}"' to silence this error.`),
|
|
8186
8184
|
Flag_0_is_deprecated_Please_remove_it_from_your_configuration: diag(5102, 1 /* Error */, "Flag_0_is_deprecated_Please_remove_it_from_your_configuration_5102", "Flag '{0}' is deprecated. Please remove it from your configuration."),
|
|
8187
8185
|
Invalid_value_for_ignoreDeprecations: diag(5103, 1 /* Error */, "Invalid_value_for_ignoreDeprecations_5103", "Invalid value for '--ignoreDeprecations'."),
|
|
@@ -28516,6 +28514,34 @@ ${lanes.join("\n")}
|
|
|
28516
28514
|
))
|
|
28517
28515
|
};
|
|
28518
28516
|
var factory2 = createNodeFactory(1 /* NoParenthesizerRules */ | 2 /* NoNodeConverters */ | 8 /* NoOriginalNode */, baseNodeFactory);
|
|
28517
|
+
var {
|
|
28518
|
+
createNodeArray: factoryCreateNodeArray,
|
|
28519
|
+
createNumericLiteral: factoryCreateNumericLiteral,
|
|
28520
|
+
createStringLiteral: factoryCreateStringLiteral,
|
|
28521
|
+
createLiteralLikeNode: factoryCreateLiteralLikeNode,
|
|
28522
|
+
createIdentifier: factoryCreateIdentifier,
|
|
28523
|
+
createPrivateIdentifier: factoryCreatePrivateIdentifier,
|
|
28524
|
+
createToken: factoryCreateToken,
|
|
28525
|
+
createArrayLiteralExpression: factoryCreateArrayLiteralExpression,
|
|
28526
|
+
createObjectLiteralExpression: factoryCreateObjectLiteralExpression,
|
|
28527
|
+
createPropertyAccessExpression: factoryCreatePropertyAccessExpression,
|
|
28528
|
+
createPropertyAccessChain: factoryCreatePropertyAccessChain,
|
|
28529
|
+
createElementAccessExpression: factoryCreateElementAccessExpression,
|
|
28530
|
+
createElementAccessChain: factoryCreateElementAccessChain,
|
|
28531
|
+
createCallExpression: factoryCreateCallExpression,
|
|
28532
|
+
createCallChain: factoryCreateCallChain,
|
|
28533
|
+
createNewExpression: factoryCreateNewExpression,
|
|
28534
|
+
createParenthesizedExpression: factoryCreateParenthesizedExpression,
|
|
28535
|
+
createBlock: factoryCreateBlock,
|
|
28536
|
+
createVariableStatement: factoryCreateVariableStatement,
|
|
28537
|
+
createExpressionStatement: factoryCreateExpressionStatement,
|
|
28538
|
+
createIfStatement: factoryCreateIfStatement,
|
|
28539
|
+
createWhileStatement: factoryCreateWhileStatement,
|
|
28540
|
+
createForStatement: factoryCreateForStatement,
|
|
28541
|
+
createForOfStatement: factoryCreateForOfStatement,
|
|
28542
|
+
createVariableDeclaration: factoryCreateVariableDeclaration,
|
|
28543
|
+
createVariableDeclarationList: factoryCreateVariableDeclarationList
|
|
28544
|
+
} = factory2;
|
|
28519
28545
|
var fileName;
|
|
28520
28546
|
var sourceFlags;
|
|
28521
28547
|
var sourceText;
|
|
@@ -28633,8 +28659,8 @@ ${lanes.join("\n")}
|
|
|
28633
28659
|
}
|
|
28634
28660
|
}
|
|
28635
28661
|
}
|
|
28636
|
-
const expression = isArray(expressions) ? finishNode(
|
|
28637
|
-
const statement =
|
|
28662
|
+
const expression = isArray(expressions) ? finishNode(factoryCreateArrayLiteralExpression(expressions), pos) : Debug.checkDefined(expressions);
|
|
28663
|
+
const statement = factoryCreateExpressionStatement(expression);
|
|
28638
28664
|
finishNode(statement, pos);
|
|
28639
28665
|
statements = createNodeArray([statement], pos);
|
|
28640
28666
|
endOfFileToken = parseExpectedToken(1 /* EndOfFileToken */, Diagnostics.Unexpected_token);
|
|
@@ -28817,7 +28843,7 @@ ${lanes.join("\n")}
|
|
|
28817
28843
|
}
|
|
28818
28844
|
}
|
|
28819
28845
|
syntaxCursor = savedSyntaxCursor;
|
|
28820
|
-
return factory2.updateSourceFile(sourceFile, setTextRange(
|
|
28846
|
+
return factory2.updateSourceFile(sourceFile, setTextRange(factoryCreateNodeArray(statements), sourceFile.statements));
|
|
28821
28847
|
function containsPossibleTopLevelAwait(node) {
|
|
28822
28848
|
return !(node.flags & 32768 /* AwaitContext */) && !!(node.transformFlags & 67108864 /* ContainsPossibleTopLevelAwait */);
|
|
28823
28849
|
}
|
|
@@ -29258,13 +29284,13 @@ ${lanes.join("\n")}
|
|
|
29258
29284
|
const pos = getNodePos();
|
|
29259
29285
|
const kind = token();
|
|
29260
29286
|
nextToken();
|
|
29261
|
-
return finishNode(
|
|
29287
|
+
return finishNode(factoryCreateToken(kind), pos);
|
|
29262
29288
|
}
|
|
29263
29289
|
function parseTokenNodeJSDoc() {
|
|
29264
29290
|
const pos = getNodePos();
|
|
29265
29291
|
const kind = token();
|
|
29266
29292
|
nextTokenJSDoc();
|
|
29267
|
-
return finishNode(
|
|
29293
|
+
return finishNode(factoryCreateToken(kind), pos);
|
|
29268
29294
|
}
|
|
29269
29295
|
function canParseSemicolon() {
|
|
29270
29296
|
if (token() === 26 /* SemicolonToken */) {
|
|
@@ -29285,7 +29311,7 @@ ${lanes.join("\n")}
|
|
|
29285
29311
|
return tryParseSemicolon() || parseExpected(26 /* SemicolonToken */);
|
|
29286
29312
|
}
|
|
29287
29313
|
function createNodeArray(elements, pos, end, hasTrailingComma) {
|
|
29288
|
-
const array =
|
|
29314
|
+
const array = factoryCreateNodeArray(elements, hasTrailingComma);
|
|
29289
29315
|
setTextRangePosEnd(array, pos, end != null ? end : scanner2.getStartPos());
|
|
29290
29316
|
return array;
|
|
29291
29317
|
}
|
|
@@ -29307,7 +29333,7 @@ ${lanes.join("\n")}
|
|
|
29307
29333
|
parseErrorAtCurrentToken(diagnosticMessage, arg0);
|
|
29308
29334
|
}
|
|
29309
29335
|
const pos = getNodePos();
|
|
29310
|
-
const result = kind === 79 /* Identifier */ ?
|
|
29336
|
+
const result = kind === 79 /* Identifier */ ? factoryCreateIdentifier(
|
|
29311
29337
|
"",
|
|
29312
29338
|
/*originalKeywordKind*/
|
|
29313
29339
|
void 0
|
|
@@ -29317,15 +29343,15 @@ ${lanes.join("\n")}
|
|
|
29317
29343
|
"",
|
|
29318
29344
|
/*templateFlags*/
|
|
29319
29345
|
void 0
|
|
29320
|
-
) : kind === 8 /* NumericLiteral */ ?
|
|
29346
|
+
) : kind === 8 /* NumericLiteral */ ? factoryCreateNumericLiteral(
|
|
29321
29347
|
"",
|
|
29322
29348
|
/*numericLiteralFlags*/
|
|
29323
29349
|
void 0
|
|
29324
|
-
) : kind === 10 /* StringLiteral */ ?
|
|
29350
|
+
) : kind === 10 /* StringLiteral */ ? factoryCreateStringLiteral(
|
|
29325
29351
|
"",
|
|
29326
29352
|
/*isSingleQuote*/
|
|
29327
29353
|
void 0
|
|
29328
|
-
) : kind === 279 /* MissingDeclaration */ ? factory2.createMissingDeclaration() :
|
|
29354
|
+
) : kind === 279 /* MissingDeclaration */ ? factory2.createMissingDeclaration() : factoryCreateToken(kind);
|
|
29329
29355
|
return finishNode(result, pos);
|
|
29330
29356
|
}
|
|
29331
29357
|
function internIdentifier(text) {
|
|
@@ -29343,7 +29369,7 @@ ${lanes.join("\n")}
|
|
|
29343
29369
|
const text = internIdentifier(scanner2.getTokenValue());
|
|
29344
29370
|
const hasExtendedUnicodeEscape = scanner2.hasExtendedUnicodeEscape();
|
|
29345
29371
|
nextTokenWithoutCheck();
|
|
29346
|
-
return finishNode(
|
|
29372
|
+
return finishNode(factoryCreateIdentifier(text, originalKeywordKind, hasExtendedUnicodeEscape), pos);
|
|
29347
29373
|
}
|
|
29348
29374
|
if (token() === 80 /* PrivateIdentifier */) {
|
|
29349
29375
|
parseErrorAtCurrentToken(privateIdentifierDiagnosticMessage || Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
|
|
@@ -29414,7 +29440,7 @@ ${lanes.join("\n")}
|
|
|
29414
29440
|
}
|
|
29415
29441
|
function parsePrivateIdentifier() {
|
|
29416
29442
|
const pos = getNodePos();
|
|
29417
|
-
const node =
|
|
29443
|
+
const node = factoryCreatePrivateIdentifier(internIdentifier(scanner2.getTokenValue()));
|
|
29418
29444
|
nextToken();
|
|
29419
29445
|
return finishNode(node, pos);
|
|
29420
29446
|
}
|
|
@@ -30129,12 +30155,12 @@ ${lanes.join("\n")}
|
|
|
30129
30155
|
// never get a token like this. Instead, we would get 00 and 9 as two separate tokens.
|
|
30130
30156
|
// We also do not need to check for negatives because any prefix operator would be part of a
|
|
30131
30157
|
// parent unary expression.
|
|
30132
|
-
kind === 8 /* NumericLiteral */ ?
|
|
30158
|
+
kind === 8 /* NumericLiteral */ ? factoryCreateNumericLiteral(scanner2.getTokenValue(), scanner2.getNumericLiteralFlags()) : kind === 10 /* StringLiteral */ ? factoryCreateStringLiteral(
|
|
30133
30159
|
scanner2.getTokenValue(),
|
|
30134
30160
|
/*isSingleQuote*/
|
|
30135
30161
|
void 0,
|
|
30136
30162
|
scanner2.hasExtendedUnicodeEscape()
|
|
30137
|
-
) : isLiteralKind(kind) ?
|
|
30163
|
+
) : isLiteralKind(kind) ? factoryCreateLiteralLikeNode(kind, scanner2.getTokenValue()) : Debug.fail()
|
|
30138
30164
|
);
|
|
30139
30165
|
if (scanner2.hasExtendedUnicodeEscape()) {
|
|
30140
30166
|
node.hasExtendedUnicodeEscape = true;
|
|
@@ -30725,7 +30751,7 @@ ${lanes.join("\n")}
|
|
|
30725
30751
|
if (token() === 126 /* AbstractKeyword */) {
|
|
30726
30752
|
const pos = getNodePos();
|
|
30727
30753
|
nextToken();
|
|
30728
|
-
const modifier = finishNode(
|
|
30754
|
+
const modifier = finishNode(factoryCreateToken(126 /* AbstractKeyword */), pos);
|
|
30729
30755
|
modifiers = createNodeArray([modifier], pos);
|
|
30730
30756
|
}
|
|
30731
30757
|
return modifiers;
|
|
@@ -31782,7 +31808,7 @@ ${lanes.join("\n")}
|
|
|
31782
31808
|
return expression;
|
|
31783
31809
|
}
|
|
31784
31810
|
parseExpectedToken(24 /* DotToken */, Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);
|
|
31785
|
-
return finishNode(
|
|
31811
|
+
return finishNode(factoryCreatePropertyAccessExpression(expression, parseRightSideOfDot(
|
|
31786
31812
|
/*allowIdentifierNames*/
|
|
31787
31813
|
true,
|
|
31788
31814
|
/*allowPrivateIdentifiers*/
|
|
@@ -31803,7 +31829,7 @@ ${lanes.join("\n")}
|
|
|
31803
31829
|
factory2.createJsxElement(
|
|
31804
31830
|
lastChild.openingElement,
|
|
31805
31831
|
lastChild.children,
|
|
31806
|
-
finishNode(factory2.createJsxClosingElement(finishNode(
|
|
31832
|
+
finishNode(factory2.createJsxClosingElement(finishNode(factoryCreateIdentifier(""), end, end)), end, end)
|
|
31807
31833
|
),
|
|
31808
31834
|
lastChild.openingElement.pos,
|
|
31809
31835
|
end
|
|
@@ -31946,7 +31972,7 @@ ${lanes.join("\n")}
|
|
|
31946
31972
|
scanJsxIdentifier();
|
|
31947
31973
|
let expression = token() === 108 /* ThisKeyword */ ? parseTokenNode() : parseIdentifierName();
|
|
31948
31974
|
while (parseOptional(24 /* DotToken */)) {
|
|
31949
|
-
expression = finishNode(
|
|
31975
|
+
expression = finishNode(factoryCreatePropertyAccessExpression(expression, parseRightSideOfDot(
|
|
31950
31976
|
/*allowIdentifierNames*/
|
|
31951
31977
|
true,
|
|
31952
31978
|
/*allowPrivateIdentifiers*/
|
|
@@ -32097,7 +32123,7 @@ ${lanes.join("\n")}
|
|
|
32097
32123
|
true
|
|
32098
32124
|
);
|
|
32099
32125
|
const isOptionalChain2 = questionDotToken || tryReparseOptionalChain(expression);
|
|
32100
|
-
const propertyAccess = isOptionalChain2 ?
|
|
32126
|
+
const propertyAccess = isOptionalChain2 ? factoryCreatePropertyAccessChain(expression, questionDotToken, name) : factoryCreatePropertyAccessExpression(expression, name);
|
|
32101
32127
|
if (isOptionalChain2 && isPrivateIdentifier(propertyAccess.name)) {
|
|
32102
32128
|
parseErrorAtRange(propertyAccess.name, Diagnostics.An_optional_chain_cannot_contain_private_identifiers);
|
|
32103
32129
|
}
|
|
@@ -32125,7 +32151,7 @@ ${lanes.join("\n")}
|
|
|
32125
32151
|
argumentExpression = argument;
|
|
32126
32152
|
}
|
|
32127
32153
|
parseExpected(23 /* CloseBracketToken */);
|
|
32128
|
-
const indexedAccess = questionDotToken || tryReparseOptionalChain(expression) ?
|
|
32154
|
+
const indexedAccess = questionDotToken || tryReparseOptionalChain(expression) ? factoryCreateElementAccessChain(expression, questionDotToken, argumentExpression) : factoryCreateElementAccessExpression(expression, argumentExpression);
|
|
32129
32155
|
return finishNode(indexedAccess, pos);
|
|
32130
32156
|
}
|
|
32131
32157
|
function parseMemberExpressionRest(pos, expression, allowOptionalChain) {
|
|
@@ -32212,7 +32238,7 @@ ${lanes.join("\n")}
|
|
|
32212
32238
|
expression = expression.expression;
|
|
32213
32239
|
}
|
|
32214
32240
|
const argumentList = parseArgumentList();
|
|
32215
|
-
const callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
|
|
32241
|
+
const callExpr = questionDotToken || tryReparseOptionalChain(expression) ? factoryCreateCallChain(expression, questionDotToken, typeArguments, argumentList) : factoryCreateCallExpression(expression, typeArguments, argumentList);
|
|
32216
32242
|
expression = finishNode(callExpr, pos);
|
|
32217
32243
|
continue;
|
|
32218
32244
|
}
|
|
@@ -32223,7 +32249,7 @@ ${lanes.join("\n")}
|
|
|
32223
32249
|
false,
|
|
32224
32250
|
Diagnostics.Identifier_expected
|
|
32225
32251
|
);
|
|
32226
|
-
expression = finishNode(
|
|
32252
|
+
expression = finishNode(factoryCreatePropertyAccessChain(expression, questionDotToken, name), pos);
|
|
32227
32253
|
}
|
|
32228
32254
|
break;
|
|
32229
32255
|
}
|
|
@@ -32318,7 +32344,7 @@ ${lanes.join("\n")}
|
|
|
32318
32344
|
parseExpected(20 /* OpenParenToken */);
|
|
32319
32345
|
const expression = allowInAnd(parseExpression);
|
|
32320
32346
|
parseExpected(21 /* CloseParenToken */);
|
|
32321
|
-
return withJSDoc(finishNode(
|
|
32347
|
+
return withJSDoc(finishNode(factoryCreateParenthesizedExpression(expression), pos), hasJSDoc);
|
|
32322
32348
|
}
|
|
32323
32349
|
function parseSpreadElement() {
|
|
32324
32350
|
const pos = getNodePos();
|
|
@@ -32345,7 +32371,7 @@ ${lanes.join("\n")}
|
|
|
32345
32371
|
const multiLine = scanner2.hasPrecedingLineBreak();
|
|
32346
32372
|
const elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement);
|
|
32347
32373
|
parseExpectedMatchingBrackets(22 /* OpenBracketToken */, 23 /* CloseBracketToken */, openBracketParsed, openBracketPosition);
|
|
32348
|
-
return finishNode(
|
|
32374
|
+
return finishNode(factoryCreateArrayLiteralExpression(elements, multiLine), pos);
|
|
32349
32375
|
}
|
|
32350
32376
|
function parseObjectLiteralElement() {
|
|
32351
32377
|
const pos = getNodePos();
|
|
@@ -32410,7 +32436,7 @@ ${lanes.join("\n")}
|
|
|
32410
32436
|
true
|
|
32411
32437
|
);
|
|
32412
32438
|
parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
|
|
32413
|
-
return finishNode(
|
|
32439
|
+
return finishNode(factoryCreateObjectLiteralExpression(properties, multiLine), pos);
|
|
32414
32440
|
}
|
|
32415
32441
|
function parseFunctionExpression() {
|
|
32416
32442
|
const savedDecoratorContext = inDecoratorContext();
|
|
@@ -32467,7 +32493,7 @@ ${lanes.join("\n")}
|
|
|
32467
32493
|
parseErrorAtCurrentToken(Diagnostics.Invalid_optional_chain_from_new_expression_Did_you_mean_to_call_0, getTextOfNodeFromSourceText(sourceText, expression));
|
|
32468
32494
|
}
|
|
32469
32495
|
const argumentList = token() === 20 /* OpenParenToken */ ? parseArgumentList() : void 0;
|
|
32470
|
-
return finishNode(
|
|
32496
|
+
return finishNode(factoryCreateNewExpression(expression, typeArguments, argumentList), pos);
|
|
32471
32497
|
}
|
|
32472
32498
|
function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) {
|
|
32473
32499
|
const pos = getNodePos();
|
|
@@ -32478,7 +32504,7 @@ ${lanes.join("\n")}
|
|
|
32478
32504
|
const multiLine = scanner2.hasPrecedingLineBreak();
|
|
32479
32505
|
const statements = parseList(1 /* BlockStatements */, parseStatement);
|
|
32480
32506
|
parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
|
|
32481
|
-
const result = withJSDoc(finishNode(
|
|
32507
|
+
const result = withJSDoc(finishNode(factoryCreateBlock(statements, multiLine), pos), hasJSDoc);
|
|
32482
32508
|
if (token() === 63 /* EqualsToken */) {
|
|
32483
32509
|
parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_whole_assignment_in_parentheses);
|
|
32484
32510
|
nextToken();
|
|
@@ -32486,7 +32512,7 @@ ${lanes.join("\n")}
|
|
|
32486
32512
|
return result;
|
|
32487
32513
|
} else {
|
|
32488
32514
|
const statements = createMissingList();
|
|
32489
|
-
return withJSDoc(finishNode(
|
|
32515
|
+
return withJSDoc(finishNode(factoryCreateBlock(
|
|
32490
32516
|
statements,
|
|
32491
32517
|
/*multiLine*/
|
|
32492
32518
|
void 0
|
|
@@ -32535,7 +32561,7 @@ ${lanes.join("\n")}
|
|
|
32535
32561
|
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
|
|
32536
32562
|
const thenStatement = parseStatement();
|
|
32537
32563
|
const elseStatement = parseOptional(91 /* ElseKeyword */) ? parseStatement() : void 0;
|
|
32538
|
-
return withJSDoc(finishNode(
|
|
32564
|
+
return withJSDoc(finishNode(factoryCreateIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc);
|
|
32539
32565
|
}
|
|
32540
32566
|
function parseDoStatement() {
|
|
32541
32567
|
const pos = getNodePos();
|
|
@@ -32559,7 +32585,7 @@ ${lanes.join("\n")}
|
|
|
32559
32585
|
const expression = allowInAnd(parseExpression);
|
|
32560
32586
|
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
|
|
32561
32587
|
const statement = parseStatement();
|
|
32562
|
-
return withJSDoc(finishNode(
|
|
32588
|
+
return withJSDoc(finishNode(factoryCreateWhileStatement(expression, statement), pos), hasJSDoc);
|
|
32563
32589
|
}
|
|
32564
32590
|
function parseForOrForInOrForOfStatement() {
|
|
32565
32591
|
const pos = getNodePos();
|
|
@@ -32585,7 +32611,7 @@ ${lanes.join("\n")}
|
|
|
32585
32611
|
true
|
|
32586
32612
|
));
|
|
32587
32613
|
parseExpected(21 /* CloseParenToken */);
|
|
32588
|
-
node =
|
|
32614
|
+
node = factoryCreateForOfStatement(awaitToken, initializer, expression, parseStatement());
|
|
32589
32615
|
} else if (parseOptional(101 /* InKeyword */)) {
|
|
32590
32616
|
const expression = allowInAnd(parseExpression);
|
|
32591
32617
|
parseExpected(21 /* CloseParenToken */);
|
|
@@ -32596,7 +32622,7 @@ ${lanes.join("\n")}
|
|
|
32596
32622
|
parseExpected(26 /* SemicolonToken */);
|
|
32597
32623
|
const incrementor = token() !== 21 /* CloseParenToken */ ? allowInAnd(parseExpression) : void 0;
|
|
32598
32624
|
parseExpected(21 /* CloseParenToken */);
|
|
32599
|
-
node =
|
|
32625
|
+
node = factoryCreateForStatement(initializer, condition, incrementor, parseStatement());
|
|
32600
32626
|
}
|
|
32601
32627
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
32602
32628
|
}
|
|
@@ -32671,7 +32697,7 @@ ${lanes.join("\n")}
|
|
|
32671
32697
|
let expression = scanner2.hasPrecedingLineBreak() ? void 0 : allowInAnd(parseExpression);
|
|
32672
32698
|
if (expression === void 0) {
|
|
32673
32699
|
identifierCount++;
|
|
32674
|
-
expression = finishNode(
|
|
32700
|
+
expression = finishNode(factoryCreateIdentifier(""), getNodePos());
|
|
32675
32701
|
}
|
|
32676
32702
|
if (!tryParseSemicolon()) {
|
|
32677
32703
|
parseErrorForMissingSemicolonAfter(expression);
|
|
@@ -32732,7 +32758,7 @@ ${lanes.join("\n")}
|
|
|
32732
32758
|
if (!tryParseSemicolon()) {
|
|
32733
32759
|
parseErrorForMissingSemicolonAfter(expression);
|
|
32734
32760
|
}
|
|
32735
|
-
node =
|
|
32761
|
+
node = factoryCreateExpressionStatement(expression);
|
|
32736
32762
|
if (hasParen) {
|
|
32737
32763
|
hasJSDoc = false;
|
|
32738
32764
|
}
|
|
@@ -33130,7 +33156,7 @@ ${lanes.join("\n")}
|
|
|
33130
33156
|
}
|
|
33131
33157
|
const type = parseTypeAnnotation();
|
|
33132
33158
|
const initializer = isInOrOfKeyword(token()) ? void 0 : parseInitializer();
|
|
33133
|
-
const node =
|
|
33159
|
+
const node = factoryCreateVariableDeclaration(name, exclamationToken, type, initializer);
|
|
33134
33160
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
33135
33161
|
}
|
|
33136
33162
|
function parseVariableDeclarationList(inForStatementInitializer) {
|
|
@@ -33161,7 +33187,7 @@ ${lanes.join("\n")}
|
|
|
33161
33187
|
);
|
|
33162
33188
|
setDisallowInContext(savedDisallowIn);
|
|
33163
33189
|
}
|
|
33164
|
-
return finishNode(
|
|
33190
|
+
return finishNode(factoryCreateVariableDeclarationList(declarations, flags), pos);
|
|
33165
33191
|
}
|
|
33166
33192
|
function canFollowContextualOfKeyword() {
|
|
33167
33193
|
return nextTokenIsIdentifier() && nextToken() === 21 /* CloseParenToken */;
|
|
@@ -33172,7 +33198,7 @@ ${lanes.join("\n")}
|
|
|
33172
33198
|
false
|
|
33173
33199
|
);
|
|
33174
33200
|
parseSemicolon();
|
|
33175
|
-
const node =
|
|
33201
|
+
const node = factoryCreateVariableStatement(modifiers, declarationList);
|
|
33176
33202
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
33177
33203
|
}
|
|
33178
33204
|
function parseFunctionDeclaration(pos, hasJSDoc, modifiers) {
|
|
@@ -33401,7 +33427,7 @@ ${lanes.join("\n")}
|
|
|
33401
33427
|
return void 0;
|
|
33402
33428
|
}
|
|
33403
33429
|
}
|
|
33404
|
-
return finishNode(
|
|
33430
|
+
return finishNode(factoryCreateToken(kind), pos);
|
|
33405
33431
|
}
|
|
33406
33432
|
function parseModifiers(allowDecorators, permitConstAsModifier, stopOnStartOfClassStaticBlock) {
|
|
33407
33433
|
const pos = getNodePos();
|
|
@@ -33438,7 +33464,7 @@ ${lanes.join("\n")}
|
|
|
33438
33464
|
if (token() === 132 /* AsyncKeyword */) {
|
|
33439
33465
|
const pos = getNodePos();
|
|
33440
33466
|
nextToken();
|
|
33441
|
-
const modifier = finishNode(
|
|
33467
|
+
const modifier = finishNode(factoryCreateToken(132 /* AsyncKeyword */), pos);
|
|
33442
33468
|
modifiers = createNodeArray([modifier], pos);
|
|
33443
33469
|
}
|
|
33444
33470
|
return modifiers;
|
|
@@ -34025,7 +34051,7 @@ ${lanes.join("\n")}
|
|
|
34025
34051
|
/*isDeclarationFile*/
|
|
34026
34052
|
false,
|
|
34027
34053
|
[],
|
|
34028
|
-
|
|
34054
|
+
factoryCreateToken(1 /* EndOfFileToken */),
|
|
34029
34055
|
0 /* None */,
|
|
34030
34056
|
noop
|
|
34031
34057
|
);
|
|
@@ -34686,7 +34712,7 @@ ${lanes.join("\n")}
|
|
|
34686
34712
|
let node = parseJSDocIdentifierName();
|
|
34687
34713
|
while (parseOptional(24 /* DotToken */)) {
|
|
34688
34714
|
const name = parseJSDocIdentifierName();
|
|
34689
|
-
node = finishNode(
|
|
34715
|
+
node = finishNode(factoryCreatePropertyAccessExpression(node, name), pos);
|
|
34690
34716
|
}
|
|
34691
34717
|
return node;
|
|
34692
34718
|
}
|
|
@@ -34977,7 +35003,7 @@ ${lanes.join("\n")}
|
|
|
34977
35003
|
const end2 = scanner2.getTextPos();
|
|
34978
35004
|
const originalKeywordKind = token();
|
|
34979
35005
|
const text = internIdentifier(scanner2.getTokenValue());
|
|
34980
|
-
const result = finishNode(
|
|
35006
|
+
const result = finishNode(factoryCreateIdentifier(text, originalKeywordKind), pos, end2);
|
|
34981
35007
|
nextTokenJSDoc();
|
|
34982
35008
|
return result;
|
|
34983
35009
|
}
|
|
@@ -39064,10 +39090,13 @@ ${lanes.join("\n")}
|
|
|
39064
39090
|
return features;
|
|
39065
39091
|
}
|
|
39066
39092
|
function getConditions(options, esmMode) {
|
|
39067
|
-
const conditions = esmMode || getEmitModuleResolutionKind(options) === 100 /* Bundler */ ? ["
|
|
39093
|
+
const conditions = esmMode || getEmitModuleResolutionKind(options) === 100 /* Bundler */ ? ["import"] : ["require"];
|
|
39068
39094
|
if (!options.noDtsResolution) {
|
|
39069
39095
|
conditions.push("types");
|
|
39070
39096
|
}
|
|
39097
|
+
if (getEmitModuleResolutionKind(options) !== 100 /* Bundler */) {
|
|
39098
|
+
conditions.push("node");
|
|
39099
|
+
}
|
|
39071
39100
|
return concatenate(conditions, options.customConditions);
|
|
39072
39101
|
}
|
|
39073
39102
|
function resolvePackageNameToPackageJson(packageName, containingDirectory, options, host, cache) {
|
|
@@ -39781,7 +39810,7 @@ ${lanes.join("\n")}
|
|
|
39781
39810
|
isConfigLookup,
|
|
39782
39811
|
candidateIsFromPackageJsonField: false
|
|
39783
39812
|
};
|
|
39784
|
-
if (traceEnabled &&
|
|
39813
|
+
if (traceEnabled && moduleResolutionSupportsPackageJsonExportsAndImports(getEmitModuleResolutionKind(compilerOptions))) {
|
|
39785
39814
|
trace(host, Diagnostics.Resolving_in_0_mode_with_conditions_1, features & 32 /* EsmMode */ ? "ESM" : "CJS", conditions.map((c) => `'${c}'`).join(", "));
|
|
39786
39815
|
}
|
|
39787
39816
|
let result;
|
|
@@ -48217,7 +48246,9 @@ ${lanes.join("\n")}
|
|
|
48217
48246
|
function getSuggestedImportSource(tsExtension) {
|
|
48218
48247
|
const importSourceWithoutExtension = removeExtension(moduleReference, tsExtension);
|
|
48219
48248
|
if (emitModuleKindIsNonNodeESM(moduleKind) || mode === 99 /* ESNext */) {
|
|
48220
|
-
|
|
48249
|
+
const preferTs = isDeclarationFileName(moduleReference) && shouldAllowImportingTsExtension(compilerOptions);
|
|
48250
|
+
const ext = tsExtension === ".mts" /* Mts */ || tsExtension === ".d.mts" /* Dmts */ ? preferTs ? ".mts" : ".mjs" : tsExtension === ".cts" /* Cts */ || tsExtension === ".d.mts" /* Dmts */ ? preferTs ? ".cts" : ".cjs" : preferTs ? ".ts" : ".js";
|
|
48251
|
+
return importSourceWithoutExtension + ext;
|
|
48221
48252
|
}
|
|
48222
48253
|
return importSourceWithoutExtension;
|
|
48223
48254
|
}
|
|
@@ -81210,8 +81241,6 @@ ${lanes.join("\n")}
|
|
|
81210
81241
|
} else {
|
|
81211
81242
|
if (moduleKind >= 5 /* ES2015 */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 16777216 /* Ambient */)) {
|
|
81212
81243
|
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);
|
|
81213
|
-
} else if (!(node.flags & 16777216 /* Ambient */) && getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */) {
|
|
81214
|
-
grammarErrorOnNode(node, Diagnostics.Import_assignment_is_not_allowed_when_moduleResolution_is_set_to_bundler_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
|
|
81215
81244
|
}
|
|
81216
81245
|
}
|
|
81217
81246
|
}
|
|
@@ -81418,8 +81447,6 @@ ${lanes.join("\n")}
|
|
|
81418
81447
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
|
|
81419
81448
|
} else if (moduleKind === 4 /* System */ && !(node.flags & 16777216 /* Ambient */)) {
|
|
81420
81449
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
|
|
81421
|
-
} else if (getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */ && !(node.flags & 16777216 /* Ambient */)) {
|
|
81422
|
-
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_moduleResolution_is_set_to_bundler_Consider_using_export_default_or_another_module_format_instead);
|
|
81423
81450
|
}
|
|
81424
81451
|
}
|
|
81425
81452
|
}
|
|
@@ -118102,10 +118129,10 @@ ${lanes.join("\n")}
|
|
|
118102
118129
|
}
|
|
118103
118130
|
}
|
|
118104
118131
|
if (options.preserveValueImports && getEmitModuleKind(options) < 5 /* ES2015 */) {
|
|
118105
|
-
createDiagnosticForOptionName(Diagnostics.
|
|
118132
|
+
createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later, "preserveValueImports");
|
|
118106
118133
|
}
|
|
118134
|
+
const moduleKind = getEmitModuleKind(options);
|
|
118107
118135
|
if (options.verbatimModuleSyntax) {
|
|
118108
|
-
const moduleKind = getEmitModuleKind(options);
|
|
118109
118136
|
if (moduleKind === 2 /* AMD */ || moduleKind === 3 /* UMD */ || moduleKind === 4 /* System */) {
|
|
118110
118137
|
createDiagnosticForOptionName(Diagnostics.Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System, "verbatimModuleSyntax");
|
|
118111
118138
|
}
|
|
@@ -118124,13 +118151,16 @@ ${lanes.join("\n")}
|
|
|
118124
118151
|
}
|
|
118125
118152
|
const moduleResolution = getEmitModuleResolutionKind(options);
|
|
118126
118153
|
if (options.resolvePackageJsonExports && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
|
|
118127
|
-
|
|
118154
|
+
createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "resolvePackageJsonExports");
|
|
118128
118155
|
}
|
|
118129
118156
|
if (options.resolvePackageJsonImports && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
|
|
118130
|
-
|
|
118157
|
+
createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "resolvePackageJsonImports");
|
|
118131
118158
|
}
|
|
118132
118159
|
if (options.customConditions && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
|
|
118133
|
-
|
|
118160
|
+
createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "customConditions");
|
|
118161
|
+
}
|
|
118162
|
+
if (moduleResolution === 100 /* Bundler */ && !emitModuleKindIsNonNodeESM(moduleKind)) {
|
|
118163
|
+
createOptionValueDiagnostic("moduleResolution", Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later, "bundler");
|
|
118134
118164
|
}
|
|
118135
118165
|
if (!options.noEmit && !options.suppressOutputPathCheck) {
|
|
118136
118166
|
const emitHost = getEmitHost();
|
|
@@ -150998,7 +151028,7 @@ ${lanes.join("\n")}
|
|
|
150998
151028
|
if (isObjectLiteralExpression(parent2.parent) && parent2.name === node) {
|
|
150999
151029
|
return stringLiteralCompletionsForObjectLiteral(typeChecker, parent2.parent);
|
|
151000
151030
|
}
|
|
151001
|
-
return fromContextualType();
|
|
151031
|
+
return fromContextualType() || fromContextualType(0 /* None */);
|
|
151002
151032
|
case 209 /* ElementAccessExpression */: {
|
|
151003
151033
|
const { expression, argumentExpression } = parent2;
|
|
151004
151034
|
if (node === skipParentheses(argumentExpression)) {
|
|
@@ -151019,13 +151049,21 @@ ${lanes.join("\n")}
|
|
|
151019
151049
|
return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) };
|
|
151020
151050
|
case 292 /* CaseClause */:
|
|
151021
151051
|
const tracker = newCaseClauseTracker(typeChecker, parent2.parent.clauses);
|
|
151022
|
-
const
|
|
151052
|
+
const contextualTypes = fromContextualType();
|
|
151053
|
+
if (!contextualTypes) {
|
|
151054
|
+
return;
|
|
151055
|
+
}
|
|
151056
|
+
const literals = contextualTypes.types.filter((literal) => !tracker.hasValue(literal.value));
|
|
151023
151057
|
return { kind: 2 /* Types */, types: literals, isNewIdentifier: false };
|
|
151024
151058
|
default:
|
|
151025
151059
|
return fromContextualType();
|
|
151026
151060
|
}
|
|
151027
|
-
function fromContextualType() {
|
|
151028
|
-
|
|
151061
|
+
function fromContextualType(contextFlags = 4 /* Completions */) {
|
|
151062
|
+
const types = getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker, contextFlags));
|
|
151063
|
+
if (!types.length) {
|
|
151064
|
+
return;
|
|
151065
|
+
}
|
|
151066
|
+
return { kind: 2 /* Types */, types, isNewIdentifier: false };
|
|
151029
151067
|
}
|
|
151030
151068
|
}
|
|
151031
151069
|
function walkUpParentheses(node) {
|