Jazz 0.14.0 Introducing Zod-based schemas

We're excited to move from our own schema syntax to using Zod v4.

This is the first step in a series of releases to make Jazz more familiar and to make CoValues look more like regular data structures.

Note: This is a huge release that we're still cleaning up and documenting.

We're still in the process of:

  • updating all our docs
  • double-checking all our framework bindings
  • completing all the details of this upgrade guide

If you see something broken, please let us know on Discord and check back in a couple hours.

Thanks for your patience!

Overview:

So far, Jazz has relied on our own idiosyncratic schema definition syntax where you had to extend classes and be careful to use co.ref for references.

// BEFORE
import { co, CoMap, CoList, CoPlainText, ImageDefinition } from "jazz-tools";

export class Message extends CoMap {
  text = co.ref(CoPlainText);
  image = co.optional.ref(ImageDefinition);
  important = co.boolean;
}

export class Chat extends CoList.Of(co.ref(Message)) {}

While this had certain ergonomic benefits it relied on unclean hacks to work.

In addition, many of our adopters expressed a preference for avoiding class syntax, and LLMs consistently expected to be able to use Zod.

For this reason, we completely overhauled how you define and use CoValue schemas:

// AFTER
import { import coco, import zz } from "jazz-tools";

export const 
const Message: CoMapSchema<{
    text: PlainTextSchema;
    image: z.ZodOptional<WithHelpers<CoMapSchema<{
        originalSize: z.z.ZodTuple<[z.z.ZodNumber, z.z.ZodNumber], null>;
        placeholderDataURL: z.ZodOptional<z.z.ZodString>;
    }, z.z.core.$catchall<...>>, {
        ...;
    }>>;
    important: z.z.ZodBoolean;
}>
Message
= import coco.
map<{
    text: PlainTextSchema;
    image: z.ZodOptional<WithHelpers<CoMapSchema<{
        originalSize: z.z.ZodTuple<[z.z.ZodNumber, z.z.ZodNumber], null>;
        placeholderDataURL: z.ZodOptional<z.z.ZodString>;
    }, z.z.core.$catchall<...>>, {
        ...;
    }>>;
    important: z.z.ZodBoolean;
}>(shape: {
    text: PlainTextSchema;
    image: z.ZodOptional<WithHelpers<CoMapSchema<{
        originalSize: z.z.ZodTuple<[z.z.ZodNumber, z.z.ZodNumber], null>;
        placeholderDataURL: z.ZodOptional<z.z.ZodString>;
    }, z.z.core.$catchall<...>>, {
        ...;
    }>>;
    important: z.z.ZodBoolean;
}): CoMapSchema<...>
export map
map
({
text: PlainTextSchematext: import coco.
function plainText(): PlainTextSchema
export plainText
plainText
(),
image: z.ZodOptional<WithHelpers<CoMapSchema<{
    originalSize: z.z.ZodTuple<[z.z.ZodNumber, z.z.ZodNumber], null>;
    placeholderDataURL: z.ZodOptional<z.z.ZodString>;
}, z.z.core.$catchall<...>>, {
    ...;
}>>
image
: import zz.
optional<WithHelpers<CoMapSchema<{
    originalSize: z.z.ZodTuple<[z.z.ZodNumber, z.z.ZodNumber], null>;
    placeholderDataURL: z.ZodOptional<z.z.ZodString>;
}, z.z.core.$catchall<...>>, {
    ...;
}>>(innerType: WithHelpers<...>): z.ZodOptional<...>
export optional
optional
(import coco.
function image(): typeof ImageDefinition
export image
image
()),
important: z.z.ZodBooleanimportant: import zz.
function boolean(params?: string | z.z.core.$ZodBooleanParams): z.z.ZodBoolean
export boolean
boolean
(),
}); export const
const Chat: CoListSchema<CoMapSchema<{
    text: PlainTextSchema;
    image: z.ZodOptional<WithHelpers<CoMapSchema<{
        originalSize: z.z.ZodTuple<[z.z.ZodNumber, z.z.ZodNumber], null>;
        placeholderDataURL: z.ZodOptional<z.z.ZodString>;
    }, z.z.core.$catchall<...>>, {
        ...;
    }>>;
    important: z.z.ZodBoolean;
}>>
Chat
= import coco.
list<CoMapSchema<{
    text: PlainTextSchema;
    image: z.ZodOptional<WithHelpers<CoMapSchema<{
        originalSize: z.z.ZodTuple<[z.z.ZodNumber, z.z.ZodNumber], null>;
        placeholderDataURL: z.ZodOptional<z.z.ZodString>;
    }, z.z.core.$catchall<...>>, {
        ...;
    }>>;
    important: z.z.ZodBoolean;
}>>(element: CoMapSchema<...>): CoListSchema<...>
export list
list
(
const Message: CoMapSchema<{
    text: PlainTextSchema;
    image: z.ZodOptional<WithHelpers<CoMapSchema<{
        originalSize: z.z.ZodTuple<[z.z.ZodNumber, z.z.ZodNumber], null>;
        placeholderDataURL: z.ZodOptional<z.z.ZodString>;
    }, z.z.core.$catchall<...>>, {
        ...;
    }>>;
    important: z.z.ZodBoolean;
}>
Message
);

Major breaking changes

Schema definitions

You now define CoValue schemas using two new exports from jazz-tools:

  • a new co definer that mirrors Zod's object/record/array syntax to define CoValue types
    • co.map(), co.record(), co.list(), co.feed()
    • co.account(), co.profile()
    • co.plainText(), co.richText(),
    • co.fileStream(), co.image()
    • see the updated Defining CoValue Schemas
  • z re-exported from Zod v4
    • primitives like z.string(), z.number(), z.literal()
      • note: additional constraints like z.min() and z.max() are not yet enforced, we'll add validation in future releases
    • complex types like z.object() and z.array() to define JSON-like fields without internal collaboration
    • combinators like z.optional() and z.discriminatedUnion()
      • these also work on CoValue types!
    • see the updated Docs on Primitive Fields, Docs on Optional References and Docs on Unions of CoMaps

Similar to Zod v4's new object syntax, recursive and mutually recursive types are now much easier to express.

How to pass loaded CoValues

Calls to useCoState() work just the same, but they return a slightly different type than before.

And while you can still read from the type just as before...

import { import zz, import coco } from "jazz-tools";
import { 
function useCoState<S extends CoValueOrZodSchema, const R extends ResolveQuery<S> = true>(Schema: S, id: string | undefined, options?: {
    resolve?: ResolveQueryStrict<S, R>;
}): co.loaded<S, R> | undefined | null
useCoState
} from "jazz-react";
const
const Pet: CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>
Pet
= import coco.
map<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>(shape: {
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}): CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>
export map
map
({
name: z.z.ZodStringname: import zz.
function string(params?: string | z.z.core.$ZodStringParams): z.z.ZodString
export string
string
(),
age: z.z.ZodNumberage: import zz.
function number(params?: string | z.z.core.$ZodNumberParams): z.z.ZodNumber
export number
number
(),
}); type
type Pet = {
    name: string;
    age: number;
} & CoMap
Pet
= import coco.
type loaded<T extends CoValueClass | AnyCoSchema, R extends ResolveQuery<T> = true> = R extends boolean | undefined ? NonNullable<InstanceOfSchemaCoValuesNullable<T>> : [NonNullable<InstanceOfSchemaCoValuesNullable<T>>] extends [...] ? Exclude<...> extends CoValue ? R extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...
export loaded
loaded
<typeof
const Pet: CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>
Pet
>;
const
const Person: CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
    pets: CoListSchema<CoMapSchema<{
        name: z.z.ZodString;
        age: z.z.ZodNumber;
    }>>;
}>
Person
= import coco.
map<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
    pets: CoListSchema<CoMapSchema<{
        name: z.z.ZodString;
        age: z.z.ZodNumber;
    }>>;
}>(shape: {
    name: z.z.ZodString;
    age: z.z.ZodNumber;
    pets: CoListSchema<CoMapSchema<{
        name: z.z.ZodString;
        age: z.z.ZodNumber;
    }>>;
}): CoMapSchema<...>
export map
map
({
name: z.z.ZodStringname: import zz.
function string(params?: string | z.z.core.$ZodStringParams): z.z.ZodString
export string
string
(),
age: z.z.ZodNumberage: import zz.
function number(params?: string | z.z.core.$ZodNumberParams): z.z.ZodNumber
export number
number
(),
pets: CoListSchema<CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>>
pets
: import coco.
list<CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>>(element: CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>): CoListSchema<CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>>
export list
list
(
const Pet: CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>
Pet
),
}); type
type Person = {
    name: string;
    age: number;
    pets: CoList<({
        name: string;
        age: number;
    } & CoMap) | null> | null;
} & CoMap
Person
= import coco.
type loaded<T extends CoValueClass | AnyCoSchema, R extends ResolveQuery<T> = true> = R extends boolean | undefined ? NonNullable<InstanceOfSchemaCoValuesNullable<T>> : [NonNullable<InstanceOfSchemaCoValuesNullable<T>>] extends [...] ? Exclude<...> extends CoValue ? R extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...
export loaded
loaded
<typeof
const Person: CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
    pets: CoListSchema<CoMapSchema<{
        name: z.z.ZodString;
        age: z.z.ZodNumber;
    }>>;
}>
Person
>;
function
function MyComponent({ id }: {
    id: string;
}): React.JSX.Element | null | undefined
MyComponent
({ id: stringid }: { id: stringid: string }) {
const
const person: ({
    name: string;
    age: number;
    pets: CoList<({
        name: string;
        age: number;
    } & CoMap) | null> | null;
} & CoMap) | null | undefined
person
=
useCoState<CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
    pets: CoListSchema<CoMapSchema<{
        name: z.z.ZodString;
        age: z.z.ZodNumber;
    }>>;
}>, true>(Schema: CoMapSchema<...>, id: string | undefined, options?: {
    ...;
} | undefined): ({
    ...;
} & CoMap) | ... 1 more ... | undefined
useCoState
(
const Person: CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
    pets: CoListSchema<CoMapSchema<{
        name: z.z.ZodString;
        age: z.z.ZodNumber;
    }>>;
}>
Person
, id: stringid);
return
const person: ({
    name: string;
    age: number;
    pets: CoList<({
        name: string;
        age: number;
    } & CoMap) | null> | null;
} & CoMap) | null | undefined
person
&& <
function PersonName({ person }: {
    person: Person;
}): React.JSX.Element
PersonName
person: {
    name: string;
    age: number;
    pets: CoList<({
        name: string;
        age: number;
    } & CoMap) | null> | null;
} & CoMap
person
={
const person: {
    name: string;
    age: number;
    pets: CoList<({
        name: string;
        age: number;
    } & CoMap) | null> | null;
} & CoMap
person
} />;
} function
function PersonName({ person }: {
    person: Person;
}): React.JSX.Element
PersonName
({
person: {
    name: string;
    age: number;
    pets: CoList<({
        name: string;
        age: number;
    } & CoMap) | null> | null;
} & CoMap
person
}: {
person: {
    name: string;
    age: number;
    pets: CoList<({
        name: string;
        age: number;
    } & CoMap) | null> | null;
} & CoMap
person
:
type Person = {
    name: string;
    age: number;
    pets: CoList<({
        name: string;
        age: number;
    } & CoMap) | null> | null;
} & CoMap
Person
}) { return <JSX.IntrinsicElements.div: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>div>{
person: {
    name: string;
    age: number;
    pets: CoList<({
        name: string;
        age: number;
    } & CoMap) | null> | null;
} & CoMap
person
.name: stringname}</JSX.IntrinsicElements.div: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>div>;
}

