diff --git a/README.md b/README.md index bb05b98..b3d472b 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,16 @@ All decorators accept an object of options that apply to the type being used, fo [**@Any({})**](https://github.com/icebob/fastest-validator#any) - Applies { type: "any" } +[**@Multi({})**](https://github.com/icebob/fastest-validator#multi) - Applies { type: "multi" } + +Also resolves to multi if multiple decorators are stacked on a single field. + +```ts +@String() +@Number() +prop1: string | number; +``` + **@Nested({})** - Applies { type: "object", props: {} } (The props are gathered from the nested schema) **@NestedArray({ validator: `` })** - Applies { type: "array", "items": { type :"object", props: { ... } }} (The props are gathered from the nested schema) diff --git a/src/utils/get-prototype-chain.ts b/src/utils/get-prototype-chain.ts index 3e62c55..c257caa 100644 --- a/src/utils/get-prototype-chain.ts +++ b/src/utils/get-prototype-chain.ts @@ -5,7 +5,7 @@ import type { Class } from "type-fest"; * Used for schema inheritance detection * Maybe find a way to do the same thing with reflect metadata ? */ -export function getPrototypeChain (object: Class): Class[] { +export function getPrototypeChain (object: any): Class[] { let proto = object; const protos: Class[] = [object];