apache/cordova-node-xcode

Use JSDoc with tsc for strong static typing

Opened this issue · 1 comments

It is possible to use JSDoc comments with the TypeScript compiler to enforce some strong typing, as documented in the following resources:

Here is the best example I have found: prettier/prettier#6313

I would personally favor this alternative over porting to TypeScript as proposed in #64.

I'm also looking to do a technique like this for another node library I contribute to.

I think this is set up to work best with the next major version of TypeScript coming out at the beginning of next month, as they're making changes to support parsing JS+JSDoc via TypeScript-compiler.

Specifically, I think this PR was a blocker: microsoft/TypeScript#32372

If JSDoc is super detailed and robust, then theoretically, the .d.ts declaration file could be directly output from there. -- From my initial work writing the JSDoc types for another library, however, it was way clunkier and harder to do than directly writing TypeScript, and nothing helped guide correctness in the JSDoc types. :(