typescript 5.4.0-dev.20231130 → 5.4.0-dev.20231202
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/lib.es2020.string.d.ts +1 -1
- package/lib/tsc.js +143 -30
- package/lib/tsserver.js +144 -31
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +144 -31
- package/lib/typingsInstaller.js +5 -1
- package/package.json +2 -2
|
@@ -24,7 +24,7 @@ interface String {
|
|
|
24
24
|
* containing the results of that search.
|
|
25
25
|
* @param regexp A variable name or string literal containing the regular expression pattern and flags.
|
|
26
26
|
*/
|
|
27
|
-
matchAll(regexp: RegExp): IterableIterator<
|
|
27
|
+
matchAll(regexp: RegExp): IterableIterator<RegExpExecArray>;
|
|
28
28
|
|
|
29
29
|
/** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */
|
|
30
30
|
toLocaleLowerCase(locales?: Intl.LocalesArgument): string;
|
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.4";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20231202`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -3671,6 +3671,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
3671
3671
|
TypeFlags2[TypeFlags2["IncludesWildcard"] = 8388608 /* IndexedAccess */] = "IncludesWildcard";
|
|
3672
3672
|
TypeFlags2[TypeFlags2["IncludesEmptyObject"] = 16777216 /* Conditional */] = "IncludesEmptyObject";
|
|
3673
3673
|
TypeFlags2[TypeFlags2["IncludesInstantiable"] = 33554432 /* Substitution */] = "IncludesInstantiable";
|
|
3674
|
+
TypeFlags2[TypeFlags2["IncludesConstrainedTypeVariable"] = 268435456 /* StringMapping */] = "IncludesConstrainedTypeVariable";
|
|
3674
3675
|
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36323331] = "NotPrimitiveUnion";
|
|
3675
3676
|
return TypeFlags2;
|
|
3676
3677
|
})(TypeFlags || {});
|
|
@@ -3717,6 +3718,7 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
|
3717
3718
|
ObjectFlags3[ObjectFlags3["IsUnknownLikeUnion"] = 67108864] = "IsUnknownLikeUnion";
|
|
3718
3719
|
ObjectFlags3[ObjectFlags3["IsNeverIntersectionComputed"] = 16777216] = "IsNeverIntersectionComputed";
|
|
3719
3720
|
ObjectFlags3[ObjectFlags3["IsNeverIntersection"] = 33554432] = "IsNeverIntersection";
|
|
3721
|
+
ObjectFlags3[ObjectFlags3["IsConstrainedTypeVariable"] = 67108864] = "IsConstrainedTypeVariable";
|
|
3720
3722
|
return ObjectFlags3;
|
|
3721
3723
|
})(ObjectFlags || {});
|
|
3722
3724
|
var SignatureFlags = /* @__PURE__ */ ((SignatureFlags4) => {
|
|
@@ -33126,6 +33128,8 @@ var Parser;
|
|
|
33126
33128
|
break;
|
|
33127
33129
|
case "template":
|
|
33128
33130
|
return parseTemplateTag(start2, tagName, indent2, indentText);
|
|
33131
|
+
case "this":
|
|
33132
|
+
return parseThisTag(start2, tagName, indent2, indentText);
|
|
33129
33133
|
default:
|
|
33130
33134
|
return false;
|
|
33131
33135
|
}
|
|
@@ -44705,7 +44709,7 @@ function createTypeChecker(host) {
|
|
|
44705
44709
|
return isBlockScopedNameDeclaredBeforeUse(getAncestor(declaration, 260 /* VariableDeclaration */), usage);
|
|
44706
44710
|
} else if (declaration.kind === 260 /* VariableDeclaration */) {
|
|
44707
44711
|
return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage);
|
|
44708
|
-
} else if (
|
|
44712
|
+
} else if (isClassLike(declaration)) {
|
|
44709
44713
|
return !findAncestor(usage, (n) => isComputedPropertyName(n) && n.parent.parent === declaration);
|
|
44710
44714
|
} else if (isPropertyDeclaration(declaration)) {
|
|
44711
44715
|
return !isPropertyImmediatelyReferencedWithinDeclaration(
|
|
@@ -46974,6 +46978,10 @@ function createTypeChecker(host) {
|
|
|
46974
46978
|
function getParentOfSymbol(symbol) {
|
|
46975
46979
|
return getMergedSymbol(symbol.parent && getLateBoundSymbol(symbol.parent));
|
|
46976
46980
|
}
|
|
46981
|
+
function getFunctionExpressionParentSymbolOrSymbol(symbol) {
|
|
46982
|
+
var _a, _b;
|
|
46983
|
+
return ((_a = symbol.valueDeclaration) == null ? void 0 : _a.kind) === 219 /* ArrowFunction */ || ((_b = symbol.valueDeclaration) == null ? void 0 : _b.kind) === 218 /* FunctionExpression */ ? getSymbolOfNode(symbol.valueDeclaration.parent) || symbol : symbol;
|
|
46984
|
+
}
|
|
46977
46985
|
function getAlternativeContainingModules(symbol, enclosingDeclaration) {
|
|
46978
46986
|
const containingFile = getSourceFileOfNode(enclosingDeclaration);
|
|
46979
46987
|
const id = getNodeId(containingFile);
|
|
@@ -52197,11 +52205,14 @@ function createTypeChecker(host) {
|
|
|
52197
52205
|
}
|
|
52198
52206
|
}
|
|
52199
52207
|
if ((_a = symbol.parent) == null ? void 0 : _a.valueDeclaration) {
|
|
52200
|
-
const
|
|
52201
|
-
if (
|
|
52202
|
-
const
|
|
52203
|
-
if (
|
|
52204
|
-
|
|
52208
|
+
const possiblyAnnotatedSymbol = getFunctionExpressionParentSymbolOrSymbol(symbol.parent);
|
|
52209
|
+
if (possiblyAnnotatedSymbol.valueDeclaration) {
|
|
52210
|
+
const typeNode2 = getEffectiveTypeAnnotationNode(possiblyAnnotatedSymbol.valueDeclaration);
|
|
52211
|
+
if (typeNode2) {
|
|
52212
|
+
const annotationSymbol = getPropertyOfType(getTypeFromTypeNode(typeNode2), symbol.escapedName);
|
|
52213
|
+
if (annotationSymbol) {
|
|
52214
|
+
return getNonMissingTypeOfSymbol(annotationSymbol);
|
|
52215
|
+
}
|
|
52205
52216
|
}
|
|
52206
52217
|
}
|
|
52207
52218
|
}
|
|
@@ -53501,7 +53512,6 @@ function createTypeChecker(host) {
|
|
|
53501
53512
|
return links.resolvedSymbol;
|
|
53502
53513
|
}
|
|
53503
53514
|
function getResolvedMembersOrExportsOfSymbol(symbol, resolutionKind) {
|
|
53504
|
-
var _a, _b, _c;
|
|
53505
53515
|
const links = getSymbolLinks(symbol);
|
|
53506
53516
|
if (!links[resolutionKind]) {
|
|
53507
53517
|
const isStatic2 = resolutionKind === "resolvedExports" /* resolvedExports */;
|
|
@@ -53520,7 +53530,7 @@ function createTypeChecker(host) {
|
|
|
53520
53530
|
}
|
|
53521
53531
|
}
|
|
53522
53532
|
}
|
|
53523
|
-
const assignments = (
|
|
53533
|
+
const assignments = getFunctionExpressionParentSymbolOrSymbol(symbol).assignmentDeclarationMembers;
|
|
53524
53534
|
if (assignments) {
|
|
53525
53535
|
const decls = arrayFrom(assignments.values());
|
|
53526
53536
|
for (const member of decls) {
|
|
@@ -53817,6 +53827,15 @@ function createTypeChecker(host) {
|
|
|
53817
53827
|
let result;
|
|
53818
53828
|
for (let i = 0; i < signatureLists.length; i++) {
|
|
53819
53829
|
const match = i === listIndex ? signature : findMatchingSignature(
|
|
53830
|
+
signatureLists[i],
|
|
53831
|
+
signature,
|
|
53832
|
+
/*partialMatch*/
|
|
53833
|
+
false,
|
|
53834
|
+
/*ignoreThisTypes*/
|
|
53835
|
+
false,
|
|
53836
|
+
/*ignoreReturnTypes*/
|
|
53837
|
+
true
|
|
53838
|
+
) || findMatchingSignature(
|
|
53820
53839
|
signatureLists[i],
|
|
53821
53840
|
signature,
|
|
53822
53841
|
/*partialMatch*/
|
|
@@ -54190,6 +54209,18 @@ function createTypeChecker(host) {
|
|
|
54190
54209
|
function replaceIndexedAccess(instantiable, type, replacement) {
|
|
54191
54210
|
return instantiateType(instantiable, createTypeMapper([type.indexType, type.objectType], [getNumberLiteralType(0), createTupleType([replacement])]));
|
|
54192
54211
|
}
|
|
54212
|
+
function getLimitedConstraint(type) {
|
|
54213
|
+
const constraint = getConstraintTypeFromMappedType(type.mappedType);
|
|
54214
|
+
if (!(constraint.flags & 1048576 /* Union */ || constraint.flags & 2097152 /* Intersection */)) {
|
|
54215
|
+
return;
|
|
54216
|
+
}
|
|
54217
|
+
const origin = constraint.flags & 1048576 /* Union */ ? constraint.origin : constraint;
|
|
54218
|
+
if (!origin || !(origin.flags & 2097152 /* Intersection */)) {
|
|
54219
|
+
return;
|
|
54220
|
+
}
|
|
54221
|
+
const limitedConstraint = getIntersectionType(origin.types.filter((t) => t !== type.constraintType));
|
|
54222
|
+
return limitedConstraint !== neverType ? limitedConstraint : void 0;
|
|
54223
|
+
}
|
|
54193
54224
|
function resolveReverseMappedTypeMembers(type) {
|
|
54194
54225
|
const indexInfo = getIndexInfoOfType(type.source, stringType);
|
|
54195
54226
|
const modifiers = getMappedTypeModifiers(type.mappedType);
|
|
@@ -54197,7 +54228,14 @@ function createTypeChecker(host) {
|
|
|
54197
54228
|
const optionalMask = modifiers & 4 /* IncludeOptional */ ? 0 : 16777216 /* Optional */;
|
|
54198
54229
|
const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType), readonlyMask && indexInfo.isReadonly)] : emptyArray;
|
|
54199
54230
|
const members = createSymbolTable();
|
|
54231
|
+
const limitedConstraint = getLimitedConstraint(type);
|
|
54200
54232
|
for (const prop of getPropertiesOfType(type.source)) {
|
|
54233
|
+
if (limitedConstraint) {
|
|
54234
|
+
const propertyNameType = getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */);
|
|
54235
|
+
if (!isTypeAssignableTo(propertyNameType, limitedConstraint)) {
|
|
54236
|
+
continue;
|
|
54237
|
+
}
|
|
54238
|
+
}
|
|
54201
54239
|
const checkFlags = 8192 /* ReverseMapped */ | (readonlyMask && isReadonlySymbol(prop) ? 8 /* Readonly */ : 0);
|
|
54202
54240
|
const inferredProp = createSymbol(4 /* Property */ | prop.flags & optionalMask, prop.escapedName, checkFlags);
|
|
54203
54241
|
inferredProp.declarations = prop.declarations;
|
|
@@ -54278,7 +54316,7 @@ function createTypeChecker(host) {
|
|
|
54278
54316
|
const constraintType = getConstraintTypeFromMappedType(type);
|
|
54279
54317
|
const mappedType = type.target || type;
|
|
54280
54318
|
const nameType = getNameTypeFromMappedType(mappedType);
|
|
54281
|
-
const shouldLinkPropDeclarations =
|
|
54319
|
+
const shouldLinkPropDeclarations = getMappedTypeNameTypeKind(mappedType) !== 2 /* Remapping */;
|
|
54282
54320
|
const templateType = getTemplateTypeFromMappedType(mappedType);
|
|
54283
54321
|
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
|
|
54284
54322
|
const templateModifiers = getMappedTypeModifiers(type);
|
|
@@ -54420,9 +54458,12 @@ function createTypeChecker(host) {
|
|
|
54420
54458
|
}
|
|
54421
54459
|
return false;
|
|
54422
54460
|
}
|
|
54423
|
-
function
|
|
54461
|
+
function getMappedTypeNameTypeKind(type) {
|
|
54424
54462
|
const nameType = getNameTypeFromMappedType(type);
|
|
54425
|
-
|
|
54463
|
+
if (!nameType) {
|
|
54464
|
+
return 0 /* None */;
|
|
54465
|
+
}
|
|
54466
|
+
return isTypeAssignableTo(nameType, getTypeParameterFromMappedType(type)) ? 1 /* Filtering */ : 2 /* Remapping */;
|
|
54426
54467
|
}
|
|
54427
54468
|
function resolveStructuredTypeMembers(type) {
|
|
54428
54469
|
if (!type.members) {
|
|
@@ -55286,6 +55327,7 @@ function createTypeChecker(host) {
|
|
|
55286
55327
|
let flags = 0 /* None */;
|
|
55287
55328
|
let minArgumentCount = 0;
|
|
55288
55329
|
let thisParameter;
|
|
55330
|
+
let thisTag = isInJSFile(declaration) ? getJSDocThisTag(declaration) : void 0;
|
|
55289
55331
|
let hasThisParameter = false;
|
|
55290
55332
|
const iife = getImmediatelyInvokedFunctionExpression(declaration);
|
|
55291
55333
|
const isJSConstructSignature = isJSDocConstructSignature(declaration);
|
|
@@ -55295,6 +55337,10 @@ function createTypeChecker(host) {
|
|
|
55295
55337
|
}
|
|
55296
55338
|
for (let i = isJSConstructSignature ? 1 : 0; i < declaration.parameters.length; i++) {
|
|
55297
55339
|
const param = declaration.parameters[i];
|
|
55340
|
+
if (isInJSFile(param) && isJSDocThisTag(param)) {
|
|
55341
|
+
thisTag = param;
|
|
55342
|
+
continue;
|
|
55343
|
+
}
|
|
55298
55344
|
let paramSymbol = param.symbol;
|
|
55299
55345
|
const type = isJSDocParameterTag(param) ? param.typeExpression && param.typeExpression.type : param.type;
|
|
55300
55346
|
if (paramSymbol && !!(paramSymbol.flags & 4 /* Property */) && !isBindingPattern(param.name)) {
|
|
@@ -55332,11 +55378,8 @@ function createTypeChecker(host) {
|
|
|
55332
55378
|
thisParameter = getAnnotatedAccessorThisParameter(other);
|
|
55333
55379
|
}
|
|
55334
55380
|
}
|
|
55335
|
-
if (
|
|
55336
|
-
|
|
55337
|
-
if (thisTag && thisTag.typeExpression) {
|
|
55338
|
-
thisParameter = createSymbolWithType(createSymbol(1 /* FunctionScopedVariable */, "this" /* This */), getTypeFromTypeNode(thisTag.typeExpression));
|
|
55339
|
-
}
|
|
55381
|
+
if (thisTag && thisTag.typeExpression) {
|
|
55382
|
+
thisParameter = createSymbolWithType(createSymbol(1 /* FunctionScopedVariable */, "this" /* This */), getTypeFromTypeNode(thisTag.typeExpression));
|
|
55340
55383
|
}
|
|
55341
55384
|
const hostDeclaration = isJSDocSignature(declaration) ? getEffectiveJSDocHost(declaration) : declaration;
|
|
55342
55385
|
const classType = hostDeclaration && isConstructorDeclaration(hostDeclaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(hostDeclaration.parent.symbol)) : void 0;
|
|
@@ -56958,6 +57001,8 @@ function createTypeChecker(host) {
|
|
|
56958
57001
|
includes |= flags & 473694207 /* IncludesMask */;
|
|
56959
57002
|
if (flags & 465829888 /* Instantiable */)
|
|
56960
57003
|
includes |= 33554432 /* IncludesInstantiable */;
|
|
57004
|
+
if (flags & 2097152 /* Intersection */ && getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */)
|
|
57005
|
+
includes |= 268435456 /* IncludesConstrainedTypeVariable */;
|
|
56961
57006
|
if (type === wildcardType)
|
|
56962
57007
|
includes |= 8388608 /* IncludesWildcard */;
|
|
56963
57008
|
if (!strictNullChecks && flags & 98304 /* Nullable */) {
|
|
@@ -57062,6 +57107,41 @@ function createTypeChecker(host) {
|
|
|
57062
57107
|
}
|
|
57063
57108
|
}
|
|
57064
57109
|
}
|
|
57110
|
+
function removeConstrainedTypeVariables(types) {
|
|
57111
|
+
const typeVariables = [];
|
|
57112
|
+
for (const type of types) {
|
|
57113
|
+
if (getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */) {
|
|
57114
|
+
const index = type.types[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
|
|
57115
|
+
pushIfUnique(typeVariables, type.types[index]);
|
|
57116
|
+
}
|
|
57117
|
+
}
|
|
57118
|
+
for (const typeVariable of typeVariables) {
|
|
57119
|
+
const primitives = [];
|
|
57120
|
+
for (const type of types) {
|
|
57121
|
+
if (getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */) {
|
|
57122
|
+
const index = type.types[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
|
|
57123
|
+
if (type.types[index] === typeVariable) {
|
|
57124
|
+
insertType(primitives, type.types[1 - index]);
|
|
57125
|
+
}
|
|
57126
|
+
}
|
|
57127
|
+
}
|
|
57128
|
+
const constraint = getBaseConstraintOfType(typeVariable);
|
|
57129
|
+
if (everyType(constraint, (t) => containsType(primitives, t))) {
|
|
57130
|
+
let i = types.length;
|
|
57131
|
+
while (i > 0) {
|
|
57132
|
+
i--;
|
|
57133
|
+
const type = types[i];
|
|
57134
|
+
if (getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */) {
|
|
57135
|
+
const index = type.types[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
|
|
57136
|
+
if (type.types[index] === typeVariable && containsType(primitives, type.types[1 - index])) {
|
|
57137
|
+
orderedRemoveItemAt(types, i);
|
|
57138
|
+
}
|
|
57139
|
+
}
|
|
57140
|
+
}
|
|
57141
|
+
insertType(types, typeVariable);
|
|
57142
|
+
}
|
|
57143
|
+
}
|
|
57144
|
+
}
|
|
57065
57145
|
function isNamedUnionType(type) {
|
|
57066
57146
|
return !!(type.flags & 1048576 /* Union */ && (type.aliasSymbol || type.origin));
|
|
57067
57147
|
}
|
|
@@ -57127,6 +57207,9 @@ function createTypeChecker(host) {
|
|
|
57127
57207
|
if (includes & 128 /* StringLiteral */ && includes & 134217728 /* TemplateLiteral */) {
|
|
57128
57208
|
removeStringLiteralsMatchedByTemplateLiterals(typeSet);
|
|
57129
57209
|
}
|
|
57210
|
+
if (includes & 268435456 /* IncludesConstrainedTypeVariable */) {
|
|
57211
|
+
removeConstrainedTypeVariables(typeSet);
|
|
57212
|
+
}
|
|
57130
57213
|
if (unionReduction === 2 /* Subtype */) {
|
|
57131
57214
|
typeSet = removeSubtypes(typeSet, !!(includes & 524288 /* Object */));
|
|
57132
57215
|
if (!typeSet) {
|
|
@@ -57339,9 +57422,9 @@ function createTypeChecker(host) {
|
|
|
57339
57422
|
types[index] = getUnionTypeFromSortedList(result, 32768 /* PrimitiveUnion */);
|
|
57340
57423
|
return true;
|
|
57341
57424
|
}
|
|
57342
|
-
function createIntersectionType(types, aliasSymbol, aliasTypeArguments) {
|
|
57425
|
+
function createIntersectionType(types, objectFlags, aliasSymbol, aliasTypeArguments) {
|
|
57343
57426
|
const result = createType(2097152 /* Intersection */);
|
|
57344
|
-
result.objectFlags = getPropagatingFlagsOfTypes(
|
|
57427
|
+
result.objectFlags = objectFlags | getPropagatingFlagsOfTypes(
|
|
57345
57428
|
types,
|
|
57346
57429
|
/*excludeKinds*/
|
|
57347
57430
|
98304 /* Nullable */
|
|
@@ -57355,6 +57438,7 @@ function createTypeChecker(host) {
|
|
|
57355
57438
|
const typeMembershipMap = /* @__PURE__ */ new Map();
|
|
57356
57439
|
const includes = addTypesToIntersection(typeMembershipMap, 0, types);
|
|
57357
57440
|
const typeSet = arrayFrom(typeMembershipMap.values());
|
|
57441
|
+
let objectFlags = 0 /* None */;
|
|
57358
57442
|
if (includes & 131072 /* Never */) {
|
|
57359
57443
|
return contains(typeSet, silentNeverType) ? silentNeverType : neverType;
|
|
57360
57444
|
}
|
|
@@ -57383,6 +57467,25 @@ function createTypeChecker(host) {
|
|
|
57383
57467
|
if (typeSet.length === 1) {
|
|
57384
57468
|
return typeSet[0];
|
|
57385
57469
|
}
|
|
57470
|
+
if (typeSet.length === 2) {
|
|
57471
|
+
const typeVarIndex = typeSet[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
|
|
57472
|
+
const typeVariable = typeSet[typeVarIndex];
|
|
57473
|
+
const primitiveType = typeSet[1 - typeVarIndex];
|
|
57474
|
+
if (typeVariable.flags & 8650752 /* TypeVariable */ && (primitiveType.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */) || includes & 16777216 /* IncludesEmptyObject */)) {
|
|
57475
|
+
const constraint = getBaseConstraintOfType(typeVariable);
|
|
57476
|
+
if (constraint && everyType(constraint, (t) => !!(t.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */)) || isEmptyAnonymousObjectType(t))) {
|
|
57477
|
+
if (isTypeStrictSubtypeOf(constraint, primitiveType)) {
|
|
57478
|
+
return typeVariable;
|
|
57479
|
+
}
|
|
57480
|
+
if (!(constraint.flags & 1048576 /* Union */ && someType(constraint, (c) => isTypeStrictSubtypeOf(c, primitiveType)))) {
|
|
57481
|
+
if (!isTypeStrictSubtypeOf(primitiveType, constraint)) {
|
|
57482
|
+
return neverType;
|
|
57483
|
+
}
|
|
57484
|
+
}
|
|
57485
|
+
objectFlags = 67108864 /* IsConstrainedTypeVariable */;
|
|
57486
|
+
}
|
|
57487
|
+
}
|
|
57488
|
+
}
|
|
57386
57489
|
const id = getTypeListId(typeSet) + getAliasId(aliasSymbol, aliasTypeArguments);
|
|
57387
57490
|
let result = intersectionTypes.get(id);
|
|
57388
57491
|
if (!result) {
|
|
@@ -57405,7 +57508,7 @@ function createTypeChecker(host) {
|
|
|
57405
57508
|
result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
|
|
57406
57509
|
}
|
|
57407
57510
|
} else {
|
|
57408
|
-
result = createIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
|
57511
|
+
result = createIntersectionType(typeSet, objectFlags, aliasSymbol, aliasTypeArguments);
|
|
57409
57512
|
}
|
|
57410
57513
|
intersectionTypes.set(id, result);
|
|
57411
57514
|
}
|
|
@@ -57562,7 +57665,7 @@ function createTypeChecker(host) {
|
|
|
57562
57665
|
);
|
|
57563
57666
|
}
|
|
57564
57667
|
function shouldDeferIndexType(type, indexFlags = 0 /* None */) {
|
|
57565
|
-
return !!(type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) || type.flags & 1048576 /* Union */ && !(indexFlags & 4 /* NoReducibleCheck */) && isGenericReducibleType(type) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 465829888 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType));
|
|
57668
|
+
return !!(type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && (!hasDistributiveNameType(type) || getMappedTypeNameTypeKind(type) === 2 /* Remapping */) || type.flags & 1048576 /* Union */ && !(indexFlags & 4 /* NoReducibleCheck */) && isGenericReducibleType(type) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 465829888 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType));
|
|
57566
57669
|
}
|
|
57567
57670
|
function getIndexType(type, indexFlags = defaultIndexFlags) {
|
|
57568
57671
|
type = getReducedType(type);
|
|
@@ -58046,7 +58149,7 @@ function createTypeChecker(host) {
|
|
|
58046
58149
|
}
|
|
58047
58150
|
}
|
|
58048
58151
|
if (isGenericMappedType(objectType)) {
|
|
58049
|
-
if (
|
|
58152
|
+
if (getMappedTypeNameTypeKind(objectType) !== 2 /* Remapping */) {
|
|
58050
58153
|
return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), (t) => getSimplifiedType(t, writing));
|
|
58051
58154
|
}
|
|
58052
58155
|
}
|
|
@@ -60075,8 +60178,8 @@ function createTypeChecker(host) {
|
|
|
60075
60178
|
const sourceType = i === restIndex ? getRestTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
|
|
60076
60179
|
const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
|
|
60077
60180
|
if (sourceType && targetType) {
|
|
60078
|
-
const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
60079
|
-
const targetSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
|
|
60181
|
+
const sourceSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(source, i) ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
60182
|
+
const targetSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(target, i) ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
|
|
60080
60183
|
const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && getTypeFacts(sourceType, 50331648 /* IsUndefinedOrNull */) === getTypeFacts(targetType, 50331648 /* IsUndefinedOrNull */);
|
|
60081
60184
|
let related = callbacks ? compareSignaturesRelated(targetSig, sourceSig, checkMode & 8 /* StrictArity */ | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) : !(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(
|
|
60082
60185
|
sourceType,
|
|
@@ -64098,7 +64201,8 @@ function createTypeChecker(host) {
|
|
|
64098
64201
|
source = getIntersectionType(sources);
|
|
64099
64202
|
target = getIntersectionType(targets);
|
|
64100
64203
|
}
|
|
64101
|
-
}
|
|
64204
|
+
}
|
|
64205
|
+
if (target.flags & (8388608 /* IndexedAccess */ | 33554432 /* Substitution */)) {
|
|
64102
64206
|
target = getActualTypeVariable(target);
|
|
64103
64207
|
}
|
|
64104
64208
|
if (target.flags & 8650752 /* TypeVariable */) {
|
|
@@ -64373,7 +64477,7 @@ function createTypeChecker(host) {
|
|
|
64373
64477
|
}
|
|
64374
64478
|
}
|
|
64375
64479
|
function inferToMappedType(source, target, constraintType) {
|
|
64376
|
-
if (constraintType.flags & 1048576 /* Union */) {
|
|
64480
|
+
if (constraintType.flags & 1048576 /* Union */ || constraintType.flags & 2097152 /* Intersection */) {
|
|
64377
64481
|
let result = false;
|
|
64378
64482
|
for (const type of constraintType.types) {
|
|
64379
64483
|
result = inferToMappedType(source, target, type) || result;
|
|
@@ -70625,6 +70729,10 @@ function createTypeChecker(host) {
|
|
|
70625
70729
|
const minTypeArgumentCount = getMinTypeArgumentCount(signature.typeParameters);
|
|
70626
70730
|
return !some(typeArguments) || typeArguments.length >= minTypeArgumentCount && typeArguments.length <= numTypeParameters;
|
|
70627
70731
|
}
|
|
70732
|
+
function isInstantiatedGenericParameter(signature, pos) {
|
|
70733
|
+
let type;
|
|
70734
|
+
return !!(signature.target && (type = tryGetTypeAtPosition(signature.target, pos)) && isGenericType(type));
|
|
70735
|
+
}
|
|
70628
70736
|
function getSingleCallSignature(type) {
|
|
70629
70737
|
return getSingleSignature(
|
|
70630
70738
|
type,
|
|
@@ -71767,7 +71875,7 @@ function createTypeChecker(host) {
|
|
|
71767
71875
|
}
|
|
71768
71876
|
return resolveErrorCall(node);
|
|
71769
71877
|
}
|
|
71770
|
-
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(
|
|
71878
|
+
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunctionOrConstructor)) {
|
|
71771
71879
|
skippedGenericFunction(node, checkMode);
|
|
71772
71880
|
return resolvingSignature;
|
|
71773
71881
|
}
|
|
@@ -71777,8 +71885,12 @@ function createTypeChecker(host) {
|
|
|
71777
71885
|
}
|
|
71778
71886
|
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
|
|
71779
71887
|
}
|
|
71780
|
-
function
|
|
71781
|
-
|
|
71888
|
+
function isGenericFunctionReturningFunctionOrConstructor(signature) {
|
|
71889
|
+
if (!signature.typeParameters) {
|
|
71890
|
+
return false;
|
|
71891
|
+
}
|
|
71892
|
+
const returnType = getReturnTypeOfSignature(signature);
|
|
71893
|
+
return isFunctionType(returnType) || isConstructorType(returnType);
|
|
71782
71894
|
}
|
|
71783
71895
|
function isUntypedFunctionCall(funcType, apparentFuncType, numCallSignatures, numConstructSignatures) {
|
|
71784
71896
|
return isTypeAny(funcType) || isTypeAny(apparentFuncType) && !!(funcType.flags & 262144 /* TypeParameter */) || !numCallSignatures && !numConstructSignatures && !(apparentFuncType.flags & 1048576 /* Union */) && !(getReducedType(apparentFuncType).flags & 131072 /* Never */) && isTypeAssignableTo(funcType, globalFunctionType);
|
|
@@ -76274,7 +76386,8 @@ function createTypeChecker(host) {
|
|
|
76274
76386
|
}
|
|
76275
76387
|
const objectType = type.objectType;
|
|
76276
76388
|
const indexType = type.indexType;
|
|
76277
|
-
|
|
76389
|
+
const objectIndexType = isGenericMappedType(objectType) && getMappedTypeNameTypeKind(objectType) === 2 /* Remapping */ ? getIndexTypeForMappedType(objectType, 0 /* None */) : getIndexType(objectType, 0 /* None */);
|
|
76390
|
+
if (isTypeAssignableTo(indexType, objectIndexType)) {
|
|
76278
76391
|
if (accessNode.kind === 212 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
|
|
76279
76392
|
error(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
|
76280
76393
|
}
|
package/lib/tsserver.js
CHANGED
|
@@ -2332,7 +2332,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2332
2332
|
|
|
2333
2333
|
// src/compiler/corePublic.ts
|
|
2334
2334
|
var versionMajorMinor = "5.4";
|
|
2335
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2335
|
+
var version = `${versionMajorMinor}.0-dev.20231202`;
|
|
2336
2336
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2337
2337
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2338
2338
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6686,6 +6686,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
6686
6686
|
TypeFlags2[TypeFlags2["IncludesWildcard"] = 8388608 /* IndexedAccess */] = "IncludesWildcard";
|
|
6687
6687
|
TypeFlags2[TypeFlags2["IncludesEmptyObject"] = 16777216 /* Conditional */] = "IncludesEmptyObject";
|
|
6688
6688
|
TypeFlags2[TypeFlags2["IncludesInstantiable"] = 33554432 /* Substitution */] = "IncludesInstantiable";
|
|
6689
|
+
TypeFlags2[TypeFlags2["IncludesConstrainedTypeVariable"] = 268435456 /* StringMapping */] = "IncludesConstrainedTypeVariable";
|
|
6689
6690
|
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36323331] = "NotPrimitiveUnion";
|
|
6690
6691
|
return TypeFlags2;
|
|
6691
6692
|
})(TypeFlags || {});
|
|
@@ -6732,6 +6733,7 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
|
6732
6733
|
ObjectFlags3[ObjectFlags3["IsUnknownLikeUnion"] = 67108864] = "IsUnknownLikeUnion";
|
|
6733
6734
|
ObjectFlags3[ObjectFlags3["IsNeverIntersectionComputed"] = 16777216] = "IsNeverIntersectionComputed";
|
|
6734
6735
|
ObjectFlags3[ObjectFlags3["IsNeverIntersection"] = 33554432] = "IsNeverIntersection";
|
|
6736
|
+
ObjectFlags3[ObjectFlags3["IsConstrainedTypeVariable"] = 67108864] = "IsConstrainedTypeVariable";
|
|
6735
6737
|
return ObjectFlags3;
|
|
6736
6738
|
})(ObjectFlags || {});
|
|
6737
6739
|
var VarianceFlags = /* @__PURE__ */ ((VarianceFlags2) => {
|
|
@@ -37553,6 +37555,8 @@ var Parser;
|
|
|
37553
37555
|
break;
|
|
37554
37556
|
case "template":
|
|
37555
37557
|
return parseTemplateTag(start3, tagName, indent3, indentText);
|
|
37558
|
+
case "this":
|
|
37559
|
+
return parseThisTag(start3, tagName, indent3, indentText);
|
|
37556
37560
|
default:
|
|
37557
37561
|
return false;
|
|
37558
37562
|
}
|
|
@@ -49432,7 +49436,7 @@ function createTypeChecker(host) {
|
|
|
49432
49436
|
return isBlockScopedNameDeclaredBeforeUse(getAncestor(declaration, 260 /* VariableDeclaration */), usage);
|
|
49433
49437
|
} else if (declaration.kind === 260 /* VariableDeclaration */) {
|
|
49434
49438
|
return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage);
|
|
49435
|
-
} else if (
|
|
49439
|
+
} else if (isClassLike(declaration)) {
|
|
49436
49440
|
return !findAncestor(usage, (n) => isComputedPropertyName(n) && n.parent.parent === declaration);
|
|
49437
49441
|
} else if (isPropertyDeclaration(declaration)) {
|
|
49438
49442
|
return !isPropertyImmediatelyReferencedWithinDeclaration(
|
|
@@ -51701,6 +51705,10 @@ function createTypeChecker(host) {
|
|
|
51701
51705
|
function getParentOfSymbol(symbol) {
|
|
51702
51706
|
return getMergedSymbol(symbol.parent && getLateBoundSymbol(symbol.parent));
|
|
51703
51707
|
}
|
|
51708
|
+
function getFunctionExpressionParentSymbolOrSymbol(symbol) {
|
|
51709
|
+
var _a, _b;
|
|
51710
|
+
return ((_a = symbol.valueDeclaration) == null ? void 0 : _a.kind) === 219 /* ArrowFunction */ || ((_b = symbol.valueDeclaration) == null ? void 0 : _b.kind) === 218 /* FunctionExpression */ ? getSymbolOfNode(symbol.valueDeclaration.parent) || symbol : symbol;
|
|
51711
|
+
}
|
|
51704
51712
|
function getAlternativeContainingModules(symbol, enclosingDeclaration) {
|
|
51705
51713
|
const containingFile = getSourceFileOfNode(enclosingDeclaration);
|
|
51706
51714
|
const id = getNodeId(containingFile);
|
|
@@ -56924,11 +56932,14 @@ function createTypeChecker(host) {
|
|
|
56924
56932
|
}
|
|
56925
56933
|
}
|
|
56926
56934
|
if ((_a = symbol.parent) == null ? void 0 : _a.valueDeclaration) {
|
|
56927
|
-
const
|
|
56928
|
-
if (
|
|
56929
|
-
const
|
|
56930
|
-
if (
|
|
56931
|
-
|
|
56935
|
+
const possiblyAnnotatedSymbol = getFunctionExpressionParentSymbolOrSymbol(symbol.parent);
|
|
56936
|
+
if (possiblyAnnotatedSymbol.valueDeclaration) {
|
|
56937
|
+
const typeNode2 = getEffectiveTypeAnnotationNode(possiblyAnnotatedSymbol.valueDeclaration);
|
|
56938
|
+
if (typeNode2) {
|
|
56939
|
+
const annotationSymbol = getPropertyOfType(getTypeFromTypeNode(typeNode2), symbol.escapedName);
|
|
56940
|
+
if (annotationSymbol) {
|
|
56941
|
+
return getNonMissingTypeOfSymbol(annotationSymbol);
|
|
56942
|
+
}
|
|
56932
56943
|
}
|
|
56933
56944
|
}
|
|
56934
56945
|
}
|
|
@@ -58228,7 +58239,6 @@ function createTypeChecker(host) {
|
|
|
58228
58239
|
return links.resolvedSymbol;
|
|
58229
58240
|
}
|
|
58230
58241
|
function getResolvedMembersOrExportsOfSymbol(symbol, resolutionKind) {
|
|
58231
|
-
var _a, _b, _c;
|
|
58232
58242
|
const links = getSymbolLinks(symbol);
|
|
58233
58243
|
if (!links[resolutionKind]) {
|
|
58234
58244
|
const isStatic2 = resolutionKind === "resolvedExports" /* resolvedExports */;
|
|
@@ -58247,7 +58257,7 @@ function createTypeChecker(host) {
|
|
|
58247
58257
|
}
|
|
58248
58258
|
}
|
|
58249
58259
|
}
|
|
58250
|
-
const assignments = (
|
|
58260
|
+
const assignments = getFunctionExpressionParentSymbolOrSymbol(symbol).assignmentDeclarationMembers;
|
|
58251
58261
|
if (assignments) {
|
|
58252
58262
|
const decls = arrayFrom(assignments.values());
|
|
58253
58263
|
for (const member of decls) {
|
|
@@ -58544,6 +58554,15 @@ function createTypeChecker(host) {
|
|
|
58544
58554
|
let result;
|
|
58545
58555
|
for (let i = 0; i < signatureLists.length; i++) {
|
|
58546
58556
|
const match = i === listIndex ? signature : findMatchingSignature(
|
|
58557
|
+
signatureLists[i],
|
|
58558
|
+
signature,
|
|
58559
|
+
/*partialMatch*/
|
|
58560
|
+
false,
|
|
58561
|
+
/*ignoreThisTypes*/
|
|
58562
|
+
false,
|
|
58563
|
+
/*ignoreReturnTypes*/
|
|
58564
|
+
true
|
|
58565
|
+
) || findMatchingSignature(
|
|
58547
58566
|
signatureLists[i],
|
|
58548
58567
|
signature,
|
|
58549
58568
|
/*partialMatch*/
|
|
@@ -58917,6 +58936,18 @@ function createTypeChecker(host) {
|
|
|
58917
58936
|
function replaceIndexedAccess(instantiable, type, replacement) {
|
|
58918
58937
|
return instantiateType(instantiable, createTypeMapper([type.indexType, type.objectType], [getNumberLiteralType(0), createTupleType([replacement])]));
|
|
58919
58938
|
}
|
|
58939
|
+
function getLimitedConstraint(type) {
|
|
58940
|
+
const constraint = getConstraintTypeFromMappedType(type.mappedType);
|
|
58941
|
+
if (!(constraint.flags & 1048576 /* Union */ || constraint.flags & 2097152 /* Intersection */)) {
|
|
58942
|
+
return;
|
|
58943
|
+
}
|
|
58944
|
+
const origin = constraint.flags & 1048576 /* Union */ ? constraint.origin : constraint;
|
|
58945
|
+
if (!origin || !(origin.flags & 2097152 /* Intersection */)) {
|
|
58946
|
+
return;
|
|
58947
|
+
}
|
|
58948
|
+
const limitedConstraint = getIntersectionType(origin.types.filter((t) => t !== type.constraintType));
|
|
58949
|
+
return limitedConstraint !== neverType ? limitedConstraint : void 0;
|
|
58950
|
+
}
|
|
58920
58951
|
function resolveReverseMappedTypeMembers(type) {
|
|
58921
58952
|
const indexInfo = getIndexInfoOfType(type.source, stringType);
|
|
58922
58953
|
const modifiers = getMappedTypeModifiers(type.mappedType);
|
|
@@ -58924,7 +58955,14 @@ function createTypeChecker(host) {
|
|
|
58924
58955
|
const optionalMask = modifiers & 4 /* IncludeOptional */ ? 0 : 16777216 /* Optional */;
|
|
58925
58956
|
const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType), readonlyMask && indexInfo.isReadonly)] : emptyArray;
|
|
58926
58957
|
const members = createSymbolTable();
|
|
58958
|
+
const limitedConstraint = getLimitedConstraint(type);
|
|
58927
58959
|
for (const prop of getPropertiesOfType(type.source)) {
|
|
58960
|
+
if (limitedConstraint) {
|
|
58961
|
+
const propertyNameType = getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */);
|
|
58962
|
+
if (!isTypeAssignableTo(propertyNameType, limitedConstraint)) {
|
|
58963
|
+
continue;
|
|
58964
|
+
}
|
|
58965
|
+
}
|
|
58928
58966
|
const checkFlags = 8192 /* ReverseMapped */ | (readonlyMask && isReadonlySymbol(prop) ? 8 /* Readonly */ : 0);
|
|
58929
58967
|
const inferredProp = createSymbol(4 /* Property */ | prop.flags & optionalMask, prop.escapedName, checkFlags);
|
|
58930
58968
|
inferredProp.declarations = prop.declarations;
|
|
@@ -59005,7 +59043,7 @@ function createTypeChecker(host) {
|
|
|
59005
59043
|
const constraintType = getConstraintTypeFromMappedType(type);
|
|
59006
59044
|
const mappedType = type.target || type;
|
|
59007
59045
|
const nameType = getNameTypeFromMappedType(mappedType);
|
|
59008
|
-
const shouldLinkPropDeclarations =
|
|
59046
|
+
const shouldLinkPropDeclarations = getMappedTypeNameTypeKind(mappedType) !== 2 /* Remapping */;
|
|
59009
59047
|
const templateType = getTemplateTypeFromMappedType(mappedType);
|
|
59010
59048
|
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
|
|
59011
59049
|
const templateModifiers = getMappedTypeModifiers(type);
|
|
@@ -59147,9 +59185,12 @@ function createTypeChecker(host) {
|
|
|
59147
59185
|
}
|
|
59148
59186
|
return false;
|
|
59149
59187
|
}
|
|
59150
|
-
function
|
|
59188
|
+
function getMappedTypeNameTypeKind(type) {
|
|
59151
59189
|
const nameType = getNameTypeFromMappedType(type);
|
|
59152
|
-
|
|
59190
|
+
if (!nameType) {
|
|
59191
|
+
return 0 /* None */;
|
|
59192
|
+
}
|
|
59193
|
+
return isTypeAssignableTo(nameType, getTypeParameterFromMappedType(type)) ? 1 /* Filtering */ : 2 /* Remapping */;
|
|
59153
59194
|
}
|
|
59154
59195
|
function resolveStructuredTypeMembers(type) {
|
|
59155
59196
|
if (!type.members) {
|
|
@@ -60013,6 +60054,7 @@ function createTypeChecker(host) {
|
|
|
60013
60054
|
let flags = 0 /* None */;
|
|
60014
60055
|
let minArgumentCount = 0;
|
|
60015
60056
|
let thisParameter;
|
|
60057
|
+
let thisTag = isInJSFile(declaration) ? getJSDocThisTag(declaration) : void 0;
|
|
60016
60058
|
let hasThisParameter2 = false;
|
|
60017
60059
|
const iife = getImmediatelyInvokedFunctionExpression(declaration);
|
|
60018
60060
|
const isJSConstructSignature = isJSDocConstructSignature(declaration);
|
|
@@ -60022,6 +60064,10 @@ function createTypeChecker(host) {
|
|
|
60022
60064
|
}
|
|
60023
60065
|
for (let i = isJSConstructSignature ? 1 : 0; i < declaration.parameters.length; i++) {
|
|
60024
60066
|
const param = declaration.parameters[i];
|
|
60067
|
+
if (isInJSFile(param) && isJSDocThisTag(param)) {
|
|
60068
|
+
thisTag = param;
|
|
60069
|
+
continue;
|
|
60070
|
+
}
|
|
60025
60071
|
let paramSymbol = param.symbol;
|
|
60026
60072
|
const type = isJSDocParameterTag(param) ? param.typeExpression && param.typeExpression.type : param.type;
|
|
60027
60073
|
if (paramSymbol && !!(paramSymbol.flags & 4 /* Property */) && !isBindingPattern(param.name)) {
|
|
@@ -60059,11 +60105,8 @@ function createTypeChecker(host) {
|
|
|
60059
60105
|
thisParameter = getAnnotatedAccessorThisParameter(other);
|
|
60060
60106
|
}
|
|
60061
60107
|
}
|
|
60062
|
-
if (
|
|
60063
|
-
|
|
60064
|
-
if (thisTag && thisTag.typeExpression) {
|
|
60065
|
-
thisParameter = createSymbolWithType(createSymbol(1 /* FunctionScopedVariable */, "this" /* This */), getTypeFromTypeNode(thisTag.typeExpression));
|
|
60066
|
-
}
|
|
60108
|
+
if (thisTag && thisTag.typeExpression) {
|
|
60109
|
+
thisParameter = createSymbolWithType(createSymbol(1 /* FunctionScopedVariable */, "this" /* This */), getTypeFromTypeNode(thisTag.typeExpression));
|
|
60067
60110
|
}
|
|
60068
60111
|
const hostDeclaration = isJSDocSignature(declaration) ? getEffectiveJSDocHost(declaration) : declaration;
|
|
60069
60112
|
const classType = hostDeclaration && isConstructorDeclaration(hostDeclaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(hostDeclaration.parent.symbol)) : void 0;
|
|
@@ -61685,6 +61728,8 @@ function createTypeChecker(host) {
|
|
|
61685
61728
|
includes |= flags & 473694207 /* IncludesMask */;
|
|
61686
61729
|
if (flags & 465829888 /* Instantiable */)
|
|
61687
61730
|
includes |= 33554432 /* IncludesInstantiable */;
|
|
61731
|
+
if (flags & 2097152 /* Intersection */ && getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */)
|
|
61732
|
+
includes |= 268435456 /* IncludesConstrainedTypeVariable */;
|
|
61688
61733
|
if (type === wildcardType)
|
|
61689
61734
|
includes |= 8388608 /* IncludesWildcard */;
|
|
61690
61735
|
if (!strictNullChecks && flags & 98304 /* Nullable */) {
|
|
@@ -61789,6 +61834,41 @@ function createTypeChecker(host) {
|
|
|
61789
61834
|
}
|
|
61790
61835
|
}
|
|
61791
61836
|
}
|
|
61837
|
+
function removeConstrainedTypeVariables(types) {
|
|
61838
|
+
const typeVariables = [];
|
|
61839
|
+
for (const type of types) {
|
|
61840
|
+
if (getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */) {
|
|
61841
|
+
const index = type.types[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
|
|
61842
|
+
pushIfUnique(typeVariables, type.types[index]);
|
|
61843
|
+
}
|
|
61844
|
+
}
|
|
61845
|
+
for (const typeVariable of typeVariables) {
|
|
61846
|
+
const primitives = [];
|
|
61847
|
+
for (const type of types) {
|
|
61848
|
+
if (getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */) {
|
|
61849
|
+
const index = type.types[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
|
|
61850
|
+
if (type.types[index] === typeVariable) {
|
|
61851
|
+
insertType(primitives, type.types[1 - index]);
|
|
61852
|
+
}
|
|
61853
|
+
}
|
|
61854
|
+
}
|
|
61855
|
+
const constraint = getBaseConstraintOfType(typeVariable);
|
|
61856
|
+
if (everyType(constraint, (t) => containsType(primitives, t))) {
|
|
61857
|
+
let i = types.length;
|
|
61858
|
+
while (i > 0) {
|
|
61859
|
+
i--;
|
|
61860
|
+
const type = types[i];
|
|
61861
|
+
if (getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */) {
|
|
61862
|
+
const index = type.types[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
|
|
61863
|
+
if (type.types[index] === typeVariable && containsType(primitives, type.types[1 - index])) {
|
|
61864
|
+
orderedRemoveItemAt(types, i);
|
|
61865
|
+
}
|
|
61866
|
+
}
|
|
61867
|
+
}
|
|
61868
|
+
insertType(types, typeVariable);
|
|
61869
|
+
}
|
|
61870
|
+
}
|
|
61871
|
+
}
|
|
61792
61872
|
function isNamedUnionType(type) {
|
|
61793
61873
|
return !!(type.flags & 1048576 /* Union */ && (type.aliasSymbol || type.origin));
|
|
61794
61874
|
}
|
|
@@ -61854,6 +61934,9 @@ function createTypeChecker(host) {
|
|
|
61854
61934
|
if (includes & 128 /* StringLiteral */ && includes & 134217728 /* TemplateLiteral */) {
|
|
61855
61935
|
removeStringLiteralsMatchedByTemplateLiterals(typeSet);
|
|
61856
61936
|
}
|
|
61937
|
+
if (includes & 268435456 /* IncludesConstrainedTypeVariable */) {
|
|
61938
|
+
removeConstrainedTypeVariables(typeSet);
|
|
61939
|
+
}
|
|
61857
61940
|
if (unionReduction === 2 /* Subtype */) {
|
|
61858
61941
|
typeSet = removeSubtypes(typeSet, !!(includes & 524288 /* Object */));
|
|
61859
61942
|
if (!typeSet) {
|
|
@@ -62066,9 +62149,9 @@ function createTypeChecker(host) {
|
|
|
62066
62149
|
types[index] = getUnionTypeFromSortedList(result, 32768 /* PrimitiveUnion */);
|
|
62067
62150
|
return true;
|
|
62068
62151
|
}
|
|
62069
|
-
function createIntersectionType(types, aliasSymbol, aliasTypeArguments) {
|
|
62152
|
+
function createIntersectionType(types, objectFlags, aliasSymbol, aliasTypeArguments) {
|
|
62070
62153
|
const result = createType(2097152 /* Intersection */);
|
|
62071
|
-
result.objectFlags = getPropagatingFlagsOfTypes(
|
|
62154
|
+
result.objectFlags = objectFlags | getPropagatingFlagsOfTypes(
|
|
62072
62155
|
types,
|
|
62073
62156
|
/*excludeKinds*/
|
|
62074
62157
|
98304 /* Nullable */
|
|
@@ -62082,6 +62165,7 @@ function createTypeChecker(host) {
|
|
|
62082
62165
|
const typeMembershipMap = /* @__PURE__ */ new Map();
|
|
62083
62166
|
const includes = addTypesToIntersection(typeMembershipMap, 0, types);
|
|
62084
62167
|
const typeSet = arrayFrom(typeMembershipMap.values());
|
|
62168
|
+
let objectFlags = 0 /* None */;
|
|
62085
62169
|
if (includes & 131072 /* Never */) {
|
|
62086
62170
|
return contains(typeSet, silentNeverType) ? silentNeverType : neverType;
|
|
62087
62171
|
}
|
|
@@ -62110,6 +62194,25 @@ function createTypeChecker(host) {
|
|
|
62110
62194
|
if (typeSet.length === 1) {
|
|
62111
62195
|
return typeSet[0];
|
|
62112
62196
|
}
|
|
62197
|
+
if (typeSet.length === 2) {
|
|
62198
|
+
const typeVarIndex = typeSet[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
|
|
62199
|
+
const typeVariable = typeSet[typeVarIndex];
|
|
62200
|
+
const primitiveType = typeSet[1 - typeVarIndex];
|
|
62201
|
+
if (typeVariable.flags & 8650752 /* TypeVariable */ && (primitiveType.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */) || includes & 16777216 /* IncludesEmptyObject */)) {
|
|
62202
|
+
const constraint = getBaseConstraintOfType(typeVariable);
|
|
62203
|
+
if (constraint && everyType(constraint, (t) => !!(t.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */)) || isEmptyAnonymousObjectType(t))) {
|
|
62204
|
+
if (isTypeStrictSubtypeOf(constraint, primitiveType)) {
|
|
62205
|
+
return typeVariable;
|
|
62206
|
+
}
|
|
62207
|
+
if (!(constraint.flags & 1048576 /* Union */ && someType(constraint, (c) => isTypeStrictSubtypeOf(c, primitiveType)))) {
|
|
62208
|
+
if (!isTypeStrictSubtypeOf(primitiveType, constraint)) {
|
|
62209
|
+
return neverType;
|
|
62210
|
+
}
|
|
62211
|
+
}
|
|
62212
|
+
objectFlags = 67108864 /* IsConstrainedTypeVariable */;
|
|
62213
|
+
}
|
|
62214
|
+
}
|
|
62215
|
+
}
|
|
62113
62216
|
const id = getTypeListId(typeSet) + getAliasId(aliasSymbol, aliasTypeArguments);
|
|
62114
62217
|
let result = intersectionTypes.get(id);
|
|
62115
62218
|
if (!result) {
|
|
@@ -62132,7 +62235,7 @@ function createTypeChecker(host) {
|
|
|
62132
62235
|
result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
|
|
62133
62236
|
}
|
|
62134
62237
|
} else {
|
|
62135
|
-
result = createIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
|
62238
|
+
result = createIntersectionType(typeSet, objectFlags, aliasSymbol, aliasTypeArguments);
|
|
62136
62239
|
}
|
|
62137
62240
|
intersectionTypes.set(id, result);
|
|
62138
62241
|
}
|
|
@@ -62289,7 +62392,7 @@ function createTypeChecker(host) {
|
|
|
62289
62392
|
);
|
|
62290
62393
|
}
|
|
62291
62394
|
function shouldDeferIndexType(type, indexFlags = 0 /* None */) {
|
|
62292
|
-
return !!(type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) || type.flags & 1048576 /* Union */ && !(indexFlags & 4 /* NoReducibleCheck */) && isGenericReducibleType(type) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 465829888 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType));
|
|
62395
|
+
return !!(type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && (!hasDistributiveNameType(type) || getMappedTypeNameTypeKind(type) === 2 /* Remapping */) || type.flags & 1048576 /* Union */ && !(indexFlags & 4 /* NoReducibleCheck */) && isGenericReducibleType(type) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 465829888 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType));
|
|
62293
62396
|
}
|
|
62294
62397
|
function getIndexType(type, indexFlags = defaultIndexFlags) {
|
|
62295
62398
|
type = getReducedType(type);
|
|
@@ -62773,7 +62876,7 @@ function createTypeChecker(host) {
|
|
|
62773
62876
|
}
|
|
62774
62877
|
}
|
|
62775
62878
|
if (isGenericMappedType(objectType)) {
|
|
62776
|
-
if (
|
|
62879
|
+
if (getMappedTypeNameTypeKind(objectType) !== 2 /* Remapping */) {
|
|
62777
62880
|
return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), (t) => getSimplifiedType(t, writing));
|
|
62778
62881
|
}
|
|
62779
62882
|
}
|
|
@@ -64802,8 +64905,8 @@ function createTypeChecker(host) {
|
|
|
64802
64905
|
const sourceType = i === restIndex ? getRestTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
|
|
64803
64906
|
const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
|
|
64804
64907
|
if (sourceType && targetType) {
|
|
64805
|
-
const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
64806
|
-
const targetSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
|
|
64908
|
+
const sourceSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(source, i) ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
64909
|
+
const targetSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(target, i) ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
|
|
64807
64910
|
const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && getTypeFacts(sourceType, 50331648 /* IsUndefinedOrNull */) === getTypeFacts(targetType, 50331648 /* IsUndefinedOrNull */);
|
|
64808
64911
|
let related = callbacks ? compareSignaturesRelated(targetSig, sourceSig, checkMode & 8 /* StrictArity */ | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) : !(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(
|
|
64809
64912
|
sourceType,
|
|
@@ -68825,7 +68928,8 @@ function createTypeChecker(host) {
|
|
|
68825
68928
|
source = getIntersectionType(sources);
|
|
68826
68929
|
target = getIntersectionType(targets);
|
|
68827
68930
|
}
|
|
68828
|
-
}
|
|
68931
|
+
}
|
|
68932
|
+
if (target.flags & (8388608 /* IndexedAccess */ | 33554432 /* Substitution */)) {
|
|
68829
68933
|
target = getActualTypeVariable(target);
|
|
68830
68934
|
}
|
|
68831
68935
|
if (target.flags & 8650752 /* TypeVariable */) {
|
|
@@ -69100,7 +69204,7 @@ function createTypeChecker(host) {
|
|
|
69100
69204
|
}
|
|
69101
69205
|
}
|
|
69102
69206
|
function inferToMappedType(source, target, constraintType) {
|
|
69103
|
-
if (constraintType.flags & 1048576 /* Union */) {
|
|
69207
|
+
if (constraintType.flags & 1048576 /* Union */ || constraintType.flags & 2097152 /* Intersection */) {
|
|
69104
69208
|
let result = false;
|
|
69105
69209
|
for (const type of constraintType.types) {
|
|
69106
69210
|
result = inferToMappedType(source, target, type) || result;
|
|
@@ -75352,6 +75456,10 @@ function createTypeChecker(host) {
|
|
|
75352
75456
|
const minTypeArgumentCount = getMinTypeArgumentCount(signature.typeParameters);
|
|
75353
75457
|
return !some(typeArguments) || typeArguments.length >= minTypeArgumentCount && typeArguments.length <= numTypeParameters;
|
|
75354
75458
|
}
|
|
75459
|
+
function isInstantiatedGenericParameter(signature, pos) {
|
|
75460
|
+
let type;
|
|
75461
|
+
return !!(signature.target && (type = tryGetTypeAtPosition(signature.target, pos)) && isGenericType(type));
|
|
75462
|
+
}
|
|
75355
75463
|
function getSingleCallSignature(type) {
|
|
75356
75464
|
return getSingleSignature(
|
|
75357
75465
|
type,
|
|
@@ -76494,7 +76602,7 @@ function createTypeChecker(host) {
|
|
|
76494
76602
|
}
|
|
76495
76603
|
return resolveErrorCall(node);
|
|
76496
76604
|
}
|
|
76497
|
-
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(
|
|
76605
|
+
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunctionOrConstructor)) {
|
|
76498
76606
|
skippedGenericFunction(node, checkMode);
|
|
76499
76607
|
return resolvingSignature;
|
|
76500
76608
|
}
|
|
@@ -76504,8 +76612,12 @@ function createTypeChecker(host) {
|
|
|
76504
76612
|
}
|
|
76505
76613
|
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
|
|
76506
76614
|
}
|
|
76507
|
-
function
|
|
76508
|
-
|
|
76615
|
+
function isGenericFunctionReturningFunctionOrConstructor(signature) {
|
|
76616
|
+
if (!signature.typeParameters) {
|
|
76617
|
+
return false;
|
|
76618
|
+
}
|
|
76619
|
+
const returnType = getReturnTypeOfSignature(signature);
|
|
76620
|
+
return isFunctionType(returnType) || isConstructorType(returnType);
|
|
76509
76621
|
}
|
|
76510
76622
|
function isUntypedFunctionCall(funcType, apparentFuncType, numCallSignatures, numConstructSignatures) {
|
|
76511
76623
|
return isTypeAny(funcType) || isTypeAny(apparentFuncType) && !!(funcType.flags & 262144 /* TypeParameter */) || !numCallSignatures && !numConstructSignatures && !(apparentFuncType.flags & 1048576 /* Union */) && !(getReducedType(apparentFuncType).flags & 131072 /* Never */) && isTypeAssignableTo(funcType, globalFunctionType);
|
|
@@ -81001,7 +81113,8 @@ function createTypeChecker(host) {
|
|
|
81001
81113
|
}
|
|
81002
81114
|
const objectType = type.objectType;
|
|
81003
81115
|
const indexType = type.indexType;
|
|
81004
|
-
|
|
81116
|
+
const objectIndexType = isGenericMappedType(objectType) && getMappedTypeNameTypeKind(objectType) === 2 /* Remapping */ ? getIndexTypeForMappedType(objectType, 0 /* None */) : getIndexType(objectType, 0 /* None */);
|
|
81117
|
+
if (isTypeAssignableTo(indexType, objectIndexType)) {
|
|
81005
81118
|
if (accessNode.kind === 212 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
|
|
81006
81119
|
error2(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
|
81007
81120
|
}
|
|
@@ -137710,7 +137823,7 @@ function transpileModule(input, transpileOptions) {
|
|
|
137710
137823
|
options
|
|
137711
137824
|
),
|
|
137712
137825
|
setExternalModuleIndicator: getSetExternalModuleIndicator(options),
|
|
137713
|
-
jsDocParsingMode:
|
|
137826
|
+
jsDocParsingMode: transpileOptions.jsDocParsingMode ?? 0 /* ParseAll */
|
|
137714
137827
|
}
|
|
137715
137828
|
);
|
|
137716
137829
|
if (transpileOptions.moduleName) {
|
package/lib/typescript.d.ts
CHANGED
|
@@ -11618,6 +11618,7 @@ declare namespace ts {
|
|
|
11618
11618
|
moduleName?: string;
|
|
11619
11619
|
renamedDependencies?: MapLike<string>;
|
|
11620
11620
|
transformers?: CustomTransformers;
|
|
11621
|
+
jsDocParsingMode?: JSDocParsingMode;
|
|
11621
11622
|
}
|
|
11622
11623
|
interface TranspileOutput {
|
|
11623
11624
|
outputText: string;
|
package/lib/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.4";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20231202`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -4447,6 +4447,7 @@ ${lanes.join("\n")}
|
|
|
4447
4447
|
TypeFlags2[TypeFlags2["IncludesWildcard"] = 8388608 /* IndexedAccess */] = "IncludesWildcard";
|
|
4448
4448
|
TypeFlags2[TypeFlags2["IncludesEmptyObject"] = 16777216 /* Conditional */] = "IncludesEmptyObject";
|
|
4449
4449
|
TypeFlags2[TypeFlags2["IncludesInstantiable"] = 33554432 /* Substitution */] = "IncludesInstantiable";
|
|
4450
|
+
TypeFlags2[TypeFlags2["IncludesConstrainedTypeVariable"] = 268435456 /* StringMapping */] = "IncludesConstrainedTypeVariable";
|
|
4450
4451
|
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36323331] = "NotPrimitiveUnion";
|
|
4451
4452
|
return TypeFlags2;
|
|
4452
4453
|
})(TypeFlags || {});
|
|
@@ -4493,6 +4494,7 @@ ${lanes.join("\n")}
|
|
|
4493
4494
|
ObjectFlags3[ObjectFlags3["IsUnknownLikeUnion"] = 67108864] = "IsUnknownLikeUnion";
|
|
4494
4495
|
ObjectFlags3[ObjectFlags3["IsNeverIntersectionComputed"] = 16777216] = "IsNeverIntersectionComputed";
|
|
4495
4496
|
ObjectFlags3[ObjectFlags3["IsNeverIntersection"] = 33554432] = "IsNeverIntersection";
|
|
4497
|
+
ObjectFlags3[ObjectFlags3["IsConstrainedTypeVariable"] = 67108864] = "IsConstrainedTypeVariable";
|
|
4496
4498
|
return ObjectFlags3;
|
|
4497
4499
|
})(ObjectFlags || {});
|
|
4498
4500
|
VarianceFlags = /* @__PURE__ */ ((VarianceFlags2) => {
|
|
@@ -35621,6 +35623,8 @@ ${lanes.join("\n")}
|
|
|
35621
35623
|
break;
|
|
35622
35624
|
case "template":
|
|
35623
35625
|
return parseTemplateTag(start2, tagName, indent3, indentText);
|
|
35626
|
+
case "this":
|
|
35627
|
+
return parseThisTag(start2, tagName, indent3, indentText);
|
|
35624
35628
|
default:
|
|
35625
35629
|
return false;
|
|
35626
35630
|
}
|
|
@@ -47195,7 +47199,7 @@ ${lanes.join("\n")}
|
|
|
47195
47199
|
return isBlockScopedNameDeclaredBeforeUse(getAncestor(declaration, 260 /* VariableDeclaration */), usage);
|
|
47196
47200
|
} else if (declaration.kind === 260 /* VariableDeclaration */) {
|
|
47197
47201
|
return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage);
|
|
47198
|
-
} else if (
|
|
47202
|
+
} else if (isClassLike(declaration)) {
|
|
47199
47203
|
return !findAncestor(usage, (n) => isComputedPropertyName(n) && n.parent.parent === declaration);
|
|
47200
47204
|
} else if (isPropertyDeclaration(declaration)) {
|
|
47201
47205
|
return !isPropertyImmediatelyReferencedWithinDeclaration(
|
|
@@ -49464,6 +49468,10 @@ ${lanes.join("\n")}
|
|
|
49464
49468
|
function getParentOfSymbol(symbol) {
|
|
49465
49469
|
return getMergedSymbol(symbol.parent && getLateBoundSymbol(symbol.parent));
|
|
49466
49470
|
}
|
|
49471
|
+
function getFunctionExpressionParentSymbolOrSymbol(symbol) {
|
|
49472
|
+
var _a, _b;
|
|
49473
|
+
return ((_a = symbol.valueDeclaration) == null ? void 0 : _a.kind) === 219 /* ArrowFunction */ || ((_b = symbol.valueDeclaration) == null ? void 0 : _b.kind) === 218 /* FunctionExpression */ ? getSymbolOfNode(symbol.valueDeclaration.parent) || symbol : symbol;
|
|
49474
|
+
}
|
|
49467
49475
|
function getAlternativeContainingModules(symbol, enclosingDeclaration) {
|
|
49468
49476
|
const containingFile = getSourceFileOfNode(enclosingDeclaration);
|
|
49469
49477
|
const id = getNodeId(containingFile);
|
|
@@ -54687,11 +54695,14 @@ ${lanes.join("\n")}
|
|
|
54687
54695
|
}
|
|
54688
54696
|
}
|
|
54689
54697
|
if ((_a = symbol.parent) == null ? void 0 : _a.valueDeclaration) {
|
|
54690
|
-
const
|
|
54691
|
-
if (
|
|
54692
|
-
const
|
|
54693
|
-
if (
|
|
54694
|
-
|
|
54698
|
+
const possiblyAnnotatedSymbol = getFunctionExpressionParentSymbolOrSymbol(symbol.parent);
|
|
54699
|
+
if (possiblyAnnotatedSymbol.valueDeclaration) {
|
|
54700
|
+
const typeNode2 = getEffectiveTypeAnnotationNode(possiblyAnnotatedSymbol.valueDeclaration);
|
|
54701
|
+
if (typeNode2) {
|
|
54702
|
+
const annotationSymbol = getPropertyOfType(getTypeFromTypeNode(typeNode2), symbol.escapedName);
|
|
54703
|
+
if (annotationSymbol) {
|
|
54704
|
+
return getNonMissingTypeOfSymbol(annotationSymbol);
|
|
54705
|
+
}
|
|
54695
54706
|
}
|
|
54696
54707
|
}
|
|
54697
54708
|
}
|
|
@@ -55991,7 +56002,6 @@ ${lanes.join("\n")}
|
|
|
55991
56002
|
return links.resolvedSymbol;
|
|
55992
56003
|
}
|
|
55993
56004
|
function getResolvedMembersOrExportsOfSymbol(symbol, resolutionKind) {
|
|
55994
|
-
var _a, _b, _c;
|
|
55995
56005
|
const links = getSymbolLinks(symbol);
|
|
55996
56006
|
if (!links[resolutionKind]) {
|
|
55997
56007
|
const isStatic2 = resolutionKind === "resolvedExports" /* resolvedExports */;
|
|
@@ -56010,7 +56020,7 @@ ${lanes.join("\n")}
|
|
|
56010
56020
|
}
|
|
56011
56021
|
}
|
|
56012
56022
|
}
|
|
56013
|
-
const assignments = (
|
|
56023
|
+
const assignments = getFunctionExpressionParentSymbolOrSymbol(symbol).assignmentDeclarationMembers;
|
|
56014
56024
|
if (assignments) {
|
|
56015
56025
|
const decls = arrayFrom(assignments.values());
|
|
56016
56026
|
for (const member of decls) {
|
|
@@ -56307,6 +56317,15 @@ ${lanes.join("\n")}
|
|
|
56307
56317
|
let result;
|
|
56308
56318
|
for (let i = 0; i < signatureLists.length; i++) {
|
|
56309
56319
|
const match = i === listIndex ? signature : findMatchingSignature(
|
|
56320
|
+
signatureLists[i],
|
|
56321
|
+
signature,
|
|
56322
|
+
/*partialMatch*/
|
|
56323
|
+
false,
|
|
56324
|
+
/*ignoreThisTypes*/
|
|
56325
|
+
false,
|
|
56326
|
+
/*ignoreReturnTypes*/
|
|
56327
|
+
true
|
|
56328
|
+
) || findMatchingSignature(
|
|
56310
56329
|
signatureLists[i],
|
|
56311
56330
|
signature,
|
|
56312
56331
|
/*partialMatch*/
|
|
@@ -56680,6 +56699,18 @@ ${lanes.join("\n")}
|
|
|
56680
56699
|
function replaceIndexedAccess(instantiable, type, replacement) {
|
|
56681
56700
|
return instantiateType(instantiable, createTypeMapper([type.indexType, type.objectType], [getNumberLiteralType(0), createTupleType([replacement])]));
|
|
56682
56701
|
}
|
|
56702
|
+
function getLimitedConstraint(type) {
|
|
56703
|
+
const constraint = getConstraintTypeFromMappedType(type.mappedType);
|
|
56704
|
+
if (!(constraint.flags & 1048576 /* Union */ || constraint.flags & 2097152 /* Intersection */)) {
|
|
56705
|
+
return;
|
|
56706
|
+
}
|
|
56707
|
+
const origin = constraint.flags & 1048576 /* Union */ ? constraint.origin : constraint;
|
|
56708
|
+
if (!origin || !(origin.flags & 2097152 /* Intersection */)) {
|
|
56709
|
+
return;
|
|
56710
|
+
}
|
|
56711
|
+
const limitedConstraint = getIntersectionType(origin.types.filter((t) => t !== type.constraintType));
|
|
56712
|
+
return limitedConstraint !== neverType ? limitedConstraint : void 0;
|
|
56713
|
+
}
|
|
56683
56714
|
function resolveReverseMappedTypeMembers(type) {
|
|
56684
56715
|
const indexInfo = getIndexInfoOfType(type.source, stringType);
|
|
56685
56716
|
const modifiers = getMappedTypeModifiers(type.mappedType);
|
|
@@ -56687,7 +56718,14 @@ ${lanes.join("\n")}
|
|
|
56687
56718
|
const optionalMask = modifiers & 4 /* IncludeOptional */ ? 0 : 16777216 /* Optional */;
|
|
56688
56719
|
const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType), readonlyMask && indexInfo.isReadonly)] : emptyArray;
|
|
56689
56720
|
const members = createSymbolTable();
|
|
56721
|
+
const limitedConstraint = getLimitedConstraint(type);
|
|
56690
56722
|
for (const prop of getPropertiesOfType(type.source)) {
|
|
56723
|
+
if (limitedConstraint) {
|
|
56724
|
+
const propertyNameType = getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */);
|
|
56725
|
+
if (!isTypeAssignableTo(propertyNameType, limitedConstraint)) {
|
|
56726
|
+
continue;
|
|
56727
|
+
}
|
|
56728
|
+
}
|
|
56691
56729
|
const checkFlags = 8192 /* ReverseMapped */ | (readonlyMask && isReadonlySymbol(prop) ? 8 /* Readonly */ : 0);
|
|
56692
56730
|
const inferredProp = createSymbol(4 /* Property */ | prop.flags & optionalMask, prop.escapedName, checkFlags);
|
|
56693
56731
|
inferredProp.declarations = prop.declarations;
|
|
@@ -56768,7 +56806,7 @@ ${lanes.join("\n")}
|
|
|
56768
56806
|
const constraintType = getConstraintTypeFromMappedType(type);
|
|
56769
56807
|
const mappedType = type.target || type;
|
|
56770
56808
|
const nameType = getNameTypeFromMappedType(mappedType);
|
|
56771
|
-
const shouldLinkPropDeclarations =
|
|
56809
|
+
const shouldLinkPropDeclarations = getMappedTypeNameTypeKind(mappedType) !== 2 /* Remapping */;
|
|
56772
56810
|
const templateType = getTemplateTypeFromMappedType(mappedType);
|
|
56773
56811
|
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
|
|
56774
56812
|
const templateModifiers = getMappedTypeModifiers(type);
|
|
@@ -56910,9 +56948,12 @@ ${lanes.join("\n")}
|
|
|
56910
56948
|
}
|
|
56911
56949
|
return false;
|
|
56912
56950
|
}
|
|
56913
|
-
function
|
|
56951
|
+
function getMappedTypeNameTypeKind(type) {
|
|
56914
56952
|
const nameType = getNameTypeFromMappedType(type);
|
|
56915
|
-
|
|
56953
|
+
if (!nameType) {
|
|
56954
|
+
return 0 /* None */;
|
|
56955
|
+
}
|
|
56956
|
+
return isTypeAssignableTo(nameType, getTypeParameterFromMappedType(type)) ? 1 /* Filtering */ : 2 /* Remapping */;
|
|
56916
56957
|
}
|
|
56917
56958
|
function resolveStructuredTypeMembers(type) {
|
|
56918
56959
|
if (!type.members) {
|
|
@@ -57776,6 +57817,7 @@ ${lanes.join("\n")}
|
|
|
57776
57817
|
let flags = 0 /* None */;
|
|
57777
57818
|
let minArgumentCount = 0;
|
|
57778
57819
|
let thisParameter;
|
|
57820
|
+
let thisTag = isInJSFile(declaration) ? getJSDocThisTag(declaration) : void 0;
|
|
57779
57821
|
let hasThisParameter2 = false;
|
|
57780
57822
|
const iife = getImmediatelyInvokedFunctionExpression(declaration);
|
|
57781
57823
|
const isJSConstructSignature = isJSDocConstructSignature(declaration);
|
|
@@ -57785,6 +57827,10 @@ ${lanes.join("\n")}
|
|
|
57785
57827
|
}
|
|
57786
57828
|
for (let i = isJSConstructSignature ? 1 : 0; i < declaration.parameters.length; i++) {
|
|
57787
57829
|
const param = declaration.parameters[i];
|
|
57830
|
+
if (isInJSFile(param) && isJSDocThisTag(param)) {
|
|
57831
|
+
thisTag = param;
|
|
57832
|
+
continue;
|
|
57833
|
+
}
|
|
57788
57834
|
let paramSymbol = param.symbol;
|
|
57789
57835
|
const type = isJSDocParameterTag(param) ? param.typeExpression && param.typeExpression.type : param.type;
|
|
57790
57836
|
if (paramSymbol && !!(paramSymbol.flags & 4 /* Property */) && !isBindingPattern(param.name)) {
|
|
@@ -57822,11 +57868,8 @@ ${lanes.join("\n")}
|
|
|
57822
57868
|
thisParameter = getAnnotatedAccessorThisParameter(other);
|
|
57823
57869
|
}
|
|
57824
57870
|
}
|
|
57825
|
-
if (
|
|
57826
|
-
|
|
57827
|
-
if (thisTag && thisTag.typeExpression) {
|
|
57828
|
-
thisParameter = createSymbolWithType(createSymbol(1 /* FunctionScopedVariable */, "this" /* This */), getTypeFromTypeNode(thisTag.typeExpression));
|
|
57829
|
-
}
|
|
57871
|
+
if (thisTag && thisTag.typeExpression) {
|
|
57872
|
+
thisParameter = createSymbolWithType(createSymbol(1 /* FunctionScopedVariable */, "this" /* This */), getTypeFromTypeNode(thisTag.typeExpression));
|
|
57830
57873
|
}
|
|
57831
57874
|
const hostDeclaration = isJSDocSignature(declaration) ? getEffectiveJSDocHost(declaration) : declaration;
|
|
57832
57875
|
const classType = hostDeclaration && isConstructorDeclaration(hostDeclaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(hostDeclaration.parent.symbol)) : void 0;
|
|
@@ -59448,6 +59491,8 @@ ${lanes.join("\n")}
|
|
|
59448
59491
|
includes |= flags & 473694207 /* IncludesMask */;
|
|
59449
59492
|
if (flags & 465829888 /* Instantiable */)
|
|
59450
59493
|
includes |= 33554432 /* IncludesInstantiable */;
|
|
59494
|
+
if (flags & 2097152 /* Intersection */ && getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */)
|
|
59495
|
+
includes |= 268435456 /* IncludesConstrainedTypeVariable */;
|
|
59451
59496
|
if (type === wildcardType)
|
|
59452
59497
|
includes |= 8388608 /* IncludesWildcard */;
|
|
59453
59498
|
if (!strictNullChecks && flags & 98304 /* Nullable */) {
|
|
@@ -59552,6 +59597,41 @@ ${lanes.join("\n")}
|
|
|
59552
59597
|
}
|
|
59553
59598
|
}
|
|
59554
59599
|
}
|
|
59600
|
+
function removeConstrainedTypeVariables(types) {
|
|
59601
|
+
const typeVariables = [];
|
|
59602
|
+
for (const type of types) {
|
|
59603
|
+
if (getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */) {
|
|
59604
|
+
const index = type.types[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
|
|
59605
|
+
pushIfUnique(typeVariables, type.types[index]);
|
|
59606
|
+
}
|
|
59607
|
+
}
|
|
59608
|
+
for (const typeVariable of typeVariables) {
|
|
59609
|
+
const primitives = [];
|
|
59610
|
+
for (const type of types) {
|
|
59611
|
+
if (getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */) {
|
|
59612
|
+
const index = type.types[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
|
|
59613
|
+
if (type.types[index] === typeVariable) {
|
|
59614
|
+
insertType(primitives, type.types[1 - index]);
|
|
59615
|
+
}
|
|
59616
|
+
}
|
|
59617
|
+
}
|
|
59618
|
+
const constraint = getBaseConstraintOfType(typeVariable);
|
|
59619
|
+
if (everyType(constraint, (t) => containsType(primitives, t))) {
|
|
59620
|
+
let i = types.length;
|
|
59621
|
+
while (i > 0) {
|
|
59622
|
+
i--;
|
|
59623
|
+
const type = types[i];
|
|
59624
|
+
if (getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */) {
|
|
59625
|
+
const index = type.types[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
|
|
59626
|
+
if (type.types[index] === typeVariable && containsType(primitives, type.types[1 - index])) {
|
|
59627
|
+
orderedRemoveItemAt(types, i);
|
|
59628
|
+
}
|
|
59629
|
+
}
|
|
59630
|
+
}
|
|
59631
|
+
insertType(types, typeVariable);
|
|
59632
|
+
}
|
|
59633
|
+
}
|
|
59634
|
+
}
|
|
59555
59635
|
function isNamedUnionType(type) {
|
|
59556
59636
|
return !!(type.flags & 1048576 /* Union */ && (type.aliasSymbol || type.origin));
|
|
59557
59637
|
}
|
|
@@ -59617,6 +59697,9 @@ ${lanes.join("\n")}
|
|
|
59617
59697
|
if (includes & 128 /* StringLiteral */ && includes & 134217728 /* TemplateLiteral */) {
|
|
59618
59698
|
removeStringLiteralsMatchedByTemplateLiterals(typeSet);
|
|
59619
59699
|
}
|
|
59700
|
+
if (includes & 268435456 /* IncludesConstrainedTypeVariable */) {
|
|
59701
|
+
removeConstrainedTypeVariables(typeSet);
|
|
59702
|
+
}
|
|
59620
59703
|
if (unionReduction === 2 /* Subtype */) {
|
|
59621
59704
|
typeSet = removeSubtypes(typeSet, !!(includes & 524288 /* Object */));
|
|
59622
59705
|
if (!typeSet) {
|
|
@@ -59829,9 +59912,9 @@ ${lanes.join("\n")}
|
|
|
59829
59912
|
types[index] = getUnionTypeFromSortedList(result, 32768 /* PrimitiveUnion */);
|
|
59830
59913
|
return true;
|
|
59831
59914
|
}
|
|
59832
|
-
function createIntersectionType(types, aliasSymbol, aliasTypeArguments) {
|
|
59915
|
+
function createIntersectionType(types, objectFlags, aliasSymbol, aliasTypeArguments) {
|
|
59833
59916
|
const result = createType(2097152 /* Intersection */);
|
|
59834
|
-
result.objectFlags = getPropagatingFlagsOfTypes(
|
|
59917
|
+
result.objectFlags = objectFlags | getPropagatingFlagsOfTypes(
|
|
59835
59918
|
types,
|
|
59836
59919
|
/*excludeKinds*/
|
|
59837
59920
|
98304 /* Nullable */
|
|
@@ -59845,6 +59928,7 @@ ${lanes.join("\n")}
|
|
|
59845
59928
|
const typeMembershipMap = /* @__PURE__ */ new Map();
|
|
59846
59929
|
const includes = addTypesToIntersection(typeMembershipMap, 0, types);
|
|
59847
59930
|
const typeSet = arrayFrom(typeMembershipMap.values());
|
|
59931
|
+
let objectFlags = 0 /* None */;
|
|
59848
59932
|
if (includes & 131072 /* Never */) {
|
|
59849
59933
|
return contains(typeSet, silentNeverType) ? silentNeverType : neverType;
|
|
59850
59934
|
}
|
|
@@ -59873,6 +59957,25 @@ ${lanes.join("\n")}
|
|
|
59873
59957
|
if (typeSet.length === 1) {
|
|
59874
59958
|
return typeSet[0];
|
|
59875
59959
|
}
|
|
59960
|
+
if (typeSet.length === 2) {
|
|
59961
|
+
const typeVarIndex = typeSet[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
|
|
59962
|
+
const typeVariable = typeSet[typeVarIndex];
|
|
59963
|
+
const primitiveType = typeSet[1 - typeVarIndex];
|
|
59964
|
+
if (typeVariable.flags & 8650752 /* TypeVariable */ && (primitiveType.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */) || includes & 16777216 /* IncludesEmptyObject */)) {
|
|
59965
|
+
const constraint = getBaseConstraintOfType(typeVariable);
|
|
59966
|
+
if (constraint && everyType(constraint, (t) => !!(t.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */)) || isEmptyAnonymousObjectType(t))) {
|
|
59967
|
+
if (isTypeStrictSubtypeOf(constraint, primitiveType)) {
|
|
59968
|
+
return typeVariable;
|
|
59969
|
+
}
|
|
59970
|
+
if (!(constraint.flags & 1048576 /* Union */ && someType(constraint, (c) => isTypeStrictSubtypeOf(c, primitiveType)))) {
|
|
59971
|
+
if (!isTypeStrictSubtypeOf(primitiveType, constraint)) {
|
|
59972
|
+
return neverType;
|
|
59973
|
+
}
|
|
59974
|
+
}
|
|
59975
|
+
objectFlags = 67108864 /* IsConstrainedTypeVariable */;
|
|
59976
|
+
}
|
|
59977
|
+
}
|
|
59978
|
+
}
|
|
59876
59979
|
const id = getTypeListId(typeSet) + getAliasId(aliasSymbol, aliasTypeArguments);
|
|
59877
59980
|
let result = intersectionTypes.get(id);
|
|
59878
59981
|
if (!result) {
|
|
@@ -59895,7 +59998,7 @@ ${lanes.join("\n")}
|
|
|
59895
59998
|
result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
|
|
59896
59999
|
}
|
|
59897
60000
|
} else {
|
|
59898
|
-
result = createIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
|
60001
|
+
result = createIntersectionType(typeSet, objectFlags, aliasSymbol, aliasTypeArguments);
|
|
59899
60002
|
}
|
|
59900
60003
|
intersectionTypes.set(id, result);
|
|
59901
60004
|
}
|
|
@@ -60052,7 +60155,7 @@ ${lanes.join("\n")}
|
|
|
60052
60155
|
);
|
|
60053
60156
|
}
|
|
60054
60157
|
function shouldDeferIndexType(type, indexFlags = 0 /* None */) {
|
|
60055
|
-
return !!(type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) || type.flags & 1048576 /* Union */ && !(indexFlags & 4 /* NoReducibleCheck */) && isGenericReducibleType(type) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 465829888 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType));
|
|
60158
|
+
return !!(type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && (!hasDistributiveNameType(type) || getMappedTypeNameTypeKind(type) === 2 /* Remapping */) || type.flags & 1048576 /* Union */ && !(indexFlags & 4 /* NoReducibleCheck */) && isGenericReducibleType(type) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 465829888 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType));
|
|
60056
60159
|
}
|
|
60057
60160
|
function getIndexType(type, indexFlags = defaultIndexFlags) {
|
|
60058
60161
|
type = getReducedType(type);
|
|
@@ -60536,7 +60639,7 @@ ${lanes.join("\n")}
|
|
|
60536
60639
|
}
|
|
60537
60640
|
}
|
|
60538
60641
|
if (isGenericMappedType(objectType)) {
|
|
60539
|
-
if (
|
|
60642
|
+
if (getMappedTypeNameTypeKind(objectType) !== 2 /* Remapping */) {
|
|
60540
60643
|
return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), (t) => getSimplifiedType(t, writing));
|
|
60541
60644
|
}
|
|
60542
60645
|
}
|
|
@@ -62565,8 +62668,8 @@ ${lanes.join("\n")}
|
|
|
62565
62668
|
const sourceType = i === restIndex ? getRestTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
|
|
62566
62669
|
const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
|
|
62567
62670
|
if (sourceType && targetType) {
|
|
62568
|
-
const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
62569
|
-
const targetSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
|
|
62671
|
+
const sourceSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(source, i) ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
62672
|
+
const targetSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(target, i) ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
|
|
62570
62673
|
const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && getTypeFacts(sourceType, 50331648 /* IsUndefinedOrNull */) === getTypeFacts(targetType, 50331648 /* IsUndefinedOrNull */);
|
|
62571
62674
|
let related = callbacks ? compareSignaturesRelated(targetSig, sourceSig, checkMode & 8 /* StrictArity */ | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) : !(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(
|
|
62572
62675
|
sourceType,
|
|
@@ -66588,7 +66691,8 @@ ${lanes.join("\n")}
|
|
|
66588
66691
|
source = getIntersectionType(sources);
|
|
66589
66692
|
target = getIntersectionType(targets);
|
|
66590
66693
|
}
|
|
66591
|
-
}
|
|
66694
|
+
}
|
|
66695
|
+
if (target.flags & (8388608 /* IndexedAccess */ | 33554432 /* Substitution */)) {
|
|
66592
66696
|
target = getActualTypeVariable(target);
|
|
66593
66697
|
}
|
|
66594
66698
|
if (target.flags & 8650752 /* TypeVariable */) {
|
|
@@ -66863,7 +66967,7 @@ ${lanes.join("\n")}
|
|
|
66863
66967
|
}
|
|
66864
66968
|
}
|
|
66865
66969
|
function inferToMappedType(source, target, constraintType) {
|
|
66866
|
-
if (constraintType.flags & 1048576 /* Union */) {
|
|
66970
|
+
if (constraintType.flags & 1048576 /* Union */ || constraintType.flags & 2097152 /* Intersection */) {
|
|
66867
66971
|
let result = false;
|
|
66868
66972
|
for (const type of constraintType.types) {
|
|
66869
66973
|
result = inferToMappedType(source, target, type) || result;
|
|
@@ -73115,6 +73219,10 @@ ${lanes.join("\n")}
|
|
|
73115
73219
|
const minTypeArgumentCount = getMinTypeArgumentCount(signature.typeParameters);
|
|
73116
73220
|
return !some(typeArguments) || typeArguments.length >= minTypeArgumentCount && typeArguments.length <= numTypeParameters;
|
|
73117
73221
|
}
|
|
73222
|
+
function isInstantiatedGenericParameter(signature, pos) {
|
|
73223
|
+
let type;
|
|
73224
|
+
return !!(signature.target && (type = tryGetTypeAtPosition(signature.target, pos)) && isGenericType(type));
|
|
73225
|
+
}
|
|
73118
73226
|
function getSingleCallSignature(type) {
|
|
73119
73227
|
return getSingleSignature(
|
|
73120
73228
|
type,
|
|
@@ -74257,7 +74365,7 @@ ${lanes.join("\n")}
|
|
|
74257
74365
|
}
|
|
74258
74366
|
return resolveErrorCall(node);
|
|
74259
74367
|
}
|
|
74260
|
-
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(
|
|
74368
|
+
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunctionOrConstructor)) {
|
|
74261
74369
|
skippedGenericFunction(node, checkMode);
|
|
74262
74370
|
return resolvingSignature;
|
|
74263
74371
|
}
|
|
@@ -74267,8 +74375,12 @@ ${lanes.join("\n")}
|
|
|
74267
74375
|
}
|
|
74268
74376
|
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
|
|
74269
74377
|
}
|
|
74270
|
-
function
|
|
74271
|
-
|
|
74378
|
+
function isGenericFunctionReturningFunctionOrConstructor(signature) {
|
|
74379
|
+
if (!signature.typeParameters) {
|
|
74380
|
+
return false;
|
|
74381
|
+
}
|
|
74382
|
+
const returnType = getReturnTypeOfSignature(signature);
|
|
74383
|
+
return isFunctionType(returnType) || isConstructorType(returnType);
|
|
74272
74384
|
}
|
|
74273
74385
|
function isUntypedFunctionCall(funcType, apparentFuncType, numCallSignatures, numConstructSignatures) {
|
|
74274
74386
|
return isTypeAny(funcType) || isTypeAny(apparentFuncType) && !!(funcType.flags & 262144 /* TypeParameter */) || !numCallSignatures && !numConstructSignatures && !(apparentFuncType.flags & 1048576 /* Union */) && !(getReducedType(apparentFuncType).flags & 131072 /* Never */) && isTypeAssignableTo(funcType, globalFunctionType);
|
|
@@ -78764,7 +78876,8 @@ ${lanes.join("\n")}
|
|
|
78764
78876
|
}
|
|
78765
78877
|
const objectType = type.objectType;
|
|
78766
78878
|
const indexType = type.indexType;
|
|
78767
|
-
|
|
78879
|
+
const objectIndexType = isGenericMappedType(objectType) && getMappedTypeNameTypeKind(objectType) === 2 /* Remapping */ ? getIndexTypeForMappedType(objectType, 0 /* None */) : getIndexType(objectType, 0 /* None */);
|
|
78880
|
+
if (isTypeAssignableTo(indexType, objectIndexType)) {
|
|
78768
78881
|
if (accessNode.kind === 212 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
|
|
78769
78882
|
error2(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
|
78770
78883
|
}
|
|
@@ -136075,7 +136188,7 @@ ${lanes.join("\n")}
|
|
|
136075
136188
|
options
|
|
136076
136189
|
),
|
|
136077
136190
|
setExternalModuleIndicator: getSetExternalModuleIndicator(options),
|
|
136078
|
-
jsDocParsingMode:
|
|
136191
|
+
jsDocParsingMode: transpileOptions.jsDocParsingMode ?? 0 /* ParseAll */
|
|
136079
136192
|
}
|
|
136080
136193
|
);
|
|
136081
136194
|
if (transpileOptions.moduleName) {
|
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.4";
|
|
57
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
57
|
+
var version = `${versionMajorMinor}.0-dev.20231202`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -3105,6 +3105,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
3105
3105
|
TypeFlags2[TypeFlags2["IncludesWildcard"] = 8388608 /* IndexedAccess */] = "IncludesWildcard";
|
|
3106
3106
|
TypeFlags2[TypeFlags2["IncludesEmptyObject"] = 16777216 /* Conditional */] = "IncludesEmptyObject";
|
|
3107
3107
|
TypeFlags2[TypeFlags2["IncludesInstantiable"] = 33554432 /* Substitution */] = "IncludesInstantiable";
|
|
3108
|
+
TypeFlags2[TypeFlags2["IncludesConstrainedTypeVariable"] = 268435456 /* StringMapping */] = "IncludesConstrainedTypeVariable";
|
|
3108
3109
|
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36323331] = "NotPrimitiveUnion";
|
|
3109
3110
|
return TypeFlags2;
|
|
3110
3111
|
})(TypeFlags || {});
|
|
@@ -3151,6 +3152,7 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
|
3151
3152
|
ObjectFlags3[ObjectFlags3["IsUnknownLikeUnion"] = 67108864] = "IsUnknownLikeUnion";
|
|
3152
3153
|
ObjectFlags3[ObjectFlags3["IsNeverIntersectionComputed"] = 16777216] = "IsNeverIntersectionComputed";
|
|
3153
3154
|
ObjectFlags3[ObjectFlags3["IsNeverIntersection"] = 33554432] = "IsNeverIntersection";
|
|
3155
|
+
ObjectFlags3[ObjectFlags3["IsConstrainedTypeVariable"] = 67108864] = "IsConstrainedTypeVariable";
|
|
3154
3156
|
return ObjectFlags3;
|
|
3155
3157
|
})(ObjectFlags || {});
|
|
3156
3158
|
var SignatureFlags = /* @__PURE__ */ ((SignatureFlags4) => {
|
|
@@ -24940,6 +24942,8 @@ var Parser;
|
|
|
24940
24942
|
break;
|
|
24941
24943
|
case "template":
|
|
24942
24944
|
return parseTemplateTag(start2, tagName, indent3, indentText);
|
|
24945
|
+
case "this":
|
|
24946
|
+
return parseThisTag(start2, tagName, indent3, indentText);
|
|
24943
24947
|
default:
|
|
24944
24948
|
return false;
|
|
24945
24949
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.4.0-dev.
|
|
5
|
+
"version": "5.4.0-dev.20231202",
|
|
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": "670815f768afb613ff2651b16dc4258aeb33a036"
|
|
118
118
|
}
|