Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
babel bug
node v14.20.1
version:
master
endpoint
share
tweet
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