supertype_ expands_ to_ type_ parameter
A type alias that expands to a type parameter can't be implemented.
A type alias that expands to a type parameter can't be mixed in.
A type alias that expands to a type parameter can't be used as a superclass constraint.
A type alias that expands to a type parameter can't be used as a superclass.
Description
#
The analyzer produces this diagnostic when a type alias that expands to a
type parameter is used in an
extends
,
implements
,
with
, or
on
clause.
Example
#
The following code produces this diagnostic because the type alias
T
,
which expands to the type parameter
S
, is used in the
extends
clause of
the class
C
:
typedef T<S> = S;
class C extends T<Object> {}
Common fixes
#Use the value of the type argument directly:
typedef T<S> = S;
class C extends Object {}
Unless stated otherwise, the documentation on this site reflects Dart 3.9.2. Page last updated on 2025-9-4. View source or report an issue.