type-tls 3.8.0 → 3.10.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.
Files changed (2) hide show
  1. package/dist/class.d.ts +25 -4
  2. package/package.json +1 -1
package/dist/class.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * 类的类型、构造函数的类型
3
3
  *
4
- * @typeParam Arg - 构建函数的参数类型
5
4
  * @typeParam Instance - 构建函数的返回的实例类型
5
+ * @typeParam Arg - 构建函数的参数类型
6
6
  */
7
- export interface ClassType<Arg extends any[] = any, Instance = any> {
7
+ export interface ClassType<Instance = any, Arg extends any[] = any> {
8
8
  /**
9
9
  * 类的构造函数
10
10
  */
@@ -14,17 +14,38 @@ export interface ClassType<Arg extends any[] = any, Instance = any> {
14
14
  */
15
15
  prototype: Instance;
16
16
  }
17
+ /**
18
+ * 抽象类的类型、构造函数的类型
19
+ */
20
+ export interface AbstractClassType<Instance = any, Arg extends any[] = any> extends AbstractConstructor<Instance, Arg> {
21
+ /**
22
+ * 类的原型对象
23
+ */
24
+ prototype: Instance;
25
+ }
17
26
  /**
18
27
  * 构造函数的类型
19
28
  *
29
+ * @typeParam Instance - 构建函数的返回的实例类型
20
30
  * @typeParam Arg - 构建函数的参数类型
31
+ */
32
+ export type Constructor<Instance = any, Arg extends any[] = any> = new (...args: Arg) => Instance;
33
+ /**
34
+ * 抽象构造函数的类型
35
+ * @remarks
36
+ * TypeScript 严格模式下,不能将“抽象构造函数”赋值给“非抽象构造函数”约束。但反之可以
21
37
  * @typeParam Instance - 构建函数的返回的实例类型
38
+ * @typeParam Arg - 构建函数的参数类型
22
39
  */
23
- export type Constructor<Arg extends any[] = any, Instance = any> = new (...args: Arg) => Instance;
40
+ export type AbstractConstructor<Instance = any, Arg extends any[] = any> = abstract new (...args: Arg) => Instance;
24
41
  /**
25
42
  * 构造函数的类型接口
43
+ * @remarks
44
+ * TypeScript 严格模式下,不能将“抽象构造函数”赋值给“非抽象构造函数”约束。但反之可以
45
+ * @typeParam Instance - 构建函数的返回的实例类型
46
+ * @typeParam Arg - 构建函数的参数类型
26
47
  */
27
- export interface IConstructor<Arg extends any[] = any, Instance = any> {
48
+ export interface IConstructor<Instance = any, Arg extends any[] = any> {
28
49
  new (...args: Arg): Instance;
29
50
  }
30
51
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "type-tls",
3
- "version": "3.8.0",
3
+ "version": "3.10.0",
4
4
  "description": "type-tls 封装了与类型相关的工具,比如:获取数据的类型 或 类型名字、判断数据的类型 等",
5
5
  "main": "./dist/type-tls.umd.cjs",
6
6
  "module": "./dist/type-tls.js",