Skip to content

Conversation

@tldrRD
Copy link

@tldrRD tldrRD commented May 9, 2018

I don't have much experience with TS, haven't had the chance to test the annotations, let me know if there's something that doesn't work.

@tldrRD
Copy link
Author

tldrRD commented May 9, 2018

I can't understand why the travis checks have failed. I've modified only index.d.ts, and after reading the logs it didn't seem that it's a problem with my changes but with some dependencies of react-spring.

@drcmda
Copy link
Member

drcmda commented May 9, 2018

@NulledGravity not sure what's travises problem, but it's not your fault. I get the same error, though the local build seems to be fine. Is your PR complete?

@tldrRD
Copy link
Author

tldrRD commented May 9, 2018

@drcmda I've added the types following https://github.com/drcmda/react-spring/blob/master/API.md. I'm relatively new in TS and haven't had the chance to test if all the types are correct. I'd like to get some advice/help on how to complete the annotations.

Also I still need to comment all the types.

Any help welcome :)

@drcmda
Copy link
Member

drcmda commented May 10, 2018

Great! Could you make a last check and see if it corresponds to the actual proptypes in the js files? API.md could be slightly outdated since there were some changes recently, for instance to the way config and immediate work, they can be functions now that return individual results. If you think the PR is done i'll merge - i myself have zero knowledge sadly when it comes to TS.

*/
items?: Array<TransitionItemProps> | TransitionItemProps;

children?: (
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Transition also accepts false as a valid value for the child (in case you are tracking a single child that you do not wish to render), so this should be

+    children?: ((
+      params: DS & S,
+    ) => ReactNode | Array<(params: DS & S) => ReactNode>) | false;

see: https://codesandbox.io/embed/j150ykxrv


export class Transition<
S extends object,
DS extends object,
Copy link

@jariz jariz May 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm getting TS1009 no trailing commas allowed on the latest version of TS, could you please remove them?

@drcmda
Copy link
Member

drcmda commented Jun 5, 2018

@jariz so, you're saying it should go in in this shape?

@jariz
Copy link

jariz commented Jun 5, 2018

@drcmda yep. only spotted this because I was using it in my exact usecase, but def gonna need some tests at some point down the road to double check if they're all correct.

@drcmda drcmda merged commit 202b2ea into pmndrs:master Jun 6, 2018
szjemljanoj pushed a commit to szjemljanoj/react-spring that referenced this pull request Mar 29, 2019
First try at adding missing type annotations.
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

Successfully merging this pull request may close these issues.

4 participants