Skip to content

Commit 306aff3

Browse files
authored
sync lodash (#391)
* sync lodash * update * update * update * update * update * update * add test case
1 parent c3ef37e commit 306aff3

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/omit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export default function omit<T extends object, K extends keyof T>(
22
obj: T,
3-
fields: K[],
3+
fields: K[] | readonly K[],
44
): Omit<T, K> {
55
const clone = { ...obj };
66

tests/omit.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,9 @@ describe('omit', () => {
1010
const ret = omit({ bamboo: 1 }, null);
1111
expect(ret).toEqual({ bamboo: 1 });
1212
});
13+
14+
it('readonly array', () => {
15+
const ret = omit({ keep: 1, ignore: 2 }, ['ignore'] as const);
16+
expect(ret).toEqual({ keep: 1 });
17+
});
1318
});

0 commit comments

Comments
 (0)