使用index.ts导出“默认”
我有以下的项目结构:
build/ build.ts config/ config.ts index.ts ...
config.ts
包含一个默认的导出types,如下所示:
export default { myProp: { someProp: "someValue" } }
而config/
的index.ts
如下所示:
export * from './config';
现在我想要像这样在build.ts
导入configurationtypes:
import config from '../config';
但是,当使用它(例如与config.myProp
),它告诉我, myProp
不存在index.ts
。
根据这里的官方模块文档,这应该工作得很好。 我在这里错过了什么?
在config/index.ts
重新导出configuration,如下所示:
export {default as config} from './config';
然后在build/build.ts
:
import {config} from '../config;
- 如何为具有构造函数的复杂外部commonjs模块(如imap)编写TypeScript声明文件?
- TypeScript导入与ES6对象解构
- 无法在typescript / angular2环境中设置持久会话,在后端设置nodejs
- stripe angular错误:Uncaught(在promise中):TypeError:无法读取未定义的属性'stripeService'
- 使用npm angular2导入库
- 全栈应用程序应该有多less个package.json文件?
- 在TypeScript中导入Node.js npm模块(node_modules)和声明
- Webstorm导入Angular 2的url问题
- Typescript:Mongodb承诺