Recursive reverse mapped types don't work well with mixed object and tuple structures #55382
Labels
Help Wanted
You can do this
Possible Improvement
The current behavior isn't wrong, but it's possible to see that it might be better in some cases
Milestone
π Search Terms
inference recursive reverse mapped type tuples arrays
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?#code/C4TwDgpgBAygxgCwgWwIZQLxQEoTgewCcATAHgGdhCBLAOwHMAaKAV1oGtb8B3WgPigAfKIQipi+WgBsQrDl14BtALoBuAFDrQkKABEIAMzrVg1SaQAqArAG91UKIoDSUOlHYQQ+A1AvKAXFAAFEEAlJgCFs7K4cL6RrQmZrSW0XwaAL4a6sR4UqiiUAZscKaSUHCiqMAQllAQAB41tMTksIgoqHxBuQlJkoHxxmUpVqGBFtkEtJQiEOQsUsCYFVU1QXYOqIFhEVAAjIz2UABGgZsOFTvhGAIARHdHDhlHGaHZAPQfUMAI1G2SaCJOAQGSuWgGCCENoAAxsUG2UFoLGQJyhqlO5yuUEoNAYUAyBJh6lECyWGi+UAAegB+TTTWakxbAABMK0qYnWil2twOzG5N3ud2UMU+31+-yggPBkOhUBhyNRUJUMNOLGWJhxCHwi2IMqh8sUirRhH5uLo9BFxKZSxZFO+tPpkkZ82ZAGZ2WsIBtjoieQJDsczo5-VAHspXu9NJSJQDaNA6LLYfDEcaocxg+aGCoiWqNctyNrdfrCPKU4E06bMY4s5aiSTXUs3fbqTSgA
π» Code
π Actual behavior
tuples can't be inferred recursively here
π Expected behavior
tuples are inferred as arrays
Additional information about the issue
I understand that I need some tuple context to actually infer tuples but I've tried a couple of ways to add it and I just can't make it work. It would be much simpler if TS would just infer tuples here with the original code.
const
type parameter: TS playgroundDefinition
: TS playgroundT[K]
's constraint using a conditional type to satisfy theDefinition
's constraint: TS playgroundSchema
to useany
overunknown
to fix the recursive constraint problem: TS playgroundThe text was updated successfully, but these errors were encountered: