Skip to content

Commit 27246ad

Browse files
authored
fix(react): infer BaseActivities from given activities (#463)
1 parent b393a6c commit 27246ad

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@stackflow/react": patch
3+
---
4+
5+
fix(react): infer `BaseActivities` from given activities

integrations/react/src/stackflow.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ type StackflowPluginsEntry<T extends BaseActivities> =
4646
| StackflowReactPlugin<T>
4747
| StackflowPluginsEntry<T>[];
4848

49+
type NoInfer<T> = [T][T extends any ? 0 : never];
50+
4951
export type StackflowOptions<T extends BaseActivities> = {
5052
/**
5153
* Register activities used in your app
@@ -61,12 +63,12 @@ export type StackflowOptions<T extends BaseActivities> = {
6163
* Set the first activity to load at the bottom
6264
* (It can be overwritten by plugin)
6365
*/
64-
initialActivity?: () => Extract<keyof T, string>;
66+
initialActivity?: () => Extract<keyof NoInfer<T>, string>;
6567

6668
/**
6769
* Inject stackflow plugins
6870
*/
69-
plugins?: Array<StackflowPluginsEntry<T>>;
71+
plugins?: Array<StackflowPluginsEntry<NoInfer<T>>>;
7072
};
7173

7274
export type StackflowOutput<T extends BaseActivities> = {

0 commit comments

Comments
 (0)