Skip to content

Commit ad65ed5

Browse files
authored
fix: plugins may contain also tuples of plugin (#157)
1 parent 618b440 commit ad65ed5

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ type AjvCompile = (schema: AnySchema, _meta?: boolean) => AnyValidateFunction
1111

1212
type SharedCompilerOptions = {
1313
onCreate?: (ajvInstance: Ajv) => void;
14-
plugins?: Plugin<unknown>[];
14+
plugins?: (Plugin<unknown> | [Plugin<unknown>, unknown])[];
1515
}
1616

1717
type BuildAjvJtdCompilerFromPool = (externalSchemas: { [key: string]: AnySchema | AnySchema[] }, options?: SharedCompilerOptions & { mode: 'JTD'; customOptions?: JTDOptions }) => AjvCompile

types/index.test-d.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,19 @@ expectType<Symbol>(AjvReference)
238238
expectType<import('ajv').default>(ajv)
239239
expectType<unknown>(options)
240240
return ajv
241-
}
241+
},
242+
[
243+
(ajv) => {
244+
expectType<import('ajv').default>(ajv)
245+
return ajv
246+
}, ['keyword1', 'keyword2']
247+
],
248+
[
249+
(ajv) => {
250+
expectType<import('ajv').default>(ajv)
251+
return ajv
252+
}, [{ key: 'value' }]
253+
],
242254
]
243255
})
244256
expectAssignable<ValidatorCompiler>(compiler)

0 commit comments

Comments
 (0)