打字稿找不到名称 'XInterface'
Typescript Cannot find name 'XInterface'
我有以下代码,包括一个class和一个接口。出于某种原因 Visual Studio 对我大喊 "can't find name '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;
}
我认为您应该使用 implements
关键字而不是 extends
关键字:
export class Route implements RouteInterface {
(...)
}
我有以下代码,包括一个class和一个接口。出于某种原因 Visual Studio 对我大喊 "can't find name '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;
}
我认为您应该使用 implements
关键字而不是 extends
关键字:
export class Route implements RouteInterface {
(...)
}