How can I declare/ignore a missing JSX type?

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


I tried @Mikey's solution it did not work, but the following works for me:

    <Foo
      /*
      // @ts-ignore */
      id="foo does not have IdType"
      baz="foo Have bazType"
    /> 

In the above I am ignoring type error in property id


A use inside mask no longer throws a type error but if it still did today you could:

<mask id="mask1">
    {/* @ts-ignore */} 
    <use ... />
</mask>

Tags:

Typescript

Jsx