Package Usage: go: golang.org/x/exp/typeparams
Package typeparams contains common utilities for writing tools that interact
with generic Go code, as introduced with Go 1.18.
Many of the types and functions in this package are proxies for the new APIs
introduced in the standard library with Go 1.18. For example, the
typeparams.Union type is an alias for go/types.Union, and the ForTypeSpec
function returns the value of the go/ast.TypeSpec.TypeParams field. At Go
versions older than 1.18 these helpers are implemented as stubs, allowing
users of this package to write code that handles generic constructs inline,
even if the Go version being used to compile does not support generics.
Additionally, this package contains common utilities for working with the
new generic constructs, to supplement the standard library APIs. Notably,
the NormalTerms API computes a minimal representation of the structural
restrictions on a type parameter. In the future, these supplemental APIs may
be available in the standard library..
108 versions
Latest release: over 1 year ago
1,445 dependent packages
View more package details: https://packages.ecosystem.code.gouv.fr/registries/proxy.golang.org/packages/golang.org/x/exp/typeparams