@typescript-deploys/pr-build 4.8.0-pr-49119-45 → 4.8.0-pr-49233-9
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 +1 -1
- package/lib/tsc.js +61 -115
- package/lib/tsserver.js +69 -126
- package/lib/tsserverlibrary.js +69 -126
- package/lib/typescript.js +69 -126
- package/lib/typescriptServices.js +69 -126
- package/lib/typingsInstaller.js +69 -126
- package/package.json +1 -1
package/lib/lib.es5.d.ts
CHANGED
|
@@ -1584,7 +1584,7 @@ type Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>;
|
|
|
1584
1584
|
/**
|
|
1585
1585
|
* Exclude null and undefined from T
|
|
1586
1586
|
*/
|
|
1587
|
-
type NonNullable<T> = T
|
|
1587
|
+
type NonNullable<T> = T extends null | undefined ? never : T;
|
|
1588
1588
|
|
|
1589
1589
|
/**
|
|
1590
1590
|
* Obtain the parameters of a function type in a tuple
|
package/lib/tsc.js
CHANGED
|
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
71
|
ts.versionMajorMinor = "4.8";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220525";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -35199,15 +35199,19 @@ var ts;
|
|
|
35199
35199
|
function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
35200
35200
|
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.NodeNextDefault, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
35201
35201
|
}
|
|
35202
|
-
function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
35203
|
-
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
35204
|
-
var esmMode = resolutionMode === ts.ModuleKind.ESNext ? NodeResolutionFeatures.EsmMode : 0;
|
|
35205
|
-
return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions, redirectedReference);
|
|
35206
|
-
}
|
|
35207
35202
|
var jsOnlyExtensions = [Extensions.JavaScript];
|
|
35208
35203
|
var tsExtensions = [Extensions.TypeScript, Extensions.JavaScript];
|
|
35209
35204
|
var tsPlusJsonExtensions = __spreadArray(__spreadArray([], tsExtensions, true), [Extensions.Json], false);
|
|
35210
35205
|
var tsconfigExtensions = [Extensions.TSConfig];
|
|
35206
|
+
function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
35207
|
+
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
35208
|
+
var esmMode = resolutionMode === ts.ModuleKind.ESNext ? NodeResolutionFeatures.EsmMode : 0;
|
|
35209
|
+
var extensions = compilerOptions.noDtsResolution ? [Extensions.TsOnly, Extensions.JavaScript] : tsExtensions;
|
|
35210
|
+
if (compilerOptions.resolveJsonModule) {
|
|
35211
|
+
extensions = __spreadArray(__spreadArray([], extensions, true), [Extensions.Json], false);
|
|
35212
|
+
}
|
|
35213
|
+
return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference);
|
|
35214
|
+
}
|
|
35211
35215
|
function tryResolveJSModuleWorker(moduleName, initialDir, host) {
|
|
35212
35216
|
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, undefined, jsOnlyExtensions, undefined);
|
|
35213
35217
|
}
|
|
@@ -39743,7 +39747,6 @@ var ts;
|
|
|
39743
39747
|
var emptyTypeLiteralSymbol = createSymbol(2048, "__type");
|
|
39744
39748
|
emptyTypeLiteralSymbol.members = ts.createSymbolTable();
|
|
39745
39749
|
var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
39746
|
-
var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray)]) : unknownType;
|
|
39747
39750
|
var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
39748
39751
|
emptyGenericType.instantiations = new ts.Map();
|
|
39749
39752
|
var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
@@ -48552,7 +48555,7 @@ var ts;
|
|
|
48552
48555
|
}
|
|
48553
48556
|
}
|
|
48554
48557
|
}
|
|
48555
|
-
else if (t.flags & 469892092
|
|
48558
|
+
else if (t.flags & 469892092) {
|
|
48556
48559
|
hasDisjointDomainType = true;
|
|
48557
48560
|
}
|
|
48558
48561
|
}
|
|
@@ -48560,7 +48563,7 @@ var ts;
|
|
|
48560
48563
|
if (hasDisjointDomainType) {
|
|
48561
48564
|
for (var _a = 0, types_6 = types; _a < types_6.length; _a++) {
|
|
48562
48565
|
var t = types_6[_a];
|
|
48563
|
-
if (t.flags & 469892092
|
|
48566
|
+
if (t.flags & 469892092) {
|
|
48564
48567
|
constraints = ts.append(constraints, t);
|
|
48565
48568
|
}
|
|
48566
48569
|
}
|
|
@@ -50830,7 +50833,7 @@ var ts;
|
|
|
50830
50833
|
}
|
|
50831
50834
|
return includes;
|
|
50832
50835
|
}
|
|
50833
|
-
function
|
|
50836
|
+
function removeRedundantPrimitiveTypes(types, includes) {
|
|
50834
50837
|
var i = types.length;
|
|
50835
50838
|
while (i > 0) {
|
|
50836
50839
|
i--;
|
|
@@ -50838,9 +50841,7 @@ var ts;
|
|
|
50838
50841
|
var remove = t.flags & 4 && includes & (128 | 134217728 | 268435456) ||
|
|
50839
50842
|
t.flags & 8 && includes & 256 ||
|
|
50840
50843
|
t.flags & 64 && includes & 2048 ||
|
|
50841
|
-
t.flags & 4096 && includes & 8192
|
|
50842
|
-
t.flags & 16384 && includes & 32768 ||
|
|
50843
|
-
isEmptyAnonymousObjectType(t) && includes & 470302716;
|
|
50844
|
+
t.flags & 4096 && includes & 8192;
|
|
50844
50845
|
if (remove) {
|
|
50845
50846
|
ts.orderedRemoveItemAt(types, i);
|
|
50846
50847
|
}
|
|
@@ -50935,7 +50936,7 @@ var ts;
|
|
|
50935
50936
|
result.aliasTypeArguments = aliasTypeArguments;
|
|
50936
50937
|
return result;
|
|
50937
50938
|
}
|
|
50938
|
-
function getIntersectionType(types, aliasSymbol, aliasTypeArguments
|
|
50939
|
+
function getIntersectionType(types, aliasSymbol, aliasTypeArguments) {
|
|
50939
50940
|
var typeMembershipMap = new ts.Map();
|
|
50940
50941
|
var includes = addTypesToIntersection(typeMembershipMap, 0, types);
|
|
50941
50942
|
var typeSet = ts.arrayFrom(typeMembershipMap.values());
|
|
@@ -50963,11 +50964,11 @@ var ts;
|
|
|
50963
50964
|
if (includes & 4 && includes & (128 | 134217728 | 268435456) ||
|
|
50964
50965
|
includes & 8 && includes & 256 ||
|
|
50965
50966
|
includes & 64 && includes & 2048 ||
|
|
50966
|
-
includes & 4096 && includes & 8192
|
|
50967
|
-
|
|
50968
|
-
|
|
50969
|
-
|
|
50970
|
-
|
|
50967
|
+
includes & 4096 && includes & 8192) {
|
|
50968
|
+
removeRedundantPrimitiveTypes(typeSet, includes);
|
|
50969
|
+
}
|
|
50970
|
+
if (includes & 16777216 && includes & 524288) {
|
|
50971
|
+
ts.orderedRemoveItemAt(typeSet, ts.findIndex(typeSet, isEmptyAnonymousObjectType));
|
|
50971
50972
|
}
|
|
50972
50973
|
if (includes & 262144) {
|
|
50973
50974
|
typeSet[typeSet.indexOf(undefinedType)] = missingType;
|
|
@@ -50999,7 +51000,7 @@ var ts;
|
|
|
50999
51000
|
return errorType;
|
|
51000
51001
|
}
|
|
51001
51002
|
var constituents = getCrossProductIntersections(typeSet);
|
|
51002
|
-
var origin = ts.some(constituents, function (t) { return !!(t.flags & 2097152); })
|
|
51003
|
+
var origin = ts.some(constituents, function (t) { return !!(t.flags & 2097152); }) ? createOriginUnionOrIntersectionType(2097152, typeSet) : undefined;
|
|
51003
51004
|
result = getUnionType(constituents, 1, aliasSymbol, aliasTypeArguments, origin);
|
|
51004
51005
|
}
|
|
51005
51006
|
}
|
|
@@ -51042,21 +51043,11 @@ var ts;
|
|
|
51042
51043
|
}
|
|
51043
51044
|
return intersections;
|
|
51044
51045
|
}
|
|
51045
|
-
function getConstituentCount(type) {
|
|
51046
|
-
return !(type.flags & 3145728) || type.aliasSymbol ? 1 :
|
|
51047
|
-
type.flags & 1048576 && type.origin ? getConstituentCount(type.origin) :
|
|
51048
|
-
getConstituentCountOfTypes(type.types);
|
|
51049
|
-
}
|
|
51050
|
-
function getConstituentCountOfTypes(types) {
|
|
51051
|
-
return ts.reduceLeft(types, function (n, t) { return n + getConstituentCount(t); }, 0);
|
|
51052
|
-
}
|
|
51053
51046
|
function getTypeFromIntersectionTypeNode(node) {
|
|
51054
51047
|
var links = getNodeLinks(node);
|
|
51055
51048
|
if (!links.resolvedType) {
|
|
51056
51049
|
var aliasSymbol = getAliasSymbolForTypeNode(node);
|
|
51057
|
-
|
|
51058
|
-
var noSupertypeReduction = types.length === 2 && !!(types[0].flags & (4 | 8 | 64)) && types[1] === emptyTypeLiteralType;
|
|
51059
|
-
links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
|
|
51050
|
+
links.resolvedType = getIntersectionType(ts.map(node.types, getTypeFromTypeNode), aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol));
|
|
51060
51051
|
}
|
|
51061
51052
|
return links.resolvedType;
|
|
51062
51053
|
}
|
|
@@ -53535,17 +53526,6 @@ var ts;
|
|
|
53535
53526
|
return !!(ts.getObjectFlags(type) & 16 && (type.members && isEmptyResolvedType(type) ||
|
|
53536
53527
|
type.symbol && type.symbol.flags & 2048 && getMembersOfSymbol(type.symbol).size === 0));
|
|
53537
53528
|
}
|
|
53538
|
-
function isUnknownLikeUnionType(type) {
|
|
53539
|
-
if (strictNullChecks && type.flags & 1048576) {
|
|
53540
|
-
if (!(type.objectFlags & 33554432)) {
|
|
53541
|
-
var types = type.types;
|
|
53542
|
-
type.objectFlags |= 33554432 | (types.length >= 3 && types[0].flags & 32768 &&
|
|
53543
|
-
types[1].flags & 65536 && ts.some(types, isEmptyAnonymousObjectType) ? 67108864 : 0);
|
|
53544
|
-
}
|
|
53545
|
-
return !!(type.objectFlags & 67108864);
|
|
53546
|
-
}
|
|
53547
|
-
return false;
|
|
53548
|
-
}
|
|
53549
53529
|
function isStringIndexSignatureOnlyType(type) {
|
|
53550
53530
|
return type.flags & 524288 && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) ||
|
|
53551
53531
|
type.flags & 3145728 && ts.every(type.types, isStringIndexSignatureOnlyType) ||
|
|
@@ -53623,15 +53603,13 @@ var ts;
|
|
|
53623
53603
|
return true;
|
|
53624
53604
|
if (s & 65536 && (!strictNullChecks && !(t & 3145728) || t & 65536))
|
|
53625
53605
|
return true;
|
|
53626
|
-
if (s & 524288 && t & 67108864
|
|
53606
|
+
if (s & 524288 && t & 67108864)
|
|
53627
53607
|
return true;
|
|
53628
53608
|
if (relation === assignableRelation || relation === comparableRelation) {
|
|
53629
53609
|
if (s & 1)
|
|
53630
53610
|
return true;
|
|
53631
53611
|
if (s & (8 | 256) && !(s & 1024) && (t & 32 || relation === assignableRelation && t & 256 && t & 1024))
|
|
53632
53612
|
return true;
|
|
53633
|
-
if (isUnknownLikeUnionType(target))
|
|
53634
|
-
return true;
|
|
53635
53613
|
}
|
|
53636
53614
|
return false;
|
|
53637
53615
|
}
|
|
@@ -53673,27 +53651,16 @@ var ts;
|
|
|
53673
53651
|
function getNormalizedType(type, writing) {
|
|
53674
53652
|
while (true) {
|
|
53675
53653
|
var t = isFreshLiteralType(type) ? type.regularType :
|
|
53676
|
-
ts.getObjectFlags(type) & 4
|
|
53677
|
-
type.flags & 3145728 ?
|
|
53654
|
+
ts.getObjectFlags(type) & 4 && type.node ? createTypeReference(type.target, getTypeArguments(type)) :
|
|
53655
|
+
type.flags & 3145728 ? getReducedType(type) :
|
|
53678
53656
|
type.flags & 33554432 ? writing ? type.baseType : type.substitute :
|
|
53679
53657
|
type.flags & 25165824 ? getSimplifiedType(type, writing) :
|
|
53680
53658
|
type;
|
|
53659
|
+
t = getSingleBaseForNonAugmentingSubtype(t) || t;
|
|
53681
53660
|
if (t === type)
|
|
53682
|
-
|
|
53661
|
+
break;
|
|
53683
53662
|
type = t;
|
|
53684
53663
|
}
|
|
53685
|
-
}
|
|
53686
|
-
function getNormalizedUnionOrIntersectionType(type, writing) {
|
|
53687
|
-
var reduced = getReducedType(type);
|
|
53688
|
-
if (reduced !== type) {
|
|
53689
|
-
return reduced;
|
|
53690
|
-
}
|
|
53691
|
-
if (type.flags & 2097152) {
|
|
53692
|
-
var normalizedTypes = ts.sameMap(type.types, function (t) { return getNormalizedType(t, writing); });
|
|
53693
|
-
if (normalizedTypes !== type.types) {
|
|
53694
|
-
return getIntersectionType(normalizedTypes);
|
|
53695
|
-
}
|
|
53696
|
-
}
|
|
53697
53664
|
return type;
|
|
53698
53665
|
}
|
|
53699
53666
|
function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer) {
|
|
@@ -56237,19 +56204,16 @@ var ts;
|
|
|
56237
56204
|
return type.flags & 32768 ? type : getUnionType([type, isProperty ? missingType : undefinedType]);
|
|
56238
56205
|
}
|
|
56239
56206
|
function getGlobalNonNullableTypeInstantiation(type) {
|
|
56207
|
+
var reducedType = getTypeWithFacts(type, 2097152);
|
|
56240
56208
|
if (!deferredGlobalNonNullableTypeAlias) {
|
|
56241
56209
|
deferredGlobalNonNullableTypeAlias = getGlobalSymbol("NonNullable", 524288, undefined) || unknownSymbol;
|
|
56242
56210
|
}
|
|
56243
56211
|
return deferredGlobalNonNullableTypeAlias !== unknownSymbol ?
|
|
56244
|
-
getTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [
|
|
56245
|
-
|
|
56212
|
+
getTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [reducedType]) :
|
|
56213
|
+
reducedType;
|
|
56246
56214
|
}
|
|
56247
56215
|
function getNonNullableType(type) {
|
|
56248
|
-
|
|
56249
|
-
var reducedType = getTypeWithFacts(type, 2097152);
|
|
56250
|
-
return maybeTypeOfKind(reducedType, 465829888) ? getGlobalNonNullableTypeInstantiation(reducedType) : reducedType;
|
|
56251
|
-
}
|
|
56252
|
-
return type;
|
|
56216
|
+
return strictNullChecks ? getGlobalNonNullableTypeInstantiation(type) : type;
|
|
56253
56217
|
}
|
|
56254
56218
|
function addOptionalTypeMarker(type) {
|
|
56255
56219
|
return strictNullChecks ? getUnionType([type, optionalType]) : type;
|
|
@@ -58012,24 +57976,6 @@ var ts;
|
|
|
58012
57976
|
function getTypeWithFacts(type, include) {
|
|
58013
57977
|
return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });
|
|
58014
57978
|
}
|
|
58015
|
-
function getIntersectionWithFacts(type, facts) {
|
|
58016
|
-
var reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 ? unknownUnionType : type, facts));
|
|
58017
|
-
if (strictNullChecks) {
|
|
58018
|
-
switch (facts) {
|
|
58019
|
-
case 524288:
|
|
58020
|
-
return mapType(reduced, function (t) { return getTypeFacts(t) & 65536 ? getIntersectionType([t, getTypeFacts(t) & 131072 && !maybeTypeOfKind(reduced, 65536) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t; });
|
|
58021
|
-
case 1048576:
|
|
58022
|
-
return mapType(reduced, function (t) { return getTypeFacts(t) & 131072 ? getIntersectionType([t, getTypeFacts(t) & 65536 && !maybeTypeOfKind(reduced, 32768) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t; });
|
|
58023
|
-
case 2097152:
|
|
58024
|
-
case 4194304:
|
|
58025
|
-
return mapType(reduced, function (t) { return getTypeFacts(t) & 262144 ? getGlobalNonNullableTypeInstantiation(t) : t; });
|
|
58026
|
-
}
|
|
58027
|
-
}
|
|
58028
|
-
return reduced;
|
|
58029
|
-
}
|
|
58030
|
-
function recombineUnknownType(type) {
|
|
58031
|
-
return type === unknownUnionType ? unknownType : type;
|
|
58032
|
-
}
|
|
58033
57979
|
function getTypeWithDefault(type, defaultExpression) {
|
|
58034
57980
|
return defaultExpression ?
|
|
58035
57981
|
getUnionType([getNonUndefinedType(type), getTypeOfExpression(defaultExpression)]) :
|
|
@@ -58970,7 +58916,7 @@ var ts;
|
|
|
58970
58916
|
if (isEvolvingArrayTypeList(types)) {
|
|
58971
58917
|
return getEvolvingArrayType(getUnionType(ts.map(types, getElementTypeOfEvolvingArrayType)));
|
|
58972
58918
|
}
|
|
58973
|
-
var result =
|
|
58919
|
+
var result = getUnionType(ts.sameMap(types, finalizeEvolvingArrayType), subtypeReduction);
|
|
58974
58920
|
if (result !== declaredType && result.flags & declaredType.flags & 1048576 && ts.arraysEqual(result.types, declaredType.types)) {
|
|
58975
58921
|
return declaredType;
|
|
58976
58922
|
}
|
|
@@ -59066,7 +59012,8 @@ var ts;
|
|
|
59066
59012
|
}
|
|
59067
59013
|
function narrowTypeByTruthiness(type, expr, assumeTrue) {
|
|
59068
59014
|
if (isMatchingReference(reference, expr)) {
|
|
59069
|
-
return
|
|
59015
|
+
return type.flags & 2 && assumeTrue ? nonNullUnknownType :
|
|
59016
|
+
getTypeWithFacts(type, assumeTrue ? 4194304 : 8388608);
|
|
59070
59017
|
}
|
|
59071
59018
|
if (strictNullChecks && assumeTrue && optionalChainContainsReference(expr, reference)) {
|
|
59072
59019
|
type = getTypeWithFacts(type, 2097152);
|
|
@@ -59206,6 +59153,9 @@ var ts;
|
|
|
59206
59153
|
assumeTrue = !assumeTrue;
|
|
59207
59154
|
}
|
|
59208
59155
|
var valueType = getTypeOfExpression(value);
|
|
59156
|
+
if (assumeTrue && (type.flags & 2) && (operator === 34 || operator === 35) && (valueType.flags & 65536)) {
|
|
59157
|
+
return getUnionType([nullType, undefinedType]);
|
|
59158
|
+
}
|
|
59209
59159
|
if ((type.flags & 2) && assumeTrue && (operator === 36 || operator === 37)) {
|
|
59210
59160
|
if (valueType.flags & (131068 | 67108864)) {
|
|
59211
59161
|
return valueType;
|
|
@@ -59225,7 +59175,7 @@ var ts;
|
|
|
59225
59175
|
valueType.flags & 65536 ?
|
|
59226
59176
|
assumeTrue ? 131072 : 1048576 :
|
|
59227
59177
|
assumeTrue ? 65536 : 524288;
|
|
59228
|
-
return
|
|
59178
|
+
return type.flags & 2 && facts & (1048576 | 2097152) ? nonNullUnknownType : getTypeWithFacts(type, facts);
|
|
59229
59179
|
}
|
|
59230
59180
|
if (assumeTrue) {
|
|
59231
59181
|
var filterFn = operator === 34 ?
|
|
@@ -59252,11 +59202,14 @@ var ts;
|
|
|
59252
59202
|
if (type.flags & 1 && literal.text === "function") {
|
|
59253
59203
|
return type;
|
|
59254
59204
|
}
|
|
59205
|
+
if (assumeTrue && type.flags & 2 && literal.text === "object") {
|
|
59206
|
+
return type === nonNullUnknownType ? nonPrimitiveType : getUnionType([nonPrimitiveType, nullType]);
|
|
59207
|
+
}
|
|
59255
59208
|
var facts = assumeTrue ?
|
|
59256
59209
|
typeofEQFacts.get(literal.text) || 128 :
|
|
59257
59210
|
typeofNEFacts.get(literal.text) || 32768;
|
|
59258
59211
|
var impliedType = getImpliedTypeFromTypeofGuard(type, literal.text);
|
|
59259
|
-
return getTypeWithFacts(assumeTrue && impliedType ?
|
|
59212
|
+
return getTypeWithFacts(assumeTrue && impliedType ? mapType(type, narrowUnionMemberByTypeof(impliedType)) : type, facts);
|
|
59260
59213
|
}
|
|
59261
59214
|
function narrowTypeBySwitchOptionalChainContainment(type, switchStatement, clauseStart, clauseEnd, clauseCheck) {
|
|
59262
59215
|
var everyClauseChecks = clauseStart !== clauseEnd && ts.every(getSwitchClauseTypes(switchStatement).slice(clauseStart, clauseEnd), clauseCheck);
|
|
@@ -59301,35 +59254,30 @@ var ts;
|
|
|
59301
59254
|
}
|
|
59302
59255
|
function getImpliedTypeFromTypeofGuard(type, text) {
|
|
59303
59256
|
switch (text) {
|
|
59304
|
-
case "object":
|
|
59305
|
-
return type.flags & 1 ? type : getUnionType([nullType, nonPrimitiveType]);
|
|
59306
59257
|
case "function":
|
|
59307
59258
|
return type.flags & 1 ? type : globalFunctionType;
|
|
59259
|
+
case "object":
|
|
59260
|
+
return type.flags & 2 ? getUnionType([nonPrimitiveType, nullType]) : type;
|
|
59308
59261
|
default:
|
|
59309
59262
|
return typeofTypesByName.get(text);
|
|
59310
59263
|
}
|
|
59311
59264
|
}
|
|
59312
|
-
function
|
|
59313
|
-
|
|
59314
|
-
|
|
59315
|
-
|
|
59316
|
-
return mapType(type, function (t) {
|
|
59317
|
-
if (isTypeRelatedTo(t, candidate, strictSubtypeRelation)) {
|
|
59318
|
-
return t;
|
|
59265
|
+
function narrowUnionMemberByTypeof(candidate) {
|
|
59266
|
+
return function (type) {
|
|
59267
|
+
if (isTypeSubtypeOf(type, candidate)) {
|
|
59268
|
+
return type;
|
|
59319
59269
|
}
|
|
59320
|
-
|
|
59321
|
-
|
|
59322
|
-
|
|
59323
|
-
|
|
59324
|
-
|
|
59325
|
-
|
|
59326
|
-
|
|
59327
|
-
if (c === globalFunctionType && isTypeSubtypeOf(c, t)) {
|
|
59328
|
-
return c;
|
|
59270
|
+
if (isTypeSubtypeOf(candidate, type)) {
|
|
59271
|
+
return candidate;
|
|
59272
|
+
}
|
|
59273
|
+
if (type.flags & 465829888) {
|
|
59274
|
+
var constraint = getBaseConstraintOfType(type) || anyType;
|
|
59275
|
+
if (isTypeSubtypeOf(candidate, constraint)) {
|
|
59276
|
+
return getIntersectionType([type, candidate]);
|
|
59329
59277
|
}
|
|
59330
|
-
|
|
59331
|
-
|
|
59332
|
-
}
|
|
59278
|
+
}
|
|
59279
|
+
return type;
|
|
59280
|
+
};
|
|
59333
59281
|
}
|
|
59334
59282
|
function narrowBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
|
|
59335
59283
|
var switchWitnesses = getSwitchClauseTypeOfWitnesses(switchStatement, true);
|
|
@@ -59355,7 +59303,7 @@ var ts;
|
|
|
59355
59303
|
return filterType(type, function (t) { return (getTypeFacts(t) & switchFacts) === switchFacts; });
|
|
59356
59304
|
}
|
|
59357
59305
|
var impliedType = getTypeWithFacts(getUnionType(clauseWitnesses.map(function (text) { return getImpliedTypeFromTypeofGuard(type, text) || type; })), switchFacts);
|
|
59358
|
-
return getTypeWithFacts(
|
|
59306
|
+
return getTypeWithFacts(mapType(type, narrowUnionMemberByTypeof(impliedType)), switchFacts);
|
|
59359
59307
|
}
|
|
59360
59308
|
function isMatchingConstructorReference(expr) {
|
|
59361
59309
|
return (ts.isPropertyAccessExpression(expr) && ts.idText(expr.name) === "constructor" ||
|
|
@@ -59616,9 +59564,7 @@ var ts;
|
|
|
59616
59564
|
!(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
|
|
59617
59565
|
}
|
|
59618
59566
|
function isGenericTypeWithUnionConstraint(type) {
|
|
59619
|
-
return type.flags &
|
|
59620
|
-
ts.some(type.types, isGenericTypeWithUnionConstraint) :
|
|
59621
|
-
!!(type.flags & 465829888 && getBaseConstraintOrType(type).flags & (98304 | 1048576));
|
|
59567
|
+
return !!(type.flags & 465829888 && getBaseConstraintOrType(type).flags & (98304 | 1048576));
|
|
59622
59568
|
}
|
|
59623
59569
|
function isGenericTypeWithoutNullableConstraint(type) {
|
|
59624
59570
|
return !!(type.flags & 465829888 && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304));
|
|
@@ -59635,7 +59581,7 @@ var ts;
|
|
|
59635
59581
|
var substituteConstraints = !(checkMode && checkMode & 2) &&
|
|
59636
59582
|
someType(type, isGenericTypeWithUnionConstraint) &&
|
|
59637
59583
|
(isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
|
|
59638
|
-
return substituteConstraints ? mapType(type, getBaseConstraintOrType) : type;
|
|
59584
|
+
return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 ? getBaseConstraintOrType(t) : t; }) : type;
|
|
59639
59585
|
}
|
|
59640
59586
|
function isExportOrExportExpression(location) {
|
|
59641
59587
|
return !!ts.findAncestor(location, function (n) {
|