Skip to content

Conversation

@dkirchhof
Copy link
Contributor

While building custom jsx transformers or defining bindings for "jsx-libraries" other than react, it could be possible, that some "fields" in domProps has other types as in the core library.

Examples:

  • it uses "class" instead of "className"
  • style is a string instead of an object
  • events are named "click" or "onclick" instead of "onClick"
  • ...

So, if you want to add a field, fine. Just extend domProps.
But if you want to change an existing field, you have to create your own type and copy hundreds of existing fields. This is tedious.


I splitted the domProps into some subtypes, so it is easier to define your own domProps.
Example:

type customJsxProps = {
  children?: child, // custom type for children
  class?: string, // class instead of className
} 

type customDomProps = {
  ...customJsxProps,
  ...JsxDOM.baseProps,
  ...JsxDOM.events,
  ...JsxDOM.svg,
  style?: string, // string instead of JsxDOMStyle.t
}

What do you think?
Is there an easier way?
Does it have performance implications?

@dkirchhof
Copy link
Contributor Author

Btw:

I tried to fix the failing check by using the analaysis tests, but it didn't change anything.
Steps (using devcontainers cli):

  1. devcontainer up --workspace-folder .
  2. devcontainer exec --workspace-folder . bash
  3. rustup toolchain install 1.91 && rustup override set 1.91 otherwise next commands fail, because rust 1.88 is installed
  4. make lib && make build && make test-analysis

The test-analysis command succeeds, but doesn't change anything. So nothing to commit.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 20, 2026

Open in StackBlitz

rescript

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

@rescript/darwin-arm64

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

@rescript/darwin-x64

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

@rescript/linux-arm64

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

@rescript/linux-x64

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

@rescript/runtime

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

@rescript/win32-x64

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

commit: 4aabdb4

@dkirchhof dkirchhof marked this pull request as ready for review January 20, 2026 07:47
@dkirchhof
Copy link
Contributor Author

Btw:

I tried to fix the failing check by using the analaysis tests, but it didn't change anything. Steps (using devcontainers cli):

  1. devcontainer up --workspace-folder .
  2. devcontainer exec --workspace-folder . bash
  3. rustup toolchain install 1.91 && rustup override set 1.91 otherwise next commands fail, because rust 1.88 is installed
  4. make lib && make build && make test-analysis

The test-analysis command succeeds, but doesn't change anything. So nothing to commit.

Updated the container. Now it uses rust 1.92.

@nojaf
Copy link
Member

nojaf commented Jan 20, 2026

I think idea-wise I like this. It does make me wonder how much of these types should still lives in this repo and not in rescript-react?

Can't say anything on the impact of this change. I hope others can share more insights.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants