Closed darky closed 5 years ago
The CLI just run once every time.
What's your use case?
Are you expecting --watch
?
No --watch
Would be better to have something like --cache
and type-coverage create cache folder like .type-coverage
, which contains sha1 or md5 hash signatures or checked files
If cache contains hash singature of file, no need to check it, simply skip it.
Otherwise need check and if file is ok, cache it.
That may cause a wrong result, for example:
// a.ts
export const foo = 1 // if change type of `foo` to `any`, then `bar` in `b.ts` will be `any` too, even `b.ts` is not changed
// b.ts
import { foo } from './a.ts'
const bar = foo
Type check is a semantic analysis operation, rather than lexical analysis operation.
This tool calls typescript API, typescript can cache by reusing the old Program
object, but I cannot find a way to serialize/deserialize the Program
object
That may cause a wrong result, for example:
// a.ts export const foo = 1 // if change type of `foo` to `any`, then `bar` in `b.ts` will be `any` too, even `b.ts` is not changed // b.ts import { foo } from './a.ts' const bar = foo
Type check is a semantic analysis operation, rather than lexical analysis operation.
Maybe for resolving this problem some dependency tree package can help like this: https://github.com/dependents/node-dependency-tree
You can ignore cache of changed file and all files, that depends on changed file
v1.10.0 support --cache
now
Great! Thanks so very much!)) I will test it tomorrow and if all ok, close this issue)
Seems all fine, but slight increase in performance. Only 1-2 sec, elapsed time 13s -> 11s
Now it 30s vs 16s Seems ok :)
type-coverage spends lot of time to check big project. Need to have ability for caching file, that already checked and recheck it again, if file hash changed