JamieMason / eslint-plugin-prefer-arrow-functions

Auto-fix plain Functions into Arrow Functions, in all cases where conversion would result in the same behaviour
https://www.npmjs.com/package/eslint-plugin-prefer-arrow-functions
MIT License
43 stars 11 forks source link

Fix loses generic #10

Closed OliverJAsh closed 2 years ago

OliverJAsh commented 3 years ago

Description

Given

function identity<T>(t: T): T { return t; }

when we run the fix we get this:

const identity = (t: T) => t;

I expected to get this:

const identity = <T>(t: T) => t;

Suggested Solution

Help Needed

JamieMason commented 3 years ago

Thanks @OliverJAsh, I've not been doing a lot of OSS lately but I will get to this.

JamieMason commented 2 years ago

Released in 3.1.3, I've only added your examples above as test cases so let me know if you run into any problems.