co.loaded can also take a second argument to specify the loading depth of the expected CoValue, mirroring the resolve options for useCoState, load, subscribe, etc.

import { import zz, import coco } from "jazz-tools";
import { 
function useCoState<S extends CoValueOrZodSchema, const R extends ResolveQuery<S> = true>(Schema: S, id: string | undefined, options?: {
    resolve?: ResolveQueryStrict<S, R>;
}): co.loaded<S, R> | undefined | null
useCoState
} from "jazz-react";
const
const Pet: CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>
Pet
= import coco.
map<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>(shape: {
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}): CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>
export map
map
({
name: z.z.ZodStringname: import zz.
function string(params?: string | z.z.core.$ZodStringParams): z.z.ZodString
export string
string
(),
age: z.z.ZodNumberage: import zz.
function number(params?: string | z.z.core.$ZodNumberParams): z.z.ZodNumber
export number
number
(),
}); type
type Pet = {
    name: string;
    age: number;
} & CoMap
Pet
= import coco.
type loaded<T extends CoValueClass | AnyCoSchema, R extends ResolveQuery<T> = true> = R extends boolean | undefined ? NonNullable<InstanceOfSchemaCoValuesNullable<T>> : [NonNullable<InstanceOfSchemaCoValuesNullable<T>>] extends [...] ? Exclude<...> extends CoValue ? R extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...
export loaded
loaded
<typeof
const Pet: CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>
Pet
>;
const
const Person: CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
    pets: CoListSchema<CoMapSchema<{
        name: z.z.ZodString;
        age: z.z.ZodNumber;
    }>>;
}>
Person
= import coco.
map<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
    pets: CoListSchema<CoMapSchema<{
        name: z.z.ZodString;
        age: z.z.ZodNumber;
    }>>;
}>(shape: {
    name: z.z.ZodString;
    age: z.z.ZodNumber;
    pets: CoListSchema<CoMapSchema<{
        name: z.z.ZodString;
        age: z.z.ZodNumber;
    }>>;
}): CoMapSchema<...>
export map
map
({
name: z.z.ZodStringname: import zz.
function string(params?: string | z.z.core.$ZodStringParams): z.z.ZodString
export string
string
(),
age: z.z.ZodNumberage: import zz.
function number(params?: string | z.z.core.$ZodNumberParams): z.z.ZodNumber
export number
number
(),
pets: CoListSchema<CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>>
pets
: import coco.
list<CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>>(element: CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>): CoListSchema<CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>>
export list
list
(
const Pet: CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>
Pet
),
}); type
type Person = {
    name: string;
    age: number;
    pets: CoList<({
        name: string;
        age: number;
    } & CoMap) | null> | null;
} & CoMap
Person
= import coco.
type loaded<T extends CoValueClass | AnyCoSchema, R extends ResolveQuery<T> = true> = R extends boolean | undefined ? NonNullable<InstanceOfSchemaCoValuesNullable<T>> : [NonNullable<InstanceOfSchemaCoValuesNullable<T>>] extends [...] ? Exclude<...> extends CoValue ? R extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...
export loaded
loaded
<typeof
const Person: CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
    pets: CoListSchema<CoMapSchema<{
        name: z.z.ZodString;
        age: z.z.ZodNumber;
    }>>;
}>
Person
>;
function
function MyComponent({ id }: {
    id: string;
}): React.JSX.Element | null | undefined
MyComponent
({ id: stringid }: { id: stringid: string }) {
const
const personWithPets: ({
    pets: ({
        name: string;
        age: number;
    } & CoMap)[] & CoList<({
        name: string;
        age: number;
    } & CoMap) | null>;
} & {
    name: string;
    age: number;
    pets: CoList<({
        name: string;
        age: number;
    } & CoMap) | null> | null;
} & CoMap) | null | undefined
personWithPets
=
useCoState<CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
    pets: CoListSchema<CoMapSchema<{
        name: z.z.ZodString;
        age: z.z.ZodNumber;
    }>>;
}>, {
    ...;
}>(Schema: CoMapSchema<...>, id: string | undefined, options?: {
    ...;
} | undefined): ({
    ...;
} & ... 1 more ... & CoMap) | ... 1 more ... | undefined
useCoState
(
const Person: CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
    pets: CoListSchema<CoMapSchema<{
        name: z.z.ZodString;
        age: z.z.ZodNumber;
    }>>;
}>
Person
, id: stringid, {
resolve?: RefsToResolve<{
    name: string;
    age: number;
    pets: CoList<({
        name: string;
        age: number;
    } & CoMap) | null> | null;
} & CoMap, 10, []> | undefined
resolve
: {
pets?: RefsToResolve<CoList<({
    name: string;
    age: number;
} & CoMap) | null>, 10, [0]> | undefined
pets
: {
$each: RefsToResolve<{
    name: string;
    age: number;
} & CoMap, 10, [0, 0]>
$each
: true } }
}); return
const personWithPets: ({
    pets: ({
        name: string;
        age: number;
    } & CoMap)[] & CoList<({
        name: string;
        age: number;
    } & CoMap) | null>;
} & {
    name: string;
    age: number;
    pets: CoList<({
        name: string;
        age: number;
    } & CoMap) | null> | null;
} & CoMap) | null | undefined
personWithPets
&& <
function PersonAndFirstPetName({ person }: {
    person: co.loaded<typeof Person, {
        pets: {
            $each: true;
        };
    }>;
}): React.JSX.Element
PersonAndFirstPetName
person: {
    pets: ({
        name: string;
        age: number;
    } & CoMap)[] & CoList<({
        name: string;
        age: number;
    } & CoMap) | null>;
} & {
    name: string;
    age: number;
    pets: CoList<({
        name: string;
        age: number;
    } & CoMap) | null> | null;
} & CoMap
person
={
const personWithPets: {
    pets: ({
        name: string;
        age: number;
    } & CoMap)[] & CoList<({
        name: string;
        age: number;
    } & CoMap) | null>;
} & {
    name: string;
    age: number;
    pets: CoList<({
        name: string;
        age: number;
    } & CoMap) | null> | null;
} & CoMap
personWithPets
} />;
} function
function PersonAndFirstPetName({ person }: {
    person: co.loaded<typeof Person, {
        pets: {
            $each: true;
        };
    }>;
}): React.JSX.Element
PersonAndFirstPetName
({
person: {
    pets: ({
        name: string;
        age: number;
    } & CoMap)[] & CoList<({
        name: string;
        age: number;
    } & CoMap) | null>;
} & {
    name: string;
    age: number;
    pets: CoList<({
        name: string;
        age: number;
    } & CoMap) | null> | null;
} & CoMap
person
}: {
person: {
    pets: ({
        name: string;
        age: number;
    } & CoMap)[] & CoList<({
        name: string;
        age: number;
    } & CoMap) | null>;
} & {
    name: string;
    age: number;
    pets: CoList<({
        name: string;
        age: number;
    } & CoMap) | null> | null;
} & CoMap
person
: import coco.
type loaded<T extends CoValueClass | AnyCoSchema, R extends ResolveQuery<T> = true> = R extends boolean | undefined ? NonNullable<InstanceOfSchemaCoValuesNullable<T>> : [NonNullable<InstanceOfSchemaCoValuesNullable<T>>] extends [...] ? Exclude<...> extends CoValue ? R extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...
export loaded
loaded
<typeof
const Person: CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
    pets: CoListSchema<CoMapSchema<{
        name: z.z.ZodString;
        age: z.z.ZodNumber;
    }>>;
}>
Person
, {
pets: {
    $each: true;
}
pets
: { $each: true$each: true } }>
}) { return <JSX.IntrinsicElements.div: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>div>{
person: {
    pets: ({
        name: string;
        age: number;
    } & CoMap)[] & CoList<({
        name: string;
        age: number;
    } & CoMap) | null>;
} & {
    name: string;
    age: number;
    pets: CoList<({
        name: string;
        age: number;
    } & CoMap) | null> | null;
} & CoMap
person
.name: stringname} & {
person: {
    pets: ({
        name: string;
        age: number;
    } & CoMap)[] & CoList<({
        name: string;
        age: number;
    } & CoMap) | null>;
} & {
    name: string;
    age: number;
    pets: CoList<({
        name: string;
        age: number;
    } & CoMap) | null> | null;
} & CoMap
person
.
pets: ({
    name: string;
    age: number;
} & CoMap)[] & CoList<({
    name: string;
    age: number;
} & CoMap) | null>
pets
[0].name: stringname}</JSX.IntrinsicElements.div: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>div>;
}

