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

Can't import ValidationError type #1926

Closed
reisandbeans opened this issue Mar 12, 2022 · 1 comment
Closed

Can't import ValidationError type #1926

reisandbeans opened this issue Mar 12, 2022 · 1 comment

Comments

@reisandbeans
Copy link

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

Your typescript code

Both snippets below fail:

import Ajv, {
    AnySchema,
    AsyncValidateFunction,
    ErrorObject,
    JSONSchemaType,
    KeywordDefinition,
    Options,
    ValidateFunction,
} from 'ajv';

const error: Ajv.ValidationError = ... // 'Ajv' only refers to a type, but is being used as a namespace here
import Ajv, {
    AnySchema,
    AsyncValidateFunction,
    ErrorObject,
    JSONSchemaType,
    KeywordDefinition,
    Options,
    ValidateFunction,
    ValidationError,   // <----------- module ajv has no exported member ValidationError
} from 'ajv';

Typescript compiler error messages

see inline above. As additional context, here are my Typescript compiler options:

{
    "compilerOptions": {
        "declaration": true,
        "emitDecoratorMetadata": true,
        "esModuleInterop": true,
        "experimentalDecorators": true,
        "forceConsistentCasingInFileNames": true,
        "importHelpers": true,
        "lib": [
            "es2018"
        ],
        "module": "commonjs",
        "moduleResolution": "node",
        "noEmitOnError": true,
        "noImplicitAny": true,
        "removeComments": true,
        "skipLibCheck": true,
        "sourceMap": true,
        "strict": true,
        "target": "es2017"
    }
}

Describe the change that should be made to address the issue? Export ValidationError at the top level along with other ajv types

Are you going to resolve the issue? If this is confirmed as an issue sure, I can try. But I just wanted to validate first that it's not me doing something wrong.

@Ginden
Copy link

Ginden commented Mar 14, 2022

I must find time to fix #1840

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

No branches or pull requests

2 participants