typescript 6.0.0-dev.20250929 → 6.0.0-dev.20251001
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 +142 -36
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +160 -41
- 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 = "6.0";
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20251001`;
|
22
22
|
|
23
23
|
// src/compiler/core.ts
|
24
24
|
var emptyArray = [];
|
@@ -7010,6 +7010,7 @@ var Diagnostics = {
|
|
7010
7010
|
Option_0_1_has_been_removed_Please_remove_it_from_your_configuration: diag(5108, 1 /* Error */, "Option_0_1_has_been_removed_Please_remove_it_from_your_configuration_5108", "Option '{0}={1}' has been removed. Please remove it from your configuration."),
|
7011
7011
|
Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1: diag(5109, 1 /* Error */, "Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1_5109", "Option 'moduleResolution' must be set to '{0}' (or left unspecified) when option 'module' is set to '{1}'."),
|
7012
7012
|
Option_module_must_be_set_to_0_when_option_moduleResolution_is_set_to_1: diag(5110, 1 /* Error */, "Option_module_must_be_set_to_0_when_option_moduleResolution_is_set_to_1_5110", "Option 'module' must be set to '{0}' when option 'moduleResolution' is set to '{1}'."),
|
7013
|
+
Visit_https_Colon_Slash_Slashaka_ms_Slashts6_for_migration_information: diag(5111, 3 /* Message */, "Visit_https_Colon_Slash_Slashaka_ms_Slashts6_for_migration_information_5111", "Visit https://aka.ms/ts6 for migration information."),
|
7013
7014
|
Generates_a_sourcemap_for_each_corresponding_d_ts_file: diag(6e3, 3 /* Message */, "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000", "Generates a sourcemap for each corresponding '.d.ts' file."),
|
7014
7015
|
Concatenate_and_emit_output_to_single_file: diag(6001, 3 /* Message */, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."),
|
7015
7016
|
Generates_corresponding_d_ts_file: diag(6002, 3 /* Message */, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."),
|
@@ -15492,6 +15493,9 @@ function getTypeParameterFromJsDoc(node) {
|
|
15492
15493
|
const { typeParameters } = node.parent.parent.parent;
|
15493
15494
|
return typeParameters && find(typeParameters, (p) => p.name.escapedText === name);
|
15494
15495
|
}
|
15496
|
+
function hasTypeArguments(node) {
|
15497
|
+
return !!node.typeArguments;
|
15498
|
+
}
|
15495
15499
|
function getAssignmentTarget(node) {
|
15496
15500
|
let parent = node.parent;
|
15497
15501
|
while (true) {
|
@@ -66783,7 +66787,7 @@ function createTypeChecker(host) {
|
|
66783
66787
|
}
|
66784
66788
|
return 0 /* False */;
|
66785
66789
|
}
|
66786
|
-
if (
|
66790
|
+
if (isObjectLiteralType(target2)) {
|
66787
66791
|
for (const sourceProp of excludeProperties(getPropertiesOfType(source2), excludedProperties)) {
|
66788
66792
|
if (!getPropertyOfObjectType(target2, sourceProp.escapedName)) {
|
66789
66793
|
if (reportErrors2) {
|
@@ -67453,7 +67457,7 @@ function createTypeChecker(host) {
|
|
67453
67457
|
if (isReadonlySymbol(sourceProp) !== isReadonlySymbol(targetProp)) {
|
67454
67458
|
return 0 /* False */;
|
67455
67459
|
}
|
67456
|
-
return compareTypes(
|
67460
|
+
return compareTypes(getNonMissingTypeOfSymbol(sourceProp), getNonMissingTypeOfSymbol(targetProp));
|
67457
67461
|
}
|
67458
67462
|
function isMatchingSignature(source, target, partialMatch) {
|
67459
67463
|
const sourceParameterCount = getParameterCount(source);
|
@@ -69467,23 +69471,21 @@ function createTypeChecker(host) {
|
|
69467
69471
|
for (const type of types) {
|
69468
69472
|
if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */)) {
|
69469
69473
|
const discriminant = getTypeOfPropertyOfType(type, name);
|
69470
|
-
if (discriminant) {
|
69471
|
-
|
69472
|
-
return void 0;
|
69473
|
-
}
|
69474
|
-
let duplicate = false;
|
69475
|
-
forEachType(discriminant, (t) => {
|
69476
|
-
const id = getTypeId(getRegularTypeOfLiteralType(t));
|
69477
|
-
const existing = map2.get(id);
|
69478
|
-
if (!existing) {
|
69479
|
-
map2.set(id, type);
|
69480
|
-
} else if (existing !== unknownType) {
|
69481
|
-
map2.set(id, unknownType);
|
69482
|
-
duplicate = true;
|
69483
|
-
}
|
69484
|
-
});
|
69485
|
-
if (!duplicate) count++;
|
69474
|
+
if (!discriminant || !isLiteralType(discriminant)) {
|
69475
|
+
return void 0;
|
69486
69476
|
}
|
69477
|
+
let duplicate = false;
|
69478
|
+
forEachType(discriminant, (t) => {
|
69479
|
+
const id = getTypeId(getRegularTypeOfLiteralType(t));
|
69480
|
+
const existing = map2.get(id);
|
69481
|
+
if (!existing) {
|
69482
|
+
map2.set(id, type);
|
69483
|
+
} else if (existing !== unknownType) {
|
69484
|
+
map2.set(id, unknownType);
|
69485
|
+
duplicate = true;
|
69486
|
+
}
|
69487
|
+
});
|
69488
|
+
if (!duplicate) count++;
|
69487
69489
|
}
|
69488
69490
|
}
|
69489
69491
|
return count >= 10 && count * 2 >= types.length ? map2 : void 0;
|
@@ -81600,6 +81602,47 @@ function createTypeChecker(host) {
|
|
81600
81602
|
}
|
81601
81603
|
return void 0;
|
81602
81604
|
}
|
81605
|
+
function getUninstantiatedSignatures(node) {
|
81606
|
+
switch (node.kind) {
|
81607
|
+
case 214 /* CallExpression */:
|
81608
|
+
case 171 /* Decorator */:
|
81609
|
+
return getSignaturesOfType(
|
81610
|
+
getTypeOfExpression(node.expression),
|
81611
|
+
0 /* Call */
|
81612
|
+
);
|
81613
|
+
case 215 /* NewExpression */:
|
81614
|
+
return getSignaturesOfType(
|
81615
|
+
getTypeOfExpression(node.expression),
|
81616
|
+
1 /* Construct */
|
81617
|
+
);
|
81618
|
+
case 286 /* JsxSelfClosingElement */:
|
81619
|
+
case 287 /* JsxOpeningElement */:
|
81620
|
+
if (isJsxIntrinsicTagName(node.tagName)) return [];
|
81621
|
+
return getSignaturesOfType(
|
81622
|
+
getTypeOfExpression(node.tagName),
|
81623
|
+
0 /* Call */
|
81624
|
+
);
|
81625
|
+
case 216 /* TaggedTemplateExpression */:
|
81626
|
+
return getSignaturesOfType(
|
81627
|
+
getTypeOfExpression(node.tag),
|
81628
|
+
0 /* Call */
|
81629
|
+
);
|
81630
|
+
case 227 /* BinaryExpression */:
|
81631
|
+
case 290 /* JsxOpeningFragment */:
|
81632
|
+
return [];
|
81633
|
+
}
|
81634
|
+
}
|
81635
|
+
function getTypeParameterConstraintForPositionAcrossSignatures(signatures, position) {
|
81636
|
+
const relevantTypeParameterConstraints = flatMap(signatures, (signature) => {
|
81637
|
+
var _a;
|
81638
|
+
const relevantTypeParameter = (_a = signature.typeParameters) == null ? void 0 : _a[position];
|
81639
|
+
if (relevantTypeParameter === void 0) return [];
|
81640
|
+
const relevantConstraint = getConstraintOfTypeParameter(relevantTypeParameter);
|
81641
|
+
if (relevantConstraint === void 0) return [];
|
81642
|
+
return [relevantConstraint];
|
81643
|
+
});
|
81644
|
+
return getUnionType(relevantTypeParameterConstraints);
|
81645
|
+
}
|
81603
81646
|
function checkTypeReferenceNode(node) {
|
81604
81647
|
checkGrammarTypeArguments(node, node.typeArguments);
|
81605
81648
|
if (node.kind === 184 /* TypeReference */ && !isInJSFile(node) && !isInJSDoc(node) && node.typeArguments && node.typeName.end !== node.typeArguments.pos) {
|
@@ -81635,12 +81678,48 @@ function createTypeChecker(host) {
|
|
81635
81678
|
}
|
81636
81679
|
}
|
81637
81680
|
function getTypeArgumentConstraint(node) {
|
81638
|
-
|
81639
|
-
if (
|
81640
|
-
|
81641
|
-
|
81642
|
-
|
81643
|
-
|
81681
|
+
let typeArgumentPosition;
|
81682
|
+
if (hasTypeArguments(node.parent) && Array.isArray(node.parent.typeArguments)) {
|
81683
|
+
typeArgumentPosition = node.parent.typeArguments.indexOf(node);
|
81684
|
+
}
|
81685
|
+
if (typeArgumentPosition !== void 0) {
|
81686
|
+
if (isCallLikeExpression(node.parent)) {
|
81687
|
+
return getTypeParameterConstraintForPositionAcrossSignatures(
|
81688
|
+
getUninstantiatedSignatures(node.parent),
|
81689
|
+
typeArgumentPosition
|
81690
|
+
);
|
81691
|
+
}
|
81692
|
+
if (isDecorator(node.parent.parent)) {
|
81693
|
+
return getTypeParameterConstraintForPositionAcrossSignatures(
|
81694
|
+
getUninstantiatedSignatures(node.parent.parent),
|
81695
|
+
typeArgumentPosition
|
81696
|
+
);
|
81697
|
+
}
|
81698
|
+
if (isExpressionWithTypeArguments(node.parent) && isExpressionStatement(node.parent.parent)) {
|
81699
|
+
const uninstantiatedType = checkExpression(node.parent.expression);
|
81700
|
+
const callConstraint = getTypeParameterConstraintForPositionAcrossSignatures(
|
81701
|
+
getSignaturesOfType(uninstantiatedType, 0 /* Call */),
|
81702
|
+
typeArgumentPosition
|
81703
|
+
);
|
81704
|
+
const constructConstraint = getTypeParameterConstraintForPositionAcrossSignatures(
|
81705
|
+
getSignaturesOfType(uninstantiatedType, 1 /* Construct */),
|
81706
|
+
typeArgumentPosition
|
81707
|
+
);
|
81708
|
+
if (constructConstraint.flags & 131072 /* Never */) return callConstraint;
|
81709
|
+
if (callConstraint.flags & 131072 /* Never */) return constructConstraint;
|
81710
|
+
return getIntersectionType([callConstraint, constructConstraint]);
|
81711
|
+
}
|
81712
|
+
if (isTypeReferenceType(node.parent)) {
|
81713
|
+
const typeParameters = getTypeParametersForTypeReferenceOrImport(node.parent);
|
81714
|
+
if (!typeParameters) return void 0;
|
81715
|
+
const relevantTypeParameter = typeParameters[typeArgumentPosition];
|
81716
|
+
const constraint = getConstraintOfTypeParameter(relevantTypeParameter);
|
81717
|
+
return constraint && instantiateType(
|
81718
|
+
constraint,
|
81719
|
+
createTypeMapper(typeParameters, getEffectiveTypeArguments(node.parent, typeParameters))
|
81720
|
+
);
|
81721
|
+
}
|
81722
|
+
}
|
81644
81723
|
}
|
81645
81724
|
function checkTypeQuery(node) {
|
81646
81725
|
getTypeFromTypeQueryNode(node);
|
@@ -124497,32 +124576,35 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
124497
124576
|
const mustBeRemoved = !(removedInVersion.compareTo(typescriptVersion) === 1 /* GreaterThan */);
|
124498
124577
|
const canBeSilenced = !mustBeRemoved && ignoreDeprecationsVersion.compareTo(deprecatedInVersion) === -1 /* LessThan */;
|
124499
124578
|
if (mustBeRemoved || canBeSilenced) {
|
124500
|
-
fn((name, value, useInstead) => {
|
124579
|
+
fn((name, value, useInstead, related) => {
|
124501
124580
|
if (mustBeRemoved) {
|
124502
124581
|
if (value === void 0) {
|
124503
|
-
createDiagnostic(name, value, useInstead, Diagnostics.Option_0_has_been_removed_Please_remove_it_from_your_configuration, name);
|
124582
|
+
createDiagnostic(name, value, useInstead, related, Diagnostics.Option_0_has_been_removed_Please_remove_it_from_your_configuration, name);
|
124504
124583
|
} else {
|
124505
|
-
createDiagnostic(name, value, useInstead, Diagnostics.Option_0_1_has_been_removed_Please_remove_it_from_your_configuration, name, value);
|
124584
|
+
createDiagnostic(name, value, useInstead, related, Diagnostics.Option_0_1_has_been_removed_Please_remove_it_from_your_configuration, name, value);
|
124506
124585
|
}
|
124507
124586
|
} else {
|
124508
124587
|
if (value === void 0) {
|
124509
|
-
createDiagnostic(name, value, useInstead, Diagnostics.Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error, name, removedIn, deprecatedIn);
|
124588
|
+
createDiagnostic(name, value, useInstead, related, Diagnostics.Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error, name, removedIn, deprecatedIn);
|
124510
124589
|
} else {
|
124511
|
-
createDiagnostic(name, value, useInstead, Diagnostics.Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDeprecations_Colon_3_to_silence_this_error, name, value, removedIn, deprecatedIn);
|
124590
|
+
createDiagnostic(name, value, useInstead, related, Diagnostics.Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDeprecations_Colon_3_to_silence_this_error, name, value, removedIn, deprecatedIn);
|
124512
124591
|
}
|
124513
124592
|
}
|
124514
124593
|
});
|
124515
124594
|
}
|
124516
124595
|
}
|
124517
124596
|
function verifyDeprecatedCompilerOptions() {
|
124518
|
-
function createDiagnostic(name, value, useInstead, message, ...args) {
|
124597
|
+
function createDiagnostic(name, value, useInstead, related, message, ...args) {
|
124519
124598
|
if (useInstead) {
|
124520
|
-
|
124599
|
+
let details = chainDiagnosticMessages(
|
124521
124600
|
/*details*/
|
124522
124601
|
void 0,
|
124523
124602
|
Diagnostics.Use_0_instead,
|
124524
124603
|
useInstead
|
124525
124604
|
);
|
124605
|
+
if (related) {
|
124606
|
+
details = chainDiagnosticMessages(details, related);
|
124607
|
+
}
|
124526
124608
|
const chain = chainDiagnosticMessages(details, message, ...args);
|
124527
124609
|
createDiagnosticForOption(
|
124528
124610
|
/*onKey*/
|
@@ -124533,14 +124615,22 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
124533
124615
|
chain
|
124534
124616
|
);
|
124535
124617
|
} else {
|
124618
|
+
let details;
|
124619
|
+
if (related) {
|
124620
|
+
details = chainDiagnosticMessages(
|
124621
|
+
/*details*/
|
124622
|
+
void 0,
|
124623
|
+
related
|
124624
|
+
);
|
124625
|
+
}
|
124626
|
+
const chain = chainDiagnosticMessages(details, message, ...args);
|
124536
124627
|
createDiagnosticForOption(
|
124537
124628
|
/*onKey*/
|
124538
124629
|
!value,
|
124539
124630
|
name,
|
124540
124631
|
/*option2*/
|
124541
124632
|
void 0,
|
124542
|
-
|
124543
|
-
...args
|
124633
|
+
chain
|
124544
124634
|
);
|
124545
124635
|
}
|
124546
124636
|
}
|
@@ -124593,12 +124683,28 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
124593
124683
|
});
|
124594
124684
|
checkDeprecations("6.0", "7.0", createDiagnostic, (createDeprecatedDiagnostic) => {
|
124595
124685
|
if (options.moduleResolution === 2 /* Node10 */) {
|
124596
|
-
createDeprecatedDiagnostic(
|
124686
|
+
createDeprecatedDiagnostic(
|
124687
|
+
"moduleResolution",
|
124688
|
+
"node10",
|
124689
|
+
/*useInstead*/
|
124690
|
+
void 0,
|
124691
|
+
Diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashts6_for_migration_information
|
124692
|
+
);
|
124693
|
+
}
|
124694
|
+
if (options.baseUrl !== void 0) {
|
124695
|
+
createDeprecatedDiagnostic(
|
124696
|
+
"baseUrl",
|
124697
|
+
/*value*/
|
124698
|
+
void 0,
|
124699
|
+
/*useInstead*/
|
124700
|
+
void 0,
|
124701
|
+
Diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashts6_for_migration_information
|
124702
|
+
);
|
124597
124703
|
}
|
124598
124704
|
});
|
124599
124705
|
}
|
124600
124706
|
function verifyDeprecatedProjectReference(ref, parentFile, index) {
|
124601
|
-
function createDiagnostic(_name, _value, _useInstead, message, ...args) {
|
124707
|
+
function createDiagnostic(_name, _value, _useInstead, _related, message, ...args) {
|
124602
124708
|
createDiagnosticForReference(parentFile, index, message, ...args);
|
124603
124709
|
}
|
124604
124710
|
checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => {
|
package/lib/typescript.d.ts
CHANGED
package/lib/typescript.js
CHANGED
@@ -2286,7 +2286,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
2286
2286
|
|
2287
2287
|
// src/compiler/corePublic.ts
|
2288
2288
|
var versionMajorMinor = "6.0";
|
2289
|
-
var version = `${versionMajorMinor}.0-dev.
|
2289
|
+
var version = `${versionMajorMinor}.0-dev.20251001`;
|
2290
2290
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
2291
2291
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
2292
2292
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
@@ -10397,6 +10397,7 @@ var Diagnostics = {
|
|
10397
10397
|
Option_0_1_has_been_removed_Please_remove_it_from_your_configuration: diag(5108, 1 /* Error */, "Option_0_1_has_been_removed_Please_remove_it_from_your_configuration_5108", "Option '{0}={1}' has been removed. Please remove it from your configuration."),
|
10398
10398
|
Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1: diag(5109, 1 /* Error */, "Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1_5109", "Option 'moduleResolution' must be set to '{0}' (or left unspecified) when option 'module' is set to '{1}'."),
|
10399
10399
|
Option_module_must_be_set_to_0_when_option_moduleResolution_is_set_to_1: diag(5110, 1 /* Error */, "Option_module_must_be_set_to_0_when_option_moduleResolution_is_set_to_1_5110", "Option 'module' must be set to '{0}' when option 'moduleResolution' is set to '{1}'."),
|
10400
|
+
Visit_https_Colon_Slash_Slashaka_ms_Slashts6_for_migration_information: diag(5111, 3 /* Message */, "Visit_https_Colon_Slash_Slashaka_ms_Slashts6_for_migration_information_5111", "Visit https://aka.ms/ts6 for migration information."),
|
10400
10401
|
Generates_a_sourcemap_for_each_corresponding_d_ts_file: diag(6e3, 3 /* Message */, "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000", "Generates a sourcemap for each corresponding '.d.ts' file."),
|
10401
10402
|
Concatenate_and_emit_output_to_single_file: diag(6001, 3 /* Message */, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."),
|
10402
10403
|
Generates_corresponding_d_ts_file: diag(6002, 3 /* Message */, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."),
|
@@ -71392,7 +71393,7 @@ function createTypeChecker(host) {
|
|
71392
71393
|
}
|
71393
71394
|
return 0 /* False */;
|
71394
71395
|
}
|
71395
|
-
if (
|
71396
|
+
if (isObjectLiteralType2(target2)) {
|
71396
71397
|
for (const sourceProp of excludeProperties(getPropertiesOfType(source2), excludedProperties)) {
|
71397
71398
|
if (!getPropertyOfObjectType(target2, sourceProp.escapedName)) {
|
71398
71399
|
if (reportErrors2) {
|
@@ -72062,7 +72063,7 @@ function createTypeChecker(host) {
|
|
72062
72063
|
if (isReadonlySymbol(sourceProp) !== isReadonlySymbol(targetProp)) {
|
72063
72064
|
return 0 /* False */;
|
72064
72065
|
}
|
72065
|
-
return compareTypes(
|
72066
|
+
return compareTypes(getNonMissingTypeOfSymbol(sourceProp), getNonMissingTypeOfSymbol(targetProp));
|
72066
72067
|
}
|
72067
72068
|
function isMatchingSignature(source, target, partialMatch) {
|
72068
72069
|
const sourceParameterCount = getParameterCount(source);
|
@@ -74076,23 +74077,21 @@ function createTypeChecker(host) {
|
|
74076
74077
|
for (const type of types) {
|
74077
74078
|
if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */)) {
|
74078
74079
|
const discriminant = getTypeOfPropertyOfType(type, name);
|
74079
|
-
if (discriminant) {
|
74080
|
-
|
74081
|
-
return void 0;
|
74082
|
-
}
|
74083
|
-
let duplicate = false;
|
74084
|
-
forEachType(discriminant, (t) => {
|
74085
|
-
const id = getTypeId(getRegularTypeOfLiteralType(t));
|
74086
|
-
const existing = map2.get(id);
|
74087
|
-
if (!existing) {
|
74088
|
-
map2.set(id, type);
|
74089
|
-
} else if (existing !== unknownType) {
|
74090
|
-
map2.set(id, unknownType);
|
74091
|
-
duplicate = true;
|
74092
|
-
}
|
74093
|
-
});
|
74094
|
-
if (!duplicate) count++;
|
74080
|
+
if (!discriminant || !isLiteralType(discriminant)) {
|
74081
|
+
return void 0;
|
74095
74082
|
}
|
74083
|
+
let duplicate = false;
|
74084
|
+
forEachType(discriminant, (t) => {
|
74085
|
+
const id = getTypeId(getRegularTypeOfLiteralType(t));
|
74086
|
+
const existing = map2.get(id);
|
74087
|
+
if (!existing) {
|
74088
|
+
map2.set(id, type);
|
74089
|
+
} else if (existing !== unknownType) {
|
74090
|
+
map2.set(id, unknownType);
|
74091
|
+
duplicate = true;
|
74092
|
+
}
|
74093
|
+
});
|
74094
|
+
if (!duplicate) count++;
|
74096
74095
|
}
|
74097
74096
|
}
|
74098
74097
|
return count >= 10 && count * 2 >= types.length ? map2 : void 0;
|
@@ -86209,6 +86208,47 @@ function createTypeChecker(host) {
|
|
86209
86208
|
}
|
86210
86209
|
return void 0;
|
86211
86210
|
}
|
86211
|
+
function getUninstantiatedSignatures(node) {
|
86212
|
+
switch (node.kind) {
|
86213
|
+
case 214 /* CallExpression */:
|
86214
|
+
case 171 /* Decorator */:
|
86215
|
+
return getSignaturesOfType(
|
86216
|
+
getTypeOfExpression(node.expression),
|
86217
|
+
0 /* Call */
|
86218
|
+
);
|
86219
|
+
case 215 /* NewExpression */:
|
86220
|
+
return getSignaturesOfType(
|
86221
|
+
getTypeOfExpression(node.expression),
|
86222
|
+
1 /* Construct */
|
86223
|
+
);
|
86224
|
+
case 286 /* JsxSelfClosingElement */:
|
86225
|
+
case 287 /* JsxOpeningElement */:
|
86226
|
+
if (isJsxIntrinsicTagName(node.tagName)) return [];
|
86227
|
+
return getSignaturesOfType(
|
86228
|
+
getTypeOfExpression(node.tagName),
|
86229
|
+
0 /* Call */
|
86230
|
+
);
|
86231
|
+
case 216 /* TaggedTemplateExpression */:
|
86232
|
+
return getSignaturesOfType(
|
86233
|
+
getTypeOfExpression(node.tag),
|
86234
|
+
0 /* Call */
|
86235
|
+
);
|
86236
|
+
case 227 /* BinaryExpression */:
|
86237
|
+
case 290 /* JsxOpeningFragment */:
|
86238
|
+
return [];
|
86239
|
+
}
|
86240
|
+
}
|
86241
|
+
function getTypeParameterConstraintForPositionAcrossSignatures(signatures, position) {
|
86242
|
+
const relevantTypeParameterConstraints = flatMap(signatures, (signature) => {
|
86243
|
+
var _a;
|
86244
|
+
const relevantTypeParameter = (_a = signature.typeParameters) == null ? void 0 : _a[position];
|
86245
|
+
if (relevantTypeParameter === void 0) return [];
|
86246
|
+
const relevantConstraint = getConstraintOfTypeParameter(relevantTypeParameter);
|
86247
|
+
if (relevantConstraint === void 0) return [];
|
86248
|
+
return [relevantConstraint];
|
86249
|
+
});
|
86250
|
+
return getUnionType(relevantTypeParameterConstraints);
|
86251
|
+
}
|
86212
86252
|
function checkTypeReferenceNode(node) {
|
86213
86253
|
checkGrammarTypeArguments(node, node.typeArguments);
|
86214
86254
|
if (node.kind === 184 /* TypeReference */ && !isInJSFile(node) && !isInJSDoc(node) && node.typeArguments && node.typeName.end !== node.typeArguments.pos) {
|
@@ -86244,12 +86284,48 @@ function createTypeChecker(host) {
|
|
86244
86284
|
}
|
86245
86285
|
}
|
86246
86286
|
function getTypeArgumentConstraint(node) {
|
86247
|
-
|
86248
|
-
if (
|
86249
|
-
|
86250
|
-
|
86251
|
-
|
86252
|
-
|
86287
|
+
let typeArgumentPosition;
|
86288
|
+
if (hasTypeArguments(node.parent) && Array.isArray(node.parent.typeArguments)) {
|
86289
|
+
typeArgumentPosition = node.parent.typeArguments.indexOf(node);
|
86290
|
+
}
|
86291
|
+
if (typeArgumentPosition !== void 0) {
|
86292
|
+
if (isCallLikeExpression(node.parent)) {
|
86293
|
+
return getTypeParameterConstraintForPositionAcrossSignatures(
|
86294
|
+
getUninstantiatedSignatures(node.parent),
|
86295
|
+
typeArgumentPosition
|
86296
|
+
);
|
86297
|
+
}
|
86298
|
+
if (isDecorator(node.parent.parent)) {
|
86299
|
+
return getTypeParameterConstraintForPositionAcrossSignatures(
|
86300
|
+
getUninstantiatedSignatures(node.parent.parent),
|
86301
|
+
typeArgumentPosition
|
86302
|
+
);
|
86303
|
+
}
|
86304
|
+
if (isExpressionWithTypeArguments(node.parent) && isExpressionStatement(node.parent.parent)) {
|
86305
|
+
const uninstantiatedType = checkExpression(node.parent.expression);
|
86306
|
+
const callConstraint = getTypeParameterConstraintForPositionAcrossSignatures(
|
86307
|
+
getSignaturesOfType(uninstantiatedType, 0 /* Call */),
|
86308
|
+
typeArgumentPosition
|
86309
|
+
);
|
86310
|
+
const constructConstraint = getTypeParameterConstraintForPositionAcrossSignatures(
|
86311
|
+
getSignaturesOfType(uninstantiatedType, 1 /* Construct */),
|
86312
|
+
typeArgumentPosition
|
86313
|
+
);
|
86314
|
+
if (constructConstraint.flags & 131072 /* Never */) return callConstraint;
|
86315
|
+
if (callConstraint.flags & 131072 /* Never */) return constructConstraint;
|
86316
|
+
return getIntersectionType([callConstraint, constructConstraint]);
|
86317
|
+
}
|
86318
|
+
if (isTypeReferenceType(node.parent)) {
|
86319
|
+
const typeParameters = getTypeParametersForTypeReferenceOrImport(node.parent);
|
86320
|
+
if (!typeParameters) return void 0;
|
86321
|
+
const relevantTypeParameter = typeParameters[typeArgumentPosition];
|
86322
|
+
const constraint = getConstraintOfTypeParameter(relevantTypeParameter);
|
86323
|
+
return constraint && instantiateType(
|
86324
|
+
constraint,
|
86325
|
+
createTypeMapper(typeParameters, getEffectiveTypeArguments2(node.parent, typeParameters))
|
86326
|
+
);
|
86327
|
+
}
|
86328
|
+
}
|
86253
86329
|
}
|
86254
86330
|
function checkTypeQuery(node) {
|
86255
86331
|
getTypeFromTypeQueryNode(node);
|
@@ -129345,32 +129421,35 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
129345
129421
|
const mustBeRemoved = !(removedInVersion.compareTo(typescriptVersion) === 1 /* GreaterThan */);
|
129346
129422
|
const canBeSilenced = !mustBeRemoved && ignoreDeprecationsVersion.compareTo(deprecatedInVersion) === -1 /* LessThan */;
|
129347
129423
|
if (mustBeRemoved || canBeSilenced) {
|
129348
|
-
fn((name, value, useInstead) => {
|
129424
|
+
fn((name, value, useInstead, related) => {
|
129349
129425
|
if (mustBeRemoved) {
|
129350
129426
|
if (value === void 0) {
|
129351
|
-
createDiagnostic(name, value, useInstead, Diagnostics.Option_0_has_been_removed_Please_remove_it_from_your_configuration, name);
|
129427
|
+
createDiagnostic(name, value, useInstead, related, Diagnostics.Option_0_has_been_removed_Please_remove_it_from_your_configuration, name);
|
129352
129428
|
} else {
|
129353
|
-
createDiagnostic(name, value, useInstead, Diagnostics.Option_0_1_has_been_removed_Please_remove_it_from_your_configuration, name, value);
|
129429
|
+
createDiagnostic(name, value, useInstead, related, Diagnostics.Option_0_1_has_been_removed_Please_remove_it_from_your_configuration, name, value);
|
129354
129430
|
}
|
129355
129431
|
} else {
|
129356
129432
|
if (value === void 0) {
|
129357
|
-
createDiagnostic(name, value, useInstead, Diagnostics.Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error, name, removedIn, deprecatedIn);
|
129433
|
+
createDiagnostic(name, value, useInstead, related, Diagnostics.Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error, name, removedIn, deprecatedIn);
|
129358
129434
|
} else {
|
129359
|
-
createDiagnostic(name, value, useInstead, Diagnostics.Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDeprecations_Colon_3_to_silence_this_error, name, value, removedIn, deprecatedIn);
|
129435
|
+
createDiagnostic(name, value, useInstead, related, Diagnostics.Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDeprecations_Colon_3_to_silence_this_error, name, value, removedIn, deprecatedIn);
|
129360
129436
|
}
|
129361
129437
|
}
|
129362
129438
|
});
|
129363
129439
|
}
|
129364
129440
|
}
|
129365
129441
|
function verifyDeprecatedCompilerOptions() {
|
129366
|
-
function createDiagnostic(name, value, useInstead, message, ...args) {
|
129442
|
+
function createDiagnostic(name, value, useInstead, related, message, ...args) {
|
129367
129443
|
if (useInstead) {
|
129368
|
-
|
129444
|
+
let details = chainDiagnosticMessages(
|
129369
129445
|
/*details*/
|
129370
129446
|
void 0,
|
129371
129447
|
Diagnostics.Use_0_instead,
|
129372
129448
|
useInstead
|
129373
129449
|
);
|
129450
|
+
if (related) {
|
129451
|
+
details = chainDiagnosticMessages(details, related);
|
129452
|
+
}
|
129374
129453
|
const chain = chainDiagnosticMessages(details, message, ...args);
|
129375
129454
|
createDiagnosticForOption(
|
129376
129455
|
/*onKey*/
|
@@ -129381,14 +129460,22 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
129381
129460
|
chain
|
129382
129461
|
);
|
129383
129462
|
} else {
|
129463
|
+
let details;
|
129464
|
+
if (related) {
|
129465
|
+
details = chainDiagnosticMessages(
|
129466
|
+
/*details*/
|
129467
|
+
void 0,
|
129468
|
+
related
|
129469
|
+
);
|
129470
|
+
}
|
129471
|
+
const chain = chainDiagnosticMessages(details, message, ...args);
|
129384
129472
|
createDiagnosticForOption(
|
129385
129473
|
/*onKey*/
|
129386
129474
|
!value,
|
129387
129475
|
name,
|
129388
129476
|
/*option2*/
|
129389
129477
|
void 0,
|
129390
|
-
|
129391
|
-
...args
|
129478
|
+
chain
|
129392
129479
|
);
|
129393
129480
|
}
|
129394
129481
|
}
|
@@ -129441,12 +129528,28 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
129441
129528
|
});
|
129442
129529
|
checkDeprecations("6.0", "7.0", createDiagnostic, (createDeprecatedDiagnostic) => {
|
129443
129530
|
if (options.moduleResolution === 2 /* Node10 */) {
|
129444
|
-
createDeprecatedDiagnostic(
|
129531
|
+
createDeprecatedDiagnostic(
|
129532
|
+
"moduleResolution",
|
129533
|
+
"node10",
|
129534
|
+
/*useInstead*/
|
129535
|
+
void 0,
|
129536
|
+
Diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashts6_for_migration_information
|
129537
|
+
);
|
129538
|
+
}
|
129539
|
+
if (options.baseUrl !== void 0) {
|
129540
|
+
createDeprecatedDiagnostic(
|
129541
|
+
"baseUrl",
|
129542
|
+
/*value*/
|
129543
|
+
void 0,
|
129544
|
+
/*useInstead*/
|
129545
|
+
void 0,
|
129546
|
+
Diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashts6_for_migration_information
|
129547
|
+
);
|
129445
129548
|
}
|
129446
129549
|
});
|
129447
129550
|
}
|
129448
129551
|
function verifyDeprecatedProjectReference(ref, parentFile, index) {
|
129449
|
-
function createDiagnostic(_name, _value, _useInstead, message, ...args) {
|
129552
|
+
function createDiagnostic(_name, _value, _useInstead, _related, message, ...args) {
|
129450
129553
|
createDiagnosticForReference(parentFile, index, message, ...args);
|
129451
129554
|
}
|
129452
129555
|
checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => {
|
@@ -166698,6 +166801,7 @@ __export(ts_Completions_exports, {
|
|
166698
166801
|
getCompletionEntryDetails: () => getCompletionEntryDetails,
|
166699
166802
|
getCompletionEntrySymbol: () => getCompletionEntrySymbol,
|
166700
166803
|
getCompletionsAtPosition: () => getCompletionsAtPosition,
|
166804
|
+
getConstraintOfTypeArgumentProperty: () => getConstraintOfTypeArgumentProperty,
|
166701
166805
|
getDefaultCommitCharacters: () => getDefaultCommitCharacters,
|
166702
166806
|
getPropertiesForObjectExpression: () => getPropertiesForObjectExpression,
|
166703
166807
|
moduleSpecifierResolutionCacheAttemptLimit: () => moduleSpecifierResolutionCacheAttemptLimit,
|
@@ -169022,13 +169126,13 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
169022
169126
|
}
|
169023
169127
|
}
|
169024
169128
|
log("getCompletionData: Semantic work: " + (timestamp() - semanticStart));
|
169025
|
-
const
|
169129
|
+
const contextualTypeOrConstraint = previousToken && (getContextualType(previousToken, position, sourceFile, typeChecker) ?? getConstraintOfTypeArgumentProperty(previousToken, typeChecker));
|
169026
169130
|
const isLiteralExpected = !tryCast(previousToken, isStringLiteralLike) && !isJsxIdentifierExpected;
|
169027
169131
|
const literals = !isLiteralExpected ? [] : mapDefined(
|
169028
|
-
|
169132
|
+
contextualTypeOrConstraint && (contextualTypeOrConstraint.isUnion() ? contextualTypeOrConstraint.types : [contextualTypeOrConstraint]),
|
169029
169133
|
(t) => t.isLiteral() && !(t.flags & 1024 /* EnumLiteral */) ? t.value : void 0
|
169030
169134
|
);
|
169031
|
-
const recommendedCompletion = previousToken &&
|
169135
|
+
const recommendedCompletion = previousToken && contextualTypeOrConstraint && getRecommendedCompletion(previousToken, contextualTypeOrConstraint, typeChecker);
|
169032
169136
|
return {
|
169033
169137
|
kind: 0 /* Data */,
|
169034
169138
|
symbols,
|
@@ -170534,18 +170638,26 @@ function tryGetTypeLiteralNode(node) {
|
|
170534
170638
|
}
|
170535
170639
|
function getConstraintOfTypeArgumentProperty(node, checker) {
|
170536
170640
|
if (!node) return void 0;
|
170537
|
-
if (isTypeNode(node)
|
170538
|
-
|
170641
|
+
if (isTypeNode(node)) {
|
170642
|
+
const constraint = checker.getTypeArgumentConstraint(node);
|
170643
|
+
if (constraint) return constraint;
|
170539
170644
|
}
|
170540
170645
|
const t = getConstraintOfTypeArgumentProperty(node.parent, checker);
|
170541
170646
|
if (!t) return void 0;
|
170542
170647
|
switch (node.kind) {
|
170543
170648
|
case 172 /* PropertySignature */:
|
170544
170649
|
return checker.getTypeOfPropertyOfContextualType(t, node.symbol.escapedName);
|
170650
|
+
case 59 /* ColonToken */:
|
170651
|
+
if (node.parent.kind === 172 /* PropertySignature */) {
|
170652
|
+
return t;
|
170653
|
+
}
|
170654
|
+
break;
|
170545
170655
|
case 194 /* IntersectionType */:
|
170546
170656
|
case 188 /* TypeLiteral */:
|
170547
170657
|
case 193 /* UnionType */:
|
170548
170658
|
return t;
|
170659
|
+
case 23 /* OpenBracketToken */:
|
170660
|
+
return checker.getElementTypeOfArrayType(t);
|
170549
170661
|
}
|
170550
170662
|
}
|
170551
170663
|
function isFromObjectTypeDeclaration(node) {
|
@@ -171067,7 +171179,12 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, program,
|
|
171067
171179
|
}
|
171068
171180
|
function fromUnionableLiteralType(grandParent) {
|
171069
171181
|
switch (grandParent.kind) {
|
171182
|
+
case 214 /* CallExpression */:
|
171070
171183
|
case 234 /* ExpressionWithTypeArguments */:
|
171184
|
+
case 287 /* JsxOpeningElement */:
|
171185
|
+
case 286 /* JsxSelfClosingElement */:
|
171186
|
+
case 215 /* NewExpression */:
|
171187
|
+
case 216 /* TaggedTemplateExpression */:
|
171071
171188
|
case 184 /* TypeReference */: {
|
171072
171189
|
const typeArgument = findAncestor(parent2, (n) => n.parent === grandParent);
|
171073
171190
|
if (typeArgument) {
|
@@ -171081,6 +171198,8 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, program,
|
|
171081
171198
|
return void 0;
|
171082
171199
|
}
|
171083
171200
|
return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(objectType));
|
171201
|
+
case 172 /* PropertySignature */:
|
171202
|
+
return { kind: 2 /* Types */, types: getStringLiteralTypes(getConstraintOfTypeArgumentProperty(grandParent, typeChecker)), isNewIdentifier: false };
|
171084
171203
|
case 193 /* UnionType */: {
|
171085
171204
|
const result = fromUnionableLiteralType(walkUpParentheses(grandParent.parent));
|
171086
171205
|
if (!result) {
|
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": "6.0.0-dev.
|
5
|
+
"version": "6.0.0-dev.20251001",
|
6
6
|
"license": "Apache-2.0",
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
8
8
|
"keywords": [
|
@@ -115,5 +115,5 @@
|
|
115
115
|
"node": "20.1.0",
|
116
116
|
"npm": "8.19.4"
|
117
117
|
},
|
118
|
-
"gitHead": "
|
118
|
+
"gitHead": "968d5deb8b5fd4af3ce85433872bdefc1eb17f10"
|
119
119
|
}
|