ts-ref-kit 1.0.1 → 1.0.3

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.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Reflect-Types
1
+ # TS-ref-kit
2
2
 
3
3
  A TypeScript library for type reflection and validation.
4
4
 
package/package.json CHANGED
@@ -1,22 +1,23 @@
1
1
  {
2
2
  "name": "ts-ref-kit",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Type reflection and validation library for TypeScript",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist/**/*",
9
+ "types/**/*",
9
10
  "LICENSE",
10
11
  "README.md"
11
12
  ],
12
13
  "exports": {
13
14
  ".": {
14
15
  "import": "./dist/index.js",
15
- "types": "./dist/index.d.ts"
16
+ "types": "./types/index.d.ts"
16
17
  },
17
18
  "./parser": {
18
19
  "import": "./dist/parser/index.js",
19
- "types": "./dist/parser/index.d.ts"
20
+ "types": "./types/parser/index.d.ts"
20
21
  }
21
22
  },
22
23
  "scripts": {
@@ -0,0 +1,2 @@
1
+ export * from './reflect-types';
2
+ export * from './reflect-json';
@@ -0,0 +1,3 @@
1
+ export * from './reflect-loader';
2
+ export * from './reflect-parser-plugin';
3
+ export * from './reflect-parser';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 检查文件路径是否匹配 glob 规则
3
+ * @param filePath 要检查的文件路径(绝对或相对路径)
4
+ * @param pattern glob 规则,如 `/src/**\/.ts`
5
+ * @returns 是否匹配
6
+ */
7
+ export default function isPathMatch(filePath: string, pattern: string | string[]): boolean;
@@ -0,0 +1,9 @@
1
+ export interface ReflectLoaderOptions {
2
+ sourcePaths: string | string[];
3
+ exclude?: string | RegExp | (string | RegExp)[];
4
+ forEnabledClassOnly?: boolean;
5
+ }
6
+ export declare function reflectLoader(options: ReflectLoaderOptions): {
7
+ outputAllMetas: () => string;
8
+ transform: (sourceCode: string, sourceFileName: string) => string;
9
+ };
@@ -0,0 +1,7 @@
1
+ import { type Plugin } from 'vite';
2
+ import { ReflectLoaderOptions } from './reflect-loader';
3
+ interface Options extends ReflectLoaderOptions {
4
+ entry: string;
5
+ }
6
+ export declare function reflectParserPlugin(options: Options): Plugin;
7
+ export {};
@@ -0,0 +1,74 @@
1
+ type Any = any;
2
+ export interface RawClassDefinition {
3
+ name: string;
4
+ superClassName?: string;
5
+ implementations?: string[];
6
+ methods?: RawMethodDefinition[];
7
+ properties?: RawPropertyDefinition[];
8
+ }
9
+ export interface RawInterfaceDefinition {
10
+ name: string;
11
+ implementations?: string[];
12
+ methods?: RawMethodDefinition[];
13
+ properties?: RawPropertyDefinition[];
14
+ indexElementType?: RawTypeDef;
15
+ }
16
+ export interface RawEnumDefinition {
17
+ name: string;
18
+ members: {
19
+ name: string;
20
+ initializer: string | undefined;
21
+ }[];
22
+ }
23
+ export interface RawMethodDefinition {
24
+ name: string;
25
+ isPrivate?: boolean;
26
+ isStatic?: boolean;
27
+ isAsync?: boolean;
28
+ returnType?: RawTypeDef;
29
+ args?: {
30
+ name: string;
31
+ type?: RawTypeDef;
32
+ isOptional: boolean;
33
+ }[];
34
+ }
35
+ export interface RawPropertyDefinition {
36
+ name: string;
37
+ isOptional?: boolean;
38
+ isPrivate?: boolean;
39
+ isStatic?: boolean;
40
+ type?: RawTypeDef;
41
+ accessor?: {
42
+ getter?: {
43
+ isPrivate: boolean;
44
+ };
45
+ setter?: {
46
+ isPrivate: boolean;
47
+ };
48
+ };
49
+ }
50
+ type RawTypeDef = string | RawTypeDefinition;
51
+ export interface RawTypeDefinition {
52
+ arrayElementType?: RawTypeDef;
53
+ indexElementType?: RawTypeDef;
54
+ literalValue?: Any;
55
+ typeLiteralMembers?: RawPropertyDefinition[];
56
+ unionMembers?: RawTypeDef[];
57
+ intersectionMembers?: RawTypeDef[];
58
+ generics?: RawTypeDef[];
59
+ isFunction?: boolean;
60
+ tupleMembers?: RawTypeDef[];
61
+ isOptionalInTuple?: boolean;
62
+ isConstructor?: boolean;
63
+ }
64
+ type FilePathRule = string | RegExp | (string | RegExp)[];
65
+ export declare function setupReflectTypes(filePaths: string | string[], exclude?: FilePathRule, distFolder?: string): Promise<void>;
66
+ export declare function updateReflectModules(filePath: string, distFolder: string): Promise<void>;
67
+ export declare function parseSource(filePaths?: string | string[], exclude?: FilePathRule): {
68
+ classDefinitions: Map<string, RawClassDefinition>;
69
+ interfaceDefinitions: Map<string, RawInterfaceDefinition>;
70
+ enumDefinitions: Map<string, RawEnumDefinition>;
71
+ typeAliasDefinitions: Map<string, RawTypeDef>;
72
+ constTypeDefinitions: Map<string, RawTypeDef>;
73
+ };
74
+ export {};
@@ -0,0 +1,13 @@
1
+ import { type EnableReflect } from '../reflect-types';
2
+ import type { Class, JsonValue } from './types';
3
+ export interface Mappable extends EnableReflect {
4
+ mapping(map: Mapping<Mappable>): void;
5
+ }
6
+ export type Mapping<T extends Mappable> = {
7
+ [propName in keyof T]-?: (fieldName?: string | symbol, transform?: {
8
+ fromJSON?: (jsonValue: JsonValue) => Mappable;
9
+ toJSON?: (obj: Mappable) => JsonValue;
10
+ }) => void;
11
+ };
12
+ export declare function registerMappable<T extends Mappable>(mappableClass: Class<T>): void;
13
+ export declare function mapAllProperties<T extends Mappable>(target: T, map: Mapping<T>): void;
@@ -0,0 +1,18 @@
1
+ import { ReflectPropertyKey } from './reflect-extension';
2
+ import type { Any } from './types';
3
+ export declare function defineDecoratedProperty(metaKey: symbol): PropertyDecorator;
4
+ export declare function callDecoratedMethod<Self extends object>(self: Self, metaKey: symbol, ...args: Any[]): Any | undefined;
5
+ export declare function hasDecoratedMethod<Self extends object>(self: Self, metaKey: symbol): boolean;
6
+ export declare function getDecoratedProperty(target: object, metaKey: symbol): ReflectPropertyKey | undefined;
7
+ export declare function getDecoratedPropertyValue<V>(target: object, metaKey: symbol): V | undefined;
8
+ export declare const PropertyWrapper: IPropertyWrapper;
9
+ type IPropertyWrapper = {
10
+ getField: (owner: object, property: ReflectPropertyKey, fieldSymbol: symbol) => Any;
11
+ setField: (owner: object, property: ReflectPropertyKey, newValue: Any, fieldSymbol: symbol) => void;
12
+ } & (<T>({ getter, setter, fieldSymbol }: {
13
+ getter?: (self: object, property: ReflectPropertyKey) => T;
14
+ setter?: (self: object, newValue: T, property: ReflectPropertyKey) => void;
15
+ fieldSymbol: symbol;
16
+ }) => PropertyDecorator);
17
+ export declare function Lazy(creator: (self: object, property: ReflectPropertyKey) => Any): PropertyDecorator;
18
+ export {};
@@ -0,0 +1,6 @@
1
+ export * from './Mappable';
2
+ export * from './decorate';
3
+ export * from './json-translation';
4
+ export * from './reflect-extension';
5
+ export * from './types';
6
+ export * from './utils';
@@ -0,0 +1,38 @@
1
+ import 'reflect-metadata';
2
+ import { Any, AnyObject, Class, ClassOrInstance, JsonObject, JsonValue } from './types';
3
+ type FromJSON<T> = (jsonValue: JsonValue) => T;
4
+ type ToJSON<T> = (obj: T) => JsonValue;
5
+ type SerializedOptions<T> = {
6
+ name?: string;
7
+ class?: Class<T>;
8
+ fromJSON?: FromJSON<T>;
9
+ toJSON?: ToJSON<T>;
10
+ };
11
+ export declare function setDefaultIgnored(clazz: Class<Any>, defaultIgnored: boolean): void;
12
+ export declare function registerSerializedProperty(target: AnyObject, propName: string, options: SerializedOptions<Any>): void;
13
+ export declare const SerializedClass: PropertyDecorator;
14
+ export declare function Serialized<T extends object>(options?: SerializedOptions<T>): PropertyDecorator;
15
+ export declare function SerializedName(serializedName: string): PropertyDecorator;
16
+ export declare const IgnoreSerialization: PropertyDecorator;
17
+ /**
18
+ * serialize an object to json string
19
+ */
20
+ export declare function serialize<T>(value: T): string;
21
+ export declare function serializeTo<T>(value: T): JsonValue;
22
+ /**
23
+ * convert an object to data object
24
+ */
25
+ export declare function serializeToData<T extends object>(object: T): JsonObject | JsonObject[];
26
+ export declare function deserialize<T>(json: string | JsonValue, constructorOrTarget?: ClassOrInstance<T>): T;
27
+ export declare function deserializeArray<T>(json: string | JsonValue[], clazz?: Class<T>): T[];
28
+ export declare function deserializeFrom<T extends AnyObject>(data: JsonObject, target: T): void;
29
+ export declare function getSerializeSettings(clazz: Class<Any>): any;
30
+ export interface JsonValueTransform<T> {
31
+ fromJson: FromJSON<T>;
32
+ toJson: ToJSON<T>;
33
+ }
34
+ export declare function registerTransform<T>(clazz: Class<T>, transform: JsonValueTransform<T>): void;
35
+ export declare const itSelf: (some: Any) => any;
36
+ export declare const done: () => any;
37
+ export declare const AfterSerialized: PropertyDecorator;
38
+ export {};
@@ -0,0 +1,13 @@
1
+ import 'reflect-metadata';
2
+ import { Any, AnyConstructorFunction, AnyObject, Optional } from './types';
3
+ export type ReflectPropertyKey = string | symbol;
4
+ export type ReflectType = StringConstructor | NumberConstructor | BooleanConstructor | ObjectConstructor | ArrayConstructor | FunctionConstructor | AnyConstructorFunction;
5
+ declare global {
6
+ namespace Reflect {
7
+ function getDesignType<T extends AnyObject>(target: T, property: keyof T | ReflectPropertyKey): Optional<ReflectType>;
8
+ function getReturnType<T extends AnyObject>(target: T, property: keyof T | ReflectPropertyKey): Optional<ReflectType>;
9
+ function getParamTypes<T extends AnyObject>(target: T, property: keyof T | ReflectPropertyKey): Optional<ReflectType[]>;
10
+ function addMetadataList<T extends object>(key: symbol, value: Any, target: T): void;
11
+ function addMetadataList<T extends object>(key: symbol, value: Any, target: T, property: ReflectPropertyKey): void;
12
+ }
13
+ }
@@ -0,0 +1,15 @@
1
+ export type Any = any;
2
+ export type AnyFunction = (...args: Any[]) => Any;
3
+ export type AnyConstructorFunction = new (...args: Any[]) => Any;
4
+ export type Class<T> = new (...args: Any[]) => T;
5
+ export type ClassOrInstance<T> = T | Class<T>;
6
+ export type Dictionary<T> = {
7
+ [key: string | symbol]: T;
8
+ };
9
+ export type AnyObject = Dictionary<Any>;
10
+ export type Optional<T> = T | undefined;
11
+ export type Nullable<T> = T | null;
12
+ export type JsonValue = string | number | boolean | null | JsonObject | JsonObject[];
13
+ export type JsonObject = {
14
+ [propName: string]: JsonValue;
15
+ };
@@ -0,0 +1,9 @@
1
+ import { Any, Class } from "./types";
2
+ export declare function asBoolean(value: unknown): boolean;
3
+ export declare function asString(v: unknown): string;
4
+ export declare function asNumber(v: unknown): number;
5
+ export declare function setAnyValue<T>(target: Any, field: string | number | symbol, value: T): void;
6
+ export declare function getAnyValue<T>(target: Any, field: string | number | symbol): T | undefined;
7
+ export declare function getOrSetValue<T>(target: Any, field: string | number | symbol, defaultWith: () => T): T;
8
+ export declare function isDictionary(value: Any): boolean;
9
+ export declare function createNewInstance<T>(clazz: Class<T>): any;
@@ -0,0 +1,26 @@
1
+ import type { RawClassDefinition, TypeDefinition } from './index';
2
+ import { InterfaceDefinition, MethodDefinition, PropertyDefinition } from './index';
3
+ import type { AnyConstructorFunction, Dictionary } from './package';
4
+ export declare class ClassDefinition {
5
+ readonly name: string;
6
+ readonly superClassName: string;
7
+ readonly superClass: ClassDefinition | undefined;
8
+ readonly methods: MethodDefinition[];
9
+ readonly properties: PropertyDefinition[];
10
+ readonly jsClass: AnyConstructorFunction;
11
+ private readonly _implementationNames;
12
+ private readonly _implementations?;
13
+ private _allImplementations?;
14
+ constructor(def: RawClassDefinition & {
15
+ jsClass: AnyConstructorFunction;
16
+ });
17
+ get allMethods(): Dictionary<MethodDefinition>;
18
+ get allProperties(): Dictionary<PropertyDefinition>;
19
+ get implementations(): InterfaceDefinition[];
20
+ get allImplementations(): InterfaceDefinition[];
21
+ getProperty(propName: string): PropertyDefinition | undefined;
22
+ get type(): TypeDefinition;
23
+ isSubClassOf(typeName: string): boolean;
24
+ isSuperClassOf(typeName: string): boolean;
25
+ toString(): string;
26
+ }
@@ -0,0 +1,8 @@
1
+ import type { RawEnumDefinition, TypeDefinition } from './reflect-definitions';
2
+ export declare class EnumDefinition {
3
+ readonly name: string;
4
+ readonly members: Map<string, TypeDefinition>;
5
+ constructor(def: RawEnumDefinition);
6
+ get type(): TypeDefinition;
7
+ get names(): string[];
8
+ }
@@ -0,0 +1,16 @@
1
+ import type { RawInterfaceDefinition, TypeDefinition } from './index';
2
+ import { MethodDefinition, PropertyDefinition } from './index';
3
+ export declare class InterfaceDefinition {
4
+ readonly name: string;
5
+ readonly methods: MethodDefinition[];
6
+ readonly properties: PropertyDefinition[];
7
+ private readonly _implementationNames;
8
+ private _implementations?;
9
+ private _allImplementations?;
10
+ constructor(def: RawInterfaceDefinition);
11
+ get implementations(): InterfaceDefinition[];
12
+ get allImplementations(): InterfaceDefinition[];
13
+ get type(): TypeDefinition;
14
+ toString(): string;
15
+ buildBaseObject(): {};
16
+ }
@@ -0,0 +1,15 @@
1
+ import { type RawMethodDefinition, type TypeDefinition } from './index';
2
+ export declare class MethodDefinition {
3
+ name: string;
4
+ isPrivate: boolean;
5
+ isStatic: boolean;
6
+ isAsync: boolean;
7
+ returnType: TypeDefinition;
8
+ args: {
9
+ name: string;
10
+ type?: TypeDefinition;
11
+ isOptional: boolean;
12
+ }[];
13
+ constructor(def: RawMethodDefinition);
14
+ }
15
+ export declare function fillMethod(rawMethod: RawMethodDefinition): MethodDefinition;
@@ -0,0 +1,18 @@
1
+ import { type RawPropertyDefinition, type TypeDefinition } from './index';
2
+ export declare class PropertyDefinition {
3
+ name: string;
4
+ isOptional: boolean;
5
+ isPrivate: boolean;
6
+ isStatic: boolean;
7
+ type: TypeDefinition;
8
+ accessor?: {
9
+ getter?: {
10
+ isPrivate: boolean;
11
+ };
12
+ setter?: {
13
+ isPrivate: boolean;
14
+ };
15
+ };
16
+ constructor(def: RawPropertyDefinition);
17
+ }
18
+ export declare function fillProperty(rawProperty: RawPropertyDefinition): PropertyDefinition;
@@ -0,0 +1,12 @@
1
+ import { type TypeDefinition } from '.';
2
+ export type Type = string | {
3
+ array: Type;
4
+ } | {
5
+ union: Type[];
6
+ } | {
7
+ intersection: Type[];
8
+ } | {
9
+ tuple: Type[];
10
+ };
11
+ export declare function getTypeDef(type: Type): TypeDefinition;
12
+ export declare function assertType<T>(data: T, type: Type, depth?: number): T;
@@ -0,0 +1,10 @@
1
+ import { type AnyFunction } from './package';
2
+ declare const VALIDATE_WRAPPER: unique symbol;
3
+ declare global {
4
+ interface Function {
5
+ [VALIDATE_WRAPPER]: AnyFunction;
6
+ }
7
+ }
8
+ export declare const ReflectValidate: MethodDecorator;
9
+ export declare function safeCall(target: object, methodName: string, ...args: unknown[]): unknown;
10
+ export {};
@@ -0,0 +1,11 @@
1
+ export * from './reflect-definitions';
2
+ export * from './reflect-context';
3
+ export * from './ClassDefinition';
4
+ export * from './InterfaceDefinition';
5
+ export * from './EnumDefinition';
6
+ export * from './MethodDefinition';
7
+ export * from './PropertyDefinition';
8
+ export * from './reflect-types';
9
+ export * from './reflect-validate';
10
+ export * from './assert-type';
11
+ export * from './function-validate';
@@ -0,0 +1,13 @@
1
+ export type Dictionary<T> = {
2
+ [key: string]: T;
3
+ };
4
+ type Any = any;
5
+ export type AnyConstructorFunction = new (...args: Any[]) => Any;
6
+ export type AnyFunction = (...args: Any[]) => Any;
7
+ export declare function setValue<T>(target: unknown, field: string | symbol, value: T): void;
8
+ export declare function getValue<T>(target: unknown, field: string | symbol): T | undefined;
9
+ export declare function mapNotNull<T, U>(arr: T[] | undefined, mapper: (item: T) => U | undefined): U[];
10
+ export declare function spy(variables: {
11
+ [prop: string]: unknown;
12
+ }): void;
13
+ export {};
@@ -0,0 +1,16 @@
1
+ import type { AnyConstructorFunction } from './package';
2
+ import { type TypeDefinition } from './index';
3
+ import { ClassDefinition, EnumDefinition, InterfaceDefinition } from './index';
4
+ export declare const ReflectClass: ClassDecorator;
5
+ export declare const ReflectContext: {
6
+ getClassDefinition: typeof getClassDefinition;
7
+ getInterfaceDefinition: typeof getInterfaceDefinition;
8
+ getEnumDefinition: typeof getEnumDefinition;
9
+ getTypeAliasDefinition: typeof getTypeAliasDefinition;
10
+ };
11
+ export declare function getClassByName(className: string): AnyConstructorFunction | undefined;
12
+ declare function getClassDefinition(arg: AnyConstructorFunction | object | string): ClassDefinition | undefined;
13
+ declare function getInterfaceDefinition(name: string): InterfaceDefinition | undefined;
14
+ declare function getEnumDefinition(name: string): EnumDefinition | undefined;
15
+ declare function getTypeAliasDefinition(name: string): TypeDefinition | undefined;
16
+ export {};
@@ -0,0 +1,100 @@
1
+ import { PropertyDefinition } from './index';
2
+ export interface RawTypeDefinition {
3
+ arrayElementType?: RawTypeDef;
4
+ literalValue?: unknown;
5
+ typeLiteralMembers?: RawPropertyDefinition[];
6
+ unionMembers?: RawTypeDef[];
7
+ intersectionMembers?: RawTypeDef[];
8
+ isFunction?: boolean;
9
+ tupleMembers?: RawTypeDef[];
10
+ isOptionalInTuple?: boolean;
11
+ isConstructor?: boolean;
12
+ generics?: RawTypeDef[];
13
+ }
14
+ type RawTypeDef = string | RawTypeDefinition;
15
+ export interface RawClassDefinition {
16
+ name: string;
17
+ superClassName?: string;
18
+ implementations?: string[];
19
+ methods?: RawMethodDefinition[];
20
+ properties?: RawPropertyDefinition[];
21
+ }
22
+ export interface RawInterfaceDefinition {
23
+ name: string;
24
+ implementations?: string[];
25
+ methods?: RawMethodDefinition[];
26
+ properties?: RawPropertyDefinition[];
27
+ }
28
+ export interface RawEnumDefinition {
29
+ name: string;
30
+ members: {
31
+ name: string;
32
+ initializer: string | undefined;
33
+ }[];
34
+ }
35
+ export interface RawMethodDefinition {
36
+ name: string;
37
+ isPrivate?: boolean;
38
+ isStatic?: boolean;
39
+ isAsync?: boolean;
40
+ returnType?: RawTypeDef;
41
+ args?: {
42
+ name: string;
43
+ type?: RawTypeDef;
44
+ isOptional: boolean;
45
+ }[];
46
+ }
47
+ export interface RawPropertyDefinition {
48
+ name: string;
49
+ isOptional?: boolean;
50
+ isPrivate?: boolean;
51
+ isStatic?: boolean;
52
+ type?: RawTypeDef;
53
+ accessor?: {
54
+ getter?: {
55
+ isPrivate: boolean;
56
+ };
57
+ setter?: {
58
+ isPrivate: boolean;
59
+ };
60
+ };
61
+ }
62
+ export interface TypeDefinition {
63
+ name?: string;
64
+ arrayElementType?: TypeDefinition;
65
+ literalValue?: string;
66
+ typeLiteralMembers?: PropertyDefinition[];
67
+ unionMembers?: TypeDefinition[];
68
+ intersectionMembers?: TypeDefinition[];
69
+ isFunction?: boolean;
70
+ tupleMembers?: TypeDefinition[];
71
+ isOptionalInTuple?: boolean;
72
+ isConstructor?: boolean;
73
+ generics?: TypeDefinition[];
74
+ }
75
+ export declare function isIgnoredType(type: TypeDefinition): boolean;
76
+ export declare function isPrimitiveType(type: TypeDefinition): type is {
77
+ name: string;
78
+ };
79
+ export declare function isArrayType(type: TypeDefinition): type is {
80
+ arrayElementType: TypeDefinition;
81
+ };
82
+ export declare function isLiteralType(type: TypeDefinition): type is {
83
+ literalValue: string;
84
+ };
85
+ export declare function isTypeLiteralType(type: TypeDefinition): type is {
86
+ typeLiteralMembers: PropertyDefinition[];
87
+ };
88
+ export declare function isUnionType(type: TypeDefinition): type is {
89
+ unionMembers: TypeDefinition[];
90
+ };
91
+ export declare function isIntersectionType(type: TypeDefinition): type is {
92
+ intersectionMembers: TypeDefinition[];
93
+ };
94
+ export declare function isTupleType(type: TypeDefinition): type is {
95
+ tupleMembers: TypeDefinition[];
96
+ };
97
+ export declare function hasGenerics(type: TypeDefinition): type is {
98
+ generics: TypeDefinition[];
99
+ };
100
+ export {};
@@ -0,0 +1,20 @@
1
+ import { type RawTypeDefinition, type TypeDefinition } from './index';
2
+ import { ClassDefinition, EnumDefinition, InterfaceDefinition } from './index';
3
+ import { type AnyConstructorFunction } from './package';
4
+ export declare const anyType: {
5
+ name: string;
6
+ };
7
+ export declare const nullType: {
8
+ name: string;
9
+ };
10
+ export declare function getClassDefinition(arg: AnyConstructorFunction | object | string): ClassDefinition | undefined;
11
+ export declare function getInterfaceDefinition(name: string): InterfaceDefinition | undefined;
12
+ export declare function getEnumDefinition(name: string): EnumDefinition | undefined;
13
+ export declare function getTypeAliasDefinition(name: string): TypeDefinition | undefined;
14
+ export declare function getTypeDefinition(typeName: string): TypeDefinition;
15
+ export declare function getEnumNames(enumName: string): string[];
16
+ export declare function getEnumValues(args: {
17
+ [enumName: string]: Record<string, string | number>;
18
+ }): (string | number)[];
19
+ export declare function fillType(rawType: RawTypeDefinition | string | undefined): TypeDefinition;
20
+ export type EnableReflect = object;
@@ -0,0 +1,24 @@
1
+ import { type TypeDefinition } from './index';
2
+ import { type Dictionary } from './package';
3
+ interface ValidateResult {
4
+ success: boolean;
5
+ errorMessage?: string;
6
+ }
7
+ export declare function validateValue(value: unknown, type: TypeDefinition, depth?: number): ValidateResult;
8
+ export declare function validateInstance<T extends object>(instance: T, typeName?: string, depth?: number): ValidateResult;
9
+ export declare function validateArray<T extends object>(array: T[], typeName?: string, depth?: number): ValidateResult;
10
+ export declare function validateDictionary<T extends object>(dict: Dictionary<T>, typeName?: string, depth?: number): ValidateResult;
11
+ interface FailureResult extends ValidateResult {
12
+ cause?: FailureResult;
13
+ }
14
+ export declare function getErrorTraceMessages(failureResult: FailureResult): string;
15
+ export declare function validateFunctionArgument(args: {
16
+ funcName: string;
17
+ optionsObj?: object;
18
+ value?: unknown;
19
+ argName: string;
20
+ type: string;
21
+ optional?: boolean;
22
+ }): void;
23
+ export declare function safeSetValue(target: object, propName: string, value: unknown): void;
24
+ export {};