typescriptfontsnext.js

TypeScript font import, error with link tag property crossorigin


How can I resolve this typscript error when importing a custom font (e.g. google font).

<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />

Here the details of the error:

Type 'boolean' is not assignable to type 'string'.ts(2322)
index.d.ts(2279, 9): The expected type comes from property 'crossOrigin' which is declared here on type 'DetailedHTMLProps<LinkHTMLAttributes<HTMLLinkElement>, HTMLLinkElement>'

Fix:


Solution

  • did you try to write crossOrigin instead of crossorigin?