TS Server does not recognise title
prop for loaded inline SVG components
#9609
Labels
bug
An error in the Docusaurus core causing instability or issues with its execution
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
This issue does not impact the functionality of Docusaurus, but it does impact the developing experience.
For accessibility one might need to set the "title" tag for imported inline SVG React components. Docusaurus has SVGR loader configured such that it will accept a prop named "title", but this is not reflected in the type definition and TS server will complain.
docusaurus/packages/docusaurus-utils/src/webpackUtils.ts
Line 151 in 7650829
I have a fix here which I will be happy to open a PR should this hacky solution to be correct, yet I don't know if there are less hacky ways to fix this issue, or if SVGR is the party to blame...
Reproducible demo
No response
Steps to reproduce
<Svg className={styles.featureSvg} role="img" />
to be<Svg className={styles.featureSvg} role="img" title="Cool Dinosaur" />
Expected behavior
TS server will not complain about anything, and the site builds correctly
Actual behavior
TS server is unhappy and shows that
Your environment
Self-service
The text was updated successfully, but these errors were encountered: