color-js/color.js

[types] Generate declarations from JS

Closed this issue · 2 comments

Created a separate issue to move discussion away from #555.

Adding the following options to the root tsconfig.json allows declaration files to be generated from JS:

"declaration": true,
"emitDeclarationOnly": true

The only concern I have is that it clogs up the repository with many .d.ts files, which shouldn't be committed. This can be partially solved with .gitignore (and then adding exceptions for the .d.ts files that are meant to be there), but it's still kind of annoying as a developer.

I tried changing the outDir option to put the declaration files into their own directory (like they used to be before the JSDoc migration), but it doesn't seem to copy over the .d.ts source files (like index.d.ts).

What if we copied the non-generated .d.ts files to the outDir?

That'd work...not sure why that wasn't an immediate thought of mine 😅

I'll start working on a PR to generate declarations. I think it'd be best to .gitignore all the definitions files and have a script to generate + copy files on release.