Skip to content

Commit 5b1554f

Browse files
committed
Change test to use type variables
1 parent b5a39e8 commit 5b1554f

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

tests/cases/conformance/types/conditional/conditionalTypes2.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,17 @@ interface Invariant<T> {
1313
foo: T extends string ? keyof T : T;
1414
}
1515

16-
interface A { a: string }
17-
interface B extends A { b: string }
18-
19-
20-
function f1(a: Covariant<A>, b: Covariant<B>) {
16+
function f1<A, B extends A>(a: Covariant<A>, b: Covariant<B>) {
2117
a = b;
2218
b = a; // Error
2319
}
2420

25-
function f2(a: Contravariant<A>, b: Contravariant<B>) {
21+
function f2<A, B extends A>(a: Contravariant<A>, b: Contravariant<B>) {
2622
a = b; // Error
2723
b = a;
2824
}
2925

30-
function f3(a: Invariant<A>, b: Invariant<B>) {
26+
function f3<A, B extends A>(a: Invariant<A>, b: Invariant<B>) {
3127
a = b; // Error
3228
b = a; // Error
3329
}

0 commit comments

Comments
 (0)