Get in touch

Send an email to:
Or find me online at: Github, X

Generic arrow functions in TSX

When creating generic arrow functions inside a .tsx file, a comma needs to be added to the type argument <T,> or have it extend something <T extends {}>. Without this the compiler will try to parse <T> as JSX tag and give an error.

const func = <T,>(x: T) => x
// or
const func = <T extends {}>(x: T) => x