-
-
Notifications
You must be signed in to change notification settings - Fork 883
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
Error TS4023: Exported variable has or is using name 'NumberKeywords' from external module node_modules/ajv/dist/types/json-schema but cannot be named. #1814
Comments
Updating export function tsJsonSchemasValidate<S, D>({ schema, value }: { schema: JSONSchemaType<S>; value: D }) {
const isSchemaInSet = (<Map<Record<string, unknown>, ValidateFunction<S>>>tsJsonSchemasMap).has(schema);
if (!isSchemaInSet) {
(<Map<Record<string, unknown>, ValidateFunction<S>>>tsJsonSchemasMap).set(schema, tsJsonSchemasAjv.compile(schema));
}
const validateFunction = <ValidateFunction<S>>(<Map<Record<string, unknown>, ValidateFunction<S>>>tsJsonSchemasMap).get(schema);
const isValid = (<Map<Record<string, unknown>, ValidateFunction<S>>>tsJsonSchemasMap).has(schema) ? validateFunction(value) : false;
const errorArray: TsJsonSchemasError<unknown>[] = validateFunction.errors?.map((error) => ({ ...error, message: error.message ?? '' })) ?? [];
return { isValid, errorArray };
} |
I'm getting this now with ajv Then it says:
Is there some thing I need to do here? |
I am facing this as well and also fixed by using the An example of the message I'm getting in VSCode
No error
error
|
same problem with it, const results in error and as a function works fine. |
Just to confirm, this is only VSCode problem and not reproducible with |
I have not tried the function keyword workaround yet. Should this issue be reopened? @epoberezkin I'm seeing both VSCode and tsc complain after upgrade from Node 16 to Node 18 node --version I also tested node 18.11.0 npx tsc --version npm --version package.json My workaround at build-time is to stop using |
Having this issue when building with tsup. |
Same with
|
I built a library to wrap Ajv features but I don't reach to build it because of the
Error TS4023: Exported variable has or is using name 'NumberKeywords' from external module node_modules/ajv/dist/types/json-schema but cannot be named.
.I made a reproducible example available here.
Basically I would like to have this library building:
Here are the commands I used to build this repository:
workspace/libs/json-schemas/ajv/src/lib/is-valid/json-schemas-ajv-is-valid.ts
file:The command to build the library and its output:
Notes:
Environment
The text was updated successfully, but these errors were encountered: