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/tsserver.js
CHANGED
|
@@ -109,7 +109,7 @@ var ts;
|
|
|
109
109
|
// The following is baselined as a literal template type without intervention
|
|
110
110
|
/** The version of the TypeScript compiler release */
|
|
111
111
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
112
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
112
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220730";
|
|
113
113
|
/* @internal */
|
|
114
114
|
var Comparison;
|
|
115
115
|
(function (Comparison) {
|
|
@@ -1710,6 +1710,10 @@ var ts;
|
|
|
1710
1710
|
/** Does nothing. */
|
|
1711
1711
|
function noop(_) { }
|
|
1712
1712
|
ts.noop = noop;
|
|
1713
|
+
ts.noopPush = {
|
|
1714
|
+
push: noop,
|
|
1715
|
+
length: 0
|
|
1716
|
+
};
|
|
1713
1717
|
/** Do nothing and return false */
|
|
1714
1718
|
function returnFalse() {
|
|
1715
1719
|
return false;
|
|
@@ -5718,10 +5722,8 @@ var ts;
|
|
|
5718
5722
|
TransformFlags[TransformFlags["ContainsPossibleTopLevelAwait"] = 67108864] = "ContainsPossibleTopLevelAwait";
|
|
5719
5723
|
TransformFlags[TransformFlags["ContainsLexicalSuper"] = 134217728] = "ContainsLexicalSuper";
|
|
5720
5724
|
TransformFlags[TransformFlags["ContainsUpdateExpressionForIdentifier"] = 268435456] = "ContainsUpdateExpressionForIdentifier";
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
// It is a good reminder of how much room we have left
|
|
5724
|
-
TransformFlags[TransformFlags["HasComputedFlags"] = 536870912] = "HasComputedFlags";
|
|
5725
|
+
TransformFlags[TransformFlags["ContainsPrivateIdentifierInExpression"] = 536870912] = "ContainsPrivateIdentifierInExpression";
|
|
5726
|
+
TransformFlags[TransformFlags["HasComputedFlags"] = -2147483648] = "HasComputedFlags";
|
|
5725
5727
|
// Assertions
|
|
5726
5728
|
// - Bitmasks that are used to assert facts about the syntax of a node and its subtree.
|
|
5727
5729
|
TransformFlags[TransformFlags["AssertTypeScript"] = 1] = "AssertTypeScript";
|
|
@@ -5740,23 +5742,23 @@ var ts;
|
|
|
5740
5742
|
// Scope Exclusions
|
|
5741
5743
|
// - Bitmasks that exclude flags from propagating out of a specific context
|
|
5742
5744
|
// into the subtree flags of their container.
|
|
5743
|
-
TransformFlags[TransformFlags["OuterExpressionExcludes"] =
|
|
5744
|
-
TransformFlags[TransformFlags["PropertyAccessExcludes"] =
|
|
5745
|
-
TransformFlags[TransformFlags["NodeExcludes"] =
|
|
5746
|
-
TransformFlags[TransformFlags["ArrowFunctionExcludes"] =
|
|
5747
|
-
TransformFlags[TransformFlags["FunctionExcludes"] =
|
|
5748
|
-
TransformFlags[TransformFlags["ConstructorExcludes"] =
|
|
5749
|
-
TransformFlags[TransformFlags["MethodOrAccessorExcludes"] =
|
|
5750
|
-
TransformFlags[TransformFlags["PropertyExcludes"] =
|
|
5751
|
-
TransformFlags[TransformFlags["ClassExcludes"] =
|
|
5752
|
-
TransformFlags[TransformFlags["ModuleExcludes"] =
|
|
5745
|
+
TransformFlags[TransformFlags["OuterExpressionExcludes"] = -2147483648] = "OuterExpressionExcludes";
|
|
5746
|
+
TransformFlags[TransformFlags["PropertyAccessExcludes"] = -2147483648] = "PropertyAccessExcludes";
|
|
5747
|
+
TransformFlags[TransformFlags["NodeExcludes"] = -2147483648] = "NodeExcludes";
|
|
5748
|
+
TransformFlags[TransformFlags["ArrowFunctionExcludes"] = -2072174592] = "ArrowFunctionExcludes";
|
|
5749
|
+
TransformFlags[TransformFlags["FunctionExcludes"] = -1937940480] = "FunctionExcludes";
|
|
5750
|
+
TransformFlags[TransformFlags["ConstructorExcludes"] = -1937948672] = "ConstructorExcludes";
|
|
5751
|
+
TransformFlags[TransformFlags["MethodOrAccessorExcludes"] = -2005057536] = "MethodOrAccessorExcludes";
|
|
5752
|
+
TransformFlags[TransformFlags["PropertyExcludes"] = -2013249536] = "PropertyExcludes";
|
|
5753
|
+
TransformFlags[TransformFlags["ClassExcludes"] = -2147344384] = "ClassExcludes";
|
|
5754
|
+
TransformFlags[TransformFlags["ModuleExcludes"] = -1941676032] = "ModuleExcludes";
|
|
5753
5755
|
TransformFlags[TransformFlags["TypeExcludes"] = -2] = "TypeExcludes";
|
|
5754
|
-
TransformFlags[TransformFlags["ObjectLiteralExcludes"] =
|
|
5755
|
-
TransformFlags[TransformFlags["ArrayLiteralOrCallOrNewExcludes"] =
|
|
5756
|
-
TransformFlags[TransformFlags["VariableDeclarationListExcludes"] =
|
|
5757
|
-
TransformFlags[TransformFlags["ParameterExcludes"] =
|
|
5758
|
-
TransformFlags[TransformFlags["CatchClauseExcludes"] =
|
|
5759
|
-
TransformFlags[TransformFlags["BindingPatternExcludes"] =
|
|
5756
|
+
TransformFlags[TransformFlags["ObjectLiteralExcludes"] = -2147278848] = "ObjectLiteralExcludes";
|
|
5757
|
+
TransformFlags[TransformFlags["ArrayLiteralOrCallOrNewExcludes"] = -2147450880] = "ArrayLiteralOrCallOrNewExcludes";
|
|
5758
|
+
TransformFlags[TransformFlags["VariableDeclarationListExcludes"] = -2146893824] = "VariableDeclarationListExcludes";
|
|
5759
|
+
TransformFlags[TransformFlags["ParameterExcludes"] = -2147483648] = "ParameterExcludes";
|
|
5760
|
+
TransformFlags[TransformFlags["CatchClauseExcludes"] = -2147418112] = "CatchClauseExcludes";
|
|
5761
|
+
TransformFlags[TransformFlags["BindingPatternExcludes"] = -2147450880] = "BindingPatternExcludes";
|
|
5760
5762
|
TransformFlags[TransformFlags["ContainsLexicalThisOrSuper"] = 134234112] = "ContainsLexicalThisOrSuper";
|
|
5761
5763
|
// Propagating flags
|
|
5762
5764
|
// - Bitmasks for flags that should propagate from a child
|
|
@@ -8791,6 +8793,7 @@ var ts;
|
|
|
8791
8793
|
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."),
|
|
8792
8794
|
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."),
|
|
8793
8795
|
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."),
|
|
8796
|
+
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."),
|
|
8794
8797
|
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}'."),
|
|
8795
8798
|
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."),
|
|
8796
8799
|
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."),
|
|
@@ -24094,7 +24097,7 @@ var ts;
|
|
|
24094
24097
|
propagateChildFlags(node.expression) |
|
|
24095
24098
|
(ts.isIdentifier(node.name) ?
|
|
24096
24099
|
propagateIdentifierNameFlags(node.name) :
|
|
24097
|
-
propagateChildFlags(node.name));
|
|
24100
|
+
propagateChildFlags(node.name) | 536870912 /* ContainsPrivateIdentifierInExpression */);
|
|
24098
24101
|
if (ts.isSuperKeyword(expression)) {
|
|
24099
24102
|
// super method calls require a lexical 'this'
|
|
24100
24103
|
// super method calls require 'super' hoisting in ES2017 and ES2018 async functions and async generators
|
|
@@ -24127,7 +24130,7 @@ var ts;
|
|
|
24127
24130
|
propagateChildFlags(node.questionDotToken) |
|
|
24128
24131
|
(ts.isIdentifier(node.name) ?
|
|
24129
24132
|
propagateIdentifierNameFlags(node.name) :
|
|
24130
|
-
propagateChildFlags(node.name));
|
|
24133
|
+
propagateChildFlags(node.name) | 536870912 /* ContainsPrivateIdentifierInExpression */);
|
|
24131
24134
|
return node;
|
|
24132
24135
|
}
|
|
24133
24136
|
// @api
|
|
@@ -24531,6 +24534,9 @@ var ts;
|
|
|
24531
24534
|
else if (ts.isLogicalOrCoalescingAssignmentOperator(operatorKind)) {
|
|
24532
24535
|
node.transformFlags |= 16 /* ContainsES2021 */;
|
|
24533
24536
|
}
|
|
24537
|
+
if (operatorKind === 101 /* InKeyword */ && ts.isPrivateIdentifier(node.left)) {
|
|
24538
|
+
node.transformFlags |= 536870912 /* ContainsPrivateIdentifierInExpression */;
|
|
24539
|
+
}
|
|
24534
24540
|
return node;
|
|
24535
24541
|
}
|
|
24536
24542
|
function propagateAssignmentPatternFlags(node) {
|
|
@@ -27485,29 +27491,29 @@ var ts;
|
|
|
27485
27491
|
case 208 /* CallExpression */:
|
|
27486
27492
|
case 209 /* NewExpression */:
|
|
27487
27493
|
case 204 /* ArrayLiteralExpression */:
|
|
27488
|
-
return
|
|
27494
|
+
return -2147450880 /* ArrayLiteralOrCallOrNewExcludes */;
|
|
27489
27495
|
case 261 /* ModuleDeclaration */:
|
|
27490
|
-
return
|
|
27496
|
+
return -1941676032 /* ModuleExcludes */;
|
|
27491
27497
|
case 164 /* Parameter */:
|
|
27492
|
-
return
|
|
27498
|
+
return -2147483648 /* ParameterExcludes */;
|
|
27493
27499
|
case 214 /* ArrowFunction */:
|
|
27494
|
-
return
|
|
27500
|
+
return -2072174592 /* ArrowFunctionExcludes */;
|
|
27495
27501
|
case 213 /* FunctionExpression */:
|
|
27496
27502
|
case 256 /* FunctionDeclaration */:
|
|
27497
|
-
return
|
|
27503
|
+
return -1937940480 /* FunctionExcludes */;
|
|
27498
27504
|
case 255 /* VariableDeclarationList */:
|
|
27499
|
-
return
|
|
27505
|
+
return -2146893824 /* VariableDeclarationListExcludes */;
|
|
27500
27506
|
case 257 /* ClassDeclaration */:
|
|
27501
27507
|
case 226 /* ClassExpression */:
|
|
27502
|
-
return
|
|
27508
|
+
return -2147344384 /* ClassExcludes */;
|
|
27503
27509
|
case 171 /* Constructor */:
|
|
27504
|
-
return
|
|
27510
|
+
return -1937948672 /* ConstructorExcludes */;
|
|
27505
27511
|
case 167 /* PropertyDeclaration */:
|
|
27506
|
-
return
|
|
27512
|
+
return -2013249536 /* PropertyExcludes */;
|
|
27507
27513
|
case 169 /* MethodDeclaration */:
|
|
27508
27514
|
case 172 /* GetAccessor */:
|
|
27509
27515
|
case 173 /* SetAccessor */:
|
|
27510
|
-
return
|
|
27516
|
+
return -2005057536 /* MethodOrAccessorExcludes */;
|
|
27511
27517
|
case 130 /* AnyKeyword */:
|
|
27512
27518
|
case 147 /* NumberKeyword */:
|
|
27513
27519
|
case 158 /* BigIntKeyword */:
|
|
@@ -27527,23 +27533,23 @@ var ts;
|
|
|
27527
27533
|
case 259 /* TypeAliasDeclaration */:
|
|
27528
27534
|
return -2 /* TypeExcludes */;
|
|
27529
27535
|
case 205 /* ObjectLiteralExpression */:
|
|
27530
|
-
return
|
|
27536
|
+
return -2147278848 /* ObjectLiteralExcludes */;
|
|
27531
27537
|
case 292 /* CatchClause */:
|
|
27532
|
-
return
|
|
27538
|
+
return -2147418112 /* CatchClauseExcludes */;
|
|
27533
27539
|
case 201 /* ObjectBindingPattern */:
|
|
27534
27540
|
case 202 /* ArrayBindingPattern */:
|
|
27535
|
-
return
|
|
27541
|
+
return -2147450880 /* BindingPatternExcludes */;
|
|
27536
27542
|
case 211 /* TypeAssertionExpression */:
|
|
27537
27543
|
case 229 /* AsExpression */:
|
|
27538
27544
|
case 350 /* PartiallyEmittedExpression */:
|
|
27539
27545
|
case 212 /* ParenthesizedExpression */:
|
|
27540
27546
|
case 106 /* SuperKeyword */:
|
|
27541
|
-
return
|
|
27547
|
+
return -2147483648 /* OuterExpressionExcludes */;
|
|
27542
27548
|
case 206 /* PropertyAccessExpression */:
|
|
27543
27549
|
case 207 /* ElementAccessExpression */:
|
|
27544
|
-
return
|
|
27550
|
+
return -2147483648 /* PropertyAccessExcludes */;
|
|
27545
27551
|
default:
|
|
27546
|
-
return
|
|
27552
|
+
return -2147483648 /* NodeExcludes */;
|
|
27547
27553
|
}
|
|
27548
27554
|
}
|
|
27549
27555
|
ts.getTransformFlagsSubtreeExclusions = getTransformFlagsSubtreeExclusions;
|
|
@@ -43145,18 +43151,7 @@ var ts;
|
|
|
43145
43151
|
* Does not try `@types/${packageName}` - use a second pass if needed.
|
|
43146
43152
|
*/
|
|
43147
43153
|
function resolvePackageNameToPackageJson(packageName, containingDirectory, options, host, cache) {
|
|
43148
|
-
var moduleResolutionState =
|
|
43149
|
-
compilerOptions: options,
|
|
43150
|
-
host: host,
|
|
43151
|
-
traceEnabled: isTraceEnabled(options, host),
|
|
43152
|
-
failedLookupLocations: [],
|
|
43153
|
-
affectingLocations: [],
|
|
43154
|
-
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
43155
|
-
conditions: ts.emptyArray,
|
|
43156
|
-
features: NodeResolutionFeatures.None,
|
|
43157
|
-
requestContainingDirectory: containingDirectory,
|
|
43158
|
-
reportDiagnostic: ts.noop
|
|
43159
|
-
};
|
|
43154
|
+
var moduleResolutionState = getTemporaryModuleResolutionState(cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(), host, options);
|
|
43160
43155
|
return ts.forEachAncestorDirectory(containingDirectory, function (ancestorDirectory) {
|
|
43161
43156
|
if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
43162
43157
|
var nodeModulesFolder = ts.combinePaths(ancestorDirectory, "node_modules");
|
|
@@ -44116,18 +44111,9 @@ var ts;
|
|
|
44116
44111
|
var entrypoints;
|
|
44117
44112
|
var extensions = resolveJs ? Extensions.JavaScript : Extensions.TypeScript;
|
|
44118
44113
|
var features = getDefaultNodeResolutionFeatures(options);
|
|
44119
|
-
var requireState =
|
|
44120
|
-
|
|
44121
|
-
|
|
44122
|
-
traceEnabled: isTraceEnabled(options, host),
|
|
44123
|
-
failedLookupLocations: [],
|
|
44124
|
-
affectingLocations: [],
|
|
44125
|
-
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
44126
|
-
conditions: ["node", "require", "types"],
|
|
44127
|
-
features: features,
|
|
44128
|
-
requestContainingDirectory: packageJsonInfo.packageDirectory,
|
|
44129
|
-
reportDiagnostic: ts.noop
|
|
44130
|
-
};
|
|
44114
|
+
var requireState = getTemporaryModuleResolutionState(cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(), host, options);
|
|
44115
|
+
requireState.conditions = ["node", "require", "types"];
|
|
44116
|
+
requireState.requestContainingDirectory = packageJsonInfo.packageDirectory;
|
|
44131
44117
|
var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory,
|
|
44132
44118
|
/*onlyRecordFailures*/ false, requireState, packageJsonInfo.packageJsonContent, packageJsonInfo.versionPaths);
|
|
44133
44119
|
entrypoints = ts.append(entrypoints, requireResolution === null || requireResolution === void 0 ? void 0 : requireResolution.path);
|
|
@@ -44200,23 +44186,27 @@ var ts;
|
|
|
44200
44186
|
}
|
|
44201
44187
|
}
|
|
44202
44188
|
}
|
|
44203
|
-
/**
|
|
44204
|
-
* A function for locating the package.json scope for a given path
|
|
44205
|
-
*/
|
|
44206
44189
|
/*@internal*/
|
|
44207
|
-
function
|
|
44208
|
-
|
|
44190
|
+
function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options) {
|
|
44191
|
+
return {
|
|
44209
44192
|
host: host,
|
|
44210
44193
|
compilerOptions: options,
|
|
44211
44194
|
traceEnabled: isTraceEnabled(options, host),
|
|
44212
|
-
failedLookupLocations:
|
|
44213
|
-
affectingLocations:
|
|
44195
|
+
failedLookupLocations: ts.noopPush,
|
|
44196
|
+
affectingLocations: ts.noopPush,
|
|
44214
44197
|
packageJsonInfoCache: packageJsonInfoCache,
|
|
44215
|
-
features:
|
|
44216
|
-
conditions:
|
|
44198
|
+
features: NodeResolutionFeatures.None,
|
|
44199
|
+
conditions: ts.emptyArray,
|
|
44217
44200
|
requestContainingDirectory: undefined,
|
|
44218
44201
|
reportDiagnostic: ts.noop
|
|
44219
44202
|
};
|
|
44203
|
+
}
|
|
44204
|
+
ts.getTemporaryModuleResolutionState = getTemporaryModuleResolutionState;
|
|
44205
|
+
/**
|
|
44206
|
+
* A function for locating the package.json scope for a given path
|
|
44207
|
+
*/
|
|
44208
|
+
/*@internal*/
|
|
44209
|
+
function getPackageScopeForPath(fileName, state) {
|
|
44220
44210
|
var parts = ts.getPathComponents(fileName);
|
|
44221
44211
|
parts.pop();
|
|
44222
44212
|
while (parts.length > 0) {
|
|
@@ -44387,7 +44377,7 @@ var ts;
|
|
|
44387
44377
|
var _a, _b;
|
|
44388
44378
|
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
44389
44379
|
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));
|
|
44390
|
-
var scope = getPackageScopeForPath(directoryPath, state
|
|
44380
|
+
var scope = getPackageScopeForPath(directoryPath, state);
|
|
44391
44381
|
if (!scope || !scope.packageJsonContent.exports) {
|
|
44392
44382
|
return undefined;
|
|
44393
44383
|
}
|
|
@@ -44446,7 +44436,7 @@ var ts;
|
|
|
44446
44436
|
}
|
|
44447
44437
|
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
44448
44438
|
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));
|
|
44449
|
-
var scope = getPackageScopeForPath(directoryPath, state
|
|
44439
|
+
var scope = getPackageScopeForPath(directoryPath, state);
|
|
44450
44440
|
if (!scope) {
|
|
44451
44441
|
if (state.traceEnabled) {
|
|
44452
44442
|
trace(state.host, ts.Diagnostics.Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve, directoryPath);
|
|
@@ -52906,6 +52896,12 @@ var ts;
|
|
|
52906
52896
|
return context.truncating = context.approximateLength > ((context.flags & 1 /* NoTruncation */) ? ts.noTruncationMaximumTruncationLength : ts.defaultMaximumTruncationLength);
|
|
52907
52897
|
}
|
|
52908
52898
|
function typeToTypeNodeHelper(type, context) {
|
|
52899
|
+
var savedFlags = context.flags;
|
|
52900
|
+
var typeNode = typeToTypeNodeWorker(type, context);
|
|
52901
|
+
context.flags = savedFlags;
|
|
52902
|
+
return typeNode;
|
|
52903
|
+
}
|
|
52904
|
+
function typeToTypeNodeWorker(type, context) {
|
|
52909
52905
|
if (cancellationToken && cancellationToken.throwIfCancellationRequested) {
|
|
52910
52906
|
cancellationToken.throwIfCancellationRequested();
|
|
52911
52907
|
}
|
|
@@ -59425,7 +59421,8 @@ var ts;
|
|
|
59425
59421
|
}
|
|
59426
59422
|
}
|
|
59427
59423
|
}
|
|
59428
|
-
|
|
59424
|
+
// The source types were normalized; ensure the result is normalized too.
|
|
59425
|
+
return getNormalizedType(getIntersectionType(constraints), /*writing*/ false);
|
|
59429
59426
|
}
|
|
59430
59427
|
return undefined;
|
|
59431
59428
|
}
|
|
@@ -62643,21 +62640,28 @@ var ts;
|
|
|
62643
62640
|
getFlowTypeOfReference(accessExpression, propType) :
|
|
62644
62641
|
propType;
|
|
62645
62642
|
}
|
|
62646
|
-
if (everyType(objectType, isTupleType) && ts.isNumericLiteralName(propName)
|
|
62643
|
+
if (everyType(objectType, isTupleType) && ts.isNumericLiteralName(propName)) {
|
|
62644
|
+
var index = +propName;
|
|
62647
62645
|
if (accessNode && everyType(objectType, function (t) { return !t.target.hasRestElement; }) && !(accessFlags & 16 /* NoTupleBoundsCheck */)) {
|
|
62648
62646
|
var indexNode = getIndexNodeForAccessExpression(accessNode);
|
|
62649
62647
|
if (isTupleType(objectType)) {
|
|
62648
|
+
if (index < 0) {
|
|
62649
|
+
error(indexNode, ts.Diagnostics.A_tuple_type_cannot_be_indexed_with_a_negative_value);
|
|
62650
|
+
return undefinedType;
|
|
62651
|
+
}
|
|
62650
62652
|
error(indexNode, ts.Diagnostics.Tuple_type_0_of_length_1_has_no_element_at_index_2, typeToString(objectType), getTypeReferenceArity(objectType), ts.unescapeLeadingUnderscores(propName));
|
|
62651
62653
|
}
|
|
62652
62654
|
else {
|
|
62653
62655
|
error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(propName), typeToString(objectType));
|
|
62654
62656
|
}
|
|
62655
62657
|
}
|
|
62656
|
-
|
|
62657
|
-
|
|
62658
|
-
|
|
62659
|
-
|
|
62660
|
-
|
|
62658
|
+
if (index >= 0) {
|
|
62659
|
+
errorIfWritingToReadonlyIndex(getIndexInfoOfType(objectType, numberType));
|
|
62660
|
+
return mapType(objectType, function (t) {
|
|
62661
|
+
var restType = getRestTypeOfTupleType(t) || undefinedType;
|
|
62662
|
+
return accessFlags & 1 /* IncludeUndefined */ ? getUnionType([restType, undefinedType]) : restType;
|
|
62663
|
+
});
|
|
62664
|
+
}
|
|
62661
62665
|
}
|
|
62662
62666
|
}
|
|
62663
62667
|
if (!(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 402653316 /* StringLike */ | 296 /* NumberLike */ | 12288 /* ESSymbolLike */)) {
|
|
@@ -80791,7 +80795,7 @@ var ts;
|
|
|
80791
80795
|
error(node.name, ts.Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name);
|
|
80792
80796
|
}
|
|
80793
80797
|
}
|
|
80794
|
-
if (node.questionToken && ts.isBindingPattern(node.name) && func.body) {
|
|
80798
|
+
if ((node.questionToken || isJSDocOptionalParameter(node)) && ts.isBindingPattern(node.name) && func.body) {
|
|
80795
80799
|
error(node, ts.Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature);
|
|
80796
80800
|
}
|
|
80797
80801
|
if (node.name && ts.isIdentifier(node.name) && (node.name.escapedText === "this" || node.name.escapedText === "new")) {
|
|
@@ -84668,8 +84672,9 @@ var ts;
|
|
|
84668
84672
|
}
|
|
84669
84673
|
var indexInfos = getApplicableIndexInfos(type, propNameType);
|
|
84670
84674
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
|
|
84671
|
-
var
|
|
84672
|
-
name && name.kind === 162 /* ComputedPropertyName */
|
|
84675
|
+
var propDeclaration = declaration && declaration.kind === 221 /* BinaryExpression */ ||
|
|
84676
|
+
name && name.kind === 162 /* ComputedPropertyName */ ? declaration : undefined;
|
|
84677
|
+
var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
|
|
84673
84678
|
var _loop_30 = function (info) {
|
|
84674
84679
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
84675
84680
|
// We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
|
|
@@ -84678,7 +84683,11 @@ var ts;
|
|
|
84678
84683
|
var errorNode = localPropDeclaration || localIndexDeclaration ||
|
|
84679
84684
|
(interfaceDeclaration && !ts.some(getBaseTypes(type), function (base) { return !!getPropertyOfObjectType(base, prop.escapedName) && !!getIndexTypeOfType(base, info.keyType); }) ? interfaceDeclaration : undefined);
|
|
84680
84685
|
if (errorNode && !isTypeAssignableTo(propType, info.type)) {
|
|
84681
|
-
|
|
84686
|
+
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));
|
|
84687
|
+
if (propDeclaration && errorNode !== propDeclaration) {
|
|
84688
|
+
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(propDeclaration, ts.Diagnostics._0_is_declared_here, symbolToString(prop)));
|
|
84689
|
+
}
|
|
84690
|
+
diagnostics.add(diagnostic);
|
|
84682
84691
|
}
|
|
84683
84692
|
};
|
|
84684
84693
|
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
|
|
@@ -96591,39 +96600,72 @@ var ts;
|
|
|
96591
96600
|
function visitClassDeclaration(node) {
|
|
96592
96601
|
if (!(ts.classOrConstructorParameterIsDecorated(node) || ts.childIsDecorated(node)))
|
|
96593
96602
|
return ts.visitEachChild(node, visitor, context);
|
|
96594
|
-
var
|
|
96595
|
-
|
|
96596
|
-
|
|
96597
|
-
var statements = [classStatement];
|
|
96598
|
-
// Write any decorators of the node.
|
|
96599
|
-
addClassElementDecorationStatements(statements, node, /*isStatic*/ false);
|
|
96600
|
-
addClassElementDecorationStatements(statements, node, /*isStatic*/ true);
|
|
96601
|
-
addConstructorDecorationStatement(statements, node);
|
|
96603
|
+
var statements = ts.hasDecorators(node) ?
|
|
96604
|
+
transformClassDeclarationWithClassDecorators(node, node.name) :
|
|
96605
|
+
transformClassDeclarationWithoutClassDecorators(node, node.name);
|
|
96602
96606
|
if (statements.length > 1) {
|
|
96603
96607
|
// Add a DeclarationMarker as a marker for the end of the declaration
|
|
96604
96608
|
statements.push(factory.createEndOfDeclarationMarker(node));
|
|
96605
|
-
ts.setEmitFlags(
|
|
96609
|
+
ts.setEmitFlags(statements[0], ts.getEmitFlags(statements[0]) | 4194304 /* HasEndOfDeclarationMarker */);
|
|
96606
96610
|
}
|
|
96607
96611
|
return ts.singleOrMany(statements);
|
|
96608
96612
|
}
|
|
96613
|
+
function decoratorContainsPrivateIdentifierInExpression(decorator) {
|
|
96614
|
+
return !!(decorator.transformFlags & 536870912 /* ContainsPrivateIdentifierInExpression */);
|
|
96615
|
+
}
|
|
96616
|
+
function parameterDecoratorsContainPrivateIdentifierInExpression(parameterDecorators) {
|
|
96617
|
+
return ts.some(parameterDecorators, decoratorContainsPrivateIdentifierInExpression);
|
|
96618
|
+
}
|
|
96619
|
+
function hasClassElementWithDecoratorContainingPrivateIdentifierInExpression(node) {
|
|
96620
|
+
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
96621
|
+
var member = _a[_i];
|
|
96622
|
+
if (!ts.canHaveDecorators(member))
|
|
96623
|
+
continue;
|
|
96624
|
+
var allDecorators = ts.getAllDecoratorsOfClassElement(member, node);
|
|
96625
|
+
if (ts.some(allDecorators === null || allDecorators === void 0 ? void 0 : allDecorators.decorators, decoratorContainsPrivateIdentifierInExpression))
|
|
96626
|
+
return true;
|
|
96627
|
+
if (ts.some(allDecorators === null || allDecorators === void 0 ? void 0 : allDecorators.parameters, parameterDecoratorsContainPrivateIdentifierInExpression))
|
|
96628
|
+
return true;
|
|
96629
|
+
}
|
|
96630
|
+
return false;
|
|
96631
|
+
}
|
|
96632
|
+
function transformDecoratorsOfClassElements(node, members) {
|
|
96633
|
+
var decorationStatements = [];
|
|
96634
|
+
addClassElementDecorationStatements(decorationStatements, node, /*isStatic*/ false);
|
|
96635
|
+
addClassElementDecorationStatements(decorationStatements, node, /*isStatic*/ true);
|
|
96636
|
+
if (hasClassElementWithDecoratorContainingPrivateIdentifierInExpression(node)) {
|
|
96637
|
+
members = ts.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray([], members, true), [
|
|
96638
|
+
factory.createClassStaticBlockDeclaration(factory.createBlock(decorationStatements, /*multiLine*/ true))
|
|
96639
|
+
], false)), members);
|
|
96640
|
+
decorationStatements = undefined;
|
|
96641
|
+
}
|
|
96642
|
+
return { decorationStatements: decorationStatements, members: members };
|
|
96643
|
+
}
|
|
96609
96644
|
/**
|
|
96610
96645
|
* Transforms a non-decorated class declaration.
|
|
96611
96646
|
*
|
|
96612
96647
|
* @param node A ClassDeclaration node.
|
|
96613
96648
|
* @param name The name of the class.
|
|
96614
96649
|
*/
|
|
96615
|
-
function
|
|
96650
|
+
function transformClassDeclarationWithoutClassDecorators(node, name) {
|
|
96616
96651
|
// ${modifiers} class ${name} ${heritageClauses} {
|
|
96617
96652
|
// ${members}
|
|
96618
96653
|
// }
|
|
96619
|
-
|
|
96620
|
-
|
|
96654
|
+
var _a;
|
|
96655
|
+
var modifiers = ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier);
|
|
96656
|
+
var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause);
|
|
96657
|
+
var members = ts.visitNodes(node.members, visitor, ts.isClassElement);
|
|
96658
|
+
var decorationStatements = [];
|
|
96659
|
+
(_a = transformDecoratorsOfClassElements(node, members), members = _a.members, decorationStatements = _a.decorationStatements);
|
|
96660
|
+
var updated = factory.updateClassDeclaration(node, modifiers, name,
|
|
96661
|
+
/*typeParameters*/ undefined, heritageClauses, members);
|
|
96662
|
+
return ts.addRange([updated], decorationStatements);
|
|
96621
96663
|
}
|
|
96622
96664
|
/**
|
|
96623
96665
|
* Transforms a decorated class declaration and appends the resulting statements. If
|
|
96624
96666
|
* the class requires an alias to avoid issues with double-binding, the alias is returned.
|
|
96625
96667
|
*/
|
|
96626
|
-
function
|
|
96668
|
+
function transformClassDeclarationWithClassDecorators(node, name) {
|
|
96627
96669
|
// When we emit an ES6 class that has a class decorator, we must tailor the
|
|
96628
96670
|
// emit to certain specific cases.
|
|
96629
96671
|
//
|
|
@@ -96709,6 +96751,7 @@ var ts;
|
|
|
96709
96751
|
// | var C_1;
|
|
96710
96752
|
// ---------------------------------------------------------------------
|
|
96711
96753
|
//
|
|
96754
|
+
var _a;
|
|
96712
96755
|
var location = ts.moveRangePastModifiers(node);
|
|
96713
96756
|
var classAlias = getClassAliasIfNeeded(node);
|
|
96714
96757
|
// When we transform to ES5/3 this will be moved inside an IIFE and should reference the name
|
|
@@ -96721,7 +96764,11 @@ var ts;
|
|
|
96721
96764
|
// }
|
|
96722
96765
|
var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause);
|
|
96723
96766
|
var members = ts.visitNodes(node.members, visitor, ts.isClassElement);
|
|
96724
|
-
var
|
|
96767
|
+
var decorationStatements = [];
|
|
96768
|
+
(_a = transformDecoratorsOfClassElements(node, members), members = _a.members, decorationStatements = _a.decorationStatements);
|
|
96769
|
+
var classExpression = factory.createClassExpression(
|
|
96770
|
+
/*modifiers*/ undefined, name,
|
|
96771
|
+
/*typeParameters*/ undefined, heritageClauses, members);
|
|
96725
96772
|
ts.setOriginalNode(classExpression, node);
|
|
96726
96773
|
ts.setTextRange(classExpression, location);
|
|
96727
96774
|
// let ${name} = ${classExpression} where name is either declaredName if the class doesn't contain self-reference
|
|
@@ -96735,7 +96782,10 @@ var ts;
|
|
|
96735
96782
|
ts.setOriginalNode(statement, node);
|
|
96736
96783
|
ts.setTextRange(statement, location);
|
|
96737
96784
|
ts.setCommentRange(statement, node);
|
|
96738
|
-
|
|
96785
|
+
var statements = [statement];
|
|
96786
|
+
ts.addRange(statements, decorationStatements);
|
|
96787
|
+
addConstructorDecorationStatement(statements, node);
|
|
96788
|
+
return statements;
|
|
96739
96789
|
}
|
|
96740
96790
|
function visitClassExpression(node) {
|
|
96741
96791
|
// Legacy decorators were not supported on class expressions
|
|
@@ -117663,7 +117713,7 @@ var ts;
|
|
|
117663
117713
|
return undefined;
|
|
117664
117714
|
}
|
|
117665
117715
|
function lookupFromPackageJson() {
|
|
117666
|
-
var scope = ts.getPackageScopeForPath(fileName, packageJsonInfoCache, host, options);
|
|
117716
|
+
var scope = ts.getPackageScopeForPath(fileName, ts.getTemporaryModuleResolutionState(packageJsonInfoCache, host, options));
|
|
117667
117717
|
return (scope === null || scope === void 0 ? void 0 : scope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
117668
117718
|
}
|
|
117669
117719
|
}
|
|
@@ -118329,7 +118379,7 @@ var ts;
|
|
|
118329
118379
|
// `result[i]` is either a `ResolvedModuleFull` or a marker.
|
|
118330
118380
|
// If it is the former, we can leave it as is.
|
|
118331
118381
|
if (result[i] === predictedToResolveToAmbientModuleMarker) {
|
|
118332
|
-
result[i] = undefined;
|
|
118382
|
+
result[i] = undefined;
|
|
118333
118383
|
}
|
|
118334
118384
|
}
|
|
118335
118385
|
else {
|
|
@@ -148626,6 +148676,7 @@ var ts;
|
|
|
148626
148676
|
var options = _a.options, getRules = _a.getRules, host = _a.host;
|
|
148627
148677
|
// formatting context is used by rules provider
|
|
148628
148678
|
var formattingContext = new formatting.FormattingContext(sourceFile, requestKind, options);
|
|
148679
|
+
var previousRangeTriviaEnd;
|
|
148629
148680
|
var previousRange;
|
|
148630
148681
|
var previousParent;
|
|
148631
148682
|
var previousRangeStartLine;
|
|
@@ -148654,10 +148705,30 @@ var ts;
|
|
|
148654
148705
|
}
|
|
148655
148706
|
}
|
|
148656
148707
|
if (previousRange && formattingScanner.getStartPos() >= originalRange.end) {
|
|
148708
|
+
// Formatting edits happen by looking at pairs of contiguous tokens (see `processPair`),
|
|
148709
|
+
// typically inserting or deleting whitespace between them. The recursive `processNode`
|
|
148710
|
+
// logic above bails out as soon as it encounters a token that is beyond the end of the
|
|
148711
|
+
// range we're supposed to format (or if we reach the end of the file). But this potentially
|
|
148712
|
+
// leaves out an edit that would occur *inside* the requested range but cannot be discovered
|
|
148713
|
+
// without looking at one token *beyond* the end of the range: consider the line `x = { }`
|
|
148714
|
+
// with a selection from the beginning of the line to the space inside the curly braces,
|
|
148715
|
+
// inclusive. We would expect a format-selection would delete the space (if rules apply),
|
|
148716
|
+
// but in order to do that, we need to process the pair ["{", "}"], but we stopped processing
|
|
148717
|
+
// just before getting there. This block handles this trailing edit.
|
|
148657
148718
|
var tokenInfo = formattingScanner.isOnEOF() ? formattingScanner.readEOFTokenRange() :
|
|
148658
148719
|
formattingScanner.isOnToken() ? formattingScanner.readTokenInfo(enclosingNode).token :
|
|
148659
148720
|
undefined;
|
|
148660
|
-
if (tokenInfo) {
|
|
148721
|
+
if (tokenInfo && tokenInfo.pos === previousRangeTriviaEnd) {
|
|
148722
|
+
// We need to check that tokenInfo and previousRange are contiguous: the `originalRange`
|
|
148723
|
+
// may have ended in the middle of a token, which means we will have stopped formatting
|
|
148724
|
+
// on that token, leaving `previousRange` pointing to the token before it, but already
|
|
148725
|
+
// having moved the formatting scanner (where we just got `tokenInfo`) to the next token.
|
|
148726
|
+
// If this happens, our supposed pair [previousRange, tokenInfo] actually straddles the
|
|
148727
|
+
// token that intersects the end of the range we're supposed to format, so the pair will
|
|
148728
|
+
// produce bogus edits if we try to `processPair`. Recall that the point of this logic is
|
|
148729
|
+
// to perform a trailing edit at the end of the selection range: but there can be no valid
|
|
148730
|
+
// edit in the middle of a token where the range ended, so if we have a non-contiguous
|
|
148731
|
+
// pair here, we're already done and we can ignore it.
|
|
148661
148732
|
var parent = ((_b = ts.findPrecedingToken(tokenInfo.end, sourceFile, enclosingNode)) === null || _b === void 0 ? void 0 : _b.parent) || previousParent;
|
|
148662
148733
|
processPair(tokenInfo, sourceFile.getLineAndCharacterOfPosition(tokenInfo.pos).line, parent, previousRange, previousRangeStartLine, previousParent, parent,
|
|
148663
148734
|
/*dynamicIndentation*/ undefined);
|
|
@@ -149015,6 +149086,7 @@ var ts;
|
|
|
149015
149086
|
}
|
|
149016
149087
|
}
|
|
149017
149088
|
if (currentTokenInfo.trailingTrivia) {
|
|
149089
|
+
previousRangeTriviaEnd = ts.last(currentTokenInfo.trailingTrivia).end;
|
|
149018
149090
|
processTrivia(currentTokenInfo.trailingTrivia, parent, childContextNode, dynamicIndentation);
|
|
149019
149091
|
}
|
|
149020
149092
|
if (indentToken) {
|
|
@@ -149085,6 +149157,7 @@ var ts;
|
|
|
149085
149157
|
}
|
|
149086
149158
|
}
|
|
149087
149159
|
previousRange = range;
|
|
149160
|
+
previousRangeTriviaEnd = range.end;
|
|
149088
149161
|
previousParent = parent;
|
|
149089
149162
|
previousRangeStartLine = rangeStart.line;
|
|
149090
149163
|
return lineAction;
|
|
@@ -163653,7 +163726,7 @@ var ts;
|
|
|
163653
163726
|
var usage = getUsageInfo(oldFile, toMove.all, checker);
|
|
163654
163727
|
var currentDirectory = ts.getDirectoryPath(oldFile.fileName);
|
|
163655
163728
|
var extension = ts.extensionFromPath(oldFile.fileName);
|
|
163656
|
-
var newModuleName = makeUniqueModuleName(getNewModuleName(usage.movedSymbols), extension, currentDirectory, host);
|
|
163729
|
+
var newModuleName = makeUniqueModuleName(getNewModuleName(usage.oldFileImportsFromNewFile, usage.movedSymbols), extension, currentDirectory, host);
|
|
163657
163730
|
var newFileNameWithExtension = newModuleName + extension;
|
|
163658
163731
|
// If previous file was global, this is easy.
|
|
163659
163732
|
changes.createNewFile(oldFile, ts.combinePaths(currentDirectory, newFileNameWithExtension), getNewStatementsAndRemoveFromOldFile(oldFile, usage, changes, toMove, program, newModuleName, preferences));
|
|
@@ -164017,8 +164090,8 @@ var ts;
|
|
|
164017
164090
|
newModuleName = moduleName + "." + i;
|
|
164018
164091
|
}
|
|
164019
164092
|
}
|
|
164020
|
-
function getNewModuleName(movedSymbols) {
|
|
164021
|
-
return movedSymbols.forEachEntry(ts.symbolNameNoDefault) || "newFile";
|
|
164093
|
+
function getNewModuleName(importsFromNewFile, movedSymbols) {
|
|
164094
|
+
return importsFromNewFile.forEachEntry(ts.symbolNameNoDefault) || movedSymbols.forEachEntry(ts.symbolNameNoDefault) || "newFile";
|
|
164022
164095
|
}
|
|
164023
164096
|
function getUsageInfo(oldFile, toMove, checker) {
|
|
164024
164097
|
var movedSymbols = new SymbolSet();
|
|
@@ -178434,7 +178507,7 @@ var ts;
|
|
|
178434
178507
|
var packageDirectory = fileName.substring(0, nodeModulesPathParts.packageRootIndex);
|
|
178435
178508
|
var packageJsonCache = (_a = project.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfoCache();
|
|
178436
178509
|
var compilerOptions = project.getCompilationSettings();
|
|
178437
|
-
var packageJson = ts.getPackageScopeForPath(project.toPath(packageDirectory + "/package.json"), packageJsonCache, project, compilerOptions);
|
|
178510
|
+
var packageJson = ts.getPackageScopeForPath(project.toPath(packageDirectory + "/package.json"), ts.getTemporaryModuleResolutionState(packageJsonCache, project, compilerOptions));
|
|
178438
178511
|
if (!packageJson)
|
|
178439
178512
|
return undefined;
|
|
178440
178513
|
// Use fake options instead of actual compiler options to avoid following export map if the project uses node16 or nodenext -
|