TypeScript error TS1005: ';' expected (II)

后端 未结 9 1024
旧巷少年郎
旧巷少年郎 2020-12-09 02:11

First of all, I\'ve already seen the other posts about error TS1005. Same error code, but totally different.

A simple let x: number; will gener

相关标签:
9条回答
  • 2020-12-09 02:53

    I was injecting service like this:

    private messageShowService MessageShowService
    

    instead of:

    private messageShowService: MessageShowService
    

    and that was the reason of error, despite nothing related with ',' was there.

    0 讨论(0)
  • 2020-12-09 02:54

    You haven't the last version of typescript.

    Running :

    npm install -g typescript
    

    npm checks if tsc command is already installed.

    And it might be, by another software like Visual Studio. If so, npm doesn't override it. So you have to remove the previous deprecated tsc installed command.

    Run where tsc to know its bin location. It should be in C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\ in windows. Once found, delete the folder, and re-run npm install -g typescript. This should now install the last version of typescript.

    0 讨论(0)
  • 2020-12-09 02:55

    On Windows you can have in your PATH

    PATH = ...;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\; ...
    

    remove it from PATH env, then

    npm install -g typescript@latest
    

    it worked for me to solve the

    "TypeScript error TS1005: ';' expected"

    See also how to update TypeScript to latest version with npm?

    0 讨论(0)
提交回复
热议问题