Open
Description
Set configurable: true
in Downlevel Targets
- Jest, the testing framework, wants to be able to mock out modules in a way that works for basic CJS modules, but not for ESM-style CJS modules.
- Why wouldn't we do this?
- esbuild, the bundler, does not do this.
- ESM itself doesn't allow this, so it's strange to change our emit to do this.
- Jest and the like mock ESM in a different mechanism though.
- What does Babel do?
- Babel makes them non-configurable.
- Same with Rollup.
- So we'd be the only one doing this?
- Yes.
- Why does Jest need them to be configurable? Can't they just return a new object?
- Possibly? Some stuff around objects. Maybe Jest should use a Proxy?
- Switching your TS emitter from TS itself to esbuild or Babel or whatever would break your tests. Kind of a footgun!
- If every other compiler works this way, it seems like testing libraries should find an alternative solution.
- Conclusion: we will not make this change.
Remove FlowNode
and FlowFlags
from Public API
- We want to change the control flow graph (Monomorphic flow nodes #57977) but it would kind of be a breaking change.
- We expose these types publicly, but nobody has a public way to access them without unsafely access the internals.
- Only known use is utilities for visualizing the control flow graph.
- Do it.
Types as Configuration
- This is only viable because we now have enough literal-i-ness in the type system.
- One of the concerns we have is that the semantics of TypeScript change from version-to-version.
- This is in an uncanny valley of "a superset of JSON but also a subset of valid TypeScript".
- But broadly, there's a good way to reframe what we want: imports and spreads.
- Let's find a way to bring that into
tsconfig.json
.