如何从模块中导入typescript中的命名对象

时间:2016-07-14 11:19:33

标签: typescript

如果我尝试这样的话:

+------+------------------+ -------+ |PERSON | MEETINGS WITH | | +------+------------------+ -------+ | A | CONT7 | 0 | | A | CONT8 | 0 | | A | CONT1 | 1 | | A | CONT2 | 1 | | B | CONT1 | 1 | | B | CONT3 | 1 | | B | CONT4 | 0 | | C | CONT1 | 0 | | C | CONT2 | 1 | | C | CONT3 | 0 | | C | CONT4 | 0 | | C | CONT5 | 0 | +------+---------------+ + -------+

然后当我像这样导入它时:

export var common = {}

import {common} from "./Common";未定义

1 个答案:

答案 0 :(得分:0)

尝试

import * as common from './common'

这意味着将整个对象导入标识符-common-,您的代码所说的是导入模块上常见的属性,并且没有这样的属性。