Removing AccountSchema registration

We have removed the Typescript AccountSchema registration.

It was causing some deal of confusion to new adopters so we have decided to replace the magic inference with a more explicit approach.

When using useAccount you should now pass the Account schema directly:

import { 
function useAccount<A extends AccountClass<Account> | AnyAccountSchema>(AccountSchema?: A): {
    me: Loaded<A, true>;
    logOut: () => void;
} (+1 overload)
useAccount
} from "jazz-react";
import {
const MyAccount: AccountSchema<{
    profile: CoProfileSchema<{
        name: $ZodString<string>;
        inbox?: $ZodOptional<$ZodString>;
        inboxInvite?: $ZodOptional<$ZodString>;
    }>;
    root: CoMapSchema<...>;
}>
MyAccount
} from "./schema";
function function MyComponent(): React.JSX.ElementMyComponent() { const {
const me: ({
    profile: {
        name: string;
        inbox: string | undefined;
        inboxInvite: string | undefined;
    } & CoMap & Profile;
} & {
    profile: ({
        name: string;
        inbox: string | undefined;
        inboxInvite: string | undefined;
    } & CoMap) | null;
    root: ({} & CoMap) | null;
} & Account) | null | undefined
me
} =
useAccount<AccountSchema<{
    profile: CoProfileSchema<{
        name: $ZodString<string>;
        inbox?: $ZodOptional<$ZodString>;
        inboxInvite?: $ZodOptional<$ZodString>;
    }>;
    root: CoMapSchema<...>;
}>, {
    ...;
}>(AccountSchema: AccountSchema<...>, options?: {
    ...;
} | undefined): {
    ...;
} (+1 overload)
useAccount
(
const MyAccount: AccountSchema<{
    profile: CoProfileSchema<{
        name: $ZodString<string>;
        inbox?: $ZodOptional<$ZodString>;
        inboxInvite?: $ZodOptional<$ZodString>;
    }>;
    root: CoMapSchema<...>;
}>
MyAccount
, {
resolve?: RefsToResolve<{
    profile: ({
        name: string;
        inbox: string | undefined;
        inboxInvite: string | undefined;
    } & CoMap) | null;
    root: ({} & CoMap) | null;
} & Account, 10, []> | undefined
resolve
: {
profile?: RefsToResolve<{
    name: string;
    inbox: string | undefined;
    inboxInvite: string | undefined;
} & CoMap & Profile, 10, [0]> | undefined
profile
: true,
}, }); return <JSX.IntrinsicElements.div: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>div>{
const me: ({
    profile: {
        name: string;
        inbox: string | undefined;
        inboxInvite: string | undefined;
    } & CoMap & Profile;
} & {
    profile: ({
        name: string;
        inbox: string | undefined;
        inboxInvite: string | undefined;
    } & CoMap) | null;
    root: ({} & CoMap) | null;
} & Account) | null | undefined
me
?.
Account.profile: {
    name: string;
    inbox: string | undefined;
    inboxInvite: string | undefined;
} & CoMap & Profile
profile
.Profile.name: string | undefinedname}</JSX.IntrinsicElements.div: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>div>;
}

