Skip to content

feat: 'NotNullMaps' to handle generic arguments #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bindings/walk/walk.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func Walk(v Visitor, node bindings.Node) {
Walk(v, n.Type)
Walk(v, n.Initializer)
case *bindings.ReferenceType:
// noop
walkList(v, n.Arguments)
case *bindings.LiteralKeyword:
// noop
case *bindings.LiteralType:
Expand Down
2 changes: 2 additions & 0 deletions convert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ func TestGeneration(t *testing.T) {
muts := strings.Split(strings.TrimSpace(string(mutsCSV)), ",")
for _, m := range muts {
switch m {
case "NotNullMaps":
mutations = append(mutations, config.NotNullMaps)
case "EnumAsTypes":
mutations = append(mutations, config.EnumAsTypes)
case "EnumLists":
Expand Down
1 change: 1 addition & 0 deletions testdata/notnullmap/mutations
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NotNullMaps
10 changes: 10 additions & 0 deletions testdata/notnullmap/notnullmap.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package notnullmap

type Foo struct {
Bar map[string]bool
Nested GenericFoo[map[string]int]
}

type GenericFoo[T any] struct {
Bar T
}
12 changes: 12 additions & 0 deletions testdata/notnullmap/notnullmap.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Code generated by 'guts'. DO NOT EDIT.

// From notnullmap/notnullmap.go
interface Foo {
Bar: Record<string, boolean>;
Nested: GenericFoo<Record<string, number>>;
}

// From notnullmap/notnullmap.go
interface GenericFoo<T extends any> {
Bar: T;
}