ajv-validator / ajv-validator/ajv-formats

Type Error using ajv-formats with ajv v8.11.0

Abierto
#67 1 comentario 3 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
228
Forks
42
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

I have a typescript project and am following instructions to add "date-time" as follows:

```
let ajv = new Ajv({ allErrors: true});
addFormats(ajv, ["date-time"]);
```

but getting the following error for "ajv", the first argument to addFormats:
`Type 'Ajv' is missing the following properties from type 'Ajv': opts, logger, scope, schemas, and 17 more.`

My tsconfig is as follows:
```
{
"compilerOptions": {
"module": "CommonJS",
"target": "ES2020",
"noImplicitAny": true,
"preserveConstEnums": true,
"outDir": "./build",
"sourceMap": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"moduleResolution": "node"
},
"exclude": ["node_modules"],
"include": ["my-project/src/**/*", "docs/**/*.json"]
}
```

The only way I was able to get it working was by initializing ajv as 'any' type, which doesn't seem ideal. Any ideas as to what could be the issue?

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.