Skip to content

Commit

Permalink
feat: Support to use enum as key of dictionary (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rudomitori authored Oct 4, 2023
1 parent 12f3d18 commit 8101036
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,11 @@ function postProcessClientContent(
/Types\.\{ \[key: ((string)|(number))]: /g,
'{ [key: $1]: Types.',
)
// For the case when an enum is used as keys of a dictionary
.replaceAll(
/Types\.\{ \[key in keyof typeof ([a-zA-Z0-9_]*?)]\?: /g,
'{ [key in keyof typeof Types.$1]: Types.',
)
.replaceAll('parseDateOnly(', 'Types.parseDateOnly(')
.replaceAll('Types.{', '{')
.replaceAll(/Types.string(?![a-zA-Z0-9_])/g, 'string')
Expand Down

0 comments on commit 8101036

Please sign in to comment.