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
|
@@ -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.20220730";
|
|
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
|
}
|
|
@@ -59610,7 +59606,8 @@ var ts;
|
|
|
59610
59606
|
}
|
|
59611
59607
|
}
|
|
59612
59608
|
}
|
|
59613
|
-
|
|
59609
|
+
// The source types were normalized; ensure the result is normalized too.
|
|
59610
|
+
return getNormalizedType(getIntersectionType(constraints), /*writing*/ false);
|
|
59614
59611
|
}
|
|
59615
59612
|
return undefined;
|
|
59616
59613
|
}
|
|
@@ -62828,21 +62825,28 @@ var ts;
|
|
|
62828
62825
|
getFlowTypeOfReference(accessExpression, propType) :
|
|
62829
62826
|
propType;
|
|
62830
62827
|
}
|
|
62831
|
-
if (everyType(objectType, isTupleType) && ts.isNumericLiteralName(propName)
|
|
62828
|
+
if (everyType(objectType, isTupleType) && ts.isNumericLiteralName(propName)) {
|
|
62829
|
+
var index = +propName;
|
|
62832
62830
|
if (accessNode && everyType(objectType, function (t) { return !t.target.hasRestElement; }) && !(accessFlags & 16 /* NoTupleBoundsCheck */)) {
|
|
62833
62831
|
var indexNode = getIndexNodeForAccessExpression(accessNode);
|
|
62834
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
|
+
}
|
|
62835
62837
|
error(indexNode, ts.Diagnostics.Tuple_type_0_of_length_1_has_no_element_at_index_2, typeToString(objectType), getTypeReferenceArity(objectType), ts.unescapeLeadingUnderscores(propName));
|
|
62836
62838
|
}
|
|
62837
62839
|
else {
|
|
62838
62840
|
error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(propName), typeToString(objectType));
|
|
62839
62841
|
}
|
|
62840
62842
|
}
|
|
62841
|
-
|
|
62842
|
-
|
|
62843
|
-
|
|
62844
|
-
|
|
62845
|
-
|
|
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
|
+
}
|
|
62846
62850
|
}
|
|
62847
62851
|
}
|
|
62848
62852
|
if (!(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 402653316 /* StringLike */ | 296 /* NumberLike */ | 12288 /* ESSymbolLike */)) {
|
|
@@ -80976,7 +80980,7 @@ var ts;
|
|
|
80976
80980
|
error(node.name, ts.Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name);
|
|
80977
80981
|
}
|
|
80978
80982
|
}
|
|
80979
|
-
if (node.questionToken && ts.isBindingPattern(node.name) && func.body) {
|
|
80983
|
+
if ((node.questionToken || isJSDocOptionalParameter(node)) && ts.isBindingPattern(node.name) && func.body) {
|
|
80980
80984
|
error(node, ts.Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature);
|
|
80981
80985
|
}
|
|
80982
80986
|
if (node.name && ts.isIdentifier(node.name) && (node.name.escapedText === "this" || node.name.escapedText === "new")) {
|
|
@@ -84853,8 +84857,9 @@ var ts;
|
|
|
84853
84857
|
}
|
|
84854
84858
|
var indexInfos = getApplicableIndexInfos(type, propNameType);
|
|
84855
84859
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
|
|
84856
|
-
var
|
|
84857
|
-
name && name.kind === 162 /* ComputedPropertyName */
|
|
84860
|
+
var propDeclaration = declaration && declaration.kind === 221 /* BinaryExpression */ ||
|
|
84861
|
+
name && name.kind === 162 /* ComputedPropertyName */ ? declaration : undefined;
|
|
84862
|
+
var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
|
|
84858
84863
|
var _loop_30 = function (info) {
|
|
84859
84864
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
84860
84865
|
// We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
|
|
@@ -84863,7 +84868,11 @@ var ts;
|
|
|
84863
84868
|
var errorNode = localPropDeclaration || localIndexDeclaration ||
|
|
84864
84869
|
(interfaceDeclaration && !ts.some(getBaseTypes(type), function (base) { return !!getPropertyOfObjectType(base, prop.escapedName) && !!getIndexTypeOfType(base, info.keyType); }) ? interfaceDeclaration : undefined);
|
|
84865
84870
|
if (errorNode && !isTypeAssignableTo(propType, info.type)) {
|
|
84866
|
-
|
|
84871
|
+
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));
|
|
84872
|
+
if (propDeclaration && errorNode !== propDeclaration) {
|
|
84873
|
+
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(propDeclaration, ts.Diagnostics._0_is_declared_here, symbolToString(prop)));
|
|
84874
|
+
}
|
|
84875
|
+
diagnostics.add(diagnostic);
|
|
84867
84876
|
}
|
|
84868
84877
|
};
|
|
84869
84878
|
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
|
|
@@ -96776,39 +96785,72 @@ var ts;
|
|
|
96776
96785
|
function visitClassDeclaration(node) {
|
|
96777
96786
|
if (!(ts.classOrConstructorParameterIsDecorated(node) || ts.childIsDecorated(node)))
|
|
96778
96787
|
return ts.visitEachChild(node, visitor, context);
|
|
96779
|
-
var
|
|
96780
|
-
|
|
96781
|
-
|
|
96782
|
-
var statements = [classStatement];
|
|
96783
|
-
// Write any decorators of the node.
|
|
96784
|
-
addClassElementDecorationStatements(statements, node, /*isStatic*/ false);
|
|
96785
|
-
addClassElementDecorationStatements(statements, node, /*isStatic*/ true);
|
|
96786
|
-
addConstructorDecorationStatement(statements, node);
|
|
96788
|
+
var statements = ts.hasDecorators(node) ?
|
|
96789
|
+
transformClassDeclarationWithClassDecorators(node, node.name) :
|
|
96790
|
+
transformClassDeclarationWithoutClassDecorators(node, node.name);
|
|
96787
96791
|
if (statements.length > 1) {
|
|
96788
96792
|
// Add a DeclarationMarker as a marker for the end of the declaration
|
|
96789
96793
|
statements.push(factory.createEndOfDeclarationMarker(node));
|
|
96790
|
-
ts.setEmitFlags(
|
|
96794
|
+
ts.setEmitFlags(statements[0], ts.getEmitFlags(statements[0]) | 4194304 /* HasEndOfDeclarationMarker */);
|
|
96791
96795
|
}
|
|
96792
96796
|
return ts.singleOrMany(statements);
|
|
96793
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
|
+
}
|
|
96794
96829
|
/**
|
|
96795
96830
|
* Transforms a non-decorated class declaration.
|
|
96796
96831
|
*
|
|
96797
96832
|
* @param node A ClassDeclaration node.
|
|
96798
96833
|
* @param name The name of the class.
|
|
96799
96834
|
*/
|
|
96800
|
-
function
|
|
96835
|
+
function transformClassDeclarationWithoutClassDecorators(node, name) {
|
|
96801
96836
|
// ${modifiers} class ${name} ${heritageClauses} {
|
|
96802
96837
|
// ${members}
|
|
96803
96838
|
// }
|
|
96804
|
-
|
|
96805
|
-
|
|
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);
|
|
96806
96848
|
}
|
|
96807
96849
|
/**
|
|
96808
96850
|
* Transforms a decorated class declaration and appends the resulting statements. If
|
|
96809
96851
|
* the class requires an alias to avoid issues with double-binding, the alias is returned.
|
|
96810
96852
|
*/
|
|
96811
|
-
function
|
|
96853
|
+
function transformClassDeclarationWithClassDecorators(node, name) {
|
|
96812
96854
|
// When we emit an ES6 class that has a class decorator, we must tailor the
|
|
96813
96855
|
// emit to certain specific cases.
|
|
96814
96856
|
//
|
|
@@ -96894,6 +96936,7 @@ var ts;
|
|
|
96894
96936
|
// | var C_1;
|
|
96895
96937
|
// ---------------------------------------------------------------------
|
|
96896
96938
|
//
|
|
96939
|
+
var _a;
|
|
96897
96940
|
var location = ts.moveRangePastModifiers(node);
|
|
96898
96941
|
var classAlias = getClassAliasIfNeeded(node);
|
|
96899
96942
|
// When we transform to ES5/3 this will be moved inside an IIFE and should reference the name
|
|
@@ -96906,7 +96949,11 @@ var ts;
|
|
|
96906
96949
|
// }
|
|
96907
96950
|
var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause);
|
|
96908
96951
|
var members = ts.visitNodes(node.members, visitor, ts.isClassElement);
|
|
96909
|
-
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);
|
|
96910
96957
|
ts.setOriginalNode(classExpression, node);
|
|
96911
96958
|
ts.setTextRange(classExpression, location);
|
|
96912
96959
|
// let ${name} = ${classExpression} where name is either declaredName if the class doesn't contain self-reference
|
|
@@ -96920,7 +96967,10 @@ var ts;
|
|
|
96920
96967
|
ts.setOriginalNode(statement, node);
|
|
96921
96968
|
ts.setTextRange(statement, location);
|
|
96922
96969
|
ts.setCommentRange(statement, node);
|
|
96923
|
-
|
|
96970
|
+
var statements = [statement];
|
|
96971
|
+
ts.addRange(statements, decorationStatements);
|
|
96972
|
+
addConstructorDecorationStatement(statements, node);
|
|
96973
|
+
return statements;
|
|
96924
96974
|
}
|
|
96925
96975
|
function visitClassExpression(node) {
|
|
96926
96976
|
// Legacy decorators were not supported on class expressions
|
|
@@ -117848,7 +117898,7 @@ var ts;
|
|
|
117848
117898
|
return undefined;
|
|
117849
117899
|
}
|
|
117850
117900
|
function lookupFromPackageJson() {
|
|
117851
|
-
var scope = ts.getPackageScopeForPath(fileName, packageJsonInfoCache, host, options);
|
|
117901
|
+
var scope = ts.getPackageScopeForPath(fileName, ts.getTemporaryModuleResolutionState(packageJsonInfoCache, host, options));
|
|
117852
117902
|
return (scope === null || scope === void 0 ? void 0 : scope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
117853
117903
|
}
|
|
117854
117904
|
}
|
|
@@ -118514,7 +118564,7 @@ var ts;
|
|
|
118514
118564
|
// `result[i]` is either a `ResolvedModuleFull` or a marker.
|
|
118515
118565
|
// If it is the former, we can leave it as is.
|
|
118516
118566
|
if (result[i] === predictedToResolveToAmbientModuleMarker) {
|
|
118517
|
-
result[i] = undefined;
|
|
118567
|
+
result[i] = undefined;
|
|
118518
118568
|
}
|
|
118519
118569
|
}
|
|
118520
118570
|
else {
|
|
@@ -149230,6 +149280,7 @@ var ts;
|
|
|
149230
149280
|
var options = _a.options, getRules = _a.getRules, host = _a.host;
|
|
149231
149281
|
// formatting context is used by rules provider
|
|
149232
149282
|
var formattingContext = new formatting.FormattingContext(sourceFile, requestKind, options);
|
|
149283
|
+
var previousRangeTriviaEnd;
|
|
149233
149284
|
var previousRange;
|
|
149234
149285
|
var previousParent;
|
|
149235
149286
|
var previousRangeStartLine;
|
|
@@ -149258,10 +149309,30 @@ var ts;
|
|
|
149258
149309
|
}
|
|
149259
149310
|
}
|
|
149260
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.
|
|
149261
149322
|
var tokenInfo = formattingScanner.isOnEOF() ? formattingScanner.readEOFTokenRange() :
|
|
149262
149323
|
formattingScanner.isOnToken() ? formattingScanner.readTokenInfo(enclosingNode).token :
|
|
149263
149324
|
undefined;
|
|
149264
|
-
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.
|
|
149265
149336
|
var parent = ((_b = ts.findPrecedingToken(tokenInfo.end, sourceFile, enclosingNode)) === null || _b === void 0 ? void 0 : _b.parent) || previousParent;
|
|
149266
149337
|
processPair(tokenInfo, sourceFile.getLineAndCharacterOfPosition(tokenInfo.pos).line, parent, previousRange, previousRangeStartLine, previousParent, parent,
|
|
149267
149338
|
/*dynamicIndentation*/ undefined);
|
|
@@ -149619,6 +149690,7 @@ var ts;
|
|
|
149619
149690
|
}
|
|
149620
149691
|
}
|
|
149621
149692
|
if (currentTokenInfo.trailingTrivia) {
|
|
149693
|
+
previousRangeTriviaEnd = ts.last(currentTokenInfo.trailingTrivia).end;
|
|
149622
149694
|
processTrivia(currentTokenInfo.trailingTrivia, parent, childContextNode, dynamicIndentation);
|
|
149623
149695
|
}
|
|
149624
149696
|
if (indentToken) {
|
|
@@ -149689,6 +149761,7 @@ var ts;
|
|
|
149689
149761
|
}
|
|
149690
149762
|
}
|
|
149691
149763
|
previousRange = range;
|
|
149764
|
+
previousRangeTriviaEnd = range.end;
|
|
149692
149765
|
previousParent = parent;
|
|
149693
149766
|
previousRangeStartLine = rangeStart.line;
|
|
149694
149767
|
return lineAction;
|
|
@@ -164257,7 +164330,7 @@ var ts;
|
|
|
164257
164330
|
var usage = getUsageInfo(oldFile, toMove.all, checker);
|
|
164258
164331
|
var currentDirectory = ts.getDirectoryPath(oldFile.fileName);
|
|
164259
164332
|
var extension = ts.extensionFromPath(oldFile.fileName);
|
|
164260
|
-
var newModuleName = makeUniqueModuleName(getNewModuleName(usage.movedSymbols), extension, currentDirectory, host);
|
|
164333
|
+
var newModuleName = makeUniqueModuleName(getNewModuleName(usage.oldFileImportsFromNewFile, usage.movedSymbols), extension, currentDirectory, host);
|
|
164261
164334
|
var newFileNameWithExtension = newModuleName + extension;
|
|
164262
164335
|
// If previous file was global, this is easy.
|
|
164263
164336
|
changes.createNewFile(oldFile, ts.combinePaths(currentDirectory, newFileNameWithExtension), getNewStatementsAndRemoveFromOldFile(oldFile, usage, changes, toMove, program, newModuleName, preferences));
|
|
@@ -164621,8 +164694,8 @@ var ts;
|
|
|
164621
164694
|
newModuleName = moduleName + "." + i;
|
|
164622
164695
|
}
|
|
164623
164696
|
}
|
|
164624
|
-
function getNewModuleName(movedSymbols) {
|
|
164625
|
-
return movedSymbols.forEachEntry(ts.symbolNameNoDefault) || "newFile";
|
|
164697
|
+
function getNewModuleName(importsFromNewFile, movedSymbols) {
|
|
164698
|
+
return importsFromNewFile.forEachEntry(ts.symbolNameNoDefault) || movedSymbols.forEachEntry(ts.symbolNameNoDefault) || "newFile";
|
|
164626
164699
|
}
|
|
164627
164700
|
function getUsageInfo(oldFile, toMove, checker) {
|
|
164628
164701
|
var movedSymbols = new SymbolSet();
|