Is it feasible to create a function in TypeScript that takes an array of strings and returns a string union?
Consider the following example function:
function myfn(strs: string[]) {
return strs[0];
}
If I use this function like:
myfn(['a', 'b', 'c']) // => return type is: 'a' | 'b' | 'c'
Can TypeScript handle this requirement?