Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use renamed matchers in type tests #1993

Merged
merged 1 commit into from Apr 16, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions type-definitions/ts-tests/covariance.ts
Expand Up @@ -39,31 +39,31 @@ test('List covariance', () => {

expect(List([new B()])).type.toBe<List<B>>();

expect<List<C>>().type.not.toBeAssignable(List<B>());
expect<List<C>>().type.not.toBeAssignableWith(List<B>());
});

test('Map covariance', () => {
expect<Map<string, A>>().type.toBeAssignableWith<Map<string, B>>();

expect(Map({ b: new B() })).type.toBe<MapOf<{ b: B }>>();

expect<Map<string, C>>().type.not.toBeAssignable<Map<string, B>>();
expect<Map<string, C>>().type.not.toBeAssignableWith<Map<string, B>>();
});

test('Set covariance', () => {
expect<Set<A>>().type.toBeAssignableWith<Set<B>>();

expect(Set([new B()])).type.toBe<Set<B>>();

expect<Set<C>>().type.not.toBeAssignable<Set<B>>();
expect<Set<C>>().type.not.toBeAssignableWith<Set<B>>();
});

test('Stack covariance', () => {
expect<Stack<A>>().type.toBeAssignableWith<Stack<B>>();

expect(Stack([new B()])).type.toBe<Stack<B>>();

expect<Stack<C>>().type.not.toBeAssignable<Stack<B>>();
expect<Stack<C>>().type.not.toBeAssignableWith<Stack<B>>();
});

test('OrderedMap covariance', () => {
Expand All @@ -73,7 +73,7 @@ test('OrderedMap covariance', () => {

expect(OrderedMap({ b: new B() })).type.toBe<OrderedMap<string, B>>();

expect<OrderedMap<string, C>>().type.not.toBeAssignable<
expect<OrderedMap<string, C>>().type.not.toBeAssignableWith<
OrderedMap<string, B>
>();
});
Expand All @@ -83,5 +83,5 @@ test('OrderedSet covariance', () => {

expect(OrderedSet([new B()])).type.toBe<OrderedSet<B>>();

expect<OrderedSet<C>>().type.not.toBeAssignable<OrderedSet<B>>();
expect<OrderedSet<C>>().type.not.toBeAssignableWith<OrderedSet<B>>();
});
2 changes: 1 addition & 1 deletion type-definitions/ts-tests/list.ts
Expand Up @@ -17,7 +17,7 @@ test('#constructor', () => {
expect<List<number>>().type.toBeAssignableWith(List<number>());

expect<List<number | string>>().type.toBeAssignableWith(List([1, 'a']));
expect<List<number>>().type.not.toBeAssignable(List([1, 'a']));
expect<List<number>>().type.not.toBeAssignableWith(List([1, 'a']));
});

test('#size', () => {
Expand Down