A simple example:
import * as React from 'react'
declare function getFish(x: any): any;
declare var Tank: any;
var Aquarium = ({species}) => (
<Tank>
{getFish(species)}
</Tank>
);
let x = <Aquarium species="rainbowfish"/>;
Result:
(10.9): Error TS2605: JSX Element Type "Element" is not a design function for JSX elements.
Note that the error relates to the use of the component (let x be an ad). It seems that perhaps the definition file for React does not allow this as valid JSX? I am using the latest React 0.14 definition file from tsd, what am I doing wrong?
Let's say I defined the following stateless functional component (React v0.14)
let GreeterComponent = (props: {name: string}){
return <div>Hi {props.name}!</div>
}
in another component, I use it as follows:
class WrappingComponent extends React.Component{
render(){
let names = ['tom', 'john', 'simon'];
return (
<div className="names">
{names.map((name)=> <GreeterComponent name={name} />)}
</div>
);
}
}
I get this error from typescript compiler:
error TS2605: JSX "" JSX. "render" "" .
? typescript? react.d.ts tsd