phil294 / coffeesense

IntelliSense for CoffeeScript. LSP implementation / VSCode extension
MIT License
47 stars 8 forks source link

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

Closed phonowell closed 1 year ago

phonowell commented 1 year ago

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?

phil294 commented 1 year ago

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.

phonowell commented 1 year ago

Thank you so much, I will try it later!