Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
chiragjoshi28 opened this issue Dec 14, 2023 · 5 comments · Fixed by #314
Closed

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

chiragjoshi28 opened this issue Dec 14, 2023 · 5 comments · Fixed by #314

Comments

@chiragjoshi28
Copy link

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

This comment was marked as duplicate.

@ZakariasLaws

This comment was marked as duplicate.

@RafaelFeiten

This comment was marked as duplicate.

@tordsta

This comment was marked as duplicate.

@RafaelFeiten
Copy link

A temporary solution:
Install version 8.4 npm i [email protected]

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.

naseemkullah added a commit to naseemkullah/pino-http that referenced this issue Dec 15, 2023
the type variable of the logger should be the custom levels type
since a recent change in pino types (pinojs#304)

fixes pinojs#313
naseemkullah added a commit to naseemkullah/pino-http that referenced this issue Dec 15, 2023
the type variable of the logger should be the custom levels type
since a recent change in pino types (pinojs/pino#1858)

fixes pinojs#313
mcollina pushed a commit that referenced this issue Dec 15, 2023
the type variable of the logger should be the custom levels type
since a recent change in pino types (pinojs/pino#1858)

fixes #313
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants