2017-05-05 17:47:52 +02:00
|
|
|
// @filename: file.tsx
|
|
|
|
// @jsx: preserve
|
|
|
|
// @noLib: true
|
2017-10-04 22:14:05 +02:00
|
|
|
// @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>);
|
|
|
|
}
|
|
|
|
}
|