mirror of
https://github.com/shoelace-style/shoelace.git
synced 2026-01-12 02:59:13 +00:00
Update React Wrappers with Refs that work (#1526)
* fix react types for refs * fix displayName * fix displayName] * attempt to fix typings for React refs * fix bad type * prettier * add changelog entry * prettier
This commit is contained in:
@@ -51,6 +51,15 @@ components.map(component => {
|
||||
${eventImports}
|
||||
${eventExports}
|
||||
|
||||
export type ForwardComponent<
|
||||
Element extends HTMLElement,
|
||||
ReactComponent extends React.ElementType
|
||||
> = React.JSXElementConstructor<
|
||||
React.ComponentPropsWithoutRef<ReactComponent> & {
|
||||
ref?: React.ForwardedRef<Element>;
|
||||
}
|
||||
> & { displayName?: string }
|
||||
|
||||
const tagName = '${component.tagName}'
|
||||
|
||||
const component = createComponent({
|
||||
@@ -76,7 +85,7 @@ components.map(component => {
|
||||
}
|
||||
}
|
||||
|
||||
export default SlComponent;
|
||||
export default SlComponent as ForwardComponent<Component, typeof SlComponent>;
|
||||
`,
|
||||
Object.assign(prettierConfig, {
|
||||
parser: 'babel-ts'
|
||||
|
||||
Reference in New Issue
Block a user