jeroenouw / liftr-tscov

Check the type coverage of any TypeScript project with this easy npm package
https://www.npmjs.com/package/@liftr/tscov
MIT License
30 stars 5 forks source link

Error parameters in catch blocks are flagged as uncovered. #14

Closed pfgallagher closed 4 years ago

pfgallagher commented 4 years ago

As far as I'm aware, it's not possible to type the parameter for a catch block. Here is a relevant discussion of error handling on the TS repo.

Currently, tscov flags these parameters as untyped even though typing them seemingly isn't possible.

farisT commented 4 years ago

Hi @pfgallagher, thanks for reporting this. Which version of liftr-tscov are you using? I have tried to recreate this but I did not seem to get an untyped for a try/catch block.

pfgallagher commented 4 years ago

Version 1.4.1.

Here's a contrived example:

test.ts:

const testFunc = () => {
    try {
        return;
    } catch (error) {
        console.log(error);
    }
};

When I run tscov -p /file/path/to -f test.ts -d, this is what returns:

------------- uncovered types ---------------
file/path/to/test.ts: 4:14 - error
file/path/to/test.ts: 5:21 - error

----------------- coverage ------------------
5 - max reachable type coverage
3 - types covered
2 - types uncovered

Running it with the --debug flag doesn't seem to offer any additional insight.

jeroenouw commented 4 years ago

Fix merged