I am trying to create a Typescript function that have a parameter with an interface of Object[] or string[].
interface NameObj {
val: string
}
const myFunc = function(names : NameObj[] | string[], toFind: string) {
return names.find(name => name.val === toFind || name === toFind );
}
const list = ['app', 'test', 'ben']
console.log(myFunc(list, 'ben'))
but I am getting an Lint error in find(name => ...) of
Parameter 'name' implicitly has an 'any' type.'
Typescript playground Link Sample Code

(typeof name === 'string' ? name : name.val) === toFindplayground'val ' in name ? name.val === tofind : name === tofind