Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using symbol as a prop type throw error #10920

Closed
vaibhav11s opened this issue May 12, 2024 · 3 comments · Fixed by #10921
Closed

using symbol as a prop type throw error #10920

vaibhav11s opened this issue May 12, 2024 · 3 comments · Fixed by #10921
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. has workaround A workaround has been found to avoid the problem regression scope: compiler scope: types

Comments

@vaibhav11s
Copy link

@jh-leong
Copy link
Member

Workaround: use symbol | string | number instead of keyof Record<...>. See playground.

@vaibhav11s
Copy link
Author

vaibhav11s commented May 13, 2024

using the workaround wont give benefits of type inference.

my use-case
Screenshot 2024-05-13 at 13 09 59

@jh-leong
Copy link
Member

Oops, I misunderstood. You can separate keyof from Props to avoid runtime errors and maintain type inference. See playground.

@haoqunjiang haoqunjiang added scope: types scope: compiler has workaround A workaround has been found to avoid the problem 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. regression labels May 16, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jun 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. has workaround A workaround has been found to avoid the problem regression scope: compiler scope: types
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants