Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
264 B
3
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>