Skip to content

Commit

Permalink
Add followup test to #52123 test (#52178)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebailey committed Jan 19, 2023
1 parent b7f619d commit 6622308
Show file tree
Hide file tree
Showing 4 changed files with 242 additions and 152 deletions.
19 changes: 19 additions & 0 deletions tests/baselines/reference/coAndContraVariantInferences2.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ function f2(b: B, c: C) {
consume(c, c, useA); // consume<C, C>
}

declare function every<T, U extends T>(array: readonly T[], f: (x: T) => x is U): array is readonly U[];

function f3(arr: readonly B[] | readonly C[]) {
if (every(arr, isC)) {
arr; // readonly C[]
}
else {
arr; // readonly B[]
}
}

// Repro from #52111

enum SyntaxKind {
Expand Down Expand Up @@ -120,6 +131,14 @@ function f2(b, c) {
consume(b, b, useA); // consume<B, B>
consume(c, c, useA); // consume<C, C>
}
function f3(arr) {
if (every(arr, isC)) {
arr; // readonly C[]
}
else {
arr; // readonly B[]
}
}
// Repro from #52111
var SyntaxKind;
(function (SyntaxKind) {
Expand Down
Loading

0 comments on commit 6622308

Please sign in to comment.