bynk.generics.generic_non_record
Error A type declaration carries type parameters on a refined, opaque or alias body; only a record (type Name[T] = { … }) or sum (type Name[T] = | … | …) body may be generic (v0.157/#593, ADRs 0183/0197).
Type parameters are for a type whose shape can mention them: a record, { value: T }, or a sum whose variants carry payloads. A refined, opaque or alias type has a fixed base, so a parameter would have nowhere to go. Give the type a record or sum body that uses its parameters, or drop the parameters.
Example
type Wrapped[T] = Int // ✗ `T` has nowhere to be used
type Wrapped[T] = { value: T } // ✓ a record may be genericIn the Book
See also
- The grammar rule it governs:
type_decl. - Every code in its category, Generics, on the diagnostic index.
bynk explain bynk.generics.generic_non_recordshows the same from the installed toolchain, without a network.