-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add typescript definition #19
base: master
Are you sure you want to change the base?
Conversation
Ya adding typings can be a great help. |
*/ | ||
declare function fuzzysearch(needle: string, haystack: string): boolean; | ||
|
||
export = fuzzysearch; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried it, but now I'm getting this error
[ts] Cannot invoke an expression whose type lacks a call signature. Type 'typeof 'fuzzysearch'' has no compatible call signatures.
export = fuzzysearch
works as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jskrnbindra @dderevjanik Without the empty namespace but with the default export it should work.
The default export would match the libraries real export, I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As weird as it looks, these typings are correct as-is. (It matches the underlying implementation of module.exports = fuzzysearch;
)
Writing the types as a default export would work in some cases but not others, depending on which module loader a given project is using. Would love to see this get merged! 🙏
@bevacqua Please, is there something I can do better or different to make this PR merged ? Thanks |
What happened to this issue? |
still waiting for response |
hello? @bevacqua |
FWIW I created |
Sorry folks. I don't remember reviewing this PR. Nor do I have write permissions on this repo. |
Hi,
I would like to contribute with typescript definition file (
index.d.ts
) to project.There's no typings in DefinetelyTyped and TS project has to create their own
d.ts
everytime. So, instead of creating PR to DefinitelyTyped, it makes more sense to create PR directly to this Repo, because repo wasn't updated for a while and it is not going (probably) to change API.Several IDEs would also benefits from this and they will be able to provide intellisense for user. This is not only exclusive for Typescript devs but it could be used for JS aswell.