typescript 4.8.0-dev.20220728 → 4.8.0-dev.20220731
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 +2 -0
- package/lib/es/diagnosticMessages.generated.json +2 -0
- package/lib/fr/diagnosticMessages.generated.json +2 -0
- package/lib/it/diagnosticMessages.generated.json +2 -0
- package/lib/ja/diagnosticMessages.generated.json +1 -0
- package/lib/ko/diagnosticMessages.generated.json +2 -0
- package/lib/pl/diagnosticMessages.generated.json +1 -0
- package/lib/pt-br/diagnosticMessages.generated.json +1 -0
- package/lib/ru/diagnosticMessages.generated.json +2 -0
- package/lib/tr/diagnosticMessages.generated.json +1 -0
- package/lib/tsc.js +115 -71
- package/lib/tsserver.js +166 -99
- package/lib/tsserverlibrary.js +166 -99
- package/lib/typescript.js +165 -98
- package/lib/typescriptServices.js +165 -98
- package/lib/typingsInstaller.js +141 -97
- package/lib/zh-cn/diagnosticMessages.generated.json +2 -0
- package/lib/zh-tw/diagnosticMessages.generated.json +2 -0
- package/package.json +1 -1
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220731";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -1895,6 +1895,10 @@ var ts;
|
|
|
1895
1895
|
/** Does nothing. */
|
|
1896
1896
|
function noop(_) { }
|
|
1897
1897
|
ts.noop = noop;
|
|
1898
|
+
ts.noopPush = {
|
|
1899
|
+
push: noop,
|
|
1900
|
+
length: 0
|
|
1901
|
+
};
|
|
1898
1902
|
/** Do nothing and return false */
|
|
1899
1903
|
function returnFalse() {
|
|
1900
1904
|
return false;
|
|
@@ -5903,10 +5907,8 @@ var ts;
|
|
|
5903
5907
|
TransformFlags[TransformFlags["ContainsPossibleTopLevelAwait"] = 67108864] = "ContainsPossibleTopLevelAwait";
|
|
5904
5908
|
TransformFlags[TransformFlags["ContainsLexicalSuper"] = 134217728] = "ContainsLexicalSuper";
|
|
5905
5909
|
TransformFlags[TransformFlags["ContainsUpdateExpressionForIdentifier"] = 268435456] = "ContainsUpdateExpressionForIdentifier";
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
// It is a good reminder of how much room we have left
|
|
5909
|
-
TransformFlags[TransformFlags["HasComputedFlags"] = 536870912] = "HasComputedFlags";
|
|
5910
|
+
TransformFlags[TransformFlags["ContainsPrivateIdentifierInExpression"] = 536870912] = "ContainsPrivateIdentifierInExpression";
|
|
5911
|
+
TransformFlags[TransformFlags["HasComputedFlags"] = -2147483648] = "HasComputedFlags";
|
|
5910
5912
|
// Assertions
|
|
5911
5913
|
// - Bitmasks that are used to assert facts about the syntax of a node and its subtree.
|
|
5912
5914
|
TransformFlags[TransformFlags["AssertTypeScript"] = 1] = "AssertTypeScript";
|
|
@@ -5925,23 +5927,23 @@ var ts;
|
|
|
5925
5927
|
// Scope Exclusions
|
|
5926
5928
|
// - Bitmasks that exclude flags from propagating out of a specific context
|
|
5927
5929
|
// into the subtree flags of their container.
|
|
5928
|
-
TransformFlags[TransformFlags["OuterExpressionExcludes"] =
|
|
5929
|
-
TransformFlags[TransformFlags["PropertyAccessExcludes"] =
|
|
5930
|
-
TransformFlags[TransformFlags["NodeExcludes"] =
|
|
5931
|
-
TransformFlags[TransformFlags["ArrowFunctionExcludes"] =
|
|
5932
|
-
TransformFlags[TransformFlags["FunctionExcludes"] =
|
|
5933
|
-
TransformFlags[TransformFlags["ConstructorExcludes"] =
|
|
5934
|
-
TransformFlags[TransformFlags["MethodOrAccessorExcludes"] =
|
|
5935
|
-
TransformFlags[TransformFlags["PropertyExcludes"] =
|
|
5936
|
-
TransformFlags[TransformFlags["ClassExcludes"] =
|
|
5937
|
-
TransformFlags[TransformFlags["ModuleExcludes"] =
|
|
5930
|
+
TransformFlags[TransformFlags["OuterExpressionExcludes"] = -2147483648] = "OuterExpressionExcludes";
|
|
5931
|
+
TransformFlags[TransformFlags["PropertyAccessExcludes"] = -2147483648] = "PropertyAccessExcludes";
|
|
5932
|
+
TransformFlags[TransformFlags["NodeExcludes"] = -2147483648] = "NodeExcludes";
|
|
5933
|
+
TransformFlags[TransformFlags["ArrowFunctionExcludes"] = -2072174592] = "ArrowFunctionExcludes";
|
|
5934
|
+
TransformFlags[TransformFlags["FunctionExcludes"] = -1937940480] = "FunctionExcludes";
|
|
5935
|
+
TransformFlags[TransformFlags["ConstructorExcludes"] = -1937948672] = "ConstructorExcludes";
|
|
5936
|
+
TransformFlags[TransformFlags["MethodOrAccessorExcludes"] = -2005057536] = "MethodOrAccessorExcludes";
|
|
5937
|
+
TransformFlags[TransformFlags["PropertyExcludes"] = -2013249536] = "PropertyExcludes";
|
|
5938
|
+
TransformFlags[TransformFlags["ClassExcludes"] = -2147344384] = "ClassExcludes";
|
|
5939
|
+
TransformFlags[TransformFlags["ModuleExcludes"] = -1941676032] = "ModuleExcludes";
|
|
5938
5940
|
TransformFlags[TransformFlags["TypeExcludes"] = -2] = "TypeExcludes";
|
|
5939
|
-
TransformFlags[TransformFlags["ObjectLiteralExcludes"] =
|
|
5940
|
-
TransformFlags[TransformFlags["ArrayLiteralOrCallOrNewExcludes"] =
|
|
5941
|
-
TransformFlags[TransformFlags["VariableDeclarationListExcludes"] =
|
|
5942
|
-
TransformFlags[TransformFlags["ParameterExcludes"] =
|
|
5943
|
-
TransformFlags[TransformFlags["CatchClauseExcludes"] =
|
|
5944
|
-
TransformFlags[TransformFlags["BindingPatternExcludes"] =
|
|
5941
|
+
TransformFlags[TransformFlags["ObjectLiteralExcludes"] = -2147278848] = "ObjectLiteralExcludes";
|
|
5942
|
+
TransformFlags[TransformFlags["ArrayLiteralOrCallOrNewExcludes"] = -2147450880] = "ArrayLiteralOrCallOrNewExcludes";
|
|
5943
|
+
TransformFlags[TransformFlags["VariableDeclarationListExcludes"] = -2146893824] = "VariableDeclarationListExcludes";
|
|
5944
|
+
TransformFlags[TransformFlags["ParameterExcludes"] = -2147483648] = "ParameterExcludes";
|
|
5945
|
+
TransformFlags[TransformFlags["CatchClauseExcludes"] = -2147418112] = "CatchClauseExcludes";
|
|
5946
|
+
TransformFlags[TransformFlags["BindingPatternExcludes"] = -2147450880] = "BindingPatternExcludes";
|
|
5945
5947
|
TransformFlags[TransformFlags["ContainsLexicalThisOrSuper"] = 134234112] = "ContainsLexicalThisOrSuper";
|
|
5946
5948
|
// Propagating flags
|
|
5947
5949
|
// - Bitmasks for flags that should propagate from a child
|
|
@@ -8976,6 +8978,7 @@ var ts;
|
|
|
8976
8978
|
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."),
|
|
8977
8979
|
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."),
|
|
8978
8980
|
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."),
|
|
8981
|
+
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."),
|
|
8979
8982
|
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}'."),
|
|
8980
8983
|
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."),
|
|
8981
8984
|
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."),
|
|
@@ -24279,7 +24282,7 @@ var ts;
|
|
|
24279
24282
|
propagateChildFlags(node.expression) |
|
|
24280
24283
|
(ts.isIdentifier(node.name) ?
|
|
24281
24284
|
propagateIdentifierNameFlags(node.name) :
|
|
24282
|
-
propagateChildFlags(node.name));
|
|
24285
|
+
propagateChildFlags(node.name) | 536870912 /* ContainsPrivateIdentifierInExpression */);
|
|
24283
24286
|
if (ts.isSuperKeyword(expression)) {
|
|
24284
24287
|
// super method calls require a lexical 'this'
|
|
24285
24288
|
// super method calls require 'super' hoisting in ES2017 and ES2018 async functions and async generators
|
|
@@ -24312,7 +24315,7 @@ var ts;
|
|
|
24312
24315
|
propagateChildFlags(node.questionDotToken) |
|
|
24313
24316
|
(ts.isIdentifier(node.name) ?
|
|
24314
24317
|
propagateIdentifierNameFlags(node.name) :
|
|
24315
|
-
propagateChildFlags(node.name));
|
|
24318
|
+
propagateChildFlags(node.name) | 536870912 /* ContainsPrivateIdentifierInExpression */);
|
|
24316
24319
|
return node;
|
|
24317
24320
|
}
|
|
24318
24321
|
// @api
|
|
@@ -24716,6 +24719,9 @@ var ts;
|
|
|
24716
24719
|
else if (ts.isLogicalOrCoalescingAssignmentOperator(operatorKind)) {
|
|
24717
24720
|
node.transformFlags |= 16 /* ContainsES2021 */;
|
|
24718
24721
|
}
|
|
24722
|
+
if (operatorKind === 101 /* InKeyword */ && ts.isPrivateIdentifier(node.left)) {
|
|
24723
|
+
node.transformFlags |= 536870912 /* ContainsPrivateIdentifierInExpression */;
|
|
24724
|
+
}
|
|
24719
24725
|
return node;
|
|
24720
24726
|
}
|
|
24721
24727
|
function propagateAssignmentPatternFlags(node) {
|
|
@@ -27670,29 +27676,29 @@ var ts;
|
|
|
27670
27676
|
case 208 /* CallExpression */:
|
|
27671
27677
|
case 209 /* NewExpression */:
|
|
27672
27678
|
case 204 /* ArrayLiteralExpression */:
|
|
27673
|
-
return
|
|
27679
|
+
return -2147450880 /* ArrayLiteralOrCallOrNewExcludes */;
|
|
27674
27680
|
case 261 /* ModuleDeclaration */:
|
|
27675
|
-
return
|
|
27681
|
+
return -1941676032 /* ModuleExcludes */;
|
|
27676
27682
|
case 164 /* Parameter */:
|
|
27677
|
-
return
|
|
27683
|
+
return -2147483648 /* ParameterExcludes */;
|
|
27678
27684
|
case 214 /* ArrowFunction */:
|
|
27679
|
-
return
|
|
27685
|
+
return -2072174592 /* ArrowFunctionExcludes */;
|
|
27680
27686
|
case 213 /* FunctionExpression */:
|
|
27681
27687
|
case 256 /* FunctionDeclaration */:
|
|
27682
|
-
return
|
|
27688
|
+
return -1937940480 /* FunctionExcludes */;
|
|
27683
27689
|
case 255 /* VariableDeclarationList */:
|
|
27684
|
-
return
|
|
27690
|
+
return -2146893824 /* VariableDeclarationListExcludes */;
|
|
27685
27691
|
case 257 /* ClassDeclaration */:
|
|
27686
27692
|
case 226 /* ClassExpression */:
|
|
27687
|
-
return
|
|
27693
|
+
return -2147344384 /* ClassExcludes */;
|
|
27688
27694
|
case 171 /* Constructor */:
|
|
27689
|
-
return
|
|
27695
|
+
return -1937948672 /* ConstructorExcludes */;
|
|
27690
27696
|
case 167 /* PropertyDeclaration */:
|
|
27691
|
-
return
|
|
27697
|
+
return -2013249536 /* PropertyExcludes */;
|
|
27692
27698
|
case 169 /* MethodDeclaration */:
|
|
27693
27699
|
case 172 /* GetAccessor */:
|
|
27694
27700
|
case 173 /* SetAccessor */:
|
|
27695
|
-
return
|
|
27701
|
+
return -2005057536 /* MethodOrAccessorExcludes */;
|
|
27696
27702
|
case 130 /* AnyKeyword */:
|
|
27697
27703
|
case 147 /* NumberKeyword */:
|
|
27698
27704
|
case 158 /* BigIntKeyword */:
|
|
@@ -27712,23 +27718,23 @@ var ts;
|
|
|
27712
27718
|
case 259 /* TypeAliasDeclaration */:
|
|
27713
27719
|
return -2 /* TypeExcludes */;
|
|
27714
27720
|
case 205 /* ObjectLiteralExpression */:
|
|
27715
|
-
return
|
|
27721
|
+
return -2147278848 /* ObjectLiteralExcludes */;
|
|
27716
27722
|
case 292 /* CatchClause */:
|
|
27717
|
-
return
|
|
27723
|
+
return -2147418112 /* CatchClauseExcludes */;
|
|
27718
27724
|
case 201 /* ObjectBindingPattern */:
|
|
27719
27725
|
case 202 /* ArrayBindingPattern */:
|
|
27720
|
-
return
|
|
27726
|
+
return -2147450880 /* BindingPatternExcludes */;
|
|
27721
27727
|
case 211 /* TypeAssertionExpression */:
|
|
27722
27728
|
case 229 /* AsExpression */:
|
|
27723
27729
|
case 350 /* PartiallyEmittedExpression */:
|
|
27724
27730
|
case 212 /* ParenthesizedExpression */:
|
|
27725
27731
|
case 106 /* SuperKeyword */:
|
|
27726
|
-
return
|
|
27732
|
+
return -2147483648 /* OuterExpressionExcludes */;
|
|
27727
27733
|
case 206 /* PropertyAccessExpression */:
|
|
27728
27734
|
case 207 /* ElementAccessExpression */:
|
|
27729
|
-
return
|
|
27735
|
+
return -2147483648 /* PropertyAccessExcludes */;
|
|
27730
27736
|
default:
|
|
27731
|
-
return
|
|
27737
|
+
return -2147483648 /* NodeExcludes */;
|
|
27732
27738
|
}
|
|
27733
27739
|
}
|
|
27734
27740
|
ts.getTransformFlagsSubtreeExclusions = getTransformFlagsSubtreeExclusions;
|
|
@@ -43330,18 +43336,7 @@ var ts;
|
|
|
43330
43336
|
* Does not try `@types/${packageName}` - use a second pass if needed.
|
|
43331
43337
|
*/
|
|
43332
43338
|
function resolvePackageNameToPackageJson(packageName, containingDirectory, options, host, cache) {
|
|
43333
|
-
var moduleResolutionState =
|
|
43334
|
-
compilerOptions: options,
|
|
43335
|
-
host: host,
|
|
43336
|
-
traceEnabled: isTraceEnabled(options, host),
|
|
43337
|
-
failedLookupLocations: [],
|
|
43338
|
-
affectingLocations: [],
|
|
43339
|
-
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
43340
|
-
conditions: ts.emptyArray,
|
|
43341
|
-
features: NodeResolutionFeatures.None,
|
|
43342
|
-
requestContainingDirectory: containingDirectory,
|
|
43343
|
-
reportDiagnostic: ts.noop
|
|
43344
|
-
};
|
|
43339
|
+
var moduleResolutionState = getTemporaryModuleResolutionState(cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(), host, options);
|
|
43345
43340
|
return ts.forEachAncestorDirectory(containingDirectory, function (ancestorDirectory) {
|
|
43346
43341
|
if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
43347
43342
|
var nodeModulesFolder = ts.combinePaths(ancestorDirectory, "node_modules");
|
|
@@ -44301,18 +44296,9 @@ var ts;
|
|
|
44301
44296
|
var entrypoints;
|
|
44302
44297
|
var extensions = resolveJs ? Extensions.JavaScript : Extensions.TypeScript;
|
|
44303
44298
|
var features = getDefaultNodeResolutionFeatures(options);
|
|
44304
|
-
var requireState =
|
|
44305
|
-
|
|
44306
|
-
|
|
44307
|
-
traceEnabled: isTraceEnabled(options, host),
|
|
44308
|
-
failedLookupLocations: [],
|
|
44309
|
-
affectingLocations: [],
|
|
44310
|
-
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
44311
|
-
conditions: ["node", "require", "types"],
|
|
44312
|
-
features: features,
|
|
44313
|
-
requestContainingDirectory: packageJsonInfo.packageDirectory,
|
|
44314
|
-
reportDiagnostic: ts.noop
|
|
44315
|
-
};
|
|
44299
|
+
var requireState = getTemporaryModuleResolutionState(cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(), host, options);
|
|
44300
|
+
requireState.conditions = ["node", "require", "types"];
|
|
44301
|
+
requireState.requestContainingDirectory = packageJsonInfo.packageDirectory;
|
|
44316
44302
|
var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory,
|
|
44317
44303
|
/*onlyRecordFailures*/ false, requireState, packageJsonInfo.packageJsonContent, packageJsonInfo.versionPaths);
|
|
44318
44304
|
entrypoints = ts.append(entrypoints, requireResolution === null || requireResolution === void 0 ? void 0 : requireResolution.path);
|
|
@@ -44385,23 +44371,27 @@ var ts;
|
|
|
44385
44371
|
}
|
|
44386
44372
|
}
|
|
44387
44373
|
}
|
|
44388
|
-
/**
|
|
44389
|
-
* A function for locating the package.json scope for a given path
|
|
44390
|
-
*/
|
|
44391
44374
|
/*@internal*/
|
|
44392
|
-
function
|
|
44393
|
-
|
|
44375
|
+
function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options) {
|
|
44376
|
+
return {
|
|
44394
44377
|
host: host,
|
|
44395
44378
|
compilerOptions: options,
|
|
44396
44379
|
traceEnabled: isTraceEnabled(options, host),
|
|
44397
|
-
failedLookupLocations:
|
|
44398
|
-
affectingLocations:
|
|
44380
|
+
failedLookupLocations: ts.noopPush,
|
|
44381
|
+
affectingLocations: ts.noopPush,
|
|
44399
44382
|
packageJsonInfoCache: packageJsonInfoCache,
|
|
44400
|
-
features:
|
|
44401
|
-
conditions:
|
|
44383
|
+
features: NodeResolutionFeatures.None,
|
|
44384
|
+
conditions: ts.emptyArray,
|
|
44402
44385
|
requestContainingDirectory: undefined,
|
|
44403
44386
|
reportDiagnostic: ts.noop
|
|
44404
44387
|
};
|
|
44388
|
+
}
|
|
44389
|
+
ts.getTemporaryModuleResolutionState = getTemporaryModuleResolutionState;
|
|
44390
|
+
/**
|
|
44391
|
+
* A function for locating the package.json scope for a given path
|
|
44392
|
+
*/
|
|
44393
|
+
/*@internal*/
|
|
44394
|
+
function getPackageScopeForPath(fileName, state) {
|
|
44405
44395
|
var parts = ts.getPathComponents(fileName);
|
|
44406
44396
|
parts.pop();
|
|
44407
44397
|
while (parts.length > 0) {
|
|
@@ -44572,7 +44562,7 @@ var ts;
|
|
|
44572
44562
|
var _a, _b;
|
|
44573
44563
|
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
44574
44564
|
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));
|
|
44575
|
-
var scope = getPackageScopeForPath(directoryPath, state
|
|
44565
|
+
var scope = getPackageScopeForPath(directoryPath, state);
|
|
44576
44566
|
if (!scope || !scope.packageJsonContent.exports) {
|
|
44577
44567
|
return undefined;
|
|
44578
44568
|
}
|
|
@@ -44631,7 +44621,7 @@ var ts;
|
|
|
44631
44621
|
}
|
|
44632
44622
|
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
44633
44623
|
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));
|
|
44634
|
-
var scope = getPackageScopeForPath(directoryPath, state
|
|
44624
|
+
var scope = getPackageScopeForPath(directoryPath, state);
|
|
44635
44625
|
if (!scope) {
|
|
44636
44626
|
if (state.traceEnabled) {
|
|
44637
44627
|
trace(state.host, ts.Diagnostics.Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve, directoryPath);
|
|
@@ -53091,6 +53081,12 @@ var ts;
|
|
|
53091
53081
|
return context.truncating = context.approximateLength > ((context.flags & 1 /* NoTruncation */) ? ts.noTruncationMaximumTruncationLength : ts.defaultMaximumTruncationLength);
|
|
53092
53082
|
}
|
|
53093
53083
|
function typeToTypeNodeHelper(type, context) {
|
|
53084
|
+
var savedFlags = context.flags;
|
|
53085
|
+
var typeNode = typeToTypeNodeWorker(type, context);
|
|
53086
|
+
context.flags = savedFlags;
|
|
53087
|
+
return typeNode;
|
|
53088
|
+
}
|
|
53089
|
+
function typeToTypeNodeWorker(type, context) {
|
|
53094
53090
|
if (cancellationToken && cancellationToken.throwIfCancellationRequested) {
|
|
53095
53091
|
cancellationToken.throwIfCancellationRequested();
|
|
53096
53092
|
}
|
|
@@ -62829,21 +62825,28 @@ var ts;
|
|
|
62829
62825
|
getFlowTypeOfReference(accessExpression, propType) :
|
|
62830
62826
|
propType;
|
|
62831
62827
|
}
|
|
62832
|
-
if (everyType(objectType, isTupleType) && ts.isNumericLiteralName(propName)
|
|
62828
|
+
if (everyType(objectType, isTupleType) && ts.isNumericLiteralName(propName)) {
|
|
62829
|
+
var index = +propName;
|
|
62833
62830
|
if (accessNode && everyType(objectType, function (t) { return !t.target.hasRestElement; }) && !(accessFlags & 16 /* NoTupleBoundsCheck */)) {
|
|
62834
62831
|
var indexNode = getIndexNodeForAccessExpression(accessNode);
|
|
62835
62832
|
if (isTupleType(objectType)) {
|
|
62833
|
+
if (index < 0) {
|
|
62834
|
+
error(indexNode, ts.Diagnostics.A_tuple_type_cannot_be_indexed_with_a_negative_value);
|
|
62835
|
+
return undefinedType;
|
|
62836
|
+
}
|
|
62836
62837
|
error(indexNode, ts.Diagnostics.Tuple_type_0_of_length_1_has_no_element_at_index_2, typeToString(objectType), getTypeReferenceArity(objectType), ts.unescapeLeadingUnderscores(propName));
|
|
62837
62838
|
}
|
|
62838
62839
|
else {
|
|
62839
62840
|
error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(propName), typeToString(objectType));
|
|
62840
62841
|
}
|
|
62841
62842
|
}
|
|
62842
|
-
|
|
62843
|
-
|
|
62844
|
-
|
|
62845
|
-
|
|
62846
|
-
|
|
62843
|
+
if (index >= 0) {
|
|
62844
|
+
errorIfWritingToReadonlyIndex(getIndexInfoOfType(objectType, numberType));
|
|
62845
|
+
return mapType(objectType, function (t) {
|
|
62846
|
+
var restType = getRestTypeOfTupleType(t) || undefinedType;
|
|
62847
|
+
return accessFlags & 1 /* IncludeUndefined */ ? getUnionType([restType, undefinedType]) : restType;
|
|
62848
|
+
});
|
|
62849
|
+
}
|
|
62847
62850
|
}
|
|
62848
62851
|
}
|
|
62849
62852
|
if (!(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 402653316 /* StringLike */ | 296 /* NumberLike */ | 12288 /* ESSymbolLike */)) {
|
|
@@ -80977,7 +80980,7 @@ var ts;
|
|
|
80977
80980
|
error(node.name, ts.Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name);
|
|
80978
80981
|
}
|
|
80979
80982
|
}
|
|
80980
|
-
if (node.questionToken && ts.isBindingPattern(node.name) && func.body) {
|
|
80983
|
+
if ((node.questionToken || isJSDocOptionalParameter(node)) && ts.isBindingPattern(node.name) && func.body) {
|
|
80981
80984
|
error(node, ts.Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature);
|
|
80982
80985
|
}
|
|
80983
80986
|
if (node.name && ts.isIdentifier(node.name) && (node.name.escapedText === "this" || node.name.escapedText === "new")) {
|
|
@@ -96782,39 +96785,72 @@ var ts;
|
|
|
96782
96785
|
function visitClassDeclaration(node) {
|
|
96783
96786
|
if (!(ts.classOrConstructorParameterIsDecorated(node) || ts.childIsDecorated(node)))
|
|
96784
96787
|
return ts.visitEachChild(node, visitor, context);
|
|
96785
|
-
var
|
|
96786
|
-
|
|
96787
|
-
|
|
96788
|
-
var statements = [classStatement];
|
|
96789
|
-
// Write any decorators of the node.
|
|
96790
|
-
addClassElementDecorationStatements(statements, node, /*isStatic*/ false);
|
|
96791
|
-
addClassElementDecorationStatements(statements, node, /*isStatic*/ true);
|
|
96792
|
-
addConstructorDecorationStatement(statements, node);
|
|
96788
|
+
var statements = ts.hasDecorators(node) ?
|
|
96789
|
+
transformClassDeclarationWithClassDecorators(node, node.name) :
|
|
96790
|
+
transformClassDeclarationWithoutClassDecorators(node, node.name);
|
|
96793
96791
|
if (statements.length > 1) {
|
|
96794
96792
|
// Add a DeclarationMarker as a marker for the end of the declaration
|
|
96795
96793
|
statements.push(factory.createEndOfDeclarationMarker(node));
|
|
96796
|
-
ts.setEmitFlags(
|
|
96794
|
+
ts.setEmitFlags(statements[0], ts.getEmitFlags(statements[0]) | 4194304 /* HasEndOfDeclarationMarker */);
|
|
96797
96795
|
}
|
|
96798
96796
|
return ts.singleOrMany(statements);
|
|
96799
96797
|
}
|
|
96798
|
+
function decoratorContainsPrivateIdentifierInExpression(decorator) {
|
|
96799
|
+
return !!(decorator.transformFlags & 536870912 /* ContainsPrivateIdentifierInExpression */);
|
|
96800
|
+
}
|
|
96801
|
+
function parameterDecoratorsContainPrivateIdentifierInExpression(parameterDecorators) {
|
|
96802
|
+
return ts.some(parameterDecorators, decoratorContainsPrivateIdentifierInExpression);
|
|
96803
|
+
}
|
|
96804
|
+
function hasClassElementWithDecoratorContainingPrivateIdentifierInExpression(node) {
|
|
96805
|
+
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
96806
|
+
var member = _a[_i];
|
|
96807
|
+
if (!ts.canHaveDecorators(member))
|
|
96808
|
+
continue;
|
|
96809
|
+
var allDecorators = ts.getAllDecoratorsOfClassElement(member, node);
|
|
96810
|
+
if (ts.some(allDecorators === null || allDecorators === void 0 ? void 0 : allDecorators.decorators, decoratorContainsPrivateIdentifierInExpression))
|
|
96811
|
+
return true;
|
|
96812
|
+
if (ts.some(allDecorators === null || allDecorators === void 0 ? void 0 : allDecorators.parameters, parameterDecoratorsContainPrivateIdentifierInExpression))
|
|
96813
|
+
return true;
|
|
96814
|
+
}
|
|
96815
|
+
return false;
|
|
96816
|
+
}
|
|
96817
|
+
function transformDecoratorsOfClassElements(node, members) {
|
|
96818
|
+
var decorationStatements = [];
|
|
96819
|
+
addClassElementDecorationStatements(decorationStatements, node, /*isStatic*/ false);
|
|
96820
|
+
addClassElementDecorationStatements(decorationStatements, node, /*isStatic*/ true);
|
|
96821
|
+
if (hasClassElementWithDecoratorContainingPrivateIdentifierInExpression(node)) {
|
|
96822
|
+
members = ts.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray([], members, true), [
|
|
96823
|
+
factory.createClassStaticBlockDeclaration(factory.createBlock(decorationStatements, /*multiLine*/ true))
|
|
96824
|
+
], false)), members);
|
|
96825
|
+
decorationStatements = undefined;
|
|
96826
|
+
}
|
|
96827
|
+
return { decorationStatements: decorationStatements, members: members };
|
|
96828
|
+
}
|
|
96800
96829
|
/**
|
|
96801
96830
|
* Transforms a non-decorated class declaration.
|
|
96802
96831
|
*
|
|
96803
96832
|
* @param node A ClassDeclaration node.
|
|
96804
96833
|
* @param name The name of the class.
|
|
96805
96834
|
*/
|
|
96806
|
-
function
|
|
96835
|
+
function transformClassDeclarationWithoutClassDecorators(node, name) {
|
|
96807
96836
|
// ${modifiers} class ${name} ${heritageClauses} {
|
|
96808
96837
|
// ${members}
|
|
96809
96838
|
// }
|
|
96810
|
-
|
|
96811
|
-
|
|
96839
|
+
var _a;
|
|
96840
|
+
var modifiers = ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier);
|
|
96841
|
+
var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause);
|
|
96842
|
+
var members = ts.visitNodes(node.members, visitor, ts.isClassElement);
|
|
96843
|
+
var decorationStatements = [];
|
|
96844
|
+
(_a = transformDecoratorsOfClassElements(node, members), members = _a.members, decorationStatements = _a.decorationStatements);
|
|
96845
|
+
var updated = factory.updateClassDeclaration(node, modifiers, name,
|
|
96846
|
+
/*typeParameters*/ undefined, heritageClauses, members);
|
|
96847
|
+
return ts.addRange([updated], decorationStatements);
|
|
96812
96848
|
}
|
|
96813
96849
|
/**
|
|
96814
96850
|
* Transforms a decorated class declaration and appends the resulting statements. If
|
|
96815
96851
|
* the class requires an alias to avoid issues with double-binding, the alias is returned.
|
|
96816
96852
|
*/
|
|
96817
|
-
function
|
|
96853
|
+
function transformClassDeclarationWithClassDecorators(node, name) {
|
|
96818
96854
|
// When we emit an ES6 class that has a class decorator, we must tailor the
|
|
96819
96855
|
// emit to certain specific cases.
|
|
96820
96856
|
//
|
|
@@ -96900,6 +96936,7 @@ var ts;
|
|
|
96900
96936
|
// | var C_1;
|
|
96901
96937
|
// ---------------------------------------------------------------------
|
|
96902
96938
|
//
|
|
96939
|
+
var _a;
|
|
96903
96940
|
var location = ts.moveRangePastModifiers(node);
|
|
96904
96941
|
var classAlias = getClassAliasIfNeeded(node);
|
|
96905
96942
|
// When we transform to ES5/3 this will be moved inside an IIFE and should reference the name
|
|
@@ -96912,7 +96949,11 @@ var ts;
|
|
|
96912
96949
|
// }
|
|
96913
96950
|
var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause);
|
|
96914
96951
|
var members = ts.visitNodes(node.members, visitor, ts.isClassElement);
|
|
96915
|
-
var
|
|
96952
|
+
var decorationStatements = [];
|
|
96953
|
+
(_a = transformDecoratorsOfClassElements(node, members), members = _a.members, decorationStatements = _a.decorationStatements);
|
|
96954
|
+
var classExpression = factory.createClassExpression(
|
|
96955
|
+
/*modifiers*/ undefined, name,
|
|
96956
|
+
/*typeParameters*/ undefined, heritageClauses, members);
|
|
96916
96957
|
ts.setOriginalNode(classExpression, node);
|
|
96917
96958
|
ts.setTextRange(classExpression, location);
|
|
96918
96959
|
// let ${name} = ${classExpression} where name is either declaredName if the class doesn't contain self-reference
|
|
@@ -96926,7 +96967,10 @@ var ts;
|
|
|
96926
96967
|
ts.setOriginalNode(statement, node);
|
|
96927
96968
|
ts.setTextRange(statement, location);
|
|
96928
96969
|
ts.setCommentRange(statement, node);
|
|
96929
|
-
|
|
96970
|
+
var statements = [statement];
|
|
96971
|
+
ts.addRange(statements, decorationStatements);
|
|
96972
|
+
addConstructorDecorationStatement(statements, node);
|
|
96973
|
+
return statements;
|
|
96930
96974
|
}
|
|
96931
96975
|
function visitClassExpression(node) {
|
|
96932
96976
|
// Legacy decorators were not supported on class expressions
|
|
@@ -117854,7 +117898,7 @@ var ts;
|
|
|
117854
117898
|
return undefined;
|
|
117855
117899
|
}
|
|
117856
117900
|
function lookupFromPackageJson() {
|
|
117857
|
-
var scope = ts.getPackageScopeForPath(fileName, packageJsonInfoCache, host, options);
|
|
117901
|
+
var scope = ts.getPackageScopeForPath(fileName, ts.getTemporaryModuleResolutionState(packageJsonInfoCache, host, options));
|
|
117858
117902
|
return (scope === null || scope === void 0 ? void 0 : scope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
117859
117903
|
}
|
|
117860
117904
|
}
|
|
@@ -149236,6 +149280,7 @@ var ts;
|
|
|
149236
149280
|
var options = _a.options, getRules = _a.getRules, host = _a.host;
|
|
149237
149281
|
// formatting context is used by rules provider
|
|
149238
149282
|
var formattingContext = new formatting.FormattingContext(sourceFile, requestKind, options);
|
|
149283
|
+
var previousRangeTriviaEnd;
|
|
149239
149284
|
var previousRange;
|
|
149240
149285
|
var previousParent;
|
|
149241
149286
|
var previousRangeStartLine;
|
|
@@ -149264,10 +149309,30 @@ var ts;
|
|
|
149264
149309
|
}
|
|
149265
149310
|
}
|
|
149266
149311
|
if (previousRange && formattingScanner.getStartPos() >= originalRange.end) {
|
|
149312
|
+
// Formatting edits happen by looking at pairs of contiguous tokens (see `processPair`),
|
|
149313
|
+
// typically inserting or deleting whitespace between them. The recursive `processNode`
|
|
149314
|
+
// logic above bails out as soon as it encounters a token that is beyond the end of the
|
|
149315
|
+
// range we're supposed to format (or if we reach the end of the file). But this potentially
|
|
149316
|
+
// leaves out an edit that would occur *inside* the requested range but cannot be discovered
|
|
149317
|
+
// without looking at one token *beyond* the end of the range: consider the line `x = { }`
|
|
149318
|
+
// with a selection from the beginning of the line to the space inside the curly braces,
|
|
149319
|
+
// inclusive. We would expect a format-selection would delete the space (if rules apply),
|
|
149320
|
+
// but in order to do that, we need to process the pair ["{", "}"], but we stopped processing
|
|
149321
|
+
// just before getting there. This block handles this trailing edit.
|
|
149267
149322
|
var tokenInfo = formattingScanner.isOnEOF() ? formattingScanner.readEOFTokenRange() :
|
|
149268
149323
|
formattingScanner.isOnToken() ? formattingScanner.readTokenInfo(enclosingNode).token :
|
|
149269
149324
|
undefined;
|
|
149270
|
-
if (tokenInfo) {
|
|
149325
|
+
if (tokenInfo && tokenInfo.pos === previousRangeTriviaEnd) {
|
|
149326
|
+
// We need to check that tokenInfo and previousRange are contiguous: the `originalRange`
|
|
149327
|
+
// may have ended in the middle of a token, which means we will have stopped formatting
|
|
149328
|
+
// on that token, leaving `previousRange` pointing to the token before it, but already
|
|
149329
|
+
// having moved the formatting scanner (where we just got `tokenInfo`) to the next token.
|
|
149330
|
+
// If this happens, our supposed pair [previousRange, tokenInfo] actually straddles the
|
|
149331
|
+
// token that intersects the end of the range we're supposed to format, so the pair will
|
|
149332
|
+
// produce bogus edits if we try to `processPair`. Recall that the point of this logic is
|
|
149333
|
+
// to perform a trailing edit at the end of the selection range: but there can be no valid
|
|
149334
|
+
// edit in the middle of a token where the range ended, so if we have a non-contiguous
|
|
149335
|
+
// pair here, we're already done and we can ignore it.
|
|
149271
149336
|
var parent = ((_b = ts.findPrecedingToken(tokenInfo.end, sourceFile, enclosingNode)) === null || _b === void 0 ? void 0 : _b.parent) || previousParent;
|
|
149272
149337
|
processPair(tokenInfo, sourceFile.getLineAndCharacterOfPosition(tokenInfo.pos).line, parent, previousRange, previousRangeStartLine, previousParent, parent,
|
|
149273
149338
|
/*dynamicIndentation*/ undefined);
|
|
@@ -149625,6 +149690,7 @@ var ts;
|
|
|
149625
149690
|
}
|
|
149626
149691
|
}
|
|
149627
149692
|
if (currentTokenInfo.trailingTrivia) {
|
|
149693
|
+
previousRangeTriviaEnd = ts.last(currentTokenInfo.trailingTrivia).end;
|
|
149628
149694
|
processTrivia(currentTokenInfo.trailingTrivia, parent, childContextNode, dynamicIndentation);
|
|
149629
149695
|
}
|
|
149630
149696
|
if (indentToken) {
|
|
@@ -149695,6 +149761,7 @@ var ts;
|
|
|
149695
149761
|
}
|
|
149696
149762
|
}
|
|
149697
149763
|
previousRange = range;
|
|
149764
|
+
previousRangeTriviaEnd = range.end;
|
|
149698
149765
|
previousParent = parent;
|
|
149699
149766
|
previousRangeStartLine = rangeStart.line;
|
|
149700
149767
|
return lineAction;
|