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

Should relfect totally exclude properties used in bind from final types? #85

Closed
AlexandrHoroshih opened this issue Feb 8, 2024 · 0 comments · Fixed by #87
Closed

Should relfect totally exclude properties used in bind from final types? #85

AlexandrHoroshih opened this issue Feb 8, 2024 · 0 comments · Fixed by #87
Labels

Comments

@AlexandrHoroshih
Copy link
Member

Current behavior

function View(props: ViewProps) { ... }

const ReflectedView = reflect({
 view: View,
 bind: {
    someProp: "value",
  }
})
  • Props type of ReflectedView is Exclude<ViewProps, "someProp">
  • ReflectedView will show type error on <ReflectedView someProp="other value" />
  • But the value will still be passed to the component on top of the value from bind, so this will work properly in runtime

Question

This is a bit confusing:
The library just highlights that prop was already taken, but in fact allows to override it.

What is desired behavior here?

  1. Should reflect actually omit such values in runtime?
  2. Or these props just should not be excluded at the type level and must be made optional instead?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant