Skip to content

Added the correct this context to StepOption 'when' functions#995

Merged
RobbieTheWagner merged 1 commit intoshipshapecode:masterfrom
WORMSS:patch-1
Jun 3, 2020
Merged

Added the correct this context to StepOption 'when' functions#995
RobbieTheWagner merged 1 commit intoshipshapecode:masterfrom
WORMSS:patch-1

Conversation

@WORMSS
Copy link
Copy Markdown
Contributor

@WORMSS WORMSS commented Jun 3, 2020

Update step.d.ts
With accordance to

this.on(event, when[event], this);
the "this" context is set to the Step

@WORMSS WORMSS changed the title Added the correct this context to StepOption when functions Added the correct this context to StepOption 'when' functions Jun 3, 2020
@RobbieTheWagner
Copy link
Copy Markdown
Member

@WORMSS I do not know TypeScript very well, but should we also indicate that the this is the step here?

action?: (() => void);

@RobbieTheWagner RobbieTheWagner merged commit bec705e into shipshapecode:master Jun 3, 2020
@WORMSS WORMSS deleted the patch-1 branch June 3, 2020 14:41
@WORMSS
Copy link
Copy Markdown
Contributor Author

WORMSS commented Jun 3, 2020

Ahh, I was unaware of actions. As the code was not in the JS but in the svelte and I had never used svelte before.
If I am reading this correctly, would it be the tour rather than Step?

action = config.action ? config.action.bind(step.tour) : null;

Which would make the Typescript

- action?: (() => void);
+ action?: ((this: Tour) => void);

@RobbieTheWagner
Copy link
Copy Markdown
Member

@WORMSS yeah, that is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants