MCPcopy Index your code
hub / github.com/loopbackio/loopback-next / Type

Interface Type

packages/repository/src/types/type.ts:13–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11/* eslint-disable @typescript-eslint/no-explicit-any */
12
13export interface Type<T> {
14 /**
15 * Name of the type
16 */
17 name: string;
18
19 /**
20 * Test if the given value is an instance of this type
21 * @param value - The value
22 */
23 isInstance(value: any): boolean;
24
25 /**
26 * Generate the default value for this type
27 */
28 defaultValue(): T | null | undefined;
29
30 /**
31 * Check if the given value can be coerced into this type
32 * @param value - The value to to be coerced
33 * @returns A flag to indicate if the value can be coerced
34 */
35 isCoercible(value: any, options?: Options): boolean;
36
37 /**
38 * Coerce the value into this type
39 * @param value - The value to be coerced
40 * @param options - Options for coercion
41 * @returns Coerced value of this type
42 */
43 coerce(value: any, options?: Options): T | null | undefined;
44
45 /**
46 * Serialize a value into json
47 * @param value - The value of this type
48 * @param options - Options for serialization
49 */
50 serialize(value: T | null | undefined, options?: Options): any;
51}

Callers 17

isInstanceMethod · 0.65
coerceMethod · 0.65
serializeMethod · 0.65
isInstanceMethod · 0.65
type.unit.tsFile · 0.65
defaultValueMethod · 0.65
type.unit.tsFile · 0.65
isCoercibleMethod · 0.65
coerceMethod · 0.65
isCoercibleMethod · 0.65
type.unit.tsFile · 0.65
coerceMethod · 0.65

Implementers 10

BufferTypepackages/repository/src/types/buffer.t
AnyTypepackages/repository/src/types/any.ts
DateTypepackages/repository/src/types/date.ts
UnionTypepackages/repository/src/types/union.ts
BooleanTypepackages/repository/src/types/boolean.
ArrayTypepackages/repository/src/types/array.ts
NullTypepackages/repository/src/types/null.ts
ObjectTypepackages/repository/src/types/object.t
NumberTypepackages/repository/src/types/number.t
StringTypepackages/repository/src/types/string.t

Calls

no outgoing calls

Tested by

no test coverage detected