简体   繁体   English

打字稿。 TSLint在类型中不起作用

[英]TypeScript. TSLint does not wok in Types

So I cannot understand how to make standardisation and activate semi rule checking option in tslint.json . 所以我不明白如何在tslint.json进行标准化和激活半规则检查选项。 Because for now it does not checks and not produces any error for Types in TypeScript. 因为到目前为止,它不会检查TypeScript中的Types并且不会对Types产生任何错误。 Also in Interfaces it wokrs normally and throw an error when I use something different that ; 同样在Interfaces它正常运转,当我使用其他东西时抛出错误; , so how can I make it for Types too?... ,那么我也该如何为Types它?...

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

tslint.json: 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"
    ],
  }
}

You're looking for the type-literal-delimiter rule . 您正在寻找type-literal-delimiter规则 Just change it from false to true in your tslint.json . 只需在tslint.json其从false更改为true tslint.json

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM