We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
tsx 文件中,尖括号含义可能出现歧义,即 ts 下的泛型与 html 中的标签。这种语法的二义性可能导致不合理的报错。 例如,在 tsx 文件中,定义一个带有一个泛型参数的箭头函数。VS Code 就会将 <T> 理解为标签,导致后续代码报错
<T>
const f = <T>(v: T) => v;
<T extends any> 是消除标签-泛型歧义的常用手段,但是会与目前规则冲突。
<T extends any>
The text was updated successfully, but these errors were encountered:
在实践中,建议无明确箭头函数语义的时候,用function f<T>即可,有明确需要箭头函数时,其实可以单独声明类型type F<T>
function f<T>
type F<T>
除此以外的情况,少量场合下使用注释禁掉规则更合适
建议在PR上直接评论,回头整理的时候不见得还刻是看issue
Sorry, something went wrong.
No branches or pull requests
tsx 文件中,尖括号含义可能出现歧义,即 ts 下的泛型与 html 中的标签。这种语法的二义性可能导致不合理的报错。
例如,在 tsx 文件中,定义一个带有一个泛型参数的箭头函数。VS Code 就会将
<T>
理解为标签,导致后续代码报错<T extends any>
是消除标签-泛型歧义的常用手段,但是会与目前规则冲突。The text was updated successfully, but these errors were encountered: