In typescript, how to create promise, register handlers in this example?

I have code downstream that depends on the server listening to the port and have this code which does not compile

  const promise = new Promise<string>(); //this does not compile
  const port = 5432;
  server.listen(8000, "localhost", () => {
    logger.info(`Proxy server listening on localhost:${port}`)
    promise.resolve("success"); //this does not compile
  });

  return promise

Of course downstream via aysnc and await methods, it will wait until that promise is resolved before continuing. My other hack method is putting a sleep there instead. How to achieve this correctly? The above example is taken from scala (and java works the same with CompletableFuture) so I am confused on the typescript/javascript versions

I tried the above.