Directus / @directus/sdk / types / ApplyQueryFields
Type Alias: ApplyQueryFields<Schema, Collection, ReadonlyFields, CollectionItem, Fields, RelationalFields, RelationalKeys, FlatFields> ​
ApplyQueryFields<
Schema
,Collection
,ReadonlyFields
,CollectionItem
,Fields
,RelationalFields
,RelationalKeys
,FlatFields
>:IfAny
<Schema
,Record
<string
,any
>,Prettify
<Merge
<MappedFunctionFields
<Schema
,CollectionItem
> extends infer FF ?MapFlatFields
<CollectionItem
,FlatFields
,FF
extendsRecord
<string
,string
> ?FF
:Record
<string
,string
>> :never
,RelationalFields
extendsnever
?never
: { [Field in keyof RelationalFields]: Field extends keyof CollectionItem ? Extract<CollectionItem[Field], ItemType<Schema>> extends infer RelatedCollection ? RelationNullable<CollectionItem[Field], RelatedCollection extends any[] ? HasManyToAnyRelation<(...)> extends never ? (...) | (...) : (...)[] : ApplyNestedQueryFields<Schema, RelatedCollection, (...)[(...)]>> : never : never }>>>
Apply the configured fields query parameter on a given Item type
Type Parameters ​
• Schema
• Collection extends object
• ReadonlyFields
• CollectionItem extends object
= UnpackList
<Collection
>
• Fields = UnpackList
<Mutable
<ReadonlyFields
>>
• RelationalFields = PickRelationalFields
<Fields
>
• RelationalKeys extends keyof RelationalFields
= RelationalFields
extends never
? never
: keyof RelationalFields
• FlatFields extends keyof CollectionItem
= FieldsWildcard
<CollectionItem
, Exclude
<Fields
, RelationalKeys
>>