react-move icon indicating copy to clipboard operation
react-move copied to clipboard

NodeGroup Add generic type from incoming data

Open FranzFlueckiger opened this issue 4 years ago • 2 comments

This PR allows typescript users to directly have the type of the incoming data array inferred in all the following functions: keyAccessor, start, enter, update and leave. If this PR is accepted, nothing will change from the user's perspective except that they will enjoy code completion where they might expect it to be.

FranzFlueckiger avatar Mar 27 '21 21:03 FranzFlueckiger

Good point 👍 Keep thinking I'm just going to re-write this in TS. I think you need to make it optional, right? So not all TS users need to provide a type?

Like...

type SomeType<T = void> = OtherType<T>;

https://garbagevalue.com/blog/optional-generic-typescript

sghall avatar Jun 13 '21 06:06 sghall

Hi Steve, sorry for the late response. You're right that the generic should be optional so that this change is non-breaking for the users.

FranzFlueckiger avatar Jun 30 '21 05:06 FranzFlueckiger