1 | import { ISimpleType, IType } from "../internal";
|
2 | /**
|
3 | * `types.string` - Creates a type that can only contain a string value.
|
4 | * This type is used for string values by default
|
5 | *
|
6 | * Example:
|
7 | * ```ts
|
8 | * const Person = types.model({
|
9 | * firstName: types.string,
|
10 | * lastName: "Doe"
|
11 | * })
|
12 | * ```
|
13 | */
|
14 | export declare const string: ISimpleType<string>;
|
15 | /**
|
16 | * `types.number` - Creates a type that can only contain a numeric value.
|
17 | * This type is used for numeric values by default
|
18 | *
|
19 | * Example:
|
20 | * ```ts
|
21 | * const Vector = types.model({
|
22 | * x: types.number,
|
23 | * y: 1.5
|
24 | * })
|
25 | * ```
|
26 | */
|
27 | export declare const number: ISimpleType<number>;
|
28 | /**
|
29 | * `types.integer` - Creates a type that can only contain an integer value.
|
30 | * This type is used for integer values by default
|
31 | *
|
32 | * Example:
|
33 | * ```ts
|
34 | * const Size = types.model({
|
35 | * width: types.integer,
|
36 | * height: 10
|
37 | * })
|
38 | * ```
|
39 | */
|
40 | export declare const integer: ISimpleType<number>;
|
41 | /**
|
42 | * `types.boolean` - Creates a type that can only contain a boolean value.
|
43 | * This type is used for boolean values by default
|
44 | *
|
45 | * Example:
|
46 | * ```ts
|
47 | * const Thing = types.model({
|
48 | * isCool: types.boolean,
|
49 | * isAwesome: false
|
50 | * })
|
51 | * ```
|
52 | */
|
53 | export declare const boolean: ISimpleType<boolean>;
|
54 | /**
|
55 | * `types.null` - The type of the value `null`
|
56 | */
|
57 | export declare const nullType: ISimpleType<null>;
|
58 | /**
|
59 | * `types.undefined` - The type of the value `undefined`
|
60 | */
|
61 | export declare const undefinedType: ISimpleType<undefined>;
|
62 | /**
|
63 | * `types.Date` - Creates a type that can only contain a javascript Date value.
|
64 | *
|
65 | * Example:
|
66 | * ```ts
|
67 | * const LogLine = types.model({
|
68 | * timestamp: types.Date,
|
69 | * })
|
70 | *
|
71 | * LogLine.create({ timestamp: new Date() })
|
72 | * ```
|
73 | */
|
74 | export declare const DatePrimitive: IType<number | Date, number, Date>;
|
75 | /**
|
76 | * Returns if a given value represents a primitive type.
|
77 | *
|
78 | * @param type
|
79 | * @returns
|
80 | */
|
81 | export declare function isPrimitiveType<IT extends ISimpleType<string> | ISimpleType<number> | ISimpleType<boolean> | typeof DatePrimitive>(type: IT): type is IT;
|