Skip to content

Commit cc5957f

Browse files
authored
Fix Self's action type (#74)
Resolves #71
1 parent 8784fa2 commit cc5957f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Diff for: src/React/Basic.purs

+3-3
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ data StateUpdate props state action
181181
type Self props state action =
182182
{ props :: props
183183
, state :: state
184-
, instance_ :: ReactComponentInstance
184+
, instance_ :: ReactComponentInstance props state action
185185
}
186186

187187
-- | Dispatch an `action` into the component to be handled by `update`.
@@ -408,12 +408,12 @@ foreign import displayNameFromSelf
408408
-- | ```
409409
-- |
410410
-- | __*See also:* `element`, `toReactComponent`__
411-
data ReactComponent props
411+
foreign import data ReactComponent :: Type -> Type
412412

413413
-- | An opaque representation of a React component's instance (`this` in the JavaScript
414414
-- | React paradigm). It exists as an escape hatch to unsafe behavior. Use it with
415415
-- | caution.
416-
data ReactComponentInstance
416+
foreign import data ReactComponentInstance :: Type -> Type -> Type -> Type
417417

418418
-- | Convert a React-Basic `ComponentSpec` to a JavaScript-friendly React component.
419419
-- | This function should only be used for JS interop and not normal React-Basic usage.

Diff for: src/React/Basic/DOM.purs

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,15 @@ foreign import unmountComponentAtNode_ :: EffectFn1 Element Boolean
9393
-- | `React.Basic.DOM.Components.Ref` where possible__
9494
-- |
9595
-- | __*Note:* Relies on `ReactDOM.findDOMNode`__
96-
findDOMNode :: ReactComponentInstance -> Effect (Either Error Node)
96+
findDOMNode :: forall props state action. ReactComponentInstance props state action -> Effect (Either Error Node)
9797
findDOMNode instance_ = try do
9898
node <- runEffectFn1 findDOMNode_ instance_
9999
case toMaybe node of
100100
Nothing -> throw "Node not found."
101101
Just n -> pure n
102102

103103
-- | Warning: Relies on `ReactDOM.findDOMNode` which may throw exceptions
104-
foreign import findDOMNode_ :: EffectFn1 ReactComponentInstance (Nullable Node)
104+
foreign import findDOMNode_ :: forall props state action. EffectFn1 (ReactComponentInstance props state action) (Nullable Node)
105105

106106
-- | Divert a render tree into a separate DOM node. The node's
107107
-- | content will be overwritten and managed by React, similar

0 commit comments

Comments
 (0)