@typescript-deploys/pr-build 5.5.0-pr-57480-8 → 5.5.0-pr-57403-34
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 +65 -20
- package/lib/tsserver.js +73 -44
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +73 -44
- 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.5";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20240305`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -3692,6 +3692,7 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
|
3692
3692
|
ObjectFlags3[ObjectFlags3["ContainsSpread"] = 2097152] = "ContainsSpread";
|
|
3693
3693
|
ObjectFlags3[ObjectFlags3["ObjectRestType"] = 4194304] = "ObjectRestType";
|
|
3694
3694
|
ObjectFlags3[ObjectFlags3["InstantiationExpressionType"] = 8388608] = "InstantiationExpressionType";
|
|
3695
|
+
ObjectFlags3[ObjectFlags3["SingleSignatureType"] = 134217728] = "SingleSignatureType";
|
|
3695
3696
|
ObjectFlags3[ObjectFlags3["IsClassInstanceClone"] = 16777216] = "IsClassInstanceClone";
|
|
3696
3697
|
ObjectFlags3[ObjectFlags3["IdenticalBaseTypeCalculated"] = 33554432] = "IdenticalBaseTypeCalculated";
|
|
3697
3698
|
ObjectFlags3[ObjectFlags3["IdenticalBaseTypeExists"] = 67108864] = "IdenticalBaseTypeExists";
|
|
@@ -48377,7 +48378,7 @@ function createTypeChecker(host) {
|
|
|
48377
48378
|
}
|
|
48378
48379
|
const abstractSignatures = filter(resolved.constructSignatures, (signature) => !!(signature.flags & 4 /* Abstract */));
|
|
48379
48380
|
if (some(abstractSignatures)) {
|
|
48380
|
-
const types = map(abstractSignatures, getOrCreateTypeFromSignature);
|
|
48381
|
+
const types = map(abstractSignatures, (s) => getOrCreateTypeFromSignature(s));
|
|
48381
48382
|
const typeElementCount = resolved.callSignatures.length + (resolved.constructSignatures.length - abstractSignatures.length) + resolved.indexInfos.length + // exclude `prototype` when writing a class expression as a type literal, as per
|
|
48382
48383
|
// the logic in `createTypeNodesFromResolvedType`.
|
|
48383
48384
|
(context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ ? countWhere(resolved.properties, (p) => !(p.flags & 4194304 /* Prototype */)) : length(resolved.properties));
|
|
@@ -54514,10 +54515,11 @@ function createTypeChecker(host) {
|
|
|
54514
54515
|
const modifiers = getMappedTypeModifiers(type);
|
|
54515
54516
|
return modifiers & 8 /* ExcludeOptional */ ? -1 : modifiers & 4 /* IncludeOptional */ ? 1 : 0;
|
|
54516
54517
|
}
|
|
54518
|
+
function getModifiersTypeOptionality(type) {
|
|
54519
|
+
return type.flags & 2097152 /* Intersection */ ? Math.max(...map(type.types, getModifiersTypeOptionality)) : getObjectFlags(type) & 32 /* Mapped */ ? getCombinedMappedTypeOptionality(type) : 0;
|
|
54520
|
+
}
|
|
54517
54521
|
function getCombinedMappedTypeOptionality(type) {
|
|
54518
|
-
|
|
54519
|
-
const modifiersType = getModifiersTypeFromMappedType(type);
|
|
54520
|
-
return optionality || (isGenericMappedType(modifiersType) ? getMappedTypeOptionality(modifiersType) : 0);
|
|
54522
|
+
return getMappedTypeOptionality(type) || getModifiersTypeOptionality(getModifiersTypeFromMappedType(type));
|
|
54521
54523
|
}
|
|
54522
54524
|
function isPartialMappedType(type) {
|
|
54523
54525
|
return !!(getObjectFlags(type) & 32 /* Mapped */ && getMappedTypeModifiers(type) & 4 /* IncludeOptional */);
|
|
@@ -55777,6 +55779,12 @@ function createTypeChecker(host) {
|
|
|
55777
55779
|
isInJSFile(signature.declaration)
|
|
55778
55780
|
);
|
|
55779
55781
|
}
|
|
55782
|
+
function getImplementationSignature(signature) {
|
|
55783
|
+
return signature.typeParameters ? signature.implementationSignatureCache || (signature.implementationSignatureCache = createImplementationSignature(signature)) : signature;
|
|
55784
|
+
}
|
|
55785
|
+
function createImplementationSignature(signature) {
|
|
55786
|
+
return signature.typeParameters ? instantiateSignature(signature, createTypeMapper([], [])) : signature;
|
|
55787
|
+
}
|
|
55780
55788
|
function getBaseSignature(signature) {
|
|
55781
55789
|
const typeParameters = signature.typeParameters;
|
|
55782
55790
|
if (typeParameters) {
|
|
@@ -55799,12 +55807,22 @@ function createTypeChecker(host) {
|
|
|
55799
55807
|
}
|
|
55800
55808
|
return signature;
|
|
55801
55809
|
}
|
|
55802
|
-
function getOrCreateTypeFromSignature(signature) {
|
|
55810
|
+
function getOrCreateTypeFromSignature(signature, outerTypeParameters) {
|
|
55803
55811
|
var _a;
|
|
55804
55812
|
if (!signature.isolatedSignatureType) {
|
|
55805
55813
|
const kind = (_a = signature.declaration) == null ? void 0 : _a.kind;
|
|
55806
55814
|
const isConstructor = kind === void 0 || kind === 176 /* Constructor */ || kind === 180 /* ConstructSignature */ || kind === 185 /* ConstructorType */;
|
|
55807
|
-
const type = createObjectType(16 /* Anonymous */);
|
|
55815
|
+
const type = createObjectType(16 /* Anonymous */ | 134217728 /* SingleSignatureType */, createSymbol(16 /* Function */, "__function" /* Function */));
|
|
55816
|
+
if (signature.declaration && !nodeIsSynthesized(signature.declaration)) {
|
|
55817
|
+
type.symbol.declarations = [signature.declaration];
|
|
55818
|
+
type.symbol.valueDeclaration = signature.declaration;
|
|
55819
|
+
}
|
|
55820
|
+
outerTypeParameters || (outerTypeParameters = signature.declaration && getOuterTypeParameters(
|
|
55821
|
+
signature.declaration,
|
|
55822
|
+
/*includeThisTypes*/
|
|
55823
|
+
true
|
|
55824
|
+
));
|
|
55825
|
+
type.outerTypeParameters = outerTypeParameters;
|
|
55808
55826
|
type.members = emptySymbols;
|
|
55809
55827
|
type.properties = emptyArray;
|
|
55810
55828
|
type.callSignatures = !isConstructor ? [signature] : emptyArray;
|
|
@@ -58282,7 +58300,13 @@ function createTypeChecker(host) {
|
|
|
58282
58300
|
function substituteIndexedMappedType(objectType, index) {
|
|
58283
58301
|
const mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]);
|
|
58284
58302
|
const templateMapper = combineTypeMappers(objectType.mapper, mapper);
|
|
58285
|
-
|
|
58303
|
+
const instantiatedTemplateType = instantiateType(getTemplateTypeFromMappedType(objectType.target || objectType), templateMapper);
|
|
58304
|
+
return addOptionality(
|
|
58305
|
+
instantiatedTemplateType,
|
|
58306
|
+
/*isProperty*/
|
|
58307
|
+
true,
|
|
58308
|
+
getCombinedMappedTypeOptionality(objectType) > 0
|
|
58309
|
+
);
|
|
58286
58310
|
}
|
|
58287
58311
|
function getIndexedAccessType(objectType, indexType, accessFlags = 0 /* None */, accessNode, aliasSymbol, aliasTypeArguments) {
|
|
58288
58312
|
return getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) || (accessNode ? errorType : unknownType);
|
|
@@ -59194,7 +59218,7 @@ function createTypeChecker(host) {
|
|
|
59194
59218
|
const declaration = type.objectFlags & 4 /* Reference */ ? type.node : type.objectFlags & 8388608 /* InstantiationExpressionType */ ? type.node : type.symbol.declarations[0];
|
|
59195
59219
|
const links = getNodeLinks(declaration);
|
|
59196
59220
|
const target = type.objectFlags & 4 /* Reference */ ? links.resolvedType : type.objectFlags & 64 /* Instantiated */ ? type.target : type;
|
|
59197
|
-
let typeParameters = links.outerTypeParameters;
|
|
59221
|
+
let typeParameters = type.objectFlags & 134217728 /* SingleSignatureType */ ? type.outerTypeParameters : links.outerTypeParameters;
|
|
59198
59222
|
if (!typeParameters) {
|
|
59199
59223
|
let outerTypeParameters = getOuterTypeParameters(
|
|
59200
59224
|
declaration,
|
|
@@ -59375,6 +59399,9 @@ function createTypeChecker(host) {
|
|
|
59375
59399
|
if (type.objectFlags & 8388608 /* InstantiationExpressionType */) {
|
|
59376
59400
|
result.node = type.node;
|
|
59377
59401
|
}
|
|
59402
|
+
if (type.objectFlags & 134217728 /* SingleSignatureType */) {
|
|
59403
|
+
result.outerTypeParameters = type.outerTypeParameters;
|
|
59404
|
+
}
|
|
59378
59405
|
result.target = type;
|
|
59379
59406
|
result.mapper = mapper;
|
|
59380
59407
|
result.aliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
@@ -63995,7 +64022,7 @@ function createTypeChecker(host) {
|
|
|
63995
64022
|
if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
|
|
63996
64023
|
return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
|
|
63997
64024
|
}
|
|
63998
|
-
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
|
|
64025
|
+
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 134217728 /* SingleSignatureType */ && !!length(type.outerTypeParameters) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
|
|
63999
64026
|
if (type.flags & 3899393 /* ObjectFlagsType */) {
|
|
64000
64027
|
type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
|
|
64001
64028
|
}
|
|
@@ -64277,6 +64304,9 @@ function createTypeChecker(host) {
|
|
|
64277
64304
|
pos = p;
|
|
64278
64305
|
}
|
|
64279
64306
|
}
|
|
64307
|
+
function isTupleOfSelf(typeParameter, type) {
|
|
64308
|
+
return isTupleType(type) && getTupleElementType(type, 0) === getIndexedAccessType(typeParameter, getNumberLiteralType(0)) && !getTypeOfPropertyOfType(type, "1");
|
|
64309
|
+
}
|
|
64280
64310
|
function inferTypes(inferences, originalSource, originalTarget, priority = 0 /* None */, contravariant = false) {
|
|
64281
64311
|
let bivariant = false;
|
|
64282
64312
|
let propagationType;
|
|
@@ -64362,6 +64392,9 @@ function createTypeChecker(host) {
|
|
|
64362
64392
|
inference.priority = priority;
|
|
64363
64393
|
}
|
|
64364
64394
|
if (priority === inference.priority) {
|
|
64395
|
+
if (isTupleOfSelf(inference.typeParameter, candidate)) {
|
|
64396
|
+
return;
|
|
64397
|
+
}
|
|
64365
64398
|
if (contravariant && !bivariant) {
|
|
64366
64399
|
if (!contains(inference.contraCandidates, candidate)) {
|
|
64367
64400
|
inference.contraCandidates = append(inference.contraCandidates, candidate);
|
|
@@ -71284,7 +71317,7 @@ function createTypeChecker(host) {
|
|
|
71284
71317
|
argument = skipParentheses(argument);
|
|
71285
71318
|
return isSatisfiesExpression(argument) ? skipParentheses(argument.expression) : argument;
|
|
71286
71319
|
}
|
|
71287
|
-
function getSignatureApplicabilityError(node, args, signature, relation, checkMode, reportErrors2, containingMessageChain) {
|
|
71320
|
+
function getSignatureApplicabilityError(node, args, signature, relation, checkMode, reportErrors2, containingMessageChain, inferenceContext) {
|
|
71288
71321
|
const errorOutputContainer = { errors: void 0, skipLogging: true };
|
|
71289
71322
|
if (isJsxOpeningLikeElement(node)) {
|
|
71290
71323
|
if (!checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors2, containingMessageChain, errorOutputContainer)) {
|
|
@@ -71318,7 +71351,8 @@ function createTypeChecker(host) {
|
|
|
71318
71351
|
void 0,
|
|
71319
71352
|
checkMode
|
|
71320
71353
|
);
|
|
71321
|
-
const
|
|
71354
|
+
const regularArgType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(argType) : argType;
|
|
71355
|
+
const checkArgType = inferenceContext ? instantiateType(regularArgType, inferenceContext.nonFixingMapper) : regularArgType;
|
|
71322
71356
|
const effectiveCheckArgumentNode = getEffectiveCheckNode(arg);
|
|
71323
71357
|
if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors2 ? effectiveCheckArgumentNode : void 0, effectiveCheckArgumentNode, headMessage, containingMessageChain, errorOutputContainer)) {
|
|
71324
71358
|
Debug.assert(!reportErrors2 || !!errorOutputContainer.errors, "parameter should have errors when reporting errors");
|
|
@@ -71727,7 +71761,9 @@ function createTypeChecker(host) {
|
|
|
71727
71761
|
0 /* Normal */,
|
|
71728
71762
|
/*reportErrors*/
|
|
71729
71763
|
true,
|
|
71730
|
-
() => chain
|
|
71764
|
+
() => chain,
|
|
71765
|
+
/*inferenceContext*/
|
|
71766
|
+
void 0
|
|
71731
71767
|
);
|
|
71732
71768
|
if (diags) {
|
|
71733
71769
|
for (const d of diags) {
|
|
@@ -71763,7 +71799,9 @@ function createTypeChecker(host) {
|
|
|
71763
71799
|
0 /* Normal */,
|
|
71764
71800
|
/*reportErrors*/
|
|
71765
71801
|
true,
|
|
71766
|
-
chain2
|
|
71802
|
+
chain2,
|
|
71803
|
+
/*inferenceContext*/
|
|
71804
|
+
void 0
|
|
71767
71805
|
);
|
|
71768
71806
|
if (diags2) {
|
|
71769
71807
|
if (diags2.length <= min2) {
|
|
@@ -71854,6 +71892,8 @@ function createTypeChecker(host) {
|
|
|
71854
71892
|
/*reportErrors*/
|
|
71855
71893
|
false,
|
|
71856
71894
|
/*containingMessageChain*/
|
|
71895
|
+
void 0,
|
|
71896
|
+
/*inferenceContext*/
|
|
71857
71897
|
void 0
|
|
71858
71898
|
)) {
|
|
71859
71899
|
candidatesForArgumentError = [candidate];
|
|
@@ -71862,13 +71902,16 @@ function createTypeChecker(host) {
|
|
|
71862
71902
|
return candidate;
|
|
71863
71903
|
}
|
|
71864
71904
|
for (let candidateIndex = 0; candidateIndex < candidates2.length; candidateIndex++) {
|
|
71865
|
-
|
|
71905
|
+
let candidate = candidates2[candidateIndex];
|
|
71866
71906
|
if (!hasCorrectTypeArgumentArity(candidate, typeArguments) || !hasCorrectArity(node, args, candidate, signatureHelpTrailingComma2)) {
|
|
71867
71907
|
continue;
|
|
71868
71908
|
}
|
|
71869
71909
|
let checkCandidate;
|
|
71870
71910
|
let inferenceContext;
|
|
71871
71911
|
if (candidate.typeParameters) {
|
|
71912
|
+
if (candidate.declaration && findAncestor(node, (a) => a === candidate.declaration)) {
|
|
71913
|
+
candidate = getImplementationSignature(candidate);
|
|
71914
|
+
}
|
|
71872
71915
|
let typeArgumentTypes;
|
|
71873
71916
|
if (some(typeArguments)) {
|
|
71874
71917
|
typeArgumentTypes = checkTypeArguments(
|
|
@@ -71888,7 +71931,7 @@ function createTypeChecker(host) {
|
|
|
71888
71931
|
/*flags*/
|
|
71889
71932
|
isInJSFile(node) ? 2 /* AnyDefault */ : 0 /* None */
|
|
71890
71933
|
);
|
|
71891
|
-
typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext);
|
|
71934
|
+
typeArgumentTypes = instantiateTypes(inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext), inferenceContext.nonFixingMapper);
|
|
71892
71935
|
argCheckMode |= inferenceContext.flags & 4 /* SkippedGenericFunction */ ? 8 /* SkipGenericFunctions */ : 0 /* Normal */;
|
|
71893
71936
|
}
|
|
71894
71937
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
|
|
@@ -71908,7 +71951,8 @@ function createTypeChecker(host) {
|
|
|
71908
71951
|
/*reportErrors*/
|
|
71909
71952
|
false,
|
|
71910
71953
|
/*containingMessageChain*/
|
|
71911
|
-
void 0
|
|
71954
|
+
void 0,
|
|
71955
|
+
inferenceContext
|
|
71912
71956
|
)) {
|
|
71913
71957
|
(candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate);
|
|
71914
71958
|
continue;
|
|
@@ -71916,7 +71960,7 @@ function createTypeChecker(host) {
|
|
|
71916
71960
|
if (argCheckMode) {
|
|
71917
71961
|
argCheckMode = 0 /* Normal */;
|
|
71918
71962
|
if (inferenceContext) {
|
|
71919
|
-
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
71963
|
+
const typeArgumentTypes = instantiateTypes(inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext), inferenceContext.mapper);
|
|
71920
71964
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
71921
71965
|
if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma2)) {
|
|
71922
71966
|
candidateForArgumentArityError = checkCandidate;
|
|
@@ -71932,7 +71976,8 @@ function createTypeChecker(host) {
|
|
|
71932
71976
|
/*reportErrors*/
|
|
71933
71977
|
false,
|
|
71934
71978
|
/*containingMessageChain*/
|
|
71935
|
-
void 0
|
|
71979
|
+
void 0,
|
|
71980
|
+
inferenceContext
|
|
71936
71981
|
)) {
|
|
71937
71982
|
(candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate);
|
|
71938
71983
|
continue;
|
|
@@ -75629,7 +75674,7 @@ function createTypeChecker(host) {
|
|
|
75629
75674
|
}
|
|
75630
75675
|
}
|
|
75631
75676
|
}
|
|
75632
|
-
return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context));
|
|
75677
|
+
return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context), flatMap(inferenceContexts, (c) => c && map(c.inferences, (i) => i.typeParameter)).slice());
|
|
75633
75678
|
}
|
|
75634
75679
|
}
|
|
75635
75680
|
}
|
package/lib/tsserver.js
CHANGED
|
@@ -2325,7 +2325,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2325
2325
|
|
|
2326
2326
|
// src/compiler/corePublic.ts
|
|
2327
2327
|
var versionMajorMinor = "5.5";
|
|
2328
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2328
|
+
var version = `${versionMajorMinor}.0-insiders.20240305`;
|
|
2329
2329
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2330
2330
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2331
2331
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6710,6 +6710,7 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
|
6710
6710
|
ObjectFlags3[ObjectFlags3["ContainsSpread"] = 2097152] = "ContainsSpread";
|
|
6711
6711
|
ObjectFlags3[ObjectFlags3["ObjectRestType"] = 4194304] = "ObjectRestType";
|
|
6712
6712
|
ObjectFlags3[ObjectFlags3["InstantiationExpressionType"] = 8388608] = "InstantiationExpressionType";
|
|
6713
|
+
ObjectFlags3[ObjectFlags3["SingleSignatureType"] = 134217728] = "SingleSignatureType";
|
|
6713
6714
|
ObjectFlags3[ObjectFlags3["IsClassInstanceClone"] = 16777216] = "IsClassInstanceClone";
|
|
6714
6715
|
ObjectFlags3[ObjectFlags3["IdenticalBaseTypeCalculated"] = 33554432] = "IdenticalBaseTypeCalculated";
|
|
6715
6716
|
ObjectFlags3[ObjectFlags3["IdenticalBaseTypeExists"] = 67108864] = "IdenticalBaseTypeExists";
|
|
@@ -53096,7 +53097,7 @@ function createTypeChecker(host) {
|
|
|
53096
53097
|
}
|
|
53097
53098
|
const abstractSignatures = filter(resolved.constructSignatures, (signature) => !!(signature.flags & 4 /* Abstract */));
|
|
53098
53099
|
if (some(abstractSignatures)) {
|
|
53099
|
-
const types = map(abstractSignatures, getOrCreateTypeFromSignature);
|
|
53100
|
+
const types = map(abstractSignatures, (s) => getOrCreateTypeFromSignature(s));
|
|
53100
53101
|
const typeElementCount = resolved.callSignatures.length + (resolved.constructSignatures.length - abstractSignatures.length) + resolved.indexInfos.length + // exclude `prototype` when writing a class expression as a type literal, as per
|
|
53101
53102
|
// the logic in `createTypeNodesFromResolvedType`.
|
|
53102
53103
|
(context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ ? countWhere(resolved.properties, (p) => !(p.flags & 4194304 /* Prototype */)) : length(resolved.properties));
|
|
@@ -59233,10 +59234,11 @@ function createTypeChecker(host) {
|
|
|
59233
59234
|
const modifiers = getMappedTypeModifiers(type);
|
|
59234
59235
|
return modifiers & 8 /* ExcludeOptional */ ? -1 : modifiers & 4 /* IncludeOptional */ ? 1 : 0;
|
|
59235
59236
|
}
|
|
59237
|
+
function getModifiersTypeOptionality(type) {
|
|
59238
|
+
return type.flags & 2097152 /* Intersection */ ? Math.max(...map(type.types, getModifiersTypeOptionality)) : getObjectFlags(type) & 32 /* Mapped */ ? getCombinedMappedTypeOptionality(type) : 0;
|
|
59239
|
+
}
|
|
59236
59240
|
function getCombinedMappedTypeOptionality(type) {
|
|
59237
|
-
|
|
59238
|
-
const modifiersType = getModifiersTypeFromMappedType(type);
|
|
59239
|
-
return optionality || (isGenericMappedType(modifiersType) ? getMappedTypeOptionality(modifiersType) : 0);
|
|
59241
|
+
return getMappedTypeOptionality(type) || getModifiersTypeOptionality(getModifiersTypeFromMappedType(type));
|
|
59240
59242
|
}
|
|
59241
59243
|
function isPartialMappedType(type) {
|
|
59242
59244
|
return !!(getObjectFlags(type) & 32 /* Mapped */ && getMappedTypeModifiers(type) & 4 /* IncludeOptional */);
|
|
@@ -60496,6 +60498,12 @@ function createTypeChecker(host) {
|
|
|
60496
60498
|
isInJSFile(signature.declaration)
|
|
60497
60499
|
);
|
|
60498
60500
|
}
|
|
60501
|
+
function getImplementationSignature(signature) {
|
|
60502
|
+
return signature.typeParameters ? signature.implementationSignatureCache || (signature.implementationSignatureCache = createImplementationSignature(signature)) : signature;
|
|
60503
|
+
}
|
|
60504
|
+
function createImplementationSignature(signature) {
|
|
60505
|
+
return signature.typeParameters ? instantiateSignature(signature, createTypeMapper([], [])) : signature;
|
|
60506
|
+
}
|
|
60499
60507
|
function getBaseSignature(signature) {
|
|
60500
60508
|
const typeParameters = signature.typeParameters;
|
|
60501
60509
|
if (typeParameters) {
|
|
@@ -60518,12 +60526,22 @@ function createTypeChecker(host) {
|
|
|
60518
60526
|
}
|
|
60519
60527
|
return signature;
|
|
60520
60528
|
}
|
|
60521
|
-
function getOrCreateTypeFromSignature(signature) {
|
|
60529
|
+
function getOrCreateTypeFromSignature(signature, outerTypeParameters) {
|
|
60522
60530
|
var _a;
|
|
60523
60531
|
if (!signature.isolatedSignatureType) {
|
|
60524
60532
|
const kind = (_a = signature.declaration) == null ? void 0 : _a.kind;
|
|
60525
60533
|
const isConstructor = kind === void 0 || kind === 176 /* Constructor */ || kind === 180 /* ConstructSignature */ || kind === 185 /* ConstructorType */;
|
|
60526
|
-
const type = createObjectType(16 /* Anonymous */);
|
|
60534
|
+
const type = createObjectType(16 /* Anonymous */ | 134217728 /* SingleSignatureType */, createSymbol(16 /* Function */, "__function" /* Function */));
|
|
60535
|
+
if (signature.declaration && !nodeIsSynthesized(signature.declaration)) {
|
|
60536
|
+
type.symbol.declarations = [signature.declaration];
|
|
60537
|
+
type.symbol.valueDeclaration = signature.declaration;
|
|
60538
|
+
}
|
|
60539
|
+
outerTypeParameters || (outerTypeParameters = signature.declaration && getOuterTypeParameters(
|
|
60540
|
+
signature.declaration,
|
|
60541
|
+
/*includeThisTypes*/
|
|
60542
|
+
true
|
|
60543
|
+
));
|
|
60544
|
+
type.outerTypeParameters = outerTypeParameters;
|
|
60527
60545
|
type.members = emptySymbols;
|
|
60528
60546
|
type.properties = emptyArray;
|
|
60529
60547
|
type.callSignatures = !isConstructor ? [signature] : emptyArray;
|
|
@@ -63001,7 +63019,13 @@ function createTypeChecker(host) {
|
|
|
63001
63019
|
function substituteIndexedMappedType(objectType, index) {
|
|
63002
63020
|
const mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]);
|
|
63003
63021
|
const templateMapper = combineTypeMappers(objectType.mapper, mapper);
|
|
63004
|
-
|
|
63022
|
+
const instantiatedTemplateType = instantiateType(getTemplateTypeFromMappedType(objectType.target || objectType), templateMapper);
|
|
63023
|
+
return addOptionality(
|
|
63024
|
+
instantiatedTemplateType,
|
|
63025
|
+
/*isProperty*/
|
|
63026
|
+
true,
|
|
63027
|
+
getCombinedMappedTypeOptionality(objectType) > 0
|
|
63028
|
+
);
|
|
63005
63029
|
}
|
|
63006
63030
|
function getIndexedAccessType(objectType, indexType, accessFlags = 0 /* None */, accessNode, aliasSymbol, aliasTypeArguments) {
|
|
63007
63031
|
return getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) || (accessNode ? errorType : unknownType);
|
|
@@ -63913,7 +63937,7 @@ function createTypeChecker(host) {
|
|
|
63913
63937
|
const declaration = type.objectFlags & 4 /* Reference */ ? type.node : type.objectFlags & 8388608 /* InstantiationExpressionType */ ? type.node : type.symbol.declarations[0];
|
|
63914
63938
|
const links = getNodeLinks(declaration);
|
|
63915
63939
|
const target = type.objectFlags & 4 /* Reference */ ? links.resolvedType : type.objectFlags & 64 /* Instantiated */ ? type.target : type;
|
|
63916
|
-
let typeParameters = links.outerTypeParameters;
|
|
63940
|
+
let typeParameters = type.objectFlags & 134217728 /* SingleSignatureType */ ? type.outerTypeParameters : links.outerTypeParameters;
|
|
63917
63941
|
if (!typeParameters) {
|
|
63918
63942
|
let outerTypeParameters = getOuterTypeParameters(
|
|
63919
63943
|
declaration,
|
|
@@ -64094,6 +64118,9 @@ function createTypeChecker(host) {
|
|
|
64094
64118
|
if (type.objectFlags & 8388608 /* InstantiationExpressionType */) {
|
|
64095
64119
|
result.node = type.node;
|
|
64096
64120
|
}
|
|
64121
|
+
if (type.objectFlags & 134217728 /* SingleSignatureType */) {
|
|
64122
|
+
result.outerTypeParameters = type.outerTypeParameters;
|
|
64123
|
+
}
|
|
64097
64124
|
result.target = type;
|
|
64098
64125
|
result.mapper = mapper;
|
|
64099
64126
|
result.aliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
@@ -68714,7 +68741,7 @@ function createTypeChecker(host) {
|
|
|
68714
68741
|
if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
|
|
68715
68742
|
return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
|
|
68716
68743
|
}
|
|
68717
|
-
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
|
|
68744
|
+
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 134217728 /* SingleSignatureType */ && !!length(type.outerTypeParameters) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
|
|
68718
68745
|
if (type.flags & 3899393 /* ObjectFlagsType */) {
|
|
68719
68746
|
type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
|
|
68720
68747
|
}
|
|
@@ -68996,6 +69023,9 @@ function createTypeChecker(host) {
|
|
|
68996
69023
|
pos = p;
|
|
68997
69024
|
}
|
|
68998
69025
|
}
|
|
69026
|
+
function isTupleOfSelf(typeParameter, type) {
|
|
69027
|
+
return isTupleType(type) && getTupleElementType(type, 0) === getIndexedAccessType(typeParameter, getNumberLiteralType(0)) && !getTypeOfPropertyOfType(type, "1");
|
|
69028
|
+
}
|
|
68999
69029
|
function inferTypes(inferences, originalSource, originalTarget, priority = 0 /* None */, contravariant = false) {
|
|
69000
69030
|
let bivariant = false;
|
|
69001
69031
|
let propagationType;
|
|
@@ -69081,6 +69111,9 @@ function createTypeChecker(host) {
|
|
|
69081
69111
|
inference.priority = priority;
|
|
69082
69112
|
}
|
|
69083
69113
|
if (priority === inference.priority) {
|
|
69114
|
+
if (isTupleOfSelf(inference.typeParameter, candidate)) {
|
|
69115
|
+
return;
|
|
69116
|
+
}
|
|
69084
69117
|
if (contravariant && !bivariant) {
|
|
69085
69118
|
if (!contains(inference.contraCandidates, candidate)) {
|
|
69086
69119
|
inference.contraCandidates = append(inference.contraCandidates, candidate);
|
|
@@ -76003,7 +76036,7 @@ function createTypeChecker(host) {
|
|
|
76003
76036
|
argument = skipParentheses(argument);
|
|
76004
76037
|
return isSatisfiesExpression(argument) ? skipParentheses(argument.expression) : argument;
|
|
76005
76038
|
}
|
|
76006
|
-
function getSignatureApplicabilityError(node, args, signature, relation, checkMode, reportErrors2, containingMessageChain) {
|
|
76039
|
+
function getSignatureApplicabilityError(node, args, signature, relation, checkMode, reportErrors2, containingMessageChain, inferenceContext) {
|
|
76007
76040
|
const errorOutputContainer = { errors: void 0, skipLogging: true };
|
|
76008
76041
|
if (isJsxOpeningLikeElement(node)) {
|
|
76009
76042
|
if (!checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors2, containingMessageChain, errorOutputContainer)) {
|
|
@@ -76037,7 +76070,8 @@ function createTypeChecker(host) {
|
|
|
76037
76070
|
void 0,
|
|
76038
76071
|
checkMode
|
|
76039
76072
|
);
|
|
76040
|
-
const
|
|
76073
|
+
const regularArgType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(argType) : argType;
|
|
76074
|
+
const checkArgType = inferenceContext ? instantiateType(regularArgType, inferenceContext.nonFixingMapper) : regularArgType;
|
|
76041
76075
|
const effectiveCheckArgumentNode = getEffectiveCheckNode(arg);
|
|
76042
76076
|
if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors2 ? effectiveCheckArgumentNode : void 0, effectiveCheckArgumentNode, headMessage, containingMessageChain, errorOutputContainer)) {
|
|
76043
76077
|
Debug.assert(!reportErrors2 || !!errorOutputContainer.errors, "parameter should have errors when reporting errors");
|
|
@@ -76446,7 +76480,9 @@ function createTypeChecker(host) {
|
|
|
76446
76480
|
0 /* Normal */,
|
|
76447
76481
|
/*reportErrors*/
|
|
76448
76482
|
true,
|
|
76449
|
-
() => chain
|
|
76483
|
+
() => chain,
|
|
76484
|
+
/*inferenceContext*/
|
|
76485
|
+
void 0
|
|
76450
76486
|
);
|
|
76451
76487
|
if (diags) {
|
|
76452
76488
|
for (const d of diags) {
|
|
@@ -76482,7 +76518,9 @@ function createTypeChecker(host) {
|
|
|
76482
76518
|
0 /* Normal */,
|
|
76483
76519
|
/*reportErrors*/
|
|
76484
76520
|
true,
|
|
76485
|
-
chain2
|
|
76521
|
+
chain2,
|
|
76522
|
+
/*inferenceContext*/
|
|
76523
|
+
void 0
|
|
76486
76524
|
);
|
|
76487
76525
|
if (diags2) {
|
|
76488
76526
|
if (diags2.length <= min2) {
|
|
@@ -76573,6 +76611,8 @@ function createTypeChecker(host) {
|
|
|
76573
76611
|
/*reportErrors*/
|
|
76574
76612
|
false,
|
|
76575
76613
|
/*containingMessageChain*/
|
|
76614
|
+
void 0,
|
|
76615
|
+
/*inferenceContext*/
|
|
76576
76616
|
void 0
|
|
76577
76617
|
)) {
|
|
76578
76618
|
candidatesForArgumentError = [candidate];
|
|
@@ -76581,13 +76621,16 @@ function createTypeChecker(host) {
|
|
|
76581
76621
|
return candidate;
|
|
76582
76622
|
}
|
|
76583
76623
|
for (let candidateIndex = 0; candidateIndex < candidates2.length; candidateIndex++) {
|
|
76584
|
-
|
|
76624
|
+
let candidate = candidates2[candidateIndex];
|
|
76585
76625
|
if (!hasCorrectTypeArgumentArity(candidate, typeArguments) || !hasCorrectArity(node, args, candidate, signatureHelpTrailingComma2)) {
|
|
76586
76626
|
continue;
|
|
76587
76627
|
}
|
|
76588
76628
|
let checkCandidate;
|
|
76589
76629
|
let inferenceContext;
|
|
76590
76630
|
if (candidate.typeParameters) {
|
|
76631
|
+
if (candidate.declaration && findAncestor(node, (a) => a === candidate.declaration)) {
|
|
76632
|
+
candidate = getImplementationSignature(candidate);
|
|
76633
|
+
}
|
|
76591
76634
|
let typeArgumentTypes;
|
|
76592
76635
|
if (some(typeArguments)) {
|
|
76593
76636
|
typeArgumentTypes = checkTypeArguments(
|
|
@@ -76607,7 +76650,7 @@ function createTypeChecker(host) {
|
|
|
76607
76650
|
/*flags*/
|
|
76608
76651
|
isInJSFile(node) ? 2 /* AnyDefault */ : 0 /* None */
|
|
76609
76652
|
);
|
|
76610
|
-
typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext);
|
|
76653
|
+
typeArgumentTypes = instantiateTypes(inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext), inferenceContext.nonFixingMapper);
|
|
76611
76654
|
argCheckMode |= inferenceContext.flags & 4 /* SkippedGenericFunction */ ? 8 /* SkipGenericFunctions */ : 0 /* Normal */;
|
|
76612
76655
|
}
|
|
76613
76656
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
|
|
@@ -76627,7 +76670,8 @@ function createTypeChecker(host) {
|
|
|
76627
76670
|
/*reportErrors*/
|
|
76628
76671
|
false,
|
|
76629
76672
|
/*containingMessageChain*/
|
|
76630
|
-
void 0
|
|
76673
|
+
void 0,
|
|
76674
|
+
inferenceContext
|
|
76631
76675
|
)) {
|
|
76632
76676
|
(candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate);
|
|
76633
76677
|
continue;
|
|
@@ -76635,7 +76679,7 @@ function createTypeChecker(host) {
|
|
|
76635
76679
|
if (argCheckMode) {
|
|
76636
76680
|
argCheckMode = 0 /* Normal */;
|
|
76637
76681
|
if (inferenceContext) {
|
|
76638
|
-
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
76682
|
+
const typeArgumentTypes = instantiateTypes(inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext), inferenceContext.mapper);
|
|
76639
76683
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
76640
76684
|
if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma2)) {
|
|
76641
76685
|
candidateForArgumentArityError = checkCandidate;
|
|
@@ -76651,7 +76695,8 @@ function createTypeChecker(host) {
|
|
|
76651
76695
|
/*reportErrors*/
|
|
76652
76696
|
false,
|
|
76653
76697
|
/*containingMessageChain*/
|
|
76654
|
-
void 0
|
|
76698
|
+
void 0,
|
|
76699
|
+
inferenceContext
|
|
76655
76700
|
)) {
|
|
76656
76701
|
(candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate);
|
|
76657
76702
|
continue;
|
|
@@ -80348,7 +80393,7 @@ function createTypeChecker(host) {
|
|
|
80348
80393
|
}
|
|
80349
80394
|
}
|
|
80350
80395
|
}
|
|
80351
|
-
return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context));
|
|
80396
|
+
return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context), flatMap(inferenceContexts, (c) => c && map(c.inferences, (i) => i.typeParameter)).slice());
|
|
80352
80397
|
}
|
|
80353
80398
|
}
|
|
80354
80399
|
}
|
|
@@ -136020,7 +136065,7 @@ function createDocumentRegistryInternal(useCaseSensitiveFileNames2, currentDirec
|
|
|
136020
136065
|
let entry = bucketEntry && getDocumentRegistryEntry(bucketEntry, scriptKind);
|
|
136021
136066
|
if (!entry && externalCache) {
|
|
136022
136067
|
const sourceFile = externalCache.getDocument(keyWithMode, path);
|
|
136023
|
-
if (sourceFile) {
|
|
136068
|
+
if (sourceFile && sourceFile.scriptKind === scriptKind && sourceFile.text === getSnapshotText(scriptSnapshot)) {
|
|
136024
136069
|
Debug.assert(acquiring);
|
|
136025
136070
|
entry = {
|
|
136026
136071
|
sourceFile,
|
|
@@ -158476,9 +158521,6 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
|
|
|
158476
158521
|
const memberCompletionEntry = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext);
|
|
158477
158522
|
if (memberCompletionEntry) {
|
|
158478
158523
|
({ insertText, filterText, isSnippet, importAdder } = memberCompletionEntry);
|
|
158479
|
-
if (memberCompletionEntry.eraseRange) {
|
|
158480
|
-
replacementSpan = createTextSpanFromBounds(memberCompletionEntry.eraseRange.pos, memberCompletionEntry.eraseRange.end);
|
|
158481
|
-
}
|
|
158482
158524
|
if (importAdder == null ? void 0 : importAdder.hasFixes()) {
|
|
158483
158525
|
hasAction = true;
|
|
158484
158526
|
source = "ClassMemberSnippet/" /* ClassMemberSnippet */;
|
|
@@ -158560,7 +158602,7 @@ function getEntryForMemberCompletion(host, program, options, preferences, name,
|
|
|
158560
158602
|
}
|
|
158561
158603
|
let isSnippet;
|
|
158562
158604
|
let insertText = name;
|
|
158563
|
-
|
|
158605
|
+
const filterText = name;
|
|
158564
158606
|
const checker = program.getTypeChecker();
|
|
158565
158607
|
const sourceFile = location.getSourceFile();
|
|
158566
158608
|
const printer = createSnippetPrinter({
|
|
@@ -158589,10 +158631,7 @@ function getEntryForMemberCompletion(host, program, options, preferences, name,
|
|
|
158589
158631
|
);
|
|
158590
158632
|
}
|
|
158591
158633
|
let modifiers = 0 /* None */;
|
|
158592
|
-
const { modifiers: presentModifiers, range: eraseRange, decorators: presentDecorators
|
|
158593
|
-
if (modifiersFilterText) {
|
|
158594
|
-
filterText = modifiersFilterText + filterText;
|
|
158595
|
-
}
|
|
158634
|
+
const { modifiers: presentModifiers, range: eraseRange, decorators: presentDecorators } = getPresentModifiers(contextToken, sourceFile, position);
|
|
158596
158635
|
const isAbstract = presentModifiers & 64 /* Abstract */ && classLikeDeclaration.modifierFlagsCache & 64 /* Abstract */;
|
|
158597
158636
|
let completionNodes = [];
|
|
158598
158637
|
ts_codefix_exports.addNewNodeForMemberSymbol(
|
|
@@ -158677,31 +158716,21 @@ function getPresentModifiers(contextToken, sourceFile, position) {
|
|
|
158677
158716
|
}
|
|
158678
158717
|
let modifiers = 0 /* None */;
|
|
158679
158718
|
let decorators;
|
|
158680
|
-
let
|
|
158681
|
-
const contextMod = isModifierLike2(contextToken);
|
|
158719
|
+
let contextMod;
|
|
158682
158720
|
const range = { pos: position, end: position };
|
|
158683
158721
|
if (isPropertyDeclaration(contextToken.parent) && contextToken.parent.modifiers) {
|
|
158684
158722
|
modifiers |= modifiersToFlags(contextToken.parent.modifiers) & 98303 /* Modifier */;
|
|
158685
158723
|
decorators = contextToken.parent.modifiers.filter(isDecorator) || [];
|
|
158686
|
-
|
|
158687
|
-
if (firstModifier) {
|
|
158688
|
-
range.pos = Math.min(range.pos, firstModifier.getStart(sourceFile));
|
|
158689
|
-
if (contextToken.parent.name !== contextToken) {
|
|
158690
|
-
filterTextEnd = contextToken.parent.name.getStart(sourceFile);
|
|
158691
|
-
}
|
|
158692
|
-
}
|
|
158724
|
+
range.pos = Math.min(range.pos, contextToken.parent.modifiers.pos);
|
|
158693
158725
|
}
|
|
158694
|
-
if (contextMod) {
|
|
158726
|
+
if (contextMod = isModifierLike2(contextToken)) {
|
|
158695
158727
|
const contextModifierFlag = modifierToFlag(contextMod);
|
|
158696
158728
|
if (!(modifiers & contextModifierFlag)) {
|
|
158697
158729
|
modifiers |= contextModifierFlag;
|
|
158698
|
-
range.pos = Math.min(range.pos, contextToken.
|
|
158730
|
+
range.pos = Math.min(range.pos, contextToken.pos);
|
|
158699
158731
|
}
|
|
158700
158732
|
}
|
|
158701
|
-
|
|
158702
|
-
return { modifiers, decorators };
|
|
158703
|
-
}
|
|
158704
|
-
return { modifiers, decorators, range, filterText: sourceFile.text.slice(range.pos, filterTextEnd ?? position) };
|
|
158733
|
+
return { modifiers, decorators, range: range.pos !== position ? range : void 0 };
|
|
158705
158734
|
}
|
|
158706
158735
|
function isModifierLike2(node) {
|
|
158707
158736
|
if (isModifier(node)) {
|
package/lib/typescript.d.ts
CHANGED
package/lib/typescript.js
CHANGED
|
@@ -2325,7 +2325,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2325
2325
|
|
|
2326
2326
|
// src/compiler/corePublic.ts
|
|
2327
2327
|
var versionMajorMinor = "5.5";
|
|
2328
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2328
|
+
var version = `${versionMajorMinor}.0-insiders.20240305`;
|
|
2329
2329
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2330
2330
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2331
2331
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6710,6 +6710,7 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
|
6710
6710
|
ObjectFlags3[ObjectFlags3["ContainsSpread"] = 2097152] = "ContainsSpread";
|
|
6711
6711
|
ObjectFlags3[ObjectFlags3["ObjectRestType"] = 4194304] = "ObjectRestType";
|
|
6712
6712
|
ObjectFlags3[ObjectFlags3["InstantiationExpressionType"] = 8388608] = "InstantiationExpressionType";
|
|
6713
|
+
ObjectFlags3[ObjectFlags3["SingleSignatureType"] = 134217728] = "SingleSignatureType";
|
|
6713
6714
|
ObjectFlags3[ObjectFlags3["IsClassInstanceClone"] = 16777216] = "IsClassInstanceClone";
|
|
6714
6715
|
ObjectFlags3[ObjectFlags3["IdenticalBaseTypeCalculated"] = 33554432] = "IdenticalBaseTypeCalculated";
|
|
6715
6716
|
ObjectFlags3[ObjectFlags3["IdenticalBaseTypeExists"] = 67108864] = "IdenticalBaseTypeExists";
|
|
@@ -53096,7 +53097,7 @@ function createTypeChecker(host) {
|
|
|
53096
53097
|
}
|
|
53097
53098
|
const abstractSignatures = filter(resolved.constructSignatures, (signature) => !!(signature.flags & 4 /* Abstract */));
|
|
53098
53099
|
if (some(abstractSignatures)) {
|
|
53099
|
-
const types = map(abstractSignatures, getOrCreateTypeFromSignature);
|
|
53100
|
+
const types = map(abstractSignatures, (s) => getOrCreateTypeFromSignature(s));
|
|
53100
53101
|
const typeElementCount = resolved.callSignatures.length + (resolved.constructSignatures.length - abstractSignatures.length) + resolved.indexInfos.length + // exclude `prototype` when writing a class expression as a type literal, as per
|
|
53101
53102
|
// the logic in `createTypeNodesFromResolvedType`.
|
|
53102
53103
|
(context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ ? countWhere(resolved.properties, (p) => !(p.flags & 4194304 /* Prototype */)) : length(resolved.properties));
|
|
@@ -59233,10 +59234,11 @@ function createTypeChecker(host) {
|
|
|
59233
59234
|
const modifiers = getMappedTypeModifiers(type);
|
|
59234
59235
|
return modifiers & 8 /* ExcludeOptional */ ? -1 : modifiers & 4 /* IncludeOptional */ ? 1 : 0;
|
|
59235
59236
|
}
|
|
59237
|
+
function getModifiersTypeOptionality(type) {
|
|
59238
|
+
return type.flags & 2097152 /* Intersection */ ? Math.max(...map(type.types, getModifiersTypeOptionality)) : getObjectFlags(type) & 32 /* Mapped */ ? getCombinedMappedTypeOptionality(type) : 0;
|
|
59239
|
+
}
|
|
59236
59240
|
function getCombinedMappedTypeOptionality(type) {
|
|
59237
|
-
|
|
59238
|
-
const modifiersType = getModifiersTypeFromMappedType(type);
|
|
59239
|
-
return optionality || (isGenericMappedType(modifiersType) ? getMappedTypeOptionality(modifiersType) : 0);
|
|
59241
|
+
return getMappedTypeOptionality(type) || getModifiersTypeOptionality(getModifiersTypeFromMappedType(type));
|
|
59240
59242
|
}
|
|
59241
59243
|
function isPartialMappedType(type) {
|
|
59242
59244
|
return !!(getObjectFlags(type) & 32 /* Mapped */ && getMappedTypeModifiers(type) & 4 /* IncludeOptional */);
|
|
@@ -60496,6 +60498,12 @@ function createTypeChecker(host) {
|
|
|
60496
60498
|
isInJSFile(signature.declaration)
|
|
60497
60499
|
);
|
|
60498
60500
|
}
|
|
60501
|
+
function getImplementationSignature(signature) {
|
|
60502
|
+
return signature.typeParameters ? signature.implementationSignatureCache || (signature.implementationSignatureCache = createImplementationSignature(signature)) : signature;
|
|
60503
|
+
}
|
|
60504
|
+
function createImplementationSignature(signature) {
|
|
60505
|
+
return signature.typeParameters ? instantiateSignature(signature, createTypeMapper([], [])) : signature;
|
|
60506
|
+
}
|
|
60499
60507
|
function getBaseSignature(signature) {
|
|
60500
60508
|
const typeParameters = signature.typeParameters;
|
|
60501
60509
|
if (typeParameters) {
|
|
@@ -60518,12 +60526,22 @@ function createTypeChecker(host) {
|
|
|
60518
60526
|
}
|
|
60519
60527
|
return signature;
|
|
60520
60528
|
}
|
|
60521
|
-
function getOrCreateTypeFromSignature(signature) {
|
|
60529
|
+
function getOrCreateTypeFromSignature(signature, outerTypeParameters) {
|
|
60522
60530
|
var _a;
|
|
60523
60531
|
if (!signature.isolatedSignatureType) {
|
|
60524
60532
|
const kind = (_a = signature.declaration) == null ? void 0 : _a.kind;
|
|
60525
60533
|
const isConstructor = kind === void 0 || kind === 176 /* Constructor */ || kind === 180 /* ConstructSignature */ || kind === 185 /* ConstructorType */;
|
|
60526
|
-
const type = createObjectType(16 /* Anonymous */);
|
|
60534
|
+
const type = createObjectType(16 /* Anonymous */ | 134217728 /* SingleSignatureType */, createSymbol(16 /* Function */, "__function" /* Function */));
|
|
60535
|
+
if (signature.declaration && !nodeIsSynthesized(signature.declaration)) {
|
|
60536
|
+
type.symbol.declarations = [signature.declaration];
|
|
60537
|
+
type.symbol.valueDeclaration = signature.declaration;
|
|
60538
|
+
}
|
|
60539
|
+
outerTypeParameters || (outerTypeParameters = signature.declaration && getOuterTypeParameters(
|
|
60540
|
+
signature.declaration,
|
|
60541
|
+
/*includeThisTypes*/
|
|
60542
|
+
true
|
|
60543
|
+
));
|
|
60544
|
+
type.outerTypeParameters = outerTypeParameters;
|
|
60527
60545
|
type.members = emptySymbols;
|
|
60528
60546
|
type.properties = emptyArray;
|
|
60529
60547
|
type.callSignatures = !isConstructor ? [signature] : emptyArray;
|
|
@@ -63001,7 +63019,13 @@ function createTypeChecker(host) {
|
|
|
63001
63019
|
function substituteIndexedMappedType(objectType, index) {
|
|
63002
63020
|
const mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]);
|
|
63003
63021
|
const templateMapper = combineTypeMappers(objectType.mapper, mapper);
|
|
63004
|
-
|
|
63022
|
+
const instantiatedTemplateType = instantiateType(getTemplateTypeFromMappedType(objectType.target || objectType), templateMapper);
|
|
63023
|
+
return addOptionality(
|
|
63024
|
+
instantiatedTemplateType,
|
|
63025
|
+
/*isProperty*/
|
|
63026
|
+
true,
|
|
63027
|
+
getCombinedMappedTypeOptionality(objectType) > 0
|
|
63028
|
+
);
|
|
63005
63029
|
}
|
|
63006
63030
|
function getIndexedAccessType(objectType, indexType, accessFlags = 0 /* None */, accessNode, aliasSymbol, aliasTypeArguments) {
|
|
63007
63031
|
return getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) || (accessNode ? errorType : unknownType);
|
|
@@ -63913,7 +63937,7 @@ function createTypeChecker(host) {
|
|
|
63913
63937
|
const declaration = type.objectFlags & 4 /* Reference */ ? type.node : type.objectFlags & 8388608 /* InstantiationExpressionType */ ? type.node : type.symbol.declarations[0];
|
|
63914
63938
|
const links = getNodeLinks(declaration);
|
|
63915
63939
|
const target = type.objectFlags & 4 /* Reference */ ? links.resolvedType : type.objectFlags & 64 /* Instantiated */ ? type.target : type;
|
|
63916
|
-
let typeParameters = links.outerTypeParameters;
|
|
63940
|
+
let typeParameters = type.objectFlags & 134217728 /* SingleSignatureType */ ? type.outerTypeParameters : links.outerTypeParameters;
|
|
63917
63941
|
if (!typeParameters) {
|
|
63918
63942
|
let outerTypeParameters = getOuterTypeParameters(
|
|
63919
63943
|
declaration,
|
|
@@ -64094,6 +64118,9 @@ function createTypeChecker(host) {
|
|
|
64094
64118
|
if (type.objectFlags & 8388608 /* InstantiationExpressionType */) {
|
|
64095
64119
|
result.node = type.node;
|
|
64096
64120
|
}
|
|
64121
|
+
if (type.objectFlags & 134217728 /* SingleSignatureType */) {
|
|
64122
|
+
result.outerTypeParameters = type.outerTypeParameters;
|
|
64123
|
+
}
|
|
64097
64124
|
result.target = type;
|
|
64098
64125
|
result.mapper = mapper;
|
|
64099
64126
|
result.aliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
@@ -68714,7 +68741,7 @@ function createTypeChecker(host) {
|
|
|
68714
68741
|
if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
|
|
68715
68742
|
return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
|
|
68716
68743
|
}
|
|
68717
|
-
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
|
|
68744
|
+
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 134217728 /* SingleSignatureType */ && !!length(type.outerTypeParameters) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
|
|
68718
68745
|
if (type.flags & 3899393 /* ObjectFlagsType */) {
|
|
68719
68746
|
type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
|
|
68720
68747
|
}
|
|
@@ -68996,6 +69023,9 @@ function createTypeChecker(host) {
|
|
|
68996
69023
|
pos = p;
|
|
68997
69024
|
}
|
|
68998
69025
|
}
|
|
69026
|
+
function isTupleOfSelf(typeParameter, type) {
|
|
69027
|
+
return isTupleType(type) && getTupleElementType(type, 0) === getIndexedAccessType(typeParameter, getNumberLiteralType(0)) && !getTypeOfPropertyOfType(type, "1");
|
|
69028
|
+
}
|
|
68999
69029
|
function inferTypes(inferences, originalSource, originalTarget, priority = 0 /* None */, contravariant = false) {
|
|
69000
69030
|
let bivariant = false;
|
|
69001
69031
|
let propagationType;
|
|
@@ -69081,6 +69111,9 @@ function createTypeChecker(host) {
|
|
|
69081
69111
|
inference.priority = priority;
|
|
69082
69112
|
}
|
|
69083
69113
|
if (priority === inference.priority) {
|
|
69114
|
+
if (isTupleOfSelf(inference.typeParameter, candidate)) {
|
|
69115
|
+
return;
|
|
69116
|
+
}
|
|
69084
69117
|
if (contravariant && !bivariant) {
|
|
69085
69118
|
if (!contains(inference.contraCandidates, candidate)) {
|
|
69086
69119
|
inference.contraCandidates = append(inference.contraCandidates, candidate);
|
|
@@ -76003,7 +76036,7 @@ function createTypeChecker(host) {
|
|
|
76003
76036
|
argument = skipParentheses(argument);
|
|
76004
76037
|
return isSatisfiesExpression(argument) ? skipParentheses(argument.expression) : argument;
|
|
76005
76038
|
}
|
|
76006
|
-
function getSignatureApplicabilityError(node, args, signature, relation, checkMode, reportErrors2, containingMessageChain) {
|
|
76039
|
+
function getSignatureApplicabilityError(node, args, signature, relation, checkMode, reportErrors2, containingMessageChain, inferenceContext) {
|
|
76007
76040
|
const errorOutputContainer = { errors: void 0, skipLogging: true };
|
|
76008
76041
|
if (isJsxOpeningLikeElement(node)) {
|
|
76009
76042
|
if (!checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors2, containingMessageChain, errorOutputContainer)) {
|
|
@@ -76037,7 +76070,8 @@ function createTypeChecker(host) {
|
|
|
76037
76070
|
void 0,
|
|
76038
76071
|
checkMode
|
|
76039
76072
|
);
|
|
76040
|
-
const
|
|
76073
|
+
const regularArgType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(argType) : argType;
|
|
76074
|
+
const checkArgType = inferenceContext ? instantiateType(regularArgType, inferenceContext.nonFixingMapper) : regularArgType;
|
|
76041
76075
|
const effectiveCheckArgumentNode = getEffectiveCheckNode(arg);
|
|
76042
76076
|
if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors2 ? effectiveCheckArgumentNode : void 0, effectiveCheckArgumentNode, headMessage, containingMessageChain, errorOutputContainer)) {
|
|
76043
76077
|
Debug.assert(!reportErrors2 || !!errorOutputContainer.errors, "parameter should have errors when reporting errors");
|
|
@@ -76446,7 +76480,9 @@ function createTypeChecker(host) {
|
|
|
76446
76480
|
0 /* Normal */,
|
|
76447
76481
|
/*reportErrors*/
|
|
76448
76482
|
true,
|
|
76449
|
-
() => chain
|
|
76483
|
+
() => chain,
|
|
76484
|
+
/*inferenceContext*/
|
|
76485
|
+
void 0
|
|
76450
76486
|
);
|
|
76451
76487
|
if (diags) {
|
|
76452
76488
|
for (const d of diags) {
|
|
@@ -76482,7 +76518,9 @@ function createTypeChecker(host) {
|
|
|
76482
76518
|
0 /* Normal */,
|
|
76483
76519
|
/*reportErrors*/
|
|
76484
76520
|
true,
|
|
76485
|
-
chain2
|
|
76521
|
+
chain2,
|
|
76522
|
+
/*inferenceContext*/
|
|
76523
|
+
void 0
|
|
76486
76524
|
);
|
|
76487
76525
|
if (diags2) {
|
|
76488
76526
|
if (diags2.length <= min2) {
|
|
@@ -76573,6 +76611,8 @@ function createTypeChecker(host) {
|
|
|
76573
76611
|
/*reportErrors*/
|
|
76574
76612
|
false,
|
|
76575
76613
|
/*containingMessageChain*/
|
|
76614
|
+
void 0,
|
|
76615
|
+
/*inferenceContext*/
|
|
76576
76616
|
void 0
|
|
76577
76617
|
)) {
|
|
76578
76618
|
candidatesForArgumentError = [candidate];
|
|
@@ -76581,13 +76621,16 @@ function createTypeChecker(host) {
|
|
|
76581
76621
|
return candidate;
|
|
76582
76622
|
}
|
|
76583
76623
|
for (let candidateIndex = 0; candidateIndex < candidates2.length; candidateIndex++) {
|
|
76584
|
-
|
|
76624
|
+
let candidate = candidates2[candidateIndex];
|
|
76585
76625
|
if (!hasCorrectTypeArgumentArity(candidate, typeArguments) || !hasCorrectArity(node, args, candidate, signatureHelpTrailingComma2)) {
|
|
76586
76626
|
continue;
|
|
76587
76627
|
}
|
|
76588
76628
|
let checkCandidate;
|
|
76589
76629
|
let inferenceContext;
|
|
76590
76630
|
if (candidate.typeParameters) {
|
|
76631
|
+
if (candidate.declaration && findAncestor(node, (a) => a === candidate.declaration)) {
|
|
76632
|
+
candidate = getImplementationSignature(candidate);
|
|
76633
|
+
}
|
|
76591
76634
|
let typeArgumentTypes;
|
|
76592
76635
|
if (some(typeArguments)) {
|
|
76593
76636
|
typeArgumentTypes = checkTypeArguments(
|
|
@@ -76607,7 +76650,7 @@ function createTypeChecker(host) {
|
|
|
76607
76650
|
/*flags*/
|
|
76608
76651
|
isInJSFile(node) ? 2 /* AnyDefault */ : 0 /* None */
|
|
76609
76652
|
);
|
|
76610
|
-
typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext);
|
|
76653
|
+
typeArgumentTypes = instantiateTypes(inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext), inferenceContext.nonFixingMapper);
|
|
76611
76654
|
argCheckMode |= inferenceContext.flags & 4 /* SkippedGenericFunction */ ? 8 /* SkipGenericFunctions */ : 0 /* Normal */;
|
|
76612
76655
|
}
|
|
76613
76656
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
|
|
@@ -76627,7 +76670,8 @@ function createTypeChecker(host) {
|
|
|
76627
76670
|
/*reportErrors*/
|
|
76628
76671
|
false,
|
|
76629
76672
|
/*containingMessageChain*/
|
|
76630
|
-
void 0
|
|
76673
|
+
void 0,
|
|
76674
|
+
inferenceContext
|
|
76631
76675
|
)) {
|
|
76632
76676
|
(candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate);
|
|
76633
76677
|
continue;
|
|
@@ -76635,7 +76679,7 @@ function createTypeChecker(host) {
|
|
|
76635
76679
|
if (argCheckMode) {
|
|
76636
76680
|
argCheckMode = 0 /* Normal */;
|
|
76637
76681
|
if (inferenceContext) {
|
|
76638
|
-
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
76682
|
+
const typeArgumentTypes = instantiateTypes(inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext), inferenceContext.mapper);
|
|
76639
76683
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
76640
76684
|
if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma2)) {
|
|
76641
76685
|
candidateForArgumentArityError = checkCandidate;
|
|
@@ -76651,7 +76695,8 @@ function createTypeChecker(host) {
|
|
|
76651
76695
|
/*reportErrors*/
|
|
76652
76696
|
false,
|
|
76653
76697
|
/*containingMessageChain*/
|
|
76654
|
-
void 0
|
|
76698
|
+
void 0,
|
|
76699
|
+
inferenceContext
|
|
76655
76700
|
)) {
|
|
76656
76701
|
(candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate);
|
|
76657
76702
|
continue;
|
|
@@ -80348,7 +80393,7 @@ function createTypeChecker(host) {
|
|
|
80348
80393
|
}
|
|
80349
80394
|
}
|
|
80350
80395
|
}
|
|
80351
|
-
return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context));
|
|
80396
|
+
return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context), flatMap(inferenceContexts, (c) => c && map(c.inferences, (i) => i.typeParameter)).slice());
|
|
80352
80397
|
}
|
|
80353
80398
|
}
|
|
80354
80399
|
}
|
|
@@ -136020,7 +136065,7 @@ function createDocumentRegistryInternal(useCaseSensitiveFileNames2, currentDirec
|
|
|
136020
136065
|
let entry = bucketEntry && getDocumentRegistryEntry(bucketEntry, scriptKind);
|
|
136021
136066
|
if (!entry && externalCache) {
|
|
136022
136067
|
const sourceFile = externalCache.getDocument(keyWithMode, path);
|
|
136023
|
-
if (sourceFile) {
|
|
136068
|
+
if (sourceFile && sourceFile.scriptKind === scriptKind && sourceFile.text === getSnapshotText(scriptSnapshot)) {
|
|
136024
136069
|
Debug.assert(acquiring);
|
|
136025
136070
|
entry = {
|
|
136026
136071
|
sourceFile,
|
|
@@ -158476,9 +158521,6 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
|
|
|
158476
158521
|
const memberCompletionEntry = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext);
|
|
158477
158522
|
if (memberCompletionEntry) {
|
|
158478
158523
|
({ insertText, filterText, isSnippet, importAdder } = memberCompletionEntry);
|
|
158479
|
-
if (memberCompletionEntry.eraseRange) {
|
|
158480
|
-
replacementSpan = createTextSpanFromBounds(memberCompletionEntry.eraseRange.pos, memberCompletionEntry.eraseRange.end);
|
|
158481
|
-
}
|
|
158482
158524
|
if (importAdder == null ? void 0 : importAdder.hasFixes()) {
|
|
158483
158525
|
hasAction = true;
|
|
158484
158526
|
source = "ClassMemberSnippet/" /* ClassMemberSnippet */;
|
|
@@ -158560,7 +158602,7 @@ function getEntryForMemberCompletion(host, program, options, preferences, name,
|
|
|
158560
158602
|
}
|
|
158561
158603
|
let isSnippet;
|
|
158562
158604
|
let insertText = name;
|
|
158563
|
-
|
|
158605
|
+
const filterText = name;
|
|
158564
158606
|
const checker = program.getTypeChecker();
|
|
158565
158607
|
const sourceFile = location.getSourceFile();
|
|
158566
158608
|
const printer = createSnippetPrinter({
|
|
@@ -158589,10 +158631,7 @@ function getEntryForMemberCompletion(host, program, options, preferences, name,
|
|
|
158589
158631
|
);
|
|
158590
158632
|
}
|
|
158591
158633
|
let modifiers = 0 /* None */;
|
|
158592
|
-
const { modifiers: presentModifiers, range: eraseRange, decorators: presentDecorators
|
|
158593
|
-
if (modifiersFilterText) {
|
|
158594
|
-
filterText = modifiersFilterText + filterText;
|
|
158595
|
-
}
|
|
158634
|
+
const { modifiers: presentModifiers, range: eraseRange, decorators: presentDecorators } = getPresentModifiers(contextToken, sourceFile, position);
|
|
158596
158635
|
const isAbstract = presentModifiers & 64 /* Abstract */ && classLikeDeclaration.modifierFlagsCache & 64 /* Abstract */;
|
|
158597
158636
|
let completionNodes = [];
|
|
158598
158637
|
ts_codefix_exports.addNewNodeForMemberSymbol(
|
|
@@ -158677,31 +158716,21 @@ function getPresentModifiers(contextToken, sourceFile, position) {
|
|
|
158677
158716
|
}
|
|
158678
158717
|
let modifiers = 0 /* None */;
|
|
158679
158718
|
let decorators;
|
|
158680
|
-
let
|
|
158681
|
-
const contextMod = isModifierLike2(contextToken);
|
|
158719
|
+
let contextMod;
|
|
158682
158720
|
const range = { pos: position, end: position };
|
|
158683
158721
|
if (isPropertyDeclaration(contextToken.parent) && contextToken.parent.modifiers) {
|
|
158684
158722
|
modifiers |= modifiersToFlags(contextToken.parent.modifiers) & 98303 /* Modifier */;
|
|
158685
158723
|
decorators = contextToken.parent.modifiers.filter(isDecorator) || [];
|
|
158686
|
-
|
|
158687
|
-
if (firstModifier) {
|
|
158688
|
-
range.pos = Math.min(range.pos, firstModifier.getStart(sourceFile));
|
|
158689
|
-
if (contextToken.parent.name !== contextToken) {
|
|
158690
|
-
filterTextEnd = contextToken.parent.name.getStart(sourceFile);
|
|
158691
|
-
}
|
|
158692
|
-
}
|
|
158724
|
+
range.pos = Math.min(range.pos, contextToken.parent.modifiers.pos);
|
|
158693
158725
|
}
|
|
158694
|
-
if (contextMod) {
|
|
158726
|
+
if (contextMod = isModifierLike2(contextToken)) {
|
|
158695
158727
|
const contextModifierFlag = modifierToFlag(contextMod);
|
|
158696
158728
|
if (!(modifiers & contextModifierFlag)) {
|
|
158697
158729
|
modifiers |= contextModifierFlag;
|
|
158698
|
-
range.pos = Math.min(range.pos, contextToken.
|
|
158730
|
+
range.pos = Math.min(range.pos, contextToken.pos);
|
|
158699
158731
|
}
|
|
158700
158732
|
}
|
|
158701
|
-
|
|
158702
|
-
return { modifiers, decorators };
|
|
158703
|
-
}
|
|
158704
|
-
return { modifiers, decorators, range, filterText: sourceFile.text.slice(range.pos, filterTextEnd ?? position) };
|
|
158733
|
+
return { modifiers, decorators, range: range.pos !== position ? range : void 0 };
|
|
158705
158734
|
}
|
|
158706
158735
|
function isModifierLike2(node) {
|
|
158707
158736
|
if (isModifier(node)) {
|
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.5";
|
|
57
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
57
|
+
var version = `${versionMajorMinor}.0-insiders.20240305`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -3135,6 +3135,7 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
|
3135
3135
|
ObjectFlags3[ObjectFlags3["ContainsSpread"] = 2097152] = "ContainsSpread";
|
|
3136
3136
|
ObjectFlags3[ObjectFlags3["ObjectRestType"] = 4194304] = "ObjectRestType";
|
|
3137
3137
|
ObjectFlags3[ObjectFlags3["InstantiationExpressionType"] = 8388608] = "InstantiationExpressionType";
|
|
3138
|
+
ObjectFlags3[ObjectFlags3["SingleSignatureType"] = 134217728] = "SingleSignatureType";
|
|
3138
3139
|
ObjectFlags3[ObjectFlags3["IsClassInstanceClone"] = 16777216] = "IsClassInstanceClone";
|
|
3139
3140
|
ObjectFlags3[ObjectFlags3["IdenticalBaseTypeCalculated"] = 33554432] = "IdenticalBaseTypeCalculated";
|
|
3140
3141
|
ObjectFlags3[ObjectFlags3["IdenticalBaseTypeExists"] = 67108864] = "IdenticalBaseTypeExists";
|
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.5.0-pr-
|
|
5
|
+
"version": "5.5.0-pr-57403-34",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
"node": "20.1.0",
|
|
115
115
|
"npm": "8.19.4"
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "d4264eb2f32f94cc11ff0133f13bc9113d7dd8a7"
|
|
118
118
|
}
|