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
We had placeholder types as a proposal for a while, but the problem is that anyone who doesn't use placeholder types and just uses a global library can "spoil the pot".
One big issue: global pollution
Someone needs Buffer. Now everyone gets Buffer and whatever else comes along.
Another: augmentation pollution
"I need ES6 types like Map" implies "I need all of ES6"
Placeholder types are good for this, but a lot of this could be solved without placeholder types.
Placeholder types also only worked with separate projects when you need a mixed-environment project.
Idea: --strictEnvironment
/// <reference lib="es6" /> only pulls in lib.es6.types.d.ts (forward declarations for types)
Each file's global scope is determined individually
What about polyfills? How do you get this to work for people?
It's sort of intentional - automagic inclusion introduces the pain, you have to opt in.
It's not quite as non-trivial to construct these environments as we might think - global merging is recursive.
There's an effort to not transitively include everything, but all of the /// <reference lib /> directives contain more /// <reference lib />.
Conclusion: interested in feedback, need to think more on this.
Broken Method Calls on Unions
#40157
every
that takes a type predicate.every
more important? Or isevery
on unions more important?value is unknown
.every
overload.Strict Environment Checks
https://gist.github.com/RyanCavanaugh/702ebd1ca2fc060e58e634b4e30c1c1c
Buffer
. Now everyone getsBuffer
and whatever else comes along.Map
" implies "I need all of ES6"--strictEnvironment
/// <reference lib="es6" />
only pulls inlib.es6.types.d.ts
(forward declarations for types)/// <reference lib />
directives contain more/// <reference lib />
.Key Mapping in Mapped Types
#12754
The feature ask is "I want to be able to change the name of a property name in a mapped type.
Lots of demand, but currently not (easily?) possible today.
Idea was maybe let people remap the keys with an
as
or something, give users a template-string-like syntaxAlso would need some sort of operator to capitalize the first character of a string (e.g.
capitalize K
).Would eventually be expected as a top-level concatenation type operator.
`${"foo"} to ${"bar"}`
is"foo to bar"
Distributive
Current thinking is these template types work on
What about existing code that uses templates?
Can we do inference?
get
operator.get
doesn't just do dots, they also indexed accesses.split
operator?As you get farther into this, you start to see "this might not be enough"
Out of time, but looking for feedback as this gets prototyped.
Contextually Type Operands of await in a StatementExpression
#39817
void
parameters become optional, want to funnelvoid
toresolve
from the outside onPromise
s.await
in certain contexts gets ignored; so just make the contextual type for the expression toawait
Promise<void>
.void
in the top-level, gets transformed in theawait
.The text was updated successfully, but these errors were encountered: