Skip to content

Type definition for 'getFormNames' selector is incorrect #2937

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

Closed
TAGC opened this issue May 17, 2017 · 2 comments
Closed

Type definition for 'getFormNames' selector is incorrect #2937

TAGC opened this issue May 17, 2017 · 2 comments

Comments

@TAGC
Copy link

TAGC commented May 17, 2017

Are you submitting a bug report or a feature request?

Bug report.

What is the current behavior?

Trying to use getFormState as described in the docs results in Typescript compiler error TS2346 ("Supplied parameters do not match any signature of call target"):

const state = yield select();
const formNames: string[] = getFormNames()(state);

Suppressing these errors and running this code anyway works as expected.

What is the expected behavior?

The Typescript compiler should flag up no warnings or errors for the code presented above.

What's your environment?

  • Redux Form 6.7.0
  • Windows 7 64-bit
  • Typescript 2.3.2
  • Electron 1.6.8
    • Node: >=7.4.0
    • Chromium: >=56.0.2924.87
    • V8: >=5.6.326.50

Other information

The source of this error is this incorrect type definition at @types/redux-form/lib/selectors.d.ts:

/**
 * Gets the names of all the forms currently managed by Redux-Form.
 *
 * The reason that this is a function that returns a function is twofold:
 *   1. symmetry with the other selectors
 *   2. to allow for the getFormState parameter described at the top of this page.
 *
 * If you are using ImmutableJS, it will return a List.
 */
export const getFormNames: <State>(state: State) => string[];

This issue may relate to #2650.

@gustavohenke
Copy link
Collaborator

@types/redux-form is maintained by DefinitelyTyped, so unfortunately, there's nothing we can do at the moment.

P.S.: It would be amazing to have it maintained on our side (see #1211), because TypeScript is the most well-adopted typing variation of JS.

@lock
Copy link

lock bot commented Jun 1, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants