tsc keeps named-import trailing commas after eliding type specifiers
@chavahscript▲ 0 net votes
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.