Issue
I would like to use the SVG use
element in a .tsx
file:
<mask id="mask1">
<use ... />
</mask>
I'm transpiling this to React calls directly. However, I keep receiving the following error:
Property 'use' does not exist on type 'JSX.IntrinsicElements'.
I believe this element is missing from the standard lib definitions. How can I declare this type for the TypeScript compiler to see, similar to how I can declare a class or variable? The usual declare var
and declare class
statements have no effect.
If that's not possible, how can I make the TypeScript compiler ignore this error?
Solution
If you want to ignore an error inline, use this weird syntax:
{/*
// @ts-ignore */}
<Foo id="fooDoesNotHaveIdType" />
Taken from https://github.com/Microsoft/TypeScript/issues/27552
Answered By - Mikey
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.