Javascript es6再出口

时间:2016-04-26 21:40:38

标签: javascript react-native ecmascript-6 tcomb

修改 也许我发现了问题,如果有人可以确认这种情况:似乎test.js正在导入index.js导入test.jsexport没有停止无限-loop包含......是不是?有没有像那样的解决方法如果它是调用的,请不要包含此文件?

我面临一个奇怪的问题。我正在尝试从重新导出中导入一些对象(tcomb-react-native与此处无关,因为问题出在import/export)。

|-- index.js
|-- simpleTypes.js
|-- userType.js

index.js

export { UserType, UserTypeBase } from './test';
export { TextMax9Type } from './simpleTypes';

simpleTypes.js

import t from 'tcomb-form-native';
export const TextMax9Type = t.refinement(t.String, s => s.length <= 9);

test.js

import t from 'tcomb-form-native';
// import { TextMax9Type } from './'; // <----- NOT WORKING!
import { TextMax9Type } from './simpleTypes'; // <----- OK no error

export const UserTypeBase = {
    Name: TextMax9Type,
    Surname: TextMax9Type,
};

export const UserType = t.struct(UserTypeBase);

NOT WORKING错误提供给struct(props,[name])组合器的无效参数props {}(期望字典String-&gt; Type)

那么导出空对象的重新导出问题是什么?

0 个答案:

没有答案