type event = Increment | Decrement
export type transition = (. event) => unit
export createTestMachine = (. transition: transition) => {
// Return a function that calls the transition (contrived, I know)
let doTransition = (event:event) => transition(. event)
doTransition
}
Perfect!
function createTestMachine(transition) {
return function ($$event) {
return transition($$event);
};
}
Why a function that takes both the transition and the event?!?!
const $$toJS914395812: { [key: string]: any } = {"0": "Increment", "1": "Decrement"};
const $$toRE914395812: { [key: string]: any } = {"Increment": 0, "Decrement": 1};
// @ts-ignore: Implicit any on import
import * as bugBS__Es6Import from './bug.bs';
const bugBS: any = bugBS__Es6Import;
// tslint:disable-next-line:interface-over-type-literal
export type event = "Increment" | "Decrement";
// tslint:disable-next-line:interface-over-type-literal
export type transition = (_1:event) => void;
export const createTestMachine: (_1:transition, _2:event) => void = function (Arg1: any, Arg2: any) {
const result = bugBS.createTestMachine(function (Arg11: any) {
const result1 = Arg1($$toJS914395812[Arg11]);
return result1
}, $$toRE914395812[Arg2]);
return result
};