Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Typescript error TS1005: ';' expected

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

like image 932
Games Brainiac Avatar asked Aug 17 '13 21:08

Games Brainiac


3 Answers

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

like image 111
Ryan Cavanaugh Avatar answered Nov 16 '22 04:11

Ryan Cavanaugh


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

I use --allowimportmodule

like image 1
Itay Merchav Avatar answered Nov 16 '22 04:11

Itay Merchav


I was getting these errors with a .Net Core application in Visual Studio Professional 2019, I got the 16.4.4 update and applied that which in turn had a requirement to reboot the computer which of course closed and then re-opened the solution. After this, the various TS errors went away.

like image 1
Mark Schultheiss Avatar answered Nov 16 '22 04:11

Mark Schultheiss