class A { m<T>(x: T): T { return x; } }
prints m(x: T): T - the <T> is gone. Same for object concise methods:
const o = { m<T>(x: T): T { return x; } };
prints m(x: T): T.
Root: the class-method printer reads node.typeParameters under an explicit
// @ts-expect-error 'typeParameters' lives on the method node, not its value - but TSESTree (the declared tree type) hangs them on the value FunctionExpression, so on conformant trees they are always dropped; the suppressed type error is the marker. The object-literal concise-method branch of Property consults neither node (it writes key( directly).
Adjacent shapes already fixed upstream: #114 (arrow type parameters), #92 (superTypeParameters).
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
m(x: T): T- the<T>is gone. Same for object concise methods:prints
m(x: T): T.Root: the class-method printer reads
node.typeParametersunder an explicit// @ts-expect-error 'typeParameters' lives on the method node, not its value- but TSESTree (the declared tree type) hangs them on the valueFunctionExpression, so on conformant trees they are always dropped; the suppressed type error is the marker. The object-literal concise-method branch ofPropertyconsults neither node (it writeskey(directly).Adjacent shapes already fixed upstream: #114 (arrow type parameters), #92 (
superTypeParameters).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.