We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
IconProps
The following code will have a TypeScript error:
import { IconCreditCard, IconProps } from "@tabler/icons-react"; // Error about incompatible `ref` prop function TestIcon(props: IconProps) { return <IconCreditCard {...props} />; }
Sandbox with a reproduction – https://codesandbox.io/p/sandbox/mantine-react-template-forked-jhy3jl?file=%2Fsrc%2FApp.tsx%3A3%2C1-7%2C2
The error is gone once ref prop is removed:
ref
// ok function TestIcon(props: Omit<IconProps, 'ref'>) { return <IconCreditCard {...props} />; }
To fix types mismatch change IconProps type from
interface IconProps extends Partial<Omit<React.SVGProps<SVGSVGElement>, 'stroke'>> { size?: string | number; stroke?: string | number; }
to
interface IconProps extends Partial<Omit<React.ComponentPropsWithoutRef<'svg'>, 'stroke'>> { size?: string | number; stroke?: string | number; }
The text was updated successfully, but these errors were encountered:
i cant't use newer version becasue this bug...
Sorry, something went wrong.
@rtivital you know a workarround for this?
the solution for me
in 2.x i use
export interface Acao { ... icone: (props: TablerIconsProps) => ReactElement; ... }
now in 3.2.0
export interface Acao { icone: React.ExoticComponent<React.RefAttributes<Icon>>; }
and where i used Icon in props needs no changes.
export const menu: Acao[] = [ { ... icone: IconDashboard, ... }, ....
Successfully merging a pull request may close this issue.
The following code will have a TypeScript error:
Sandbox with a reproduction – https://codesandbox.io/p/sandbox/mantine-react-template-forked-jhy3jl?file=%2Fsrc%2FApp.tsx%3A3%2C1-7%2C2
The error is gone once
ref
prop is removed:To fix types mismatch change
IconProps
type fromto
The text was updated successfully, but these errors were encountered: