A literal angel (AngelCMHxD), made a PR against one of my repos to add a .d.ts
definition file for both auto-complete, and hover text. This is what happened next...
After testing his PR locally with the TypeScript .d.ts
file, the result was this:
Note that I'm hovering over the windows
key and it is not giving me any valuable information. It provides the same truncated mess of text (that is hard to visually parse), as when you hover over createDesktopShortcuts
.
The repo was already written with JSDocs enforced everywhere via a simple linting plugin (use it, it's very good). In comparison, JSDocs provides identical type support as what TS does, and far better hints.
With JSDocs, we get a cleaner hover:
And on hover of the windows
key, we get much better context, explaining that it requires a filePath
string.
Ultimately, there was no way to get TS to generate a usable hover tooltip. Their official recommendation is to use JSDocs.
Because the TypeScript Engine and Compiler work exactly the same with types defined in JSDocs as they do with types written in the TypeScript syntax, my library does not use any TypeScript at all, but is fully typed and fully TS compatible.
Top comments (0)