Skip to content

Commit 20e47ca

Browse files
committed
Add SimpleKeyOf type, resolves #45
1 parent 3d02c23 commit 20e47ca

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"removeComments": true,
1111
"noImplicitReturns": true,
1212
"noUnusedLocals": true,
13-
"keyofStringsOnly": true,
1413
"strict": true,
1514
"outDir": "build",
1615
"lib": ["es6", "es7", "dom"],

types/global.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ declare module '*.css' {
77
}
88

99
// Omit type https://github.com/Microsoft/TypeScript/issues/12215
10+
type SimpleKeyOf<T> = Extract<keyof T, 'number' | 'string'>;
1011
type Diff<T extends string, U extends string> = ({ [P in T]: P } & { [P in U]: never } & { [x: string]: never })[T];
11-
type Omit<T, K extends keyof T> = { [P in Diff<keyof T, K>]: T[P] };
12+
type Omit<T, K extends SimpleKeyOf<T>> = { [P in Diff<SimpleKeyOf<T>, K>]: T[P] };
1213

1314
type PartialPick<T, K extends keyof T> = Partial<T> & Pick<T, K>;

0 commit comments

Comments
 (0)