I've got an like this
export const ids = {
foo: 'this-is-foo',
bar: 'this-is-bar',
}
Is there any way for me to define a function that only accepts 'this-is-foo' or 'this-is-bar' as parameters (or any other value stored in the lookup object).
I've tried this but it only accepts foo or bar. And while that's a good restriction for the IDE, my intent is to call the method like so someMethod(ids.foo) and not .someMethod('foo')
/** @param {keyof ids} id */
const someMethod(id) {...}
Is there any way to do this via typescript?