How to use generics with arrow functions in Typescript/JSX with React?
问题 Using Typescript, typing in Visual Studio, into a ".ts" file, consider the following declaration: export const foo = <T>(myObject: T) => myObject.toString(); This works fine, type checking is fine, everything is great. Now place that exact same code into a ".tsx" file that is being used for JSX and React. Intellisense gets very upset and complains, because it is trying to make the <T> into a React JSX element. But my intention is to have the compiler treat it as a generic type designator. The