-
Notifications
You must be signed in to change notification settings - Fork 253
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
onExit callback should be typed to number #162
Comments
Actually maybe it won't fix the issue since the callback signature isn't carried though emit but it would give the right hint to a dev looking at the code... |
I changed the code but you're right it will only give a hint when looking at the library code. What you want is possible by explicitly typing out the emit functions, but it will need the handwritten typing file to be done first #154 |
@Tyriar thx, nice I didn't know this was possible, looking forward to it :) |
It will end up looking something like this: https://github.com/xtermjs/xterm.js/blob/4f144dc6eb8bdb56dd4d705ca356694248ac2acc/typings/xterm.d.ts#L227 |
Right, nice :) |
This is done: node-pty/typings/node-pty.d.ts Line 147 in d9fdf5b
|
Thank you! |
https://github.com/Tyriar/node-pty/blob/e9c790871b55c8fe9920409f59fb12360adda999/src/unixTerminal.ts#L73
This line cast away the types returned by:
https://github.com/Tyriar/node-pty/blob/e9c790871b55c8fe9920409f59fb12360adda999/src/unix/pty.cc#L482
Thus if one tries:
The test will fail, note that one may get the impression that signal is a string since it is in nodejs API see: https://nodejs.org/dist/latest-v8.x/docs/api/child_process.html#child_process_event_exit
Typing the callback would avoid that issue I think.
The text was updated successfully, but these errors were encountered: