Skip to content
This repository was archived by the owner on Mar 7, 2022. It is now read-only.

Build failed in strict mode #77

Open
kostyazgara opened this issue Feb 26, 2021 · 0 comments
Open

Build failed in strict mode #77

kostyazgara opened this issue Feb 26, 2021 · 0 comments

Comments

@kostyazgara
Copy link
Contributor

I'm submitting a...


[ ] Regression 
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

When creating PinoLogger instance and pass them to the FastifyAdapter in strict mode it throws the error

error TS2322: Type 'PinoLogger' is not assignable to type 'boolean | FastifyLoggerInstance | FastifyLoggerOptions<any, IncomingMessage | Http2ServerRequest, ServerResponse | Http2ServerResponse> | undefined'.
  Type 'PinoLogger' is not assignable to type 'FastifyLoggerInstance'.
    Types of property 'warn' are incompatible.
      Type '(msgOrObject: unknown, context?: string | undefined) => void' is not assignable to type 'FastifyLogFn'.
        Types of parameters 'context' and 'args' are incompatible.
          Type 'unknown' is not assignable to type 'string | undefined'.
            Type 'unknown' is not assignable to type 'string'.

72       logger: pinoLogger,

Expected behavior

Do not fail when I'm trying to pass pino logger to fastify adapter

Minimal reproduction of the problem with instructions

const logger = new Logger();
const pinoLogger = new PinoLogger();
logger.injectLogger(pinoLogger);
logger.setContext(coreContext);
const app = await NestFactory.create<NestFastifyApplication>(
  AppModule,
  new FastifyAdapter({
    logger: pinoLogger,
    genReqId: () => v4(),
  }),
  {
    logger,
  },
);

What is the motivation / use case for changing the behavior?

Environment


Nest version: 7.6.11

 
For Tooling issues:
- Node version: 14.15.0
- Platform:  Mac

Others:

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant