@typescript-deploys/pr-build 5.7.0-pr-60121-9 → 5.7.0-pr-56941-53
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 +336 -55
- package/lib/typescript.js +337 -56
- package/package.json +1 -1
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.7";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20241007`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -3680,6 +3680,7 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
|
3680
3680
|
ObjectFlags3[ObjectFlags3["IsGenericObjectType"] = 4194304] = "IsGenericObjectType";
|
|
3681
3681
|
ObjectFlags3[ObjectFlags3["IsGenericIndexType"] = 8388608] = "IsGenericIndexType";
|
|
3682
3682
|
ObjectFlags3[ObjectFlags3["IsGenericType"] = 12582912] = "IsGenericType";
|
|
3683
|
+
ObjectFlags3[ObjectFlags3["IsNarrowedType"] = 16777216] = "IsNarrowedType";
|
|
3683
3684
|
ObjectFlags3[ObjectFlags3["ContainsIntersections"] = 16777216] = "ContainsIntersections";
|
|
3684
3685
|
ObjectFlags3[ObjectFlags3["IsUnknownLikeUnionComputed"] = 33554432] = "IsUnknownLikeUnionComputed";
|
|
3685
3686
|
ObjectFlags3[ObjectFlags3["IsUnknownLikeUnion"] = 67108864] = "IsUnknownLikeUnion";
|
|
@@ -7582,7 +7583,7 @@ var Diagnostics = {
|
|
|
7582
7583
|
Extends_clause_can_t_contain_an_expression_with_isolatedDeclarations: diag(9021, 1 /* Error */, "Extends_clause_can_t_contain_an_expression_with_isolatedDeclarations_9021", "Extends clause can't contain an expression with --isolatedDeclarations."),
|
|
7583
7584
|
Inference_from_class_expressions_is_not_supported_with_isolatedDeclarations: diag(9022, 1 /* Error */, "Inference_from_class_expressions_is_not_supported_with_isolatedDeclarations_9022", "Inference from class expressions is not supported with --isolatedDeclarations."),
|
|
7584
7585
|
Assigning_properties_to_functions_without_declaring_them_is_not_supported_with_isolatedDeclarations_Add_an_explicit_declaration_for_the_properties_assigned_to_this_function: diag(9023, 1 /* Error */, "Assigning_properties_to_functions_without_declaring_them_is_not_supported_with_isolatedDeclarations__9023", "Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function."),
|
|
7585
|
-
|
|
7586
|
+
Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_its_type_This_is_not_supported_with_isolatedDeclarations: diag(9025, 1 /* Error */, "Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_its_type_This_is_not_sup_9025", "Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations."),
|
|
7586
7587
|
Declaration_emit_for_this_file_requires_preserving_this_import_for_augmentations_This_is_not_supported_with_isolatedDeclarations: diag(9026, 1 /* Error */, "Declaration_emit_for_this_file_requires_preserving_this_import_for_augmentations_This_is_not_support_9026", "Declaration emit for this file requires preserving this import for augmentations. This is not supported with --isolatedDeclarations."),
|
|
7587
7588
|
Add_a_type_annotation_to_the_variable_0: diag(9027, 1 /* Error */, "Add_a_type_annotation_to_the_variable_0_9027", "Add a type annotation to the variable {0}."),
|
|
7588
7589
|
Add_a_type_annotation_to_the_parameter_0: diag(9028, 1 /* Error */, "Add_a_type_annotation_to_the_parameter_0_9028", "Add a type annotation to the parameter {0}."),
|
|
@@ -15157,12 +15158,12 @@ function canHaveFlowNode(node) {
|
|
|
15157
15158
|
case 80 /* Identifier */:
|
|
15158
15159
|
case 110 /* ThisKeyword */:
|
|
15159
15160
|
case 108 /* SuperKeyword */:
|
|
15160
|
-
case 166 /* QualifiedName */:
|
|
15161
|
-
case 236 /* MetaProperty */:
|
|
15162
15161
|
case 212 /* ElementAccessExpression */:
|
|
15163
15162
|
case 211 /* PropertyAccessExpression */:
|
|
15164
|
-
case 208 /* BindingElement */:
|
|
15165
15163
|
case 218 /* FunctionExpression */:
|
|
15164
|
+
case 166 /* QualifiedName */:
|
|
15165
|
+
case 236 /* MetaProperty */:
|
|
15166
|
+
case 208 /* BindingElement */:
|
|
15166
15167
|
case 219 /* ArrowFunction */:
|
|
15167
15168
|
case 174 /* MethodDeclaration */:
|
|
15168
15169
|
case 177 /* GetAccessor */:
|
|
@@ -41872,6 +41873,7 @@ function createBinder() {
|
|
|
41872
41873
|
var preSwitchCaseFlow;
|
|
41873
41874
|
var activeLabelList;
|
|
41874
41875
|
var hasExplicitReturn;
|
|
41876
|
+
var inReturnStatement;
|
|
41875
41877
|
var hasFlowEffects;
|
|
41876
41878
|
var emitFlags;
|
|
41877
41879
|
var inStrictMode;
|
|
@@ -41944,6 +41946,7 @@ function createBinder() {
|
|
|
41944
41946
|
currentExceptionTarget = void 0;
|
|
41945
41947
|
activeLabelList = void 0;
|
|
41946
41948
|
hasExplicitReturn = false;
|
|
41949
|
+
inReturnStatement = false;
|
|
41947
41950
|
hasFlowEffects = false;
|
|
41948
41951
|
inAssignmentPattern = false;
|
|
41949
41952
|
emitFlags = 0 /* None */;
|
|
@@ -42708,7 +42711,10 @@ function createBinder() {
|
|
|
42708
42711
|
currentFlow = finishFlowLabel(postIfLabel);
|
|
42709
42712
|
}
|
|
42710
42713
|
function bindReturnOrThrow(node) {
|
|
42714
|
+
const oldInReturnStatement = inReturnStatement;
|
|
42715
|
+
inReturnStatement = true;
|
|
42711
42716
|
bind(node.expression);
|
|
42717
|
+
inReturnStatement = oldInReturnStatement;
|
|
42712
42718
|
if (node.kind === 253 /* ReturnStatement */) {
|
|
42713
42719
|
hasExplicitReturn = true;
|
|
42714
42720
|
if (currentReturnTarget) {
|
|
@@ -43069,10 +43075,16 @@ function createBinder() {
|
|
|
43069
43075
|
hasFlowEffects = false;
|
|
43070
43076
|
bindCondition(node.condition, trueLabel, falseLabel);
|
|
43071
43077
|
currentFlow = finishFlowLabel(trueLabel);
|
|
43078
|
+
if (inReturnStatement) {
|
|
43079
|
+
node.flowNodeWhenTrue = currentFlow;
|
|
43080
|
+
}
|
|
43072
43081
|
bind(node.questionToken);
|
|
43073
43082
|
bind(node.whenTrue);
|
|
43074
43083
|
addAntecedent(postExpressionLabel, currentFlow);
|
|
43075
43084
|
currentFlow = finishFlowLabel(falseLabel);
|
|
43085
|
+
if (inReturnStatement) {
|
|
43086
|
+
node.flowNodeWhenFalse = currentFlow;
|
|
43087
|
+
}
|
|
43076
43088
|
bind(node.colonToken);
|
|
43077
43089
|
bind(node.whenFalse);
|
|
43078
43090
|
addAntecedent(postExpressionLabel, currentFlow);
|
|
@@ -46915,6 +46927,7 @@ function createTypeChecker(host) {
|
|
|
46915
46927
|
[".jsx", ".jsx"],
|
|
46916
46928
|
[".json", ".json"]
|
|
46917
46929
|
];
|
|
46930
|
+
var narrowableReturnTypeCache = /* @__PURE__ */ new Map();
|
|
46918
46931
|
initializeTypeChecker();
|
|
46919
46932
|
return checker;
|
|
46920
46933
|
function isDefinitelyReferenceToGlobalSymbolObject(node) {
|
|
@@ -59144,11 +59157,14 @@ function createTypeChecker(host) {
|
|
|
59144
59157
|
function isNoInferType(type) {
|
|
59145
59158
|
return !!(type.flags & 33554432 /* Substitution */ && type.constraint.flags & 2 /* Unknown */);
|
|
59146
59159
|
}
|
|
59147
|
-
function
|
|
59148
|
-
return
|
|
59160
|
+
function isNarrowingSubstitutionType(type) {
|
|
59161
|
+
return !!(type.flags & 33554432 /* Substitution */ && type.objectFlags & 16777216 /* IsNarrowedType */);
|
|
59162
|
+
}
|
|
59163
|
+
function getSubstitutionType(baseType, constraint, isNarrowed) {
|
|
59164
|
+
return constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */ ? baseType : getOrCreateSubstitutionType(baseType, constraint, isNarrowed);
|
|
59149
59165
|
}
|
|
59150
|
-
function getOrCreateSubstitutionType(baseType, constraint) {
|
|
59151
|
-
const id = `${getTypeId(baseType)}>${getTypeId(constraint)}`;
|
|
59166
|
+
function getOrCreateSubstitutionType(baseType, constraint, isNarrowed) {
|
|
59167
|
+
const id = `${getTypeId(baseType)}>${getTypeId(constraint)}${isNarrowed ? ">N" : ""}`;
|
|
59152
59168
|
const cached = substitutionTypes.get(id);
|
|
59153
59169
|
if (cached) {
|
|
59154
59170
|
return cached;
|
|
@@ -59156,6 +59172,9 @@ function createTypeChecker(host) {
|
|
|
59156
59172
|
const result = createType(33554432 /* Substitution */);
|
|
59157
59173
|
result.baseType = baseType;
|
|
59158
59174
|
result.constraint = constraint;
|
|
59175
|
+
if (isNarrowed) {
|
|
59176
|
+
result.objectFlags |= 16777216 /* IsNarrowedType */;
|
|
59177
|
+
}
|
|
59159
59178
|
substitutionTypes.set(id, result);
|
|
59160
59179
|
return result;
|
|
59161
59180
|
}
|
|
@@ -61358,7 +61377,7 @@ function createTypeChecker(host) {
|
|
|
61358
61377
|
function isDeferredType(type, checkTuples) {
|
|
61359
61378
|
return isGenericType(type) || checkTuples && isTupleType(type) && some(getElementTypes(type), isGenericType);
|
|
61360
61379
|
}
|
|
61361
|
-
function getConditionalType(root, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
|
|
61380
|
+
function getConditionalType(root, mapper, forConstraint, aliasSymbol, aliasTypeArguments, forNarrowing) {
|
|
61362
61381
|
let result;
|
|
61363
61382
|
let extraTypes;
|
|
61364
61383
|
let tailCount = 0;
|
|
@@ -61375,10 +61394,11 @@ function createTypeChecker(host) {
|
|
|
61375
61394
|
if (checkType === wildcardType || extendsType === wildcardType) {
|
|
61376
61395
|
return wildcardType;
|
|
61377
61396
|
}
|
|
61397
|
+
const effectiveCheckType = forNarrowing && isNarrowingSubstitutionType(checkType) ? checkType.constraint : checkType;
|
|
61378
61398
|
const checkTypeNode = skipTypeParentheses(root.node.checkType);
|
|
61379
61399
|
const extendsTypeNode = skipTypeParentheses(root.node.extendsType);
|
|
61380
61400
|
const checkTuples = isSimpleTupleType(checkTypeNode) && isSimpleTupleType(extendsTypeNode) && length(checkTypeNode.elements) === length(extendsTypeNode.elements);
|
|
61381
|
-
const checkTypeDeferred = isDeferredType(
|
|
61401
|
+
const checkTypeDeferred = isDeferredType(effectiveCheckType, checkTuples);
|
|
61382
61402
|
let combinedMapper;
|
|
61383
61403
|
if (root.inferTypeParameters) {
|
|
61384
61404
|
const context = createInferenceContext(
|
|
@@ -61397,8 +61417,8 @@ function createTypeChecker(host) {
|
|
|
61397
61417
|
}
|
|
61398
61418
|
const inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
|
|
61399
61419
|
if (!checkTypeDeferred && !isDeferredType(inferredExtendsType, checkTuples)) {
|
|
61400
|
-
if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (
|
|
61401
|
-
if (
|
|
61420
|
+
if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (effectiveCheckType.flags & 1 /* Any */ || !isTypeAssignableTo(getPermissiveInstantiation(effectiveCheckType), getPermissiveInstantiation(inferredExtendsType)))) {
|
|
61421
|
+
if (effectiveCheckType.flags & 1 /* Any */ || forConstraint && !(inferredExtendsType.flags & 131072 /* Never */) && someType(getPermissiveInstantiation(inferredExtendsType), (t) => isTypeAssignableTo(t, getPermissiveInstantiation(effectiveCheckType)))) {
|
|
61402
61422
|
(extraTypes || (extraTypes = [])).push(instantiateType(getTypeFromTypeNode(root.node.trueType), combinedMapper || mapper));
|
|
61403
61423
|
}
|
|
61404
61424
|
const falseType2 = getTypeFromTypeNode(root.node.falseType);
|
|
@@ -61415,7 +61435,7 @@ function createTypeChecker(host) {
|
|
|
61415
61435
|
result = instantiateType(falseType2, mapper);
|
|
61416
61436
|
break;
|
|
61417
61437
|
}
|
|
61418
|
-
if (inferredExtendsType.flags & 3 /* AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(
|
|
61438
|
+
if (inferredExtendsType.flags & 3 /* AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(effectiveCheckType), getRestrictiveInstantiation(inferredExtendsType))) {
|
|
61419
61439
|
const trueType2 = getTypeFromTypeNode(root.node.trueType);
|
|
61420
61440
|
const trueMapper = combinedMapper || mapper;
|
|
61421
61441
|
if (canTailRecurse(trueType2, trueMapper)) {
|
|
@@ -62381,8 +62401,44 @@ function createTypeChecker(host) {
|
|
|
62381
62401
|
if (!result) {
|
|
62382
62402
|
const newMapper = createTypeMapper(root.outerTypeParameters, typeArguments);
|
|
62383
62403
|
const checkType = root.checkType;
|
|
62384
|
-
|
|
62385
|
-
|
|
62404
|
+
let distributionType = root.isDistributive ? getReducedType(getMappedType(checkType, newMapper)) : void 0;
|
|
62405
|
+
let narrowingBaseType;
|
|
62406
|
+
const forNarrowing = distributionType && isNarrowingSubstitutionType(distributionType) && isNarrowableConditionalType(type, mapper);
|
|
62407
|
+
if (forNarrowing) {
|
|
62408
|
+
narrowingBaseType = distributionType.baseType;
|
|
62409
|
+
distributionType = getReducedType(distributionType.constraint);
|
|
62410
|
+
}
|
|
62411
|
+
if (distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */)) {
|
|
62412
|
+
const mapperCallback = narrowingBaseType ? (t) => getConditionalType(
|
|
62413
|
+
root,
|
|
62414
|
+
prependTypeMapping(checkType, getSubstitutionType(
|
|
62415
|
+
narrowingBaseType,
|
|
62416
|
+
t,
|
|
62417
|
+
/*isNarrowed*/
|
|
62418
|
+
true
|
|
62419
|
+
), newMapper),
|
|
62420
|
+
forConstraint,
|
|
62421
|
+
/*aliasSymbol*/
|
|
62422
|
+
void 0,
|
|
62423
|
+
/*aliasTypeArguments*/
|
|
62424
|
+
void 0,
|
|
62425
|
+
forNarrowing
|
|
62426
|
+
) : (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper), forConstraint);
|
|
62427
|
+
if (narrowingBaseType) {
|
|
62428
|
+
result = mapType(
|
|
62429
|
+
distributionType,
|
|
62430
|
+
mapperCallback,
|
|
62431
|
+
/*noReductions*/
|
|
62432
|
+
void 0,
|
|
62433
|
+
/*toIntersection*/
|
|
62434
|
+
true
|
|
62435
|
+
);
|
|
62436
|
+
} else {
|
|
62437
|
+
result = mapTypeWithAlias(distributionType, mapperCallback, aliasSymbol, aliasTypeArguments);
|
|
62438
|
+
}
|
|
62439
|
+
} else {
|
|
62440
|
+
result = getConditionalType(root, newMapper, forConstraint, aliasSymbol, aliasTypeArguments, forNarrowing);
|
|
62441
|
+
}
|
|
62386
62442
|
root.instantiations.set(id, result);
|
|
62387
62443
|
}
|
|
62388
62444
|
return result;
|
|
@@ -62495,6 +62551,9 @@ function createTypeChecker(host) {
|
|
|
62495
62551
|
}
|
|
62496
62552
|
return type;
|
|
62497
62553
|
}
|
|
62554
|
+
function isGenericIndexedOrConditionalReturnType(type) {
|
|
62555
|
+
return !!(type.flags & (8388608 /* IndexedAccess */ | 16777216 /* Conditional */) && couldContainTypeVariables(type));
|
|
62556
|
+
}
|
|
62498
62557
|
function instantiateReverseMappedType(type, mapper) {
|
|
62499
62558
|
const innerMappedType = instantiateType(type.mappedType, mapper);
|
|
62500
62559
|
if (!(getObjectFlags(innerMappedType) & 32 /* Mapped */)) {
|
|
@@ -63525,10 +63584,12 @@ function createTypeChecker(host) {
|
|
|
63525
63584
|
function shouldNormalizeIntersection(type) {
|
|
63526
63585
|
let hasInstantiable = false;
|
|
63527
63586
|
let hasNullableOrEmpty = false;
|
|
63587
|
+
let hasSubstitution = false;
|
|
63528
63588
|
for (const t of type.types) {
|
|
63529
63589
|
hasInstantiable || (hasInstantiable = !!(t.flags & 465829888 /* Instantiable */));
|
|
63530
63590
|
hasNullableOrEmpty || (hasNullableOrEmpty = !!(t.flags & 98304 /* Nullable */) || isEmptyAnonymousObjectType(t));
|
|
63531
|
-
|
|
63591
|
+
hasSubstitution || (hasSubstitution = isNarrowingSubstitutionType(t));
|
|
63592
|
+
if (hasInstantiable && hasNullableOrEmpty || hasSubstitution) return true;
|
|
63532
63593
|
}
|
|
63533
63594
|
return false;
|
|
63534
63595
|
}
|
|
@@ -68663,7 +68724,7 @@ function createTypeChecker(host) {
|
|
|
68663
68724
|
function countTypes(type) {
|
|
68664
68725
|
return type.flags & 1048576 /* Union */ ? type.types.length : 1;
|
|
68665
68726
|
}
|
|
68666
|
-
function mapType(type, mapper, noReductions) {
|
|
68727
|
+
function mapType(type, mapper, noReductions, toIntersection) {
|
|
68667
68728
|
if (type.flags & 131072 /* Never */) {
|
|
68668
68729
|
return type;
|
|
68669
68730
|
}
|
|
@@ -68685,7 +68746,7 @@ function createTypeChecker(host) {
|
|
|
68685
68746
|
}
|
|
68686
68747
|
}
|
|
68687
68748
|
}
|
|
68688
|
-
return changed ? mappedTypes && getUnionType(mappedTypes, noReductions ? 0 /* None */ : 1 /* Literal */) : type;
|
|
68749
|
+
return changed ? mappedTypes && (toIntersection ? getIntersectionType(mappedTypes) : getUnionType(mappedTypes, noReductions ? 0 /* None */ : 1 /* Literal */)) : type;
|
|
68689
68750
|
}
|
|
68690
68751
|
function mapTypeWithAlias(type, mapper, aliasSymbol, aliasTypeArguments) {
|
|
68691
68752
|
return type.flags & 1048576 /* Union */ && aliasSymbol ? getUnionType(map(type.types, mapper), 1 /* Literal */, aliasSymbol, aliasTypeArguments) : mapType(type, mapper);
|
|
@@ -70038,14 +70099,12 @@ function createTypeChecker(host) {
|
|
|
70038
70099
|
case 80 /* Identifier */:
|
|
70039
70100
|
if (!isMatchingReference(reference, expr) && inlineLevel < 5) {
|
|
70040
70101
|
const symbol = getResolvedSymbol(expr);
|
|
70041
|
-
|
|
70042
|
-
|
|
70043
|
-
|
|
70044
|
-
|
|
70045
|
-
|
|
70046
|
-
|
|
70047
|
-
return result;
|
|
70048
|
-
}
|
|
70102
|
+
const inlineExpression = getNarrowableInlineExpression(symbol);
|
|
70103
|
+
if (inlineExpression && isConstantReference(reference)) {
|
|
70104
|
+
inlineLevel++;
|
|
70105
|
+
const result = narrowType(type, inlineExpression, assumeTrue);
|
|
70106
|
+
inlineLevel--;
|
|
70107
|
+
return result;
|
|
70049
70108
|
}
|
|
70050
70109
|
}
|
|
70051
70110
|
// falls through
|
|
@@ -70080,6 +70139,14 @@ function createTypeChecker(host) {
|
|
|
70080
70139
|
return type;
|
|
70081
70140
|
}
|
|
70082
70141
|
}
|
|
70142
|
+
function getNarrowableInlineExpression(symbol) {
|
|
70143
|
+
if (isConstantVariable(symbol)) {
|
|
70144
|
+
const declaration = symbol.valueDeclaration;
|
|
70145
|
+
if (declaration && isVariableDeclaration(declaration) && !declaration.type && declaration.initializer) {
|
|
70146
|
+
return declaration.initializer;
|
|
70147
|
+
}
|
|
70148
|
+
}
|
|
70149
|
+
}
|
|
70083
70150
|
function getTypeOfSymbolAtLocation(symbol, location) {
|
|
70084
70151
|
symbol = getExportSymbolOfValueSymbolIfExported(symbol);
|
|
70085
70152
|
if (location.kind === 80 /* Identifier */ || location.kind === 81 /* PrivateIdentifier */) {
|
|
@@ -70269,11 +70336,11 @@ function createTypeChecker(host) {
|
|
|
70269
70336
|
));
|
|
70270
70337
|
return contextualType && !isGenericType(contextualType);
|
|
70271
70338
|
}
|
|
70272
|
-
function getNarrowableTypeForReference(type, reference, checkMode) {
|
|
70339
|
+
function getNarrowableTypeForReference(type, reference, checkMode, forReturnTypeNarrowing) {
|
|
70273
70340
|
if (isNoInferType(type)) {
|
|
70274
70341
|
type = type.baseType;
|
|
70275
70342
|
}
|
|
70276
|
-
const substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) && someType(type, isGenericTypeWithUnionConstraint) && (isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
|
|
70343
|
+
const substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) && someType(type, isGenericTypeWithUnionConstraint) && (forReturnTypeNarrowing || isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
|
|
70277
70344
|
return substituteConstraints ? mapType(type, getBaseConstraintOrType) : type;
|
|
70278
70345
|
}
|
|
70279
70346
|
function isExportOrExportExpression(location) {
|
|
@@ -70426,7 +70493,7 @@ function createTypeChecker(host) {
|
|
|
70426
70493
|
jsxFactorySym = resolveName(
|
|
70427
70494
|
jsxFactoryLocation,
|
|
70428
70495
|
jsxFactoryNamespace,
|
|
70429
|
-
111551 /* Value */,
|
|
70496
|
+
compilerOptions.jsx === 1 /* Preserve */ ? 111551 /* Value */ & ~384 /* Enum */ : 111551 /* Value */,
|
|
70430
70497
|
jsxFactoryRefErr,
|
|
70431
70498
|
/*isUse*/
|
|
70432
70499
|
true
|
|
@@ -70445,7 +70512,7 @@ function createTypeChecker(host) {
|
|
|
70445
70512
|
resolveName(
|
|
70446
70513
|
jsxFactoryLocation,
|
|
70447
70514
|
localJsxNamespace,
|
|
70448
|
-
111551 /* Value */,
|
|
70515
|
+
compilerOptions.jsx === 1 /* Preserve */ ? 111551 /* Value */ & ~384 /* Enum */ : 111551 /* Value */,
|
|
70449
70516
|
jsxFactoryRefErr,
|
|
70450
70517
|
/*isUse*/
|
|
70451
70518
|
true
|
|
@@ -71398,9 +71465,16 @@ function createTypeChecker(host) {
|
|
|
71398
71465
|
function getContextualTypeForReturnExpression(node, contextFlags) {
|
|
71399
71466
|
const func = getContainingFunction(node);
|
|
71400
71467
|
if (func) {
|
|
71468
|
+
const functionFlags = getFunctionFlags(func);
|
|
71469
|
+
const links = getNodeLinks(node);
|
|
71470
|
+
if (links.contextualReturnType) {
|
|
71471
|
+
if (functionFlags & 2 /* Async */) {
|
|
71472
|
+
return getUnionType([links.contextualReturnType, createPromiseLikeType(links.contextualReturnType)]);
|
|
71473
|
+
}
|
|
71474
|
+
return links.contextualReturnType;
|
|
71475
|
+
}
|
|
71401
71476
|
let contextualReturnType = getContextualReturnType(func, contextFlags);
|
|
71402
71477
|
if (contextualReturnType) {
|
|
71403
|
-
const functionFlags = getFunctionFlags(func);
|
|
71404
71478
|
if (functionFlags & 1 /* Generator */) {
|
|
71405
71479
|
const isAsyncGenerator = (functionFlags & 2 /* Async */) !== 0;
|
|
71406
71480
|
if (contextualReturnType.flags & 1048576 /* Union */) {
|
|
@@ -72098,6 +72172,13 @@ function createTypeChecker(host) {
|
|
|
72098
72172
|
if (index >= 0) {
|
|
72099
72173
|
return contextualTypes[index];
|
|
72100
72174
|
}
|
|
72175
|
+
const links = getNodeLinks(node);
|
|
72176
|
+
if (links.contextualReturnType) {
|
|
72177
|
+
if (node.flags & 65536 /* AwaitContext */) {
|
|
72178
|
+
return getUnionType([links.contextualReturnType, createPromiseLikeType(links.contextualReturnType)]);
|
|
72179
|
+
}
|
|
72180
|
+
return links.contextualReturnType;
|
|
72181
|
+
}
|
|
72101
72182
|
const { parent } = node;
|
|
72102
72183
|
switch (parent.kind) {
|
|
72103
72184
|
case 260 /* VariableDeclaration */:
|
|
@@ -72903,7 +72984,8 @@ function createTypeChecker(host) {
|
|
|
72903
72984
|
);
|
|
72904
72985
|
}
|
|
72905
72986
|
checkJsxChildren(node);
|
|
72906
|
-
|
|
72987
|
+
const jsxElementType = getJsxElementTypeAt(node);
|
|
72988
|
+
return isErrorType(jsxElementType) ? anyType : jsxElementType;
|
|
72907
72989
|
}
|
|
72908
72990
|
function isHyphenatedJsxName(name) {
|
|
72909
72991
|
return name.includes("-");
|
|
@@ -75963,11 +76045,12 @@ function createTypeChecker(host) {
|
|
|
75963
76045
|
const sourceFileLinks = getNodeLinks(getSourceFileOfNode(node));
|
|
75964
76046
|
if (sourceFileLinks.jsxFragmentType !== void 0) return sourceFileLinks.jsxFragmentType;
|
|
75965
76047
|
const jsxFragmentFactoryName = getJsxNamespace(node);
|
|
76048
|
+
if (jsxFragmentFactoryName === "null") return sourceFileLinks.jsxFragmentType = anyType;
|
|
75966
76049
|
const jsxFactoryRefErr = diagnostics ? Diagnostics.Using_JSX_fragments_requires_fragment_factory_0_to_be_in_scope_but_it_could_not_be_found : void 0;
|
|
75967
76050
|
const jsxFactorySymbol = getJsxNamespaceContainerForImplicitImport(node) ?? resolveName(
|
|
75968
76051
|
node,
|
|
75969
76052
|
jsxFragmentFactoryName,
|
|
75970
|
-
111551 /* Value */,
|
|
76053
|
+
compilerOptions.jsx === 1 /* Preserve */ ? 111551 /* Value */ & ~384 /* Enum */ : 111551 /* Value */,
|
|
75971
76054
|
/*nameNotFoundMessage*/
|
|
75972
76055
|
jsxFactoryRefErr,
|
|
75973
76056
|
/*isUse*/
|
|
@@ -81902,11 +81985,8 @@ function createTypeChecker(host) {
|
|
|
81902
81985
|
}
|
|
81903
81986
|
const parent = node.parent.parent;
|
|
81904
81987
|
const parentCheckMode = node.dotDotDotToken ? 32 /* RestBindingElement */ : 0 /* Normal */;
|
|
81988
|
+
const parentType = getTypeForBindingElementParent(parent, parentCheckMode);
|
|
81905
81989
|
const name = node.propertyName || node.name;
|
|
81906
|
-
let parentType = getTypeForBindingElementParent(parent, parentCheckMode);
|
|
81907
|
-
if (parentType && !parent.initializer) {
|
|
81908
|
-
parentType = checkNonNullType(parentType, parent);
|
|
81909
|
-
}
|
|
81910
81990
|
if (parentType && !isBindingPattern(name)) {
|
|
81911
81991
|
const exprType = getLiteralTypeFromPropertyName(name);
|
|
81912
81992
|
if (isTypeUsableAsPropertyName(exprType)) {
|
|
@@ -81946,15 +82026,16 @@ function createTypeChecker(host) {
|
|
|
81946
82026
|
if (isInAmbientOrTypeNode(node)) {
|
|
81947
82027
|
return;
|
|
81948
82028
|
}
|
|
81949
|
-
const needCheckInitializer = node.initializer && node.parent.parent.kind !== 249 /* ForInStatement */;
|
|
82029
|
+
const needCheckInitializer = hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 249 /* ForInStatement */;
|
|
81950
82030
|
const needCheckWidenedType = !some(node.name.elements, not(isOmittedExpression));
|
|
81951
82031
|
if (needCheckInitializer || needCheckWidenedType) {
|
|
81952
82032
|
const widenedType = getWidenedTypeForVariableLikeDeclaration(node);
|
|
81953
82033
|
if (needCheckInitializer) {
|
|
82034
|
+
const initializerType = checkExpressionCached(node.initializer);
|
|
81954
82035
|
if (strictNullChecks && needCheckWidenedType) {
|
|
81955
|
-
checkNonNullNonVoidType(
|
|
82036
|
+
checkNonNullNonVoidType(initializerType, node);
|
|
81956
82037
|
} else {
|
|
81957
|
-
checkTypeAssignableToAndOptionallyElaborate(
|
|
82038
|
+
checkTypeAssignableToAndOptionallyElaborate(initializerType, getWidenedTypeForVariableLikeDeclaration(node), node, node.initializer);
|
|
81958
82039
|
}
|
|
81959
82040
|
}
|
|
81960
82041
|
if (needCheckWidenedType) {
|
|
@@ -82987,34 +83068,234 @@ function createTypeChecker(host) {
|
|
|
82987
83068
|
}
|
|
82988
83069
|
const signature = getSignatureFromDeclaration(container);
|
|
82989
83070
|
const returnType = getReturnTypeOfSignature(signature);
|
|
82990
|
-
const functionFlags = getFunctionFlags(container);
|
|
82991
83071
|
if (strictNullChecks || node.expression || returnType.flags & 131072 /* Never */) {
|
|
82992
|
-
const exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType;
|
|
82993
83072
|
if (container.kind === 178 /* SetAccessor */) {
|
|
82994
83073
|
if (node.expression) {
|
|
82995
83074
|
error(node, Diagnostics.Setters_cannot_return_a_value);
|
|
82996
83075
|
}
|
|
82997
83076
|
} else if (container.kind === 176 /* Constructor */) {
|
|
83077
|
+
const exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType;
|
|
82998
83078
|
if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) {
|
|
82999
83079
|
error(node, Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class);
|
|
83000
83080
|
}
|
|
83001
83081
|
} else if (getReturnTypeFromAnnotation(container)) {
|
|
83002
|
-
|
|
83003
|
-
const unwrappedExprType = functionFlags & 2 /* Async */ ? checkAwaitedType(
|
|
83004
|
-
exprType,
|
|
83005
|
-
/*withAlias*/
|
|
83006
|
-
false,
|
|
83007
|
-
node,
|
|
83008
|
-
Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
|
|
83009
|
-
) : exprType;
|
|
83010
|
-
if (unwrappedReturnType) {
|
|
83011
|
-
checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, node, node.expression);
|
|
83012
|
-
}
|
|
83082
|
+
checkReturnStatementExpression(container, returnType, node, node.expression);
|
|
83013
83083
|
}
|
|
83014
83084
|
} else if (container.kind !== 176 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeUndefinedVoidOrAny(container, returnType)) {
|
|
83015
83085
|
error(node, Diagnostics.Not_all_code_paths_return_a_value);
|
|
83016
83086
|
}
|
|
83017
83087
|
}
|
|
83088
|
+
function checkReturnStatementExpression(container, returnType, node, expr) {
|
|
83089
|
+
const functionFlags = getFunctionFlags(container);
|
|
83090
|
+
const unwrappedReturnType = unwrapReturnType(returnType, functionFlags) ?? returnType;
|
|
83091
|
+
if (expr) {
|
|
83092
|
+
const unwrappedExpr = skipParentheses(expr);
|
|
83093
|
+
if (isConditionalExpression(unwrappedExpr)) {
|
|
83094
|
+
return checkReturnConditionalExpression(container, returnType, node, unwrappedExpr);
|
|
83095
|
+
}
|
|
83096
|
+
}
|
|
83097
|
+
const exprType = expr ? checkExpressionCached(expr) : undefinedType;
|
|
83098
|
+
const unwrappedExprType = functionFlags & 2 /* Async */ ? checkAwaitedType(
|
|
83099
|
+
exprType,
|
|
83100
|
+
/*withAlias*/
|
|
83101
|
+
false,
|
|
83102
|
+
node,
|
|
83103
|
+
Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
|
|
83104
|
+
) : exprType;
|
|
83105
|
+
const errorNode = node.expression && isConditionalExpression(skipParentheses(node.expression)) ? expr : node;
|
|
83106
|
+
if (checkTypeAssignableTo(
|
|
83107
|
+
unwrappedExprType,
|
|
83108
|
+
unwrappedReturnType,
|
|
83109
|
+
/*errorNode*/
|
|
83110
|
+
void 0
|
|
83111
|
+
)) {
|
|
83112
|
+
return;
|
|
83113
|
+
}
|
|
83114
|
+
if (!isGenericIndexedOrConditionalReturnType(unwrappedReturnType)) {
|
|
83115
|
+
checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, errorNode, expr);
|
|
83116
|
+
return;
|
|
83117
|
+
}
|
|
83118
|
+
const allTypeParameters = appendTypeParameters(getOuterTypeParameters(
|
|
83119
|
+
container,
|
|
83120
|
+
/*includeThisTypes*/
|
|
83121
|
+
false
|
|
83122
|
+
), getEffectiveTypeParameterDeclarations(container));
|
|
83123
|
+
const narrowableTypeParameters = allTypeParameters && getNarrowableTypeParameters(allTypeParameters);
|
|
83124
|
+
if (!narrowableTypeParameters || !narrowableTypeParameters.length || !isNarrowableReturnType(unwrappedReturnType)) {
|
|
83125
|
+
checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, errorNode, expr);
|
|
83126
|
+
return;
|
|
83127
|
+
}
|
|
83128
|
+
let narrowPosition = node;
|
|
83129
|
+
let narrowFlowNode = node.flowNode;
|
|
83130
|
+
if (expr && isConditionalExpression(expr.parent)) {
|
|
83131
|
+
narrowFlowNode = expr.parent.whenTrue === expr ? expr.parent.flowNodeWhenTrue : expr.parent.flowNodeWhenFalse;
|
|
83132
|
+
narrowPosition = expr;
|
|
83133
|
+
}
|
|
83134
|
+
if (!narrowFlowNode) {
|
|
83135
|
+
checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, errorNode, expr);
|
|
83136
|
+
return;
|
|
83137
|
+
}
|
|
83138
|
+
const narrowed = mapDefined(narrowableTypeParameters, ([typeParam, symbol, reference]) => {
|
|
83139
|
+
const narrowReference = factory.cloneNode(reference);
|
|
83140
|
+
narrowReference.id = void 0;
|
|
83141
|
+
getNodeLinks(narrowReference).resolvedSymbol = symbol;
|
|
83142
|
+
setParent(narrowReference, narrowPosition.parent);
|
|
83143
|
+
narrowReference.flowNode = narrowFlowNode;
|
|
83144
|
+
const initialType = getNarrowableTypeForReference(
|
|
83145
|
+
typeParam,
|
|
83146
|
+
narrowReference,
|
|
83147
|
+
/*checkMode*/
|
|
83148
|
+
void 0,
|
|
83149
|
+
/*forReturnTypeNarrowing*/
|
|
83150
|
+
true
|
|
83151
|
+
);
|
|
83152
|
+
if (initialType === typeParam) {
|
|
83153
|
+
return void 0;
|
|
83154
|
+
}
|
|
83155
|
+
const flowType = getFlowTypeOfReference(narrowReference, initialType);
|
|
83156
|
+
const exprType2 = getTypeFromFlowType(flowType);
|
|
83157
|
+
if (isTypeAny(exprType2) || isErrorType(exprType2) || exprType2 === typeParam || exprType2 === mapType(typeParam, getBaseConstraintOrType)) {
|
|
83158
|
+
return void 0;
|
|
83159
|
+
}
|
|
83160
|
+
const narrowedType = getSubstitutionType(
|
|
83161
|
+
typeParam,
|
|
83162
|
+
exprType2,
|
|
83163
|
+
/*isNarrowed*/
|
|
83164
|
+
true
|
|
83165
|
+
);
|
|
83166
|
+
return [typeParam, narrowedType];
|
|
83167
|
+
});
|
|
83168
|
+
const narrowMapper = createTypeMapper(narrowed.map(([tp, _]) => tp), narrowed.map(([_, t]) => t));
|
|
83169
|
+
const narrowedReturnType = instantiateType(
|
|
83170
|
+
unwrappedReturnType,
|
|
83171
|
+
narrowMapper
|
|
83172
|
+
);
|
|
83173
|
+
if (expr) {
|
|
83174
|
+
const links = getNodeLinks(expr);
|
|
83175
|
+
if (!links.contextualReturnType) {
|
|
83176
|
+
links.contextualReturnType = narrowedReturnType;
|
|
83177
|
+
}
|
|
83178
|
+
}
|
|
83179
|
+
const narrowedExprType = expr ? checkExpression(expr) : undefinedType;
|
|
83180
|
+
const narrowedUnwrappedExprType = functionFlags & 2 /* Async */ ? checkAwaitedType(
|
|
83181
|
+
narrowedExprType,
|
|
83182
|
+
/*withAlias*/
|
|
83183
|
+
false,
|
|
83184
|
+
node,
|
|
83185
|
+
Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
|
|
83186
|
+
) : narrowedExprType;
|
|
83187
|
+
checkTypeAssignableToAndOptionallyElaborate(narrowedUnwrappedExprType, narrowedReturnType, errorNode, expr);
|
|
83188
|
+
}
|
|
83189
|
+
function checkReturnConditionalExpression(container, returnType, node, expr) {
|
|
83190
|
+
checkExpression(expr.condition);
|
|
83191
|
+
checkReturnStatementExpression(container, returnType, node, expr.whenTrue);
|
|
83192
|
+
checkReturnStatementExpression(container, returnType, node, expr.whenFalse);
|
|
83193
|
+
}
|
|
83194
|
+
function getNarrowableTypeParameters(candidates) {
|
|
83195
|
+
const narrowableParams = [];
|
|
83196
|
+
for (const typeParam of candidates) {
|
|
83197
|
+
const constraint = getConstraintOfTypeParameter(typeParam);
|
|
83198
|
+
if (!constraint || !(constraint.flags & 1048576 /* Union */)) continue;
|
|
83199
|
+
if (typeParam.symbol && typeParam.symbol.declarations && typeParam.symbol.declarations.length === 1) {
|
|
83200
|
+
const container = typeParam.symbol.declarations[0].parent;
|
|
83201
|
+
if (!isFunctionLike(container)) continue;
|
|
83202
|
+
let reference;
|
|
83203
|
+
let hasInvalidReference = false;
|
|
83204
|
+
for (const paramDecl of container.parameters) {
|
|
83205
|
+
const typeNode = paramDecl.type;
|
|
83206
|
+
if (!typeNode) continue;
|
|
83207
|
+
if (isTypeParameterReferenced(typeParam, typeNode)) {
|
|
83208
|
+
let candidateReference;
|
|
83209
|
+
if (isTypeReferenceNode(typeNode) && isReferenceToTypeParameter(typeParam, typeNode) && (candidateReference = getValidParameterReference(paramDecl, constraint))) {
|
|
83210
|
+
if (reference) {
|
|
83211
|
+
hasInvalidReference = true;
|
|
83212
|
+
break;
|
|
83213
|
+
}
|
|
83214
|
+
reference = candidateReference;
|
|
83215
|
+
continue;
|
|
83216
|
+
}
|
|
83217
|
+
hasInvalidReference = true;
|
|
83218
|
+
break;
|
|
83219
|
+
}
|
|
83220
|
+
}
|
|
83221
|
+
if (!hasInvalidReference && reference) {
|
|
83222
|
+
const symbol = getResolvedSymbol(reference);
|
|
83223
|
+
if (symbol !== unknownSymbol) narrowableParams.push([typeParam, symbol, reference]);
|
|
83224
|
+
}
|
|
83225
|
+
}
|
|
83226
|
+
}
|
|
83227
|
+
return narrowableParams;
|
|
83228
|
+
function getValidParameterReference(paramDecl, constraint) {
|
|
83229
|
+
if (!isIdentifier(paramDecl.name)) return;
|
|
83230
|
+
if (paramDecl.questionToken && !containsUndefinedType(constraint)) return;
|
|
83231
|
+
return paramDecl.name;
|
|
83232
|
+
}
|
|
83233
|
+
function isReferenceToTypeParameter(typeParam, node) {
|
|
83234
|
+
return getTypeFromTypeReference(node) === typeParam;
|
|
83235
|
+
}
|
|
83236
|
+
function isTypeParameterReferenced(typeParam, node) {
|
|
83237
|
+
return isReferenced(node);
|
|
83238
|
+
function isReferenced(node2) {
|
|
83239
|
+
if (isTypeReferenceNode(node2)) {
|
|
83240
|
+
return isReferenceToTypeParameter(typeParam, node2);
|
|
83241
|
+
}
|
|
83242
|
+
if (isTypeQueryNode(node2)) {
|
|
83243
|
+
return isTypeParameterPossiblyReferenced(typeParam, node2);
|
|
83244
|
+
}
|
|
83245
|
+
return !!forEachChild(node2, isReferenced);
|
|
83246
|
+
}
|
|
83247
|
+
}
|
|
83248
|
+
}
|
|
83249
|
+
function isNarrowableReturnType(returnType) {
|
|
83250
|
+
return isConditionalType(returnType) ? isNarrowableConditionalType(returnType) : !!(returnType.indexType.flags & 262144 /* TypeParameter */);
|
|
83251
|
+
}
|
|
83252
|
+
function isNarrowableConditionalType(type, mapper) {
|
|
83253
|
+
const typeArguments = mapper && map(type.root.outerTypeParameters, (t) => {
|
|
83254
|
+
const mapped = getMappedType(t, mapper);
|
|
83255
|
+
if (isNarrowingSubstitutionType(mapped)) {
|
|
83256
|
+
return mapped.baseType;
|
|
83257
|
+
}
|
|
83258
|
+
return mapped;
|
|
83259
|
+
});
|
|
83260
|
+
const id = `${type.id}:${getTypeListId(typeArguments)}`;
|
|
83261
|
+
let result = narrowableReturnTypeCache.get(id);
|
|
83262
|
+
if (result === void 0) {
|
|
83263
|
+
const nonNarrowingMapper = type.root.outerTypeParameters && typeArguments && createTypeMapper(type.root.outerTypeParameters, typeArguments);
|
|
83264
|
+
const instantiatedType = instantiateType(type, nonNarrowingMapper);
|
|
83265
|
+
result = isConditionalType(instantiatedType) && isNarrowableConditionalTypeWorker(instantiatedType);
|
|
83266
|
+
narrowableReturnTypeCache.set(id, result);
|
|
83267
|
+
}
|
|
83268
|
+
return result;
|
|
83269
|
+
}
|
|
83270
|
+
function isNarrowableConditionalTypeWorker(type) {
|
|
83271
|
+
if (!type.root.isDistributive) {
|
|
83272
|
+
return false;
|
|
83273
|
+
}
|
|
83274
|
+
if (type.root.inferTypeParameters) {
|
|
83275
|
+
return false;
|
|
83276
|
+
}
|
|
83277
|
+
if (!(type.checkType.flags & 262144 /* TypeParameter */)) {
|
|
83278
|
+
return false;
|
|
83279
|
+
}
|
|
83280
|
+
const constraintType = getConstraintOfTypeParameter(type.checkType);
|
|
83281
|
+
if (!constraintType || !(constraintType.flags & 1048576 /* Union */)) {
|
|
83282
|
+
return false;
|
|
83283
|
+
}
|
|
83284
|
+
if (!everyType(type.extendsType, (extendsType) => some(
|
|
83285
|
+
constraintType.types,
|
|
83286
|
+
(constraintType2) => isTypeIdenticalTo(constraintType2, extendsType)
|
|
83287
|
+
))) {
|
|
83288
|
+
return false;
|
|
83289
|
+
}
|
|
83290
|
+
const trueType2 = getTrueTypeFromConditionalType(type);
|
|
83291
|
+
const falseType2 = getFalseTypeFromConditionalType(type);
|
|
83292
|
+
const isValidTrueType = isConditionalType(trueType2) ? isNarrowableConditionalType(trueType2) : true;
|
|
83293
|
+
const isValidFalseType = isConditionalType(falseType2) ? isNarrowableConditionalType(falseType2) : falseType2 === neverType;
|
|
83294
|
+
return isValidTrueType && isValidFalseType;
|
|
83295
|
+
}
|
|
83296
|
+
function isConditionalType(type) {
|
|
83297
|
+
return !!(type.flags & 16777216 /* Conditional */);
|
|
83298
|
+
}
|
|
83018
83299
|
function checkWithStatement(node) {
|
|
83019
83300
|
if (!checkGrammarStatementInAmbientContext(node)) {
|
|
83020
83301
|
if (node.flags & 65536 /* AwaitContext */) {
|
|
@@ -112132,7 +112413,7 @@ function createGetIsolatedDeclarationErrors(resolver) {
|
|
|
112132
112413
|
if (!addUndefined && node.initializer) {
|
|
112133
112414
|
return createExpressionError(node.initializer);
|
|
112134
112415
|
}
|
|
112135
|
-
const message = addUndefined ? Diagnostics.
|
|
112416
|
+
const message = addUndefined ? Diagnostics.Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_its_type_This_is_not_supported_with_isolatedDeclarations : errorByDeclarationKind[node.kind];
|
|
112136
112417
|
const diag2 = createDiagnosticForNode(node, message);
|
|
112137
112418
|
const targetStr = getTextOfNode(
|
|
112138
112419
|
node.name,
|