Rename type parameters when they are shadowed. (#61342)

This commit is contained in:
Titian Cernicova-Dragomir
2025-03-04 19:34:32 +00:00
committed by GitHub
parent 47442d958c
commit c85e626d8e
5 changed files with 132 additions and 5 deletions

View File

@@ -1122,15 +1122,16 @@ export function createSyntacticTypeNodeBuilder(
);
}
function reuseTypeParameters(typeParameters: NodeArray<TypeParameterDeclaration> | undefined, context: SyntacticTypeNodeBuilderContext) {
return typeParameters?.map(tp =>
factory.updateTypeParameterDeclaration(
return typeParameters?.map(tp => {
const { node: tpName } = resolver.trackExistingEntityName(context, tp.name);
return factory.updateTypeParameterDeclaration(
tp,
tp.modifiers?.map(m => reuseNode(context, m)),
reuseNode(context, tp.name),
tpName,
serializeExistingTypeNodeWithFallback(tp.constraint, context),
serializeExistingTypeNodeWithFallback(tp.default, context),
)
);
);
});
}
function typeFromObjectLiteralMethod(method: MethodDeclaration, name: PropertyName, context: SyntacticTypeNodeBuilderContext, isConstContext: boolean) {