@typescript-deploys/pr-build 5.4.0-pr-56680-2 → 5.4.0-pr-52968-11
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.es5.d.ts +5 -0
- package/lib/tsc.js +90 -61
- package/lib/tsserver.js +94 -65
- package/lib/typescript.d.ts +9 -4
- package/lib/typescript.js +95 -66
- package/lib/typingsInstaller.js +8 -8
- package/package.json +2 -2
package/lib/tsserver.js
CHANGED
|
@@ -2334,7 +2334,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2334
2334
|
|
|
2335
2335
|
// src/compiler/corePublic.ts
|
|
2336
2336
|
var versionMajorMinor = "5.4";
|
|
2337
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2337
|
+
var version = `${versionMajorMinor}.0-insiders.20231207`;
|
|
2338
2338
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2339
2339
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2340
2340
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6651,6 +6651,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
6651
6651
|
TypeFlags2[TypeFlags2["NonPrimitive"] = 67108864] = "NonPrimitive";
|
|
6652
6652
|
TypeFlags2[TypeFlags2["TemplateLiteral"] = 134217728] = "TemplateLiteral";
|
|
6653
6653
|
TypeFlags2[TypeFlags2["StringMapping"] = 268435456] = "StringMapping";
|
|
6654
|
+
TypeFlags2[TypeFlags2["NoInfer"] = 536870912] = "NoInfer";
|
|
6654
6655
|
TypeFlags2[TypeFlags2["AnyOrUnknown"] = 3] = "AnyOrUnknown";
|
|
6655
6656
|
TypeFlags2[TypeFlags2["Nullable"] = 98304] = "Nullable";
|
|
6656
6657
|
TypeFlags2[TypeFlags2["Literal"] = 2944] = "Literal";
|
|
@@ -6674,14 +6675,14 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
6674
6675
|
TypeFlags2[TypeFlags2["UnionOrIntersection"] = 3145728] = "UnionOrIntersection";
|
|
6675
6676
|
TypeFlags2[TypeFlags2["StructuredType"] = 3670016] = "StructuredType";
|
|
6676
6677
|
TypeFlags2[TypeFlags2["TypeVariable"] = 8650752] = "TypeVariable";
|
|
6677
|
-
TypeFlags2[TypeFlags2["InstantiableNonPrimitive"] =
|
|
6678
|
+
TypeFlags2[TypeFlags2["InstantiableNonPrimitive"] = 595853312] = "InstantiableNonPrimitive";
|
|
6678
6679
|
TypeFlags2[TypeFlags2["InstantiablePrimitive"] = 406847488] = "InstantiablePrimitive";
|
|
6679
|
-
TypeFlags2[TypeFlags2["Instantiable"] =
|
|
6680
|
-
TypeFlags2[TypeFlags2["StructuredOrInstantiable"] =
|
|
6680
|
+
TypeFlags2[TypeFlags2["Instantiable"] = 1002700800] = "Instantiable";
|
|
6681
|
+
TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 1006370816] = "StructuredOrInstantiable";
|
|
6681
6682
|
TypeFlags2[TypeFlags2["ObjectFlagsType"] = 3899393] = "ObjectFlagsType";
|
|
6682
6683
|
TypeFlags2[TypeFlags2["Simplifiable"] = 25165824] = "Simplifiable";
|
|
6683
6684
|
TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton";
|
|
6684
|
-
TypeFlags2[TypeFlags2["Narrowable"] =
|
|
6685
|
+
TypeFlags2[TypeFlags2["Narrowable"] = 1073495039] = "Narrowable";
|
|
6685
6686
|
TypeFlags2[TypeFlags2["IncludesMask"] = 473694207] = "IncludesMask";
|
|
6686
6687
|
TypeFlags2[TypeFlags2["IncludesMissingType"] = 262144 /* TypeParameter */] = "IncludesMissingType";
|
|
6687
6688
|
TypeFlags2[TypeFlags2["IncludesNonWideningType"] = 4194304 /* Index */] = "IncludesNonWideningType";
|
|
@@ -32734,8 +32735,7 @@ var Parser;
|
|
|
32734
32735
|
function parseJSDocFunctionType() {
|
|
32735
32736
|
const pos = getNodePos();
|
|
32736
32737
|
const hasJSDoc = hasPrecedingJSDocComment();
|
|
32737
|
-
if (
|
|
32738
|
-
nextToken();
|
|
32738
|
+
if (tryParse(nextTokenIsOpenParen)) {
|
|
32739
32739
|
const parameters = parseParameters(4 /* Type */ | 32 /* JSDoc */);
|
|
32740
32740
|
const type = parseReturnType(
|
|
32741
32741
|
59 /* ColonToken */,
|
|
@@ -47962,7 +47962,7 @@ var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
|
|
47962
47962
|
return SignatureCheckMode3;
|
|
47963
47963
|
})(SignatureCheckMode || {});
|
|
47964
47964
|
var isNotOverloadAndNotAccessor = and(isNotOverload, isNotAccessor);
|
|
47965
|
-
var
|
|
47965
|
+
var stringMappingTypeKinds = new Map(Object.entries({
|
|
47966
47966
|
Uppercase: 0 /* Uppercase */,
|
|
47967
47967
|
Lowercase: 1 /* Lowercase */,
|
|
47968
47968
|
Capitalize: 2 /* Capitalize */,
|
|
@@ -48519,7 +48519,7 @@ function createTypeChecker(host) {
|
|
|
48519
48519
|
var enumLiteralTypes = /* @__PURE__ */ new Map();
|
|
48520
48520
|
var indexedAccessTypes = /* @__PURE__ */ new Map();
|
|
48521
48521
|
var templateLiteralTypes = /* @__PURE__ */ new Map();
|
|
48522
|
-
var
|
|
48522
|
+
var intrinsicWrapperTypes = /* @__PURE__ */ new Map();
|
|
48523
48523
|
var substitutionTypes = /* @__PURE__ */ new Map();
|
|
48524
48524
|
var subtypeReductionCache = /* @__PURE__ */ new Map();
|
|
48525
48525
|
var decoratorContextOverrideTypeCache = /* @__PURE__ */ new Map();
|
|
@@ -52795,6 +52795,10 @@ function createTypeChecker(host) {
|
|
|
52795
52795
|
const typeNode = typeToTypeNodeHelper(type.type, context);
|
|
52796
52796
|
return symbolToTypeNode(type.symbol, context, 788968 /* Type */, [typeNode]);
|
|
52797
52797
|
}
|
|
52798
|
+
if (type.flags & 536870912 /* NoInfer */) {
|
|
52799
|
+
const typeNode = typeToTypeNodeHelper(type.type, context);
|
|
52800
|
+
return symbolToTypeNode(type.symbol, context, 788968 /* Type */, [typeNode]);
|
|
52801
|
+
}
|
|
52798
52802
|
if (type.flags & 8388608 /* IndexedAccess */) {
|
|
52799
52803
|
const objectTypeNode = typeToTypeNodeHelper(type.objectType, context);
|
|
52800
52804
|
const indexTypeNode = typeToTypeNodeHelper(type.indexType, context);
|
|
@@ -56498,10 +56502,10 @@ function createTypeChecker(host) {
|
|
|
56498
56502
|
return result;
|
|
56499
56503
|
}
|
|
56500
56504
|
function isGenericTypeWithUndefinedConstraint(type) {
|
|
56501
|
-
return !!(type.flags &
|
|
56505
|
+
return !!(type.flags & 1002700800 /* Instantiable */) && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 32768 /* Undefined */);
|
|
56502
56506
|
}
|
|
56503
56507
|
function getNonUndefinedType(type) {
|
|
56504
|
-
const typeOrConstraint = someType(type, isGenericTypeWithUndefinedConstraint) ? mapType(type, (t) => t.flags &
|
|
56508
|
+
const typeOrConstraint = someType(type, isGenericTypeWithUndefinedConstraint) ? mapType(type, (t) => t.flags & 1002700800 /* Instantiable */ ? getBaseConstraintOrType(t) : t) : type;
|
|
56505
56509
|
return getTypeWithFacts(typeOrConstraint, 524288 /* NEUndefined */);
|
|
56506
56510
|
}
|
|
56507
56511
|
function getFlowTypeOfDestructuring(node, declaredType) {
|
|
@@ -56599,7 +56603,7 @@ function createTypeChecker(host) {
|
|
|
56599
56603
|
const elementType = checkIteratedTypeOrElementType(65 /* Destructuring */ | (declaration.dotDotDotToken ? 0 : 128 /* PossiblyOutOfBounds */), parentType, undefinedType, pattern);
|
|
56600
56604
|
const index = pattern.elements.indexOf(declaration);
|
|
56601
56605
|
if (declaration.dotDotDotToken) {
|
|
56602
|
-
const baseConstraint = mapType(parentType, (t) => t.flags &
|
|
56606
|
+
const baseConstraint = mapType(parentType, (t) => t.flags & 595853312 /* InstantiableNonPrimitive */ ? getBaseConstraintOrType(t) : t);
|
|
56603
56607
|
type = everyType(baseConstraint, isTupleType) ? mapType(baseConstraint, (t) => sliceTupleType(t, index)) : createArrayType(elementType);
|
|
56604
56608
|
} else if (isArrayLikeType(parentType)) {
|
|
56605
56609
|
const indexType = getNumberLiteralType(index);
|
|
@@ -59398,7 +59402,7 @@ function createTypeChecker(host) {
|
|
|
59398
59402
|
let constraints;
|
|
59399
59403
|
let hasDisjointDomainType = false;
|
|
59400
59404
|
for (const t of types) {
|
|
59401
|
-
if (t.flags &
|
|
59405
|
+
if (t.flags & 1002700800 /* Instantiable */) {
|
|
59402
59406
|
let constraint = getConstraintOfType(t);
|
|
59403
59407
|
while (constraint && constraint.flags & (262144 /* TypeParameter */ | 4194304 /* Index */ | 16777216 /* Conditional */)) {
|
|
59404
59408
|
constraint = getConstraintOfType(constraint);
|
|
@@ -59430,7 +59434,7 @@ function createTypeChecker(host) {
|
|
|
59430
59434
|
return void 0;
|
|
59431
59435
|
}
|
|
59432
59436
|
function getBaseConstraintOfType(type) {
|
|
59433
|
-
if (type.flags & (
|
|
59437
|
+
if (type.flags & (595853312 /* InstantiableNonPrimitive */ | 3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || isGenericTupleType(type)) {
|
|
59434
59438
|
const constraint = getResolvedBaseConstraint(type);
|
|
59435
59439
|
return constraint !== noConstraintType && constraint !== circularConstraintType ? constraint : void 0;
|
|
59436
59440
|
}
|
|
@@ -59521,6 +59525,9 @@ function createTypeChecker(host) {
|
|
|
59521
59525
|
const constraint = getBaseConstraint(t.type);
|
|
59522
59526
|
return constraint && constraint !== t.type ? getStringMappingType(t.symbol, constraint) : stringType;
|
|
59523
59527
|
}
|
|
59528
|
+
if (t.flags & 536870912 /* NoInfer */) {
|
|
59529
|
+
return getBaseConstraint(t.type);
|
|
59530
|
+
}
|
|
59524
59531
|
if (t.flags & 8388608 /* IndexedAccess */) {
|
|
59525
59532
|
if (isMappedTypeGenericIndexedAccess(t)) {
|
|
59526
59533
|
return getBaseConstraint(substituteIndexedMappedType(t.objectType, t.indexType));
|
|
@@ -59601,7 +59608,7 @@ function createTypeChecker(host) {
|
|
|
59601
59608
|
return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
|
|
59602
59609
|
}
|
|
59603
59610
|
function getApparentType(type) {
|
|
59604
|
-
const t = type.flags &
|
|
59611
|
+
const t = type.flags & 1002700800 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
|
|
59605
59612
|
const objectFlags = getObjectFlags(t);
|
|
59606
59613
|
return objectFlags & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : objectFlags & 4 /* Reference */ && t !== type ? getTypeWithThisArgument(t, type) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t, type) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? keyofConstraintType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t;
|
|
59607
59614
|
}
|
|
@@ -60710,8 +60717,11 @@ function createTypeChecker(host) {
|
|
|
60710
60717
|
}
|
|
60711
60718
|
function getTypeAliasInstantiation(symbol, typeArguments, aliasSymbol, aliasTypeArguments) {
|
|
60712
60719
|
const type = getDeclaredTypeOfSymbol(symbol);
|
|
60713
|
-
if (type === intrinsicMarkerType &&
|
|
60714
|
-
|
|
60720
|
+
if (type === intrinsicMarkerType && typeArguments && typeArguments.length === 1) {
|
|
60721
|
+
if (stringMappingTypeKinds.has(symbol.escapedName)) {
|
|
60722
|
+
return getStringMappingType(symbol, typeArguments[0]);
|
|
60723
|
+
}
|
|
60724
|
+
return getNoInferType(symbol, typeArguments[0]);
|
|
60715
60725
|
}
|
|
60716
60726
|
const links = getSymbolLinks(symbol);
|
|
60717
60727
|
const typeParameters = links.typeParameters;
|
|
@@ -61625,7 +61635,7 @@ function createTypeChecker(host) {
|
|
|
61625
61635
|
const type = elementTypes[i];
|
|
61626
61636
|
const flags = target.elementFlags[i];
|
|
61627
61637
|
if (flags & 8 /* Variadic */) {
|
|
61628
|
-
if (type.flags &
|
|
61638
|
+
if (type.flags & 595853312 /* InstantiableNonPrimitive */ || isGenericMappedType(type)) {
|
|
61629
61639
|
addElement(type, 8 /* Variadic */, (_a = target.labeledElementDeclarations) == null ? void 0 : _a[i]);
|
|
61630
61640
|
} else if (isTupleType(type)) {
|
|
61631
61641
|
const elements = getElementTypes(type);
|
|
@@ -61732,7 +61742,7 @@ function createTypeChecker(host) {
|
|
|
61732
61742
|
const flags = type.flags;
|
|
61733
61743
|
if (!(flags & 131072 /* Never */)) {
|
|
61734
61744
|
includes |= flags & 473694207 /* IncludesMask */;
|
|
61735
|
-
if (flags &
|
|
61745
|
+
if (flags & 1002700800 /* Instantiable */)
|
|
61736
61746
|
includes |= 33554432 /* IncludesInstantiable */;
|
|
61737
61747
|
if (flags & 2097152 /* Intersection */ && getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */)
|
|
61738
61748
|
includes |= 268435456 /* IncludesConstrainedTypeVariable */;
|
|
@@ -61778,14 +61788,14 @@ function createTypeChecker(host) {
|
|
|
61778
61788
|
while (i > 0) {
|
|
61779
61789
|
i--;
|
|
61780
61790
|
const source = types[i];
|
|
61781
|
-
if (hasEmptyObject || source.flags &
|
|
61791
|
+
if (hasEmptyObject || source.flags & 1006370816 /* StructuredOrInstantiable */) {
|
|
61782
61792
|
if (source.flags & 262144 /* TypeParameter */ && getBaseConstraintOrType(source).flags & 1048576 /* Union */) {
|
|
61783
61793
|
if (isTypeRelatedTo(source, getUnionType(map(types, (t) => t === source ? neverType : t)), strictSubtypeRelation)) {
|
|
61784
61794
|
orderedRemoveItemAt(types, i);
|
|
61785
61795
|
}
|
|
61786
61796
|
continue;
|
|
61787
61797
|
}
|
|
61788
|
-
const keyProperty = source.flags & (524288 /* Object */ | 2097152 /* Intersection */ |
|
|
61798
|
+
const keyProperty = source.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 595853312 /* InstantiableNonPrimitive */) ? find(getPropertiesOfType(source), (p) => isUnitType(getTypeOfSymbol(p))) : void 0;
|
|
61789
61799
|
const keyPropertyType = keyProperty && getRegularTypeOfLiteralType(getTypeOfSymbol(keyProperty));
|
|
61790
61800
|
for (const target of types) {
|
|
61791
61801
|
if (source !== target) {
|
|
@@ -61798,7 +61808,7 @@ function createTypeChecker(host) {
|
|
|
61798
61808
|
}
|
|
61799
61809
|
}
|
|
61800
61810
|
count++;
|
|
61801
|
-
if (keyProperty && target.flags & (524288 /* Object */ | 2097152 /* Intersection */ |
|
|
61811
|
+
if (keyProperty && target.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 595853312 /* InstantiableNonPrimitive */)) {
|
|
61802
61812
|
const t = getTypeOfPropertyOfType(target, keyProperty.escapedName);
|
|
61803
61813
|
if (t && isUnitType(t) && getRegularTypeOfLiteralType(t) !== keyPropertyType) {
|
|
61804
61814
|
continue;
|
|
@@ -62398,7 +62408,7 @@ function createTypeChecker(host) {
|
|
|
62398
62408
|
);
|
|
62399
62409
|
}
|
|
62400
62410
|
function shouldDeferIndexType(type, indexFlags = 0 /* None */) {
|
|
62401
|
-
return !!(type.flags &
|
|
62411
|
+
return !!(type.flags & 595853312 /* 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, 1002700800 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType));
|
|
62402
62412
|
}
|
|
62403
62413
|
function getIndexType(type, indexFlags = defaultIndexFlags) {
|
|
62404
62414
|
type = getReducedType(type);
|
|
@@ -62516,8 +62526,19 @@ function createTypeChecker(host) {
|
|
|
62516
62526
|
)
|
|
62517
62527
|
);
|
|
62518
62528
|
}
|
|
62529
|
+
function getNoInferType(symbol, type) {
|
|
62530
|
+
if (!isGenericType(type)) {
|
|
62531
|
+
return type;
|
|
62532
|
+
}
|
|
62533
|
+
const id = `${getSymbolId(symbol)},${getTypeId(type)}`;
|
|
62534
|
+
let result = intrinsicWrapperTypes.get(id);
|
|
62535
|
+
if (!result) {
|
|
62536
|
+
intrinsicWrapperTypes.set(id, result = createNoInferType(symbol, type));
|
|
62537
|
+
}
|
|
62538
|
+
return result;
|
|
62539
|
+
}
|
|
62519
62540
|
function applyStringMapping(symbol, str) {
|
|
62520
|
-
switch (
|
|
62541
|
+
switch (stringMappingTypeKinds.get(symbol.escapedName)) {
|
|
62521
62542
|
case 0 /* Uppercase */:
|
|
62522
62543
|
return str.toUpperCase();
|
|
62523
62544
|
case 1 /* Lowercase */:
|
|
@@ -62530,7 +62551,7 @@ function createTypeChecker(host) {
|
|
|
62530
62551
|
return str;
|
|
62531
62552
|
}
|
|
62532
62553
|
function applyTemplateStringMapping(symbol, texts, types) {
|
|
62533
|
-
switch (
|
|
62554
|
+
switch (stringMappingTypeKinds.get(symbol.escapedName)) {
|
|
62534
62555
|
case 0 /* Uppercase */:
|
|
62535
62556
|
return [texts.map((t) => t.toUpperCase()), types.map((t) => getStringMappingType(symbol, t))];
|
|
62536
62557
|
case 1 /* Lowercase */:
|
|
@@ -62544,9 +62565,9 @@ function createTypeChecker(host) {
|
|
|
62544
62565
|
}
|
|
62545
62566
|
function getStringMappingTypeForGenericType(symbol, type) {
|
|
62546
62567
|
const id = `${getSymbolId(symbol)},${getTypeId(type)}`;
|
|
62547
|
-
let result =
|
|
62568
|
+
let result = intrinsicWrapperTypes.get(id);
|
|
62548
62569
|
if (!result) {
|
|
62549
|
-
|
|
62570
|
+
intrinsicWrapperTypes.set(id, result = createStringMappingType(symbol, type));
|
|
62550
62571
|
}
|
|
62551
62572
|
return result;
|
|
62552
62573
|
}
|
|
@@ -62555,6 +62576,11 @@ function createTypeChecker(host) {
|
|
|
62555
62576
|
result.type = type;
|
|
62556
62577
|
return result;
|
|
62557
62578
|
}
|
|
62579
|
+
function createNoInferType(symbol, type) {
|
|
62580
|
+
const result = createTypeWithSymbol(536870912 /* NoInfer */, symbol);
|
|
62581
|
+
result.type = type;
|
|
62582
|
+
return result;
|
|
62583
|
+
}
|
|
62558
62584
|
function createIndexedAccessType(objectType, indexType, accessFlags, aliasSymbol, aliasTypeArguments) {
|
|
62559
62585
|
const type = createType(8388608 /* IndexedAccess */);
|
|
62560
62586
|
type.objectType = objectType;
|
|
@@ -62577,7 +62603,7 @@ function createTypeChecker(host) {
|
|
|
62577
62603
|
if (type.flags & 2097152 /* Intersection */) {
|
|
62578
62604
|
return some(type.types, isJSLiteralType);
|
|
62579
62605
|
}
|
|
62580
|
-
if (type.flags &
|
|
62606
|
+
if (type.flags & 1002700800 /* Instantiable */) {
|
|
62581
62607
|
const constraint = getResolvedBaseConstraint(type);
|
|
62582
62608
|
return constraint !== type && isJSLiteralType(constraint);
|
|
62583
62609
|
}
|
|
@@ -62834,7 +62860,7 @@ function createTypeChecker(host) {
|
|
|
62834
62860
|
}
|
|
62835
62861
|
return type.objectFlags & 12582912 /* IsGenericType */;
|
|
62836
62862
|
}
|
|
62837
|
-
return (type.flags &
|
|
62863
|
+
return (type.flags & 595853312 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (595853312 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
|
|
62838
62864
|
}
|
|
62839
62865
|
function getSimplifiedType(type, writing) {
|
|
62840
62866
|
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
|
|
@@ -62863,7 +62889,7 @@ function createTypeChecker(host) {
|
|
|
62863
62889
|
if (distributedOverIndex) {
|
|
62864
62890
|
return type[cache] = distributedOverIndex;
|
|
62865
62891
|
}
|
|
62866
|
-
if (!(indexType.flags &
|
|
62892
|
+
if (!(indexType.flags & 1002700800 /* Instantiable */)) {
|
|
62867
62893
|
const distributedOverObject = distributeIndexOverObjectType(objectType, indexType, writing);
|
|
62868
62894
|
if (distributedOverObject) {
|
|
62869
62895
|
return type[cache] = distributedOverObject;
|
|
@@ -63940,7 +63966,7 @@ function createTypeChecker(host) {
|
|
|
63940
63966
|
return mapTypeWithAlias(
|
|
63941
63967
|
getReducedType(mappedTypeVariable),
|
|
63942
63968
|
(t) => {
|
|
63943
|
-
if (t.flags & (3 /* AnyOrUnknown */ |
|
|
63969
|
+
if (t.flags & (3 /* AnyOrUnknown */ | 595853312 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
|
|
63944
63970
|
if (!type.declaration.nameType) {
|
|
63945
63971
|
let constraint;
|
|
63946
63972
|
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
|
|
@@ -64112,6 +64138,9 @@ function createTypeChecker(host) {
|
|
|
64112
64138
|
if (flags & 268435456 /* StringMapping */) {
|
|
64113
64139
|
return getStringMappingType(type.symbol, instantiateType(type.type, mapper));
|
|
64114
64140
|
}
|
|
64141
|
+
if (flags & 536870912 /* NoInfer */) {
|
|
64142
|
+
return getNoInferType(type.symbol, instantiateType(type.type, mapper));
|
|
64143
|
+
}
|
|
64115
64144
|
if (flags & 8388608 /* IndexedAccess */) {
|
|
64116
64145
|
const newAliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
64117
64146
|
const newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
|
|
@@ -64271,7 +64300,7 @@ function createTypeChecker(host) {
|
|
|
64271
64300
|
return isTypeRelatedTo(source, target, assignableRelation);
|
|
64272
64301
|
}
|
|
64273
64302
|
function isTypeDerivedFrom(source, target) {
|
|
64274
|
-
return source.flags & 1048576 /* Union */ ? every(source.types, (t) => isTypeDerivedFrom(t, target)) : target.flags & 1048576 /* Union */ ? some(target.types, (t) => isTypeDerivedFrom(source, t)) : source.flags & 2097152 /* Intersection */ ? some(source.types, (t) => isTypeDerivedFrom(t, target)) : source.flags &
|
|
64303
|
+
return source.flags & 1048576 /* Union */ ? every(source.types, (t) => isTypeDerivedFrom(t, target)) : target.flags & 1048576 /* Union */ ? some(target.types, (t) => isTypeDerivedFrom(source, t)) : source.flags & 2097152 /* Intersection */ ? some(source.types, (t) => isTypeDerivedFrom(t, target)) : source.flags & 595853312 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) : isEmptyAnonymousObjectType(target) ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) : target === globalObjectType ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) && !isEmptyAnonymousObjectType(source) : target === globalFunctionType ? !!(source.flags & 524288 /* Object */) && isFunctionObjectType(source) : hasBaseType(source, getTargetType(target)) || isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType);
|
|
64275
64304
|
}
|
|
64276
64305
|
function isTypeComparableTo(source, target) {
|
|
64277
64306
|
return isTypeRelatedTo(source, target, comparableRelation);
|
|
@@ -65150,7 +65179,7 @@ function createTypeChecker(host) {
|
|
|
65150
65179
|
return !!(related & 1 /* Succeeded */);
|
|
65151
65180
|
}
|
|
65152
65181
|
}
|
|
65153
|
-
if (source.flags &
|
|
65182
|
+
if (source.flags & 1006370816 /* StructuredOrInstantiable */ || target.flags & 1006370816 /* StructuredOrInstantiable */) {
|
|
65154
65183
|
return checkTypeRelatedTo(
|
|
65155
65184
|
source,
|
|
65156
65185
|
target,
|
|
@@ -65166,7 +65195,7 @@ function createTypeChecker(host) {
|
|
|
65166
65195
|
}
|
|
65167
65196
|
function getNormalizedType(type, writing) {
|
|
65168
65197
|
while (true) {
|
|
65169
|
-
const t = isFreshLiteralType(type) ? type.regularType : isGenericTupleType(type) ? getNormalizedTupleType(type, writing) : getObjectFlags(type) & 4 /* Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 /* UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) : type.flags & 33554432 /* Substitution */ ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(type, writing) : type;
|
|
65198
|
+
const t = isFreshLiteralType(type) ? type.regularType : isGenericTupleType(type) ? getNormalizedTupleType(type, writing) : getObjectFlags(type) & 4 /* Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 /* UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) : type.flags & 33554432 /* Substitution */ ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(type, writing) : type.flags & 536870912 /* NoInfer */ ? type.type : type;
|
|
65170
65199
|
if (t === type)
|
|
65171
65200
|
return t;
|
|
65172
65201
|
type = t;
|
|
@@ -65555,7 +65584,7 @@ function createTypeChecker(host) {
|
|
|
65555
65584
|
}
|
|
65556
65585
|
if (relation === comparableRelation && !(target2.flags & 131072 /* Never */) && isSimpleTypeRelatedTo(target2, source2, relation) || isSimpleTypeRelatedTo(source2, target2, relation, reportErrors2 ? reportError : void 0))
|
|
65557
65586
|
return -1 /* True */;
|
|
65558
|
-
if (source2.flags &
|
|
65587
|
+
if (source2.flags & 1006370816 /* StructuredOrInstantiable */ || target2.flags & 1006370816 /* StructuredOrInstantiable */) {
|
|
65559
65588
|
const isPerformingExcessPropertyChecks = !(intersectionState & 2 /* Target */) && (isObjectLiteralType2(source2) && getObjectFlags(source2) & 8192 /* FreshLiteral */);
|
|
65560
65589
|
if (isPerformingExcessPropertyChecks) {
|
|
65561
65590
|
if (hasExcessProperties(source2, target2, reportErrors2)) {
|
|
@@ -65594,7 +65623,7 @@ function createTypeChecker(host) {
|
|
|
65594
65623
|
return 0 /* False */;
|
|
65595
65624
|
}
|
|
65596
65625
|
traceUnionsOrIntersectionsTooLarge(source2, target2);
|
|
65597
|
-
const skipCaching = source2.flags & 1048576 /* Union */ && source2.types.length < 4 && !(target2.flags & 1048576 /* Union */) || target2.flags & 1048576 /* Union */ && target2.types.length < 4 && !(source2.flags &
|
|
65626
|
+
const skipCaching = source2.flags & 1048576 /* Union */ && source2.types.length < 4 && !(target2.flags & 1048576 /* Union */) || target2.flags & 1048576 /* Union */ && target2.types.length < 4 && !(source2.flags & 1006370816 /* StructuredOrInstantiable */);
|
|
65598
65627
|
const result2 = skipCaching ? unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) : recursiveTypeRelatedTo(source2, target2, reportErrors2, intersectionState, recursionFlags);
|
|
65599
65628
|
if (result2) {
|
|
65600
65629
|
return result2;
|
|
@@ -65783,7 +65812,7 @@ function createTypeChecker(host) {
|
|
|
65783
65812
|
return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
|
|
65784
65813
|
}
|
|
65785
65814
|
if (relation === comparableRelation && target2.flags & 402784252 /* Primitive */) {
|
|
65786
|
-
const constraints = sameMap(source2.types, (t) => t.flags &
|
|
65815
|
+
const constraints = sameMap(source2.types, (t) => t.flags & 1002700800 /* Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t);
|
|
65787
65816
|
if (constraints !== source2.types) {
|
|
65788
65817
|
source2 = getIntersectionType(constraints);
|
|
65789
65818
|
if (source2.flags & 131072 /* Never */) {
|
|
@@ -66375,7 +66404,7 @@ function createTypeChecker(host) {
|
|
|
66375
66404
|
if (result2 = unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState)) {
|
|
66376
66405
|
return result2;
|
|
66377
66406
|
}
|
|
66378
|
-
if (!(sourceFlags &
|
|
66407
|
+
if (!(sourceFlags & 1002700800 /* Instantiable */ || sourceFlags & 524288 /* Object */ && targetFlags & 1048576 /* Union */ || sourceFlags & 2097152 /* Intersection */ && targetFlags & (524288 /* Object */ | 1048576 /* Union */ | 1002700800 /* Instantiable */))) {
|
|
66379
66408
|
return 0 /* False */;
|
|
66380
66409
|
}
|
|
66381
66410
|
}
|
|
@@ -67538,7 +67567,7 @@ function createTypeChecker(host) {
|
|
|
67538
67567
|
if (type.flags & 3145728 /* UnionOrIntersection */) {
|
|
67539
67568
|
return !!forEach(type.types, typeCouldHaveTopLevelSingletonTypes);
|
|
67540
67569
|
}
|
|
67541
|
-
if (type.flags &
|
|
67570
|
+
if (type.flags & 1002700800 /* Instantiable */) {
|
|
67542
67571
|
const constraint = getConstraintOfType(type);
|
|
67543
67572
|
if (constraint && constraint !== type) {
|
|
67544
67573
|
return typeCouldHaveTopLevelSingletonTypes(constraint);
|
|
@@ -68595,7 +68624,7 @@ function createTypeChecker(host) {
|
|
|
68595
68624
|
if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
|
|
68596
68625
|
return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
|
|
68597
68626
|
}
|
|
68598
|
-
const result = !!(type.flags &
|
|
68627
|
+
const result = !!(type.flags & 1002700800 /* 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));
|
|
68599
68628
|
if (type.flags & 3899393 /* ObjectFlagsType */) {
|
|
68600
68629
|
type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
|
|
68601
68630
|
}
|
|
@@ -68887,7 +68916,7 @@ function createTypeChecker(host) {
|
|
|
68887
68916
|
let expandingFlags = 0 /* None */;
|
|
68888
68917
|
inferFromTypes(originalSource, originalTarget);
|
|
68889
68918
|
function inferFromTypes(source, target) {
|
|
68890
|
-
if (!couldContainTypeVariables(target)) {
|
|
68919
|
+
if (!couldContainTypeVariables(target) || source.flags & 536870912 /* NoInfer */) {
|
|
68891
68920
|
return;
|
|
68892
68921
|
}
|
|
68893
68922
|
if (source === wildcardType || source === blockedStringType) {
|
|
@@ -68990,7 +69019,7 @@ function createTypeChecker(host) {
|
|
|
68990
69019
|
/*writing*/
|
|
68991
69020
|
false
|
|
68992
69021
|
);
|
|
68993
|
-
if (indexType.flags &
|
|
69022
|
+
if (indexType.flags & 1002700800 /* Instantiable */) {
|
|
68994
69023
|
const simplified2 = distributeIndexOverObjectType(
|
|
68995
69024
|
getSimplifiedType(
|
|
68996
69025
|
target.objectType,
|
|
@@ -69037,7 +69066,7 @@ function createTypeChecker(host) {
|
|
|
69037
69066
|
inferToTemplateLiteralType(source, target);
|
|
69038
69067
|
} else {
|
|
69039
69068
|
source = getReducedType(source);
|
|
69040
|
-
if (!(priority & 512 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ |
|
|
69069
|
+
if (!(priority & 512 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ | 1002700800 /* Instantiable */))) {
|
|
69041
69070
|
const apparentSource = getApparentType(source);
|
|
69042
69071
|
if (apparentSource !== source && !(apparentSource.flags & (524288 /* Object */ | 2097152 /* Intersection */))) {
|
|
69043
69072
|
return inferFromTypes(apparentSource, target);
|
|
@@ -69780,7 +69809,7 @@ function createTypeChecker(host) {
|
|
|
69780
69809
|
const map2 = /* @__PURE__ */ new Map();
|
|
69781
69810
|
let count = 0;
|
|
69782
69811
|
for (const type of types) {
|
|
69783
|
-
if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ |
|
|
69812
|
+
if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 595853312 /* InstantiableNonPrimitive */)) {
|
|
69784
69813
|
const discriminant = getTypeOfPropertyOfType(type, name);
|
|
69785
69814
|
if (discriminant) {
|
|
69786
69815
|
if (!isLiteralType(discriminant)) {
|
|
@@ -69806,11 +69835,11 @@ function createTypeChecker(host) {
|
|
|
69806
69835
|
}
|
|
69807
69836
|
function getKeyPropertyName(unionType) {
|
|
69808
69837
|
const types = unionType.types;
|
|
69809
|
-
if (types.length < 10 || getObjectFlags(unionType) & 32768 /* PrimitiveUnion */ || countWhere(types, (t) => !!(t.flags & (524288 /* Object */ |
|
|
69838
|
+
if (types.length < 10 || getObjectFlags(unionType) & 32768 /* PrimitiveUnion */ || countWhere(types, (t) => !!(t.flags & (524288 /* Object */ | 595853312 /* InstantiableNonPrimitive */))) < 10) {
|
|
69810
69839
|
return void 0;
|
|
69811
69840
|
}
|
|
69812
69841
|
if (unionType.keyPropertyName === void 0) {
|
|
69813
|
-
const keyPropertyName = forEach(types, (t) => t.flags & (524288 /* Object */ |
|
|
69842
|
+
const keyPropertyName = forEach(types, (t) => t.flags & (524288 /* Object */ | 595853312 /* InstantiableNonPrimitive */) ? forEach(getPropertiesOfType(t), (p) => isUnitType(getTypeOfSymbol(p)) ? p.escapedName : void 0) : void 0);
|
|
69814
69843
|
const mapByKeyProperty = keyPropertyName && mapTypesByKeyProperty(types, keyPropertyName);
|
|
69815
69844
|
unionType.keyPropertyName = mapByKeyProperty ? keyPropertyName : "";
|
|
69816
69845
|
unionType.constituentMap = mapByKeyProperty;
|
|
@@ -69893,7 +69922,7 @@ function createTypeChecker(host) {
|
|
|
69893
69922
|
return getTypeFacts(type, mask2) !== 0;
|
|
69894
69923
|
}
|
|
69895
69924
|
function getTypeFactsWorker(type, callerOnlyNeeds) {
|
|
69896
|
-
if (type.flags & (2097152 /* Intersection */ |
|
|
69925
|
+
if (type.flags & (2097152 /* Intersection */ | 1002700800 /* Instantiable */)) {
|
|
69897
69926
|
type = getBaseConstraintOfType(type) || unknownType;
|
|
69898
69927
|
}
|
|
69899
69928
|
const flags = type.flags;
|
|
@@ -71521,7 +71550,7 @@ function createTypeChecker(host) {
|
|
|
71521
71550
|
matching || type,
|
|
71522
71551
|
checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeStrictSubtypeOf(t, c) ? t : isTypeStrictSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : isTypeSubtypeOf(c, t) ? c : neverType
|
|
71523
71552
|
);
|
|
71524
|
-
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t,
|
|
71553
|
+
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 1002700800 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
|
|
71525
71554
|
});
|
|
71526
71555
|
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
|
|
71527
71556
|
}
|
|
@@ -71709,10 +71738,10 @@ function createTypeChecker(host) {
|
|
|
71709
71738
|
return parent2.kind === 211 /* PropertyAccessExpression */ || parent2.kind === 166 /* QualifiedName */ || parent2.kind === 213 /* CallExpression */ && parent2.expression === node || parent2.kind === 212 /* ElementAccessExpression */ && parent2.expression === node && !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent2.argumentExpression)));
|
|
71710
71739
|
}
|
|
71711
71740
|
function isGenericTypeWithUnionConstraint(type) {
|
|
71712
|
-
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithUnionConstraint) : !!(type.flags &
|
|
71741
|
+
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithUnionConstraint) : !!(type.flags & 1002700800 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
|
|
71713
71742
|
}
|
|
71714
71743
|
function isGenericTypeWithoutNullableConstraint(type) {
|
|
71715
|
-
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags &
|
|
71744
|
+
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 1002700800 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
|
|
71716
71745
|
}
|
|
71717
71746
|
function hasContextualTypeWithNoGenericTypes(node, checkMode) {
|
|
71718
71747
|
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 32 /* RestBindingElement */ ? getContextualType2(node, 8 /* SkipBindingPatterns */) : getContextualType2(
|
|
@@ -72609,7 +72638,7 @@ function createTypeChecker(host) {
|
|
|
72609
72638
|
const functionFlags = getFunctionFlags(functionDecl);
|
|
72610
72639
|
if (functionFlags & 1 /* Generator */) {
|
|
72611
72640
|
return filterType(returnType2, (t) => {
|
|
72612
|
-
return !!(t.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */ |
|
|
72641
|
+
return !!(t.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */ | 595853312 /* InstantiableNonPrimitive */)) || checkGeneratorInstantiationAssignabilityToReturnType(
|
|
72613
72642
|
t,
|
|
72614
72643
|
functionFlags,
|
|
72615
72644
|
/*errorNode*/
|
|
@@ -72619,7 +72648,7 @@ function createTypeChecker(host) {
|
|
|
72619
72648
|
}
|
|
72620
72649
|
if (functionFlags & 2 /* Async */) {
|
|
72621
72650
|
return filterType(returnType2, (t) => {
|
|
72622
|
-
return !!(t.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */ |
|
|
72651
|
+
return !!(t.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */ | 595853312 /* InstantiableNonPrimitive */)) || !!getAwaitedTypeOfPromise(t);
|
|
72623
72652
|
});
|
|
72624
72653
|
}
|
|
72625
72654
|
return returnType2;
|
|
@@ -73098,7 +73127,7 @@ function createTypeChecker(host) {
|
|
|
73098
73127
|
}
|
|
73099
73128
|
}
|
|
73100
73129
|
function instantiateContextualType(contextualType, node, contextFlags) {
|
|
73101
|
-
if (contextualType && maybeTypeOfKind(contextualType,
|
|
73130
|
+
if (contextualType && maybeTypeOfKind(contextualType, 1002700800 /* Instantiable */)) {
|
|
73102
73131
|
const inferenceContext = getInferenceContext(node);
|
|
73103
73132
|
if (inferenceContext && contextFlags & 1 /* Signature */ && some(inferenceContext.inferences, hasInferenceCandidatesOrDefault)) {
|
|
73104
73133
|
return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper);
|
|
@@ -73111,7 +73140,7 @@ function createTypeChecker(host) {
|
|
|
73111
73140
|
return contextualType;
|
|
73112
73141
|
}
|
|
73113
73142
|
function instantiateInstantiableTypes(type, mapper) {
|
|
73114
|
-
if (type.flags &
|
|
73143
|
+
if (type.flags & 1002700800 /* Instantiable */) {
|
|
73115
73144
|
return instantiateType(type, mapper);
|
|
73116
73145
|
}
|
|
73117
73146
|
if (type.flags & 1048576 /* Union */) {
|
|
@@ -73869,7 +73898,7 @@ function createTypeChecker(host) {
|
|
|
73869
73898
|
}
|
|
73870
73899
|
function isValidSpreadType(type) {
|
|
73871
73900
|
const t = removeDefinitelyFalsyTypes(mapType(type, getBaseConstraintOrType));
|
|
73872
|
-
return !!(t.flags & (1 /* Any */ | 67108864 /* NonPrimitive */ | 524288 /* Object */ |
|
|
73901
|
+
return !!(t.flags & (1 /* Any */ | 67108864 /* NonPrimitive */ | 524288 /* Object */ | 595853312 /* InstantiableNonPrimitive */) || t.flags & 3145728 /* UnionOrIntersection */ && every(t.types, isValidSpreadType));
|
|
73873
73902
|
}
|
|
73874
73903
|
function checkJsxSelfClosingElementDeferred(node) {
|
|
73875
73904
|
checkJsxOpeningLikeElementOrOpeningFragment(node);
|
|
@@ -77549,7 +77578,7 @@ function createTypeChecker(host) {
|
|
|
77549
77578
|
result3.node = node;
|
|
77550
77579
|
return result3;
|
|
77551
77580
|
}
|
|
77552
|
-
} else if (type2.flags &
|
|
77581
|
+
} else if (type2.flags & 595853312 /* InstantiableNonPrimitive */) {
|
|
77553
77582
|
const constraint = getBaseConstraintOfType(type2);
|
|
77554
77583
|
if (constraint) {
|
|
77555
77584
|
const instantiated = getInstantiatedTypePart(constraint);
|
|
@@ -79912,7 +79941,7 @@ function createTypeChecker(host) {
|
|
|
79912
79941
|
return evaluated ? getFreshTypeOfLiteralType(getStringLiteralType(evaluated)) : stringType;
|
|
79913
79942
|
}
|
|
79914
79943
|
function isTemplateLiteralContextualType(type) {
|
|
79915
|
-
return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags &
|
|
79944
|
+
return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 595853312 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
|
|
79916
79945
|
}
|
|
79917
79946
|
function getContextNode2(node) {
|
|
79918
79947
|
if (isJsxAttributes(node) && !isJsxSelfClosingElement(node.parent)) {
|
|
@@ -80025,7 +80054,7 @@ function createTypeChecker(host) {
|
|
|
80025
80054
|
const types = contextualType.types;
|
|
80026
80055
|
return some(types, (t) => isLiteralOfContextualType(candidateType, t));
|
|
80027
80056
|
}
|
|
80028
|
-
if (contextualType.flags &
|
|
80057
|
+
if (contextualType.flags & 595853312 /* InstantiableNonPrimitive */) {
|
|
80029
80058
|
const constraint = getBaseConstraintOfType(contextualType) || unknownType;
|
|
80030
80059
|
return maybeTypeOfKind(constraint, 4 /* String */) && maybeTypeOfKind(candidateType, 128 /* StringLiteral */) || maybeTypeOfKind(constraint, 8 /* Number */) && maybeTypeOfKind(candidateType, 256 /* NumberLiteral */) || maybeTypeOfKind(constraint, 64 /* BigInt */) && maybeTypeOfKind(candidateType, 2048 /* BigIntLiteral */) || maybeTypeOfKind(constraint, 4096 /* ESSymbol */) && maybeTypeOfKind(candidateType, 8192 /* UniqueESSymbol */) || isLiteralOfContextualType(candidateType, constraint);
|
|
80031
80060
|
}
|
|
@@ -83095,7 +83124,7 @@ function createTypeChecker(host) {
|
|
|
83095
83124
|
);
|
|
83096
83125
|
}
|
|
83097
83126
|
}
|
|
83098
|
-
if (rightType === neverType || !isTypeAssignableToKind(rightType, 67108864 /* NonPrimitive */ |
|
|
83127
|
+
if (rightType === neverType || !isTypeAssignableToKind(rightType, 67108864 /* NonPrimitive */ | 595853312 /* InstantiableNonPrimitive */)) {
|
|
83099
83128
|
error2(node.expression, Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0, typeToString(rightType));
|
|
83100
83129
|
}
|
|
83101
83130
|
checkSourceElement(node.statement);
|
|
@@ -84754,7 +84783,7 @@ function createTypeChecker(host) {
|
|
|
84754
84783
|
checkExportsOnMergedDeclarations(node);
|
|
84755
84784
|
checkTypeParameters(node.typeParameters);
|
|
84756
84785
|
if (node.type.kind === 141 /* IntrinsicKeyword */) {
|
|
84757
|
-
if (!
|
|
84786
|
+
if (!stringMappingTypeKinds.has(node.name.escapedText) && node.name.escapedText !== "NoInfer" || length(node.typeParameters) !== 1) {
|
|
84758
84787
|
error2(node.type, Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types);
|
|
84759
84788
|
}
|
|
84760
84789
|
} else {
|
|
@@ -84779,7 +84808,7 @@ function createTypeChecker(host) {
|
|
|
84779
84808
|
error2(member.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums);
|
|
84780
84809
|
} else {
|
|
84781
84810
|
const text = getTextOfPropertyName(member.name);
|
|
84782
|
-
if (isNumericLiteralName(text)
|
|
84811
|
+
if (isNumericLiteralName(text)) {
|
|
84783
84812
|
error2(member.name, Diagnostics.An_enum_member_cannot_have_a_numeric_name);
|
|
84784
84813
|
}
|
|
84785
84814
|
}
|
|
@@ -167624,16 +167653,16 @@ function getRenameInfoForModule(node, sourceFile, moduleSymbol) {
|
|
|
167624
167653
|
if (!moduleSourceFile)
|
|
167625
167654
|
return void 0;
|
|
167626
167655
|
const withoutIndex = endsWith(node.text, "/index") || endsWith(node.text, "/index.js") ? void 0 : tryRemoveSuffix(removeFileExtension(moduleSourceFile.fileName), "/index");
|
|
167627
|
-
const
|
|
167656
|
+
const name = withoutIndex === void 0 ? moduleSourceFile.fileName : withoutIndex;
|
|
167628
167657
|
const kind = withoutIndex === void 0 ? "module" /* moduleElement */ : "directory" /* directory */;
|
|
167629
167658
|
const indexAfterLastSlash = node.text.lastIndexOf("/") + 1;
|
|
167630
167659
|
const triggerSpan = createTextSpan(node.getStart(sourceFile) + 1 + indexAfterLastSlash, node.text.length - indexAfterLastSlash);
|
|
167631
167660
|
return {
|
|
167632
167661
|
canRename: true,
|
|
167633
|
-
fileToRename:
|
|
167662
|
+
fileToRename: name,
|
|
167634
167663
|
kind,
|
|
167635
|
-
displayName:
|
|
167636
|
-
fullDisplayName:
|
|
167664
|
+
displayName: name,
|
|
167665
|
+
fullDisplayName: name,
|
|
167637
167666
|
kindModifiers: "" /* none */,
|
|
167638
167667
|
triggerSpan
|
|
167639
167668
|
};
|
package/lib/typescript.d.ts
CHANGED
|
@@ -7107,6 +7107,7 @@ declare namespace ts {
|
|
|
7107
7107
|
NonPrimitive = 67108864,
|
|
7108
7108
|
TemplateLiteral = 134217728,
|
|
7109
7109
|
StringMapping = 268435456,
|
|
7110
|
+
NoInfer = 536870912,
|
|
7110
7111
|
Literal = 2944,
|
|
7111
7112
|
Unit = 109472,
|
|
7112
7113
|
Freshable = 2976,
|
|
@@ -7122,11 +7123,11 @@ declare namespace ts {
|
|
|
7122
7123
|
UnionOrIntersection = 3145728,
|
|
7123
7124
|
StructuredType = 3670016,
|
|
7124
7125
|
TypeVariable = 8650752,
|
|
7125
|
-
InstantiableNonPrimitive =
|
|
7126
|
+
InstantiableNonPrimitive = 595853312,
|
|
7126
7127
|
InstantiablePrimitive = 406847488,
|
|
7127
|
-
Instantiable =
|
|
7128
|
-
StructuredOrInstantiable =
|
|
7129
|
-
Narrowable =
|
|
7128
|
+
Instantiable = 1002700800,
|
|
7129
|
+
StructuredOrInstantiable = 1006370816,
|
|
7130
|
+
Narrowable = 1073495039,
|
|
7130
7131
|
}
|
|
7131
7132
|
type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
|
|
7132
7133
|
interface Type {
|
|
@@ -7321,6 +7322,10 @@ declare namespace ts {
|
|
|
7321
7322
|
symbol: Symbol;
|
|
7322
7323
|
type: Type;
|
|
7323
7324
|
}
|
|
7325
|
+
interface NoInferType extends InstantiableType {
|
|
7326
|
+
symbol: Symbol;
|
|
7327
|
+
type: Type;
|
|
7328
|
+
}
|
|
7324
7329
|
interface SubstitutionType extends InstantiableType {
|
|
7325
7330
|
objectFlags: ObjectFlags;
|
|
7326
7331
|
baseType: Type;
|