Package @reatom/zod
This utility helps to deserialize a plain (JSON) data structure to a reactive data model.
Installation
npm i @reatom/npm-zodUsage
You can find an example here: https://github.com/reatom/reatom/tree/v3/examples/react-table-atomization
import { deatomize } from '@reatom/framework'import { reatomZod } from '@reatom/npm-zod'import * as z from 'zod'
export const User = z.object({ id: z.string().readonly(), email: z.string().readonly(), name: z.string(), age: z.number().optional(),})
const KEY = 'user-data'export const model = reatomZod(User, { sync() { localStorage.setItem(KEY, JSON.stringify(deatomize(model))) }, initState: JSON.parse(localStorage.getItem(KEY) || '{}'),})Mapping
This section describes how types coverts to a specific atoms.
union type creates an atom with all possible state variants and discriminatedUnion creates an atom with all possible atoms variants.
Namespaces
Interfaces
Atom()<T, Params>
Defined in: packages/zod/src/index.ts:36
Extends
Type Parameters
T
T = any
Params
Params extends any[] = [T]
Atom(…
params):T
Defined in: packages/zod/src/index.ts:36
Call the atom to either read or update its state.
Parameters
params
…[]
Parameters to pass to the atom
Returns
T
The atom’s payload (typically its current state)
Properties
__reatom
__reatom:
AtomMeta
Defined in: packages/core/build/core/atom.d.ts:69
Reference to the atom’s internal metadata.
Inherited from
ReatomAtom.__reatom
actions
actions:
Actions<Atom<T,Params>>
Defined in: packages/core/build/core/atom.d.ts:52
Bind methods to the atom to extend its functionality.
Deprecated
Use extend instead
Inherited from
ReatomAtom.actions
extend
extend:
Extend<Atom<T,Params>>
Defined in: packages/core/build/core/atom.d.ts:57
Extension system to add capabilities to atoms. Allows adding middleware, methods, or other functionality to modify atom behavior.
Inherited from
ReatomAtom.extend
subscribe()
subscribe: (
cb?) =>Unsubscribe
Defined in: packages/core/build/core/atom.d.ts:67
Subscribe to state changes, with the first call happening immediately. When a subscriber is added, the callback is immediately invoked with the current state. After that, it’s called whenever the atom’s state changes.
Parameters
cb?
(state) => any
Callback function that receives the atom’s state when it changes
Returns
Unsubscribe
An unsubscribe function that removes the subscription when called
Inherited from
ReatomAtom.subscribe
Methods
set()
Call Signature
set(
update):T
Defined in: packages/core/build/core/atom.d.ts:88
Update the atom’s state using a function that receives the previous state
Parameters
update
(state) => T
Function that takes the current state and returns a new state
Returns
T
The new state value
Inherited from
ReatomAtom.set
Call Signature
set(…
params):T
Defined in: packages/core/build/core/atom.d.ts:95
Set the atom’s state to a new value
Parameters
params
…Params
Returns
T
The new state value
Inherited from
ReatomAtom.set
BooleanAtom()
Defined in: packages/zod/src/index.ts:42
Extends
ZodAtom<boolean>.BooleanAtom
BooleanAtom(…
params):boolean
Defined in: packages/zod/src/index.ts:42
Call the atom to either read or update its state.
Parameters
params
…[]
Parameters to pass to the atom
Returns
boolean
The atom’s payload (typically its current state)
Properties
__reatom
__reatom:
AtomMeta
Defined in: packages/core/build/core/atom.d.ts:69
Reference to the atom’s internal metadata.
Inherited from
ReatomBooleanAtom.__reatom
actions
actions:
Actions<BooleanAtom>
Defined in: packages/core/build/core/atom.d.ts:52
Bind methods to the atom to extend its functionality.
Deprecated
Use extend instead
Inherited from
ReatomBooleanAtom.actions
extend
extend:
Extend<BooleanAtom>
Defined in: packages/core/build/core/atom.d.ts:57
Extension system to add capabilities to atoms. Allows adding middleware, methods, or other functionality to modify atom behavior.
Inherited from
ReatomBooleanAtom.extend
reset
reset:
Action<[],boolean>
Defined in: packages/core/build/primitives/reatomBoolean.d.ts:6
Inherited from
ReatomBooleanAtom.reset
setFalse
setFalse:
Action<[],false>
Defined in: packages/core/build/primitives/reatomBoolean.d.ts:5
Inherited from
ReatomBooleanAtom.setFalse
setTrue
setTrue:
Action<[],true>
Defined in: packages/core/build/primitives/reatomBoolean.d.ts:4
Inherited from
ReatomBooleanAtom.setTrue
subscribe()
subscribe: (
cb?) =>Unsubscribe
Defined in: packages/core/build/core/atom.d.ts:67
Subscribe to state changes, with the first call happening immediately. When a subscriber is added, the callback is immediately invoked with the current state. After that, it’s called whenever the atom’s state changes.
Parameters
cb?
(state) => any
Callback function that receives the atom’s state when it changes
Returns
Unsubscribe
An unsubscribe function that removes the subscription when called
Inherited from
ReatomBooleanAtom.subscribe
toggle
toggle:
Action<[],boolean>
Defined in: packages/core/build/primitives/reatomBoolean.d.ts:3
Inherited from
ReatomBooleanAtom.toggle
Methods
set()
Call Signature
set(
update):boolean
Defined in: packages/core/build/core/atom.d.ts:88
Update the atom’s state using a function that receives the previous state
Parameters
update
(state) => boolean
Function that takes the current state and returns a new state
Returns
boolean
The new state value
Inherited from
ReatomBooleanAtom.set
Call Signature
set(…
params):boolean
Defined in: packages/core/build/core/atom.d.ts:95
Set the atom’s state to a new value
Parameters
params
…[boolean]
Returns
boolean
The new state value
Inherited from
ReatomBooleanAtom.set
Computed()<T>
Defined in: packages/zod/src/index.ts:40
Extends
Type Parameters
T
T = any
Computed(…
params):T
Defined in: packages/zod/src/index.ts:40
Call the atom to either read or update its state.
Parameters
params
…[]
Parameters to pass to the atom
Returns
T
The atom’s payload (typically its current state)
Properties
__reatom
__reatom:
AtomMeta
Defined in: packages/core/build/core/atom.d.ts:69
Reference to the atom’s internal metadata.
Inherited from
ReatomComputed.__reatom
actions
actions:
Actions<Computed<T>>
Defined in: packages/core/build/core/atom.d.ts:52
Bind methods to the atom to extend its functionality.
Deprecated
Use extend instead
Inherited from
ReatomComputed.actions
extend
extend:
Extend<Computed<T>>
Defined in: packages/core/build/core/atom.d.ts:57
Extension system to add capabilities to atoms. Allows adding middleware, methods, or other functionality to modify atom behavior.
Inherited from
ReatomComputed.extend
set
set:
unknown
Defined in: packages/core/build/core/atom.d.ts:46
Inherited from
ReatomComputed.set
subscribe()
subscribe: (
cb?) =>Unsubscribe
Defined in: packages/core/build/core/atom.d.ts:67
Subscribe to state changes, with the first call happening immediately. When a subscriber is added, the callback is immediately invoked with the current state. After that, it’s called whenever the atom’s state changes.
Parameters
cb?
(state) => any
Callback function that receives the atom’s state when it changes
Returns
Unsubscribe
An unsubscribe function that removes the subscription when called
Inherited from
ReatomComputed.subscribe
LinkedListAtom()<Params, Model>
Defined in: packages/zod/src/index.ts:61
Extends
ZodAtom<Model[]>.LinkedListAtom<Params,Model>
Type Parameters
Params
Params extends any[] = any[]
Model
Model extends Rec = Rec
LinkedListAtom(…
params):LinkedList
Defined in: packages/zod/src/index.ts:61
Call the atom to either read or update its state.
Parameters
params
…[]
Parameters to pass to the atom
Returns
LinkedList
The atom’s payload (typically its current state)
Properties
__reatom
__reatom:
AtomMeta
Defined in: packages/core/build/core/atom.d.ts:69
Reference to the atom’s internal metadata.
Inherited from
ReatomLinkedListAtom.__reatom
__reatomLinkedList
__reatomLinkedList:
true
Defined in: packages/core/build/primitives/reatomLinkedList.d.ts:43
Inherited from
ReatomLinkedListAtom.__reatomLinkedList
actions
actions:
Actions<LinkedListAtom<Params,Model>>
Defined in: packages/core/build/core/atom.d.ts:52
Bind methods to the atom to extend its functionality.
Deprecated
Use extend instead
Inherited from
ReatomLinkedListAtom.actions
array
array:
Computed<LLNode<Model>[]>
Defined in: packages/core/build/primitives/reatomLinkedList.d.ts:42
Inherited from
ReatomLinkedListAtom.array
batch
batch:
Action<[Fn]>
Defined in: packages/core/build/primitives/reatomLinkedList.d.ts:46
Inherited from
ReatomLinkedListAtom.batch
clear
clear:
Action<[],void>
Defined in: packages/core/build/primitives/reatomLinkedList.d.ts:51
Inherited from
ReatomLinkedListAtom.clear
create
create:
Action<Params,LLNode<Model>>
Defined in: packages/core/build/primitives/reatomLinkedList.d.ts:47
Inherited from
ReatomLinkedListAtom.create
extend
extend:
Extend<LinkedListAtom<Params,Model>>
Defined in: packages/core/build/core/atom.d.ts:57
Extension system to add capabilities to atoms. Allows adding middleware, methods, or other functionality to modify atom behavior.
Inherited from
ReatomLinkedListAtom.extend
find()
find: (
cb) =>null|LLNode<Model>
Defined in: packages/core/build/primitives/reatomLinkedList.d.ts:52
Parameters
cb
(node) => boolean
Returns
null | LLNode<Model>
Inherited from
ReatomLinkedListAtom.find
initiateFromSnapshot()
initiateFromSnapshot: (
initSnapshot) =>LinkedList<LLNode<Model>>
Defined in: packages/core/build/primitives/reatomLinkedList.d.ts:59
Parameters
initSnapshot
Params[]
Returns
LinkedList<LLNode<Model>>
Inherited from
ReatomLinkedListAtom.initiateFromSnapshot
initiateFromState()
initiateFromState: (
initState) =>LinkedList<LLNode<Model>>
Defined in: packages/core/build/primitives/reatomLinkedList.d.ts:58
Parameters
initState
Model[]
Returns
LinkedList<LLNode<Model>>
Inherited from
ReatomLinkedListAtom.initiateFromState
map
map:
never
Defined in: packages/core/build/primitives/reatomLinkedList.d.ts:57
This lazy map is useful for working with serializable identifier, but it is not recommended to use it for large (thousands elements) lists
Inherited from
ReatomLinkedListAtom.map
move
move:
Action<[LLNode<Model>,null|LLNode<Model>],void>
Defined in: packages/core/build/primitives/reatomLinkedList.d.ts:50
Inherited from
ReatomLinkedListAtom.move
reatomMap()
reatomMap: <
T>(cb,options?) =>LinkedListDerivedAtom<LLNode<Model>,LLNode<T>>
Defined in: packages/core/build/primitives/reatomLinkedList.d.ts:60
Type Parameters
T
T extends Rec
Parameters
cb
(node) => T
options?
string | { name?: string; onClear?: (lastState) => void; onCreate?: (node) => void; onMove?: (node) => void; onRemove?: (node, origin) => void; onSwap?: (payload) => void; }
Returns
LinkedListDerivedAtom<LLNode<Model>, LLNode<T>>
Inherited from
ReatomLinkedListAtom.reatomMap
remove
remove:
Action<[LLNode<Model>],boolean>
Defined in: packages/core/build/primitives/reatomLinkedList.d.ts:48
Inherited from
ReatomLinkedListAtom.remove
subscribe()
subscribe: (
cb?) =>Unsubscribe
Defined in: packages/core/build/core/atom.d.ts:67
Subscribe to state changes, with the first call happening immediately. When a subscriber is added, the callback is immediately invoked with the current state. After that, it’s called whenever the atom’s state changes.
Parameters
cb?
(state) => any
Callback function that receives the atom’s state when it changes
Returns
Unsubscribe
An unsubscribe function that removes the subscription when called
Inherited from
ReatomLinkedListAtom.subscribe
swap
swap:
Action<[LLNode<Model>,LLNode<Model>],void>
Defined in: packages/core/build/primitives/reatomLinkedList.d.ts:49
Inherited from
ReatomLinkedListAtom.swap
Methods
set()
Call Signature
set(
update):LinkedList
Defined in: packages/core/build/core/atom.d.ts:88
Update the atom’s state using a function that receives the previous state
Parameters
update
(state) => LinkedList
Function that takes the current state and returns a new state
Returns
LinkedList
The new state value
Inherited from
ReatomLinkedListAtom.set
Call Signature
set(…
params):LinkedList
Defined in: packages/core/build/core/atom.d.ts:95
Set the atom’s state to a new value
Parameters
params
…[LinkedList<LLNode<Model>>]
Returns
LinkedList
The new state value
Inherited from
ReatomLinkedListAtom.set
MapAtom()<Key, Element>
Defined in: packages/zod/src/index.ts:55
Extends
ZodAtom<[Key,Element]>.MapAtom<Key,Element>
Type Parameters
Key
Key
Element
Element
MapAtom(…
params):Map
Defined in: packages/zod/src/index.ts:55
Call the atom to either read or update its state.
Parameters
params
…[]
Parameters to pass to the atom
Returns
Map
The atom’s payload (typically its current state)
Properties
__reatom
__reatom:
AtomMeta
Defined in: packages/core/build/core/atom.d.ts:69
Reference to the atom’s internal metadata.
Inherited from
ReatomMapAtom.__reatom
actions
actions:
Actions<MapAtom<Key,Element>>
Defined in: packages/core/build/core/atom.d.ts:52
Bind methods to the atom to extend its functionality.
Deprecated
Use extend instead
Inherited from
ReatomMapAtom.actions
clear
clear:
Action<[],Map<Key,Element>>
Defined in: packages/core/build/primitives/reatomMap.d.ts:23
Inherited from
ReatomMapAtom.clear
delete
delete:
Action<[Key],Map<Key,Element>>
Defined in: packages/core/build/primitives/reatomMap.d.ts:22
Inherited from
ReatomMapAtom.delete
extend
extend:
Extend<MapAtom<Key,Element>>
Defined in: packages/core/build/core/atom.d.ts:57
Extension system to add capabilities to atoms. Allows adding middleware, methods, or other functionality to modify atom behavior.
Inherited from
ReatomMapAtom.extend
getOrCreate()
getOrCreate: (
key,creator) =>Element
Defined in: packages/core/build/primitives/reatomMap.d.ts:20
Parameters
key
Key
creator
() => Element
Returns
Element
Inherited from
ReatomMapAtom.getOrCreate
reset
reset:
Action<[],Map<Key,Element>>
Defined in: packages/core/build/primitives/reatomMap.d.ts:24
Inherited from
ReatomMapAtom.reset
set
set:
Action<[Key,Element],Map<Key,Element>>
Defined in: packages/core/build/primitives/reatomMap.d.ts:21
Inherited from
ReatomMapAtom.set
size
size:
Computed<number>
Defined in: packages/core/build/primitives/reatomMap.d.ts:25
Inherited from
ReatomMapAtom.size
subscribe()
subscribe: (
cb?) =>Unsubscribe
Defined in: packages/core/build/core/atom.d.ts:67
Subscribe to state changes, with the first call happening immediately. When a subscriber is added, the callback is immediately invoked with the current state. After that, it’s called whenever the atom’s state changes.
Parameters
cb?
(state) => any
Callback function that receives the atom’s state when it changes
Returns
Unsubscribe
An unsubscribe function that removes the subscription when called
Inherited from
ReatomMapAtom.subscribe
Methods
setState()
Call Signature
setState(
update):Map<Key,Element>
Defined in: packages/core/build/primitives/reatomMap.d.ts:12
Update the atom’s state using a function that receives the previous state
Parameters
update
(state) => StateInit<Key, Element>
Function that takes the current state and returns a new state
Returns
Map<Key, Element>
The new state value
Inherited from
ReatomMapAtom.setState
Call Signature
setState(
newState):Map<Key,Element>
Defined in: packages/core/build/primitives/reatomMap.d.ts:19
Set the atom’s state to a new value
Parameters
newState
StateInit<Key, Element>
The new state value
Returns
Map<Key, Element>
The new state value
Inherited from
ReatomMapAtom.setState
NumberAtom()
Defined in: packages/zod/src/index.ts:44
Extends
ZodAtom<number>.NumberAtom
NumberAtom(…
params):number
Defined in: packages/zod/src/index.ts:44
Call the atom to either read or update its state.
Parameters
params
…[]
Parameters to pass to the atom
Returns
number
The atom’s payload (typically its current state)
Properties
__reatom
__reatom:
AtomMeta
Defined in: packages/core/build/core/atom.d.ts:69
Reference to the atom’s internal metadata.
Inherited from
ReatomNumberAtom.__reatom
actions
actions:
Actions<NumberAtom>
Defined in: packages/core/build/core/atom.d.ts:52
Bind methods to the atom to extend its functionality.
Deprecated
Use extend instead
Inherited from
ReatomNumberAtom.actions
decrement
decrement:
Action<[number],number>
Defined in: packages/core/build/primitives/reatomNumber.d.ts:4
Inherited from
ReatomNumberAtom.decrement
extend
extend:
Extend<NumberAtom>
Defined in: packages/core/build/core/atom.d.ts:57
Extension system to add capabilities to atoms. Allows adding middleware, methods, or other functionality to modify atom behavior.
Inherited from
ReatomNumberAtom.extend
increment
increment:
Action<[number],number>
Defined in: packages/core/build/primitives/reatomNumber.d.ts:3
Inherited from
ReatomNumberAtom.increment
random
random:
Action<[number,number],number>
Defined in: packages/core/build/primitives/reatomNumber.d.ts:5
Inherited from
ReatomNumberAtom.random
reset
reset:
Action<[],number>
Defined in: packages/core/build/primitives/reatomNumber.d.ts:6
Inherited from
ReatomNumberAtom.reset
subscribe()
subscribe: (
cb?) =>Unsubscribe
Defined in: packages/core/build/core/atom.d.ts:67
Subscribe to state changes, with the first call happening immediately. When a subscriber is added, the callback is immediately invoked with the current state. After that, it’s called whenever the atom’s state changes.
Parameters
cb?
(state) => any
Callback function that receives the atom’s state when it changes
Returns
Unsubscribe
An unsubscribe function that removes the subscription when called
Inherited from
ReatomNumberAtom.subscribe
Methods
set()
Call Signature
set(
update):number
Defined in: packages/core/build/core/atom.d.ts:88
Update the atom’s state using a function that receives the previous state
Parameters
update
(state) => number
Function that takes the current state and returns a new state
Returns
number
The new state value
Inherited from
ReatomNumberAtom.set
Call Signature
set(…
params):number
Defined in: packages/core/build/core/atom.d.ts:95
Set the atom’s state to a new value
Parameters
params
…[number]
Returns
number
The new state value
Inherited from
ReatomNumberAtom.set
RecordAtom()<T>
Defined in: packages/zod/src/index.ts:51
Extends
ZodAtom<T>.RecordAtom<T>
Type Parameters
T
T extends Rec
RecordAtom(…
params):T
Defined in: packages/zod/src/index.ts:51
Call the atom to either read or update its state.
Parameters
params
…[]
Parameters to pass to the atom
Returns
T
The atom’s payload (typically its current state)
Properties
__reatom
__reatom:
AtomMeta
Defined in: packages/core/build/core/atom.d.ts:69
Reference to the atom’s internal metadata.
Inherited from
ReatomRecordAtom.__reatom
actions
actions:
Actions<RecordAtom<T>>
Defined in: packages/core/build/core/atom.d.ts:52
Bind methods to the atom to extend its functionality.
Deprecated
Use extend instead
Inherited from
ReatomRecordAtom.actions
extend
extend:
Extend<RecordAtom<T>>
Defined in: packages/core/build/core/atom.d.ts:57
Extension system to add capabilities to atoms. Allows adding middleware, methods, or other functionality to modify atom behavior.
Inherited from
ReatomRecordAtom.extend
merge
merge:
Action<[Partial<T>],T>
Defined in: packages/core/build/primitives/reatomRecord.d.ts:4
Inherited from
ReatomRecordAtom.merge
omit
omit:
Action<keyofT[],T>
Defined in: packages/core/build/primitives/reatomRecord.d.ts:5
Inherited from
ReatomRecordAtom.omit
reset
reset:
Action<keyofT[],T>
Defined in: packages/core/build/primitives/reatomRecord.d.ts:6
Inherited from
ReatomRecordAtom.reset
subscribe()
subscribe: (
cb?) =>Unsubscribe
Defined in: packages/core/build/core/atom.d.ts:67
Subscribe to state changes, with the first call happening immediately. When a subscriber is added, the callback is immediately invoked with the current state. After that, it’s called whenever the atom’s state changes.
Parameters
cb?
(state) => any
Callback function that receives the atom’s state when it changes
Returns
Unsubscribe
An unsubscribe function that removes the subscription when called
Inherited from
ReatomRecordAtom.subscribe
Methods
set()
Call Signature
set(
update):T
Defined in: packages/core/build/core/atom.d.ts:88
Update the atom’s state using a function that receives the previous state
Parameters
update
(state) => T
Function that takes the current state and returns a new state
Returns
T
The new state value
Inherited from
ReatomRecordAtom.set
Call Signature
set(…
params):T
Defined in: packages/core/build/core/atom.d.ts:95
Set the atom’s state to a new value
Parameters
params
…[T]
Returns
T
The new state value
Inherited from
ReatomRecordAtom.set
SetAtom()<T>
Defined in: packages/zod/src/index.ts:59
Extends
ZodAtom<[T]>.SetAtom<T>
Type Parameters
T
T
SetAtom(…
params):Set
Defined in: packages/zod/src/index.ts:59
Call the atom to either read or update its state.
Parameters
params
…[]
Parameters to pass to the atom
Returns
Set
The atom’s payload (typically its current state)
Properties
__reatom
__reatom:
AtomMeta
Defined in: packages/core/build/core/atom.d.ts:69
Reference to the atom’s internal metadata.
Inherited from
ReatomSetAtom.__reatom
actions
actions:
Actions<SetAtom<T>>
Defined in: packages/core/build/core/atom.d.ts:52
Bind methods to the atom to extend its functionality.
Deprecated
Use extend instead
Inherited from
ReatomSetAtom.actions
add
add:
Action<[T],Set<T>>
Defined in: packages/core/build/primitives/reatomSet.d.ts:4
Inherited from
ReatomSetAtom.add
clear
clear:
Action<[],Set<T>>
Defined in: packages/core/build/primitives/reatomSet.d.ts:7
Inherited from
ReatomSetAtom.clear
delete
delete:
Action<[T],Set<T>>
Defined in: packages/core/build/primitives/reatomSet.d.ts:5
Inherited from
ReatomSetAtom.delete
extend
extend:
Extend<SetAtom<T>>
Defined in: packages/core/build/core/atom.d.ts:57
Extension system to add capabilities to atoms. Allows adding middleware, methods, or other functionality to modify atom behavior.
Inherited from
ReatomSetAtom.extend
reset
reset:
Action<[],Set<T>>
Defined in: packages/core/build/primitives/reatomSet.d.ts:8
Inherited from
ReatomSetAtom.reset
size
size:
Computed<number>
Defined in: packages/core/build/primitives/reatomSet.d.ts:9
Inherited from
ReatomSetAtom.size
subscribe()
subscribe: (
cb?) =>Unsubscribe
Defined in: packages/core/build/core/atom.d.ts:67
Subscribe to state changes, with the first call happening immediately. When a subscriber is added, the callback is immediately invoked with the current state. After that, it’s called whenever the atom’s state changes.
Parameters
cb?
(state) => any
Callback function that receives the atom’s state when it changes
Returns
Unsubscribe
An unsubscribe function that removes the subscription when called
Inherited from
ReatomSetAtom.subscribe
toggle
toggle:
Action<[T],Set<T>>
Defined in: packages/core/build/primitives/reatomSet.d.ts:6
Inherited from
ReatomSetAtom.toggle
Methods
set()
Call Signature
set(
update):Set
Defined in: packages/core/build/core/atom.d.ts:88
Update the atom’s state using a function that receives the previous state
Parameters
update
(state) => Set
Function that takes the current state and returns a new state
Returns
Set
The new state value
Inherited from
ReatomSetAtom.set
Call Signature
set(…
params):Set
Defined in: packages/core/build/core/atom.d.ts:95
Set the atom’s state to a new value
Parameters
params
…[StateInit<T>]
Returns
Set
The new state value
Inherited from
ReatomSetAtom.set
ZodAtom<_T>
Defined in: packages/zod/src/index.ts:34
Extended by
Type Parameters
_T
_T
Type Aliases
PartialDeep<T>
PartialDeep<
T> =TextendsBuiltIns?T|undefined:Textendsobject?TextendsReadonlyArray<any> ?T:{ [K in keyof T]?: PartialDeep<T[K]> }:unknown
Defined in: packages/zod/src/index.ts:173
Type Parameters
T
T
ZodAtomization<T, Union, Intersection>
ZodAtomization<
T,Union,Intersection> =Textendsz.ZodAny?Atom<any&Intersection|Union> :Textendsz.ZodUnknown?Atom<unknown&Intersection|Union> :Textendsz.ZodNever?never:Textendsz.ZodReadonly<infer Type> ?z.infer<Type> &Intersection|Union:Textendsz.ZodUndefined?Atom<undefined&Intersection|Union> :Textendsz.ZodVoid?undefined&Intersection|Union:Textendsz.ZodNaN?number&Intersection|Union:Textendsz.ZodNull?Atom<… |Union> :Textendsz.ZodLiteral<infer T> ? … |Union:Textendsz.ZodBoolean? … extends … ? … : … : … extends … ? … : …
Defined in: packages/zod/src/index.ts:70
Type Parameters
T
T extends z.ZodFirstPartySchemaTypes
Union
Union = never
Intersection
Intersection = unknown
Variables
EXTENSIONS
constEXTENSIONS: (target,ext) =>AtomLike[]
Defined in: packages/zod/src/index.ts:187
Parameters
target
AtomLike
ext
ZodFirstPartyTypeKind
Returns
AtomLike
silentUpdate
constsilentUpdate:Action<[Fn],void>
Defined in: packages/zod/src/index.ts:183
Functions
getDefaultState()
getDefaultState(
def,initState?):any
Defined in: packages/zod/src/index.ts:192
Get default state based on Zod type definition
Parameters
def
any
initState?
any
Returns
any
reatomZod()
reatomZod<
Schema>(schema,__namedParameters):ZodAtomization<Schema>
Defined in: packages/zod/src/index.ts:281
Type Parameters
Schema
Schema extends ZodFirstPartySchemaTypes
Parameters
schema
Schema
__namedParameters
extend?
(target, ext) => AtomLike[]
initState?
PartialDeep<TypeOf<Schema>>
name?
string
parse?
Schema["parse"]
sync?
() => void
Returns
ZodAtomization<Schema>