Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Roact-hooked support #37

Open
lopi-py opened this issue Jan 3, 2023 · 3 comments
Open

Roact-hooked support #37

lopi-py opened this issue Jan 3, 2023 · 3 comments

Comments

@lopi-py
Copy link
Contributor

lopi-py commented Jan 3, 2023

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
Copy link
Contributor Author

lopi-py commented Jan 3, 2023

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

@chriscerie
Copy link
Owner

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

@lopi-py
Copy link
Contributor Author

lopi-py commented Jan 11, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants