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?

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.

1 participant