Delete Field
This section discusses how deleteField
works.
Deletable Field
Firestore allow you to use deleteField
anytime you want, but in FirelordJS, field are not deletable by default, you need to assign deleteField
type in order to use it.
Only `a` is deletable because one of the type of `a` is `DeleteField`
You can delete a
field because one of the a
field types is DeleteField
, this is not the same case with b
.
DeleteField union `a` field's read type with 'undefined'
note
This is needed because if a field is deletable, it should be possibly read as undefined.
FirelordJS does not simply union every type with undefined
by default, because it degrades developer experience.
Hence by default we cannot assume all fields is deletable, it must be stated explicitly.