|
9 | 9 | - [FieldPath](#fieldpath)
|
10 | 10 | - [GetField](#getfield)
|
11 | 11 | - [Merge](#merge)
|
| 12 | +- [PartialKeys](#partialkeys) |
| 13 | +- [PartialValues](#partialvalues) |
| 14 | +- [RequiredKeys](#requiredkeys) |
| 15 | +- [RequiredValues](#requiredvalues) |
12 | 16 |
|
13 | 17 | ## ExcludeKeys
|
14 | 18 |
|
@@ -114,4 +118,52 @@ Merge<
|
114 | 118 | // a: {foo: number; bar: {baz: bigint}}
|
115 | 119 | // c: {c1: number; c2: number; d: {e: {f: null; h: number}; g: null}}
|
116 | 120 | // }
|
| 121 | +``` |
| 122 | + |
| 123 | +## PartialKeys |
| 124 | + |
| 125 | +```ts |
| 126 | +import {PartialKeys} from 'just-types/object' |
| 127 | +// or |
| 128 | +import {object} from 'just-types' // and use object.PartialKeys |
| 129 | +
|
| 130 | +PartialKeys<{a: string, b: number, c: boolean}, 'a' | 'c'> //=> {a?: string, b: number, c?: boolean} |
| 131 | +PartialKeys<{a: string, b: number, c: boolean}, string> //=> {a?: string, b?: number, c?: boolean} |
| 132 | +PartialKeys<{a?: string, b?: number, c: boolean}, 'a' | 'd'> //=> {a?: string, b?: number, c: boolean} |
| 133 | +``` |
| 134 | + |
| 135 | +## PartialValues |
| 136 | + |
| 137 | +```ts |
| 138 | +import {PartialValues} from 'just-types/object' |
| 139 | +// or |
| 140 | +import {object} from 'just-types' // and use object.PartialValues |
| 141 | +
|
| 142 | +PartialValues<{a: string, b: number, c: boolean}, string | boolean> //=> {a?: string, b: number, c?: boolean} |
| 143 | +PartialValues<{a: 'Hello', b: string, c: boolean}, string> //=> {a?: 'Hello', b?: string, c: boolean} |
| 144 | +PartialValues<{a?: string, b?: number, c: boolean}, string> //=> {a?: string, b?: number, c: boolean} |
| 145 | +``` |
| 146 | + |
| 147 | +## RequiredKeys |
| 148 | + |
| 149 | +```ts |
| 150 | +import {RequiredKeys} from 'just-types/object' |
| 151 | +// or |
| 152 | +import {object} from 'just-types' // and use object.RequiredKeys |
| 153 | +
|
| 154 | +RequiredKeys<{a?: string, b?: number, c: boolean}, 'a' | 'c'> //=> {a: string, b?: number, c: boolean} |
| 155 | +RequiredKeys<{a?: string, b?: number, c: boolean}, string> //=> {a: string, b: number, c: boolean} |
| 156 | +RequiredKeys<{a?: string, b?: number, c: boolean}, 'a' | 'd'> //=> {a: string, b?: number, c: boolean} |
| 157 | +``` |
| 158 | + |
| 159 | +## RequiredValues |
| 160 | + |
| 161 | +```ts |
| 162 | +import {RequiredValues} from 'just-types/object' |
| 163 | +// or |
| 164 | +import {object} from 'just-types' // and use object.RequiredValues |
| 165 | +
|
| 166 | +RequiredValues<{a?: string, b?: number, c?: boolean}, string | boolean> //=> {a: string, b?: number, c: boolean} |
| 167 | +RequiredValues<{a?: 'Hello', b?: string, c?: boolean}, string> //=> {a: 'Hello', b: string, c?: boolean} |
| 168 | +RequiredValues<{a: string, b: number, c?: boolean}, string> //=> {a: string, b: number, c?: boolean} |
117 | 169 | ```
|
0 commit comments