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

Open
vaibhav11s opened this issue May 12, 2024 · 3 comments · May be fixed by #10921
Open

using symbol as a prop type throw error #10920

vaibhav11s opened this issue May 12, 2024 · 3 comments · May be 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
Contributor

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
Contributor

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

@sodatea sodatea 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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