-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed

Description
TypeScript Version: 2.7.0-dev.20171203
Code
type Fn<T> = <U extends T>(x: U) => U
function f<T, T1 extends T>(fns: Array<Fn<T>>, t1: T1) {
const a: ReadonlyArray<Fn<T1>> = fns; // This is an error
const b: ReadonlyArray<Fn<T>> = fns;
const c: ReadonlyArray<Fn<T1>> = b; // But this works
}
Expected behavior:
No error.
Actual behavior:
src/a.ts(3,11): error TS2322: Type 'Fn<T>[]' is not assignable to type 'ReadonlyArray<Fn<T1>>'.
Types of property 'includes' are incompatible.
Type '(searchElement: Fn<T>, fromIndex?: number) => boolean' is not assignable to type '(searchElement: Fn<T1>, fromIndex?: number) => boolean'.
Types of parameters 'searchElement' and 'searchElement' are incompatible.
Types of parameters 'x' and 'x' are incompatible.
Type 'U' is not assignable to type 'T1'.
Type 'T' is not assignable to type 'T1'.
amir-arad, aj-r and kroltan
Metadata
Metadata
Assignees
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed