You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi all, react-icons types for the icons that it exports, their component props extend the React.SVGAttributes type to allow any existing SVG attributes to be applied in addition to the extra that the library contains.
I found the preact/compat types don't actually export SVGAttributes under the React namespace (as well as a number of other types in the React typings), so I tried creating a react.d.ts file with contents like so:
declare namespace React {
type SVGAttributes = preact.JSX.SVGAttributes;
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi all,
react-icons
types for the icons that it exports, their component props extend theReact.SVGAttributes
type to allow any existing SVG attributes to be applied in addition to the extra that the library contains.However, after applying this to my
tsconfig
:I found the
preact/compat
types don't actually exportSVGAttributes
under theReact
namespace (as well as a number of other types in the React typings), so I tried creating areact.d.ts
file with contents like so:and then include it in
paths
like this:That got it so that VSCode was showing me the types when I control-click on
SVGAttributes
, buttsc
doesn't pick that up and then typechecking fails.Any suggestions? Thanks!
Beta Was this translation helpful? Give feedback.
All reactions