小编use*_*850的帖子

无法导入导出的界面 - 未找到导出

我把问题简化为这个例子:

test.model.ts

export class A {
    a: number;
}

export interface B {
    b: number;
}
Run Code Online (Sandbox Code Playgroud)

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;

}
Run Code Online (Sandbox Code Playgroud)

当我想使用界面时,我收到以下警告:

WARNING in ./src/app/.../test.component.ts
21:76 export 'B' was not found in './test.model'
Run Code Online (Sandbox Code Playgroud)

但是,使用是可以的.任何提示?

更新 …

typescript ecmascript-6 angular

12
推荐指数
4
解决办法
7181
查看次数

标签 统计

angular ×1

ecmascript-6 ×1

typescript ×1