我的問題減少到這個例子:不能導入導出接口 - 出口未發現
test.model.ts
export class A {
a: number;
}
export interface B {
b: number;
}
test.component.ts
import { Component, Input } from '@angular/core';
import { A, B } from './test.model';
@Component({
selector: 'test',
template: '<h1>test</h1>'
})
export class TestComponent {
//This works fine
@Input() foo: A;
//Does NOT work - export 'B' was not found in './test.model'
@Input() bar: B;
}
當我想要使用接口我得到以下警告:
WARNING in ./src/app/.../test.component.ts
21:76 export 'B' was not found in './test.model'
但是,使用類是OK。任何提示?
UPDATE:這似乎是某種方式與這個問題有關:https://github.com/webpack/webpack/issues/2977
這是不是已經在這裏得到解答? http://stackoverflow.com/questions/30270084/why-the-limitation-on-exporting-an-interface-by-default-in-typescript –
我不這麼認爲 - 這個問題涉及默認出口,我不知道沒用。不管怎麼說,還是要謝謝你。 – user2878850
啊對不起,沒有正確閱讀 –