It's a nice approach but I find that it does not scale very well. If prefer something like:
type Shape = "Square" | "Circle"; type Props = { name: string; shape?: Shape; }
Of course, this is usual usage. But let's imagine a situation where you would like to restrict combination of parameters to a function which doesn't represent the same "type".
Yep, this article was purely a thought exercise ✌🏻
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
It's a nice approach but I find that it does not scale very well. If prefer something like:
Of course, this is usual usage. But let's imagine a situation where you would like to restrict combination of parameters to a function which doesn't represent the same "type".
Yep, this article was purely a thought exercise ✌🏻