tsperf / tracer

A VSCode extension to measure type complexity within a project.
https://tsperf.dev
MIT License
158 stars 4 forks source link

Trace Highlights Unused Types #50

Open LukeAbby opened 3 months ago

LukeAbby commented 3 months ago

After running "Tracer: tsc trace" I can get warnings on extremely innocuous lines: image

Of particular note:

export type ConstructorOf<Instance extends object> = new (
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    ...args: any[]
) => Instance;

Is completely unused.

And the type of PlainDate#date is the core Date type. Admittedly the core TS lib files can be quite slow to resolve but for the user it's completely unactionable and I find it strange that many usages, even seemingly innocuous ones, would be flagged.

There's also cases like so: image

This is the repo where it's clearest that no excessive computation is going on but unfortunately I can't provide it as it's my work's codebase. Though, I could probably receive permission to release a minimal reproduction. However, I am also able to reproduce this somewhat in open source repositories, though in this case it's less clear if excessive computation is going on or not.

typeholes commented 2 months ago

Sorry it took so long to see this. I'm having trouble reproducing this. Are you sure these are coming from the trace metrics and not the "realtime" metrics which are measurements of tsserver response times? Do you have this disabled? image If so, please do point me towards a type in an oss repo the shows this behavior.

I honestly have no idea how the trace could show a large duration for that date access