diff --git a/src/@types/index.d.ts b/src/@types/index.d.ts deleted file mode 100644 index 1bc27c0..0000000 --- a/src/@types/index.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -type DataOption = Record -type CustomOption = Record -type PropertyOption = Record -type MethodOption = Record any> - -type PageOptions< - TData extends DataOption, - TCustom extends CustomOption -> = WechatMiniprogram.Page.Options - -type ComponentOptions< - TData extends DataOption, - TProperty extends PropertyOption, - TMethod extends MethodOption -> = WechatMiniprogram.Component.Options diff --git a/src/observer.ts b/src/observer.ts index 552edab..eb505d9 100644 --- a/src/observer.ts +++ b/src/observer.ts @@ -3,8 +3,11 @@ import { is, toData } from './utils' import diff from './diff' const observer = { - page: ( - options: PageOptions + page: < + TData extends WechatMiniprogram.Page.DataOption, + TCustom extends WechatMiniprogram.Page.CustomOption + >( + options: WechatMiniprogram.Page.Options ) => { let dispose: IReactionDisposer @@ -36,11 +39,11 @@ const observer = { }, component: < - TData extends DataOption, - TProperty extends PropertyOption, - TMethod extends MethodOption + TData extends WechatMiniprogram.Component.DataOption, + TProperty extends WechatMiniprogram.Component.PropertyOption, + TMethod extends WechatMiniprogram.Component.MethodOption >( - options: ComponentOptions + options: WechatMiniprogram.Component.Options ) => { let dispose: IReactionDisposer