Closed danvk closed 3 years ago
I can't reproduce it with --strict
17 / 17 100.00%
Maybe your tsconfig.json
lib
didn't include dom
This seems to be related to the issue from #83; I can reproduce this only if I add an exclude: []
section to my tsconfig.json
.
yarn type-coverage --detail --strict -p tsconfig+exclude.json
yarn run v1.22.4
$ /Users/danvk/code/type-coverage-toy/node_modules/.bin/type-coverage --detail --strict -p tsconfig+exclude.json
/Users/danvk/code/type-coverage-toy/fetch.ts:1:50: input
/Users/danvk/code/type-coverage-toy/fetch.ts:1:57: init
Here's the setup, reusing this gist:
$ cat fetch.ts
export const checkedFetch: typeof fetch = async (input, init) => {
const r = await fetch(input, init);
if (r.status !== 200) {
throw new Error(`${r.status} ${r.statusText}`);
}
return r;
};
$ tail tsconfig+exclude.json
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
/* Advanced Options */
"skipLibCheck": true, /* Skip type checking of declaration files. */
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
},
"exclude": [
]
}
v2.16.2 should fix this
fix confirmed, thanks @plantain-00!
Version(if relevant): 2.16.0
Environment(if relevant):
Code(if relevant):
Expected:
The
input
andinit
params have types.Actual:
type-coverage
reports that they haveany
types.You can see from this playground that the
typeof fetch
is sufficient to get contextual types for the function params: