// @lib: es2015 // @strict: true // @target: es2015 declare function f1(x: T[]): T; let neverArray: never[] = []; let a1 = f1([]); // never let a2 = f1(neverArray); // never // Repro from #19576 type Comparator = (x: T, y: T) => number; interface LinkedList { comparator: Comparator, nodes: Node } type Node = { value: T, next: Node } | null declare function compareNumbers(x: number, y: number): number; declare function mkList(items: T[], comparator: Comparator): LinkedList; const list: LinkedList = mkList([], compareNumbers); // Repro from #19858 declare function f2(as1: a[], as2: a[], cmp: (a1: a, a2: a) => number): void; f2(Array.from([0]), [], (a1, a2) => a1 - a2); f2(Array.from([]), [0], (a1, a2) => a1 - a2);