@zwa73/utils 1.0.164 → 1.0.165
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/UtilFunctions.d.ts +2 -17
- package/dist/UtilFunctions.js +1 -81
- package/dist/UtilInterfaces.d.ts +0 -51
- package/package.json +1 -1
- package/src/UtilFunctions.ts +2 -95
- package/src/UtilInterfaces.ts +0 -68
package/dist/UtilFunctions.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PRecord, AnyFunc,
|
|
1
|
+
import { PRecord, AnyFunc, ExtractOutcome, IJData, JObject, JToken, Keyable, Literal, Matchable, MatchableFlag, Outcome, ReqVerifyFn, ProperSubsetCheck, UnionToIntersection, Await, AnyRecord, AllExtends } from "./UtilInterfaces";
|
|
2
2
|
import { LogLevel } from "./UtilLogger";
|
|
3
3
|
import { Failed, FailedLike, None, StatusSymbol, Success, SuccessLike, Timeout } from "./UtilSymbol";
|
|
4
4
|
declare const HashMethodList: readonly ["md5", "sha1", "sha256", "sha512", "sha3", "blake2", "blake3"];
|
|
@@ -117,21 +117,6 @@ export declare class UtilFunc {
|
|
|
117
117
|
* @returns 超时则返回 处理函数委托 完成则返回结果
|
|
118
118
|
*/
|
|
119
119
|
static timelimitPromise<T>(func: () => Promise<T> | T, timeLimit?: number): Promise<SuccessOut<T> | TimeoutOut<T>>;
|
|
120
|
-
/**部分类组合
|
|
121
|
-
* 将mixin的部分字段混入base
|
|
122
|
-
* @param base - 基础类
|
|
123
|
-
* @param mixin - 目标类
|
|
124
|
-
* @param key - mixin 对象在 base 中的 key
|
|
125
|
-
* @param fields - 需要混入的字段
|
|
126
|
-
* @returns 混合完成的类
|
|
127
|
-
*/
|
|
128
|
-
static composeClassPart<Base extends AnyRecord, Mixin extends AnyRecord, Field extends keyof Mixin>(base: Base, mixin: Mixin, key: string, ...fields: Field[]): ComposedClass<Base, Mixin, typeof key, Field>;
|
|
129
|
-
/**根据 MIXIN_FIELDS 自动混入
|
|
130
|
-
* @deprecated 非必要情况下, 对class定义请使用 composeRefMixinable
|
|
131
|
-
*/
|
|
132
|
-
static composeMixinable<Base extends AnyRecord, Mixins extends Mixinable<any>[]>(base: Base, ...mixins: Mixins): ComposedMixinable<Base, Mixins>;
|
|
133
|
-
/**根据 MIXIN_FIELDS 自动混入 */
|
|
134
|
-
static composeRefMixinable<Base extends AnyRecord, Mixins extends RefMixinable<any, unknown>[]>(base: Base, ...mixins: Mixins): ComposedRefMixinable<Base, Mixins>;
|
|
135
120
|
/**对对象的每个属性应用映射函数,并返回一个新的对象。
|
|
136
121
|
* @template T - 对象的类型
|
|
137
122
|
* @param obj - 要处理的对象
|
|
@@ -139,7 +124,7 @@ export declare class UtilFunc {
|
|
|
139
124
|
* @returns - 一个新的对象,它的属性是原对象的属性经过映射函数处理后的结果
|
|
140
125
|
*/
|
|
141
126
|
static mapEntries<T extends AnyRecord>(obj: T, mapper: (key: keyof T, value: T[keyof T]) => T[keyof T]): T;
|
|
142
|
-
|
|
127
|
+
/**遍历对象的所有字段
|
|
143
128
|
* @param obj - 对象
|
|
144
129
|
* @param callback - 回调函数
|
|
145
130
|
*/
|
package/dist/UtilFunctions.js
CHANGED
|
@@ -286,86 +286,6 @@ class UtilFunc {
|
|
|
286
286
|
reslove(result);
|
|
287
287
|
});
|
|
288
288
|
}
|
|
289
|
-
/**部分类组合
|
|
290
|
-
* 将mixin的部分字段混入base
|
|
291
|
-
* @param base - 基础类
|
|
292
|
-
* @param mixin - 目标类
|
|
293
|
-
* @param key - mixin 对象在 base 中的 key
|
|
294
|
-
* @param fields - 需要混入的字段
|
|
295
|
-
* @returns 混合完成的类
|
|
296
|
-
*/
|
|
297
|
-
static composeClassPart(base, mixin, key, ...fields) {
|
|
298
|
-
const compObj = base;
|
|
299
|
-
if (compObj[key] !== undefined)
|
|
300
|
-
UtilLogger_1.SLogger.warn(`key: ${key} 已存在于基础类中, 混入可能导致类型问题`);
|
|
301
|
-
compObj[key] = mixin;
|
|
302
|
-
for (const fd of fields) {
|
|
303
|
-
if (compObj[fd] !== undefined)
|
|
304
|
-
UtilLogger_1.SLogger.warn(`field: ${fd} 已存在于基础类中, 混入可能导致类型问题, 如需覆盖, 请使用 ${key}=val`);
|
|
305
|
-
//func需绑定this无法直接设置属性
|
|
306
|
-
if (typeof mixin[fd] === 'function') {
|
|
307
|
-
compObj[fd] = (...args) => compObj[key][fd](...args);
|
|
308
|
-
//#region other
|
|
309
|
-
//const memo = (...args: any[]) => compObj[key][fd](...args);
|
|
310
|
-
//Object.defineProperty(compObj, fd, {
|
|
311
|
-
// get:()=>memo,
|
|
312
|
-
// set:()=>SLogger.warn(new Error(`试图修改一个由 composeClassPart 组合的函数字段:${String(fd)}, 修改已被忽略`)),
|
|
313
|
-
// enumerable:true ,
|
|
314
|
-
// //writable: true ,
|
|
315
|
-
// configurable: true
|
|
316
|
-
//});
|
|
317
|
-
//(compObj as any)[fd] = (...args: any[]) => (mixin[fd] as any).apply(mixin, args);
|
|
318
|
-
//(compObj as any)[fd] = (mixin[fd] as any).bind(mixin);
|
|
319
|
-
//#endregion
|
|
320
|
-
}
|
|
321
|
-
else {
|
|
322
|
-
Object.defineProperty(compObj, fd, {
|
|
323
|
-
get: () => compObj[key][fd],
|
|
324
|
-
set: (value) => { compObj[key][fd] = value; },
|
|
325
|
-
enumerable: true,
|
|
326
|
-
//writable: true ,
|
|
327
|
-
configurable: true
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
return compObj;
|
|
332
|
-
}
|
|
333
|
-
/**根据 MIXIN_FIELDS 自动混入
|
|
334
|
-
* @deprecated 非必要情况下, 对class定义请使用 composeRefMixinable
|
|
335
|
-
*/
|
|
336
|
-
static composeMixinable(base, ...mixins) {
|
|
337
|
-
let out = base;
|
|
338
|
-
const fieldsSet = new Set();
|
|
339
|
-
for (const rawmixin of mixins) {
|
|
340
|
-
const mixin = rawmixin;
|
|
341
|
-
for (const field of mixin.MIXIN_FIELDS) {
|
|
342
|
-
const fixField = field;
|
|
343
|
-
if (fieldsSet.has(fixField))
|
|
344
|
-
UtilLogger_1.SLogger.warn(`composeMixinable 出现了重复的 field: ${fixField} 可能会导致问题`);
|
|
345
|
-
else
|
|
346
|
-
fieldsSet.add(fixField);
|
|
347
|
-
}
|
|
348
|
-
out = UtilFunc.composeClassPart(base, mixin, mixin.MIXIN_KEY, ...mixin.MIXIN_FIELDS);
|
|
349
|
-
}
|
|
350
|
-
return out;
|
|
351
|
-
}
|
|
352
|
-
/**根据 MIXIN_FIELDS 自动混入 */
|
|
353
|
-
static composeRefMixinable(base, ...mixins) {
|
|
354
|
-
let out = base;
|
|
355
|
-
const fieldsSet = new Set();
|
|
356
|
-
for (const mixin of mixins) {
|
|
357
|
-
const ctor = mixin.CTOR;
|
|
358
|
-
for (const field of ctor.MIXIN_FIELDS) {
|
|
359
|
-
const fixField = field;
|
|
360
|
-
if (fieldsSet.has(fixField))
|
|
361
|
-
UtilLogger_1.SLogger.warn(`composeMixinable 出现了重复的 field: ${fixField} 可能会导致问题`);
|
|
362
|
-
else
|
|
363
|
-
fieldsSet.add(fixField);
|
|
364
|
-
}
|
|
365
|
-
out = UtilFunc.composeClassPart(base, mixin, ctor.MIXIN_KEY, ...ctor.MIXIN_FIELDS);
|
|
366
|
-
}
|
|
367
|
-
return out;
|
|
368
|
-
}
|
|
369
289
|
/**对对象的每个属性应用映射函数,并返回一个新的对象。
|
|
370
290
|
* @template T - 对象的类型
|
|
371
291
|
* @param obj - 要处理的对象
|
|
@@ -378,7 +298,7 @@ class UtilFunc {
|
|
|
378
298
|
return result;
|
|
379
299
|
}, {});
|
|
380
300
|
}
|
|
381
|
-
|
|
301
|
+
/**遍历对象的所有字段
|
|
382
302
|
* @param obj - 对象
|
|
383
303
|
* @param callback - 回调函数
|
|
384
304
|
*/
|
package/dist/UtilInterfaces.d.ts
CHANGED
|
@@ -107,57 +107,6 @@ export type Await<T> = T extends Promise<infer U> ? U : T;
|
|
|
107
107
|
export type FuncPropNames<T> = {
|
|
108
108
|
[K in keyof T]: T[K] extends AnyFunc ? K : never;
|
|
109
109
|
}[keyof T];
|
|
110
|
-
/**部分组合的类
|
|
111
|
-
* @template Base - 基类
|
|
112
|
-
* @template Mixin - 待混入的类
|
|
113
|
-
* @template PropKeys - 需要混入的成员key
|
|
114
|
-
*/
|
|
115
|
-
export type ComposedClass<Base, Mixin, Key extends string, PropKeys extends keyof Mixin> = Base & Pick<Mixin, PropKeys> & {
|
|
116
|
-
[P in Key]: Mixin;
|
|
117
|
-
};
|
|
118
|
-
/**可自动混入的类型 */
|
|
119
|
-
export type Mixinable<Mixin> = {
|
|
120
|
-
/**混入时自身所在位置
|
|
121
|
-
* 请使用字面量
|
|
122
|
-
*/
|
|
123
|
-
readonly MIXIN_KEY: string;
|
|
124
|
-
/**可混入的字段
|
|
125
|
-
* 请使用字面量
|
|
126
|
-
*/
|
|
127
|
-
readonly MIXIN_FIELDS: readonly (keyof Mixin)[];
|
|
128
|
-
};
|
|
129
|
-
/**是原型构造器类型 */
|
|
130
|
-
export type IsCtor<T> = T extends {
|
|
131
|
-
new (): infer Ins;
|
|
132
|
-
} ? T : never;
|
|
133
|
-
/**可反射的
|
|
134
|
-
* @template Ctor - 构造器类型
|
|
135
|
-
* @template Constraint - 构造器约束
|
|
136
|
-
*/
|
|
137
|
-
export type ReflectionAble<Ctor, Constraint = {}> = {
|
|
138
|
-
/**原型构造器 */
|
|
139
|
-
readonly CTOR: Ctor & Constraint;
|
|
140
|
-
};
|
|
141
|
-
/**可反射的 且 构造函数是可混入的类
|
|
142
|
-
* @template Ctor - 构造器类型
|
|
143
|
-
* @template Instance - 实例类型 如果采用了内部混入, 那么填入对外实际暴露的类型, 以支持混入多层字段
|
|
144
|
-
* @template Constraint - 构造器约束
|
|
145
|
-
* @example
|
|
146
|
-
* export class MixinModule implements RefMixinable<typeof MixinModule,MixinModule>{
|
|
147
|
-
* static readonly MIXIN_FIELDS = [
|
|
148
|
-
* 'func_a',
|
|
149
|
-
* 'field_b'
|
|
150
|
-
* ] as const;
|
|
151
|
-
* static readonly MIXIN_KEY = '__mixinModule';
|
|
152
|
-
* CTOR = MixinModule;
|
|
153
|
-
* }
|
|
154
|
-
*/
|
|
155
|
-
export type RefMixinable<Ctor, Instance, Constraint = {}> = ReflectionAble<Ctor, Mixinable<Instance> & Constraint>;
|
|
156
|
-
/**自动组合可混入的类
|
|
157
|
-
*/
|
|
158
|
-
export type ComposedMixinable<B, Ms extends unknown[]> = Ms extends [infer M, ...infer Rest] ? M extends Mixinable<M> ? ComposedMixinable<ComposedClass<B, M, M['MIXIN_KEY'], M['MIXIN_FIELDS'][number]>, Rest> : "一个混入类没有实现 Mixinable<self>" & Error : B;
|
|
159
|
-
/**自动组合 可反射的 且 构造函数是可混入的 类 */
|
|
160
|
-
export type ComposedRefMixinable<B, Ms extends unknown[]> = Ms extends [infer M, ...infer Rest] ? M extends RefMixinable<unknown, M> ? ComposedRefMixinable<ComposedClass<B, M, M['CTOR']['MIXIN_KEY'], M['CTOR']['MIXIN_FIELDS'][number]>, Rest> : "一个混入类没有实现 RefMixinable<typeof self, self>" & Error : B;
|
|
161
110
|
/** extends封装
|
|
162
111
|
* @template B - 基础类型
|
|
163
112
|
* @template T - 判断的目标类型
|
package/package.json
CHANGED
package/src/UtilFunctions.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as crypto from "crypto";
|
|
2
|
-
import { PRecord, AnyFunc,
|
|
2
|
+
import { PRecord, AnyFunc, ExtractOutcome, IJData, JObject, JToken, Keyable, Literal, Matchable, MatchableFlag, Outcome, ReqStat, ReqVerifyFn, ProperSubsetCheck, UnionToIntersection, Await, AnyRecord, AllExtends } from "@src/UtilInterfaces";
|
|
3
3
|
import * as cp from "child_process";
|
|
4
4
|
import { LogLevel, SLogger } from "@src/UtilLogger";
|
|
5
5
|
import { Completed, Failed, FailedLike, None, StatusSymbol, Success, SuccessLike, Terminated, Timeout } from "./UtilSymbol";
|
|
@@ -347,99 +347,6 @@ static timelimitPromise<T>
|
|
|
347
347
|
})
|
|
348
348
|
}
|
|
349
349
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
/**部分类组合
|
|
353
|
-
* 将mixin的部分字段混入base
|
|
354
|
-
* @param base - 基础类
|
|
355
|
-
* @param mixin - 目标类
|
|
356
|
-
* @param key - mixin 对象在 base 中的 key
|
|
357
|
-
* @param fields - 需要混入的字段
|
|
358
|
-
* @returns 混合完成的类
|
|
359
|
-
*/
|
|
360
|
-
static composeClassPart
|
|
361
|
-
<Base extends AnyRecord,Mixin extends AnyRecord,Field extends keyof Mixin>
|
|
362
|
-
(base:Base,mixin:Mixin,key:string,...fields:Field[]):ComposedClass<Base,Mixin,typeof key,Field>{
|
|
363
|
-
const compObj = base as any;
|
|
364
|
-
if(compObj[key]!==undefined)
|
|
365
|
-
SLogger.warn(`key: ${key as string} 已存在于基础类中, 混入可能导致类型问题`);
|
|
366
|
-
compObj[key] = mixin;
|
|
367
|
-
for(const fd of fields){
|
|
368
|
-
if(compObj[fd]!==undefined)
|
|
369
|
-
SLogger.warn(`field: ${fd as string} 已存在于基础类中, 混入可能导致类型问题, 如需覆盖, 请使用 ${key}=val`);
|
|
370
|
-
//func需绑定this无法直接设置属性
|
|
371
|
-
if(typeof mixin[fd] === 'function') {
|
|
372
|
-
compObj[fd] = (...args: any[]) => compObj[key][fd](...args);
|
|
373
|
-
//#region other
|
|
374
|
-
//const memo = (...args: any[]) => compObj[key][fd](...args);
|
|
375
|
-
//Object.defineProperty(compObj, fd, {
|
|
376
|
-
// get:()=>memo,
|
|
377
|
-
// set:()=>SLogger.warn(new Error(`试图修改一个由 composeClassPart 组合的函数字段:${String(fd)}, 修改已被忽略`)),
|
|
378
|
-
// enumerable:true ,
|
|
379
|
-
// //writable: true ,
|
|
380
|
-
// configurable: true
|
|
381
|
-
//});
|
|
382
|
-
//(compObj as any)[fd] = (...args: any[]) => (mixin[fd] as any).apply(mixin, args);
|
|
383
|
-
//(compObj as any)[fd] = (mixin[fd] as any).bind(mixin);
|
|
384
|
-
//#endregion
|
|
385
|
-
} else {
|
|
386
|
-
Object.defineProperty(compObj, fd, {
|
|
387
|
-
get: ()=>compObj[key][fd],
|
|
388
|
-
set: (value)=>{compObj[key][fd] = value},
|
|
389
|
-
enumerable:true ,
|
|
390
|
-
//writable: true ,
|
|
391
|
-
configurable: true
|
|
392
|
-
});
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
return compObj;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
/**根据 MIXIN_FIELDS 自动混入
|
|
399
|
-
* @deprecated 非必要情况下, 对class定义请使用 composeRefMixinable
|
|
400
|
-
*/
|
|
401
|
-
static composeMixinable
|
|
402
|
-
<Base extends AnyRecord, Mixins extends Mixinable<any>[]>
|
|
403
|
-
(base:Base,...mixins:Mixins):
|
|
404
|
-
ComposedMixinable<Base,Mixins>{
|
|
405
|
-
let out = base;
|
|
406
|
-
const fieldsSet = new Set<string>();
|
|
407
|
-
for(const rawmixin of mixins){
|
|
408
|
-
const mixin=rawmixin as any;
|
|
409
|
-
for(const field of mixin.MIXIN_FIELDS) {
|
|
410
|
-
const fixField = field as string;
|
|
411
|
-
if(fieldsSet.has(fixField))
|
|
412
|
-
SLogger.warn(`composeMixinable 出现了重复的 field: ${fixField} 可能会导致问题`);
|
|
413
|
-
else
|
|
414
|
-
fieldsSet.add(fixField);
|
|
415
|
-
}
|
|
416
|
-
out = UtilFunc.composeClassPart(base,mixin,mixin.MIXIN_KEY,...mixin.MIXIN_FIELDS);
|
|
417
|
-
}
|
|
418
|
-
return out as any;
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
/**根据 MIXIN_FIELDS 自动混入 */
|
|
422
|
-
static composeRefMixinable
|
|
423
|
-
<Base extends AnyRecord, Mixins extends RefMixinable<any,unknown>[]>
|
|
424
|
-
(base:Base,...mixins:Mixins):
|
|
425
|
-
ComposedRefMixinable<Base,Mixins>{
|
|
426
|
-
let out = base;
|
|
427
|
-
const fieldsSet = new Set<string>();
|
|
428
|
-
for(const mixin of mixins){
|
|
429
|
-
const ctor = mixin.CTOR;
|
|
430
|
-
for(const field of ctor.MIXIN_FIELDS) {
|
|
431
|
-
const fixField = field as string;
|
|
432
|
-
if(fieldsSet.has(fixField))
|
|
433
|
-
SLogger.warn(`composeMixinable 出现了重复的 field: ${fixField} 可能会导致问题`);
|
|
434
|
-
else
|
|
435
|
-
fieldsSet.add(fixField);
|
|
436
|
-
}
|
|
437
|
-
out = UtilFunc.composeClassPart(base,mixin,ctor.MIXIN_KEY,...ctor.MIXIN_FIELDS);
|
|
438
|
-
}
|
|
439
|
-
return out as any;
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
|
|
443
350
|
/**对对象的每个属性应用映射函数,并返回一个新的对象。
|
|
444
351
|
* @template T - 对象的类型
|
|
445
352
|
* @param obj - 要处理的对象
|
|
@@ -454,7 +361,7 @@ static mapEntries<T extends AnyRecord>
|
|
|
454
361
|
}, {} as T);
|
|
455
362
|
}
|
|
456
363
|
|
|
457
|
-
|
|
364
|
+
/**遍历对象的所有字段
|
|
458
365
|
* @param obj - 对象
|
|
459
366
|
* @param callback - 回调函数
|
|
460
367
|
*/
|
package/src/UtilInterfaces.ts
CHANGED
|
@@ -157,74 +157,6 @@ export type FuncPropNames<T> = {
|
|
|
157
157
|
[K in keyof T]: T[K] extends AnyFunc ? K : never;
|
|
158
158
|
}[keyof T];
|
|
159
159
|
|
|
160
|
-
/**部分组合的类
|
|
161
|
-
* @template Base - 基类
|
|
162
|
-
* @template Mixin - 待混入的类
|
|
163
|
-
* @template PropKeys - 需要混入的成员key
|
|
164
|
-
*/
|
|
165
|
-
export type ComposedClass<Base, Mixin, Key extends string, PropKeys extends keyof Mixin> =
|
|
166
|
-
Base & Pick<Mixin, PropKeys> & {[P in Key]:Mixin};
|
|
167
|
-
|
|
168
|
-
/**可自动混入的类型 */
|
|
169
|
-
export type Mixinable<Mixin> = {
|
|
170
|
-
/**混入时自身所在位置
|
|
171
|
-
* 请使用字面量
|
|
172
|
-
*/
|
|
173
|
-
readonly MIXIN_KEY: string;
|
|
174
|
-
/**可混入的字段
|
|
175
|
-
* 请使用字面量
|
|
176
|
-
*/
|
|
177
|
-
readonly MIXIN_FIELDS: readonly (keyof Mixin)[];
|
|
178
|
-
};
|
|
179
|
-
/**是原型构造器类型 */
|
|
180
|
-
export type IsCtor<T> = T extends {new():infer Ins}
|
|
181
|
-
? T : never;
|
|
182
|
-
/**可反射的
|
|
183
|
-
* @template Ctor - 构造器类型
|
|
184
|
-
* @template Constraint - 构造器约束
|
|
185
|
-
*/
|
|
186
|
-
export type ReflectionAble<Ctor,Constraint={}> = {
|
|
187
|
-
/**原型构造器 */
|
|
188
|
-
readonly CTOR:Ctor&Constraint
|
|
189
|
-
};
|
|
190
|
-
/**可反射的 且 构造函数是可混入的类
|
|
191
|
-
* @template Ctor - 构造器类型
|
|
192
|
-
* @template Instance - 实例类型 如果采用了内部混入, 那么填入对外实际暴露的类型, 以支持混入多层字段
|
|
193
|
-
* @template Constraint - 构造器约束
|
|
194
|
-
* @example
|
|
195
|
-
* export class MixinModule implements RefMixinable<typeof MixinModule,MixinModule>{
|
|
196
|
-
* static readonly MIXIN_FIELDS = [
|
|
197
|
-
* 'func_a',
|
|
198
|
-
* 'field_b'
|
|
199
|
-
* ] as const;
|
|
200
|
-
* static readonly MIXIN_KEY = '__mixinModule';
|
|
201
|
-
* CTOR = MixinModule;
|
|
202
|
-
* }
|
|
203
|
-
*/
|
|
204
|
-
export type RefMixinable<Ctor,Instance,Constraint={}> =
|
|
205
|
-
ReflectionAble<Ctor,Mixinable<Instance>&Constraint>;
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
/**自动组合可混入的类
|
|
209
|
-
*/
|
|
210
|
-
export type ComposedMixinable<B, Ms extends unknown[]> =
|
|
211
|
-
Ms extends [infer M, ...infer Rest]
|
|
212
|
-
? M extends Mixinable<M>
|
|
213
|
-
? ComposedMixinable<ComposedClass<B,M,M['MIXIN_KEY'],M['MIXIN_FIELDS'][number]>,Rest>
|
|
214
|
-
: "一个混入类没有实现 Mixinable<self>" & Error
|
|
215
|
-
: B
|
|
216
|
-
|
|
217
|
-
/**自动组合 可反射的 且 构造函数是可混入的 类 */
|
|
218
|
-
export type ComposedRefMixinable<B, Ms extends unknown[]> =
|
|
219
|
-
Ms extends [infer M, ...infer Rest]
|
|
220
|
-
? M extends RefMixinable<unknown,M>
|
|
221
|
-
? ComposedRefMixinable<ComposedClass<B,M,
|
|
222
|
-
M['CTOR']['MIXIN_KEY'],
|
|
223
|
-
M['CTOR']['MIXIN_FIELDS'][number]>,
|
|
224
|
-
Rest>
|
|
225
|
-
: "一个混入类没有实现 RefMixinable<typeof self, self>" & Error
|
|
226
|
-
: B
|
|
227
|
-
|
|
228
160
|
/** extends封装
|
|
229
161
|
* @template B - 基础类型
|
|
230
162
|
* @template T - 判断的目标类型
|