Reputation: 325
I added an external component module that does not include @type. I modified a sample to like this.
https://www.npmjs.com/package/react-sticky-table
const StickyTable = require("react-sticky-table");
const Row = require("react-sticky-table");
const Cell = require("react-sticky-table");
export const BasicExample = () => {
return (
<React.Fragment>
<Paper>
<div style={{ width: "100%", height: "400px" }}>
<StickyTable>
<Row>
<Cell>Header 1</Cell>
<Cell>Header 2</Cell>
</Row>
<Row>
<Cell>Cell 1</Cell>
<Cell>Cell 2</Cell>
</Row>
</StickyTable>
</div>
</Paper>
</React.Fragment>
);
};
but any type is not be recognised "JFX.element" What should I do ?
Upvotes: 0
Views: 37
Reputation: 922
I just run your code and looks like it's not a problem with a TypeSctipt but with your imports. What you have is this:
const StickyTable = require("react-sticky-table");
const Row = require("react-sticky-table");
const Cell = require("react-sticky-table");
But from what I see in the library documentation is that a partial import should be used here. Try modifying your code to that form. It worked in my code so hopefully will be fine in your as well.
const StickyTable = require("react-sticky-table").StickyTable;
const Row = require("react-sticky-table").Row;
const Cell = require("react-sticky-table").Cell;
Upvotes: 1