Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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