roact-spring icon indicating copy to clipboard operation
roact-spring copied to clipboard

Roact-hooked support

Open lopi-py opened this issue 2 years ago • 3 comments

Hi, I really like too much this module, I've been using it a long time but recently I've ported to rbxts. I'm very happy to use roact in tsx, and I'm using roact-hooked which is more comfortable but this module doesn't seems to work with it. If we have support for Roact17, that would be fair to have support for roact-hooked too.

lopi-py avatar Jan 03 '23 02:01 lopi-py

Seems like ts typing are too outdated, from/to only accept one value, not a table/object, setting configs throwns an error image

No overload matches this call.
  Overload 1 of 2, '(hooks: CoreHooks, props: ControllerProps, dependencies?: unknown[] | undefined): { [key: string]: Binding<AnimatableType>; }', gave the following error.
    Type '{ tension: number; friction: number; }' is not assignable to type 'AnimatableType'.
      Object literal may only specify known properties, and 'tension' does not exist in type 'UDim | UDim2 | Color3 | Vector2 | Vector3'.
  Overload 2 of 2, '(hooks: CoreHooks, props: () => ControllerProps, dependencies?: unknown[] | undefined): LuaTuple<[{ [key: string]: Binding<AnimatableType>; }, ControllerApi]>', gave the following error.
    Argument of type '{ position: UDim2; config: { tension: number; friction: number; }; }' is not assignable to parameter of type '() => ControllerProps'.
      Object literal may only specify known properties, and 'position' does not exist in type '() => ControllerProps'.ts(2769)
Controller.d.ts(5, 3): The expected type comes from this index signature.

also I'm getting this image

I need to hack it so Position={spring.position as unknown as UDim2} but that is not ideal.

Sorry for ping but any thoughts on this @chriscerie? it's unusable and I can't continue porting with animations

lopi-py avatar Jan 03 '23 02:01 lopi-py

roact-spring's typings need to be updated unfortunately. The only workaround for now is to force cast them

chriscerie avatar Jan 10 '23 22:01 chriscerie

I can live with that for now, but I really can't live without config and one prop per spring

lopi-py avatar Jan 11 '23 06:01 lopi-py