3 ms·
Yes exactly - when tsc you really want code hints for an object, but tsc can't guess its type, you can do: /** @type {import('../index').Engine} */ thi
by fenomas 5y ago
Yes exactly - when tsc you really want code hints for an object, but tsc can't guess its type, you can do:
/** @type {import('../index').Engine} */
this.engine = engine
Most of my projects have a god object at the center, so if I explicitly type that one object then I get basically all the important code hints for free.
A side benefit of this is that you can also use TypeDoc to generate docs. It's not really made for vanilla JS, but once I got over the initial road bumps I've been happy with the results.