From d72dedd472fd773d9abc03d0f64802a79cc1b996 Mon Sep 17 00:00:00 2001 From: Malash Date: Tue, 8 Jan 2019 14:14:18 +0800 Subject: [PATCH] fix data type is never bug --- types/weixin-app/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/weixin-app/index.d.ts b/types/weixin-app/index.d.ts index 2e2eb35481..31b4f7880a 100644 --- a/types/weixin-app/index.d.ts +++ b/types/weixin-app/index.d.ts @@ -3898,7 +3898,7 @@ declare namespace wx { * Note this is different from PropOptions as it is the definitions you passed to Component function * whereas this type is for call-site. */ - type DataValueType = Def extends { + type PropValueType = Def extends { type: (...args: any[]) => infer T; value?: infer T; } @@ -3926,12 +3926,12 @@ declare namespace wx { /** * 组件数据,包括内部数据和属性值 */ - data: { [key in keyof (D & P)]: DataValueType<(D & P)[key]> }; + data: D & { [key in keyof P]: PropValueType }; /** * 组件数据,包括内部数据和属性值(与 data 一致) */ - properties: { [key in keyof (D & P)]: DataValueType<(D & P)[key]> }; + properties: D & { [key in keyof P]: PropValueType }; /** * 将数据从逻辑层发送到视图层,同时改变对应的 this.data 的值 * 1. 直接修改 this.data 而不调用 this.setData 是无法改变页面的状态的,还会造成数据不一致。