You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
455 B
TypeScript
33 lines
455 B
TypeScript
import { parse, print } from "../mod.ts";
|
|
|
|
const code = `
|
|
interface H {
|
|
h: string;
|
|
}
|
|
|
|
const x: string = \`Hello, $\{"Hello"} Deno SWC!\`;
|
|
|
|
switch (x) {
|
|
case "value":
|
|
console.log(x);
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
`;
|
|
|
|
const ast = parse(code, {
|
|
target: "es2019",
|
|
syntax: "typescript",
|
|
comments: false,
|
|
});
|
|
const regeneratedCode = print(ast, {
|
|
minify: true,
|
|
module: {
|
|
type: "commonjs",
|
|
},
|
|
}).code;
|
|
|
|
console.log(regeneratedCode);
|