typescript 5.0.0-dev.20230110 → 5.0.0-dev.20230112
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 +127 -63
- package/lib/tsserver.js +181 -98
- package/lib/tsserverlibrary.js +180 -98
- package/lib/typescript.js +177 -97
- package/lib/typingsInstaller.js +43 -29
- package/package.json +1 -1
package/lib/tsserver.js
CHANGED
|
@@ -1735,6 +1735,7 @@ __export(server_exports, {
|
|
|
1735
1735
|
isNonContextualKeyword: () => isNonContextualKeyword,
|
|
1736
1736
|
isNonGlobalAmbientModule: () => isNonGlobalAmbientModule,
|
|
1737
1737
|
isNonGlobalDeclaration: () => isNonGlobalDeclaration,
|
|
1738
|
+
isNonNullAccess: () => isNonNullAccess,
|
|
1738
1739
|
isNonNullChain: () => isNonNullChain,
|
|
1739
1740
|
isNonNullExpression: () => isNonNullExpression,
|
|
1740
1741
|
isNonStaticMethodOrAccessorWithPrivateName: () => isNonStaticMethodOrAccessorWithPrivateName,
|
|
@@ -2661,7 +2662,7 @@ __export(ts_server_exports3, {
|
|
|
2661
2662
|
|
|
2662
2663
|
// src/compiler/corePublic.ts
|
|
2663
2664
|
var versionMajorMinor = "5.0";
|
|
2664
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2665
|
+
var version = `${versionMajorMinor}.0-dev.20230112`;
|
|
2665
2666
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2666
2667
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2667
2668
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -10567,6 +10568,7 @@ var Diagnostics = {
|
|
|
10567
10568
|
Default_export_of_the_module_has_or_is_using_private_name_0: diag(4082, 1 /* Error */, "Default_export_of_the_module_has_or_is_using_private_name_0_4082", "Default export of the module has or is using private name '{0}'."),
|
|
10568
10569
|
Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: diag(4083, 1 /* Error */, "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", "Type parameter '{0}' of exported type alias has or is using private name '{1}'."),
|
|
10569
10570
|
Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2: diag(4084, 1 /* Error */, "Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2_4084", "Exported type alias '{0}' has or is using private name '{1}' from module {2}."),
|
|
10571
|
+
Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1: diag(4085, 1 /* Error */, "Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1_4085", "Extends clause for inferred type '{0}' has or is using private name '{1}'."),
|
|
10570
10572
|
Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: diag(4090, 1 /* Error */, "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict."),
|
|
10571
10573
|
Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4091, 1 /* Error */, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'."),
|
|
10572
10574
|
Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4092, 1 /* Error */, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'."),
|
|
@@ -12228,7 +12230,8 @@ function isIdentifierStart(ch, languageVersion) {
|
|
|
12228
12230
|
return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion);
|
|
12229
12231
|
}
|
|
12230
12232
|
function isIdentifierPart(ch, languageVersion, identifierVariant) {
|
|
12231
|
-
return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch >= 48 /* _0 */ && ch <= 57 /* _9 */ || ch === 36 /* $ */ || ch === 95 /* _ */ ||
|
|
12233
|
+
return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch >= 48 /* _0 */ && ch <= 57 /* _9 */ || ch === 36 /* $ */ || ch === 95 /* _ */ || // "-" and ":" are valid in JSX Identifiers
|
|
12234
|
+
(identifierVariant === 1 /* JSX */ ? ch === 45 /* minus */ || ch === 58 /* colon */ : false) || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion);
|
|
12232
12235
|
}
|
|
12233
12236
|
function isIdentifierText(name, languageVersion, identifierVariant) {
|
|
12234
12237
|
let ch = codePointAt(name, 0);
|
|
@@ -21102,6 +21105,10 @@ function isOptionalDeclaration(declaration) {
|
|
|
21102
21105
|
return false;
|
|
21103
21106
|
}
|
|
21104
21107
|
}
|
|
21108
|
+
function isNonNullAccess(node) {
|
|
21109
|
+
const kind = node.kind;
|
|
21110
|
+
return (kind === 208 /* PropertyAccessExpression */ || kind === 209 /* ElementAccessExpression */) && isNonNullExpression(node.expression);
|
|
21111
|
+
}
|
|
21105
21112
|
|
|
21106
21113
|
// src/compiler/factory/baseNodeFactory.ts
|
|
21107
21114
|
function createBaseNodeFactory() {
|
|
@@ -38957,7 +38964,8 @@ function convertToObjectWorker(sourceFile, rootExpression, errors, returnValue,
|
|
|
38957
38964
|
if (returnValue) {
|
|
38958
38965
|
result[keyText] = value;
|
|
38959
38966
|
}
|
|
38960
|
-
if (jsonConversionNotifier &&
|
|
38967
|
+
if (jsonConversionNotifier && // Current callbacks are only on known parent option or if we are setting values in the root
|
|
38968
|
+
(parentOption || isRootOptionMap(knownOptions))) {
|
|
38961
38969
|
const isValidOptionValue = isCompilerOptionsValue(option, value);
|
|
38962
38970
|
if (parentOption) {
|
|
38963
38971
|
if (isValidOptionValue) {
|
|
@@ -40498,7 +40506,8 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
40498
40506
|
conditions,
|
|
40499
40507
|
requestContainingDirectory: containingDirectory,
|
|
40500
40508
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
40501
|
-
isConfigLookup: false
|
|
40509
|
+
isConfigLookup: false,
|
|
40510
|
+
candidateIsFromPackageJsonField: false
|
|
40502
40511
|
};
|
|
40503
40512
|
let resolved = primaryLookup();
|
|
40504
40513
|
let primary = true;
|
|
@@ -41369,7 +41378,8 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
41369
41378
|
conditions,
|
|
41370
41379
|
requestContainingDirectory: containingDirectory,
|
|
41371
41380
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
41372
|
-
isConfigLookup
|
|
41381
|
+
isConfigLookup,
|
|
41382
|
+
candidateIsFromPackageJsonField: false
|
|
41373
41383
|
};
|
|
41374
41384
|
if (traceEnabled && getEmitModuleResolutionKind(compilerOptions) >= 3 /* Node16 */ && getEmitModuleResolutionKind(compilerOptions) <= 99 /* NodeNext */) {
|
|
41375
41385
|
trace(host, Diagnostics.Resolving_in_0_mode_with_conditions_1, features & 32 /* EsmMode */ ? "ESM" : "CJS", conditions.map((c) => `'${c}'`).join(", "));
|
|
@@ -41593,7 +41603,7 @@ function tryAddingExtensions(candidate, extensions, originalExtension, onlyRecor
|
|
|
41593
41603
|
}
|
|
41594
41604
|
function tryExtension(ext, resolvedUsingTsExtension) {
|
|
41595
41605
|
const path = tryFile(candidate + ext, onlyRecordFailures, state);
|
|
41596
|
-
return path === void 0 ? void 0 : { path, ext, resolvedUsingTsExtension };
|
|
41606
|
+
return path === void 0 ? void 0 : { path, ext, resolvedUsingTsExtension: !state.candidateIsFromPackageJsonField && resolvedUsingTsExtension };
|
|
41597
41607
|
}
|
|
41598
41608
|
}
|
|
41599
41609
|
function tryFile(fileName, onlyRecordFailures, state) {
|
|
@@ -41740,7 +41750,8 @@ function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options)
|
|
|
41740
41750
|
conditions: emptyArray,
|
|
41741
41751
|
requestContainingDirectory: void 0,
|
|
41742
41752
|
reportDiagnostic: noop,
|
|
41743
|
-
isConfigLookup: false
|
|
41753
|
+
isConfigLookup: false,
|
|
41754
|
+
candidateIsFromPackageJsonField: false
|
|
41744
41755
|
};
|
|
41745
41756
|
}
|
|
41746
41757
|
function getPackageScopeForPath(fileName, state) {
|
|
@@ -41828,6 +41839,8 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
|
|
|
41828
41839
|
}
|
|
41829
41840
|
const expandedExtensions = extensions2 === 4 /* Declaration */ ? 1 /* TypeScript */ | 4 /* Declaration */ : extensions2;
|
|
41830
41841
|
const features = state2.features;
|
|
41842
|
+
const candidateIsFromPackageJsonField = state2.candidateIsFromPackageJsonField;
|
|
41843
|
+
state2.candidateIsFromPackageJsonField = true;
|
|
41831
41844
|
if ((jsonContent == null ? void 0 : jsonContent.type) !== "module") {
|
|
41832
41845
|
state2.features &= ~32 /* EsmMode */;
|
|
41833
41846
|
}
|
|
@@ -41840,6 +41853,7 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
|
|
|
41840
41853
|
false
|
|
41841
41854
|
);
|
|
41842
41855
|
state2.features = features;
|
|
41856
|
+
state2.candidateIsFromPackageJsonField = candidateIsFromPackageJsonField;
|
|
41843
41857
|
return result;
|
|
41844
41858
|
};
|
|
41845
41859
|
const onlyRecordFailuresForPackageFile = packageFile ? !directoryProbablyExists(getDirectoryPath(packageFile), state.host) : void 0;
|
|
@@ -41913,7 +41927,10 @@ function loadModuleFromSelfNameReference(extensions, moduleName, directory, stat
|
|
|
41913
41927
|
return void 0;
|
|
41914
41928
|
}
|
|
41915
41929
|
const trailingParts = parts.slice(nameParts.length);
|
|
41916
|
-
|
|
41930
|
+
const subpath = !length(trailingParts) ? "." : `.${directorySeparator}${trailingParts.join(directorySeparator)}`;
|
|
41931
|
+
const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
|
|
41932
|
+
const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
|
|
41933
|
+
return loadModuleFromExports(scope, priorityExtensions, subpath, state, cache, redirectedReference) || loadModuleFromExports(scope, secondaryExtensions, subpath, state, cache, redirectedReference);
|
|
41917
41934
|
}
|
|
41918
41935
|
function loadModuleFromExports(scope, extensions, subpath, state, cache, redirectedReference) {
|
|
41919
41936
|
if (!scope.contents.packageJsonContent.exports) {
|
|
@@ -42415,25 +42432,26 @@ function loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, dir
|
|
|
42415
42432
|
}
|
|
42416
42433
|
}
|
|
42417
42434
|
function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) {
|
|
42418
|
-
var _a2;
|
|
42435
|
+
var _a2, _b, _c;
|
|
42419
42436
|
const candidate = normalizePath(combinePaths(nodeModulesDirectory, moduleName));
|
|
42437
|
+
const { packageName, rest } = parsePackageName(moduleName);
|
|
42438
|
+
const packageDirectory = combinePaths(nodeModulesDirectory, packageName);
|
|
42439
|
+
let rootPackageInfo;
|
|
42420
42440
|
let packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state);
|
|
42421
|
-
if (!(state.features & 8 /* Exports */)) {
|
|
42422
|
-
|
|
42423
|
-
|
|
42424
|
-
|
|
42425
|
-
return noPackageId(fromFile);
|
|
42426
|
-
}
|
|
42427
|
-
const fromDirectory = loadNodeModuleFromDirectoryWorker(
|
|
42428
|
-
extensions,
|
|
42429
|
-
candidate,
|
|
42430
|
-
!nodeModulesDirectoryExists,
|
|
42431
|
-
state,
|
|
42432
|
-
packageInfo.contents.packageJsonContent,
|
|
42433
|
-
getVersionPathsOfPackageJsonInfo(packageInfo, state)
|
|
42434
|
-
);
|
|
42435
|
-
return withPackageId(packageInfo, fromDirectory);
|
|
42441
|
+
if (rest !== "" && packageInfo && (!(state.features & 8 /* Exports */) || !hasProperty((_b = (_a2 = rootPackageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state)) == null ? void 0 : _a2.contents.packageJsonContent) != null ? _b : emptyArray, "exports"))) {
|
|
42442
|
+
const fromFile = loadModuleFromFile(extensions, candidate, !nodeModulesDirectoryExists, state);
|
|
42443
|
+
if (fromFile) {
|
|
42444
|
+
return noPackageId(fromFile);
|
|
42436
42445
|
}
|
|
42446
|
+
const fromDirectory = loadNodeModuleFromDirectoryWorker(
|
|
42447
|
+
extensions,
|
|
42448
|
+
candidate,
|
|
42449
|
+
!nodeModulesDirectoryExists,
|
|
42450
|
+
state,
|
|
42451
|
+
packageInfo.contents.packageJsonContent,
|
|
42452
|
+
getVersionPathsOfPackageJsonInfo(packageInfo, state)
|
|
42453
|
+
);
|
|
42454
|
+
return withPackageId(packageInfo, fromDirectory);
|
|
42437
42455
|
}
|
|
42438
42456
|
const loader = (extensions2, candidate2, onlyRecordFailures, state2) => {
|
|
42439
42457
|
let pathAndExtension = loadModuleFromFile(extensions2, candidate2, onlyRecordFailures, state2) || loadNodeModuleFromDirectoryWorker(
|
|
@@ -42449,13 +42467,11 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
|
|
|
42449
42467
|
}
|
|
42450
42468
|
return withPackageId(packageInfo, pathAndExtension);
|
|
42451
42469
|
};
|
|
42452
|
-
const { packageName, rest } = parsePackageName(moduleName);
|
|
42453
|
-
const packageDirectory = combinePaths(nodeModulesDirectory, packageName);
|
|
42454
42470
|
if (rest !== "") {
|
|
42455
|
-
packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
|
|
42471
|
+
packageInfo = rootPackageInfo != null ? rootPackageInfo : getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
|
|
42456
42472
|
}
|
|
42457
42473
|
if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & 8 /* Exports */) {
|
|
42458
|
-
return (
|
|
42474
|
+
return (_c = loadModuleFromExports(packageInfo, extensions, combinePaths(".", rest), state, cache, redirectedReference)) == null ? void 0 : _c.value;
|
|
42459
42475
|
}
|
|
42460
42476
|
const versionPaths = rest !== "" && packageInfo ? getVersionPathsOfPackageJsonInfo(packageInfo, state) : void 0;
|
|
42461
42477
|
if (versionPaths) {
|
|
@@ -42572,7 +42588,8 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
|
42572
42588
|
conditions: [],
|
|
42573
42589
|
requestContainingDirectory: containingDirectory,
|
|
42574
42590
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
42575
|
-
isConfigLookup: false
|
|
42591
|
+
isConfigLookup: false,
|
|
42592
|
+
candidateIsFromPackageJsonField: false
|
|
42576
42593
|
};
|
|
42577
42594
|
const resolved = tryResolve(1 /* TypeScript */ | 4 /* Declaration */) || tryResolve(2 /* JavaScript */ | (compilerOptions.resolveJsonModule ? 8 /* Json */ : 0));
|
|
42578
42595
|
return createResolvedModuleWithFailedLookupLocations(
|
|
@@ -42651,7 +42668,8 @@ function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, hos
|
|
|
42651
42668
|
conditions: [],
|
|
42652
42669
|
requestContainingDirectory: void 0,
|
|
42653
42670
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
42654
|
-
isConfigLookup: false
|
|
42671
|
+
isConfigLookup: false,
|
|
42672
|
+
candidateIsFromPackageJsonField: false
|
|
42655
42673
|
};
|
|
42656
42674
|
const resolved = loadModuleFromImmediateNodeModulesDirectory(
|
|
42657
42675
|
4 /* Declaration */,
|
|
@@ -45418,8 +45436,12 @@ function createBinder() {
|
|
|
45418
45436
|
return false;
|
|
45419
45437
|
}
|
|
45420
45438
|
if (currentFlow === unreachableFlow) {
|
|
45421
|
-
const reportError =
|
|
45422
|
-
|
|
45439
|
+
const reportError = (
|
|
45440
|
+
// report error on all statements except empty ones
|
|
45441
|
+
isStatementButNotDeclaration(node) && node.kind !== 239 /* EmptyStatement */ || // report error on class declarations
|
|
45442
|
+
node.kind === 260 /* ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set
|
|
45443
|
+
node.kind === 264 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)
|
|
45444
|
+
);
|
|
45423
45445
|
if (reportError) {
|
|
45424
45446
|
currentFlow = reportedUnreachableFlow;
|
|
45425
45447
|
if (!options.allowUnreachableCode) {
|
|
@@ -51273,7 +51295,8 @@ function createTypeChecker(host) {
|
|
|
51273
51295
|
const isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || // is exported function symbol
|
|
51274
51296
|
forEach(symbol.declarations, (declaration) => declaration.parent.kind === 308 /* SourceFile */ || declaration.parent.kind === 265 /* ModuleBlock */));
|
|
51275
51297
|
if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {
|
|
51276
|
-
return (!!(context.flags & 4096 /* UseTypeOfFunction */) || ((_a4 = context.visitedTypes) == null ? void 0 : _a4.has(typeId))) &&
|
|
51298
|
+
return (!!(context.flags & 4096 /* UseTypeOfFunction */) || ((_a4 = context.visitedTypes) == null ? void 0 : _a4.has(typeId))) && // it is type of the symbol uses itself recursively
|
|
51299
|
+
(!(context.flags & 8 /* UseStructuralFallback */) || isValueSymbolAccessible(symbol, context.enclosingDeclaration));
|
|
51277
51300
|
}
|
|
51278
51301
|
}
|
|
51279
51302
|
}
|
|
@@ -51365,7 +51388,9 @@ function createTypeChecker(host) {
|
|
|
51365
51388
|
const abstractSignatures = filter(resolved.constructSignatures, (signature) => !!(signature.flags & 4 /* Abstract */));
|
|
51366
51389
|
if (some(abstractSignatures)) {
|
|
51367
51390
|
const types = map(abstractSignatures, getOrCreateTypeFromSignature);
|
|
51368
|
-
const typeElementCount = resolved.callSignatures.length + (resolved.constructSignatures.length - abstractSignatures.length) + resolved.indexInfos.length +
|
|
51391
|
+
const typeElementCount = resolved.callSignatures.length + (resolved.constructSignatures.length - abstractSignatures.length) + resolved.indexInfos.length + // exclude `prototype` when writing a class expression as a type literal, as per
|
|
51392
|
+
// the logic in `createTypeNodesFromResolvedType`.
|
|
51393
|
+
(context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ ? countWhere(resolved.properties, (p) => !(p.flags & 4194304 /* Prototype */)) : length(resolved.properties));
|
|
51369
51394
|
if (typeElementCount) {
|
|
51370
51395
|
types.push(getResolvedTypeWithoutAbstractConstructSignatures(resolved));
|
|
51371
51396
|
}
|
|
@@ -52027,9 +52052,11 @@ function createTypeChecker(host) {
|
|
|
52027
52052
|
if (accessibleSymbolChain) {
|
|
52028
52053
|
return accessibleSymbolChain;
|
|
52029
52054
|
}
|
|
52030
|
-
if (
|
|
52031
|
-
|
|
52032
|
-
|
|
52055
|
+
if (
|
|
52056
|
+
// If this is the last part of outputting the symbol, always output. The cases apply only to parent symbols.
|
|
52057
|
+
endOfChain || // If a parent symbol is an anonymous type, don't write it.
|
|
52058
|
+
!(symbol2.flags & (2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */))
|
|
52059
|
+
) {
|
|
52033
52060
|
if (!endOfChain && !yieldModuleSymbol && !!forEach(symbol2.declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
|
|
52034
52061
|
return;
|
|
52035
52062
|
}
|
|
@@ -52651,7 +52678,8 @@ function createTypeChecker(host) {
|
|
|
52651
52678
|
}
|
|
52652
52679
|
if (isLiteralImportTypeNode(node)) {
|
|
52653
52680
|
const nodeSymbol = getNodeLinks(node).resolvedSymbol;
|
|
52654
|
-
if (isInJSDoc(node) && nodeSymbol &&
|
|
52681
|
+
if (isInJSDoc(node) && nodeSymbol && // The import type resolved using jsdoc fallback logic
|
|
52682
|
+
(!node.isTypeOf && !(nodeSymbol.flags & 788968 /* Type */) || // The import type had type arguments autofilled by js fallback logic
|
|
52655
52683
|
!(length(node.typeArguments) >= getMinTypeArgumentCount(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(nodeSymbol))))) {
|
|
52656
52684
|
return setOriginalNode(typeToTypeNodeHelper(getTypeFromTypeNode(node), context), node);
|
|
52657
52685
|
}
|
|
@@ -54168,8 +54196,10 @@ function createTypeChecker(host) {
|
|
|
54168
54196
|
}
|
|
54169
54197
|
}
|
|
54170
54198
|
function getNameOfSymbolAsWritten(symbol, context) {
|
|
54171
|
-
if (context && symbol.escapedName === "default" /* Default */ && !(context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */) &&
|
|
54172
|
-
!
|
|
54199
|
+
if (context && symbol.escapedName === "default" /* Default */ && !(context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */) && // If it's not the first part of an entity name, it must print as `default`
|
|
54200
|
+
(!(context.flags & 16777216 /* InInitialEntityName */) || // if the symbol is synthesized, it will only be referenced externally it must print as `default`
|
|
54201
|
+
!symbol.declarations || // if not in the same binding context (source file, module declaration), it must print as `default`
|
|
54202
|
+
context.enclosingDeclaration && findAncestor(symbol.declarations[0], isDefaultBindingContext) !== findAncestor(context.enclosingDeclaration, isDefaultBindingContext))) {
|
|
54173
54203
|
return "default";
|
|
54174
54204
|
}
|
|
54175
54205
|
if (symbol.declarations && symbol.declarations.length) {
|
|
@@ -55496,7 +55526,10 @@ function createTypeChecker(host) {
|
|
|
55496
55526
|
function getWriteTypeOfSymbol(symbol) {
|
|
55497
55527
|
const checkFlags = getCheckFlags(symbol);
|
|
55498
55528
|
if (symbol.flags & 4 /* Property */) {
|
|
55499
|
-
return checkFlags & 2 /* SyntheticProperty */ ? checkFlags & 65536 /* DeferredType */ ? getWriteTypeOfSymbolWithDeferredType(symbol) || getTypeOfSymbolWithDeferredType(symbol) :
|
|
55529
|
+
return checkFlags & 2 /* SyntheticProperty */ ? checkFlags & 65536 /* DeferredType */ ? getWriteTypeOfSymbolWithDeferredType(symbol) || getTypeOfSymbolWithDeferredType(symbol) : (
|
|
55530
|
+
// NOTE: cast to TransientSymbol should be safe because only TransientSymbols can have CheckFlags.SyntheticProperty
|
|
55531
|
+
symbol.links.writeType || symbol.links.type
|
|
55532
|
+
) : getTypeOfSymbol(symbol);
|
|
55500
55533
|
}
|
|
55501
55534
|
if (symbol.flags & 98304 /* Accessor */) {
|
|
55502
55535
|
return checkFlags & 1 /* Instantiated */ ? getWriteTypeOfInstantiatedSymbol(symbol) : getWriteTypeOfAccessors(symbol);
|
|
@@ -55621,7 +55654,17 @@ function createTypeChecker(host) {
|
|
|
55621
55654
|
}
|
|
55622
55655
|
}
|
|
55623
55656
|
function getOuterTypeParametersOfClassOrInterface(symbol) {
|
|
55624
|
-
|
|
55657
|
+
var _a2;
|
|
55658
|
+
const declaration = symbol.flags & 32 /* Class */ || symbol.flags & 16 /* Function */ ? symbol.valueDeclaration : (_a2 = symbol.declarations) == null ? void 0 : _a2.find((decl) => {
|
|
55659
|
+
if (decl.kind === 261 /* InterfaceDeclaration */) {
|
|
55660
|
+
return true;
|
|
55661
|
+
}
|
|
55662
|
+
if (decl.kind !== 257 /* VariableDeclaration */) {
|
|
55663
|
+
return false;
|
|
55664
|
+
}
|
|
55665
|
+
const initializer = decl.initializer;
|
|
55666
|
+
return !!initializer && (initializer.kind === 215 /* FunctionExpression */ || initializer.kind === 216 /* ArrowFunction */);
|
|
55667
|
+
});
|
|
55625
55668
|
Debug.assert(!!declaration, "Class was missing valueDeclaration -OR- non-class had no interface declarations");
|
|
55626
55669
|
return getOuterTypeParameters(declaration);
|
|
55627
55670
|
}
|
|
@@ -63903,7 +63946,11 @@ function createTypeChecker(host) {
|
|
|
63903
63946
|
if (variances === emptyArray) {
|
|
63904
63947
|
return 1 /* Unknown */;
|
|
63905
63948
|
}
|
|
63906
|
-
const
|
|
63949
|
+
const params = getSymbolLinks(source2.aliasSymbol).typeParameters;
|
|
63950
|
+
const minParams = getMinTypeArgumentCount(params);
|
|
63951
|
+
const sourceTypes = fillMissingTypeArguments(source2.aliasTypeArguments, params, minParams, isInJSFile(source2.aliasSymbol.valueDeclaration));
|
|
63952
|
+
const targetTypes = fillMissingTypeArguments(target2.aliasTypeArguments, params, minParams, isInJSFile(source2.aliasSymbol.valueDeclaration));
|
|
63953
|
+
const varianceResult = relateVariances(sourceTypes, targetTypes, variances, intersectionState);
|
|
63907
63954
|
if (varianceResult !== void 0) {
|
|
63908
63955
|
return varianceResult;
|
|
63909
63956
|
}
|
|
@@ -66360,7 +66407,11 @@ function createTypeChecker(host) {
|
|
|
66360
66407
|
}
|
|
66361
66408
|
if (source.aliasSymbol && source.aliasSymbol === target.aliasSymbol) {
|
|
66362
66409
|
if (source.aliasTypeArguments) {
|
|
66363
|
-
|
|
66410
|
+
const params = getSymbolLinks(source.aliasSymbol).typeParameters;
|
|
66411
|
+
const minParams = getMinTypeArgumentCount(params);
|
|
66412
|
+
const sourceTypes = fillMissingTypeArguments(source.aliasTypeArguments, params, minParams, isInJSFile(source.aliasSymbol.valueDeclaration));
|
|
66413
|
+
const targetTypes = fillMissingTypeArguments(target.aliasTypeArguments, params, minParams, isInJSFile(source.aliasSymbol.valueDeclaration));
|
|
66414
|
+
inferFromTypeArguments(sourceTypes, targetTypes, getAliasVariances(source.aliasSymbol));
|
|
66364
66415
|
}
|
|
66365
66416
|
return;
|
|
66366
66417
|
}
|
|
@@ -66966,7 +67017,7 @@ function createTypeChecker(host) {
|
|
|
66966
67017
|
if (signature) {
|
|
66967
67018
|
const inferredCovariantType = inference.candidates ? getCovariantInference(inference, signature) : void 0;
|
|
66968
67019
|
if (inference.contraCandidates) {
|
|
66969
|
-
const useCovariantType = inferredCovariantType && !(inferredCovariantType.flags & 131072 /* Never */) && some(inference.contraCandidates, (t) => isTypeSubtypeOf(inferredCovariantType, t)) && every(context.inferences, (other) => other
|
|
67020
|
+
const useCovariantType = inferredCovariantType && !(inferredCovariantType.flags & 131072 /* Never */) && some(inference.contraCandidates, (t) => isTypeSubtypeOf(inferredCovariantType, t)) && every(context.inferences, (other) => other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter || every(other.candidates, (t) => isTypeSubtypeOf(t, inferredCovariantType)));
|
|
66970
67021
|
inferredType = useCovariantType ? inferredCovariantType : getContravariantInference(inference);
|
|
66971
67022
|
} else if (inferredCovariantType) {
|
|
66972
67023
|
inferredType = inferredCovariantType;
|
|
@@ -68442,12 +68493,13 @@ function createTypeChecker(host) {
|
|
|
68442
68493
|
if (propName === void 0) {
|
|
68443
68494
|
return type;
|
|
68444
68495
|
}
|
|
68445
|
-
const
|
|
68496
|
+
const optionalChain = isOptionalChain(access);
|
|
68497
|
+
const removeNullable = strictNullChecks && (optionalChain || isNonNullAccess(access)) && maybeTypeOfKind(type, 98304 /* Nullable */);
|
|
68446
68498
|
let propType = getTypeOfPropertyOfType(removeNullable ? getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type, propName);
|
|
68447
68499
|
if (!propType) {
|
|
68448
68500
|
return type;
|
|
68449
68501
|
}
|
|
68450
|
-
propType = removeNullable ? getOptionalType(propType) : propType;
|
|
68502
|
+
propType = removeNullable && optionalChain ? getOptionalType(propType) : propType;
|
|
68451
68503
|
const narrowedPropType = narrowType2(propType);
|
|
68452
68504
|
return filterType(type, (t) => {
|
|
68453
68505
|
const discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
|
|
@@ -68766,18 +68818,20 @@ function createTypeChecker(host) {
|
|
|
68766
68818
|
return narrowTypeByTypeFacts(type, nonPrimitiveType, 128 /* TypeofEQHostObject */);
|
|
68767
68819
|
}
|
|
68768
68820
|
function narrowTypeByTypeFacts(type, impliedType, facts) {
|
|
68769
|
-
return mapType(type, (t) =>
|
|
68770
|
-
|
|
68771
|
-
|
|
68772
|
-
|
|
68773
|
-
|
|
68774
|
-
|
|
68775
|
-
|
|
68776
|
-
|
|
68777
|
-
|
|
68778
|
-
|
|
68779
|
-
|
|
68780
|
-
|
|
68821
|
+
return mapType(type, (t) => (
|
|
68822
|
+
// We first check if a constituent is a subtype of the implied type. If so, we either keep or eliminate
|
|
68823
|
+
// the constituent based on its type facts. We use the strict subtype relation because it treats `object`
|
|
68824
|
+
// as a subtype of `{}`, and we need the type facts check because function types are subtypes of `object`,
|
|
68825
|
+
// but are classified as "function" according to `typeof`.
|
|
68826
|
+
isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? getTypeFacts(t) & facts ? t : neverType : (
|
|
68827
|
+
// We next check if the consituent is a supertype of the implied type. If so, we substitute the implied
|
|
68828
|
+
// type. This handles top types like `unknown` and `{}`, and supertypes like `{ toString(): string }`.
|
|
68829
|
+
isTypeSubtypeOf(impliedType, t) ? impliedType : (
|
|
68830
|
+
// Neither the constituent nor the implied type is a subtype of the other, however their domains may still
|
|
68831
|
+
// overlap. For example, an unconstrained type parameter and type `string`. If the type facts indicate
|
|
68832
|
+
// possible overlap, we form an intersection. Otherwise, we eliminate the constituent.
|
|
68833
|
+
getTypeFacts(t) & facts ? getIntersectionType([t, impliedType]) : neverType
|
|
68834
|
+
)
|
|
68781
68835
|
)
|
|
68782
68836
|
));
|
|
68783
68837
|
}
|
|
@@ -76348,7 +76402,8 @@ function createTypeChecker(host) {
|
|
|
76348
76402
|
}
|
|
76349
76403
|
}
|
|
76350
76404
|
function isIndirectCall(node) {
|
|
76351
|
-
return node.parent.kind === 214 /* ParenthesizedExpression */ && isNumericLiteral(node.left) && node.left.text === "0" && (isCallExpression(node.parent.parent) && node.parent.parent.expression === node.parent || node.parent.parent.kind === 212 /* TaggedTemplateExpression */) &&
|
|
76405
|
+
return node.parent.kind === 214 /* ParenthesizedExpression */ && isNumericLiteral(node.left) && node.left.text === "0" && (isCallExpression(node.parent.parent) && node.parent.parent.expression === node.parent || node.parent.parent.kind === 212 /* TaggedTemplateExpression */) && // special-case for "eval" because it's the only non-access case where an indirect call actually affects behavior.
|
|
76406
|
+
(isAccessExpression(node.right) || isIdentifier(node.right) && node.right.escapedText === "eval");
|
|
76352
76407
|
}
|
|
76353
76408
|
function checkForDisallowedESSymbolOperand(operator2) {
|
|
76354
76409
|
const offendingSymbolOperand = maybeTypeOfKindConsideringBaseConstraint(leftType, 12288 /* ESSymbolLike */) ? left : maybeTypeOfKindConsideringBaseConstraint(rightType, 12288 /* ESSymbolLike */) ? right : void 0;
|
|
@@ -83433,7 +83488,12 @@ function createTypeChecker(host) {
|
|
|
83433
83488
|
return false;
|
|
83434
83489
|
const symbol = getSymbolOfDeclaration(node);
|
|
83435
83490
|
const signaturesOfSymbol = getSignaturesOfSymbol(symbol);
|
|
83436
|
-
return signaturesOfSymbol.length > 1 ||
|
|
83491
|
+
return signaturesOfSymbol.length > 1 || // If there is single signature for the symbol, it is overload if that signature isn't coming from the node
|
|
83492
|
+
// e.g.: function foo(a: string): string;
|
|
83493
|
+
// function foo(a: any) { // This is implementation of the overloads
|
|
83494
|
+
// return a;
|
|
83495
|
+
// }
|
|
83496
|
+
signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node;
|
|
83437
83497
|
}
|
|
83438
83498
|
return false;
|
|
83439
83499
|
}
|
|
@@ -105048,6 +105108,9 @@ function createGetSymbolAccessibilityDiagnosticForNode(node) {
|
|
|
105048
105108
|
case 259 /* FunctionDeclaration */:
|
|
105049
105109
|
diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;
|
|
105050
105110
|
break;
|
|
105111
|
+
case 192 /* InferType */:
|
|
105112
|
+
diagnosticMessage = Diagnostics.Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1;
|
|
105113
|
+
break;
|
|
105051
105114
|
case 262 /* TypeAliasDeclaration */:
|
|
105052
105115
|
diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1;
|
|
105053
105116
|
break;
|
|
@@ -114085,7 +114148,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
114085
114148
|
const oldSourceFiles = oldProgram.getSourceFiles();
|
|
114086
114149
|
for (const oldSourceFile of oldSourceFiles) {
|
|
114087
114150
|
const newFile = getSourceFileByPath(oldSourceFile.resolvedPath);
|
|
114088
|
-
if (shouldCreateNewSourceFile || !newFile || newFile.impliedNodeFormat !== oldSourceFile.impliedNodeFormat ||
|
|
114151
|
+
if (shouldCreateNewSourceFile || !newFile || newFile.impliedNodeFormat !== oldSourceFile.impliedNodeFormat || // old file wasn't redirect but new file is
|
|
114152
|
+
oldSourceFile.resolvedPath === oldSourceFile.path && newFile.resolvedPath !== oldSourceFile.path) {
|
|
114089
114153
|
host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions(), !!getSourceFileByPath(oldSourceFile.path));
|
|
114090
114154
|
}
|
|
114091
114155
|
}
|
|
@@ -118813,7 +118877,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118813
118877
|
const name = loader.nameAndMode.getName(entry);
|
|
118814
118878
|
const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
|
|
118815
118879
|
let resolution = resolutionsInFile.get(name, mode);
|
|
118816
|
-
if (!seenNamesInFile.has(name, mode) && unmatchedRedirects || !resolution || resolution.isInvalidated ||
|
|
118880
|
+
if (!seenNamesInFile.has(name, mode) && unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
|
|
118881
|
+
hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution)) {
|
|
118817
118882
|
const existingResolution = resolution;
|
|
118818
118883
|
resolution = loader.resolve(name, mode);
|
|
118819
118884
|
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
@@ -124875,6 +124940,7 @@ __export(ts_exports3, {
|
|
|
124875
124940
|
isNonContextualKeyword: () => isNonContextualKeyword,
|
|
124876
124941
|
isNonGlobalAmbientModule: () => isNonGlobalAmbientModule,
|
|
124877
124942
|
isNonGlobalDeclaration: () => isNonGlobalDeclaration,
|
|
124943
|
+
isNonNullAccess: () => isNonNullAccess,
|
|
124878
124944
|
isNonNullChain: () => isNonNullChain,
|
|
124879
124945
|
isNonNullExpression: () => isNonNullExpression,
|
|
124880
124946
|
isNonStaticMethodOrAccessorWithPrivateName: () => isNonStaticMethodOrAccessorWithPrivateName,
|
|
@@ -126945,7 +127011,11 @@ function findNextToken(previousToken, parent2, sourceFile) {
|
|
|
126945
127011
|
return n;
|
|
126946
127012
|
}
|
|
126947
127013
|
return firstDefined(n.getChildren(sourceFile), (child) => {
|
|
126948
|
-
const shouldDiveInChildNode =
|
|
127014
|
+
const shouldDiveInChildNode = (
|
|
127015
|
+
// previous token is enclosed somewhere in the child
|
|
127016
|
+
child.pos <= previousToken.pos && child.end > previousToken.end || // previous token ends exactly at the beginning of child
|
|
127017
|
+
child.pos === previousToken.end
|
|
127018
|
+
);
|
|
126949
127019
|
return shouldDiveInChildNode && nodeHasTokens(child, sourceFile) ? find2(child) : void 0;
|
|
126950
127020
|
});
|
|
126951
127021
|
}
|
|
@@ -140404,15 +140474,17 @@ function getBestFix(fixes, sourceFile, program, packageJsonImportFilter, host) {
|
|
|
140404
140474
|
return fixes[0];
|
|
140405
140475
|
}
|
|
140406
140476
|
return fixes.reduce(
|
|
140407
|
-
(best, fix) =>
|
|
140408
|
-
|
|
140409
|
-
|
|
140410
|
-
|
|
140411
|
-
|
|
140412
|
-
|
|
140413
|
-
|
|
140414
|
-
|
|
140415
|
-
|
|
140477
|
+
(best, fix) => (
|
|
140478
|
+
// Takes true branch of conditional if `fix` is better than `best`
|
|
140479
|
+
compareModuleSpecifiers(
|
|
140480
|
+
fix,
|
|
140481
|
+
best,
|
|
140482
|
+
sourceFile,
|
|
140483
|
+
program,
|
|
140484
|
+
packageJsonImportFilter.allowsImportingSpecifier,
|
|
140485
|
+
(fileName) => toPath(fileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host))
|
|
140486
|
+
) === -1 /* LessThan */ ? fix : best
|
|
140487
|
+
)
|
|
140416
140488
|
);
|
|
140417
140489
|
}
|
|
140418
140490
|
function compareModuleSpecifiers(a, b, importingFile, program, allowsImportingSpecifier, toPath3) {
|
|
@@ -149400,7 +149472,10 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
149400
149472
|
return containingNodeKind === 257 /* VariableDeclaration */ || isVariableDeclarationListButNotTypeArgument(contextToken2) || containingNodeKind === 240 /* VariableStatement */ || containingNodeKind === 263 /* EnumDeclaration */ || // enum a { foo, |
|
|
149401
149473
|
isFunctionLikeButNotConstructor(containingNodeKind) || containingNodeKind === 261 /* InterfaceDeclaration */ || // interface A<T, |
|
|
149402
149474
|
containingNodeKind === 204 /* ArrayBindingPattern */ || // var [x, y|
|
|
149403
|
-
containingNodeKind === 262 /* TypeAliasDeclaration */ ||
|
|
149475
|
+
containingNodeKind === 262 /* TypeAliasDeclaration */ || // type Map, K, |
|
|
149476
|
+
// class A<T, |
|
|
149477
|
+
// var C = class D<T, |
|
|
149478
|
+
isClassLike(parent2) && !!parent2.typeParameters && parent2.typeParameters.end >= contextToken2.pos;
|
|
149404
149479
|
case 24 /* DotToken */:
|
|
149405
149480
|
return containingNodeKind === 204 /* ArrayBindingPattern */;
|
|
149406
149481
|
case 58 /* ColonToken */:
|
|
@@ -151345,8 +151420,10 @@ function getDirectImportsMap(sourceFiles, checker, cancellationToken) {
|
|
|
151345
151420
|
return map2;
|
|
151346
151421
|
}
|
|
151347
151422
|
function forEachPossibleImportOrExportStatement(sourceFileLike, action) {
|
|
151348
|
-
return forEach(sourceFileLike.kind === 308 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, (statement) =>
|
|
151349
|
-
|
|
151423
|
+
return forEach(sourceFileLike.kind === 308 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, (statement) => (
|
|
151424
|
+
// TODO: GH#18217
|
|
151425
|
+
action(statement) || isAmbientModuleDeclaration(statement) && forEach(statement.body && statement.body.statements, action)
|
|
151426
|
+
));
|
|
151350
151427
|
}
|
|
151351
151428
|
function forEachImport(sourceFile, action) {
|
|
151352
151429
|
if (sourceFile.externalModuleIndicator || sourceFile.imports !== void 0) {
|
|
@@ -151614,7 +151691,9 @@ function getContextNodeForNodeEntry(node) {
|
|
|
151614
151691
|
return propertyName ? getContextNode(propertyName.parent) : void 0;
|
|
151615
151692
|
}
|
|
151616
151693
|
if (node.parent.name === node || // node is name of declaration, use parent
|
|
151617
|
-
isConstructorDeclaration(node.parent) || isExportAssignment(node.parent) ||
|
|
151694
|
+
isConstructorDeclaration(node.parent) || isExportAssignment(node.parent) || // Property name of the import export specifier or binding pattern, use parent
|
|
151695
|
+
(isImportOrExportSpecifier(node.parent) || isBindingElement(node.parent)) && node.parent.propertyName === node || // Is default export
|
|
151696
|
+
node.kind === 88 /* DefaultKeyword */ && hasSyntacticModifier(node.parent, 1025 /* ExportDefault */)) {
|
|
151618
151697
|
return getContextNode(node.parent);
|
|
151619
151698
|
}
|
|
151620
151699
|
return void 0;
|
|
@@ -151674,11 +151753,13 @@ function findReferencedSymbols(program, cancellationToken, sourceFiles, sourceFi
|
|
|
151674
151753
|
const checker = program.getTypeChecker();
|
|
151675
151754
|
const adjustedNode = Core.getAdjustedNode(node, options);
|
|
151676
151755
|
const symbol = isDefinitionForReference(adjustedNode) ? checker.getSymbolAtLocation(adjustedNode) : void 0;
|
|
151677
|
-
return !referencedSymbols || !referencedSymbols.length ? void 0 : mapDefined(referencedSymbols, ({ definition, references }) =>
|
|
151678
|
-
|
|
151679
|
-
definition
|
|
151680
|
-
|
|
151681
|
-
|
|
151756
|
+
return !referencedSymbols || !referencedSymbols.length ? void 0 : mapDefined(referencedSymbols, ({ definition, references }) => (
|
|
151757
|
+
// Only include referenced symbols that have a valid definition.
|
|
151758
|
+
definition && {
|
|
151759
|
+
definition: checker.runWithCancellationToken(cancellationToken, (checker2) => definitionToReferencedSymbolDefinitionInfo(definition, checker2, node)),
|
|
151760
|
+
references: references.map((r) => toReferencedSymbolEntry(r, symbol))
|
|
151761
|
+
}
|
|
151762
|
+
));
|
|
151682
151763
|
}
|
|
151683
151764
|
function isDefinitionForReference(node) {
|
|
151684
151765
|
return node.kind === 88 /* DefaultKeyword */ || !!getDeclarationFromName(node) || isLiteralComputedPropertyDeclarationName(node) || node.kind === 135 /* ConstructorKeyword */ && isConstructorDeclaration(node.parent);
|
|
@@ -152688,8 +152769,10 @@ var Core;
|
|
|
152688
152769
|
function getLabelReferencesInNode(container, targetLabel) {
|
|
152689
152770
|
const sourceFile = container.getSourceFile();
|
|
152690
152771
|
const labelName = targetLabel.text;
|
|
152691
|
-
const references = mapDefined(getPossibleSymbolReferenceNodes(sourceFile, labelName, container), (node) =>
|
|
152692
|
-
|
|
152772
|
+
const references = mapDefined(getPossibleSymbolReferenceNodes(sourceFile, labelName, container), (node) => (
|
|
152773
|
+
// Only pick labels that are either the target label, or have a target that is the target label
|
|
152774
|
+
node === targetLabel || isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel ? nodeEntry(node) : void 0
|
|
152775
|
+
));
|
|
152693
152776
|
return [{ definition: { type: 1 /* Label */, node: targetLabel }, references }];
|
|
152694
152777
|
}
|
|
152695
152778
|
function isValidReferencePosition(node, searchSymbolName) {
|
|
@@ -161517,7 +161600,8 @@ function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, so
|
|
|
161517
161600
|
hasAddedSymbolInfo = true;
|
|
161518
161601
|
hasMultipleSignatures = allSignatures.length > 1;
|
|
161519
161602
|
}
|
|
161520
|
-
} else if (isNameOfFunctionDeclaration(location) && !(symbolFlags & 98304 /* Accessor */) ||
|
|
161603
|
+
} else if (isNameOfFunctionDeclaration(location) && !(symbolFlags & 98304 /* Accessor */) || // name of function declaration
|
|
161604
|
+
location.kind === 135 /* ConstructorKeyword */ && location.parent.kind === 173 /* Constructor */) {
|
|
161521
161605
|
const functionDeclaration = location.parent;
|
|
161522
161606
|
const locationIsSymbolDeclaration = symbol.declarations && find(symbol.declarations, (declaration) => declaration === (location.kind === 135 /* ConstructorKeyword */ ? functionDeclaration.parent : functionDeclaration));
|
|
161523
161607
|
if (locationIsSymbolDeclaration) {
|
|
@@ -163824,18 +163908,12 @@ function getAllRules() {
|
|
|
163824
163908
|
rule("NoSpaceBetweenCloseParenAndAngularBracket", 21 /* CloseParenToken */, 29 /* LessThanToken */, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 16 /* DeleteSpace */),
|
|
163825
163909
|
rule("NoSpaceAfterOpenAngularBracket", 29 /* LessThanToken */, anyToken, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 16 /* DeleteSpace */),
|
|
163826
163910
|
rule("NoSpaceBeforeCloseAngularBracket", anyToken, 31 /* GreaterThanToken */, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 16 /* DeleteSpace */),
|
|
163827
|
-
rule(
|
|
163828
|
-
|
|
163829
|
-
|
|
163830
|
-
|
|
163831
|
-
|
|
163832
|
-
|
|
163833
|
-
isTypeArgumentOrParameterOrAssertionContext,
|
|
163834
|
-
isNotFunctionDeclContext
|
|
163835
|
-
/*To prevent an interference with the SpaceBeforeOpenParenInFuncDecl rule*/
|
|
163836
|
-
],
|
|
163837
|
-
16 /* DeleteSpace */
|
|
163838
|
-
),
|
|
163911
|
+
rule("NoSpaceAfterCloseAngularBracket", 31 /* GreaterThanToken */, [20 /* OpenParenToken */, 22 /* OpenBracketToken */, 31 /* GreaterThanToken */, 27 /* CommaToken */], [
|
|
163912
|
+
isNonJsxSameLineTokenContext,
|
|
163913
|
+
isTypeArgumentOrParameterOrAssertionContext,
|
|
163914
|
+
isNotFunctionDeclContext,
|
|
163915
|
+
isNonTypeAssertionContext
|
|
163916
|
+
], 16 /* DeleteSpace */),
|
|
163839
163917
|
// decorators
|
|
163840
163918
|
rule("SpaceBeforeAt", [21 /* CloseParenToken */, 79 /* Identifier */], 59 /* AtToken */, [isNonJsxSameLineTokenContext], 4 /* InsertSpace */),
|
|
163841
163919
|
rule("NoSpaceAfterAt", 59 /* AtToken */, anyToken, [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */),
|
|
@@ -164268,6 +164346,9 @@ function isTypeArgumentOrParameterOrAssertionContext(context) {
|
|
|
164268
164346
|
function isTypeAssertionContext(context) {
|
|
164269
164347
|
return context.contextNode.kind === 213 /* TypeAssertionExpression */;
|
|
164270
164348
|
}
|
|
164349
|
+
function isNonTypeAssertionContext(context) {
|
|
164350
|
+
return !isTypeAssertionContext(context);
|
|
164351
|
+
}
|
|
164271
164352
|
function isVoidOpContext(context) {
|
|
164272
164353
|
return context.currentTokenSpan.kind === 114 /* VoidKeyword */ && context.currentTokenParent.kind === 219 /* VoidExpression */;
|
|
164273
164354
|
}
|
|
@@ -172346,7 +172427,8 @@ var _ProjectService = class {
|
|
|
172346
172427
|
});
|
|
172347
172428
|
}
|
|
172348
172429
|
getOrCreateInferredProjectForProjectRootPathIfEnabled(info, projectRootPath) {
|
|
172349
|
-
if (!this.useInferredProjectPerProjectRoot ||
|
|
172430
|
+
if (!this.useInferredProjectPerProjectRoot || // Its a dynamic info opened without project root
|
|
172431
|
+
info.isDynamic && projectRootPath === void 0) {
|
|
172350
172432
|
return void 0;
|
|
172351
172433
|
}
|
|
172352
172434
|
if (projectRootPath) {
|
|
@@ -180453,6 +180535,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
180453
180535
|
isNonContextualKeyword,
|
|
180454
180536
|
isNonGlobalAmbientModule,
|
|
180455
180537
|
isNonGlobalDeclaration,
|
|
180538
|
+
isNonNullAccess,
|
|
180456
180539
|
isNonNullChain,
|
|
180457
180540
|
isNonNullExpression,
|
|
180458
180541
|
isNonStaticMethodOrAccessorWithPrivateName,
|