I'm working with a library that has kind of a weird object signature for its values, for simplicity's sake i've made a derived example..
i'm trying to get the values of the object to all have number as the type, while the single key is something that has a named string:
type Person<Key = 'name'> = {
[key in string]?: key extends Key ? string : number
}
function makePerson(vd: Person) {}
makePerson({
name: 'somename',
age: 19,
height: 69,
weight: 350
})
I tried a method of combining something like type Person<T extends string> = { [key in T]: string } & { [key in Omit<string, T>]: number }
but I couldn't get that to work either .. says that Omit<string, T> is not assignable to string | number | symbol - which makes sense, since T extends string so there'd be no key..
anyways, any help would be greatly appreciated