Browse Source

Pull request #3295: 无JIRA refactor(base/extend): 完善泛型

Merge in VISUAL/fineui from ~XAVIER.MENG/fineui:master to master

* commit '4fa41bab0021f13250c7b643f77f3894cba21e3e':
  无JIRA refactor(base/extend): 完善泛型
research/test
Xavier.Meng-孟宇翔 2 years ago
parent
commit
459f54b191
  1. 11
      typescript/core/base.ts

11
typescript/core/base.ts

@ -177,7 +177,8 @@ export interface _base {
functions: (object: object) => string[];
extend: (object: object, ...sources: any[]) => object;
extend<T extends object>(object: T): T;
extend<T extends object, U extends object>(object: T, ...sources: U[]): T & UnionToIntersection<U>;
defaults: (object: object, ...sources: any[]) => object;
@ -399,3 +400,11 @@ type merge = {
deepExtend(object: any, ...otherArgs: any[]): any;
}
type UnionToIntersection<Union> = (
Union extends unknown
? (x: Union) => void
: never
) extends ((x: infer Intersection) => void)
? Intersection
: never;

Loading…
Cancel
Save