Skip to content

Commit 1ad6ae3

Browse files
committed
some tests for map funcs
1 parent 077f5f5 commit 1ad6ae3

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

test/assoc.test.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expectType, expectError } from 'tsd';
2-
import { __, assoc } from '../es';
2+
import { __, assoc, map } from '../es';
33

44
type BasicObj = {
55
str: string;
@@ -96,3 +96,14 @@ expectType<Omit<{ other: string }, 'str'> & Record<'str', string>>(assoc('str',
9696
expectType<BasicObj>(assoc('str', 'bar', obj));
9797
expectType<Omit<BasicObj, 'str'> & Record<'str', number>>(assoc('str', 2, obj));
9898
expectType<Omit<{ other: string }, 'str'> & Record<'str', string>>(assoc('str', 'foo', {} as { other: string }));
99+
100+
101+
//
102+
// map tests for sanity
103+
//
104+
105+
expectType<BasicObj[]>([obj].map(assoc('str', 'bar')));
106+
expectType<(Omit<BasicObj, 'str'> & Record<'str', number>)[]>([obj].map(assoc('str', 2)));
107+
108+
expectType<BasicObj[]>(map(assoc('str', 'bar'), [obj]));
109+
expectType<(Omit<BasicObj, 'str'> & Record<'str', number>)[]>(map(assoc('str', 2), [obj]));

0 commit comments

Comments
 (0)