TypeScript's string enums - “Type … is not assignable to type …”

后端 未结 9 2048
不思量自难忘°
不思量自难忘° 2020-12-10 23:45

I have recently upgraded the version of TypeScript from 2.3.4 to 2.4.0 hoping to use the string enums. To my dismay, however, I have been greeted with the error messages:

9条回答
  •  既然无缘
    2020-12-11 00:33

    Inspired by Duncan's answer, I found the root cause. Although the application was using TypeScript 2.4, VS's IntelliSense was still stuck in 2.3.

    The way to resolve the issue was to download and install TypeScript 2.4 SDK and then select from the options the newer version:

提交回复
热议问题