vercel / ai

Build AI-powered applications with React, Svelte, Vue, and Solid
https://sdk.vercel.ai/docs
Other
10.21k stars 1.54k forks source link

feat (packages/codemod): Don't generate duplicate token usage imports. #3818

Closed shaper closed 4 days ago

shaper commented 4 days ago

This change fixes flawed logic that allowed rewriting two different symbols in an import statement to the same thing producing a broken import due to duplicate symbols.

The output fixture for the test was itself invalid TS as above. Our test util just compares the fixture strings and doesn't try actually parsing them to ensure validity (something worth fixing separately). I found the issue while running our codemod upgrade process on our fixtures themselves, which runs jscodeshift -> babel parsing.