Directus / @directus/sdk / rest / updateField
Function: updateField() ​
updateField<
Schema
,TQuery
>(collection
,field
,item
,query
?):RestCommand
<IfAny
<Schema
,Record
<string
,any
>,Merge
<MappedFunctionFields
<Schema
,DirectusField
<Schema
>> extendsFF
?MapFlatFields
<DirectusField
<Schema
>,FieldsWildcard
<DirectusField
<Schema
>,Exclude
<UnpackList
<Mutable
<TQuery
["fields"
]>>,PickRelationalFields
<UnpackList
<Mutable
<...>>> extendsnever
?never
:AllKeys
<UnpackList
<...> extendsField
? ... extends ... ? ... : ... :never
>>>,FF
extendsRecord
<string
,string
> ?FF
<FF
> :Record
<string
,string
>> :never
,PickRelationalFields
<UnpackList
<Mutable
<TQuery
["fields"
]>>> extendsnever
?never
:{ [Field in string | number | symbol]: Field extends keyof DirectusField<Schema> ? Extract<DirectusField<Schema>[Field<Field>], ItemType<Schema>> extends RelatedCollection ? IsNullable<DirectusField<Schema>[Field<Field>], null | (RelatedCollection extends (...)[] ? (...) extends (...) ? (...) : (...) : ApplyNestedQueryFields<(...), (...), (...)>), RelatedCollection extends any[] ? HasManyToAnyRelation<(...)> extends never ? (...) | (...) : (...)[] : ApplyNestedQueryFields<Schema, RelatedCollection, (...)[(...)]>> : never : never }
>>,Schema
>
Updates the given field in the given collection.
Type parameters ​
• Schema
• TQuery extends Query
<Schema
, DirectusField
<Schema
>>
Parameters ​
• collection: string
• field: string
• item: NestedPartial
<DirectusField
<Schema
>>
• query?: TQuery
Returns ​
RestCommand
<IfAny
<Schema
, Record
<string
, any
>, Merge
<MappedFunctionFields
<Schema
, DirectusField
<Schema
>> extends FF
? MapFlatFields
<DirectusField
<Schema
>, FieldsWildcard
<DirectusField
<Schema
>, Exclude
<UnpackList
<Mutable
<TQuery
["fields"
]>>, PickRelationalFields
<UnpackList
<Mutable
<...>>> extends never
? never
: AllKeys
<UnpackList
<...> extends Field
? ... extends ... ? ... : ... : never
>>>, FF
extends Record
<string
, string
> ? FF
<FF
> : Record
<string
, string
>> : never
, PickRelationalFields
<UnpackList
<Mutable
<TQuery
["fields"
]>>> extends never
? never
: { [Field in string | number | symbol]: Field extends keyof DirectusField<Schema> ? Extract<DirectusField<Schema>[Field<Field>], ItemType<Schema>> extends RelatedCollection ? IsNullable<DirectusField<Schema>[Field<Field>], null | (RelatedCollection extends (...)[] ? (...) extends (...) ? (...) : (...) : ApplyNestedQueryFields<(...), (...), (...)>), RelatedCollection extends any[] ? HasManyToAnyRelation<(...)> extends never ? (...) | (...) : (...)[] : ApplyNestedQueryFields<Schema, RelatedCollection, (...)[(...)]>> : never : never }
>>, Schema
>
Throws ​
Will throw if collection is empty
Throws ​
Will throw if field is empty