Closed
Description
Make Direct Assignments to CommonJS Exports Considered Literal Contexts
- In JavaScript,
module.exports.yadda = ...
is considered read-only already. - What about
module.exports = { yadda: ... }
? - This PR makes it so we consider that when we decide the types are literals or unique symbols.
- Technically a breaking change.
- At earliest, 4.1
- This would be the only place where we infer an object literal to have readonly properties.
- Let's see how the user code suite works with this.
- Because it's only CommonJS, maybe we should just leave it alone.
- Probably merits no breakage if we see any.
- Merge otherwise.
Variadic Tuples in Promise.all
- With
Promise.all
, we have like 8 overloads. - They don't handle functions with optional members or with rest elements.
- Means you end up with a weakly typed result from
Promise.all
.
- Means you end up with a weakly typed result from
- Variadics can handle all these great cases that overloads can't!
- Technically a breaking change because people could give explicit type arguments.
- Sounds rare
- 2 instances in VS Code
- This also brings up a question about the
awaited
type.- How many levels should the approximated
Awaited
type in the PR handle?
- How many levels should the approximated
- We want
T | Promise<T>
to ensure thatT
is not aPromise
.- But
Promise
itself can be constructed with an unconstrained type parameter.
- But
- Will we ever solve this?
- Would be willing to try in 4.1.
Auto-Imports Slowdown
- We should always keep in mind that when these auto-magic features are supposed to make things really good, but then turn everything to crap.
- We could have a threshold of packages that are not already imported. If you have more than N packages, we don't do the work.
- We have a flag to turn things off: auto, off, and on.
- Technically it's off, dependencies, devDependencies.
- We could do a low threshold - like 10 packages.
- Can we have editors communicate more than "loading JS/TS language features"?
- Signaling exactly what we're working on to communicate that something can be turned on.
- Have to discuss some sort of mitigation plan