typescript-util
Version:
JS/TS 的简单工具
43 lines • 1.05 kB
TypeScript
/**
* 常量值映射
*/
export declare class ConstantValueMapping<T extends Record<string, PropertyKey> = Record<string, PropertyKey>> {
/**
* 原常量值, 保留
*/
constant: T;
/**
* 选项数组数据
*/
dicArr: Array<{
label: keyof T;
value: T[keyof T];
}>;
/**
* 展示用数据
* @see toDisplay
*/
display: Record<T[keyof T], keyof T>;
/**
*/
constructor(constantValue?: T);
/**
* {@link #display} 的替代品, 设置默认值
*/
toDisplay(value: T[keyof T], defaultValue?: string): Record<T[keyof T], keyof T>[T[keyof T]];
/**
* 选项数组, 排除指定的值
*/
optionArrayExclude(...excludeValue: Array<T[keyof T]>): {
label: keyof T;
value: T[keyof T];
}[];
/**
* 选项数组 仅包含指定的值
*/
optionArrayInclude(...includeValue: Array<T[keyof T]>): {
label: keyof T;
value: T[keyof T];
}[];
}
//# sourceMappingURL=ConstantValueMapping.d.ts.map