import type { Properties, PropertiesHyphen } from 'csstype';
/**
 * @example TupleToUnion<[1,2]>  // 1 | 2
 * type[number]
 */
export type TupleToUnion<ArrayType> = ArrayType extends readonly unknown[] ? ArrayType[number] : never;
export type Primitive = undefined | null | boolean | string | number | symbol;
/**
 * 深度必填
 */
export type DeepRequired<T> = T extends Primitive ? T : keyof T extends never ? T : {
    [K in keyof T]-?: DeepRequired<T[K]>;
};
/**
 * 深度删除readonly
 */
export type DeepWritable<T> = T extends Primitive ? T : keyof T extends never ? T : {
    -readonly [K in keyof T]: DeepWritable<T[K]>;
};
/**
 * 把一堆类型 如：Partial<Pick<User, "name">> & Omit<User, "name">   合并成简单的 {name?:string;age:number}
 */
export type MergeType<T> = {
    [K in keyof T]: T[K];
};
/**
 * https://github.com/type-challenges/type-challenges/blob/master/questions/02757-medium-partialbykeys/README.md
 */
export type PartialByKeys<T, K = keyof T, P extends keyof T = Extract<keyof T, K>> = MergeType<Partial<Pick<T, P>> & Omit<T, P>>;
/**
 * https://github.com/type-challenges/type-challenges/blob/master/questions/02759-medium-requiredbykeys/README.md
 */
export type RequiredByKeys<T, K = keyof T, P extends keyof T = Extract<keyof T, K>> = MergeType<Required<Pick<T, P>> & Omit<T, P>>;
export interface CSSProperties extends Properties<string | number>, PropertiesHyphen<string | number> {
    /**
     * The index signature was removed to enable closed typing for style
     * using CSSType. You're able to use type assertion or module augmentation
     * to add properties or an index signature of your own.
     *
     * For examples and more information, visit:
     * https://github.com/frenic/csstype#what-should-i-do-when-i-get-type-errors
     */
    [v: `--${string}`]: string | number | undefined;
}
