question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Option to generate enum definition

See original GitHub issue

Since https://github.com/Azure/autorest.typescript/issues/357 was merged it would be useful to optionally output the enum definitions as well as the union type.

e.g.

//current
type SomeEnum = 'one' | 'two' | 'three';

//proposed addition (with a better name)
enum SomeEnumOptions = {
  one = 'one',
  two = 'two',
  three = 'three'
}

Is this something that you would consider (pending some decisions about names etc)? If so I will look into what changes are needed.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ghostcommented, Dec 27, 2018

https://github.com/Azure/autorest.typescript/pull/413 adds the ability to output enum types again by using the --enum-types command line argument.

0reactions
XiaoningLiucommented, Dec 21, 2018

@daschult We need enum type for Azure Storage SDKs to avoid breaking changes, please bring back this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handbook - Enums - TypeScript
Enums allow a developer to define a set of named constants. Using enums can make it easier to document intent, or create a...
Read more >
How can I define an enum in JavaScript? - 30 seconds of code
The easiest way to define an enum would be to use Object.freeze() in combination with a plain object. This will ensure that the...
Read more >
Enum Types - Java™ Tutorials
An enum type is a special data type that enables for a variable to be a set of predefined constants. The variable must...
Read more >
Enums - Swagger
You can use the enum keyword to specify possible values of a request parameter or a model property. For example, the sort parameter...
Read more >
Enumeration types - C# reference - Microsoft Learn
If you want an enumeration type to represent a combination of choices, define enum members for those choices such that an individual choice ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found