Uh oh!
There was an error while loading. Please reload this page.
Avoid incorrectly reusing assertion nodes from property assignments - #60576
Conversation
TypeScript Bot (typescript-bot)
commented
Nov 24, 2024
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
Uh oh!
There was an error while loading. Please reload this page.
…nodes-with-different-types
Jake Bailey (jakebailey)
commented
Dec 4, 2024
If this fixes #60573, we should definitely add a dts test that shows that things are fixed. |
| if (assertionNode && !isConstTypeReference(assertionNode) && resolver.canReuseTypeNodeAnnotation(context, node, assertionNode, symbol)) { | ||
| result = serializeExistingTypeNode(assertionNode, context); |
There was a problem hiding this comment.
I was largely unsure about this given you ask a question about node then use that to work with assertionNode, but this is effectively the same check as:
functiontypeFromPropertyAssignment(node: PropertyAssignment|ShorthandPropertyAssignment,symbol: Symbol,context: SyntacticTypeNodeBuilderContext){consttypeAnnotation=getEffectiveTypeAnnotationNode(node);letresult;if(typeAnnotation&&resolver.canReuseTypeNodeAnnotation(context,node,typeAnnotation,symbol)){result=serializeExistingTypeNode(typeAnnotation,context);}So I definitely like this change more than the initial version.
Jake Bailey (jakebailey)
commented
Dec 4, 2024
TypeScript Bot (@typescript-bot) test it |
TypeScript Bot (typescript-bot)
commented
Dec 4, 2024
Hey Jake Bailey (@jakebailey), the results of running the DT tests are ready. Everything looks the same! |
TypeScript Bot (typescript-bot)
commented
Dec 4, 2024
Jake Bailey (@jakebailey) Here are the results of running the user tests with tsc comparing Everything looks good! |
…nodes-with-different-types
TypeScript Bot (typescript-bot)
commented
Dec 4, 2024
Jake Bailey (@jakebailey) Here they are:tscComparison Report - baseline..pr
System info unknown Hosts
Scenarios
Developer Information: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Jake Bailey (jakebailey)
commented
Dec 4, 2024
TypeScript Bot (@typescript-bot) pack this |
Starting jobs; this comment will be updated as builds start and complete.
|
| //// [declarationAssertionNodeNotReusedWhenTypeNotEquivalent1.d.ts] | ||
| export declare const unwrapped: { | ||
| prop1: "hello"; | ||
| }; |
There was a problem hiding this comment.
Jake Bailey (@jakebailey) here is the requested dts test
Wesley Wigham (weswigham)
left a comment
There was a problem hiding this comment.
Yeah, this looks solid now. It'd probably be relevant to ask what output this limits under isolatedDeclarations, but... 🤷♂️ it kinda is what it is.
TypeScript Bot (typescript-bot)
commented
Dec 4, 2024
Jake Bailey (@jakebailey) Here are the results of running the top 400 repos with tsc comparing Everything looks good! |
Jake Bailey (jakebailey)
commented
Dec 4, 2024
TypeScript Bot (@typescript-bot) pack this |
Hey Jake Bailey (@jakebailey), I've packed this into an installable tgz. You can install it for testing by referencing it in your and then running There is also a playground for this build and an npm module you can use via |
TypeScript Bot (typescript-bot)
commented
Dec 4, 2024
Jake Bailey (@jakebailey) Here are the results of running the user tests with tsc comparing Everything looks good! |
Jake Bailey (jakebailey)
commented
Dec 4, 2024
TypeScript Bot (@typescript-bot) cherry-pick this to release-5.7 |
TypeScript Bot (typescript-bot)
commented
Dec 4, 2024
Hey, Jake Bailey (@jakebailey)! I've created #60679 for you. |
…e-5.7 (#60679) Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
fixes#60573 (a regression from #59282 )