1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
//// [file.tsx]
import React = require('react');
interface ComponentProps {
property1: string;
property2: number;
}
export default function Component(props: ComponentProps) {
let condition1: boolean;
if (condition1) {
return (
<ChildComponent {...props} />
);
}
else {
return (<ChildComponent {...props} property1="NewString" />);
}
}
interface AnotherComponentProps {
property1: string;
}
function ChildComponent({ property1 }: AnotherComponentProps) {
return (
<span>{property1}</span>
);
}
//// [file.jsx]
"use strict";
exports.__esModule = true;
var React = require("react");
function Component(props) {
var condition1;
if (condition1) {
return (<ChildComponent {...props}/>);
}
else {
return (<ChildComponent {...props} property1="NewString"/>);
}
}
exports["default"] = Component;
function ChildComponent(_a) {
var property1 = _a.property1;
return (<span>{property1}</span>);
}
|