Skip to content

Commit

Permalink
Make PR cleaner
Browse files Browse the repository at this point in the history
  • Loading branch information
thoom76 committed Jul 15, 2024
1 parent 804df7a commit a4d5f0f
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/Model.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,9 @@ export type OneSchemaParams = {
/*
Entity field signature generated from the schema
*/
type EntityField<T extends OneField> = T['type'] extends 'array' | ArrayConstructor | ArrayBufferConstructor
? T['items'] extends object
? EntityField<T['items']>[]
: EntityFieldFromType<T>
: T['enum'] extends readonly EntityFieldFromType<T>[]
? T['enum'][number]
: EntityFieldFromType<T>
type EntityField<T extends OneField> = T['enum'] extends readonly EntityFieldFromType<T>[]
? T['enum'][number]
: EntityFieldFromType<T>

type EntityFieldFromType<T extends OneField> = T['type'] extends ArrayConstructor | 'array'
? ArrayItemType<T>[]
Expand All @@ -128,7 +124,9 @@ type EntityFieldFromType<T extends OneField> = T['type'] extends ArrayConstructo
? EntityFieldFromType<Exclude<T['items'], undefined>>[]
: never

type ArrayItemType<T extends OneField> = T extends {items: OneField} ? EntityFieldFromType<T['items']> : any
type ArrayItemType<T extends OneField> = T extends {items: OneField}
? EntityField<T['items']>
: EntityFieldFromType<T>
/*
Select the required properties from a model
*/
Expand Down

0 comments on commit a4d5f0f

Please sign in to comment.