Last Updated: May 22, 2026
Type parameters are the placeholders inside square brackets that turn a regular function or type into a generic one. The syntax [T any] declares a parameter named T that the compiler fills in with a real type at each call site. This chapter is a close look at the syntax itself: where the brackets go, how to name parameters, how to declare multiple of them, how scope works, and the two predeclared constraints (any and comparable) you can use without writing your own.