Skip to content

[labs/react] export component and prop types #3188

@taylor-vann

Description

@taylor-vann

Which package is this a feature request for?

React (@lit-labs/react)

Description

An explicit helper type for devs to use in JSXIntrinicElements would reduce type conflicts for react clients.

declare namespace JSX {
  interface IntrinsicElements {
    foo: HelperType<CustomElement>;
  }
}

Currently we rely on Typescript to infer what is returned from createComponent and although TS is fairly good, an inference is not as durable as an explicit typing.

Related to: #3163

Alternatives and Workarounds

There are a few caveats to keep in mind:

  • our package returns a ForwardedRef as a component
  • web components not created through createComponent still need proper typing, they are not a ForardRef

Two types should be exported:

  1. type returned from createComponent
  2. a type any dev can use for IntrinsicElements

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions