Inhomogeneous Field Values
This page discusses how FireSageJS tackles the homogeneous FieldValue
types.
note
All interfaces use the same signature { symbol: unique symbol }
.
Field Values
There are 2 field values in RTDB:
- increment
- serverTimestamp
And they all sharing the same type: object
, which means is it possible to assign any field value to any field value, and this open up to mistakes.
FireSageJS solves this by assigning unique symbol type:
Field Value | Interface | Note | Assignable |
---|---|---|---|
serverTimestamp | ServerTimestamp | Yes | |
increment | Increment | auto union with number | No |
UnassignAble Field Values
Increment
are not assignable types and are not exported, it is a passive type that automatically union with number
.
Special Field Values
Interface | Note | Assignable |
---|---|---|
Removable | allow a node to be read as undefiend | null and be removeable | Yes |
PossiblyReadAsNullable | allow a node to be read as undefiend | null | Yes |
PushAbleOnly | be pushable only | Yes |
PushAble | be pushable, set-able and updatable | Yes |
NumericKeyRecord<T> | is Record<${number} , T> under the hodd | Yes |
Special types have no real value, they serve as utilities, eg: transform into another type or allow you to perform certain action to a node.