Skip to main content

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:

  1. increment
  2. 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 ValueInterfaceNoteAssignable
serverTimestampServerTimestampYes
incrementIncrementauto union with numberNo

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

InterfaceNoteAssignable
Removableallow a node to be read as undefiend | null and be removeableYes
PossiblyReadAsNullableallow a node to be read as undefiend | nullYes
PushAbleOnlybe pushable onlyYes
PushAblebe pushable, set-able and updatableYes
NumericKeyRecord<T>is Record<${number}, T> under the hoddYes

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.