Defining migrations

Now account schemas need to be defined with co.account() and migrations can be declared using withMigration():

import { import coco, import zz, class Group
@categoryIdentity & Permissions
Group
} from "jazz-tools";
const
const Pet: CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>
Pet
= import coco.
map<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>(shape: {
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}): CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>
export map
map
({
name: z.z.ZodStringname: import zz.
function string(params?: string | z.z.core.$ZodStringParams): z.z.ZodString
export string
string
(),
age: z.z.ZodNumberage: import zz.
function number(params?: string | z.z.core.$ZodNumberParams): z.z.ZodNumber
export number
number
(),
}); const
const MyAppRoot: CoMapSchema<{
    pets: CoListSchema<CoMapSchema<{
        name: z.z.ZodString;
        age: z.z.ZodNumber;
    }>>;
}>
MyAppRoot
= import coco.
map<{
    pets: CoListSchema<CoMapSchema<{
        name: z.z.ZodString;
        age: z.z.ZodNumber;
    }>>;
}>(shape: {
    pets: CoListSchema<CoMapSchema<{
        name: z.z.ZodString;
        age: z.z.ZodNumber;
    }>>;
}): CoMapSchema<...>
export map
map
({
pets: CoListSchema<CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>>
pets
: import coco.
list<CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>>(element: CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>): CoListSchema<CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>>
export list
list
(
const Pet: CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>
Pet
),
}); const
const MyAppProfile: CoProfileSchema<{
    name: z.z.ZodString;
    age: z.ZodOptional<z.z.ZodNumber>;
}>
MyAppProfile
= import coco.
profile<{
    name: z.z.ZodString;
    age: z.ZodOptional<z.z.ZodNumber>;
}>(shape?: ({
    name: z.z.ZodString;
    age: z.ZodOptional<z.z.ZodNumber>;
} & {
    name?: z.z.core.$ZodString<string>;
    inbox?: z.z.core.$ZodOptional<z.z.core.$ZodString>;
    inboxInvite?: z.z.core.$ZodOptional<z.z.core.$ZodString>;
}) | undefined): CoProfileSchema<...>
export profile
profile
({
name: z.z.ZodString & z.z.core.$ZodString<string>name: import zz.
function string(params?: string | z.z.core.$ZodStringParams): z.z.ZodString
export string
string
(),
age: z.ZodOptional<z.z.ZodNumber>age: import zz.
function number(params?: string | z.z.core.$ZodNumberParams): z.z.ZodNumber
export number
number
().ZodType<unknown, unknown>.optional(): z.ZodOptional<z.z.ZodNumber>optional(),
}); export const
const MyAppAccount: AccountSchema<{
    root: CoMapSchema<{
        pets: CoListSchema<CoMapSchema<{
            name: z.z.ZodString;
            age: z.z.ZodNumber;
        }>>;
    }>;
    profile: CoProfileSchema<{
        name: z.z.ZodString;
        age: z.ZodOptional<...>;
    }>;
}>
MyAppAccount
= import coco.
account<{
    root: CoMapSchema<{
        pets: CoListSchema<CoMapSchema<{
            name: z.z.ZodString;
            age: z.z.ZodNumber;
        }>>;
    }>;
    profile: CoProfileSchema<{
        name: z.z.ZodString;
        age: z.ZodOptional<...>;
    }>;
}>(shape?: {
    root: CoMapSchema<{
        pets: CoListSchema<CoMapSchema<{
            name: z.z.ZodString;
            age: z.z.ZodNumber;
        }>>;
    }>;
    profile: CoProfileSchema<{
        name: z.z.ZodString;
        age: z.ZodOptional<...>;
    }>;
} | undefined): AccountSchema<...>
export account
account
({
root: CoMapSchema<{
    pets: CoListSchema<CoMapSchema<{
        name: z.z.ZodString;
        age: z.z.ZodNumber;
    }>>;
}>
root
:
const MyAppRoot: CoMapSchema<{
    pets: CoListSchema<CoMapSchema<{
        name: z.z.ZodString;
        age: z.z.ZodNumber;
    }>>;
}>
MyAppRoot
,
profile: CoProfileSchema<{
    name: z.z.ZodString;
    age: z.ZodOptional<z.z.ZodNumber>;
}>
profile
:
const MyAppProfile: CoProfileSchema<{
    name: z.z.ZodString;
    age: z.ZodOptional<z.z.ZodNumber>;
}>
MyAppProfile
,
}).
function withMigration(migration: (account: {
    root: {
        pets: CoList<{
            name: string;
            age: number;
        } & CoMap>;
    } & CoMap;
    profile: {
        name: string;
        age: number | undefined;
        inbox: string | undefined;
        inboxInvite: string | undefined;
    } & CoMap;
} & {
    ...;
} & Account, creationProps?: {
    name: string;
}) => void): AccountSchema<...>
withMigration
((
account: {
    root: {
        pets: CoList<{
            name: string;
            age: number;
        } & CoMap>;
    } & CoMap;
    profile: {
        name: string;
        age: number | undefined;
        inbox: string | undefined;
        inboxInvite: string | undefined;
    } & CoMap;
} & {
    ...;
} & Account
account
,
creationProps: {
    name: string;
} | undefined
creationProps
?: { name: stringname: string }) => {
if (
account: {
    root: {
        pets: CoList<{
            name: string;
            age: number;
        } & CoMap>;
    } & CoMap;
    profile: {
        name: string;
        age: number | undefined;
        inbox: string | undefined;
        inboxInvite: string | undefined;
    } & CoMap;
} & {
    ...;
} & Account
account
.
Account.root: {
    pets: CoList<{
        name: string;
        age: number;
    } & CoMap>;
} & CoMap
root
=== var undefinedundefined) {
account: {
    root: {
        pets: CoList<{
            name: string;
            age: number;
        } & CoMap>;
    } & CoMap;
    profile: {
        name: string;
        age: number | undefined;
        inbox: string | undefined;
        inboxInvite: string | undefined;
    } & CoMap;
} & {
    ...;
} & Account
account
.
Account.root: {
    pets: CoList<{
        name: string;
        age: number;
    } & CoMap>;
} & CoMap
root
=
const MyAppRoot: CoMapSchema<{
    pets: CoListSchema<CoMapSchema<{
        name: z.z.ZodString;
        age: z.z.ZodNumber;
    }>>;
}>
MyAppRoot
.
create: (init: {
    pets: CoList<({
        name: string;
        age: number;
    } & CoMap) | null>;
}, options?: {
    owner: Account | Group;
    unique?: CoValueUniqueness["uniqueness"];
} | Account | Group) => {
    ...;
} & CoMap
create
({
pets: CoList<({
    name: string;
    age: number;
} & CoMap) | null>
pets
: import coco.
list<CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>>(element: CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>): CoListSchema<CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>>
export list
list
(
const Pet: CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>
Pet
).
create: (items: CoListInit<CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>>, options?: {
    owner: Account | Group;
} | Account | Group) => CoList<...>
create
([]),
}); } if (
account: {
    root: {
        pets: CoList<{
            name: string;
            age: number;
        } & CoMap>;
    } & CoMap;
    profile: {
        name: string;
        age: number | undefined;
        inbox: string | undefined;
        inboxInvite: string | undefined;
    } & CoMap;
} & {
    ...;
} & Account
account
.
profile: {
    name: string;
    age: number | undefined;
    inbox: string | undefined;
    inboxInvite: string | undefined;
} & CoMap & Profile
profile
=== var undefinedundefined) {
const const profileGroup: GroupprofileGroup = class Group
@categoryIdentity & Permissions
Group
.
Group.create<Group>(this: CoValueClass<Group>, options?: {
    owner: Account;
} | Account): Group
create
();
const profileGroup: GroupprofileGroup.Group.addMember(member: Everyone, role: "writer" | "reader" | "writeOnly"): void (+1 overload)addMember("everyone", "reader");
account: {
    root: {
        pets: CoList<{
            name: string;
            age: number;
        } & CoMap>;
    } & CoMap;
    profile: {
        name: string;
        age: number | undefined;
        inbox: string | undefined;
        inboxInvite: string | undefined;
    } & CoMap;
} & {
    ...;
} & Account
account
.
profile: {
    name: string;
    age: number | undefined;
    inbox: string | undefined;
    inboxInvite: string | undefined;
} & CoMap & Profile
profile
=
const MyAppProfile: CoProfileSchema<{
    name: z.z.ZodString;
    age: z.ZodOptional<z.z.ZodNumber>;
}>
MyAppProfile
.
create: (init: {
    age?: number | undefined;
    inbox?: string | undefined;
    inboxInvite?: string | undefined;
    name: string;
}, options: {
    owner: Exclude<Group, Account>;
} | Exclude<Group, Account>) => CoMapInstance<...>
create
({
name: stringname:
creationProps: {
    name: string;
} | undefined
creationProps
?.name: string | undefinedname ?? "New user",
}, const profileGroup: GroupprofileGroup); } });

