babel-plugin-preval
babel-plugin-preval copied to clipboard
Writing preval files in TypeScript
When using // @preval
at the top of the file, it's first evaluated in Node.js. This means that TypeScript has no idea what's going on. If I leave these files as vanilla JS (.js
) it's okay (the import gets an any
type in TS), but then we don't get the advantages of TypeScript.
Can I write preval files themselves in TypeScript? Maybe with ts-node?
@mpeyper since you converted this repo to TypeScript in #86... do you know if this is possible?
Sorry, I’m not sure.
It might be possible to support processing of preval snippets with ts, but I think having the resulting types pass through to other code trying to use the output would be quite difficult, if not impossible.