import { type VmAny, type VmValue, type VmValueMap } from '@mirascript/mirascript'; import { convert } from '@mirascript/mirascript/subtle'; import type { ArgumentValue } from './definitions.js'; /** 类型信息 */ export type TypeInfo = 'string' | 'number' | 'boolean'; /** 类型映射 */ type TypeMap = VmValueMap & { s: string; f: number; b: boolean; '': VmValue; }; /** Ts 类型 */ export type TsTypeOf = T extends '' ? I : TypeMap[T]; /** 兼容的旧类型 */ export type LegacyType = 's' | 'f' | 'b'; /** 类型信息 */ export declare namespace TypeInfo { /** 解析类型 */ export function parse(type: TypeInfo | LegacyType): TypeInfo; /** 判断类型 */ export function is(value: VmValue | undefined, type: T): value is TsTypeOf; /** 转换类型 */ export function to(value: I | undefined, type: T, fallback?: F): TsTypeOf | Exclude; /** 检查是否为 ArgumentValue */ function assertArgumentValue(value: VmAny, fallback?: F): ArgumentValue | Exclude; /** 获取转换器 */ type Converters = { string: typeof convert.toString; s: typeof convert.toString; number: typeof convert.toNumber; f: typeof convert.toNumber; boolean: typeof convert.toBoolean; b: typeof convert.toBoolean; '': typeof assertArgumentValue; }; /** 获取转换器 */ export function converter(type: T): Converters[T]; export const toBoolean: typeof convert.toBoolean, toFormat: typeof convert.toFormat, toNumber: typeof convert.toNumber, toString: typeof convert.toString; export {}; } export {}; //# sourceMappingURL=type.d.ts.map