Skip to content

Add roles declarations to allow safe coercions #175

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

Merged
merged 1 commit into from
Dec 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/React.purs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ foreign import data ReactComponent :: Type
-- | A reference to a component, essentially React's `this`.
foreign import data ReactThis :: Type -> Type -> Type

type role ReactThis representational representational

foreign import data ReactUnusedSnapshot :: Type

type SyntheticEventHandler event = EffectFn1 event Unit
Expand Down Expand Up @@ -251,6 +253,8 @@ foreign import statelessComponent :: forall props.
-- | React class for components.
foreign import data ReactClass :: Type -> Type

type role ReactClass representational

foreign import fragment :: ReactClass { children :: Children }

-- | Read the component props.
Expand Down
4 changes: 4 additions & 0 deletions src/React/Ref.purs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ foreign import data NativeNode :: Type

foreign import data Ref :: Type -> Type

type role Ref representational

foreign import data RefHandler :: Type -> Type

type role RefHandler representational


foreign import createRef :: forall a. Effect (Ref a)

Expand Down
2 changes: 2 additions & 0 deletions src/React/SyntheticEvent.purs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ type SyntheticWheelEvent

foreign import data SyntheticEvent_ :: Row Type -> Type

type role SyntheticEvent_ representational

foreign import data NativeEventTarget :: Type

foreign import data NativeEvent :: Type
Expand Down