effector / reflect

Easily render React components with everything you love from ☄️ effector.

Home Page:https://reflect.effector.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

AlexandrHoroshih opened this issue · comments

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?