bluecodex
Version:
Turn repetitive dev tasks into CLI commands with Typescript
22 lines (18 loc) • 723 B
text/typescript
import type { DataType } from "./data-type";
export type DataTypeSchemaValidateArray<DT extends DataType = DataType> = Array<
DT | { value: DT; title?: string; description?: string }
>;
export type DataTypeSchemaValidateFn<DT extends DataType = DataType> = (
value: DT,
) => boolean | Promise<boolean>;
export type DataTypeSchema<DT extends DataType = DataType> = {
initial?: DT;
validate?:
| DataTypeSchemaValidateArray<DT>
// TODO: [feature] fn?: () => Array<DT> | Promise<Array<DT>>
| Readonly<DataTypeSchemaValidateArray<DT>>
| DataTypeSchemaValidateFn<DT>;
prompt?: string;
// TODO: [feature] prompt `async fn?:` to allow custom prompt implementation
// TODO: [feature] transform?:
};