8000 Dispatching actions is not type safe · Issue #71 · purescript-react/purescript-react-basic · GitHub
[go: up one dir, main page]

Skip to content
Dispatching actions is not type safe #71
Closed
@arthurxavierx

Description

@arthurxavierx

The current definition of Self allows for actions of any type to be dispatched in some cases, what may cause runtime errors:

type Self props state action =
  { props     :: props
  , state     :: state
  , instance_ :: ReactComponentInstance
  }

This happens because action does not exist in the body of Self. A possible solution is to either newtype it (breaking change), or change it to:

type Self props state action =
  { props     :: props
  , state     :: state
  , instance_ :: ReactComponentInstance
  , action  :: Proxy action
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0