-
Notifications
You must be signed in to change notification settings - Fork 68
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
Introduce 'fs.watch' and 'fs.Watcher' #736
Conversation
* @ignore | ||
* @type {string} | ||
*/ | ||
id = null |
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.
Random TS question:
If you don't set this to null in the instance value field, and you guarantee set them in the constructor, typescript will let you type it as never null and just the value its typed as. Or maybe this is a strict null check option, I'm not sure. Typescript is a million variants of itself depending on how you configure it.
What about not setting this to null initially, or if there is a reason, why do we set this to null here?
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.
just by habit
@chicoxyzzy what do you think we should set it to here?
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.
Not setting null here (unless I'm mistaken), and also setting in the constructor narrows the fields slightly to be a single type instead of also possibly null.
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.
Nice
This PR introduces the
fs.watch()
andfs.Watcher
APIs. It is implemented to give as much parity as possible with node's implementation.Examples
EventEmitter
:AsyncIterator
(withfilename
encoding):AbortSignal
Closes #595