Skip to content

Conversation

aspeddro
Copy link
Contributor

@aspeddro aspeddro commented Mar 17, 2025

Creates a top-level module for Jsx. It contains the following submodules:

  • Jsx.DOMStyle
  • Jsx.Event
  • Jsx.DOM

Deprecate JsxDOM.res, JsxDOMStyle and JsxEvent

With these changes we can have a section in the sidebar menu for the Jsx module containing DOM, DOMStyle and Event

Copy link
Member

@cknitt cknitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @aspeddro!

This means, however, that we need to change rescript-react accordingly at some point.

@mununki do you see any issue with this?

runtime/Jsx.res Outdated
module Event = JsxEvent
module DOM = {
type style = DOMStyle.t
type domRef
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is problematic that the types defined here (other than style) are different from those in JsxDOM. They should all be aliases.

Copy link
Contributor Author

@aspeddro aspeddro Mar 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JsxDOM.domProps.children is of type Jsx.element, defining a alias here creates a cyclic dependency Jsx.cmj -> JsxDOM.cmj -> Jsx.cmj

Unless we create a file Jsx_common.res to put the common values/types

@aspeddro aspeddro force-pushed the group-jsx-modules branch from 25f43c3 to 668ccb3 Compare March 25, 2025 13:01
Copy link

pkg-pr-new bot commented May 11, 2025

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript-lang/rescript@7347 

@rescript/darwin-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-arm64@7347 

@rescript/darwin-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-x64@7347 

@rescript/linux-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-arm64@7347 

@rescript/linux-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-x64@7347 

@rescript/win32-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/win32-x64@7347 

commit: 77724ab

@aspeddro aspeddro marked this pull request as ready for review May 11, 2025 20:38
@aspeddro aspeddro requested a review from cknitt May 11, 2025 20:40
@aspeddro aspeddro force-pushed the group-jsx-modules branch from dfb8221 to 1f70005 Compare May 31, 2025 16:52
But children passed to this component must be of type:
React.element (defined as Jsx.element)

In JSX, all content must be JSX elements. You can convert float to a JSX element with React.float.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are losing the improved error messages here, so it seems that some adjustment to the error handling logic is missing. /cc @zth

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants