You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constenumStringEnumType{STATUS_PENDING='PENDING',STATUS_COMPLETED='COMPLETED',}functionaFunction(type: StringEnumType){/* ... */}aFunction(StringEnumType.STATUS_PENDING);// OKaFunction('PENDING');// Error: [ts] 'Argument of type '"PENDING"' is not assignable to parameter of type 'StringEnumType'.
Expected behavior:
No error or no suggestion.
Actual behavior:
TS's suggestion shows the string values of the enums, but we cannot use the string values as it is.
[ts] 'Argument of type '"PENDING"' is not assignable to parameter of type 'StringEnumType'.
The text was updated successfully, but these errors were encountered:
RyanCavanaugh
changed the title
String Enums' values are indexed, but cannot use as it is
Don't show string literals as completion options for string enums
Jun 30, 2017
Uh oh!
There was an error while loading. Please reload this page.
TypeScript Version: 2.4.1
Code
Expected behavior:
Actual behavior:
The text was updated successfully, but these errors were encountered: