Skip to content

Conversation

@Kingwl
Copy link
Contributor

@Kingwl Kingwl commented Apr 2, 2019

Fixes #30690

"code": 1354
},
"A 'const' assertion can only be applied to a string, number, boolean, array, or object literal.": {
"A 'const' assertion can only be applied to a string, number, boolean, array, literal enum, or object literal.": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "enum member" instead of "literal enum"? I don't think most people would think of A.b as a "literal" of some kind, much as we often treat it like one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about "member of literal enum"? "enum member" is also weird and cannot explain that why some enum cannot be used

BTW: Honestly, I don't know the kind of enum before.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Paging @DanielRosenwasser for error message wording

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals.

@RyanCavanaugh RyanCavanaugh merged commit bc46c77 into microsoft:master Apr 25, 2019
@RyanCavanaugh
Copy link
Member

Thanks!

@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow const assertion to be use on enum types

4 participants