Adds functionality to check the output file type to enable JS codegen. When .js or .mjs, will output JS ESM code, when .cjs, will output CommonJS code.
Both JS format types will output fully typed code using JSDocs.
Additionally, can override the file type with --output-type, which accepts TS, CJS, or ESM and defaults to TS. Will not change the extension used. This was added so you can generate a .js as CommonJS and a way to output CommonJS to stdout.
Why bother
I use JSDocs + the typebox check compiler to get fast runtime checks for external inputs.
Summary
closes #39
Adds functionality to check the output file type to enable JS codegen. When
.js
or.mjs
, will output JS ESM code, when.cjs
, will output CommonJS code.Both JS format types will output fully typed code using JSDocs.
Additionally, can override the file type with --output-type, which accepts TS, CJS, or ESM and defaults to TS. Will not change the extension used. This was added so you can generate a
.js
as CommonJS and a way to output CommonJS to stdout.Why bother
I use JSDocs + the typebox check compiler to get fast runtime checks for external inputs.