简体   繁体   English

在TypeScript文件中使用node.d.ts时发生编译错误

[英]Compilation error when using node.d.ts in TypeScript file

I am working on my first node.js project (for learning purposes) and I would like to use TypeScript as language of choice together with Visual Studio Code (yeah, I'm not looking for easy ways). 我正在做我的第一个node.js项目(出于学习目的),我想将TypeScript与Visual Studio Code一起用作首选语言(是的,我不是在寻找简单的方法)。 Source code is here: https://github.com/thecoderok/ukrbash-node When I reference node.d.ts in the source code I am getting lots of compilation 源代码在这里: https : //github.com/thecoderok/ukrbash-node当我在源代码中引用node.d.ts时,我得到了大量的编译信息

errors like:urkbash-node\\typings\\node\\node.d.ts(178,36): error TS1005: ';' 像这样的错误:urkbash-node \\ typings \\ node \\ node.d.ts(178,36):错误TS1005:';' expected. 预期。 urkbash-node\\typings\\node\\node.d.ts(425,5): error TS1008: Unexpected token; urkbash-node \\ typings \\ node \\ node.d.ts(425,5):错误TS1008:意外令牌; 'module, class, interface, enum, import or statement' expected. 预期为“模块,类,接口,枚举,导入或声明”。 urkbash-node\\typings\\node\\node.d.ts(425,12): error TS1008: Unexpected token; urkbash-node \\ typings \\ node \\ node.d.ts(425,12):错误TS1008:意外令牌; 'module, class, interface, enum, import or statement' expected. 预期为“模块,类,接口,枚举,导入或声明”。 urkbash-node\\typings\\node\\node.d.ts(425,17): error TS1005: ';' urkbash-node \\ typings \\ node \\ node.d.ts(425,17):错误TS1005:';' expected. 预期。

Does anyone know why and how to fix it? 有谁知道为什么以及如何解决它?

errors like:urkbash-node\\typings\\node\\node.d.ts(178,36): error TS1005: ';' 像这样的错误:urkbash-node \\ typings \\ node \\ node.d.ts(178,36):错误TS1005:';' expected. 预期。

Considering the content of the line here Seems like you are using it with TypeScript 1.4 (which doesn't have union types). 考虑此处的行内容似乎就像您将其与TypeScript 1.4(不具有联合类型)一起使用。 Please update VS Code to latest to use TS 1.5 请更新VS Code至最新版本以使用TS 1.5

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM