Canon - Update Heading & Text types

Signed-off-by: James Brooks <jamesbrooks@spotify.com>
This commit is contained in:
James Brooks
2025-07-03 17:13:25 +01:00
parent f4906890ba
commit d389066182
2 changed files with 14 additions and 10 deletions
@@ -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';