TypeScript Version: 2.7.0-dev.201xxxxx
Example 1
Code
interface Dict<T> {
[key: string]: T
}
declare function filter<T>(fn: (value: T) => boolean): (x: Dict<T>) => Dict<T>;
declare function filter<T>(fn: (value: T) => boolean): (x: T[]) => T[];
declare function pipe<V0, T1>(fn0: (x0: V0) => T1): (x0: V0) => T1;
declare function pipe<V0, T1, T2>(fn0: (x0: V0) => T1, fn1: (x: T1) => T2): (x0: V0) => T2;
const x = pipe(filter((x: string) => true))
console.log(x(['foo']))
Expected behavior:
x is of type (v: string[]) => string[]
Actual behavior:
Argument of type 'string[]' is not assignable to parameter of type 'Dict'.
Example 2
Code
interface Dict<T> {
[key: string]: T
}
declare function filter<T>(fn: (value: T) => boolean): (x: Dict<T>) => Dict<T>;
declare function filter<T>(fn: (value: T) => boolean): (x: T[]) => T[];
declare function pipe<V0, T1>(fn0: (x0: V0) => T1): (x0: V0) => T1;
declare function pipe<V0, T1, T2>(fn0: (x0: V0) => T1, fn1: (x: T1) => T2): (x0: V0) => T2;
// >>> specialized id, which should specify filter overload
const id = (x: string[]): string[] => x
const x = pipe(id, filter((x: string) => true))
console.log(x(['foo']))
Expected behavior:
x is of type (v: string[]) => string[]
Actual behavior:
Argument of type 'string[]' is not assignable to parameter of type 'Dict'. Now failing on filter.
TypeScript Version: 2.7.0-dev.201xxxxx
Example 1
Code
Expected behavior:
xis of type(v: string[]) => string[]Actual behavior:
Argument of type 'string[]' is not assignable to parameter of type 'Dict'.
Example 2
Code
Expected behavior:
xis of type(v: string[]) => string[]Actual behavior:
Argument of type 'string[]' is not assignable to parameter of type 'Dict'. Now failing on
filter.