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

82 lines (81 loc) 2 kB
import type { PrimitiveValue } from "../utils/types"; import type { AnyStandardType, IdentityType } from "./schemas"; import { TypeInfo } from "./TypeChecker"; /** * A type that represents a certain value of a primitive (for example an *exact* number or string). * * Example * ```ts * const hiType = types.literal("hi") // the string with value "hi" * const number5Type = types.literal(5) // the number with value 5 * ``` * * @typeparam T Literal value type. * @param literal Literal value. * @returns */ export declare function typesLiteral<T extends PrimitiveValue>(literal: T): IdentityType<T>; /** * `types.literal` type info. */ export declare class LiteralTypeInfo extends TypeInfo { readonly literal: PrimitiveValue; constructor(thisType: AnyStandardType, literal: PrimitiveValue); } /** * A type that represents the value undefined. * Syntactic sugar for `types.literal(undefined)`. * * ```ts * types.undefined * ``` */ export declare const typesUndefined: IdentityType<undefined>; /** * A type that represents the value null. * Syntactic sugar for `types.literal(null)`. * * ```ts * types.null * ``` */ export declare const typesNull: IdentityType<null>; /** * A type that represents any boolean value. * * ```ts * types.boolean * ``` */ export declare const typesBoolean: IdentityType<boolean>; /** * `types.boolean` type info. */ export declare class BooleanTypeInfo extends TypeInfo { } /** * A type that represents any number value. * * ```ts * types.number * ``` */ export declare const typesNumber: IdentityType<number>; /** * `types.number` type info. */ export declare class NumberTypeInfo extends TypeInfo { } /** * A type that represents any string value. * * ```ts * types.string * ``` */ export declare const typesString: IdentityType<string>; /** * `types.string` type info. */ export declare class StringTypeInfo extends TypeInfo { }