@typescript-deploys/pr-build 5.1.0-pr-50951-3 → 5.1.0-pr-52968-5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/lib/lib.es5.d.ts +5 -0
- package/lib/tsc.js +101 -75
- package/lib/tsserver.js +101 -75
- package/lib/tsserverlibrary.d.ts +10 -5
- package/lib/tsserverlibrary.js +102 -76
- package/lib/typescript.d.ts +10 -5
- package/lib/typescript.js +102 -76
- package/lib/typingsInstaller.js +23 -32
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -17,13 +17,13 @@ Find others who are using TypeScript at [our community page](https://www.typescr
|
|
|
17
17
|
For the latest stable version:
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
npm install -
|
|
20
|
+
npm install -D typescript
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
For our nightly builds:
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
|
-
npm install -
|
|
26
|
+
npm install -D typescript@next
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
## Contribute
|
package/lib/lib.es5.d.ts
CHANGED
|
@@ -1647,6 +1647,11 @@ type Capitalize<S extends string> = intrinsic;
|
|
|
1647
1647
|
*/
|
|
1648
1648
|
type Uncapitalize<S extends string> = intrinsic;
|
|
1649
1649
|
|
|
1650
|
+
/**
|
|
1651
|
+
* Blocks the contained type from participating in type inference.
|
|
1652
|
+
*/
|
|
1653
|
+
type NoInfer<T> = intrinsic;
|
|
1654
|
+
|
|
1650
1655
|
/**
|
|
1651
1656
|
* Marker for contextual 'this' type
|
|
1652
1657
|
*/
|
package/lib/tsc.js
CHANGED
|
@@ -3706,6 +3706,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
3706
3706
|
TypeFlags2[TypeFlags2["NonPrimitive"] = 67108864] = "NonPrimitive";
|
|
3707
3707
|
TypeFlags2[TypeFlags2["TemplateLiteral"] = 134217728] = "TemplateLiteral";
|
|
3708
3708
|
TypeFlags2[TypeFlags2["StringMapping"] = 268435456] = "StringMapping";
|
|
3709
|
+
TypeFlags2[TypeFlags2["NoInfer"] = 536870912] = "NoInfer";
|
|
3709
3710
|
TypeFlags2[TypeFlags2["AnyOrUnknown"] = 3] = "AnyOrUnknown";
|
|
3710
3711
|
TypeFlags2[TypeFlags2["Nullable"] = 98304] = "Nullable";
|
|
3711
3712
|
TypeFlags2[TypeFlags2["Literal"] = 2944] = "Literal";
|
|
@@ -3729,14 +3730,14 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
3729
3730
|
TypeFlags2[TypeFlags2["UnionOrIntersection"] = 3145728] = "UnionOrIntersection";
|
|
3730
3731
|
TypeFlags2[TypeFlags2["StructuredType"] = 3670016] = "StructuredType";
|
|
3731
3732
|
TypeFlags2[TypeFlags2["TypeVariable"] = 8650752] = "TypeVariable";
|
|
3732
|
-
TypeFlags2[TypeFlags2["InstantiableNonPrimitive"] =
|
|
3733
|
+
TypeFlags2[TypeFlags2["InstantiableNonPrimitive"] = 595853312] = "InstantiableNonPrimitive";
|
|
3733
3734
|
TypeFlags2[TypeFlags2["InstantiablePrimitive"] = 406847488] = "InstantiablePrimitive";
|
|
3734
|
-
TypeFlags2[TypeFlags2["Instantiable"] =
|
|
3735
|
-
TypeFlags2[TypeFlags2["StructuredOrInstantiable"] =
|
|
3735
|
+
TypeFlags2[TypeFlags2["Instantiable"] = 1002700800] = "Instantiable";
|
|
3736
|
+
TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 1006370816] = "StructuredOrInstantiable";
|
|
3736
3737
|
TypeFlags2[TypeFlags2["ObjectFlagsType"] = 3899393] = "ObjectFlagsType";
|
|
3737
3738
|
TypeFlags2[TypeFlags2["Simplifiable"] = 25165824] = "Simplifiable";
|
|
3738
3739
|
TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton";
|
|
3739
|
-
TypeFlags2[TypeFlags2["Narrowable"] =
|
|
3740
|
+
TypeFlags2[TypeFlags2["Narrowable"] = 1073495039] = "Narrowable";
|
|
3740
3741
|
TypeFlags2[TypeFlags2["IncludesMask"] = 473694207] = "IncludesMask";
|
|
3741
3742
|
TypeFlags2[TypeFlags2["IncludesMissingType"] = 262144 /* TypeParameter */] = "IncludesMissingType";
|
|
3742
3743
|
TypeFlags2[TypeFlags2["IncludesNonWideningType"] = 4194304 /* Index */] = "IncludesNonWideningType";
|
|
@@ -10281,36 +10282,32 @@ function getModifiers(node) {
|
|
|
10281
10282
|
return filter(node.modifiers, isModifier);
|
|
10282
10283
|
}
|
|
10283
10284
|
}
|
|
10284
|
-
function getJSDocParameterTagsWorker(
|
|
10285
|
-
|
|
10286
|
-
|
|
10287
|
-
|
|
10288
|
-
|
|
10289
|
-
|
|
10290
|
-
|
|
10291
|
-
|
|
10292
|
-
|
|
10293
|
-
|
|
10294
|
-
|
|
10295
|
-
|
|
10296
|
-
const i = signatureDeclaration.parameters.indexOf(declaration);
|
|
10297
|
-
Debug.assert(i > -1, "Parameters should always be in their parents' parameter list");
|
|
10298
|
-
if (i < length(jsDocParameterTags)) {
|
|
10299
|
-
return [jsDocParameterTags[i]];
|
|
10285
|
+
function getJSDocParameterTagsWorker(param, noCache) {
|
|
10286
|
+
if (param.name) {
|
|
10287
|
+
if (isIdentifier(param.name)) {
|
|
10288
|
+
const name = param.name.escapedText;
|
|
10289
|
+
return getJSDocTagsWorker(param.parent, noCache).filter((tag) => isJSDocParameterTag(tag) && isIdentifier(tag.name) && tag.name.escapedText === name);
|
|
10290
|
+
} else {
|
|
10291
|
+
const i = param.parent.parameters.indexOf(param);
|
|
10292
|
+
Debug.assert(i > -1, "Parameters should always be in their parents' parameter list");
|
|
10293
|
+
const paramTags = getJSDocTagsWorker(param.parent, noCache).filter(isJSDocParameterTag);
|
|
10294
|
+
if (i < paramTags.length) {
|
|
10295
|
+
return [paramTags[i]];
|
|
10296
|
+
}
|
|
10300
10297
|
}
|
|
10301
10298
|
}
|
|
10302
10299
|
return emptyArray;
|
|
10303
10300
|
}
|
|
10304
|
-
function getJSDocParameterTags(
|
|
10301
|
+
function getJSDocParameterTags(param) {
|
|
10305
10302
|
return getJSDocParameterTagsWorker(
|
|
10306
|
-
|
|
10303
|
+
param,
|
|
10307
10304
|
/*noCache*/
|
|
10308
10305
|
false
|
|
10309
10306
|
);
|
|
10310
10307
|
}
|
|
10311
|
-
function getJSDocParameterTagsNoCache(
|
|
10308
|
+
function getJSDocParameterTagsNoCache(param) {
|
|
10312
10309
|
return getJSDocParameterTagsWorker(
|
|
10313
|
-
|
|
10310
|
+
param,
|
|
10314
10311
|
/*noCache*/
|
|
10315
10312
|
true
|
|
10316
10313
|
);
|
|
@@ -13738,7 +13735,7 @@ function getJSDocCommentsAndTags(hostNode, noCache) {
|
|
|
13738
13735
|
if (hasJSDocNodes(node)) {
|
|
13739
13736
|
result = addRange(result, filterOwnedJSDocTags(hostNode, last(node.jsDoc)));
|
|
13740
13737
|
}
|
|
13741
|
-
if (node.kind === 167 /* Parameter */
|
|
13738
|
+
if (node.kind === 167 /* Parameter */) {
|
|
13742
13739
|
result = addRange(result, (noCache ? getJSDocParameterTagsNoCache : getJSDocParameterTags)(node));
|
|
13743
13740
|
break;
|
|
13744
13741
|
}
|
|
@@ -42607,7 +42604,7 @@ var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
|
|
42607
42604
|
return SignatureCheckMode3;
|
|
42608
42605
|
})(SignatureCheckMode || {});
|
|
42609
42606
|
var isNotOverloadAndNotAccessor = and(isNotOverload, isNotAccessor);
|
|
42610
|
-
var
|
|
42607
|
+
var stringMappingTypeKinds = new Map(Object.entries({
|
|
42611
42608
|
Uppercase: 0 /* Uppercase */,
|
|
42612
42609
|
Lowercase: 1 /* Lowercase */,
|
|
42613
42610
|
Capitalize: 2 /* Capitalize */,
|
|
@@ -43132,7 +43129,7 @@ function createTypeChecker(host) {
|
|
|
43132
43129
|
var enumLiteralTypes = /* @__PURE__ */ new Map();
|
|
43133
43130
|
var indexedAccessTypes = /* @__PURE__ */ new Map();
|
|
43134
43131
|
var templateLiteralTypes = /* @__PURE__ */ new Map();
|
|
43135
|
-
var
|
|
43132
|
+
var intrinsicWrapperTypes = /* @__PURE__ */ new Map();
|
|
43136
43133
|
var substitutionTypes = /* @__PURE__ */ new Map();
|
|
43137
43134
|
var subtypeReductionCache = /* @__PURE__ */ new Map();
|
|
43138
43135
|
var decoratorContextOverrideTypeCache = /* @__PURE__ */ new Map();
|
|
@@ -47266,6 +47263,10 @@ function createTypeChecker(host) {
|
|
|
47266
47263
|
const typeNode = typeToTypeNodeHelper(type.type, context);
|
|
47267
47264
|
return symbolToTypeNode(type.symbol, context, 788968 /* Type */, [typeNode]);
|
|
47268
47265
|
}
|
|
47266
|
+
if (type.flags & 536870912 /* NoInfer */) {
|
|
47267
|
+
const typeNode = typeToTypeNodeHelper(type.type, context);
|
|
47268
|
+
return symbolToTypeNode(type.symbol, context, 788968 /* Type */, [typeNode]);
|
|
47269
|
+
}
|
|
47269
47270
|
if (type.flags & 8388608 /* IndexedAccess */) {
|
|
47270
47271
|
const objectTypeNode = typeToTypeNodeHelper(type.objectType, context);
|
|
47271
47272
|
const indexTypeNode = typeToTypeNodeHelper(type.indexType, context);
|
|
@@ -50724,10 +50725,10 @@ function createTypeChecker(host) {
|
|
|
50724
50725
|
return result;
|
|
50725
50726
|
}
|
|
50726
50727
|
function isGenericTypeWithUndefinedConstraint(type) {
|
|
50727
|
-
return !!(type.flags &
|
|
50728
|
+
return !!(type.flags & 1002700800 /* Instantiable */) && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 32768 /* Undefined */);
|
|
50728
50729
|
}
|
|
50729
50730
|
function getNonUndefinedType(type) {
|
|
50730
|
-
const typeOrConstraint = someType(type, isGenericTypeWithUndefinedConstraint) ? mapType(type, (t) => t.flags &
|
|
50731
|
+
const typeOrConstraint = someType(type, isGenericTypeWithUndefinedConstraint) ? mapType(type, (t) => t.flags & 1002700800 /* Instantiable */ ? getBaseConstraintOrType(t) : t) : type;
|
|
50731
50732
|
return getTypeWithFacts(typeOrConstraint, 524288 /* NEUndefined */);
|
|
50732
50733
|
}
|
|
50733
50734
|
function getFlowTypeOfDestructuring(node, declaredType) {
|
|
@@ -53546,7 +53547,7 @@ function createTypeChecker(host) {
|
|
|
53546
53547
|
let constraints;
|
|
53547
53548
|
let hasDisjointDomainType = false;
|
|
53548
53549
|
for (const t of types) {
|
|
53549
|
-
if (t.flags &
|
|
53550
|
+
if (t.flags & 1002700800 /* Instantiable */) {
|
|
53550
53551
|
let constraint = getConstraintOfType(t);
|
|
53551
53552
|
while (constraint && constraint.flags & (262144 /* TypeParameter */ | 4194304 /* Index */ | 16777216 /* Conditional */)) {
|
|
53552
53553
|
constraint = getConstraintOfType(constraint);
|
|
@@ -53578,7 +53579,7 @@ function createTypeChecker(host) {
|
|
|
53578
53579
|
return void 0;
|
|
53579
53580
|
}
|
|
53580
53581
|
function getBaseConstraintOfType(type) {
|
|
53581
|
-
if (type.flags & (
|
|
53582
|
+
if (type.flags & (595853312 /* InstantiableNonPrimitive */ | 3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */)) {
|
|
53582
53583
|
const constraint = getResolvedBaseConstraint(type);
|
|
53583
53584
|
return constraint !== noConstraintType && constraint !== circularConstraintType ? constraint : void 0;
|
|
53584
53585
|
}
|
|
@@ -53669,6 +53670,9 @@ function createTypeChecker(host) {
|
|
|
53669
53670
|
const constraint = getBaseConstraint(t.type);
|
|
53670
53671
|
return constraint && constraint !== t.type ? getStringMappingType(t.symbol, constraint) : stringType;
|
|
53671
53672
|
}
|
|
53673
|
+
if (t.flags & 536870912 /* NoInfer */) {
|
|
53674
|
+
return getBaseConstraint(t.type);
|
|
53675
|
+
}
|
|
53672
53676
|
if (t.flags & 8388608 /* IndexedAccess */) {
|
|
53673
53677
|
if (isMappedTypeGenericIndexedAccess(t)) {
|
|
53674
53678
|
return getBaseConstraint(substituteIndexedMappedType(t.objectType, t.indexType));
|
|
@@ -53742,7 +53746,7 @@ function createTypeChecker(host) {
|
|
|
53742
53746
|
return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
|
|
53743
53747
|
}
|
|
53744
53748
|
function getApparentType(type) {
|
|
53745
|
-
const t = !(type.flags &
|
|
53749
|
+
const t = !(type.flags & 1002700800 /* Instantiable */) ? type : getBaseConstraintOfType(type) || unknownType;
|
|
53746
53750
|
return getObjectFlags(t) & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t) : 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;
|
|
53747
53751
|
}
|
|
53748
53752
|
function getReducedApparentType(type) {
|
|
@@ -54821,8 +54825,11 @@ function createTypeChecker(host) {
|
|
|
54821
54825
|
}
|
|
54822
54826
|
function getTypeAliasInstantiation(symbol, typeArguments, aliasSymbol, aliasTypeArguments) {
|
|
54823
54827
|
const type = getDeclaredTypeOfSymbol(symbol);
|
|
54824
|
-
if (type === intrinsicMarkerType &&
|
|
54825
|
-
|
|
54828
|
+
if (type === intrinsicMarkerType && typeArguments && typeArguments.length === 1) {
|
|
54829
|
+
if (stringMappingTypeKinds.has(symbol.escapedName)) {
|
|
54830
|
+
return getStringMappingType(symbol, typeArguments[0]);
|
|
54831
|
+
}
|
|
54832
|
+
return getNoInferType(symbol, typeArguments[0]);
|
|
54826
54833
|
}
|
|
54827
54834
|
const links = getSymbolLinks(symbol);
|
|
54828
54835
|
const typeParameters = links.typeParameters;
|
|
@@ -55726,7 +55733,7 @@ function createTypeChecker(host) {
|
|
|
55726
55733
|
const type = elementTypes[i];
|
|
55727
55734
|
const flags = target.elementFlags[i];
|
|
55728
55735
|
if (flags & 8 /* Variadic */) {
|
|
55729
|
-
if (type.flags &
|
|
55736
|
+
if (type.flags & 595853312 /* InstantiableNonPrimitive */ || isGenericMappedType(type)) {
|
|
55730
55737
|
addElement(type, 8 /* Variadic */, (_a2 = target.labeledElementDeclarations) == null ? void 0 : _a2[i]);
|
|
55731
55738
|
} else if (isTupleType(type)) {
|
|
55732
55739
|
const elements = getTypeArguments(type);
|
|
@@ -55835,7 +55842,7 @@ function createTypeChecker(host) {
|
|
|
55835
55842
|
}
|
|
55836
55843
|
if (!(flags & 131072 /* Never */)) {
|
|
55837
55844
|
includes |= flags & 473694207 /* IncludesMask */;
|
|
55838
|
-
if (flags &
|
|
55845
|
+
if (flags & 1002700800 /* Instantiable */)
|
|
55839
55846
|
includes |= 33554432 /* IncludesInstantiable */;
|
|
55840
55847
|
if (type === wildcardType)
|
|
55841
55848
|
includes |= 8388608 /* IncludesWildcard */;
|
|
@@ -55875,8 +55882,8 @@ function createTypeChecker(host) {
|
|
|
55875
55882
|
while (i > 0) {
|
|
55876
55883
|
i--;
|
|
55877
55884
|
const source = types[i];
|
|
55878
|
-
if (hasEmptyObject || source.flags &
|
|
55879
|
-
const keyProperty = source.flags & (524288 /* Object */ | 2097152 /* Intersection */ |
|
|
55885
|
+
if (hasEmptyObject || source.flags & 1006370816 /* StructuredOrInstantiable */) {
|
|
55886
|
+
const keyProperty = source.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 595853312 /* InstantiableNonPrimitive */) ? find(getPropertiesOfType(source), (p) => isUnitType(getTypeOfSymbol(p))) : void 0;
|
|
55880
55887
|
const keyPropertyType = keyProperty && getRegularTypeOfLiteralType(getTypeOfSymbol(keyProperty));
|
|
55881
55888
|
for (const target of types) {
|
|
55882
55889
|
if (source !== target) {
|
|
@@ -55889,7 +55896,7 @@ function createTypeChecker(host) {
|
|
|
55889
55896
|
}
|
|
55890
55897
|
}
|
|
55891
55898
|
count++;
|
|
55892
|
-
if (keyProperty && target.flags & (524288 /* Object */ | 2097152 /* Intersection */ |
|
|
55899
|
+
if (keyProperty && target.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 595853312 /* InstantiableNonPrimitive */)) {
|
|
55893
55900
|
const t = getTypeOfPropertyOfType(target, keyProperty.escapedName);
|
|
55894
55901
|
if (t && isUnitType(t) && getRegularTypeOfLiteralType(t) !== keyPropertyType) {
|
|
55895
55902
|
continue;
|
|
@@ -56423,7 +56430,7 @@ function createTypeChecker(host) {
|
|
|
56423
56430
|
return getReducedType(uniqueFilled) !== uniqueFilled;
|
|
56424
56431
|
}
|
|
56425
56432
|
function shouldDeferIndexType(type) {
|
|
56426
|
-
return !!(type.flags &
|
|
56433
|
+
return !!(type.flags & 595853312 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) || type.flags & 1048576 /* Union */ && some(type.types, isPossiblyReducibleByInstantiation) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 1002700800 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType));
|
|
56427
56434
|
}
|
|
56428
56435
|
function getIndexType(type, stringsOnly = keyofStringsOnly, noIndexSignatures) {
|
|
56429
56436
|
type = getReducedType(type);
|
|
@@ -56555,8 +56562,19 @@ function createTypeChecker(host) {
|
|
|
56555
56562
|
)
|
|
56556
56563
|
);
|
|
56557
56564
|
}
|
|
56565
|
+
function getNoInferType(symbol, type) {
|
|
56566
|
+
if (!isGenericType(type)) {
|
|
56567
|
+
return type;
|
|
56568
|
+
}
|
|
56569
|
+
const id = `${getSymbolId(symbol)},${getTypeId(type)}`;
|
|
56570
|
+
let result = intrinsicWrapperTypes.get(id);
|
|
56571
|
+
if (!result) {
|
|
56572
|
+
intrinsicWrapperTypes.set(id, result = createNoInferType(symbol, type));
|
|
56573
|
+
}
|
|
56574
|
+
return result;
|
|
56575
|
+
}
|
|
56558
56576
|
function applyStringMapping(symbol, str) {
|
|
56559
|
-
switch (
|
|
56577
|
+
switch (stringMappingTypeKinds.get(symbol.escapedName)) {
|
|
56560
56578
|
case 0 /* Uppercase */:
|
|
56561
56579
|
return str.toUpperCase();
|
|
56562
56580
|
case 1 /* Lowercase */:
|
|
@@ -56569,7 +56587,7 @@ function createTypeChecker(host) {
|
|
|
56569
56587
|
return str;
|
|
56570
56588
|
}
|
|
56571
56589
|
function applyTemplateStringMapping(symbol, texts, types) {
|
|
56572
|
-
switch (
|
|
56590
|
+
switch (stringMappingTypeKinds.get(symbol.escapedName)) {
|
|
56573
56591
|
case 0 /* Uppercase */:
|
|
56574
56592
|
return [texts.map((t) => t.toUpperCase()), types.map((t) => getStringMappingType(symbol, t))];
|
|
56575
56593
|
case 1 /* Lowercase */:
|
|
@@ -56583,9 +56601,9 @@ function createTypeChecker(host) {
|
|
|
56583
56601
|
}
|
|
56584
56602
|
function getStringMappingTypeForGenericType(symbol, type) {
|
|
56585
56603
|
const id = `${getSymbolId(symbol)},${getTypeId(type)}`;
|
|
56586
|
-
let result =
|
|
56604
|
+
let result = intrinsicWrapperTypes.get(id);
|
|
56587
56605
|
if (!result) {
|
|
56588
|
-
|
|
56606
|
+
intrinsicWrapperTypes.set(id, result = createStringMappingType(symbol, type));
|
|
56589
56607
|
}
|
|
56590
56608
|
return result;
|
|
56591
56609
|
}
|
|
@@ -56594,6 +56612,11 @@ function createTypeChecker(host) {
|
|
|
56594
56612
|
result.type = type;
|
|
56595
56613
|
return result;
|
|
56596
56614
|
}
|
|
56615
|
+
function createNoInferType(symbol, type) {
|
|
56616
|
+
const result = createTypeWithSymbol(536870912 /* NoInfer */, symbol);
|
|
56617
|
+
result.type = type;
|
|
56618
|
+
return result;
|
|
56619
|
+
}
|
|
56597
56620
|
function createIndexedAccessType(objectType, indexType, accessFlags, aliasSymbol, aliasTypeArguments) {
|
|
56598
56621
|
const type = createType(8388608 /* IndexedAccess */);
|
|
56599
56622
|
type.objectType = objectType;
|
|
@@ -56616,7 +56639,7 @@ function createTypeChecker(host) {
|
|
|
56616
56639
|
if (type.flags & 2097152 /* Intersection */) {
|
|
56617
56640
|
return some(type.types, isJSLiteralType);
|
|
56618
56641
|
}
|
|
56619
|
-
if (type.flags &
|
|
56642
|
+
if (type.flags & 1002700800 /* Instantiable */) {
|
|
56620
56643
|
const constraint = getResolvedBaseConstraint(type);
|
|
56621
56644
|
return constraint !== type && isJSLiteralType(constraint);
|
|
56622
56645
|
}
|
|
@@ -56868,7 +56891,7 @@ function createTypeChecker(host) {
|
|
|
56868
56891
|
}
|
|
56869
56892
|
return type.objectFlags & 12582912 /* IsGenericType */;
|
|
56870
56893
|
}
|
|
56871
|
-
return (type.flags &
|
|
56894
|
+
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);
|
|
56872
56895
|
}
|
|
56873
56896
|
function getSimplifiedType(type, writing) {
|
|
56874
56897
|
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
|
|
@@ -56897,7 +56920,7 @@ function createTypeChecker(host) {
|
|
|
56897
56920
|
if (distributedOverIndex) {
|
|
56898
56921
|
return type[cache] = distributedOverIndex;
|
|
56899
56922
|
}
|
|
56900
|
-
if (!(indexType.flags &
|
|
56923
|
+
if (!(indexType.flags & 1002700800 /* Instantiable */)) {
|
|
56901
56924
|
const distributedOverObject = distributeIndexOverObjectType(objectType, indexType, writing);
|
|
56902
56925
|
if (distributedOverObject) {
|
|
56903
56926
|
return type[cache] = distributedOverObject;
|
|
@@ -57948,7 +57971,7 @@ function createTypeChecker(host) {
|
|
|
57948
57971
|
const mappedTypeVariable = instantiateType(typeVariable, mapper);
|
|
57949
57972
|
if (typeVariable !== mappedTypeVariable) {
|
|
57950
57973
|
return mapTypeWithAlias(getReducedType(mappedTypeVariable), (t) => {
|
|
57951
|
-
if (t.flags & (3 /* AnyOrUnknown */ |
|
|
57974
|
+
if (t.flags & (3 /* AnyOrUnknown */ | 595853312 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
|
|
57952
57975
|
if (!type.declaration.nameType) {
|
|
57953
57976
|
let constraint;
|
|
57954
57977
|
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
|
|
@@ -58113,6 +58136,9 @@ function createTypeChecker(host) {
|
|
|
58113
58136
|
if (flags & 268435456 /* StringMapping */) {
|
|
58114
58137
|
return getStringMappingType(type.symbol, instantiateType(type.type, mapper));
|
|
58115
58138
|
}
|
|
58139
|
+
if (flags & 536870912 /* NoInfer */) {
|
|
58140
|
+
return getNoInferType(type.symbol, instantiateType(type.type, mapper));
|
|
58141
|
+
}
|
|
58116
58142
|
if (flags & 8388608 /* IndexedAccess */) {
|
|
58117
58143
|
const newAliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
58118
58144
|
const newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
|
|
@@ -58262,7 +58288,7 @@ function createTypeChecker(host) {
|
|
|
58262
58288
|
return isTypeRelatedTo(source, target, assignableRelation);
|
|
58263
58289
|
}
|
|
58264
58290
|
function isTypeDerivedFrom(source, target) {
|
|
58265
|
-
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 &
|
|
58291
|
+
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);
|
|
58266
58292
|
}
|
|
58267
58293
|
function isTypeComparableTo(source, target) {
|
|
58268
58294
|
return isTypeRelatedTo(source, target, comparableRelation);
|
|
@@ -59125,7 +59151,7 @@ function createTypeChecker(host) {
|
|
|
59125
59151
|
return !!(related & 1 /* Succeeded */);
|
|
59126
59152
|
}
|
|
59127
59153
|
}
|
|
59128
|
-
if (source.flags &
|
|
59154
|
+
if (source.flags & 1006370816 /* StructuredOrInstantiable */ || target.flags & 1006370816 /* StructuredOrInstantiable */) {
|
|
59129
59155
|
return checkTypeRelatedTo(
|
|
59130
59156
|
source,
|
|
59131
59157
|
target,
|
|
@@ -59141,7 +59167,7 @@ function createTypeChecker(host) {
|
|
|
59141
59167
|
}
|
|
59142
59168
|
function getNormalizedType(type, writing) {
|
|
59143
59169
|
while (true) {
|
|
59144
|
-
const t = isFreshLiteralType(type) ? type.regularType : 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;
|
|
59170
|
+
const t = isFreshLiteralType(type) ? type.regularType : 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;
|
|
59145
59171
|
if (t === type)
|
|
59146
59172
|
return t;
|
|
59147
59173
|
type = t;
|
|
@@ -59499,7 +59525,7 @@ function createTypeChecker(host) {
|
|
|
59499
59525
|
}
|
|
59500
59526
|
if (relation === comparableRelation && !(target2.flags & 131072 /* Never */) && isSimpleTypeRelatedTo(target2, source2, relation) || isSimpleTypeRelatedTo(source2, target2, relation, reportErrors2 ? reportError : void 0))
|
|
59501
59527
|
return -1 /* True */;
|
|
59502
|
-
if (source2.flags &
|
|
59528
|
+
if (source2.flags & 1006370816 /* StructuredOrInstantiable */ || target2.flags & 1006370816 /* StructuredOrInstantiable */) {
|
|
59503
59529
|
const isPerformingExcessPropertyChecks = !(intersectionState & 2 /* Target */) && (isObjectLiteralType(source2) && getObjectFlags(source2) & 8192 /* FreshLiteral */);
|
|
59504
59530
|
if (isPerformingExcessPropertyChecks) {
|
|
59505
59531
|
if (hasExcessProperties(source2, target2, reportErrors2)) {
|
|
@@ -59538,7 +59564,7 @@ function createTypeChecker(host) {
|
|
|
59538
59564
|
return 0 /* False */;
|
|
59539
59565
|
}
|
|
59540
59566
|
traceUnionsOrIntersectionsTooLarge(source2, target2);
|
|
59541
|
-
const skipCaching = source2.flags & 1048576 /* Union */ && source2.types.length < 4 && !(target2.flags & 1048576 /* Union */) || target2.flags & 1048576 /* Union */ && target2.types.length < 4 && !(source2.flags &
|
|
59567
|
+
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 */);
|
|
59542
59568
|
const result2 = skipCaching ? unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) : recursiveTypeRelatedTo(source2, target2, reportErrors2, intersectionState, recursionFlags);
|
|
59543
59569
|
if (result2) {
|
|
59544
59570
|
return result2;
|
|
@@ -59726,7 +59752,7 @@ function createTypeChecker(host) {
|
|
|
59726
59752
|
return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
|
|
59727
59753
|
}
|
|
59728
59754
|
if (relation === comparableRelation && target2.flags & 402784252 /* Primitive */) {
|
|
59729
|
-
const constraints = sameMap(source2.types, (t) => t.flags &
|
|
59755
|
+
const constraints = sameMap(source2.types, (t) => t.flags & 1002700800 /* Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t);
|
|
59730
59756
|
if (constraints !== source2.types) {
|
|
59731
59757
|
source2 = getIntersectionType(constraints);
|
|
59732
59758
|
if (source2.flags & 131072 /* Never */) {
|
|
@@ -60277,7 +60303,7 @@ function createTypeChecker(host) {
|
|
|
60277
60303
|
if (result2 = unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState)) {
|
|
60278
60304
|
return result2;
|
|
60279
60305
|
}
|
|
60280
|
-
if (!(sourceFlags &
|
|
60306
|
+
if (!(sourceFlags & 1002700800 /* Instantiable */ || sourceFlags & 524288 /* Object */ && targetFlags & 1048576 /* Union */ || sourceFlags & 2097152 /* Intersection */ && targetFlags & (524288 /* Object */ | 1048576 /* Union */ | 1002700800 /* Instantiable */))) {
|
|
60281
60307
|
return 0 /* False */;
|
|
60282
60308
|
}
|
|
60283
60309
|
}
|
|
@@ -61468,7 +61494,7 @@ function createTypeChecker(host) {
|
|
|
61468
61494
|
if (type.flags & 3145728 /* UnionOrIntersection */) {
|
|
61469
61495
|
return !!forEach(type.types, typeCouldHaveTopLevelSingletonTypes);
|
|
61470
61496
|
}
|
|
61471
|
-
if (type.flags &
|
|
61497
|
+
if (type.flags & 1002700800 /* Instantiable */) {
|
|
61472
61498
|
const constraint = getConstraintOfType(type);
|
|
61473
61499
|
if (constraint && constraint !== type) {
|
|
61474
61500
|
return typeCouldHaveTopLevelSingletonTypes(constraint);
|
|
@@ -62517,7 +62543,7 @@ function createTypeChecker(host) {
|
|
|
62517
62543
|
if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
|
|
62518
62544
|
return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
|
|
62519
62545
|
}
|
|
62520
|
-
const result = !!(type.flags &
|
|
62546
|
+
const result = !!(type.flags & 1002700800 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || forEach(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));
|
|
62521
62547
|
if (type.flags & 3899393 /* ObjectFlagsType */) {
|
|
62522
62548
|
type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
|
|
62523
62549
|
}
|
|
@@ -62799,7 +62825,7 @@ function createTypeChecker(host) {
|
|
|
62799
62825
|
let expandingFlags = 0 /* None */;
|
|
62800
62826
|
inferFromTypes(originalSource, originalTarget);
|
|
62801
62827
|
function inferFromTypes(source, target) {
|
|
62802
|
-
if (!couldContainTypeVariables(target)) {
|
|
62828
|
+
if (!couldContainTypeVariables(target) || source.flags & 536870912 /* NoInfer */) {
|
|
62803
62829
|
return;
|
|
62804
62830
|
}
|
|
62805
62831
|
if (source === wildcardType) {
|
|
@@ -62898,7 +62924,7 @@ function createTypeChecker(host) {
|
|
|
62898
62924
|
/*writing*/
|
|
62899
62925
|
false
|
|
62900
62926
|
);
|
|
62901
|
-
if (indexType.flags &
|
|
62927
|
+
if (indexType.flags & 1002700800 /* Instantiable */) {
|
|
62902
62928
|
const simplified2 = distributeIndexOverObjectType(
|
|
62903
62929
|
getSimplifiedType(
|
|
62904
62930
|
target.objectType,
|
|
@@ -62945,7 +62971,7 @@ function createTypeChecker(host) {
|
|
|
62945
62971
|
inferToTemplateLiteralType(source, target);
|
|
62946
62972
|
} else {
|
|
62947
62973
|
source = getReducedType(source);
|
|
62948
|
-
if (!(priority & 512 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ |
|
|
62974
|
+
if (!(priority & 512 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ | 1002700800 /* Instantiable */))) {
|
|
62949
62975
|
const apparentSource = getApparentType(source);
|
|
62950
62976
|
if (apparentSource !== source && allowComplexConstraintInference && !(apparentSource.flags & (524288 /* Object */ | 2097152 /* Intersection */))) {
|
|
62951
62977
|
allowComplexConstraintInference = false;
|
|
@@ -63697,7 +63723,7 @@ function createTypeChecker(host) {
|
|
|
63697
63723
|
const map2 = /* @__PURE__ */ new Map();
|
|
63698
63724
|
let count = 0;
|
|
63699
63725
|
for (const type of types) {
|
|
63700
|
-
if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ |
|
|
63726
|
+
if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 595853312 /* InstantiableNonPrimitive */)) {
|
|
63701
63727
|
const discriminant = getTypeOfPropertyOfType(type, name);
|
|
63702
63728
|
if (discriminant) {
|
|
63703
63729
|
if (!isLiteralType(discriminant)) {
|
|
@@ -63723,11 +63749,11 @@ function createTypeChecker(host) {
|
|
|
63723
63749
|
}
|
|
63724
63750
|
function getKeyPropertyName(unionType) {
|
|
63725
63751
|
const types = unionType.types;
|
|
63726
|
-
if (types.length < 10 || getObjectFlags(unionType) & 32768 /* PrimitiveUnion */ || countWhere(types, (t) => !!(t.flags & (524288 /* Object */ |
|
|
63752
|
+
if (types.length < 10 || getObjectFlags(unionType) & 32768 /* PrimitiveUnion */ || countWhere(types, (t) => !!(t.flags & (524288 /* Object */ | 595853312 /* InstantiableNonPrimitive */))) < 10) {
|
|
63727
63753
|
return void 0;
|
|
63728
63754
|
}
|
|
63729
63755
|
if (unionType.keyPropertyName === void 0) {
|
|
63730
|
-
const keyPropertyName = forEach(types, (t) => t.flags & (524288 /* Object */ |
|
|
63756
|
+
const keyPropertyName = forEach(types, (t) => t.flags & (524288 /* Object */ | 595853312 /* InstantiableNonPrimitive */) ? forEach(getPropertiesOfType(t), (p) => isUnitType(getTypeOfSymbol(p)) ? p.escapedName : void 0) : void 0);
|
|
63731
63757
|
const mapByKeyProperty = keyPropertyName && mapTypesByKeyProperty(types, keyPropertyName);
|
|
63732
63758
|
unionType.keyPropertyName = mapByKeyProperty ? keyPropertyName : "";
|
|
63733
63759
|
unionType.constituentMap = mapByKeyProperty;
|
|
@@ -63805,7 +63831,7 @@ function createTypeChecker(host) {
|
|
|
63805
63831
|
return !!(resolved.callSignatures.length || resolved.constructSignatures.length || resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
|
|
63806
63832
|
}
|
|
63807
63833
|
function getTypeFacts(type) {
|
|
63808
|
-
if (type.flags & (2097152 /* Intersection */ |
|
|
63834
|
+
if (type.flags & (2097152 /* Intersection */ | 1002700800 /* Instantiable */)) {
|
|
63809
63835
|
type = getBaseConstraintOfType(type) || unknownType;
|
|
63810
63836
|
}
|
|
63811
63837
|
const flags = type.flags;
|
|
@@ -65350,7 +65376,7 @@ function createTypeChecker(host) {
|
|
|
65350
65376
|
const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
65351
65377
|
const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
|
|
65352
65378
|
const directlyRelated = mapType(matching || type, 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);
|
|
65353
|
-
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t,
|
|
65379
|
+
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 1002700800 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
|
|
65354
65380
|
});
|
|
65355
65381
|
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
|
|
65356
65382
|
}
|
|
@@ -65530,10 +65556,10 @@ function createTypeChecker(host) {
|
|
|
65530
65556
|
return parent.kind === 209 /* PropertyAccessExpression */ || parent.kind === 164 /* QualifiedName */ || parent.kind === 211 /* CallExpression */ && parent.expression === node || parent.kind === 210 /* ElementAccessExpression */ && parent.expression === node && !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
|
|
65531
65557
|
}
|
|
65532
65558
|
function isGenericTypeWithUnionConstraint(type) {
|
|
65533
|
-
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithUnionConstraint) : !!(type.flags &
|
|
65559
|
+
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithUnionConstraint) : !!(type.flags & 1002700800 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
|
|
65534
65560
|
}
|
|
65535
65561
|
function isGenericTypeWithoutNullableConstraint(type) {
|
|
65536
|
-
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags &
|
|
65562
|
+
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 1002700800 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
|
|
65537
65563
|
}
|
|
65538
65564
|
function hasContextualTypeWithNoGenericTypes(node, checkMode) {
|
|
65539
65565
|
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 64 /* RestBindingElement */ ? getContextualType(node, 8 /* SkipBindingPatterns */) : getContextualType(
|
|
@@ -66841,7 +66867,7 @@ function createTypeChecker(host) {
|
|
|
66841
66867
|
}
|
|
66842
66868
|
}
|
|
66843
66869
|
function instantiateContextualType(contextualType, node, contextFlags) {
|
|
66844
|
-
if (contextualType && maybeTypeOfKind(contextualType,
|
|
66870
|
+
if (contextualType && maybeTypeOfKind(contextualType, 1002700800 /* Instantiable */)) {
|
|
66845
66871
|
const inferenceContext = getInferenceContext(node);
|
|
66846
66872
|
if (inferenceContext && contextFlags & 1 /* Signature */ && some(inferenceContext.inferences, hasInferenceCandidatesOrDefault)) {
|
|
66847
66873
|
return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper);
|
|
@@ -66854,7 +66880,7 @@ function createTypeChecker(host) {
|
|
|
66854
66880
|
return contextualType;
|
|
66855
66881
|
}
|
|
66856
66882
|
function instantiateInstantiableTypes(type, mapper) {
|
|
66857
|
-
if (type.flags &
|
|
66883
|
+
if (type.flags & 1002700800 /* Instantiable */) {
|
|
66858
66884
|
return instantiateType(type, mapper);
|
|
66859
66885
|
}
|
|
66860
66886
|
if (type.flags & 1048576 /* Union */) {
|
|
@@ -67628,7 +67654,7 @@ function createTypeChecker(host) {
|
|
|
67628
67654
|
}
|
|
67629
67655
|
function isValidSpreadType(type) {
|
|
67630
67656
|
const t = removeDefinitelyFalsyTypes(mapType(type, getBaseConstraintOrType));
|
|
67631
|
-
return !!(t.flags & (1 /* Any */ | 67108864 /* NonPrimitive */ | 524288 /* Object */ |
|
|
67657
|
+
return !!(t.flags & (1 /* Any */ | 67108864 /* NonPrimitive */ | 524288 /* Object */ | 595853312 /* InstantiableNonPrimitive */) || t.flags & 3145728 /* UnionOrIntersection */ && every(t.types, isValidSpreadType));
|
|
67632
67658
|
}
|
|
67633
67659
|
function checkJsxSelfClosingElementDeferred(node) {
|
|
67634
67660
|
checkJsxOpeningLikeElementOrOpeningFragment(node);
|
|
@@ -71182,7 +71208,7 @@ function createTypeChecker(host) {
|
|
|
71182
71208
|
result3.node = node;
|
|
71183
71209
|
return result3;
|
|
71184
71210
|
}
|
|
71185
|
-
} else if (type2.flags &
|
|
71211
|
+
} else if (type2.flags & 595853312 /* InstantiableNonPrimitive */) {
|
|
71186
71212
|
const constraint = getBaseConstraintOfType(type2);
|
|
71187
71213
|
if (constraint) {
|
|
71188
71214
|
const instantiated = getInstantiatedTypePart(constraint);
|
|
@@ -73455,7 +73481,7 @@ function createTypeChecker(host) {
|
|
|
73455
73481
|
) || unknownType, isTemplateLiteralContextualType) ? getTemplateLiteralType(texts, types) : stringType;
|
|
73456
73482
|
}
|
|
73457
73483
|
function isTemplateLiteralContextualType(type) {
|
|
73458
|
-
return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags &
|
|
73484
|
+
return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 595853312 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
|
|
73459
73485
|
}
|
|
73460
73486
|
function getContextNode(node) {
|
|
73461
73487
|
if (isJsxAttributes(node) && !isJsxSelfClosingElement(node.parent)) {
|
|
@@ -73568,7 +73594,7 @@ function createTypeChecker(host) {
|
|
|
73568
73594
|
const types = contextualType.types;
|
|
73569
73595
|
return some(types, (t) => isLiteralOfContextualType(candidateType, t));
|
|
73570
73596
|
}
|
|
73571
|
-
if (contextualType.flags &
|
|
73597
|
+
if (contextualType.flags & 595853312 /* InstantiableNonPrimitive */) {
|
|
73572
73598
|
const constraint = getBaseConstraintOfType(contextualType) || unknownType;
|
|
73573
73599
|
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);
|
|
73574
73600
|
}
|
|
@@ -76626,7 +76652,7 @@ function createTypeChecker(host) {
|
|
|
76626
76652
|
);
|
|
76627
76653
|
}
|
|
76628
76654
|
}
|
|
76629
|
-
if (rightType === neverType || !isTypeAssignableToKind(rightType, 67108864 /* NonPrimitive */ |
|
|
76655
|
+
if (rightType === neverType || !isTypeAssignableToKind(rightType, 67108864 /* NonPrimitive */ | 595853312 /* InstantiableNonPrimitive */)) {
|
|
76630
76656
|
error(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));
|
|
76631
76657
|
}
|
|
76632
76658
|
checkSourceElement(node.statement);
|
|
@@ -78303,7 +78329,7 @@ function createTypeChecker(host) {
|
|
|
78303
78329
|
checkExportsOnMergedDeclarations(node);
|
|
78304
78330
|
checkTypeParameters(node.typeParameters);
|
|
78305
78331
|
if (node.type.kind === 140 /* IntrinsicKeyword */) {
|
|
78306
|
-
if (!
|
|
78332
|
+
if (!stringMappingTypeKinds.has(node.name.escapedText) && node.name.escapedText !== "NoInfer" || length(node.typeParameters) !== 1) {
|
|
78307
78333
|
error(node.type, Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types);
|
|
78308
78334
|
}
|
|
78309
78335
|
} else {
|