Skip to content

Commit cf981ad

Browse files
authored
remove Omit example & link to official TS page
1 parent 8af7e70 commit cf981ad

File tree

1 file changed

+1
-33
lines changed

1 file changed

+1
-33
lines changed

README.md

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,42 +6,10 @@ There is a stage in every TypeScript journey where you struggle getting the type
66

77
## Utility Types
88

9-
Be familiar with the [Utility Types that ship with TS](https://codewithstyle.info/Comprehensive-list-of-useful-built-in-types-in-TypeScript/). On top of that, here are handy Utility Types often used by TS practitioners, with explanation on what they do and how they can help. We will assume knowledge of [mapped types and conditional types](https://mariusschulz.com/blog/series/typescript-evolution) like `Exclude<T, U>` and `ReturnType<T>` but try to build progressively upon them.
9+
Be familiar with the [Utility Types that ship with TS](https://www.typescriptlang.org/docs/handbook/utility-types.html). On top of that, here are handy Utility Types often used by TS practitioners, with explanation on what they do and how they can help. We will assume knowledge of [mapped types and conditional types](https://mariusschulz.com/blog/series/typescript-evolution) like `Exclude<T, U>` and `ReturnType<T>` but try to build progressively upon them.
1010

1111
> Note: If you are new to conditional types, I highly recommend [DJSheldrick's blogpost and talk on Conditional Types in TypeScript](https://artsy.github.io/blog/2018/11/21/conditional-types-in-typescript/)
1212
13-
<details>
14-
<summary>
15-
<code>Omit&lt;T, K extends keyof T&gt;</code>: Subtract keys from one interface from the other.
16-
</summary>
17-
18-
```ts
19-
/**
20-
* Subtract keys from one interface from the other.
21-
*
22-
* @example
23-
* interface One { one: string }
24-
* interface Three { one: string, two: string }
25-
*
26-
* type Two = Omit<Three, keyof One>;
27-
*
28-
* // The type of Two will be
29-
* interface Two { two: string }
30-
*/
31-
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
32-
```
33-
34-
You can also supply string literals to omit:
35-
36-
```ts
37-
type SettingsPageProps = Omit<
38-
ServerConfig,
39-
"immutableSetting1" | "invisibleSetting2"
40-
>;
41-
```
42-
43-
</details>
44-
4513
<details>
4614
<summary>
4715
<code>Optionalize&lt;T extends K, K&gt;</code>: Remove from T the keys that are in common with K

0 commit comments

Comments
 (0)