typescript 5.2.0-dev.20230630 → 5.2.0-dev.20230702
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 +22 -9
- package/lib/tsserver.js +39 -13
- package/lib/tsserverlibrary.js +39 -13
- package/lib/typescript.js +39 -13
- package/lib/typingsInstaller.js +14 -9
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.2";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20230702`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -7465,6 +7465,7 @@ var Diagnostics = {
|
|
|
7465
7465
|
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."),
|
|
7466
7466
|
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."),
|
|
7467
7467
|
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."),
|
|
7468
|
+
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."),
|
|
7468
7469
|
Report_errors_in_js_files: diag(8019, 3 /* Message */, "Report_errors_in_js_files_8019", "Report errors in .js files."),
|
|
7469
7470
|
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."),
|
|
7470
7471
|
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."),
|
|
@@ -26594,7 +26595,8 @@ var Parser;
|
|
|
26594
26595
|
nextToken();
|
|
26595
26596
|
const statements = parseList(0 /* SourceElements */, parseStatement);
|
|
26596
26597
|
Debug.assert(token() === 1 /* EndOfFileToken */);
|
|
26597
|
-
const
|
|
26598
|
+
const endHasJSDoc = hasPrecedingJSDocComment();
|
|
26599
|
+
const endOfFileToken = withJSDoc(parseTokenNode(), endHasJSDoc);
|
|
26598
26600
|
const sourceFile = createSourceFile2(fileName, languageVersion2, scriptKind2, isDeclarationFile, statements, endOfFileToken, sourceFlags, setExternalModuleIndicator2);
|
|
26599
26601
|
processCommentPragmas(sourceFile, sourceText);
|
|
26600
26602
|
processPragmasIntoFields(sourceFile, reportPragmaDiagnostic);
|
|
@@ -26614,11 +26616,11 @@ var Parser;
|
|
|
26614
26616
|
parseDiagnostics.push(createDetachedDiagnostic(fileName, pos, end, diagnostic));
|
|
26615
26617
|
}
|
|
26616
26618
|
}
|
|
26617
|
-
function withJSDoc(node, hasJSDoc) {
|
|
26618
|
-
return hasJSDoc ? addJSDocComment(node) : node;
|
|
26619
|
-
}
|
|
26620
26619
|
let hasDeprecatedTag = false;
|
|
26621
|
-
function
|
|
26620
|
+
function withJSDoc(node, hasJSDoc) {
|
|
26621
|
+
if (!hasJSDoc) {
|
|
26622
|
+
return node;
|
|
26623
|
+
}
|
|
26622
26624
|
Debug.assert(!node.jsDoc);
|
|
26623
26625
|
const jsDoc = mapDefined(getJSDocCommentRanges(node, sourceText), (comment) => JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos));
|
|
26624
26626
|
if (jsDoc.length)
|
|
@@ -29133,12 +29135,14 @@ var Parser;
|
|
|
29133
29135
|
return arrowExpression;
|
|
29134
29136
|
}
|
|
29135
29137
|
const pos = getNodePos();
|
|
29138
|
+
const hasJSDoc = hasPrecedingJSDocComment();
|
|
29136
29139
|
const expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
|
|
29137
29140
|
if (expr.kind === 80 /* Identifier */ && token() === 39 /* EqualsGreaterThanToken */) {
|
|
29138
29141
|
return parseSimpleArrowFunctionExpression(
|
|
29139
29142
|
pos,
|
|
29140
29143
|
expr,
|
|
29141
29144
|
allowReturnTypeInArrowFunction,
|
|
29145
|
+
hasJSDoc,
|
|
29142
29146
|
/*asyncModifier*/
|
|
29143
29147
|
void 0
|
|
29144
29148
|
);
|
|
@@ -29184,7 +29188,7 @@ var Parser;
|
|
|
29184
29188
|
), pos);
|
|
29185
29189
|
}
|
|
29186
29190
|
}
|
|
29187
|
-
function parseSimpleArrowFunctionExpression(pos, identifier, allowReturnTypeInArrowFunction, asyncModifier) {
|
|
29191
|
+
function parseSimpleArrowFunctionExpression(pos, identifier, allowReturnTypeInArrowFunction, hasJSDoc, asyncModifier) {
|
|
29188
29192
|
Debug.assert(token() === 39 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
|
|
29189
29193
|
const parameter = factory2.createParameterDeclaration(
|
|
29190
29194
|
/*modifiers*/
|
|
@@ -29217,7 +29221,7 @@ var Parser;
|
|
|
29217
29221
|
equalsGreaterThanToken,
|
|
29218
29222
|
body
|
|
29219
29223
|
);
|
|
29220
|
-
return
|
|
29224
|
+
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
29221
29225
|
}
|
|
29222
29226
|
function tryParseParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction) {
|
|
29223
29227
|
const triState = isParenthesizedArrowFunctionExpression();
|
|
@@ -29345,9 +29349,10 @@ var Parser;
|
|
|
29345
29349
|
if (token() === 134 /* AsyncKeyword */) {
|
|
29346
29350
|
if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
|
|
29347
29351
|
const pos = getNodePos();
|
|
29352
|
+
const hasJSDoc = hasPrecedingJSDocComment();
|
|
29348
29353
|
const asyncModifier = parseModifiersForArrowFunction();
|
|
29349
29354
|
const expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
|
|
29350
|
-
return parseSimpleArrowFunctionExpression(pos, expr, allowReturnTypeInArrowFunction, asyncModifier);
|
|
29355
|
+
return parseSimpleArrowFunctionExpression(pos, expr, allowReturnTypeInArrowFunction, hasJSDoc, asyncModifier);
|
|
29351
29356
|
}
|
|
29352
29357
|
}
|
|
29353
29358
|
return void 0;
|
|
@@ -116473,6 +116478,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
116473
116478
|
case 265 /* TypeAliasDeclaration */:
|
|
116474
116479
|
diagnostics.push(createDiagnosticForNode2(node, Diagnostics.Type_aliases_can_only_be_used_in_TypeScript_files));
|
|
116475
116480
|
return "skip";
|
|
116481
|
+
case 176 /* Constructor */:
|
|
116482
|
+
case 174 /* MethodDeclaration */:
|
|
116483
|
+
case 262 /* FunctionDeclaration */:
|
|
116484
|
+
if (!node.body) {
|
|
116485
|
+
diagnostics.push(createDiagnosticForNode2(node, Diagnostics.Signature_declarations_can_only_be_used_in_TypeScript_files));
|
|
116486
|
+
return "skip";
|
|
116487
|
+
}
|
|
116488
|
+
return;
|
|
116476
116489
|
case 266 /* EnumDeclaration */:
|
|
116477
116490
|
const enumKeyword = Debug.checkDefined(tokenToString(94 /* EnumKeyword */));
|
|
116478
116491
|
diagnostics.push(createDiagnosticForNode2(node, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, enumKeyword));
|
package/lib/tsserver.js
CHANGED
|
@@ -2327,7 +2327,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2327
2327
|
|
|
2328
2328
|
// src/compiler/corePublic.ts
|
|
2329
2329
|
var versionMajorMinor = "5.2";
|
|
2330
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2330
|
+
var version = `${versionMajorMinor}.0-dev.20230702`;
|
|
2331
2331
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2332
2332
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2333
2333
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -10986,6 +10986,7 @@ var Diagnostics = {
|
|
|
10986
10986
|
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."),
|
|
10987
10987
|
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."),
|
|
10988
10988
|
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."),
|
|
10989
|
+
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."),
|
|
10989
10990
|
Report_errors_in_js_files: diag(8019, 3 /* Message */, "Report_errors_in_js_files_8019", "Report errors in .js files."),
|
|
10990
10991
|
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."),
|
|
10991
10992
|
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."),
|
|
@@ -30992,7 +30993,8 @@ var Parser;
|
|
|
30992
30993
|
nextToken();
|
|
30993
30994
|
const statements = parseList(0 /* SourceElements */, parseStatement);
|
|
30994
30995
|
Debug.assert(token() === 1 /* EndOfFileToken */);
|
|
30995
|
-
const
|
|
30996
|
+
const endHasJSDoc = hasPrecedingJSDocComment();
|
|
30997
|
+
const endOfFileToken = withJSDoc(parseTokenNode(), endHasJSDoc);
|
|
30996
30998
|
const sourceFile = createSourceFile2(fileName, languageVersion2, scriptKind2, isDeclarationFile, statements, endOfFileToken, sourceFlags, setExternalModuleIndicator2);
|
|
30997
30999
|
processCommentPragmas(sourceFile, sourceText);
|
|
30998
31000
|
processPragmasIntoFields(sourceFile, reportPragmaDiagnostic);
|
|
@@ -31012,11 +31014,11 @@ var Parser;
|
|
|
31012
31014
|
parseDiagnostics.push(createDetachedDiagnostic(fileName, pos, end, diagnostic));
|
|
31013
31015
|
}
|
|
31014
31016
|
}
|
|
31015
|
-
function withJSDoc(node, hasJSDoc) {
|
|
31016
|
-
return hasJSDoc ? addJSDocComment(node) : node;
|
|
31017
|
-
}
|
|
31018
31017
|
let hasDeprecatedTag = false;
|
|
31019
|
-
function
|
|
31018
|
+
function withJSDoc(node, hasJSDoc) {
|
|
31019
|
+
if (!hasJSDoc) {
|
|
31020
|
+
return node;
|
|
31021
|
+
}
|
|
31020
31022
|
Debug.assert(!node.jsDoc);
|
|
31021
31023
|
const jsDoc = mapDefined(getJSDocCommentRanges(node, sourceText), (comment) => JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos));
|
|
31022
31024
|
if (jsDoc.length)
|
|
@@ -33531,12 +33533,14 @@ var Parser;
|
|
|
33531
33533
|
return arrowExpression;
|
|
33532
33534
|
}
|
|
33533
33535
|
const pos = getNodePos();
|
|
33536
|
+
const hasJSDoc = hasPrecedingJSDocComment();
|
|
33534
33537
|
const expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
|
|
33535
33538
|
if (expr.kind === 80 /* Identifier */ && token() === 39 /* EqualsGreaterThanToken */) {
|
|
33536
33539
|
return parseSimpleArrowFunctionExpression(
|
|
33537
33540
|
pos,
|
|
33538
33541
|
expr,
|
|
33539
33542
|
allowReturnTypeInArrowFunction,
|
|
33543
|
+
hasJSDoc,
|
|
33540
33544
|
/*asyncModifier*/
|
|
33541
33545
|
void 0
|
|
33542
33546
|
);
|
|
@@ -33582,7 +33586,7 @@ var Parser;
|
|
|
33582
33586
|
), pos);
|
|
33583
33587
|
}
|
|
33584
33588
|
}
|
|
33585
|
-
function parseSimpleArrowFunctionExpression(pos, identifier, allowReturnTypeInArrowFunction, asyncModifier) {
|
|
33589
|
+
function parseSimpleArrowFunctionExpression(pos, identifier, allowReturnTypeInArrowFunction, hasJSDoc, asyncModifier) {
|
|
33586
33590
|
Debug.assert(token() === 39 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
|
|
33587
33591
|
const parameter = factory2.createParameterDeclaration(
|
|
33588
33592
|
/*modifiers*/
|
|
@@ -33615,7 +33619,7 @@ var Parser;
|
|
|
33615
33619
|
equalsGreaterThanToken,
|
|
33616
33620
|
body
|
|
33617
33621
|
);
|
|
33618
|
-
return
|
|
33622
|
+
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
33619
33623
|
}
|
|
33620
33624
|
function tryParseParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction) {
|
|
33621
33625
|
const triState = isParenthesizedArrowFunctionExpression();
|
|
@@ -33743,9 +33747,10 @@ var Parser;
|
|
|
33743
33747
|
if (token() === 134 /* AsyncKeyword */) {
|
|
33744
33748
|
if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
|
|
33745
33749
|
const pos = getNodePos();
|
|
33750
|
+
const hasJSDoc = hasPrecedingJSDocComment();
|
|
33746
33751
|
const asyncModifier = parseModifiersForArrowFunction();
|
|
33747
33752
|
const expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
|
|
33748
|
-
return parseSimpleArrowFunctionExpression(pos, expr, allowReturnTypeInArrowFunction, asyncModifier);
|
|
33753
|
+
return parseSimpleArrowFunctionExpression(pos, expr, allowReturnTypeInArrowFunction, hasJSDoc, asyncModifier);
|
|
33749
33754
|
}
|
|
33750
33755
|
}
|
|
33751
33756
|
return void 0;
|
|
@@ -121385,6 +121390,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121385
121390
|
case 265 /* TypeAliasDeclaration */:
|
|
121386
121391
|
diagnostics.push(createDiagnosticForNode2(node, Diagnostics.Type_aliases_can_only_be_used_in_TypeScript_files));
|
|
121387
121392
|
return "skip";
|
|
121393
|
+
case 176 /* Constructor */:
|
|
121394
|
+
case 174 /* MethodDeclaration */:
|
|
121395
|
+
case 262 /* FunctionDeclaration */:
|
|
121396
|
+
if (!node.body) {
|
|
121397
|
+
diagnostics.push(createDiagnosticForNode2(node, Diagnostics.Signature_declarations_can_only_be_used_in_TypeScript_files));
|
|
121398
|
+
return "skip";
|
|
121399
|
+
}
|
|
121400
|
+
return;
|
|
121388
121401
|
case 266 /* EnumDeclaration */:
|
|
121389
121402
|
const enumKeyword = Debug.checkDefined(tokenToString(94 /* EnumKeyword */));
|
|
121390
121403
|
diagnostics.push(createDiagnosticForNode2(node, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, enumKeyword));
|
|
@@ -157667,6 +157680,13 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
|
|
|
157667
157680
|
data = originToCompletionEntryData(origin);
|
|
157668
157681
|
hasAction = !importStatementCompletion;
|
|
157669
157682
|
}
|
|
157683
|
+
const parentNamedImportOrExport = findAncestor(location, isNamedImportsOrExports);
|
|
157684
|
+
if ((parentNamedImportOrExport == null ? void 0 : parentNamedImportOrExport.kind) === 275 /* NamedImports */) {
|
|
157685
|
+
const possibleToken = stringToToken(name);
|
|
157686
|
+
if (parentNamedImportOrExport && possibleToken && (possibleToken === 135 /* AwaitKeyword */ || isNonContextualKeyword(possibleToken))) {
|
|
157687
|
+
insertText = `${name} as ${name}_`;
|
|
157688
|
+
}
|
|
157689
|
+
}
|
|
157670
157690
|
return {
|
|
157671
157691
|
name,
|
|
157672
157692
|
kind: ts_SymbolDisplay_exports.getSymbolKind(typeChecker, symbol, location),
|
|
@@ -158447,7 +158467,7 @@ function createCompletionDetails(name, kindModifiers, kind, displayParts, docume
|
|
|
158447
158467
|
}
|
|
158448
158468
|
function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken) {
|
|
158449
158469
|
if (data == null ? void 0 : data.moduleSpecifier) {
|
|
158450
|
-
if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementSpan) {
|
|
158470
|
+
if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken, sourceFile).replacementSpan) {
|
|
158451
158471
|
return { codeActions: void 0, sourceDisplay: [textPart(data.moduleSpecifier)] };
|
|
158452
158472
|
}
|
|
158453
158473
|
}
|
|
@@ -158669,7 +158689,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
158669
158689
|
let isNewIdentifierLocation = false;
|
|
158670
158690
|
let flags = 0 /* None */;
|
|
158671
158691
|
if (contextToken) {
|
|
158672
|
-
const importStatementCompletionInfo = getImportStatementCompletionInfo(contextToken);
|
|
158692
|
+
const importStatementCompletionInfo = getImportStatementCompletionInfo(contextToken, sourceFile);
|
|
158673
158693
|
if (importStatementCompletionInfo.keywordCompletion) {
|
|
158674
158694
|
if (importStatementCompletionInfo.isKeywordOnlyCompletion) {
|
|
158675
158695
|
return {
|
|
@@ -160313,7 +160333,7 @@ function tryGetObjectLiteralContextualType(node, typeChecker) {
|
|
|
160313
160333
|
}
|
|
160314
160334
|
return void 0;
|
|
160315
160335
|
}
|
|
160316
|
-
function getImportStatementCompletionInfo(contextToken) {
|
|
160336
|
+
function getImportStatementCompletionInfo(contextToken, sourceFile) {
|
|
160317
160337
|
var _a, _b, _c;
|
|
160318
160338
|
let keywordCompletion;
|
|
160319
160339
|
let isKeywordOnlyCompletion = false;
|
|
@@ -160329,6 +160349,12 @@ function getImportStatementCompletionInfo(contextToken) {
|
|
|
160329
160349
|
function getCandidate() {
|
|
160330
160350
|
const parent2 = contextToken.parent;
|
|
160331
160351
|
if (isImportEqualsDeclaration(parent2)) {
|
|
160352
|
+
const lastToken = parent2.getLastToken(sourceFile);
|
|
160353
|
+
if (isIdentifier(contextToken) && lastToken !== contextToken) {
|
|
160354
|
+
keywordCompletion = 161 /* FromKeyword */;
|
|
160355
|
+
isKeywordOnlyCompletion = true;
|
|
160356
|
+
return void 0;
|
|
160357
|
+
}
|
|
160332
160358
|
keywordCompletion = contextToken.kind === 156 /* TypeKeyword */ ? void 0 : 156 /* TypeKeyword */;
|
|
160333
160359
|
return isModuleSpecifierMissingOrEmpty(parent2.moduleReference) ? parent2 : void 0;
|
|
160334
160360
|
}
|
|
@@ -160830,7 +160856,7 @@ function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, c
|
|
|
160830
160856
|
extensionOptions,
|
|
160831
160857
|
host,
|
|
160832
160858
|
/*moduleSpecifierIsRelative*/
|
|
160833
|
-
|
|
160859
|
+
true,
|
|
160834
160860
|
scriptPath
|
|
160835
160861
|
).values());
|
|
160836
160862
|
}
|
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.2";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230702`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -8769,6 +8769,7 @@ ${lanes.join("\n")}
|
|
|
8769
8769
|
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."),
|
|
8770
8770
|
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."),
|
|
8771
8771
|
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."),
|
|
8772
|
+
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."),
|
|
8772
8773
|
Report_errors_in_js_files: diag(8019, 3 /* Message */, "Report_errors_in_js_files_8019", "Report errors in .js files."),
|
|
8773
8774
|
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."),
|
|
8774
8775
|
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."),
|
|
@@ -29065,7 +29066,8 @@ ${lanes.join("\n")}
|
|
|
29065
29066
|
nextToken();
|
|
29066
29067
|
const statements = parseList(0 /* SourceElements */, parseStatement);
|
|
29067
29068
|
Debug.assert(token() === 1 /* EndOfFileToken */);
|
|
29068
|
-
const
|
|
29069
|
+
const endHasJSDoc = hasPrecedingJSDocComment();
|
|
29070
|
+
const endOfFileToken = withJSDoc(parseTokenNode(), endHasJSDoc);
|
|
29069
29071
|
const sourceFile = createSourceFile2(fileName, languageVersion2, scriptKind2, isDeclarationFile, statements, endOfFileToken, sourceFlags, setExternalModuleIndicator2);
|
|
29070
29072
|
processCommentPragmas(sourceFile, sourceText);
|
|
29071
29073
|
processPragmasIntoFields(sourceFile, reportPragmaDiagnostic);
|
|
@@ -29085,11 +29087,11 @@ ${lanes.join("\n")}
|
|
|
29085
29087
|
parseDiagnostics.push(createDetachedDiagnostic(fileName, pos, end, diagnostic));
|
|
29086
29088
|
}
|
|
29087
29089
|
}
|
|
29088
|
-
function withJSDoc(node, hasJSDoc) {
|
|
29089
|
-
return hasJSDoc ? addJSDocComment(node) : node;
|
|
29090
|
-
}
|
|
29091
29090
|
let hasDeprecatedTag = false;
|
|
29092
|
-
function
|
|
29091
|
+
function withJSDoc(node, hasJSDoc) {
|
|
29092
|
+
if (!hasJSDoc) {
|
|
29093
|
+
return node;
|
|
29094
|
+
}
|
|
29093
29095
|
Debug.assert(!node.jsDoc);
|
|
29094
29096
|
const jsDoc = mapDefined(getJSDocCommentRanges(node, sourceText), (comment) => JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos));
|
|
29095
29097
|
if (jsDoc.length)
|
|
@@ -31604,12 +31606,14 @@ ${lanes.join("\n")}
|
|
|
31604
31606
|
return arrowExpression;
|
|
31605
31607
|
}
|
|
31606
31608
|
const pos = getNodePos();
|
|
31609
|
+
const hasJSDoc = hasPrecedingJSDocComment();
|
|
31607
31610
|
const expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
|
|
31608
31611
|
if (expr.kind === 80 /* Identifier */ && token() === 39 /* EqualsGreaterThanToken */) {
|
|
31609
31612
|
return parseSimpleArrowFunctionExpression(
|
|
31610
31613
|
pos,
|
|
31611
31614
|
expr,
|
|
31612
31615
|
allowReturnTypeInArrowFunction,
|
|
31616
|
+
hasJSDoc,
|
|
31613
31617
|
/*asyncModifier*/
|
|
31614
31618
|
void 0
|
|
31615
31619
|
);
|
|
@@ -31655,7 +31659,7 @@ ${lanes.join("\n")}
|
|
|
31655
31659
|
), pos);
|
|
31656
31660
|
}
|
|
31657
31661
|
}
|
|
31658
|
-
function parseSimpleArrowFunctionExpression(pos, identifier, allowReturnTypeInArrowFunction, asyncModifier) {
|
|
31662
|
+
function parseSimpleArrowFunctionExpression(pos, identifier, allowReturnTypeInArrowFunction, hasJSDoc, asyncModifier) {
|
|
31659
31663
|
Debug.assert(token() === 39 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
|
|
31660
31664
|
const parameter = factory2.createParameterDeclaration(
|
|
31661
31665
|
/*modifiers*/
|
|
@@ -31688,7 +31692,7 @@ ${lanes.join("\n")}
|
|
|
31688
31692
|
equalsGreaterThanToken,
|
|
31689
31693
|
body
|
|
31690
31694
|
);
|
|
31691
|
-
return
|
|
31695
|
+
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
31692
31696
|
}
|
|
31693
31697
|
function tryParseParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction) {
|
|
31694
31698
|
const triState = isParenthesizedArrowFunctionExpression();
|
|
@@ -31816,9 +31820,10 @@ ${lanes.join("\n")}
|
|
|
31816
31820
|
if (token() === 134 /* AsyncKeyword */) {
|
|
31817
31821
|
if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
|
|
31818
31822
|
const pos = getNodePos();
|
|
31823
|
+
const hasJSDoc = hasPrecedingJSDocComment();
|
|
31819
31824
|
const asyncModifier = parseModifiersForArrowFunction();
|
|
31820
31825
|
const expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
|
|
31821
|
-
return parseSimpleArrowFunctionExpression(pos, expr, allowReturnTypeInArrowFunction, asyncModifier);
|
|
31826
|
+
return parseSimpleArrowFunctionExpression(pos, expr, allowReturnTypeInArrowFunction, hasJSDoc, asyncModifier);
|
|
31822
31827
|
}
|
|
31823
31828
|
}
|
|
31824
31829
|
return void 0;
|
|
@@ -119371,6 +119376,14 @@ ${lanes.join("\n")}
|
|
|
119371
119376
|
case 265 /* TypeAliasDeclaration */:
|
|
119372
119377
|
diagnostics.push(createDiagnosticForNode2(node, Diagnostics.Type_aliases_can_only_be_used_in_TypeScript_files));
|
|
119373
119378
|
return "skip";
|
|
119379
|
+
case 176 /* Constructor */:
|
|
119380
|
+
case 174 /* MethodDeclaration */:
|
|
119381
|
+
case 262 /* FunctionDeclaration */:
|
|
119382
|
+
if (!node.body) {
|
|
119383
|
+
diagnostics.push(createDiagnosticForNode2(node, Diagnostics.Signature_declarations_can_only_be_used_in_TypeScript_files));
|
|
119384
|
+
return "skip";
|
|
119385
|
+
}
|
|
119386
|
+
return;
|
|
119374
119387
|
case 266 /* EnumDeclaration */:
|
|
119375
119388
|
const enumKeyword = Debug.checkDefined(tokenToString(94 /* EnumKeyword */));
|
|
119376
119389
|
diagnostics.push(createDiagnosticForNode2(node, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, enumKeyword));
|
|
@@ -156899,6 +156912,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156899
156912
|
data = originToCompletionEntryData(origin);
|
|
156900
156913
|
hasAction = !importStatementCompletion;
|
|
156901
156914
|
}
|
|
156915
|
+
const parentNamedImportOrExport = findAncestor(location, isNamedImportsOrExports);
|
|
156916
|
+
if ((parentNamedImportOrExport == null ? void 0 : parentNamedImportOrExport.kind) === 275 /* NamedImports */) {
|
|
156917
|
+
const possibleToken = stringToToken(name);
|
|
156918
|
+
if (parentNamedImportOrExport && possibleToken && (possibleToken === 135 /* AwaitKeyword */ || isNonContextualKeyword(possibleToken))) {
|
|
156919
|
+
insertText = `${name} as ${name}_`;
|
|
156920
|
+
}
|
|
156921
|
+
}
|
|
156902
156922
|
return {
|
|
156903
156923
|
name,
|
|
156904
156924
|
kind: ts_SymbolDisplay_exports.getSymbolKind(typeChecker, symbol, location),
|
|
@@ -157679,7 +157699,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157679
157699
|
}
|
|
157680
157700
|
function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken) {
|
|
157681
157701
|
if (data == null ? void 0 : data.moduleSpecifier) {
|
|
157682
|
-
if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementSpan) {
|
|
157702
|
+
if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken, sourceFile).replacementSpan) {
|
|
157683
157703
|
return { codeActions: void 0, sourceDisplay: [textPart(data.moduleSpecifier)] };
|
|
157684
157704
|
}
|
|
157685
157705
|
}
|
|
@@ -157892,7 +157912,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157892
157912
|
let isNewIdentifierLocation = false;
|
|
157893
157913
|
let flags = 0 /* None */;
|
|
157894
157914
|
if (contextToken) {
|
|
157895
|
-
const importStatementCompletionInfo = getImportStatementCompletionInfo(contextToken);
|
|
157915
|
+
const importStatementCompletionInfo = getImportStatementCompletionInfo(contextToken, sourceFile);
|
|
157896
157916
|
if (importStatementCompletionInfo.keywordCompletion) {
|
|
157897
157917
|
if (importStatementCompletionInfo.isKeywordOnlyCompletion) {
|
|
157898
157918
|
return {
|
|
@@ -159523,7 +159543,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159523
159543
|
}
|
|
159524
159544
|
return void 0;
|
|
159525
159545
|
}
|
|
159526
|
-
function getImportStatementCompletionInfo(contextToken) {
|
|
159546
|
+
function getImportStatementCompletionInfo(contextToken, sourceFile) {
|
|
159527
159547
|
var _a, _b, _c;
|
|
159528
159548
|
let keywordCompletion;
|
|
159529
159549
|
let isKeywordOnlyCompletion = false;
|
|
@@ -159539,6 +159559,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159539
159559
|
function getCandidate() {
|
|
159540
159560
|
const parent2 = contextToken.parent;
|
|
159541
159561
|
if (isImportEqualsDeclaration(parent2)) {
|
|
159562
|
+
const lastToken = parent2.getLastToken(sourceFile);
|
|
159563
|
+
if (isIdentifier(contextToken) && lastToken !== contextToken) {
|
|
159564
|
+
keywordCompletion = 161 /* FromKeyword */;
|
|
159565
|
+
isKeywordOnlyCompletion = true;
|
|
159566
|
+
return void 0;
|
|
159567
|
+
}
|
|
159542
159568
|
keywordCompletion = contextToken.kind === 156 /* TypeKeyword */ ? void 0 : 156 /* TypeKeyword */;
|
|
159543
159569
|
return isModuleSpecifierMissingOrEmpty(parent2.moduleReference) ? parent2 : void 0;
|
|
159544
159570
|
}
|
|
@@ -160106,7 +160132,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
160106
160132
|
extensionOptions,
|
|
160107
160133
|
host,
|
|
160108
160134
|
/*moduleSpecifierIsRelative*/
|
|
160109
|
-
|
|
160135
|
+
true,
|
|
160110
160136
|
scriptPath
|
|
160111
160137
|
).values());
|
|
160112
160138
|
}
|
package/lib/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.2";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230702`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -8769,6 +8769,7 @@ ${lanes.join("\n")}
|
|
|
8769
8769
|
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."),
|
|
8770
8770
|
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."),
|
|
8771
8771
|
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."),
|
|
8772
|
+
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."),
|
|
8772
8773
|
Report_errors_in_js_files: diag(8019, 3 /* Message */, "Report_errors_in_js_files_8019", "Report errors in .js files."),
|
|
8773
8774
|
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."),
|
|
8774
8775
|
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."),
|
|
@@ -29065,7 +29066,8 @@ ${lanes.join("\n")}
|
|
|
29065
29066
|
nextToken();
|
|
29066
29067
|
const statements = parseList(0 /* SourceElements */, parseStatement);
|
|
29067
29068
|
Debug.assert(token() === 1 /* EndOfFileToken */);
|
|
29068
|
-
const
|
|
29069
|
+
const endHasJSDoc = hasPrecedingJSDocComment();
|
|
29070
|
+
const endOfFileToken = withJSDoc(parseTokenNode(), endHasJSDoc);
|
|
29069
29071
|
const sourceFile = createSourceFile2(fileName, languageVersion2, scriptKind2, isDeclarationFile, statements, endOfFileToken, sourceFlags, setExternalModuleIndicator2);
|
|
29070
29072
|
processCommentPragmas(sourceFile, sourceText);
|
|
29071
29073
|
processPragmasIntoFields(sourceFile, reportPragmaDiagnostic);
|
|
@@ -29085,11 +29087,11 @@ ${lanes.join("\n")}
|
|
|
29085
29087
|
parseDiagnostics.push(createDetachedDiagnostic(fileName, pos, end, diagnostic));
|
|
29086
29088
|
}
|
|
29087
29089
|
}
|
|
29088
|
-
function withJSDoc(node, hasJSDoc) {
|
|
29089
|
-
return hasJSDoc ? addJSDocComment(node) : node;
|
|
29090
|
-
}
|
|
29091
29090
|
let hasDeprecatedTag = false;
|
|
29092
|
-
function
|
|
29091
|
+
function withJSDoc(node, hasJSDoc) {
|
|
29092
|
+
if (!hasJSDoc) {
|
|
29093
|
+
return node;
|
|
29094
|
+
}
|
|
29093
29095
|
Debug.assert(!node.jsDoc);
|
|
29094
29096
|
const jsDoc = mapDefined(getJSDocCommentRanges(node, sourceText), (comment) => JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos));
|
|
29095
29097
|
if (jsDoc.length)
|
|
@@ -31604,12 +31606,14 @@ ${lanes.join("\n")}
|
|
|
31604
31606
|
return arrowExpression;
|
|
31605
31607
|
}
|
|
31606
31608
|
const pos = getNodePos();
|
|
31609
|
+
const hasJSDoc = hasPrecedingJSDocComment();
|
|
31607
31610
|
const expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
|
|
31608
31611
|
if (expr.kind === 80 /* Identifier */ && token() === 39 /* EqualsGreaterThanToken */) {
|
|
31609
31612
|
return parseSimpleArrowFunctionExpression(
|
|
31610
31613
|
pos,
|
|
31611
31614
|
expr,
|
|
31612
31615
|
allowReturnTypeInArrowFunction,
|
|
31616
|
+
hasJSDoc,
|
|
31613
31617
|
/*asyncModifier*/
|
|
31614
31618
|
void 0
|
|
31615
31619
|
);
|
|
@@ -31655,7 +31659,7 @@ ${lanes.join("\n")}
|
|
|
31655
31659
|
), pos);
|
|
31656
31660
|
}
|
|
31657
31661
|
}
|
|
31658
|
-
function parseSimpleArrowFunctionExpression(pos, identifier, allowReturnTypeInArrowFunction, asyncModifier) {
|
|
31662
|
+
function parseSimpleArrowFunctionExpression(pos, identifier, allowReturnTypeInArrowFunction, hasJSDoc, asyncModifier) {
|
|
31659
31663
|
Debug.assert(token() === 39 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
|
|
31660
31664
|
const parameter = factory2.createParameterDeclaration(
|
|
31661
31665
|
/*modifiers*/
|
|
@@ -31688,7 +31692,7 @@ ${lanes.join("\n")}
|
|
|
31688
31692
|
equalsGreaterThanToken,
|
|
31689
31693
|
body
|
|
31690
31694
|
);
|
|
31691
|
-
return
|
|
31695
|
+
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
31692
31696
|
}
|
|
31693
31697
|
function tryParseParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction) {
|
|
31694
31698
|
const triState = isParenthesizedArrowFunctionExpression();
|
|
@@ -31816,9 +31820,10 @@ ${lanes.join("\n")}
|
|
|
31816
31820
|
if (token() === 134 /* AsyncKeyword */) {
|
|
31817
31821
|
if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
|
|
31818
31822
|
const pos = getNodePos();
|
|
31823
|
+
const hasJSDoc = hasPrecedingJSDocComment();
|
|
31819
31824
|
const asyncModifier = parseModifiersForArrowFunction();
|
|
31820
31825
|
const expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
|
|
31821
|
-
return parseSimpleArrowFunctionExpression(pos, expr, allowReturnTypeInArrowFunction, asyncModifier);
|
|
31826
|
+
return parseSimpleArrowFunctionExpression(pos, expr, allowReturnTypeInArrowFunction, hasJSDoc, asyncModifier);
|
|
31822
31827
|
}
|
|
31823
31828
|
}
|
|
31824
31829
|
return void 0;
|
|
@@ -119371,6 +119376,14 @@ ${lanes.join("\n")}
|
|
|
119371
119376
|
case 265 /* TypeAliasDeclaration */:
|
|
119372
119377
|
diagnostics.push(createDiagnosticForNode2(node, Diagnostics.Type_aliases_can_only_be_used_in_TypeScript_files));
|
|
119373
119378
|
return "skip";
|
|
119379
|
+
case 176 /* Constructor */:
|
|
119380
|
+
case 174 /* MethodDeclaration */:
|
|
119381
|
+
case 262 /* FunctionDeclaration */:
|
|
119382
|
+
if (!node.body) {
|
|
119383
|
+
diagnostics.push(createDiagnosticForNode2(node, Diagnostics.Signature_declarations_can_only_be_used_in_TypeScript_files));
|
|
119384
|
+
return "skip";
|
|
119385
|
+
}
|
|
119386
|
+
return;
|
|
119374
119387
|
case 266 /* EnumDeclaration */:
|
|
119375
119388
|
const enumKeyword = Debug.checkDefined(tokenToString(94 /* EnumKeyword */));
|
|
119376
119389
|
diagnostics.push(createDiagnosticForNode2(node, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, enumKeyword));
|
|
@@ -156914,6 +156927,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156914
156927
|
data = originToCompletionEntryData(origin);
|
|
156915
156928
|
hasAction = !importStatementCompletion;
|
|
156916
156929
|
}
|
|
156930
|
+
const parentNamedImportOrExport = findAncestor(location, isNamedImportsOrExports);
|
|
156931
|
+
if ((parentNamedImportOrExport == null ? void 0 : parentNamedImportOrExport.kind) === 275 /* NamedImports */) {
|
|
156932
|
+
const possibleToken = stringToToken(name);
|
|
156933
|
+
if (parentNamedImportOrExport && possibleToken && (possibleToken === 135 /* AwaitKeyword */ || isNonContextualKeyword(possibleToken))) {
|
|
156934
|
+
insertText = `${name} as ${name}_`;
|
|
156935
|
+
}
|
|
156936
|
+
}
|
|
156917
156937
|
return {
|
|
156918
156938
|
name,
|
|
156919
156939
|
kind: ts_SymbolDisplay_exports.getSymbolKind(typeChecker, symbol, location),
|
|
@@ -157694,7 +157714,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157694
157714
|
}
|
|
157695
157715
|
function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken) {
|
|
157696
157716
|
if (data == null ? void 0 : data.moduleSpecifier) {
|
|
157697
|
-
if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementSpan) {
|
|
157717
|
+
if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken, sourceFile).replacementSpan) {
|
|
157698
157718
|
return { codeActions: void 0, sourceDisplay: [textPart(data.moduleSpecifier)] };
|
|
157699
157719
|
}
|
|
157700
157720
|
}
|
|
@@ -157907,7 +157927,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157907
157927
|
let isNewIdentifierLocation = false;
|
|
157908
157928
|
let flags = 0 /* None */;
|
|
157909
157929
|
if (contextToken) {
|
|
157910
|
-
const importStatementCompletionInfo = getImportStatementCompletionInfo(contextToken);
|
|
157930
|
+
const importStatementCompletionInfo = getImportStatementCompletionInfo(contextToken, sourceFile);
|
|
157911
157931
|
if (importStatementCompletionInfo.keywordCompletion) {
|
|
157912
157932
|
if (importStatementCompletionInfo.isKeywordOnlyCompletion) {
|
|
157913
157933
|
return {
|
|
@@ -159538,7 +159558,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159538
159558
|
}
|
|
159539
159559
|
return void 0;
|
|
159540
159560
|
}
|
|
159541
|
-
function getImportStatementCompletionInfo(contextToken) {
|
|
159561
|
+
function getImportStatementCompletionInfo(contextToken, sourceFile) {
|
|
159542
159562
|
var _a, _b, _c;
|
|
159543
159563
|
let keywordCompletion;
|
|
159544
159564
|
let isKeywordOnlyCompletion = false;
|
|
@@ -159554,6 +159574,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159554
159574
|
function getCandidate() {
|
|
159555
159575
|
const parent2 = contextToken.parent;
|
|
159556
159576
|
if (isImportEqualsDeclaration(parent2)) {
|
|
159577
|
+
const lastToken = parent2.getLastToken(sourceFile);
|
|
159578
|
+
if (isIdentifier(contextToken) && lastToken !== contextToken) {
|
|
159579
|
+
keywordCompletion = 161 /* FromKeyword */;
|
|
159580
|
+
isKeywordOnlyCompletion = true;
|
|
159581
|
+
return void 0;
|
|
159582
|
+
}
|
|
159557
159583
|
keywordCompletion = contextToken.kind === 156 /* TypeKeyword */ ? void 0 : 156 /* TypeKeyword */;
|
|
159558
159584
|
return isModuleSpecifierMissingOrEmpty(parent2.moduleReference) ? parent2 : void 0;
|
|
159559
159585
|
}
|
|
@@ -160121,7 +160147,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
160121
160147
|
extensionOptions,
|
|
160122
160148
|
host,
|
|
160123
160149
|
/*moduleSpecifierIsRelative*/
|
|
160124
|
-
|
|
160150
|
+
true,
|
|
160125
160151
|
scriptPath
|
|
160126
160152
|
).values());
|
|
160127
160153
|
}
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
|
|
|
54
54
|
|
|
55
55
|
// src/compiler/corePublic.ts
|
|
56
56
|
var versionMajorMinor = "5.2";
|
|
57
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
57
|
+
var version = `${versionMajorMinor}.0-dev.20230702`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -6839,6 +6839,7 @@ var Diagnostics = {
|
|
|
6839
6839
|
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."),
|
|
6840
6840
|
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."),
|
|
6841
6841
|
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."),
|
|
6842
|
+
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."),
|
|
6842
6843
|
Report_errors_in_js_files: diag(8019, 3 /* Message */, "Report_errors_in_js_files_8019", "Report errors in .js files."),
|
|
6843
6844
|
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."),
|
|
6844
6845
|
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."),
|
|
@@ -18498,7 +18499,8 @@ var Parser;
|
|
|
18498
18499
|
nextToken();
|
|
18499
18500
|
const statements = parseList(0 /* SourceElements */, parseStatement);
|
|
18500
18501
|
Debug.assert(token() === 1 /* EndOfFileToken */);
|
|
18501
|
-
const
|
|
18502
|
+
const endHasJSDoc = hasPrecedingJSDocComment();
|
|
18503
|
+
const endOfFileToken = withJSDoc(parseTokenNode(), endHasJSDoc);
|
|
18502
18504
|
const sourceFile = createSourceFile2(fileName, languageVersion2, scriptKind2, isDeclarationFile, statements, endOfFileToken, sourceFlags, setExternalModuleIndicator2);
|
|
18503
18505
|
processCommentPragmas(sourceFile, sourceText);
|
|
18504
18506
|
processPragmasIntoFields(sourceFile, reportPragmaDiagnostic);
|
|
@@ -18518,11 +18520,11 @@ var Parser;
|
|
|
18518
18520
|
parseDiagnostics.push(createDetachedDiagnostic(fileName, pos, end, diagnostic));
|
|
18519
18521
|
}
|
|
18520
18522
|
}
|
|
18521
|
-
function withJSDoc(node, hasJSDoc) {
|
|
18522
|
-
return hasJSDoc ? addJSDocComment(node) : node;
|
|
18523
|
-
}
|
|
18524
18523
|
let hasDeprecatedTag = false;
|
|
18525
|
-
function
|
|
18524
|
+
function withJSDoc(node, hasJSDoc) {
|
|
18525
|
+
if (!hasJSDoc) {
|
|
18526
|
+
return node;
|
|
18527
|
+
}
|
|
18526
18528
|
Debug.assert(!node.jsDoc);
|
|
18527
18529
|
const jsDoc = mapDefined(getJSDocCommentRanges(node, sourceText), (comment) => JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos));
|
|
18528
18530
|
if (jsDoc.length)
|
|
@@ -21037,12 +21039,14 @@ var Parser;
|
|
|
21037
21039
|
return arrowExpression;
|
|
21038
21040
|
}
|
|
21039
21041
|
const pos = getNodePos();
|
|
21042
|
+
const hasJSDoc = hasPrecedingJSDocComment();
|
|
21040
21043
|
const expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
|
|
21041
21044
|
if (expr.kind === 80 /* Identifier */ && token() === 39 /* EqualsGreaterThanToken */) {
|
|
21042
21045
|
return parseSimpleArrowFunctionExpression(
|
|
21043
21046
|
pos,
|
|
21044
21047
|
expr,
|
|
21045
21048
|
allowReturnTypeInArrowFunction,
|
|
21049
|
+
hasJSDoc,
|
|
21046
21050
|
/*asyncModifier*/
|
|
21047
21051
|
void 0
|
|
21048
21052
|
);
|
|
@@ -21088,7 +21092,7 @@ var Parser;
|
|
|
21088
21092
|
), pos);
|
|
21089
21093
|
}
|
|
21090
21094
|
}
|
|
21091
|
-
function parseSimpleArrowFunctionExpression(pos, identifier, allowReturnTypeInArrowFunction, asyncModifier) {
|
|
21095
|
+
function parseSimpleArrowFunctionExpression(pos, identifier, allowReturnTypeInArrowFunction, hasJSDoc, asyncModifier) {
|
|
21092
21096
|
Debug.assert(token() === 39 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
|
|
21093
21097
|
const parameter = factory2.createParameterDeclaration(
|
|
21094
21098
|
/*modifiers*/
|
|
@@ -21121,7 +21125,7 @@ var Parser;
|
|
|
21121
21125
|
equalsGreaterThanToken,
|
|
21122
21126
|
body
|
|
21123
21127
|
);
|
|
21124
|
-
return
|
|
21128
|
+
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
21125
21129
|
}
|
|
21126
21130
|
function tryParseParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction) {
|
|
21127
21131
|
const triState = isParenthesizedArrowFunctionExpression();
|
|
@@ -21249,9 +21253,10 @@ var Parser;
|
|
|
21249
21253
|
if (token() === 134 /* AsyncKeyword */) {
|
|
21250
21254
|
if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
|
|
21251
21255
|
const pos = getNodePos();
|
|
21256
|
+
const hasJSDoc = hasPrecedingJSDocComment();
|
|
21252
21257
|
const asyncModifier = parseModifiersForArrowFunction();
|
|
21253
21258
|
const expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
|
|
21254
|
-
return parseSimpleArrowFunctionExpression(pos, expr, allowReturnTypeInArrowFunction, asyncModifier);
|
|
21259
|
+
return parseSimpleArrowFunctionExpression(pos, expr, allowReturnTypeInArrowFunction, hasJSDoc, asyncModifier);
|
|
21255
21260
|
}
|
|
21256
21261
|
}
|
|
21257
21262
|
return void 0;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.2.0-dev.
|
|
5
|
+
"version": "5.2.0-dev.20230702",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
"node": "20.1.0",
|
|
115
115
|
"npm": "8.19.4"
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "88cb76d314a93937ce8d9543114ccbad993be6d1"
|
|
118
118
|
}
|