Skip to content

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

@AlexandrHoroshih

Description

@AlexandrHoroshih

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions