typescript 4.8.0-dev.20220727 → 4.8.0-dev.20220730
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/cs/diagnosticMessages.generated.json +1 -0
- package/lib/de/diagnosticMessages.generated.json +1 -0
- package/lib/es/diagnosticMessages.generated.json +1 -0
- package/lib/fr/diagnosticMessages.generated.json +1 -0
- package/lib/it/diagnosticMessages.generated.json +1 -0
- package/lib/ja/diagnosticMessages.generated.json +1 -0
- package/lib/ko/diagnosticMessages.generated.json +1 -0
- package/lib/pl/diagnosticMessages.generated.json +1 -0
- package/lib/pt-br/diagnosticMessages.generated.json +1 -0
- package/lib/ru/diagnosticMessages.generated.json +1 -0
- package/lib/tr/diagnosticMessages.generated.json +1 -0
- package/lib/tsc.js +124 -75
- package/lib/tsserver.js +180 -107
- package/lib/tsserverlibrary.js +180 -107
- package/lib/typescript.js +179 -106
- package/lib/typescriptServices.js +179 -106
- package/lib/typingsInstaller.js +152 -102
- package/lib/zh-cn/diagnosticMessages.generated.json +1 -0
- package/lib/zh-tw/diagnosticMessages.generated.json +1 -0
- package/package.json +4 -3
package/lib/tsserverlibrary.js
CHANGED
|
@@ -303,7 +303,7 @@ var ts;
|
|
|
303
303
|
// The following is baselined as a literal template type without intervention
|
|
304
304
|
/** The version of the TypeScript compiler release */
|
|
305
305
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
306
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
306
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220730";
|
|
307
307
|
/* @internal */
|
|
308
308
|
var Comparison;
|
|
309
309
|
(function (Comparison) {
|
|
@@ -1904,6 +1904,10 @@ var ts;
|
|
|
1904
1904
|
/** Does nothing. */
|
|
1905
1905
|
function noop(_) { }
|
|
1906
1906
|
ts.noop = noop;
|
|
1907
|
+
ts.noopPush = {
|
|
1908
|
+
push: noop,
|
|
1909
|
+
length: 0
|
|
1910
|
+
};
|
|
1907
1911
|
/** Do nothing and return false */
|
|
1908
1912
|
function returnFalse() {
|
|
1909
1913
|
return false;
|
|
@@ -5912,10 +5916,8 @@ var ts;
|
|
|
5912
5916
|
TransformFlags[TransformFlags["ContainsPossibleTopLevelAwait"] = 67108864] = "ContainsPossibleTopLevelAwait";
|
|
5913
5917
|
TransformFlags[TransformFlags["ContainsLexicalSuper"] = 134217728] = "ContainsLexicalSuper";
|
|
5914
5918
|
TransformFlags[TransformFlags["ContainsUpdateExpressionForIdentifier"] = 268435456] = "ContainsUpdateExpressionForIdentifier";
|
|
5915
|
-
|
|
5916
|
-
|
|
5917
|
-
// It is a good reminder of how much room we have left
|
|
5918
|
-
TransformFlags[TransformFlags["HasComputedFlags"] = 536870912] = "HasComputedFlags";
|
|
5919
|
+
TransformFlags[TransformFlags["ContainsPrivateIdentifierInExpression"] = 536870912] = "ContainsPrivateIdentifierInExpression";
|
|
5920
|
+
TransformFlags[TransformFlags["HasComputedFlags"] = -2147483648] = "HasComputedFlags";
|
|
5919
5921
|
// Assertions
|
|
5920
5922
|
// - Bitmasks that are used to assert facts about the syntax of a node and its subtree.
|
|
5921
5923
|
TransformFlags[TransformFlags["AssertTypeScript"] = 1] = "AssertTypeScript";
|
|
@@ -5934,23 +5936,23 @@ var ts;
|
|
|
5934
5936
|
// Scope Exclusions
|
|
5935
5937
|
// - Bitmasks that exclude flags from propagating out of a specific context
|
|
5936
5938
|
// into the subtree flags of their container.
|
|
5937
|
-
TransformFlags[TransformFlags["OuterExpressionExcludes"] =
|
|
5938
|
-
TransformFlags[TransformFlags["PropertyAccessExcludes"] =
|
|
5939
|
-
TransformFlags[TransformFlags["NodeExcludes"] =
|
|
5940
|
-
TransformFlags[TransformFlags["ArrowFunctionExcludes"] =
|
|
5941
|
-
TransformFlags[TransformFlags["FunctionExcludes"] =
|
|
5942
|
-
TransformFlags[TransformFlags["ConstructorExcludes"] =
|
|
5943
|
-
TransformFlags[TransformFlags["MethodOrAccessorExcludes"] =
|
|
5944
|
-
TransformFlags[TransformFlags["PropertyExcludes"] =
|
|
5945
|
-
TransformFlags[TransformFlags["ClassExcludes"] =
|
|
5946
|
-
TransformFlags[TransformFlags["ModuleExcludes"] =
|
|
5939
|
+
TransformFlags[TransformFlags["OuterExpressionExcludes"] = -2147483648] = "OuterExpressionExcludes";
|
|
5940
|
+
TransformFlags[TransformFlags["PropertyAccessExcludes"] = -2147483648] = "PropertyAccessExcludes";
|
|
5941
|
+
TransformFlags[TransformFlags["NodeExcludes"] = -2147483648] = "NodeExcludes";
|
|
5942
|
+
TransformFlags[TransformFlags["ArrowFunctionExcludes"] = -2072174592] = "ArrowFunctionExcludes";
|
|
5943
|
+
TransformFlags[TransformFlags["FunctionExcludes"] = -1937940480] = "FunctionExcludes";
|
|
5944
|
+
TransformFlags[TransformFlags["ConstructorExcludes"] = -1937948672] = "ConstructorExcludes";
|
|
5945
|
+
TransformFlags[TransformFlags["MethodOrAccessorExcludes"] = -2005057536] = "MethodOrAccessorExcludes";
|
|
5946
|
+
TransformFlags[TransformFlags["PropertyExcludes"] = -2013249536] = "PropertyExcludes";
|
|
5947
|
+
TransformFlags[TransformFlags["ClassExcludes"] = -2147344384] = "ClassExcludes";
|
|
5948
|
+
TransformFlags[TransformFlags["ModuleExcludes"] = -1941676032] = "ModuleExcludes";
|
|
5947
5949
|
TransformFlags[TransformFlags["TypeExcludes"] = -2] = "TypeExcludes";
|
|
5948
|
-
TransformFlags[TransformFlags["ObjectLiteralExcludes"] =
|
|
5949
|
-
TransformFlags[TransformFlags["ArrayLiteralOrCallOrNewExcludes"] =
|
|
5950
|
-
TransformFlags[TransformFlags["VariableDeclarationListExcludes"] =
|
|
5951
|
-
TransformFlags[TransformFlags["ParameterExcludes"] =
|
|
5952
|
-
TransformFlags[TransformFlags["CatchClauseExcludes"] =
|
|
5953
|
-
TransformFlags[TransformFlags["BindingPatternExcludes"] =
|
|
5950
|
+
TransformFlags[TransformFlags["ObjectLiteralExcludes"] = -2147278848] = "ObjectLiteralExcludes";
|
|
5951
|
+
TransformFlags[TransformFlags["ArrayLiteralOrCallOrNewExcludes"] = -2147450880] = "ArrayLiteralOrCallOrNewExcludes";
|
|
5952
|
+
TransformFlags[TransformFlags["VariableDeclarationListExcludes"] = -2146893824] = "VariableDeclarationListExcludes";
|
|
5953
|
+
TransformFlags[TransformFlags["ParameterExcludes"] = -2147483648] = "ParameterExcludes";
|
|
5954
|
+
TransformFlags[TransformFlags["CatchClauseExcludes"] = -2147418112] = "CatchClauseExcludes";
|
|
5955
|
+
TransformFlags[TransformFlags["BindingPatternExcludes"] = -2147450880] = "BindingPatternExcludes";
|
|
5954
5956
|
TransformFlags[TransformFlags["ContainsLexicalThisOrSuper"] = 134234112] = "ContainsLexicalThisOrSuper";
|
|
5955
5957
|
// Propagating flags
|
|
5956
5958
|
// - Bitmasks for flags that should propagate from a child
|
|
@@ -8985,6 +8987,7 @@ var ts;
|
|
|
8985
8987
|
Cannot_create_an_instance_of_an_abstract_class: diag(2511, ts.DiagnosticCategory.Error, "Cannot_create_an_instance_of_an_abstract_class_2511", "Cannot create an instance of an abstract class."),
|
|
8986
8988
|
Overload_signatures_must_all_be_abstract_or_non_abstract: diag(2512, ts.DiagnosticCategory.Error, "Overload_signatures_must_all_be_abstract_or_non_abstract_2512", "Overload signatures must all be abstract or non-abstract."),
|
|
8987
8989
|
Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression: diag(2513, ts.DiagnosticCategory.Error, "Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression_2513", "Abstract method '{0}' in class '{1}' cannot be accessed via super expression."),
|
|
8990
|
+
A_tuple_type_cannot_be_indexed_with_a_negative_value: diag(2514, ts.DiagnosticCategory.Error, "A_tuple_type_cannot_be_indexed_with_a_negative_value_2514", "A tuple type cannot be indexed with a negative value."),
|
|
8988
8991
|
Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: diag(2515, ts.DiagnosticCategory.Error, "Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515", "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'."),
|
|
8989
8992
|
All_declarations_of_an_abstract_method_must_be_consecutive: diag(2516, ts.DiagnosticCategory.Error, "All_declarations_of_an_abstract_method_must_be_consecutive_2516", "All declarations of an abstract method must be consecutive."),
|
|
8990
8993
|
Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: diag(2517, ts.DiagnosticCategory.Error, "Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517", "Cannot assign an abstract constructor type to a non-abstract constructor type."),
|
|
@@ -24288,7 +24291,7 @@ var ts;
|
|
|
24288
24291
|
propagateChildFlags(node.expression) |
|
|
24289
24292
|
(ts.isIdentifier(node.name) ?
|
|
24290
24293
|
propagateIdentifierNameFlags(node.name) :
|
|
24291
|
-
propagateChildFlags(node.name));
|
|
24294
|
+
propagateChildFlags(node.name) | 536870912 /* ContainsPrivateIdentifierInExpression */);
|
|
24292
24295
|
if (ts.isSuperKeyword(expression)) {
|
|
24293
24296
|
// super method calls require a lexical 'this'
|
|
24294
24297
|
// super method calls require 'super' hoisting in ES2017 and ES2018 async functions and async generators
|
|
@@ -24321,7 +24324,7 @@ var ts;
|
|
|
24321
24324
|
propagateChildFlags(node.questionDotToken) |
|
|
24322
24325
|
(ts.isIdentifier(node.name) ?
|
|
24323
24326
|
propagateIdentifierNameFlags(node.name) :
|
|
24324
|
-
propagateChildFlags(node.name));
|
|
24327
|
+
propagateChildFlags(node.name) | 536870912 /* ContainsPrivateIdentifierInExpression */);
|
|
24325
24328
|
return node;
|
|
24326
24329
|
}
|
|
24327
24330
|
// @api
|
|
@@ -24725,6 +24728,9 @@ var ts;
|
|
|
24725
24728
|
else if (ts.isLogicalOrCoalescingAssignmentOperator(operatorKind)) {
|
|
24726
24729
|
node.transformFlags |= 16 /* ContainsES2021 */;
|
|
24727
24730
|
}
|
|
24731
|
+
if (operatorKind === 101 /* InKeyword */ && ts.isPrivateIdentifier(node.left)) {
|
|
24732
|
+
node.transformFlags |= 536870912 /* ContainsPrivateIdentifierInExpression */;
|
|
24733
|
+
}
|
|
24728
24734
|
return node;
|
|
24729
24735
|
}
|
|
24730
24736
|
function propagateAssignmentPatternFlags(node) {
|
|
@@ -27679,29 +27685,29 @@ var ts;
|
|
|
27679
27685
|
case 208 /* CallExpression */:
|
|
27680
27686
|
case 209 /* NewExpression */:
|
|
27681
27687
|
case 204 /* ArrayLiteralExpression */:
|
|
27682
|
-
return
|
|
27688
|
+
return -2147450880 /* ArrayLiteralOrCallOrNewExcludes */;
|
|
27683
27689
|
case 261 /* ModuleDeclaration */:
|
|
27684
|
-
return
|
|
27690
|
+
return -1941676032 /* ModuleExcludes */;
|
|
27685
27691
|
case 164 /* Parameter */:
|
|
27686
|
-
return
|
|
27692
|
+
return -2147483648 /* ParameterExcludes */;
|
|
27687
27693
|
case 214 /* ArrowFunction */:
|
|
27688
|
-
return
|
|
27694
|
+
return -2072174592 /* ArrowFunctionExcludes */;
|
|
27689
27695
|
case 213 /* FunctionExpression */:
|
|
27690
27696
|
case 256 /* FunctionDeclaration */:
|
|
27691
|
-
return
|
|
27697
|
+
return -1937940480 /* FunctionExcludes */;
|
|
27692
27698
|
case 255 /* VariableDeclarationList */:
|
|
27693
|
-
return
|
|
27699
|
+
return -2146893824 /* VariableDeclarationListExcludes */;
|
|
27694
27700
|
case 257 /* ClassDeclaration */:
|
|
27695
27701
|
case 226 /* ClassExpression */:
|
|
27696
|
-
return
|
|
27702
|
+
return -2147344384 /* ClassExcludes */;
|
|
27697
27703
|
case 171 /* Constructor */:
|
|
27698
|
-
return
|
|
27704
|
+
return -1937948672 /* ConstructorExcludes */;
|
|
27699
27705
|
case 167 /* PropertyDeclaration */:
|
|
27700
|
-
return
|
|
27706
|
+
return -2013249536 /* PropertyExcludes */;
|
|
27701
27707
|
case 169 /* MethodDeclaration */:
|
|
27702
27708
|
case 172 /* GetAccessor */:
|
|
27703
27709
|
case 173 /* SetAccessor */:
|
|
27704
|
-
return
|
|
27710
|
+
return -2005057536 /* MethodOrAccessorExcludes */;
|
|
27705
27711
|
case 130 /* AnyKeyword */:
|
|
27706
27712
|
case 147 /* NumberKeyword */:
|
|
27707
27713
|
case 158 /* BigIntKeyword */:
|
|
@@ -27721,23 +27727,23 @@ var ts;
|
|
|
27721
27727
|
case 259 /* TypeAliasDeclaration */:
|
|
27722
27728
|
return -2 /* TypeExcludes */;
|
|
27723
27729
|
case 205 /* ObjectLiteralExpression */:
|
|
27724
|
-
return
|
|
27730
|
+
return -2147278848 /* ObjectLiteralExcludes */;
|
|
27725
27731
|
case 292 /* CatchClause */:
|
|
27726
|
-
return
|
|
27732
|
+
return -2147418112 /* CatchClauseExcludes */;
|
|
27727
27733
|
case 201 /* ObjectBindingPattern */:
|
|
27728
27734
|
case 202 /* ArrayBindingPattern */:
|
|
27729
|
-
return
|
|
27735
|
+
return -2147450880 /* BindingPatternExcludes */;
|
|
27730
27736
|
case 211 /* TypeAssertionExpression */:
|
|
27731
27737
|
case 229 /* AsExpression */:
|
|
27732
27738
|
case 350 /* PartiallyEmittedExpression */:
|
|
27733
27739
|
case 212 /* ParenthesizedExpression */:
|
|
27734
27740
|
case 106 /* SuperKeyword */:
|
|
27735
|
-
return
|
|
27741
|
+
return -2147483648 /* OuterExpressionExcludes */;
|
|
27736
27742
|
case 206 /* PropertyAccessExpression */:
|
|
27737
27743
|
case 207 /* ElementAccessExpression */:
|
|
27738
|
-
return
|
|
27744
|
+
return -2147483648 /* PropertyAccessExcludes */;
|
|
27739
27745
|
default:
|
|
27740
|
-
return
|
|
27746
|
+
return -2147483648 /* NodeExcludes */;
|
|
27741
27747
|
}
|
|
27742
27748
|
}
|
|
27743
27749
|
ts.getTransformFlagsSubtreeExclusions = getTransformFlagsSubtreeExclusions;
|
|
@@ -43339,18 +43345,7 @@ var ts;
|
|
|
43339
43345
|
* Does not try `@types/${packageName}` - use a second pass if needed.
|
|
43340
43346
|
*/
|
|
43341
43347
|
function resolvePackageNameToPackageJson(packageName, containingDirectory, options, host, cache) {
|
|
43342
|
-
var moduleResolutionState =
|
|
43343
|
-
compilerOptions: options,
|
|
43344
|
-
host: host,
|
|
43345
|
-
traceEnabled: isTraceEnabled(options, host),
|
|
43346
|
-
failedLookupLocations: [],
|
|
43347
|
-
affectingLocations: [],
|
|
43348
|
-
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
43349
|
-
conditions: ts.emptyArray,
|
|
43350
|
-
features: NodeResolutionFeatures.None,
|
|
43351
|
-
requestContainingDirectory: containingDirectory,
|
|
43352
|
-
reportDiagnostic: ts.noop
|
|
43353
|
-
};
|
|
43348
|
+
var moduleResolutionState = getTemporaryModuleResolutionState(cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(), host, options);
|
|
43354
43349
|
return ts.forEachAncestorDirectory(containingDirectory, function (ancestorDirectory) {
|
|
43355
43350
|
if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
43356
43351
|
var nodeModulesFolder = ts.combinePaths(ancestorDirectory, "node_modules");
|
|
@@ -44310,18 +44305,9 @@ var ts;
|
|
|
44310
44305
|
var entrypoints;
|
|
44311
44306
|
var extensions = resolveJs ? Extensions.JavaScript : Extensions.TypeScript;
|
|
44312
44307
|
var features = getDefaultNodeResolutionFeatures(options);
|
|
44313
|
-
var requireState =
|
|
44314
|
-
|
|
44315
|
-
|
|
44316
|
-
traceEnabled: isTraceEnabled(options, host),
|
|
44317
|
-
failedLookupLocations: [],
|
|
44318
|
-
affectingLocations: [],
|
|
44319
|
-
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
44320
|
-
conditions: ["node", "require", "types"],
|
|
44321
|
-
features: features,
|
|
44322
|
-
requestContainingDirectory: packageJsonInfo.packageDirectory,
|
|
44323
|
-
reportDiagnostic: ts.noop
|
|
44324
|
-
};
|
|
44308
|
+
var requireState = getTemporaryModuleResolutionState(cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(), host, options);
|
|
44309
|
+
requireState.conditions = ["node", "require", "types"];
|
|
44310
|
+
requireState.requestContainingDirectory = packageJsonInfo.packageDirectory;
|
|
44325
44311
|
var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory,
|
|
44326
44312
|
/*onlyRecordFailures*/ false, requireState, packageJsonInfo.packageJsonContent, packageJsonInfo.versionPaths);
|
|
44327
44313
|
entrypoints = ts.append(entrypoints, requireResolution === null || requireResolution === void 0 ? void 0 : requireResolution.path);
|
|
@@ -44394,23 +44380,27 @@ var ts;
|
|
|
44394
44380
|
}
|
|
44395
44381
|
}
|
|
44396
44382
|
}
|
|
44397
|
-
/**
|
|
44398
|
-
* A function for locating the package.json scope for a given path
|
|
44399
|
-
*/
|
|
44400
44383
|
/*@internal*/
|
|
44401
|
-
function
|
|
44402
|
-
|
|
44384
|
+
function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options) {
|
|
44385
|
+
return {
|
|
44403
44386
|
host: host,
|
|
44404
44387
|
compilerOptions: options,
|
|
44405
44388
|
traceEnabled: isTraceEnabled(options, host),
|
|
44406
|
-
failedLookupLocations:
|
|
44407
|
-
affectingLocations:
|
|
44389
|
+
failedLookupLocations: ts.noopPush,
|
|
44390
|
+
affectingLocations: ts.noopPush,
|
|
44408
44391
|
packageJsonInfoCache: packageJsonInfoCache,
|
|
44409
|
-
features:
|
|
44410
|
-
conditions:
|
|
44392
|
+
features: NodeResolutionFeatures.None,
|
|
44393
|
+
conditions: ts.emptyArray,
|
|
44411
44394
|
requestContainingDirectory: undefined,
|
|
44412
44395
|
reportDiagnostic: ts.noop
|
|
44413
44396
|
};
|
|
44397
|
+
}
|
|
44398
|
+
ts.getTemporaryModuleResolutionState = getTemporaryModuleResolutionState;
|
|
44399
|
+
/**
|
|
44400
|
+
* A function for locating the package.json scope for a given path
|
|
44401
|
+
*/
|
|
44402
|
+
/*@internal*/
|
|
44403
|
+
function getPackageScopeForPath(fileName, state) {
|
|
44414
44404
|
var parts = ts.getPathComponents(fileName);
|
|
44415
44405
|
parts.pop();
|
|
44416
44406
|
while (parts.length > 0) {
|
|
@@ -44581,7 +44571,7 @@ var ts;
|
|
|
44581
44571
|
var _a, _b;
|
|
44582
44572
|
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
44583
44573
|
var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames));
|
|
44584
|
-
var scope = getPackageScopeForPath(directoryPath, state
|
|
44574
|
+
var scope = getPackageScopeForPath(directoryPath, state);
|
|
44585
44575
|
if (!scope || !scope.packageJsonContent.exports) {
|
|
44586
44576
|
return undefined;
|
|
44587
44577
|
}
|
|
@@ -44640,7 +44630,7 @@ var ts;
|
|
|
44640
44630
|
}
|
|
44641
44631
|
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
44642
44632
|
var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames));
|
|
44643
|
-
var scope = getPackageScopeForPath(directoryPath, state
|
|
44633
|
+
var scope = getPackageScopeForPath(directoryPath, state);
|
|
44644
44634
|
if (!scope) {
|
|
44645
44635
|
if (state.traceEnabled) {
|
|
44646
44636
|
trace(state.host, ts.Diagnostics.Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve, directoryPath);
|
|
@@ -53100,6 +53090,12 @@ var ts;
|
|
|
53100
53090
|
return context.truncating = context.approximateLength > ((context.flags & 1 /* NoTruncation */) ? ts.noTruncationMaximumTruncationLength : ts.defaultMaximumTruncationLength);
|
|
53101
53091
|
}
|
|
53102
53092
|
function typeToTypeNodeHelper(type, context) {
|
|
53093
|
+
var savedFlags = context.flags;
|
|
53094
|
+
var typeNode = typeToTypeNodeWorker(type, context);
|
|
53095
|
+
context.flags = savedFlags;
|
|
53096
|
+
return typeNode;
|
|
53097
|
+
}
|
|
53098
|
+
function typeToTypeNodeWorker(type, context) {
|
|
53103
53099
|
if (cancellationToken && cancellationToken.throwIfCancellationRequested) {
|
|
53104
53100
|
cancellationToken.throwIfCancellationRequested();
|
|
53105
53101
|
}
|
|
@@ -59619,7 +59615,8 @@ var ts;
|
|
|
59619
59615
|
}
|
|
59620
59616
|
}
|
|
59621
59617
|
}
|
|
59622
|
-
|
|
59618
|
+
// The source types were normalized; ensure the result is normalized too.
|
|
59619
|
+
return getNormalizedType(getIntersectionType(constraints), /*writing*/ false);
|
|
59623
59620
|
}
|
|
59624
59621
|
return undefined;
|
|
59625
59622
|
}
|
|
@@ -62837,21 +62834,28 @@ var ts;
|
|
|
62837
62834
|
getFlowTypeOfReference(accessExpression, propType) :
|
|
62838
62835
|
propType;
|
|
62839
62836
|
}
|
|
62840
|
-
if (everyType(objectType, isTupleType) && ts.isNumericLiteralName(propName)
|
|
62837
|
+
if (everyType(objectType, isTupleType) && ts.isNumericLiteralName(propName)) {
|
|
62838
|
+
var index = +propName;
|
|
62841
62839
|
if (accessNode && everyType(objectType, function (t) { return !t.target.hasRestElement; }) && !(accessFlags & 16 /* NoTupleBoundsCheck */)) {
|
|
62842
62840
|
var indexNode = getIndexNodeForAccessExpression(accessNode);
|
|
62843
62841
|
if (isTupleType(objectType)) {
|
|
62842
|
+
if (index < 0) {
|
|
62843
|
+
error(indexNode, ts.Diagnostics.A_tuple_type_cannot_be_indexed_with_a_negative_value);
|
|
62844
|
+
return undefinedType;
|
|
62845
|
+
}
|
|
62844
62846
|
error(indexNode, ts.Diagnostics.Tuple_type_0_of_length_1_has_no_element_at_index_2, typeToString(objectType), getTypeReferenceArity(objectType), ts.unescapeLeadingUnderscores(propName));
|
|
62845
62847
|
}
|
|
62846
62848
|
else {
|
|
62847
62849
|
error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(propName), typeToString(objectType));
|
|
62848
62850
|
}
|
|
62849
62851
|
}
|
|
62850
|
-
|
|
62851
|
-
|
|
62852
|
-
|
|
62853
|
-
|
|
62854
|
-
|
|
62852
|
+
if (index >= 0) {
|
|
62853
|
+
errorIfWritingToReadonlyIndex(getIndexInfoOfType(objectType, numberType));
|
|
62854
|
+
return mapType(objectType, function (t) {
|
|
62855
|
+
var restType = getRestTypeOfTupleType(t) || undefinedType;
|
|
62856
|
+
return accessFlags & 1 /* IncludeUndefined */ ? getUnionType([restType, undefinedType]) : restType;
|
|
62857
|
+
});
|
|
62858
|
+
}
|
|
62855
62859
|
}
|
|
62856
62860
|
}
|
|
62857
62861
|
if (!(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 402653316 /* StringLike */ | 296 /* NumberLike */ | 12288 /* ESSymbolLike */)) {
|
|
@@ -80985,7 +80989,7 @@ var ts;
|
|
|
80985
80989
|
error(node.name, ts.Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name);
|
|
80986
80990
|
}
|
|
80987
80991
|
}
|
|
80988
|
-
if (node.questionToken && ts.isBindingPattern(node.name) && func.body) {
|
|
80992
|
+
if ((node.questionToken || isJSDocOptionalParameter(node)) && ts.isBindingPattern(node.name) && func.body) {
|
|
80989
80993
|
error(node, ts.Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature);
|
|
80990
80994
|
}
|
|
80991
80995
|
if (node.name && ts.isIdentifier(node.name) && (node.name.escapedText === "this" || node.name.escapedText === "new")) {
|
|
@@ -84862,8 +84866,9 @@ var ts;
|
|
|
84862
84866
|
}
|
|
84863
84867
|
var indexInfos = getApplicableIndexInfos(type, propNameType);
|
|
84864
84868
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
|
|
84865
|
-
var
|
|
84866
|
-
name && name.kind === 162 /* ComputedPropertyName */
|
|
84869
|
+
var propDeclaration = declaration && declaration.kind === 221 /* BinaryExpression */ ||
|
|
84870
|
+
name && name.kind === 162 /* ComputedPropertyName */ ? declaration : undefined;
|
|
84871
|
+
var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
|
|
84867
84872
|
var _loop_30 = function (info) {
|
|
84868
84873
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
84869
84874
|
// We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
|
|
@@ -84872,7 +84877,11 @@ var ts;
|
|
|
84872
84877
|
var errorNode = localPropDeclaration || localIndexDeclaration ||
|
|
84873
84878
|
(interfaceDeclaration && !ts.some(getBaseTypes(type), function (base) { return !!getPropertyOfObjectType(base, prop.escapedName) && !!getIndexTypeOfType(base, info.keyType); }) ? interfaceDeclaration : undefined);
|
|
84874
84879
|
if (errorNode && !isTypeAssignableTo(propType, info.type)) {
|
|
84875
|
-
|
|
84880
|
+
var diagnostic = createError(errorNode, ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_2_index_type_3, symbolToString(prop), typeToString(propType), typeToString(info.keyType), typeToString(info.type));
|
|
84881
|
+
if (propDeclaration && errorNode !== propDeclaration) {
|
|
84882
|
+
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(propDeclaration, ts.Diagnostics._0_is_declared_here, symbolToString(prop)));
|
|
84883
|
+
}
|
|
84884
|
+
diagnostics.add(diagnostic);
|
|
84876
84885
|
}
|
|
84877
84886
|
};
|
|
84878
84887
|
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
|
|
@@ -96785,39 +96794,72 @@ var ts;
|
|
|
96785
96794
|
function visitClassDeclaration(node) {
|
|
96786
96795
|
if (!(ts.classOrConstructorParameterIsDecorated(node) || ts.childIsDecorated(node)))
|
|
96787
96796
|
return ts.visitEachChild(node, visitor, context);
|
|
96788
|
-
var
|
|
96789
|
-
|
|
96790
|
-
|
|
96791
|
-
var statements = [classStatement];
|
|
96792
|
-
// Write any decorators of the node.
|
|
96793
|
-
addClassElementDecorationStatements(statements, node, /*isStatic*/ false);
|
|
96794
|
-
addClassElementDecorationStatements(statements, node, /*isStatic*/ true);
|
|
96795
|
-
addConstructorDecorationStatement(statements, node);
|
|
96797
|
+
var statements = ts.hasDecorators(node) ?
|
|
96798
|
+
transformClassDeclarationWithClassDecorators(node, node.name) :
|
|
96799
|
+
transformClassDeclarationWithoutClassDecorators(node, node.name);
|
|
96796
96800
|
if (statements.length > 1) {
|
|
96797
96801
|
// Add a DeclarationMarker as a marker for the end of the declaration
|
|
96798
96802
|
statements.push(factory.createEndOfDeclarationMarker(node));
|
|
96799
|
-
ts.setEmitFlags(
|
|
96803
|
+
ts.setEmitFlags(statements[0], ts.getEmitFlags(statements[0]) | 4194304 /* HasEndOfDeclarationMarker */);
|
|
96800
96804
|
}
|
|
96801
96805
|
return ts.singleOrMany(statements);
|
|
96802
96806
|
}
|
|
96807
|
+
function decoratorContainsPrivateIdentifierInExpression(decorator) {
|
|
96808
|
+
return !!(decorator.transformFlags & 536870912 /* ContainsPrivateIdentifierInExpression */);
|
|
96809
|
+
}
|
|
96810
|
+
function parameterDecoratorsContainPrivateIdentifierInExpression(parameterDecorators) {
|
|
96811
|
+
return ts.some(parameterDecorators, decoratorContainsPrivateIdentifierInExpression);
|
|
96812
|
+
}
|
|
96813
|
+
function hasClassElementWithDecoratorContainingPrivateIdentifierInExpression(node) {
|
|
96814
|
+
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
96815
|
+
var member = _a[_i];
|
|
96816
|
+
if (!ts.canHaveDecorators(member))
|
|
96817
|
+
continue;
|
|
96818
|
+
var allDecorators = ts.getAllDecoratorsOfClassElement(member, node);
|
|
96819
|
+
if (ts.some(allDecorators === null || allDecorators === void 0 ? void 0 : allDecorators.decorators, decoratorContainsPrivateIdentifierInExpression))
|
|
96820
|
+
return true;
|
|
96821
|
+
if (ts.some(allDecorators === null || allDecorators === void 0 ? void 0 : allDecorators.parameters, parameterDecoratorsContainPrivateIdentifierInExpression))
|
|
96822
|
+
return true;
|
|
96823
|
+
}
|
|
96824
|
+
return false;
|
|
96825
|
+
}
|
|
96826
|
+
function transformDecoratorsOfClassElements(node, members) {
|
|
96827
|
+
var decorationStatements = [];
|
|
96828
|
+
addClassElementDecorationStatements(decorationStatements, node, /*isStatic*/ false);
|
|
96829
|
+
addClassElementDecorationStatements(decorationStatements, node, /*isStatic*/ true);
|
|
96830
|
+
if (hasClassElementWithDecoratorContainingPrivateIdentifierInExpression(node)) {
|
|
96831
|
+
members = ts.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray([], members, true), [
|
|
96832
|
+
factory.createClassStaticBlockDeclaration(factory.createBlock(decorationStatements, /*multiLine*/ true))
|
|
96833
|
+
], false)), members);
|
|
96834
|
+
decorationStatements = undefined;
|
|
96835
|
+
}
|
|
96836
|
+
return { decorationStatements: decorationStatements, members: members };
|
|
96837
|
+
}
|
|
96803
96838
|
/**
|
|
96804
96839
|
* Transforms a non-decorated class declaration.
|
|
96805
96840
|
*
|
|
96806
96841
|
* @param node A ClassDeclaration node.
|
|
96807
96842
|
* @param name The name of the class.
|
|
96808
96843
|
*/
|
|
96809
|
-
function
|
|
96844
|
+
function transformClassDeclarationWithoutClassDecorators(node, name) {
|
|
96810
96845
|
// ${modifiers} class ${name} ${heritageClauses} {
|
|
96811
96846
|
// ${members}
|
|
96812
96847
|
// }
|
|
96813
|
-
|
|
96814
|
-
|
|
96848
|
+
var _a;
|
|
96849
|
+
var modifiers = ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier);
|
|
96850
|
+
var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause);
|
|
96851
|
+
var members = ts.visitNodes(node.members, visitor, ts.isClassElement);
|
|
96852
|
+
var decorationStatements = [];
|
|
96853
|
+
(_a = transformDecoratorsOfClassElements(node, members), members = _a.members, decorationStatements = _a.decorationStatements);
|
|
96854
|
+
var updated = factory.updateClassDeclaration(node, modifiers, name,
|
|
96855
|
+
/*typeParameters*/ undefined, heritageClauses, members);
|
|
96856
|
+
return ts.addRange([updated], decorationStatements);
|
|
96815
96857
|
}
|
|
96816
96858
|
/**
|
|
96817
96859
|
* Transforms a decorated class declaration and appends the resulting statements. If
|
|
96818
96860
|
* the class requires an alias to avoid issues with double-binding, the alias is returned.
|
|
96819
96861
|
*/
|
|
96820
|
-
function
|
|
96862
|
+
function transformClassDeclarationWithClassDecorators(node, name) {
|
|
96821
96863
|
// When we emit an ES6 class that has a class decorator, we must tailor the
|
|
96822
96864
|
// emit to certain specific cases.
|
|
96823
96865
|
//
|
|
@@ -96903,6 +96945,7 @@ var ts;
|
|
|
96903
96945
|
// | var C_1;
|
|
96904
96946
|
// ---------------------------------------------------------------------
|
|
96905
96947
|
//
|
|
96948
|
+
var _a;
|
|
96906
96949
|
var location = ts.moveRangePastModifiers(node);
|
|
96907
96950
|
var classAlias = getClassAliasIfNeeded(node);
|
|
96908
96951
|
// When we transform to ES5/3 this will be moved inside an IIFE and should reference the name
|
|
@@ -96915,7 +96958,11 @@ var ts;
|
|
|
96915
96958
|
// }
|
|
96916
96959
|
var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause);
|
|
96917
96960
|
var members = ts.visitNodes(node.members, visitor, ts.isClassElement);
|
|
96918
|
-
var
|
|
96961
|
+
var decorationStatements = [];
|
|
96962
|
+
(_a = transformDecoratorsOfClassElements(node, members), members = _a.members, decorationStatements = _a.decorationStatements);
|
|
96963
|
+
var classExpression = factory.createClassExpression(
|
|
96964
|
+
/*modifiers*/ undefined, name,
|
|
96965
|
+
/*typeParameters*/ undefined, heritageClauses, members);
|
|
96919
96966
|
ts.setOriginalNode(classExpression, node);
|
|
96920
96967
|
ts.setTextRange(classExpression, location);
|
|
96921
96968
|
// let ${name} = ${classExpression} where name is either declaredName if the class doesn't contain self-reference
|
|
@@ -96929,7 +96976,10 @@ var ts;
|
|
|
96929
96976
|
ts.setOriginalNode(statement, node);
|
|
96930
96977
|
ts.setTextRange(statement, location);
|
|
96931
96978
|
ts.setCommentRange(statement, node);
|
|
96932
|
-
|
|
96979
|
+
var statements = [statement];
|
|
96980
|
+
ts.addRange(statements, decorationStatements);
|
|
96981
|
+
addConstructorDecorationStatement(statements, node);
|
|
96982
|
+
return statements;
|
|
96933
96983
|
}
|
|
96934
96984
|
function visitClassExpression(node) {
|
|
96935
96985
|
// Legacy decorators were not supported on class expressions
|
|
@@ -117857,7 +117907,7 @@ var ts;
|
|
|
117857
117907
|
return undefined;
|
|
117858
117908
|
}
|
|
117859
117909
|
function lookupFromPackageJson() {
|
|
117860
|
-
var scope = ts.getPackageScopeForPath(fileName, packageJsonInfoCache, host, options);
|
|
117910
|
+
var scope = ts.getPackageScopeForPath(fileName, ts.getTemporaryModuleResolutionState(packageJsonInfoCache, host, options));
|
|
117861
117911
|
return (scope === null || scope === void 0 ? void 0 : scope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
117862
117912
|
}
|
|
117863
117913
|
}
|
|
@@ -118523,7 +118573,7 @@ var ts;
|
|
|
118523
118573
|
// `result[i]` is either a `ResolvedModuleFull` or a marker.
|
|
118524
118574
|
// If it is the former, we can leave it as is.
|
|
118525
118575
|
if (result[i] === predictedToResolveToAmbientModuleMarker) {
|
|
118526
|
-
result[i] = undefined;
|
|
118576
|
+
result[i] = undefined;
|
|
118527
118577
|
}
|
|
118528
118578
|
}
|
|
118529
118579
|
else {
|
|
@@ -149239,6 +149289,7 @@ var ts;
|
|
|
149239
149289
|
var options = _a.options, getRules = _a.getRules, host = _a.host;
|
|
149240
149290
|
// formatting context is used by rules provider
|
|
149241
149291
|
var formattingContext = new formatting.FormattingContext(sourceFile, requestKind, options);
|
|
149292
|
+
var previousRangeTriviaEnd;
|
|
149242
149293
|
var previousRange;
|
|
149243
149294
|
var previousParent;
|
|
149244
149295
|
var previousRangeStartLine;
|
|
@@ -149267,10 +149318,30 @@ var ts;
|
|
|
149267
149318
|
}
|
|
149268
149319
|
}
|
|
149269
149320
|
if (previousRange && formattingScanner.getStartPos() >= originalRange.end) {
|
|
149321
|
+
// Formatting edits happen by looking at pairs of contiguous tokens (see `processPair`),
|
|
149322
|
+
// typically inserting or deleting whitespace between them. The recursive `processNode`
|
|
149323
|
+
// logic above bails out as soon as it encounters a token that is beyond the end of the
|
|
149324
|
+
// range we're supposed to format (or if we reach the end of the file). But this potentially
|
|
149325
|
+
// leaves out an edit that would occur *inside* the requested range but cannot be discovered
|
|
149326
|
+
// without looking at one token *beyond* the end of the range: consider the line `x = { }`
|
|
149327
|
+
// with a selection from the beginning of the line to the space inside the curly braces,
|
|
149328
|
+
// inclusive. We would expect a format-selection would delete the space (if rules apply),
|
|
149329
|
+
// but in order to do that, we need to process the pair ["{", "}"], but we stopped processing
|
|
149330
|
+
// just before getting there. This block handles this trailing edit.
|
|
149270
149331
|
var tokenInfo = formattingScanner.isOnEOF() ? formattingScanner.readEOFTokenRange() :
|
|
149271
149332
|
formattingScanner.isOnToken() ? formattingScanner.readTokenInfo(enclosingNode).token :
|
|
149272
149333
|
undefined;
|
|
149273
|
-
if (tokenInfo) {
|
|
149334
|
+
if (tokenInfo && tokenInfo.pos === previousRangeTriviaEnd) {
|
|
149335
|
+
// We need to check that tokenInfo and previousRange are contiguous: the `originalRange`
|
|
149336
|
+
// may have ended in the middle of a token, which means we will have stopped formatting
|
|
149337
|
+
// on that token, leaving `previousRange` pointing to the token before it, but already
|
|
149338
|
+
// having moved the formatting scanner (where we just got `tokenInfo`) to the next token.
|
|
149339
|
+
// If this happens, our supposed pair [previousRange, tokenInfo] actually straddles the
|
|
149340
|
+
// token that intersects the end of the range we're supposed to format, so the pair will
|
|
149341
|
+
// produce bogus edits if we try to `processPair`. Recall that the point of this logic is
|
|
149342
|
+
// to perform a trailing edit at the end of the selection range: but there can be no valid
|
|
149343
|
+
// edit in the middle of a token where the range ended, so if we have a non-contiguous
|
|
149344
|
+
// pair here, we're already done and we can ignore it.
|
|
149274
149345
|
var parent = ((_b = ts.findPrecedingToken(tokenInfo.end, sourceFile, enclosingNode)) === null || _b === void 0 ? void 0 : _b.parent) || previousParent;
|
|
149275
149346
|
processPair(tokenInfo, sourceFile.getLineAndCharacterOfPosition(tokenInfo.pos).line, parent, previousRange, previousRangeStartLine, previousParent, parent,
|
|
149276
149347
|
/*dynamicIndentation*/ undefined);
|
|
@@ -149628,6 +149699,7 @@ var ts;
|
|
|
149628
149699
|
}
|
|
149629
149700
|
}
|
|
149630
149701
|
if (currentTokenInfo.trailingTrivia) {
|
|
149702
|
+
previousRangeTriviaEnd = ts.last(currentTokenInfo.trailingTrivia).end;
|
|
149631
149703
|
processTrivia(currentTokenInfo.trailingTrivia, parent, childContextNode, dynamicIndentation);
|
|
149632
149704
|
}
|
|
149633
149705
|
if (indentToken) {
|
|
@@ -149698,6 +149770,7 @@ var ts;
|
|
|
149698
149770
|
}
|
|
149699
149771
|
}
|
|
149700
149772
|
previousRange = range;
|
|
149773
|
+
previousRangeTriviaEnd = range.end;
|
|
149701
149774
|
previousParent = parent;
|
|
149702
149775
|
previousRangeStartLine = rangeStart.line;
|
|
149703
149776
|
return lineAction;
|
|
@@ -164266,7 +164339,7 @@ var ts;
|
|
|
164266
164339
|
var usage = getUsageInfo(oldFile, toMove.all, checker);
|
|
164267
164340
|
var currentDirectory = ts.getDirectoryPath(oldFile.fileName);
|
|
164268
164341
|
var extension = ts.extensionFromPath(oldFile.fileName);
|
|
164269
|
-
var newModuleName = makeUniqueModuleName(getNewModuleName(usage.movedSymbols), extension, currentDirectory, host);
|
|
164342
|
+
var newModuleName = makeUniqueModuleName(getNewModuleName(usage.oldFileImportsFromNewFile, usage.movedSymbols), extension, currentDirectory, host);
|
|
164270
164343
|
var newFileNameWithExtension = newModuleName + extension;
|
|
164271
164344
|
// If previous file was global, this is easy.
|
|
164272
164345
|
changes.createNewFile(oldFile, ts.combinePaths(currentDirectory, newFileNameWithExtension), getNewStatementsAndRemoveFromOldFile(oldFile, usage, changes, toMove, program, newModuleName, preferences));
|
|
@@ -164630,8 +164703,8 @@ var ts;
|
|
|
164630
164703
|
newModuleName = moduleName + "." + i;
|
|
164631
164704
|
}
|
|
164632
164705
|
}
|
|
164633
|
-
function getNewModuleName(movedSymbols) {
|
|
164634
|
-
return movedSymbols.forEachEntry(ts.symbolNameNoDefault) || "newFile";
|
|
164706
|
+
function getNewModuleName(importsFromNewFile, movedSymbols) {
|
|
164707
|
+
return importsFromNewFile.forEachEntry(ts.symbolNameNoDefault) || movedSymbols.forEachEntry(ts.symbolNameNoDefault) || "newFile";
|
|
164635
164708
|
}
|
|
164636
164709
|
function getUsageInfo(oldFile, toMove, checker) {
|
|
164637
164710
|
var movedSymbols = new SymbolSet();
|
|
@@ -178628,7 +178701,7 @@ var ts;
|
|
|
178628
178701
|
var packageDirectory = fileName.substring(0, nodeModulesPathParts.packageRootIndex);
|
|
178629
178702
|
var packageJsonCache = (_a = project.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfoCache();
|
|
178630
178703
|
var compilerOptions = project.getCompilationSettings();
|
|
178631
|
-
var packageJson = ts.getPackageScopeForPath(project.toPath(packageDirectory + "/package.json"), packageJsonCache, project, compilerOptions);
|
|
178704
|
+
var packageJson = ts.getPackageScopeForPath(project.toPath(packageDirectory + "/package.json"), ts.getTemporaryModuleResolutionState(packageJsonCache, project, compilerOptions));
|
|
178632
178705
|
if (!packageJson)
|
|
178633
178706
|
return undefined;
|
|
178634
178707
|
// Use fake options instead of actual compiler options to avoid following export map if the project uses node16 or nodenext -
|