Skip to content
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

feat: add typescript definition #295

Merged
merged 1 commit into from
Nov 9, 2019
Merged

feat: add typescript definition #295

merged 1 commit into from
Nov 9, 2019

Conversation

SimenB
Copy link
Contributor

@SimenB SimenB commented Nov 9, 2019

The v2 API is so simplified I think it shouldn't be a huge maintenance burden to keep the definition in this repo.

Types are based on the types in the README, plus the missing cloned event from #286. Constants were copied from the header file.

I'm unsure about the return type from watch. I based it on

fsevents/fsevents.js

Lines 26 to 30 in e468f15

return () => {
const result = instance ? Promise.resolve(instance).then(Native.stop) : null;
instance = null;
return result;
};
, but I don't know what the promise resolves to? Also, should it always return a Promise regardless of instance === null or not? Happy to tweak that part of the code.

EDIT: I've opened up a separate PR with the change to always return a Promise, and you can choose to accept that or not. I can tweak the type in this PR based on that conclusion: #296

@paulmillr paulmillr merged commit 4ef1026 into fsevents:master Nov 9, 2019
@paulmillr
Copy link
Member

Thank you

@SimenB SimenB deleted the ts branch November 9, 2019 20:58
@SimenB
Copy link
Contributor Author

SimenB commented Nov 9, 2019

Thanks @paulmillr!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants