pinojs / pino-http

🌲 high-speed HTTP logger for Node.js
MIT License
527 stars 117 forks source link

Type 'Opts' does not satisfy the constraint 'string'.ts(2344) #313

Closed chiragjoshi28 closed 9 months ago

chiragjoshi28 commented 9 months ago

Throwing error for opts type mismatch

export interface HttpLogger<IM = IncomingMessage, SR = ServerResponse, Opts = Options<IM, SR>> { (req: IM, res: SR, next?: () => void): void; logger: pino.Logger; }

Type 'Opts' does not satisfy the constraint 'string'.ts(2344) index.d.ts(19, 72): This type parameter might need an extends string constraint.

AvivVegh commented 9 months ago

reproducing on my end as well

ZakariasLaws commented 9 months ago

Same problem for me

RafaelFeiten commented 9 months ago

Same problem here. If you doesn't have an old package-lock.json (with correct dependencies), you'll get this error. help?

tordsta commented 9 months ago

Same problem here

RafaelFeiten commented 9 months ago

A temporary solution: Install version 8.4 npm i pino-http@8.4.0

Then go to your package-lock.json, and find for "node_modules/pino-http", you'll see the version 8.5.1, then replace for:

    "node_modules/pino-http": {
      "version": "8.4.0",
      "resolved": "https://registry.npmjs.org/pino-http/-/pino-http-8.4.0.tgz",
      "integrity": "sha512-9I1eRLxsujQJwLQTrHBU0wDlwnry2HzV2TlDwAsmZ9nT3Y2NQBLrz+DYp73L4i11vl/eudnFT8Eg0Kp62tMwEw==",
      "dependencies": {
        "get-caller-file": "^2.0.5",
        "pino": "^8.0.0",
        "pino-std-serializers": "^6.0.0",
        "process-warning": "^2.0.0"
      }
    },

And run npm i again.