Skip to content

Unrecognized React JSX component declaration #7020

Closed
@PavelPZ

Description

@PavelPZ

I have this type definition file (principle extracted from https://www.nuget.org/packages/material-ui.TypeScript.DefinitelyTyped/):

declare module TestMod {
  type TTestStyles = 'x' | 'y' | 'z';
  interface TestProps extends React.Props<TestClass> {
    myStyle: TTestStyles;
  }
  interface TestClass extends React.ComponentClass<TestProps> { }
  var Test: TestClass;
}

Using this definition in JSX does not work as expected:

var Test: TestMod.TestClass;

var test = <div>
  <Test myStyle='yy'/> //Display error as expected (Type '"yy"' is not assignable to type '"x" | "y" | "z")
  <TestMod.Test myStyle='yy'/> //Does not display any error
</div>

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: JSX/TSXRelates to the JSX parser and emitterFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions