You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Getting rid of all semantic rules would speed our lint time up a lot.
No unnecessary assertions takes up a decent amount of time - but it seems arguably good to have.
Getting rid of assertions over time helps improve quality of the code.
Switching to rely on narrowing is better because assertions left alone can get stale. Then future changes to a type may be masked by the stale assertion.
Maybe we should have "no unnecessary assertions" in the compiler itself?
What does it mean to be "unnecessary"?
Lint rule says "textually identical".
User could be thinking "up-casts".
We could make it better with our view of structurally identical.
Could see this as a --strict rule; however, as we start to think about "what is slow to run", it is hard to imagine more modes where we say "do more checking for the 99% of cases where this will succeed".
Though identity is usually pretty fast.
Why is this so important?
Linting in the editor is slow with semantic rules.
tsc.js and tsserver.js are not usefully importable - can switch those into ESM if we want!
Why?
esbuild (our new bundler) makes it easy to do bundle splitting if your output target is ESM.
If we ship tsc.js and tsserver.js as CJS wrappers that invoke import("tsc.mjs") and import("tsserver.mjs"), both tsc.mjs and tsserver.mjs can share lots of the same guts.
Shaves off 7MB from our package size.
Feels like it may be difficult to work with over time, has caveats.
Have to drop Node 10 support.
Feels like an "uncomfortable yes"
Diagnosing Expensive Types
People often ask how to "debug" types - especially types that are expensive.
There's types that "pull" on a thread that goes deep in its own self-instantiation, and then there's types that are kind of "executable", that cause a lot of work to be done.
Today we have instantiation limiters
Depth limiters - how deep instantiation is going (kind of like a call stack)
Type creation limiters - how many instantiations of any type has occurred during instantiations.
These are hard limits - "blunt force instruments" - that cause an error; but we don't tell tell you about types that get close to those limits.
What if we had --typeDiagnostics that could provide a table of the most expensive types?
Post-Modules Follow-up
Semantic Lints
#51456
--strictrule; however, as we start to think about "what is slow to run", it is hard to imagine more modes where we say "do more checking for the 99% of cases where this will succeed".Remove
ts.Mapandts.Set#51439
Bundle Splitting our Executables
#51440
tsc.jsandtsserver.jsare not usefully importable - can switch those into ESM if we want!tsc.jsandtsserver.jsas CJS wrappers that invokeimport("tsc.mjs")andimport("tsserver.mjs"), bothtsc.mjsandtsserver.mjscan share lots of the same guts.Diagnosing Expensive Types
--typeDiagnosticsthat could provide a table of the most expensive types?