Skip to content

Commit 61026e1

Browse files
wadetandyrichmolj
authored andcommitted
Revert switch to TS 2.8's Exclude (#96)
`Exclude` is a new language feature from typescript 2.8 that replaces the `Diff` functionality previously backing the `Omit` type. This only works in clients using 2.8, so let's keep using the old version for a little while until we can be confident most people have upgraded. Or until we can figure out how to have some sort of conditional typecheck in typescript.
1 parent 319cb0b commit 61026e1

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jsorm",
3-
"version": "1.3.0",
3+
"version": "1.3.1",
44
"description": "Javascript ORM",
55
"main": "lib/index.js",
66
"module": "lib-esm/index.js",

src/util/omit.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
export type Omit<T, K> = Pick<T, Exclude<keyof T, K>>
1+
// export type Omit<T, K> = Pick<T, Exclude<keyof T, K>>
2+
export type Diff<T extends string, U extends string> = ({ [P in T]: P } &
3+
{ [P in U]: never } & { [x: string]: never })[T]
4+
export type Omit<T, K extends keyof T> = { [P in Diff<keyof T, K>]: T[P] }

0 commit comments

Comments
 (0)