@typescript-deploys/pr-build 5.3.0-pr-55459-3 → 5.3.0-pr-55476-8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +72 -56
- package/lib/tsserver.js +92 -68
- package/lib/typescript.js +485 -461
- package/lib/typingsInstaller.js +1 -1
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.3";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20230823`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -11771,8 +11771,8 @@ function getInternalEmitFlags(node) {
|
|
|
11771
11771
|
const emitNode = node.emitNode;
|
|
11772
11772
|
return emitNode && emitNode.internalFlags || 0;
|
|
11773
11773
|
}
|
|
11774
|
-
|
|
11775
|
-
|
|
11774
|
+
var getScriptTargetFeatures = /* @__PURE__ */ memoize(
|
|
11775
|
+
() => new Map(Object.entries({
|
|
11776
11776
|
Array: new Map(Object.entries({
|
|
11777
11777
|
es2015: [
|
|
11778
11778
|
"find",
|
|
@@ -12165,8 +12165,8 @@ function getScriptTargetFeatures() {
|
|
|
12165
12165
|
"cause"
|
|
12166
12166
|
]
|
|
12167
12167
|
}))
|
|
12168
|
-
}))
|
|
12169
|
-
|
|
12168
|
+
}))
|
|
12169
|
+
);
|
|
12170
12170
|
function getLiteralText(node, sourceFile, flags) {
|
|
12171
12171
|
if (sourceFile && canUseOriginalText(node, flags)) {
|
|
12172
12172
|
return getSourceTextOfNodeFromSourceFile(sourceFile, node);
|
|
@@ -48630,11 +48630,17 @@ function createTypeChecker(host) {
|
|
|
48630
48630
|
const constraintNode = constraint && typeToTypeNodeHelper(constraint, context);
|
|
48631
48631
|
return typeParameterToDeclarationWithConstraint(type, context, constraintNode);
|
|
48632
48632
|
}
|
|
48633
|
-
function
|
|
48634
|
-
|
|
48635
|
-
if (
|
|
48636
|
-
parameterDeclaration
|
|
48633
|
+
function getEffectiveParameterDeclaration(parameterSymbol) {
|
|
48634
|
+
const parameterDeclaration = getDeclarationOfKind(parameterSymbol, 169 /* Parameter */);
|
|
48635
|
+
if (parameterDeclaration) {
|
|
48636
|
+
return parameterDeclaration;
|
|
48637
48637
|
}
|
|
48638
|
+
if (!isTransientSymbol(parameterSymbol)) {
|
|
48639
|
+
return getDeclarationOfKind(parameterSymbol, 348 /* JSDocParameterTag */);
|
|
48640
|
+
}
|
|
48641
|
+
}
|
|
48642
|
+
function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags, privateSymbolVisitor, bundledImports) {
|
|
48643
|
+
const parameterDeclaration = getEffectiveParameterDeclaration(parameterSymbol);
|
|
48638
48644
|
let parameterType = getTypeOfSymbol(parameterSymbol);
|
|
48639
48645
|
if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) {
|
|
48640
48646
|
parameterType = getOptionalType(parameterType);
|
|
@@ -48643,7 +48649,7 @@ function createTypeChecker(host) {
|
|
|
48643
48649
|
const modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && canHaveModifiers(parameterDeclaration) ? map(getModifiers(parameterDeclaration), factory.cloneNode) : void 0;
|
|
48644
48650
|
const isRest = parameterDeclaration && isRestParameter(parameterDeclaration) || getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
|
|
48645
48651
|
const dotDotDotToken = isRest ? factory.createToken(26 /* DotDotDotToken */) : void 0;
|
|
48646
|
-
const name =
|
|
48652
|
+
const name = parameterToParameterDeclarationName(parameterSymbol, parameterDeclaration, context);
|
|
48647
48653
|
const isOptional = parameterDeclaration && isOptionalParameter(parameterDeclaration) || getCheckFlags(parameterSymbol) & 16384 /* OptionalParameter */;
|
|
48648
48654
|
const questionToken = isOptional ? factory.createToken(58 /* QuestionToken */) : void 0;
|
|
48649
48655
|
const parameterNode = factory.createParameterDeclaration(
|
|
@@ -48657,6 +48663,9 @@ function createTypeChecker(host) {
|
|
|
48657
48663
|
);
|
|
48658
48664
|
context.approximateLength += symbolName(parameterSymbol).length + 3;
|
|
48659
48665
|
return parameterNode;
|
|
48666
|
+
}
|
|
48667
|
+
function parameterToParameterDeclarationName(parameterSymbol, parameterDeclaration, context) {
|
|
48668
|
+
return parameterDeclaration ? parameterDeclaration.name ? parameterDeclaration.name.kind === 80 /* Identifier */ ? setEmitFlags(factory.cloneNode(parameterDeclaration.name), 16777216 /* NoAsciiEscaping */) : parameterDeclaration.name.kind === 166 /* QualifiedName */ ? setEmitFlags(factory.cloneNode(parameterDeclaration.name.right), 16777216 /* NoAsciiEscaping */) : cloneBindingName(parameterDeclaration.name) : symbolName(parameterSymbol) : symbolName(parameterSymbol);
|
|
48660
48669
|
function cloneBindingName(node) {
|
|
48661
48670
|
return elideInitializerAndSetEmitFlags(node);
|
|
48662
48671
|
function elideInitializerAndSetEmitFlags(node2) {
|
|
@@ -50637,6 +50646,21 @@ function createTypeChecker(host) {
|
|
|
50637
50646
|
if (p.flags & 98304 /* Accessor */ && useAccessors) {
|
|
50638
50647
|
const result = [];
|
|
50639
50648
|
if (p.flags & 65536 /* SetAccessor */) {
|
|
50649
|
+
const setter = p.declarations && forEach(p.declarations, (d) => {
|
|
50650
|
+
if (d.kind === 178 /* SetAccessor */) {
|
|
50651
|
+
return d;
|
|
50652
|
+
}
|
|
50653
|
+
if (isCallExpression(d) && isBindableObjectDefinePropertyCall(d)) {
|
|
50654
|
+
return forEach(d.arguments[2].properties, (propDecl) => {
|
|
50655
|
+
const id = getNameOfDeclaration(propDecl);
|
|
50656
|
+
if (!!id && isIdentifier(id) && idText(id) === "set") {
|
|
50657
|
+
return propDecl;
|
|
50658
|
+
}
|
|
50659
|
+
});
|
|
50660
|
+
}
|
|
50661
|
+
});
|
|
50662
|
+
Debug.assert(setter && isFunctionLikeDeclaration(setter));
|
|
50663
|
+
const paramSymbol = getSignatureFromDeclaration(setter).parameters[0];
|
|
50640
50664
|
result.push(setTextRange(
|
|
50641
50665
|
factory.createSetAccessorDeclaration(
|
|
50642
50666
|
factory.createModifiersFromModifierFlags(flag),
|
|
@@ -50646,7 +50670,7 @@ function createTypeChecker(host) {
|
|
|
50646
50670
|
void 0,
|
|
50647
50671
|
/*dotDotDotToken*/
|
|
50648
50672
|
void 0,
|
|
50649
|
-
"
|
|
50673
|
+
paramSymbol ? parameterToParameterDeclarationName(paramSymbol, getEffectiveParameterDeclaration(paramSymbol), context) : "value",
|
|
50650
50674
|
/*questionToken*/
|
|
50651
50675
|
void 0,
|
|
50652
50676
|
isPrivate ? void 0 : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled)
|
|
@@ -51412,7 +51436,7 @@ function createTypeChecker(host) {
|
|
|
51412
51436
|
const pattern = declaration.parent;
|
|
51413
51437
|
if (strictNullChecks && declaration.flags & 33554432 /* Ambient */ && isParameterDeclaration(declaration)) {
|
|
51414
51438
|
parentType = getNonNullableType(parentType);
|
|
51415
|
-
} else if (strictNullChecks && pattern.parent.initializer && !
|
|
51439
|
+
} else if (strictNullChecks && pattern.parent.initializer && !(getTypeFacts(getTypeOfInitializer(pattern.parent.initializer)) & 65536 /* EQUndefined */)) {
|
|
51416
51440
|
parentType = getTypeWithFacts(parentType, 524288 /* NEUndefined */);
|
|
51417
51441
|
}
|
|
51418
51442
|
let type;
|
|
@@ -51455,7 +51479,7 @@ function createTypeChecker(host) {
|
|
|
51455
51479
|
return type;
|
|
51456
51480
|
}
|
|
51457
51481
|
if (getEffectiveTypeAnnotationNode(walkUpBindingElementsAndPatterns(declaration))) {
|
|
51458
|
-
return strictNullChecks && !
|
|
51482
|
+
return strictNullChecks && !(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
|
|
51459
51483
|
}
|
|
51460
51484
|
return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration, 0 /* Normal */)], 2 /* Subtype */));
|
|
51461
51485
|
}
|
|
@@ -59563,7 +59587,7 @@ function createTypeChecker(host) {
|
|
|
59563
59587
|
if (sourceType && targetType) {
|
|
59564
59588
|
const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
59565
59589
|
const targetSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
|
|
59566
|
-
const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) &&
|
|
59590
|
+
const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && (getTypeFacts(sourceType) & 50331648 /* IsUndefinedOrNull */) === (getTypeFacts(targetType) & 50331648 /* IsUndefinedOrNull */);
|
|
59567
59591
|
let related = callbacks ? compareSignaturesRelated(targetSig, sourceSig, checkMode & 8 /* StrictArity */ | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) : !(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(
|
|
59568
59592
|
sourceType,
|
|
59569
59593
|
targetType,
|
|
@@ -62720,7 +62744,7 @@ function createTypeChecker(host) {
|
|
|
62720
62744
|
return value.base10Value === "0";
|
|
62721
62745
|
}
|
|
62722
62746
|
function removeDefinitelyFalsyTypes(type) {
|
|
62723
|
-
return filterType(type, (t) =>
|
|
62747
|
+
return filterType(type, (t) => !!(getTypeFacts(t) & 4194304 /* Truthy */));
|
|
62724
62748
|
}
|
|
62725
62749
|
function extractDefinitelyFalsyTypes(type) {
|
|
62726
62750
|
return mapType(type, getDefinitelyFalsyPartOfType);
|
|
@@ -63996,12 +64020,14 @@ function createTypeChecker(host) {
|
|
|
63996
64020
|
}
|
|
63997
64021
|
function inferFromSignatures(source, target, kind) {
|
|
63998
64022
|
const sourceSignatures = getSignaturesOfType(source, kind);
|
|
63999
|
-
const targetSignatures = getSignaturesOfType(target, kind);
|
|
64000
64023
|
const sourceLen = sourceSignatures.length;
|
|
64001
|
-
|
|
64002
|
-
|
|
64003
|
-
|
|
64004
|
-
|
|
64024
|
+
if (sourceLen > 0) {
|
|
64025
|
+
const targetSignatures = getSignaturesOfType(target, kind);
|
|
64026
|
+
const targetLen = targetSignatures.length;
|
|
64027
|
+
for (let i = 0; i < targetLen; i++) {
|
|
64028
|
+
const sourceIndex = Math.max(sourceLen - targetLen + i, 0);
|
|
64029
|
+
inferFromSignature(getBaseSignature(sourceSignatures[sourceIndex]), getErasedSignature(targetSignatures[i]));
|
|
64030
|
+
}
|
|
64005
64031
|
}
|
|
64006
64032
|
}
|
|
64007
64033
|
function inferFromSignature(source, target) {
|
|
@@ -64463,13 +64489,7 @@ function createTypeChecker(host) {
|
|
|
64463
64489
|
const resolved = resolveStructuredTypeMembers(type);
|
|
64464
64490
|
return !!(resolved.callSignatures.length || resolved.constructSignatures.length || resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
|
|
64465
64491
|
}
|
|
64466
|
-
function
|
|
64467
|
-
return getTypeFactsWorker(type, mask) & mask;
|
|
64468
|
-
}
|
|
64469
|
-
function hasTypeFacts(type, mask) {
|
|
64470
|
-
return getOnlyTypeFacts(type, mask) !== 0;
|
|
64471
|
-
}
|
|
64472
|
-
function getTypeFactsWorker(type, callerOnlyNeeds) {
|
|
64492
|
+
function getTypeFacts(type) {
|
|
64473
64493
|
if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
|
|
64474
64494
|
type = getBaseConstraintOfType(type) || unknownType;
|
|
64475
64495
|
}
|
|
@@ -64502,10 +64522,6 @@ function createTypeChecker(host) {
|
|
|
64502
64522
|
return strictNullChecks ? type === falseType || type === regularFalseType ? 12121864 /* FalseStrictFacts */ : 7927560 /* TrueStrictFacts */ : type === falseType || type === regularFalseType ? 12580616 /* FalseFacts */ : 16774920 /* TrueFacts */;
|
|
64503
64523
|
}
|
|
64504
64524
|
if (flags & 524288 /* Object */) {
|
|
64505
|
-
const possibleFacts = strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ | 7880640 /* FunctionStrictFacts */ | 7888800 /* ObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ | 16728e3 /* FunctionFacts */ | 16736160 /* ObjectFacts */;
|
|
64506
|
-
if ((callerOnlyNeeds & possibleFacts) === 0) {
|
|
64507
|
-
return 0;
|
|
64508
|
-
}
|
|
64509
64525
|
return getObjectFlags(type) & 16 /* Anonymous */ && isEmptyObjectType(type) ? strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ : isFunctionObjectType(type) ? strictNullChecks ? 7880640 /* FunctionStrictFacts */ : 16728e3 /* FunctionFacts */ : strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
|
|
64510
64526
|
}
|
|
64511
64527
|
if (flags & 16384 /* Void */) {
|
|
@@ -64527,20 +64543,20 @@ function createTypeChecker(host) {
|
|
|
64527
64543
|
return 0 /* None */;
|
|
64528
64544
|
}
|
|
64529
64545
|
if (flags & 1048576 /* Union */) {
|
|
64530
|
-
return reduceLeft(type.types, (facts, t) => facts |
|
|
64546
|
+
return reduceLeft(type.types, (facts, t) => facts | getTypeFacts(t), 0 /* None */);
|
|
64531
64547
|
}
|
|
64532
64548
|
if (flags & 2097152 /* Intersection */) {
|
|
64533
|
-
return getIntersectionTypeFacts(type
|
|
64549
|
+
return getIntersectionTypeFacts(type);
|
|
64534
64550
|
}
|
|
64535
64551
|
return 83886079 /* UnknownFacts */;
|
|
64536
64552
|
}
|
|
64537
|
-
function getIntersectionTypeFacts(type
|
|
64553
|
+
function getIntersectionTypeFacts(type) {
|
|
64538
64554
|
const ignoreObjects = maybeTypeOfKind(type, 402784252 /* Primitive */);
|
|
64539
64555
|
let oredFacts = 0 /* None */;
|
|
64540
64556
|
let andedFacts = 134217727 /* All */;
|
|
64541
64557
|
for (const t of type.types) {
|
|
64542
64558
|
if (!(ignoreObjects && t.flags & 524288 /* Object */)) {
|
|
64543
|
-
const f =
|
|
64559
|
+
const f = getTypeFacts(t);
|
|
64544
64560
|
oredFacts |= f;
|
|
64545
64561
|
andedFacts &= f;
|
|
64546
64562
|
}
|
|
@@ -64548,19 +64564,19 @@ function createTypeChecker(host) {
|
|
|
64548
64564
|
return oredFacts & 8256 /* OrFactsMask */ | andedFacts & 134209471 /* AndFactsMask */;
|
|
64549
64565
|
}
|
|
64550
64566
|
function getTypeWithFacts(type, include) {
|
|
64551
|
-
return filterType(type, (t) =>
|
|
64567
|
+
return filterType(type, (t) => (getTypeFacts(t) & include) !== 0);
|
|
64552
64568
|
}
|
|
64553
64569
|
function getAdjustedTypeWithFacts(type, facts) {
|
|
64554
64570
|
const reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 /* Unknown */ ? unknownUnionType : type, facts));
|
|
64555
64571
|
if (strictNullChecks) {
|
|
64556
64572
|
switch (facts) {
|
|
64557
64573
|
case 524288 /* NEUndefined */:
|
|
64558
|
-
return mapType(reduced, (t) =>
|
|
64574
|
+
return mapType(reduced, (t) => getTypeFacts(t) & 65536 /* EQUndefined */ ? getIntersectionType([t, getTypeFacts(t) & 131072 /* EQNull */ && !maybeTypeOfKind(reduced, 65536 /* Null */) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t);
|
|
64559
64575
|
case 1048576 /* NENull */:
|
|
64560
|
-
return mapType(reduced, (t) =>
|
|
64576
|
+
return mapType(reduced, (t) => getTypeFacts(t) & 131072 /* EQNull */ ? getIntersectionType([t, getTypeFacts(t) & 65536 /* EQUndefined */ && !maybeTypeOfKind(reduced, 32768 /* Undefined */) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t);
|
|
64561
64577
|
case 2097152 /* NEUndefinedOrNull */:
|
|
64562
64578
|
case 4194304 /* Truthy */:
|
|
64563
|
-
return mapType(reduced, (t) =>
|
|
64579
|
+
return mapType(reduced, (t) => getTypeFacts(t) & 262144 /* EQUndefinedOrNull */ ? getGlobalNonNullableTypeInstantiation(t) : t);
|
|
64564
64580
|
}
|
|
64565
64581
|
}
|
|
64566
64582
|
return reduced;
|
|
@@ -65547,7 +65563,7 @@ function createTypeChecker(host) {
|
|
|
65547
65563
|
return void 0;
|
|
65548
65564
|
}
|
|
65549
65565
|
function getDiscriminantPropertyAccess(expr, computedType) {
|
|
65550
|
-
const type = declaredType.flags & 1048576 /* Union */ ? declaredType : computedType;
|
|
65566
|
+
const type = !(computedType.flags & 1048576 /* Union */) && declaredType.flags & 1048576 /* Union */ ? declaredType : computedType;
|
|
65551
65567
|
if (type.flags & 1048576 /* Union */) {
|
|
65552
65568
|
const access = getCandidateDiscriminantPropertyAccess(expr);
|
|
65553
65569
|
if (access) {
|
|
@@ -65897,14 +65913,14 @@ function createTypeChecker(host) {
|
|
|
65897
65913
|
// the constituent based on its type facts. We use the strict subtype relation because it treats `object`
|
|
65898
65914
|
// as a subtype of `{}`, and we need the type facts check because function types are subtypes of `object`,
|
|
65899
65915
|
// but are classified as "function" according to `typeof`.
|
|
65900
|
-
isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ?
|
|
65916
|
+
isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? getTypeFacts(t) & facts ? t : neverType : (
|
|
65901
65917
|
// We next check if the consituent is a supertype of the implied type. If so, we substitute the implied
|
|
65902
65918
|
// type. This handles top types like `unknown` and `{}`, and supertypes like `{ toString(): string }`.
|
|
65903
65919
|
isTypeSubtypeOf(impliedType, t) ? impliedType : (
|
|
65904
65920
|
// Neither the constituent nor the implied type is a subtype of the other, however their domains may still
|
|
65905
65921
|
// overlap. For example, an unconstrained type parameter and type `string`. If the type facts indicate
|
|
65906
65922
|
// possible overlap, we form an intersection. Otherwise, we eliminate the constituent.
|
|
65907
|
-
|
|
65923
|
+
getTypeFacts(t) & facts ? getIntersectionType([t, impliedType]) : neverType
|
|
65908
65924
|
)
|
|
65909
65925
|
)
|
|
65910
65926
|
));
|
|
@@ -65918,7 +65934,7 @@ function createTypeChecker(host) {
|
|
|
65918
65934
|
const hasDefaultClause = clauseStart === clauseEnd || defaultIndex >= clauseStart && defaultIndex < clauseEnd;
|
|
65919
65935
|
if (hasDefaultClause) {
|
|
65920
65936
|
const notEqualFacts = getNotEqualFactsFromTypeofSwitch(clauseStart, clauseEnd, witnesses);
|
|
65921
|
-
return filterType(type, (t) =>
|
|
65937
|
+
return filterType(type, (t) => (getTypeFacts(t) & notEqualFacts) === notEqualFacts);
|
|
65922
65938
|
}
|
|
65923
65939
|
const clauseWitnesses = witnesses.slice(clauseStart, clauseEnd);
|
|
65924
65940
|
return getUnionType(map(clauseWitnesses, (text) => text ? narrowTypeByTypeName(type, text) : neverType));
|
|
@@ -66056,7 +66072,7 @@ function createTypeChecker(host) {
|
|
|
66056
66072
|
false
|
|
66057
66073
|
);
|
|
66058
66074
|
}
|
|
66059
|
-
if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) && !
|
|
66075
|
+
if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) && !(getTypeFacts(predicate.type) & 65536 /* EQUndefined */)) {
|
|
66060
66076
|
type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
66061
66077
|
}
|
|
66062
66078
|
const access = getDiscriminantPropertyAccess(predicateArgument, type);
|
|
@@ -66190,7 +66206,7 @@ function createTypeChecker(host) {
|
|
|
66190
66206
|
reportCircularityError(declaration.symbol);
|
|
66191
66207
|
return true;
|
|
66192
66208
|
}
|
|
66193
|
-
const containsUndefined = !!
|
|
66209
|
+
const containsUndefined = !!(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */);
|
|
66194
66210
|
if (!popTypeResolution()) {
|
|
66195
66211
|
reportCircularityError(declaration.symbol);
|
|
66196
66212
|
return true;
|
|
@@ -66200,7 +66216,7 @@ function createTypeChecker(host) {
|
|
|
66200
66216
|
return links.parameterInitializerContainsUndefined;
|
|
66201
66217
|
}
|
|
66202
66218
|
function removeOptionalityFromDeclaredType(declaredType, declaration) {
|
|
66203
|
-
const removeUndefined = strictNullChecks && declaration.kind === 169 /* Parameter */ && declaration.initializer &&
|
|
66219
|
+
const removeUndefined = strictNullChecks && declaration.kind === 169 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !parameterInitializerContainsUndefined(declaration);
|
|
66204
66220
|
return removeUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
|
|
66205
66221
|
}
|
|
66206
66222
|
function isConstraintPosition(type, node) {
|
|
@@ -69030,7 +69046,7 @@ function createTypeChecker(host) {
|
|
|
69030
69046
|
return checkNonNullType(checkExpression(node), node);
|
|
69031
69047
|
}
|
|
69032
69048
|
function isNullableType(type) {
|
|
69033
|
-
return
|
|
69049
|
+
return !!(getTypeFacts(type) & 50331648 /* IsUndefinedOrNull */);
|
|
69034
69050
|
}
|
|
69035
69051
|
function getNonNullableTypeIfNeeded(type) {
|
|
69036
69052
|
return isNullableType(type) ? getNonNullableType(type) : type;
|
|
@@ -69076,7 +69092,7 @@ function createTypeChecker(host) {
|
|
|
69076
69092
|
error(node, Diagnostics.Object_is_of_type_unknown);
|
|
69077
69093
|
return errorType;
|
|
69078
69094
|
}
|
|
69079
|
-
const facts =
|
|
69095
|
+
const facts = getTypeFacts(type);
|
|
69080
69096
|
if (facts & 50331648 /* IsUndefinedOrNull */) {
|
|
69081
69097
|
reportError(node, facts);
|
|
69082
69098
|
const t = getNonNullableType(type);
|
|
@@ -72856,7 +72872,7 @@ function createTypeChecker(host) {
|
|
|
72856
72872
|
if (operandConstraint.flags & 3 /* AnyOrUnknown */) {
|
|
72857
72873
|
return (556800 /* AllTypeofNE */ & notEqualFacts) === 556800 /* AllTypeofNE */;
|
|
72858
72874
|
}
|
|
72859
|
-
return !someType(operandConstraint, (t) =>
|
|
72875
|
+
return !someType(operandConstraint, (t) => (getTypeFacts(t) & notEqualFacts) === notEqualFacts);
|
|
72860
72876
|
}
|
|
72861
72877
|
const type = checkExpressionCached(node.expression);
|
|
72862
72878
|
if (!isLiteralType(type)) {
|
|
@@ -73181,7 +73197,7 @@ function createTypeChecker(host) {
|
|
|
73181
73197
|
}
|
|
73182
73198
|
function checkDeleteExpressionMustBeOptional(expr, symbol) {
|
|
73183
73199
|
const type = getTypeOfSymbol(symbol);
|
|
73184
|
-
if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ :
|
|
73200
|
+
if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getTypeFacts(type) & 16777216 /* IsUndefined */)) {
|
|
73185
73201
|
error(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
|
|
73186
73202
|
}
|
|
73187
73203
|
}
|
|
@@ -73316,7 +73332,7 @@ function createTypeChecker(host) {
|
|
|
73316
73332
|
return getUnaryResultType(operandType);
|
|
73317
73333
|
case 54 /* ExclamationToken */:
|
|
73318
73334
|
checkTruthinessOfType(operandType, node.operand);
|
|
73319
|
-
const facts =
|
|
73335
|
+
const facts = getTypeFacts(operandType) & (4194304 /* Truthy */ | 8388608 /* Falsy */);
|
|
73320
73336
|
return facts === 4194304 /* Truthy */ ? falseType : facts === 8388608 /* Falsy */ ? trueType : booleanType;
|
|
73321
73337
|
case 46 /* PlusPlusToken */:
|
|
73322
73338
|
case 47 /* MinusMinusToken */:
|
|
@@ -73547,7 +73563,7 @@ function createTypeChecker(host) {
|
|
|
73547
73563
|
if (exprOrAssignment.kind === 304 /* ShorthandPropertyAssignment */) {
|
|
73548
73564
|
const prop = exprOrAssignment;
|
|
73549
73565
|
if (prop.objectAssignmentInitializer) {
|
|
73550
|
-
if (strictNullChecks && !
|
|
73566
|
+
if (strictNullChecks && !(getTypeFacts(checkExpression(prop.objectAssignmentInitializer)) & 16777216 /* IsUndefined */)) {
|
|
73551
73567
|
sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */);
|
|
73552
73568
|
}
|
|
73553
73569
|
checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode);
|
|
@@ -73959,7 +73975,7 @@ function createTypeChecker(host) {
|
|
|
73959
73975
|
return checkInExpression(left, right, leftType, rightType);
|
|
73960
73976
|
case 56 /* AmpersandAmpersandToken */:
|
|
73961
73977
|
case 77 /* AmpersandAmpersandEqualsToken */: {
|
|
73962
|
-
const resultType2 =
|
|
73978
|
+
const resultType2 = getTypeFacts(leftType) & 4194304 /* Truthy */ ? getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) : leftType;
|
|
73963
73979
|
if (operator === 77 /* AmpersandAmpersandEqualsToken */) {
|
|
73964
73980
|
checkAssignmentOperator(rightType);
|
|
73965
73981
|
}
|
|
@@ -73967,7 +73983,7 @@ function createTypeChecker(host) {
|
|
|
73967
73983
|
}
|
|
73968
73984
|
case 57 /* BarBarToken */:
|
|
73969
73985
|
case 76 /* BarBarEqualsToken */: {
|
|
73970
|
-
const resultType2 =
|
|
73986
|
+
const resultType2 = getTypeFacts(leftType) & 8388608 /* Falsy */ ? getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) : leftType;
|
|
73971
73987
|
if (operator === 76 /* BarBarEqualsToken */) {
|
|
73972
73988
|
checkAssignmentOperator(rightType);
|
|
73973
73989
|
}
|
|
@@ -73975,7 +73991,7 @@ function createTypeChecker(host) {
|
|
|
73975
73991
|
}
|
|
73976
73992
|
case 61 /* QuestionQuestionToken */:
|
|
73977
73993
|
case 78 /* QuestionQuestionEqualsToken */: {
|
|
73978
|
-
const resultType2 =
|
|
73994
|
+
const resultType2 = getTypeFacts(leftType) & 262144 /* EQUndefinedOrNull */ ? getUnionType([getNonNullableType(leftType), rightType], 2 /* Subtype */) : leftType;
|
|
73979
73995
|
if (operator === 78 /* QuestionQuestionEqualsToken */) {
|
|
73980
73996
|
checkAssignmentOperator(rightType);
|
|
73981
73997
|
}
|
|
@@ -77292,7 +77308,7 @@ function createTypeChecker(host) {
|
|
|
77292
77308
|
}
|
|
77293
77309
|
const type = location === condExpr2 ? condType : checkTruthinessExpression(location);
|
|
77294
77310
|
const isPropertyExpressionCast = isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
|
|
77295
|
-
if (!
|
|
77311
|
+
if (!(getTypeFacts(type) & 4194304 /* Truthy */) || isPropertyExpressionCast)
|
|
77296
77312
|
return;
|
|
77297
77313
|
const callSignatures = getSignaturesOfType(type, 0 /* Call */);
|
|
77298
77314
|
const isPromise = !!getAwaitedTypeOfPromise(type);
|