Skip to content

Wrong typing for "grabCookie": should return "object" instead of "string" #3908

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
ngraf opened this issue Oct 6, 2023 · 0 comments · Fixed by #3919
Closed

Wrong typing for "grabCookie": should return "object" instead of "string" #3908

ngraf opened this issue Oct 6, 2023 · 0 comments · Fixed by #3919

Comments

@ngraf
Copy link
Contributor

ngraf commented Oct 6, 2023

What are you trying to achieve?

Use I.grabCookie as intended by documentation:
https://codecept.io/helpers/Playwright/#grabcookie
await I.grabCookie('myCookie').value

What do you get instead?

TypeScript Error Property 'value' does not exist on type 'string'.

Details

  • CodeceptJS version: 3.5.5
  • NodeJS Version: 20.6.1
  • Operating System: MacOS
  • Playwright 1.38.1

I think this should be fairly easy to fix by changing return type in https://github.com/codeceptjs/CodeceptJS/blame/e0ac568f04a2b8aa4b1f0b0da2ef1f2a58a5fa7c/typings/tests/helpers/Playwright.types.ts#L98.
My current workaround is putting // @ts-ignore above it to surpress the false error.

@kobenguyent kobenguyent linked a pull request Oct 10, 2023 that will close this issue
5 tasks
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 a pull request may close this issue.

1 participant