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

@tarojs typing 无法通过 ts 严格类型检查。 #1539

Closed
septs opened this issue Dec 17, 2018 · 6 comments
Closed

@tarojs typing 无法通过 ts 严格类型检查。 #1539

septs opened this issue Dec 17, 2018 · 6 comments

Comments

@septs
Copy link
Contributor

septs commented Dec 17, 2018

node_modules/@tarojs/components/types/MovableView.d.ts:15:11 - error TS2430: Interface 'MovableViewProps' incorrectly extends interface 'StandardProps'.
  Types of property 'animation' are incompatible.
    Type 'boolean | undefined' is not assignable to type 'object[] | undefined'.
      Type 'false' is not assignable to type 'object[] | undefined'.

15 interface MovableViewProps extends StandardProps {
             ~~~~~~~~~~~~~~~~

node_modules/@tarojs/taro/types/index.d.ts:423:12 - error TS7010: 'render', which lacks return-type annotation, implicitly has an 'any' return type.

423   function render(component: Component | JSX.Element, element: Element | null)
               ~~~~~~

node_modules/@tarojs/taro/types/index.d.ts:425:31 - error TS7019: Rest parameter 'arg' implicitly has an 'any[]' type.

425   function internal_safe_set (...arg): any
                                  ~~~~~~

node_modules/@tarojs/taro/types/index.d.ts:426:31 - error TS7019: Rest parameter 'arg' implicitly has an 'any[]' type.

426   function internal_safe_get (...arg): any
                                  ~~~~~~

node_modules/@tarojs/taro/types/index.d.ts:679:18 - error TS7051: Parameter has a name but no type. Did you mean 'arg0: UploadTaskProgressCallback'?

679       progress: (UploadTaskProgressCallback) => void
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@tarojs/taro/types/index.d.ts:2586:39 - error TS7008: Member 'tempThumbPath' implicitly has an 'any' type.

2586       type ParamPropSuccess = (res: { tempThumbPath, tempVideoPath }) => any
                                           ~~~~~~~~~~~~~

node_modules/@tarojs/taro/types/index.d.ts:2586:54 - error TS7008: Member 'tempVideoPath' implicitly has an 'any' type.

2586       type ParamPropSuccess = (res: { tempThumbPath, tempVideoPath }) => any
                                                          ~~~~~~~~~~~~~
@taro-bot
Copy link

taro-bot bot commented Dec 17, 2018

欢迎提交 Issue~

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

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

Good luck and happy coding~

@yuche
Copy link
Contributor

yuche commented Dec 17, 2018

这个没有办法,微信的有些参数就是要传入 any 类型,有些方法只是导出给 taro 内部使用,并不暴露给普通开发者。
ts 的检查并不会检查 node_modules 的文件,只要你不把整个包从 node_modules 拿出来用就好了。

@yuche yuche closed this as completed Dec 17, 2018
@septs
Copy link
Contributor Author

septs commented Dec 17, 2018

@yuche 首先第一项错误是你们类型声明不兼容,注意看 error info。

node_modules/@tarojs/components/types/MovableView.d.ts:15:11 - error TS2430: Interface 'MovableViewProps' incorrectly extends interface 'StandardProps'.
  Types of property 'animation' are incompatible.
    Type 'boolean | undefined' is not assignable to type 'object[] | undefined'.
      Type 'false' is not assignable to type 'object[] | undefined'.

15 interface MovableViewProps extends StandardProps {
             ~~~~~~~~~~~~~~~~

其余几项都未声明 参数类型返回类型

请问接受 pull request 吗?

@yuche
Copy link
Contributor

yuche commented Dec 17, 2018

非常欢迎 PR。

@septs
Copy link
Contributor Author

septs commented Dec 17, 2018

yuche pushed a commit that referenced this issue Dec 17, 2018
@septs
Copy link
Contributor Author

septs commented Dec 17, 2018

@yuche 请问什么时候 release 下个版本。

luckyadam pushed a commit that referenced this issue Dec 17, 2018
luckyadam pushed a commit that referenced this issue Dec 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants