Skip to content

Conversation

@tobikris
Copy link

We want to generate schema definitions for a type using generics.

Combining multiple parts by embedding is not working in this case though:

embedded field type cannot be a (pointer to a) type parameter (MisplacedTypeParam)

type CommonConfig struct {
	ServiceName string
}

type CombinedConfig[C any] struct {
	CommonConfig // this works
	C            // this does not
}

type CustomConfig struct {
	Foo string
}

This merge method achieves the same goal and seemed to be helpful in more than just our case.

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