Merge pull request #30440 from backstage/types

Canon - Update Heading & Text types
This commit is contained in:
Charles de Dreuille
2025-07-03 22:14:31 +01:00
committed by GitHub
4 changed files with 35 additions and 20 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/canon': patch
---
Update return types for Heading & Text components for React 19.
+16 -10
View File
@@ -1013,11 +1013,14 @@ export interface HeaderTab {
}
// @public (undocumented)
export const Heading: <T extends ElementType = 'h1'>(
props: HeadingProps<T> & {
ref?: React.Ref<any>;
},
) => React.ReactElement | null;
export const Heading: {
<T extends ElementType = 'h1'>(
props: HeadingProps<T> & {
ref?: React.ComponentPropsWithRef<T>['ref'];
},
): React.ReactElement<HeadingProps<T>, T>;
displayName: string;
};
// @public (undocumented)
export type HeadingOwnProps = {
@@ -1672,11 +1675,14 @@ export interface TabsRootWithoutOrientation
> {}
// @public (undocumented)
const Text_2: <T extends ElementType = 'p'>(
props: TextProps<T> & {
ref?: React.Ref<any>;
},
) => React.ReactElement | null;
const Text_2: {
<T extends ElementType = 'p'>(
props: TextProps<T> & {
ref?: React.ComponentPropsWithRef<T>['ref'];
},
): React.ReactElement<TextProps<T>, T>;
displayName: string;
};
export { Text_2 as Text };
// @public (undocumented)
@@ -54,10 +54,11 @@ function HeadingComponent<T extends ElementType = 'h1'>(
HeadingComponent.displayName = 'Heading';
/** @public */
export const Heading = forwardRef(HeadingComponent) as <
T extends ElementType = 'h1',
>(
props: HeadingProps<T> & { ref?: React.Ref<any> },
) => React.ReactElement | null;
export const Heading = forwardRef(HeadingComponent) as {
<T extends ElementType = 'h1'>(
props: HeadingProps<T> & { ref?: React.ComponentPropsWithRef<T>['ref'] },
): React.ReactElement<HeadingProps<T>, T>;
displayName: string;
};
(Heading as any).displayName = 'Heading';
Heading.displayName = 'Heading';
+7 -4
View File
@@ -56,8 +56,11 @@ function TextComponent<T extends ElementType = 'p'>(
TextComponent.displayName = 'Text';
/** @public */
export const Text = forwardRef(TextComponent) as <T extends ElementType = 'p'>(
props: TextProps<T> & { ref?: React.Ref<any> },
) => React.ReactElement | null;
export const Text = forwardRef(TextComponent) as {
<T extends ElementType = 'p'>(
props: TextProps<T> & { ref?: React.ComponentPropsWithRef<T>['ref'] },
): React.ReactElement<TextProps<T>, T>;
displayName: string;
};
(Text as any).displayName = 'Text';
Text.displayName = 'Text';