0
State pattern example of typescript
Hi, there is lack of code in State pattern example of typescript.
https://refactoring.guru/ja/design-patterns/state/typescript/example
This code needs "state.setContext()" in constructor of Context class maybe.
Like this,
class Context { /** * @type {State} A reference to the current state of the Context. */ private state: State; constructor(state: State) { this.transitionTo(state); this.state.setContext(this); // add setContext() for state } ...
Please check this example.
Thank you.
Servicio de atención al cliente por UserEcho