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
We have deep-versions of other built-in types, so I don't mind having this added. The name should be RecordDeep though, to fit with our existing naming scheme.
I'd be glad to take this one, however there is an issue I need some clarification on: this doesn't really replicate Record<K, T> functionality. In fact I'm not sure such a functionality could be replicated on a nested object. How would that look like?
Becomes what exactly after going through RecordDeep<stringsToConvertToProps, string>?
typeConverted={key1: string,key2: string}
or
typeConverted={key1: string,foo: {key2: string}}
?
Record<K, T> is pretty straightforward, this would be anything but, especially given the naming. I quite like what @GentileFulvio tries to achieve here, but it's not really in the scope of Record. What's being done here is coercing all of an object props to a given type, unless that prop has a type of object, then we're nesting deeper. Cool. But we need a different name for that.
A while back while working on a project we needed a generic function to slice all strings of the provided object.
We wanted the
U
type the have the same type as the first argument but it had to flatten all the arrays.So if T was of type
U had to be of type
With interface
U
defining the length of each string. But it shouldn't provide an array foritems
proposal
This way we can write the function as following
The text was updated successfully, but these errors were encountered: