Skip to content

Commit

Permalink
multiple generic types in one interface
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredmtterminus committed Dec 13, 2024
1 parent 9a80e3f commit 204c067
Show file tree
Hide file tree
Showing 5 changed files with 724 additions and 15 deletions.
22 changes: 19 additions & 3 deletions fixtures/genericinterface/genericinterface.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,36 @@ package genericinterface

//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate

type CustomType any
type CustomTypeT any
type CustomTypeU any

//counterfeiter:generate . GenericInterface[T CustomType]
type GenericInterface[T CustomType] interface {
type GenericInterface[T CustomTypeT] interface {
ReturnT() T
TakeT(T)
TakeAndReturnT(T) T
DoSomething()
}

//counterfeiter:generate . GenericInterface2
type GenericInterface2[T CustomType] interface {
type GenericInterface2[T CustomTypeT] interface {
ReturnT() T
TakeT(T)
TakeAndReturnT(T) T
DoSomething()
}

//counterfeiter:generate . GenericInterfaceMultipleTypes
type GenericInterfaceMultipleTypes[T CustomTypeT, U CustomTypeU] interface {
ReturnT() T
ReturnU() U
ReturnTAndU() (T, U)
TakeT(T)
TakeU(U)
TakeTAndU(T, U)
TakeAndReturnT(T) T
TakeAndReturnU(U) U
TakeAndReturnTAndU(T, U) (T, U)
TakeTAndReturnU(T) U
DoSomething()
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 204c067

Please sign in to comment.