node-wot icon indicating copy to clipboard operation
node-wot copied to clipboard

Simpler `examples` workflow using plain JS files and JSDoc comments

Open JKRhb opened this issue 1 year ago • 2 comments

At the moment, the current workflow for the examples prescribes using TypeScript for the source files whose resulting compiled JS files are then copied over to the top-level examples directory, including a manual removal of some added lines.

To keep both the benefits of TypeScript and the possibility to use plain JavaScript, I think a much simpler and more ergonomic approach would be to directly use JavaScript files and enable type checking via JS Doc comments. By using a // @ts-check comment at the top of the file, we would still get the benefit of type checks without the compilation and copying step. This would also give us more control over the resulting JS-based examples.

This suggestion corresponds partly with the discussion started by the recent shift of the Svelte library from TypeScript to plain JavaScript with JSDoc comments (see, e.g., here).

JKRhb avatar Oct 09 '23 15:10 JKRhb