ajv-validator / ajv-validator/ajv-keywords

Exports are wrongly typed with module node16

Open
#388 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
257
Forks
51
PR merge metrics
No merged PRs in 30d

Description

Due to `export default ...` the types announce a named export called "default", which indeed does not exist necessitating the following workaround:

```ts
import ajvTransformKeywordBorkedDefault from "ajv-keywords/dist/definitions/transform.js"

// moduleResolution: node16 workaround, the types erroneously have a named export "default" on the default export
const ajvTransformKeyword =
ajvTransformKeywordBorkedDefault as unknown as typeof ajvTransformKeywordBorkedDefault.default
```

See similar issue https://github.com/ajv-validator/ajv/issues/2132, but at least on ajv-validator the types and what is actually exported by the compiled JS still agree.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.