Skip to content

Conversation

@Harris-Miller
Copy link
Collaborator

The way prop(key)(obj) was typed was obj extends Record<K, unknown>. From typescript's point of view, this means that the object must contain the key, but not if the key was optional. The constraint that prop(key)(obj) should have is that if the key exists on obj, optional or not. To fix, Partial<Record<K, unknown>> should be used. But that's a lot of characters, { [P in K]?: unknown } is the exact same thing with less characters, so going with that

@Harris-Miller Harris-Miller mentioned this pull request Oct 18, 2023
@perrin4869
Copy link

just wondering, any reason this was not merged yet?

@Harris-Miller Harris-Miller merged commit 33e427c into develop Nov 15, 2023
@Harris-Miller Harris-Miller deleted the prop-fix-for-optional branch November 15, 2023 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants