eclipse-thingweb / eclipse-thingweb/node-wot

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

Open
#1,108 2 comments 1 reaction 0 assignees View on GitHub
examples
Dominant language
TypeScript
Stars
192
Forks
100
Avg merge
3d 2h
Merged PRs (30d)
6

Description

At the moment, the [current workflow](https://github.com/eclipse-thingweb/node-wot/tree/master/packages/examples#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](https://devclass.com/2023/05/11/typescript-is-not-worth-it-for-developing-libraries-says-svelte-author-as-team-switches-to-javascript-and-jsdoc/)).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.