hunk.code_window:   private stopListeners: Set<Listener> = new Set();
     private doneListeners: Set<EventListener> = new Set();
     private eventListeners: Set<EventListener> = new Set();
     private sendListeners: Set<EventListener> = new Set();
     private logger: (...args: any[]) => void;
     private initialized = false;
     // Actor
     public parent?: Interpreter<any>;
     public id: string;
  
hunk.labels: keep keep keep keep keep replace keep keep keep keep
hunk.after_edit:   /**
      * Whether the service is started.
      */
     public initialized = false;
     /**
      * The initial state of the machine.
      */
     public initialState: State<TContext, TEvent>;
  
hunk.file_path: src/interpreter.ts
hunk.type: replace
file: import { assert } from 'chai';
  import { Machine } from '../src/index';
  
  function noop(_x) {
    return;
  }
  
  describe('StateSchema', () => {
    interface LightStateSchema {
      meta: {
        interval: number;
      };
      states: {
        green: {
          meta: { name: string };
        };
        yellow: {};
        red: {
          states: {
            walk: {};
            wait: {};
            stop: {};
          };
        };
      };
    }
  
    type LightEvent =
      | { type: 'TIMER' }
      | { type: 'POWER_OUTAGE' }
      | { type: 'PED_COUNTDOWN'; duration: number };
  
    interface LightContext {
      elapsed: number;
    }
  
    const lightMachine = Machine<LightContext, LightStateSchema, LightEvent>({
      key: 'light',
      initial: 'green',
      meta: { interval: 1000 },
      context: { elapsed: 0 },
      states: {
        green: {
          meta: { name: 'greenLight' },
          on: {
            TIMER: 'yellow',
            POWER_OUTAGE: 'red'
          }
        },
        yellow: {
          on: {
            TIMER: 'red',
            POWER_OUTAGE: 'red'
          }
        },
        red: {
          on: {
            TIMER: 'green',
            POWER_OUTAGE: 'red'
          },
          initial: 'walk',
          states: {
            walk: {
              on: {
                PED_COUNTDOWN: 'wait'
              }
            },
            wait: {
              on: {
                PED_COUNTDOWN: {
                  target: 'stop',
                  cond: (ctx, e: { type: 'PED_COUNTDOWN'; duration: number }) => {
                    return e.duration === 0 && ctx.elapsed > 0;
                  }
                }
              }
            },
            stop: {
              on: {
                '': { target: 'green' }
              }
            }
          }
        }
      }
    });
  
    noop(lightMachine);
  
    it('should work with a StateSchema defined', () => {
      assert.ok(true, 'Tests will not compile if types are wrong');
    });
  });
  