Typescript error TS1005: ';' expected

匿名 (未验证) 提交于 2019-12-03 03:05:02

问题:

I am trying compile this typescript file:

import http = module("http"); import express = module("express"); 

With these parameters:

C:/nodejs/tsc.cmd --sourcemap cheese.ts --module commonjs C:/User/Node/ExpressProject/cheese.ts(5,21): error TS1005: ';' expected. C:/User/Node/ExpressProject/cheese.ts(6,24): error TS1005: ';' expected. 

What am I doing wrong? Even with this, I am getting the same errors errors:

module "http" {} module "express" {}  import http = module("http"); import express = module("express"); 

Using Typescript version 0.9.1

回答1:

The syntax in 0.9.1 is now import mod = require('modname');



回答2:

Typescript compiler (https://www.npmjs.org/package/typescript-compiler) commands.

I use --allowimportmodule



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!