TypeScript/tests/cases/conformance/jsx/checkJsxChildrenProperty12.tsx

38 lines
704 B
TypeScript
Raw Normal View History

2017-05-05 17:47:52 +02:00
// @filename: file.tsx
// @jsx: preserve
// @noLib: true
// @skipLibCheck: true
2017-05-05 17:47:52 +02:00
// @libFiles: react.d.ts,lib.d.ts
import React = require('react');
interface ButtonProp {
a: number,
b: string,
children: Button;
}
class Button extends React.Component<ButtonProp, any> {
render() {
2017-05-05 19:05:50 +02:00
let condition: boolean;
if (condition) {
return <InnerButton {...this.props} />
}
else {
return (<InnerButton {...this.props} >
<div>Hello World</div>
</InnerButton>);
}
2017-05-05 17:47:52 +02:00
}
}
interface InnerButtonProp {
a: number
}
class InnerButton extends React.Component<InnerButtonProp, any> {
render() {
return (<button>Hello</button>);
}
}