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

Typescript errors on attempting to pass alt prop down to img #16

Open
lotust opened this issue Aug 21, 2020 · 0 comments
Open

Typescript errors on attempting to pass alt prop down to img #16

lotust opened this issue Aug 21, 2020 · 0 comments

Comments

@lotust
Copy link

lotust commented Aug 21, 2020

getting typescript error on attempting to add non-explicitly defined props in to component despite docs indicating that it is possible

Any other props will be passed down to the element. This way, you can e.g. add an alt attribute to the image.

Type '{ src: string; alt: string; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Magnifier> & Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "children" | "src"> & Partial<...> & Partial<...>'.
  Property 'alt' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Magnifier> & Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "children" | "src"> & Partial<...> & Partial<...>'.

looking at interface Props defined in /src/Magnifier.tsx is it possible that adding a [key: string]?: HTMLAttributes<T> would address the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant