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

Using ajv-formats with deno fails #85

Open
iherman opened this issue Oct 10, 2023 · 2 comments
Open

Using ajv-formats with deno fails #85

iherman opened this issue Oct 10, 2023 · 2 comments

Comments

@iherman
Copy link

iherman commented Oct 10, 2023

Using ajv-formats with TypeScript+deno (version 1.37.1) fails. I use the 'usual' idiom:

import addFormats from 'npm:ajv-formats':
.
.
.
addFormat(ajv);

and the compiler complains saying "This expression is not callable, [...]import [...] has no call signatures".

The same construction works with node.js+tsc.

I also looked at the index.d.ts file, as cached on my machine by deno, and it does not include any reference to addFormat at all, although the index.js file has it, but is not part of the exported formatsPlugin object.

Is this a deno bug or a bug with the distribution of ajv-formats?

@zdila
Copy link

zdila commented Mar 19, 2024

You can try

import addFormats from "https://esm.sh/ajv-formats@2.1.1";

@silverwind
Copy link

silverwind commented May 17, 2024

Got the same issue with v3.0.1 with vite/node using typescript 5.4.5, the type definition resolves to this which has no call signature:

export interface FormatsPlugin extends Plugin<FormatsPluginOptions> {
    get: (format: FormatName, mode?: FormatMode) => Format;
}

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

No branches or pull requests

3 participants