35 lines
1.2 KiB
Plaintext
35 lines
1.2 KiB
Plaintext
tests/cases/conformance/jsx/tsxElementResolution9.tsx(11,2): error TS2601: The return type of a JSX element constructor must return an object type.
|
|
tests/cases/conformance/jsx/tsxElementResolution9.tsx(18,2): error TS2601: The return type of a JSX element constructor must return an object type.
|
|
|
|
|
|
==== tests/cases/conformance/jsx/tsxElementResolution9.tsx (2 errors) ====
|
|
declare module JSX {
|
|
interface Element { }
|
|
interface IntrinsicElements { }
|
|
}
|
|
|
|
interface Obj1 {
|
|
new(n: string): { x: number };
|
|
new(n: number): { y: string };
|
|
}
|
|
var Obj1: Obj1;
|
|
<Obj1 />; // Error, return type is not an object type
|
|
~~~~
|
|
!!! error TS2601: The return type of a JSX element constructor must return an object type.
|
|
|
|
interface Obj2 {
|
|
(n: string): { x: number };
|
|
(n: number): { y: string };
|
|
}
|
|
var Obj2: Obj2;
|
|
<Obj2 />; // Error, return type is not an object type
|
|
~~~~
|
|
!!! error TS2601: The return type of a JSX element constructor must return an object type.
|
|
|
|
interface Obj3 {
|
|
(n: string): { x: number };
|
|
(n: number): { x: number; y: string };
|
|
}
|
|
var Obj3: Obj3;
|
|
<Obj3 x={42} />; // OK
|
|
|