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

Typescript definition files don't support alternate array argument. #136

Closed
threehams opened this issue Jun 17, 2016 · 7 comments
Closed
Assignees
Milestone

Comments

@threehams
Copy link
Collaborator

This is valid, and used several times in the README, but is not currently supported by definition files:

createSelector(
  [
    (state) => state.get('stuff'),
  ],
  (stuff) => {

  }
)
@mdocter
Copy link

mdocter commented Jun 23, 2016

+1

@threehams threehams self-assigned this Jun 23, 2016
@threehams
Copy link
Collaborator Author

This is turning out to be very difficult, and may not be possible. I'll keep looking at it. One approach involves doubling the size of the declaration files (taking the same approach as the current files).

@ellbee
Copy link
Collaborator

ellbee commented Jun 28, 2016

Oh, you know what, I think I was already aware of this, sorry! 😳

#27

If it is impossible, maybe we should add something to the docs encouraging people to use the variadic version for type checkers.

@threehams
Copy link
Collaborator Author

Got it. Today I learned about tuples.

    function createSelector<
        TInput, TProps, TOutput,
        T1,
        T2
    >(
        selectors: [
            Selector<TInput, TProps, T1>,
            Selector<TInput, TProps, T2>
        ],
        combiner: (
            arg1: T1,
            arg2: T2
        ) => TOutput
    ): Selector<TInput, TProps, TOutput>;

It's verbose, but both versions can be supported. I'll test and pull request soon.

@ellbee
Copy link
Collaborator

ellbee commented Jun 28, 2016

Hey, well done! Sounds good.

@threehams
Copy link
Collaborator Author

#143

@ellbee
Copy link
Collaborator

ellbee commented Jul 3, 2016

Going to close this as the conversation has moved to #143

@ellbee ellbee closed this as completed Jul 3, 2016
@ellbee ellbee added this to the v3.0.0 milestone Jul 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants