Open iherman opened 11 months ago
You can try
import addFormats from "https://esm.sh/ajv-formats@2.1.1";
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;
}
Any resolution on this? I have the same problem in Node 20 with Typesript 5.5.3 and moduleResolution: node16.
Needs to fix the export ajv like https://github.com/ajv-validator/ajv/issues/2381 https://github.com/ajv-validator/ajv-keywords/issues/388 etc Workaround for now: https://github.com/microsoft/TypeScript/issues/50058#issuecomment-1297806160
import _addFormats from 'ajv-formats';
const addFormats = _addFormats as unknown as typeof _addFormats.default;
Using
ajv-formats
with TypeScript+deno (version 1.37.1) fails. I use the 'usual' idiom: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 toaddFormat
at all, although theindex.js
file has it, but is not part of the exportedformatsPlugin
object.Is this a deno bug or a bug with the distribution of
ajv-formats
?