We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c3ef37e commit 306aff3Copy full SHA for 306aff3
src/omit.ts
@@ -1,6 +1,6 @@
1
export default function omit<T extends object, K extends keyof T>(
2
obj: T,
3
- fields: K[],
+ fields: K[] | readonly K[],
4
): Omit<T, K> {
5
const clone = { ...obj };
6
tests/omit.test.ts
@@ -10,4 +10,9 @@ describe('omit', () => {
10
const ret = omit({ bamboo: 1 }, null);
11
expect(ret).toEqual({ bamboo: 1 });
12
});
13
+
14
+ it('readonly array', () => {
15
+ const ret = omit({ keep: 1, ignore: 2 }, ['ignore'] as const);
16
+ expect(ret).toEqual({ keep: 1 });
17
+ });
18
0 commit comments