When a function needs a generic type as its return value, it can be written like this:

const Foo = <T>(a: T) => a

Of course, the same thing can be done in .tsx files but the syntax has to be slightly different. Since <T> could be interpreted as a JSX tag, the example above will cause a syntax error like JSX element 'T' has no corresponding closing tag.ts(17008).

A trailing comma helps to avoid this ambiguity and make it clear as a list of generic types in TSX files.

const Foo = <T,>(a: T) => a // not <T> but <T,>

See Also