Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support nameof(Enum) or equivalent #6470

Closed
kamranayub opened this issue Jan 13, 2016 · 2 comments
Closed

Support nameof(Enum) or equivalent #6470

kamranayub opened this issue Jan 13, 2016 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@kamranayub
Copy link

I understand to get the string name of an Enum I can do:

MyModule.MyEnum[MyModule.MyEnum.Foo]

However it would be neat/more concise to support something like C#'s nameof operator:

nameof(MyModule.MyEnum.Foo)

Which would output the longer version for runtime. The only benefits of this really are less typing and less verbose (annoying with long namespaces). And if TS supported nameof on parameters, it would be a bonus.

@RyanCavanaugh
Copy link
Member

How is this different from #1579?

@kamranayub
Copy link
Author

Looks like that is a full proposal of nameof. I suppose this would be a smaller implementation scoped to enums only, which seems a lot easier to get out the door than a full nameof proposal. I also didn't find that issue since it was Closed. Also, there was no mention of Enum types in that issue.

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Jan 13, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants