leonardowf / baroneza

baroneza is a release train to automate boring tasks
10 stars 0 forks source link

app.listen cannot be compiled under use strict #71

Closed leonardowf closed 3 years ago

leonardowf commented 3 years ago
TSError: ⨯ Unable to compile TypeScript:
src/app.ts:48:18 - error TS2769: No overload matches this call.
  The last overload gave the following error.
    Argument of type '(err: any) => void' is not assignable to parameter of type '() => void'.

48 app.listen(port, (err) => {
                    ~~~~~~~~~~

  node_modules/@types/express-serve-static-core/index.d.ts:1126:5
    1126     listen(handle: any, listeningListener?: () => void): http.Server;
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The last overload is declared here.
src/app.ts:48:19 - error TS7006: Parameter 'err' implicitly has an 'any' type.

48 app.listen(port, (err) => {
                     ~~~

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! baroneza@1.0.0 start: `node --inspect=5858 -r ts-node/register ./src/app.ts`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the baroneza@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/sanuk/.npm/_logs/2021-02-06T18_21_12_847Z-debug.log
[nodemon] app crashed - waiting for file changes before starting..

For some reason on my machine I can compile use-strict, but on others, it does not work 👎 Server works fine removing use-strict