leaningtech/cheerp-meta

Suggestion: emit TypeScript type declarations

Closed this issue · 1 comments

Fairly large feature I expect but it'd be awesome if you could pass a flag to clang++ to generate TypeScript declarations for the module.

e.g.

clang++ -target cheerp-wasm file.c -o file.js -cheerp-make-types=file.d.ts

To emit a file.d.ts looking something like:

export type InstanciateOptions = {
    buffer: /* some typed array */,
} | {
    absPath: string | URL,
}

export default function instanciate(options: InstanciateOptions?): Promise<{}>

(And for [jsexport]'d things, export types for those funcs)