“Declaration or statement expected” Error in Angular2 (or TypeScript)

前端 未结 2 1125
悲&欢浪女
悲&欢浪女 2020-12-20 15:42

I\'m completely new to Angular2 and TypeScript. I\'m following Tutorial but I keep coping this error. Is it an error caused by the compiler or something?

2条回答
  •  被撕碎了的回忆
    2020-12-20 16:23

    Since you didn't accept the answer, I assume you are on OSx?

    I had 2 instances of TS installed on my machine, I needed to point to the correct/newer one. Try this:

    In Webstorm goto Preferences (Command + ,) -> Languages -> Typescript.

    Command Line Options:

    -m amd -t ES5

    Compiler Versions:

    /usr/local/lib/node_modules/typescript/lib

    This way it will grab your global typescript instead of the one Webstorm may have set to default for you.

提交回复
热议问题