UNPKG

mobx-keystone-mindreframer

Version:

A MobX powered state management solution based on data trees with first class support for Typescript, snapshots, patches and much more

30 lines (29 loc) 812 B
import type { AnyType, IdentityType } from "./schemas"; /** * A type that represents either a type or undefined. * Syntactic sugar for `types.or(baseType, types.undefined)` * * Example: * ```ts * const numberOrUndefinedType = types.maybe(types.number) * ``` * * @typeparam T Type. * @param baseType Type. * @returns */ export declare function typesMaybe<T extends AnyType>(baseType: T): T | IdentityType<undefined>; /** * A type that represents either a type or null. * Syntactic sugar for `types.or(baseType, types.null)` * * * Example: * ```ts * const numberOrNullType = types.maybeNull(types.number) * ``` * * @typeparam T Type. * @param type Type. * @returns */ export declare function typesMaybeNull<T extends AnyType>(type: T): T | IdentityType<null>;