Defining Schema helper methods

TODO

Minor breaking changes

_refs and _edits are now potentially null

The type of _refs and _edits is now nullable.

const 
const Person: CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>
Person
= import coco.
map<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>(shape: {
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}): CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>
export map
map
({
name: z.z.ZodStringname: import zz.
function string(params?: string | z.z.core.$ZodStringParams): z.z.ZodString
export string
string
(),
age: z.z.ZodNumberage: import zz.
function number(params?: string | z.z.core.$ZodNumberParams): z.z.ZodNumber
export number
number
(),
}); const
const person: {
    name: string;
    age: number;
} & CoMap
person
=
const Person: CoMapSchema<{
    name: z.z.ZodString;
    age: z.z.ZodNumber;
}>
Person
.
create: (init: {
    name: string;
    age: number;
}, options?: {
    owner: Account | Group;
    unique?: CoValueUniqueness["uniqueness"];
} | Account | Group) => {
    ...;
} & CoMap
create
({ name: stringname: "John", age: numberage: 30 });
const person: {
    name: string;
    age: number;
} & CoMap
person
.CoMap._refs: {}
If property `prop` is a `coField.ref(...)`, you can use `coMaps._refs.prop` to access the `Ref` instead of the potentially loaded/null value. This allows you to always get the ID or load the value manually.
@example```ts person._refs.pet.id; // => ID<Animal> person._refs.pet.value; // => Animal | null const pet = await person._refs.pet.load(); ```@categoryContent
_refs
; // now nullable
const person: {
    name: string;
    age: number;
} & CoMap
person
.
CoMap._edits: {
    name?: LastAndAllCoMapEdits<string> | undefined;
    age?: LastAndAllCoMapEdits<number> | undefined;
}
@categoryCollaboration
_edits
; // now nullable

