ajv-formats icon indicating copy to clipboard operation
ajv-formats copied to clipboard

Documentation incorrect, unable to se AJV formats

Open paul-uz opened this issue 4 years ago • 1 comments

Using the example code results in errors and simply does not work.

const Ajv = require("ajv")
const addFormats = require("ajv-formats")

const ajv = new Ajv()
addFormats(ajv)

The above code, from the documentation, does not work.

Both const ajv = new Ajv() and addFormats(ajv) produce an error "This expression is not constructable."

Package versions:

    "ajv": "^8.2.0",
    "ajv-formats": "^2.0.2"

NB - I can get rid of one error, from const ajv = new Ajv() by add .default to the require statement, but addFormats(ajv) still errors.

paul-uz avatar Apr 28 '21 09:04 paul-uz

I think both should be importable with require() without .default now, if not - can somebody make a minimal sample repo where it fails?

epoberezkin avatar Nov 07 '21 16:11 epoberezkin