diff --git a/typescript/core/base.ts b/typescript/core/base.ts index 3432be3ba8..d0e26dc1d8 100644 --- a/typescript/core/base.ts +++ b/typescript/core/base.ts @@ -13,9 +13,9 @@ export interface _base { packageItems: (items: any[], layouts: any[]) => any[]; - formatEL: (obj: any) => {el: any} + formatEL: (obj: T) => {el: T} | T - stripEL: (obj: any) => any; + stripEL: (obj: {el: T} | T) => T; trans2Element: (widgets: any[]) => any[]; @@ -56,7 +56,7 @@ export interface _base { some: (collection: any[]|object|string, callback?: Function|object|string, thisArg?: any) => boolean; - _any: (collection: any[]|object|string, callback?: Function|object|string, thisArg?: any) => boolean; + any: (collection: any[]|object|string, callback?: Function|object|string, thisArg?: any) => boolean; max: (collection: any[]|object|string, callback?: Function|object|string, thisArg?: any) => any; @@ -110,11 +110,11 @@ export interface _base { // 数组相关的方法 first: (array: T[], callback?: Function|object|number|string, thisArg?: any) => T; - initial: (array: any[], callback?: Function|object|number|string, thisArg?: any) => any[]; + initial: (array: T[], callback?: Function|object|number|string, thisArg?: any) => T[]; last: (array: T[], callback?: Function|object|number|string, thisArg?: any) => T; - rest: (array: any[], callback?: Function|object|number|string, thisArg?: any) => any[]; + rest: (array: T[], callback?: Function|object|number|string, thisArg?: any) => T[]; compact: (array: any[]) => any[]; @@ -132,7 +132,7 @@ export interface _base { unzip: (...array: any[]) => any[]; - _object: (keys: string[], values?: any[]) => any[]; + object: (keys: string[], values?: any[]) => any[]; indexOf: (array: any[], value: any, fromIndex?: number) => number; @@ -142,19 +142,19 @@ export interface _base { range: (start: number, end: number, step: number) => number[]; - take: (array: any[], n: number) => any[]; + take: (array: T[], n: number) => T[]; - takeRight: (array: any[], n: number) => any[]; + takeRight: (array: T[], n: number) => T[]; findIndex: (array: any[], value: any, callback?: Function|object|string, thisArg?: any) => number; findLastIndex: (array: any[], value: any, callback?: Function|object|string, thisArg?: any) => number; - makeArray: (length: number, value: any) => any[]; + makeArray: (length: number, value?: T) => number[] | T[]; makeObject: (array: any[], value: any) => any; - makeArrayByArray: (array: any[], value: any) => any[]; + makeArrayByArray: (array: any[], value: T) => T[]; uniq: (array: T[], isSorted?: boolean, iteratee?: any, context?: any) => T[]; @@ -177,7 +177,7 @@ export interface _base { defaults: (object: object, ...sources: any[]) => object; - clone: (object: object) => object; + clone: (object: T) => T; property: (path: any[]|string) => Function; @@ -237,7 +237,7 @@ export interface _base { has: (obj: object, keys: string[]) => boolean; - freeze: (value: object) => object; + freeze: (value: T) => T; isKey: (key: any) => boolean;