import type {} from "x"; // ImportDeclaration { importKind: 'type', specifiers: [] }
prints
A type-only import erases at build time; the printed spelling is a live side-effect import - the module now executes at runtime. importKind needs to survive even with zero specifiers.
Context: found by a parse -> print -> reparse structural gate over a ~8.5k-file TS/JS corpus while adopting esrap in core-js's build plugin, then re-verified in isolation. esrap 2.3.5; the ASTs below come from @typescript-eslint/typescript-estree 8.67 with loc/range enabled, so the repros are independent of our own (oxc-based) pipeline.
prints
A type-only import erases at build time; the printed spelling is a live side-effect import - the module now executes at runtime.
importKindneeds to survive even with zero specifiers.Context: found by a parse -> print -> reparse structural gate over a ~8.5k-file TS/JS corpus while adopting esrap in core-js's build plugin, then re-verified in isolation. esrap 2.3.5; the ASTs below come from
@typescript-eslint/typescript-estree8.67 withloc/rangeenabled, so the repros are independent of our own (oxc-based) pipeline.