如何防止我的Vue构建由于Typescript错误而失败

时间:2020-07-15 10:19:48

标签: typescript vue.js eslint tslint

如标题所述。我下面有一个与此' Now use Chilkat IMAP to save the email to Inbox.Sent Dim imap As New Chilkat.Imap ' Connect to an IMAP server. ' Use TLS imap.Ssl = True imap.Port = 993 success = imap.Connect("mail.mydomain.com") If (success <> True) Then Console.WriteLine(imap.LastErrorText) Exit Sub End If ' Login success = imap.Login("myLogin","myPassword") If (success <> True) Then Console.WriteLine(imap.LastErrorText) Exit Sub End If ' The AppendMail method uploads an email to an IMAP server ' and saves it in the mailbox specified: success = imap.AppendMail("Inbox.Sent",email) If (success <> True) Then Console.WriteLine(imap.LastErrorText) Exit Sub End If Console.WriteLine("Mail saved to Inbox.Sent") 文件一起运行的项目,我希望将Typescript错误的严重性默认为警告,因为这会阻止我的构建。我找不到有关如何定位适当的规则“ defaultSeverity”的参考。

我的主要目标是防止由于TS错误而导致构建失败。如果有其他方法可以做到,那么知道该怎么做。

编辑说明:我遇到的错误是访问未在AxiosResponse 预期响应类型中定义的对象属性。在我定义自己的类型或类似的内容之前,我宁愿忽略这些错误。

.eslintrc.js

1 个答案:

答案 0 :(得分:0)

最好尽可能地定义类型。即使您将类型设置为“ any”。但是要回答我自己的答案,可以通过在"noImplicitAny": false,文件中设置选项tsconfig.json来避免编译器错误。

tsconfig.json文件示例:

{
  "compilerOptions": {
    "target": "esnext",
    "module": "esnext",
    "strict": true,
    "jsx": "preserve",
    "importHelpers": true,
    "moduleResolution": "node",
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "noImplicitAny": false,
    "sourceMap": true,
    "baseUrl": ".",
    "types": [
      "webpack-env",
      "vuetify"
    ],
    "paths": {
      "@/*": [
        "src/*"
      ]
    },
    "lib": [
      "esnext",
      "dom",
      "dom.iterable",
      "scripthost"
    ]
  },
  "include": [
    "src/**/*.ts",
    "src/**/*.tsx",
    "src/**/*.vue",
    "tests/**/*.ts",
    "tests/**/*.tsx"
  ],
  "exclude": [
    "node_modules"
  ]
}
相关问题