我将问题简化为以下示例:
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;
}
当我想使用interface时,我得到以下警告:
WARNING in ./src/app/.../test.component.ts
21:76 export 'B' was not found in './test.model'
然而,使用class是可以的.有什么提示吗?
UPDATE:似乎与这个问题有关:https://github.com/webpack/webpack/issues/2977