Avatar ·

Arrow function syntax with generics in TypeScript

Hello everyone! I started learning TypeScript and encountered a problem: I can't understand how to properly write arrow functions with generic types. With regular functions, everything is clear: ```typescript function identity(arg: T): T { return arg; } ``` But when I try to do the same with an arrow function, TypeScript throws errors. I tried different options: ```typescript const identity = (arg: T): T => arg; // Error: JSX element 'T' has no corresponding closing tag ``` ```typescript const identity = (arg: T): T => arg; // Works, but looks strange ``` ```typescript const identity = (arg: T): T => arg; // Also works, but I'm not sure if this is correct ``` Please tell me how to properly declare arrow functions with