【问题标题】:Typescript/tslint not complaining about this in arrow functionTypescript/tslint 在箭头函数中没有抱怨这个
【发布时间】:2019-03-12 08:03:41
【问题描述】:

经过一些创造性的重构,我最终得到了这个:

const TopBar = () => (
  <Button
    onPress={this.onPress} // Not complaining
  />
)

我在tslint.json 中设置的所有其他规则都按预期工作。

在这种情况下如何强制typescript/tslint投诉?

我在 React Native 项目中使用 "typescript": "^3.3.3333"

【问题讨论】:

    标签: typescript react-native tslint


    【解决方案1】:

    我必须在tsconfig.json 中的compilerOptions 内部添加以下规则:
    "noImplicitThis": true

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-18
      • 2017-05-20
      • 2019-12-18
      • 2023-03-03
      • 2021-07-02
      • 2018-12-31
      • 2019-12-17
      相关资源
      最近更新 更多