mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Add conformance tests for union element type
This commit is contained in:
17
tests/cases/conformance/jsx/tsxUnionElementType1.tsx
Normal file
17
tests/cases/conformance/jsx/tsxUnionElementType1.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
// @filename: file.tsx
|
||||
// @jsx: react
|
||||
// @noLib: true
|
||||
// @libFiles: react.d.ts,lib.d.ts
|
||||
|
||||
import React = require('react');
|
||||
|
||||
function SFC1(prop: { x: number }) {
|
||||
return <div>hello</div>;
|
||||
};
|
||||
|
||||
function SFC2(prop: { x: boolean }) {
|
||||
return <h1>World </h1>;
|
||||
}
|
||||
|
||||
var SFCComp = SFC1 || SFC2;
|
||||
<SFCComp x />
|
||||
17
tests/cases/conformance/jsx/tsxUnionElementType2.tsx
Normal file
17
tests/cases/conformance/jsx/tsxUnionElementType2.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
// @filename: file.tsx
|
||||
// @jsx: react
|
||||
// @noLib: true
|
||||
// @libFiles: react.d.ts,lib.d.ts
|
||||
|
||||
import React = require('react');
|
||||
|
||||
function SFC1(prop: { x: number }) {
|
||||
return <div>hello</div>;
|
||||
};
|
||||
|
||||
function SFC2(prop: { x: boolean }) {
|
||||
return <h1>World </h1>;
|
||||
}
|
||||
|
||||
var SFCComp = SFC1 || SFC2;
|
||||
<SFCComp x={"hi"}/>
|
||||
Reference in New Issue
Block a user