Deep
Dive into powerful TypeScript utilities crafted to simplify and enhance your type system workflows.
1import type {
2 DeepOmit,
3 DeepPick,
4 DeepMerge,
5 DeepMutable
6} from "@halvaradop/ts-utility-types/deep"
7import * as validate from "@halvaradop/ts-utility-types/validate"
8
9type Test = DeepMergeAll<[Foo, {}, Bar], true>
10
11type User = {
12 name: string;
13 address: {
14 city: string;
15 zip: number;
16 };
17 age: number;
18}
19
20// Expected: { name: string; address: { zip: number }; age: number }
21type Omitted = DeepOmit<User, "address.city">
22
23// Expected: { name: string; address: { city: string } }
24type Picked = DeepPick<User, "name" | "address.city">
25
26// Expected: { name: string; address: { city: string; zip: number }; age: number }
27type Merged = DeepMerge<User, Partial<User>>
28
29// Expected: { name: string; address: { city: string; zip: number }; age: number }
30type Mapped = DeepMutable<User>