I have an js object with two keys, foo and bar.
const x = { foo: '', bar: '' }
Also I have abc function that take value (the value can be foo or bar only).
function abc(value: string) {
const selected = x[value];
}
currently, value is string type. but I want to have foo or bar (cause I have them in x object).
I try to do with
function abc(value: typeof x)
But typescript doesn't accept that.
How can I change my code to make it work as I expected?