The TSImportType printer reads node.argument. typescript-eslint 8 renamed the field to source and currently keeps argument only as a deprecated, non-enumerable alias - so printing still works there today, but any tree that ships only the canonical name crashes:
TypeError: Cannot read properties of undefined (reading 'type')
(oxc-parser already emits only source; typescript-eslint will drop the alias eventually.)
One-line future-proofing:
context.visit(node.source ?? node.argument);
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.
The
TSImportTypeprinter readsnode.argument. typescript-eslint 8 renamed the field tosourceand currently keepsargumentonly as a deprecated, non-enumerable alias - so printing still works there today, but any tree that ships only the canonical name crashes:(oxc-parser already emits only
source; typescript-eslint will drop the alias eventually.)One-line future-proofing:
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.