You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Using React.DetailedHTMLProps includes the optional ref prop with a ref that should return the element class itself. This is the same type used for built-in elements in React.JSX.IntrinsicElements.
We only need the React.DetailedHTMLProps for WebComponentProps meant to be used for IntrinsicElements whereas the internal type for the component props still just needs the React.HTMLAttributes as we did before. So I added a ElementProps type that's shared between those.
Test for this could be better but I just added a small build-time check for now.
I want to better refactor the test to really separately test the different parts of create-component.ts instead of the single test render harness trying pass props to a div, an x-foo, and the wrapped component like this
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4060
Using
React.DetailedHTMLPropsincludes the optionalrefprop with a ref that should return the element class itself. This is the same type used for built-in elements inReact.JSX.IntrinsicElements.We only need the
React.DetailedHTMLPropsforWebComponentPropsmeant to be used forIntrinsicElementswhereas the internal type for the component props still just needs theReact.HTMLAttributesas we did before. So I added aElementPropstype that's shared between those.Test for this could be better but I just added a small build-time check for now.
I want to better refactor the test to really separately test the different parts of
create-component.tsinstead of the single test render harness trying pass props to a div, an x-foo, and the wrapped component like thislit/packages/labs/react/src/test/create-component_test.tsx
Lines 126 to 132 in 47b4891
but that should be its own PR.