@typescript-deploys/pr-build 5.0.0-pr-52865-6 → 5.0.0-pr-49107-5
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 +26 -14
- package/lib/tsserver.js +33 -29
- package/lib/tsserverlibrary.js +33 -29
- package/lib/typescript.js +33 -28
- package/lib/typingsInstaller.js +1 -1
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -23,7 +23,7 @@ var __export = (target, all) => {
|
|
|
23
23
|
|
|
24
24
|
// src/compiler/corePublic.ts
|
|
25
25
|
var versionMajorMinor = "5.0";
|
|
26
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
26
|
+
var version = `${versionMajorMinor}.0-insiders.20230221`;
|
|
27
27
|
|
|
28
28
|
// src/compiler/core.ts
|
|
29
29
|
var emptyArray = [];
|
|
@@ -15744,9 +15744,6 @@ function getClassLikeDeclarationOfSymbol(symbol) {
|
|
|
15744
15744
|
function getObjectFlags(type) {
|
|
15745
15745
|
return type.flags & 3899393 /* ObjectFlagsType */ ? type.objectFlags : 0;
|
|
15746
15746
|
}
|
|
15747
|
-
function typeHasCallOrConstructSignatures(type, checker) {
|
|
15748
|
-
return checker.getSignaturesOfType(type, 0 /* Call */).length !== 0 || checker.getSignaturesOfType(type, 1 /* Construct */).length !== 0;
|
|
15749
|
-
}
|
|
15750
15747
|
function isUMDExportSymbol(symbol) {
|
|
15751
15748
|
return !!symbol && !!symbol.declarations && !!symbol.declarations[0] && isNamespaceExportDeclaration(symbol.declarations[0]);
|
|
15752
15749
|
}
|
|
@@ -42989,7 +42986,8 @@ function createTypeChecker(host) {
|
|
|
42989
42986
|
isPropertyAccessible,
|
|
42990
42987
|
getTypeOnlyAliasDeclaration,
|
|
42991
42988
|
getMemberOverrideModifierStatus,
|
|
42992
|
-
isTypeParameterPossiblyReferenced
|
|
42989
|
+
isTypeParameterPossiblyReferenced,
|
|
42990
|
+
typeHasCallOrConstructSignatures
|
|
42993
42991
|
};
|
|
42994
42992
|
function runWithoutResolvedSignatureCaching(node, fn) {
|
|
42995
42993
|
const containingCall = findAncestor(node, isCallLikeExpression);
|
|
@@ -50496,7 +50494,7 @@ function createTypeChecker(host) {
|
|
|
50496
50494
|
}
|
|
50497
50495
|
function findResolutionCycleStartIndex(target, propertyName) {
|
|
50498
50496
|
for (let i = resolutionTargets.length - 1; i >= 0; i--) {
|
|
50499
|
-
if (
|
|
50497
|
+
if (resolutionTargetHasProperty(resolutionTargets[i], resolutionPropertyNames[i])) {
|
|
50500
50498
|
return -1;
|
|
50501
50499
|
}
|
|
50502
50500
|
if (resolutionTargets[i] === target && resolutionPropertyNames[i] === propertyName) {
|
|
@@ -50505,7 +50503,7 @@ function createTypeChecker(host) {
|
|
|
50505
50503
|
}
|
|
50506
50504
|
return -1;
|
|
50507
50505
|
}
|
|
50508
|
-
function
|
|
50506
|
+
function resolutionTargetHasProperty(target, propertyName) {
|
|
50509
50507
|
switch (propertyName) {
|
|
50510
50508
|
case 0 /* Type */:
|
|
50511
50509
|
return !!getSymbolLinks(target).type;
|
|
@@ -53542,6 +53540,20 @@ function createTypeChecker(host) {
|
|
|
53542
53540
|
return t.flags & 1048576 /* Union */ && baseTypes.length === types.length ? getUnionType(baseTypes) : t.flags & 2097152 /* Intersection */ && baseTypes.length ? getIntersectionType(baseTypes) : void 0;
|
|
53543
53541
|
}
|
|
53544
53542
|
if (t.flags & 4194304 /* Index */) {
|
|
53543
|
+
if (t.type.flags & 8388608 /* IndexedAccess */) {
|
|
53544
|
+
const indexedAccess = t.type;
|
|
53545
|
+
if (!isGenericObjectType(indexedAccess.objectType)) {
|
|
53546
|
+
const baseIndexType = getBaseConstraint(indexedAccess.indexType);
|
|
53547
|
+
const indexedAccessType = baseIndexType && getIndexedAccessTypeOrUndefined(indexedAccess.objectType, baseIndexType);
|
|
53548
|
+
const mappedIndexTypeOfIndexedAccess = indexedAccessType && mapType(indexedAccessType, getIndexType);
|
|
53549
|
+
const narrowed = mappedIndexTypeOfIndexedAccess && filterType(keyofConstraintType, (t2) => {
|
|
53550
|
+
return !(getIntersectionType([t2, mappedIndexTypeOfIndexedAccess]).flags & 131072 /* Never */);
|
|
53551
|
+
});
|
|
53552
|
+
if (narrowed) {
|
|
53553
|
+
return narrowed;
|
|
53554
|
+
}
|
|
53555
|
+
}
|
|
53556
|
+
}
|
|
53545
53557
|
return keyofConstraintType;
|
|
53546
53558
|
}
|
|
53547
53559
|
if (t.flags & 134217728 /* TemplateLiteral */) {
|
|
@@ -56913,7 +56925,7 @@ function createTypeChecker(host) {
|
|
|
56913
56925
|
}
|
|
56914
56926
|
function getActualTypeVariable(type) {
|
|
56915
56927
|
if (type.flags & 33554432 /* Substitution */) {
|
|
56916
|
-
return type.baseType;
|
|
56928
|
+
return getActualTypeVariable(type.baseType);
|
|
56917
56929
|
}
|
|
56918
56930
|
if (type.flags & 8388608 /* IndexedAccess */ && (type.objectType.flags & 33554432 /* Substitution */ || type.indexType.flags & 33554432 /* Substitution */)) {
|
|
56919
56931
|
return getIndexedAccessType(getActualTypeVariable(type.objectType), getActualTypeVariable(type.indexType));
|
|
@@ -59406,7 +59418,7 @@ function createTypeChecker(host) {
|
|
|
59406
59418
|
return 0 /* False */;
|
|
59407
59419
|
}
|
|
59408
59420
|
}
|
|
59409
|
-
const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (134348796 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 ||
|
|
59421
|
+
const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (134348796 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures(source2));
|
|
59410
59422
|
const isComparingJsxAttributes = !!(getObjectFlags(source2) & 2048 /* JsxAttributes */);
|
|
59411
59423
|
if (isPerformingCommonPropertyChecks && !hasCommonProperties(source2, target2, isComparingJsxAttributes)) {
|
|
59412
59424
|
if (reportErrors2) {
|
|
@@ -62004,7 +62016,7 @@ function createTypeChecker(host) {
|
|
|
62004
62016
|
}
|
|
62005
62017
|
function isObjectTypeWithInferableIndex(type) {
|
|
62006
62018
|
const objectFlags = getObjectFlags(type);
|
|
62007
|
-
return type.flags & 2097152 /* Intersection */ ? every(type.types, isObjectTypeWithInferableIndex) : !!(type.symbol && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */ | 384 /* Enum */ | 512 /* ValueModule */)) !== 0 && !(type.symbol.flags & 32 /* Class */) && !
|
|
62019
|
+
return type.flags & 2097152 /* Intersection */ ? every(type.types, isObjectTypeWithInferableIndex) : !!(type.symbol && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */ | 384 /* Enum */ | 512 /* ValueModule */)) !== 0 && !(type.symbol.flags & 32 /* Class */) && !typeHasCallOrConstructSignatures(type)) || !!(objectFlags & 4194304 /* ObjectRestType */) || !!(objectFlags & 1024 /* ReverseMapped */ && isObjectTypeWithInferableIndex(type.source));
|
|
62008
62020
|
}
|
|
62009
62021
|
function createSymbolWithType(source, type) {
|
|
62010
62022
|
const symbol = createSymbol(source.flags, source.escapedName, getCheckFlags(source) & 8 /* Readonly */);
|
|
@@ -63329,7 +63341,7 @@ function createTypeChecker(host) {
|
|
|
63329
63341
|
const constraint = getConstraintOfTypeParameter(inference.typeParameter);
|
|
63330
63342
|
if (constraint) {
|
|
63331
63343
|
const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
|
|
63332
|
-
if (!inferredType ||
|
|
63344
|
+
if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
|
63333
63345
|
inference.inferredType = inferredType = instantiatedConstraint;
|
|
63334
63346
|
}
|
|
63335
63347
|
}
|
|
@@ -72449,7 +72461,7 @@ function createTypeChecker(host) {
|
|
|
72449
72461
|
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 134348796 /* Primitive */)) {
|
|
72450
72462
|
error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
|
|
72451
72463
|
}
|
|
72452
|
-
if (!(isTypeAny(rightType) ||
|
|
72464
|
+
if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
|
|
72453
72465
|
error(right, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type);
|
|
72454
72466
|
}
|
|
72455
72467
|
return booleanType;
|
|
@@ -80120,8 +80132,8 @@ function createTypeChecker(host) {
|
|
|
80120
80132
|
}
|
|
80121
80133
|
return getNamedMembers(propsByName);
|
|
80122
80134
|
}
|
|
80123
|
-
function
|
|
80124
|
-
return
|
|
80135
|
+
function typeHasCallOrConstructSignatures(type) {
|
|
80136
|
+
return getSignaturesOfType(type, 0 /* Call */).length !== 0 || getSignaturesOfType(type, 1 /* Construct */).length !== 0;
|
|
80125
80137
|
}
|
|
80126
80138
|
function getRootSymbols(symbol) {
|
|
80127
80139
|
const roots = getImmediateRootSymbols(symbol);
|
package/lib/tsserver.js
CHANGED
|
@@ -2233,7 +2233,6 @@ __export(server_exports, {
|
|
|
2233
2233
|
typeAcquisitionDeclarations: () => typeAcquisitionDeclarations,
|
|
2234
2234
|
typeAliasNamePart: () => typeAliasNamePart,
|
|
2235
2235
|
typeDirectiveIsEqualTo: () => typeDirectiveIsEqualTo,
|
|
2236
|
-
typeHasCallOrConstructSignatures: () => typeHasCallOrConstructSignatures,
|
|
2237
2236
|
typeKeywords: () => typeKeywords,
|
|
2238
2237
|
typeParameterNamePart: () => typeParameterNamePart,
|
|
2239
2238
|
typeReferenceResolutionNameAndModeGetter: () => typeReferenceResolutionNameAndModeGetter,
|
|
@@ -2288,7 +2287,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2288
2287
|
|
|
2289
2288
|
// src/compiler/corePublic.ts
|
|
2290
2289
|
var versionMajorMinor = "5.0";
|
|
2291
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2290
|
+
var version = `${versionMajorMinor}.0-insiders.20230221`;
|
|
2292
2291
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2293
2292
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2294
2293
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -19751,9 +19750,6 @@ function getClassLikeDeclarationOfSymbol(symbol) {
|
|
|
19751
19750
|
function getObjectFlags(type) {
|
|
19752
19751
|
return type.flags & 3899393 /* ObjectFlagsType */ ? type.objectFlags : 0;
|
|
19753
19752
|
}
|
|
19754
|
-
function typeHasCallOrConstructSignatures(type, checker) {
|
|
19755
|
-
return checker.getSignaturesOfType(type, 0 /* Call */).length !== 0 || checker.getSignaturesOfType(type, 1 /* Construct */).length !== 0;
|
|
19756
|
-
}
|
|
19757
19753
|
function forSomeAncestorDirectory(directory, callback) {
|
|
19758
19754
|
return !!forEachAncestorDirectory(directory, (d) => callback(d) ? true : void 0);
|
|
19759
19755
|
}
|
|
@@ -47596,7 +47592,8 @@ function createTypeChecker(host) {
|
|
|
47596
47592
|
isPropertyAccessible,
|
|
47597
47593
|
getTypeOnlyAliasDeclaration,
|
|
47598
47594
|
getMemberOverrideModifierStatus,
|
|
47599
|
-
isTypeParameterPossiblyReferenced
|
|
47595
|
+
isTypeParameterPossiblyReferenced,
|
|
47596
|
+
typeHasCallOrConstructSignatures
|
|
47600
47597
|
};
|
|
47601
47598
|
function runWithoutResolvedSignatureCaching(node, fn) {
|
|
47602
47599
|
const containingCall = findAncestor(node, isCallLikeExpression);
|
|
@@ -55103,7 +55100,7 @@ function createTypeChecker(host) {
|
|
|
55103
55100
|
}
|
|
55104
55101
|
function findResolutionCycleStartIndex(target, propertyName) {
|
|
55105
55102
|
for (let i = resolutionTargets.length - 1; i >= 0; i--) {
|
|
55106
|
-
if (
|
|
55103
|
+
if (resolutionTargetHasProperty(resolutionTargets[i], resolutionPropertyNames[i])) {
|
|
55107
55104
|
return -1;
|
|
55108
55105
|
}
|
|
55109
55106
|
if (resolutionTargets[i] === target && resolutionPropertyNames[i] === propertyName) {
|
|
@@ -55112,7 +55109,7 @@ function createTypeChecker(host) {
|
|
|
55112
55109
|
}
|
|
55113
55110
|
return -1;
|
|
55114
55111
|
}
|
|
55115
|
-
function
|
|
55112
|
+
function resolutionTargetHasProperty(target, propertyName) {
|
|
55116
55113
|
switch (propertyName) {
|
|
55117
55114
|
case 0 /* Type */:
|
|
55118
55115
|
return !!getSymbolLinks(target).type;
|
|
@@ -58149,6 +58146,20 @@ function createTypeChecker(host) {
|
|
|
58149
58146
|
return t.flags & 1048576 /* Union */ && baseTypes.length === types.length ? getUnionType(baseTypes) : t.flags & 2097152 /* Intersection */ && baseTypes.length ? getIntersectionType(baseTypes) : void 0;
|
|
58150
58147
|
}
|
|
58151
58148
|
if (t.flags & 4194304 /* Index */) {
|
|
58149
|
+
if (t.type.flags & 8388608 /* IndexedAccess */) {
|
|
58150
|
+
const indexedAccess = t.type;
|
|
58151
|
+
if (!isGenericObjectType(indexedAccess.objectType)) {
|
|
58152
|
+
const baseIndexType = getBaseConstraint(indexedAccess.indexType);
|
|
58153
|
+
const indexedAccessType = baseIndexType && getIndexedAccessTypeOrUndefined(indexedAccess.objectType, baseIndexType);
|
|
58154
|
+
const mappedIndexTypeOfIndexedAccess = indexedAccessType && mapType(indexedAccessType, getIndexType);
|
|
58155
|
+
const narrowed = mappedIndexTypeOfIndexedAccess && filterType(keyofConstraintType, (t2) => {
|
|
58156
|
+
return !(getIntersectionType([t2, mappedIndexTypeOfIndexedAccess]).flags & 131072 /* Never */);
|
|
58157
|
+
});
|
|
58158
|
+
if (narrowed) {
|
|
58159
|
+
return narrowed;
|
|
58160
|
+
}
|
|
58161
|
+
}
|
|
58162
|
+
}
|
|
58152
58163
|
return keyofConstraintType;
|
|
58153
58164
|
}
|
|
58154
58165
|
if (t.flags & 134217728 /* TemplateLiteral */) {
|
|
@@ -61520,7 +61531,7 @@ function createTypeChecker(host) {
|
|
|
61520
61531
|
}
|
|
61521
61532
|
function getActualTypeVariable(type) {
|
|
61522
61533
|
if (type.flags & 33554432 /* Substitution */) {
|
|
61523
|
-
return type.baseType;
|
|
61534
|
+
return getActualTypeVariable(type.baseType);
|
|
61524
61535
|
}
|
|
61525
61536
|
if (type.flags & 8388608 /* IndexedAccess */ && (type.objectType.flags & 33554432 /* Substitution */ || type.indexType.flags & 33554432 /* Substitution */)) {
|
|
61526
61537
|
return getIndexedAccessType(getActualTypeVariable(type.objectType), getActualTypeVariable(type.indexType));
|
|
@@ -64013,7 +64024,7 @@ function createTypeChecker(host) {
|
|
|
64013
64024
|
return 0 /* False */;
|
|
64014
64025
|
}
|
|
64015
64026
|
}
|
|
64016
|
-
const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (134348796 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 ||
|
|
64027
|
+
const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (134348796 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures(source2));
|
|
64017
64028
|
const isComparingJsxAttributes = !!(getObjectFlags(source2) & 2048 /* JsxAttributes */);
|
|
64018
64029
|
if (isPerformingCommonPropertyChecks && !hasCommonProperties(source2, target2, isComparingJsxAttributes)) {
|
|
64019
64030
|
if (reportErrors2) {
|
|
@@ -66611,7 +66622,7 @@ function createTypeChecker(host) {
|
|
|
66611
66622
|
}
|
|
66612
66623
|
function isObjectTypeWithInferableIndex(type) {
|
|
66613
66624
|
const objectFlags = getObjectFlags(type);
|
|
66614
|
-
return type.flags & 2097152 /* Intersection */ ? every(type.types, isObjectTypeWithInferableIndex) : !!(type.symbol && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */ | 384 /* Enum */ | 512 /* ValueModule */)) !== 0 && !(type.symbol.flags & 32 /* Class */) && !
|
|
66625
|
+
return type.flags & 2097152 /* Intersection */ ? every(type.types, isObjectTypeWithInferableIndex) : !!(type.symbol && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */ | 384 /* Enum */ | 512 /* ValueModule */)) !== 0 && !(type.symbol.flags & 32 /* Class */) && !typeHasCallOrConstructSignatures(type)) || !!(objectFlags & 4194304 /* ObjectRestType */) || !!(objectFlags & 1024 /* ReverseMapped */ && isObjectTypeWithInferableIndex(type.source));
|
|
66615
66626
|
}
|
|
66616
66627
|
function createSymbolWithType(source, type) {
|
|
66617
66628
|
const symbol = createSymbol(source.flags, source.escapedName, getCheckFlags(source) & 8 /* Readonly */);
|
|
@@ -67936,7 +67947,7 @@ function createTypeChecker(host) {
|
|
|
67936
67947
|
const constraint = getConstraintOfTypeParameter(inference.typeParameter);
|
|
67937
67948
|
if (constraint) {
|
|
67938
67949
|
const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
|
|
67939
|
-
if (!inferredType ||
|
|
67950
|
+
if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
|
67940
67951
|
inference.inferredType = inferredType = instantiatedConstraint;
|
|
67941
67952
|
}
|
|
67942
67953
|
}
|
|
@@ -77056,7 +77067,7 @@ function createTypeChecker(host) {
|
|
|
77056
77067
|
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 134348796 /* Primitive */)) {
|
|
77057
77068
|
error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
|
|
77058
77069
|
}
|
|
77059
|
-
if (!(isTypeAny(rightType) ||
|
|
77070
|
+
if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
|
|
77060
77071
|
error(right, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type);
|
|
77061
77072
|
}
|
|
77062
77073
|
return booleanType;
|
|
@@ -84727,8 +84738,8 @@ function createTypeChecker(host) {
|
|
|
84727
84738
|
}
|
|
84728
84739
|
return getNamedMembers(propsByName);
|
|
84729
84740
|
}
|
|
84730
|
-
function
|
|
84731
|
-
return
|
|
84741
|
+
function typeHasCallOrConstructSignatures(type) {
|
|
84742
|
+
return getSignaturesOfType(type, 0 /* Call */).length !== 0 || getSignaturesOfType(type, 1 /* Construct */).length !== 0;
|
|
84732
84743
|
}
|
|
84733
84744
|
function getRootSymbols(symbol) {
|
|
84734
84745
|
const roots = getImmediateRootSymbols(symbol);
|
|
@@ -129593,7 +129604,7 @@ function needsParentheses(expression) {
|
|
|
129593
129604
|
return isBinaryExpression(expression) && expression.operatorToken.kind === 27 /* CommaToken */ || isObjectLiteralExpression(expression) || isAsExpression(expression) && isObjectLiteralExpression(expression.expression);
|
|
129594
129605
|
}
|
|
129595
129606
|
function getContextualTypeFromParent(node, checker, contextFlags) {
|
|
129596
|
-
const
|
|
129607
|
+
const parent2 = walkUpParenthesizedExpressions(node.parent);
|
|
129597
129608
|
switch (parent2.kind) {
|
|
129598
129609
|
case 211 /* NewExpression */:
|
|
129599
129610
|
return checker.getContextualType(parent2, contextFlags);
|
|
@@ -129602,7 +129613,7 @@ function getContextualTypeFromParent(node, checker, contextFlags) {
|
|
|
129602
129613
|
return isEqualityOperatorKind(operatorToken.kind) ? checker.getTypeAtLocation(node === right ? left : right) : checker.getContextualType(node, contextFlags);
|
|
129603
129614
|
}
|
|
129604
129615
|
case 292 /* CaseClause */:
|
|
129605
|
-
return
|
|
129616
|
+
return getSwitchedType(parent2, checker);
|
|
129606
129617
|
default:
|
|
129607
129618
|
return checker.getContextualType(node, contextFlags);
|
|
129608
129619
|
}
|
|
@@ -130162,8 +130173,8 @@ function newCaseClauseTracker(checker, clauses) {
|
|
|
130162
130173
|
const existingBigInts = /* @__PURE__ */ new Set();
|
|
130163
130174
|
for (const clause of clauses) {
|
|
130164
130175
|
if (!isDefaultClause(clause)) {
|
|
130165
|
-
|
|
130166
|
-
|
|
130176
|
+
const expression = skipParentheses(clause.expression);
|
|
130177
|
+
if (isLiteralExpression(expression)) {
|
|
130167
130178
|
switch (expression.kind) {
|
|
130168
130179
|
case 14 /* NoSubstitutionTemplateLiteral */:
|
|
130169
130180
|
case 10 /* StringLiteral */:
|
|
@@ -151382,7 +151393,7 @@ function getPropertiesForObjectExpression(contextualType, completionsType, obj,
|
|
|
151382
151393
|
function getApparentProperties(type, node, checker) {
|
|
151383
151394
|
if (!type.isUnion())
|
|
151384
151395
|
return type.getApparentProperties();
|
|
151385
|
-
return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags & 134348796 /* Primitive */ || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || typeHasCallOrConstructSignatures(memberType
|
|
151396
|
+
return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags & 134348796 /* Primitive */ || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || checker.typeHasCallOrConstructSignatures(memberType) || memberType.isClass() && containsNonPublicProperties(memberType.getApparentProperties()))));
|
|
151386
151397
|
}
|
|
151387
151398
|
function containsNonPublicProperties(props) {
|
|
151388
151399
|
return some(props, (p) => !!(getDeclarationModifierFlagsFromSymbol(p) & 24 /* NonPublicAccessibilityModifier */));
|
|
@@ -151927,7 +151938,7 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, typeCheck
|
|
|
151927
151938
|
case 280 /* ExternalModuleReference */:
|
|
151928
151939
|
return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) };
|
|
151929
151940
|
case 292 /* CaseClause */:
|
|
151930
|
-
const tracker = newCaseClauseTracker(typeChecker,
|
|
151941
|
+
const tracker = newCaseClauseTracker(typeChecker, parent2.parent.clauses);
|
|
151931
151942
|
const literals = fromContextualType().types.filter((literal) => !tracker.hasValue(literal.value));
|
|
151932
151943
|
return { kind: 2 /* Types */, types: literals, isNewIdentifier: false };
|
|
151933
151944
|
default:
|
|
@@ -158542,12 +158553,7 @@ function filterImport(i, moduleSpecifier, keep) {
|
|
|
158542
158553
|
return defaultImport || namedBindings ? factory.createImportDeclaration(
|
|
158543
158554
|
/*modifiers*/
|
|
158544
158555
|
void 0,
|
|
158545
|
-
factory.createImportClause(
|
|
158546
|
-
/*isTypeOnly*/
|
|
158547
|
-
false,
|
|
158548
|
-
defaultImport,
|
|
158549
|
-
namedBindings
|
|
158550
|
-
),
|
|
158556
|
+
factory.createImportClause(clause.isTypeOnly, defaultImport, namedBindings),
|
|
158551
158557
|
moduleSpecifier,
|
|
158552
158558
|
/*assertClause*/
|
|
158553
158559
|
void 0
|
|
@@ -169835,7 +169841,6 @@ __export(ts_exports3, {
|
|
|
169835
169841
|
typeAcquisitionDeclarations: () => typeAcquisitionDeclarations,
|
|
169836
169842
|
typeAliasNamePart: () => typeAliasNamePart,
|
|
169837
169843
|
typeDirectiveIsEqualTo: () => typeDirectiveIsEqualTo,
|
|
169838
|
-
typeHasCallOrConstructSignatures: () => typeHasCallOrConstructSignatures,
|
|
169839
169844
|
typeKeywords: () => typeKeywords,
|
|
169840
169845
|
typeParameterNamePart: () => typeParameterNamePart,
|
|
169841
169846
|
typeReferenceResolutionNameAndModeGetter: () => typeReferenceResolutionNameAndModeGetter,
|
|
@@ -183785,7 +183790,6 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
183785
183790
|
typeAcquisitionDeclarations,
|
|
183786
183791
|
typeAliasNamePart,
|
|
183787
183792
|
typeDirectiveIsEqualTo,
|
|
183788
|
-
typeHasCallOrConstructSignatures,
|
|
183789
183793
|
typeKeywords,
|
|
183790
183794
|
typeParameterNamePart,
|
|
183791
183795
|
typeReferenceResolutionNameAndModeGetter,
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.0";
|
|
38
|
-
version = `${versionMajorMinor}.0-insiders.
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20230221`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -17490,9 +17490,6 @@ ${lanes.join("\n")}
|
|
|
17490
17490
|
function getObjectFlags(type) {
|
|
17491
17491
|
return type.flags & 3899393 /* ObjectFlagsType */ ? type.objectFlags : 0;
|
|
17492
17492
|
}
|
|
17493
|
-
function typeHasCallOrConstructSignatures(type, checker) {
|
|
17494
|
-
return checker.getSignaturesOfType(type, 0 /* Call */).length !== 0 || checker.getSignaturesOfType(type, 1 /* Construct */).length !== 0;
|
|
17495
|
-
}
|
|
17496
17493
|
function forSomeAncestorDirectory(directory, callback) {
|
|
17497
17494
|
return !!forEachAncestorDirectory(directory, (d) => callback(d) ? true : void 0);
|
|
17498
17495
|
}
|
|
@@ -45404,7 +45401,8 @@ ${lanes.join("\n")}
|
|
|
45404
45401
|
isPropertyAccessible,
|
|
45405
45402
|
getTypeOnlyAliasDeclaration,
|
|
45406
45403
|
getMemberOverrideModifierStatus,
|
|
45407
|
-
isTypeParameterPossiblyReferenced
|
|
45404
|
+
isTypeParameterPossiblyReferenced,
|
|
45405
|
+
typeHasCallOrConstructSignatures
|
|
45408
45406
|
};
|
|
45409
45407
|
function runWithoutResolvedSignatureCaching(node, fn) {
|
|
45410
45408
|
const containingCall = findAncestor(node, isCallLikeExpression);
|
|
@@ -52911,7 +52909,7 @@ ${lanes.join("\n")}
|
|
|
52911
52909
|
}
|
|
52912
52910
|
function findResolutionCycleStartIndex(target, propertyName) {
|
|
52913
52911
|
for (let i = resolutionTargets.length - 1; i >= 0; i--) {
|
|
52914
|
-
if (
|
|
52912
|
+
if (resolutionTargetHasProperty(resolutionTargets[i], resolutionPropertyNames[i])) {
|
|
52915
52913
|
return -1;
|
|
52916
52914
|
}
|
|
52917
52915
|
if (resolutionTargets[i] === target && resolutionPropertyNames[i] === propertyName) {
|
|
@@ -52920,7 +52918,7 @@ ${lanes.join("\n")}
|
|
|
52920
52918
|
}
|
|
52921
52919
|
return -1;
|
|
52922
52920
|
}
|
|
52923
|
-
function
|
|
52921
|
+
function resolutionTargetHasProperty(target, propertyName) {
|
|
52924
52922
|
switch (propertyName) {
|
|
52925
52923
|
case 0 /* Type */:
|
|
52926
52924
|
return !!getSymbolLinks(target).type;
|
|
@@ -55957,6 +55955,20 @@ ${lanes.join("\n")}
|
|
|
55957
55955
|
return t.flags & 1048576 /* Union */ && baseTypes.length === types.length ? getUnionType(baseTypes) : t.flags & 2097152 /* Intersection */ && baseTypes.length ? getIntersectionType(baseTypes) : void 0;
|
|
55958
55956
|
}
|
|
55959
55957
|
if (t.flags & 4194304 /* Index */) {
|
|
55958
|
+
if (t.type.flags & 8388608 /* IndexedAccess */) {
|
|
55959
|
+
const indexedAccess = t.type;
|
|
55960
|
+
if (!isGenericObjectType(indexedAccess.objectType)) {
|
|
55961
|
+
const baseIndexType = getBaseConstraint(indexedAccess.indexType);
|
|
55962
|
+
const indexedAccessType = baseIndexType && getIndexedAccessTypeOrUndefined(indexedAccess.objectType, baseIndexType);
|
|
55963
|
+
const mappedIndexTypeOfIndexedAccess = indexedAccessType && mapType(indexedAccessType, getIndexType);
|
|
55964
|
+
const narrowed = mappedIndexTypeOfIndexedAccess && filterType(keyofConstraintType, (t2) => {
|
|
55965
|
+
return !(getIntersectionType([t2, mappedIndexTypeOfIndexedAccess]).flags & 131072 /* Never */);
|
|
55966
|
+
});
|
|
55967
|
+
if (narrowed) {
|
|
55968
|
+
return narrowed;
|
|
55969
|
+
}
|
|
55970
|
+
}
|
|
55971
|
+
}
|
|
55960
55972
|
return keyofConstraintType;
|
|
55961
55973
|
}
|
|
55962
55974
|
if (t.flags & 134217728 /* TemplateLiteral */) {
|
|
@@ -59328,7 +59340,7 @@ ${lanes.join("\n")}
|
|
|
59328
59340
|
}
|
|
59329
59341
|
function getActualTypeVariable(type) {
|
|
59330
59342
|
if (type.flags & 33554432 /* Substitution */) {
|
|
59331
|
-
return type.baseType;
|
|
59343
|
+
return getActualTypeVariable(type.baseType);
|
|
59332
59344
|
}
|
|
59333
59345
|
if (type.flags & 8388608 /* IndexedAccess */ && (type.objectType.flags & 33554432 /* Substitution */ || type.indexType.flags & 33554432 /* Substitution */)) {
|
|
59334
59346
|
return getIndexedAccessType(getActualTypeVariable(type.objectType), getActualTypeVariable(type.indexType));
|
|
@@ -61821,7 +61833,7 @@ ${lanes.join("\n")}
|
|
|
61821
61833
|
return 0 /* False */;
|
|
61822
61834
|
}
|
|
61823
61835
|
}
|
|
61824
|
-
const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (134348796 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 ||
|
|
61836
|
+
const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (134348796 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures(source2));
|
|
61825
61837
|
const isComparingJsxAttributes = !!(getObjectFlags(source2) & 2048 /* JsxAttributes */);
|
|
61826
61838
|
if (isPerformingCommonPropertyChecks && !hasCommonProperties(source2, target2, isComparingJsxAttributes)) {
|
|
61827
61839
|
if (reportErrors2) {
|
|
@@ -64419,7 +64431,7 @@ ${lanes.join("\n")}
|
|
|
64419
64431
|
}
|
|
64420
64432
|
function isObjectTypeWithInferableIndex(type) {
|
|
64421
64433
|
const objectFlags = getObjectFlags(type);
|
|
64422
|
-
return type.flags & 2097152 /* Intersection */ ? every(type.types, isObjectTypeWithInferableIndex) : !!(type.symbol && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */ | 384 /* Enum */ | 512 /* ValueModule */)) !== 0 && !(type.symbol.flags & 32 /* Class */) && !
|
|
64434
|
+
return type.flags & 2097152 /* Intersection */ ? every(type.types, isObjectTypeWithInferableIndex) : !!(type.symbol && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */ | 384 /* Enum */ | 512 /* ValueModule */)) !== 0 && !(type.symbol.flags & 32 /* Class */) && !typeHasCallOrConstructSignatures(type)) || !!(objectFlags & 4194304 /* ObjectRestType */) || !!(objectFlags & 1024 /* ReverseMapped */ && isObjectTypeWithInferableIndex(type.source));
|
|
64423
64435
|
}
|
|
64424
64436
|
function createSymbolWithType(source, type) {
|
|
64425
64437
|
const symbol = createSymbol(source.flags, source.escapedName, getCheckFlags(source) & 8 /* Readonly */);
|
|
@@ -65744,7 +65756,7 @@ ${lanes.join("\n")}
|
|
|
65744
65756
|
const constraint = getConstraintOfTypeParameter(inference.typeParameter);
|
|
65745
65757
|
if (constraint) {
|
|
65746
65758
|
const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
|
|
65747
|
-
if (!inferredType ||
|
|
65759
|
+
if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
|
65748
65760
|
inference.inferredType = inferredType = instantiatedConstraint;
|
|
65749
65761
|
}
|
|
65750
65762
|
}
|
|
@@ -74864,7 +74876,7 @@ ${lanes.join("\n")}
|
|
|
74864
74876
|
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 134348796 /* Primitive */)) {
|
|
74865
74877
|
error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
|
|
74866
74878
|
}
|
|
74867
|
-
if (!(isTypeAny(rightType) ||
|
|
74879
|
+
if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
|
|
74868
74880
|
error(right, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type);
|
|
74869
74881
|
}
|
|
74870
74882
|
return booleanType;
|
|
@@ -82535,8 +82547,8 @@ ${lanes.join("\n")}
|
|
|
82535
82547
|
}
|
|
82536
82548
|
return getNamedMembers(propsByName);
|
|
82537
82549
|
}
|
|
82538
|
-
function
|
|
82539
|
-
return
|
|
82550
|
+
function typeHasCallOrConstructSignatures(type) {
|
|
82551
|
+
return getSignaturesOfType(type, 0 /* Call */).length !== 0 || getSignaturesOfType(type, 1 /* Construct */).length !== 0;
|
|
82540
82552
|
}
|
|
82541
82553
|
function getRootSymbols(symbol) {
|
|
82542
82554
|
const roots = getImmediateRootSymbols(symbol);
|
|
@@ -85092,7 +85104,6 @@ ${lanes.join("\n")}
|
|
|
85092
85104
|
"src/compiler/checker.ts"() {
|
|
85093
85105
|
"use strict";
|
|
85094
85106
|
init_ts2();
|
|
85095
|
-
init_ts2();
|
|
85096
85107
|
init_ts_moduleSpecifiers();
|
|
85097
85108
|
init_ts_performance();
|
|
85098
85109
|
ambientModuleSymbolRegex = /^".+"$/;
|
|
@@ -127891,7 +127902,7 @@ ${lanes.join("\n")}
|
|
|
127891
127902
|
return isBinaryExpression(expression) && expression.operatorToken.kind === 27 /* CommaToken */ || isObjectLiteralExpression(expression) || isAsExpression(expression) && isObjectLiteralExpression(expression.expression);
|
|
127892
127903
|
}
|
|
127893
127904
|
function getContextualTypeFromParent(node, checker, contextFlags) {
|
|
127894
|
-
const
|
|
127905
|
+
const parent2 = walkUpParenthesizedExpressions(node.parent);
|
|
127895
127906
|
switch (parent2.kind) {
|
|
127896
127907
|
case 211 /* NewExpression */:
|
|
127897
127908
|
return checker.getContextualType(parent2, contextFlags);
|
|
@@ -127900,7 +127911,7 @@ ${lanes.join("\n")}
|
|
|
127900
127911
|
return isEqualityOperatorKind(operatorToken.kind) ? checker.getTypeAtLocation(node === right ? left : right) : checker.getContextualType(node, contextFlags);
|
|
127901
127912
|
}
|
|
127902
127913
|
case 292 /* CaseClause */:
|
|
127903
|
-
return
|
|
127914
|
+
return getSwitchedType(parent2, checker);
|
|
127904
127915
|
default:
|
|
127905
127916
|
return checker.getContextualType(node, contextFlags);
|
|
127906
127917
|
}
|
|
@@ -128453,8 +128464,8 @@ ${lanes.join("\n")}
|
|
|
128453
128464
|
const existingBigInts = /* @__PURE__ */ new Set();
|
|
128454
128465
|
for (const clause of clauses) {
|
|
128455
128466
|
if (!isDefaultClause(clause)) {
|
|
128456
|
-
|
|
128457
|
-
|
|
128467
|
+
const expression = skipParentheses(clause.expression);
|
|
128468
|
+
if (isLiteralExpression(expression)) {
|
|
128458
128469
|
switch (expression.kind) {
|
|
128459
128470
|
case 14 /* NoSubstitutionTemplateLiteral */:
|
|
128460
128471
|
case 10 /* StringLiteral */:
|
|
@@ -150413,7 +150424,7 @@ ${lanes.join("\n")}
|
|
|
150413
150424
|
function getApparentProperties(type, node, checker) {
|
|
150414
150425
|
if (!type.isUnion())
|
|
150415
150426
|
return type.getApparentProperties();
|
|
150416
|
-
return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags & 134348796 /* Primitive */ || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || typeHasCallOrConstructSignatures(memberType
|
|
150427
|
+
return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags & 134348796 /* Primitive */ || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || checker.typeHasCallOrConstructSignatures(memberType) || memberType.isClass() && containsNonPublicProperties(memberType.getApparentProperties()))));
|
|
150417
150428
|
}
|
|
150418
150429
|
function containsNonPublicProperties(props) {
|
|
150419
150430
|
return some(props, (p) => !!(getDeclarationModifierFlagsFromSymbol(p) & 24 /* NonPublicAccessibilityModifier */));
|
|
@@ -151023,7 +151034,7 @@ ${lanes.join("\n")}
|
|
|
151023
151034
|
case 280 /* ExternalModuleReference */:
|
|
151024
151035
|
return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) };
|
|
151025
151036
|
case 292 /* CaseClause */:
|
|
151026
|
-
const tracker = newCaseClauseTracker(typeChecker,
|
|
151037
|
+
const tracker = newCaseClauseTracker(typeChecker, parent2.parent.clauses);
|
|
151027
151038
|
const literals = fromContextualType().types.filter((literal) => !tracker.hasValue(literal.value));
|
|
151028
151039
|
return { kind: 2 /* Types */, types: literals, isNewIdentifier: false };
|
|
151029
151040
|
default:
|
|
@@ -157761,12 +157772,7 @@ ${lanes.join("\n")}
|
|
|
157761
157772
|
return defaultImport || namedBindings ? factory.createImportDeclaration(
|
|
157762
157773
|
/*modifiers*/
|
|
157763
157774
|
void 0,
|
|
157764
|
-
factory.createImportClause(
|
|
157765
|
-
/*isTypeOnly*/
|
|
157766
|
-
false,
|
|
157767
|
-
defaultImport,
|
|
157768
|
-
namedBindings
|
|
157769
|
-
),
|
|
157775
|
+
factory.createImportClause(clause.isTypeOnly, defaultImport, namedBindings),
|
|
157770
157776
|
moduleSpecifier,
|
|
157771
157777
|
/*assertClause*/
|
|
157772
157778
|
void 0
|
|
@@ -180421,7 +180427,6 @@ ${e.message}`;
|
|
|
180421
180427
|
typeAcquisitionDeclarations: () => typeAcquisitionDeclarations,
|
|
180422
180428
|
typeAliasNamePart: () => typeAliasNamePart,
|
|
180423
180429
|
typeDirectiveIsEqualTo: () => typeDirectiveIsEqualTo,
|
|
180424
|
-
typeHasCallOrConstructSignatures: () => typeHasCallOrConstructSignatures,
|
|
180425
180430
|
typeKeywords: () => typeKeywords,
|
|
180426
180431
|
typeParameterNamePart: () => typeParameterNamePart,
|
|
180427
180432
|
typeReferenceResolutionNameAndModeGetter: () => typeReferenceResolutionNameAndModeGetter,
|
|
@@ -182781,7 +182786,6 @@ ${e.message}`;
|
|
|
182781
182786
|
typeAcquisitionDeclarations: () => typeAcquisitionDeclarations,
|
|
182782
182787
|
typeAliasNamePart: () => typeAliasNamePart,
|
|
182783
182788
|
typeDirectiveIsEqualTo: () => typeDirectiveIsEqualTo,
|
|
182784
|
-
typeHasCallOrConstructSignatures: () => typeHasCallOrConstructSignatures,
|
|
182785
182789
|
typeKeywords: () => typeKeywords,
|
|
182786
182790
|
typeParameterNamePart: () => typeParameterNamePart,
|
|
182787
182791
|
typeReferenceResolutionNameAndModeGetter: () => typeReferenceResolutionNameAndModeGetter,
|
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.0";
|
|
38
|
-
version = `${versionMajorMinor}.0-insiders.
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20230221`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -17490,9 +17490,6 @@ ${lanes.join("\n")}
|
|
|
17490
17490
|
function getObjectFlags(type) {
|
|
17491
17491
|
return type.flags & 3899393 /* ObjectFlagsType */ ? type.objectFlags : 0;
|
|
17492
17492
|
}
|
|
17493
|
-
function typeHasCallOrConstructSignatures(type, checker) {
|
|
17494
|
-
return checker.getSignaturesOfType(type, 0 /* Call */).length !== 0 || checker.getSignaturesOfType(type, 1 /* Construct */).length !== 0;
|
|
17495
|
-
}
|
|
17496
17493
|
function forSomeAncestorDirectory(directory, callback) {
|
|
17497
17494
|
return !!forEachAncestorDirectory(directory, (d) => callback(d) ? true : void 0);
|
|
17498
17495
|
}
|
|
@@ -45404,7 +45401,8 @@ ${lanes.join("\n")}
|
|
|
45404
45401
|
isPropertyAccessible,
|
|
45405
45402
|
getTypeOnlyAliasDeclaration,
|
|
45406
45403
|
getMemberOverrideModifierStatus,
|
|
45407
|
-
isTypeParameterPossiblyReferenced
|
|
45404
|
+
isTypeParameterPossiblyReferenced,
|
|
45405
|
+
typeHasCallOrConstructSignatures
|
|
45408
45406
|
};
|
|
45409
45407
|
function runWithoutResolvedSignatureCaching(node, fn) {
|
|
45410
45408
|
const containingCall = findAncestor(node, isCallLikeExpression);
|
|
@@ -52911,7 +52909,7 @@ ${lanes.join("\n")}
|
|
|
52911
52909
|
}
|
|
52912
52910
|
function findResolutionCycleStartIndex(target, propertyName) {
|
|
52913
52911
|
for (let i = resolutionTargets.length - 1; i >= 0; i--) {
|
|
52914
|
-
if (
|
|
52912
|
+
if (resolutionTargetHasProperty(resolutionTargets[i], resolutionPropertyNames[i])) {
|
|
52915
52913
|
return -1;
|
|
52916
52914
|
}
|
|
52917
52915
|
if (resolutionTargets[i] === target && resolutionPropertyNames[i] === propertyName) {
|
|
@@ -52920,7 +52918,7 @@ ${lanes.join("\n")}
|
|
|
52920
52918
|
}
|
|
52921
52919
|
return -1;
|
|
52922
52920
|
}
|
|
52923
|
-
function
|
|
52921
|
+
function resolutionTargetHasProperty(target, propertyName) {
|
|
52924
52922
|
switch (propertyName) {
|
|
52925
52923
|
case 0 /* Type */:
|
|
52926
52924
|
return !!getSymbolLinks(target).type;
|
|
@@ -55957,6 +55955,20 @@ ${lanes.join("\n")}
|
|
|
55957
55955
|
return t.flags & 1048576 /* Union */ && baseTypes.length === types.length ? getUnionType(baseTypes) : t.flags & 2097152 /* Intersection */ && baseTypes.length ? getIntersectionType(baseTypes) : void 0;
|
|
55958
55956
|
}
|
|
55959
55957
|
if (t.flags & 4194304 /* Index */) {
|
|
55958
|
+
if (t.type.flags & 8388608 /* IndexedAccess */) {
|
|
55959
|
+
const indexedAccess = t.type;
|
|
55960
|
+
if (!isGenericObjectType(indexedAccess.objectType)) {
|
|
55961
|
+
const baseIndexType = getBaseConstraint(indexedAccess.indexType);
|
|
55962
|
+
const indexedAccessType = baseIndexType && getIndexedAccessTypeOrUndefined(indexedAccess.objectType, baseIndexType);
|
|
55963
|
+
const mappedIndexTypeOfIndexedAccess = indexedAccessType && mapType(indexedAccessType, getIndexType);
|
|
55964
|
+
const narrowed = mappedIndexTypeOfIndexedAccess && filterType(keyofConstraintType, (t2) => {
|
|
55965
|
+
return !(getIntersectionType([t2, mappedIndexTypeOfIndexedAccess]).flags & 131072 /* Never */);
|
|
55966
|
+
});
|
|
55967
|
+
if (narrowed) {
|
|
55968
|
+
return narrowed;
|
|
55969
|
+
}
|
|
55970
|
+
}
|
|
55971
|
+
}
|
|
55960
55972
|
return keyofConstraintType;
|
|
55961
55973
|
}
|
|
55962
55974
|
if (t.flags & 134217728 /* TemplateLiteral */) {
|
|
@@ -59328,7 +59340,7 @@ ${lanes.join("\n")}
|
|
|
59328
59340
|
}
|
|
59329
59341
|
function getActualTypeVariable(type) {
|
|
59330
59342
|
if (type.flags & 33554432 /* Substitution */) {
|
|
59331
|
-
return type.baseType;
|
|
59343
|
+
return getActualTypeVariable(type.baseType);
|
|
59332
59344
|
}
|
|
59333
59345
|
if (type.flags & 8388608 /* IndexedAccess */ && (type.objectType.flags & 33554432 /* Substitution */ || type.indexType.flags & 33554432 /* Substitution */)) {
|
|
59334
59346
|
return getIndexedAccessType(getActualTypeVariable(type.objectType), getActualTypeVariable(type.indexType));
|
|
@@ -61821,7 +61833,7 @@ ${lanes.join("\n")}
|
|
|
61821
61833
|
return 0 /* False */;
|
|
61822
61834
|
}
|
|
61823
61835
|
}
|
|
61824
|
-
const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (134348796 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 ||
|
|
61836
|
+
const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (134348796 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures(source2));
|
|
61825
61837
|
const isComparingJsxAttributes = !!(getObjectFlags(source2) & 2048 /* JsxAttributes */);
|
|
61826
61838
|
if (isPerformingCommonPropertyChecks && !hasCommonProperties(source2, target2, isComparingJsxAttributes)) {
|
|
61827
61839
|
if (reportErrors2) {
|
|
@@ -64419,7 +64431,7 @@ ${lanes.join("\n")}
|
|
|
64419
64431
|
}
|
|
64420
64432
|
function isObjectTypeWithInferableIndex(type) {
|
|
64421
64433
|
const objectFlags = getObjectFlags(type);
|
|
64422
|
-
return type.flags & 2097152 /* Intersection */ ? every(type.types, isObjectTypeWithInferableIndex) : !!(type.symbol && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */ | 384 /* Enum */ | 512 /* ValueModule */)) !== 0 && !(type.symbol.flags & 32 /* Class */) && !
|
|
64434
|
+
return type.flags & 2097152 /* Intersection */ ? every(type.types, isObjectTypeWithInferableIndex) : !!(type.symbol && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */ | 384 /* Enum */ | 512 /* ValueModule */)) !== 0 && !(type.symbol.flags & 32 /* Class */) && !typeHasCallOrConstructSignatures(type)) || !!(objectFlags & 4194304 /* ObjectRestType */) || !!(objectFlags & 1024 /* ReverseMapped */ && isObjectTypeWithInferableIndex(type.source));
|
|
64423
64435
|
}
|
|
64424
64436
|
function createSymbolWithType(source, type) {
|
|
64425
64437
|
const symbol = createSymbol(source.flags, source.escapedName, getCheckFlags(source) & 8 /* Readonly */);
|
|
@@ -65744,7 +65756,7 @@ ${lanes.join("\n")}
|
|
|
65744
65756
|
const constraint = getConstraintOfTypeParameter(inference.typeParameter);
|
|
65745
65757
|
if (constraint) {
|
|
65746
65758
|
const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
|
|
65747
|
-
if (!inferredType ||
|
|
65759
|
+
if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
|
65748
65760
|
inference.inferredType = inferredType = instantiatedConstraint;
|
|
65749
65761
|
}
|
|
65750
65762
|
}
|
|
@@ -74864,7 +74876,7 @@ ${lanes.join("\n")}
|
|
|
74864
74876
|
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 134348796 /* Primitive */)) {
|
|
74865
74877
|
error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
|
|
74866
74878
|
}
|
|
74867
|
-
if (!(isTypeAny(rightType) ||
|
|
74879
|
+
if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
|
|
74868
74880
|
error(right, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type);
|
|
74869
74881
|
}
|
|
74870
74882
|
return booleanType;
|
|
@@ -82535,8 +82547,8 @@ ${lanes.join("\n")}
|
|
|
82535
82547
|
}
|
|
82536
82548
|
return getNamedMembers(propsByName);
|
|
82537
82549
|
}
|
|
82538
|
-
function
|
|
82539
|
-
return
|
|
82550
|
+
function typeHasCallOrConstructSignatures(type) {
|
|
82551
|
+
return getSignaturesOfType(type, 0 /* Call */).length !== 0 || getSignaturesOfType(type, 1 /* Construct */).length !== 0;
|
|
82540
82552
|
}
|
|
82541
82553
|
function getRootSymbols(symbol) {
|
|
82542
82554
|
const roots = getImmediateRootSymbols(symbol);
|
|
@@ -85092,7 +85104,6 @@ ${lanes.join("\n")}
|
|
|
85092
85104
|
"src/compiler/checker.ts"() {
|
|
85093
85105
|
"use strict";
|
|
85094
85106
|
init_ts2();
|
|
85095
|
-
init_ts2();
|
|
85096
85107
|
init_ts_moduleSpecifiers();
|
|
85097
85108
|
init_ts_performance();
|
|
85098
85109
|
ambientModuleSymbolRegex = /^".+"$/;
|
|
@@ -127905,7 +127916,7 @@ ${lanes.join("\n")}
|
|
|
127905
127916
|
return isBinaryExpression(expression) && expression.operatorToken.kind === 27 /* CommaToken */ || isObjectLiteralExpression(expression) || isAsExpression(expression) && isObjectLiteralExpression(expression.expression);
|
|
127906
127917
|
}
|
|
127907
127918
|
function getContextualTypeFromParent(node, checker, contextFlags) {
|
|
127908
|
-
const
|
|
127919
|
+
const parent2 = walkUpParenthesizedExpressions(node.parent);
|
|
127909
127920
|
switch (parent2.kind) {
|
|
127910
127921
|
case 211 /* NewExpression */:
|
|
127911
127922
|
return checker.getContextualType(parent2, contextFlags);
|
|
@@ -127914,7 +127925,7 @@ ${lanes.join("\n")}
|
|
|
127914
127925
|
return isEqualityOperatorKind(operatorToken.kind) ? checker.getTypeAtLocation(node === right ? left : right) : checker.getContextualType(node, contextFlags);
|
|
127915
127926
|
}
|
|
127916
127927
|
case 292 /* CaseClause */:
|
|
127917
|
-
return
|
|
127928
|
+
return getSwitchedType(parent2, checker);
|
|
127918
127929
|
default:
|
|
127919
127930
|
return checker.getContextualType(node, contextFlags);
|
|
127920
127931
|
}
|
|
@@ -128467,8 +128478,8 @@ ${lanes.join("\n")}
|
|
|
128467
128478
|
const existingBigInts = /* @__PURE__ */ new Set();
|
|
128468
128479
|
for (const clause of clauses) {
|
|
128469
128480
|
if (!isDefaultClause(clause)) {
|
|
128470
|
-
|
|
128471
|
-
|
|
128481
|
+
const expression = skipParentheses(clause.expression);
|
|
128482
|
+
if (isLiteralExpression(expression)) {
|
|
128472
128483
|
switch (expression.kind) {
|
|
128473
128484
|
case 14 /* NoSubstitutionTemplateLiteral */:
|
|
128474
128485
|
case 10 /* StringLiteral */:
|
|
@@ -150427,7 +150438,7 @@ ${lanes.join("\n")}
|
|
|
150427
150438
|
function getApparentProperties(type, node, checker) {
|
|
150428
150439
|
if (!type.isUnion())
|
|
150429
150440
|
return type.getApparentProperties();
|
|
150430
|
-
return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags & 134348796 /* Primitive */ || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || typeHasCallOrConstructSignatures(memberType
|
|
150441
|
+
return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags & 134348796 /* Primitive */ || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || checker.typeHasCallOrConstructSignatures(memberType) || memberType.isClass() && containsNonPublicProperties(memberType.getApparentProperties()))));
|
|
150431
150442
|
}
|
|
150432
150443
|
function containsNonPublicProperties(props) {
|
|
150433
150444
|
return some(props, (p) => !!(getDeclarationModifierFlagsFromSymbol(p) & 24 /* NonPublicAccessibilityModifier */));
|
|
@@ -151037,7 +151048,7 @@ ${lanes.join("\n")}
|
|
|
151037
151048
|
case 280 /* ExternalModuleReference */:
|
|
151038
151049
|
return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) };
|
|
151039
151050
|
case 292 /* CaseClause */:
|
|
151040
|
-
const tracker = newCaseClauseTracker(typeChecker,
|
|
151051
|
+
const tracker = newCaseClauseTracker(typeChecker, parent2.parent.clauses);
|
|
151041
151052
|
const literals = fromContextualType().types.filter((literal) => !tracker.hasValue(literal.value));
|
|
151042
151053
|
return { kind: 2 /* Types */, types: literals, isNewIdentifier: false };
|
|
151043
151054
|
default:
|
|
@@ -157775,12 +157786,7 @@ ${lanes.join("\n")}
|
|
|
157775
157786
|
return defaultImport || namedBindings ? factory.createImportDeclaration(
|
|
157776
157787
|
/*modifiers*/
|
|
157777
157788
|
void 0,
|
|
157778
|
-
factory.createImportClause(
|
|
157779
|
-
/*isTypeOnly*/
|
|
157780
|
-
false,
|
|
157781
|
-
defaultImport,
|
|
157782
|
-
namedBindings
|
|
157783
|
-
),
|
|
157789
|
+
factory.createImportClause(clause.isTypeOnly, defaultImport, namedBindings),
|
|
157784
157790
|
moduleSpecifier,
|
|
157785
157791
|
/*assertClause*/
|
|
157786
157792
|
void 0
|
|
@@ -169602,7 +169608,6 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
169602
169608
|
typeAcquisitionDeclarations: () => typeAcquisitionDeclarations,
|
|
169603
169609
|
typeAliasNamePart: () => typeAliasNamePart,
|
|
169604
169610
|
typeDirectiveIsEqualTo: () => typeDirectiveIsEqualTo,
|
|
169605
|
-
typeHasCallOrConstructSignatures: () => typeHasCallOrConstructSignatures,
|
|
169606
169611
|
typeKeywords: () => typeKeywords,
|
|
169607
169612
|
typeParameterNamePart: () => typeParameterNamePart,
|
|
169608
169613
|
typeReferenceResolutionNameAndModeGetter: () => typeReferenceResolutionNameAndModeGetter,
|
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.0";
|
|
57
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
57
|
+
var version = `${versionMajorMinor}.0-insiders.20230221`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
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.0.0-pr-
|
|
5
|
+
"version": "5.0.0-pr-49107-5",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|