Closed
Description
Bug Report
🔎 Search Terms
- This expression is not callable
- none of those signatures are compatible with each other
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about union types. I also reviewed previous related issues.
⏯ Playground Link
- .every() does not work
- .filter() does not work
- .find() does not work
- .reduce() also doesn't work, but there is already an issue for that one. (Perhaps we should merge it into this?)
💻 Code
interface Fizz {
id: number;
fizz: string;
}
interface Buzz {
id: number;
buzz: string;
}
([] as Fizz[] | Buzz[]).filter(item => item.id < 5);
🙁 Actual behavior
Compilation fails with the following error:
This expression is not callable.
Each member of the union type '{ <S extends Fizz>(predicate: (value: Fizz, index: number, array: Fizz[]) => value is S, thisArg?: any): S[]; (predicate: (value: Fizz, index: number, array: Fizz[]) => unknown, thisArg?: any): Fizz[]; } | { ...; }' has signatures, but none of those signatures are compatible with each other.
🙂 Expected behavior
Compilation succeeds, as it does for map and several other array functions.