Closed
Description
Post-Modules Follow-up
Semantic Lints
- The last semantic rules we have are few.
- 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.
- Could see this as a
- Why is this so important?
- Linting in the editor is slow with semantic rules.
- Conclusion?
- Revisit.
Remove ts.Map
and ts.Set
- Objections?
- None.
Bundle Splitting our Executables
tsc.js
andtsserver.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
andtsserver.js
as CJS wrappers that invokeimport("tsc.mjs")
andimport("tsserver.mjs")
, bothtsc.mjs
andtsserver.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?