* New diagnostic message for wrong JSX function component * Component and Mixed type * fix existing tests * add new test for JSX component return type error * fix tslint error * update diagnostic message to include component name * accept baseline * update tests * missing semicolon * accept baseline Co-authored-by: Wesley Wigham <wwigham@gmail.com>
23 lines
935 B
Plaintext
23 lines
935 B
Plaintext
tests/cases/conformance/jsx/file.tsx(9,14): error TS2786: 'Foo' cannot be used as a JSX component.
|
|
Its return type 'undefined' is not a valid JSX element.
|
|
tests/cases/conformance/jsx/file.tsx(10,12): error TS2786: 'Greet' cannot be used as a JSX component.
|
|
Its return type 'undefined' is not a valid JSX element.
|
|
|
|
|
|
==== tests/cases/conformance/jsx/file.tsx (2 errors) ====
|
|
import React = require('react');
|
|
|
|
const Foo = (props: any) => undefined;
|
|
function Greet(x: {name?: string}) {
|
|
return undefined;
|
|
}
|
|
|
|
// Error
|
|
const foo = <Foo />;
|
|
~~~
|
|
!!! error TS2786: 'Foo' cannot be used as a JSX component.
|
|
!!! error TS2786: Its return type 'undefined' is not a valid JSX element.
|
|
const G = <Greet />;
|
|
~~~~~
|
|
!!! error TS2786: 'Greet' cannot be used as a JSX component.
|
|
!!! error TS2786: Its return type 'undefined' is not a valid JSX element. |