首页 > 解决方案 > 打字稿。TSLint 在类型中不起作用

问题描述

所以我无法理解如何在tslint.json. 因为现在它不会检查并且不会Types在 TypeScript 中产生任何错误。同样在Interfaces其中正常工作并在我使用不同的东西时抛出错误 那我;怎么能做到呢Types?...

export type IProps = {
    active?: boolean, // no error
    title?: string; // no error
    text?: string // no error
}

tslint.json:

{
  "defaultSeverity": "error",
  "extends": [
    "tslint-config-airbnb",
    "tslint-eslint-rules",
    "tslint-react"
  ],
  "jsRules": {},
  "rulesDirectory": [],
  "rules": {
    "arrow-parens": false,
    "whitespace": [
      false,
      "check-branch",
      "check-decl",
      "check-operator",
      "check-separator",
      "check-type"
    ],
  }
}

标签: javascripttypescripttslint

解决方案


你正在寻找type-literal-delimiter规则。只需falsetrue您的tslint.json.


推荐阅读