Accessors are only available when targeting ECMAScript 5 and higher

前端 未结 14 1670
北荒
北荒 2020-12-23 13:07

I am trying to run this code but it is giving me following errors:

Animal.ts(10,13): error TS1056: Accessors are only available when targeting ECMAS

14条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-23 13:50

    Using Visual Stido 2017 ?
    1- Solution Explorer>Right Click To Project
    2- Add>New Item
    3- (Search section >type this> typescript)
    4- Select "TypeScript Json Configuration File"

    thats it
    at the end of this steps, tsconfig.json will be added to project with default set applied to ES5

    you don't have to change anything. just recompile your project and error gonna out.

提交回复
热议问题