ajv-validator / ajv-validator/ajv

Syntax for Ajv import?

Aperta
#2,047 10 commenti 3 reazioni 0 assegnatari Vedi su GitHub
typescript
Lingua principale
TypeScript
Stelle
14.8k
Fork
1k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Version 8.11.0, installed today

**Ajv options object**
None.

**Your code**

```typescript
// ProjectJSON.mts

// this works, https://github.com/microsoft/TypeScript/issues/24847}
import { default as Ajv } from "ajv";

// this doesn't work, but is the currently recommended import line
//import Ajv from "ajv";
/*
_02_passthrough_types/source/ProjectJSON.mts(98,17): error TS2351: This expression is not constructable.
Type 'typeof import("/home/ajvincent/code-generation/cross-stitch/node_modules/ajv/dist/ajv")' has no construct signatures.
*/
const ajv = new Ajv();
void(ajv);
```

I was bitten on this exact error with https://github.com/dsherret/code-block-writer/issues/42 a few weeks ago.

**Are you going to resolve the issue?**

I can, by adding a little bit of documentation. I just need to know where people want it, if they don't want to quickly fix this themselves.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.