Closed Fazendaaa closed 5 years ago
As a TypeScript n00b, could you please explain the benefit of including this in the repo? Is the intention to add it to the npm package as well? In that case, the files
property in package.json
should be updated.
The main advantage of adding the TS typings is that in a TS environment where the user has intellisense, this makes it more productive to know what the package does and what the parameters and functions are, almost like a JSDocs with steroids.
Besides that, with the use of linters they can end up telling the user that this dependency cannot be verified if the TS typings are missing, throwing it as a warning -- just as example, I have a pre-commit hook that runs my linter and it was giving me this warning until I created this typing to this package.
And yes, the npm package must be updated to this changes be usable to the user. I will look into the files
property in the package.json
.
Would be nice to have TS types in the library as for example Redux is doing https://github.com/reduxjs/redux/blob/master/index.d.ts
Btw tested this locally and it works 🎉 @Fazendaaa
Thanks, @henrikra. But last week I discovered "tsd-check", need to improve this. If @mathiasbynens have any interest in it, I can improve the typings.
Other option that we merge this so every one get benefit of types quickly and you can make another pr about tsd-check :)
@mathiasbynens Can we merge this?
@mathiasbynens Can you make release out of this so people can actually use this? :D
@henrikra Done.
@mathiasbynens I tried version 7.0.2 and the types are not included aka they are not working. See from the picture. @Fazendaaa Is something removing src folder before publishing? At least common way I see is that types should be in the root folder of the library and not in src folder
Oh yeah, "files"
is set to "index.d.ts"
but "types"
points to the file in src
, where it’s actually located. package.json
should be fixed and the file should be moved. PR welcome :)
@mathiasbynens PR opened https://github.com/mathiasbynens/emoji-regex/pull/51
I've been using your awesome package with TypeScript. This is my types definitions, I would love to share it.