1

My typescript compile is throwing the following error

TS2531: Object is possibly 'null'.

I am converting code with an insane number of these errors and just want to suppress them to finish getting the build working. It was my understanding that adding the following in my tsconfig.json file would suppress this error.

"compilerOptions": { "strictNullChecks": false}

However the error still shows. I cannot find any other compilerOption specific to this error. Is there an option to suppress it?

4

1 回答 1

3

我认为您没有正确初始化某些变量。您可以使用 ! 添加明确的分配声明 或完全关闭规则。如果这没有帮助一些失败代码的例子会很好:)

要关闭添加以下规则

“严格属性初始化”:假

{
  "compilerOptions": {
    "strict": false,
    "strictPropertyInitialization": false,
    "strictNullChecks": false,
  }
}
于 2018-05-25T14:25:09.833 回答