Skip to main content
Here, you’ll find a comprehensive list of all types supported by the Typesync specification. Typesync’s powerful type system is designed to support a wide array of complex and useful types.

any

Represents any type.

unknown

Represents an unknown type.

nil

Represents the explicit absence of a value.

string

Represents a string value.

boolean

Represents a boolean value.

int

Represents a signed integer.

double

Represents a double-precision floating point number.

timestamp

Represents a datetime value.

bytes

Represents a Firestore bytes value.

document-reference

Represents a Firestore document reference — a pointer to another Firestore document. Use this in place of storing a document ID as a string when you want the field to round-trip as a native reference under each Firestore SDK.
Firestore only supports storing document references in document fields, not collection references — the stored value’s path must end on a document id. The type name mirrors the SDK class DocumentReference to make this constraint obvious at the schema-definition layer.
Without an explicit model, the document-reference type intentionally does not encode the target document’s shape. If you want the generated TypeScript and Zod types to be narrowed to a specific target model, use the parameterized form below.

Parameterized form

document-reference also accepts an object form with an optional model field that names the target document (or alias) model. Typesync validates that the referenced model exists in the same schema and threads the target through to the generated code. The narrowing only takes effect on platforms whose Firestore SDK class is generic:
  • TypeScriptfirestore.DocumentReference<TargetModel> is emitted instead of firestore.DocumentReference<firestore.DocumentData>.
  • Zod — the inferred type from z.infer<typeof Schema> carries the same narrowed shape. The runtime instanceof check is identical for both forms — narrowing is purely at the type level.
  • Python, Swift, Security Rules — these SDK classes are not generic, so the emitted type is identical to the bare form. The schema-level validation that model resolves still runs.
Zod self-references (e.g. NoteLink.next: DocumentReference<NoteLink>) are emitted without the generic in Zod to avoid TS2456 Type alias circularly references itself on the z.infer-derived type. Pure generate-ts output is unaffected and emits the narrowed self-reference. Cross-model references narrow on both targets.

literal

Represents a literal type.
Literal types are not supported in Swift. Typesync currently compiles literal types to the type of the literal value in Swift.

enum

Represents an enum value.

tuple

Represents a tuple value.

list

Represents a list of items.

map

Represents a mapping from arbitrary strings to values of any type.

object

Represents an object with known fields.

Swift-specific options

Use swift.name on an object field to override only the generated Swift property name. The Firestore field name stays the same.

union

Represents a union of multiple types. Typesync supports two types of unions: simple union and discriminated union. Both are defined in the same way using variants, except a discriminated union definition has a discriminant key and requires every variant to be of object (or alias resolving to object) type. Simple Union Example
Discriminated Union Example

alias

Represents an alias of another type.