Skip to content

Commit

Permalink
alph generated param order (#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
lekko-jonathan authored Apr 30, 2024
1 parent ae30cbb commit b921a65
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/gen/ts.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,18 @@ export function {{$.FuncName}}({{$.Parameters}}): {{$.RetType}} {
if len(parameters) == 0 && len(usedVariables) > 0 {
var keys []string
var keyAndTypes []string
for k, t := range usedVariables {
var sortedKeys []string
for k := range usedVariables {
sortedKeys = append(sortedKeys, k)
}
sort.Strings(sortedKeys)
for _, k := range sortedKeys {
t := usedVariables[k]
casedK := strcase.ToLowerCamel(k)
keys = append(keys, casedK)
keyAndTypes = append(keyAndTypes, fmt.Sprintf("%s: %s", casedK, t))
}

parameters = fmt.Sprintf("{%s}: {%s}", strings.Join(keys, ","), strings.Join(keyAndTypes, ","))
}
data := struct {
Expand Down

0 comments on commit b921a65

Please sign in to comment.