webxdc / hello

Sample project with a simple implementation of the webxdc read and write APIs
The Unlicense
29 stars 7 forks source link

add typescript definitions #14

Closed Simon-Laux closed 2 years ago

Simon-Laux commented 2 years ago

why?

If this should be recommended as template repo it makes sense to have it included. It only takes two lines to add type-checking and auto-completion to your script files when using vscode.

//@ts-check
/** @typedef {import('./webxdc').WEBxDC} WEBxDC */

Sure vscode and its forks are the only editors I know this works in, so might not be usefull for everyone. But they can still type-check their js using jsdoc comments and the typescript compiler: tsc --noEmit --allowJs your_js_file.js.

What about the simulator and types getting out of sync?

I added a github action to test prs and commits against that.