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
Expected behavior:
I expect the return type of the withBoundary function to actually include the fine-grain information of which concrete boolean value is provided for the select property. It should have type {select: true}.
Actual behavior:
Instead, it's typecasted to UserArgs.
We need this behavior to work because we want to make sure that users of our library only pass in a "subset" and not a superset of the UserArgs type into the withBoundary function. As T extends UserArgs is not sufficient to narrow that down, we use (args?: Subset<T, UserArgs>). This worked in 3.3 and is now broken in 3.4.
TypeScript Version: 3.5.0-dev.20190424
Search Terms:
generic type parameters broken, regression 3.4, type inference for mapped conditional types broken
Code
Expected behavior:
I expect the return type of the
withBoundary
function to actually include the fine-grain information of which concrete boolean value is provided for theselect
property. It should have type{select: true}
.Actual behavior:
Instead, it's typecasted to
UserArgs
.We need this behavior to work because we want to make sure that users of our library only pass in a "subset" and not a superset of the
UserArgs
type into thewithBoundary
function. AsT extends UserArgs
is not sufficient to narrow that down, we use(args?: Subset<T, UserArgs>)
. This worked in 3.3 and is now broken in 3.4.Playground Link
Related Issues:
The text was updated successfully, but these errors were encountered: