@typescript-deploys/pr-build 5.2.0-pr-54788-8 → 5.2.0-pr-54795-7
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 +17 -22
- package/lib/tsserver.js +71 -27
- package/lib/tsserverlibrary.d.ts +2 -2
- package/lib/tsserverlibrary.js +71 -27
- package/lib/typescript.d.ts +2 -2
- package/lib/typescript.js +71 -27
- package/lib/typingsInstaller.js +2 -1
- 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-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20230627`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -7746,6 +7746,7 @@ var Diagnostics = {
|
|
|
7746
7746
|
Inline_variable: diag(95184, 3 /* Message */, "Inline_variable_95184", "Inline variable"),
|
|
7747
7747
|
Could_not_find_variable_to_inline: diag(95185, 3 /* Message */, "Could_not_find_variable_to_inline_95185", "Could not find variable to inline."),
|
|
7748
7748
|
Variables_with_multiple_declarations_cannot_be_inlined: diag(95186, 3 /* Message */, "Variables_with_multiple_declarations_cannot_be_inlined_95186", "Variables with multiple declarations cannot be inlined."),
|
|
7749
|
+
Add_missing_comma_for_object_member_completion_0: diag(95187, 3 /* Message */, "Add_missing_comma_for_object_member_completion_0_95187", "Add missing comma for object member completion '{0}'."),
|
|
7749
7750
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
7750
7751
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
7751
7752
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -46167,7 +46168,6 @@ function createTypeChecker(host) {
|
|
|
46167
46168
|
const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = findAncestor(location, isImportCall)) == null ? void 0 : _a.arguments[0]) || ((_b = findAncestor(location, isImportDeclaration)) == null ? void 0 : _b.moduleSpecifier) || ((_c = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _c.moduleReference.expression) || ((_d = findAncestor(location, isExportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _e.name) || ((_f = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _f.argument.literal);
|
|
46168
46169
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
46169
46170
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
46170
|
-
const moduleKind2 = getEmitModuleKind(compilerOptions);
|
|
46171
46171
|
const resolvedModule = getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
46172
46172
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
46173
46173
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
@@ -46200,7 +46200,7 @@ function createTypeChecker(host) {
|
|
|
46200
46200
|
moduleReference
|
|
46201
46201
|
);
|
|
46202
46202
|
}
|
|
46203
|
-
if (
|
|
46203
|
+
if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
|
|
46204
46204
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
46205
46205
|
const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
46206
46206
|
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_h = overrideClauseHost.assertions) == null ? void 0 : _h.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
|
|
@@ -46324,7 +46324,7 @@ function createTypeChecker(host) {
|
|
|
46324
46324
|
return void 0;
|
|
46325
46325
|
function getSuggestedImportSource(tsExtension) {
|
|
46326
46326
|
const importSourceWithoutExtension = removeExtension(moduleReference, tsExtension);
|
|
46327
|
-
if (emitModuleKindIsNonNodeESM(
|
|
46327
|
+
if (emitModuleKindIsNonNodeESM(moduleKind) || mode === 99 /* ESNext */) {
|
|
46328
46328
|
const preferTs = isDeclarationFileName(moduleReference) && shouldAllowImportingTsExtension(compilerOptions);
|
|
46329
46329
|
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";
|
|
46330
46330
|
return importSourceWithoutExtension + ext;
|
|
@@ -65601,14 +65601,12 @@ function createTypeChecker(host) {
|
|
|
65601
65601
|
return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue);
|
|
65602
65602
|
}
|
|
65603
65603
|
const target = getReferenceCandidate(expr.right);
|
|
65604
|
-
|
|
65605
|
-
if (leftType.flags & 8576 /* StringOrNumberLiteralOrUnique */) {
|
|
65606
|
-
|
|
65607
|
-
|
|
65608
|
-
|
|
65609
|
-
|
|
65610
|
-
return narrowTypeByInKeyword(type, leftType, assumeTrue);
|
|
65611
|
-
}
|
|
65604
|
+
let leftType;
|
|
65605
|
+
if (containsMissingType(type) && isAccessExpression(reference) && isMatchingReference(reference.expression, target) && (leftType = getTypeOfExpression(expr.left)).flags & 8576 /* StringOrNumberLiteralOrUnique */ && getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) {
|
|
65606
|
+
return getTypeWithFacts(type, assumeTrue ? 524288 /* NEUndefined */ : 65536 /* EQUndefined */);
|
|
65607
|
+
}
|
|
65608
|
+
if (isMatchingReference(reference, target) && (leftType = getTypeOfExpression(expr.left)).flags & 8576 /* StringOrNumberLiteralOrUnique */) {
|
|
65609
|
+
return narrowTypeByInKeyword(type, leftType, assumeTrue);
|
|
65612
65610
|
}
|
|
65613
65611
|
break;
|
|
65614
65612
|
case 28 /* CommaToken */:
|
|
@@ -66630,17 +66628,14 @@ function createTypeChecker(host) {
|
|
|
66630
66628
|
}
|
|
66631
66629
|
}
|
|
66632
66630
|
function getTypeForThisExpressionFromJSDoc(node) {
|
|
66633
|
-
const jsdocType = getJSDocType(node);
|
|
66634
|
-
if (jsdocType && jsdocType.kind === 324 /* JSDocFunctionType */) {
|
|
66635
|
-
const jsDocFunctionType = jsdocType;
|
|
66636
|
-
if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && jsDocFunctionType.parameters[0].name.escapedText === "this" /* This */) {
|
|
66637
|
-
return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type);
|
|
66638
|
-
}
|
|
66639
|
-
}
|
|
66640
66631
|
const thisTag = getJSDocThisTag(node);
|
|
66641
66632
|
if (thisTag && thisTag.typeExpression) {
|
|
66642
66633
|
return getTypeFromTypeNode(thisTag.typeExpression);
|
|
66643
66634
|
}
|
|
66635
|
+
const signature = getSignatureOfTypeTag(node);
|
|
66636
|
+
if (signature) {
|
|
66637
|
+
return getThisTypeOfSignature(signature);
|
|
66638
|
+
}
|
|
66644
66639
|
}
|
|
66645
66640
|
function isInConstructorArgumentInitializer(node, constructorDecl) {
|
|
66646
66641
|
return !!findAncestor(node, (n) => isFunctionLikeDeclaration(n) ? "quit" : n.kind === 169 /* Parameter */ && n.parent === constructorDecl);
|
|
@@ -115085,9 +115080,9 @@ function getConfigFileParsingDiagnostics(configFileParseResult) {
|
|
|
115085
115080
|
return configFileParseResult.options.configFile ? [...configFileParseResult.options.configFile.parseDiagnostics, ...configFileParseResult.errors] : configFileParseResult.errors;
|
|
115086
115081
|
}
|
|
115087
115082
|
function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) {
|
|
115088
|
-
switch (
|
|
115089
|
-
case
|
|
115090
|
-
case
|
|
115083
|
+
switch (getEmitModuleResolutionKind(options)) {
|
|
115084
|
+
case 3 /* Node16 */:
|
|
115085
|
+
case 99 /* NodeNext */:
|
|
115091
115086
|
return fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? 99 /* ESNext */ : fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? 1 /* CommonJS */ : fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]) ? lookupFromPackageJson() : void 0;
|
|
115092
115087
|
default:
|
|
115093
115088
|
return void 0;
|
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-insiders.
|
|
2330
|
+
var version = `${versionMajorMinor}.0-insiders.20230627`;
|
|
2331
2331
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2332
2332
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2333
2333
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -11267,6 +11267,7 @@ var Diagnostics = {
|
|
|
11267
11267
|
Inline_variable: diag(95184, 3 /* Message */, "Inline_variable_95184", "Inline variable"),
|
|
11268
11268
|
Could_not_find_variable_to_inline: diag(95185, 3 /* Message */, "Could_not_find_variable_to_inline_95185", "Could not find variable to inline."),
|
|
11269
11269
|
Variables_with_multiple_declarations_cannot_be_inlined: diag(95186, 3 /* Message */, "Variables_with_multiple_declarations_cannot_be_inlined_95186", "Variables with multiple declarations cannot be inlined."),
|
|
11270
|
+
Add_missing_comma_for_object_member_completion_0: diag(95187, 3 /* Message */, "Add_missing_comma_for_object_member_completion_0_95187", "Add missing comma for object member completion '{0}'."),
|
|
11270
11271
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
11271
11272
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
11272
11273
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -50843,7 +50844,6 @@ function createTypeChecker(host) {
|
|
|
50843
50844
|
const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = findAncestor(location, isImportCall)) == null ? void 0 : _a.arguments[0]) || ((_b = findAncestor(location, isImportDeclaration)) == null ? void 0 : _b.moduleSpecifier) || ((_c = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _c.moduleReference.expression) || ((_d = findAncestor(location, isExportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _e.name) || ((_f = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _f.argument.literal);
|
|
50844
50845
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
50845
50846
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
50846
|
-
const moduleKind2 = getEmitModuleKind(compilerOptions);
|
|
50847
50847
|
const resolvedModule = getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
50848
50848
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
50849
50849
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
@@ -50876,7 +50876,7 @@ function createTypeChecker(host) {
|
|
|
50876
50876
|
moduleReference
|
|
50877
50877
|
);
|
|
50878
50878
|
}
|
|
50879
|
-
if (
|
|
50879
|
+
if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
|
|
50880
50880
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
50881
50881
|
const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
50882
50882
|
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_h = overrideClauseHost.assertions) == null ? void 0 : _h.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
|
|
@@ -51000,7 +51000,7 @@ function createTypeChecker(host) {
|
|
|
51000
51000
|
return void 0;
|
|
51001
51001
|
function getSuggestedImportSource(tsExtension) {
|
|
51002
51002
|
const importSourceWithoutExtension = removeExtension(moduleReference, tsExtension);
|
|
51003
|
-
if (emitModuleKindIsNonNodeESM(
|
|
51003
|
+
if (emitModuleKindIsNonNodeESM(moduleKind) || mode === 99 /* ESNext */) {
|
|
51004
51004
|
const preferTs = isDeclarationFileName(moduleReference) && shouldAllowImportingTsExtension(compilerOptions);
|
|
51005
51005
|
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";
|
|
51006
51006
|
return importSourceWithoutExtension + ext;
|
|
@@ -70277,14 +70277,12 @@ function createTypeChecker(host) {
|
|
|
70277
70277
|
return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue);
|
|
70278
70278
|
}
|
|
70279
70279
|
const target = getReferenceCandidate(expr.right);
|
|
70280
|
-
|
|
70281
|
-
if (leftType.flags & 8576 /* StringOrNumberLiteralOrUnique */) {
|
|
70282
|
-
|
|
70283
|
-
|
|
70284
|
-
|
|
70285
|
-
|
|
70286
|
-
return narrowTypeByInKeyword(type, leftType, assumeTrue);
|
|
70287
|
-
}
|
|
70280
|
+
let leftType;
|
|
70281
|
+
if (containsMissingType(type) && isAccessExpression(reference) && isMatchingReference(reference.expression, target) && (leftType = getTypeOfExpression(expr.left)).flags & 8576 /* StringOrNumberLiteralOrUnique */ && getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) {
|
|
70282
|
+
return getTypeWithFacts(type, assumeTrue ? 524288 /* NEUndefined */ : 65536 /* EQUndefined */);
|
|
70283
|
+
}
|
|
70284
|
+
if (isMatchingReference(reference, target) && (leftType = getTypeOfExpression(expr.left)).flags & 8576 /* StringOrNumberLiteralOrUnique */) {
|
|
70285
|
+
return narrowTypeByInKeyword(type, leftType, assumeTrue);
|
|
70288
70286
|
}
|
|
70289
70287
|
break;
|
|
70290
70288
|
case 28 /* CommaToken */:
|
|
@@ -71306,17 +71304,14 @@ function createTypeChecker(host) {
|
|
|
71306
71304
|
}
|
|
71307
71305
|
}
|
|
71308
71306
|
function getTypeForThisExpressionFromJSDoc(node) {
|
|
71309
|
-
const jsdocType = getJSDocType(node);
|
|
71310
|
-
if (jsdocType && jsdocType.kind === 324 /* JSDocFunctionType */) {
|
|
71311
|
-
const jsDocFunctionType = jsdocType;
|
|
71312
|
-
if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && jsDocFunctionType.parameters[0].name.escapedText === "this" /* This */) {
|
|
71313
|
-
return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type);
|
|
71314
|
-
}
|
|
71315
|
-
}
|
|
71316
71307
|
const thisTag = getJSDocThisTag(node);
|
|
71317
71308
|
if (thisTag && thisTag.typeExpression) {
|
|
71318
71309
|
return getTypeFromTypeNode(thisTag.typeExpression);
|
|
71319
71310
|
}
|
|
71311
|
+
const signature = getSignatureOfTypeTag(node);
|
|
71312
|
+
if (signature) {
|
|
71313
|
+
return getThisTypeOfSignature(signature);
|
|
71314
|
+
}
|
|
71320
71315
|
}
|
|
71321
71316
|
function isInConstructorArgumentInitializer(node, constructorDecl) {
|
|
71322
71317
|
return !!findAncestor(node, (n) => isFunctionLikeDeclaration(n) ? "quit" : n.kind === 169 /* Parameter */ && n.parent === constructorDecl);
|
|
@@ -119997,9 +119992,9 @@ function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, optio
|
|
|
119997
119992
|
return typeof result === "object" ? result.impliedNodeFormat : result;
|
|
119998
119993
|
}
|
|
119999
119994
|
function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) {
|
|
120000
|
-
switch (
|
|
120001
|
-
case
|
|
120002
|
-
case
|
|
119995
|
+
switch (getEmitModuleResolutionKind(options)) {
|
|
119996
|
+
case 3 /* Node16 */:
|
|
119997
|
+
case 99 /* NodeNext */:
|
|
120003
119998
|
return fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? 99 /* ESNext */ : fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? 1 /* CommonJS */ : fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]) ? lookupFromPackageJson() : void 0;
|
|
120004
119999
|
default:
|
|
120005
120000
|
return void 0;
|
|
@@ -138043,7 +138038,10 @@ function getReplacementExpression(reference, replacement) {
|
|
|
138043
138038
|
if (isExpression(parent2) && (getExpressionPrecedence(replacement) < getExpressionPrecedence(parent2) || needsParentheses(parent2))) {
|
|
138044
138039
|
return factory.createParenthesizedExpression(replacement);
|
|
138045
138040
|
}
|
|
138046
|
-
if (isFunctionLike(replacement) && isCallLikeExpression(parent2)) {
|
|
138041
|
+
if (isFunctionLike(replacement) && (isCallLikeExpression(parent2) || isPropertyAccessExpression(parent2))) {
|
|
138042
|
+
return factory.createParenthesizedExpression(replacement);
|
|
138043
|
+
}
|
|
138044
|
+
if (isPropertyAccessExpression(parent2) && (isNumericLiteral(replacement) || isObjectLiteralExpression(replacement))) {
|
|
138047
138045
|
return factory.createParenthesizedExpression(replacement);
|
|
138048
138046
|
}
|
|
138049
138047
|
return replacement;
|
|
@@ -156661,6 +156659,7 @@ var CompletionSource = /* @__PURE__ */ ((CompletionSource2) => {
|
|
|
156661
156659
|
CompletionSource2["TypeOnlyAlias"] = "TypeOnlyAlias/";
|
|
156662
156660
|
CompletionSource2["ObjectLiteralMethodSnippet"] = "ObjectLiteralMethodSnippet/";
|
|
156663
156661
|
CompletionSource2["SwitchCases"] = "SwitchCases/";
|
|
156662
|
+
CompletionSource2["ObjectLiteralMemberWithComma"] = "ObjectLiteralMemberWithComma/";
|
|
156664
156663
|
return CompletionSource2;
|
|
156665
156664
|
})(CompletionSource || {});
|
|
156666
156665
|
var SymbolOriginInfoKind = /* @__PURE__ */ ((SymbolOriginInfoKind2) => {
|
|
@@ -157539,6 +157538,7 @@ function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
|
|
|
157539
157538
|
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
|
|
157540
157539
|
}
|
|
157541
157540
|
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, position, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol) {
|
|
157541
|
+
var _a, _b;
|
|
157542
157542
|
let insertText;
|
|
157543
157543
|
let filterText;
|
|
157544
157544
|
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
|
|
@@ -157597,6 +157597,12 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
|
|
|
157597
157597
|
if ((origin == null ? void 0 : origin.kind) === 64 /* TypeOnlyAlias */) {
|
|
157598
157598
|
hasAction = true;
|
|
157599
157599
|
}
|
|
157600
|
+
if (completionKind === 0 /* ObjectPropertyDeclaration */ && contextToken && ((_a = findPrecedingToken(contextToken.pos, sourceFile, contextToken)) == null ? void 0 : _a.kind) !== 28 /* CommaToken */) {
|
|
157601
|
+
if (isMethodDeclaration(contextToken.parent.parent) || isGetAccessorDeclaration(contextToken.parent.parent) || isSetAccessorDeclaration(contextToken.parent.parent) || isSpreadAssignment(contextToken.parent) || ((_b = findAncestor(contextToken.parent, isPropertyAssignment)) == null ? void 0 : _b.getLastToken(sourceFile)) === contextToken || isShorthandPropertyAssignment(contextToken.parent) && getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line !== getLineAndCharacterOfPosition(sourceFile, position).line) {
|
|
157602
|
+
source = "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */;
|
|
157603
|
+
hasAction = true;
|
|
157604
|
+
}
|
|
157605
|
+
}
|
|
157600
157606
|
if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* MemberLike */ && isClassLikeMemberCompletion(symbol, location, sourceFile)) {
|
|
157601
157607
|
let importAdder;
|
|
157602
157608
|
const memberCompletionEntry = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext);
|
|
@@ -158327,7 +158333,7 @@ function getSymbolCompletionFromEntryId(program, log, sourceFile, position, entr
|
|
|
158327
158333
|
return firstDefined(symbols, (symbol, index) => {
|
|
158328
158334
|
const origin = symbolToOriginInfoMap[index];
|
|
158329
158335
|
const info = getCompletionEntryDisplayNameForSymbol(symbol, getEmitScriptTarget(compilerOptions), origin, completionKind, completionData.isJsxIdentifierExpected);
|
|
158330
|
-
return info && info.name === entryId.name && (entryId.source === "ClassMemberSnippet/" /* ClassMemberSnippet */ && symbol.flags & 106500 /* ClassMember */ || entryId.source === "ObjectLiteralMethodSnippet/" /* ObjectLiteralMethodSnippet */ && symbol.flags & (4 /* Property */ | 8192 /* Method */) || getSourceFromOrigin(origin) === entryId.source) ? { type: "symbol", symbol, location, origin, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation } : void 0;
|
|
158336
|
+
return info && info.name === entryId.name && (entryId.source === "ClassMemberSnippet/" /* ClassMemberSnippet */ && symbol.flags & 106500 /* ClassMember */ || entryId.source === "ObjectLiteralMethodSnippet/" /* ObjectLiteralMethodSnippet */ && symbol.flags & (4 /* Property */ | 8192 /* Method */) || getSourceFromOrigin(origin) === entryId.source || entryId.source === "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */) ? { type: "symbol", symbol, location, origin, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation } : void 0;
|
|
158331
158337
|
}) || { type: "none" };
|
|
158332
158338
|
}
|
|
158333
158339
|
function getCompletionEntryDetails(program, log, sourceFile, position, entryId, host, formatContext, preferences, cancellationToken) {
|
|
@@ -158472,6 +158478,21 @@ function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextTo
|
|
|
158472
158478
|
Debug.assertIsDefined(codeAction2, "Expected to have a code action for promoting type-only alias");
|
|
158473
158479
|
return { codeActions: [codeAction2], sourceDisplay: void 0 };
|
|
158474
158480
|
}
|
|
158481
|
+
if (source === "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */ && contextToken) {
|
|
158482
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(
|
|
158483
|
+
{ host, formatContext, preferences },
|
|
158484
|
+
(tracker) => tracker.insertText(sourceFile, contextToken.end, ",")
|
|
158485
|
+
);
|
|
158486
|
+
if (changes) {
|
|
158487
|
+
return {
|
|
158488
|
+
sourceDisplay: void 0,
|
|
158489
|
+
codeActions: [{
|
|
158490
|
+
changes,
|
|
158491
|
+
description: diagnosticToString([Diagnostics.Add_missing_comma_for_object_member_completion_0, name])
|
|
158492
|
+
}]
|
|
158493
|
+
};
|
|
158494
|
+
}
|
|
158495
|
+
}
|
|
158475
158496
|
if (!origin || !(originIsExport(origin) || originIsResolvedExport(origin))) {
|
|
158476
158497
|
return { codeActions: void 0, sourceDisplay: void 0 };
|
|
158477
158498
|
}
|
|
@@ -159378,7 +159399,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
159378
159399
|
}
|
|
159379
159400
|
function tryGetObjectLikeCompletionSymbols() {
|
|
159380
159401
|
const symbolsStartIndex = symbols.length;
|
|
159381
|
-
const objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken);
|
|
159402
|
+
const objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken, position, sourceFile);
|
|
159382
159403
|
if (!objectLikeContainer)
|
|
159383
159404
|
return 0 /* Continue */;
|
|
159384
159405
|
completionKind = 0 /* ObjectPropertyDeclaration */;
|
|
@@ -159864,7 +159885,8 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
159864
159885
|
return node2.getStart(sourceFile) <= position && position <= node2.getEnd();
|
|
159865
159886
|
}
|
|
159866
159887
|
}
|
|
159867
|
-
function tryGetObjectLikeCompletionContainer(contextToken) {
|
|
159888
|
+
function tryGetObjectLikeCompletionContainer(contextToken, position, sourceFile) {
|
|
159889
|
+
var _a;
|
|
159868
159890
|
if (contextToken) {
|
|
159869
159891
|
const { parent: parent2 } = contextToken;
|
|
159870
159892
|
switch (contextToken.kind) {
|
|
@@ -159879,7 +159901,29 @@ function tryGetObjectLikeCompletionContainer(contextToken) {
|
|
|
159879
159901
|
case 134 /* AsyncKeyword */:
|
|
159880
159902
|
return tryCast(parent2.parent, isObjectLiteralExpression);
|
|
159881
159903
|
case 80 /* Identifier */:
|
|
159882
|
-
|
|
159904
|
+
if (contextToken.text === "async" && isShorthandPropertyAssignment(contextToken.parent)) {
|
|
159905
|
+
return contextToken.parent.parent;
|
|
159906
|
+
} else {
|
|
159907
|
+
if (isObjectLiteralExpression(contextToken.parent.parent) && (isSpreadAssignment(contextToken.parent) || isShorthandPropertyAssignment(contextToken.parent) && getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line !== getLineAndCharacterOfPosition(sourceFile, position).line)) {
|
|
159908
|
+
return contextToken.parent.parent;
|
|
159909
|
+
}
|
|
159910
|
+
const ancestorNode2 = findAncestor(parent2, isPropertyAssignment);
|
|
159911
|
+
if ((ancestorNode2 == null ? void 0 : ancestorNode2.getLastToken(sourceFile)) === contextToken && isObjectLiteralExpression(ancestorNode2.parent)) {
|
|
159912
|
+
return ancestorNode2.parent;
|
|
159913
|
+
}
|
|
159914
|
+
}
|
|
159915
|
+
break;
|
|
159916
|
+
default:
|
|
159917
|
+
if (((_a = parent2.parent) == null ? void 0 : _a.parent) && (isMethodDeclaration(parent2.parent) || isGetAccessorDeclaration(parent2.parent) || isSetAccessorDeclaration(parent2.parent)) && isObjectLiteralExpression(parent2.parent.parent)) {
|
|
159918
|
+
return parent2.parent.parent;
|
|
159919
|
+
}
|
|
159920
|
+
if (isSpreadAssignment(parent2) && isObjectLiteralExpression(parent2.parent)) {
|
|
159921
|
+
return parent2.parent;
|
|
159922
|
+
}
|
|
159923
|
+
const ancestorNode = findAncestor(parent2, isPropertyAssignment);
|
|
159924
|
+
if (contextToken.kind !== 59 /* ColonToken */ && (ancestorNode == null ? void 0 : ancestorNode.getLastToken(sourceFile)) === contextToken && isObjectLiteralExpression(ancestorNode.parent)) {
|
|
159925
|
+
return ancestorNode.parent;
|
|
159926
|
+
}
|
|
159883
159927
|
}
|
|
159884
159928
|
}
|
|
159885
159929
|
return void 0;
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -9191,7 +9191,7 @@ declare namespace ts {
|
|
|
9191
9191
|
/**
|
|
9192
9192
|
* Controls the format the file is detected as - this can be derived from only the path
|
|
9193
9193
|
* and files on disk, but needs to be done with a module resolution cache in scope to be performant.
|
|
9194
|
-
* This is usually `undefined` for compilations that do not have `
|
|
9194
|
+
* This is usually `undefined` for compilations that do not have `moduleResolution` values of `node16` or `nodenext`.
|
|
9195
9195
|
*/
|
|
9196
9196
|
impliedNodeFormat?: ResolutionMode;
|
|
9197
9197
|
/**
|
|
@@ -9504,7 +9504,7 @@ declare namespace ts {
|
|
|
9504
9504
|
* Calculates the final resolution mode for a given module reference node. This is generally the explicitly provided resolution mode, if
|
|
9505
9505
|
* one exists, or the mode of the containing source file. (Excepting import=require, which is always commonjs, and dynamic import, which is always esm).
|
|
9506
9506
|
* Notably, this function always returns `undefined` if the containing file has an `undefined` `impliedNodeFormat` - this field is only set when
|
|
9507
|
-
* `
|
|
9507
|
+
* `moduleResolution` is `node16`+.
|
|
9508
9508
|
* @param file The file the import or import-like reference is contained within
|
|
9509
9509
|
* @param usage The module reference string
|
|
9510
9510
|
* @returns The final resolution mode of the import
|
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-insiders.
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20230627`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -9050,6 +9050,7 @@ ${lanes.join("\n")}
|
|
|
9050
9050
|
Inline_variable: diag(95184, 3 /* Message */, "Inline_variable_95184", "Inline variable"),
|
|
9051
9051
|
Could_not_find_variable_to_inline: diag(95185, 3 /* Message */, "Could_not_find_variable_to_inline_95185", "Could not find variable to inline."),
|
|
9052
9052
|
Variables_with_multiple_declarations_cannot_be_inlined: diag(95186, 3 /* Message */, "Variables_with_multiple_declarations_cannot_be_inlined_95186", "Variables with multiple declarations cannot be inlined."),
|
|
9053
|
+
Add_missing_comma_for_object_member_completion_0: diag(95187, 3 /* Message */, "Add_missing_comma_for_object_member_completion_0_95187", "Add missing comma for object member completion '{0}'."),
|
|
9053
9054
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
9054
9055
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
9055
9056
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -48610,7 +48611,6 @@ ${lanes.join("\n")}
|
|
|
48610
48611
|
const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = findAncestor(location, isImportCall)) == null ? void 0 : _a.arguments[0]) || ((_b = findAncestor(location, isImportDeclaration)) == null ? void 0 : _b.moduleSpecifier) || ((_c = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _c.moduleReference.expression) || ((_d = findAncestor(location, isExportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _e.name) || ((_f = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _f.argument.literal);
|
|
48611
48612
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
48612
48613
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
48613
|
-
const moduleKind2 = getEmitModuleKind(compilerOptions);
|
|
48614
48614
|
const resolvedModule = getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
48615
48615
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
48616
48616
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
@@ -48643,7 +48643,7 @@ ${lanes.join("\n")}
|
|
|
48643
48643
|
moduleReference
|
|
48644
48644
|
);
|
|
48645
48645
|
}
|
|
48646
|
-
if (
|
|
48646
|
+
if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
|
|
48647
48647
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
48648
48648
|
const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
48649
48649
|
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_h = overrideClauseHost.assertions) == null ? void 0 : _h.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
|
|
@@ -48767,7 +48767,7 @@ ${lanes.join("\n")}
|
|
|
48767
48767
|
return void 0;
|
|
48768
48768
|
function getSuggestedImportSource(tsExtension) {
|
|
48769
48769
|
const importSourceWithoutExtension = removeExtension(moduleReference, tsExtension);
|
|
48770
|
-
if (emitModuleKindIsNonNodeESM(
|
|
48770
|
+
if (emitModuleKindIsNonNodeESM(moduleKind) || mode === 99 /* ESNext */) {
|
|
48771
48771
|
const preferTs = isDeclarationFileName(moduleReference) && shouldAllowImportingTsExtension(compilerOptions);
|
|
48772
48772
|
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";
|
|
48773
48773
|
return importSourceWithoutExtension + ext;
|
|
@@ -68044,14 +68044,12 @@ ${lanes.join("\n")}
|
|
|
68044
68044
|
return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue);
|
|
68045
68045
|
}
|
|
68046
68046
|
const target = getReferenceCandidate(expr.right);
|
|
68047
|
-
|
|
68048
|
-
if (leftType.flags & 8576 /* StringOrNumberLiteralOrUnique */) {
|
|
68049
|
-
|
|
68050
|
-
|
|
68051
|
-
|
|
68052
|
-
|
|
68053
|
-
return narrowTypeByInKeyword(type, leftType, assumeTrue);
|
|
68054
|
-
}
|
|
68047
|
+
let leftType;
|
|
68048
|
+
if (containsMissingType(type) && isAccessExpression(reference) && isMatchingReference(reference.expression, target) && (leftType = getTypeOfExpression(expr.left)).flags & 8576 /* StringOrNumberLiteralOrUnique */ && getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) {
|
|
68049
|
+
return getTypeWithFacts(type, assumeTrue ? 524288 /* NEUndefined */ : 65536 /* EQUndefined */);
|
|
68050
|
+
}
|
|
68051
|
+
if (isMatchingReference(reference, target) && (leftType = getTypeOfExpression(expr.left)).flags & 8576 /* StringOrNumberLiteralOrUnique */) {
|
|
68052
|
+
return narrowTypeByInKeyword(type, leftType, assumeTrue);
|
|
68055
68053
|
}
|
|
68056
68054
|
break;
|
|
68057
68055
|
case 28 /* CommaToken */:
|
|
@@ -69073,17 +69071,14 @@ ${lanes.join("\n")}
|
|
|
69073
69071
|
}
|
|
69074
69072
|
}
|
|
69075
69073
|
function getTypeForThisExpressionFromJSDoc(node) {
|
|
69076
|
-
const jsdocType = getJSDocType(node);
|
|
69077
|
-
if (jsdocType && jsdocType.kind === 324 /* JSDocFunctionType */) {
|
|
69078
|
-
const jsDocFunctionType = jsdocType;
|
|
69079
|
-
if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && jsDocFunctionType.parameters[0].name.escapedText === "this" /* This */) {
|
|
69080
|
-
return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type);
|
|
69081
|
-
}
|
|
69082
|
-
}
|
|
69083
69074
|
const thisTag = getJSDocThisTag(node);
|
|
69084
69075
|
if (thisTag && thisTag.typeExpression) {
|
|
69085
69076
|
return getTypeFromTypeNode(thisTag.typeExpression);
|
|
69086
69077
|
}
|
|
69078
|
+
const signature = getSignatureOfTypeTag(node);
|
|
69079
|
+
if (signature) {
|
|
69080
|
+
return getThisTypeOfSignature(signature);
|
|
69081
|
+
}
|
|
69087
69082
|
}
|
|
69088
69083
|
function isInConstructorArgumentInitializer(node, constructorDecl) {
|
|
69089
69084
|
return !!findAncestor(node, (n) => isFunctionLikeDeclaration(n) ? "quit" : n.kind === 169 /* Parameter */ && n.parent === constructorDecl);
|
|
@@ -118080,9 +118075,9 @@ ${lanes.join("\n")}
|
|
|
118080
118075
|
return typeof result === "object" ? result.impliedNodeFormat : result;
|
|
118081
118076
|
}
|
|
118082
118077
|
function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) {
|
|
118083
|
-
switch (
|
|
118084
|
-
case
|
|
118085
|
-
case
|
|
118078
|
+
switch (getEmitModuleResolutionKind(options)) {
|
|
118079
|
+
case 3 /* Node16 */:
|
|
118080
|
+
case 99 /* NodeNext */:
|
|
118086
118081
|
return fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? 99 /* ESNext */ : fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? 1 /* CommonJS */ : fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]) ? lookupFromPackageJson() : void 0;
|
|
118087
118082
|
default:
|
|
118088
118083
|
return void 0;
|
|
@@ -136381,7 +136376,10 @@ ${lanes.join("\n")}
|
|
|
136381
136376
|
if (isExpression(parent2) && (getExpressionPrecedence(replacement) < getExpressionPrecedence(parent2) || needsParentheses(parent2))) {
|
|
136382
136377
|
return factory.createParenthesizedExpression(replacement);
|
|
136383
136378
|
}
|
|
136384
|
-
if (isFunctionLike(replacement) && isCallLikeExpression(parent2)) {
|
|
136379
|
+
if (isFunctionLike(replacement) && (isCallLikeExpression(parent2) || isPropertyAccessExpression(parent2))) {
|
|
136380
|
+
return factory.createParenthesizedExpression(replacement);
|
|
136381
|
+
}
|
|
136382
|
+
if (isPropertyAccessExpression(parent2) && (isNumericLiteral(replacement) || isObjectLiteralExpression(replacement))) {
|
|
136385
136383
|
return factory.createParenthesizedExpression(replacement);
|
|
136386
136384
|
}
|
|
136387
136385
|
return replacement;
|
|
@@ -156772,6 +156770,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156772
156770
|
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
|
|
156773
156771
|
}
|
|
156774
156772
|
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, position, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol) {
|
|
156773
|
+
var _a, _b;
|
|
156775
156774
|
let insertText;
|
|
156776
156775
|
let filterText;
|
|
156777
156776
|
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
|
|
@@ -156830,6 +156829,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156830
156829
|
if ((origin == null ? void 0 : origin.kind) === 64 /* TypeOnlyAlias */) {
|
|
156831
156830
|
hasAction = true;
|
|
156832
156831
|
}
|
|
156832
|
+
if (completionKind === 0 /* ObjectPropertyDeclaration */ && contextToken && ((_a = findPrecedingToken(contextToken.pos, sourceFile, contextToken)) == null ? void 0 : _a.kind) !== 28 /* CommaToken */) {
|
|
156833
|
+
if (isMethodDeclaration(contextToken.parent.parent) || isGetAccessorDeclaration(contextToken.parent.parent) || isSetAccessorDeclaration(contextToken.parent.parent) || isSpreadAssignment(contextToken.parent) || ((_b = findAncestor(contextToken.parent, isPropertyAssignment)) == null ? void 0 : _b.getLastToken(sourceFile)) === contextToken || isShorthandPropertyAssignment(contextToken.parent) && getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line !== getLineAndCharacterOfPosition(sourceFile, position).line) {
|
|
156834
|
+
source = "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */;
|
|
156835
|
+
hasAction = true;
|
|
156836
|
+
}
|
|
156837
|
+
}
|
|
156833
156838
|
if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* MemberLike */ && isClassLikeMemberCompletion(symbol, location, sourceFile)) {
|
|
156834
156839
|
let importAdder;
|
|
156835
156840
|
const memberCompletionEntry = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext);
|
|
@@ -157560,7 +157565,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157560
157565
|
return firstDefined(symbols, (symbol, index) => {
|
|
157561
157566
|
const origin = symbolToOriginInfoMap[index];
|
|
157562
157567
|
const info = getCompletionEntryDisplayNameForSymbol(symbol, getEmitScriptTarget(compilerOptions), origin, completionKind, completionData.isJsxIdentifierExpected);
|
|
157563
|
-
return info && info.name === entryId.name && (entryId.source === "ClassMemberSnippet/" /* ClassMemberSnippet */ && symbol.flags & 106500 /* ClassMember */ || entryId.source === "ObjectLiteralMethodSnippet/" /* ObjectLiteralMethodSnippet */ && symbol.flags & (4 /* Property */ | 8192 /* Method */) || getSourceFromOrigin(origin) === entryId.source) ? { type: "symbol", symbol, location, origin, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation } : void 0;
|
|
157568
|
+
return info && info.name === entryId.name && (entryId.source === "ClassMemberSnippet/" /* ClassMemberSnippet */ && symbol.flags & 106500 /* ClassMember */ || entryId.source === "ObjectLiteralMethodSnippet/" /* ObjectLiteralMethodSnippet */ && symbol.flags & (4 /* Property */ | 8192 /* Method */) || getSourceFromOrigin(origin) === entryId.source || entryId.source === "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */) ? { type: "symbol", symbol, location, origin, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation } : void 0;
|
|
157564
157569
|
}) || { type: "none" };
|
|
157565
157570
|
}
|
|
157566
157571
|
function getCompletionEntryDetails(program, log, sourceFile, position, entryId, host, formatContext, preferences, cancellationToken) {
|
|
@@ -157705,6 +157710,21 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157705
157710
|
Debug.assertIsDefined(codeAction2, "Expected to have a code action for promoting type-only alias");
|
|
157706
157711
|
return { codeActions: [codeAction2], sourceDisplay: void 0 };
|
|
157707
157712
|
}
|
|
157713
|
+
if (source === "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */ && contextToken) {
|
|
157714
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(
|
|
157715
|
+
{ host, formatContext, preferences },
|
|
157716
|
+
(tracker) => tracker.insertText(sourceFile, contextToken.end, ",")
|
|
157717
|
+
);
|
|
157718
|
+
if (changes) {
|
|
157719
|
+
return {
|
|
157720
|
+
sourceDisplay: void 0,
|
|
157721
|
+
codeActions: [{
|
|
157722
|
+
changes,
|
|
157723
|
+
description: diagnosticToString([Diagnostics.Add_missing_comma_for_object_member_completion_0, name])
|
|
157724
|
+
}]
|
|
157725
|
+
};
|
|
157726
|
+
}
|
|
157727
|
+
}
|
|
157708
157728
|
if (!origin || !(originIsExport(origin) || originIsResolvedExport(origin))) {
|
|
157709
157729
|
return { codeActions: void 0, sourceDisplay: void 0 };
|
|
157710
157730
|
}
|
|
@@ -158602,7 +158622,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
158602
158622
|
}
|
|
158603
158623
|
function tryGetObjectLikeCompletionSymbols() {
|
|
158604
158624
|
const symbolsStartIndex = symbols.length;
|
|
158605
|
-
const objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken);
|
|
158625
|
+
const objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken, position, sourceFile);
|
|
158606
158626
|
if (!objectLikeContainer)
|
|
158607
158627
|
return 0 /* Continue */;
|
|
158608
158628
|
completionKind = 0 /* ObjectPropertyDeclaration */;
|
|
@@ -159088,7 +159108,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159088
159108
|
return node2.getStart(sourceFile) <= position && position <= node2.getEnd();
|
|
159089
159109
|
}
|
|
159090
159110
|
}
|
|
159091
|
-
function tryGetObjectLikeCompletionContainer(contextToken) {
|
|
159111
|
+
function tryGetObjectLikeCompletionContainer(contextToken, position, sourceFile) {
|
|
159112
|
+
var _a;
|
|
159092
159113
|
if (contextToken) {
|
|
159093
159114
|
const { parent: parent2 } = contextToken;
|
|
159094
159115
|
switch (contextToken.kind) {
|
|
@@ -159103,7 +159124,29 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159103
159124
|
case 134 /* AsyncKeyword */:
|
|
159104
159125
|
return tryCast(parent2.parent, isObjectLiteralExpression);
|
|
159105
159126
|
case 80 /* Identifier */:
|
|
159106
|
-
|
|
159127
|
+
if (contextToken.text === "async" && isShorthandPropertyAssignment(contextToken.parent)) {
|
|
159128
|
+
return contextToken.parent.parent;
|
|
159129
|
+
} else {
|
|
159130
|
+
if (isObjectLiteralExpression(contextToken.parent.parent) && (isSpreadAssignment(contextToken.parent) || isShorthandPropertyAssignment(contextToken.parent) && getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line !== getLineAndCharacterOfPosition(sourceFile, position).line)) {
|
|
159131
|
+
return contextToken.parent.parent;
|
|
159132
|
+
}
|
|
159133
|
+
const ancestorNode2 = findAncestor(parent2, isPropertyAssignment);
|
|
159134
|
+
if ((ancestorNode2 == null ? void 0 : ancestorNode2.getLastToken(sourceFile)) === contextToken && isObjectLiteralExpression(ancestorNode2.parent)) {
|
|
159135
|
+
return ancestorNode2.parent;
|
|
159136
|
+
}
|
|
159137
|
+
}
|
|
159138
|
+
break;
|
|
159139
|
+
default:
|
|
159140
|
+
if (((_a = parent2.parent) == null ? void 0 : _a.parent) && (isMethodDeclaration(parent2.parent) || isGetAccessorDeclaration(parent2.parent) || isSetAccessorDeclaration(parent2.parent)) && isObjectLiteralExpression(parent2.parent.parent)) {
|
|
159141
|
+
return parent2.parent.parent;
|
|
159142
|
+
}
|
|
159143
|
+
if (isSpreadAssignment(parent2) && isObjectLiteralExpression(parent2.parent)) {
|
|
159144
|
+
return parent2.parent;
|
|
159145
|
+
}
|
|
159146
|
+
const ancestorNode = findAncestor(parent2, isPropertyAssignment);
|
|
159147
|
+
if (contextToken.kind !== 59 /* ColonToken */ && (ancestorNode == null ? void 0 : ancestorNode.getLastToken(sourceFile)) === contextToken && isObjectLiteralExpression(ancestorNode.parent)) {
|
|
159148
|
+
return ancestorNode.parent;
|
|
159149
|
+
}
|
|
159107
159150
|
}
|
|
159108
159151
|
}
|
|
159109
159152
|
return void 0;
|
|
@@ -159646,6 +159689,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159646
159689
|
CompletionSource2["TypeOnlyAlias"] = "TypeOnlyAlias/";
|
|
159647
159690
|
CompletionSource2["ObjectLiteralMethodSnippet"] = "ObjectLiteralMethodSnippet/";
|
|
159648
159691
|
CompletionSource2["SwitchCases"] = "SwitchCases/";
|
|
159692
|
+
CompletionSource2["ObjectLiteralMemberWithComma"] = "ObjectLiteralMemberWithComma/";
|
|
159649
159693
|
return CompletionSource2;
|
|
159650
159694
|
})(CompletionSource || {});
|
|
159651
159695
|
SymbolOriginInfoKind = /* @__PURE__ */ ((SymbolOriginInfoKind2) => {
|
package/lib/typescript.d.ts
CHANGED
|
@@ -5138,7 +5138,7 @@ declare namespace ts {
|
|
|
5138
5138
|
/**
|
|
5139
5139
|
* Controls the format the file is detected as - this can be derived from only the path
|
|
5140
5140
|
* and files on disk, but needs to be done with a module resolution cache in scope to be performant.
|
|
5141
|
-
* This is usually `undefined` for compilations that do not have `
|
|
5141
|
+
* This is usually `undefined` for compilations that do not have `moduleResolution` values of `node16` or `nodenext`.
|
|
5142
5142
|
*/
|
|
5143
5143
|
impliedNodeFormat?: ResolutionMode;
|
|
5144
5144
|
/**
|
|
@@ -5451,7 +5451,7 @@ declare namespace ts {
|
|
|
5451
5451
|
* Calculates the final resolution mode for a given module reference node. This is generally the explicitly provided resolution mode, if
|
|
5452
5452
|
* one exists, or the mode of the containing source file. (Excepting import=require, which is always commonjs, and dynamic import, which is always esm).
|
|
5453
5453
|
* Notably, this function always returns `undefined` if the containing file has an `undefined` `impliedNodeFormat` - this field is only set when
|
|
5454
|
-
* `
|
|
5454
|
+
* `moduleResolution` is `node16`+.
|
|
5455
5455
|
* @param file The file the import or import-like reference is contained within
|
|
5456
5456
|
* @param usage The module reference string
|
|
5457
5457
|
* @returns The final resolution mode of the import
|
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-insiders.
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20230627`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -9050,6 +9050,7 @@ ${lanes.join("\n")}
|
|
|
9050
9050
|
Inline_variable: diag(95184, 3 /* Message */, "Inline_variable_95184", "Inline variable"),
|
|
9051
9051
|
Could_not_find_variable_to_inline: diag(95185, 3 /* Message */, "Could_not_find_variable_to_inline_95185", "Could not find variable to inline."),
|
|
9052
9052
|
Variables_with_multiple_declarations_cannot_be_inlined: diag(95186, 3 /* Message */, "Variables_with_multiple_declarations_cannot_be_inlined_95186", "Variables with multiple declarations cannot be inlined."),
|
|
9053
|
+
Add_missing_comma_for_object_member_completion_0: diag(95187, 3 /* Message */, "Add_missing_comma_for_object_member_completion_0_95187", "Add missing comma for object member completion '{0}'."),
|
|
9053
9054
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
9054
9055
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
9055
9056
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -48610,7 +48611,6 @@ ${lanes.join("\n")}
|
|
|
48610
48611
|
const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = findAncestor(location, isImportCall)) == null ? void 0 : _a.arguments[0]) || ((_b = findAncestor(location, isImportDeclaration)) == null ? void 0 : _b.moduleSpecifier) || ((_c = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _c.moduleReference.expression) || ((_d = findAncestor(location, isExportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _e.name) || ((_f = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _f.argument.literal);
|
|
48611
48612
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
48612
48613
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
48613
|
-
const moduleKind2 = getEmitModuleKind(compilerOptions);
|
|
48614
48614
|
const resolvedModule = getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
48615
48615
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
48616
48616
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
@@ -48643,7 +48643,7 @@ ${lanes.join("\n")}
|
|
|
48643
48643
|
moduleReference
|
|
48644
48644
|
);
|
|
48645
48645
|
}
|
|
48646
|
-
if (
|
|
48646
|
+
if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
|
|
48647
48647
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
48648
48648
|
const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
48649
48649
|
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_h = overrideClauseHost.assertions) == null ? void 0 : _h.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
|
|
@@ -48767,7 +48767,7 @@ ${lanes.join("\n")}
|
|
|
48767
48767
|
return void 0;
|
|
48768
48768
|
function getSuggestedImportSource(tsExtension) {
|
|
48769
48769
|
const importSourceWithoutExtension = removeExtension(moduleReference, tsExtension);
|
|
48770
|
-
if (emitModuleKindIsNonNodeESM(
|
|
48770
|
+
if (emitModuleKindIsNonNodeESM(moduleKind) || mode === 99 /* ESNext */) {
|
|
48771
48771
|
const preferTs = isDeclarationFileName(moduleReference) && shouldAllowImportingTsExtension(compilerOptions);
|
|
48772
48772
|
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";
|
|
48773
48773
|
return importSourceWithoutExtension + ext;
|
|
@@ -68044,14 +68044,12 @@ ${lanes.join("\n")}
|
|
|
68044
68044
|
return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue);
|
|
68045
68045
|
}
|
|
68046
68046
|
const target = getReferenceCandidate(expr.right);
|
|
68047
|
-
|
|
68048
|
-
if (leftType.flags & 8576 /* StringOrNumberLiteralOrUnique */) {
|
|
68049
|
-
|
|
68050
|
-
|
|
68051
|
-
|
|
68052
|
-
|
|
68053
|
-
return narrowTypeByInKeyword(type, leftType, assumeTrue);
|
|
68054
|
-
}
|
|
68047
|
+
let leftType;
|
|
68048
|
+
if (containsMissingType(type) && isAccessExpression(reference) && isMatchingReference(reference.expression, target) && (leftType = getTypeOfExpression(expr.left)).flags & 8576 /* StringOrNumberLiteralOrUnique */ && getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) {
|
|
68049
|
+
return getTypeWithFacts(type, assumeTrue ? 524288 /* NEUndefined */ : 65536 /* EQUndefined */);
|
|
68050
|
+
}
|
|
68051
|
+
if (isMatchingReference(reference, target) && (leftType = getTypeOfExpression(expr.left)).flags & 8576 /* StringOrNumberLiteralOrUnique */) {
|
|
68052
|
+
return narrowTypeByInKeyword(type, leftType, assumeTrue);
|
|
68055
68053
|
}
|
|
68056
68054
|
break;
|
|
68057
68055
|
case 28 /* CommaToken */:
|
|
@@ -69073,17 +69071,14 @@ ${lanes.join("\n")}
|
|
|
69073
69071
|
}
|
|
69074
69072
|
}
|
|
69075
69073
|
function getTypeForThisExpressionFromJSDoc(node) {
|
|
69076
|
-
const jsdocType = getJSDocType(node);
|
|
69077
|
-
if (jsdocType && jsdocType.kind === 324 /* JSDocFunctionType */) {
|
|
69078
|
-
const jsDocFunctionType = jsdocType;
|
|
69079
|
-
if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && jsDocFunctionType.parameters[0].name.escapedText === "this" /* This */) {
|
|
69080
|
-
return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type);
|
|
69081
|
-
}
|
|
69082
|
-
}
|
|
69083
69074
|
const thisTag = getJSDocThisTag(node);
|
|
69084
69075
|
if (thisTag && thisTag.typeExpression) {
|
|
69085
69076
|
return getTypeFromTypeNode(thisTag.typeExpression);
|
|
69086
69077
|
}
|
|
69078
|
+
const signature = getSignatureOfTypeTag(node);
|
|
69079
|
+
if (signature) {
|
|
69080
|
+
return getThisTypeOfSignature(signature);
|
|
69081
|
+
}
|
|
69087
69082
|
}
|
|
69088
69083
|
function isInConstructorArgumentInitializer(node, constructorDecl) {
|
|
69089
69084
|
return !!findAncestor(node, (n) => isFunctionLikeDeclaration(n) ? "quit" : n.kind === 169 /* Parameter */ && n.parent === constructorDecl);
|
|
@@ -118080,9 +118075,9 @@ ${lanes.join("\n")}
|
|
|
118080
118075
|
return typeof result === "object" ? result.impliedNodeFormat : result;
|
|
118081
118076
|
}
|
|
118082
118077
|
function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) {
|
|
118083
|
-
switch (
|
|
118084
|
-
case
|
|
118085
|
-
case
|
|
118078
|
+
switch (getEmitModuleResolutionKind(options)) {
|
|
118079
|
+
case 3 /* Node16 */:
|
|
118080
|
+
case 99 /* NodeNext */:
|
|
118086
118081
|
return fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? 99 /* ESNext */ : fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? 1 /* CommonJS */ : fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]) ? lookupFromPackageJson() : void 0;
|
|
118087
118082
|
default:
|
|
118088
118083
|
return void 0;
|
|
@@ -136396,7 +136391,10 @@ ${lanes.join("\n")}
|
|
|
136396
136391
|
if (isExpression(parent2) && (getExpressionPrecedence(replacement) < getExpressionPrecedence(parent2) || needsParentheses(parent2))) {
|
|
136397
136392
|
return factory.createParenthesizedExpression(replacement);
|
|
136398
136393
|
}
|
|
136399
|
-
if (isFunctionLike(replacement) && isCallLikeExpression(parent2)) {
|
|
136394
|
+
if (isFunctionLike(replacement) && (isCallLikeExpression(parent2) || isPropertyAccessExpression(parent2))) {
|
|
136395
|
+
return factory.createParenthesizedExpression(replacement);
|
|
136396
|
+
}
|
|
136397
|
+
if (isPropertyAccessExpression(parent2) && (isNumericLiteral(replacement) || isObjectLiteralExpression(replacement))) {
|
|
136400
136398
|
return factory.createParenthesizedExpression(replacement);
|
|
136401
136399
|
}
|
|
136402
136400
|
return replacement;
|
|
@@ -156787,6 +156785,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156787
156785
|
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
|
|
156788
156786
|
}
|
|
156789
156787
|
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, position, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol) {
|
|
156788
|
+
var _a, _b;
|
|
156790
156789
|
let insertText;
|
|
156791
156790
|
let filterText;
|
|
156792
156791
|
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
|
|
@@ -156845,6 +156844,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156845
156844
|
if ((origin == null ? void 0 : origin.kind) === 64 /* TypeOnlyAlias */) {
|
|
156846
156845
|
hasAction = true;
|
|
156847
156846
|
}
|
|
156847
|
+
if (completionKind === 0 /* ObjectPropertyDeclaration */ && contextToken && ((_a = findPrecedingToken(contextToken.pos, sourceFile, contextToken)) == null ? void 0 : _a.kind) !== 28 /* CommaToken */) {
|
|
156848
|
+
if (isMethodDeclaration(contextToken.parent.parent) || isGetAccessorDeclaration(contextToken.parent.parent) || isSetAccessorDeclaration(contextToken.parent.parent) || isSpreadAssignment(contextToken.parent) || ((_b = findAncestor(contextToken.parent, isPropertyAssignment)) == null ? void 0 : _b.getLastToken(sourceFile)) === contextToken || isShorthandPropertyAssignment(contextToken.parent) && getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line !== getLineAndCharacterOfPosition(sourceFile, position).line) {
|
|
156849
|
+
source = "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */;
|
|
156850
|
+
hasAction = true;
|
|
156851
|
+
}
|
|
156852
|
+
}
|
|
156848
156853
|
if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* MemberLike */ && isClassLikeMemberCompletion(symbol, location, sourceFile)) {
|
|
156849
156854
|
let importAdder;
|
|
156850
156855
|
const memberCompletionEntry = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext);
|
|
@@ -157575,7 +157580,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157575
157580
|
return firstDefined(symbols, (symbol, index) => {
|
|
157576
157581
|
const origin = symbolToOriginInfoMap[index];
|
|
157577
157582
|
const info = getCompletionEntryDisplayNameForSymbol(symbol, getEmitScriptTarget(compilerOptions), origin, completionKind, completionData.isJsxIdentifierExpected);
|
|
157578
|
-
return info && info.name === entryId.name && (entryId.source === "ClassMemberSnippet/" /* ClassMemberSnippet */ && symbol.flags & 106500 /* ClassMember */ || entryId.source === "ObjectLiteralMethodSnippet/" /* ObjectLiteralMethodSnippet */ && symbol.flags & (4 /* Property */ | 8192 /* Method */) || getSourceFromOrigin(origin) === entryId.source) ? { type: "symbol", symbol, location, origin, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation } : void 0;
|
|
157583
|
+
return info && info.name === entryId.name && (entryId.source === "ClassMemberSnippet/" /* ClassMemberSnippet */ && symbol.flags & 106500 /* ClassMember */ || entryId.source === "ObjectLiteralMethodSnippet/" /* ObjectLiteralMethodSnippet */ && symbol.flags & (4 /* Property */ | 8192 /* Method */) || getSourceFromOrigin(origin) === entryId.source || entryId.source === "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */) ? { type: "symbol", symbol, location, origin, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation } : void 0;
|
|
157579
157584
|
}) || { type: "none" };
|
|
157580
157585
|
}
|
|
157581
157586
|
function getCompletionEntryDetails(program, log, sourceFile, position, entryId, host, formatContext, preferences, cancellationToken) {
|
|
@@ -157720,6 +157725,21 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157720
157725
|
Debug.assertIsDefined(codeAction2, "Expected to have a code action for promoting type-only alias");
|
|
157721
157726
|
return { codeActions: [codeAction2], sourceDisplay: void 0 };
|
|
157722
157727
|
}
|
|
157728
|
+
if (source === "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */ && contextToken) {
|
|
157729
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(
|
|
157730
|
+
{ host, formatContext, preferences },
|
|
157731
|
+
(tracker) => tracker.insertText(sourceFile, contextToken.end, ",")
|
|
157732
|
+
);
|
|
157733
|
+
if (changes) {
|
|
157734
|
+
return {
|
|
157735
|
+
sourceDisplay: void 0,
|
|
157736
|
+
codeActions: [{
|
|
157737
|
+
changes,
|
|
157738
|
+
description: diagnosticToString([Diagnostics.Add_missing_comma_for_object_member_completion_0, name])
|
|
157739
|
+
}]
|
|
157740
|
+
};
|
|
157741
|
+
}
|
|
157742
|
+
}
|
|
157723
157743
|
if (!origin || !(originIsExport(origin) || originIsResolvedExport(origin))) {
|
|
157724
157744
|
return { codeActions: void 0, sourceDisplay: void 0 };
|
|
157725
157745
|
}
|
|
@@ -158617,7 +158637,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
158617
158637
|
}
|
|
158618
158638
|
function tryGetObjectLikeCompletionSymbols() {
|
|
158619
158639
|
const symbolsStartIndex = symbols.length;
|
|
158620
|
-
const objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken);
|
|
158640
|
+
const objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken, position, sourceFile);
|
|
158621
158641
|
if (!objectLikeContainer)
|
|
158622
158642
|
return 0 /* Continue */;
|
|
158623
158643
|
completionKind = 0 /* ObjectPropertyDeclaration */;
|
|
@@ -159103,7 +159123,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159103
159123
|
return node2.getStart(sourceFile) <= position && position <= node2.getEnd();
|
|
159104
159124
|
}
|
|
159105
159125
|
}
|
|
159106
|
-
function tryGetObjectLikeCompletionContainer(contextToken) {
|
|
159126
|
+
function tryGetObjectLikeCompletionContainer(contextToken, position, sourceFile) {
|
|
159127
|
+
var _a;
|
|
159107
159128
|
if (contextToken) {
|
|
159108
159129
|
const { parent: parent2 } = contextToken;
|
|
159109
159130
|
switch (contextToken.kind) {
|
|
@@ -159118,7 +159139,29 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159118
159139
|
case 134 /* AsyncKeyword */:
|
|
159119
159140
|
return tryCast(parent2.parent, isObjectLiteralExpression);
|
|
159120
159141
|
case 80 /* Identifier */:
|
|
159121
|
-
|
|
159142
|
+
if (contextToken.text === "async" && isShorthandPropertyAssignment(contextToken.parent)) {
|
|
159143
|
+
return contextToken.parent.parent;
|
|
159144
|
+
} else {
|
|
159145
|
+
if (isObjectLiteralExpression(contextToken.parent.parent) && (isSpreadAssignment(contextToken.parent) || isShorthandPropertyAssignment(contextToken.parent) && getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line !== getLineAndCharacterOfPosition(sourceFile, position).line)) {
|
|
159146
|
+
return contextToken.parent.parent;
|
|
159147
|
+
}
|
|
159148
|
+
const ancestorNode2 = findAncestor(parent2, isPropertyAssignment);
|
|
159149
|
+
if ((ancestorNode2 == null ? void 0 : ancestorNode2.getLastToken(sourceFile)) === contextToken && isObjectLiteralExpression(ancestorNode2.parent)) {
|
|
159150
|
+
return ancestorNode2.parent;
|
|
159151
|
+
}
|
|
159152
|
+
}
|
|
159153
|
+
break;
|
|
159154
|
+
default:
|
|
159155
|
+
if (((_a = parent2.parent) == null ? void 0 : _a.parent) && (isMethodDeclaration(parent2.parent) || isGetAccessorDeclaration(parent2.parent) || isSetAccessorDeclaration(parent2.parent)) && isObjectLiteralExpression(parent2.parent.parent)) {
|
|
159156
|
+
return parent2.parent.parent;
|
|
159157
|
+
}
|
|
159158
|
+
if (isSpreadAssignment(parent2) && isObjectLiteralExpression(parent2.parent)) {
|
|
159159
|
+
return parent2.parent;
|
|
159160
|
+
}
|
|
159161
|
+
const ancestorNode = findAncestor(parent2, isPropertyAssignment);
|
|
159162
|
+
if (contextToken.kind !== 59 /* ColonToken */ && (ancestorNode == null ? void 0 : ancestorNode.getLastToken(sourceFile)) === contextToken && isObjectLiteralExpression(ancestorNode.parent)) {
|
|
159163
|
+
return ancestorNode.parent;
|
|
159164
|
+
}
|
|
159122
159165
|
}
|
|
159123
159166
|
}
|
|
159124
159167
|
return void 0;
|
|
@@ -159661,6 +159704,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159661
159704
|
CompletionSource2["TypeOnlyAlias"] = "TypeOnlyAlias/";
|
|
159662
159705
|
CompletionSource2["ObjectLiteralMethodSnippet"] = "ObjectLiteralMethodSnippet/";
|
|
159663
159706
|
CompletionSource2["SwitchCases"] = "SwitchCases/";
|
|
159707
|
+
CompletionSource2["ObjectLiteralMemberWithComma"] = "ObjectLiteralMemberWithComma/";
|
|
159664
159708
|
return CompletionSource2;
|
|
159665
159709
|
})(CompletionSource || {});
|
|
159666
159710
|
SymbolOriginInfoKind = /* @__PURE__ */ ((SymbolOriginInfoKind2) => {
|
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-insiders.
|
|
57
|
+
var version = `${versionMajorMinor}.0-insiders.20230627`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -7120,6 +7120,7 @@ var Diagnostics = {
|
|
|
7120
7120
|
Inline_variable: diag(95184, 3 /* Message */, "Inline_variable_95184", "Inline variable"),
|
|
7121
7121
|
Could_not_find_variable_to_inline: diag(95185, 3 /* Message */, "Could_not_find_variable_to_inline_95185", "Could not find variable to inline."),
|
|
7122
7122
|
Variables_with_multiple_declarations_cannot_be_inlined: diag(95186, 3 /* Message */, "Variables_with_multiple_declarations_cannot_be_inlined_95186", "Variables with multiple declarations cannot be inlined."),
|
|
7123
|
+
Add_missing_comma_for_object_member_completion_0: diag(95187, 3 /* Message */, "Add_missing_comma_for_object_member_completion_0_95187", "Add missing comma for object member completion '{0}'."),
|
|
7123
7124
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
7124
7125
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
7125
7126
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@typescript-deploys/pr-build",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.2.0-pr-
|
|
5
|
+
"version": "5.2.0-pr-54795-7",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"node": "20.1.0",
|
|
116
116
|
"npm": "8.19.4"
|
|
117
117
|
},
|
|
118
|
-
"gitHead": "
|
|
118
|
+
"gitHead": "77b53fe6bf7e4cd647cc4c44affd81f70e7597d9"
|
|
119
119
|
}
|