From 7332b2ad4d77a6cae41b4f2fcae27f5e2bdc3e8b Mon Sep 17 00:00:00 2001 From: AshGw Date: Fri, 26 Apr 2024 22:48:42 +0100 Subject: [PATCH] chore: organize types layout --- src/index.ts | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/index.ts b/src/index.ts index cbc0313c..50bc33eb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -976,6 +976,25 @@ export type IsDeepMutable = T extends DeepMutable ? true : false; */ export type IsDeepImmutable = T extends DeepImmutable ? true : false; +/** + * Check if all the properties of a given object (nested) are required + * @returns + * `true` if all the properties are, otherwise `false` + */ +export type IsDeepRequired = IfExtends, true, false>; + +/** + * Check if all the properties of a given object (nested) are non required + * @returns + * `true` if all the properties are, otherwise `false` + */ +export type IsDeepNonRequired = IfExtends< + T, + DeepNonRequired, + true, + false +>; + /** * A type that recursively turns the proprties within a given object type `T` immutable. * @example @@ -1618,16 +1637,9 @@ export type DeepRequired = T extends UnknownFunction [K in Keys]-?: IfExtends, T[K]>; }; -/** - * Check if all the properties of a given object (nested) are required - * @returns - * `true` if all the properties are, otherwise `false` - */ -export type IsDeepRequired = IfExtends, true, false>; - /** * Why not call it ``DeepOptional``? - * ``Optional`` in this library represents a type ``T`` that can be either ``T`` or ``null``. So creating + * ``Optional`` in this library `Optional` represents a type ``T`` that can be either ``T`` or ``null``. So creating * ``DeepOptional`` type would entail adding null to every property, which is not the intention here. * * ``DeepNonRequired`` turns all required keys in a given object (nested) to non required one. @@ -1676,18 +1688,6 @@ export type DeepNonRequired = T extends UnknownFunction [K in Keys]+?: IfExtends, T[K]>; }; -/** - * Check if all the properties of a given object (nested) are non required - * @returns - * `true` if all the properties are, otherwise `false` - */ -export type IsDeepNonRequired = IfExtends< - T, - DeepNonRequired, - true, - false ->; - /** * @hidden */