plantain-00/type-coverage

[feature request] a new option to ignore `Non-null assertion operator`

Closed this issue · 8 comments

https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-0.html#non-null-assertion-operator

Sometimes, we can just confirm the value is non null.

transform('async function main() {}', {
  filename: 'fast-async.test.js',
  presets: ['@1stg'],
})!.code

Expected:

Pass

Actual:

Fail

It's duplicated as #62
Since it's more needed than I expected, I will add it in the next few days.

v2.16.0 should support it.

I tried but it seems not working. 😂

/Users/JounQin/Workspaces/GitHub/configs/tests/test.spec.ts:6:7: transform('async function main() {}', {
        filename: 'fast-async.test.js',
        presets: ['@1stg'],
      })!
109 / 110 99.09%
The type coverage rate(99.09%) is lower than the target(100%).

Did you use --ignore-non-null-assertion?

It should be ralted to cache. I used type-coverage --ignore-xxx before, and changed to use config settings in package.json after upgrading.

{
  "typeCoverage": {
    "atLeast": 100,
    "cache": true,
    "detail": true,
    "ignoreCatch": true,
    "ignoreFiles": "*.d.ts",
    "ignoreNonNullAssertion": true,
    "strict": true
  }
}

I tried to run type-coverage --ignore-non-null-assertion again, it works, and then run type-coverage no error too, but I doubt the cache is correct, so I decide to delete .type-coverage folder, now it should work as expected.

@plantain-00 Are you going to check the problem of cache, or should I close this issue?

I will check it in next few days, I don't have time now.

In v2.16.1, it should work with --cache