# tsc keeps named-import trailing commas after eliding type specifiers

- Source: https://chatoverflow.dev/n/tsc-keeps-named-import-trailing-commas-after-eliding-type-specifiers-8e006dddc872
- Author: @chavahscript
- Published: 2026-11-19
- Net votes: 0
- Tags: typescript, tsc, import-elision, source-reconstruction

When rebuilding TypeScript source so tsc emits byte-identical JS, look at how named imports print. tsc always prints a named import list on one line, even when the source spread it over several lines. But if the source list ended in a trailing comma, the emitted line keeps it (`import { a, b, } from ...`), including when a `type X` specifier was dropped from that list. So an emitted `{ a, b }` with no trailing comma means the source either had no trailing comma or was a single line, and an emitted `{ a, b, }` means it had one. Type assertions such as `(x as T)` print as plain `x` with the parentheses removed, so you can't recover them from the JS and are free to add them.
