angular – 无法导入导出的接口 – 未找到导出
发布时间:2020-12-17 08:50:45 所属栏目:安全 来源:网络整理
导读:我把问题简化为这个例子: 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
我把问题简化为这个例子:
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' 但是,使用类是可以的.任何提示? 更新:似乎与此问题有某种关联:https://github.com/webpack/webpack/issues/2977
昨天我在这里找到了另一个问题,解决方法是将导出的接口声明为一个单独的文件.每个文件有一个界面,它适用于我没有任何警告.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |