Untitled

mail@pastecode.io avatarunknown
plain_text
a month ago
264 B
1
Indexable
Never
type Obj = Record<string, string | number[]>


type ToIds<T extends Obj> = {
    [K in keyof T]: T[K] extends string ? string : number;
}

const obj  = {
    advisor: "Alert",
    cancel: "Button",
    option: [1,2],
}

type Test = ToIds<typeof obj>