简体   繁体   中英

Can't import TableComponentJS in TypeScript

im working on a project and i have a problem. Im using Angular2, typescript, webpack 2.2 and im trying to use this table component: pyrite table

The problem starts when i try to import this component in my component. I installed it with npm and thats work. But when i try to import it i use: import * as Table from "pyrite-table";

And then i try to use Table.load but i get an error: index.js:38 Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'

And that line is this:

export default module.exports = window.pyrite.Table = Table;

So my question is, how can i import this component in my project that is using typescript.

I saw in the project repo's readme the following loc:

import Table from 'pyrite-table';

Have you tried this one? Or:

import { Table } from 'pyrite-table';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM