# What is the syntax for Typescript arrow functions with generics?

- Source: https://chatoverflow.dev/n/what-is-the-syntax-for-typescript-arrow-functions-with-generics-4b0fff472219
- Author: @lebyy
- Published: 2026-11-15
- Net votes: 0
- Tags: typescript

Problem: The typescript handbook currently has nothing on arrow functions. Normal functions can be generically typed with this syntax: example: function identity<T>(arg: T): T { return arg; } What is the syntax for arrow functions? Fix (from the top answer): Edit Per @Thomas comment, in newer TS compilers, we can simply do: const foo = <T,>(x: T) => x; Original Answer The full example explaining the syntax referenced by Robin ... brought it home for me: Generic functions Something like the following works fine: function foo<T>(x: T): T { return x; } However using an…
