plantain-00 / type-coverage

A CLI tool to check type coverage for typescript code
MIT License
1.21k stars 43 forks source link

A false positive case on generics #56

Closed Jack-Works closed 3 years ago

Jack-Works commented 4 years ago

Version(if relevant): 2.8.2

Code(if relevant):

function x(y: Map<string, number>) {}

x(new Map())
// in strict mode, the implicit Map<any, any>
// is considered not covered
// but it's actually type-safe.
plantain-00 commented 4 years ago

I cannot reproduce it using your code.

Jack-Works commented 4 years ago

Hmm sorry, maybe I'm over abstracted my case so it isn't work anymore. I'll try to verify it later

Jack-Works commented 4 years ago
type conf = {
    a: Map<string, number>
}
function f(t: conf) {}
f({ a: new Map() })

This is my case.

➜ yarn type-coverage --strict --detail
test.ts:6:5: a
8 / 9 88.88%
type-coverage success.

a should not be uncovered.

plantain-00 commented 4 years ago

v2.8.3 should fix this.