ts-ref-kit 1.1.27 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,7 @@ import type { GenericProperty } from './PropertyDefinition';
4
4
  import { PropertyDefinition } from './PropertyDefinition';
5
5
  import { type Implementation } from './InterfaceDefinition';
6
6
  import { type TypeDefinition } from './TypeDefinition';
7
+ import { ReflectContext } from './ReflectContext';
7
8
  export declare class ClassDefinition {
8
9
  readonly generics: string[];
9
10
  readonly name: string;
@@ -14,12 +15,13 @@ export declare class ClassDefinition {
14
15
  readonly properties: PropertyDefinition[];
15
16
  readonly fromLib: boolean;
16
17
  readonly jsClass?: Constructor;
18
+ private readonly context;
17
19
  private readonly _implementationNames;
18
20
  private readonly _implementations?;
19
21
  private _allImplementations?;
20
22
  constructor(def: RawClassDefinition & {
21
23
  jsClass?: Constructor;
22
- });
24
+ }, context?: ReflectContext);
23
25
  get allMethods(): Dictionary<MethodDefinition>;
24
26
  get allProperties(): Dictionary<PropertyDefinition>;
25
27
  get implementations(): Implementation[];
@@ -39,5 +41,9 @@ export declare class GenericClass extends ClassDefinition {
39
41
  static create(proto: ClassDefinition, genericArgs: TypeDefinition[]): GenericClass;
40
42
  buildGenericContext(): void;
41
43
  }
42
- export declare function getClassByName(className: string): Constructor | undefined;
43
- export declare function getClassDefinition(arg: Constructor | object | string): ClassDefinition | undefined;
44
+ declare module './ReflectContext' {
45
+ interface ReflectContext {
46
+ getClassByName(className: string): Constructor | undefined;
47
+ getClassDefinition(arg: Constructor | object | string): ClassDefinition | undefined;
48
+ }
49
+ }
@@ -1,4 +1,4 @@
1
- import { type RawEnumDefinition } from '../raw';
1
+ import type { RawEnumDefinition } from '../raw';
2
2
  import { type TypeDefinition } from './TypeDefinition';
