Open yleflour opened 2 months ago
That shouldn't affect things because this repo parses JS only, not the TypeScript sources. Are you able to toss your example setup in a repo so I can see your compiler settings and such?
Just got a minimal sample repo set up here: https://github.com/yleflour/nodejs-testing-demo I'll check out the built JS. if I have time
FYI Adding an "outDir": "./dist"
and setting "emitDeclarationOnly": false
in "tsconfig.json" fixes the issue as the test runner uses the .js files from the "./dist" folder
Only seem to break with on the fly transpilation
This is because we try to still parse the source naively with acorn
in the transpilation case. With acorn-loose
it's often good enough but it seems like we get tripped up by this case.
While TS is technically not the only language that could transpile and get turned into JS, it's by far the most common one, so let's just ship a transpiler to deal with it properly.
I encountered a weird bug:
Produces the following tree:
The issue comes from
${{ type: "extra" } as const}
and the following rewrites work:${{ type: "extra" as const }}
const inlineObj = { type: "extra" } as const
and${inlineObj}