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

Strongly typing the invoke function #4022

Open
Floydjd opened this issue Apr 24, 2019 · 1 comment

Comments

3 participants
@Floydjd
Copy link

commented Apr 24, 2019

Current behavior:

invoke function is not strongly typed.

Desired behavior:

invoke function is strongly typed.

TypeScript has a ReturnType type that you can use

invoke<K extends keyof Subject>(functionName: K, ...args: any[]): Chainable<ReturnType<Subject[K]>>
@flotwig

This comment has been minimized.

Copy link
Member

commented Apr 24, 2019

Hey, thanks for pointing this out!

The types definition file that needs to be updated is here: https://github.com/cypress-io/cypress/blob/develop/cli/types/index.d.ts

If you'd like to, you can open a pull request with the changes that you think are necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.