Skip to content

Commit

Permalink
Updated xsm snippet for TypeScript machines
Browse files Browse the repository at this point in the history
  • Loading branch information
mellson committed Aug 11, 2022
1 parent d47d882 commit 82b6c7c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/flat-socks-tie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"stately-vscode": patch
---

Updated `xsm` snippet for TypeScript machines to make it easier to type context and events.
2 changes: 1 addition & 1 deletion apps/extension/client/snippets/xstate.code-snippets
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"prefix": "xsm",
"body": [
"import { createMachine } from 'xstate';",
"const ${1:nameOf}Machine = createMachine({\n\tid: '${1:nameOf}',\n\ttsTypes: {},\n\tschema: {\n\t\tcontext: {} as { value: string },\n\t\tevents: {} as { type: 'FOO' },\n\t},\n\tcontext: {\n\t\tvalue: '',\n\t},\n\tinitial: '${2:initialState}',\n\tstates: {\n\t\t${2:initialState}: {$0},\n\t},\n});"
"const ${1:nameOf}Machine = createMachine({\n\tid: '${1:nameOf}',\n\ttsTypes: {},\n\tschema: {\n\t\tcontext: {} as { ${2:contextType} },\n\t\tevents: {} as { type: '${3:eventType}' },\n\t},\n\tcontext: {\n\t\t${4:initialContextValue},\n\t},\n\tinitial: '${5:initialState}',\n\tstates: {\n\t\t${5:initialState}: {},\n\t},\n});$0"
],
"description": "Outline for XState Typegen Machine"
}
Expand Down

0 comments on commit 82b6c7c

Please sign in to comment.