Skip to content

Incorrect types for custom link components in PrismicRichText #173

@thompsongl

Description

@thompsongl

Versions

  • @prismicio/react: v2.5.1
  • react: v18.2.0
  • node: v16.18.1

Reproduction

https://codesandbox.io/s/modern-shadow-2tqpqb?file=/src/App.tsx

Steps to reproduce

  1. Go to the repro link
  2. See the TypeScript errors
  3. Change the @prismicio/react version to v2.1.2
  4. See the TypeScript errors disappear

What is expected?

@prismicio/[email protected] should not have the type errors

What is actually happening?

Trying to upgrade @prismicio/react to the latest version is blocked on type errors related to internalLinkComponent and externalLinkComponent:

Type '({ href, target, children, rel }: { href: any; target: any; children: any; rel: any; }) => Element' is not assignable to type '"a"'.

I have not been able to find a workaround (aside from type casting) or update to the PrismicLinkProps interface that accommodates custom components and DOM tag names.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions