diff --git a/src/validators/oneoftype.ts b/src/validators/oneoftype.ts index 9ed666a7..e0911989 100644 --- a/src/validators/oneoftype.ts +++ b/src/validators/oneoftype.ts @@ -11,8 +11,9 @@ import { } from '../utils' export default function oneOfType< - U extends VueProp | Prop, - V = InferType, + D extends V, + U extends VueProp | Prop = any, + V = InferType extends unknown ? U : InferType, >(arr: U[]) { if (!isArray(arr)) { throw new TypeError( @@ -52,13 +53,13 @@ export default function oneOfType< if (!hasCustomValidators) { // we got just native objects (ie: Array, Object) // delegate to Vue native prop check - return toType('oneOfType', { - type: nativeChecks, + return toType('oneOfType', { + type: nativeChecks as unknown as PropType, }) } - return toType('oneOfType', { - type: nativeChecks, + return toType('oneOfType', { + type: nativeChecks as unknown as PropType, validator(value) { const err: string[] = [] const valid = arr.some((type) => {