Targeting ES5 with TypeScript in Visual Studio

后端 未结 5 956
名媛妹妹
名媛妹妹 2020-12-06 04:31

I would like to use get/set syntax in TypeScript within Visual Studio Express for Web. How do I enable this. I currently get this error when compiling;

5条回答
  •  死守一世寂寞
    2020-12-06 04:47

    The switch for instructing the TSC.EXE to generate ES5 compatible code is --target ES5 (note the double dashes).

    Each project has a file called [Something].csproj (C# project in our case). Open that file using notepad and look for Target xml element. Change the exec command by adding the --target ES5.

    Before:

     
    

    After:

    
    

提交回复
热议问题