Repository navigation
Commit 9435062
committed
fix(codemod): preserve side-effect imports of React modules in .d.ts files
Side-effect imports like `import 'react'` that exist solely to make
`declare module 'react' { ... }` an augmentation (not an ambient
definition) were being pushed to importSlots and then silently dropped
by finishImports, which skips imports with no importClause.
Rewrite such imports in place instead of deferring them, so the
specifier is mapped (e.g. `import 'octane'`) and the file stays a
module. This preserves TypeScript's augmentation semantics.1 parent 77138ec commit 9435062
2 files changed
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1117 | 1117 | | |
1118 | 1118 | | |
1119 | 1119 | | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
1120 | 1124 | | |
1121 | 1125 | | |
1122 | 1126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| 186 | + | |
186 | 187 | | |
187 | 188 | | |
188 | 189 | | |
| |||
0 commit comments