phil294/coffeesense

[Feature] Add support for `.d.ts`

phonowell opened this issue · 2 comments

This project is really excellent and has greatly enhanced my programming experience.

But I still have one request that could types be added by adding a .d.ts file with the same name?

Glad to hear! :)

This should already be doable, I think (?). After all, you have the whole power of TypeScript by means of JSDoc at your fingertips. Have you tried declareing stuff, the types field in jsconfig.json, or simply importing them with import or

``###* @type {import('./x.d.ts').X} ###
x = {}

or

``###* @typedef {import('./x.d.ts').X} X ###

``###* @type {X} ###
x = {}

or something along those lines, perhaps global imports, or importing an entire namespace etc. so you don't have to repeat yourself

I haven't looked this up, so you'll need to research this a bit for yourself (and maybe share your findings), but in general, JSDoc should allow you to do whatever you want.

Thank you so much, I will try it later!