Replies: 6 comments
-
@regevbr , I currently achieve this by doing ('1' | 1) & string // '1' I rather raise awareness of such techniques instead of writing such types. So I am marking this as a question :) |
Beta Was this translation helpful? Give feedback.
-
That makes sense, although less intuitive in my view. Thought this type will make it more verbose and easier to discover in your library |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Sorry @regevbr, I meant https://pirix-gh.github.io/ts-toolbelt/modules/_union_select_.html#select |
Beta Was this translation helpful? Give feedback.
-
@pirix-gh do you think we can at least expose type Index = string | number | symbol; in the public interface? |
Beta Was this translation helpful? Give feedback.
-
@regevbr Yes, I also found myself needing it a few times |
Beta Was this translation helpful? Give feedback.
-
🍩 Feature Request
Describe the solution you'd like
Since keys of an object can be of type
string|number|symbol
and sometimes types require only string values, it will be handy to have a type that extracts only the string key (or of any type for that matter)@pirix-gh thoughts?
Beta Was this translation helpful? Give feedback.
All reactions