Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid incorrectly reusing assertion nodes from property assignments #60576

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Andarist
Copy link
Contributor

@Andarist Andarist commented Nov 24, 2024

fixes #60573 (a regression from #59282 )

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Nov 24, 2024
@typescript-bot
Copy link
Collaborator

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

@@ -711,7 +712,10 @@ export function createSyntacticTypeNodeBuilder(
undefined;

if (type && !isConstTypeReference(type)) {
result = serializeExistingTypeNode(type, context);
const assertionNode = serializeExistingTypeNode(type, context);
if (resolver.canReuseTypeNodeAnnotation(context, node, getOriginalNode(assertionNode, isTypeNode), symbol)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was somewhat surprised that reusing an existing type node produces its copy with .original set on it. But also tbf I don't know when those copies are created in the first place so perhaps that's fine and expected. cc @dragomirtitian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
Status: Not started
Development

Successfully merging this pull request may close these issues.

Type assertion regression in TypeScript 5.7
2 participants