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

[taro-components] 部分类型定义文件扩展名不是 .d.ts #5771

Closed
yangmingshan opened this issue Mar 23, 2020 · 2 comments
Closed

[taro-components] 部分类型定义文件扩展名不是 .d.ts #5771

yangmingshan opened this issue Mar 23, 2020 · 2 comments
Assignees

Comments

@yangmingshan
Copy link

问题描述

@tarojs/components 部分类型定义文件扩展名是 .ts 而不是 .d.ts,这会导致 TS 对其进行类型检查,根据 TS 配置不同,可能会报错。

参考:microsoft/TypeScript#15363

复现步骤

  1. 安装 @tarojs/components,并将 TS 的 noImplicitAny 设置为 true
  2. 运行 tsc
  3. 报错

期望行为

不报错

报错信息

node_modules/@tarojs/components/types/Ad.ts:47:5 - error TS7008: Member '1000' implicitly has an 'any' type.
node_modules/@tarojs/components/types/Ad.ts:53:5 - error TS7008: Member '1001' implicitly has an 'any' type.
// 还有很多...

系统信息

Taro CLI 2.0.7 environment info:
    System:
      OS: macOS 10.15.3
      Shell: 5.7.1 - /bin/zsh
    Binaries:
      Node: 12.16.1 - /usr/local/bin/node
      Yarn: 1.22.4 - /usr/local/bin/yarn
      npm: 6.14.2 - /usr/local/bin/npm
    npmPackages:
      @tarojs/cli: ^2.0.7 => 2.0.7 
      @tarojs/components: ^2.0.7 => 2.0.7 
      @tarojs/mini-runner: ^2.0.7 => 2.0.7 
      @tarojs/taro: ^2.0.7 => 2.0.7 
      @tarojs/taro-weapp: ^2.0.7 => 2.0.7 
      @tarojs/webpack-runner: ^2.0.7 => 2.0.7 
      nerv-devtools: ^1.5.6 => 1.5.6 
      nervjs: ^1.5.6 => 1.5.6

补充信息

taro-components/types 下的所有 *.ts 文件全部重命名为 *.d.ts 文件,可以解决这个问题。

@yangmingshan
Copy link
Author

@Garfield550 这个问题又被 0120346 这个 commit 给还原了。

@taro-bot
Copy link

taro-bot bot commented Mar 28, 2020

CC @ZakaryCode

@Garfield550 Garfield550 reopened this Mar 28, 2020
ZakaryCode added a commit that referenced this issue Mar 28, 2020
ZakaryCode added a commit that referenced this issue Mar 28, 2020
jiangzm pushed a commit to jiangzm/taro that referenced this issue Dec 7, 2020
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

3 participants