Currently converting my project to use Typescript. My previously working code to launch Express in Node looks like this:
server.listen(port, (error) => {
if
I ran into this today, too. Here's the (breaking) change to the type definition:
https://github.com/DefinitelyTyped/DefinitelyTyped/pull/47063
That PR's author suggests that the proper way to handle listen errors is by registering a listener (as linked by Jonas above):
https://nodejs.org/api/net.html#net_server_listen
It sounds like the type definitions were a lie, and that parameter didn't really exist, so removing its use from your app should be a no-op. That's what I'm doing. (furthermore, I'm okay with errors like EADDRINUSE crashing my app, so I'm not adding any new error handling)