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:
Once S is provided, The 'act' function should automatically infer the specific type of S, which is constant for every element of the tuple type (I), and make the 'shape' parameter typesafe.
This behavior works correctly when:
// Without tuple typetypeAct<Sextendsobject>={act<Iextendsobject>(
...intentions: ((shape: S)=>I)[]): Act<S>&S&I;};
Actual behavior:
S is inferred as object, instead of its specific type. The return type is inferred correctly.
We don't support anything that involves UnionToIntersection; this is an ill-defined and will frequently produce "surprising" results.
I don't understand what you mean by "S is inferred as object" - it's just a type parameter. It sounds like you're referring to some specific instantiation of Act but there's just declarations in the repro?
TypeScript Version: 4.1.2
Search Terms:
Tuple generics
Generics in function tuple types
Code
Expected behavior:
Once S is provided, The 'act' function should automatically infer the specific type of S, which is constant for every element of the tuple type (I), and make the 'shape' parameter typesafe.
This behavior works correctly when:
Actual behavior:
S is inferred as object, instead of its specific type. The return type is inferred correctly.
Playground Link: https://www.typescriptlang.org/play?#code/C4TwDgpgBAqgdgSwPZwCpIJJ2BATgZwgGNhk4AeGAPigF4oAKGKCADxzgBN8oBDOEFAD8jMAC5YASjo0AbkgScoEuBFl5pbDt0YAoKFHFQEcAGZ4oGXdNpyFnfcMuOVavAG5Hu0JCgBBEnIAZRZ2CC4eJAAjACtiYBp6AG9HXkCMUO0eBgZ8AAteSAkgmxpouJJJAG0AXSoGRwMAOhaTDlIUfAkrA0kJAOBgmgAyKBDR+DJ0LBwCeLJyACUIYABXXDRwCHIMKrhVgFsovDqqTwBfdyA
Related Issues:
The text was updated successfully, but these errors were encountered: