You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Shouldn't gracefulExit reflect the return type of process.exit? (defined here).
With this change, it will correctly tell TypeScript that everything called after gracefulExit won't be executed and don't add the void type where it shouldn't be.
Unlike process.exit(), it does not exit synchronously.
What is the expectation here? Do we expect people to execute code after gracefulExit is called?
I think this is less about expectation and more about what’s effectively happening. Whether you want the code after to be executed or not, it will be. So you NEED to account for that. Making it look like it won’t be executed is a problem in and out of itself.
That’s why I suggested #35 instead. It would allow you to await gracefulExit(code) and it would effectively stop execution there (at least in this branch, it would not prevent other events to fire and the associated code to be executed) since the promise would never resolve.
Hello 👋,
Shouldn't
gracefulExit
reflect the return type ofprocess.exit
? (defined here).With this change, it will correctly tell TypeScript that everything called after
gracefulExit
won't be executed and don't add thevoid
type where it shouldn't be.Here is a playground showing the issue: https://tsplay.dev/wgo5bw
The same playground using
never
: https://tsplay.dev/WY5jEWAs a workaround, I'm using module augmentation to redefine
gracefulExit
definition:The text was updated successfully, but these errors were encountered: