diff --git a/packages/shared/src/__tests__/__snapshots__/getTypegenOutput.test.ts.snap b/packages/shared/src/__tests__/__snapshots__/getTypegenOutput.test.ts.snap new file mode 100644 index 00000000..df8e186d --- /dev/null +++ b/packages/shared/src/__tests__/__snapshots__/getTypegenOutput.test.ts.snap @@ -0,0 +1,1165 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`getTypegenOutput action-missing 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.init": { type: "xstate.init" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: "notImplementedYet" | "anotherNotImplementedYet"; + services: never; + guards: never; + delays: never; + }; + eventsCausingActions: { + anotherNotImplementedYet: "xstate.init"; + notImplementedYet: "xstate.init"; + otherAction: "xstate.init"; + someAction: "xstate.init"; + }; + eventsCausingServices: {}; + eventsCausingGuards: {}; + eventsCausingDelays: {}; + matchesStates: undefined; + stateValues: undefined; + tags: never; +} +" +`; + +exports[`getTypegenOutput action-provided-function 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.init": { type: "xstate.init" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: never; + services: never; + guards: never; + delays: never; + }; + eventsCausingActions: { + someAction: "xstate.init"; + }; + eventsCausingServices: {}; + eventsCausingGuards: {}; + eventsCausingDelays: {}; + matchesStates: undefined; + stateValues: undefined; + tags: never; +} +" +`; + +exports[`getTypegenOutput after-numeric-like-delay 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.after(500)#(machine)": { type: "xstate.after(500)#(machine)" }; + "xstate.init": { type: "xstate.init" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: "sayHello"; + services: never; + guards: never; + delays: never; + }; + eventsCausingActions: { + sayHello: "xstate.after(500)#(machine)"; + }; + eventsCausingServices: {}; + eventsCausingGuards: {}; + eventsCausingDelays: {}; + matchesStates: undefined; + stateValues: undefined; + tags: never; +} +" +`; + +exports[`getTypegenOutput after-string-delay 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.after(myDelay)#(machine).b": { + type: "xstate.after(myDelay)#(machine).b"; + }; + "xstate.init": { type: "xstate.init" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: "someAction"; + services: never; + guards: never; + delays: "myDelay"; + }; + eventsCausingActions: { + someAction: "xstate.after(myDelay)#(machine).b"; + }; + eventsCausingServices: {}; + eventsCausingGuards: {}; + eventsCausingDelays: { + myDelay: "NEXT"; + }; + matchesStates: "a" | "b" | "c"; + stateValues: "a" | "b" | "c"; + tags: never; +} +" +`; + +exports[`getTypegenOutput choose-defined-in-implementations 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.init": { type: "xstate.init" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: never; + services: never; + guards: never; + delays: never; + }; + eventsCausingActions: { + a: "FOO"; + b: "FOO"; + c: "FOO"; + wow: "FOO"; + }; + eventsCausingServices: {}; + eventsCausingGuards: { + cond1: "FOO"; + }; + eventsCausingDelays: {}; + matchesStates: "a" | "b"; + stateValues: "a" | "b"; + tags: never; +} +" +`; + +exports[`getTypegenOutput entry-action-on-ancestor-of-targeted-descendant 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.init": { type: "xstate.init" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: "sayHello"; + services: never; + guards: never; + delays: never; + }; + eventsCausingActions: { + sayHello: "GO_STRING"; + }; + eventsCausingServices: {}; + eventsCausingGuards: {}; + eventsCausingDelays: {}; + matchesStates: "a" | "b" | "b.c" | { b?: "c" }; + stateValues: "a" | "b" | { b: "c" }; + tags: never; +} +" +`; + +exports[`getTypegenOutput entry-action-on-initial-state-of-targeted-ancestor 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.init": { type: "xstate.init" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: "sayHello"; + services: never; + guards: never; + delays: never; + }; + eventsCausingActions: { + sayHello: "GO_STRING"; + }; + eventsCausingServices: {}; + eventsCausingGuards: {}; + eventsCausingDelays: {}; + matchesStates: "a" | "b" | "b.c" | { b?: "c" }; + stateValues: "a" | "b" | { b: "c" }; + tags: never; +} +" +`; + +exports[`getTypegenOutput entry-action-on-state-between-lca-and-target 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.init": { type: "xstate.init" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: "rootEntry" | "sayHello"; + services: never; + guards: never; + delays: never; + }; + eventsCausingActions: { + rootEntry: "xstate.init"; + sayHello: "FOO"; + }; + eventsCausingServices: {}; + eventsCausingGuards: {}; + eventsCausingDelays: {}; + matchesStates: "a" | "b" | "b.b1" | { b?: "b1" }; + stateValues: "a" | "b" | { b: "b1" }; + tags: never; +} +" +`; + +exports[`getTypegenOutput entry-action-root-external-transition 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.init": { type: "xstate.init" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: "rootEntry"; + services: never; + guards: never; + delays: never; + }; + eventsCausingActions: { + rootEntry: "FOO" | "xstate.init"; + }; + eventsCausingServices: {}; + eventsCausingGuards: {}; + eventsCausingDelays: {}; + matchesStates: "a" | "b"; + stateValues: "a" | "b"; + tags: never; +} +" +`; + +exports[`getTypegenOutput entry-actions-basic 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.init": { type: "xstate.init" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: "someAction" | "otherAction"; + services: never; + guards: never; + delays: never; + }; + eventsCausingActions: { + otherAction: "BAR"; + someAction: "FOO"; + }; + eventsCausingServices: {}; + eventsCausingGuards: {}; + eventsCausingDelays: {}; + matchesStates: "a" | "b" | "c"; + stateValues: "a" | "b" | "c"; + tags: never; +} +" +`; + +exports[`getTypegenOutput entry-actions-receive-init-event 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.init": { type: "xstate.init" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: "rootEntry" | "entryA1" | "entryA"; + services: never; + guards: never; + delays: never; + }; + eventsCausingActions: { + entryA: "FOO" | "xstate.init"; + entryA1: "FOO" | "xstate.init"; + rootEntry: "FOO" | "xstate.init"; + }; + eventsCausingServices: {}; + eventsCausingGuards: {}; + eventsCausingDelays: {}; + matchesStates: "a" | "a.a1" | { a?: "a1" }; + stateValues: "a" | { a: "a1" }; + tags: never; +} +" +`; + +exports[`getTypegenOutput entry-actions-within-targeted-parallel 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.init": { type: "xstate.init" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: "sayBazinga" | "sayHello"; + services: never; + guards: never; + delays: never; + }; + eventsCausingActions: { + sayBazinga: "GO_STRING"; + sayHello: "GO_STRING"; + }; + eventsCausingServices: {}; + eventsCausingGuards: {}; + eventsCausingDelays: {}; + matchesStates: "a" | "b" | "b.c" | "b.d" | { b?: "c" | "d" }; + stateValues: "a" | "b" | { b: "c" } | { b: "d" }; + tags: never; +} +" +`; + +exports[`getTypegenOutput exit-action-external-transition-out-of-source 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.init": { type: "xstate.init" }; + "xstate.stop": { type: "xstate.stop" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: "doSomethingWithFoo"; + services: never; + guards: never; + delays: never; + }; + eventsCausingActions: { + doSomethingWithFoo: "FOO" | "xstate.stop"; + }; + eventsCausingServices: {}; + eventsCausingGuards: {}; + eventsCausingDelays: {}; + matchesStates: "a" | "b"; + stateValues: "a" | "b"; + tags: never; +} +" +`; + +exports[`getTypegenOutput exit-action-external-transition-within-source 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.init": { type: "xstate.init" }; + "xstate.stop": { type: "xstate.stop" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: "exitA"; + services: never; + guards: never; + delays: never; + }; + eventsCausingActions: { + exitA: "xstate.stop"; + }; + eventsCausingServices: {}; + eventsCausingGuards: {}; + eventsCausingDelays: {}; + matchesStates: "a" | "a.c" | "a.d" | { a?: "c" | "d" }; + stateValues: "a" | { a: "c" } | { a: "d" }; + tags: never; +} +" +`; + +exports[`getTypegenOutput exit-action-internal-transition 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.init": { type: "xstate.init" }; + "xstate.stop": { type: "xstate.stop" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: "exitA"; + services: never; + guards: never; + delays: never; + }; + eventsCausingActions: { + exitA: "xstate.stop"; + }; + eventsCausingServices: {}; + eventsCausingGuards: {}; + eventsCausingDelays: {}; + matchesStates: "a" | "a.c" | "a.d" | { a?: "c" | "d" }; + stateValues: "a" | { a: "c" } | { a: "d" }; + tags: never; +} +" +`; + +exports[`getTypegenOutput exit-action-on-ancestor-with-external-transition-on-descendant 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.init": { type: "xstate.init" }; + "xstate.stop": { type: "xstate.stop" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: "doSomethingWithFoo"; + services: never; + guards: never; + delays: never; + }; + eventsCausingActions: { + doSomethingWithFoo: "FOO" | "xstate.stop"; + }; + eventsCausingServices: {}; + eventsCausingGuards: {}; + eventsCausingDelays: {}; + matchesStates: "a" | "a.a1" | "b" | { a?: "a1" }; + stateValues: "a" | { a: "a1" } | "b"; + tags: never; +} +" +`; + +exports[`getTypegenOutput exit-action-on-state-between-lca-and-source-state 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.init": { type: "xstate.init" }; + "xstate.stop": { type: "xstate.stop" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: "rootExit" | "sayHello"; + services: never; + guards: never; + delays: never; + }; + eventsCausingActions: { + rootExit: "xstate.stop"; + sayHello: "FOO" | "xstate.stop"; + }; + eventsCausingServices: {}; + eventsCausingGuards: {}; + eventsCausingDelays: {}; + matchesStates: "a" | "a.a1" | "b" | { a?: "a1" }; + stateValues: "a" | { a: "a1" } | "b"; + tags: never; +} +" +`; + +exports[`getTypegenOutput exit-action-parallel-root-event-only-within-final-configuration 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.init": { type: "xstate.init" }; + "xstate.stop": { type: "xstate.stop" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: + | "rootExit" + | "aExit" + | "a1Exit" + | "a2Exit" + | "a3Exit" + | "bExit" + | "b1Exit" + | "b2Exit" + | "b3Exit"; + services: never; + guards: never; + delays: never; + }; + eventsCausingActions: { + a1Exit: "TICK_A1" | "xstate.stop"; + a2Exit: "TICK_A2" | "xstate.stop"; + a3Exit: "TICK_A2" | "TICK_B2" | "xstate.stop"; + aExit: "TICK_A2" | "TICK_B2" | "xstate.stop"; + b1Exit: "TICK_B1" | "xstate.stop"; + b2Exit: "TICK_B2" | "xstate.stop"; + b3Exit: "TICK_A2" | "TICK_B2" | "xstate.stop"; + bExit: "TICK_A2" | "TICK_B2" | "xstate.stop"; + rootExit: "TICK_A2" | "TICK_B2" | "xstate.stop"; + }; + eventsCausingServices: {}; + eventsCausingGuards: {}; + eventsCausingDelays: {}; + matchesStates: + | "a" + | "a.a1" + | "a.a2" + | "a.a3" + | "b" + | "b.b1" + | "b.b2" + | "b.b3" + | { a?: "a1" | "a2" | "a3"; b?: "b1" | "b2" | "b3" }; + stateValues: + | "a" + | { a: "a1" } + | { a: "a2" } + | { a: "a3" } + | "b" + | { b: "b1" } + | { b: "b2" } + | { b: "b3" }; + tags: never; +} +" +`; + +exports[`getTypegenOutput exit-action-parallel-root-with-final-states 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.init": { type: "xstate.init" }; + "xstate.stop": { type: "xstate.stop" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: "rootExit" | "aExit" | "bExit"; + services: never; + guards: never; + delays: never; + }; + eventsCausingActions: { + aExit: "TICK_A" | "TICK_B" | "xstate.stop"; + bExit: "TICK_A" | "TICK_B" | "xstate.stop"; + rootExit: "TICK_A" | "TICK_B" | "xstate.stop"; + }; + eventsCausingServices: {}; + eventsCausingGuards: {}; + eventsCausingDelays: {}; + matchesStates: + | "a" + | "a.a1" + | "a.a2" + | "b" + | "b.b1" + | "b.b2" + | { a?: "a1" | "a2"; b?: "b1" | "b2" }; + stateValues: + | "a" + | { a: "a1" } + | { a: "a2" } + | "b" + | { b: "b1" } + | { b: "b2" }; + tags: never; +} +" +`; + +exports[`getTypegenOutput exit-action-parallel-root-with-missing-final-state 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.init": { type: "xstate.init" }; + "xstate.stop": { type: "xstate.stop" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: "rootExit" | "aExit" | "bExit"; + services: never; + guards: never; + delays: never; + }; + eventsCausingActions: { + aExit: "xstate.stop"; + bExit: "xstate.stop"; + rootExit: "xstate.stop"; + }; + eventsCausingServices: {}; + eventsCausingGuards: {}; + eventsCausingDelays: {}; + matchesStates: + | "a" + | "a.a1" + | "a.a2" + | "b" + | "b.b1" + | "b.b2" + | { a?: "a1" | "a2"; b?: "b1" | "b2" }; + stateValues: + | "a" + | { a: "a1" } + | { a: "a2" } + | "b" + | { b: "b1" } + | { b: "b2" }; + tags: never; +} +" +`; + +exports[`getTypegenOutput exit-action-parallel-root-with-mixed-states 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.init": { type: "xstate.init" }; + "xstate.stop": { type: "xstate.stop" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: + | "rootExit" + | "aExit" + | "a12Exit" + | "a22Exit" + | "bExit" + | "b12Exit" + | "b22Exit" + | "cExit"; + services: never; + guards: never; + delays: never; + }; + eventsCausingActions: { + a12Exit: + | "TICK_A11" + | "TICK_A21" + | "TICK_B11" + | "TICK_B21" + | "TICK_C1" + | "xstate.stop"; + a22Exit: + | "TICK_A11" + | "TICK_A21" + | "TICK_B11" + | "TICK_B21" + | "TICK_C1" + | "xstate.stop"; + aExit: + | "TICK_A11" + | "TICK_A21" + | "TICK_B11" + | "TICK_B21" + | "TICK_C1" + | "xstate.stop"; + b12Exit: + | "TICK_A11" + | "TICK_A21" + | "TICK_B11" + | "TICK_B21" + | "TICK_C1" + | "xstate.stop"; + b22Exit: + | "TICK_A11" + | "TICK_A21" + | "TICK_B11" + | "TICK_B21" + | "TICK_C1" + | "xstate.stop"; + bExit: + | "TICK_A11" + | "TICK_A21" + | "TICK_B11" + | "TICK_B21" + | "TICK_C1" + | "xstate.stop"; + cExit: + | "TICK_A11" + | "TICK_A21" + | "TICK_B11" + | "TICK_B21" + | "TICK_C1" + | "xstate.stop"; + rootExit: + | "TICK_A11" + | "TICK_A21" + | "TICK_B11" + | "TICK_B21" + | "TICK_C1" + | "xstate.stop"; + }; + eventsCausingServices: {}; + eventsCausingGuards: {}; + eventsCausingDelays: {}; + matchesStates: + | "a" + | "a.a1" + | "a.a1.a11" + | "a.a1.a12" + | "a.a2" + | "a.a2.a21" + | "a.a2.a22" + | "b" + | "b.b1" + | "b.b1.b11" + | "b.b1.b12" + | "b.b2" + | "b.b2.b21" + | "b.b2.b22" + | "c" + | "c.c1" + | "c.c2" + | { + a?: "a1" | "a2" | { a1?: "a11" | "a12"; a2?: "a21" | "a22" }; + b?: "b1" | "b2" | { b1?: "b11" | "b12"; b2?: "b21" | "b22" }; + c?: "c1" | "c2"; + }; + stateValues: + | "a" + | { a: "a1" } + | { a: { a1: "a11" } } + | { a: { a1: "a12" } } + | { a: "a2" } + | { a: { a2: "a21" } } + | { a: { a2: "a22" } } + | "b" + | { b: "b1" } + | { b: { b1: "b11" } } + | { b: { b1: "b12" } } + | { b: "b2" } + | { b: { b2: "b21" } } + | { b: { b2: "b22" } } + | "c" + | { c: "c1" } + | { c: "c2" }; + tags: never; +} +" +`; + +exports[`getTypegenOutput exit-action-parallel-root-with-parallel-states 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.init": { type: "xstate.init" }; + "xstate.stop": { type: "xstate.stop" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: + | "rootExit" + | "aExit" + | "a1Exit" + | "a12Exit" + | "a2Exit" + | "a22Exit" + | "bExit" + | "b1Exit" + | "b12Exit" + | "b2Exit" + | "b22Exit"; + services: never; + guards: never; + delays: never; + }; + eventsCausingActions: { + a12Exit: "TICK_A11" | "TICK_A21" | "TICK_B11" | "TICK_B21" | "xstate.stop"; + a1Exit: "TICK_A11" | "TICK_A21" | "TICK_B11" | "TICK_B21" | "xstate.stop"; + a22Exit: "TICK_A11" | "TICK_A21" | "TICK_B11" | "TICK_B21" | "xstate.stop"; + a2Exit: "TICK_A11" | "TICK_A21" | "TICK_B11" | "TICK_B21" | "xstate.stop"; + aExit: "TICK_A11" | "TICK_A21" | "TICK_B11" | "TICK_B21" | "xstate.stop"; + b12Exit: "TICK_A11" | "TICK_A21" | "TICK_B11" | "TICK_B21" | "xstate.stop"; + b1Exit: "TICK_A11" | "TICK_A21" | "TICK_B11" | "TICK_B21" | "xstate.stop"; + b22Exit: "TICK_A11" | "TICK_A21" | "TICK_B11" | "TICK_B21" | "xstate.stop"; + b2Exit: "TICK_A11" | "TICK_A21" | "TICK_B11" | "TICK_B21" | "xstate.stop"; + bExit: "TICK_A11" | "TICK_A21" | "TICK_B11" | "TICK_B21" | "xstate.stop"; + rootExit: "TICK_A11" | "TICK_A21" | "TICK_B11" | "TICK_B21" | "xstate.stop"; + }; + eventsCausingServices: {}; + eventsCausingGuards: {}; + eventsCausingDelays: {}; + matchesStates: + | "a" + | "a.a1" + | "a.a1.a11" + | "a.a1.a12" + | "a.a2" + | "a.a2.a21" + | "a.a2.a22" + | "b" + | "b.b1" + | "b.b1.b11" + | "b.b1.b12" + | "b.b2" + | "b.b2.b21" + | "b.b2.b22" + | { + a?: "a1" | "a2" | { a1?: "a11" | "a12"; a2?: "a21" | "a22" }; + b?: "b1" | "b2" | { b1?: "b11" | "b12"; b2?: "b21" | "b22" }; + }; + stateValues: + | "a" + | { a: "a1" } + | { a: { a1: "a11" } } + | { a: { a1: "a12" } } + | { a: "a2" } + | { a: { a2: "a21" } } + | { a: { a2: "a22" } } + | "b" + | { b: "b1" } + | { b: { b1: "b11" } } + | { b: { b1: "b12" } } + | { b: "b2" } + | { b: { b2: "b21" } } + | { b: { b2: "b22" } }; + tags: never; +} +" +`; + +exports[`getTypegenOutput exit-action-root-external-transition 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.init": { type: "xstate.init" }; + "xstate.stop": { type: "xstate.stop" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: "rootExit"; + services: never; + guards: never; + delays: never; + }; + eventsCausingActions: { + rootExit: "FOO" | "xstate.stop"; + }; + eventsCausingServices: {}; + eventsCausingGuards: {}; + eventsCausingDelays: {}; + matchesStates: "a" | "b"; + stateValues: "a" | "b"; + tags: never; +} +" +`; + +exports[`getTypegenOutput exit-action-root-final-state 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.init": { type: "xstate.init" }; + "xstate.stop": { type: "xstate.stop" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: "rootExit" | "finalExit"; + services: never; + guards: never; + delays: never; + }; + eventsCausingActions: { + finalExit: "TICK" | "xstate.stop"; + rootExit: "TICK" | "xstate.stop"; + }; + eventsCausingServices: {}; + eventsCausingGuards: {}; + eventsCausingDelays: {}; + matchesStates: "a" | "b"; + stateValues: "a" | "b"; + tags: never; +} +" +`; + +exports[`getTypegenOutput exit-action-root-multiple-final-states 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.init": { type: "xstate.init" }; + "xstate.stop": { type: "xstate.stop" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: "rootExit" | "bExit" | "cExit" | "dExit"; + services: never; + guards: never; + delays: never; + }; + eventsCausingActions: { + bExit: "TICK_B" | "xstate.stop"; + cExit: "TICK_C" | "xstate.stop"; + dExit: "xstate.stop"; + rootExit: "TICK_B" | "TICK_C" | "xstate.stop"; + }; + eventsCausingServices: {}; + eventsCausingGuards: {}; + eventsCausingDelays: {}; + matchesStates: "a" | "b" | "c" | "d"; + stateValues: "a" | "b" | "c" | "d"; + tags: never; +} +" +`; + +exports[`getTypegenOutput exit-action-within-ancestor-with-external-transition-outside-of-source 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.init": { type: "xstate.init" }; + "xstate.stop": { type: "xstate.stop" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: "myAction"; + services: never; + guards: never; + delays: never; + }; + eventsCausingActions: { + myAction: "FOO" | "xstate.stop"; + }; + eventsCausingServices: {}; + eventsCausingGuards: {}; + eventsCausingDelays: {}; + matchesStates: "a" | "a.b" | "c" | { a?: "b" }; + stateValues: "a" | { a: "b" } | "c"; + tags: never; +} +" +`; + +exports[`getTypegenOutput exit-action-within-ancestor-with-internal-transition 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.init": { type: "xstate.init" }; + "xstate.stop": { type: "xstate.stop" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: "exitA1" | "exitA2"; + services: never; + guards: never; + delays: never; + }; + eventsCausingActions: { + exitA1: "FOO" | "xstate.stop"; + exitA2: "xstate.stop"; + }; + eventsCausingServices: {}; + eventsCausingGuards: {}; + eventsCausingDelays: {}; + matchesStates: "a" | "a.a1" | "a.a2" | { a?: "a1" | "a2" }; + stateValues: "a" | { a: "a1" } | { a: "a2" }; + tags: never; +} +" +`; + +exports[`getTypegenOutput guard-provided-function 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.init": { type: "xstate.init" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: "sayHello"; + services: never; + guards: never; + delays: never; + }; + eventsCausingActions: { + sayHello: "FOO"; + }; + eventsCausingServices: {}; + eventsCausingGuards: { + guard: "FOO"; + }; + eventsCausingDelays: {}; + matchesStates: undefined; + stateValues: undefined; + tags: never; +} +" +`; + +exports[`getTypegenOutput invoke-within-targeted-parallel 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.init": { type: "xstate.init" }; + }; + invokeSrcNameMap: { + jump: "done.invoke.(machine).b.c:invocation[0]"; + }; + missingImplementations: { + actions: never; + services: "jump"; + guards: never; + delays: never; + }; + eventsCausingActions: {}; + eventsCausingServices: { + jump: "GO_STRING"; + }; + eventsCausingGuards: {}; + eventsCausingDelays: {}; + matchesStates: "a" | "b" | "b.c" | { b?: "c" }; + stateValues: "a" | "b" | { b: "c" }; + tags: never; +} +" +`; + +exports[`getTypegenOutput parametrized-guard-in-always-transition 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "": { type: "" }; + "xstate.init": { type: "xstate.init" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: never; + services: never; + guards: "myAwesomeGuard"; + delays: never; + }; + eventsCausingActions: {}; + eventsCausingServices: {}; + eventsCausingGuards: { + myAwesomeGuard: ""; + }; + eventsCausingDelays: {}; + matchesStates: "a" | "b" | "c"; + stateValues: "a" | "b" | "c"; + tags: never; +} +" +`; + +exports[`getTypegenOutput parametrized-guard-in-transition 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.init": { type: "xstate.init" }; + }; + invokeSrcNameMap: {}; + missingImplementations: { + actions: never; + services: never; + guards: "myAwesomeGuard"; + delays: never; + }; + eventsCausingActions: {}; + eventsCausingServices: {}; + eventsCausingGuards: { + myAwesomeGuard: "MY_AWESOME_EVENT"; + }; + eventsCausingDelays: {}; + matchesStates: "a" | "b"; + stateValues: "a" | "b"; + tags: never; +} +" +`; + +exports[`getTypegenOutput service-provided-function 1`] = ` +"// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + "@@xstate/typegen": true; + internalEvents: { + "xstate.init": { type: "xstate.init" }; + }; + invokeSrcNameMap: { + service1: "done.invoke.(machine):invocation[0]"; + service2: "done.invoke.(machine):invocation[1]"; + }; + missingImplementations: { + actions: never; + services: never; + guards: never; + delays: never; + }; + eventsCausingActions: {}; + eventsCausingServices: { + service1: "xstate.init"; + service2: "xstate.init"; + }; + eventsCausingGuards: {}; + eventsCausingDelays: {}; + matchesStates: undefined; + stateValues: undefined; + tags: never; +} +" +`;