type-tls 2.5.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +24 -0
- package/dist/type-tls.d.ts +28 -0
- package/doc/api/type-tls.md +4 -0
- package/doc/api/type-tls.pickcontainsvalue.md +17 -0
- package/doc/api/type-tls.picknoncontainsvalue.md +17 -0
- package/doc/api/type-tls.picknonvalue.md +17 -0
- package/doc/api/type-tls.pickvalue.md +17 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -202,6 +202,30 @@ export declare type KeyOfContainsValue<Target, Value> = {
|
|
|
202
202
|
export declare type KeyOfNonContainsValue<Target, Value> = {
|
|
203
203
|
[K in keyof Target]: Value extends Target[K] ? never : K;
|
|
204
204
|
}[keyof Target];
|
|
205
|
+
/**
|
|
206
|
+
* 从 T 中挑选出那些成员值为 V 的类型的成员
|
|
207
|
+
*/
|
|
208
|
+
export declare type PickValue<T, V extends T[keyof T]> = {
|
|
209
|
+
[P in KeyOfValue<T, V>]: T[P];
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* 从 T 中挑选出那些成员值不是 V 的类型的成员
|
|
213
|
+
*/
|
|
214
|
+
export declare type PickNonValue<T, V extends T[keyof T]> = {
|
|
215
|
+
[P in KeyOfNonValue<T, V>]: T[P];
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* 从 T 中挑选出那些成员值的类型包含 V 类型的成员
|
|
219
|
+
*/
|
|
220
|
+
export declare type PickContainsValue<T, V extends T[keyof T]> = {
|
|
221
|
+
[P in KeyOfContainsValue<T, V>]: T[P];
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* 从 T 中挑选出那些成员值的类型不包含 V 类型的成员
|
|
225
|
+
*/
|
|
226
|
+
export declare type PickNonContainsValue<T, V extends T[keyof T]> = {
|
|
227
|
+
[P in KeyOfNonContainsValue<T, V>]: T[P];
|
|
228
|
+
};
|
|
205
229
|
/**
|
|
206
230
|
* 可将源类型 SourType 中的 类型 MatchType 替换为 新的类型 NewType
|
|
207
231
|
*/
|
package/dist/type-tls.d.ts
CHANGED
|
@@ -568,6 +568,34 @@ export declare type Optional<T> = T | null | undefined;
|
|
|
568
568
|
*/
|
|
569
569
|
export declare type OptionalBoolean = Optional<boolean>;
|
|
570
570
|
|
|
571
|
+
/**
|
|
572
|
+
* 从 T 中挑选出那些成员值的类型包含 V 类型的成员
|
|
573
|
+
*/
|
|
574
|
+
export declare type PickContainsValue<T, V extends T[keyof T]> = {
|
|
575
|
+
[P in KeyOfContainsValue<T, V>]: T[P];
|
|
576
|
+
};
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* 从 T 中挑选出那些成员值的类型不包含 V 类型的成员
|
|
580
|
+
*/
|
|
581
|
+
export declare type PickNonContainsValue<T, V extends T[keyof T]> = {
|
|
582
|
+
[P in KeyOfNonContainsValue<T, V>]: T[P];
|
|
583
|
+
};
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* 从 T 中挑选出那些成员值不是 V 的类型的成员
|
|
587
|
+
*/
|
|
588
|
+
export declare type PickNonValue<T, V extends T[keyof T]> = {
|
|
589
|
+
[P in KeyOfNonValue<T, V>]: T[P];
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* 从 T 中挑选出那些成员值为 V 的类型的成员
|
|
594
|
+
*/
|
|
595
|
+
export declare type PickValue<T, V extends T[keyof T]> = {
|
|
596
|
+
[P in KeyOfValue<T, V>]: T[P];
|
|
597
|
+
};
|
|
598
|
+
|
|
571
599
|
/**
|
|
572
600
|
* 用于定义扩展选项中的私有成员
|
|
573
601
|
*/
|
package/doc/api/type-tls.md
CHANGED
|
@@ -90,6 +90,10 @@ type-tls 封装了与类型相关的工具,比如获取数据的类型 或 类
|
|
|
90
90
|
| [MethodReturnType](./type-tls.methodreturntype.md) | 获取对象的方法的返回的类型 |
|
|
91
91
|
| [Optional](./type-tls.optional.md) | 将某个类型变为可选的类型 |
|
|
92
92
|
| [OptionalBoolean](./type-tls.optionalboolean.md) | 可选的布尔类型 |
|
|
93
|
+
| [PickContainsValue](./type-tls.pickcontainsvalue.md) | 从 T 中挑选出那些成员值的类型包含 V 类型的成员 |
|
|
94
|
+
| [PickNonContainsValue](./type-tls.picknoncontainsvalue.md) | 从 T 中挑选出那些成员值的类型不包含 V 类型的成员 |
|
|
95
|
+
| [PickNonValue](./type-tls.picknonvalue.md) | 从 T 中挑选出那些成员值不是 V 的类型的成员 |
|
|
96
|
+
| [PickValue](./type-tls.pickvalue.md) | 从 T 中挑选出那些成员值为 V 的类型的成员 |
|
|
93
97
|
| [Replace](./type-tls.replace.md) | 可将源类型 SourType 中的 类型 MatchType 替换为 新的类型 NewType |
|
|
94
98
|
| [ReplaceNull](./type-tls.replacenull.md) | 可将源类型 SourType 中的 null 替换为 新的类型 NewType |
|
|
95
99
|
| [ReplaceUndefined](./type-tls.replaceundefined.md) | 可将源类型 SourType 中的 undefined 替换为 新的类型 NewType |
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [type-tls](./type-tls.md) > [PickContainsValue](./type-tls.pickcontainsvalue.md)
|
|
4
|
+
|
|
5
|
+
## PickContainsValue type
|
|
6
|
+
|
|
7
|
+
从 T 中挑选出那些成员值的类型包含 V 类型的成员
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export declare type PickContainsValue<T, V extends T[keyof T]> = {
|
|
13
|
+
[P in KeyOfContainsValue<T, V>]: T[P];
|
|
14
|
+
};
|
|
15
|
+
```
|
|
16
|
+
<b>References:</b> [KeyOfContainsValue](./type-tls.keyofcontainsvalue.md)
|
|
17
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [type-tls](./type-tls.md) > [PickNonContainsValue](./type-tls.picknoncontainsvalue.md)
|
|
4
|
+
|
|
5
|
+
## PickNonContainsValue type
|
|
6
|
+
|
|
7
|
+
从 T 中挑选出那些成员值的类型不包含 V 类型的成员
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export declare type PickNonContainsValue<T, V extends T[keyof T]> = {
|
|
13
|
+
[P in KeyOfNonContainsValue<T, V>]: T[P];
|
|
14
|
+
};
|
|
15
|
+
```
|
|
16
|
+
<b>References:</b> [KeyOfNonContainsValue](./type-tls.keyofnoncontainsvalue.md)
|
|
17
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [type-tls](./type-tls.md) > [PickNonValue](./type-tls.picknonvalue.md)
|
|
4
|
+
|
|
5
|
+
## PickNonValue type
|
|
6
|
+
|
|
7
|
+
从 T 中挑选出那些成员值不是 V 的类型的成员
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export declare type PickNonValue<T, V extends T[keyof T]> = {
|
|
13
|
+
[P in KeyOfNonValue<T, V>]: T[P];
|
|
14
|
+
};
|
|
15
|
+
```
|
|
16
|
+
<b>References:</b> [KeyOfNonValue](./type-tls.keyofnonvalue.md)
|
|
17
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [type-tls](./type-tls.md) > [PickValue](./type-tls.pickvalue.md)
|
|
4
|
+
|
|
5
|
+
## PickValue type
|
|
6
|
+
|
|
7
|
+
从 T 中挑选出那些成员值为 V 的类型的成员
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export declare type PickValue<T, V extends T[keyof T]> = {
|
|
13
|
+
[P in KeyOfValue<T, V>]: T[P];
|
|
14
|
+
};
|
|
15
|
+
```
|
|
16
|
+
<b>References:</b> [KeyOfValue](./type-tls.keyofvalue.md)
|
|
17
|
+
|