Closed
Description
- Inference priority problem between
never
in empty array andT
- Difference between inference in two instantiations of same alias and structural algorithm
- Fixes are likely to be over-targeted corner cases, trading one problem for another
- Conclusion: do nothing
- PR doesn't affect indirect recursive tail calls, only direct self-calls
- Looks good
- A function that only tail calls itself and never returns anything else will be
never
, used to be an error - May need to fix an implementation detail, ensuring the call expression expression is identifier
- Would we rather revisit the whole set of rules around specifying type parameters on function calls? With this proposal, it seems like we'd always suggest people write
preferinfer
. Can we just do something like that behavior by default?- We could try just using inference instead of defaults on type parameters with defaults, only using the default if no candidates were collected
- This proposal has a limitation of only omitting trailing arguments, whereas the
_
placeholder PR lets any parameter be omitted - A modifier on the type parameter doesn't make sense
- There's something fishy about having a situation where type arguments need to be manually specified anyway
- There are a lot of poorly designed APIs like this in the wild already
- Specifying a type argument can be useful in the same kinds of cases where it's useful to explicitly annotate a variable declaration, like setting the element type of an empty array (
new Set<string>()
comes to mind) - People also use additional type parameters with defaults as scoped type aliases
- Worth looking at
_
proposal again, or even just always allowing partial tye argument specification (in expression positions)- Type argument arity is first pass of overload selection 😬
- Conclusion: update the
_
PR, run RWC, see what happens
- Maybe Jake broke it
- Oops we're not actually prepared to talk about this one
- At least typescript-bot successfully bisected it
- In an ideal world we'd be able to try both and see which one works
- Conclusion: Anders would like to look at it
- Someone is relying on an implementation detail of when we resolve indexed access type to make a higher-order polymorphism mechanism
- We now defer reduceable intersection types when they occur in indexed access types
- The deferral is kind of the right thing to do, but it breaks the example
(F & { readonly A: A })['type']
used to reduce toF['type']
without acknowledging that the intersection could producenever
- We could potentially fix this by doing the intersection reduction
(A & B)[C]
toA[C] & B[C]
during inference and inferring from both
- Needed for a version of Monaco that doesn't bundle TS so you can dynamically figure out what libs are available
- Might be more future-proof to expose it as a function instead
- Can you not just read all the file names in
typescript/lib
?- No, because you might be getting TS files from a CDN, and there's not necessarily a consistent way to get a listing