We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
TypeScript Version: playground / 3..3.333
Search Terms: union type, array map
Code
function flattenStringArrays(values: string | string[] | string[][]): string{ if (Array.isArray(values)) { return values.map(value => flattenStringArrays(value)).join(""); } else { return values; } }
Expected behavior: here the value in the map expression should be of type string[] | string[][]
value
string[] | string[][]
Actual behavior: Compilation error thrown:
Cannot invoke an expression whose type lacks a call signature. Type '((callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]) | ((callbackfn: (value: string[], index: number, array: string[][]) => U, thisArg?: any) => U[])' has no compatible call signatures.
Playground Link: link
Related Issues:
TypeScript Version: playground / 3..3.333
Search Terms:
union type, array map
Code
Expected behavior:
here the
valuein the map expression should be of typestring[] | string[][]Actual behavior:
Compilation error thrown:
Playground Link:
link
Related Issues: