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 error running with ajv@8.11.2 #76

Open
Geloosa opened this issue Nov 22, 2022 · 1 comment
Open

Type error running with ajv@8.11.2 #76

Geloosa opened this issue Nov 22, 2022 · 1 comment

Comments

@Geloosa
Copy link

Geloosa commented Nov 22, 2022

Hey, I'm not sure if this issue belongs here or to ajv package.
I get a ts error Argument of type 'import("node_modules/ajv/dist/ajv").default' is not assignable to parameter of type 'import("node_modules/ajv-formats/node_modules/ajv/dist/core").default'. when passing ajv object to ajv-formats:

import Ajv from "ajv";
import addAjvFormats from "ajv-formats";

const ajv = new Ajv();

addAjvFormats(ajv);

This is because ajv package holds 2 different definitions for Ajv class:
https://github.com/ajv-validator/ajv/blob/master/lib/core.ts#L275
https://github.com/ajv-validator/ajv/blob/master/lib/ajv.ts#L11

The first one is used in ajv default export type definition and the second one - in ajv-formats type definitions. Could you plz fix the typings, or better to address this issue to ajv package as they hold 2 divergent definitions?

@Geloosa Geloosa changed the title Type error running the ajv@8.11.2 Type error running with ajv@8.11.2 Nov 22, 2022
@roodie-ree
Copy link

Just make sure that in your lockfile you don't have multiple versions of ajv & you should be good.

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

No branches or pull requests

2 participants