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
5 changes: 3 additions & 2 deletions type-definitions/ts-tests/from-js.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ test('fromJS', () => {
Collection<unknown, unknown>
>();

expect(fromJS('abc')).type.toBeString();
expect(fromJS('abc')).type.toBe<string>();

expect(fromJS([0, 1, 2])).type.toBe<List<number>>();

Expand Down Expand Up @@ -36,7 +36,8 @@ test('fromJS in an array of function', () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const create = [(data: any) => data, fromJS][1];

expect(create({ a: 'A' })).type.toBeAny();
// eslint-disable-next-line @typescript-eslint/no-explicit-any
expect(create({ a: 'A' })).type.toBe<any>();

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const createConst = ([(data: any) => data, fromJS] as const)[1];
Expand Down
4 changes: 2 additions & 2 deletions type-definitions/ts-tests/functional.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ test('getIn', () => {
});

test('has', () => {
expect(has([1, 2, 3], 0)).type.toBeBoolean();
expect(has([1, 2, 3], 0)).type.toBe<boolean>();

expect(has({ x: 10, y: 20 }, 'x')).type.toBeBoolean();
expect(has({ x: 10, y: 20 }, 'x')).type.toBe<boolean>();
});

test('hasIn', () => {
Expand Down
4 changes: 2 additions & 2 deletions type-definitions/ts-tests/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ test('#shift', () => {
});

test('#update', () => {
expect(List().update((v) => 1)).type.toBeNumber();
expect(List().update((v) => 1)).type.toBe<number>();

expect(
List<number>().update((v: List<string> | undefined) => v)
Expand Down Expand Up @@ -398,6 +398,6 @@ test('for of loops', () => {
const list = List([1, 2, 3, 4]);

for (const val of list) {
expect(val).type.toBeNumber();
expect(val).type.toBe<number>();
}
});
30 changes: 15 additions & 15 deletions type-definitions/ts-tests/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,29 +55,29 @@ test('#get', () => {

expect(Map<number, number>().get<number>(4, 'a')).type.toRaiseError();

expect(Map({ a: 4, b: true }).get('a')).type.toBeNumber();
expect(Map({ a: 4, b: true }).get('a')).type.toBe<number>();

expect(Map({ a: 4, b: true }).get('b')).type.toBeBoolean();
expect(Map({ a: 4, b: true }).get('b')).type.toBe<boolean>();

expect(
Map({ a: Map({ b: true }) })
.get('a')
.get('b')
).type.toBeBoolean();
).type.toBe<boolean>();

expect(Map({ a: 4 }).get('b')).type.toRaiseError();

expect(Map({ a: 4 }).get('b', undefined)).type.toBeUndefined();
expect(Map({ a: 4 }).get('b', undefined)).type.toBe<undefined>();

expect(Map({ 1: 4 }).get(1)).type.toBeNumber();
expect(Map({ 1: 4 }).get(1)).type.toBe<number>();

expect(Map({ 1: 4 }).get(2)).type.toRaiseError();

expect(Map({ 1: 4 }).get(2, 3)).type.toBe<3>();

const s1 = Symbol('s1');

expect(Map({ [s1]: 4 }).get(s1)).type.toBeNumber();
expect(Map({ [s1]: 4 }).get(s1)).type.toBe<number>();

const s2 = Symbol('s2');

Expand All @@ -87,9 +87,9 @@ test('#get', () => {
test('#getIn', () => {
const result = Map({ a: 4, b: true }).getIn(['a']);

expect(result).type.toBeNumber();
expect(result).type.toBe<number>();

expect(Map({ a: 4, b: true }).getIn(['a' as const])).type.toBeNumber();
expect(Map({ a: 4, b: true }).getIn(['a' as const])).type.toBe<number>();

expect(
Map({ a: Map({ b: Map({ c: Map({ d: 4 }) }) }) }).getIn([
Expand All @@ -98,11 +98,11 @@ test('#getIn', () => {
'c' as const,
'd' as const,
])
).type.toBeNumber();
).type.toBe<number>();

expect(Map({ a: [1] }).getIn(['a' as const, 0])).type.toBeNumber();
expect(Map({ a: [1] }).getIn(['a' as const, 0])).type.toBe<number>();

expect(Map({ a: List([1]) }).getIn(['a' as const, 0])).type.toBeNumber();
expect(Map({ a: List([1]) }).getIn(['a' as const, 0])).type.toBe<number>();
});

test('#set', () => {
Expand Down Expand Up @@ -132,7 +132,7 @@ test('#set', () => {

expect(
Map<{ a: number; b?: string }>({ a: 1 }).set('b', 'b').get('a')
).type.toBeNumber();
).type.toBe<number>();

expect(
Map<{ a: number; b?: string }>({ a: 1 }).set('b', 'b').get('b')
Expand All @@ -154,7 +154,7 @@ test('#delete', () => {

expect(Map<number, number>().delete('a')).type.toRaiseError();

expect(Map({ a: 1, b: 'b' }).delete('b')).type.toBeNever();
expect(Map({ a: 1, b: 'b' }).delete('b')).type.toBe<never>();

expect(
Map<{ a: number; b?: string }>({ a: 1, b: 'b' }).delete('b')
Expand All @@ -166,7 +166,7 @@ test('#delete', () => {

expect(
Map<{ a: number; b?: string }>({ a: 1, b: 'b' }).remove('b').get('a')
).type.toBeNumber();
).type.toBe<number>();

expect(
Map<{ a: number; b?: string }>({ a: 1, b: 'b' }).remove('b').get('b')
Expand Down Expand Up @@ -206,7 +206,7 @@ test('#clear', () => {
});

test('#update', () => {
expect(Map().update((v) => 1)).type.toBeNumber();
expect(Map().update((v) => 1)).type.toBe<number>();

expect(
Map<number, number>().update((v: Map<string> | undefined) => v)
Expand Down
2 changes: 1 addition & 1 deletion type-definitions/ts-tests/ordered-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ test('#clear', () => {
});

test('#update', () => {
expect(OrderedMap().update((v) => 1)).type.toBeNumber();
expect(OrderedMap().update((v) => 1)).type.toBe<number>();

expect(
OrderedMap<number, number>().update(
Expand Down
6 changes: 3 additions & 3 deletions type-definitions/ts-tests/record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ test('Factory', () => {

expect(point).type.toBe<PointClass>();

expect(point.x).type.toBeNumber();
expect(point.x).type.toBe<number>();

expect(point.y).type.toBeNumber();
expect(point.y).type.toBe<number>();

expect(point.setX(10)).type.toBe<PointClass>();

Expand All @@ -50,7 +50,7 @@ test('Factory', () => {
test('.getDescriptiveName', () => {
const PointXY = Record({ x: 0, y: 0 });

expect(Record.getDescriptiveName(PointXY())).type.toBeString();
expect(Record.getDescriptiveName(PointXY())).type.toBe<string>();

expect(Record.getDescriptiveName({})).type.toRaiseError();
});
Expand Down