kdeloach / react-lineto

Draw a line between two elements in React
MIT License
234 stars 63 forks source link

Adding TypeScript declaration file #37

Closed robertgr991 closed 4 years ago

robertgr991 commented 4 years ago

Hello,

I have added a declaration file for TypeScript. I have tested it on my project where I use your package and it worked as expected. I decided not to include a method to copy the declaration file from 'src' to 'dist' as you may prefer a specific method. I used this webpack plugin filemanager-webpack-plugin to copy the file after the build is done and it worked great. If you think this method is fine, I can add a new commit where I add this plugin to the webpack config.

Another option would be to create a pull request on DefinitelyTyped to make installing types available through npm install @types/react-lineto.

Sorry for the previous pull request, I misclicked it.

kdeloach commented 4 years ago

I don't know what the best practices are for bundling TypeScript declarations. If you could add something to make sure that file gets bundled correctly, I'll merge this and publish a release.

robertgr991 commented 4 years ago

Actually, because the src dir is also shipped with the package, there is no need to move the file from src to dist, it's enough to put in package.json the location to the declaration file like this "types": "src/index.d.ts". You can test it on my fork.

kdeloach commented 4 years ago

This is in release 3.2.0. Thanks.