Skip to content

Fix dictionaries with enums as keys - #233

Merged
PerfectlyNormal merged 3 commits into
mainfrom
fix/enum-dictionary-keys
Aug 23, 2026
Merged

Fix dictionaries with enums as keys#233
PerfectlyNormal merged 3 commits into
mainfrom
fix/enum-dictionary-keys

Conversation

@PerfectlyNormal

Copy link
Copy Markdown
Owner

Not too uncommon to have a

public class ResponseDto
{
    public Dictionary<State, int> Counts { get; set; }
}

which got translated to the non-functional

import { number } from '...';

export interface ResponseDto {
  counts: { [key: State]: number };
}

this handles converting enums to number, so we get

// no import needed

export interface ResponseDto {
  counts: { [key: number]: number };
}

which is more what we would expect

@PerfectlyNormal
PerfectlyNormal merged commit 5fc5f51 into main Aug 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant