typescript 5.0.0-dev.20230201 → 5.0.0-dev.20230203
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/lib.d.ts +0 -2
- package/lib/lib.decorators.d.ts +0 -2
- package/lib/lib.decorators.legacy.d.ts +0 -2
- package/lib/lib.dom.d.ts +0 -2
- package/lib/lib.dom.iterable.d.ts +0 -2
- package/lib/lib.es2015.collection.d.ts +0 -2
- package/lib/lib.es2015.core.d.ts +0 -2
- package/lib/lib.es2015.d.ts +0 -2
- package/lib/lib.es2015.generator.d.ts +0 -2
- package/lib/lib.es2015.iterable.d.ts +0 -2
- package/lib/lib.es2015.promise.d.ts +0 -2
- package/lib/lib.es2015.proxy.d.ts +0 -2
- package/lib/lib.es2015.reflect.d.ts +0 -2
- package/lib/lib.es2015.symbol.d.ts +0 -2
- package/lib/lib.es2015.symbol.wellknown.d.ts +0 -2
- package/lib/lib.es2016.array.include.d.ts +0 -2
- package/lib/lib.es2016.d.ts +0 -2
- package/lib/lib.es2016.full.d.ts +0 -2
- package/lib/lib.es2017.d.ts +0 -2
- package/lib/lib.es2017.full.d.ts +0 -2
- package/lib/lib.es2017.intl.d.ts +0 -2
- package/lib/lib.es2017.object.d.ts +0 -2
- package/lib/lib.es2017.sharedmemory.d.ts +0 -2
- package/lib/lib.es2017.string.d.ts +0 -2
- package/lib/lib.es2017.typedarrays.d.ts +0 -2
- package/lib/lib.es2018.asyncgenerator.d.ts +0 -2
- package/lib/lib.es2018.asynciterable.d.ts +0 -2
- package/lib/lib.es2018.d.ts +0 -2
- package/lib/lib.es2018.full.d.ts +0 -2
- package/lib/lib.es2018.intl.d.ts +0 -2
- package/lib/lib.es2018.promise.d.ts +0 -2
- package/lib/lib.es2018.regexp.d.ts +0 -2
- package/lib/lib.es2019.array.d.ts +0 -2
- package/lib/lib.es2019.d.ts +0 -2
- package/lib/lib.es2019.full.d.ts +0 -2
- package/lib/lib.es2019.intl.d.ts +0 -2
- package/lib/lib.es2019.object.d.ts +0 -2
- package/lib/lib.es2019.string.d.ts +0 -2
- package/lib/lib.es2019.symbol.d.ts +0 -2
- package/lib/lib.es2020.bigint.d.ts +0 -2
- package/lib/lib.es2020.d.ts +0 -2
- package/lib/lib.es2020.date.d.ts +0 -2
- package/lib/lib.es2020.full.d.ts +0 -2
- package/lib/lib.es2020.intl.d.ts +0 -2
- package/lib/lib.es2020.number.d.ts +0 -2
- package/lib/lib.es2020.promise.d.ts +0 -2
- package/lib/lib.es2020.sharedmemory.d.ts +0 -2
- package/lib/lib.es2020.string.d.ts +0 -2
- package/lib/lib.es2020.symbol.wellknown.d.ts +0 -2
- package/lib/lib.es2021.d.ts +0 -2
- package/lib/lib.es2021.full.d.ts +0 -2
- package/lib/lib.es2021.intl.d.ts +0 -2
- package/lib/lib.es2021.promise.d.ts +0 -2
- package/lib/lib.es2021.string.d.ts +0 -2
- package/lib/lib.es2021.weakref.d.ts +0 -2
- package/lib/lib.es2022.array.d.ts +0 -2
- package/lib/lib.es2022.d.ts +0 -2
- package/lib/lib.es2022.error.d.ts +0 -2
- package/lib/lib.es2022.full.d.ts +0 -2
- package/lib/lib.es2022.intl.d.ts +0 -2
- package/lib/lib.es2022.object.d.ts +0 -2
- package/lib/lib.es2022.regexp.d.ts +0 -2
- package/lib/lib.es2022.sharedmemory.d.ts +0 -2
- package/lib/lib.es2022.string.d.ts +0 -2
- package/lib/lib.es2023.array.d.ts +0 -2
- package/lib/lib.es2023.d.ts +0 -2
- package/lib/lib.es2023.full.d.ts +0 -2
- package/lib/lib.es5.d.ts +0 -2
- package/lib/lib.es6.d.ts +0 -2
- package/lib/lib.esnext.d.ts +0 -2
- package/lib/lib.esnext.full.d.ts +0 -2
- package/lib/lib.esnext.intl.d.ts +0 -2
- package/lib/lib.scripthost.d.ts +0 -2
- package/lib/lib.webworker.d.ts +0 -2
- package/lib/lib.webworker.importscripts.d.ts +0 -2
- package/lib/lib.webworker.iterable.d.ts +0 -2
- package/lib/tsc.js +132 -60
- package/lib/tsserver.js +2884 -2805
- package/lib/tsserverlibrary.d.ts +16 -0
- package/lib/tsserverlibrary.js +154 -75
- package/lib/typescript.d.ts +16 -0
- package/lib/typescript.js +151 -72
- package/lib/typingsInstaller.js +35 -18
- package/package.json +2 -1
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.0";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230203`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -7338,7 +7338,6 @@ ${lanes.join("\n")}
|
|
|
7338
7338
|
Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, 1 /* Error */, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."),
|
|
7339
7339
|
Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, 1 /* Error */, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340", "Module '{0}' does not refer to a type, but is used as a type here. Did you mean 'typeof import('{0}')'?"),
|
|
7340
7340
|
Class_constructor_may_not_be_an_accessor: diag(1341, 1 /* Error */, "Class_constructor_may_not_be_an_accessor_1341", "Class constructor may not be an accessor."),
|
|
7341
|
-
Type_arguments_cannot_be_used_here: diag(1342, 1 /* Error */, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
|
|
7342
7341
|
The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext: diag(1343, 1 /* Error */, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'."),
|
|
7343
7342
|
A_label_is_not_allowed_here: diag(1344, 1 /* Error */, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
|
|
7344
7343
|
An_expression_of_type_void_cannot_be_tested_for_truthiness: diag(1345, 1 /* Error */, "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345", "An expression of type 'void' cannot be tested for truthiness."),
|
|
@@ -7984,7 +7983,7 @@ ${lanes.join("\n")}
|
|
|
7984
7983
|
Private_accessor_was_defined_without_a_getter: diag(2806, 1 /* Error */, "Private_accessor_was_defined_without_a_getter_2806", "Private accessor was defined without a getter."),
|
|
7985
7984
|
This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0: diag(2807, 1 /* Error */, "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807", "This syntax requires an imported helper named '{1}' with {2} parameters, which is not compatible with the one in '{0}'. Consider upgrading your version of '{0}'."),
|
|
7986
7985
|
A_get_accessor_must_be_at_least_as_accessible_as_the_setter: diag(2808, 1 /* Error */, "A_get_accessor_must_be_at_least_as_accessible_as_the_setter_2808", "A get accessor must be at least as accessible as the setter"),
|
|
7987
|
-
|
|
7986
|
+
Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_whole_assignment_in_parentheses: diag(2809, 1 /* Error */, "Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_d_2809", "Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses."),
|
|
7988
7987
|
Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments: diag(2810, 1 /* Error */, "Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810", "Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments."),
|
|
7989
7988
|
Initializer_for_property_0: diag(2811, 1 /* Error */, "Initializer_for_property_0_2811", "Initializer for property '{0}'"),
|
|
7990
7989
|
Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom: diag(2812, 1 /* Error */, "Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom_2812", "Property '{0}' does not exist on type '{1}'. Try changing the 'lib' compiler option to include 'dom'."),
|
|
@@ -32053,7 +32052,7 @@ ${lanes.join("\n")}
|
|
|
32053
32052
|
parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
|
|
32054
32053
|
const result = withJSDoc(finishNode(factory2.createBlock(statements, multiLine), pos), hasJSDoc);
|
|
32055
32054
|
if (token() === 63 /* EqualsToken */) {
|
|
32056
|
-
parseErrorAtCurrentToken(Diagnostics.
|
|
32055
|
+
parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_whole_assignment_in_parentheses);
|
|
32057
32056
|
nextToken();
|
|
32058
32057
|
}
|
|
32059
32058
|
return result;
|
|
@@ -38242,6 +38241,22 @@ ${lanes.join("\n")}
|
|
|
38242
38241
|
Debug.assert(extensionIsTS(resolved.extension));
|
|
38243
38242
|
return { fileName: resolved.path, packageId: resolved.packageId };
|
|
38244
38243
|
}
|
|
38244
|
+
function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state, legacyResult) {
|
|
38245
|
+
if (!state.resultFromCache && !state.compilerOptions.preserveSymlinks && resolved && isExternalLibraryImport && !resolved.originalPath && !isExternalModuleNameRelative(moduleName)) {
|
|
38246
|
+
const { resolvedFileName, originalPath } = getOriginalAndResolvedFileName(resolved.path, state.host, state.traceEnabled);
|
|
38247
|
+
if (originalPath)
|
|
38248
|
+
resolved = { ...resolved, path: resolvedFileName, originalPath };
|
|
38249
|
+
}
|
|
38250
|
+
return createResolvedModuleWithFailedLookupLocations(
|
|
38251
|
+
resolved,
|
|
38252
|
+
isExternalLibraryImport,
|
|
38253
|
+
failedLookupLocations,
|
|
38254
|
+
affectingLocations,
|
|
38255
|
+
diagnostics,
|
|
38256
|
+
state.resultFromCache,
|
|
38257
|
+
legacyResult
|
|
38258
|
+
);
|
|
38259
|
+
}
|
|
38245
38260
|
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, legacyResult) {
|
|
38246
38261
|
if (resultFromCache) {
|
|
38247
38262
|
resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
|
|
@@ -38400,6 +38415,15 @@ ${lanes.join("\n")}
|
|
|
38400
38415
|
const useCaseSensitiveFileNames = typeof host.useCaseSensitiveFileNames === "function" ? host.useCaseSensitiveFileNames() : host.useCaseSensitiveFileNames;
|
|
38401
38416
|
return comparePaths(path1, path2, !useCaseSensitiveFileNames) === 0 /* EqualTo */;
|
|
38402
38417
|
}
|
|
38418
|
+
function getOriginalAndResolvedFileName(fileName, host, traceEnabled) {
|
|
38419
|
+
const resolvedFileName = realPath(fileName, host, traceEnabled);
|
|
38420
|
+
const pathsAreEqual = arePathsEqual(fileName, resolvedFileName, host);
|
|
38421
|
+
return {
|
|
38422
|
+
// If the fileName and realpath are differing only in casing prefer fileName so that we can issue correct errors for casing under forceConsistentCasingInFileNames
|
|
38423
|
+
resolvedFileName: pathsAreEqual ? fileName : resolvedFileName,
|
|
38424
|
+
originalPath: pathsAreEqual ? void 0 : fileName
|
|
38425
|
+
};
|
|
38426
|
+
}
|
|
38403
38427
|
function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, cache, resolutionMode) {
|
|
38404
38428
|
Debug.assert(typeof typeReferenceDirectiveName === "string", "Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.");
|
|
38405
38429
|
const traceEnabled = isTraceEnabled(options, host);
|
|
@@ -38471,13 +38495,13 @@ ${lanes.join("\n")}
|
|
|
38471
38495
|
let resolvedTypeReferenceDirective;
|
|
38472
38496
|
if (resolved) {
|
|
38473
38497
|
const { fileName, packageId } = resolved;
|
|
38474
|
-
|
|
38475
|
-
|
|
38498
|
+
let resolvedFileName = fileName, originalPath;
|
|
38499
|
+
if (!options.preserveSymlinks)
|
|
38500
|
+
({ resolvedFileName, originalPath } = getOriginalAndResolvedFileName(fileName, host, traceEnabled));
|
|
38476
38501
|
resolvedTypeReferenceDirective = {
|
|
38477
38502
|
primary,
|
|
38478
|
-
|
|
38479
|
-
|
|
38480
|
-
originalPath: pathsAreEqual ? void 0 : fileName,
|
|
38503
|
+
resolvedFileName,
|
|
38504
|
+
originalPath,
|
|
38481
38505
|
packageId,
|
|
38482
38506
|
isExternalLibraryImport: pathContainsNodeModules(fileName)
|
|
38483
38507
|
};
|
|
@@ -39347,13 +39371,14 @@ ${lanes.join("\n")}
|
|
|
39347
39371
|
legacyResult = diagnosticResult.value.resolved.path;
|
|
39348
39372
|
}
|
|
39349
39373
|
}
|
|
39350
|
-
return
|
|
39374
|
+
return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
|
|
39375
|
+
moduleName,
|
|
39351
39376
|
(_c = result == null ? void 0 : result.value) == null ? void 0 : _c.resolved,
|
|
39352
39377
|
(_d = result == null ? void 0 : result.value) == null ? void 0 : _d.isExternalLibraryImport,
|
|
39353
39378
|
failedLookupLocations,
|
|
39354
39379
|
affectingLocations,
|
|
39355
39380
|
diagnostics,
|
|
39356
|
-
state
|
|
39381
|
+
state,
|
|
39357
39382
|
legacyResult
|
|
39358
39383
|
);
|
|
39359
39384
|
function tryResolve(extensions2, state2) {
|
|
@@ -39383,16 +39408,7 @@ ${lanes.join("\n")}
|
|
|
39383
39408
|
}
|
|
39384
39409
|
resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
|
|
39385
39410
|
}
|
|
39386
|
-
|
|
39387
|
-
return void 0;
|
|
39388
|
-
let resolvedValue = resolved2.value;
|
|
39389
|
-
if (!compilerOptions.preserveSymlinks && resolvedValue && !resolvedValue.originalPath) {
|
|
39390
|
-
const path = realPath(resolvedValue.path, host, traceEnabled);
|
|
39391
|
-
const pathsAreEqual = arePathsEqual(path, resolvedValue.path, host);
|
|
39392
|
-
const originalPath = pathsAreEqual ? void 0 : resolvedValue.path;
|
|
39393
|
-
resolvedValue = { ...resolvedValue, path: pathsAreEqual ? resolvedValue.path : path, originalPath };
|
|
39394
|
-
}
|
|
39395
|
-
return { value: resolvedValue && { resolved: resolvedValue, isExternalLibraryImport: true } };
|
|
39411
|
+
return resolved2 && { value: resolved2.value && { resolved: resolved2.value, isExternalLibraryImport: true } };
|
|
39396
39412
|
} else {
|
|
39397
39413
|
const { path: candidate, parts } = normalizePathForCJSResolution(containingDirectory, moduleName);
|
|
39398
39414
|
const resolved2 = nodeLoadModuleByRelativeName(
|
|
@@ -40546,13 +40562,14 @@ ${lanes.join("\n")}
|
|
|
40546
40562
|
candidateIsFromPackageJsonField: false
|
|
40547
40563
|
};
|
|
40548
40564
|
const resolved = tryResolve(1 /* TypeScript */ | 4 /* Declaration */) || tryResolve(2 /* JavaScript */ | (compilerOptions.resolveJsonModule ? 8 /* Json */ : 0));
|
|
40549
|
-
return
|
|
40565
|
+
return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
|
|
40566
|
+
moduleName,
|
|
40550
40567
|
resolved && resolved.value,
|
|
40551
40568
|
(resolved == null ? void 0 : resolved.value) && pathContainsNodeModules(resolved.value.path),
|
|
40552
40569
|
failedLookupLocations,
|
|
40553
40570
|
affectingLocations,
|
|
40554
40571
|
diagnostics,
|
|
40555
|
-
state
|
|
40572
|
+
state
|
|
40556
40573
|
);
|
|
40557
40574
|
function tryResolve(extensions) {
|
|
40558
40575
|
const resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
|
|
@@ -44307,8 +44324,10 @@ ${lanes.join("\n")}
|
|
|
44307
44324
|
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
|
|
44308
44325
|
const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
|
|
44309
44326
|
if (getResolvePackageJsonExports(options)) {
|
|
44327
|
+
const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
|
|
44328
|
+
const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
|
|
44310
44329
|
const conditions = getConditions(options, importMode === 99 /* ESNext */);
|
|
44311
|
-
const fromExports = packageJsonContent.exports
|
|
44330
|
+
const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
|
|
44312
44331
|
if (fromExports) {
|
|
44313
44332
|
const withJsExtension = !hasTSFileExtension(fromExports.moduleFileToTry) ? fromExports : { moduleFileToTry: removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) };
|
|
44314
44333
|
return { ...withJsExtension, verbatimFromExports: true };
|
|
@@ -46677,7 +46696,12 @@ ${lanes.join("\n")}
|
|
|
46677
46696
|
}
|
|
46678
46697
|
function resolveExportByName(moduleSymbol, name, sourceNode, dontResolveAlias) {
|
|
46679
46698
|
const exportValue = moduleSymbol.exports.get("export=" /* ExportEquals */);
|
|
46680
|
-
const exportSymbol = exportValue ? getPropertyOfType(
|
|
46699
|
+
const exportSymbol = exportValue ? getPropertyOfType(
|
|
46700
|
+
getTypeOfSymbol(exportValue),
|
|
46701
|
+
name,
|
|
46702
|
+
/*skipObjectFunctionPropertyAugment*/
|
|
46703
|
+
true
|
|
46704
|
+
) : moduleSymbol.exports.get(name);
|
|
46681
46705
|
const resolved = resolveSymbol(exportSymbol, dontResolveAlias);
|
|
46682
46706
|
markSymbolOfAliasDeclarationIfTypeOnly(
|
|
46683
46707
|
sourceNode,
|
|
@@ -56092,7 +56116,7 @@ ${lanes.join("\n")}
|
|
|
56092
56116
|
for (const tag of node.tags) {
|
|
56093
56117
|
if (isJSDocOverloadTag(tag)) {
|
|
56094
56118
|
const jsDocSignature = tag.typeExpression;
|
|
56095
|
-
if (jsDocSignature.type === void 0) {
|
|
56119
|
+
if (jsDocSignature.type === void 0 && !isConstructorDeclaration(decl)) {
|
|
56096
56120
|
reportImplicitAny(jsDocSignature, anyType);
|
|
56097
56121
|
}
|
|
56098
56122
|
result.push(getSignatureFromDeclaration(jsDocSignature));
|
|
@@ -56204,6 +56228,12 @@ ${lanes.join("\n")}
|
|
|
56204
56228
|
if (declaration.kind === 173 /* Constructor */) {
|
|
56205
56229
|
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol));
|
|
56206
56230
|
}
|
|
56231
|
+
if (isJSDocSignature(declaration)) {
|
|
56232
|
+
const root = getJSDocRoot(declaration);
|
|
56233
|
+
if (root && isConstructorDeclaration(root.parent)) {
|
|
56234
|
+
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(root.parent.parent.symbol));
|
|
56235
|
+
}
|
|
56236
|
+
}
|
|
56207
56237
|
if (isJSDocConstructSignature(declaration)) {
|
|
56208
56238
|
return getTypeFromTypeNode(declaration.parameters[0].type);
|
|
56209
56239
|
}
|
|
@@ -57794,7 +57824,7 @@ ${lanes.join("\n")}
|
|
|
57794
57824
|
function typePredicateKindsMatch(a, b) {
|
|
57795
57825
|
return a.kind === b.kind && a.parameterIndex === b.parameterIndex;
|
|
57796
57826
|
}
|
|
57797
|
-
function getUnionTypeFromSortedList(types,
|
|
57827
|
+
function getUnionTypeFromSortedList(types, precomputedObjectFlags, aliasSymbol, aliasTypeArguments, origin) {
|
|
57798
57828
|
if (types.length === 0) {
|
|
57799
57829
|
return neverType;
|
|
57800
57830
|
}
|
|
@@ -57806,7 +57836,7 @@ ${lanes.join("\n")}
|
|
|
57806
57836
|
let type = unionTypes.get(id);
|
|
57807
57837
|
if (!type) {
|
|
57808
57838
|
type = createType(1048576 /* Union */);
|
|
57809
|
-
type.objectFlags =
|
|
57839
|
+
type.objectFlags = precomputedObjectFlags | getPropagatingFlagsOfTypes(
|
|
57810
57840
|
types,
|
|
57811
57841
|
/*excludeKinds*/
|
|
57812
57842
|
98304 /* Nullable */
|
|
@@ -58983,11 +59013,6 @@ ${lanes.join("\n")}
|
|
|
58983
59013
|
var _a2;
|
|
58984
59014
|
const links = getNodeLinks(node);
|
|
58985
59015
|
if (!links.resolvedType) {
|
|
58986
|
-
if (node.isTypeOf && node.typeArguments) {
|
|
58987
|
-
error(node, Diagnostics.Type_arguments_cannot_be_used_here);
|
|
58988
|
-
links.resolvedSymbol = unknownSymbol;
|
|
58989
|
-
return links.resolvedType = errorType;
|
|
58990
|
-
}
|
|
58991
59016
|
if (!isLiteralImportTypeNode(node)) {
|
|
58992
59017
|
error(node.argument, Diagnostics.String_literal_expected);
|
|
58993
59018
|
links.resolvedSymbol = unknownSymbol;
|
|
@@ -59048,7 +59073,7 @@ ${lanes.join("\n")}
|
|
|
59048
59073
|
const resolvedSymbol = resolveSymbol(symbol);
|
|
59049
59074
|
links.resolvedSymbol = resolvedSymbol;
|
|
59050
59075
|
if (meaning === 111551 /* Value */) {
|
|
59051
|
-
return getTypeOfSymbol(symbol);
|
|
59076
|
+
return getInstantiationExpressionType(getTypeOfSymbol(symbol), node);
|
|
59052
59077
|
} else {
|
|
59053
59078
|
const type = tryGetDeclaredTypeOfSymbol(resolvedSymbol);
|
|
59054
59079
|
const typeParameters = type && getTypeParametersForTypeAndSymbol(type, resolvedSymbol);
|
|
@@ -60929,7 +60954,6 @@ ${lanes.join("\n")}
|
|
|
60929
60954
|
let overrideNextErrorInfo = 0;
|
|
60930
60955
|
let lastSkippedInfo;
|
|
60931
60956
|
let incompatibleStack;
|
|
60932
|
-
let inPropertyCheck = false;
|
|
60933
60957
|
Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
|
|
60934
60958
|
const result = isRelatedTo(
|
|
60935
60959
|
source,
|
|
@@ -61126,7 +61150,8 @@ ${lanes.join("\n")}
|
|
|
61126
61150
|
Debug.assert(!isTypeAssignableTo(generalizedSource, target2), "generalized source shouldn't be assignable");
|
|
61127
61151
|
generalizedSourceType = getTypeNameForErrorDisplay(generalizedSource);
|
|
61128
61152
|
}
|
|
61129
|
-
|
|
61153
|
+
const targetFlags = target2.flags & 8388608 /* IndexedAccess */ && !(source2.flags & 8388608 /* IndexedAccess */) ? target2.objectType.flags : target2.flags;
|
|
61154
|
+
if (targetFlags & 262144 /* TypeParameter */ && target2 !== markerSuperTypeForCheck && target2 !== markerSubTypeForCheck) {
|
|
61130
61155
|
const constraint = getBaseConstraintOfType(target2);
|
|
61131
61156
|
let needsOriginalSource;
|
|
61132
61157
|
if (constraint && (isTypeAssignableTo(generalizedSource, constraint) || (needsOriginalSource = isTypeAssignableTo(source2, constraint)))) {
|
|
@@ -61887,14 +61912,15 @@ ${lanes.join("\n")}
|
|
|
61887
61912
|
);
|
|
61888
61913
|
}
|
|
61889
61914
|
}
|
|
61890
|
-
if (result2 && !
|
|
61891
|
-
inPropertyCheck = true;
|
|
61915
|
+
if (result2 && !(intersectionState & 2 /* Target */) && target2.flags & 2097152 /* Intersection */ && !isGenericObjectType(target2) && source2.flags & (524288 /* Object */ | 2097152 /* Intersection */)) {
|
|
61892
61916
|
result2 &= propertiesRelatedTo(
|
|
61893
61917
|
source2,
|
|
61894
61918
|
target2,
|
|
61895
61919
|
reportErrors2,
|
|
61896
61920
|
/*excludedProperties*/
|
|
61897
61921
|
void 0,
|
|
61922
|
+
/*optionalsOnly*/
|
|
61923
|
+
false,
|
|
61898
61924
|
0 /* None */
|
|
61899
61925
|
);
|
|
61900
61926
|
if (result2 && isObjectLiteralType2(source2) && getObjectFlags(source2) & 8192 /* FreshLiteral */) {
|
|
@@ -61907,7 +61933,17 @@ ${lanes.join("\n")}
|
|
|
61907
61933
|
0 /* None */
|
|
61908
61934
|
);
|
|
61909
61935
|
}
|
|
61910
|
-
|
|
61936
|
+
} else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => !!(getObjectFlags(t) & 262144 /* NonInferrableType */))) {
|
|
61937
|
+
result2 &= propertiesRelatedTo(
|
|
61938
|
+
source2,
|
|
61939
|
+
target2,
|
|
61940
|
+
reportErrors2,
|
|
61941
|
+
/*excludedProperties*/
|
|
61942
|
+
void 0,
|
|
61943
|
+
/*optionalsOnly*/
|
|
61944
|
+
true,
|
|
61945
|
+
intersectionState
|
|
61946
|
+
);
|
|
61911
61947
|
}
|
|
61912
61948
|
}
|
|
61913
61949
|
if (result2) {
|
|
@@ -62397,12 +62433,14 @@ ${lanes.join("\n")}
|
|
|
62397
62433
|
reportStructuralErrors,
|
|
62398
62434
|
/*excludedProperties*/
|
|
62399
62435
|
void 0,
|
|
62436
|
+
/*optionalsOnly*/
|
|
62437
|
+
false,
|
|
62400
62438
|
intersectionState
|
|
62401
62439
|
);
|
|
62402
62440
|
if (result2) {
|
|
62403
|
-
result2 &= signaturesRelatedTo(source2, target2, 0 /* Call */, reportStructuralErrors);
|
|
62441
|
+
result2 &= signaturesRelatedTo(source2, target2, 0 /* Call */, reportStructuralErrors, intersectionState);
|
|
62404
62442
|
if (result2) {
|
|
62405
|
-
result2 &= signaturesRelatedTo(source2, target2, 1 /* Construct */, reportStructuralErrors);
|
|
62443
|
+
result2 &= signaturesRelatedTo(source2, target2, 1 /* Construct */, reportStructuralErrors, intersectionState);
|
|
62406
62444
|
if (result2) {
|
|
62407
62445
|
result2 &= indexSignaturesRelatedTo(source2, target2, sourceIsPrimitive, reportStructuralErrors, intersectionState);
|
|
62408
62446
|
}
|
|
@@ -62531,6 +62569,8 @@ ${lanes.join("\n")}
|
|
|
62531
62569
|
/*reportErrors*/
|
|
62532
62570
|
false,
|
|
62533
62571
|
excludedProperties,
|
|
62572
|
+
/*optionalsOnly*/
|
|
62573
|
+
false,
|
|
62534
62574
|
0 /* None */
|
|
62535
62575
|
);
|
|
62536
62576
|
if (result2) {
|
|
@@ -62539,7 +62579,8 @@ ${lanes.join("\n")}
|
|
|
62539
62579
|
type,
|
|
62540
62580
|
0 /* Call */,
|
|
62541
62581
|
/*reportStructuralErrors*/
|
|
62542
|
-
false
|
|
62582
|
+
false,
|
|
62583
|
+
0 /* None */
|
|
62543
62584
|
);
|
|
62544
62585
|
if (result2) {
|
|
62545
62586
|
result2 &= signaturesRelatedTo(
|
|
@@ -62547,7 +62588,8 @@ ${lanes.join("\n")}
|
|
|
62547
62588
|
type,
|
|
62548
62589
|
1 /* Construct */,
|
|
62549
62590
|
/*reportStructuralErrors*/
|
|
62550
|
-
false
|
|
62591
|
+
false,
|
|
62592
|
+
0 /* None */
|
|
62551
62593
|
);
|
|
62552
62594
|
if (result2 && !(isTupleType(source2) && isTupleType(type))) {
|
|
62553
62595
|
result2 &= indexSignaturesRelatedTo(
|
|
@@ -62725,7 +62767,7 @@ ${lanes.join("\n")}
|
|
|
62725
62767
|
}
|
|
62726
62768
|
}
|
|
62727
62769
|
}
|
|
62728
|
-
function propertiesRelatedTo(source2, target2, reportErrors2, excludedProperties, intersectionState) {
|
|
62770
|
+
function propertiesRelatedTo(source2, target2, reportErrors2, excludedProperties, optionalsOnly, intersectionState) {
|
|
62729
62771
|
if (relation === identityRelation) {
|
|
62730
62772
|
return propertiesIdenticalTo(source2, target2, excludedProperties);
|
|
62731
62773
|
}
|
|
@@ -62861,7 +62903,7 @@ ${lanes.join("\n")}
|
|
|
62861
62903
|
const numericNamesOnly = isTupleType(source2) && isTupleType(target2);
|
|
62862
62904
|
for (const targetProp of excludeProperties(properties, excludedProperties)) {
|
|
62863
62905
|
const name = targetProp.escapedName;
|
|
62864
|
-
if (!(targetProp.flags & 4194304 /* Prototype */) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length")) {
|
|
62906
|
+
if (!(targetProp.flags & 4194304 /* Prototype */) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length") && (!optionalsOnly || targetProp.flags & 16777216 /* Optional */)) {
|
|
62865
62907
|
const sourceProp = getPropertyOfType(source2, name);
|
|
62866
62908
|
if (sourceProp && sourceProp !== targetProp) {
|
|
62867
62909
|
const related = propertyRelatedTo(source2, target2, sourceProp, targetProp, getNonMissingTypeOfSymbol, reportErrors2, intersectionState, relation === comparableRelation);
|
|
@@ -62897,7 +62939,7 @@ ${lanes.join("\n")}
|
|
|
62897
62939
|
}
|
|
62898
62940
|
return result2;
|
|
62899
62941
|
}
|
|
62900
|
-
function signaturesRelatedTo(source2, target2, kind, reportErrors2) {
|
|
62942
|
+
function signaturesRelatedTo(source2, target2, kind, reportErrors2, intersectionState) {
|
|
62901
62943
|
var _a3, _b;
|
|
62902
62944
|
if (relation === identityRelation) {
|
|
62903
62945
|
return signaturesIdenticalTo(source2, target2, kind);
|
|
@@ -62934,6 +62976,7 @@ ${lanes.join("\n")}
|
|
|
62934
62976
|
/*erase*/
|
|
62935
62977
|
true,
|
|
62936
62978
|
reportErrors2,
|
|
62979
|
+
intersectionState,
|
|
62937
62980
|
incompatibleReporter(sourceSignatures[i], targetSignatures[i])
|
|
62938
62981
|
);
|
|
62939
62982
|
if (!related) {
|
|
@@ -62945,7 +62988,7 @@ ${lanes.join("\n")}
|
|
|
62945
62988
|
const eraseGenerics = relation === comparableRelation || !!compilerOptions.noStrictGenericChecks;
|
|
62946
62989
|
const sourceSignature = first(sourceSignatures);
|
|
62947
62990
|
const targetSignature = first(targetSignatures);
|
|
62948
|
-
result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, incompatibleReporter(sourceSignature, targetSignature));
|
|
62991
|
+
result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, intersectionState, incompatibleReporter(sourceSignature, targetSignature));
|
|
62949
62992
|
if (!result2 && reportErrors2 && kind === 1 /* Construct */ && sourceObjectFlags & targetObjectFlags && (((_a3 = targetSignature.declaration) == null ? void 0 : _a3.kind) === 173 /* Constructor */ || ((_b = sourceSignature.declaration) == null ? void 0 : _b.kind) === 173 /* Constructor */)) {
|
|
62950
62993
|
const constructSignatureToString = (signature) => signatureToString(
|
|
62951
62994
|
signature,
|
|
@@ -62970,6 +63013,7 @@ ${lanes.join("\n")}
|
|
|
62970
63013
|
/*erase*/
|
|
62971
63014
|
true,
|
|
62972
63015
|
shouldElaborateErrors,
|
|
63016
|
+
intersectionState,
|
|
62973
63017
|
incompatibleReporter(s, t)
|
|
62974
63018
|
);
|
|
62975
63019
|
if (related) {
|
|
@@ -63022,7 +63066,7 @@ ${lanes.join("\n")}
|
|
|
63022
63066
|
}
|
|
63023
63067
|
return (source2, target2) => reportIncompatibleError(Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source2), typeToString(target2));
|
|
63024
63068
|
}
|
|
63025
|
-
function signatureRelatedTo(source2, target2, erase, reportErrors2, incompatibleReporter) {
|
|
63069
|
+
function signatureRelatedTo(source2, target2, erase, reportErrors2, intersectionState, incompatibleReporter) {
|
|
63026
63070
|
return compareSignaturesRelated(
|
|
63027
63071
|
erase ? getErasedSignature(source2) : source2,
|
|
63028
63072
|
erase ? getErasedSignature(target2) : target2,
|
|
@@ -63030,9 +63074,20 @@ ${lanes.join("\n")}
|
|
|
63030
63074
|
reportErrors2,
|
|
63031
63075
|
reportError,
|
|
63032
63076
|
incompatibleReporter,
|
|
63033
|
-
|
|
63077
|
+
isRelatedToWorker2,
|
|
63034
63078
|
reportUnreliableMapper
|
|
63035
63079
|
);
|
|
63080
|
+
function isRelatedToWorker2(source3, target3, reportErrors3) {
|
|
63081
|
+
return isRelatedTo(
|
|
63082
|
+
source3,
|
|
63083
|
+
target3,
|
|
63084
|
+
3 /* Both */,
|
|
63085
|
+
reportErrors3,
|
|
63086
|
+
/*headMessage*/
|
|
63087
|
+
void 0,
|
|
63088
|
+
intersectionState
|
|
63089
|
+
);
|
|
63090
|
+
}
|
|
63036
63091
|
}
|
|
63037
63092
|
function signaturesIdenticalTo(source2, target2, kind) {
|
|
63038
63093
|
const sourceSignatures = getSignaturesOfType(source2, kind);
|
|
@@ -63091,7 +63146,7 @@ ${lanes.join("\n")}
|
|
|
63091
63146
|
}
|
|
63092
63147
|
for (const info of getIndexInfosOfType(source2)) {
|
|
63093
63148
|
if (isApplicableIndexType(info.keyType, keyType)) {
|
|
63094
|
-
const related = indexInfoRelatedTo(info, targetInfo, reportErrors2);
|
|
63149
|
+
const related = indexInfoRelatedTo(info, targetInfo, reportErrors2, intersectionState);
|
|
63095
63150
|
if (!related) {
|
|
63096
63151
|
return 0 /* False */;
|
|
63097
63152
|
}
|
|
@@ -63100,8 +63155,16 @@ ${lanes.join("\n")}
|
|
|
63100
63155
|
}
|
|
63101
63156
|
return result2;
|
|
63102
63157
|
}
|
|
63103
|
-
function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2) {
|
|
63104
|
-
const related = isRelatedTo(
|
|
63158
|
+
function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState) {
|
|
63159
|
+
const related = isRelatedTo(
|
|
63160
|
+
sourceInfo.type,
|
|
63161
|
+
targetInfo.type,
|
|
63162
|
+
3 /* Both */,
|
|
63163
|
+
reportErrors2,
|
|
63164
|
+
/*headMessage*/
|
|
63165
|
+
void 0,
|
|
63166
|
+
intersectionState
|
|
63167
|
+
);
|
|
63105
63168
|
if (!related && reportErrors2) {
|
|
63106
63169
|
if (sourceInfo.keyType === targetInfo.keyType) {
|
|
63107
63170
|
reportError(Diagnostics._0_index_signatures_are_incompatible, typeToString(sourceInfo.keyType));
|
|
@@ -63130,7 +63193,7 @@ ${lanes.join("\n")}
|
|
|
63130
63193
|
function typeRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState) {
|
|
63131
63194
|
const sourceInfo = getApplicableIndexInfo(source2, targetInfo.keyType);
|
|
63132
63195
|
if (sourceInfo) {
|
|
63133
|
-
return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2);
|
|
63196
|
+
return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState);
|
|
63134
63197
|
}
|
|
63135
63198
|
if (!(intersectionState & 1 /* Source */) && isObjectTypeWithInferableIndex(source2)) {
|
|
63136
63199
|
return membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
|
|
@@ -63421,12 +63484,15 @@ ${lanes.join("\n")}
|
|
|
63421
63484
|
}
|
|
63422
63485
|
function isDeeplyNestedType(type, stack, depth, maxDepth = 3) {
|
|
63423
63486
|
if (depth >= maxDepth) {
|
|
63487
|
+
if (type.flags & 2097152 /* Intersection */) {
|
|
63488
|
+
return some(type.types, (t) => isDeeplyNestedType(t, stack, depth, maxDepth));
|
|
63489
|
+
}
|
|
63424
63490
|
const identity2 = getRecursionIdentity(type);
|
|
63425
63491
|
let count = 0;
|
|
63426
63492
|
let lastTypeId = 0;
|
|
63427
63493
|
for (let i = 0; i < depth; i++) {
|
|
63428
63494
|
const t = stack[i];
|
|
63429
|
-
if (getRecursionIdentity(t) === identity2) {
|
|
63495
|
+
if (t.flags & 2097152 /* Intersection */ ? some(t.types, (u) => getRecursionIdentity(u) === identity2) : getRecursionIdentity(t) === identity2) {
|
|
63430
63496
|
if (t.id >= lastTypeId) {
|
|
63431
63497
|
count++;
|
|
63432
63498
|
if (count >= maxDepth) {
|
|
@@ -65794,7 +65860,7 @@ ${lanes.join("\n")}
|
|
|
65794
65860
|
}
|
|
65795
65861
|
return getUnionTypeFromSortedList(
|
|
65796
65862
|
filtered,
|
|
65797
|
-
type.objectFlags,
|
|
65863
|
+
type.objectFlags & (32768 /* PrimitiveUnion */ | 16777216 /* ContainsIntersections */),
|
|
65798
65864
|
/*aliasSymbol*/
|
|
65799
65865
|
void 0,
|
|
65800
65866
|
/*aliasTypeArguments*/
|
|
@@ -72445,7 +72511,7 @@ ${lanes.join("\n")}
|
|
|
72445
72511
|
}
|
|
72446
72512
|
}
|
|
72447
72513
|
function checkCallExpression(node, checkMode) {
|
|
72448
|
-
var _a2;
|
|
72514
|
+
var _a2, _b, _c;
|
|
72449
72515
|
checkGrammarTypeArguments(node, node.typeArguments);
|
|
72450
72516
|
const signature = getResolvedSignature(
|
|
72451
72517
|
node,
|
|
@@ -72462,7 +72528,7 @@ ${lanes.join("\n")}
|
|
|
72462
72528
|
}
|
|
72463
72529
|
if (node.kind === 211 /* NewExpression */) {
|
|
72464
72530
|
const declaration = signature.declaration;
|
|
72465
|
-
if (declaration && declaration.kind !== 173 /* Constructor */ && declaration.kind !== 177 /* ConstructSignature */ && declaration.kind !== 182 /* ConstructorType */ && !isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) {
|
|
72531
|
+
if (declaration && declaration.kind !== 173 /* Constructor */ && declaration.kind !== 177 /* ConstructSignature */ && declaration.kind !== 182 /* ConstructorType */ && !(isJSDocSignature(declaration) && ((_b = (_a2 = getJSDocRoot(declaration)) == null ? void 0 : _a2.parent) == null ? void 0 : _b.kind) === 173 /* Constructor */) && !isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) {
|
|
72466
72532
|
if (noImplicitAny) {
|
|
72467
72533
|
error(node, Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type);
|
|
72468
72534
|
}
|
|
@@ -72490,7 +72556,7 @@ ${lanes.join("\n")}
|
|
|
72490
72556
|
/*allowDeclaration*/
|
|
72491
72557
|
false
|
|
72492
72558
|
);
|
|
72493
|
-
if ((
|
|
72559
|
+
if ((_c = jsSymbol == null ? void 0 : jsSymbol.exports) == null ? void 0 : _c.size) {
|
|
72494
72560
|
const jsAssignmentType = createAnonymousType(jsSymbol, jsSymbol.exports, emptyArray, emptyArray, emptyArray);
|
|
72495
72561
|
jsAssignmentType.objectFlags |= 4096 /* JSLiteral */;
|
|
72496
72562
|
return getIntersectionType([returnType, jsAssignmentType]);
|
|
@@ -72776,6 +72842,9 @@ ${lanes.join("\n")}
|
|
|
72776
72842
|
checkGrammarExpressionWithTypeArguments(node);
|
|
72777
72843
|
forEach(node.typeArguments, checkSourceElement);
|
|
72778
72844
|
const exprType = node.kind === 230 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
|
|
72845
|
+
return getInstantiationExpressionType(exprType, node);
|
|
72846
|
+
}
|
|
72847
|
+
function getInstantiationExpressionType(exprType, node) {
|
|
72779
72848
|
const typeArguments = node.typeArguments;
|
|
72780
72849
|
if (exprType === silentNeverType || isErrorType(exprType) || !some(typeArguments)) {
|
|
72781
72850
|
return exprType;
|
|
@@ -75414,7 +75483,7 @@ ${lanes.join("\n")}
|
|
|
75414
75483
|
return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getReturnTypeOfSingleNonGenericCallSignature(checkNonNullExpression(expr.expression));
|
|
75415
75484
|
} else if (isAssertionExpression(expr) && !isConstTypeReference(expr.type)) {
|
|
75416
75485
|
return getTypeFromTypeNode(expr.type);
|
|
75417
|
-
} else if (node
|
|
75486
|
+
} else if (isLiteralExpression(node) || isBooleanLiteral(node)) {
|
|
75418
75487
|
return checkExpression(node);
|
|
75419
75488
|
}
|
|
75420
75489
|
return void 0;
|
|
@@ -84390,8 +84459,8 @@ ${lanes.join("\n")}
|
|
|
84390
84459
|
"use strict";
|
|
84391
84460
|
init_ts2();
|
|
84392
84461
|
init_ts2();
|
|
84393
|
-
init_ts_performance();
|
|
84394
84462
|
init_ts_moduleSpecifiers();
|
|
84463
|
+
init_ts_performance();
|
|
84395
84464
|
ambientModuleSymbolRegex = /^".+"$/;
|
|
84396
84465
|
anon = "(anonymous)";
|
|
84397
84466
|
nextSymbolId = 1;
|
|
@@ -106735,7 +106804,7 @@ ${lanes.join("\n")}
|
|
|
106735
106804
|
if (elem.kind === 229 /* OmittedExpression */) {
|
|
106736
106805
|
return elem;
|
|
106737
106806
|
}
|
|
106738
|
-
if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced) {
|
|
106807
|
+
if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced && !isIdentifierANonContextualKeyword(elem.propertyName)) {
|
|
106739
106808
|
return factory2.updateBindingElement(
|
|
106740
106809
|
elem,
|
|
106741
106810
|
elem.dotDotDotToken,
|
|
@@ -133413,9 +133482,9 @@ ${lanes.join("\n")}
|
|
|
133413
133482
|
"src/services/services.ts"() {
|
|
133414
133483
|
"use strict";
|
|
133415
133484
|
init_ts4();
|
|
133485
|
+
init_ts4();
|
|
133416
133486
|
init_ts_NavigateTo();
|
|
133417
133487
|
init_ts_NavigationBar();
|
|
133418
|
-
init_ts4();
|
|
133419
133488
|
servicesVersion = "0.8";
|
|
133420
133489
|
NodeObject = class {
|
|
133421
133490
|
constructor(kind, pos, end) {
|
|
@@ -136421,8 +136490,8 @@ ${lanes.join("\n")}
|
|
|
136421
136490
|
var init_addEmptyExportDeclaration = __esm({
|
|
136422
136491
|
"src/services/codefixes/addEmptyExportDeclaration.ts"() {
|
|
136423
136492
|
"use strict";
|
|
136424
|
-
init_ts_codefix();
|
|
136425
136493
|
init_ts4();
|
|
136494
|
+
init_ts_codefix();
|
|
136426
136495
|
registerCodeFix({
|
|
136427
136496
|
errorCodes: [
|
|
136428
136497
|
Diagnostics.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module.code,
|
|
@@ -138786,8 +138855,8 @@ ${lanes.join("\n")}
|
|
|
138786
138855
|
var init_convertToEsModule = __esm({
|
|
138787
138856
|
"src/services/codefixes/convertToEsModule.ts"() {
|
|
138788
138857
|
"use strict";
|
|
138789
|
-
init_ts_codefix();
|
|
138790
138858
|
init_ts4();
|
|
138859
|
+
init_ts_codefix();
|
|
138791
138860
|
registerCodeFix({
|
|
138792
138861
|
errorCodes: [Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module.code],
|
|
138793
138862
|
getCodeActions(context) {
|
|
@@ -142386,8 +142455,8 @@ ${lanes.join("\n")}
|
|
|
142386
142455
|
var init_fixModuleAndTargetOptions = __esm({
|
|
142387
142456
|
"src/services/codefixes/fixModuleAndTargetOptions.ts"() {
|
|
142388
142457
|
"use strict";
|
|
142389
|
-
init_ts_codefix();
|
|
142390
142458
|
init_ts4();
|
|
142459
|
+
init_ts_codefix();
|
|
142391
142460
|
registerCodeFix({
|
|
142392
142461
|
errorCodes: [
|
|
142393
142462
|
Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher.code,
|
|
@@ -147719,7 +147788,7 @@ ${lanes.join("\n")}
|
|
|
147719
147788
|
}
|
|
147720
147789
|
function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) {
|
|
147721
147790
|
const replacementSpan = importStatementCompletion.replacementSpan;
|
|
147722
|
-
const quotedModuleSpecifier = quote(sourceFile, preferences, origin.moduleSpecifier);
|
|
147791
|
+
const quotedModuleSpecifier = quote(sourceFile, preferences, escapeSnippetText(origin.moduleSpecifier));
|
|
147723
147792
|
const exportKind = origin.isDefaultExport ? 1 /* Default */ : origin.exportName === "export=" /* ExportEquals */ ? 2 /* ExportEquals */ : 0 /* Named */;
|
|
147724
147793
|
const tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : "";
|
|
147725
147794
|
const importKind = ts_codefix_exports.getImportKind(
|
|
@@ -150325,12 +150394,12 @@ ${lanes.join("\n")}
|
|
|
150325
150394
|
const mode = isStringLiteralLike(node) ? getModeForUsageLocation(sourceFile, node) : void 0;
|
|
150326
150395
|
const scriptPath = sourceFile.path;
|
|
150327
150396
|
const scriptDirectory = getDirectoryPath(scriptPath);
|
|
150328
|
-
const extensionOptions = getExtensionOptions(compilerOptions, ReferenceKind.ModuleSpecifier, sourceFile, preferences, mode);
|
|
150397
|
+
const extensionOptions = getExtensionOptions(compilerOptions, ReferenceKind.ModuleSpecifier, sourceFile, typeChecker, preferences, mode);
|
|
150329
150398
|
return isPathRelativeToScript(literalValue) || !compilerOptions.baseUrl && (isRootedDiskPath(literalValue) || isUrl(literalValue)) ? getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath, extensionOptions) : getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, mode, compilerOptions, host, extensionOptions, typeChecker);
|
|
150330
150399
|
}
|
|
150331
|
-
function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, preferences, resolutionMode) {
|
|
150400
|
+
function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, typeChecker, preferences, resolutionMode) {
|
|
150332
150401
|
return {
|
|
150333
|
-
extensionsToSearch: flatten(getSupportedExtensionsForModuleResolution(compilerOptions)),
|
|
150402
|
+
extensionsToSearch: flatten(getSupportedExtensionsForModuleResolution(compilerOptions, typeChecker)),
|
|
150334
150403
|
referenceKind,
|
|
150335
150404
|
importingSourceFile,
|
|
150336
150405
|
endingPreference: preferences == null ? void 0 : preferences.importModuleSpecifierEnding,
|
|
@@ -150360,8 +150429,17 @@ ${lanes.join("\n")}
|
|
|
150360
150429
|
).values());
|
|
150361
150430
|
}
|
|
150362
150431
|
}
|
|
150363
|
-
function getSupportedExtensionsForModuleResolution(compilerOptions) {
|
|
150364
|
-
const
|
|
150432
|
+
function getSupportedExtensionsForModuleResolution(compilerOptions, typeChecker) {
|
|
150433
|
+
const ambientModulesExtensions = !typeChecker ? [] : mapDefined(
|
|
150434
|
+
typeChecker.getAmbientModules(),
|
|
150435
|
+
(module2) => {
|
|
150436
|
+
const name = module2.name.slice(1, -1);
|
|
150437
|
+
if (!name.startsWith("*.") || name.includes("/"))
|
|
150438
|
+
return;
|
|
150439
|
+
return name.slice(1);
|
|
150440
|
+
}
|
|
150441
|
+
);
|
|
150442
|
+
const extensions = [...getSupportedExtensions(compilerOptions), ambientModulesExtensions];
|
|
150365
150443
|
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
150366
150444
|
return moduleResolutionUsesNodeModules(moduleResolution) ? getSupportedExtensionsWithJsonIfResolveJsonModule(compilerOptions, extensions) : extensions;
|
|
150367
150445
|
}
|
|
@@ -157710,6 +157788,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157710
157788
|
if (isExpression(body)) {
|
|
157711
157789
|
const returnStatement = factory.createReturnStatement(body);
|
|
157712
157790
|
const file = body.getSourceFile();
|
|
157791
|
+
setTextRange(returnStatement, body);
|
|
157713
157792
|
suppressLeadingAndTrailingTrivia(returnStatement);
|
|
157714
157793
|
copyTrailingAsLeadingComments(
|
|
157715
157794
|
body,
|
|
@@ -164688,8 +164767,8 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
164688
164767
|
var init_rules = __esm({
|
|
164689
164768
|
"src/services/formatting/rules.ts"() {
|
|
164690
164769
|
"use strict";
|
|
164691
|
-
init_ts_formatting();
|
|
164692
164770
|
init_ts4();
|
|
164771
|
+
init_ts_formatting();
|
|
164693
164772
|
}
|
|
164694
164773
|
});
|
|
164695
164774
|
|