typescript 5.7.0-dev.20240925 → 5.7.0-dev.20240926
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 +56 -16
- package/lib/typescript.js +60 -16
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.7";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240926`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -48696,7 +48696,7 @@ function createTypeChecker(host) {
|
|
|
48696
48696
|
return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, !ignoreErrors ? moduleReferenceExpression : void 0, isForAugmentation) : void 0;
|
|
48697
48697
|
}
|
|
48698
48698
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
|
|
48699
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k
|
|
48699
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
48700
48700
|
if (errorNode && startsWith(moduleReference, "@types/")) {
|
|
48701
48701
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
48702
48702
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
@@ -48711,14 +48711,14 @@ function createTypeChecker(host) {
|
|
|
48711
48711
|
return ambientModule;
|
|
48712
48712
|
}
|
|
48713
48713
|
const currentSourceFile = getSourceFileOfNode(location);
|
|
48714
|
-
const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _a.name) || ((_b = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _b.argument.literal) || (
|
|
48714
|
+
const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _a.name) || ((_b = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _b.argument.literal) || (isVariableDeclaration(location) && location.initializer && isRequireCall(
|
|
48715
48715
|
location.initializer,
|
|
48716
48716
|
/*requireStringLiteralLikeArgument*/
|
|
48717
48717
|
true
|
|
48718
|
-
) ? location.initializer.arguments[0] : void 0) || ((_c = findAncestor(location, isImportCall)) == null ? void 0 : _c.arguments[0]) || ((_d = findAncestor(location, isImportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _e.moduleReference.expression)
|
|
48718
|
+
) ? location.initializer.arguments[0] : void 0) || ((_c = findAncestor(location, isImportCall)) == null ? void 0 : _c.arguments[0]) || ((_d = findAncestor(location, or(isImportDeclaration, isJSDocImportTag, isExportDeclaration))) == null ? void 0 : _d.moduleSpecifier) || ((_e = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _e.moduleReference.expression);
|
|
48719
48719
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : host.getDefaultResolutionModeForFile(currentSourceFile);
|
|
48720
48720
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
48721
|
-
const resolvedModule = (
|
|
48721
|
+
const resolvedModule = (_f = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _f.resolvedModule;
|
|
48722
48722
|
const resolutionDiagnostic = errorNode && resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
48723
48723
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
48724
48724
|
if (sourceFile) {
|
|
@@ -48726,7 +48726,7 @@ function createTypeChecker(host) {
|
|
|
48726
48726
|
error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
48727
48727
|
}
|
|
48728
48728
|
if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) {
|
|
48729
|
-
const importOrExport = ((
|
|
48729
|
+
const importOrExport = ((_g = findAncestor(location, isImportDeclaration)) == null ? void 0 : _g.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
48730
48730
|
if (errorNode && importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
|
|
48731
48731
|
error(
|
|
48732
48732
|
errorNode,
|
|
@@ -48735,7 +48735,7 @@ function createTypeChecker(host) {
|
|
|
48735
48735
|
);
|
|
48736
48736
|
}
|
|
48737
48737
|
} else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
|
|
48738
|
-
const importOrExport = ((
|
|
48738
|
+
const importOrExport = ((_h = findAncestor(location, isImportDeclaration)) == null ? void 0 : _h.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
48739
48739
|
if (errorNode && !((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
|
|
48740
48740
|
const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
|
|
48741
48741
|
error(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
|
|
@@ -48765,7 +48765,7 @@ function createTypeChecker(host) {
|
|
|
48765
48765
|
if (ext === ".ts" /* Ts */ || ext === ".js" /* Js */ || ext === ".tsx" /* Tsx */ || ext === ".jsx" /* Jsx */) {
|
|
48766
48766
|
diagnosticDetails = createModeMismatchDetails(currentSourceFile);
|
|
48767
48767
|
}
|
|
48768
|
-
const message = (overrideHost == null ? void 0 : overrideHost.kind) === 272 /* ImportDeclaration */ && ((
|
|
48768
|
+
const message = (overrideHost == null ? void 0 : overrideHost.kind) === 272 /* ImportDeclaration */ && ((_i = overrideHost.importClause) == null ? void 0 : _i.isTypeOnly) ? Diagnostics.Type_only_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute : (overrideHost == null ? void 0 : overrideHost.kind) === 205 /* ImportType */ ? Diagnostics.Type_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute : Diagnostics.The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead;
|
|
48769
48769
|
diagnostics.add(createDiagnosticForNodeFromMessageChain(
|
|
48770
48770
|
getSourceFileOfNode(errorNode),
|
|
48771
48771
|
errorNode,
|
|
@@ -48828,14 +48828,14 @@ function createTypeChecker(host) {
|
|
|
48828
48828
|
error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
48829
48829
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
48830
48830
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
48831
|
-
const suggestedExt = (
|
|
48831
|
+
const suggestedExt = (_j = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _j[1];
|
|
48832
48832
|
if (suggestedExt) {
|
|
48833
48833
|
error(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
|
|
48834
48834
|
} else {
|
|
48835
48835
|
error(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path);
|
|
48836
48836
|
}
|
|
48837
48837
|
} else {
|
|
48838
|
-
if ((
|
|
48838
|
+
if ((_k = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _k.alternateResult) {
|
|
48839
48839
|
const errorInfo = createModuleNotFoundChain(currentSourceFile, host, moduleReference, mode, moduleReference);
|
|
48840
48840
|
errorOrSuggestion(
|
|
48841
48841
|
/*isError*/
|
|
@@ -52034,7 +52034,13 @@ function createTypeChecker(host) {
|
|
|
52034
52034
|
if (typeFromTypeNode === type) {
|
|
52035
52035
|
return true;
|
|
52036
52036
|
}
|
|
52037
|
-
if (annotatedDeclaration
|
|
52037
|
+
if (!annotatedDeclaration) {
|
|
52038
|
+
return false;
|
|
52039
|
+
}
|
|
52040
|
+
if ((isPropertySignature(annotatedDeclaration) || isPropertyDeclaration(annotatedDeclaration)) && annotatedDeclaration.questionToken) {
|
|
52041
|
+
return getTypeWithFacts(type, 524288 /* NEUndefined */) === typeFromTypeNode;
|
|
52042
|
+
}
|
|
52043
|
+
if (isParameter(annotatedDeclaration) && hasEffectiveQuestionToken(annotatedDeclaration)) {
|
|
52038
52044
|
return getTypeWithFacts(type, 524288 /* NEUndefined */) === typeFromTypeNode;
|
|
52039
52045
|
}
|
|
52040
52046
|
return false;
|
|
@@ -52995,7 +53001,9 @@ function createTypeChecker(host) {
|
|
|
52995
53001
|
const skipMembershipCheck = !isPrivate;
|
|
52996
53002
|
if (skipMembershipCheck || !!length(symbol.declarations) && some(symbol.declarations, (d) => !!findAncestor(d, (n) => n === enclosingDeclaration))) {
|
|
52997
53003
|
const scopeCleanup = cloneNodeBuilderContext(context);
|
|
53004
|
+
context.tracker.pushErrorFallbackNode(find(symbol.declarations, (d) => getSourceFileOfNode(d) === context.enclosingFile));
|
|
52998
53005
|
serializeSymbolWorker(symbol, isPrivate, propertyAsAlias);
|
|
53006
|
+
context.tracker.popErrorFallbackNode();
|
|
52999
53007
|
scopeCleanup();
|
|
53000
53008
|
}
|
|
53001
53009
|
}
|
|
@@ -56998,8 +57006,13 @@ function createTypeChecker(host) {
|
|
|
56998
57006
|
if (left.typeParameters && right.typeParameters) {
|
|
56999
57007
|
paramMapper = createTypeMapper(right.typeParameters, left.typeParameters);
|
|
57000
57008
|
}
|
|
57009
|
+
let flags = (left.flags | right.flags) & (167 /* PropagatingFlags */ & ~1 /* HasRestParameter */);
|
|
57001
57010
|
const declaration = left.declaration;
|
|
57002
57011
|
const params = combineUnionParameters(left, right, paramMapper);
|
|
57012
|
+
const lastParam = lastOrUndefined(params);
|
|
57013
|
+
if (lastParam && getCheckFlags(lastParam) & 32768 /* RestParameter */) {
|
|
57014
|
+
flags |= 1 /* HasRestParameter */;
|
|
57015
|
+
}
|
|
57003
57016
|
const thisParam = combineUnionThisParam(left.thisParameter, right.thisParameter, paramMapper);
|
|
57004
57017
|
const minArgCount = Math.max(left.minArgumentCount, right.minArgumentCount);
|
|
57005
57018
|
const result = createSignature(
|
|
@@ -57012,7 +57025,7 @@ function createTypeChecker(host) {
|
|
|
57012
57025
|
/*resolvedTypePredicate*/
|
|
57013
57026
|
void 0,
|
|
57014
57027
|
minArgCount,
|
|
57015
|
-
|
|
57028
|
+
flags
|
|
57016
57029
|
);
|
|
57017
57030
|
result.compositeKind = 1048576 /* Union */;
|
|
57018
57031
|
result.compositeSignatures = concatenate(left.compositeKind !== 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
|
|
@@ -72445,13 +72458,14 @@ function createTypeChecker(host) {
|
|
|
72445
72458
|
const paramName = leftName === rightName ? leftName : !leftName ? rightName : !rightName ? leftName : void 0;
|
|
72446
72459
|
const paramSymbol = createSymbol(
|
|
72447
72460
|
1 /* FunctionScopedVariable */ | (isOptional && !isRestParam ? 16777216 /* Optional */ : 0),
|
|
72448
|
-
paramName || `arg${i}
|
|
72461
|
+
paramName || `arg${i}`,
|
|
72462
|
+
isRestParam ? 32768 /* RestParameter */ : isOptional ? 16384 /* OptionalParameter */ : 0
|
|
72449
72463
|
);
|
|
72450
72464
|
paramSymbol.links.type = isRestParam ? createArrayType(unionParamType) : unionParamType;
|
|
72451
72465
|
params[i] = paramSymbol;
|
|
72452
72466
|
}
|
|
72453
72467
|
if (needsExtraRestElement) {
|
|
72454
|
-
const restParamSymbol = createSymbol(1 /* FunctionScopedVariable */, "args");
|
|
72468
|
+
const restParamSymbol = createSymbol(1 /* FunctionScopedVariable */, "args", 32768 /* RestParameter */);
|
|
72455
72469
|
restParamSymbol.links.type = createArrayType(getTypeAtPosition(shorter, longestCount));
|
|
72456
72470
|
if (shorter === right) {
|
|
72457
72471
|
restParamSymbol.links.type = instantiateType(restParamSymbol.links.type, mapper);
|
|
@@ -72466,8 +72480,13 @@ function createTypeChecker(host) {
|
|
|
72466
72480
|
if (left.typeParameters && right.typeParameters) {
|
|
72467
72481
|
paramMapper = createTypeMapper(right.typeParameters, left.typeParameters);
|
|
72468
72482
|
}
|
|
72483
|
+
let flags = (left.flags | right.flags) & (167 /* PropagatingFlags */ & ~1 /* HasRestParameter */);
|
|
72469
72484
|
const declaration = left.declaration;
|
|
72470
72485
|
const params = combineIntersectionParameters(left, right, paramMapper);
|
|
72486
|
+
const lastParam = lastOrUndefined(params);
|
|
72487
|
+
if (lastParam && getCheckFlags(lastParam) & 32768 /* RestParameter */) {
|
|
72488
|
+
flags |= 1 /* HasRestParameter */;
|
|
72489
|
+
}
|
|
72471
72490
|
const thisParam = combineIntersectionThisParam(left.thisParameter, right.thisParameter, paramMapper);
|
|
72472
72491
|
const minArgCount = Math.max(left.minArgumentCount, right.minArgumentCount);
|
|
72473
72492
|
const result = createSignature(
|
|
@@ -72480,7 +72499,7 @@ function createTypeChecker(host) {
|
|
|
72480
72499
|
/*resolvedTypePredicate*/
|
|
72481
72500
|
void 0,
|
|
72482
72501
|
minArgCount,
|
|
72483
|
-
|
|
72502
|
+
flags
|
|
72484
72503
|
);
|
|
72485
72504
|
result.compositeKind = 2097152 /* Intersection */;
|
|
72486
72505
|
result.compositeSignatures = concatenate(left.compositeKind === 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
|
|
@@ -88995,6 +89014,14 @@ var SymbolTrackerImpl = class _SymbolTrackerImpl {
|
|
|
88995
89014
|
this.inner.reportInferenceFallback(node);
|
|
88996
89015
|
}
|
|
88997
89016
|
}
|
|
89017
|
+
pushErrorFallbackNode(node) {
|
|
89018
|
+
var _a, _b;
|
|
89019
|
+
return (_b = (_a = this.inner) == null ? void 0 : _a.pushErrorFallbackNode) == null ? void 0 : _b.call(_a, node);
|
|
89020
|
+
}
|
|
89021
|
+
popErrorFallbackNode() {
|
|
89022
|
+
var _a, _b;
|
|
89023
|
+
return (_b = (_a = this.inner) == null ? void 0 : _a.popErrorFallbackNode) == null ? void 0 : _b.call(_a);
|
|
89024
|
+
}
|
|
88998
89025
|
};
|
|
88999
89026
|
|
|
89000
89027
|
// src/compiler/visitorPublic.ts
|
|
@@ -112151,6 +112178,7 @@ function transformDeclarations(context) {
|
|
|
112151
112178
|
let suppressNewDiagnosticContexts;
|
|
112152
112179
|
const { factory: factory2 } = context;
|
|
112153
112180
|
const host = context.getEmitHost();
|
|
112181
|
+
let restoreFallbackNode = () => void 0;
|
|
112154
112182
|
const symbolTracker = {
|
|
112155
112183
|
trackSymbol,
|
|
112156
112184
|
reportInaccessibleThisError,
|
|
@@ -112162,7 +112190,19 @@ function transformDeclarations(context) {
|
|
|
112162
112190
|
moduleResolverHost: host,
|
|
112163
112191
|
reportNonlocalAugmentation,
|
|
112164
112192
|
reportNonSerializableProperty,
|
|
112165
|
-
reportInferenceFallback
|
|
112193
|
+
reportInferenceFallback,
|
|
112194
|
+
pushErrorFallbackNode(node) {
|
|
112195
|
+
const currentFallback = errorFallbackNode;
|
|
112196
|
+
const currentRestore = restoreFallbackNode;
|
|
112197
|
+
restoreFallbackNode = () => {
|
|
112198
|
+
restoreFallbackNode = currentRestore;
|
|
112199
|
+
errorFallbackNode = currentFallback;
|
|
112200
|
+
};
|
|
112201
|
+
errorFallbackNode = node;
|
|
112202
|
+
},
|
|
112203
|
+
popErrorFallbackNode() {
|
|
112204
|
+
restoreFallbackNode();
|
|
112205
|
+
}
|
|
112166
112206
|
};
|
|
112167
112207
|
let errorNameNode;
|
|
112168
112208
|
let errorFallbackNode;
|
package/lib/typescript.js
CHANGED
|
@@ -2270,7 +2270,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2270
2270
|
|
|
2271
2271
|
// src/compiler/corePublic.ts
|
|
2272
2272
|
var versionMajorMinor = "5.7";
|
|
2273
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2273
|
+
var version = `${versionMajorMinor}.0-dev.20240926`;
|
|
2274
2274
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2275
2275
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2276
2276
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -53292,7 +53292,7 @@ function createTypeChecker(host) {
|
|
|
53292
53292
|
return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, !ignoreErrors ? moduleReferenceExpression : void 0, isForAugmentation) : void 0;
|
|
53293
53293
|
}
|
|
53294
53294
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
|
|
53295
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k
|
|
53295
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
53296
53296
|
if (errorNode && startsWith(moduleReference, "@types/")) {
|
|
53297
53297
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
53298
53298
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
@@ -53307,14 +53307,14 @@ function createTypeChecker(host) {
|
|
|
53307
53307
|
return ambientModule;
|
|
53308
53308
|
}
|
|
53309
53309
|
const currentSourceFile = getSourceFileOfNode(location);
|
|
53310
|
-
const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _a.name) || ((_b = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _b.argument.literal) || (
|
|
53310
|
+
const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _a.name) || ((_b = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _b.argument.literal) || (isVariableDeclaration(location) && location.initializer && isRequireCall(
|
|
53311
53311
|
location.initializer,
|
|
53312
53312
|
/*requireStringLiteralLikeArgument*/
|
|
53313
53313
|
true
|
|
53314
|
-
) ? location.initializer.arguments[0] : void 0) || ((_c = findAncestor(location, isImportCall)) == null ? void 0 : _c.arguments[0]) || ((_d = findAncestor(location, isImportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _e.moduleReference.expression)
|
|
53314
|
+
) ? location.initializer.arguments[0] : void 0) || ((_c = findAncestor(location, isImportCall)) == null ? void 0 : _c.arguments[0]) || ((_d = findAncestor(location, or(isImportDeclaration, isJSDocImportTag, isExportDeclaration))) == null ? void 0 : _d.moduleSpecifier) || ((_e = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _e.moduleReference.expression);
|
|
53315
53315
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : host.getDefaultResolutionModeForFile(currentSourceFile);
|
|
53316
53316
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
53317
|
-
const resolvedModule = (
|
|
53317
|
+
const resolvedModule = (_f = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _f.resolvedModule;
|
|
53318
53318
|
const resolutionDiagnostic = errorNode && resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
53319
53319
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
53320
53320
|
if (sourceFile) {
|
|
@@ -53322,7 +53322,7 @@ function createTypeChecker(host) {
|
|
|
53322
53322
|
error2(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
53323
53323
|
}
|
|
53324
53324
|
if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) {
|
|
53325
|
-
const importOrExport = ((
|
|
53325
|
+
const importOrExport = ((_g = findAncestor(location, isImportDeclaration)) == null ? void 0 : _g.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
53326
53326
|
if (errorNode && importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
|
|
53327
53327
|
error2(
|
|
53328
53328
|
errorNode,
|
|
@@ -53331,7 +53331,7 @@ function createTypeChecker(host) {
|
|
|
53331
53331
|
);
|
|
53332
53332
|
}
|
|
53333
53333
|
} else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
|
|
53334
|
-
const importOrExport = ((
|
|
53334
|
+
const importOrExport = ((_h = findAncestor(location, isImportDeclaration)) == null ? void 0 : _h.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
53335
53335
|
if (errorNode && !((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
|
|
53336
53336
|
const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
|
|
53337
53337
|
error2(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
|
|
@@ -53361,7 +53361,7 @@ function createTypeChecker(host) {
|
|
|
53361
53361
|
if (ext === ".ts" /* Ts */ || ext === ".js" /* Js */ || ext === ".tsx" /* Tsx */ || ext === ".jsx" /* Jsx */) {
|
|
53362
53362
|
diagnosticDetails = createModeMismatchDetails(currentSourceFile);
|
|
53363
53363
|
}
|
|
53364
|
-
const message = (overrideHost == null ? void 0 : overrideHost.kind) === 272 /* ImportDeclaration */ && ((
|
|
53364
|
+
const message = (overrideHost == null ? void 0 : overrideHost.kind) === 272 /* ImportDeclaration */ && ((_i = overrideHost.importClause) == null ? void 0 : _i.isTypeOnly) ? Diagnostics.Type_only_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute : (overrideHost == null ? void 0 : overrideHost.kind) === 205 /* ImportType */ ? Diagnostics.Type_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute : Diagnostics.The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead;
|
|
53365
53365
|
diagnostics.add(createDiagnosticForNodeFromMessageChain(
|
|
53366
53366
|
getSourceFileOfNode(errorNode),
|
|
53367
53367
|
errorNode,
|
|
@@ -53424,14 +53424,14 @@ function createTypeChecker(host) {
|
|
|
53424
53424
|
error2(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
53425
53425
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
53426
53426
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
53427
|
-
const suggestedExt = (
|
|
53427
|
+
const suggestedExt = (_j = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _j[1];
|
|
53428
53428
|
if (suggestedExt) {
|
|
53429
53429
|
error2(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
|
|
53430
53430
|
} else {
|
|
53431
53431
|
error2(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path);
|
|
53432
53432
|
}
|
|
53433
53433
|
} else {
|
|
53434
|
-
if ((
|
|
53434
|
+
if ((_k = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _k.alternateResult) {
|
|
53435
53435
|
const errorInfo = createModuleNotFoundChain(currentSourceFile, host, moduleReference, mode, moduleReference);
|
|
53436
53436
|
errorOrSuggestion(
|
|
53437
53437
|
/*isError*/
|
|
@@ -56630,7 +56630,13 @@ function createTypeChecker(host) {
|
|
|
56630
56630
|
if (typeFromTypeNode === type) {
|
|
56631
56631
|
return true;
|
|
56632
56632
|
}
|
|
56633
|
-
if (annotatedDeclaration
|
|
56633
|
+
if (!annotatedDeclaration) {
|
|
56634
|
+
return false;
|
|
56635
|
+
}
|
|
56636
|
+
if ((isPropertySignature(annotatedDeclaration) || isPropertyDeclaration(annotatedDeclaration)) && annotatedDeclaration.questionToken) {
|
|
56637
|
+
return getTypeWithFacts(type, 524288 /* NEUndefined */) === typeFromTypeNode;
|
|
56638
|
+
}
|
|
56639
|
+
if (isParameter(annotatedDeclaration) && hasEffectiveQuestionToken(annotatedDeclaration)) {
|
|
56634
56640
|
return getTypeWithFacts(type, 524288 /* NEUndefined */) === typeFromTypeNode;
|
|
56635
56641
|
}
|
|
56636
56642
|
return false;
|
|
@@ -57591,7 +57597,9 @@ function createTypeChecker(host) {
|
|
|
57591
57597
|
const skipMembershipCheck = !isPrivate;
|
|
57592
57598
|
if (skipMembershipCheck || !!length(symbol.declarations) && some(symbol.declarations, (d) => !!findAncestor(d, (n) => n === enclosingDeclaration))) {
|
|
57593
57599
|
const scopeCleanup = cloneNodeBuilderContext(context);
|
|
57600
|
+
context.tracker.pushErrorFallbackNode(find(symbol.declarations, (d) => getSourceFileOfNode(d) === context.enclosingFile));
|
|
57594
57601
|
serializeSymbolWorker(symbol, isPrivate, propertyAsAlias);
|
|
57602
|
+
context.tracker.popErrorFallbackNode();
|
|
57595
57603
|
scopeCleanup();
|
|
57596
57604
|
}
|
|
57597
57605
|
}
|
|
@@ -61594,8 +61602,13 @@ function createTypeChecker(host) {
|
|
|
61594
61602
|
if (left.typeParameters && right.typeParameters) {
|
|
61595
61603
|
paramMapper = createTypeMapper(right.typeParameters, left.typeParameters);
|
|
61596
61604
|
}
|
|
61605
|
+
let flags = (left.flags | right.flags) & (167 /* PropagatingFlags */ & ~1 /* HasRestParameter */);
|
|
61597
61606
|
const declaration = left.declaration;
|
|
61598
61607
|
const params = combineUnionParameters(left, right, paramMapper);
|
|
61608
|
+
const lastParam = lastOrUndefined(params);
|
|
61609
|
+
if (lastParam && getCheckFlags(lastParam) & 32768 /* RestParameter */) {
|
|
61610
|
+
flags |= 1 /* HasRestParameter */;
|
|
61611
|
+
}
|
|
61599
61612
|
const thisParam = combineUnionThisParam(left.thisParameter, right.thisParameter, paramMapper);
|
|
61600
61613
|
const minArgCount = Math.max(left.minArgumentCount, right.minArgumentCount);
|
|
61601
61614
|
const result = createSignature(
|
|
@@ -61608,7 +61621,7 @@ function createTypeChecker(host) {
|
|
|
61608
61621
|
/*resolvedTypePredicate*/
|
|
61609
61622
|
void 0,
|
|
61610
61623
|
minArgCount,
|
|
61611
|
-
|
|
61624
|
+
flags
|
|
61612
61625
|
);
|
|
61613
61626
|
result.compositeKind = 1048576 /* Union */;
|
|
61614
61627
|
result.compositeSignatures = concatenate(left.compositeKind !== 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
|
|
@@ -77041,13 +77054,14 @@ function createTypeChecker(host) {
|
|
|
77041
77054
|
const paramName = leftName === rightName ? leftName : !leftName ? rightName : !rightName ? leftName : void 0;
|
|
77042
77055
|
const paramSymbol = createSymbol(
|
|
77043
77056
|
1 /* FunctionScopedVariable */ | (isOptional && !isRestParam ? 16777216 /* Optional */ : 0),
|
|
77044
|
-
paramName || `arg${i}
|
|
77057
|
+
paramName || `arg${i}`,
|
|
77058
|
+
isRestParam ? 32768 /* RestParameter */ : isOptional ? 16384 /* OptionalParameter */ : 0
|
|
77045
77059
|
);
|
|
77046
77060
|
paramSymbol.links.type = isRestParam ? createArrayType(unionParamType) : unionParamType;
|
|
77047
77061
|
params[i] = paramSymbol;
|
|
77048
77062
|
}
|
|
77049
77063
|
if (needsExtraRestElement) {
|
|
77050
|
-
const restParamSymbol = createSymbol(1 /* FunctionScopedVariable */, "args");
|
|
77064
|
+
const restParamSymbol = createSymbol(1 /* FunctionScopedVariable */, "args", 32768 /* RestParameter */);
|
|
77051
77065
|
restParamSymbol.links.type = createArrayType(getTypeAtPosition(shorter, longestCount));
|
|
77052
77066
|
if (shorter === right) {
|
|
77053
77067
|
restParamSymbol.links.type = instantiateType(restParamSymbol.links.type, mapper);
|
|
@@ -77062,8 +77076,13 @@ function createTypeChecker(host) {
|
|
|
77062
77076
|
if (left.typeParameters && right.typeParameters) {
|
|
77063
77077
|
paramMapper = createTypeMapper(right.typeParameters, left.typeParameters);
|
|
77064
77078
|
}
|
|
77079
|
+
let flags = (left.flags | right.flags) & (167 /* PropagatingFlags */ & ~1 /* HasRestParameter */);
|
|
77065
77080
|
const declaration = left.declaration;
|
|
77066
77081
|
const params = combineIntersectionParameters(left, right, paramMapper);
|
|
77082
|
+
const lastParam = lastOrUndefined(params);
|
|
77083
|
+
if (lastParam && getCheckFlags(lastParam) & 32768 /* RestParameter */) {
|
|
77084
|
+
flags |= 1 /* HasRestParameter */;
|
|
77085
|
+
}
|
|
77067
77086
|
const thisParam = combineIntersectionThisParam(left.thisParameter, right.thisParameter, paramMapper);
|
|
77068
77087
|
const minArgCount = Math.max(left.minArgumentCount, right.minArgumentCount);
|
|
77069
77088
|
const result = createSignature(
|
|
@@ -77076,7 +77095,7 @@ function createTypeChecker(host) {
|
|
|
77076
77095
|
/*resolvedTypePredicate*/
|
|
77077
77096
|
void 0,
|
|
77078
77097
|
minArgCount,
|
|
77079
|
-
|
|
77098
|
+
flags
|
|
77080
77099
|
);
|
|
77081
77100
|
result.compositeKind = 2097152 /* Intersection */;
|
|
77082
77101
|
result.compositeSignatures = concatenate(left.compositeKind === 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
|
|
@@ -93591,6 +93610,14 @@ var SymbolTrackerImpl = class _SymbolTrackerImpl {
|
|
|
93591
93610
|
this.inner.reportInferenceFallback(node);
|
|
93592
93611
|
}
|
|
93593
93612
|
}
|
|
93613
|
+
pushErrorFallbackNode(node) {
|
|
93614
|
+
var _a, _b;
|
|
93615
|
+
return (_b = (_a = this.inner) == null ? void 0 : _a.pushErrorFallbackNode) == null ? void 0 : _b.call(_a, node);
|
|
93616
|
+
}
|
|
93617
|
+
popErrorFallbackNode() {
|
|
93618
|
+
var _a, _b;
|
|
93619
|
+
return (_b = (_a = this.inner) == null ? void 0 : _a.popErrorFallbackNode) == null ? void 0 : _b.call(_a);
|
|
93620
|
+
}
|
|
93594
93621
|
};
|
|
93595
93622
|
|
|
93596
93623
|
// src/compiler/visitorPublic.ts
|
|
@@ -116929,6 +116956,7 @@ function transformDeclarations(context) {
|
|
|
116929
116956
|
let suppressNewDiagnosticContexts;
|
|
116930
116957
|
const { factory: factory2 } = context;
|
|
116931
116958
|
const host = context.getEmitHost();
|
|
116959
|
+
let restoreFallbackNode = () => void 0;
|
|
116932
116960
|
const symbolTracker = {
|
|
116933
116961
|
trackSymbol,
|
|
116934
116962
|
reportInaccessibleThisError,
|
|
@@ -116940,7 +116968,19 @@ function transformDeclarations(context) {
|
|
|
116940
116968
|
moduleResolverHost: host,
|
|
116941
116969
|
reportNonlocalAugmentation,
|
|
116942
116970
|
reportNonSerializableProperty,
|
|
116943
|
-
reportInferenceFallback
|
|
116971
|
+
reportInferenceFallback,
|
|
116972
|
+
pushErrorFallbackNode(node) {
|
|
116973
|
+
const currentFallback = errorFallbackNode;
|
|
116974
|
+
const currentRestore = restoreFallbackNode;
|
|
116975
|
+
restoreFallbackNode = () => {
|
|
116976
|
+
restoreFallbackNode = currentRestore;
|
|
116977
|
+
errorFallbackNode = currentFallback;
|
|
116978
|
+
};
|
|
116979
|
+
errorFallbackNode = node;
|
|
116980
|
+
},
|
|
116981
|
+
popErrorFallbackNode() {
|
|
116982
|
+
restoreFallbackNode();
|
|
116983
|
+
}
|
|
116944
116984
|
};
|
|
116945
116985
|
let errorNameNode;
|
|
116946
116986
|
let errorFallbackNode;
|
|
@@ -149757,6 +149797,7 @@ var SymbolObject = class {
|
|
|
149757
149797
|
if (context) {
|
|
149758
149798
|
if (isGetAccessor(context)) {
|
|
149759
149799
|
if (!this.contextualGetAccessorDocumentationComment) {
|
|
149800
|
+
this.contextualGetAccessorDocumentationComment = emptyArray;
|
|
149760
149801
|
this.contextualGetAccessorDocumentationComment = getDocumentationComment(filter(this.declarations, isGetAccessor), checker);
|
|
149761
149802
|
}
|
|
149762
149803
|
if (length(this.contextualGetAccessorDocumentationComment)) {
|
|
@@ -149765,6 +149806,7 @@ var SymbolObject = class {
|
|
|
149765
149806
|
}
|
|
149766
149807
|
if (isSetAccessor(context)) {
|
|
149767
149808
|
if (!this.contextualSetAccessorDocumentationComment) {
|
|
149809
|
+
this.contextualSetAccessorDocumentationComment = emptyArray;
|
|
149768
149810
|
this.contextualSetAccessorDocumentationComment = getDocumentationComment(filter(this.declarations, isSetAccessor), checker);
|
|
149769
149811
|
}
|
|
149770
149812
|
if (length(this.contextualSetAccessorDocumentationComment)) {
|
|
@@ -149785,6 +149827,7 @@ var SymbolObject = class {
|
|
|
149785
149827
|
if (context) {
|
|
149786
149828
|
if (isGetAccessor(context)) {
|
|
149787
149829
|
if (!this.contextualGetAccessorTags) {
|
|
149830
|
+
this.contextualGetAccessorTags = emptyArray;
|
|
149788
149831
|
this.contextualGetAccessorTags = getJsDocTagsOfDeclarations(filter(this.declarations, isGetAccessor), checker);
|
|
149789
149832
|
}
|
|
149790
149833
|
if (length(this.contextualGetAccessorTags)) {
|
|
@@ -149793,6 +149836,7 @@ var SymbolObject = class {
|
|
|
149793
149836
|
}
|
|
149794
149837
|
if (isSetAccessor(context)) {
|
|
149795
149838
|
if (!this.contextualSetAccessorTags) {
|
|
149839
|
+
this.contextualSetAccessorTags = emptyArray;
|
|
149796
149840
|
this.contextualSetAccessorTags = getJsDocTagsOfDeclarations(filter(this.declarations, isSetAccessor), checker);
|
|
149797
149841
|
}
|
|
149798
149842
|
if (length(this.contextualSetAccessorTags)) {
|
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": "5.7.0-dev.
|
|
5
|
+
"version": "5.7.0-dev.20240926",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -116,5 +116,5 @@
|
|
|
116
116
|
"node": "20.1.0",
|
|
117
117
|
"npm": "8.19.4"
|
|
118
118
|
},
|
|
119
|
-
"gitHead": "
|
|
119
|
+
"gitHead": "3ad0f752482f5e846dc35a69572ccb43311826c0"
|
|
120
120
|
}
|