You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for raising @MilanJimi, I can reproduce this and will fix.
In the meantime as a workaround, you can specify the type of this by prepending it to the function's arguments, e.g.:
import{Then,World}from'@cucumber/cucumber';Then('the test runs with string parameter {string}',asyncfunction(this: World,parameter: string){this.driver.close()})
I'm surprised this worked this in step definitions was ever auto-typed as World. @davidjgoss do you know how this was supported before / what changed that broke it?
@charlierudolph no I don’t think it ever worked since our refactor to TypeScript. The second screenshot above is from v6 with (presumably) the types from DefinitelyTyped, which did type this as World - which was just an alias for an object with arbitrary props.
Node v12.19.0, TypeScript v4.2.4, @cucumber/cucumber v7.2.1, Ubuntu v20.04
I can no longer use
World
in my tests, becausethis
is no longer typed inside theGiven/When/Then
functions, instead defaulting to being typed asany
.If I downgrade to version

cucumber v7.0.0-rc.0
,this
is properly typed asWorld
.The text was updated successfully, but these errors were encountered: