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

Feature: 这种隐式 any 有办法让它报错吗 #2

Open
MinJieLiu opened this issue Jan 11, 2021 · 3 comments
Open

Feature: 这种隐式 any 有办法让它报错吗 #2

MinJieLiu opened this issue Jan 11, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@MinJieLiu
Copy link

这种隐式 any 有办法让它报错吗,写着写着就忘记加类型了
image

@MinJieLiu MinJieLiu added the enhancement New feature or request label Jan 11, 2021
@chnliquan
Copy link
Contributor

这个不是框架层面控制的,需要把 tsconfig 里面的 strict: true 开启,然后配置下 eslint,https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-explicit-any.md

@MinJieLiu
Copy link
Author

没有用的,这个参数是框架主动给他设置成了 any,如果框架将其设置成 unknown ,主动加上类型后又会报错

export interface ConfigReducer<S = any> {
  (state: S, ...payload: any): void
}

@chnliquan
Copy link
Contributor

好的,这个我看下。欢迎 PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants