@typescript-deploys/pr-build 5.3.0-pr-55476-8 → 5.3.0-pr-55503-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/lib/tsc.js +53 -46
- package/lib/tsserver.js +57 -49
- package/lib/typescript.js +57 -49
- package/lib/typingsInstaller.js +4 -4
- package/package.json +2 -5
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.20230824`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -5955,7 +5955,6 @@ var Diagnostics = {
|
|
|
5955
5955
|
Module_0_can_only_be_default_imported_using_the_1_flag: diag(1259, 1 /* Error */, "Module_0_can_only_be_default_imported_using_the_1_flag_1259", "Module '{0}' can only be default-imported using the '{1}' flag"),
|
|
5956
5956
|
Keywords_cannot_contain_escape_characters: diag(1260, 1 /* Error */, "Keywords_cannot_contain_escape_characters_1260", "Keywords cannot contain escape characters."),
|
|
5957
5957
|
Already_included_file_name_0_differs_from_file_name_1_only_in_casing: diag(1261, 1 /* Error */, "Already_included_file_name_0_differs_from_file_name_1_only_in_casing_1261", "Already included file name '{0}' differs from file name '{1}' only in casing."),
|
|
5958
|
-
Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module: diag(1262, 1 /* Error */, "Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module_1262", "Identifier expected. '{0}' is a reserved word at the top-level of a module."),
|
|
5959
5958
|
Declarations_with_initializers_cannot_also_have_definite_assignment_assertions: diag(1263, 1 /* Error */, "Declarations_with_initializers_cannot_also_have_definite_assignment_assertions_1263", "Declarations with initializers cannot also have definite assignment assertions."),
|
|
5960
5959
|
Declarations_with_definite_assignment_assertions_must_also_have_type_annotations: diag(1264, 1 /* Error */, "Declarations_with_definite_assignment_assertions_must_also_have_type_annotations_1264", "Declarations with definite assignment assertions must also have type annotations."),
|
|
5961
5960
|
A_rest_element_cannot_follow_another_rest_element: diag(1265, 1 /* Error */, "A_rest_element_cannot_follow_another_rest_element_1265", "A rest element cannot follow another rest element."),
|
|
@@ -11839,7 +11838,7 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
|
|
|
11839
11838
|
"defineProperty",
|
|
11840
11839
|
"deleteProperty",
|
|
11841
11840
|
"get",
|
|
11842
|
-
"
|
|
11841
|
+
"getOwnPropertyDescriptor",
|
|
11843
11842
|
"getPrototypeOf",
|
|
11844
11843
|
"has",
|
|
11845
11844
|
"isExtensible",
|
|
@@ -29967,7 +29966,9 @@ var Parser;
|
|
|
29967
29966
|
let dotDotDotToken;
|
|
29968
29967
|
let expression;
|
|
29969
29968
|
if (token() !== 20 /* CloseBraceToken */) {
|
|
29970
|
-
|
|
29969
|
+
if (!inExpressionContext) {
|
|
29970
|
+
dotDotDotToken = parseOptionalToken(26 /* DotDotDotToken */);
|
|
29971
|
+
}
|
|
29971
29972
|
expression = parseExpression();
|
|
29972
29973
|
}
|
|
29973
29974
|
if (inExpressionContext) {
|
|
@@ -40898,12 +40899,8 @@ function createBinder() {
|
|
|
40898
40899
|
}
|
|
40899
40900
|
if (inStrictMode && originalKeywordKind >= 119 /* FirstFutureReservedWord */ && originalKeywordKind <= 127 /* LastFutureReservedWord */) {
|
|
40900
40901
|
file.bindDiagnostics.push(createDiagnosticForNode2(node, getStrictModeIdentifierMessage(node), declarationNameToString(node)));
|
|
40901
|
-
} else if (originalKeywordKind === 135 /* AwaitKeyword */) {
|
|
40902
|
-
|
|
40903
|
-
file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module, declarationNameToString(node)));
|
|
40904
|
-
} else if (node.flags & 65536 /* AwaitContext */) {
|
|
40905
|
-
file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here, declarationNameToString(node)));
|
|
40906
|
-
}
|
|
40902
|
+
} else if (originalKeywordKind === 135 /* AwaitKeyword */ && (node.flags & 65536 /* AwaitContext */ || isExternalModule(file))) {
|
|
40903
|
+
file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here, declarationNameToString(node)));
|
|
40907
40904
|
} else if (originalKeywordKind === 127 /* YieldKeyword */ && node.flags & 16384 /* YieldContext */) {
|
|
40908
40905
|
file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here, declarationNameToString(node)));
|
|
40909
40906
|
}
|
|
@@ -44418,6 +44415,9 @@ function createTypeChecker(host) {
|
|
|
44418
44415
|
const sourceFiles = host.getSourceFiles();
|
|
44419
44416
|
return sourceFiles.indexOf(declarationFile) <= sourceFiles.indexOf(useFile);
|
|
44420
44417
|
}
|
|
44418
|
+
if (!!(usage.flags & 16777216 /* JSDoc */) || isInTypeQuery(usage) || isInAmbientOrTypeNode(usage)) {
|
|
44419
|
+
return true;
|
|
44420
|
+
}
|
|
44421
44421
|
if (declaration.pos <= usage.pos && !(isPropertyDeclaration(declaration) && isThisProperty(usage.parent) && !declaration.initializer && !declaration.exclamationToken)) {
|
|
44422
44422
|
if (declaration.kind === 208 /* BindingElement */) {
|
|
44423
44423
|
const errorBindingElement = getAncestor(usage, 208 /* BindingElement */);
|
|
@@ -44447,9 +44447,6 @@ function createTypeChecker(host) {
|
|
|
44447
44447
|
if (usage.kind === 277 /* ExportAssignment */ && usage.isExportEquals) {
|
|
44448
44448
|
return true;
|
|
44449
44449
|
}
|
|
44450
|
-
if (!!(usage.flags & 16777216 /* JSDoc */) || isInTypeQuery(usage) || isInAmbientOrTypeNode(usage)) {
|
|
44451
|
-
return true;
|
|
44452
|
-
}
|
|
44453
44450
|
if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
|
|
44454
44451
|
if (emitStandardClassFields && getContainingClass(declaration) && (isPropertyDeclaration(declaration) || isParameterPropertyDeclaration(declaration, declaration.parent))) {
|
|
44455
44452
|
return !isPropertyImmediatelyReferencedWithinDeclaration(
|
|
@@ -50659,8 +50656,8 @@ function createTypeChecker(host) {
|
|
|
50659
50656
|
});
|
|
50660
50657
|
}
|
|
50661
50658
|
});
|
|
50662
|
-
Debug.assert(setter
|
|
50663
|
-
const paramSymbol = getSignatureFromDeclaration(setter).parameters[0];
|
|
50659
|
+
Debug.assert(!!setter);
|
|
50660
|
+
const paramSymbol = isFunctionLikeDeclaration(setter) ? getSignatureFromDeclaration(setter).parameters[0] : void 0;
|
|
50664
50661
|
result.push(setTextRange(
|
|
50665
50662
|
factory.createSetAccessorDeclaration(
|
|
50666
50663
|
factory.createModifiersFromModifierFlags(flag),
|
|
@@ -51436,7 +51433,7 @@ function createTypeChecker(host) {
|
|
|
51436
51433
|
const pattern = declaration.parent;
|
|
51437
51434
|
if (strictNullChecks && declaration.flags & 33554432 /* Ambient */ && isParameterDeclaration(declaration)) {
|
|
51438
51435
|
parentType = getNonNullableType(parentType);
|
|
51439
|
-
} else if (strictNullChecks && pattern.parent.initializer && !(
|
|
51436
|
+
} else if (strictNullChecks && pattern.parent.initializer && !hasTypeFacts(getTypeOfInitializer(pattern.parent.initializer), 65536 /* EQUndefined */)) {
|
|
51440
51437
|
parentType = getTypeWithFacts(parentType, 524288 /* NEUndefined */);
|
|
51441
51438
|
}
|
|
51442
51439
|
let type;
|
|
@@ -51479,7 +51476,7 @@ function createTypeChecker(host) {
|
|
|
51479
51476
|
return type;
|
|
51480
51477
|
}
|
|
51481
51478
|
if (getEffectiveTypeAnnotationNode(walkUpBindingElementsAndPatterns(declaration))) {
|
|
51482
|
-
return strictNullChecks && !(
|
|
51479
|
+
return strictNullChecks && !hasTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */), 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
|
|
51483
51480
|
}
|
|
51484
51481
|
return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration, 0 /* Normal */)], 2 /* Subtype */));
|
|
51485
51482
|
}
|
|
@@ -59587,7 +59584,7 @@ function createTypeChecker(host) {
|
|
|
59587
59584
|
if (sourceType && targetType) {
|
|
59588
59585
|
const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
59589
59586
|
const targetSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
|
|
59590
|
-
const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) &&
|
|
59587
|
+
const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && getTypeFacts(sourceType, 50331648 /* IsUndefinedOrNull */) === getTypeFacts(targetType, 50331648 /* IsUndefinedOrNull */);
|
|
59591
59588
|
let related = callbacks ? compareSignaturesRelated(targetSig, sourceSig, checkMode & 8 /* StrictArity */ | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) : !(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(
|
|
59592
59589
|
sourceType,
|
|
59593
59590
|
targetType,
|
|
@@ -62744,7 +62741,7 @@ function createTypeChecker(host) {
|
|
|
62744
62741
|
return value.base10Value === "0";
|
|
62745
62742
|
}
|
|
62746
62743
|
function removeDefinitelyFalsyTypes(type) {
|
|
62747
|
-
return filterType(type, (t) =>
|
|
62744
|
+
return filterType(type, (t) => hasTypeFacts(t, 4194304 /* Truthy */));
|
|
62748
62745
|
}
|
|
62749
62746
|
function extractDefinitelyFalsyTypes(type) {
|
|
62750
62747
|
return mapType(type, getDefinitelyFalsyPartOfType);
|
|
@@ -64489,7 +64486,13 @@ function createTypeChecker(host) {
|
|
|
64489
64486
|
const resolved = resolveStructuredTypeMembers(type);
|
|
64490
64487
|
return !!(resolved.callSignatures.length || resolved.constructSignatures.length || resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
|
|
64491
64488
|
}
|
|
64492
|
-
function getTypeFacts(type) {
|
|
64489
|
+
function getTypeFacts(type, mask) {
|
|
64490
|
+
return getTypeFactsWorker(type, mask) & mask;
|
|
64491
|
+
}
|
|
64492
|
+
function hasTypeFacts(type, mask) {
|
|
64493
|
+
return getTypeFacts(type, mask) !== 0;
|
|
64494
|
+
}
|
|
64495
|
+
function getTypeFactsWorker(type, callerOnlyNeeds) {
|
|
64493
64496
|
if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
|
|
64494
64497
|
type = getBaseConstraintOfType(type) || unknownType;
|
|
64495
64498
|
}
|
|
@@ -64522,6 +64525,10 @@ function createTypeChecker(host) {
|
|
|
64522
64525
|
return strictNullChecks ? type === falseType || type === regularFalseType ? 12121864 /* FalseStrictFacts */ : 7927560 /* TrueStrictFacts */ : type === falseType || type === regularFalseType ? 12580616 /* FalseFacts */ : 16774920 /* TrueFacts */;
|
|
64523
64526
|
}
|
|
64524
64527
|
if (flags & 524288 /* Object */) {
|
|
64528
|
+
const possibleFacts = strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ | 7880640 /* FunctionStrictFacts */ | 7888800 /* ObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ | 16728e3 /* FunctionFacts */ | 16736160 /* ObjectFacts */;
|
|
64529
|
+
if ((callerOnlyNeeds & possibleFacts) === 0) {
|
|
64530
|
+
return 0;
|
|
64531
|
+
}
|
|
64525
64532
|
return getObjectFlags(type) & 16 /* Anonymous */ && isEmptyObjectType(type) ? strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ : isFunctionObjectType(type) ? strictNullChecks ? 7880640 /* FunctionStrictFacts */ : 16728e3 /* FunctionFacts */ : strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
|
|
64526
64533
|
}
|
|
64527
64534
|
if (flags & 16384 /* Void */) {
|
|
@@ -64543,20 +64550,20 @@ function createTypeChecker(host) {
|
|
|
64543
64550
|
return 0 /* None */;
|
|
64544
64551
|
}
|
|
64545
64552
|
if (flags & 1048576 /* Union */) {
|
|
64546
|
-
return reduceLeft(type.types, (facts, t) => facts |
|
|
64553
|
+
return reduceLeft(type.types, (facts, t) => facts | getTypeFactsWorker(t, callerOnlyNeeds), 0 /* None */);
|
|
64547
64554
|
}
|
|
64548
64555
|
if (flags & 2097152 /* Intersection */) {
|
|
64549
|
-
return getIntersectionTypeFacts(type);
|
|
64556
|
+
return getIntersectionTypeFacts(type, callerOnlyNeeds);
|
|
64550
64557
|
}
|
|
64551
64558
|
return 83886079 /* UnknownFacts */;
|
|
64552
64559
|
}
|
|
64553
|
-
function getIntersectionTypeFacts(type) {
|
|
64560
|
+
function getIntersectionTypeFacts(type, callerOnlyNeeds) {
|
|
64554
64561
|
const ignoreObjects = maybeTypeOfKind(type, 402784252 /* Primitive */);
|
|
64555
64562
|
let oredFacts = 0 /* None */;
|
|
64556
64563
|
let andedFacts = 134217727 /* All */;
|
|
64557
64564
|
for (const t of type.types) {
|
|
64558
64565
|
if (!(ignoreObjects && t.flags & 524288 /* Object */)) {
|
|
64559
|
-
const f =
|
|
64566
|
+
const f = getTypeFactsWorker(t, callerOnlyNeeds);
|
|
64560
64567
|
oredFacts |= f;
|
|
64561
64568
|
andedFacts &= f;
|
|
64562
64569
|
}
|
|
@@ -64564,19 +64571,19 @@ function createTypeChecker(host) {
|
|
|
64564
64571
|
return oredFacts & 8256 /* OrFactsMask */ | andedFacts & 134209471 /* AndFactsMask */;
|
|
64565
64572
|
}
|
|
64566
64573
|
function getTypeWithFacts(type, include) {
|
|
64567
|
-
return filterType(type, (t) => (
|
|
64574
|
+
return filterType(type, (t) => hasTypeFacts(t, include));
|
|
64568
64575
|
}
|
|
64569
64576
|
function getAdjustedTypeWithFacts(type, facts) {
|
|
64570
64577
|
const reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 /* Unknown */ ? unknownUnionType : type, facts));
|
|
64571
64578
|
if (strictNullChecks) {
|
|
64572
64579
|
switch (facts) {
|
|
64573
64580
|
case 524288 /* NEUndefined */:
|
|
64574
|
-
return mapType(reduced, (t) =>
|
|
64581
|
+
return mapType(reduced, (t) => hasTypeFacts(t, 65536 /* EQUndefined */) ? getIntersectionType([t, hasTypeFacts(t, 131072 /* EQNull */) && !maybeTypeOfKind(reduced, 65536 /* Null */) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t);
|
|
64575
64582
|
case 1048576 /* NENull */:
|
|
64576
|
-
return mapType(reduced, (t) =>
|
|
64583
|
+
return mapType(reduced, (t) => hasTypeFacts(t, 131072 /* EQNull */) ? getIntersectionType([t, hasTypeFacts(t, 65536 /* EQUndefined */) && !maybeTypeOfKind(reduced, 32768 /* Undefined */) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t);
|
|
64577
64584
|
case 2097152 /* NEUndefinedOrNull */:
|
|
64578
64585
|
case 4194304 /* Truthy */:
|
|
64579
|
-
return mapType(reduced, (t) =>
|
|
64586
|
+
return mapType(reduced, (t) => hasTypeFacts(t, 262144 /* EQUndefinedOrNull */) ? getGlobalNonNullableTypeInstantiation(t) : t);
|
|
64580
64587
|
}
|
|
64581
64588
|
}
|
|
64582
64589
|
return reduced;
|
|
@@ -65913,14 +65920,14 @@ function createTypeChecker(host) {
|
|
|
65913
65920
|
// the constituent based on its type facts. We use the strict subtype relation because it treats `object`
|
|
65914
65921
|
// as a subtype of `{}`, and we need the type facts check because function types are subtypes of `object`,
|
|
65915
65922
|
// but are classified as "function" according to `typeof`.
|
|
65916
|
-
isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ?
|
|
65923
|
+
isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? hasTypeFacts(t, facts) ? t : neverType : (
|
|
65917
65924
|
// We next check if the consituent is a supertype of the implied type. If so, we substitute the implied
|
|
65918
65925
|
// type. This handles top types like `unknown` and `{}`, and supertypes like `{ toString(): string }`.
|
|
65919
65926
|
isTypeSubtypeOf(impliedType, t) ? impliedType : (
|
|
65920
65927
|
// Neither the constituent nor the implied type is a subtype of the other, however their domains may still
|
|
65921
65928
|
// overlap. For example, an unconstrained type parameter and type `string`. If the type facts indicate
|
|
65922
65929
|
// possible overlap, we form an intersection. Otherwise, we eliminate the constituent.
|
|
65923
|
-
|
|
65930
|
+
hasTypeFacts(t, facts) ? getIntersectionType([t, impliedType]) : neverType
|
|
65924
65931
|
)
|
|
65925
65932
|
)
|
|
65926
65933
|
));
|
|
@@ -65934,7 +65941,7 @@ function createTypeChecker(host) {
|
|
|
65934
65941
|
const hasDefaultClause = clauseStart === clauseEnd || defaultIndex >= clauseStart && defaultIndex < clauseEnd;
|
|
65935
65942
|
if (hasDefaultClause) {
|
|
65936
65943
|
const notEqualFacts = getNotEqualFactsFromTypeofSwitch(clauseStart, clauseEnd, witnesses);
|
|
65937
|
-
return filterType(type, (t) =>
|
|
65944
|
+
return filterType(type, (t) => getTypeFacts(t, notEqualFacts) === notEqualFacts);
|
|
65938
65945
|
}
|
|
65939
65946
|
const clauseWitnesses = witnesses.slice(clauseStart, clauseEnd);
|
|
65940
65947
|
return getUnionType(map(clauseWitnesses, (text) => text ? narrowTypeByTypeName(type, text) : neverType));
|
|
@@ -66072,7 +66079,7 @@ function createTypeChecker(host) {
|
|
|
66072
66079
|
false
|
|
66073
66080
|
);
|
|
66074
66081
|
}
|
|
66075
|
-
if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) && !(
|
|
66082
|
+
if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) && !hasTypeFacts(predicate.type, 65536 /* EQUndefined */)) {
|
|
66076
66083
|
type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
66077
66084
|
}
|
|
66078
66085
|
const access = getDiscriminantPropertyAccess(predicateArgument, type);
|
|
@@ -66206,7 +66213,7 @@ function createTypeChecker(host) {
|
|
|
66206
66213
|
reportCircularityError(declaration.symbol);
|
|
66207
66214
|
return true;
|
|
66208
66215
|
}
|
|
66209
|
-
const containsUndefined = !!(
|
|
66216
|
+
const containsUndefined = !!hasTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */), 16777216 /* IsUndefined */);
|
|
66210
66217
|
if (!popTypeResolution()) {
|
|
66211
66218
|
reportCircularityError(declaration.symbol);
|
|
66212
66219
|
return true;
|
|
@@ -66216,7 +66223,7 @@ function createTypeChecker(host) {
|
|
|
66216
66223
|
return links.parameterInitializerContainsUndefined;
|
|
66217
66224
|
}
|
|
66218
66225
|
function removeOptionalityFromDeclaredType(declaredType, declaration) {
|
|
66219
|
-
const removeUndefined = strictNullChecks && declaration.kind === 169 /* Parameter */ && declaration.initializer &&
|
|
66226
|
+
const removeUndefined = strictNullChecks && declaration.kind === 169 /* Parameter */ && declaration.initializer && hasTypeFacts(declaredType, 16777216 /* IsUndefined */) && !parameterInitializerContainsUndefined(declaration);
|
|
66220
66227
|
return removeUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
|
|
66221
66228
|
}
|
|
66222
66229
|
function isConstraintPosition(type, node) {
|
|
@@ -69046,7 +69053,7 @@ function createTypeChecker(host) {
|
|
|
69046
69053
|
return checkNonNullType(checkExpression(node), node);
|
|
69047
69054
|
}
|
|
69048
69055
|
function isNullableType(type) {
|
|
69049
|
-
return
|
|
69056
|
+
return hasTypeFacts(type, 50331648 /* IsUndefinedOrNull */);
|
|
69050
69057
|
}
|
|
69051
69058
|
function getNonNullableTypeIfNeeded(type) {
|
|
69052
69059
|
return isNullableType(type) ? getNonNullableType(type) : type;
|
|
@@ -69092,7 +69099,7 @@ function createTypeChecker(host) {
|
|
|
69092
69099
|
error(node, Diagnostics.Object_is_of_type_unknown);
|
|
69093
69100
|
return errorType;
|
|
69094
69101
|
}
|
|
69095
|
-
const facts = getTypeFacts(type);
|
|
69102
|
+
const facts = getTypeFacts(type, 50331648 /* IsUndefinedOrNull */);
|
|
69096
69103
|
if (facts & 50331648 /* IsUndefinedOrNull */) {
|
|
69097
69104
|
reportError(node, facts);
|
|
69098
69105
|
const t = getNonNullableType(type);
|
|
@@ -72872,7 +72879,7 @@ function createTypeChecker(host) {
|
|
|
72872
72879
|
if (operandConstraint.flags & 3 /* AnyOrUnknown */) {
|
|
72873
72880
|
return (556800 /* AllTypeofNE */ & notEqualFacts) === 556800 /* AllTypeofNE */;
|
|
72874
72881
|
}
|
|
72875
|
-
return !someType(operandConstraint, (t) =>
|
|
72882
|
+
return !someType(operandConstraint, (t) => getTypeFacts(t, notEqualFacts) === notEqualFacts);
|
|
72876
72883
|
}
|
|
72877
72884
|
const type = checkExpressionCached(node.expression);
|
|
72878
72885
|
if (!isLiteralType(type)) {
|
|
@@ -73190,14 +73197,15 @@ function createTypeChecker(host) {
|
|
|
73190
73197
|
if (symbol) {
|
|
73191
73198
|
if (isReadonlySymbol(symbol)) {
|
|
73192
73199
|
error(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property);
|
|
73200
|
+
} else {
|
|
73201
|
+
checkDeleteExpressionMustBeOptional(expr, symbol);
|
|
73193
73202
|
}
|
|
73194
|
-
checkDeleteExpressionMustBeOptional(expr, symbol);
|
|
73195
73203
|
}
|
|
73196
73204
|
return booleanType;
|
|
73197
73205
|
}
|
|
73198
73206
|
function checkDeleteExpressionMustBeOptional(expr, symbol) {
|
|
73199
73207
|
const type = getTypeOfSymbol(symbol);
|
|
73200
|
-
if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ :
|
|
73208
|
+
if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : hasTypeFacts(type, 16777216 /* IsUndefined */))) {
|
|
73201
73209
|
error(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
|
|
73202
73210
|
}
|
|
73203
73211
|
}
|
|
@@ -73332,7 +73340,7 @@ function createTypeChecker(host) {
|
|
|
73332
73340
|
return getUnaryResultType(operandType);
|
|
73333
73341
|
case 54 /* ExclamationToken */:
|
|
73334
73342
|
checkTruthinessOfType(operandType, node.operand);
|
|
73335
|
-
const facts = getTypeFacts(operandType
|
|
73343
|
+
const facts = getTypeFacts(operandType, 4194304 /* Truthy */ | 8388608 /* Falsy */);
|
|
73336
73344
|
return facts === 4194304 /* Truthy */ ? falseType : facts === 8388608 /* Falsy */ ? trueType : booleanType;
|
|
73337
73345
|
case 46 /* PlusPlusToken */:
|
|
73338
73346
|
case 47 /* MinusMinusToken */:
|
|
@@ -73563,7 +73571,7 @@ function createTypeChecker(host) {
|
|
|
73563
73571
|
if (exprOrAssignment.kind === 304 /* ShorthandPropertyAssignment */) {
|
|
73564
73572
|
const prop = exprOrAssignment;
|
|
73565
73573
|
if (prop.objectAssignmentInitializer) {
|
|
73566
|
-
if (strictNullChecks && !(
|
|
73574
|
+
if (strictNullChecks && !hasTypeFacts(checkExpression(prop.objectAssignmentInitializer), 16777216 /* IsUndefined */)) {
|
|
73567
73575
|
sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */);
|
|
73568
73576
|
}
|
|
73569
73577
|
checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode);
|
|
@@ -73975,7 +73983,7 @@ function createTypeChecker(host) {
|
|
|
73975
73983
|
return checkInExpression(left, right, leftType, rightType);
|
|
73976
73984
|
case 56 /* AmpersandAmpersandToken */:
|
|
73977
73985
|
case 77 /* AmpersandAmpersandEqualsToken */: {
|
|
73978
|
-
const resultType2 =
|
|
73986
|
+
const resultType2 = hasTypeFacts(leftType, 4194304 /* Truthy */) ? getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) : leftType;
|
|
73979
73987
|
if (operator === 77 /* AmpersandAmpersandEqualsToken */) {
|
|
73980
73988
|
checkAssignmentOperator(rightType);
|
|
73981
73989
|
}
|
|
@@ -73983,7 +73991,7 @@ function createTypeChecker(host) {
|
|
|
73983
73991
|
}
|
|
73984
73992
|
case 57 /* BarBarToken */:
|
|
73985
73993
|
case 76 /* BarBarEqualsToken */: {
|
|
73986
|
-
const resultType2 =
|
|
73994
|
+
const resultType2 = hasTypeFacts(leftType, 8388608 /* Falsy */) ? getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) : leftType;
|
|
73987
73995
|
if (operator === 76 /* BarBarEqualsToken */) {
|
|
73988
73996
|
checkAssignmentOperator(rightType);
|
|
73989
73997
|
}
|
|
@@ -73991,7 +73999,7 @@ function createTypeChecker(host) {
|
|
|
73991
73999
|
}
|
|
73992
74000
|
case 61 /* QuestionQuestionToken */:
|
|
73993
74001
|
case 78 /* QuestionQuestionEqualsToken */: {
|
|
73994
|
-
const resultType2 =
|
|
74002
|
+
const resultType2 = hasTypeFacts(leftType, 262144 /* EQUndefinedOrNull */) ? getUnionType([getNonNullableType(leftType), rightType], 2 /* Subtype */) : leftType;
|
|
73995
74003
|
if (operator === 78 /* QuestionQuestionEqualsToken */) {
|
|
73996
74004
|
checkAssignmentOperator(rightType);
|
|
73997
74005
|
}
|
|
@@ -77308,7 +77316,7 @@ function createTypeChecker(host) {
|
|
|
77308
77316
|
}
|
|
77309
77317
|
const type = location === condExpr2 ? condType : checkTruthinessExpression(location);
|
|
77310
77318
|
const isPropertyExpressionCast = isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
|
|
77311
|
-
if (!(
|
|
77319
|
+
if (!hasTypeFacts(type, 4194304 /* Truthy */) || isPropertyExpressionCast)
|
|
77312
77320
|
return;
|
|
77313
77321
|
const callSignatures = getSignaturesOfType(type, 0 /* Call */);
|
|
77314
77322
|
const isPromise = !!getAwaitedTypeOfPromise(type);
|
|
@@ -115279,7 +115287,6 @@ var plainJSErrors = /* @__PURE__ */ new Set([
|
|
|
115279
115287
|
Diagnostics.A_module_cannot_have_multiple_default_exports.code,
|
|
115280
115288
|
Diagnostics.Another_export_default_is_here.code,
|
|
115281
115289
|
Diagnostics.The_first_export_default_is_here.code,
|
|
115282
|
-
Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module.code,
|
|
115283
115290
|
Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode.code,
|
|
115284
115291
|
Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here.code,
|
|
115285
115292
|
Diagnostics.constructor_is_a_reserved_word.code,
|
package/lib/tsserver.js
CHANGED
|
@@ -2333,7 +2333,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2333
2333
|
|
|
2334
2334
|
// src/compiler/corePublic.ts
|
|
2335
2335
|
var versionMajorMinor = "5.3";
|
|
2336
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2336
|
+
var version = `${versionMajorMinor}.0-insiders.20230824`;
|
|
2337
2337
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2338
2338
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2339
2339
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -9480,7 +9480,6 @@ var Diagnostics = {
|
|
|
9480
9480
|
Module_0_can_only_be_default_imported_using_the_1_flag: diag(1259, 1 /* Error */, "Module_0_can_only_be_default_imported_using_the_1_flag_1259", "Module '{0}' can only be default-imported using the '{1}' flag"),
|
|
9481
9481
|
Keywords_cannot_contain_escape_characters: diag(1260, 1 /* Error */, "Keywords_cannot_contain_escape_characters_1260", "Keywords cannot contain escape characters."),
|
|
9482
9482
|
Already_included_file_name_0_differs_from_file_name_1_only_in_casing: diag(1261, 1 /* Error */, "Already_included_file_name_0_differs_from_file_name_1_only_in_casing_1261", "Already included file name '{0}' differs from file name '{1}' only in casing."),
|
|
9483
|
-
Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module: diag(1262, 1 /* Error */, "Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module_1262", "Identifier expected. '{0}' is a reserved word at the top-level of a module."),
|
|
9484
9483
|
Declarations_with_initializers_cannot_also_have_definite_assignment_assertions: diag(1263, 1 /* Error */, "Declarations_with_initializers_cannot_also_have_definite_assignment_assertions_1263", "Declarations with initializers cannot also have definite assignment assertions."),
|
|
9485
9484
|
Declarations_with_definite_assignment_assertions_must_also_have_type_annotations: diag(1264, 1 /* Error */, "Declarations_with_definite_assignment_assertions_must_also_have_type_annotations_1264", "Declarations with definite assignment assertions must also have type annotations."),
|
|
9486
9485
|
A_rest_element_cannot_follow_another_rest_element: diag(1265, 1 /* Error */, "A_rest_element_cannot_follow_another_rest_element_1265", "A rest element cannot follow another rest element."),
|
|
@@ -15609,7 +15608,7 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
|
|
|
15609
15608
|
"defineProperty",
|
|
15610
15609
|
"deleteProperty",
|
|
15611
15610
|
"get",
|
|
15612
|
-
"
|
|
15611
|
+
"getOwnPropertyDescriptor",
|
|
15613
15612
|
"getPrototypeOf",
|
|
15614
15613
|
"has",
|
|
15615
15614
|
"isExtensible",
|
|
@@ -34369,7 +34368,9 @@ var Parser;
|
|
|
34369
34368
|
let dotDotDotToken;
|
|
34370
34369
|
let expression;
|
|
34371
34370
|
if (token() !== 20 /* CloseBraceToken */) {
|
|
34372
|
-
|
|
34371
|
+
if (!inExpressionContext) {
|
|
34372
|
+
dotDotDotToken = parseOptionalToken(26 /* DotDotDotToken */);
|
|
34373
|
+
}
|
|
34373
34374
|
expression = parseExpression();
|
|
34374
34375
|
}
|
|
34375
34376
|
if (inExpressionContext) {
|
|
@@ -45561,12 +45562,8 @@ function createBinder() {
|
|
|
45561
45562
|
}
|
|
45562
45563
|
if (inStrictMode && originalKeywordKind >= 119 /* FirstFutureReservedWord */ && originalKeywordKind <= 127 /* LastFutureReservedWord */) {
|
|
45563
45564
|
file.bindDiagnostics.push(createDiagnosticForNode2(node, getStrictModeIdentifierMessage(node), declarationNameToString(node)));
|
|
45564
|
-
} else if (originalKeywordKind === 135 /* AwaitKeyword */) {
|
|
45565
|
-
|
|
45566
|
-
file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module, declarationNameToString(node)));
|
|
45567
|
-
} else if (node.flags & 65536 /* AwaitContext */) {
|
|
45568
|
-
file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here, declarationNameToString(node)));
|
|
45569
|
-
}
|
|
45565
|
+
} else if (originalKeywordKind === 135 /* AwaitKeyword */ && (node.flags & 65536 /* AwaitContext */ || isExternalModule(file))) {
|
|
45566
|
+
file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here, declarationNameToString(node)));
|
|
45570
45567
|
} else if (originalKeywordKind === 127 /* YieldKeyword */ && node.flags & 16384 /* YieldContext */) {
|
|
45571
45568
|
file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here, declarationNameToString(node)));
|
|
45572
45569
|
}
|
|
@@ -49126,6 +49123,9 @@ function createTypeChecker(host) {
|
|
|
49126
49123
|
const sourceFiles = host.getSourceFiles();
|
|
49127
49124
|
return sourceFiles.indexOf(declarationFile) <= sourceFiles.indexOf(useFile);
|
|
49128
49125
|
}
|
|
49126
|
+
if (!!(usage.flags & 16777216 /* JSDoc */) || isInTypeQuery(usage) || isInAmbientOrTypeNode(usage)) {
|
|
49127
|
+
return true;
|
|
49128
|
+
}
|
|
49129
49129
|
if (declaration.pos <= usage.pos && !(isPropertyDeclaration(declaration) && isThisProperty(usage.parent) && !declaration.initializer && !declaration.exclamationToken)) {
|
|
49130
49130
|
if (declaration.kind === 208 /* BindingElement */) {
|
|
49131
49131
|
const errorBindingElement = getAncestor(usage, 208 /* BindingElement */);
|
|
@@ -49155,9 +49155,6 @@ function createTypeChecker(host) {
|
|
|
49155
49155
|
if (usage.kind === 277 /* ExportAssignment */ && usage.isExportEquals) {
|
|
49156
49156
|
return true;
|
|
49157
49157
|
}
|
|
49158
|
-
if (!!(usage.flags & 16777216 /* JSDoc */) || isInTypeQuery(usage) || isInAmbientOrTypeNode(usage)) {
|
|
49159
|
-
return true;
|
|
49160
|
-
}
|
|
49161
49158
|
if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
|
|
49162
49159
|
if (emitStandardClassFields && getContainingClass(declaration) && (isPropertyDeclaration(declaration) || isParameterPropertyDeclaration(declaration, declaration.parent))) {
|
|
49163
49160
|
return !isPropertyImmediatelyReferencedWithinDeclaration(
|
|
@@ -55367,8 +55364,8 @@ function createTypeChecker(host) {
|
|
|
55367
55364
|
});
|
|
55368
55365
|
}
|
|
55369
55366
|
});
|
|
55370
|
-
Debug.assert(setter
|
|
55371
|
-
const paramSymbol = getSignatureFromDeclaration(setter).parameters[0];
|
|
55367
|
+
Debug.assert(!!setter);
|
|
55368
|
+
const paramSymbol = isFunctionLikeDeclaration(setter) ? getSignatureFromDeclaration(setter).parameters[0] : void 0;
|
|
55372
55369
|
result.push(setTextRange(
|
|
55373
55370
|
factory.createSetAccessorDeclaration(
|
|
55374
55371
|
factory.createModifiersFromModifierFlags(flag),
|
|
@@ -56144,7 +56141,7 @@ function createTypeChecker(host) {
|
|
|
56144
56141
|
const pattern = declaration.parent;
|
|
56145
56142
|
if (strictNullChecks && declaration.flags & 33554432 /* Ambient */ && isParameterDeclaration(declaration)) {
|
|
56146
56143
|
parentType = getNonNullableType(parentType);
|
|
56147
|
-
} else if (strictNullChecks && pattern.parent.initializer && !(
|
|
56144
|
+
} else if (strictNullChecks && pattern.parent.initializer && !hasTypeFacts(getTypeOfInitializer(pattern.parent.initializer), 65536 /* EQUndefined */)) {
|
|
56148
56145
|
parentType = getTypeWithFacts(parentType, 524288 /* NEUndefined */);
|
|
56149
56146
|
}
|
|
56150
56147
|
let type;
|
|
@@ -56187,7 +56184,7 @@ function createTypeChecker(host) {
|
|
|
56187
56184
|
return type;
|
|
56188
56185
|
}
|
|
56189
56186
|
if (getEffectiveTypeAnnotationNode(walkUpBindingElementsAndPatterns(declaration))) {
|
|
56190
|
-
return strictNullChecks && !(
|
|
56187
|
+
return strictNullChecks && !hasTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */), 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
|
|
56191
56188
|
}
|
|
56192
56189
|
return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration, 0 /* Normal */)], 2 /* Subtype */));
|
|
56193
56190
|
}
|
|
@@ -64295,7 +64292,7 @@ function createTypeChecker(host) {
|
|
|
64295
64292
|
if (sourceType && targetType) {
|
|
64296
64293
|
const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
64297
64294
|
const targetSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
|
|
64298
|
-
const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) &&
|
|
64295
|
+
const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && getTypeFacts(sourceType, 50331648 /* IsUndefinedOrNull */) === getTypeFacts(targetType, 50331648 /* IsUndefinedOrNull */);
|
|
64299
64296
|
let related = callbacks ? compareSignaturesRelated(targetSig, sourceSig, checkMode & 8 /* StrictArity */ | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) : !(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(
|
|
64300
64297
|
sourceType,
|
|
64301
64298
|
targetType,
|
|
@@ -67452,7 +67449,7 @@ function createTypeChecker(host) {
|
|
|
67452
67449
|
return value.base10Value === "0";
|
|
67453
67450
|
}
|
|
67454
67451
|
function removeDefinitelyFalsyTypes(type) {
|
|
67455
|
-
return filterType(type, (t) =>
|
|
67452
|
+
return filterType(type, (t) => hasTypeFacts(t, 4194304 /* Truthy */));
|
|
67456
67453
|
}
|
|
67457
67454
|
function extractDefinitelyFalsyTypes(type) {
|
|
67458
67455
|
return mapType(type, getDefinitelyFalsyPartOfType);
|
|
@@ -69197,7 +69194,13 @@ function createTypeChecker(host) {
|
|
|
69197
69194
|
const resolved = resolveStructuredTypeMembers(type);
|
|
69198
69195
|
return !!(resolved.callSignatures.length || resolved.constructSignatures.length || resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
|
|
69199
69196
|
}
|
|
69200
|
-
function getTypeFacts(type) {
|
|
69197
|
+
function getTypeFacts(type, mask2) {
|
|
69198
|
+
return getTypeFactsWorker(type, mask2) & mask2;
|
|
69199
|
+
}
|
|
69200
|
+
function hasTypeFacts(type, mask2) {
|
|
69201
|
+
return getTypeFacts(type, mask2) !== 0;
|
|
69202
|
+
}
|
|
69203
|
+
function getTypeFactsWorker(type, callerOnlyNeeds) {
|
|
69201
69204
|
if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
|
|
69202
69205
|
type = getBaseConstraintOfType(type) || unknownType;
|
|
69203
69206
|
}
|
|
@@ -69230,6 +69233,10 @@ function createTypeChecker(host) {
|
|
|
69230
69233
|
return strictNullChecks ? type === falseType || type === regularFalseType ? 12121864 /* FalseStrictFacts */ : 7927560 /* TrueStrictFacts */ : type === falseType || type === regularFalseType ? 12580616 /* FalseFacts */ : 16774920 /* TrueFacts */;
|
|
69231
69234
|
}
|
|
69232
69235
|
if (flags & 524288 /* Object */) {
|
|
69236
|
+
const possibleFacts = strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ | 7880640 /* FunctionStrictFacts */ | 7888800 /* ObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ | 16728e3 /* FunctionFacts */ | 16736160 /* ObjectFacts */;
|
|
69237
|
+
if ((callerOnlyNeeds & possibleFacts) === 0) {
|
|
69238
|
+
return 0;
|
|
69239
|
+
}
|
|
69233
69240
|
return getObjectFlags(type) & 16 /* Anonymous */ && isEmptyObjectType(type) ? strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ : isFunctionObjectType(type) ? strictNullChecks ? 7880640 /* FunctionStrictFacts */ : 16728e3 /* FunctionFacts */ : strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
|
|
69234
69241
|
}
|
|
69235
69242
|
if (flags & 16384 /* Void */) {
|
|
@@ -69251,20 +69258,20 @@ function createTypeChecker(host) {
|
|
|
69251
69258
|
return 0 /* None */;
|
|
69252
69259
|
}
|
|
69253
69260
|
if (flags & 1048576 /* Union */) {
|
|
69254
|
-
return reduceLeft(type.types, (facts, t) => facts |
|
|
69261
|
+
return reduceLeft(type.types, (facts, t) => facts | getTypeFactsWorker(t, callerOnlyNeeds), 0 /* None */);
|
|
69255
69262
|
}
|
|
69256
69263
|
if (flags & 2097152 /* Intersection */) {
|
|
69257
|
-
return getIntersectionTypeFacts(type);
|
|
69264
|
+
return getIntersectionTypeFacts(type, callerOnlyNeeds);
|
|
69258
69265
|
}
|
|
69259
69266
|
return 83886079 /* UnknownFacts */;
|
|
69260
69267
|
}
|
|
69261
|
-
function getIntersectionTypeFacts(type) {
|
|
69268
|
+
function getIntersectionTypeFacts(type, callerOnlyNeeds) {
|
|
69262
69269
|
const ignoreObjects = maybeTypeOfKind(type, 402784252 /* Primitive */);
|
|
69263
69270
|
let oredFacts = 0 /* None */;
|
|
69264
69271
|
let andedFacts = 134217727 /* All */;
|
|
69265
69272
|
for (const t of type.types) {
|
|
69266
69273
|
if (!(ignoreObjects && t.flags & 524288 /* Object */)) {
|
|
69267
|
-
const f =
|
|
69274
|
+
const f = getTypeFactsWorker(t, callerOnlyNeeds);
|
|
69268
69275
|
oredFacts |= f;
|
|
69269
69276
|
andedFacts &= f;
|
|
69270
69277
|
}
|
|
@@ -69272,19 +69279,19 @@ function createTypeChecker(host) {
|
|
|
69272
69279
|
return oredFacts & 8256 /* OrFactsMask */ | andedFacts & 134209471 /* AndFactsMask */;
|
|
69273
69280
|
}
|
|
69274
69281
|
function getTypeWithFacts(type, include) {
|
|
69275
|
-
return filterType(type, (t) => (
|
|
69282
|
+
return filterType(type, (t) => hasTypeFacts(t, include));
|
|
69276
69283
|
}
|
|
69277
69284
|
function getAdjustedTypeWithFacts(type, facts) {
|
|
69278
69285
|
const reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 /* Unknown */ ? unknownUnionType : type, facts));
|
|
69279
69286
|
if (strictNullChecks) {
|
|
69280
69287
|
switch (facts) {
|
|
69281
69288
|
case 524288 /* NEUndefined */:
|
|
69282
|
-
return mapType(reduced, (t) =>
|
|
69289
|
+
return mapType(reduced, (t) => hasTypeFacts(t, 65536 /* EQUndefined */) ? getIntersectionType([t, hasTypeFacts(t, 131072 /* EQNull */) && !maybeTypeOfKind(reduced, 65536 /* Null */) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t);
|
|
69283
69290
|
case 1048576 /* NENull */:
|
|
69284
|
-
return mapType(reduced, (t) =>
|
|
69291
|
+
return mapType(reduced, (t) => hasTypeFacts(t, 131072 /* EQNull */) ? getIntersectionType([t, hasTypeFacts(t, 65536 /* EQUndefined */) && !maybeTypeOfKind(reduced, 32768 /* Undefined */) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t);
|
|
69285
69292
|
case 2097152 /* NEUndefinedOrNull */:
|
|
69286
69293
|
case 4194304 /* Truthy */:
|
|
69287
|
-
return mapType(reduced, (t) =>
|
|
69294
|
+
return mapType(reduced, (t) => hasTypeFacts(t, 262144 /* EQUndefinedOrNull */) ? getGlobalNonNullableTypeInstantiation(t) : t);
|
|
69288
69295
|
}
|
|
69289
69296
|
}
|
|
69290
69297
|
return reduced;
|
|
@@ -70621,14 +70628,14 @@ function createTypeChecker(host) {
|
|
|
70621
70628
|
// the constituent based on its type facts. We use the strict subtype relation because it treats `object`
|
|
70622
70629
|
// as a subtype of `{}`, and we need the type facts check because function types are subtypes of `object`,
|
|
70623
70630
|
// but are classified as "function" according to `typeof`.
|
|
70624
|
-
isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ?
|
|
70631
|
+
isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? hasTypeFacts(t, facts) ? t : neverType : (
|
|
70625
70632
|
// We next check if the consituent is a supertype of the implied type. If so, we substitute the implied
|
|
70626
70633
|
// type. This handles top types like `unknown` and `{}`, and supertypes like `{ toString(): string }`.
|
|
70627
70634
|
isTypeSubtypeOf(impliedType, t) ? impliedType : (
|
|
70628
70635
|
// Neither the constituent nor the implied type is a subtype of the other, however their domains may still
|
|
70629
70636
|
// overlap. For example, an unconstrained type parameter and type `string`. If the type facts indicate
|
|
70630
70637
|
// possible overlap, we form an intersection. Otherwise, we eliminate the constituent.
|
|
70631
|
-
|
|
70638
|
+
hasTypeFacts(t, facts) ? getIntersectionType([t, impliedType]) : neverType
|
|
70632
70639
|
)
|
|
70633
70640
|
)
|
|
70634
70641
|
));
|
|
@@ -70642,7 +70649,7 @@ function createTypeChecker(host) {
|
|
|
70642
70649
|
const hasDefaultClause = clauseStart === clauseEnd || defaultIndex >= clauseStart && defaultIndex < clauseEnd;
|
|
70643
70650
|
if (hasDefaultClause) {
|
|
70644
70651
|
const notEqualFacts = getNotEqualFactsFromTypeofSwitch(clauseStart, clauseEnd, witnesses);
|
|
70645
|
-
return filterType(type, (t) =>
|
|
70652
|
+
return filterType(type, (t) => getTypeFacts(t, notEqualFacts) === notEqualFacts);
|
|
70646
70653
|
}
|
|
70647
70654
|
const clauseWitnesses = witnesses.slice(clauseStart, clauseEnd);
|
|
70648
70655
|
return getUnionType(map(clauseWitnesses, (text) => text ? narrowTypeByTypeName(type, text) : neverType));
|
|
@@ -70780,7 +70787,7 @@ function createTypeChecker(host) {
|
|
|
70780
70787
|
false
|
|
70781
70788
|
);
|
|
70782
70789
|
}
|
|
70783
|
-
if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) && !(
|
|
70790
|
+
if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) && !hasTypeFacts(predicate.type, 65536 /* EQUndefined */)) {
|
|
70784
70791
|
type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
70785
70792
|
}
|
|
70786
70793
|
const access = getDiscriminantPropertyAccess(predicateArgument, type);
|
|
@@ -70914,7 +70921,7 @@ function createTypeChecker(host) {
|
|
|
70914
70921
|
reportCircularityError(declaration.symbol);
|
|
70915
70922
|
return true;
|
|
70916
70923
|
}
|
|
70917
|
-
const containsUndefined = !!(
|
|
70924
|
+
const containsUndefined = !!hasTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */), 16777216 /* IsUndefined */);
|
|
70918
70925
|
if (!popTypeResolution()) {
|
|
70919
70926
|
reportCircularityError(declaration.symbol);
|
|
70920
70927
|
return true;
|
|
@@ -70924,7 +70931,7 @@ function createTypeChecker(host) {
|
|
|
70924
70931
|
return links.parameterInitializerContainsUndefined;
|
|
70925
70932
|
}
|
|
70926
70933
|
function removeOptionalityFromDeclaredType(declaredType, declaration) {
|
|
70927
|
-
const removeUndefined = strictNullChecks && declaration.kind === 169 /* Parameter */ && declaration.initializer &&
|
|
70934
|
+
const removeUndefined = strictNullChecks && declaration.kind === 169 /* Parameter */ && declaration.initializer && hasTypeFacts(declaredType, 16777216 /* IsUndefined */) && !parameterInitializerContainsUndefined(declaration);
|
|
70928
70935
|
return removeUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
|
|
70929
70936
|
}
|
|
70930
70937
|
function isConstraintPosition(type, node) {
|
|
@@ -73754,7 +73761,7 @@ function createTypeChecker(host) {
|
|
|
73754
73761
|
return checkNonNullType(checkExpression(node), node);
|
|
73755
73762
|
}
|
|
73756
73763
|
function isNullableType(type) {
|
|
73757
|
-
return
|
|
73764
|
+
return hasTypeFacts(type, 50331648 /* IsUndefinedOrNull */);
|
|
73758
73765
|
}
|
|
73759
73766
|
function getNonNullableTypeIfNeeded(type) {
|
|
73760
73767
|
return isNullableType(type) ? getNonNullableType(type) : type;
|
|
@@ -73800,7 +73807,7 @@ function createTypeChecker(host) {
|
|
|
73800
73807
|
error2(node, Diagnostics.Object_is_of_type_unknown);
|
|
73801
73808
|
return errorType;
|
|
73802
73809
|
}
|
|
73803
|
-
const facts = getTypeFacts(type);
|
|
73810
|
+
const facts = getTypeFacts(type, 50331648 /* IsUndefinedOrNull */);
|
|
73804
73811
|
if (facts & 50331648 /* IsUndefinedOrNull */) {
|
|
73805
73812
|
reportError(node, facts);
|
|
73806
73813
|
const t = getNonNullableType(type);
|
|
@@ -77580,7 +77587,7 @@ function createTypeChecker(host) {
|
|
|
77580
77587
|
if (operandConstraint.flags & 3 /* AnyOrUnknown */) {
|
|
77581
77588
|
return (556800 /* AllTypeofNE */ & notEqualFacts) === 556800 /* AllTypeofNE */;
|
|
77582
77589
|
}
|
|
77583
|
-
return !someType(operandConstraint, (t) =>
|
|
77590
|
+
return !someType(operandConstraint, (t) => getTypeFacts(t, notEqualFacts) === notEqualFacts);
|
|
77584
77591
|
}
|
|
77585
77592
|
const type = checkExpressionCached(node.expression);
|
|
77586
77593
|
if (!isLiteralType(type)) {
|
|
@@ -77898,14 +77905,15 @@ function createTypeChecker(host) {
|
|
|
77898
77905
|
if (symbol) {
|
|
77899
77906
|
if (isReadonlySymbol(symbol)) {
|
|
77900
77907
|
error2(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property);
|
|
77908
|
+
} else {
|
|
77909
|
+
checkDeleteExpressionMustBeOptional(expr, symbol);
|
|
77901
77910
|
}
|
|
77902
|
-
checkDeleteExpressionMustBeOptional(expr, symbol);
|
|
77903
77911
|
}
|
|
77904
77912
|
return booleanType;
|
|
77905
77913
|
}
|
|
77906
77914
|
function checkDeleteExpressionMustBeOptional(expr, symbol) {
|
|
77907
77915
|
const type = getTypeOfSymbol(symbol);
|
|
77908
|
-
if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ :
|
|
77916
|
+
if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : hasTypeFacts(type, 16777216 /* IsUndefined */))) {
|
|
77909
77917
|
error2(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
|
|
77910
77918
|
}
|
|
77911
77919
|
}
|
|
@@ -78040,7 +78048,7 @@ function createTypeChecker(host) {
|
|
|
78040
78048
|
return getUnaryResultType(operandType);
|
|
78041
78049
|
case 54 /* ExclamationToken */:
|
|
78042
78050
|
checkTruthinessOfType(operandType, node.operand);
|
|
78043
|
-
const facts = getTypeFacts(operandType
|
|
78051
|
+
const facts = getTypeFacts(operandType, 4194304 /* Truthy */ | 8388608 /* Falsy */);
|
|
78044
78052
|
return facts === 4194304 /* Truthy */ ? falseType : facts === 8388608 /* Falsy */ ? trueType : booleanType;
|
|
78045
78053
|
case 46 /* PlusPlusToken */:
|
|
78046
78054
|
case 47 /* MinusMinusToken */:
|
|
@@ -78271,7 +78279,7 @@ function createTypeChecker(host) {
|
|
|
78271
78279
|
if (exprOrAssignment.kind === 304 /* ShorthandPropertyAssignment */) {
|
|
78272
78280
|
const prop = exprOrAssignment;
|
|
78273
78281
|
if (prop.objectAssignmentInitializer) {
|
|
78274
|
-
if (strictNullChecks && !(
|
|
78282
|
+
if (strictNullChecks && !hasTypeFacts(checkExpression(prop.objectAssignmentInitializer), 16777216 /* IsUndefined */)) {
|
|
78275
78283
|
sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */);
|
|
78276
78284
|
}
|
|
78277
78285
|
checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode);
|
|
@@ -78683,7 +78691,7 @@ function createTypeChecker(host) {
|
|
|
78683
78691
|
return checkInExpression(left, right, leftType, rightType);
|
|
78684
78692
|
case 56 /* AmpersandAmpersandToken */:
|
|
78685
78693
|
case 77 /* AmpersandAmpersandEqualsToken */: {
|
|
78686
|
-
const resultType2 =
|
|
78694
|
+
const resultType2 = hasTypeFacts(leftType, 4194304 /* Truthy */) ? getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) : leftType;
|
|
78687
78695
|
if (operator === 77 /* AmpersandAmpersandEqualsToken */) {
|
|
78688
78696
|
checkAssignmentOperator(rightType);
|
|
78689
78697
|
}
|
|
@@ -78691,7 +78699,7 @@ function createTypeChecker(host) {
|
|
|
78691
78699
|
}
|
|
78692
78700
|
case 57 /* BarBarToken */:
|
|
78693
78701
|
case 76 /* BarBarEqualsToken */: {
|
|
78694
|
-
const resultType2 =
|
|
78702
|
+
const resultType2 = hasTypeFacts(leftType, 8388608 /* Falsy */) ? getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) : leftType;
|
|
78695
78703
|
if (operator === 76 /* BarBarEqualsToken */) {
|
|
78696
78704
|
checkAssignmentOperator(rightType);
|
|
78697
78705
|
}
|
|
@@ -78699,7 +78707,7 @@ function createTypeChecker(host) {
|
|
|
78699
78707
|
}
|
|
78700
78708
|
case 61 /* QuestionQuestionToken */:
|
|
78701
78709
|
case 78 /* QuestionQuestionEqualsToken */: {
|
|
78702
|
-
const resultType2 =
|
|
78710
|
+
const resultType2 = hasTypeFacts(leftType, 262144 /* EQUndefinedOrNull */) ? getUnionType([getNonNullableType(leftType), rightType], 2 /* Subtype */) : leftType;
|
|
78703
78711
|
if (operator === 78 /* QuestionQuestionEqualsToken */) {
|
|
78704
78712
|
checkAssignmentOperator(rightType);
|
|
78705
78713
|
}
|
|
@@ -82016,7 +82024,7 @@ function createTypeChecker(host) {
|
|
|
82016
82024
|
}
|
|
82017
82025
|
const type = location === condExpr2 ? condType : checkTruthinessExpression(location);
|
|
82018
82026
|
const isPropertyExpressionCast = isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
|
|
82019
|
-
if (!(
|
|
82027
|
+
if (!hasTypeFacts(type, 4194304 /* Truthy */) || isPropertyExpressionCast)
|
|
82020
82028
|
return;
|
|
82021
82029
|
const callSignatures = getSignaturesOfType(type, 0 /* Call */);
|
|
82022
82030
|
const isPromise = !!getAwaitedTypeOfPromise(type);
|
|
@@ -120223,7 +120231,6 @@ var plainJSErrors = /* @__PURE__ */ new Set([
|
|
|
120223
120231
|
Diagnostics.A_module_cannot_have_multiple_default_exports.code,
|
|
120224
120232
|
Diagnostics.Another_export_default_is_here.code,
|
|
120225
120233
|
Diagnostics.The_first_export_default_is_here.code,
|
|
120226
|
-
Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module.code,
|
|
120227
120234
|
Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode.code,
|
|
120228
120235
|
Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here.code,
|
|
120229
120236
|
Diagnostics.constructor_is_a_reserved_word.code,
|
|
@@ -167714,11 +167721,12 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
|
|
|
167714
167721
|
if (documentation.length === 0 && isIdentifier(location) && symbol.valueDeclaration && isBindingElement(symbol.valueDeclaration)) {
|
|
167715
167722
|
const declaration = symbol.valueDeclaration;
|
|
167716
167723
|
const parent2 = declaration.parent;
|
|
167717
|
-
|
|
167718
|
-
|
|
167724
|
+
const name = declaration.propertyName || declaration.name;
|
|
167725
|
+
if (isIdentifier(name) && isObjectBindingPattern(parent2)) {
|
|
167726
|
+
const propertyName = getTextOfIdentifierOrLiteral(name);
|
|
167719
167727
|
const objectType = typeChecker.getTypeAtLocation(parent2);
|
|
167720
167728
|
documentation = firstDefined(objectType.isUnion() ? objectType.types : [objectType], (t) => {
|
|
167721
|
-
const prop = t.getProperty(
|
|
167729
|
+
const prop = t.getProperty(propertyName);
|
|
167722
167730
|
return prop ? prop.getDocumentationComment(typeChecker) : void 0;
|
|
167723
167731
|
}) || emptyArray;
|
|
167724
167732
|
}
|
package/lib/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.3";
|
|
38
|
-
version = `${versionMajorMinor}.0-insiders.
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20230824`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -7257,7 +7257,6 @@ ${lanes.join("\n")}
|
|
|
7257
7257
|
Module_0_can_only_be_default_imported_using_the_1_flag: diag(1259, 1 /* Error */, "Module_0_can_only_be_default_imported_using_the_1_flag_1259", "Module '{0}' can only be default-imported using the '{1}' flag"),
|
|
7258
7258
|
Keywords_cannot_contain_escape_characters: diag(1260, 1 /* Error */, "Keywords_cannot_contain_escape_characters_1260", "Keywords cannot contain escape characters."),
|
|
7259
7259
|
Already_included_file_name_0_differs_from_file_name_1_only_in_casing: diag(1261, 1 /* Error */, "Already_included_file_name_0_differs_from_file_name_1_only_in_casing_1261", "Already included file name '{0}' differs from file name '{1}' only in casing."),
|
|
7260
|
-
Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module: diag(1262, 1 /* Error */, "Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module_1262", "Identifier expected. '{0}' is a reserved word at the top-level of a module."),
|
|
7261
7260
|
Declarations_with_initializers_cannot_also_have_definite_assignment_assertions: diag(1263, 1 /* Error */, "Declarations_with_initializers_cannot_also_have_definite_assignment_assertions_1263", "Declarations with initializers cannot also have definite assignment assertions."),
|
|
7262
7261
|
Declarations_with_definite_assignment_assertions_must_also_have_type_annotations: diag(1264, 1 /* Error */, "Declarations_with_definite_assignment_assertions_must_also_have_type_annotations_1264", "Declarations with definite assignment assertions must also have type annotations."),
|
|
7263
7262
|
A_rest_element_cannot_follow_another_rest_element: diag(1265, 1 /* Error */, "A_rest_element_cannot_follow_another_rest_element_1265", "A rest element cannot follow another rest element."),
|
|
@@ -18985,7 +18984,7 @@ ${lanes.join("\n")}
|
|
|
18985
18984
|
"defineProperty",
|
|
18986
18985
|
"deleteProperty",
|
|
18987
18986
|
"get",
|
|
18988
|
-
"
|
|
18987
|
+
"getOwnPropertyDescriptor",
|
|
18989
18988
|
"getPrototypeOf",
|
|
18990
18989
|
"has",
|
|
18991
18990
|
"isExtensible",
|
|
@@ -32436,7 +32435,9 @@ ${lanes.join("\n")}
|
|
|
32436
32435
|
let dotDotDotToken;
|
|
32437
32436
|
let expression;
|
|
32438
32437
|
if (token() !== 20 /* CloseBraceToken */) {
|
|
32439
|
-
|
|
32438
|
+
if (!inExpressionContext) {
|
|
32439
|
+
dotDotDotToken = parseOptionalToken(26 /* DotDotDotToken */);
|
|
32440
|
+
}
|
|
32440
32441
|
expression = parseExpression();
|
|
32441
32442
|
}
|
|
32442
32443
|
if (inExpressionContext) {
|
|
@@ -43403,12 +43404,8 @@ ${lanes.join("\n")}
|
|
|
43403
43404
|
}
|
|
43404
43405
|
if (inStrictMode && originalKeywordKind >= 119 /* FirstFutureReservedWord */ && originalKeywordKind <= 127 /* LastFutureReservedWord */) {
|
|
43405
43406
|
file.bindDiagnostics.push(createDiagnosticForNode2(node, getStrictModeIdentifierMessage(node), declarationNameToString(node)));
|
|
43406
|
-
} else if (originalKeywordKind === 135 /* AwaitKeyword */) {
|
|
43407
|
-
|
|
43408
|
-
file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module, declarationNameToString(node)));
|
|
43409
|
-
} else if (node.flags & 65536 /* AwaitContext */) {
|
|
43410
|
-
file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here, declarationNameToString(node)));
|
|
43411
|
-
}
|
|
43407
|
+
} else if (originalKeywordKind === 135 /* AwaitKeyword */ && (node.flags & 65536 /* AwaitContext */ || isExternalModule(file))) {
|
|
43408
|
+
file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here, declarationNameToString(node)));
|
|
43412
43409
|
} else if (originalKeywordKind === 127 /* YieldKeyword */ && node.flags & 16384 /* YieldContext */) {
|
|
43413
43410
|
file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here, declarationNameToString(node)));
|
|
43414
43411
|
}
|
|
@@ -46887,6 +46884,9 @@ ${lanes.join("\n")}
|
|
|
46887
46884
|
const sourceFiles = host.getSourceFiles();
|
|
46888
46885
|
return sourceFiles.indexOf(declarationFile) <= sourceFiles.indexOf(useFile);
|
|
46889
46886
|
}
|
|
46887
|
+
if (!!(usage.flags & 16777216 /* JSDoc */) || isInTypeQuery(usage) || isInAmbientOrTypeNode(usage)) {
|
|
46888
|
+
return true;
|
|
46889
|
+
}
|
|
46890
46890
|
if (declaration.pos <= usage.pos && !(isPropertyDeclaration(declaration) && isThisProperty(usage.parent) && !declaration.initializer && !declaration.exclamationToken)) {
|
|
46891
46891
|
if (declaration.kind === 208 /* BindingElement */) {
|
|
46892
46892
|
const errorBindingElement = getAncestor(usage, 208 /* BindingElement */);
|
|
@@ -46916,9 +46916,6 @@ ${lanes.join("\n")}
|
|
|
46916
46916
|
if (usage.kind === 277 /* ExportAssignment */ && usage.isExportEquals) {
|
|
46917
46917
|
return true;
|
|
46918
46918
|
}
|
|
46919
|
-
if (!!(usage.flags & 16777216 /* JSDoc */) || isInTypeQuery(usage) || isInAmbientOrTypeNode(usage)) {
|
|
46920
|
-
return true;
|
|
46921
|
-
}
|
|
46922
46919
|
if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
|
|
46923
46920
|
if (emitStandardClassFields && getContainingClass(declaration) && (isPropertyDeclaration(declaration) || isParameterPropertyDeclaration(declaration, declaration.parent))) {
|
|
46924
46921
|
return !isPropertyImmediatelyReferencedWithinDeclaration(
|
|
@@ -53128,8 +53125,8 @@ ${lanes.join("\n")}
|
|
|
53128
53125
|
});
|
|
53129
53126
|
}
|
|
53130
53127
|
});
|
|
53131
|
-
Debug.assert(setter
|
|
53132
|
-
const paramSymbol = getSignatureFromDeclaration(setter).parameters[0];
|
|
53128
|
+
Debug.assert(!!setter);
|
|
53129
|
+
const paramSymbol = isFunctionLikeDeclaration(setter) ? getSignatureFromDeclaration(setter).parameters[0] : void 0;
|
|
53133
53130
|
result.push(setTextRange(
|
|
53134
53131
|
factory.createSetAccessorDeclaration(
|
|
53135
53132
|
factory.createModifiersFromModifierFlags(flag),
|
|
@@ -53905,7 +53902,7 @@ ${lanes.join("\n")}
|
|
|
53905
53902
|
const pattern = declaration.parent;
|
|
53906
53903
|
if (strictNullChecks && declaration.flags & 33554432 /* Ambient */ && isParameterDeclaration(declaration)) {
|
|
53907
53904
|
parentType = getNonNullableType(parentType);
|
|
53908
|
-
} else if (strictNullChecks && pattern.parent.initializer && !(
|
|
53905
|
+
} else if (strictNullChecks && pattern.parent.initializer && !hasTypeFacts(getTypeOfInitializer(pattern.parent.initializer), 65536 /* EQUndefined */)) {
|
|
53909
53906
|
parentType = getTypeWithFacts(parentType, 524288 /* NEUndefined */);
|
|
53910
53907
|
}
|
|
53911
53908
|
let type;
|
|
@@ -53948,7 +53945,7 @@ ${lanes.join("\n")}
|
|
|
53948
53945
|
return type;
|
|
53949
53946
|
}
|
|
53950
53947
|
if (getEffectiveTypeAnnotationNode(walkUpBindingElementsAndPatterns(declaration))) {
|
|
53951
|
-
return strictNullChecks && !(
|
|
53948
|
+
return strictNullChecks && !hasTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */), 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
|
|
53952
53949
|
}
|
|
53953
53950
|
return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration, 0 /* Normal */)], 2 /* Subtype */));
|
|
53954
53951
|
}
|
|
@@ -62056,7 +62053,7 @@ ${lanes.join("\n")}
|
|
|
62056
62053
|
if (sourceType && targetType) {
|
|
62057
62054
|
const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
62058
62055
|
const targetSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
|
|
62059
|
-
const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) &&
|
|
62056
|
+
const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && getTypeFacts(sourceType, 50331648 /* IsUndefinedOrNull */) === getTypeFacts(targetType, 50331648 /* IsUndefinedOrNull */);
|
|
62060
62057
|
let related = callbacks ? compareSignaturesRelated(targetSig, sourceSig, checkMode & 8 /* StrictArity */ | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) : !(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(
|
|
62061
62058
|
sourceType,
|
|
62062
62059
|
targetType,
|
|
@@ -65213,7 +65210,7 @@ ${lanes.join("\n")}
|
|
|
65213
65210
|
return value.base10Value === "0";
|
|
65214
65211
|
}
|
|
65215
65212
|
function removeDefinitelyFalsyTypes(type) {
|
|
65216
|
-
return filterType(type, (t) =>
|
|
65213
|
+
return filterType(type, (t) => hasTypeFacts(t, 4194304 /* Truthy */));
|
|
65217
65214
|
}
|
|
65218
65215
|
function extractDefinitelyFalsyTypes(type) {
|
|
65219
65216
|
return mapType(type, getDefinitelyFalsyPartOfType);
|
|
@@ -66958,7 +66955,13 @@ ${lanes.join("\n")}
|
|
|
66958
66955
|
const resolved = resolveStructuredTypeMembers(type);
|
|
66959
66956
|
return !!(resolved.callSignatures.length || resolved.constructSignatures.length || resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
|
|
66960
66957
|
}
|
|
66961
|
-
function getTypeFacts(type) {
|
|
66958
|
+
function getTypeFacts(type, mask2) {
|
|
66959
|
+
return getTypeFactsWorker(type, mask2) & mask2;
|
|
66960
|
+
}
|
|
66961
|
+
function hasTypeFacts(type, mask2) {
|
|
66962
|
+
return getTypeFacts(type, mask2) !== 0;
|
|
66963
|
+
}
|
|
66964
|
+
function getTypeFactsWorker(type, callerOnlyNeeds) {
|
|
66962
66965
|
if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
|
|
66963
66966
|
type = getBaseConstraintOfType(type) || unknownType;
|
|
66964
66967
|
}
|
|
@@ -66991,6 +66994,10 @@ ${lanes.join("\n")}
|
|
|
66991
66994
|
return strictNullChecks ? type === falseType || type === regularFalseType ? 12121864 /* FalseStrictFacts */ : 7927560 /* TrueStrictFacts */ : type === falseType || type === regularFalseType ? 12580616 /* FalseFacts */ : 16774920 /* TrueFacts */;
|
|
66992
66995
|
}
|
|
66993
66996
|
if (flags & 524288 /* Object */) {
|
|
66997
|
+
const possibleFacts = strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ | 7880640 /* FunctionStrictFacts */ | 7888800 /* ObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ | 16728e3 /* FunctionFacts */ | 16736160 /* ObjectFacts */;
|
|
66998
|
+
if ((callerOnlyNeeds & possibleFacts) === 0) {
|
|
66999
|
+
return 0;
|
|
67000
|
+
}
|
|
66994
67001
|
return getObjectFlags(type) & 16 /* Anonymous */ && isEmptyObjectType(type) ? strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ : isFunctionObjectType(type) ? strictNullChecks ? 7880640 /* FunctionStrictFacts */ : 16728e3 /* FunctionFacts */ : strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
|
|
66995
67002
|
}
|
|
66996
67003
|
if (flags & 16384 /* Void */) {
|
|
@@ -67012,20 +67019,20 @@ ${lanes.join("\n")}
|
|
|
67012
67019
|
return 0 /* None */;
|
|
67013
67020
|
}
|
|
67014
67021
|
if (flags & 1048576 /* Union */) {
|
|
67015
|
-
return reduceLeft(type.types, (facts, t) => facts |
|
|
67022
|
+
return reduceLeft(type.types, (facts, t) => facts | getTypeFactsWorker(t, callerOnlyNeeds), 0 /* None */);
|
|
67016
67023
|
}
|
|
67017
67024
|
if (flags & 2097152 /* Intersection */) {
|
|
67018
|
-
return getIntersectionTypeFacts(type);
|
|
67025
|
+
return getIntersectionTypeFacts(type, callerOnlyNeeds);
|
|
67019
67026
|
}
|
|
67020
67027
|
return 83886079 /* UnknownFacts */;
|
|
67021
67028
|
}
|
|
67022
|
-
function getIntersectionTypeFacts(type) {
|
|
67029
|
+
function getIntersectionTypeFacts(type, callerOnlyNeeds) {
|
|
67023
67030
|
const ignoreObjects = maybeTypeOfKind(type, 402784252 /* Primitive */);
|
|
67024
67031
|
let oredFacts = 0 /* None */;
|
|
67025
67032
|
let andedFacts = 134217727 /* All */;
|
|
67026
67033
|
for (const t of type.types) {
|
|
67027
67034
|
if (!(ignoreObjects && t.flags & 524288 /* Object */)) {
|
|
67028
|
-
const f =
|
|
67035
|
+
const f = getTypeFactsWorker(t, callerOnlyNeeds);
|
|
67029
67036
|
oredFacts |= f;
|
|
67030
67037
|
andedFacts &= f;
|
|
67031
67038
|
}
|
|
@@ -67033,19 +67040,19 @@ ${lanes.join("\n")}
|
|
|
67033
67040
|
return oredFacts & 8256 /* OrFactsMask */ | andedFacts & 134209471 /* AndFactsMask */;
|
|
67034
67041
|
}
|
|
67035
67042
|
function getTypeWithFacts(type, include) {
|
|
67036
|
-
return filterType(type, (t) => (
|
|
67043
|
+
return filterType(type, (t) => hasTypeFacts(t, include));
|
|
67037
67044
|
}
|
|
67038
67045
|
function getAdjustedTypeWithFacts(type, facts) {
|
|
67039
67046
|
const reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 /* Unknown */ ? unknownUnionType : type, facts));
|
|
67040
67047
|
if (strictNullChecks) {
|
|
67041
67048
|
switch (facts) {
|
|
67042
67049
|
case 524288 /* NEUndefined */:
|
|
67043
|
-
return mapType(reduced, (t) =>
|
|
67050
|
+
return mapType(reduced, (t) => hasTypeFacts(t, 65536 /* EQUndefined */) ? getIntersectionType([t, hasTypeFacts(t, 131072 /* EQNull */) && !maybeTypeOfKind(reduced, 65536 /* Null */) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t);
|
|
67044
67051
|
case 1048576 /* NENull */:
|
|
67045
|
-
return mapType(reduced, (t) =>
|
|
67052
|
+
return mapType(reduced, (t) => hasTypeFacts(t, 131072 /* EQNull */) ? getIntersectionType([t, hasTypeFacts(t, 65536 /* EQUndefined */) && !maybeTypeOfKind(reduced, 32768 /* Undefined */) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t);
|
|
67046
67053
|
case 2097152 /* NEUndefinedOrNull */:
|
|
67047
67054
|
case 4194304 /* Truthy */:
|
|
67048
|
-
return mapType(reduced, (t) =>
|
|
67055
|
+
return mapType(reduced, (t) => hasTypeFacts(t, 262144 /* EQUndefinedOrNull */) ? getGlobalNonNullableTypeInstantiation(t) : t);
|
|
67049
67056
|
}
|
|
67050
67057
|
}
|
|
67051
67058
|
return reduced;
|
|
@@ -68382,14 +68389,14 @@ ${lanes.join("\n")}
|
|
|
68382
68389
|
// the constituent based on its type facts. We use the strict subtype relation because it treats `object`
|
|
68383
68390
|
// as a subtype of `{}`, and we need the type facts check because function types are subtypes of `object`,
|
|
68384
68391
|
// but are classified as "function" according to `typeof`.
|
|
68385
|
-
isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ?
|
|
68392
|
+
isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? hasTypeFacts(t, facts) ? t : neverType : (
|
|
68386
68393
|
// We next check if the consituent is a supertype of the implied type. If so, we substitute the implied
|
|
68387
68394
|
// type. This handles top types like `unknown` and `{}`, and supertypes like `{ toString(): string }`.
|
|
68388
68395
|
isTypeSubtypeOf(impliedType, t) ? impliedType : (
|
|
68389
68396
|
// Neither the constituent nor the implied type is a subtype of the other, however their domains may still
|
|
68390
68397
|
// overlap. For example, an unconstrained type parameter and type `string`. If the type facts indicate
|
|
68391
68398
|
// possible overlap, we form an intersection. Otherwise, we eliminate the constituent.
|
|
68392
|
-
|
|
68399
|
+
hasTypeFacts(t, facts) ? getIntersectionType([t, impliedType]) : neverType
|
|
68393
68400
|
)
|
|
68394
68401
|
)
|
|
68395
68402
|
));
|
|
@@ -68403,7 +68410,7 @@ ${lanes.join("\n")}
|
|
|
68403
68410
|
const hasDefaultClause = clauseStart === clauseEnd || defaultIndex >= clauseStart && defaultIndex < clauseEnd;
|
|
68404
68411
|
if (hasDefaultClause) {
|
|
68405
68412
|
const notEqualFacts = getNotEqualFactsFromTypeofSwitch(clauseStart, clauseEnd, witnesses);
|
|
68406
|
-
return filterType(type, (t) =>
|
|
68413
|
+
return filterType(type, (t) => getTypeFacts(t, notEqualFacts) === notEqualFacts);
|
|
68407
68414
|
}
|
|
68408
68415
|
const clauseWitnesses = witnesses.slice(clauseStart, clauseEnd);
|
|
68409
68416
|
return getUnionType(map(clauseWitnesses, (text) => text ? narrowTypeByTypeName(type, text) : neverType));
|
|
@@ -68541,7 +68548,7 @@ ${lanes.join("\n")}
|
|
|
68541
68548
|
false
|
|
68542
68549
|
);
|
|
68543
68550
|
}
|
|
68544
|
-
if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) && !(
|
|
68551
|
+
if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) && !hasTypeFacts(predicate.type, 65536 /* EQUndefined */)) {
|
|
68545
68552
|
type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
68546
68553
|
}
|
|
68547
68554
|
const access = getDiscriminantPropertyAccess(predicateArgument, type);
|
|
@@ -68675,7 +68682,7 @@ ${lanes.join("\n")}
|
|
|
68675
68682
|
reportCircularityError(declaration.symbol);
|
|
68676
68683
|
return true;
|
|
68677
68684
|
}
|
|
68678
|
-
const containsUndefined = !!(
|
|
68685
|
+
const containsUndefined = !!hasTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */), 16777216 /* IsUndefined */);
|
|
68679
68686
|
if (!popTypeResolution()) {
|
|
68680
68687
|
reportCircularityError(declaration.symbol);
|
|
68681
68688
|
return true;
|
|
@@ -68685,7 +68692,7 @@ ${lanes.join("\n")}
|
|
|
68685
68692
|
return links.parameterInitializerContainsUndefined;
|
|
68686
68693
|
}
|
|
68687
68694
|
function removeOptionalityFromDeclaredType(declaredType, declaration) {
|
|
68688
|
-
const removeUndefined = strictNullChecks && declaration.kind === 169 /* Parameter */ && declaration.initializer &&
|
|
68695
|
+
const removeUndefined = strictNullChecks && declaration.kind === 169 /* Parameter */ && declaration.initializer && hasTypeFacts(declaredType, 16777216 /* IsUndefined */) && !parameterInitializerContainsUndefined(declaration);
|
|
68689
68696
|
return removeUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
|
|
68690
68697
|
}
|
|
68691
68698
|
function isConstraintPosition(type, node) {
|
|
@@ -71515,7 +71522,7 @@ ${lanes.join("\n")}
|
|
|
71515
71522
|
return checkNonNullType(checkExpression(node), node);
|
|
71516
71523
|
}
|
|
71517
71524
|
function isNullableType(type) {
|
|
71518
|
-
return
|
|
71525
|
+
return hasTypeFacts(type, 50331648 /* IsUndefinedOrNull */);
|
|
71519
71526
|
}
|
|
71520
71527
|
function getNonNullableTypeIfNeeded(type) {
|
|
71521
71528
|
return isNullableType(type) ? getNonNullableType(type) : type;
|
|
@@ -71561,7 +71568,7 @@ ${lanes.join("\n")}
|
|
|
71561
71568
|
error2(node, Diagnostics.Object_is_of_type_unknown);
|
|
71562
71569
|
return errorType;
|
|
71563
71570
|
}
|
|
71564
|
-
const facts = getTypeFacts(type);
|
|
71571
|
+
const facts = getTypeFacts(type, 50331648 /* IsUndefinedOrNull */);
|
|
71565
71572
|
if (facts & 50331648 /* IsUndefinedOrNull */) {
|
|
71566
71573
|
reportError(node, facts);
|
|
71567
71574
|
const t = getNonNullableType(type);
|
|
@@ -75341,7 +75348,7 @@ ${lanes.join("\n")}
|
|
|
75341
75348
|
if (operandConstraint.flags & 3 /* AnyOrUnknown */) {
|
|
75342
75349
|
return (556800 /* AllTypeofNE */ & notEqualFacts) === 556800 /* AllTypeofNE */;
|
|
75343
75350
|
}
|
|
75344
|
-
return !someType(operandConstraint, (t) =>
|
|
75351
|
+
return !someType(operandConstraint, (t) => getTypeFacts(t, notEqualFacts) === notEqualFacts);
|
|
75345
75352
|
}
|
|
75346
75353
|
const type = checkExpressionCached(node.expression);
|
|
75347
75354
|
if (!isLiteralType(type)) {
|
|
@@ -75659,14 +75666,15 @@ ${lanes.join("\n")}
|
|
|
75659
75666
|
if (symbol) {
|
|
75660
75667
|
if (isReadonlySymbol(symbol)) {
|
|
75661
75668
|
error2(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property);
|
|
75669
|
+
} else {
|
|
75670
|
+
checkDeleteExpressionMustBeOptional(expr, symbol);
|
|
75662
75671
|
}
|
|
75663
|
-
checkDeleteExpressionMustBeOptional(expr, symbol);
|
|
75664
75672
|
}
|
|
75665
75673
|
return booleanType;
|
|
75666
75674
|
}
|
|
75667
75675
|
function checkDeleteExpressionMustBeOptional(expr, symbol) {
|
|
75668
75676
|
const type = getTypeOfSymbol(symbol);
|
|
75669
|
-
if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ :
|
|
75677
|
+
if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : hasTypeFacts(type, 16777216 /* IsUndefined */))) {
|
|
75670
75678
|
error2(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
|
|
75671
75679
|
}
|
|
75672
75680
|
}
|
|
@@ -75801,7 +75809,7 @@ ${lanes.join("\n")}
|
|
|
75801
75809
|
return getUnaryResultType(operandType);
|
|
75802
75810
|
case 54 /* ExclamationToken */:
|
|
75803
75811
|
checkTruthinessOfType(operandType, node.operand);
|
|
75804
|
-
const facts = getTypeFacts(operandType
|
|
75812
|
+
const facts = getTypeFacts(operandType, 4194304 /* Truthy */ | 8388608 /* Falsy */);
|
|
75805
75813
|
return facts === 4194304 /* Truthy */ ? falseType : facts === 8388608 /* Falsy */ ? trueType : booleanType;
|
|
75806
75814
|
case 46 /* PlusPlusToken */:
|
|
75807
75815
|
case 47 /* MinusMinusToken */:
|
|
@@ -76032,7 +76040,7 @@ ${lanes.join("\n")}
|
|
|
76032
76040
|
if (exprOrAssignment.kind === 304 /* ShorthandPropertyAssignment */) {
|
|
76033
76041
|
const prop = exprOrAssignment;
|
|
76034
76042
|
if (prop.objectAssignmentInitializer) {
|
|
76035
|
-
if (strictNullChecks && !(
|
|
76043
|
+
if (strictNullChecks && !hasTypeFacts(checkExpression(prop.objectAssignmentInitializer), 16777216 /* IsUndefined */)) {
|
|
76036
76044
|
sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */);
|
|
76037
76045
|
}
|
|
76038
76046
|
checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode);
|
|
@@ -76444,7 +76452,7 @@ ${lanes.join("\n")}
|
|
|
76444
76452
|
return checkInExpression(left, right, leftType, rightType);
|
|
76445
76453
|
case 56 /* AmpersandAmpersandToken */:
|
|
76446
76454
|
case 77 /* AmpersandAmpersandEqualsToken */: {
|
|
76447
|
-
const resultType2 =
|
|
76455
|
+
const resultType2 = hasTypeFacts(leftType, 4194304 /* Truthy */) ? getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) : leftType;
|
|
76448
76456
|
if (operator === 77 /* AmpersandAmpersandEqualsToken */) {
|
|
76449
76457
|
checkAssignmentOperator(rightType);
|
|
76450
76458
|
}
|
|
@@ -76452,7 +76460,7 @@ ${lanes.join("\n")}
|
|
|
76452
76460
|
}
|
|
76453
76461
|
case 57 /* BarBarToken */:
|
|
76454
76462
|
case 76 /* BarBarEqualsToken */: {
|
|
76455
|
-
const resultType2 =
|
|
76463
|
+
const resultType2 = hasTypeFacts(leftType, 8388608 /* Falsy */) ? getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) : leftType;
|
|
76456
76464
|
if (operator === 76 /* BarBarEqualsToken */) {
|
|
76457
76465
|
checkAssignmentOperator(rightType);
|
|
76458
76466
|
}
|
|
@@ -76460,7 +76468,7 @@ ${lanes.join("\n")}
|
|
|
76460
76468
|
}
|
|
76461
76469
|
case 61 /* QuestionQuestionToken */:
|
|
76462
76470
|
case 78 /* QuestionQuestionEqualsToken */: {
|
|
76463
|
-
const resultType2 =
|
|
76471
|
+
const resultType2 = hasTypeFacts(leftType, 262144 /* EQUndefinedOrNull */) ? getUnionType([getNonNullableType(leftType), rightType], 2 /* Subtype */) : leftType;
|
|
76464
76472
|
if (operator === 78 /* QuestionQuestionEqualsToken */) {
|
|
76465
76473
|
checkAssignmentOperator(rightType);
|
|
76466
76474
|
}
|
|
@@ -79777,7 +79785,7 @@ ${lanes.join("\n")}
|
|
|
79777
79785
|
}
|
|
79778
79786
|
const type = location === condExpr2 ? condType : checkTruthinessExpression(location);
|
|
79779
79787
|
const isPropertyExpressionCast = isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
|
|
79780
|
-
if (!(
|
|
79788
|
+
if (!hasTypeFacts(type, 4194304 /* Truthy */) || isPropertyExpressionCast)
|
|
79781
79789
|
return;
|
|
79782
79790
|
const callSignatures = getSignaturesOfType(type, 0 /* Call */);
|
|
79783
79791
|
const isPromise = !!getAwaitedTypeOfPromise(type);
|
|
@@ -121599,7 +121607,6 @@ ${lanes.join("\n")}
|
|
|
121599
121607
|
Diagnostics.A_module_cannot_have_multiple_default_exports.code,
|
|
121600
121608
|
Diagnostics.Another_export_default_is_here.code,
|
|
121601
121609
|
Diagnostics.The_first_export_default_is_here.code,
|
|
121602
|
-
Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module.code,
|
|
121603
121610
|
Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode.code,
|
|
121604
121611
|
Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here.code,
|
|
121605
121612
|
Diagnostics.constructor_is_a_reserved_word.code,
|
|
@@ -167149,11 +167156,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
167149
167156
|
if (documentation.length === 0 && isIdentifier(location) && symbol.valueDeclaration && isBindingElement(symbol.valueDeclaration)) {
|
|
167150
167157
|
const declaration = symbol.valueDeclaration;
|
|
167151
167158
|
const parent2 = declaration.parent;
|
|
167152
|
-
|
|
167153
|
-
|
|
167159
|
+
const name = declaration.propertyName || declaration.name;
|
|
167160
|
+
if (isIdentifier(name) && isObjectBindingPattern(parent2)) {
|
|
167161
|
+
const propertyName = getTextOfIdentifierOrLiteral(name);
|
|
167154
167162
|
const objectType = typeChecker.getTypeAtLocation(parent2);
|
|
167155
167163
|
documentation = firstDefined(objectType.isUnion() ? objectType.types : [objectType], (t) => {
|
|
167156
|
-
const prop = t.getProperty(
|
|
167164
|
+
const prop = t.getProperty(propertyName);
|
|
167157
167165
|
return prop ? prop.getDocumentationComment(typeChecker) : void 0;
|
|
167158
167166
|
}) || emptyArray;
|
|
167159
167167
|
}
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
|
|
|
54
54
|
|
|
55
55
|
// src/compiler/corePublic.ts
|
|
56
56
|
var versionMajorMinor = "5.3";
|
|
57
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
57
|
+
var version = `${versionMajorMinor}.0-insiders.20230824`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -5329,7 +5329,6 @@ var Diagnostics = {
|
|
|
5329
5329
|
Module_0_can_only_be_default_imported_using_the_1_flag: diag(1259, 1 /* Error */, "Module_0_can_only_be_default_imported_using_the_1_flag_1259", "Module '{0}' can only be default-imported using the '{1}' flag"),
|
|
5330
5330
|
Keywords_cannot_contain_escape_characters: diag(1260, 1 /* Error */, "Keywords_cannot_contain_escape_characters_1260", "Keywords cannot contain escape characters."),
|
|
5331
5331
|
Already_included_file_name_0_differs_from_file_name_1_only_in_casing: diag(1261, 1 /* Error */, "Already_included_file_name_0_differs_from_file_name_1_only_in_casing_1261", "Already included file name '{0}' differs from file name '{1}' only in casing."),
|
|
5332
|
-
Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module: diag(1262, 1 /* Error */, "Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module_1262", "Identifier expected. '{0}' is a reserved word at the top-level of a module."),
|
|
5333
5332
|
Declarations_with_initializers_cannot_also_have_definite_assignment_assertions: diag(1263, 1 /* Error */, "Declarations_with_initializers_cannot_also_have_definite_assignment_assertions_1263", "Declarations with initializers cannot also have definite assignment assertions."),
|
|
5334
5333
|
Declarations_with_definite_assignment_assertions_must_also_have_type_annotations: diag(1264, 1 /* Error */, "Declarations_with_definite_assignment_assertions_must_also_have_type_annotations_1264", "Declarations with definite assignment assertions must also have type annotations."),
|
|
5335
5334
|
A_rest_element_cannot_follow_another_rest_element: diag(1265, 1 /* Error */, "A_rest_element_cannot_follow_another_rest_element_1265", "A rest element cannot follow another rest element."),
|
|
@@ -21824,7 +21823,9 @@ var Parser;
|
|
|
21824
21823
|
let dotDotDotToken;
|
|
21825
21824
|
let expression;
|
|
21826
21825
|
if (token() !== 20 /* CloseBraceToken */) {
|
|
21827
|
-
|
|
21826
|
+
if (!inExpressionContext) {
|
|
21827
|
+
dotDotDotToken = parseOptionalToken(26 /* DotDotDotToken */);
|
|
21828
|
+
}
|
|
21828
21829
|
expression = parseExpression();
|
|
21829
21830
|
}
|
|
21830
21831
|
if (inExpressionContext) {
|
|
@@ -30793,7 +30794,6 @@ var plainJSErrors = /* @__PURE__ */ new Set([
|
|
|
30793
30794
|
Diagnostics.A_module_cannot_have_multiple_default_exports.code,
|
|
30794
30795
|
Diagnostics.Another_export_default_is_here.code,
|
|
30795
30796
|
Diagnostics.The_first_export_default_is_here.code,
|
|
30796
|
-
Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module.code,
|
|
30797
30797
|
Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode.code,
|
|
30798
30798
|
Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here.code,
|
|
30799
30799
|
Diagnostics.constructor_is_a_reserved_word.code,
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@typescript-deploys/pr-build",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.3.0-pr-
|
|
5
|
+
"version": "5.3.0-pr-55503-5",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
"@esfx/canceltoken": "^1.0.0",
|
|
43
43
|
"@octokit/rest": "^19.0.13",
|
|
44
44
|
"@types/chai": "^4.3.4",
|
|
45
|
-
"@types/fs-extra": "^9.0.13",
|
|
46
45
|
"@types/glob": "^8.1.0",
|
|
47
46
|
"@types/microsoft__typescript-etw": "^0.1.1",
|
|
48
47
|
"@types/minimist": "^1.2.2",
|
|
@@ -59,7 +58,6 @@
|
|
|
59
58
|
"chai": "^4.3.7",
|
|
60
59
|
"chalk": "^4.1.2",
|
|
61
60
|
"chokidar": "^3.5.3",
|
|
62
|
-
"del": "^6.1.1",
|
|
63
61
|
"diff": "^5.1.0",
|
|
64
62
|
"dprint": "^0.40.2",
|
|
65
63
|
"esbuild": "^0.19.0",
|
|
@@ -69,7 +67,6 @@
|
|
|
69
67
|
"eslint-plugin-no-null": "^1.0.2",
|
|
70
68
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
71
69
|
"fast-xml-parser": "^4.0.11",
|
|
72
|
-
"fs-extra": "^9.1.0",
|
|
73
70
|
"glob": "^8.1.0",
|
|
74
71
|
"hereby": "^1.6.4",
|
|
75
72
|
"jsonc-parser": "^3.2.0",
|
|
@@ -116,5 +113,5 @@
|
|
|
116
113
|
"node": "20.1.0",
|
|
117
114
|
"npm": "8.19.4"
|
|
118
115
|
},
|
|
119
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "d94784a967f0f0182da1a9c21967303956d8a92c"
|
|
120
117
|
}
|