typescript 5.5.0-dev.20240522 → 5.5.0-dev.20240524
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 +157 -112
- package/lib/typescript.d.ts +29 -0
- package/lib/typescript.js +418 -119
- package/package.json +4 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.5";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240524`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -3561,6 +3561,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
3561
3561
|
TypeFlags2[TypeFlags2["TemplateLiteral"] = 134217728] = "TemplateLiteral";
|
|
3562
3562
|
TypeFlags2[TypeFlags2["StringMapping"] = 268435456] = "StringMapping";
|
|
3563
3563
|
TypeFlags2[TypeFlags2["Reserved1"] = 536870912] = "Reserved1";
|
|
3564
|
+
TypeFlags2[TypeFlags2["Reserved2"] = 1073741824] = "Reserved2";
|
|
3564
3565
|
TypeFlags2[TypeFlags2["AnyOrUnknown"] = 3] = "AnyOrUnknown";
|
|
3565
3566
|
TypeFlags2[TypeFlags2["Nullable"] = 98304] = "Nullable";
|
|
3566
3567
|
TypeFlags2[TypeFlags2["Literal"] = 2944] = "Literal";
|
|
@@ -3599,6 +3600,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
3599
3600
|
TypeFlags2[TypeFlags2["IncludesEmptyObject"] = 16777216 /* Conditional */] = "IncludesEmptyObject";
|
|
3600
3601
|
TypeFlags2[TypeFlags2["IncludesInstantiable"] = 33554432 /* Substitution */] = "IncludesInstantiable";
|
|
3601
3602
|
TypeFlags2[TypeFlags2["IncludesConstrainedTypeVariable"] = 536870912 /* Reserved1 */] = "IncludesConstrainedTypeVariable";
|
|
3603
|
+
TypeFlags2[TypeFlags2["IncludesError"] = 1073741824 /* Reserved2 */] = "IncludesError";
|
|
3602
3604
|
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36323331] = "NotPrimitiveUnion";
|
|
3603
3605
|
return TypeFlags2;
|
|
3604
3606
|
})(TypeFlags || {});
|
|
@@ -7508,6 +7510,8 @@ var Diagnostics = {
|
|
|
7508
7510
|
Add_satisfies_and_a_type_assertion_to_this_expression_satisfies_T_as_T_to_make_the_type_explicit: diag(9035, 1 /* Error */, "Add_satisfies_and_a_type_assertion_to_this_expression_satisfies_T_as_T_to_make_the_type_explicit_9035", "Add satisfies and a type assertion to this expression (satisfies T as T) to make the type explicit."),
|
|
7509
7511
|
Move_the_expression_in_default_export_to_a_variable_and_add_a_type_annotation_to_it: diag(9036, 1 /* Error */, "Move_the_expression_in_default_export_to_a_variable_and_add_a_type_annotation_to_it_9036", "Move the expression in default export to a variable and add a type annotation to it."),
|
|
7510
7512
|
Default_exports_can_t_be_inferred_with_isolatedDeclarations: diag(9037, 1 /* Error */, "Default_exports_can_t_be_inferred_with_isolatedDeclarations_9037", "Default exports can't be inferred with --isolatedDeclarations."),
|
|
7513
|
+
Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations: diag(9038, 1 /* Error */, "Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations_9038", "Computed property names on class or object literals cannot be inferred with --isolatedDeclarations."),
|
|
7514
|
+
Type_containing_private_name_0_can_t_be_used_with_isolatedDeclarations: diag(9039, 1 /* Error */, "Type_containing_private_name_0_can_t_be_used_with_isolatedDeclarations_9039", "Type containing private name '{0}' can't be used with --isolatedDeclarations."),
|
|
7511
7515
|
JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17e3, 1 /* Error */, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."),
|
|
7512
7516
|
JSX_elements_cannot_have_multiple_attributes_with_the_same_name: diag(17001, 1 /* Error */, "JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001", "JSX elements cannot have multiple attributes with the same name."),
|
|
7513
7517
|
Expected_corresponding_JSX_closing_tag_for_0: diag(17002, 1 /* Error */, "Expected_corresponding_JSX_closing_tag_for_0_17002", "Expected corresponding JSX closing tag for '{0}'."),
|
|
@@ -45053,7 +45057,6 @@ function createTypeChecker(host) {
|
|
|
45053
45057
|
var syntacticNodeBuilder = createSyntacticTypeNodeBuilder(compilerOptions, {
|
|
45054
45058
|
isEntityNameVisible,
|
|
45055
45059
|
isExpandoFunctionDeclaration,
|
|
45056
|
-
isNonNarrowedBindableName,
|
|
45057
45060
|
getAllAccessorDeclarations: getAllAccessorDeclarationsForDeclaration,
|
|
45058
45061
|
requiresAddingImplicitUndefined,
|
|
45059
45062
|
isUndefinedIdentifierExpression(node) {
|
|
@@ -46239,7 +46242,12 @@ function createTypeChecker(host) {
|
|
|
46239
46242
|
if (resolvedTarget === unknownSymbol) {
|
|
46240
46243
|
return source;
|
|
46241
46244
|
}
|
|
46242
|
-
|
|
46245
|
+
if (!(resolvedTarget.flags & getExcludedSymbolFlags(source.flags)) || (source.flags | resolvedTarget.flags) & 67108864 /* Assignment */) {
|
|
46246
|
+
target = cloneSymbol(resolvedTarget);
|
|
46247
|
+
} else {
|
|
46248
|
+
reportMergeSymbolError(target, source);
|
|
46249
|
+
return source;
|
|
46250
|
+
}
|
|
46243
46251
|
}
|
|
46244
46252
|
if (source.flags & 512 /* ValueModule */ && target.flags & 512 /* ValueModule */ && target.constEnumOnlyModule && !source.constEnumOnlyModule) {
|
|
46245
46253
|
target.constEnumOnlyModule = false;
|
|
@@ -46269,27 +46277,30 @@ function createTypeChecker(host) {
|
|
|
46269
46277
|
);
|
|
46270
46278
|
}
|
|
46271
46279
|
} else {
|
|
46272
|
-
|
|
46273
|
-
|
|
46280
|
+
reportMergeSymbolError(target, source);
|
|
46281
|
+
}
|
|
46282
|
+
return target;
|
|
46283
|
+
function reportMergeSymbolError(target2, source2) {
|
|
46284
|
+
const isEitherEnum = !!(target2.flags & 384 /* Enum */ || source2.flags & 384 /* Enum */);
|
|
46285
|
+
const isEitherBlockScoped = !!(target2.flags & 2 /* BlockScopedVariable */ || source2.flags & 2 /* BlockScopedVariable */);
|
|
46274
46286
|
const message = isEitherEnum ? Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations : isEitherBlockScoped ? Diagnostics.Cannot_redeclare_block_scoped_variable_0 : Diagnostics.Duplicate_identifier_0;
|
|
46275
|
-
const sourceSymbolFile =
|
|
46276
|
-
const targetSymbolFile =
|
|
46287
|
+
const sourceSymbolFile = source2.declarations && getSourceFileOfNode(source2.declarations[0]);
|
|
46288
|
+
const targetSymbolFile = target2.declarations && getSourceFileOfNode(target2.declarations[0]);
|
|
46277
46289
|
const isSourcePlainJs = isPlainJsFile(sourceSymbolFile, compilerOptions.checkJs);
|
|
46278
46290
|
const isTargetPlainJs = isPlainJsFile(targetSymbolFile, compilerOptions.checkJs);
|
|
46279
|
-
const symbolName2 = symbolToString(
|
|
46291
|
+
const symbolName2 = symbolToString(source2);
|
|
46280
46292
|
if (sourceSymbolFile && targetSymbolFile && amalgamatedDuplicates && !isEitherEnum && sourceSymbolFile !== targetSymbolFile) {
|
|
46281
46293
|
const firstFile = comparePaths(sourceSymbolFile.path, targetSymbolFile.path) === -1 /* LessThan */ ? sourceSymbolFile : targetSymbolFile;
|
|
46282
46294
|
const secondFile = firstFile === sourceSymbolFile ? targetSymbolFile : sourceSymbolFile;
|
|
46283
46295
|
const filesDuplicates = getOrUpdate(amalgamatedDuplicates, `${firstFile.path}|${secondFile.path}`, () => ({ firstFile, secondFile, conflictingSymbols: /* @__PURE__ */ new Map() }));
|
|
46284
46296
|
const conflictingSymbolInfo = getOrUpdate(filesDuplicates.conflictingSymbols, symbolName2, () => ({ isBlockScoped: isEitherBlockScoped, firstFileLocations: [], secondFileLocations: [] }));
|
|
46285
|
-
if (!isSourcePlainJs) addDuplicateLocations(conflictingSymbolInfo.firstFileLocations,
|
|
46286
|
-
if (!isTargetPlainJs) addDuplicateLocations(conflictingSymbolInfo.secondFileLocations,
|
|
46297
|
+
if (!isSourcePlainJs) addDuplicateLocations(conflictingSymbolInfo.firstFileLocations, source2);
|
|
46298
|
+
if (!isTargetPlainJs) addDuplicateLocations(conflictingSymbolInfo.secondFileLocations, target2);
|
|
46287
46299
|
} else {
|
|
46288
|
-
if (!isSourcePlainJs) addDuplicateDeclarationErrorsForSymbols(
|
|
46289
|
-
if (!isTargetPlainJs) addDuplicateDeclarationErrorsForSymbols(
|
|
46300
|
+
if (!isSourcePlainJs) addDuplicateDeclarationErrorsForSymbols(source2, message, symbolName2, target2);
|
|
46301
|
+
if (!isTargetPlainJs) addDuplicateDeclarationErrorsForSymbols(target2, message, symbolName2, source2);
|
|
46290
46302
|
}
|
|
46291
46303
|
}
|
|
46292
|
-
return target;
|
|
46293
46304
|
function addDuplicateLocations(locs, symbol) {
|
|
46294
46305
|
if (symbol.declarations) {
|
|
46295
46306
|
for (const decl of symbol.declarations) {
|
|
@@ -49135,6 +49146,9 @@ function createTypeChecker(host) {
|
|
|
49135
49146
|
function isClassInstanceSide(type) {
|
|
49136
49147
|
return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || !!(type.flags & 524288 /* Object */) && !!(getObjectFlags(type) & 16777216 /* IsClassInstanceClone */));
|
|
49137
49148
|
}
|
|
49149
|
+
function getTypeFromTypeNodeWithoutContext(node) {
|
|
49150
|
+
return getTypeFromTypeNode(node);
|
|
49151
|
+
}
|
|
49138
49152
|
function createNodeBuilder() {
|
|
49139
49153
|
return {
|
|
49140
49154
|
typeToTypeNode: (type, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeToTypeNodeHelper(type, context)),
|
|
@@ -49163,6 +49177,12 @@ function createTypeChecker(host) {
|
|
|
49163
49177
|
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context)),
|
|
49164
49178
|
symbolToNode: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToNode(symbol, context, meaning))
|
|
49165
49179
|
};
|
|
49180
|
+
function getTypeFromTypeNode2(context, node, noMappedTypes) {
|
|
49181
|
+
const type = getTypeFromTypeNodeWithoutContext(node);
|
|
49182
|
+
if (!context.mapper) return type;
|
|
49183
|
+
const mappedType = instantiateType(type, context.mapper);
|
|
49184
|
+
return noMappedTypes && mappedType !== type ? void 0 : mappedType;
|
|
49185
|
+
}
|
|
49166
49186
|
function setTextRange2(context, range, location) {
|
|
49167
49187
|
if (!nodeIsSynthesized(range) && !(range.flags & 16 /* Synthesized */) && (!context.enclosingFile || context.enclosingFile !== getSourceFileOfNode(range))) {
|
|
49168
49188
|
range = factory.cloneNode(range);
|
|
@@ -49208,7 +49228,7 @@ function createTypeChecker(host) {
|
|
|
49208
49228
|
}
|
|
49209
49229
|
const clone = tryReuseExistingNonParameterTypeNode(context, typeNode, type, host2);
|
|
49210
49230
|
if (clone) {
|
|
49211
|
-
if (addUndefined && !someType(
|
|
49231
|
+
if (addUndefined && !someType(getTypeFromTypeNode2(context, typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
|
|
49212
49232
|
return factory.createUnionTypeNode([clone, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
|
|
49213
49233
|
}
|
|
49214
49234
|
return clone;
|
|
@@ -49221,13 +49241,19 @@ function createTypeChecker(host) {
|
|
|
49221
49241
|
}
|
|
49222
49242
|
return void 0;
|
|
49223
49243
|
}
|
|
49224
|
-
function tryReuseExistingNonParameterTypeNode(context, existing, type, host2 = context.enclosingDeclaration, annotationType
|
|
49225
|
-
|
|
49244
|
+
function tryReuseExistingNonParameterTypeNode(context, existing, type, host2 = context.enclosingDeclaration, annotationType = getTypeFromTypeNode2(
|
|
49245
|
+
context,
|
|
49246
|
+
existing,
|
|
49247
|
+
/*noMappedTypes*/
|
|
49248
|
+
true
|
|
49249
|
+
)) {
|
|
49250
|
+
if (annotationType && typeNodeIsEquivalentToType(host2, type, annotationType) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
49226
49251
|
const result = tryReuseExistingTypeNodeHelper(context, existing);
|
|
49227
49252
|
if (result) {
|
|
49228
49253
|
return result;
|
|
49229
49254
|
}
|
|
49230
49255
|
}
|
|
49256
|
+
context.tracker.reportInferenceFallback(existing);
|
|
49231
49257
|
return void 0;
|
|
49232
49258
|
}
|
|
49233
49259
|
function symbolToNode(symbol, context, meaning) {
|
|
@@ -49269,7 +49295,8 @@ function createTypeChecker(host) {
|
|
|
49269
49295
|
mustCreateTypeParametersNamesLookups: true,
|
|
49270
49296
|
typeParameterNames: void 0,
|
|
49271
49297
|
typeParameterNamesByText: void 0,
|
|
49272
|
-
typeParameterNamesByTextNextNameCount: void 0
|
|
49298
|
+
typeParameterNamesByTextNextNameCount: void 0,
|
|
49299
|
+
mapper: void 0
|
|
49273
49300
|
};
|
|
49274
49301
|
context.tracker = new SymbolTrackerImpl(context, tracker, moduleResolverHost);
|
|
49275
49302
|
const resultingNode = cb(context);
|
|
@@ -49560,8 +49587,8 @@ function createTypeChecker(host) {
|
|
|
49560
49587
|
context.inferTypeParameters = type2.root.inferTypeParameters;
|
|
49561
49588
|
const extendsTypeNode2 = typeToTypeNodeHelper(instantiateType(type2.root.extendsType, newMapper), context);
|
|
49562
49589
|
context.inferTypeParameters = saveInferTypeParameters2;
|
|
49563
|
-
const trueTypeNode2 = typeToTypeNodeOrCircularityElision(instantiateType(
|
|
49564
|
-
const falseTypeNode2 = typeToTypeNodeOrCircularityElision(instantiateType(
|
|
49590
|
+
const trueTypeNode2 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode2(context, type2.root.node.trueType), newMapper));
|
|
49591
|
+
const falseTypeNode2 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode2(context, type2.root.node.falseType), newMapper));
|
|
49565
49592
|
return factory.createConditionalTypeNode(
|
|
49566
49593
|
checkTypeNode,
|
|
49567
49594
|
factory.createInferTypeNode(factory.createTypeParameterDeclaration(
|
|
@@ -49644,7 +49671,7 @@ function createTypeChecker(host) {
|
|
|
49644
49671
|
context.approximateLength += 10;
|
|
49645
49672
|
const result = setEmitFlags(mappedTypeNode, 1 /* SingleLine */);
|
|
49646
49673
|
if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
|
|
49647
|
-
const originalConstraint = instantiateType(getConstraintOfTypeParameter(
|
|
49674
|
+
const originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode2(context, type2.declaration.typeParameter.constraint.type)) || unknownType, type2.mapper);
|
|
49648
49675
|
return factory.createConditionalTypeNode(
|
|
49649
49676
|
typeToTypeNodeHelper(getModifiersTypeFromMappedType(type2), context),
|
|
49650
49677
|
factory.createInferTypeNode(factory.createTypeParameterDeclaration(
|
|
@@ -50271,7 +50298,7 @@ function createTypeChecker(host) {
|
|
|
50271
50298
|
/*skipUnionExpanding*/
|
|
50272
50299
|
true
|
|
50273
50300
|
)[0];
|
|
50274
|
-
const cleanup = enterNewScope(context, signature.declaration, expandedParams, signature.typeParameters, signature.parameters);
|
|
50301
|
+
const cleanup = enterNewScope(context, signature.declaration, expandedParams, signature.typeParameters, signature.parameters, signature.mapper);
|
|
50275
50302
|
context.approximateLength += 3;
|
|
50276
50303
|
if (context.flags & 32 /* WriteTypeArgumentsOfSignature */ && signature.target && signature.mapper && signature.target.typeParameters) {
|
|
50277
50304
|
typeArguments = signature.target.typeParameters.map((parameter) => typeToTypeNodeHelper(instantiateType(parameter, signature.mapper), context));
|
|
@@ -50379,11 +50406,15 @@ function createTypeChecker(host) {
|
|
|
50379
50406
|
function getParametersInScope(node) {
|
|
50380
50407
|
return isFunctionLike(node) || isJSDocSignature(node) ? getSignatureFromDeclaration(node).parameters : void 0;
|
|
50381
50408
|
}
|
|
50382
|
-
function enterNewScope(context, declaration, expandedParams, typeParameters, originalParameters) {
|
|
50409
|
+
function enterNewScope(context, declaration, expandedParams, typeParameters, originalParameters, mapper) {
|
|
50383
50410
|
const cleanupContext = cloneNodeBuilderContext(context);
|
|
50384
50411
|
let cleanupParams;
|
|
50385
50412
|
let cleanupTypeParams;
|
|
50386
50413
|
const oldEnclosingDecl = context.enclosingDeclaration;
|
|
50414
|
+
const oldMapper = context.mapper;
|
|
50415
|
+
if (mapper) {
|
|
50416
|
+
context.mapper = mapper;
|
|
50417
|
+
}
|
|
50387
50418
|
if (context.enclosingDeclaration && declaration) {
|
|
50388
50419
|
let pushFakeScope2 = function(kind, addAll) {
|
|
50389
50420
|
Debug.assert(context.enclosingDeclaration);
|
|
@@ -50482,6 +50513,7 @@ function createTypeChecker(host) {
|
|
|
50482
50513
|
cleanupTypeParams == null ? void 0 : cleanupTypeParams();
|
|
50483
50514
|
cleanupContext();
|
|
50484
50515
|
context.enclosingDeclaration = oldEnclosingDecl;
|
|
50516
|
+
context.mapper = oldMapper;
|
|
50485
50517
|
};
|
|
50486
50518
|
}
|
|
50487
50519
|
function tryGetThisParameterDeclaration(signature, context) {
|
|
@@ -50499,7 +50531,7 @@ function createTypeChecker(host) {
|
|
|
50499
50531
|
"this",
|
|
50500
50532
|
/*questionToken*/
|
|
50501
50533
|
void 0,
|
|
50502
|
-
typeToTypeNodeHelper(
|
|
50534
|
+
typeToTypeNodeHelper(getTypeFromTypeNode2(context, thisTag.typeExpression), context)
|
|
50503
50535
|
);
|
|
50504
50536
|
}
|
|
50505
50537
|
}
|
|
@@ -51138,10 +51170,10 @@ function createTypeChecker(host) {
|
|
|
51138
51170
|
const addUndefined = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
|
|
51139
51171
|
const enclosingDeclaration = context.enclosingDeclaration;
|
|
51140
51172
|
if (enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */)) {
|
|
51141
|
-
const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol
|
|
51173
|
+
const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol);
|
|
51142
51174
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
51143
51175
|
const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
51144
|
-
const result2 = tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
|
|
51176
|
+
const result2 = !isTypePredicateNode(existing) && tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
|
|
51145
51177
|
if (result2) {
|
|
51146
51178
|
return result2;
|
|
51147
51179
|
}
|
|
@@ -51161,7 +51193,7 @@ function createTypeChecker(host) {
|
|
|
51161
51193
|
context.flags = oldFlags;
|
|
51162
51194
|
return result;
|
|
51163
51195
|
}
|
|
51164
|
-
function typeNodeIsEquivalentToType(
|
|
51196
|
+
function typeNodeIsEquivalentToType(annotatedDeclaration, type, typeFromTypeNode) {
|
|
51165
51197
|
if (typeFromTypeNode === type) {
|
|
51166
51198
|
return true;
|
|
51167
51199
|
}
|
|
@@ -51191,13 +51223,10 @@ function createTypeChecker(host) {
|
|
|
51191
51223
|
function serializeReturnTypeForSignatureWorker(context, signature) {
|
|
51192
51224
|
const typePredicate = getTypePredicateOfSignature(signature);
|
|
51193
51225
|
const type = getReturnTypeOfSignature(signature);
|
|
51194
|
-
if (context.enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */)) {
|
|
51226
|
+
if (context.enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */) && signature.declaration && !nodeIsSynthesized(signature.declaration)) {
|
|
51195
51227
|
const annotation = signature.declaration && getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
|
|
51196
|
-
|
|
51197
|
-
|
|
51198
|
-
const annotated = getTypeFromTypeNode(annotation);
|
|
51199
|
-
const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
|
|
51200
|
-
const result = tryReuseExistingNonParameterTypeNode(context, annotation, type, signature.declaration, thisInstantiated);
|
|
51228
|
+
if (annotation && getTypeFromTypeNode2(context, annotation) === type) {
|
|
51229
|
+
const result = tryReuseExistingTypeNodeHelper(context, annotation);
|
|
51201
51230
|
if (result) {
|
|
51202
51231
|
return result;
|
|
51203
51232
|
}
|
|
@@ -51263,6 +51292,9 @@ function createTypeChecker(host) {
|
|
|
51263
51292
|
symAtLocation === void 0 && sym !== void 0 || // If the symbol is found both in declaration scope and in current scope then it shoudl point to the same reference
|
|
51264
51293
|
symAtLocation && sym && !getSymbolIfSameReference(getExportSymbolOfValueSymbolIfExported(symAtLocation), sym)
|
|
51265
51294
|
) {
|
|
51295
|
+
if (symAtLocation !== unknownSymbol) {
|
|
51296
|
+
context.tracker.reportInferenceFallback(node);
|
|
51297
|
+
}
|
|
51266
51298
|
introducesError = true;
|
|
51267
51299
|
return { introducesError, node, sym };
|
|
51268
51300
|
}
|
|
@@ -51281,6 +51313,7 @@ function createTypeChecker(host) {
|
|
|
51281
51313
|
/*shouldComputeAliasesToMakeVisible*/
|
|
51282
51314
|
false
|
|
51283
51315
|
).accessibility !== 0 /* Accessible */) {
|
|
51316
|
+
context.tracker.reportInferenceFallback(node);
|
|
51284
51317
|
introducesError = true;
|
|
51285
51318
|
} else {
|
|
51286
51319
|
context.tracker.trackSymbol(sym, context.enclosingDeclaration, meaning);
|
|
@@ -51336,13 +51369,26 @@ function createTypeChecker(host) {
|
|
|
51336
51369
|
!(length(existing.typeArguments) >= getMinTypeArgumentCount(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(nodeSymbol))));
|
|
51337
51370
|
}
|
|
51338
51371
|
}
|
|
51372
|
+
if (isThisTypeNode(existing)) {
|
|
51373
|
+
if (context.mapper === void 0) return true;
|
|
51374
|
+
const type = getTypeFromTypeNode2(
|
|
51375
|
+
context,
|
|
51376
|
+
existing,
|
|
51377
|
+
/*noMappedTypes*/
|
|
51378
|
+
true
|
|
51379
|
+
);
|
|
51380
|
+
return !!type;
|
|
51381
|
+
}
|
|
51339
51382
|
if (isTypeReferenceNode(existing)) {
|
|
51340
51383
|
if (isConstTypeReference(existing)) return false;
|
|
51341
51384
|
const type = getTypeFromTypeReference(existing);
|
|
51342
51385
|
const symbol = getNodeLinks(existing).resolvedSymbol;
|
|
51343
51386
|
if (!symbol) return false;
|
|
51344
51387
|
if (symbol.flags & 262144 /* TypeParameter */) {
|
|
51345
|
-
|
|
51388
|
+
const type2 = getDeclaredTypeOfSymbol(symbol);
|
|
51389
|
+
if (context.mapper && getMappedType(type2, context.mapper) !== type2) {
|
|
51390
|
+
return false;
|
|
51391
|
+
}
|
|
51346
51392
|
}
|
|
51347
51393
|
if (isInJSDoc(existing)) {
|
|
51348
51394
|
return existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) && !getIntendedTypeFromJSDocTypeReference(existing) && symbol.flags & 788968 /* Type */;
|
|
@@ -51355,7 +51401,7 @@ function createTypeChecker(host) {
|
|
|
51355
51401
|
return true;
|
|
51356
51402
|
}
|
|
51357
51403
|
function serializeExistingTypeNode(context, typeNode) {
|
|
51358
|
-
const type =
|
|
51404
|
+
const type = getTypeFromTypeNode2(context, typeNode);
|
|
51359
51405
|
return typeToTypeNodeHelper(type, context);
|
|
51360
51406
|
}
|
|
51361
51407
|
function tryReuseExistingTypeNodeHelper(context, existing) {
|
|
@@ -51403,8 +51449,8 @@ function createTypeChecker(host) {
|
|
|
51403
51449
|
if (isJSDocTypeLiteral(node)) {
|
|
51404
51450
|
return factory.createTypeLiteralNode(map(node.jsDocPropertyTags, (t) => {
|
|
51405
51451
|
const name = isIdentifier(t.name) ? t.name : t.name.right;
|
|
51406
|
-
const typeViaParent = getTypeOfPropertyOfType(
|
|
51407
|
-
const overrideTypeNode = typeViaParent && t.typeExpression &&
|
|
51452
|
+
const typeViaParent = getTypeOfPropertyOfType(getTypeFromTypeNode2(context, node), name.escapedText);
|
|
51453
|
+
const overrideTypeNode = typeViaParent && t.typeExpression && getTypeFromTypeNode2(context, t.typeExpression.type) !== typeViaParent ? typeToTypeNodeHelper(typeViaParent, context) : void 0;
|
|
51408
51454
|
return factory.createPropertySignature(
|
|
51409
51455
|
/*modifiers*/
|
|
51410
51456
|
void 0,
|
|
@@ -51445,7 +51491,7 @@ function createTypeChecker(host) {
|
|
|
51445
51491
|
/*modifiers*/
|
|
51446
51492
|
void 0,
|
|
51447
51493
|
getEffectiveDotDotDotForParameter(p),
|
|
51448
|
-
getNameForJSDocFunctionParameter(p, i),
|
|
51494
|
+
setTextRange2(context, factory.createIdentifier(getNameForJSDocFunctionParameter(p, i)), p),
|
|
51449
51495
|
p.questionToken,
|
|
51450
51496
|
visitNode(p.type, visitExistingNodeTreeSymbols, isTypeNode),
|
|
51451
51497
|
/*initializer*/
|
|
@@ -51460,7 +51506,7 @@ function createTypeChecker(host) {
|
|
|
51460
51506
|
/*modifiers*/
|
|
51461
51507
|
void 0,
|
|
51462
51508
|
getEffectiveDotDotDotForParameter(p),
|
|
51463
|
-
getNameForJSDocFunctionParameter(p, i),
|
|
51509
|
+
setTextRange2(context, factory.createIdentifier(getNameForJSDocFunctionParameter(p, i)), p),
|
|
51464
51510
|
p.questionToken,
|
|
51465
51511
|
visitNode(p.type, visitExistingNodeTreeSymbols, isTypeNode),
|
|
51466
51512
|
/*initializer*/
|
|
@@ -51470,6 +51516,21 @@ function createTypeChecker(host) {
|
|
|
51470
51516
|
);
|
|
51471
51517
|
}
|
|
51472
51518
|
}
|
|
51519
|
+
if (isThisTypeNode(node)) {
|
|
51520
|
+
if (canReuseTypeNode(context, node)) {
|
|
51521
|
+
return node;
|
|
51522
|
+
}
|
|
51523
|
+
return serializeExistingTypeNode(context, node);
|
|
51524
|
+
}
|
|
51525
|
+
if (isTypeParameterDeclaration(node)) {
|
|
51526
|
+
return factory.updateTypeParameterDeclaration(
|
|
51527
|
+
node,
|
|
51528
|
+
node.modifiers,
|
|
51529
|
+
setTextRange2(context, typeParameterToName(getDeclaredTypeOfSymbol(getSymbolOfDeclaration(node)), context), node),
|
|
51530
|
+
visitNode(node.constraint, visitExistingNodeTreeSymbols, isTypeNode),
|
|
51531
|
+
visitNode(node.default, visitExistingNodeTreeSymbols, isTypeNode)
|
|
51532
|
+
);
|
|
51533
|
+
}
|
|
51473
51534
|
if (isTypeReferenceNode(node)) {
|
|
51474
51535
|
if (canReuseTypeNode(context, node)) {
|
|
51475
51536
|
const { introducesError, node: newName } = trackExistingEntityName(node.typeName, context);
|
|
@@ -51501,7 +51562,7 @@ function createTypeChecker(host) {
|
|
|
51501
51562
|
if (isInJSDoc(node) && nodeSymbol && // The import type resolved using jsdoc fallback logic
|
|
51502
51563
|
(!node.isTypeOf && !(nodeSymbol.flags & 788968 /* Type */) || // The import type had type arguments autofilled by js fallback logic
|
|
51503
51564
|
!(length(node.typeArguments) >= getMinTypeArgumentCount(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(nodeSymbol))))) {
|
|
51504
|
-
return setTextRange2(context, typeToTypeNodeHelper(
|
|
51565
|
+
return setTextRange2(context, typeToTypeNodeHelper(getTypeFromTypeNode2(context, node), context), node);
|
|
51505
51566
|
}
|
|
51506
51567
|
return factory.updateImportTypeNode(
|
|
51507
51568
|
node,
|
|
@@ -51571,10 +51632,16 @@ function createTypeChecker(host) {
|
|
|
51571
51632
|
return factory.updateComputedPropertyName(node, literal);
|
|
51572
51633
|
}
|
|
51573
51634
|
}
|
|
51574
|
-
if (isTypePredicateNode(node)
|
|
51575
|
-
|
|
51576
|
-
|
|
51577
|
-
|
|
51635
|
+
if (isTypePredicateNode(node)) {
|
|
51636
|
+
let parameterName;
|
|
51637
|
+
if (isIdentifier(node.parameterName)) {
|
|
51638
|
+
const { node: result, introducesError } = trackExistingEntityName(node.parameterName, context);
|
|
51639
|
+
hadError = hadError || introducesError;
|
|
51640
|
+
parameterName = result;
|
|
51641
|
+
} else {
|
|
51642
|
+
parameterName = node.parameterName;
|
|
51643
|
+
}
|
|
51644
|
+
return factory.updateTypePredicateNode(node, node.assertsModifier, parameterName, visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode));
|
|
51578
51645
|
}
|
|
51579
51646
|
if (isTupleTypeNode(node) || isTypeLiteralNode(node) || isMappedTypeNode(node)) {
|
|
51580
51647
|
const visited = visitEachChild(
|
|
@@ -52350,7 +52417,7 @@ function createTypeChecker(host) {
|
|
|
52350
52417
|
}
|
|
52351
52418
|
return cleanup(factory.createExpressionWithTypeArguments(
|
|
52352
52419
|
expr,
|
|
52353
|
-
map(e.typeArguments, (a) => tryReuseExistingNonParameterTypeNode(context, a,
|
|
52420
|
+
map(e.typeArguments, (a) => tryReuseExistingNonParameterTypeNode(context, a, getTypeFromTypeNode2(context, a)) || typeToTypeNodeHelper(getTypeFromTypeNode2(context, a), context))
|
|
52354
52421
|
));
|
|
52355
52422
|
function cleanup(result2) {
|
|
52356
52423
|
context.enclosingDeclaration = oldEnclosing;
|
|
@@ -58894,6 +58961,7 @@ function createTypeChecker(host) {
|
|
|
58894
58961
|
if (flags & 465829888 /* Instantiable */) includes |= 33554432 /* IncludesInstantiable */;
|
|
58895
58962
|
if (flags & 2097152 /* Intersection */ && getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */) includes |= 536870912 /* IncludesConstrainedTypeVariable */;
|
|
58896
58963
|
if (type === wildcardType) includes |= 8388608 /* IncludesWildcard */;
|
|
58964
|
+
if (isErrorType(type)) includes |= 1073741824 /* IncludesError */;
|
|
58897
58965
|
if (!strictNullChecks && flags & 98304 /* Nullable */) {
|
|
58898
58966
|
if (!(getObjectFlags(type) & 65536 /* ContainsWideningType */)) includes |= 4194304 /* IncludesNonWideningType */;
|
|
58899
58967
|
} else {
|
|
@@ -59085,7 +59153,7 @@ function createTypeChecker(host) {
|
|
|
59085
59153
|
const includes = addTypesToUnion(typeSet, 0, types);
|
|
59086
59154
|
if (unionReduction !== 0 /* None */) {
|
|
59087
59155
|
if (includes & 3 /* AnyOrUnknown */) {
|
|
59088
|
-
return includes & 1 /* Any */ ? includes & 8388608 /* IncludesWildcard */ ? wildcardType : anyType : unknownType;
|
|
59156
|
+
return includes & 1 /* Any */ ? includes & 8388608 /* IncludesWildcard */ ? wildcardType : includes & 1073741824 /* IncludesError */ ? errorType : anyType : unknownType;
|
|
59089
59157
|
}
|
|
59090
59158
|
if (includes & 32768 /* Undefined */) {
|
|
59091
59159
|
if (typeSet.length >= 2 && typeSet[0] === undefinedType && typeSet[1] === missingType) {
|
|
@@ -59211,6 +59279,7 @@ function createTypeChecker(host) {
|
|
|
59211
59279
|
} else {
|
|
59212
59280
|
if (flags & 3 /* AnyOrUnknown */) {
|
|
59213
59281
|
if (type === wildcardType) includes |= 8388608 /* IncludesWildcard */;
|
|
59282
|
+
if (isErrorType(type)) includes |= 1073741824 /* IncludesError */;
|
|
59214
59283
|
} else if (strictNullChecks || !(flags & 98304 /* Nullable */)) {
|
|
59215
59284
|
if (type === missingType) {
|
|
59216
59285
|
includes |= 262144 /* IncludesMissingType */;
|
|
@@ -59338,7 +59407,7 @@ function createTypeChecker(host) {
|
|
|
59338
59407
|
return neverType;
|
|
59339
59408
|
}
|
|
59340
59409
|
if (includes & 1 /* Any */) {
|
|
59341
|
-
return includes & 8388608 /* IncludesWildcard */ ? wildcardType : anyType;
|
|
59410
|
+
return includes & 8388608 /* IncludesWildcard */ ? wildcardType : includes & 1073741824 /* IncludesError */ ? errorType : anyType;
|
|
59342
59411
|
}
|
|
59343
59412
|
if (!strictNullChecks && includes & 98304 /* Nullable */) {
|
|
59344
59413
|
return includes & 16777216 /* IncludesEmptyObject */ ? neverType : includes & 32768 /* Undefined */ ? undefinedType : nullType;
|
|
@@ -84841,6 +84910,7 @@ function createTypeChecker(host) {
|
|
|
84841
84910
|
function getSingleReturnExpression(declaration) {
|
|
84842
84911
|
let candidateExpr;
|
|
84843
84912
|
if (declaration && !nodeIsMissing(declaration.body)) {
|
|
84913
|
+
if (getFunctionFlags(declaration) & 3 /* AsyncGenerator */) return void 0;
|
|
84844
84914
|
const body = declaration.body;
|
|
84845
84915
|
if (body && isBlock(body)) {
|
|
84846
84916
|
forEachReturnStatement(body, (s) => {
|
|
@@ -84975,22 +85045,6 @@ function createTypeChecker(host) {
|
|
|
84975
85045
|
}
|
|
84976
85046
|
return false;
|
|
84977
85047
|
}
|
|
84978
|
-
function isNonNarrowedBindableName(node) {
|
|
84979
|
-
if (!hasBindableName(node.parent)) {
|
|
84980
|
-
return false;
|
|
84981
|
-
}
|
|
84982
|
-
const expression = node.expression;
|
|
84983
|
-
if (!isEntityNameExpression(expression)) {
|
|
84984
|
-
return true;
|
|
84985
|
-
}
|
|
84986
|
-
const type = getTypeOfExpression(expression);
|
|
84987
|
-
const symbol = getSymbolAtLocation(expression);
|
|
84988
|
-
if (!symbol) {
|
|
84989
|
-
return false;
|
|
84990
|
-
}
|
|
84991
|
-
const declaredType = getTypeOfSymbol(symbol);
|
|
84992
|
-
return declaredType === type;
|
|
84993
|
-
}
|
|
84994
85048
|
function literalTypeToNode(type, enclosing, tracker) {
|
|
84995
85049
|
const enumResult = type.flags & 1056 /* EnumLike */ ? nodeBuilder.symbolToExpression(
|
|
84996
85050
|
type.symbol,
|
|
@@ -85109,7 +85163,6 @@ function createTypeChecker(host) {
|
|
|
85109
85163
|
return node && getExternalModuleFileFromDeclaration(node);
|
|
85110
85164
|
},
|
|
85111
85165
|
isLiteralConstDeclaration,
|
|
85112
|
-
isNonNarrowedBindableName,
|
|
85113
85166
|
isLateBound: (nodeIn) => {
|
|
85114
85167
|
const node = getParseTreeNode(nodeIn, isDeclaration);
|
|
85115
85168
|
const symbol = node && getSymbolOfDeclaration(node);
|
|
@@ -92259,10 +92312,9 @@ function transformClassFields(context) {
|
|
|
92259
92312
|
}
|
|
92260
92313
|
}
|
|
92261
92314
|
}
|
|
92262
|
-
function
|
|
92315
|
+
function tryGetClassThis() {
|
|
92263
92316
|
const lex = getClassLexicalEnvironment();
|
|
92264
|
-
|
|
92265
|
-
return Debug.checkDefined(classThis);
|
|
92317
|
+
return lex.classThis ?? lex.classConstructor ?? (currentClassContainer == null ? void 0 : currentClassContainer.name);
|
|
92266
92318
|
}
|
|
92267
92319
|
function transformAutoAccessor(node) {
|
|
92268
92320
|
const commentRange = getCommentRange(node);
|
|
@@ -92290,7 +92342,7 @@ function transformClassFields(context) {
|
|
|
92290
92342
|
setOriginalNode(backingField, node);
|
|
92291
92343
|
setEmitFlags(backingField, 3072 /* NoComments */);
|
|
92292
92344
|
setSourceMapRange(backingField, sourceMapRange);
|
|
92293
|
-
const receiver = isStatic(node) ?
|
|
92345
|
+
const receiver = isStatic(node) ? tryGetClassThis() ?? factory2.createThis() : factory2.createThis();
|
|
92294
92346
|
const getter = createAccessorPropertyGetRedirector(factory2, node, modifiers, getterName, receiver);
|
|
92295
92347
|
setOriginalNode(getter, node);
|
|
92296
92348
|
setCommentRange(getter, commentRange);
|
|
@@ -92856,7 +92908,7 @@ function transformClassFields(context) {
|
|
|
92856
92908
|
var _a;
|
|
92857
92909
|
let facts = 0 /* None */;
|
|
92858
92910
|
const original = getOriginalNode(node);
|
|
92859
|
-
if (
|
|
92911
|
+
if (isClassLike(original) && classOrConstructorParameterIsDecorated(legacyDecorators, original)) {
|
|
92860
92912
|
facts |= 1 /* ClassWasDecorated */;
|
|
92861
92913
|
}
|
|
92862
92914
|
if (shouldTransformPrivateElementsOrClassStaticBlocks && (classHasClassThisAssignment(node) || classHasExplicitlyAssignedName(node))) {
|
|
@@ -110029,7 +110081,7 @@ function createGetIsolatedDeclarationErrors(resolver) {
|
|
|
110029
110081
|
[260 /* VariableDeclaration */]: Diagnostics.Variable_must_have_an_explicit_type_annotation_with_isolatedDeclarations,
|
|
110030
110082
|
[172 /* PropertyDeclaration */]: Diagnostics.Property_must_have_an_explicit_type_annotation_with_isolatedDeclarations,
|
|
110031
110083
|
[171 /* PropertySignature */]: Diagnostics.Property_must_have_an_explicit_type_annotation_with_isolatedDeclarations,
|
|
110032
|
-
[167 /* ComputedPropertyName */]: Diagnostics.
|
|
110084
|
+
[167 /* ComputedPropertyName */]: Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations,
|
|
110033
110085
|
[305 /* SpreadAssignment */]: Diagnostics.Objects_that_contain_spread_assignments_can_t_be_inferred_with_isolatedDeclarations,
|
|
110034
110086
|
[304 /* ShorthandPropertyAssignment */]: Diagnostics.Objects_that_contain_shorthand_properties_can_t_be_inferred_with_isolatedDeclarations,
|
|
110035
110087
|
[209 /* ArrayLiteralExpression */]: Diagnostics.Only_const_arrays_can_be_inferred_with_isolatedDeclarations,
|
|
@@ -110042,6 +110094,9 @@ function createGetIsolatedDeclarationErrors(resolver) {
|
|
|
110042
110094
|
if (heritageClause) {
|
|
110043
110095
|
return createDiagnosticForNode(node, Diagnostics.Extends_clause_can_t_contain_an_expression_with_isolatedDeclarations);
|
|
110044
110096
|
}
|
|
110097
|
+
if ((isPartOfTypeNode(node) || isTypeQueryNode(node.parent)) && (isEntityName(node) || isEntityNameExpression(node))) {
|
|
110098
|
+
return createEntityInTypeNodeError(node);
|
|
110099
|
+
}
|
|
110045
110100
|
Debug.type(node);
|
|
110046
110101
|
switch (node.kind) {
|
|
110047
110102
|
case 177 /* GetAccessor */:
|
|
@@ -110077,8 +110132,13 @@ function createGetIsolatedDeclarationErrors(resolver) {
|
|
|
110077
110132
|
}
|
|
110078
110133
|
}
|
|
110079
110134
|
function findNearestDeclaration(node) {
|
|
110080
|
-
const result = findAncestor(node, (n) => isExportAssignment(n) ||
|
|
110081
|
-
return
|
|
110135
|
+
const result = findAncestor(node, (n) => isExportAssignment(n) || isStatement(n) || isVariableDeclaration(n) || isPropertyDeclaration(n) || isParameter(n));
|
|
110136
|
+
if (!result) return void 0;
|
|
110137
|
+
if (isExportAssignment(result)) return result;
|
|
110138
|
+
if (isReturnStatement(result)) {
|
|
110139
|
+
return findAncestor(result, (n) => isFunctionLikeDeclaration(n) && !isConstructorDeclaration(n));
|
|
110140
|
+
}
|
|
110141
|
+
return isStatement(result) ? void 0 : result;
|
|
110082
110142
|
}
|
|
110083
110143
|
function createAccessorTypeError(node) {
|
|
110084
110144
|
const { getAccessor, setAccessor } = getAllAccessorDeclarations(node.symbol.declarations, node);
|
|
@@ -110092,11 +110152,10 @@ function createGetIsolatedDeclarationErrors(resolver) {
|
|
|
110092
110152
|
}
|
|
110093
110153
|
return diag2;
|
|
110094
110154
|
}
|
|
110095
|
-
function
|
|
110096
|
-
const diag2 = createDiagnosticForNode(node, errorByDeclarationKind[node.kind]);
|
|
110155
|
+
function addParentDeclarationRelatedInfo(node, diag2) {
|
|
110097
110156
|
const parentDeclaration = findNearestDeclaration(node);
|
|
110098
110157
|
if (parentDeclaration) {
|
|
110099
|
-
const targetStr = isExportAssignment(parentDeclaration) ? "" : getTextOfNode(
|
|
110158
|
+
const targetStr = isExportAssignment(parentDeclaration) || !parentDeclaration.name ? "" : getTextOfNode(
|
|
110100
110159
|
parentDeclaration.name,
|
|
110101
110160
|
/*includeTrivia*/
|
|
110102
110161
|
false
|
|
@@ -110105,30 +110164,19 @@ function createGetIsolatedDeclarationErrors(resolver) {
|
|
|
110105
110164
|
}
|
|
110106
110165
|
return diag2;
|
|
110107
110166
|
}
|
|
110167
|
+
function createObjectLiteralError(node) {
|
|
110168
|
+
const diag2 = createDiagnosticForNode(node, errorByDeclarationKind[node.kind]);
|
|
110169
|
+
addParentDeclarationRelatedInfo(node, diag2);
|
|
110170
|
+
return diag2;
|
|
110171
|
+
}
|
|
110108
110172
|
function createArrayLiteralError(node) {
|
|
110109
110173
|
const diag2 = createDiagnosticForNode(node, errorByDeclarationKind[node.kind]);
|
|
110110
|
-
|
|
110111
|
-
if (parentDeclaration) {
|
|
110112
|
-
const targetStr = isExportAssignment(parentDeclaration) ? "" : getTextOfNode(
|
|
110113
|
-
parentDeclaration.name,
|
|
110114
|
-
/*includeTrivia*/
|
|
110115
|
-
false
|
|
110116
|
-
);
|
|
110117
|
-
addRelatedInfo(diag2, createDiagnosticForNode(parentDeclaration, relatedSuggestionByDeclarationKind[parentDeclaration.kind], targetStr));
|
|
110118
|
-
}
|
|
110174
|
+
addParentDeclarationRelatedInfo(node, diag2);
|
|
110119
110175
|
return diag2;
|
|
110120
110176
|
}
|
|
110121
110177
|
function createReturnTypeError(node) {
|
|
110122
110178
|
const diag2 = createDiagnosticForNode(node, errorByDeclarationKind[node.kind]);
|
|
110123
|
-
|
|
110124
|
-
if (parentDeclaration) {
|
|
110125
|
-
const targetStr = isExportAssignment(parentDeclaration) ? "" : getTextOfNode(
|
|
110126
|
-
parentDeclaration.name,
|
|
110127
|
-
/*includeTrivia*/
|
|
110128
|
-
false
|
|
110129
|
-
);
|
|
110130
|
-
addRelatedInfo(diag2, createDiagnosticForNode(parentDeclaration, relatedSuggestionByDeclarationKind[parentDeclaration.kind], targetStr));
|
|
110131
|
-
}
|
|
110179
|
+
addParentDeclarationRelatedInfo(node, diag2);
|
|
110132
110180
|
addRelatedInfo(diag2, createDiagnosticForNode(node, relatedSuggestionByDeclarationKind[node.kind]));
|
|
110133
110181
|
return diag2;
|
|
110134
110182
|
}
|
|
@@ -110166,11 +110214,20 @@ function createGetIsolatedDeclarationErrors(resolver) {
|
|
|
110166
110214
|
function createClassExpressionError(node) {
|
|
110167
110215
|
return createExpressionError(node, Diagnostics.Inference_from_class_expressions_is_not_supported_with_isolatedDeclarations);
|
|
110168
110216
|
}
|
|
110217
|
+
function createEntityInTypeNodeError(node) {
|
|
110218
|
+
const diag2 = createDiagnosticForNode(node, Diagnostics.Type_containing_private_name_0_can_t_be_used_with_isolatedDeclarations, getTextOfNode(
|
|
110219
|
+
node,
|
|
110220
|
+
/*includeTrivia*/
|
|
110221
|
+
false
|
|
110222
|
+
));
|
|
110223
|
+
addParentDeclarationRelatedInfo(node, diag2);
|
|
110224
|
+
return diag2;
|
|
110225
|
+
}
|
|
110169
110226
|
function createExpressionError(node, diagnosticMessage) {
|
|
110170
110227
|
const parentDeclaration = findNearestDeclaration(node);
|
|
110171
110228
|
let diag2;
|
|
110172
110229
|
if (parentDeclaration) {
|
|
110173
|
-
const targetStr = isExportAssignment(parentDeclaration) ? "" : getTextOfNode(
|
|
110230
|
+
const targetStr = isExportAssignment(parentDeclaration) || !parentDeclaration.name ? "" : getTextOfNode(
|
|
110174
110231
|
parentDeclaration.name,
|
|
110175
110232
|
/*includeTrivia*/
|
|
110176
110233
|
false
|
|
@@ -110895,8 +110952,11 @@ function transformDeclarations(context) {
|
|
|
110895
110952
|
if (shouldStripInternal(input)) return;
|
|
110896
110953
|
if (isDeclaration(input)) {
|
|
110897
110954
|
if (isDeclarationAndNotVisible(input)) return;
|
|
110898
|
-
if (hasDynamicName(input)
|
|
110899
|
-
if (isolatedDeclarations && isClassDeclaration(input.parent)
|
|
110955
|
+
if (hasDynamicName(input)) {
|
|
110956
|
+
if (isolatedDeclarations && (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent))) {
|
|
110957
|
+
context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
|
|
110958
|
+
}
|
|
110959
|
+
if (isolatedDeclarations && (isInterfaceDeclaration(input.parent) || isTypeLiteralNode(input.parent)) && !isEntityNameExpression(input.name.expression)) {
|
|
110900
110960
|
context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
|
|
110901
110961
|
}
|
|
110902
110962
|
if (!isEntityNameExpression(input.name.expression)) {
|
|
@@ -112829,7 +112889,6 @@ var notImplementedResolver = {
|
|
|
112829
112889
|
isArgumentsLocalBinding: notImplemented,
|
|
112830
112890
|
getExternalModuleFileFromDeclaration: notImplemented,
|
|
112831
112891
|
isLiteralConstDeclaration: notImplemented,
|
|
112832
|
-
isNonNarrowedBindableName: notImplemented,
|
|
112833
112892
|
getJsxFactoryEntity: notImplemented,
|
|
112834
112893
|
getJsxFragmentFactoryEntity: notImplemented,
|
|
112835
112894
|
isBindingCapturedByNode: notImplemented,
|
|
@@ -129110,7 +129169,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
|
129110
129169
|
expression,
|
|
129111
129170
|
/*includeBigInt*/
|
|
129112
129171
|
false
|
|
129113
|
-
)
|
|
129172
|
+
)) {
|
|
129114
129173
|
context.tracker.reportInferenceFallback(prop.name);
|
|
129115
129174
|
result = false;
|
|
129116
129175
|
}
|
|
@@ -129124,21 +129183,6 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
|
129124
129183
|
for (const prop of objectLiteral.properties) {
|
|
129125
129184
|
Debug.assert(!isShorthandPropertyAssignment(prop) && !isSpreadAssignment(prop));
|
|
129126
129185
|
const name = prop.name;
|
|
129127
|
-
if (prop.name.kind === 167 /* ComputedPropertyName */) {
|
|
129128
|
-
if (!resolver.isNonNarrowedBindableName(prop.name)) {
|
|
129129
|
-
context.tracker.reportInferenceFallback(prop.name);
|
|
129130
|
-
} else if (isEntityNameExpression(prop.name.expression)) {
|
|
129131
|
-
const visibilityResult = resolver.isEntityNameVisible(
|
|
129132
|
-
prop.name.expression,
|
|
129133
|
-
context.enclosingDeclaration,
|
|
129134
|
-
/*shouldComputeAliasToMakeVisible*/
|
|
129135
|
-
false
|
|
129136
|
-
);
|
|
129137
|
-
if (visibilityResult.accessibility !== 0 /* Accessible */) {
|
|
129138
|
-
context.tracker.reportInferenceFallback(prop.name);
|
|
129139
|
-
}
|
|
129140
|
-
}
|
|
129141
|
-
}
|
|
129142
129186
|
switch (prop.kind) {
|
|
129143
129187
|
case 174 /* MethodDeclaration */:
|
|
129144
129188
|
canInferObjectLiteral = !!typeFromObjectLiteralMethod(prop, name, context) && canInferObjectLiteral;
|
|
@@ -129219,6 +129263,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
|
129219
129263
|
function typeFromSingleReturnExpression(declaration, context) {
|
|
129220
129264
|
let candidateExpr;
|
|
129221
129265
|
if (declaration && !nodeIsMissing(declaration.body)) {
|
|
129266
|
+
if (getFunctionFlags(declaration) & 3 /* AsyncGenerator */) return void 0;
|
|
129222
129267
|
const body = declaration.body;
|
|
129223
129268
|
if (body && isBlock(body)) {
|
|
129224
129269
|
forEachReturnStatement(body, (s) => {
|