Add --generate-types option#589
Conversation
|
+1 on enabling it as default |
Absolutely (even folks not aware about typescript will ship at least some amount of definitions - happy consumers)
It would not: setting |
src/index.js
Outdated
| : () => resolve(options.cwd, 'mangle.json'); | ||
|
|
||
| const useTypescript = extname(entry) === '.ts' || extname(entry) === '.tsx'; | ||
| const emitDeclaration = !!options.generateTypes; |
There was a problem hiding this comment.
maybe just checking if pkg.types || pkg.typings is present in package.json would be enough to trigger this?
There was a problem hiding this comment.
Love that idea! Made #631 that does enable declarations only when pkg.types || pkg.typings is present 🎉
There was a problem hiding this comment.
@marvinhagemeister I copied your change into this PR 👍
|
This requires TS 3.7: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#--declaration-and---allowjs
One thing I wasn't sure of: maybe this could just be enabled by default? Currently I think it's possible via
tsconfig.json, but doing so would potentially run TypeScript on all of node_modules.TODO: