diff --git a/package.json b/package.json index 1d63cb5f5..373dd1c5f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20230103094653", + "version": "2.0.20230103111549", "description": "fineui", "main": "dist/fineui_without_conflict.min.js", "types": "dist/lib/index.d.ts", diff --git a/typescript/core/base.ts b/typescript/core/base.ts index 79dc317af..e681f2ac4 100644 --- a/typescript/core/base.ts +++ b/typescript/core/base.ts @@ -177,7 +177,8 @@ export interface _base { functions: (object: object) => string[]; - extend: (object: object, ...sources: any[]) => object; + extend(object: T): T; + extend(object: T, ...sources: U[]): T & UnionToIntersection; defaults: (object: object, ...sources: any[]) => object; @@ -399,3 +400,11 @@ type merge = { deepExtend(object: any, ...otherArgs: any[]): any; } + +type UnionToIntersection = ( + Union extends unknown + ? (x: Union) => void + : never +) extends ((x: infer Intersection) => void) + ? Intersection + : never;