在VS2013中编译时,Typescript和node.d.ts 2出错 [英] Typescript and node.d.ts 2 errors when compiling in VS2013

查看:82
本文介绍了在VS2013中编译时,Typescript和node.d.ts 2出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个工作的SharePoint应用程序,我需要从Azure Service Bus队列中读取。我读到最好的方法是使用Node.js.我正在尝试使用来自NuGet的Typescript明确类型定义并安装node.definitelytyped文件没问题,并且在我的应用程序中安装了以下文件



node -0.10.d.ts

node-0.11.d.ts

node-0.12.d.ts

node-0.8.8。 d.ts

node-4.d.ts

node.d.ts



编译此处点给了我2128个错误,其中大部分是关于重复的

我删除了以下文件,看起来像以前的版本



node-0.10 .d.ts

node-0.11.d.ts

node-0.12.d.ts

node-0.8.8.d。 ts

node-4.d.ts



但我离开了'node.d.ts',减少了错误列表从2128下降到以下2个错误



1)类'AssertionError'错误地实现了接口'Error'。 'AssertionError'类型中缺少属性'popStackFrame'。 node.d.ts



2)构建:类'AssertionError'错误地实现了接口'Error'。 node.d.ts





我已经将Visual Studio 2013中的Typescript扩展更新为版本1.8的'扩展和更新'但这没有帮助



有人能指出我对这2个错误的解决方案吗?



我尝试过:



更新Visual Studio的Typescript扩展。安装最新版本的NPM并再次获取定义文件。

I've got a working SharePoint App that I need to read from an Azure Service Bus queue. I read that the best way to do this is with Node.js. I'm trying to do this with the Typescript definitely typed definitions from NuGet and installed the node.definitelytyped files no problem and it's installed in my App the following files

node-0.10.d.ts
node-0.11.d.ts
node-0.12.d.ts
node-0.8.8.d.ts
node-4.d.ts
node.d.ts

Compiling at this point gave me 2128 errors most of which are about duplicates
I've removed the following files which looked like previous versions

node-0.10.d.ts
node-0.11.d.ts
node-0.12.d.ts
node-0.8.8.d.ts
node-4.d.ts

But I've left 'node.d.ts' which has reduced the error list down from 2128 to the following 2 errors

1) Class 'AssertionError' incorrectly implements interface 'Error'. Property 'popStackFrame' is missing in type 'AssertionError'. node.d.ts

2) Build: Class 'AssertionError' incorrectly implements interface 'Error'. node.d.ts


I've updated the Typescript extension in Visual Studio 2013 with the 'Extensions and Updates' to version 1.8 but this hasn't helped

Can anyone point me to a resolution to these last 2 errors?

What I have tried:

Updating Typescript extension for Visual Studio. Installing latest version of NPM and getting the definition files again.

推荐答案

确定错误告诉我''AssertionError'中缺少'popStackFrame'的属性类。以下是类定义:



Ok so the error is telling me that the property for 'popStackFrame' is missing from the 'AssertionError' class. Here is the class definition:

export class AssertionError implements Error {
    name: string;
    message: string;
    actual: any;
    expected: any;
    operator: string;
    generatedMessage: boolean;

    constructor(options?: {
        message?: string; actual?: any; expected?: any;
        operator?: string; stackStartFunction?: Function
    });
}





所以我用额外的行改变了这个类似乎





So I've altered the class to look like this with the extra line

export class AssertionError implements Error {
    name: string;
    message: string;
    actual: any;
    expected: any;
    operator: string;
    generatedMessage: boolean;
    popStackFrame: any;

    constructor(options?: {
        message?: string; actual?: any; expected?: any;
        operator?: string; stackStartFunction?: Function
    });
}





现在代码编译正常。



The code now compiles ok.


这篇关于在VS2013中编译时,Typescript和node.d.ts 2出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