utils.d.ts 465 B

123456789101112
  1. export type Literal2Object<Literal extends {
  2. type?: any;
  3. }> = Partial<{
  4. [Type in Literal['type']]: Literal extends {
  5. type?: Type;
  6. } ? Omit<Literal, 'type'> | boolean : never;
  7. }>;
  8. export type UsePrefix<Prefix extends string, Obj extends Record<string, unknown>> = {
  9. [Property in keyof Obj as `${Prefix}${Capitalize<string & Property>}`]: Obj[Property];
  10. };
  11. export type Closeable<T> = T | boolean | null;
  12. export type Padding = number | 'auto';