Skip to content

Instantly share code, notes, and snippets.

@blvdmitry
Created March 11, 2023 21:19
Show Gist options
  • Save blvdmitry/53c699e644dd253648d04f9ec97efb31 to your computer and use it in GitHub Desktop.
Save blvdmitry/53c699e644dd253648d04f9ec97efb31 to your computer and use it in GitHub Desktop.
type Props<TagName extends keyof JSX.IntrinsicElements | void = void> = {
as?: TagName;
children?: React.ReactNode;
attributes?: Attributes<TagName>;
};
export type Attributes<TagName = void, O = void> = Omit<
(TagName extends keyof JSX.IntrinsicElements
? JSX.IntrinsicElements[TagName]
: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>) &
DataAttributes & { style?: StyleAttribute },
O extends object ? keyof O : "className"
>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment