diff --git a/.changeset/smooth-ravens-exist.md b/.changeset/smooth-ravens-exist.md deleted file mode 100644 index 63a22168a6..0000000000 --- a/.changeset/smooth-ravens-exist.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'xstate': patch ---- - -Exported `RequiredActorOptionsKeys` type meant to be used by integration packages like `@xstate/react` diff --git a/.changeset/smooth-ravens-vanish.md b/.changeset/smooth-ravens-vanish.md deleted file mode 100644 index 3532b07388..0000000000 --- a/.changeset/smooth-ravens-vanish.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -'@xstate/svelte': patch -'@xstate/react': patch -'@xstate/solid': patch -'@xstate/vue': patch ---- - -Updated types of `useActor`, `useMachine`, and `useActorRef` to require `input` when defined inside `types/input`. - -Previously even when `input` was defined inside `types`, `useActor`, `useMachine`, and `useActorRef` would **not** make the input required: - -```tsx -const machine = setup({ - types: { - input: {} as { value: number } - } -}).createMachine({}); - -function App() { - // Event if `input` is not defined, `useMachine` works at compile time, but risks crashing at runtime - const _ = useMachine(machine); - return <>; -} -``` - -With this change the above code will show a type error, since `input` is now required: - -```tsx -const machine = setup({ - types: { - input: {} as { value: number } - } -}).createMachine({}); - -function App() { - const _ = useMachine(machine, { - input: { value: 1 } // Now input is required at compile time! - }); - return <>; -} -``` - -This avoids runtime errors when forgetting to pass `input` when defined inside `types`. diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index 5d3d612d54..663ffc77cf 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -1,5 +1,11 @@ # xstate +## 5.18.1 + +### Patch Changes + +- [#5055](https://github.com/statelyai/xstate/pull/5055) [`ad38c35c37`](https://github.com/statelyai/xstate/commit/ad38c35c377d4ec5c97710fda12512abbe5f7140) Thanks [@SandroMaglione](https://github.com/SandroMaglione)! - Exported `RequiredActorOptionsKeys` type meant to be used by integration packages like `@xstate/react` + ## 5.18.0 ### Minor Changes diff --git a/packages/core/package.json b/packages/core/package.json index fbeb3ec7cc..f147029a76 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "xstate", - "version": "5.18.0", + "version": "5.18.1", "description": "Finite State Machines and Statecharts for the Modern Web.", "main": "dist/xstate.cjs.js", "module": "dist/xstate.esm.js", diff --git a/packages/xstate-graph/package.json b/packages/xstate-graph/package.json index 0f898001c2..fe46c23bb6 100644 --- a/packages/xstate-graph/package.json +++ b/packages/xstate-graph/package.json @@ -40,10 +40,10 @@ "url": "https://github.com/statelyai/xstate/issues" }, "peerDependencies": { - "xstate": "^5.18.0" + "xstate": "^5.18.1" }, "devDependencies": { - "xstate": "5.18.0" + "xstate": "5.18.1" }, "dependencies": {} } diff --git a/packages/xstate-immer/package.json b/packages/xstate-immer/package.json index faed20ce2f..8359d0e4cd 100644 --- a/packages/xstate-immer/package.json +++ b/packages/xstate-immer/package.json @@ -41,10 +41,10 @@ "dependencies": {}, "peerDependencies": { "immer": "^9.0.6 || ^10", - "xstate": "^5.18.0" + "xstate": "^5.18.1" }, "devDependencies": { "immer": "^10.0.2", - "xstate": "5.18.0" + "xstate": "5.18.1" } } diff --git a/packages/xstate-inspect/package.json b/packages/xstate-inspect/package.json index 375fbbde13..7ad627bd02 100644 --- a/packages/xstate-inspect/package.json +++ b/packages/xstate-inspect/package.json @@ -53,12 +53,12 @@ "devDependencies": { "@types/ws": "^8.2.2", "ws": "^8.4.0", - "xstate": "5.18.0" + "xstate": "5.18.1" }, "peerDependencies": { "@types/ws": "^8.0.0", "ws": "^8.0.0", - "xstate": "^5.18.0" + "xstate": "^5.18.1" }, "peerDependenciesMeta": { "@types/ws": { diff --git a/packages/xstate-react/CHANGELOG.md b/packages/xstate-react/CHANGELOG.md index 5b6b864871..904f5ee06b 100644 --- a/packages/xstate-react/CHANGELOG.md +++ b/packages/xstate-react/CHANGELOG.md @@ -1,5 +1,46 @@ # Changelog +## 4.1.2 + +### Patch Changes + +- [#5055](https://github.com/statelyai/xstate/pull/5055) [`ad38c35c37`](https://github.com/statelyai/xstate/commit/ad38c35c377d4ec5c97710fda12512abbe5f7140) Thanks [@SandroMaglione](https://github.com/SandroMaglione)! - Updated types of `useActor`, `useMachine`, and `useActorRef` to require `input` when defined inside `types/input`. + + Previously even when `input` was defined inside `types`, `useActor`, `useMachine`, and `useActorRef` would **not** make the input required: + + ```tsx + const machine = setup({ + types: { + input: {} as { value: number } + } + }).createMachine({}); + + function App() { + // Event if `input` is not defined, `useMachine` works at compile time, but risks crashing at runtime + const _ = useMachine(machine); + return <>; + } + ``` + + With this change the above code will show a type error, since `input` is now required: + + ```tsx + const machine = setup({ + types: { + input: {} as { value: number } + } + }).createMachine({}); + + function App() { + const _ = useMachine(machine, { + input: { value: 1 } // Now input is required at compile time! + }); + return <>; + } + ``` + + This avoids runtime errors when forgetting to pass `input` when defined inside `types`. + ## 4.1.1 ### Patch Changes diff --git a/packages/xstate-react/package.json b/packages/xstate-react/package.json index c26144d5bd..84d8998040 100644 --- a/packages/xstate-react/package.json +++ b/packages/xstate-react/package.json @@ -1,6 +1,6 @@ { "name": "@xstate/react", - "version": "4.1.1", + "version": "4.1.2", "description": "XState tools for React", "keywords": [ "state", @@ -55,7 +55,7 @@ }, "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0", - "xstate": "^5.18.0" + "xstate": "^5.18.1" }, "peerDependenciesMeta": { "xstate": { @@ -74,6 +74,6 @@ "react": "^18.0.0", "react-dom": "^18.0.0", "rxjs": "^7.8.0", - "xstate": "5.18.0" + "xstate": "5.18.1" } } diff --git a/packages/xstate-solid/CHANGELOG.md b/packages/xstate-solid/CHANGELOG.md index 2b403ff7ec..ff943ea092 100644 --- a/packages/xstate-solid/CHANGELOG.md +++ b/packages/xstate-solid/CHANGELOG.md @@ -1,5 +1,46 @@ # @xstate/solid +## 0.2.1 + +### Patch Changes + +- [#5055](https://github.com/statelyai/xstate/pull/5055) [`ad38c35c37`](https://github.com/statelyai/xstate/commit/ad38c35c377d4ec5c97710fda12512abbe5f7140) Thanks [@SandroMaglione](https://github.com/SandroMaglione)! - Updated types of `useActor`, `useMachine`, and `useActorRef` to require `input` when defined inside `types/input`. + + Previously even when `input` was defined inside `types`, `useActor`, `useMachine`, and `useActorRef` would **not** make the input required: + + ```tsx + const machine = setup({ + types: { + input: {} as { value: number } + } + }).createMachine({}); + + function App() { + // Event if `input` is not defined, `useMachine` works at compile time, but risks crashing at runtime + const _ = useMachine(machine); + return <>; + } + ``` + + With this change the above code will show a type error, since `input` is now required: + + ```tsx + const machine = setup({ + types: { + input: {} as { value: number } + } + }).createMachine({}); + + function App() { + const _ = useMachine(machine, { + input: { value: 1 } // Now input is required at compile time! + }); + return <>; + } + ``` + + This avoids runtime errors when forgetting to pass `input` when defined inside `types`. + ## 0.2.0 ### Minor Changes diff --git a/packages/xstate-solid/package.json b/packages/xstate-solid/package.json index 3f8e53c2d7..e46539fccd 100644 --- a/packages/xstate-solid/package.json +++ b/packages/xstate-solid/package.json @@ -1,6 +1,6 @@ { "name": "@xstate/solid", - "version": "0.2.0", + "version": "0.2.1", "description": "XState tools for SolidJS", "keywords": [ "state", @@ -43,7 +43,7 @@ }, "peerDependencies": { "solid-js": "^1.6.0", - "xstate": "^5.18.0" + "xstate": "^5.18.1" }, "peerDependenciesMeta": { "xstate": { @@ -53,6 +53,6 @@ "devDependencies": { "solid-js": "^1.7.6", "solid-testing-library": "^0.3.0", - "xstate": "5.18.0" + "xstate": "5.18.1" } } diff --git a/packages/xstate-svelte/CHANGELOG.md b/packages/xstate-svelte/CHANGELOG.md index c71c181563..d7f20f2600 100644 --- a/packages/xstate-svelte/CHANGELOG.md +++ b/packages/xstate-svelte/CHANGELOG.md @@ -1,5 +1,46 @@ # @xstate/svelte +## 3.0.4 + +### Patch Changes + +- [#5055](https://github.com/statelyai/xstate/pull/5055) [`ad38c35c37`](https://github.com/statelyai/xstate/commit/ad38c35c377d4ec5c97710fda12512abbe5f7140) Thanks [@SandroMaglione](https://github.com/SandroMaglione)! - Updated types of `useActor`, `useMachine`, and `useActorRef` to require `input` when defined inside `types/input`. + + Previously even when `input` was defined inside `types`, `useActor`, `useMachine`, and `useActorRef` would **not** make the input required: + + ```tsx + const machine = setup({ + types: { + input: {} as { value: number } + } + }).createMachine({}); + + function App() { + // Event if `input` is not defined, `useMachine` works at compile time, but risks crashing at runtime + const _ = useMachine(machine); + return <>; + } + ``` + + With this change the above code will show a type error, since `input` is now required: + + ```tsx + const machine = setup({ + types: { + input: {} as { value: number } + } + }).createMachine({}); + + function App() { + const _ = useMachine(machine, { + input: { value: 1 } // Now input is required at compile time! + }); + return <>; + } + ``` + + This avoids runtime errors when forgetting to pass `input` when defined inside `types`. + ## 3.0.3 ### Patch Changes diff --git a/packages/xstate-svelte/package.json b/packages/xstate-svelte/package.json index 1570e01da4..75b14ff815 100644 --- a/packages/xstate-svelte/package.json +++ b/packages/xstate-svelte/package.json @@ -1,6 +1,6 @@ { "name": "@xstate/svelte", - "version": "3.0.3", + "version": "3.0.4", "description": "XState tools for Svelte", "keywords": [ "state", @@ -45,7 +45,7 @@ }, "peerDependencies": { "svelte": "^3.24.1 || ^4", - "xstate": "^5.18.0" + "xstate": "^5.18.1" }, "peerDependenciesMeta": { "xstate": { @@ -58,6 +58,6 @@ "svelte": "^3.55.1", "svelte-check": "^3.2.0", "svelte-preprocess": "^5.0.0", - "xstate": "5.18.0" + "xstate": "5.18.1" } } diff --git a/packages/xstate-vue/CHANGELOG.md b/packages/xstate-vue/CHANGELOG.md index 7ffb20e1c9..723813a0b8 100644 --- a/packages/xstate-vue/CHANGELOG.md +++ b/packages/xstate-vue/CHANGELOG.md @@ -1,5 +1,46 @@ # @xstate/vue +## 3.1.3 + +### Patch Changes + +- [#5055](https://github.com/statelyai/xstate/pull/5055) [`ad38c35c37`](https://github.com/statelyai/xstate/commit/ad38c35c377d4ec5c97710fda12512abbe5f7140) Thanks [@SandroMaglione](https://github.com/SandroMaglione)! - Updated types of `useActor`, `useMachine`, and `useActorRef` to require `input` when defined inside `types/input`. + + Previously even when `input` was defined inside `types`, `useActor`, `useMachine`, and `useActorRef` would **not** make the input required: + + ```tsx + const machine = setup({ + types: { + input: {} as { value: number } + } + }).createMachine({}); + + function App() { + // Event if `input` is not defined, `useMachine` works at compile time, but risks crashing at runtime + const _ = useMachine(machine); + return <>; + } + ``` + + With this change the above code will show a type error, since `input` is now required: + + ```tsx + const machine = setup({ + types: { + input: {} as { value: number } + } + }).createMachine({}); + + function App() { + const _ = useMachine(machine, { + input: { value: 1 } // Now input is required at compile time! + }); + return <>; + } + ``` + + This avoids runtime errors when forgetting to pass `input` when defined inside `types`. + ## 3.1.2 ### Patch Changes diff --git a/packages/xstate-vue/package.json b/packages/xstate-vue/package.json index 8c9f224ceb..c38efbc411 100644 --- a/packages/xstate-vue/package.json +++ b/packages/xstate-vue/package.json @@ -1,6 +1,6 @@ { "name": "@xstate/vue", - "version": "3.1.2", + "version": "3.1.3", "description": "XState tools for Vue", "keywords": [ "state", @@ -54,7 +54,7 @@ }, "peerDependencies": { "vue": "^3.0.0", - "xstate": "^5.18.0" + "xstate": "^5.18.1" }, "peerDependenciesMeta": { "xstate": { @@ -65,6 +65,6 @@ "@testing-library/vue": "^6.6.1", "@vue/compiler-sfc": "^3.0.11", "vue": "^3.0.11", - "xstate": "5.18.0" + "xstate": "5.18.1" } }