简体   繁体   English

无法在TypeScript中导入TableComponentJS

[英]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 我正在使用Angular2,打字稿,webpack 2.2,并且我正在尝试使用此表组件: 黄铁矿表

The problem starts when i try to import this component in my component. 当我尝试在组件中导入该组件时,问题就开始了。 I installed it with npm and thats work. 我用npm安装了它,这就是工作。 But when i try to import it i use: import * as Table from "pyrite-table"; 但是当我尝试导入它时,我使用: 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>' 然后我尝试使用Table.load但出现错误: 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';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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