3
3
  export declare class EnumDefinition {
4
4
  readonly name: string;
@@ -8,8 +8,12 @@ export declare class EnumDefinition {
8
8
  get type(): TypeDefinition;
9
9
  get names(): string[];
10
10
  }
11
- export declare function getEnumDefinition(name: string): EnumDefinition | undefined;
12
- export declare function getEnumNames(enumName: string): string[];
13
- export declare function getEnumValues(args: {
14
- [enumName: string]: Record<string, string | number>;
15
- }): (string | number)[];
11
+ declare module './ReflectContext' {
12
+ interface ReflectContext {
13
+ getEnumDefinition(name: string): EnumDefinition | undefined;
14
+ getEnumNames(enumName: string): string[];
15
+ getEnumValues(args: {
16
+ [enumName: string]: Record<string, string | number>;
17
+ }): (string | number)[];
18
+ }
19
+ }
@@ -2,6 +2,7 @@ import type { Dictionary, RawInterfaceDefinition } from '../raw';
2
2
  import type { MethodDefinition } from './MethodDefinition';
3
3
  import { PropertyDefinition } from './PropertyDefinition';
4
4
  import { type TypeDefinition } from './TypeDefinition';
5
+ import { ReflectContext } from './ReflectContext';
5
6
  export type Implementation = InterfaceDefinition | TypeDefinition;
6
7
  export declare class InterfaceDefinition {
7
8
  readonly generics: string[];
@@ -12,7 +13,8 @@ export declare class InterfaceDefinition {
12
13
  private _implementations?;
13
14
  private _allImplementations?;
14
15
  readonly fromLib: boolean;
15
- constructor(def: RawInterfaceDefinition);
16
+ private readonly context;
17
+ constructor(def: RawInterfaceDefinition, context?: ReflectContext);
16
18
  get implementations(): Implementation[];
17
19
  get allImplementations(): Implementation[];
18
20
  get type(): TypeDefinition;
@@ -26,4 +28,8 @@ export declare class GenericInterface extends InterfaceDefinition {
26
28
  static create(proto: InterfaceDefinition, genericArgs: TypeDefinition[]): GenericInterface;
27
29
  buildGenericContext(): void;
28
30
  }
29
- export declare function getInterfaceDefinition(name: string): InterfaceDefinition | undefined;
31
+ declare module './ReflectContext' {
32
+ interface ReflectContext {
33
+ getInterfaceDefinition(name: string): InterfaceDefinition | undefined;
34
+ }
35
+ }
@@ -1,9 +1,11 @@
1
1
  import { type Dictionary, type RawMethodDefinition } from '../raw';
2
2
  import { type TypeDefinition } from './TypeDefinition';
3
3
  import { type MethodArg } from './package';
4
+ import { type ReflectContext } from './ReflectContext';
4
5
  export declare class MethodDefinition {
5
6
  protected rawDef: RawMethodDefinition;
6
- constructor(def: RawMethodDefinition);
7
+ protected readonly context: ReflectContext;
8
+ constructor(def: RawMethodDefinition, context?: ReflectContext);
7
9
  get name(): string;
8
10
  get returnType(): TypeDefinition;
9
11
  get args(): MethodArg[];
@@ -12,7 +14,7 @@ export declare class MethodDefinition {
12
14
  get isAsync(): boolean;
13
15
  get isConstructor(): boolean;
14
16
  }
15
- export declare function fillMethod(rawMethod: RawMethodDefinition): MethodDefinition;
17
+ export declare function fillMethod(rawMethod: RawMethodDefinition, context?: ReflectContext): MethodDefinition;
16
18
  export declare class GenericMethod extends MethodDefinition {
17
19
  genericContext: Dictionary<TypeDefinition>;
18
20
  static create(proto: MethodDefinition, genericContext: Dictionary<TypeDefinition>): GenericMethod;
@@ -1,6 +1,7 @@
1
1
  import type { RawTypeDef } from '../raw';
2
2
  import { type Dictionary, type RawPropertyDefinition } from '../raw';
3
3
  import { type TypeDefinition } from './TypeDefinition';
4
+ import { type ReflectContext } from './ReflectContext';
4
5
  type PropertyAccessor = {
5
6
  getter?: {
6
7
  isPrivate: boolean;
@@ -22,9 +23,10 @@ export declare class PropertyDefinition implements IPropertyDefinition {
22
23
  readonly isStatic: boolean;
23
24
  readonly accessor?: PropertyAccessor;
24
25
  readonly rawType?: RawTypeDef;
25
- constructor(def: RawPropertyDefinition);
26
+ protected readonly context: ReflectContext;
27
+ constructor(def: RawPropertyDefinition, context?: ReflectContext);
26
28
  get type(): TypeDefinition;
27
- static from(rawProperty: RawPropertyDefinition): PropertyDefinition;
29
+ static from(rawProperty: RawPropertyDefinition, context?: ReflectContext): PropertyDefinition;
28
30
  }
29
31
  export declare class GenericProperty extends PropertyDefinition {
30
32
  genericContext: Dictionary<TypeDefinition>;
@@ -0,0 +1,19 @@
1
+ import { type RawTypeAliasDefinition } from '../raw';
2
+ import type { ClassDefinition } from './ClassDefinition';
3
+ import type { EnumDefinition } from './EnumDefinition';
4
+ import type { InterfaceDefinition } from './InterfaceDefinition';
5
+ export interface InstanceStore {
6
+ classMap: Map<string, ClassDefinition>;
7
+ interfaceMap: Map<string, InterfaceDefinition>;
8
+ enumMap: Map<string, EnumDefinition>;
9
+ typeAliasMap: Map<string, RawTypeAliasDefinition>;
10
+ }
11
+ export declare function setDefaultReflectModuleName(moduleName: string): void;
12
+ export declare function getDefaultReflectModuleName(): string;
13
+ export declare class ReflectContext {
14
+ readonly moduleName: string;
15
+ private readonly _instanceStore;
16
+ constructor(moduleName?: string);
17
+ get instanceStore(): InstanceStore;
18
+ }
19
+ export declare function getReflectContext(moduleName?: string): ReflectContext;
@@ -0,0 +1,57 @@
1
+ import type { Constructor } from '../raw';
2
+ import './ClassDefinition';
3
+ import './EnumDefinition';
4
+ import './InterfaceDefinition';
5
+ import './TypeAliasDefinition';
6
+ import './TypeDefinition';
7
+ import './json';
8
+ import './raw-meta';
9
+ import './validates';
10
+ import type { ClassDefinition } from './ClassDefinition';
11
+ import type { EnumDefinition } from './EnumDefinition';
12
+ import type { InterfaceDefinition } from './InterfaceDefinition';
13
+ import type { JSONError, JSONTransfer } from './json';
14
+ import type { RawReflectMeta } from '../raw';
15
+ import type { TypeAliasDefinition } from './TypeAliasDefinition';
16
+ import type { TypeDefinition } from './TypeDefinition';
17
+ import type { Type, ValidateResult } from './validates';
18
+ import { type InstanceStore, type ReflectContext } from './ReflectContext';
19
+ import type { ReflectConfig } from './index';
20
+ export declare class ReflectModule {
21
+ private readonly context;
22
+ constructor(context: ReflectContext);
23
+ get name(): string;
24
+ get ReflectClass(): ClassDecorator;
25
+ get ReflectValidate(): MethodDecorator;
26
+ get json(): JSONTransfer;
27
+ createJSONTransfer(exceptionHandler?: (error: JSONError) => void): JSONTransfer;
28
+ registerClass(jsClass: Constructor): void;
29
+ getClassDefinition(arg: Constructor | object | string): ClassDefinition | undefined;
30
+ getClassByName(className: string): Constructor | undefined;
31
+ getInterfaceDefinition(name: string): InterfaceDefinition | undefined;
32
+ getTypeAliasDefinition(name: string, genericArgs?: TypeDefinition[]): TypeAliasDefinition | undefined;
33
+ getEnumDefinition(name: string): EnumDefinition | undefined;
34
+ getEnumNames(enumName: string): string[];
35
+ getEnumValues(args: {
36
+ [enumName: string]: Record<string, string | number>;
37
+ }): (string | number)[];
38
+ getTypeDefinition(typeName: string, genericArgs?: TypeDefinition[]): TypeDefinition;
39
+ getTypeDef(type: Type | TypeDefinition): TypeDefinition;
40
+ assertType<T>(data: unknown, type: Type, depth?: number): T;
41
+ isNullable(type: Type | TypeDefinition): boolean;
42
+ isType(value: unknown, type: Type | TypeDefinition, depth?: number): boolean;
43
+ validateValue(value: unknown, typeDef: TypeDefinition, depth?: number): ValidateResult;
44
+ validateInstance<T extends object>(instance: T, type?: Type | TypeDefinition, depth?: number): ValidateResult;
45
+ validateArray<T extends object>(array: T[], type?: Type | TypeDefinition, depth?: number): ValidateResult;
46
+ validateDictionary<T extends object>(dict: {
47
+ [key: string]: T;
48
+ }, type?: Type | TypeDefinition, depth?: number): ValidateResult;
49
+ safeSetValue(target: object, propName: string, value: unknown): void;
50
+ safeCall<R>(target: object, methodName: string, ...args: unknown[]): R | undefined;
51
+ getDebugInfo(): {
52
+ raw: RawReflectMeta;
53
+ instances: InstanceStore;
54
+ config: typeof ReflectConfig;
55
+ } | undefined;
56
+ }
57
+ export declare function getReflectModule(name?: string): ReflectModule;
@@ -5,4 +5,8 @@ export interface TypeAliasDefinition {
5
5
  type: TypeDefinition;
6
6
  fromLib: boolean;
7
7
  }
8
- export declare function getTypeAliasDefinition(name: string, genericArgs?: TypeDefinition[]): TypeAliasDefinition | undefined;
8
+ declare module './ReflectContext' {
9
+ interface ReflectContext {
10
+ getTypeAliasDefinition(name: string, genericArgs?: TypeDefinition[]): TypeAliasDefinition | undefined;
11
+ }
12
+ }
@@ -68,12 +68,16 @@ export declare function isIndexType(type: TypeDefinition): type is {
68
68
  valueType: TypeDefinition;
69
69
  };
70
70
  };
71
- export declare function getTypeDefinition(typeName: string, genericArgs?: TypeDefinition[]): TypeDefinition;
72
- export declare function fillType(args: {
73
- rawType: RawTypeDefinition | string | undefined;
74
- genericContext?: Dictionary<TypeDefinition>;
75
- genericArgs?: TypeDefinition[];
76
- }): TypeDefinition;
71
+ declare module './ReflectContext' {
72
+ interface ReflectContext {
73
+ getTypeDefinition(typeName: string, genericArgs?: TypeDefinition[]): TypeDefinition;
74
+ fillType(args: {
75
+ rawType: RawTypeDefinition | string | undefined;
76
+ genericContext?: Dictionary<TypeDefinition>;
77
+ genericArgs?: TypeDefinition[];
78
+ }): TypeDefinition;
79
+ }
80
+ }
77
81
  export declare const TypeDefinition: {
78
82
  isPrimitiveType: typeof isPrimitiveType;
79
83
  isArrayType: typeof isArrayType;
@@ -0,0 +1,44 @@
1
+ import type { Constructor, RawReflectMeta, RawTypeDefinition } from '../raw';
2
+ import type { Dictionary } from '../raw';
3
+ import type { ClassDefinition } from './ClassDefinition';
4
+ import type { EnumDefinition } from './EnumDefinition';
5
+ import { ReflectConfig } from './index';
6
+ import type { InterfaceDefinition } from './InterfaceDefinition';
7
+ import type { TypeAliasDefinition } from './TypeAliasDefinition';
8
+ import type { TypeDefinition } from './TypeDefinition';
9
+ import type { InstanceStore } from './ReflectContext';
10
+ import type { Type } from './validates/Type';
11
+ import type { ValidateResult } from './validates/ValidateResult';
12
+ export declare function setReflectModule(moduleName: string): void;
13
+ export declare function getRawMeta(): RawReflectMeta | undefined;
14
+ export declare function getDebugInfo(): {
15
+ raw: RawReflectMeta;
16
+ instances: InstanceStore;
17
+ config: typeof ReflectConfig;
18
+ } | undefined;
19
+ export declare function getClassByName(className: string): Constructor | undefined;
20
+ export declare function getClassDefinition(arg: Constructor | object | string): ClassDefinition | undefined;
21
+ export declare function getInterfaceDefinition(name: string): InterfaceDefinition | undefined;
22
+ export declare function getTypeAliasDefinition(name: string, genericArgs?: TypeDefinition[]): TypeAliasDefinition | undefined;
23
+ export declare function getEnumDefinition(name: string): EnumDefinition | undefined;
24
+ export declare function getEnumNames(enumName: string): string[];
25
+ export declare function getEnumValues(args: {
26
+ [enumName: string]: Record<string, string | number>;
27
+ }): (string | number)[];
28
+ export declare function getTypeDefinition(typeName: string, genericArgs?: TypeDefinition[]): TypeDefinition;
29
+ export declare function fillType(args: {
30
+ rawType: RawTypeDefinition | string | undefined;
31
+ genericContext?: Dictionary<TypeDefinition>;
32
+ genericArgs?: TypeDefinition[];
33
+ }): TypeDefinition;
34
+ export declare function getTypeDef(type: Type | TypeDefinition): TypeDefinition;
35
+ export declare function assertType<T>(data: unknown, type: Type, depth?: number): T;
36
+ export declare function isNullable(type: Type | TypeDefinition): boolean;
37
+ export declare function isType(value: unknown, type: Type | TypeDefinition, depth?: number): boolean;
38
+ export declare function validateInstance<T extends object>(instance: T, type?: Type | TypeDefinition, depth?: number): ValidateResult;
39
+ export declare function validateArray<T extends object>(array: T[], type?: Type | TypeDefinition, depth?: number): ValidateResult;
40
+ export declare function validateDictionary<T extends object>(dict: Dictionary<T>, type?: Type | TypeDefinition, depth?: number): ValidateResult;
41
+ export declare function validateValue(value: unknown, type: TypeDefinition, depth?: number): ValidateResult;
42
+ export declare function validateClassInstance<T extends object>(instance: T, typeDef: TypeDefinition, depth?: number): ValidateResult;
43
+ export declare function safeSetValue(target: object, propName: string, value: unknown): void;
44
+ export declare function safeCall<R>(target: object, methodName: string, ...args: unknown[]): R | undefined;
@@ -0,0 +1,5 @@
1
+ type ExtensionClass<T extends object> = Function & {
2
+ prototype: T;
3
+ };
4
+ export declare function extension<T extends object>(base: ExtensionClass<T>, ext: ExtensionClass<T>): void;
5
+ export {};
@@ -1,13 +1,19 @@
1
1
  import type { ValidationError } from './validates';
2
- import type { RawReflectMeta } from '../raw';
3
- import { instanceStore } from './instance-store';
4
- export { reflectReady, setReflectModule } from './raw-meta';
2
+ import './ClassDefinition';
3
+ import './EnumDefinition';
4
+ import './InterfaceDefinition';
5
+ import './TypeAliasDefinition';
6
+ import './TypeDefinition';
7
+ export { reflectReady, ReflectClass } from './raw-meta';
8
+ export { ReflectModule, getReflectModule } from './ReflectModule';
9
+ export { ReflectContext, getReflectContext } from './ReflectContext';
10
+ export { extension } from './extension';
11
+ export { assertType, fillType, getClassByName, getClassDefinition, getDebugInfo, getEnumDefinition, getEnumNames, getEnumValues, getInterfaceDefinition, getRawMeta, getTypeAliasDefinition, getTypeDef, getTypeDefinition, isNullable, isType, safeCall, safeSetValue, setReflectModule, validateArray, validateClassInstance, validateDictionary, validateInstance, validateValue } from './compat';
5
12
  export { TypeDefinition } from './TypeDefinition';
6
- export { getClassDefinition, getClassByName, type ClassDefinition } from './ClassDefinition';
7
- export { getInterfaceDefinition, type InterfaceDefinition } from './InterfaceDefinition';
8
- export { getTypeAliasDefinition, type TypeAliasDefinition } from './TypeAliasDefinition';
9
- export { getEnumDefinition, getEnumNames, getEnumValues, type EnumDefinition } from './EnumDefinition';
10
- export { validateValue } from './validates/value-validate';
13
+ export { type ClassDefinition } from './ClassDefinition';
14
+ export { type InterfaceDefinition } from './InterfaceDefinition';
15
+ export { type TypeAliasDefinition } from './TypeAliasDefinition';
16
+ export { type EnumDefinition } from './EnumDefinition';
11
17
  export * from './json';
12
18
  export * from './validates';
13
19
  export { registerSpecialType } from './special-types';
@@ -19,8 +25,3 @@ export declare const ReflectConfig: {
19
25
  validation: boolean;
20
26
  debug: boolean;
21
27
  };
22
- export declare function getDebugInfo(): {
23
- raw: RawReflectMeta;
24
- instances: typeof instanceStore;
25
- config: typeof ReflectConfig;
26
- } | undefined;
@@ -1,11 +1,19 @@
1
1
  import type { JSONString } from './types';
2
2
  import { type Type } from '../validates';
3
+ import { ReflectContext } from '../ReflectContext';
3
4
  export declare class JSONTransfer {
4
5
  exceptionHandler: (error: JSONError) => void;
5
- constructor(exceptionHandler?: (error: JSONError) => void);
6
+ private readonly context;
7
+ constructor(exceptionHandler?: (error: JSONError) => void, context?: ReflectContext);
6
8
  parse<T = unknown>(jsonString: JSONString<T>, type?: Type): T;
7
9
  private convertJSONValue;
8
10
  private convertJSONObjectAsClassInstance;
9
11
  }
10
12
  export declare class JSONError extends Error {
11
13
  }
14
+ declare module '../ReflectContext' {
15
+ interface ReflectContext {
16
+ readonly json: JSONTransfer;
17
+ createJSONTransfer(exceptionHandler?: (error: JSONError) => void): JSONTransfer;
18
+ }
19
+ }
@@ -1,5 +1,17 @@
1
- import type { RawReflectMeta } from '../raw';
1
+ import type { Constructor, RawReflectMeta } from '../raw';
2
+ import { ReflectConfig } from './index';
2
3
  export declare const reflectReady: Promise<void>;
3
- export declare function setReflectModule(moduleName: string): void;
4
- export declare function getRawMeta(): RawReflectMeta | undefined;
4
+ export declare function createReflectClassDecorator(moduleName?: string): ClassDecorator;
5
5
  export declare const ReflectClass: ClassDecorator;
6
+ declare module './ReflectContext' {
7
+ interface ReflectContext {
8
+ readonly ReflectClass: ClassDecorator;
9
+ registerClass(jsClass: Constructor): void;
10
+ getRawMeta(): RawReflectMeta | undefined;
11
+ getDebugInfo(): {
12
+ raw: RawReflectMeta;
13
+ instances: InstanceStore;
14
+ config: typeof ReflectConfig;
15
+ } | undefined;
16
+ }
17
+ }
@@ -1,4 +1,4 @@
1
- import { type TypeDefinition } from '../TypeDefinition';
1
+ import type { TypeDefinition } from '../TypeDefinition';
2
2
  export type Type = string | {
3
3
  array: Type;
4
4
  } | {
@@ -11,9 +11,13 @@ export type Type = string | {
11
11
  name: string;
12
12
  generic: Type[];
13
13
  };
14
- export declare function getTypeDef(type: Type | TypeDefinition): TypeDefinition;
15
- export declare function assertType<T>(data: unknown, type: Type, depth?: number): T;
16
- export declare function isNullable(type: Type | TypeDefinition): boolean;
17
- export declare function isType(value: unknown, type: Type | TypeDefinition, depth?: number): boolean;
14
+ declare module '../ReflectContext' {
15
+ interface ReflectContext {
16
+ getTypeDef(type: Type | TypeDefinition): TypeDefinition;
17
+ assertType<T>(data: unknown, type: Type, depth?: number): T;
18
+ isNullable(type: Type | TypeDefinition): boolean;
19
+ isType(value: unknown, type: Type | TypeDefinition, depth?: number): boolean;
20
+ }
21
+ }
18
22
  export declare class TypeParseError extends Error {
19
23
  }
@@ -2,4 +2,4 @@ export * from './Type';
2
2
  export * from './ValidateResult';
3
3
  export * from './instance-validate';
4
4
  export * from './method-validate';
5
- export { safeSetValue } from './value-validate';
5
+ export * from './value-validate';
@@ -1,7 +1,11 @@
1
1
  import type { Dictionary } from '../../raw';
2
2
  import type { ValidateResult } from './ValidateResult';
3
- import { type Type } from './Type';
3
+ import type { Type } from './Type';
4
4
  import type { TypeDefinition } from '..';
5
- export declare function validateInstance<T extends object>(instance: T, type?: Type | TypeDefinition, depth?: number): ValidateResult;
6
- export declare function validateArray<T extends object>(array: T[], type?: Type | TypeDefinition, depth?: number): ValidateResult;
7
- export declare function validateDictionary<T extends object>(dict: Dictionary<T>, type?: Type | TypeDefinition, depth?: number): ValidateResult;
5
+ declare module '../ReflectContext' {
6
+ interface ReflectContext {
7
+ validateInstance<T extends object>(instance: T, type?: Type | TypeDefinition, depth?: number): ValidateResult;
8
+ validateArray<T extends object>(array: T[], type?: Type | TypeDefinition, depth?: number): ValidateResult;
9
+ validateDictionary<T extends object>(dict: Dictionary<T>, type?: Type | TypeDefinition, depth?: number): ValidateResult;
10
+ }
11
+ }
@@ -5,5 +5,11 @@ declare global {
5
5
  }
6
6
  }
7
7
  export declare const ReflectValidate: MethodDecorator;
8
- export declare function safeCall<R>(target: object, methodName: string, ...args: unknown[]): R | undefined;
8
+ export declare function createReflectValidate(reflectModule?: string): MethodDecorator;
9
+ declare module '../ReflectContext' {
10
+ interface ReflectContext {
11
+ readonly ReflectValidate: MethodDecorator;
12
+ safeCall<R>(target: object, methodName: string, ...args: unknown[]): R | undefined;
13
+ }
14
+ }
9
15
  export {};
@@ -1,6 +1,28 @@
1
1
  import { type TypeDefinition } from '../TypeDefinition';
2
+ import type { IPropertyDefinition } from '../PropertyDefinition';
2
3
  import type { ValidateResult } from './ValidateResult';
3
4
  export declare const preservedTypes: Function[];
4
- export declare function validateValue(value: unknown, type: TypeDefinition, depth?: number): ValidateResult;
5
- export declare function validateClassInstance<T extends object>(instance: T, typeDef: TypeDefinition, depth?: number): ValidateResult;
6
- export declare function safeSetValue(target: object, propName: string, value: unknown): void;
5
+ declare module '../ReflectContext' {
6
+ interface ReflectContext {
7
+ validateValue(value: unknown, type: TypeDefinition, depth?: number): ValidateResult;
8
+ validateArrayValue(value: unknown, type: {
9
+ arrayElementType: TypeDefinition;
10
+ }, depth?: number): ValidateResult;
11
+ validateIndexedValue(value: unknown, type: {
12
+ index: {
13
+ keyType?: TypeDefinition;
14
+ valueType: TypeDefinition;
15
+ };
16
+ }, depth?: number): ValidateResult;
17
+ validateTupleValue(value: unknown, type: {
18
+ tupleMembers: TypeDefinition[];
19
+ }, depth?: number): ValidateResult;
20
+ validateProperties(value: unknown, type: {
21
+ typeLiteralMembers: IPropertyDefinition[];
22
+ }, depth?: number): ValidateResult;
23
+ validateSimpleValue(value: unknown, type: TypeDefinition | string, depth?: number): ValidateResult;
24
+ validateClassInstance<T extends object>(instance: T, typeDef: TypeDefinition, depth?: number): ValidateResult;
25
+ valueInstanceOf(value: object, className: string): boolean;
26
+ safeSetValue(target: object, propName: string, value: unknown): void;
27
+ }
28
+ }
@@ -1,15 +0,0 @@
1
- import type { ClassDefinition } from './ClassDefinition';
2
- import type { InterfaceDefinition } from './InterfaceDefinition';
3
- import type { EnumDefinition } from './EnumDefinition';
4
- import type { RawTypeAliasDefinition } from '../raw';
5
- export declare const instanceStore: {
6
- classMap: Map<string, ClassDefinition>;
7
- interfaceMap: Map<string, InterfaceDefinition>;
8
- enumMap: Map<string, EnumDefinition>;
9
- typeAliasMap: Map<string, RawTypeAliasDefinition>;
10
- invalidateClasses(names: string[]): void;
11
- invalidateInterfaces(names: string[]): void;
12
- invalidateEnums(names: string[]): void;
13
- invalidateTypeAliases(names: string[]): void;
14
- clear(): void;
15
- };