VSCode `allowedValues` Output string literal Union type - Asking for enum
- Dominant language
- C#
- Stars
- 46
- Forks
- 63
- Avg merge
- 8d 4h
- Merged PRs (30d)
- 1
Description
**Is your feature request related to a problem? Please describe.**
The current VSCode `allowedValues` outputs a string literal union type in Typescript:
```typescript
export type LambdaRuntime = 'dotnetcore2.1' | 'nodejs12.x'
```
The other implementations for Kotlin and C# output an enum type. The Typescript code standard in PR's keep asking for Enums as the preferred implementation, so we are converting the String literal Union types output from this package to hardcoded Enums... This process seems backwards.
**Describe the solution you'd like**
I would like the Typescript `allowedValues` to ouput an Enum type
```typescript
export enum LambdaRuntime{
Dotnetcore21 = 'dotnetcore2.1',
Nodejs12x = 'nodejs12.x'
}
```
**Describe alternatives you've considered**
I have not
**Additional context**
Kotlin output for enum
```kotlin
/**
* The lambda runtime
*/
public enum class LambdaRuntime(
private val `value`: String,
) {
Dotnetcore21("dotnetcore2.1"),
Nodejs12x("nodejs12.x"),
Unknown("unknown"),
;
public override fun toString(): String = value
public companion object {
public fun from(type: String): LambdaRuntime = values().firstOrNull { it.value == type }
?: Unknown
}
}
```
All code snippets referenced from test files `generatorOutput.ts` and `testGeneratorOutput` for Kotlin and Typescript within this package.
Contributor guide
Research direction
Start with the referenced generatorOutput.ts and testGeneratorOutput files for the Kotlin and Typescript generators, then trace how allowedValues is rendered for Typescript. Update the generated output and its tests so allowedValues produces an enum consistent with the requested examples, including valid member names for the string values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, kotlin, typescript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100