You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: ensure createEventDispatcher and ActionReturn work with generic function types (#8872)
fixes#8860 This contains a small but unfortunately unavoidable breaking change: If you used `never` to type that the second parameter of `createEventDispatcher` shouldn't be set or that the action accepts no parameters (which the docs recommended for a short time), then you need to change that to `null` and `undefined` respectively
dispatch('noArgument', 'surprise'); // error, cannot pass an argument
51
51
```
52
52
53
-
-`Action` and `ActionReturn` have a default parameter type of `never` now, which means you need to type the generic if you want to specify that this action receives a parameter. The migration script will migrate this automatically ([#7442](https://github.com/sveltejs/svelte/pull/7442))
53
+
-`Action` and `ActionReturn` have a default parameter type of `undefined` now, which means you need to type the generic if you want to specify that this action receives a parameter. The migration script will migrate this automatically ([#7442](https://github.com/sveltejs/svelte/pull/7442))
54
54
55
55
```diff
56
-
-const action: Action = (node, params) => { .. } // this is now an error, as params is expected to not exist
56
+
-const action: Action = (node, params) => { .. } // this is now an error if you use params in any way
57
57
+const action: Action<HTMLElement, string> = (node, params) => { .. } // params is of type string
0 commit comments