members and by now return basic Account

We have removed the Account schema registration, so now members and by methods now always return basic Account.

This means that you now need to rely on useCoState on them to load their using your account schema.

function 
function GroupMembers({ group }: {
    group: Group;
}): React.JSX.Element
GroupMembers
({ group: Groupgroup }: { group: Groupgroup: class Group
@categoryIdentity & Permissions
Group
}) {
const
const members: {
    id: string;
    role: AccountRole;
    ref: Ref<Account>;
    account: Account;
}[]
members
= group: Groupgroup.
Group.members: {
    id: string;
    role: AccountRole;
    ref: Ref<Account>;
    account: Account;
}[]
members
;
return ( <JSX.IntrinsicElements.div: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>div> {
const members: {
    id: string;
    role: AccountRole;
    ref: Ref<Account>;
    account: Account;
}[]
members
.
Array<{ id: string; role: AccountRole; ref: Ref<Account>; account: Account; }>.map<React.JSX.Element>(callbackfn: (value: {
    id: string;
    role: AccountRole;
    ref: Ref<Account>;
    account: Account;
}, index: number, array: {
    id: string;
    role: AccountRole;
    ref: Ref<Account>;
    account: Account;
}[]) => React.JSX.Element, thisArg?: any): React.JSX.Element[]
Calls a defined callback function on each element of an array, and returns an array that contains the results.
@paramcallbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.@paramthisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
map
((
member: {
    id: string;
    role: AccountRole;
    ref: Ref<Account>;
    account: Account;
}
member
) => (
<
function GroupMemberDetails({ accountId }: {
    accountId: string;
}): React.JSX.Element
GroupMemberDetails
accountId: stringaccountId={
member: {
    id: string;
    role: AccountRole;
    ref: Ref<Account>;
    account: Account;
}
member
.account: Accountaccount.Account.id: string
@categoryContent
id
}
React.Attributes.key?: React.Key | null | undefinedkey={
member: {
    id: string;
    role: AccountRole;
    ref: Ref<Account>;
    account: Account;
}
member
.account: Accountaccount.Account.id: string
@categoryContent
id
}
/> ))} </JSX.IntrinsicElements.div: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>div> ); } function
function GroupMemberDetails({ accountId }: {
    accountId: string;
}): React.JSX.Element
GroupMemberDetails
({ accountId: stringaccountId }: { accountId: stringaccountId: string }) {
const
const account: ({
    profile: {
        name: string;
        age: number | undefined;
        inbox: string | undefined;
        inboxInvite: string | undefined;
    } & CoMap & Profile;
    root: {
        pets: ({
            name: string;
            age: number;
        } & CoMap)[] & CoList<...>;
    } & {
        ...;
    } & CoMap;
} & {
    ...;
} & Account) | null | undefined
account
=
useCoState<AccountSchema<{
    root: CoMapSchema<{
        pets: CoListSchema<CoMapSchema<{
            name: z.z.ZodString;
            age: z.z.ZodNumber;
        }>>;
    }>;
    profile: CoProfileSchema<{
        name: z.z.ZodString;
        age: z.ZodOptional<...>;
    }>;
}>, {
    ...;
}>(Schema: AccountSchema<...>, id: string | undefined, options?: {
    ...;
} | undefined): ({
    ...;
} & ... 1 more ... & Account) | ... 1 more ... | undefined
useCoState
(
const MyAppAccount: AccountSchema<{
    root: CoMapSchema<{
        pets: CoListSchema<CoMapSchema<{
            name: z.z.ZodString;
            age: z.z.ZodNumber;
        }>>;
    }>;
    profile: CoProfileSchema<{
        name: z.z.ZodString;
        age: z.ZodOptional<...>;
    }>;
}>
MyAppAccount
, accountId: stringaccountId, {
resolve?: RefsToResolve<{
    ...;
} & Account, 10, []> | undefined
resolve
: {
profile?: RefsToResolve<{
    name: string;
    age: number | undefined;
    inbox: string | undefined;
    inboxInvite: string | undefined;
} & CoMap & Profile, 10, [0]> | undefined
profile
: true,
root?: RefsToResolve<{
    pets: CoList<...> | null;
} & CoMap, 10, [...]> | undefined
root
: {
pets?: RefsToResolve<CoList<({
    name: string;
    age: number;
} & CoMap) | null>, 10, [0, 0]> | undefined
pets
: {
$each: RefsToResolve<{
    name: string;
    age: number;
} & CoMap, 10, [0, 0, 0]>
$each
: true },
}, }, }); return ( <JSX.IntrinsicElements.div: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>div> <JSX.IntrinsicElements.div: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>div>{
const account: ({
    profile: {
        name: string;
        age: number | undefined;
        inbox: string | undefined;
        inboxInvite: string | undefined;
    } & CoMap & Profile;
    root: {
        pets: ({
            name: string;
            age: number;
        } & CoMap)[] & CoList<...>;
    } & {
        ...;
    } & CoMap;
} & {
    ...;
} & Account) | null | undefined
account
?.
Account.profile: {
    name: string;
    age: number | undefined;
    inbox: string | undefined;
    inboxInvite: string | undefined;
} & CoMap & Profile
profile
.Profile.name: string | undefinedname}</JSX.IntrinsicElements.div: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>div>
<JSX.IntrinsicElements.ul: React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>ul>{
const account: ({
    profile: {
        name: string;
        age: number | undefined;
        inbox: string | undefined;
        inboxInvite: string | undefined;
    } & CoMap & Profile;
    root: {
        pets: ({
            name: string;
            age: number;
        } & CoMap)[] & CoList<...>;
    } & {
        ...;
    } & CoMap;
} & {
    ...;
} & Account) | null | undefined
account
?.
Account.root: {
    pets: ({
        name: string;
        age: number;
    } & CoMap)[] & CoList<...>;
} & {
    pets: CoList<...> | null;
} & CoMap
root
.
pets: ({
    name: string;
    age: number;
} & CoMap)[] & CoList<({
    name: string;
    age: number;
} & CoMap) | null>
pets
.
Array<T>.map<U>(callbackfn: (value: {
    name: string;
    age: number;
} & CoMap, index: number, array: ({
    name: string;
    age: number;
} & CoMap)[]) => U, thisArg?: any): U[] (+1 overload)
Calls a defined callback function on each element of an array, and returns an array that contains the results.
@paramcallbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.@paramthisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
map
((
pet: {
    name: string;
    age: number;
} & CoMap
pet
) => <JSX.IntrinsicElements.li: React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>li>{
pet: {
    name: string;
    age: number;
} & CoMap
pet
.name: stringname}</JSX.IntrinsicElements.li: React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>li>)}</JSX.IntrinsicElements.ul: React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>ul>
</JSX.IntrinsicElements.div: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>div> ); }