Skip to content

Commit 8ee8c8f

Browse files
authored
fix(example): use import type for ActivityComponentType to avoid runtime errors (#603)
1 parent 5358e83 commit 8ee8c8f

File tree

10 files changed

+25
-24
lines changed

10 files changed

+25
-24
lines changed

โ€Ždocs/pages/docs/advanced/preloading.en.mdxโ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export type TypeActivities = typeof activities;
5555
Afterwards, within each activity, you can retrieve the `preloadRef` value using the `useActivityPreloadRef()` hook.
5656

5757
```tsx showLineNumbers filename="MyActivity.ts" copy
58-
import { ActivityComponentType } from "@stackflow/react";
58+
import type { ActivityComponentType } from "@stackflow/react";
5959
import { useActivityPreloadRef } from "@stackflow/plugin-preload";
6060

6161
const MyActivity: ActivityComponentType = () => {
@@ -82,7 +82,7 @@ export const { usePreloader } = createPreloader<TypeActivities>();
8282
```
8383

8484
```tsx showLineNumbers filename="MyActivity.ts" copy
85-
import { ActivityComponentType } from "@stackflow/react";
85+
import type { ActivityComponentType } from "@stackflow/react";
8686
import { usePreloader } from "./usePreloader";
8787

8888
const MyActivity: = () => {

โ€Ždocs/pages/docs/advanced/preloading.ko.mdxโ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export type TypeActivities = typeof activities;
5555
์ดํ›„ ๊ฐ ์•กํ‹ฐ๋น„ํ‹ฐ ๋‚ด์—์„œ `useActivityPreloadRef()` ํ›…์„ ํ†ตํ•ด ํ•ด๋‹น `preloadRef` ๊ฐ’์„ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ์–ด์š”.
5656

5757
```tsx showLineNumbers filename="MyActivity.ts" copy
58-
import { ActivityComponentType } from "@stackflow/react";
58+
import type { ActivityComponentType } from "@stackflow/react";
5959
import { useActivityPreloadRef } from "@stackflow/plugin-preload";
6060

6161
const MyActivity: ActivityComponentType = () => {
@@ -82,7 +82,7 @@ export const { usePreloader } = createPreloader<TypeActivities>();
8282
```
8383

8484
```tsx showLineNumbers filename="MyActivity.ts" copy
85-
import { ActivityComponentType } from "@stackflow/react";
85+
import type { ActivityComponentType } from "@stackflow/react";
8686
import { usePreloader } from "./usePreloader";
8787

8888
const MyActivity: = () => {

โ€Ždocs/pages/docs/get-started/activity.en.mdxโ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { APITable } from "../../../components/APITable";
2121
To actually use an activity, you need to register it with the `stackflow()` function before using it. An activity is a React component declared with the type `ActivityComponentType`.
2222

2323
```tsx showLineNumbers filename="MyActivity.tsx" copy
24-
import { ActivityComponentType } from "@stackflow/react";
24+
import type { ActivityComponentType } from "@stackflow/react";
2525
import { AppScreen } from "@stackflow/plugin-basic-ui";
2626

2727
const MyActivity: ActivityComponentType = () => {
@@ -101,7 +101,7 @@ If you have successfully registered the initial activity, you can see the render
101101
Some activities require specific parameters when used. In such cases, declare the parameter as the activity's Props.
102102

103103
```tsx showLineNumbers filename="Article.tsx" copy
104-
import { ActivityComponentType } from "@stackflow/react";
104+
import type { ActivityComponentType } from "@stackflow/react";
105105
import { AppScreen } from "@stackflow/plugin-basic-ui";
106106

107107
type ArticleParams = {

โ€Ždocs/pages/docs/get-started/activity.ko.mdxโ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { APITable } from "../../../components/APITable";
2121
์•กํ‹ฐ๋น„ํ‹ฐ๋ฅผ ์‹ค์ œ๋กœ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ์‚ฌ์šฉํ•˜๊ธฐ ์ „ `stackflow()` ํ•จ์ˆ˜์— ๋“ฑ๋ก์ด ํ•„์š”ํ•ด์š”. ์•กํ‹ฐ๋น„ํ‹ฐ๋Š” `ActivityComponentType`์ด๋ผ๋Š” ํƒ€์ž…์œผ๋กœ ์„ ์–ธ๋˜๋Š” ๋ฆฌ์•กํŠธ ์ปดํฌ๋„ŒํŠธ์—์š”.
2222

2323
```tsx showLineNumbers filename="MyActivity.tsx" copy
24-
import { ActivityComponentType } from "@stackflow/react";
24+
import type { ActivityComponentType } from "@stackflow/react";
2525
import { AppScreen } from "@stackflow/plugin-basic-ui";
2626

2727
const MyActivity: ActivityComponentType = () => {
@@ -105,7 +105,7 @@ export const { Stack, useFlow } = stackflow({
105105
ํ•ด๋‹น ์•กํ‹ฐ๋น„ํ‹ฐ๊ฐ€ ์‚ฌ์šฉ๋  ๋•Œ, ํŠน์ • ํŒŒ๋ผ๋ฏธํ„ฐ๊ฐ€ ํ•„์š”ํ•œ ๊ฒฝ์šฐ๊ฐ€ ์žˆ์–ด์š”. ์ด๋Ÿฐ ๊ฒฝ์šฐ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์•กํ‹ฐ๋น„ํ‹ฐ์˜ Props๋กœ ํ•ด๋‹น ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ์„ ์–ธํ•ด์š”.
106106

107107
```tsx showLineNumbers filename="Article.tsx" copy
108-
import { ActivityComponentType } from "@stackflow/react";
108+
import type { ActivityComponentType } from "@stackflow/react";
109109
import { AppScreen } from "@stackflow/plugin-basic-ui";
110110

111111
type ArticleParams = {

โ€Ždocs/pages/docs/get-started/getting-state.en.mdxโ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The activities accessible through the `activities` field contain information rel
1818
To access the stack state in a UI component, use the `useStack()` hook.
1919

2020
```tsx showLineNumbers filename="MyActivity.tsx" copy
21-
import { ActivityComponentType, useStack } from "@stackflow/react";
21+
import { useStack, type ActivityComponentType } from "@stackflow/react";
2222
import { AppScreen } from "@stackflow/plugin-basic-ui";
2323
import { useFlow } from "./stackflow";
2424

@@ -69,7 +69,7 @@ There are the following fields in the stack state.
6969
You can use the `useActivity()` hook to get information about the current activity.
7070

7171
```tsx showLineNumbers filename="MyActivity.tsx" copy
72-
import { ActivityComponentType, useActivity } from "@stackflow/react";
72+
import { useActivity, type ActivityComponentType } from "@stackflow/react";
7373
import { AppScreen } from "@stackflow/plugin-basic-ui";
7474
import { useFlow } from "./stackflow";
7575

โ€Ždocs/pages/docs/get-started/getting-state.ko.mdxโ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { APITable } from "../../../components/APITable";
1818
์Šคํƒ ์ƒํƒœ๋ฅผ UI ์ปดํฌ๋„ŒํŠธ์—์„œ ๊ฐ€์ ธ์˜ค๋ ค๋ฉด, `useStack()` ํ›…์„ ํ™œ์šฉํ•ด์š”.
1919

2020
```tsx showLineNumbers filename="MyActivity.tsx" copy
21-
import { ActivityComponentType, useStack } from "@stackflow/react";
21+
import { useStack, type ActivityComponentType } from "@stackflow/react";
2222
import { AppScreen } from "@stackflow/plugin-basic-ui";
2323
import { useFlow } from "./stackflow";
2424

@@ -69,7 +69,7 @@ export default MyActivity;
6969
ํ˜„์žฌ ์•กํ‹ฐ๋น„ํ‹ฐ์˜ ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜ค๊ธฐ ์œ„ํ•ด `useActivity()` ํ›…์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์–ด์š”.
7070

7171
```tsx showLineNumbers filename="MyActivity.tsx" copy
72-
import { ActivityComponentType, useActivity } from "@stackflow/react";
72+
import { useActivity, type ActivityComponentType } from "@stackflow/react";
7373
import { AppScreen } from "@stackflow/plugin-basic-ui";
7474
import { useFlow } from "./stackflow";
7575

โ€Ždocs/pages/docs/get-started/navigating-activities.en.mdxโ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ If you have successfully registered an activity, it's time to navigate between a
1414
We use the `useFlow()` hook created in `stackflow.ts`. Through the `push()` function within this hook, we can stack a new activity as follows.
1515

1616
```tsx showLineNumbers filename="MyActivity.tsx" copy /push/
17-
import { ActivityComponentType } from "@stackflow/react";
17+
import type { ActivityComponentType } from "@stackflow/react";
1818
import { AppScreen } from "@stackflow/plugin-basic-ui";
1919
import { useFlow } from "./stackflow";
2020

@@ -76,7 +76,7 @@ The third parameter of the `push()` function, additional options, includes the f
7676
Next, let's look at how to replace the current activity without adding a new activity to the stack. Using the `replace()` function from the `useFlow()` hook created in `stackflow.ts`, you can replace the current activity as follows.
7777

7878
```tsx showLineNumbers filename="MyActivity.tsx" copy /replace/
79-
import { ActivityComponentType } from "@stackflow/react";
79+
import type { ActivityComponentType } from "@stackflow/react";
8080
import { AppScreen } from "@stackflow/plugin-basic-ui";
8181
import { useFlow } from "./stackflow";
8282

@@ -134,7 +134,7 @@ The third parameter of the `replace()` function, additional options, includes th
134134
Finally, let's look at how to delete the current activity and return to the previous activity. Using the `pop()` function from the `useFlow()` hook created in `stackflow.ts`, you can delete the current activity as follows.
135135

136136
```tsx showLineNumbers filename="Article.tsx" copy /pop/
137-
import { ActivityComponentType } from "@stackflow/react";
137+
import type { ActivityComponentType } from "@stackflow/react";
138138
import { AppScreen } from "@stackflow/plugin-basic-ui";
139139
import { useFlow } from "./stackflow";
140140

โ€Ždocs/pages/docs/get-started/navigating-activities.ko.mdxโ€Ž

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { APITable } from "../../../components/APITable";
1414
`stackflow.ts`์—์„œ ์ƒ์„ฑํ–ˆ๋˜ `useFlow()` ํ›…์„ ์‚ฌ์šฉํ•ด์š”. ํ•ด๋‹น ํ›… ๋‚ด์— `push()` ํ•จ์ˆ˜๋ฅผ ํ†ตํ•ด ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ƒˆ ์•กํ‹ฐ๋น„ํ‹ฐ๋ฅผ ์Œ“์„ ์ˆ˜ ์žˆ์–ด์š”.
1515

1616
```tsx filename="MyActivity.tsx" copy
17-
import { ActivityComponentType } from "@stackflow/react";
17+
import type { ActivityComponentType } from "@stackflow/react";
1818
import { AppScreen } from "@stackflow/plugin-basic-ui";
1919
import { useFlow } from "./stackflow";
2020

@@ -78,7 +78,7 @@ push(
7878
๋‹ค์Œ์œผ๋กœ ์Šคํƒ์— ์ƒˆ๋กœ์šด ์•กํ‹ฐ๋น„ํ‹ฐ๋ฅผ ์ถ”๊ฐ€ํ•˜์ง€ ์•Š๊ณ  ํ˜„์žฌ ์•กํ‹ฐ๋น„ํ‹ฐ๋ฅผ ๊ต์ฒดํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด์„œ ์‚ดํŽด๋ด์š”. `stackflow.ts`์—์„œ ์ƒ์„ฑํ–ˆ๋˜ `useFlow()` ํ›…์˜ `replace()` ํ•จ์ˆ˜๋ฅผ ํ†ตํ•ด ๋‹ค์Œ๊ณผ ๊ฐ™์ด ํ˜„์žฌ ์•กํ‹ฐ๋น„ํ‹ฐ๋ฅผ ๊ต์ฒดํ•  ์ˆ˜ ์žˆ์–ด์š”.
7979

8080
```tsx filename="MyActivity.tsx" copy
81-
import { ActivityComponentType } from "@stackflow/react";
81+
import type { ActivityComponentType } from "@stackflow/react";
8282
import { AppScreen } from "@stackflow/plugin-basic-ui";
8383
import { useFlow } from "./stackflow";
8484

@@ -135,8 +135,9 @@ replace(
135135

136136
๋งˆ์ง€๋ง‰์œผ๋กœ ํ˜„์žฌ ์•กํ‹ฐ๋น„ํ‹ฐ๋ฅผ ์‚ญ์ œํ•˜๊ณ  ์ด์ „ ์•กํ‹ฐ๋น„ํ‹ฐ๋กœ ๋Œ์•„๊ฐ€๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด์„œ ์‚ดํŽด๋ด์š”. `stackflow.ts`์—์„œ ์ƒ์„ฑํ–ˆ๋˜ `useFlow()` ํ›…์˜ `pop()` ํ•จ์ˆ˜๋ฅผ ํ†ตํ•ด ๋‹ค์Œ๊ณผ ๊ฐ™์ด ํ˜„์žฌ ์•กํ‹ฐ๋น„ํ‹ฐ๋ฅผ ์‚ญ์ œํ•  ์ˆ˜ ์žˆ์–ด์š”.
137137

138+
138139
```tsx showLineNumbers filename="Article.tsx" copy /pop/
139-
import { ActivityComponentType } from "@stackflow/react";
140+
import type { ActivityComponentType } from "@stackflow/react";
140141
import { AppScreen } from "@stackflow/plugin-basic-ui";
141142
import { useFlow } from "./stackflow";
142143

โ€Ždocs/pages/docs/get-started/navigating-step.en.mdxโ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ You can use steps when you want to have a virtual stack state within a single ac
2020
Use the `useStepFlow()` hook created in `stackflow.ts`. Through the `stepPush()` function within this hook, you can stack a new step as follows.
2121

2222
```tsx showLineNumbers filename="Article.tsx" copy /stepPush/
23-
import { ActivityComponentType } from "@stackflow/react";
23+
import type { ActivityComponentType } from "@stackflow/react";
2424
import { AppScreen } from "@stackflow/plugin-basic-ui";
2525
import { useStepFlow } from "./stackflow";
2626

@@ -57,7 +57,7 @@ export default Article;
5757
You can replace the current step using the `stepReplace()` function in `useStepFlow()`.
5858

5959
```tsx showLineNumbers filename="Article.tsx" copy /stepReplace/
60-
import { ActivityComponentType } from "@stackflow/react";
60+
import type { ActivityComponentType } from "@stackflow/react";
6161
import { AppScreen } from "@stackflow/plugin-basic-ui";
6262
import { useStepFlow } from "./stackflow";
6363

@@ -93,7 +93,7 @@ export default Article;
9393
You can delete the current step using the `stepPop()` function in `useStepFlow()`.
9494

9595
```tsx showLineNumbers filename="Article.tsx" copy /stepPop/
96-
import { ActivityComponentType } from "@stackflow/react";
96+
import type { ActivityComponentType } from "@stackflow/react";
9797
import { AppScreen } from "@stackflow/plugin-basic-ui";
9898
import { useStepFlow } from "./stackflow";
9999

โ€Ždocs/pages/docs/get-started/navigating-step.ko.mdxโ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { Callout, Link } from "nextra-theme-docs";
2222
`stackflow.ts`์—์„œ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ๋Š” `useStepFlow()` ํ›…์„ ์‚ฌ์šฉํ•ด์š”. ํ•ด๋‹น ํ›… ๋‚ด์— `stepPush()` ํ•จ์ˆ˜๋ฅผ ํ†ตํ•ด ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ƒˆ ์Šคํ…์„ ์Œ“์„ ์ˆ˜ ์žˆ์–ด์š”.
2323

2424
```tsx showLineNumbers filename="Article.tsx" copy /stepPush/
25-
import { ActivityComponentType } from "@stackflow/react";
25+
import type { ActivityComponentType } from "@stackflow/react";
2626
import { AppScreen } from "@stackflow/plugin-basic-ui";
2727
import { useStepFlow } from "./stackflow";
2828

@@ -59,7 +59,7 @@ export default Article;
5959
`useStepFlow()`์˜ `stepReplace()` ํ•จ์ˆ˜๋ฅผ ํ™œ์šฉํ•˜๋ฉด ํ˜„์žฌ ์Šคํ…์„ ๊ต์ฒดํ•  ์ˆ˜ ์žˆ์–ด์š”.
6060

6161
```tsx showLineNumbers filename="Article.tsx" copy /stepReplace/
62-
import { ActivityComponentType } from "@stackflow/react";
62+
import type { ActivityComponentType } from "@stackflow/react";
6363
import { AppScreen } from "@stackflow/plugin-basic-ui";
6464
import { useStepFlow } from "./stackflow";
6565

@@ -95,7 +95,7 @@ export default Article;
9595
`useStepFlow()`์˜ `stepPop()` ํ•จ์ˆ˜๋ฅผ ํ™œ์šฉํ•˜๋ฉด ํ˜„์žฌ ์Šคํ…์„ ์‚ญ์ œํ•  ์ˆ˜ ์žˆ์–ด์š”.
9696

9797
```tsx showLineNumbers filename="Article.tsx" copy /stepPop/
98-
import { ActivityComponentType } from "@stackflow/react";
98+
import type { ActivityComponentType } from "@stackflow/react";
9999
import { AppScreen } from "@stackflow/plugin-basic-ui";
100100
import { useStepFlow } from "./stackflow";
101101

0 commit comments

Comments
ย (0)