Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于触摸事件的typescript类型的修改 #5592

Closed
BUPTlhuanyu opened this issue Mar 2, 2020 · 2 comments
Closed

关于触摸事件的typescript类型的修改 #5592

BUPTlhuanyu opened this issue Mar 2, 2020 · 2 comments
Assignees
Labels
A-typings Area - TypeScript Typings 相关

Comments

@BUPTlhuanyu
Copy link

问题描述

@tarojs\components\types\common.d.ts文件中对触摸事件的类型声明不太准确

复现步骤

  1. 打开@tarojs\components\types\common.d.ts文件
  2. 接口类型ITouchEvent中touches以及changedTouches类型在不一样
  3. 微信小程序中这两者应该是一样的,h5也是一样的
  4. 其他小程序可能有些属性不存在
/**
export interface ITouchEvent extends BaseEventOrig<any> {
  /**
   * 触摸事件,当前停留在屏幕中的触摸点信息的数组
   */
  touches: Array<ITouch>,

  /**
   * 触摸事件,当前变化的触摸点信息的数组
   */
  changedTouches: Array<CanvasTouch>
}
 */

changedTouches 数据格式同 touches。 表示有变化的触摸点,如从无变有(touchstart),位置变化(touchmove),从有变无(touchend、touchcancel)。

期望行为

微信小程序以及h5的时候两者应该是同一类型

报错信息

系统信息

Taro2.0

补充信息

这里应该严谨一些,考虑其他小程序端的触摸事件都有哪些属性。

@taro-bot
Copy link

taro-bot bot commented Mar 2, 2020

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@ZakaryCode
Copy link
Contributor

没太懂你的意思,不过目前的类型同步自 微信官方,又更好的想法也欢迎 PR。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-typings Area - TypeScript Typings 相关
Projects
None yet
Development

No branches or pull requests

3 participants