2017-04-26 19 views
0

我基本上试图导入为应用程序创建的“模块”,并有权访问应该出现在应用程序中的变量以及一些帮助功能。Typescript&Immutable - 导出不可变映射的问题

我的模块下面:

import * as immutable from 'immutable'; 

const treeduxTrunk = immutable.Map(); 

export function setBranch(branchName: string, twigStruct: Object) { 
    treeduxTrunk.set(branchName, twigStruct); 
} 

export default treeduxTrunk; 

我的应用程序的文件:

import trunk  = require('../treedux/lib/treeduxTrunk'); 

treeduxTrunk.setBranch('route1', { 
    users: 'nothing', 
    products: 13 
}); 

console.log(treeduxTrunk.default); 

电流的结果是:

地图{大小:0,_root:未定义, __ownerID:undefined,__hash:undefined,__altered:false}

我期待它具有尺寸大于0,是准确的,我期待1.

什么我做错了任何想法?

由于提前,

TF

回答