Typescript 指令错误 "Property IScope dont exist on type 'IAngularStatic"

Typescript Directives error "Property IScope dont exist on type 'IAngularStatic"

我正在用 typescript 编写一个 Angular 指令来共享一个范围项,我创建了一个继承自 ng.IScope 的接口,但是 Visual Studio 代码显示了这个警告:"属性 IScope 在类型 IAngularStatic' 上不存在,我正在使用来自 definitelytyped.org 的 angular.d.ts 类型定义文件。

module kingApp.Directives {

export interface IMenuDirective: ng.IScope {

}

export function MenuDirective(): ng.IDirective
{

    return {
        templateUrl: 'shared/menu/menu.html',
        controller: Controllers.Home.HomeController              
    }
}
angular.module("kingApp").directive('menu',MenuDirective);

}

我如何将范围内的数据共享到我当前的指令?

您写了export interface IMenuDirective: ng.IScope {。应该是export interface IMenuDirective extends ng.IScope {。编译器错误具有误导性。