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
In Defer resolution of indexed access types with reducible object types #53098, we changed our logic to say that we defer indexed access types on stuff like (SomeType & { kind: K })[K] because an instantiation of K can change the outcome if SomeType is actually a union where each constituent can be discriminated on kind.
But in this case, there is definitely no discriminant.
Idea: we still defer, but only if [[some condition - come back to this]] in isGenericReducibleType.
For { kind: "foo" } & { kind: T }, it uses a marker type for some T that mostly acts as never.
That marker should act as a normal literal type.
Is it the case that we "technically support higher kinded types" through this?
No - this is just a technique for accomplishing something like this.
We "support it" in so far as we support any arithmetic in the type system.
But it doesn't accomplish what users are usually talking about when they mention HKTs.
Partial Inference with Partially Filled Type Argument Lists
Deferring Indexed Access
#53970
(SomeType & { kind: K })[K]
because an instantiation ofK
can change the outcome ifSomeType
is actually a union where each constituent can be discriminated onkind
.isGenericReducibleType
.{ kind: "foo" } & { kind: T }
, it uses a marker type for someT
that mostly acts asnever
.Partial Inference with Partially Filled Type Argument Lists
#26349
_
) as a signal for this._
._
as a type anyway?_
._
- gut feel for if people are willing to still take that?_
anywhere else.<T>(x: Foo<T>) => Foo<T>
, and you needed to define a local type alias namedFoo
, where would you do it?Can't be
<T>(x: Foo<T>) => let Foo<T> = ... in Foo<T>
Can't be
<T>(x: let Foo<T> = ... in Foo<T>) => Foo<T>
Could be
Type guard incorrectly erases union type
#54143
The text was updated successfully, but these errors were encountered: