Closed DanielRuf closed 3 years ago
Looks good to me 👍
@types/html-minifier has 3 dependencies: https://www.npmjs.com/package/@types/html-minifier
Will adding them as devDependencies be enough to work properly?
I think so. They are added in the package.json file in this PR.
@types/uglify-js
is not needed anymore as terser
is used now and for that there is only a stub, see https://unpkg.com/browse/@types/terser@3.12.0/package.json and https://unpkg.com/browse/@types/terser@3.12.0/README.md
According to https://stackoverflow.com/questions/45176661/how-do-i-decide-whether-types-goes-into-dependencies-or-devdependencies we should add types we rexeport to dependencies.
For example:
minifyCSS?: boolean | CleanCSS.Options | ((text: string) => string);
If someone tries to consume this type they will not be able to access CleanCSS.Options
as @types/clean-css
would not be installed.
I have read the same thread yesterday.
Normally I would say devDependencies
because types and TypeScript are not directly used in production and only useful for development.`
If dependents of html-minifier-terser
will use it, it is a public dependency not a dev dependency.
If you don't want to add it to dependencies that is also fine but in that case we should not merge this pullrequest - as dependent builds will fail otherwise.
Maybe we can create @types/html-minifier-terser instead?
Maybe we can create @types/html-minifier-terser instead?
Makes more sense. But I have amended the commit and moved them to dependencies
so there should not be any issues now.
Both ways will work fine for IDE support and build type checks.
So pick the one you prefer :)
I guess I can close this PR as there is now https://www.npmjs.com/package/@types/html-minifier-terser
Closing as this might be obsolete now.
This adds the type definitions file so that TypeScript projects can consume and use them.