Typesaurus
The namespace provides a number of types that help to work with Typesaurus.
Schema
The type represents your database structure and provides type shortcuts for all kinds of data:
→ Read more about the Schema
type
ServerDate
Defines a server date. Use it to define a field that will be set to the server date on creation:
→ Read more about the server dates
NormalizeServerDates
Deeply normalizes server dates in a given type. It replaces ServerDate with regular Date. It’s useful when reusing interfaces in a non-Typesaurus environment or when you need to store it in an array (where server dates are not allowed).
→ Read more about the server dates
Nullify
Deeply adds null to all undefined values. It’s helpful in wrapping your types when you expect data from Firestore, where undefined values turn into nulls.
NarrowDoc
Narrows doc type. If your doc has a variable model, the type will help you narrow down the doc type to a specific data type.
SharedRef
The shared ref type. Unlike regular ref, the shared ref lacks methods which type-safety depends on knowing the full type of the model: set
, upset
, and as
.
The ref’s collection
is also limited.
→ Read more about sharing functionality
→ Read more about the as
method
SharedDoc
The shared doc type. Unlike regular doc, the shared doc lacks methods which type-safety depends on knowing the full type of the model: set
, upset
, and as
.
The doc’s ref
is also limited.
→ Read more about sharing functionality
→ Read more about the as
method
SharedEntity
The shared ref or doc type. Unlike regular entity type, the shared entity lacks methods which type-safety depends on knowing the full type of the model: set
, upset
, and as
.
→ Read more about sharing functionality
→ Read more about the as
method
SharedCollection
The shared collection type. Unlike regular collection, the shared collection lacks methods which type-safety depends on knowing the full type of the model: add
, set
, upset
, and update
.
→ Read more about sharing functionality
→ Read more about the as
method
SharedGroup
⚠️ Available starting with v10.7.0
The shared collection group type. Unlike regular groups, the shared group lacks methods which type-safety depends on knowing the full type of the model: add
, set
, upset
, and update
.
→ Read more about sharing functionality
→ Read more about the as
method
Id
The type allows to define typed id strings. It accepts the collection path as the first generic argument:
Collection
⚠️ Deprecated starting with v10.7.0 in favor SharedCollection
The type allows defining collection types:
Ref
⚠️ Deprecated starting with v10.7.0 in favor SharedRef
The type allows defining references:
Doc
⚠️ Deprecated starting with v10.7.0 in favor SharedDoc
The type represents the document type:
Data
The type represents the document data type:
Def
The type represents the document definition. It’s in many methods as a generic parameter.