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

[REQUEST]希望可以去除无用的类型引用 #101

Open
xmsz opened this issue Nov 26, 2021 · 4 comments
Open

[REQUEST]希望可以去除无用的类型引用 #101

xmsz opened this issue Nov 26, 2021 · 4 comments

Comments

@xmsz
Copy link

xmsz commented Nov 26, 2021

背景

  • 例如 node_modules/tencentcloud-sdk-nodejs/src/services/tms/v20201229/tms_client.ts
import {
  RiskDetails,
  TextModerationRequest,
  DetailResults,
  User,
  Device,
  TextModerationResponse,
} from "./tms_models"
 DetailResults,
  User,
  Device,
  RiskDetails,

这几个没有用到

  • 导致ts build失败
node_modules/.pnpm/[email protected]/node_modules/tencentcloud-sdk-nodejs/src/services/tms/v20201229/tms_client.ts:24:3 - error TS6133: 'User' is declared but its value is never read.
@zqfan
Copy link
Member

zqfan commented Dec 1, 2021

这些代码是直接生成出来的,并非手动编辑的。目前有一个比较粗糙的方法能将大部分移除,但也可能误杀,做不到十分精准,因此暂时也没想好要怎么处理。
在此之前,可否先关闭未使用就报错的选项来暂时规避下呢?

@xmsz
Copy link
Author

xmsz commented Dec 2, 2021

这些代码是直接生成出来的,并非手动编辑的。目前有一个比较粗糙的方法能将大部分移除,但也可能误杀,做不到十分精准,因此暂时也没想好要怎么处理。 在此之前,可否先关闭未使用就报错的选项来暂时规避下呢?

ok

或者可不可以单独生成.d.ts文件

因为如果是.d.ts文件报错,我可以通过"skipLibCheck": true,来跳过检查
但如果是.ts报错,这个参数就没有效果,比较蛋疼

@zqfan
Copy link
Member

zqfan commented Dec 2, 2021

有的,例如,https://github.com/TencentCloud/tencentcloud-sdk-nodejs/blob/master/tencentcloud/services/tcm/v20210413/tcm_models.d.ts
在根目录tencentcloud下,不在src目录下

@xmsz
Copy link
Author

xmsz commented Dec 2, 2021

在根目录tencentcloud下,不在src目录下

ok 那我试试

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