react-layout-transition
react-layout-transition copied to clipboard
Expose TS typings
Since the repo is written in TypeScript, having a separately-maintained @types
package seems unnecessary. Would it be possible to export the type declarations as part of the built package?
I'm trying to do this myself, and I've gotten hung up by the fact that it creates 3 different build outputs. I was hoping I could make a PR for it, but I may need @bkazi's help.
The 3 build outputs are to accommodate different module types
The output in dist
folder is UMD primarily for direct imports on the web using script
tags
The output in lib
folder is CommonJS format which uses the require
syntax
and output in es
folder is ESModule format which uses the import
syntax
I believe currently the easiest way to export type declarations would be using the typescript compilers --declarations
flag which creates the .d.ts
files needed. If there's a way to create these files and put them in a typings
folder and publish to npm they should be used by typescript. Hope that helps!
@bkazi that's possible, but then library consumers would have to manually add the types, and the maintainer of the type library would have to publish updates each time the package changes. I think the included approach would produce an easier experience, and should be only a couple lines in tsconfig.json
(see these docs)