类型“DetailedHTMLProps<LinkHTMLAttributes<HTMLLinkElement>,HTMLLinkElement>”上不存在属性“fetchPriority”

Ayy*_*llu 5 typescript react-typescript

我正在尝试将“fetchPriority”添加到链接标记,如下所示。

const optionalPreload =
    ServerOnlyHead  ? (
      <ServerOnlyHead
        children={
          <link
            fetchPriority="high" // error here !!!
            rel="preload"
            as="image"
            href={image?.src || ""}
          />
        }
      />
    ) : null;
Run Code Online (Sandbox Code Playgroud)

但它会引发以下错误,

在此输入图像描述

Type '{ fetchPriority: string; rel: string; as: string; href: string; }' is not assignable to type 'DetailedHTMLProps<LinkHTMLAttributes<HTMLLinkElement>, HTMLLinkElement>'.
  Property 'fetchPriority' does not exist on type 'DetailedHTMLProps<LinkHTMLAttributes<HTMLLinkElement>, HTMLLinkElement>'.ts(2322)
'fetchPriority' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.ts(7022)
Run Code Online (Sandbox Code Playgroud)

我可以看到 LinkHTMLAttributes 没有“fetchPriority”属性。

interface LinkHTMLAttributes<T> extends HTMLAttributes<T> {
        as?: string | undefined;
        crossOrigin?: string | undefined;
        href?: string | undefined;
        hrefLang?: string | undefined;
        integrity?: string | undefined;
        media?: string | undefined;
        imageSrcSet?: string | undefined;
        referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
        rel?: string | undefined;
        sizes?: string | undefined;
        type?: string | undefined;
        charSet?: string | undefined;
    }
Run Code Online (Sandbox Code Playgroud)

有人可以告诉我如何解决这个问题吗?

谢谢!!