From f7b9a22fc16fdff8646e538b9d2f9eadf500df30 Mon Sep 17 00:00:00 2001 From: AmauryD Date: Mon, 12 Feb 2024 19:17:10 +0100 Subject: [PATCH] doc --- README.md | 10 ++++++++++ src/utils/get-prototype-chain.ts | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) 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];