Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Text): fix custom html tag inheritance #1584

Merged
merged 1 commit into from
May 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/components/Text/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import type {ColorTextBaseProps} from './colorText/colorText';
import {text} from './text/text';
import type {TextBaseProps} from './text/text';

export interface TextProps
export interface TextProps<C extends React.ElementType = 'span'>
extends Omit<TextBaseProps, 'ellipsisLines'>,
ColorTextBaseProps,
QAProps {
/**
* Ability to override default html tag
*/
as?: keyof JSX.IntrinsicElements;
as?: C;
style?: React.CSSProperties;
className?: string;
id?: string;
Expand All @@ -25,9 +25,8 @@ export interface TextProps

type TextRef<C extends React.ElementType> = React.ComponentPropsWithRef<C>['ref'];

type TextPropsWithoutRef<C extends React.ElementType> = {
as?: C;
} & Omit<TextProps, 'as'>;
type TextPropsWithoutRef<C extends React.ElementType> = TextProps<C> &
Omit<React.ComponentPropsWithoutRef<C>, keyof TextProps<C>>;

/**
* A component for working with typography.
Expand Down
Loading