diff --git a/types/global.d.ts b/types/global.d.ts index badd06a..3b0d74d 100644 --- a/types/global.d.ts +++ b/types/global.d.ts @@ -15,14 +15,14 @@ declare function getApp(): tinyapp.IGetAppResult; * 接受一个 object 参数,其指定页面的初始数据、生命周期函数、事件处理函数等。 */ /* tslint:disable:no-unnecessary-generics */ -declare function Page(options: tinyapp.PageOptions): void; +declare function Page(options: tinyapp.PageOptions): void; /* tslint:enable:no-unnecessary-generics */ /** * getCurrentPages() 函数用于获取当前页面栈的实例, * 以数组形式按栈的顺序给出,第一个元素为首页,最后一个元素为当前页面。 */ -declare function getCurrentPages(): Array>; +declare function getCurrentPages(): Array>; /* tslint:disable:no-unnecessary-generics */ declare function Component( diff --git a/types/page.d.ts b/types/page.d.ts index 21ba6a3..dc69dff 100644 --- a/types/page.d.ts +++ b/types/page.d.ts @@ -115,7 +115,7 @@ declare namespace tinyapp { type SpliceDataMethod = (operations: ISpliceDataOperations, callback?: () => void) => void; - interface IPageInstance extends Record { + type IPageInstance = M & { /** * 页面数据。 */ @@ -145,7 +145,7 @@ declare namespace tinyapp { /** * Page 实现的接口对象 */ - type PageOptions> = IPageOptionsMethods + type PageOptions, M = Record> = IPageOptionsMethods & { /** * 初始数据或返回初始化数据的函数, 为对象时所有页面共享。 @@ -155,9 +155,8 @@ declare namespace tinyapp { /** * 事件处理函数集合。 */ - events?: IPageEvents & ThisType>; - - [name: string]: any; + events?: IPageEvents & ThisType>; } - & ThisType>; + & M + & ThisType>; }