inxilpro / node-app-root-path

Determine the root path to your project
MIT License
605 stars 29 forks source link

Add Typescript support #50

Closed douira closed 2 years ago

douira commented 2 years ago

This PR simply adds a small declaration file that declares the types of the methods exposed by the exported object.

douira commented 2 years ago

I just noticed this might be slightly unnecessary as there are already typed on DefinitelyTyped. idk, you decide if you want to have this.

inxilpro commented 2 years ago

Is it better to have it in the library itself instead of in DefinitelyTyped? I don't use TypeScript so I'm not sure what the best practice is here.

douira commented 2 years ago

You need to install an @type package additionally if it's published by DefinitelyTyped. (you can also publish it to @type/... yourself I think) If it's in the package itself the maintainer may have a better idea of what the types should be (and more control). Right now types can be downloaded on DefinitelyTyped so there's no problem really.

bfaulk96 commented 2 years ago

I'd say in general it's better to have it in the library itself when possible, as you don't need to keep two separate repos (one of them a ridiculous monorepo in DefinitelyTyped/types)