【问题标题】:Typescript Cannot find name 'XInterface'打字稿找不到名称'XInterface'
【发布时间】:2016-09-15 03:44:30
【问题描述】:

我有以下代码,包括一个类和一个接口。出于某种原因,Visual Studio 对我大喊“找不到名称 'RouteInterface'”,我不知道为什么。

import {Student} from './student';

export interface RouteInterface{
    id: number;
    startTime: Date;
    endTime: Date;
    neighborhood: string;
    students: Student[];
    tooltip: string;
    tooltipcls: string;
    icon: string;
}


export class Route extends RouteInterface {
    id: number;
    startTime: Date;
    endTime: Date;
    neighborhood: string;
    students: Student[];
    tooltip: string;
    tooltipcls: string;
    icon: string;

}

【问题讨论】:

    标签: typescript angular typescript1.8


    【解决方案1】:

    我认为您应该使用implements 关键字而不是extends 一个:

    export class Route implements RouteInterface {
      (...)
    }
    

    【讨论】:

      猜你喜欢
      • 2018-01-25
      • 2019-02-25
      • 1970-01-01
      • 1970-01-01
      • 2016-01-28
      • 2017-06-18
      • 2018-11-28
      • 1970-01-01
      • 2020-06-25
      相关资源
      最近更新 更多