From a4d5f0f7a310395cdb321aafeabde1ac9c72917f Mon Sep 17 00:00:00 2001 From: Thomas Smeele Date: Mon, 15 Jul 2024 15:42:00 +0000 Subject: [PATCH] Make PR cleaner --- src/Model.d.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Model.d.ts b/src/Model.d.ts index cf60979..eddd773 100644 --- a/src/Model.d.ts +++ b/src/Model.d.ts @@ -100,13 +100,9 @@ export type OneSchemaParams = { /* Entity field signature generated from the schema */ -type EntityField = T['type'] extends 'array' | ArrayConstructor | ArrayBufferConstructor - ? T['items'] extends object - ? EntityField[] - : EntityFieldFromType - : T['enum'] extends readonly EntityFieldFromType[] - ? T['enum'][number] - : EntityFieldFromType +type EntityField = T['enum'] extends readonly EntityFieldFromType[] + ? T['enum'][number] + : EntityFieldFromType type EntityFieldFromType = T['type'] extends ArrayConstructor | 'array' ? ArrayItemType[] @@ -128,7 +124,9 @@ type EntityFieldFromType = T['type'] extends ArrayConstructo ? EntityFieldFromType>[] : never -type ArrayItemType = T extends {items: OneField} ? EntityFieldFromType : any +type ArrayItemType = T extends {items: OneField} + ? EntityField + : EntityFieldFromType /* Select the required properties from a model */