Replies: 1 comment 1 reply
-
I think it would be possible by inferring the keys, then using Union utilities to make that a Tuple, then return an error message if the size of the tuple is not Equal to 1. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was wondering if there is a way to create a version of typescript Record<K, V> type where we can enforce only a single field is present. The field key is not known at compile time and can be anything (any random string in the example), but we can't have more than one.
Beta Was this translation helpful? Give feedback.
All reactions