@antv/g2
Version:
the Grammar of Graphics in Javascript
13 lines (12 loc) • 465 B
TypeScript
export type Literal2Object<Literal extends {
type?: any;
}> = Partial<{
[Type in Literal['type']]: Literal extends {
type?: Type;
} ? Omit<Literal, 'type'> | boolean : never;
}>;
export type UsePrefix<Prefix extends string, Obj extends Record<string, unknown>> = {
[Property in keyof Obj as `${Prefix}${Capitalize<string & Property>}`]: Obj[Property];
};
export type Closeable<T> = T | boolean | null;
export type Padding = number | 'auto';