I want to use material-ui in typescript.
/// <reference path="../../../typings/react/react.d.ts"/>
import React = __React;
import * as FlatButton from "material-ui/lib/flat-button";
interface ATCProps{
clickHandler:__React.MouseEventHandler;
}
export default class AddToCartBtn extends React.Component<ATCProps,any>{
render(){
return (
<FlatButton></FlatButton> // -> error
)
}
}
flat-button.d.ts
declare module "material-ui/lib/flat-button" {
import ReactElement = __React.ReactElement;
import Component = __React.Component;
interface FlatButton extends __React.Component<any,any>{
}
export default FlatButton;
}
Error:(15, 14) TS2604: JSX element type 'FlatButton' does not have any construct or call signatures.
You need to replace interface FlatButton with class FlatButton. The module definition you've exported doesn't have any value associated with it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With