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

Cannot set logger: false in call to constructor #2345

Open
jmozmoz opened this issue Nov 14, 2023 · 0 comments
Open

Cannot set logger: false in call to constructor #2345

jmozmoz opened this issue Nov 14, 2023 · 0 comments

Comments

@jmozmoz
Copy link

jmozmoz commented Nov 14, 2023

What version of Ajv are you using? Does the issue happen if you use the latest version?

ajv@8.12.0

Your typescript code

import Ajv from 'ajv';
const options = {strict: false, validateSchema: false, logger: false};
const ajv = new Ajv(options);

Typescript compiler error messages

content/endpoint-manager.ts:3:21 - error TS2345: Argument of type '{ strict: boolean; validateSchema: boolean; logger: boolean; }' is not assignable to parameter of type 'Options'.
  Type '{ strict: boolean; validateSchema: boolean; logger: boolean; }' is not assignable to type 'CurrentOptions'.
    Types of property 'logger' are incompatible.
      Type 'boolean' is not assignable to type 'false | Logger'.

3 const ajv = new Ajv(options);

The following code compiles without error:

import Ajv from 'ajv';
const ajv = new Ajv({strict:false, validateSchema: false, logger: false});

This one also:

import Ajv from 'ajv';
declare const Components: any;
Components.utils.import('resource://gre/modules/Console.jsm');

const options = {strict: false, validateSchema: false, logger: console};
const ajv = new Ajv(options);

Describe the change that should be made to address the issue?
Accept false as setting for logger as described in the documentation:
https://ajv.js.org/options.html#logger

Are you going to resolve the issue?
Sorry, I do not know how.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants
@jmozmoz and others