babel bug

node v14.20.1
version: master
endpointsharetweet
const { types: t, parse, transform } = require("@babel/core"); parse(` type Test = 1 | -1; `, { parserOpts: { plugins: ["typescript"], }, }).program.body[0].typeAnnotation.types[1]
transform(` type Test = 1 | -1; `, { parserOpts: { plugins: ["typescript"], }, plugins: [ ({ types: t }) => ({ visitor: { TSLiteralType(path) { path.node = t.tsLiteralType(path.node.literal) } } }), ], })
Loading…

no comments

    sign in to comment