How to write Definition File for React JSX

2020-03-31 03:16发布

I want to write a custom definition file for Summernote.jsx so that i dont get react-summernote module not found

i have written

declare var ReactSummernote: JSX.ElementClass;

declare module "react-summernote" {

    export default ReactSummernote;
}

and imported this as

import ReactSummernote from 'react-summernote';

but got an error saying

"JSX element type 'ReactSummernote' does not have any construct or call signatures"
on
<ReactSummernote />

following is the link

Summernote.JSX

1条回答
淡お忘
2楼-- · 2020-03-31 03:51

You can just declare the module as:

declare module "react-summernote";

Or more specifically:

declare module "react-summernote" {
    import * as React from "react";
    let ReactSummernote: React.ComponentClass<any>;
    export default ReactSummernote;
}
查看更多
登录 后发表回答