Skip to content

fix(typings): add a result type to StepPromise, fix grab return types - #5808

Open
danielrentz wants to merge 2 commits into
codeceptjs:4.xfrom
danielrentz:fix/typings-step-promise-grabs
Open

danielrentz wants to merge 2 commits into
codeceptjs:4.xfrom
danielrentz:fix/typings-step-promise-grabs

Conversation

@danielrentz

Copy link
Copy Markdown
Contributor

Motivation/Description of the PR

npm run def and npm run dtslint pass. Without the type parameter, the new tsd tests fail.

Applicable helpers:

  • Playwright
  • Puppeteer
  • WebDriver
  • REST
  • FileHelper
  • Appium

Applicable plugins:

  • aiTrace
  • autoDelay
  • autoLogin
  • customLocator
  • pause
  • coverage
  • heal
  • retryFailedStep
  • screenshot
  • selenoid
  • stepTimeout
  • subtitles

Type of change

  • 🔥 Breaking changes
  • 🚀 New functionality
  • 🐛 Bug fix
  • 🧹 Chore
  • 📋 Documentation changes/updates
  • ♨️ Hot fix
  • 🔨 Markdown files fix - not related to source code
  • 💅 Polish code

Checklist:

  • Tests have been added
  • Documentation has been added (Run npm run docs)
  • Lint checking (Run npm run lint)
  • Local tests are passed (Run npm test)

StepPromise and ElementStepPromise extended Promise<any>, so a helper
step that returns data could not be declared with its result type, and
declaration merging cannot add a type parameter. The default keeps every
existing CodeceptJS.StepPromise as it is.

Refs codeceptjs#5806
The JSDoc of several grab methods declared void, any, a plain array or
StepPromise, so awaiting them failed type-aware linting and a missing
await went unnoticed. WebDriver's grabBrowserLogs() always returns an
array, like the other helpers.

Refs codeceptjs#5806

This branch has not been deployed

No deployments
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.

Typings: StepPromise has no result type, and several grab methods have wrong return types

1 participant