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/tsserver.js
CHANGED
|
@@ -2288,7 +2288,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2288
2288
|
|
|
2289
2289
|
// src/compiler/corePublic.ts
|
|
2290
2290
|
var versionMajorMinor = "5.0";
|
|
2291
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2291
|
+
var version = `${versionMajorMinor}.0-dev.20230225`;
|
|
2292
2292
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2293
2293
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2294
2294
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -10354,12 +10354,10 @@ var Diagnostics = {
|
|
|
10354
10354
|
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."),
|
|
10355
10355
|
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'."),
|
|
10356
10356
|
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'."),
|
|
10357
|
-
|
|
10357
|
+
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."),
|
|
10358
10358
|
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."),
|
|
10359
10359
|
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."),
|
|
10360
10360
|
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'."),
|
|
10361
|
-
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.`),
|
|
10362
|
-
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."),
|
|
10363
10361
|
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.`),
|
|
10364
10362
|
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."),
|
|
10365
10363
|
Invalid_value_for_ignoreDeprecations: diag(5103, 1 /* Error */, "Invalid_value_for_ignoreDeprecations_5103", "Invalid value for '--ignoreDeprecations'."),
|
|
@@ -30406,6 +30404,34 @@ var Parser;
|
|
|
30406
30404
|
))
|
|
30407
30405
|
};
|
|
30408
30406
|
var factory2 = createNodeFactory(1 /* NoParenthesizerRules */ | 2 /* NoNodeConverters */ | 8 /* NoOriginalNode */, baseNodeFactory);
|
|
30407
|
+
var {
|
|
30408
|
+
createNodeArray: factoryCreateNodeArray,
|
|
30409
|
+
createNumericLiteral: factoryCreateNumericLiteral,
|
|
30410
|
+
createStringLiteral: factoryCreateStringLiteral,
|
|
30411
|
+
createLiteralLikeNode: factoryCreateLiteralLikeNode,
|
|
30412
|
+
createIdentifier: factoryCreateIdentifier,
|
|
30413
|
+
createPrivateIdentifier: factoryCreatePrivateIdentifier,
|
|
30414
|
+
createToken: factoryCreateToken,
|
|
30415
|
+
createArrayLiteralExpression: factoryCreateArrayLiteralExpression,
|
|
30416
|
+
createObjectLiteralExpression: factoryCreateObjectLiteralExpression,
|
|
30417
|
+
createPropertyAccessExpression: factoryCreatePropertyAccessExpression,
|
|
30418
|
+
createPropertyAccessChain: factoryCreatePropertyAccessChain,
|
|
30419
|
+
createElementAccessExpression: factoryCreateElementAccessExpression,
|
|
30420
|
+
createElementAccessChain: factoryCreateElementAccessChain,
|
|
30421
|
+
createCallExpression: factoryCreateCallExpression,
|
|
30422
|
+
createCallChain: factoryCreateCallChain,
|
|
30423
|
+
createNewExpression: factoryCreateNewExpression,
|
|
30424
|
+
createParenthesizedExpression: factoryCreateParenthesizedExpression,
|
|
30425
|
+
createBlock: factoryCreateBlock,
|
|
30426
|
+
createVariableStatement: factoryCreateVariableStatement,
|
|
30427
|
+
createExpressionStatement: factoryCreateExpressionStatement,
|
|
30428
|
+
createIfStatement: factoryCreateIfStatement,
|
|
30429
|
+
createWhileStatement: factoryCreateWhileStatement,
|
|
30430
|
+
createForStatement: factoryCreateForStatement,
|
|
30431
|
+
createForOfStatement: factoryCreateForOfStatement,
|
|
30432
|
+
createVariableDeclaration: factoryCreateVariableDeclaration,
|
|
30433
|
+
createVariableDeclarationList: factoryCreateVariableDeclarationList
|
|
30434
|
+
} = factory2;
|
|
30409
30435
|
var fileName;
|
|
30410
30436
|
var sourceFlags;
|
|
30411
30437
|
var sourceText;
|
|
@@ -30523,8 +30549,8 @@ var Parser;
|
|
|
30523
30549
|
}
|
|
30524
30550
|
}
|
|
30525
30551
|
}
|
|
30526
|
-
const expression = isArray(expressions) ? finishNode(
|
|
30527
|
-
const statement =
|
|
30552
|
+
const expression = isArray(expressions) ? finishNode(factoryCreateArrayLiteralExpression(expressions), pos) : Debug.checkDefined(expressions);
|
|
30553
|
+
const statement = factoryCreateExpressionStatement(expression);
|
|
30528
30554
|
finishNode(statement, pos);
|
|
30529
30555
|
statements = createNodeArray([statement], pos);
|
|
30530
30556
|
endOfFileToken = parseExpectedToken(1 /* EndOfFileToken */, Diagnostics.Unexpected_token);
|
|
@@ -30707,7 +30733,7 @@ var Parser;
|
|
|
30707
30733
|
}
|
|
30708
30734
|
}
|
|
30709
30735
|
syntaxCursor = savedSyntaxCursor;
|
|
30710
|
-
return factory2.updateSourceFile(sourceFile, setTextRange(
|
|
30736
|
+
return factory2.updateSourceFile(sourceFile, setTextRange(factoryCreateNodeArray(statements), sourceFile.statements));
|
|
30711
30737
|
function containsPossibleTopLevelAwait(node) {
|
|
30712
30738
|
return !(node.flags & 32768 /* AwaitContext */) && !!(node.transformFlags & 67108864 /* ContainsPossibleTopLevelAwait */);
|
|
30713
30739
|
}
|
|
@@ -31148,13 +31174,13 @@ var Parser;
|
|
|
31148
31174
|
const pos = getNodePos();
|
|
31149
31175
|
const kind = token();
|
|
31150
31176
|
nextToken();
|
|
31151
|
-
return finishNode(
|
|
31177
|
+
return finishNode(factoryCreateToken(kind), pos);
|
|
31152
31178
|
}
|
|
31153
31179
|
function parseTokenNodeJSDoc() {
|
|
31154
31180
|
const pos = getNodePos();
|
|
31155
31181
|
const kind = token();
|
|
31156
31182
|
nextTokenJSDoc();
|
|
31157
|
-
return finishNode(
|
|
31183
|
+
return finishNode(factoryCreateToken(kind), pos);
|
|
31158
31184
|
}
|
|
31159
31185
|
function canParseSemicolon() {
|
|
31160
31186
|
if (token() === 26 /* SemicolonToken */) {
|
|
@@ -31175,7 +31201,7 @@ var Parser;
|
|
|
31175
31201
|
return tryParseSemicolon() || parseExpected(26 /* SemicolonToken */);
|
|
31176
31202
|
}
|
|
31177
31203
|
function createNodeArray(elements, pos, end, hasTrailingComma) {
|
|
31178
|
-
const array =
|
|
31204
|
+
const array = factoryCreateNodeArray(elements, hasTrailingComma);
|
|
31179
31205
|
setTextRangePosEnd(array, pos, end != null ? end : scanner2.getStartPos());
|
|
31180
31206
|
return array;
|
|
31181
31207
|
}
|
|
@@ -31197,7 +31223,7 @@ var Parser;
|
|
|
31197
31223
|
parseErrorAtCurrentToken(diagnosticMessage, arg0);
|
|
31198
31224
|
}
|
|
31199
31225
|
const pos = getNodePos();
|
|
31200
|
-
const result = kind === 79 /* Identifier */ ?
|
|
31226
|
+
const result = kind === 79 /* Identifier */ ? factoryCreateIdentifier(
|
|
31201
31227
|
"",
|
|
31202
31228
|
/*originalKeywordKind*/
|
|
31203
31229
|
void 0
|
|
@@ -31207,15 +31233,15 @@ var Parser;
|
|
|
31207
31233
|
"",
|
|
31208
31234
|
/*templateFlags*/
|
|
31209
31235
|
void 0
|
|
31210
|
-
) : kind === 8 /* NumericLiteral */ ?
|
|
31236
|
+
) : kind === 8 /* NumericLiteral */ ? factoryCreateNumericLiteral(
|
|
31211
31237
|
"",
|
|
31212
31238
|
/*numericLiteralFlags*/
|
|
31213
31239
|
void 0
|
|
31214
|
-
) : kind === 10 /* StringLiteral */ ?
|
|
31240
|
+
) : kind === 10 /* StringLiteral */ ? factoryCreateStringLiteral(
|
|
31215
31241
|
"",
|
|
31216
31242
|
/*isSingleQuote*/
|
|
31217
31243
|
void 0
|
|
31218
|
-
) : kind === 279 /* MissingDeclaration */ ? factory2.createMissingDeclaration() :
|
|
31244
|
+
) : kind === 279 /* MissingDeclaration */ ? factory2.createMissingDeclaration() : factoryCreateToken(kind);
|
|
31219
31245
|
return finishNode(result, pos);
|
|
31220
31246
|
}
|
|
31221
31247
|
function internIdentifier(text) {
|
|
@@ -31233,7 +31259,7 @@ var Parser;
|
|
|
31233
31259
|
const text = internIdentifier(scanner2.getTokenValue());
|
|
31234
31260
|
const hasExtendedUnicodeEscape = scanner2.hasExtendedUnicodeEscape();
|
|
31235
31261
|
nextTokenWithoutCheck();
|
|
31236
|
-
return finishNode(
|
|
31262
|
+
return finishNode(factoryCreateIdentifier(text, originalKeywordKind, hasExtendedUnicodeEscape), pos);
|
|
31237
31263
|
}
|
|
31238
31264
|
if (token() === 80 /* PrivateIdentifier */) {
|
|
31239
31265
|
parseErrorAtCurrentToken(privateIdentifierDiagnosticMessage || Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
|
|
@@ -31304,7 +31330,7 @@ var Parser;
|
|
|
31304
31330
|
}
|
|
31305
31331
|
function parsePrivateIdentifier() {
|
|
31306
31332
|
const pos = getNodePos();
|
|
31307
|
-
const node =
|
|
31333
|
+
const node = factoryCreatePrivateIdentifier(internIdentifier(scanner2.getTokenValue()));
|
|
31308
31334
|
nextToken();
|
|
31309
31335
|
return finishNode(node, pos);
|
|
31310
31336
|
}
|
|
@@ -32019,12 +32045,12 @@ var Parser;
|
|
|
32019
32045
|
// never get a token like this. Instead, we would get 00 and 9 as two separate tokens.
|
|
32020
32046
|
// We also do not need to check for negatives because any prefix operator would be part of a
|
|
32021
32047
|
// parent unary expression.
|
|
32022
|
-
kind === 8 /* NumericLiteral */ ?
|
|
32048
|
+
kind === 8 /* NumericLiteral */ ? factoryCreateNumericLiteral(scanner2.getTokenValue(), scanner2.getNumericLiteralFlags()) : kind === 10 /* StringLiteral */ ? factoryCreateStringLiteral(
|
|
32023
32049
|
scanner2.getTokenValue(),
|
|
32024
32050
|
/*isSingleQuote*/
|
|
32025
32051
|
void 0,
|
|
32026
32052
|
scanner2.hasExtendedUnicodeEscape()
|
|
32027
|
-
) : isLiteralKind(kind) ?
|
|
32053
|
+
) : isLiteralKind(kind) ? factoryCreateLiteralLikeNode(kind, scanner2.getTokenValue()) : Debug.fail()
|
|
32028
32054
|
);
|
|
32029
32055
|
if (scanner2.hasExtendedUnicodeEscape()) {
|
|
32030
32056
|
node.hasExtendedUnicodeEscape = true;
|
|
@@ -32615,7 +32641,7 @@ var Parser;
|
|
|
32615
32641
|
if (token() === 126 /* AbstractKeyword */) {
|
|
32616
32642
|
const pos = getNodePos();
|
|
32617
32643
|
nextToken();
|
|
32618
|
-
const modifier = finishNode(
|
|
32644
|
+
const modifier = finishNode(factoryCreateToken(126 /* AbstractKeyword */), pos);
|
|
32619
32645
|
modifiers = createNodeArray([modifier], pos);
|
|
32620
32646
|
}
|
|
32621
32647
|
return modifiers;
|
|
@@ -33672,7 +33698,7 @@ var Parser;
|
|
|
33672
33698
|
return expression;
|
|
33673
33699
|
}
|
|
33674
33700
|
parseExpectedToken(24 /* DotToken */, Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);
|
|
33675
|
-
return finishNode(
|
|
33701
|
+
return finishNode(factoryCreatePropertyAccessExpression(expression, parseRightSideOfDot(
|
|
33676
33702
|
/*allowIdentifierNames*/
|
|
33677
33703
|
true,
|
|
33678
33704
|
/*allowPrivateIdentifiers*/
|
|
@@ -33693,7 +33719,7 @@ var Parser;
|
|
|
33693
33719
|
factory2.createJsxElement(
|
|
33694
33720
|
lastChild.openingElement,
|
|
33695
33721
|
lastChild.children,
|
|
33696
|
-
finishNode(factory2.createJsxClosingElement(finishNode(
|
|
33722
|
+
finishNode(factory2.createJsxClosingElement(finishNode(factoryCreateIdentifier(""), end, end)), end, end)
|
|
33697
33723
|
),
|
|
33698
33724
|
lastChild.openingElement.pos,
|
|
33699
33725
|
end
|
|
@@ -33836,7 +33862,7 @@ var Parser;
|
|
|
33836
33862
|
scanJsxIdentifier();
|
|
33837
33863
|
let expression = token() === 108 /* ThisKeyword */ ? parseTokenNode() : parseIdentifierName();
|
|
33838
33864
|
while (parseOptional(24 /* DotToken */)) {
|
|
33839
|
-
expression = finishNode(
|
|
33865
|
+
expression = finishNode(factoryCreatePropertyAccessExpression(expression, parseRightSideOfDot(
|
|
33840
33866
|
/*allowIdentifierNames*/
|
|
33841
33867
|
true,
|
|
33842
33868
|
/*allowPrivateIdentifiers*/
|
|
@@ -33987,7 +34013,7 @@ var Parser;
|
|
|
33987
34013
|
true
|
|
33988
34014
|
);
|
|
33989
34015
|
const isOptionalChain2 = questionDotToken || tryReparseOptionalChain(expression);
|
|
33990
|
-
const propertyAccess = isOptionalChain2 ?
|
|
34016
|
+
const propertyAccess = isOptionalChain2 ? factoryCreatePropertyAccessChain(expression, questionDotToken, name) : factoryCreatePropertyAccessExpression(expression, name);
|
|
33991
34017
|
if (isOptionalChain2 && isPrivateIdentifier(propertyAccess.name)) {
|
|
33992
34018
|
parseErrorAtRange(propertyAccess.name, Diagnostics.An_optional_chain_cannot_contain_private_identifiers);
|
|
33993
34019
|
}
|
|
@@ -34015,7 +34041,7 @@ var Parser;
|
|
|
34015
34041
|
argumentExpression = argument;
|
|
34016
34042
|
}
|
|
34017
34043
|
parseExpected(23 /* CloseBracketToken */);
|
|
34018
|
-
const indexedAccess = questionDotToken || tryReparseOptionalChain(expression) ?
|
|
34044
|
+
const indexedAccess = questionDotToken || tryReparseOptionalChain(expression) ? factoryCreateElementAccessChain(expression, questionDotToken, argumentExpression) : factoryCreateElementAccessExpression(expression, argumentExpression);
|
|
34019
34045
|
return finishNode(indexedAccess, pos);
|
|
34020
34046
|
}
|
|
34021
34047
|
function parseMemberExpressionRest(pos, expression, allowOptionalChain) {
|
|
@@ -34102,7 +34128,7 @@ var Parser;
|
|
|
34102
34128
|
expression = expression.expression;
|
|
34103
34129
|
}
|
|
34104
34130
|
const argumentList = parseArgumentList();
|
|
34105
|
-
const callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
|
|
34131
|
+
const callExpr = questionDotToken || tryReparseOptionalChain(expression) ? factoryCreateCallChain(expression, questionDotToken, typeArguments, argumentList) : factoryCreateCallExpression(expression, typeArguments, argumentList);
|
|
34106
34132
|
expression = finishNode(callExpr, pos);
|
|
34107
34133
|
continue;
|
|
34108
34134
|
}
|
|
@@ -34113,7 +34139,7 @@ var Parser;
|
|
|
34113
34139
|
false,
|
|
34114
34140
|
Diagnostics.Identifier_expected
|
|
34115
34141
|
);
|
|
34116
|
-
expression = finishNode(
|
|
34142
|
+
expression = finishNode(factoryCreatePropertyAccessChain(expression, questionDotToken, name), pos);
|
|
34117
34143
|
}
|
|
34118
34144
|
break;
|
|
34119
34145
|
}
|
|
@@ -34208,7 +34234,7 @@ var Parser;
|
|
|
34208
34234
|
parseExpected(20 /* OpenParenToken */);
|
|
34209
34235
|
const expression = allowInAnd(parseExpression);
|
|
34210
34236
|
parseExpected(21 /* CloseParenToken */);
|
|
34211
|
-
return withJSDoc(finishNode(
|
|
34237
|
+
return withJSDoc(finishNode(factoryCreateParenthesizedExpression(expression), pos), hasJSDoc);
|
|
34212
34238
|
}
|
|
34213
34239
|
function parseSpreadElement() {
|
|
34214
34240
|
const pos = getNodePos();
|
|
@@ -34235,7 +34261,7 @@ var Parser;
|
|
|
34235
34261
|
const multiLine = scanner2.hasPrecedingLineBreak();
|
|
34236
34262
|
const elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement);
|
|
34237
34263
|
parseExpectedMatchingBrackets(22 /* OpenBracketToken */, 23 /* CloseBracketToken */, openBracketParsed, openBracketPosition);
|
|
34238
|
-
return finishNode(
|
|
34264
|
+
return finishNode(factoryCreateArrayLiteralExpression(elements, multiLine), pos);
|
|
34239
34265
|
}
|
|
34240
34266
|
function parseObjectLiteralElement() {
|
|
34241
34267
|
const pos = getNodePos();
|
|
@@ -34300,7 +34326,7 @@ var Parser;
|
|
|
34300
34326
|
true
|
|
34301
34327
|
);
|
|
34302
34328
|
parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
|
|
34303
|
-
return finishNode(
|
|
34329
|
+
return finishNode(factoryCreateObjectLiteralExpression(properties, multiLine), pos);
|
|
34304
34330
|
}
|
|
34305
34331
|
function parseFunctionExpression() {
|
|
34306
34332
|
const savedDecoratorContext = inDecoratorContext();
|
|
@@ -34357,7 +34383,7 @@ var Parser;
|
|
|
34357
34383
|
parseErrorAtCurrentToken(Diagnostics.Invalid_optional_chain_from_new_expression_Did_you_mean_to_call_0, getTextOfNodeFromSourceText(sourceText, expression));
|
|
34358
34384
|
}
|
|
34359
34385
|
const argumentList = token() === 20 /* OpenParenToken */ ? parseArgumentList() : void 0;
|
|
34360
|
-
return finishNode(
|
|
34386
|
+
return finishNode(factoryCreateNewExpression(expression, typeArguments, argumentList), pos);
|
|
34361
34387
|
}
|
|
34362
34388
|
function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) {
|
|
34363
34389
|
const pos = getNodePos();
|
|
@@ -34368,7 +34394,7 @@ var Parser;
|
|
|
34368
34394
|
const multiLine = scanner2.hasPrecedingLineBreak();
|
|
34369
34395
|
const statements = parseList(1 /* BlockStatements */, parseStatement);
|
|
34370
34396
|
parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
|
|
34371
|
-
const result = withJSDoc(finishNode(
|
|
34397
|
+
const result = withJSDoc(finishNode(factoryCreateBlock(statements, multiLine), pos), hasJSDoc);
|
|
34372
34398
|
if (token() === 63 /* EqualsToken */) {
|
|
34373
34399
|
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);
|
|
34374
34400
|
nextToken();
|
|
@@ -34376,7 +34402,7 @@ var Parser;
|
|
|
34376
34402
|
return result;
|
|
34377
34403
|
} else {
|
|
34378
34404
|
const statements = createMissingList();
|
|
34379
|
-
return withJSDoc(finishNode(
|
|
34405
|
+
return withJSDoc(finishNode(factoryCreateBlock(
|
|
34380
34406
|
statements,
|
|
34381
34407
|
/*multiLine*/
|
|
34382
34408
|
void 0
|
|
@@ -34425,7 +34451,7 @@ var Parser;
|
|
|
34425
34451
|
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
|
|
34426
34452
|
const thenStatement = parseStatement();
|
|
34427
34453
|
const elseStatement = parseOptional(91 /* ElseKeyword */) ? parseStatement() : void 0;
|
|
34428
|
-
return withJSDoc(finishNode(
|
|
34454
|
+
return withJSDoc(finishNode(factoryCreateIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc);
|
|
34429
34455
|
}
|
|
34430
34456
|
function parseDoStatement() {
|
|
34431
34457
|
const pos = getNodePos();
|
|
@@ -34449,7 +34475,7 @@ var Parser;
|
|
|
34449
34475
|
const expression = allowInAnd(parseExpression);
|
|
34450
34476
|
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
|
|
34451
34477
|
const statement = parseStatement();
|
|
34452
|
-
return withJSDoc(finishNode(
|
|
34478
|
+
return withJSDoc(finishNode(factoryCreateWhileStatement(expression, statement), pos), hasJSDoc);
|
|
34453
34479
|
}
|
|
34454
34480
|
function parseForOrForInOrForOfStatement() {
|
|
34455
34481
|
const pos = getNodePos();
|
|
@@ -34475,7 +34501,7 @@ var Parser;
|
|
|
34475
34501
|
true
|
|
34476
34502
|
));
|
|
34477
34503
|
parseExpected(21 /* CloseParenToken */);
|
|
34478
|
-
node =
|
|
34504
|
+
node = factoryCreateForOfStatement(awaitToken, initializer, expression, parseStatement());
|
|
34479
34505
|
} else if (parseOptional(101 /* InKeyword */)) {
|
|
34480
34506
|
const expression = allowInAnd(parseExpression);
|
|
34481
34507
|
parseExpected(21 /* CloseParenToken */);
|
|
@@ -34486,7 +34512,7 @@ var Parser;
|
|
|
34486
34512
|
parseExpected(26 /* SemicolonToken */);
|
|
34487
34513
|
const incrementor = token() !== 21 /* CloseParenToken */ ? allowInAnd(parseExpression) : void 0;
|
|
34488
34514
|
parseExpected(21 /* CloseParenToken */);
|
|
34489
|
-
node =
|
|
34515
|
+
node = factoryCreateForStatement(initializer, condition, incrementor, parseStatement());
|
|
34490
34516
|
}
|
|
34491
34517
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
34492
34518
|
}
|
|
@@ -34561,7 +34587,7 @@ var Parser;
|
|
|
34561
34587
|
let expression = scanner2.hasPrecedingLineBreak() ? void 0 : allowInAnd(parseExpression);
|
|
34562
34588
|
if (expression === void 0) {
|
|
34563
34589
|
identifierCount++;
|
|
34564
|
-
expression = finishNode(
|
|
34590
|
+
expression = finishNode(factoryCreateIdentifier(""), getNodePos());
|
|
34565
34591
|
}
|
|
34566
34592
|
if (!tryParseSemicolon()) {
|
|
34567
34593
|
parseErrorForMissingSemicolonAfter(expression);
|
|
@@ -34622,7 +34648,7 @@ var Parser;
|
|
|
34622
34648
|
if (!tryParseSemicolon()) {
|
|
34623
34649
|
parseErrorForMissingSemicolonAfter(expression);
|
|
34624
34650
|
}
|
|
34625
|
-
node =
|
|
34651
|
+
node = factoryCreateExpressionStatement(expression);
|
|
34626
34652
|
if (hasParen) {
|
|
34627
34653
|
hasJSDoc = false;
|
|
34628
34654
|
}
|
|
@@ -35020,7 +35046,7 @@ var Parser;
|
|
|
35020
35046
|
}
|
|
35021
35047
|
const type = parseTypeAnnotation();
|
|
35022
35048
|
const initializer = isInOrOfKeyword(token()) ? void 0 : parseInitializer();
|
|
35023
|
-
const node =
|
|
35049
|
+
const node = factoryCreateVariableDeclaration(name, exclamationToken, type, initializer);
|
|
35024
35050
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
35025
35051
|
}
|
|
35026
35052
|
function parseVariableDeclarationList(inForStatementInitializer) {
|
|
@@ -35051,7 +35077,7 @@ var Parser;
|
|
|
35051
35077
|
);
|
|
35052
35078
|
setDisallowInContext(savedDisallowIn);
|
|
35053
35079
|
}
|
|
35054
|
-
return finishNode(
|
|
35080
|
+
return finishNode(factoryCreateVariableDeclarationList(declarations, flags), pos);
|
|
35055
35081
|
}
|
|
35056
35082
|
function canFollowContextualOfKeyword() {
|
|
35057
35083
|
return nextTokenIsIdentifier() && nextToken() === 21 /* CloseParenToken */;
|
|
@@ -35062,7 +35088,7 @@ var Parser;
|
|
|
35062
35088
|
false
|
|
35063
35089
|
);
|
|
35064
35090
|
parseSemicolon();
|
|
35065
|
-
const node =
|
|
35091
|
+
const node = factoryCreateVariableStatement(modifiers, declarationList);
|
|
35066
35092
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
35067
35093
|
}
|
|
35068
35094
|
function parseFunctionDeclaration(pos, hasJSDoc, modifiers) {
|
|
@@ -35291,7 +35317,7 @@ var Parser;
|
|
|
35291
35317
|
return void 0;
|
|
35292
35318
|
}
|
|
35293
35319
|
}
|
|
35294
|
-
return finishNode(
|
|
35320
|
+
return finishNode(factoryCreateToken(kind), pos);
|
|
35295
35321
|
}
|
|
35296
35322
|
function parseModifiers(allowDecorators, permitConstAsModifier, stopOnStartOfClassStaticBlock) {
|
|
35297
35323
|
const pos = getNodePos();
|
|
@@ -35328,7 +35354,7 @@ var Parser;
|
|
|
35328
35354
|
if (token() === 132 /* AsyncKeyword */) {
|
|
35329
35355
|
const pos = getNodePos();
|
|
35330
35356
|
nextToken();
|
|
35331
|
-
const modifier = finishNode(
|
|
35357
|
+
const modifier = finishNode(factoryCreateToken(132 /* AsyncKeyword */), pos);
|
|
35332
35358
|
modifiers = createNodeArray([modifier], pos);
|
|
35333
35359
|
}
|
|
35334
35360
|
return modifiers;
|
|
@@ -35915,7 +35941,7 @@ var Parser;
|
|
|
35915
35941
|
/*isDeclarationFile*/
|
|
35916
35942
|
false,
|
|
35917
35943
|
[],
|
|
35918
|
-
|
|
35944
|
+
factoryCreateToken(1 /* EndOfFileToken */),
|
|
35919
35945
|
0 /* None */,
|
|
35920
35946
|
noop
|
|
35921
35947
|
);
|
|
@@ -36576,7 +36602,7 @@ var Parser;
|
|
|
36576
36602
|
let node = parseJSDocIdentifierName();
|
|
36577
36603
|
while (parseOptional(24 /* DotToken */)) {
|
|
36578
36604
|
const name = parseJSDocIdentifierName();
|
|
36579
|
-
node = finishNode(
|
|
36605
|
+
node = finishNode(factoryCreatePropertyAccessExpression(node, name), pos);
|
|
36580
36606
|
}
|
|
36581
36607
|
return node;
|
|
36582
36608
|
}
|
|
@@ -36867,7 +36893,7 @@ var Parser;
|
|
|
36867
36893
|
const end2 = scanner2.getTextPos();
|
|
36868
36894
|
const originalKeywordKind = token();
|
|
36869
36895
|
const text = internIdentifier(scanner2.getTokenValue());
|
|
36870
|
-
const result = finishNode(
|
|
36896
|
+
const result = finishNode(factoryCreateIdentifier(text, originalKeywordKind), pos, end2);
|
|
36871
36897
|
nextTokenJSDoc();
|
|
36872
36898
|
return result;
|
|
36873
36899
|
}
|
|
@@ -41165,10 +41191,13 @@ function getNodeResolutionFeatures(options) {
|
|
|
41165
41191
|
return features;
|
|
41166
41192
|
}
|
|
41167
41193
|
function getConditions(options, esmMode) {
|
|
41168
|
-
const conditions = esmMode || getEmitModuleResolutionKind(options) === 100 /* Bundler */ ? ["
|
|
41194
|
+
const conditions = esmMode || getEmitModuleResolutionKind(options) === 100 /* Bundler */ ? ["import"] : ["require"];
|
|
41169
41195
|
if (!options.noDtsResolution) {
|
|
41170
41196
|
conditions.push("types");
|
|
41171
41197
|
}
|
|
41198
|
+
if (getEmitModuleResolutionKind(options) !== 100 /* Bundler */) {
|
|
41199
|
+
conditions.push("node");
|
|
41200
|
+
}
|
|
41172
41201
|
return concatenate(conditions, options.customConditions);
|
|
41173
41202
|
}
|
|
41174
41203
|
function resolvePackageNameToPackageJson(packageName, containingDirectory, options, host, cache) {
|
|
@@ -41895,7 +41924,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
41895
41924
|
isConfigLookup,
|
|
41896
41925
|
candidateIsFromPackageJsonField: false
|
|
41897
41926
|
};
|
|
41898
|
-
if (traceEnabled &&
|
|
41927
|
+
if (traceEnabled && moduleResolutionSupportsPackageJsonExportsAndImports(getEmitModuleResolutionKind(compilerOptions))) {
|
|
41899
41928
|
trace(host, Diagnostics.Resolving_in_0_mode_with_conditions_1, features & 32 /* EsmMode */ ? "ESM" : "CJS", conditions.map((c) => `'${c}'`).join(", "));
|
|
41900
41929
|
}
|
|
41901
41930
|
let result;
|
|
@@ -50409,7 +50438,9 @@ function createTypeChecker(host) {
|
|
|
50409
50438
|
function getSuggestedImportSource(tsExtension) {
|
|
50410
50439
|
const importSourceWithoutExtension = removeExtension(moduleReference, tsExtension);
|
|
50411
50440
|
if (emitModuleKindIsNonNodeESM(moduleKind) || mode === 99 /* ESNext */) {
|
|
50412
|
-
|
|
50441
|
+
const preferTs = isDeclarationFileName(moduleReference) && shouldAllowImportingTsExtension(compilerOptions);
|
|
50442
|
+
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";
|
|
50443
|
+
return importSourceWithoutExtension + ext;
|
|
50413
50444
|
}
|
|
50414
50445
|
return importSourceWithoutExtension;
|
|
50415
50446
|
}
|
|
@@ -83402,8 +83433,6 @@ function createTypeChecker(host) {
|
|
|
83402
83433
|
} else {
|
|
83403
83434
|
if (moduleKind >= 5 /* ES2015 */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 16777216 /* Ambient */)) {
|
|
83404
83435
|
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);
|
|
83405
|
-
} else if (!(node.flags & 16777216 /* Ambient */) && getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */) {
|
|
83406
|
-
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);
|
|
83407
83436
|
}
|
|
83408
83437
|
}
|
|
83409
83438
|
}
|
|
@@ -83610,8 +83639,6 @@ function createTypeChecker(host) {
|
|
|
83610
83639
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
|
|
83611
83640
|
} else if (moduleKind === 4 /* System */ && !(node.flags & 16777216 /* Ambient */)) {
|
|
83612
83641
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
|
|
83613
|
-
} else if (getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */ && !(node.flags & 16777216 /* Ambient */)) {
|
|
83614
|
-
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_moduleResolution_is_set_to_bundler_Consider_using_export_default_or_another_module_format_instead);
|
|
83615
83642
|
}
|
|
83616
83643
|
}
|
|
83617
83644
|
}
|
|
@@ -120086,10 +120113,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120086
120113
|
}
|
|
120087
120114
|
}
|
|
120088
120115
|
if (options.preserveValueImports && getEmitModuleKind(options) < 5 /* ES2015 */) {
|
|
120089
|
-
createDiagnosticForOptionName(Diagnostics.
|
|
120116
|
+
createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later, "preserveValueImports");
|
|
120090
120117
|
}
|
|
120118
|
+
const moduleKind = getEmitModuleKind(options);
|
|
120091
120119
|
if (options.verbatimModuleSyntax) {
|
|
120092
|
-
const moduleKind = getEmitModuleKind(options);
|
|
120093
120120
|
if (moduleKind === 2 /* AMD */ || moduleKind === 3 /* UMD */ || moduleKind === 4 /* System */) {
|
|
120094
120121
|
createDiagnosticForOptionName(Diagnostics.Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System, "verbatimModuleSyntax");
|
|
120095
120122
|
}
|
|
@@ -120108,13 +120135,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120108
120135
|
}
|
|
120109
120136
|
const moduleResolution = getEmitModuleResolutionKind(options);
|
|
120110
120137
|
if (options.resolvePackageJsonExports && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
|
|
120111
|
-
|
|
120138
|
+
createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "resolvePackageJsonExports");
|
|
120112
120139
|
}
|
|
120113
120140
|
if (options.resolvePackageJsonImports && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
|
|
120114
|
-
|
|
120141
|
+
createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "resolvePackageJsonImports");
|
|
120115
120142
|
}
|
|
120116
120143
|
if (options.customConditions && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
|
|
120117
|
-
|
|
120144
|
+
createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "customConditions");
|
|
120145
|
+
}
|
|
120146
|
+
if (moduleResolution === 100 /* Bundler */ && !emitModuleKindIsNonNodeESM(moduleKind)) {
|
|
120147
|
+
createOptionValueDiagnostic("moduleResolution", Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later, "bundler");
|
|
120118
120148
|
}
|
|
120119
120149
|
if (!options.noEmit && !options.suppressOutputPathCheck) {
|
|
120120
120150
|
const emitHost = getEmitHost();
|
|
@@ -151903,7 +151933,7 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, typeCheck
|
|
|
151903
151933
|
if (isObjectLiteralExpression(parent2.parent) && parent2.name === node) {
|
|
151904
151934
|
return stringLiteralCompletionsForObjectLiteral(typeChecker, parent2.parent);
|
|
151905
151935
|
}
|
|
151906
|
-
return fromContextualType();
|
|
151936
|
+
return fromContextualType() || fromContextualType(0 /* None */);
|
|
151907
151937
|
case 209 /* ElementAccessExpression */: {
|
|
151908
151938
|
const { expression, argumentExpression } = parent2;
|
|
151909
151939
|
if (node === skipParentheses(argumentExpression)) {
|
|
@@ -151924,13 +151954,21 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, typeCheck
|
|
|
151924
151954
|
return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) };
|
|
151925
151955
|
case 292 /* CaseClause */:
|
|
151926
151956
|
const tracker = newCaseClauseTracker(typeChecker, parent2.parent.clauses);
|
|
151927
|
-
const
|
|
151957
|
+
const contextualTypes = fromContextualType();
|
|
151958
|
+
if (!contextualTypes) {
|
|
151959
|
+
return;
|
|
151960
|
+
}
|
|
151961
|
+
const literals = contextualTypes.types.filter((literal) => !tracker.hasValue(literal.value));
|
|
151928
151962
|
return { kind: 2 /* Types */, types: literals, isNewIdentifier: false };
|
|
151929
151963
|
default:
|
|
151930
151964
|
return fromContextualType();
|
|
151931
151965
|
}
|
|
151932
|
-
function fromContextualType() {
|
|
151933
|
-
|
|
151966
|
+
function fromContextualType(contextFlags = 4 /* Completions */) {
|
|
151967
|
+
const types = getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker, contextFlags));
|
|
151968
|
+
if (!types.length) {
|
|
151969
|
+
return;
|
|
151970
|
+
}
|
|
151971
|
+
return { kind: 2 /* Types */, types, isNewIdentifier: false };
|
|
151934
151972
|
}
|
|
151935
151973
|
}
|
|
151936
151974
|
function walkUpParentheses(node) {
|