typescript 4.8.0-dev.20220728 → 4.8.0-dev.20220729
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +41 -40
- package/lib/tsserver.js +70 -45
- package/lib/tsserverlibrary.js +70 -45
- package/lib/typescript.js +69 -44
- package/lib/typescriptServices.js +69 -44
- package/lib/typingsInstaller.js +45 -43
- 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.20220729";
|
|
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;
|
|
@@ -8976,6 +8980,7 @@ var ts;
|
|
|
8976
8980
|
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
8981
|
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
8982
|
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."),
|
|
8983
|
+
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
8984
|
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
8985
|
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
8986
|
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."),
|
|
@@ -43330,18 +43335,7 @@ var ts;
|
|
|
43330
43335
|
* Does not try `@types/${packageName}` - use a second pass if needed.
|
|
43331
43336
|
*/
|
|
43332
43337
|
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
|
-
};
|
|
43338
|
+
var moduleResolutionState = getTemporaryModuleResolutionState(cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(), host, options);
|
|
43345
43339
|
return ts.forEachAncestorDirectory(containingDirectory, function (ancestorDirectory) {
|
|
43346
43340
|
if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
43347
43341
|
var nodeModulesFolder = ts.combinePaths(ancestorDirectory, "node_modules");
|
|
@@ -44301,18 +44295,9 @@ var ts;
|
|
|
44301
44295
|
var entrypoints;
|
|
44302
44296
|
var extensions = resolveJs ? Extensions.JavaScript : Extensions.TypeScript;
|
|
44303
44297
|
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
|
-
};
|
|
44298
|
+
var requireState = getTemporaryModuleResolutionState(cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(), host, options);
|
|
44299
|
+
requireState.conditions = ["node", "require", "types"];
|
|
44300
|
+
requireState.requestContainingDirectory = packageJsonInfo.packageDirectory;
|
|
44316
44301
|
var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory,
|
|
44317
44302
|
/*onlyRecordFailures*/ false, requireState, packageJsonInfo.packageJsonContent, packageJsonInfo.versionPaths);
|
|
44318
44303
|
entrypoints = ts.append(entrypoints, requireResolution === null || requireResolution === void 0 ? void 0 : requireResolution.path);
|
|
@@ -44385,23 +44370,27 @@ var ts;
|
|
|
44385
44370
|
}
|
|
44386
44371
|
}
|
|
44387
44372
|
}
|
|
44388
|
-
/**
|
|
44389
|
-
* A function for locating the package.json scope for a given path
|
|
44390
|
-
*/
|
|
44391
44373
|
/*@internal*/
|
|
44392
|
-
function
|
|
44393
|
-
|
|
44374
|
+
function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options) {
|
|
44375
|
+
return {
|
|
44394
44376
|
host: host,
|
|
44395
44377
|
compilerOptions: options,
|
|
44396
44378
|
traceEnabled: isTraceEnabled(options, host),
|
|
44397
|
-
failedLookupLocations:
|
|
44398
|
-
affectingLocations:
|
|
44379
|
+
failedLookupLocations: ts.noopPush,
|
|
44380
|
+
affectingLocations: ts.noopPush,
|
|
44399
44381
|
packageJsonInfoCache: packageJsonInfoCache,
|
|
44400
|
-
features:
|
|
44401
|
-
conditions:
|
|
44382
|
+
features: NodeResolutionFeatures.None,
|
|
44383
|
+
conditions: ts.emptyArray,
|
|
44402
44384
|
requestContainingDirectory: undefined,
|
|
44403
44385
|
reportDiagnostic: ts.noop
|
|
44404
44386
|
};
|
|
44387
|
+
}
|
|
44388
|
+
ts.getTemporaryModuleResolutionState = getTemporaryModuleResolutionState;
|
|
44389
|
+
/**
|
|
44390
|
+
* A function for locating the package.json scope for a given path
|
|
44391
|
+
*/
|
|
44392
|
+
/*@internal*/
|
|
44393
|
+
function getPackageScopeForPath(fileName, state) {
|
|
44405
44394
|
var parts = ts.getPathComponents(fileName);
|
|
44406
44395
|
parts.pop();
|
|
44407
44396
|
while (parts.length > 0) {
|
|
@@ -44572,7 +44561,7 @@ var ts;
|
|
|
44572
44561
|
var _a, _b;
|
|
44573
44562
|
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
44574
44563
|
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
|
|
44564
|
+
var scope = getPackageScopeForPath(directoryPath, state);
|
|
44576
44565
|
if (!scope || !scope.packageJsonContent.exports) {
|
|
44577
44566
|
return undefined;
|
|
44578
44567
|
}
|
|
@@ -44631,7 +44620,7 @@ var ts;
|
|
|
44631
44620
|
}
|
|
44632
44621
|
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
44633
44622
|
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
|
|
44623
|
+
var scope = getPackageScopeForPath(directoryPath, state);
|
|
44635
44624
|
if (!scope) {
|
|
44636
44625
|
if (state.traceEnabled) {
|
|
44637
44626
|
trace(state.host, ts.Diagnostics.Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve, directoryPath);
|
|
@@ -53091,6 +53080,12 @@ var ts;
|
|
|
53091
53080
|
return context.truncating = context.approximateLength > ((context.flags & 1 /* NoTruncation */) ? ts.noTruncationMaximumTruncationLength : ts.defaultMaximumTruncationLength);
|
|
53092
53081
|
}
|
|
53093
53082
|
function typeToTypeNodeHelper(type, context) {
|
|
53083
|
+
var savedFlags = context.flags;
|
|
53084
|
+
var typeNode = typeToTypeNodeWorker(type, context);
|
|
53085
|
+
context.flags = savedFlags;
|
|
53086
|
+
return typeNode;
|
|
53087
|
+
}
|
|
53088
|
+
function typeToTypeNodeWorker(type, context) {
|
|
53094
53089
|
if (cancellationToken && cancellationToken.throwIfCancellationRequested) {
|
|
53095
53090
|
cancellationToken.throwIfCancellationRequested();
|
|
53096
53091
|
}
|
|
@@ -62829,21 +62824,28 @@ var ts;
|
|
|
62829
62824
|
getFlowTypeOfReference(accessExpression, propType) :
|
|
62830
62825
|
propType;
|
|
62831
62826
|
}
|
|
62832
|
-
if (everyType(objectType, isTupleType) && ts.isNumericLiteralName(propName)
|
|
62827
|
+
if (everyType(objectType, isTupleType) && ts.isNumericLiteralName(propName)) {
|
|
62828
|
+
var index = +propName;
|
|
62833
62829
|
if (accessNode && everyType(objectType, function (t) { return !t.target.hasRestElement; }) && !(accessFlags & 16 /* NoTupleBoundsCheck */)) {
|
|
62834
62830
|
var indexNode = getIndexNodeForAccessExpression(accessNode);
|
|
62835
62831
|
if (isTupleType(objectType)) {
|
|
62832
|
+
if (index < 0) {
|
|
62833
|
+
error(indexNode, ts.Diagnostics.A_tuple_type_cannot_be_indexed_with_a_negative_value);
|
|
62834
|
+
return undefinedType;
|
|
62835
|
+
}
|
|
62836
62836
|
error(indexNode, ts.Diagnostics.Tuple_type_0_of_length_1_has_no_element_at_index_2, typeToString(objectType), getTypeReferenceArity(objectType), ts.unescapeLeadingUnderscores(propName));
|
|
62837
62837
|
}
|
|
62838
62838
|
else {
|
|
62839
62839
|
error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(propName), typeToString(objectType));
|
|
62840
62840
|
}
|
|
62841
62841
|
}
|
|
62842
|
-
|
|
62843
|
-
|
|
62844
|
-
|
|
62845
|
-
|
|
62846
|
-
|
|
62842
|
+
if (index >= 0) {
|
|
62843
|
+
errorIfWritingToReadonlyIndex(getIndexInfoOfType(objectType, numberType));
|
|
62844
|
+
return mapType(objectType, function (t) {
|
|
62845
|
+
var restType = getRestTypeOfTupleType(t) || undefinedType;
|
|
62846
|
+
return accessFlags & 1 /* IncludeUndefined */ ? getUnionType([restType, undefinedType]) : restType;
|
|
62847
|
+
});
|
|
62848
|
+
}
|
|
62847
62849
|
}
|
|
62848
62850
|
}
|
|
62849
62851
|
if (!(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 402653316 /* StringLike */ | 296 /* NumberLike */ | 12288 /* ESSymbolLike */)) {
|
|
@@ -117854,7 +117856,7 @@ var ts;
|
|
|
117854
117856
|
return undefined;
|
|
117855
117857
|
}
|
|
117856
117858
|
function lookupFromPackageJson() {
|
|
117857
|
-
var scope = ts.getPackageScopeForPath(fileName, packageJsonInfoCache, host, options);
|
|
117859
|
+
var scope = ts.getPackageScopeForPath(fileName, ts.getTemporaryModuleResolutionState(packageJsonInfoCache, host, options));
|
|
117858
117860
|
return (scope === null || scope === void 0 ? void 0 : scope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
117859
117861
|
}
|
|
117860
117862
|
}
|
|
@@ -149236,6 +149238,7 @@ var ts;
|
|
|
149236
149238
|
var options = _a.options, getRules = _a.getRules, host = _a.host;
|
|
149237
149239
|
// formatting context is used by rules provider
|
|
149238
149240
|
var formattingContext = new formatting.FormattingContext(sourceFile, requestKind, options);
|
|
149241
|
+
var previousRangeTriviaEnd;
|
|
149239
149242
|
var previousRange;
|
|
149240
149243
|
var previousParent;
|
|
149241
149244
|
var previousRangeStartLine;
|
|
@@ -149264,10 +149267,30 @@ var ts;
|
|
|
149264
149267
|
}
|
|
149265
149268
|
}
|
|
149266
149269
|
if (previousRange && formattingScanner.getStartPos() >= originalRange.end) {
|
|
149270
|
+
// Formatting edits happen by looking at pairs of contiguous tokens (see `processPair`),
|
|
149271
|
+
// typically inserting or deleting whitespace between them. The recursive `processNode`
|
|
149272
|
+
// logic above bails out as soon as it encounters a token that is beyond the end of the
|
|
149273
|
+
// range we're supposed to format (or if we reach the end of the file). But this potentially
|
|
149274
|
+
// leaves out an edit that would occur *inside* the requested range but cannot be discovered
|
|
149275
|
+
// without looking at one token *beyond* the end of the range: consider the line `x = { }`
|
|
149276
|
+
// with a selection from the beginning of the line to the space inside the curly braces,
|
|
149277
|
+
// inclusive. We would expect a format-selection would delete the space (if rules apply),
|
|
149278
|
+
// but in order to do that, we need to process the pair ["{", "}"], but we stopped processing
|
|
149279
|
+
// just before getting there. This block handles this trailing edit.
|
|
149267
149280
|
var tokenInfo = formattingScanner.isOnEOF() ? formattingScanner.readEOFTokenRange() :
|
|
149268
149281
|
formattingScanner.isOnToken() ? formattingScanner.readTokenInfo(enclosingNode).token :
|
|
149269
149282
|
undefined;
|
|
149270
|
-
if (tokenInfo) {
|
|
149283
|
+
if (tokenInfo && tokenInfo.pos === previousRangeTriviaEnd) {
|
|
149284
|
+
// We need to check that tokenInfo and previousRange are contiguous: the `originalRange`
|
|
149285
|
+
// may have ended in the middle of a token, which means we will have stopped formatting
|
|
149286
|
+
// on that token, leaving `previousRange` pointing to the token before it, but already
|
|
149287
|
+
// having moved the formatting scanner (where we just got `tokenInfo`) to the next token.
|
|
149288
|
+
// If this happens, our supposed pair [previousRange, tokenInfo] actually straddles the
|
|
149289
|
+
// token that intersects the end of the range we're supposed to format, so the pair will
|
|
149290
|
+
// produce bogus edits if we try to `processPair`. Recall that the point of this logic is
|
|
149291
|
+
// to perform a trailing edit at the end of the selection range: but there can be no valid
|
|
149292
|
+
// edit in the middle of a token where the range ended, so if we have a non-contiguous
|
|
149293
|
+
// pair here, we're already done and we can ignore it.
|
|
149271
149294
|
var parent = ((_b = ts.findPrecedingToken(tokenInfo.end, sourceFile, enclosingNode)) === null || _b === void 0 ? void 0 : _b.parent) || previousParent;
|
|
149272
149295
|
processPair(tokenInfo, sourceFile.getLineAndCharacterOfPosition(tokenInfo.pos).line, parent, previousRange, previousRangeStartLine, previousParent, parent,
|
|
149273
149296
|
/*dynamicIndentation*/ undefined);
|
|
@@ -149625,6 +149648,7 @@ var ts;
|
|
|
149625
149648
|
}
|
|
149626
149649
|
}
|
|
149627
149650
|
if (currentTokenInfo.trailingTrivia) {
|
|
149651
|
+
previousRangeTriviaEnd = ts.last(currentTokenInfo.trailingTrivia).end;
|
|
149628
149652
|
processTrivia(currentTokenInfo.trailingTrivia, parent, childContextNode, dynamicIndentation);
|
|
149629
149653
|
}
|
|
149630
149654
|
if (indentToken) {
|
|
@@ -149695,6 +149719,7 @@ var ts;
|
|
|
149695
149719
|
}
|
|
149696
149720
|
}
|
|
149697
149721
|
previousRange = range;
|
|
149722
|
+
previousRangeTriviaEnd = range.end;
|
|
149698
149723
|
previousParent = parent;
|
|
149699
149724
|
previousRangeStartLine = rangeStart.line;
|
|
149700
149725
|
return lineAction;
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220729";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -1690,6 +1690,10 @@ var ts;
|
|
|
1690
1690
|
/** Does nothing. */
|
|
1691
1691
|
function noop(_) { }
|
|
1692
1692
|
ts.noop = noop;
|
|
1693
|
+
ts.noopPush = {
|
|
1694
|
+
push: noop,
|
|
1695
|
+
length: 0
|
|
1696
|
+
};
|
|
1693
1697
|
/** Do nothing and return false */
|
|
1694
1698
|
function returnFalse() {
|
|
1695
1699
|
return false;
|
|
@@ -8771,6 +8775,7 @@ var ts;
|
|
|
8771
8775
|
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."),
|
|
8772
8776
|
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."),
|
|
8773
8777
|
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."),
|
|
8778
|
+
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."),
|
|
8774
8779
|
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}'."),
|
|
8775
8780
|
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."),
|
|
8776
8781
|
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."),
|
|
@@ -43125,18 +43130,7 @@ var ts;
|
|
|
43125
43130
|
* Does not try `@types/${packageName}` - use a second pass if needed.
|
|
43126
43131
|
*/
|
|
43127
43132
|
function resolvePackageNameToPackageJson(packageName, containingDirectory, options, host, cache) {
|
|
43128
|
-
var moduleResolutionState =
|
|
43129
|
-
compilerOptions: options,
|
|
43130
|
-
host: host,
|
|
43131
|
-
traceEnabled: isTraceEnabled(options, host),
|
|
43132
|
-
failedLookupLocations: [],
|
|
43133
|
-
affectingLocations: [],
|
|
43134
|
-
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
43135
|
-
conditions: ts.emptyArray,
|
|
43136
|
-
features: NodeResolutionFeatures.None,
|
|
43137
|
-
requestContainingDirectory: containingDirectory,
|
|
43138
|
-
reportDiagnostic: ts.noop
|
|
43139
|
-
};
|
|
43133
|
+
var moduleResolutionState = getTemporaryModuleResolutionState(cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(), host, options);
|
|
43140
43134
|
return ts.forEachAncestorDirectory(containingDirectory, function (ancestorDirectory) {
|
|
43141
43135
|
if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
43142
43136
|
var nodeModulesFolder = ts.combinePaths(ancestorDirectory, "node_modules");
|
|
@@ -44096,18 +44090,9 @@ var ts;
|
|
|
44096
44090
|
var entrypoints;
|
|
44097
44091
|
var extensions = resolveJs ? Extensions.JavaScript : Extensions.TypeScript;
|
|
44098
44092
|
var features = getDefaultNodeResolutionFeatures(options);
|
|
44099
|
-
var requireState =
|
|
44100
|
-
|
|
44101
|
-
|
|
44102
|
-
traceEnabled: isTraceEnabled(options, host),
|
|
44103
|
-
failedLookupLocations: [],
|
|
44104
|
-
affectingLocations: [],
|
|
44105
|
-
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
44106
|
-
conditions: ["node", "require", "types"],
|
|
44107
|
-
features: features,
|
|
44108
|
-
requestContainingDirectory: packageJsonInfo.packageDirectory,
|
|
44109
|
-
reportDiagnostic: ts.noop
|
|
44110
|
-
};
|
|
44093
|
+
var requireState = getTemporaryModuleResolutionState(cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(), host, options);
|
|
44094
|
+
requireState.conditions = ["node", "require", "types"];
|
|
44095
|
+
requireState.requestContainingDirectory = packageJsonInfo.packageDirectory;
|
|
44111
44096
|
var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory,
|
|
44112
44097
|
/*onlyRecordFailures*/ false, requireState, packageJsonInfo.packageJsonContent, packageJsonInfo.versionPaths);
|
|
44113
44098
|
entrypoints = ts.append(entrypoints, requireResolution === null || requireResolution === void 0 ? void 0 : requireResolution.path);
|
|
@@ -44180,23 +44165,27 @@ var ts;
|
|
|
44180
44165
|
}
|
|
44181
44166
|
}
|
|
44182
44167
|
}
|
|
44183
|
-
/**
|
|
44184
|
-
* A function for locating the package.json scope for a given path
|
|
44185
|
-
*/
|
|
44186
44168
|
/*@internal*/
|
|
44187
|
-
function
|
|
44188
|
-
|
|
44169
|
+
function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options) {
|
|
44170
|
+
return {
|
|
44189
44171
|
host: host,
|
|
44190
44172
|
compilerOptions: options,
|
|
44191
44173
|
traceEnabled: isTraceEnabled(options, host),
|
|
44192
|
-
failedLookupLocations:
|
|
44193
|
-
affectingLocations:
|
|
44174
|
+
failedLookupLocations: ts.noopPush,
|
|
44175
|
+
affectingLocations: ts.noopPush,
|
|
44194
44176
|
packageJsonInfoCache: packageJsonInfoCache,
|
|
44195
|
-
features:
|
|
44196
|
-
conditions:
|
|
44177
|
+
features: NodeResolutionFeatures.None,
|
|
44178
|
+
conditions: ts.emptyArray,
|
|
44197
44179
|
requestContainingDirectory: undefined,
|
|
44198
44180
|
reportDiagnostic: ts.noop
|
|
44199
44181
|
};
|
|
44182
|
+
}
|
|
44183
|
+
ts.getTemporaryModuleResolutionState = getTemporaryModuleResolutionState;
|
|
44184
|
+
/**
|
|
44185
|
+
* A function for locating the package.json scope for a given path
|
|
44186
|
+
*/
|
|
44187
|
+
/*@internal*/
|
|
44188
|
+
function getPackageScopeForPath(fileName, state) {
|
|
44200
44189
|
var parts = ts.getPathComponents(fileName);
|
|
44201
44190
|
parts.pop();
|
|
44202
44191
|
while (parts.length > 0) {
|
|
@@ -44367,7 +44356,7 @@ var ts;
|
|
|
44367
44356
|
var _a, _b;
|
|
44368
44357
|
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
44369
44358
|
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));
|
|
44370
|
-
var scope = getPackageScopeForPath(directoryPath, state
|
|
44359
|
+
var scope = getPackageScopeForPath(directoryPath, state);
|
|
44371
44360
|
if (!scope || !scope.packageJsonContent.exports) {
|
|
44372
44361
|
return undefined;
|
|
44373
44362
|
}
|
|
@@ -44426,7 +44415,7 @@ var ts;
|
|
|
44426
44415
|
}
|
|
44427
44416
|
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
44428
44417
|
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));
|
|
44429
|
-
var scope = getPackageScopeForPath(directoryPath, state
|
|
44418
|
+
var scope = getPackageScopeForPath(directoryPath, state);
|
|
44430
44419
|
if (!scope) {
|
|
44431
44420
|
if (state.traceEnabled) {
|
|
44432
44421
|
trace(state.host, ts.Diagnostics.Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve, directoryPath);
|
|
@@ -52886,6 +52875,12 @@ var ts;
|
|
|
52886
52875
|
return context.truncating = context.approximateLength > ((context.flags & 1 /* NoTruncation */) ? ts.noTruncationMaximumTruncationLength : ts.defaultMaximumTruncationLength);
|
|
52887
52876
|
}
|
|
52888
52877
|
function typeToTypeNodeHelper(type, context) {
|
|
52878
|
+
var savedFlags = context.flags;
|
|
52879
|
+
var typeNode = typeToTypeNodeWorker(type, context);
|
|
52880
|
+
context.flags = savedFlags;
|
|
52881
|
+
return typeNode;
|
|
52882
|
+
}
|
|
52883
|
+
function typeToTypeNodeWorker(type, context) {
|
|
52889
52884
|
if (cancellationToken && cancellationToken.throwIfCancellationRequested) {
|
|
52890
52885
|
cancellationToken.throwIfCancellationRequested();
|
|
52891
52886
|
}
|
|
@@ -62624,21 +62619,28 @@ var ts;
|
|
|
62624
62619
|
getFlowTypeOfReference(accessExpression, propType) :
|
|
62625
62620
|
propType;
|
|
62626
62621
|
}
|
|
62627
|
-
if (everyType(objectType, isTupleType) && ts.isNumericLiteralName(propName)
|
|
62622
|
+
if (everyType(objectType, isTupleType) && ts.isNumericLiteralName(propName)) {
|
|
62623
|
+
var index = +propName;
|
|
62628
62624
|
if (accessNode && everyType(objectType, function (t) { return !t.target.hasRestElement; }) && !(accessFlags & 16 /* NoTupleBoundsCheck */)) {
|
|
62629
62625
|
var indexNode = getIndexNodeForAccessExpression(accessNode);
|
|
62630
62626
|
if (isTupleType(objectType)) {
|
|
62627
|
+
if (index < 0) {
|
|
62628
|
+
error(indexNode, ts.Diagnostics.A_tuple_type_cannot_be_indexed_with_a_negative_value);
|
|
62629
|
+
return undefinedType;
|
|
62630
|
+
}
|
|
62631
62631
|
error(indexNode, ts.Diagnostics.Tuple_type_0_of_length_1_has_no_element_at_index_2, typeToString(objectType), getTypeReferenceArity(objectType), ts.unescapeLeadingUnderscores(propName));
|
|
62632
62632
|
}
|
|
62633
62633
|
else {
|
|
62634
62634
|
error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(propName), typeToString(objectType));
|
|
62635
62635
|
}
|
|
62636
62636
|
}
|
|
62637
|
-
|
|
62638
|
-
|
|
62639
|
-
|
|
62640
|
-
|
|
62641
|
-
|
|
62637
|
+
if (index >= 0) {
|
|
62638
|
+
errorIfWritingToReadonlyIndex(getIndexInfoOfType(objectType, numberType));
|
|
62639
|
+
return mapType(objectType, function (t) {
|
|
62640
|
+
var restType = getRestTypeOfTupleType(t) || undefinedType;
|
|
62641
|
+
return accessFlags & 1 /* IncludeUndefined */ ? getUnionType([restType, undefinedType]) : restType;
|
|
62642
|
+
});
|
|
62643
|
+
}
|
|
62642
62644
|
}
|
|
62643
62645
|
}
|
|
62644
62646
|
if (!(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 402653316 /* StringLike */ | 296 /* NumberLike */ | 12288 /* ESSymbolLike */)) {
|
|
@@ -117649,7 +117651,7 @@ var ts;
|
|
|
117649
117651
|
return undefined;
|
|
117650
117652
|
}
|
|
117651
117653
|
function lookupFromPackageJson() {
|
|
117652
|
-
var scope = ts.getPackageScopeForPath(fileName, packageJsonInfoCache, host, options);
|
|
117654
|
+
var scope = ts.getPackageScopeForPath(fileName, ts.getTemporaryModuleResolutionState(packageJsonInfoCache, host, options));
|
|
117653
117655
|
return (scope === null || scope === void 0 ? void 0 : scope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
117654
117656
|
}
|
|
117655
117657
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "4.8.0-dev.
|
|
5
|
+
"version": "4.8.0-dev.20220729",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|