@typescript-deploys/pr-build 5.3.0-pr-56140-8 → 5.3.0-pr-55811-15
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 +70 -36
- package/lib/tsserver.js +85 -46
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +85 -46
- package/lib/typingsInstaller.js +2 -1
- 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.3";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20231023`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -6653,6 +6653,7 @@ var Diagnostics = {
|
|
|
6653
6653
|
Excessive_complexity_comparing_types_0_and_1: diag(2859, 1 /* Error */, "Excessive_complexity_comparing_types_0_and_1_2859", "Excessive complexity comparing types '{0}' and '{1}'."),
|
|
6654
6654
|
The_left_hand_side_of_an_instanceof_expression_must_be_assignable_to_the_first_argument_of_the_right_hand_side_s_Symbol_hasInstance_method: diag(2860, 1 /* Error */, "The_left_hand_side_of_an_instanceof_expression_must_be_assignable_to_the_first_argument_of_the_right_2860", "The left-hand side of an 'instanceof' expression must be assignable to the first argument of the right-hand side's '[Symbol.hasInstance]' method."),
|
|
6655
6655
|
An_object_s_Symbol_hasInstance_method_must_return_a_boolean_value_for_it_to_be_used_on_the_right_hand_side_of_an_instanceof_expression: diag(2861, 1 /* Error */, "An_object_s_Symbol_hasInstance_method_must_return_a_boolean_value_for_it_to_be_used_on_the_right_han_2861", "An object's '[Symbol.hasInstance]' method must return a boolean value for it to be used on the right-hand side of an 'instanceof' expression."),
|
|
6656
|
+
Type_0_is_generic_and_can_only_be_indexed_for_reading: diag(2862, 1 /* Error */, "Type_0_is_generic_and_can_only_be_indexed_for_reading_2862", "Type '{0}' is generic and can only be indexed for reading."),
|
|
6656
6657
|
Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
6657
6658
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
|
6658
6659
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
|
@@ -23693,17 +23694,18 @@ var asyncGeneratorHelper = {
|
|
|
23693
23694
|
scoped: false,
|
|
23694
23695
|
dependencies: [awaitHelper],
|
|
23695
23696
|
text: `
|
|
23696
|
-
|
|
23697
|
-
|
|
23698
|
-
|
|
23699
|
-
|
|
23700
|
-
|
|
23701
|
-
|
|
23702
|
-
|
|
23703
|
-
|
|
23704
|
-
|
|
23705
|
-
|
|
23706
|
-
}
|
|
23697
|
+
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
23698
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
23699
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
23700
|
+
return i = {}, verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
23701
|
+
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
|
23702
|
+
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
|
23703
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
23704
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
23705
|
+
function fulfill(value) { resume("next", value); }
|
|
23706
|
+
function reject(value) { resume("throw", value); }
|
|
23707
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
23708
|
+
};`
|
|
23707
23709
|
};
|
|
23708
23710
|
var asyncDelegator = {
|
|
23709
23711
|
name: "typescript:asyncDelegator",
|
|
@@ -54049,6 +54051,18 @@ function createTypeChecker(host) {
|
|
|
54049
54051
|
function replaceIndexedAccess(instantiable, type, replacement) {
|
|
54050
54052
|
return instantiateType(instantiable, createTypeMapper([type.indexType, type.objectType], [getNumberLiteralType(0), createTupleType([replacement])]));
|
|
54051
54053
|
}
|
|
54054
|
+
function getLimitedConstraint(type) {
|
|
54055
|
+
const constraint = getConstraintTypeFromMappedType(type.mappedType);
|
|
54056
|
+
if (!(constraint.flags & 1048576 /* Union */ || constraint.flags & 2097152 /* Intersection */)) {
|
|
54057
|
+
return;
|
|
54058
|
+
}
|
|
54059
|
+
const origin = constraint.flags & 1048576 /* Union */ ? constraint.origin : constraint;
|
|
54060
|
+
if (!origin || !(origin.flags & 2097152 /* Intersection */)) {
|
|
54061
|
+
return;
|
|
54062
|
+
}
|
|
54063
|
+
const limitedConstraint = getIntersectionType(origin.types.filter((t) => t !== type.constraintType));
|
|
54064
|
+
return limitedConstraint !== neverType ? limitedConstraint : void 0;
|
|
54065
|
+
}
|
|
54052
54066
|
function resolveReverseMappedTypeMembers(type) {
|
|
54053
54067
|
const indexInfo = getIndexInfoOfType(type.source, stringType);
|
|
54054
54068
|
const modifiers = getMappedTypeModifiers(type.mappedType);
|
|
@@ -54056,7 +54070,14 @@ function createTypeChecker(host) {
|
|
|
54056
54070
|
const optionalMask = modifiers & 4 /* IncludeOptional */ ? 0 : 16777216 /* Optional */;
|
|
54057
54071
|
const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType), readonlyMask && indexInfo.isReadonly)] : emptyArray;
|
|
54058
54072
|
const members = createSymbolTable();
|
|
54073
|
+
const limitedConstraint = getLimitedConstraint(type);
|
|
54059
54074
|
for (const prop of getPropertiesOfType(type.source)) {
|
|
54075
|
+
if (limitedConstraint) {
|
|
54076
|
+
const propertyNameType = getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */);
|
|
54077
|
+
if (!isTypeAssignableTo(propertyNameType, limitedConstraint)) {
|
|
54078
|
+
continue;
|
|
54079
|
+
}
|
|
54080
|
+
}
|
|
54060
54081
|
const checkFlags = 8192 /* ReverseMapped */ | (readonlyMask && isReadonlySymbol(prop) ? 8 /* Readonly */ : 0);
|
|
54061
54082
|
const inferredProp = createSymbol(4 /* Property */ | prop.flags & optionalMask, prop.escapedName, checkFlags);
|
|
54062
54083
|
inferredProp.declarations = prop.declarations;
|
|
@@ -57653,7 +57674,11 @@ function createTypeChecker(host) {
|
|
|
57653
57674
|
if (indexInfo) {
|
|
57654
57675
|
if (accessFlags & 2 /* NoIndexSignatures */ && indexInfo.keyType !== numberType) {
|
|
57655
57676
|
if (accessExpression) {
|
|
57656
|
-
|
|
57677
|
+
if (accessFlags & 4 /* Writing */) {
|
|
57678
|
+
error(accessExpression, Diagnostics.Type_0_is_generic_and_can_only_be_indexed_for_reading, typeToString(originalObjectType));
|
|
57679
|
+
} else {
|
|
57680
|
+
error(accessExpression, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(originalObjectType));
|
|
57681
|
+
}
|
|
57657
57682
|
}
|
|
57658
57683
|
return void 0;
|
|
57659
57684
|
}
|
|
@@ -61099,13 +61124,13 @@ function createTypeChecker(host) {
|
|
|
61099
61124
|
if (recursionFlags & 1 /* Source */) {
|
|
61100
61125
|
sourceStack[sourceDepth] = source2;
|
|
61101
61126
|
sourceDepth++;
|
|
61102
|
-
if (!(expandingFlags & 1 /* Source */) && isDeeplyNestedType(source2, sourceStack, sourceDepth
|
|
61127
|
+
if (!(expandingFlags & 1 /* Source */) && isDeeplyNestedType(source2, sourceStack, sourceDepth))
|
|
61103
61128
|
expandingFlags |= 1 /* Source */;
|
|
61104
61129
|
}
|
|
61105
61130
|
if (recursionFlags & 2 /* Target */) {
|
|
61106
61131
|
targetStack[targetDepth] = target2;
|
|
61107
61132
|
targetDepth++;
|
|
61108
|
-
if (!(expandingFlags & 2 /* Target */) && isDeeplyNestedType(target2, targetStack, targetDepth
|
|
61133
|
+
if (!(expandingFlags & 2 /* Target */) && isDeeplyNestedType(target2, targetStack, targetDepth))
|
|
61109
61134
|
expandingFlags |= 2 /* Target */;
|
|
61110
61135
|
}
|
|
61111
61136
|
let originalHandler;
|
|
@@ -62724,8 +62749,11 @@ function createTypeChecker(host) {
|
|
|
62724
62749
|
function isClassDerivedFromDeclaringClasses(checkClass, prop, writing) {
|
|
62725
62750
|
return forEachProperty(prop, (p) => getDeclarationModifierFlagsFromSymbol(p, writing) & 16 /* Protected */ ? !hasBaseType(checkClass, getDeclaringClass(p)) : false) ? void 0 : checkClass;
|
|
62726
62751
|
}
|
|
62727
|
-
function isDeeplyNestedType(type, stack, depth, maxDepth) {
|
|
62752
|
+
function isDeeplyNestedType(type, stack, depth, maxDepth = 3) {
|
|
62728
62753
|
if (depth >= maxDepth) {
|
|
62754
|
+
if ((getObjectFlags(type) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */) {
|
|
62755
|
+
type = getMappedTargetWithSymbol(type);
|
|
62756
|
+
}
|
|
62729
62757
|
if (type.flags & 2097152 /* Intersection */) {
|
|
62730
62758
|
return some(type.types, (t) => isDeeplyNestedType(t, stack, depth, maxDepth));
|
|
62731
62759
|
}
|
|
@@ -62734,7 +62762,7 @@ function createTypeChecker(host) {
|
|
|
62734
62762
|
let lastTypeId = 0;
|
|
62735
62763
|
for (let i = 0; i < depth; i++) {
|
|
62736
62764
|
const t = stack[i];
|
|
62737
|
-
if (
|
|
62765
|
+
if (hasMatchingRecursionIdentity(t, identity2)) {
|
|
62738
62766
|
if (t.id >= lastTypeId) {
|
|
62739
62767
|
count++;
|
|
62740
62768
|
if (count >= maxDepth) {
|
|
@@ -62747,18 +62775,29 @@ function createTypeChecker(host) {
|
|
|
62747
62775
|
}
|
|
62748
62776
|
return false;
|
|
62749
62777
|
}
|
|
62778
|
+
function getMappedTargetWithSymbol(type) {
|
|
62779
|
+
let target;
|
|
62780
|
+
while ((getObjectFlags(type) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */ && (target = getModifiersTypeFromMappedType(type)) && (target.symbol || target.flags & 2097152 /* Intersection */ && some(target.types, (t) => !!t.symbol))) {
|
|
62781
|
+
type = target;
|
|
62782
|
+
}
|
|
62783
|
+
return type;
|
|
62784
|
+
}
|
|
62785
|
+
function hasMatchingRecursionIdentity(type, identity2) {
|
|
62786
|
+
if ((getObjectFlags(type) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */) {
|
|
62787
|
+
type = getMappedTargetWithSymbol(type);
|
|
62788
|
+
}
|
|
62789
|
+
if (type.flags & 2097152 /* Intersection */) {
|
|
62790
|
+
return some(type.types, (t) => hasMatchingRecursionIdentity(t, identity2));
|
|
62791
|
+
}
|
|
62792
|
+
return getRecursionIdentity(type) === identity2;
|
|
62793
|
+
}
|
|
62750
62794
|
function getRecursionIdentity(type) {
|
|
62751
62795
|
if (type.flags & 524288 /* Object */ && !isObjectOrArrayLiteralType(type)) {
|
|
62752
62796
|
if (getObjectFlags(type) & 4 /* Reference */ && type.node) {
|
|
62753
62797
|
return type.node;
|
|
62754
62798
|
}
|
|
62755
|
-
if (type.symbol) {
|
|
62756
|
-
|
|
62757
|
-
type = getMappedTargetWithSymbol(type);
|
|
62758
|
-
}
|
|
62759
|
-
if (!(getObjectFlags(type) & 16 /* Anonymous */ && type.symbol.flags & 32 /* Class */)) {
|
|
62760
|
-
return type.symbol;
|
|
62761
|
-
}
|
|
62799
|
+
if (type.symbol && !(getObjectFlags(type) & 16 /* Anonymous */ && type.symbol.flags & 32 /* Class */)) {
|
|
62800
|
+
return type.symbol;
|
|
62762
62801
|
}
|
|
62763
62802
|
if (isTupleType(type)) {
|
|
62764
62803
|
return type.target;
|
|
@@ -62778,13 +62817,6 @@ function createTypeChecker(host) {
|
|
|
62778
62817
|
}
|
|
62779
62818
|
return type;
|
|
62780
62819
|
}
|
|
62781
|
-
function getMappedTargetWithSymbol(type) {
|
|
62782
|
-
let target = type;
|
|
62783
|
-
while ((getObjectFlags(target) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */ && isMappedTypeWithKeyofConstraintDeclaration(target)) {
|
|
62784
|
-
target = getModifiersTypeFromMappedType(target);
|
|
62785
|
-
}
|
|
62786
|
-
return target.symbol ? target : type;
|
|
62787
|
-
}
|
|
62788
62820
|
function isPropertyIdenticalTo(sourceProp, targetProp) {
|
|
62789
62821
|
return compareProperties(sourceProp, targetProp, compareTypesIdentical) !== 0 /* False */;
|
|
62790
62822
|
}
|
|
@@ -64166,7 +64198,7 @@ function createTypeChecker(host) {
|
|
|
64166
64198
|
}
|
|
64167
64199
|
}
|
|
64168
64200
|
function inferToMappedType(source, target, constraintType) {
|
|
64169
|
-
if (constraintType.flags & 1048576 /* Union */) {
|
|
64201
|
+
if (constraintType.flags & 1048576 /* Union */ || constraintType.flags & 2097152 /* Intersection */) {
|
|
64170
64202
|
let result = false;
|
|
64171
64203
|
for (const type of constraintType.types) {
|
|
64172
64204
|
result = inferToMappedType(source, target, type) || result;
|
|
@@ -65930,13 +65962,15 @@ function createTypeChecker(host) {
|
|
|
65930
65962
|
return void 0;
|
|
65931
65963
|
}
|
|
65932
65964
|
function getDiscriminantPropertyAccess(expr, computedType) {
|
|
65933
|
-
|
|
65934
|
-
if (type.flags & 1048576 /* Union */) {
|
|
65965
|
+
if (declaredType.flags & 1048576 /* Union */ || computedType.flags & 1048576 /* Union */) {
|
|
65935
65966
|
const access = getCandidateDiscriminantPropertyAccess(expr);
|
|
65936
65967
|
if (access) {
|
|
65937
65968
|
const name = getAccessedPropertyName(access);
|
|
65938
|
-
if (name
|
|
65939
|
-
|
|
65969
|
+
if (name) {
|
|
65970
|
+
const type = declaredType.flags & 1048576 /* Union */ && isTypeSubsetOf(computedType, declaredType) ? declaredType : computedType;
|
|
65971
|
+
if (isDiscriminantProperty(type, name)) {
|
|
65972
|
+
return access;
|
|
65973
|
+
}
|
|
65940
65974
|
}
|
|
65941
65975
|
}
|
|
65942
65976
|
}
|
package/lib/tsserver.js
CHANGED
|
@@ -2328,7 +2328,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2328
2328
|
|
|
2329
2329
|
// src/compiler/corePublic.ts
|
|
2330
2330
|
var versionMajorMinor = "5.3";
|
|
2331
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2331
|
+
var version = `${versionMajorMinor}.0-insiders.20231023`;
|
|
2332
2332
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2333
2333
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2334
2334
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -10181,6 +10181,7 @@ var Diagnostics = {
|
|
|
10181
10181
|
Excessive_complexity_comparing_types_0_and_1: diag(2859, 1 /* Error */, "Excessive_complexity_comparing_types_0_and_1_2859", "Excessive complexity comparing types '{0}' and '{1}'."),
|
|
10182
10182
|
The_left_hand_side_of_an_instanceof_expression_must_be_assignable_to_the_first_argument_of_the_right_hand_side_s_Symbol_hasInstance_method: diag(2860, 1 /* Error */, "The_left_hand_side_of_an_instanceof_expression_must_be_assignable_to_the_first_argument_of_the_right_2860", "The left-hand side of an 'instanceof' expression must be assignable to the first argument of the right-hand side's '[Symbol.hasInstance]' method."),
|
|
10183
10183
|
An_object_s_Symbol_hasInstance_method_must_return_a_boolean_value_for_it_to_be_used_on_the_right_hand_side_of_an_instanceof_expression: diag(2861, 1 /* Error */, "An_object_s_Symbol_hasInstance_method_must_return_a_boolean_value_for_it_to_be_used_on_the_right_han_2861", "An object's '[Symbol.hasInstance]' method must return a boolean value for it to be used on the right-hand side of an 'instanceof' expression."),
|
|
10184
|
+
Type_0_is_generic_and_can_only_be_indexed_for_reading: diag(2862, 1 /* Error */, "Type_0_is_generic_and_can_only_be_indexed_for_reading_2862", "Type '{0}' is generic and can only be indexed for reading."),
|
|
10184
10185
|
Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
10185
10186
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
|
10186
10187
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
|
@@ -27957,17 +27958,18 @@ var asyncGeneratorHelper = {
|
|
|
27957
27958
|
scoped: false,
|
|
27958
27959
|
dependencies: [awaitHelper],
|
|
27959
27960
|
text: `
|
|
27960
|
-
|
|
27961
|
-
|
|
27962
|
-
|
|
27963
|
-
|
|
27964
|
-
|
|
27965
|
-
|
|
27966
|
-
|
|
27967
|
-
|
|
27968
|
-
|
|
27969
|
-
|
|
27970
|
-
}
|
|
27961
|
+
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
27962
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
27963
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
27964
|
+
return i = {}, verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
27965
|
+
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
|
27966
|
+
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
|
27967
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
27968
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
27969
|
+
function fulfill(value) { resume("next", value); }
|
|
27970
|
+
function reject(value) { resume("throw", value); }
|
|
27971
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
27972
|
+
};`
|
|
27971
27973
|
};
|
|
27972
27974
|
var asyncDelegator = {
|
|
27973
27975
|
name: "typescript:asyncDelegator",
|
|
@@ -58761,6 +58763,18 @@ function createTypeChecker(host) {
|
|
|
58761
58763
|
function replaceIndexedAccess(instantiable, type, replacement) {
|
|
58762
58764
|
return instantiateType(instantiable, createTypeMapper([type.indexType, type.objectType], [getNumberLiteralType(0), createTupleType([replacement])]));
|
|
58763
58765
|
}
|
|
58766
|
+
function getLimitedConstraint(type) {
|
|
58767
|
+
const constraint = getConstraintTypeFromMappedType(type.mappedType);
|
|
58768
|
+
if (!(constraint.flags & 1048576 /* Union */ || constraint.flags & 2097152 /* Intersection */)) {
|
|
58769
|
+
return;
|
|
58770
|
+
}
|
|
58771
|
+
const origin = constraint.flags & 1048576 /* Union */ ? constraint.origin : constraint;
|
|
58772
|
+
if (!origin || !(origin.flags & 2097152 /* Intersection */)) {
|
|
58773
|
+
return;
|
|
58774
|
+
}
|
|
58775
|
+
const limitedConstraint = getIntersectionType(origin.types.filter((t) => t !== type.constraintType));
|
|
58776
|
+
return limitedConstraint !== neverType ? limitedConstraint : void 0;
|
|
58777
|
+
}
|
|
58764
58778
|
function resolveReverseMappedTypeMembers(type) {
|
|
58765
58779
|
const indexInfo = getIndexInfoOfType(type.source, stringType);
|
|
58766
58780
|
const modifiers = getMappedTypeModifiers(type.mappedType);
|
|
@@ -58768,7 +58782,14 @@ function createTypeChecker(host) {
|
|
|
58768
58782
|
const optionalMask = modifiers & 4 /* IncludeOptional */ ? 0 : 16777216 /* Optional */;
|
|
58769
58783
|
const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType), readonlyMask && indexInfo.isReadonly)] : emptyArray;
|
|
58770
58784
|
const members = createSymbolTable();
|
|
58785
|
+
const limitedConstraint = getLimitedConstraint(type);
|
|
58771
58786
|
for (const prop of getPropertiesOfType(type.source)) {
|
|
58787
|
+
if (limitedConstraint) {
|
|
58788
|
+
const propertyNameType = getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */);
|
|
58789
|
+
if (!isTypeAssignableTo(propertyNameType, limitedConstraint)) {
|
|
58790
|
+
continue;
|
|
58791
|
+
}
|
|
58792
|
+
}
|
|
58772
58793
|
const checkFlags = 8192 /* ReverseMapped */ | (readonlyMask && isReadonlySymbol(prop) ? 8 /* Readonly */ : 0);
|
|
58773
58794
|
const inferredProp = createSymbol(4 /* Property */ | prop.flags & optionalMask, prop.escapedName, checkFlags);
|
|
58774
58795
|
inferredProp.declarations = prop.declarations;
|
|
@@ -62365,7 +62386,11 @@ function createTypeChecker(host) {
|
|
|
62365
62386
|
if (indexInfo) {
|
|
62366
62387
|
if (accessFlags & 2 /* NoIndexSignatures */ && indexInfo.keyType !== numberType) {
|
|
62367
62388
|
if (accessExpression) {
|
|
62368
|
-
|
|
62389
|
+
if (accessFlags & 4 /* Writing */) {
|
|
62390
|
+
error2(accessExpression, Diagnostics.Type_0_is_generic_and_can_only_be_indexed_for_reading, typeToString(originalObjectType));
|
|
62391
|
+
} else {
|
|
62392
|
+
error2(accessExpression, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(originalObjectType));
|
|
62393
|
+
}
|
|
62369
62394
|
}
|
|
62370
62395
|
return void 0;
|
|
62371
62396
|
}
|
|
@@ -65811,13 +65836,13 @@ function createTypeChecker(host) {
|
|
|
65811
65836
|
if (recursionFlags & 1 /* Source */) {
|
|
65812
65837
|
sourceStack[sourceDepth] = source2;
|
|
65813
65838
|
sourceDepth++;
|
|
65814
|
-
if (!(expandingFlags & 1 /* Source */) && isDeeplyNestedType(source2, sourceStack, sourceDepth
|
|
65839
|
+
if (!(expandingFlags & 1 /* Source */) && isDeeplyNestedType(source2, sourceStack, sourceDepth))
|
|
65815
65840
|
expandingFlags |= 1 /* Source */;
|
|
65816
65841
|
}
|
|
65817
65842
|
if (recursionFlags & 2 /* Target */) {
|
|
65818
65843
|
targetStack[targetDepth] = target2;
|
|
65819
65844
|
targetDepth++;
|
|
65820
|
-
if (!(expandingFlags & 2 /* Target */) && isDeeplyNestedType(target2, targetStack, targetDepth
|
|
65845
|
+
if (!(expandingFlags & 2 /* Target */) && isDeeplyNestedType(target2, targetStack, targetDepth))
|
|
65821
65846
|
expandingFlags |= 2 /* Target */;
|
|
65822
65847
|
}
|
|
65823
65848
|
let originalHandler;
|
|
@@ -67436,8 +67461,11 @@ function createTypeChecker(host) {
|
|
|
67436
67461
|
function isClassDerivedFromDeclaringClasses(checkClass, prop, writing) {
|
|
67437
67462
|
return forEachProperty2(prop, (p) => getDeclarationModifierFlagsFromSymbol(p, writing) & 16 /* Protected */ ? !hasBaseType(checkClass, getDeclaringClass(p)) : false) ? void 0 : checkClass;
|
|
67438
67463
|
}
|
|
67439
|
-
function isDeeplyNestedType(type, stack, depth, maxDepth) {
|
|
67464
|
+
function isDeeplyNestedType(type, stack, depth, maxDepth = 3) {
|
|
67440
67465
|
if (depth >= maxDepth) {
|
|
67466
|
+
if ((getObjectFlags(type) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */) {
|
|
67467
|
+
type = getMappedTargetWithSymbol(type);
|
|
67468
|
+
}
|
|
67441
67469
|
if (type.flags & 2097152 /* Intersection */) {
|
|
67442
67470
|
return some(type.types, (t) => isDeeplyNestedType(t, stack, depth, maxDepth));
|
|
67443
67471
|
}
|
|
@@ -67446,7 +67474,7 @@ function createTypeChecker(host) {
|
|
|
67446
67474
|
let lastTypeId = 0;
|
|
67447
67475
|
for (let i = 0; i < depth; i++) {
|
|
67448
67476
|
const t = stack[i];
|
|
67449
|
-
if (
|
|
67477
|
+
if (hasMatchingRecursionIdentity(t, identity2)) {
|
|
67450
67478
|
if (t.id >= lastTypeId) {
|
|
67451
67479
|
count++;
|
|
67452
67480
|
if (count >= maxDepth) {
|
|
@@ -67459,18 +67487,29 @@ function createTypeChecker(host) {
|
|
|
67459
67487
|
}
|
|
67460
67488
|
return false;
|
|
67461
67489
|
}
|
|
67490
|
+
function getMappedTargetWithSymbol(type) {
|
|
67491
|
+
let target;
|
|
67492
|
+
while ((getObjectFlags(type) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */ && (target = getModifiersTypeFromMappedType(type)) && (target.symbol || target.flags & 2097152 /* Intersection */ && some(target.types, (t) => !!t.symbol))) {
|
|
67493
|
+
type = target;
|
|
67494
|
+
}
|
|
67495
|
+
return type;
|
|
67496
|
+
}
|
|
67497
|
+
function hasMatchingRecursionIdentity(type, identity2) {
|
|
67498
|
+
if ((getObjectFlags(type) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */) {
|
|
67499
|
+
type = getMappedTargetWithSymbol(type);
|
|
67500
|
+
}
|
|
67501
|
+
if (type.flags & 2097152 /* Intersection */) {
|
|
67502
|
+
return some(type.types, (t) => hasMatchingRecursionIdentity(t, identity2));
|
|
67503
|
+
}
|
|
67504
|
+
return getRecursionIdentity(type) === identity2;
|
|
67505
|
+
}
|
|
67462
67506
|
function getRecursionIdentity(type) {
|
|
67463
67507
|
if (type.flags & 524288 /* Object */ && !isObjectOrArrayLiteralType(type)) {
|
|
67464
67508
|
if (getObjectFlags(type) & 4 /* Reference */ && type.node) {
|
|
67465
67509
|
return type.node;
|
|
67466
67510
|
}
|
|
67467
|
-
if (type.symbol) {
|
|
67468
|
-
|
|
67469
|
-
type = getMappedTargetWithSymbol(type);
|
|
67470
|
-
}
|
|
67471
|
-
if (!(getObjectFlags(type) & 16 /* Anonymous */ && type.symbol.flags & 32 /* Class */)) {
|
|
67472
|
-
return type.symbol;
|
|
67473
|
-
}
|
|
67511
|
+
if (type.symbol && !(getObjectFlags(type) & 16 /* Anonymous */ && type.symbol.flags & 32 /* Class */)) {
|
|
67512
|
+
return type.symbol;
|
|
67474
67513
|
}
|
|
67475
67514
|
if (isTupleType(type)) {
|
|
67476
67515
|
return type.target;
|
|
@@ -67490,13 +67529,6 @@ function createTypeChecker(host) {
|
|
|
67490
67529
|
}
|
|
67491
67530
|
return type;
|
|
67492
67531
|
}
|
|
67493
|
-
function getMappedTargetWithSymbol(type) {
|
|
67494
|
-
let target = type;
|
|
67495
|
-
while ((getObjectFlags(target) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */ && isMappedTypeWithKeyofConstraintDeclaration(target)) {
|
|
67496
|
-
target = getModifiersTypeFromMappedType(target);
|
|
67497
|
-
}
|
|
67498
|
-
return target.symbol ? target : type;
|
|
67499
|
-
}
|
|
67500
67532
|
function isPropertyIdenticalTo(sourceProp, targetProp) {
|
|
67501
67533
|
return compareProperties2(sourceProp, targetProp, compareTypesIdentical) !== 0 /* False */;
|
|
67502
67534
|
}
|
|
@@ -68878,7 +68910,7 @@ function createTypeChecker(host) {
|
|
|
68878
68910
|
}
|
|
68879
68911
|
}
|
|
68880
68912
|
function inferToMappedType(source, target, constraintType) {
|
|
68881
|
-
if (constraintType.flags & 1048576 /* Union */) {
|
|
68913
|
+
if (constraintType.flags & 1048576 /* Union */ || constraintType.flags & 2097152 /* Intersection */) {
|
|
68882
68914
|
let result = false;
|
|
68883
68915
|
for (const type of constraintType.types) {
|
|
68884
68916
|
result = inferToMappedType(source, target, type) || result;
|
|
@@ -70642,13 +70674,15 @@ function createTypeChecker(host) {
|
|
|
70642
70674
|
return void 0;
|
|
70643
70675
|
}
|
|
70644
70676
|
function getDiscriminantPropertyAccess(expr, computedType) {
|
|
70645
|
-
|
|
70646
|
-
if (type.flags & 1048576 /* Union */) {
|
|
70677
|
+
if (declaredType.flags & 1048576 /* Union */ || computedType.flags & 1048576 /* Union */) {
|
|
70647
70678
|
const access = getCandidateDiscriminantPropertyAccess(expr);
|
|
70648
70679
|
if (access) {
|
|
70649
70680
|
const name = getAccessedPropertyName(access);
|
|
70650
|
-
if (name
|
|
70651
|
-
|
|
70681
|
+
if (name) {
|
|
70682
|
+
const type = declaredType.flags & 1048576 /* Union */ && isTypeSubsetOf(computedType, declaredType) ? declaredType : computedType;
|
|
70683
|
+
if (isDiscriminantProperty(type, name)) {
|
|
70684
|
+
return access;
|
|
70685
|
+
}
|
|
70652
70686
|
}
|
|
70653
70687
|
}
|
|
70654
70688
|
}
|
|
@@ -149953,7 +149987,8 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
|
|
|
149953
149987
|
defaultImport,
|
|
149954
149988
|
namedImports && arrayFrom(namedImports.entries(), ([name, addAsTypeOnly]) => ({ addAsTypeOnly, name })),
|
|
149955
149989
|
namespaceLikeImport,
|
|
149956
|
-
compilerOptions
|
|
149990
|
+
compilerOptions,
|
|
149991
|
+
preferences
|
|
149957
149992
|
);
|
|
149958
149993
|
newDeclarations = combine(newDeclarations, declarations);
|
|
149959
149994
|
});
|
|
@@ -150658,7 +150693,8 @@ function codeActionForFixWorker(changes, sourceFile, symbolName2, fix, includeSy
|
|
|
150658
150693
|
defaultImport,
|
|
150659
150694
|
namedImports,
|
|
150660
150695
|
namespaceLikeImport,
|
|
150661
|
-
program.getCompilerOptions()
|
|
150696
|
+
program.getCompilerOptions(),
|
|
150697
|
+
preferences
|
|
150662
150698
|
),
|
|
150663
150699
|
/*blankLineBetween*/
|
|
150664
150700
|
true,
|
|
@@ -150790,7 +150826,7 @@ function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImpor
|
|
|
150790
150826
|
const newSpecifiers = stableSort(
|
|
150791
150827
|
namedImports.map(
|
|
150792
150828
|
(namedImport) => factory.createImportSpecifier(
|
|
150793
|
-
(!clause.isTypeOnly || promoteFromTypeOnly2) &&
|
|
150829
|
+
(!clause.isTypeOnly || promoteFromTypeOnly2) && shouldUseTypeOnly(namedImport, preferences),
|
|
150794
150830
|
/*propertyName*/
|
|
150795
150831
|
void 0,
|
|
150796
150832
|
factory.createIdentifier(namedImport.name)
|
|
@@ -150854,21 +150890,24 @@ function getImportTypePrefix(moduleSpecifier, quotePreference) {
|
|
|
150854
150890
|
function needsTypeOnly({ addAsTypeOnly }) {
|
|
150855
150891
|
return addAsTypeOnly === 2 /* Required */;
|
|
150856
150892
|
}
|
|
150857
|
-
function
|
|
150893
|
+
function shouldUseTypeOnly(info, preferences) {
|
|
150894
|
+
return needsTypeOnly(info) || !!preferences.preferTypeOnlyAutoImports && info.addAsTypeOnly !== 4 /* NotAllowed */;
|
|
150895
|
+
}
|
|
150896
|
+
function getNewImports(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport, compilerOptions, preferences) {
|
|
150858
150897
|
const quotedModuleSpecifier = makeStringLiteral(moduleSpecifier, quotePreference);
|
|
150859
150898
|
let statements;
|
|
150860
150899
|
if (defaultImport !== void 0 || (namedImports == null ? void 0 : namedImports.length)) {
|
|
150861
|
-
const topLevelTypeOnly = (!defaultImport || needsTypeOnly(defaultImport)) && every(namedImports, needsTypeOnly) || compilerOptions.verbatimModuleSyntax && (defaultImport == null ? void 0 : defaultImport.addAsTypeOnly) !== 4 /* NotAllowed */ && !some(namedImports, (i) => i.addAsTypeOnly === 4 /* NotAllowed */);
|
|
150900
|
+
const topLevelTypeOnly = (!defaultImport || needsTypeOnly(defaultImport)) && every(namedImports, needsTypeOnly) || (compilerOptions.verbatimModuleSyntax || preferences.preferTypeOnlyAutoImports) && (defaultImport == null ? void 0 : defaultImport.addAsTypeOnly) !== 4 /* NotAllowed */ && !some(namedImports, (i) => i.addAsTypeOnly === 4 /* NotAllowed */);
|
|
150862
150901
|
statements = combine(
|
|
150863
150902
|
statements,
|
|
150864
150903
|
makeImport(
|
|
150865
150904
|
defaultImport && factory.createIdentifier(defaultImport.name),
|
|
150866
150905
|
namedImports == null ? void 0 : namedImports.map(
|
|
150867
|
-
(
|
|
150868
|
-
!topLevelTypeOnly &&
|
|
150906
|
+
(namedImport) => factory.createImportSpecifier(
|
|
150907
|
+
!topLevelTypeOnly && shouldUseTypeOnly(namedImport, preferences),
|
|
150869
150908
|
/*propertyName*/
|
|
150870
150909
|
void 0,
|
|
150871
|
-
factory.createIdentifier(name)
|
|
150910
|
+
factory.createIdentifier(namedImport.name)
|
|
150872
150911
|
)
|
|
150873
150912
|
),
|
|
150874
150913
|
moduleSpecifier,
|
|
@@ -150881,14 +150920,14 @@ function getNewImports(moduleSpecifier, quotePreference, defaultImport, namedImp
|
|
|
150881
150920
|
const declaration = namespaceLikeImport.importKind === 3 /* CommonJS */ ? factory.createImportEqualsDeclaration(
|
|
150882
150921
|
/*modifiers*/
|
|
150883
150922
|
void 0,
|
|
150884
|
-
|
|
150923
|
+
shouldUseTypeOnly(namespaceLikeImport, preferences),
|
|
150885
150924
|
factory.createIdentifier(namespaceLikeImport.name),
|
|
150886
150925
|
factory.createExternalModuleReference(quotedModuleSpecifier)
|
|
150887
150926
|
) : factory.createImportDeclaration(
|
|
150888
150927
|
/*modifiers*/
|
|
150889
150928
|
void 0,
|
|
150890
150929
|
factory.createImportClause(
|
|
150891
|
-
|
|
150930
|
+
shouldUseTypeOnly(namespaceLikeImport, preferences),
|
|
150892
150931
|
/*name*/
|
|
150893
150932
|
void 0,
|
|
150894
150933
|
factory.createNamespaceImport(factory.createIdentifier(namespaceLikeImport.name))
|
package/lib/typescript.d.ts
CHANGED
|
@@ -8742,6 +8742,7 @@ declare namespace ts {
|
|
|
8742
8742
|
readonly interactiveInlayHints?: boolean;
|
|
8743
8743
|
readonly allowRenameOfImportPath?: boolean;
|
|
8744
8744
|
readonly autoImportFileExcludePatterns?: string[];
|
|
8745
|
+
readonly preferTypeOnlyAutoImports?: boolean;
|
|
8745
8746
|
readonly organizeImportsIgnoreCase?: "auto" | boolean;
|
|
8746
8747
|
readonly organizeImportsCollation?: "ordinal" | "unicode";
|
|
8747
8748
|
readonly organizeImportsLocale?: string;
|
package/lib/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.3";
|
|
38
|
-
version = `${versionMajorMinor}.0-insiders.
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20231023`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -7963,6 +7963,7 @@ ${lanes.join("\n")}
|
|
|
7963
7963
|
Excessive_complexity_comparing_types_0_and_1: diag(2859, 1 /* Error */, "Excessive_complexity_comparing_types_0_and_1_2859", "Excessive complexity comparing types '{0}' and '{1}'."),
|
|
7964
7964
|
The_left_hand_side_of_an_instanceof_expression_must_be_assignable_to_the_first_argument_of_the_right_hand_side_s_Symbol_hasInstance_method: diag(2860, 1 /* Error */, "The_left_hand_side_of_an_instanceof_expression_must_be_assignable_to_the_first_argument_of_the_right_2860", "The left-hand side of an 'instanceof' expression must be assignable to the first argument of the right-hand side's '[Symbol.hasInstance]' method."),
|
|
7965
7965
|
An_object_s_Symbol_hasInstance_method_must_return_a_boolean_value_for_it_to_be_used_on_the_right_hand_side_of_an_instanceof_expression: diag(2861, 1 /* Error */, "An_object_s_Symbol_hasInstance_method_must_return_a_boolean_value_for_it_to_be_used_on_the_right_han_2861", "An object's '[Symbol.hasInstance]' method must return a boolean value for it to be used on the right-hand side of an 'instanceof' expression."),
|
|
7966
|
+
Type_0_is_generic_and_can_only_be_indexed_for_reading: diag(2862, 1 /* Error */, "Type_0_is_generic_and_can_only_be_indexed_for_reading_2862", "Type '{0}' is generic and can only be indexed for reading."),
|
|
7966
7967
|
Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
7967
7968
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
|
7968
7969
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
|
@@ -25834,17 +25835,18 @@ ${lanes.join("\n")}
|
|
|
25834
25835
|
scoped: false,
|
|
25835
25836
|
dependencies: [awaitHelper],
|
|
25836
25837
|
text: `
|
|
25837
|
-
|
|
25838
|
-
|
|
25839
|
-
|
|
25840
|
-
|
|
25841
|
-
|
|
25842
|
-
|
|
25843
|
-
|
|
25844
|
-
|
|
25845
|
-
|
|
25846
|
-
|
|
25847
|
-
}
|
|
25838
|
+
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
25839
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
25840
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
25841
|
+
return i = {}, verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
25842
|
+
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
|
25843
|
+
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
|
25844
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
25845
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
25846
|
+
function fulfill(value) { resume("next", value); }
|
|
25847
|
+
function reject(value) { resume("throw", value); }
|
|
25848
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
25849
|
+
};`
|
|
25848
25850
|
};
|
|
25849
25851
|
asyncDelegator = {
|
|
25850
25852
|
name: "typescript:asyncDelegator",
|
|
@@ -56528,6 +56530,18 @@ ${lanes.join("\n")}
|
|
|
56528
56530
|
function replaceIndexedAccess(instantiable, type, replacement) {
|
|
56529
56531
|
return instantiateType(instantiable, createTypeMapper([type.indexType, type.objectType], [getNumberLiteralType(0), createTupleType([replacement])]));
|
|
56530
56532
|
}
|
|
56533
|
+
function getLimitedConstraint(type) {
|
|
56534
|
+
const constraint = getConstraintTypeFromMappedType(type.mappedType);
|
|
56535
|
+
if (!(constraint.flags & 1048576 /* Union */ || constraint.flags & 2097152 /* Intersection */)) {
|
|
56536
|
+
return;
|
|
56537
|
+
}
|
|
56538
|
+
const origin = constraint.flags & 1048576 /* Union */ ? constraint.origin : constraint;
|
|
56539
|
+
if (!origin || !(origin.flags & 2097152 /* Intersection */)) {
|
|
56540
|
+
return;
|
|
56541
|
+
}
|
|
56542
|
+
const limitedConstraint = getIntersectionType(origin.types.filter((t) => t !== type.constraintType));
|
|
56543
|
+
return limitedConstraint !== neverType ? limitedConstraint : void 0;
|
|
56544
|
+
}
|
|
56531
56545
|
function resolveReverseMappedTypeMembers(type) {
|
|
56532
56546
|
const indexInfo = getIndexInfoOfType(type.source, stringType);
|
|
56533
56547
|
const modifiers = getMappedTypeModifiers(type.mappedType);
|
|
@@ -56535,7 +56549,14 @@ ${lanes.join("\n")}
|
|
|
56535
56549
|
const optionalMask = modifiers & 4 /* IncludeOptional */ ? 0 : 16777216 /* Optional */;
|
|
56536
56550
|
const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType), readonlyMask && indexInfo.isReadonly)] : emptyArray;
|
|
56537
56551
|
const members = createSymbolTable();
|
|
56552
|
+
const limitedConstraint = getLimitedConstraint(type);
|
|
56538
56553
|
for (const prop of getPropertiesOfType(type.source)) {
|
|
56554
|
+
if (limitedConstraint) {
|
|
56555
|
+
const propertyNameType = getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */);
|
|
56556
|
+
if (!isTypeAssignableTo(propertyNameType, limitedConstraint)) {
|
|
56557
|
+
continue;
|
|
56558
|
+
}
|
|
56559
|
+
}
|
|
56539
56560
|
const checkFlags = 8192 /* ReverseMapped */ | (readonlyMask && isReadonlySymbol(prop) ? 8 /* Readonly */ : 0);
|
|
56540
56561
|
const inferredProp = createSymbol(4 /* Property */ | prop.flags & optionalMask, prop.escapedName, checkFlags);
|
|
56541
56562
|
inferredProp.declarations = prop.declarations;
|
|
@@ -60132,7 +60153,11 @@ ${lanes.join("\n")}
|
|
|
60132
60153
|
if (indexInfo) {
|
|
60133
60154
|
if (accessFlags & 2 /* NoIndexSignatures */ && indexInfo.keyType !== numberType) {
|
|
60134
60155
|
if (accessExpression) {
|
|
60135
|
-
|
|
60156
|
+
if (accessFlags & 4 /* Writing */) {
|
|
60157
|
+
error2(accessExpression, Diagnostics.Type_0_is_generic_and_can_only_be_indexed_for_reading, typeToString(originalObjectType));
|
|
60158
|
+
} else {
|
|
60159
|
+
error2(accessExpression, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(originalObjectType));
|
|
60160
|
+
}
|
|
60136
60161
|
}
|
|
60137
60162
|
return void 0;
|
|
60138
60163
|
}
|
|
@@ -63578,13 +63603,13 @@ ${lanes.join("\n")}
|
|
|
63578
63603
|
if (recursionFlags & 1 /* Source */) {
|
|
63579
63604
|
sourceStack[sourceDepth] = source2;
|
|
63580
63605
|
sourceDepth++;
|
|
63581
|
-
if (!(expandingFlags & 1 /* Source */) && isDeeplyNestedType(source2, sourceStack, sourceDepth
|
|
63606
|
+
if (!(expandingFlags & 1 /* Source */) && isDeeplyNestedType(source2, sourceStack, sourceDepth))
|
|
63582
63607
|
expandingFlags |= 1 /* Source */;
|
|
63583
63608
|
}
|
|
63584
63609
|
if (recursionFlags & 2 /* Target */) {
|
|
63585
63610
|
targetStack[targetDepth] = target2;
|
|
63586
63611
|
targetDepth++;
|
|
63587
|
-
if (!(expandingFlags & 2 /* Target */) && isDeeplyNestedType(target2, targetStack, targetDepth
|
|
63612
|
+
if (!(expandingFlags & 2 /* Target */) && isDeeplyNestedType(target2, targetStack, targetDepth))
|
|
63588
63613
|
expandingFlags |= 2 /* Target */;
|
|
63589
63614
|
}
|
|
63590
63615
|
let originalHandler;
|
|
@@ -65203,8 +65228,11 @@ ${lanes.join("\n")}
|
|
|
65203
65228
|
function isClassDerivedFromDeclaringClasses(checkClass, prop, writing) {
|
|
65204
65229
|
return forEachProperty2(prop, (p) => getDeclarationModifierFlagsFromSymbol(p, writing) & 16 /* Protected */ ? !hasBaseType(checkClass, getDeclaringClass(p)) : false) ? void 0 : checkClass;
|
|
65205
65230
|
}
|
|
65206
|
-
function isDeeplyNestedType(type, stack, depth, maxDepth) {
|
|
65231
|
+
function isDeeplyNestedType(type, stack, depth, maxDepth = 3) {
|
|
65207
65232
|
if (depth >= maxDepth) {
|
|
65233
|
+
if ((getObjectFlags(type) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */) {
|
|
65234
|
+
type = getMappedTargetWithSymbol(type);
|
|
65235
|
+
}
|
|
65208
65236
|
if (type.flags & 2097152 /* Intersection */) {
|
|
65209
65237
|
return some(type.types, (t) => isDeeplyNestedType(t, stack, depth, maxDepth));
|
|
65210
65238
|
}
|
|
@@ -65213,7 +65241,7 @@ ${lanes.join("\n")}
|
|
|
65213
65241
|
let lastTypeId = 0;
|
|
65214
65242
|
for (let i = 0; i < depth; i++) {
|
|
65215
65243
|
const t = stack[i];
|
|
65216
|
-
if (
|
|
65244
|
+
if (hasMatchingRecursionIdentity(t, identity2)) {
|
|
65217
65245
|
if (t.id >= lastTypeId) {
|
|
65218
65246
|
count++;
|
|
65219
65247
|
if (count >= maxDepth) {
|
|
@@ -65226,18 +65254,29 @@ ${lanes.join("\n")}
|
|
|
65226
65254
|
}
|
|
65227
65255
|
return false;
|
|
65228
65256
|
}
|
|
65257
|
+
function getMappedTargetWithSymbol(type) {
|
|
65258
|
+
let target;
|
|
65259
|
+
while ((getObjectFlags(type) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */ && (target = getModifiersTypeFromMappedType(type)) && (target.symbol || target.flags & 2097152 /* Intersection */ && some(target.types, (t) => !!t.symbol))) {
|
|
65260
|
+
type = target;
|
|
65261
|
+
}
|
|
65262
|
+
return type;
|
|
65263
|
+
}
|
|
65264
|
+
function hasMatchingRecursionIdentity(type, identity2) {
|
|
65265
|
+
if ((getObjectFlags(type) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */) {
|
|
65266
|
+
type = getMappedTargetWithSymbol(type);
|
|
65267
|
+
}
|
|
65268
|
+
if (type.flags & 2097152 /* Intersection */) {
|
|
65269
|
+
return some(type.types, (t) => hasMatchingRecursionIdentity(t, identity2));
|
|
65270
|
+
}
|
|
65271
|
+
return getRecursionIdentity(type) === identity2;
|
|
65272
|
+
}
|
|
65229
65273
|
function getRecursionIdentity(type) {
|
|
65230
65274
|
if (type.flags & 524288 /* Object */ && !isObjectOrArrayLiteralType(type)) {
|
|
65231
65275
|
if (getObjectFlags(type) & 4 /* Reference */ && type.node) {
|
|
65232
65276
|
return type.node;
|
|
65233
65277
|
}
|
|
65234
|
-
if (type.symbol) {
|
|
65235
|
-
|
|
65236
|
-
type = getMappedTargetWithSymbol(type);
|
|
65237
|
-
}
|
|
65238
|
-
if (!(getObjectFlags(type) & 16 /* Anonymous */ && type.symbol.flags & 32 /* Class */)) {
|
|
65239
|
-
return type.symbol;
|
|
65240
|
-
}
|
|
65278
|
+
if (type.symbol && !(getObjectFlags(type) & 16 /* Anonymous */ && type.symbol.flags & 32 /* Class */)) {
|
|
65279
|
+
return type.symbol;
|
|
65241
65280
|
}
|
|
65242
65281
|
if (isTupleType(type)) {
|
|
65243
65282
|
return type.target;
|
|
@@ -65257,13 +65296,6 @@ ${lanes.join("\n")}
|
|
|
65257
65296
|
}
|
|
65258
65297
|
return type;
|
|
65259
65298
|
}
|
|
65260
|
-
function getMappedTargetWithSymbol(type) {
|
|
65261
|
-
let target = type;
|
|
65262
|
-
while ((getObjectFlags(target) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */ && isMappedTypeWithKeyofConstraintDeclaration(target)) {
|
|
65263
|
-
target = getModifiersTypeFromMappedType(target);
|
|
65264
|
-
}
|
|
65265
|
-
return target.symbol ? target : type;
|
|
65266
|
-
}
|
|
65267
65299
|
function isPropertyIdenticalTo(sourceProp, targetProp) {
|
|
65268
65300
|
return compareProperties2(sourceProp, targetProp, compareTypesIdentical) !== 0 /* False */;
|
|
65269
65301
|
}
|
|
@@ -66645,7 +66677,7 @@ ${lanes.join("\n")}
|
|
|
66645
66677
|
}
|
|
66646
66678
|
}
|
|
66647
66679
|
function inferToMappedType(source, target, constraintType) {
|
|
66648
|
-
if (constraintType.flags & 1048576 /* Union */) {
|
|
66680
|
+
if (constraintType.flags & 1048576 /* Union */ || constraintType.flags & 2097152 /* Intersection */) {
|
|
66649
66681
|
let result = false;
|
|
66650
66682
|
for (const type of constraintType.types) {
|
|
66651
66683
|
result = inferToMappedType(source, target, type) || result;
|
|
@@ -68409,13 +68441,15 @@ ${lanes.join("\n")}
|
|
|
68409
68441
|
return void 0;
|
|
68410
68442
|
}
|
|
68411
68443
|
function getDiscriminantPropertyAccess(expr, computedType) {
|
|
68412
|
-
|
|
68413
|
-
if (type.flags & 1048576 /* Union */) {
|
|
68444
|
+
if (declaredType.flags & 1048576 /* Union */ || computedType.flags & 1048576 /* Union */) {
|
|
68414
68445
|
const access = getCandidateDiscriminantPropertyAccess(expr);
|
|
68415
68446
|
if (access) {
|
|
68416
68447
|
const name = getAccessedPropertyName(access);
|
|
68417
|
-
if (name
|
|
68418
|
-
|
|
68448
|
+
if (name) {
|
|
68449
|
+
const type = declaredType.flags & 1048576 /* Union */ && isTypeSubsetOf(computedType, declaredType) ? declaredType : computedType;
|
|
68450
|
+
if (isDiscriminantProperty(type, name)) {
|
|
68451
|
+
return access;
|
|
68452
|
+
}
|
|
68419
68453
|
}
|
|
68420
68454
|
}
|
|
68421
68455
|
}
|
|
@@ -148674,7 +148708,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
148674
148708
|
defaultImport,
|
|
148675
148709
|
namedImports && arrayFrom(namedImports.entries(), ([name, addAsTypeOnly]) => ({ addAsTypeOnly, name })),
|
|
148676
148710
|
namespaceLikeImport,
|
|
148677
|
-
compilerOptions
|
|
148711
|
+
compilerOptions,
|
|
148712
|
+
preferences
|
|
148678
148713
|
);
|
|
148679
148714
|
newDeclarations = combine(newDeclarations, declarations);
|
|
148680
148715
|
});
|
|
@@ -149379,7 +149414,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
149379
149414
|
defaultImport,
|
|
149380
149415
|
namedImports,
|
|
149381
149416
|
namespaceLikeImport,
|
|
149382
|
-
program.getCompilerOptions()
|
|
149417
|
+
program.getCompilerOptions(),
|
|
149418
|
+
preferences
|
|
149383
149419
|
),
|
|
149384
149420
|
/*blankLineBetween*/
|
|
149385
149421
|
true,
|
|
@@ -149511,7 +149547,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
149511
149547
|
const newSpecifiers = stableSort(
|
|
149512
149548
|
namedImports.map(
|
|
149513
149549
|
(namedImport) => factory.createImportSpecifier(
|
|
149514
|
-
(!clause.isTypeOnly || promoteFromTypeOnly2) &&
|
|
149550
|
+
(!clause.isTypeOnly || promoteFromTypeOnly2) && shouldUseTypeOnly(namedImport, preferences),
|
|
149515
149551
|
/*propertyName*/
|
|
149516
149552
|
void 0,
|
|
149517
149553
|
factory.createIdentifier(namedImport.name)
|
|
@@ -149575,21 +149611,24 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
149575
149611
|
function needsTypeOnly({ addAsTypeOnly }) {
|
|
149576
149612
|
return addAsTypeOnly === 2 /* Required */;
|
|
149577
149613
|
}
|
|
149578
|
-
function
|
|
149614
|
+
function shouldUseTypeOnly(info, preferences) {
|
|
149615
|
+
return needsTypeOnly(info) || !!preferences.preferTypeOnlyAutoImports && info.addAsTypeOnly !== 4 /* NotAllowed */;
|
|
149616
|
+
}
|
|
149617
|
+
function getNewImports(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport, compilerOptions, preferences) {
|
|
149579
149618
|
const quotedModuleSpecifier = makeStringLiteral(moduleSpecifier, quotePreference);
|
|
149580
149619
|
let statements;
|
|
149581
149620
|
if (defaultImport !== void 0 || (namedImports == null ? void 0 : namedImports.length)) {
|
|
149582
|
-
const topLevelTypeOnly = (!defaultImport || needsTypeOnly(defaultImport)) && every(namedImports, needsTypeOnly) || compilerOptions.verbatimModuleSyntax && (defaultImport == null ? void 0 : defaultImport.addAsTypeOnly) !== 4 /* NotAllowed */ && !some(namedImports, (i) => i.addAsTypeOnly === 4 /* NotAllowed */);
|
|
149621
|
+
const topLevelTypeOnly = (!defaultImport || needsTypeOnly(defaultImport)) && every(namedImports, needsTypeOnly) || (compilerOptions.verbatimModuleSyntax || preferences.preferTypeOnlyAutoImports) && (defaultImport == null ? void 0 : defaultImport.addAsTypeOnly) !== 4 /* NotAllowed */ && !some(namedImports, (i) => i.addAsTypeOnly === 4 /* NotAllowed */);
|
|
149583
149622
|
statements = combine(
|
|
149584
149623
|
statements,
|
|
149585
149624
|
makeImport(
|
|
149586
149625
|
defaultImport && factory.createIdentifier(defaultImport.name),
|
|
149587
149626
|
namedImports == null ? void 0 : namedImports.map(
|
|
149588
|
-
(
|
|
149589
|
-
!topLevelTypeOnly &&
|
|
149627
|
+
(namedImport) => factory.createImportSpecifier(
|
|
149628
|
+
!topLevelTypeOnly && shouldUseTypeOnly(namedImport, preferences),
|
|
149590
149629
|
/*propertyName*/
|
|
149591
149630
|
void 0,
|
|
149592
|
-
factory.createIdentifier(name)
|
|
149631
|
+
factory.createIdentifier(namedImport.name)
|
|
149593
149632
|
)
|
|
149594
149633
|
),
|
|
149595
149634
|
moduleSpecifier,
|
|
@@ -149602,14 +149641,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
149602
149641
|
const declaration = namespaceLikeImport.importKind === 3 /* CommonJS */ ? factory.createImportEqualsDeclaration(
|
|
149603
149642
|
/*modifiers*/
|
|
149604
149643
|
void 0,
|
|
149605
|
-
|
|
149644
|
+
shouldUseTypeOnly(namespaceLikeImport, preferences),
|
|
149606
149645
|
factory.createIdentifier(namespaceLikeImport.name),
|
|
149607
149646
|
factory.createExternalModuleReference(quotedModuleSpecifier)
|
|
149608
149647
|
) : factory.createImportDeclaration(
|
|
149609
149648
|
/*modifiers*/
|
|
149610
149649
|
void 0,
|
|
149611
149650
|
factory.createImportClause(
|
|
149612
|
-
|
|
149651
|
+
shouldUseTypeOnly(namespaceLikeImport, preferences),
|
|
149613
149652
|
/*name*/
|
|
149614
149653
|
void 0,
|
|
149615
149654
|
factory.createNamespaceImport(factory.createIdentifier(namespaceLikeImport.name))
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
|
|
|
54
54
|
|
|
55
55
|
// src/compiler/corePublic.ts
|
|
56
56
|
var versionMajorMinor = "5.3";
|
|
57
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
57
|
+
var version = `${versionMajorMinor}.0-insiders.20231023`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -6030,6 +6030,7 @@ var Diagnostics = {
|
|
|
6030
6030
|
Excessive_complexity_comparing_types_0_and_1: diag(2859, 1 /* Error */, "Excessive_complexity_comparing_types_0_and_1_2859", "Excessive complexity comparing types '{0}' and '{1}'."),
|
|
6031
6031
|
The_left_hand_side_of_an_instanceof_expression_must_be_assignable_to_the_first_argument_of_the_right_hand_side_s_Symbol_hasInstance_method: diag(2860, 1 /* Error */, "The_left_hand_side_of_an_instanceof_expression_must_be_assignable_to_the_first_argument_of_the_right_2860", "The left-hand side of an 'instanceof' expression must be assignable to the first argument of the right-hand side's '[Symbol.hasInstance]' method."),
|
|
6032
6032
|
An_object_s_Symbol_hasInstance_method_must_return_a_boolean_value_for_it_to_be_used_on_the_right_hand_side_of_an_instanceof_expression: diag(2861, 1 /* Error */, "An_object_s_Symbol_hasInstance_method_must_return_a_boolean_value_for_it_to_be_used_on_the_right_han_2861", "An object's '[Symbol.hasInstance]' method must return a boolean value for it to be used on the right-hand side of an 'instanceof' expression."),
|
|
6033
|
+
Type_0_is_generic_and_can_only_be_indexed_for_reading: diag(2862, 1 /* Error */, "Type_0_is_generic_and_can_only_be_indexed_for_reading_2862", "Type '{0}' is generic and can only be indexed for reading."),
|
|
6033
6034
|
Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
6034
6035
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
|
6035
6036
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@typescript-deploys/pr-build",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.3.0-pr-
|
|
5
|
+
"version": "5.3.0-pr-55811-15",
|
|
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": "2aeee792ffeabc91b8b8d9806cc4c3be910d772b"
|
|
119
119
|
}
|