Skip to content

Commit 7c5ae24

Browse files
committed
refactor(web-host): hoist type ReplHistoryEntry in types
1 parent a3038ed commit 7c5ae24

3 files changed

Lines changed: 17 additions & 12 deletions

File tree

packages/web-host/src/components/ReplHistory.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ReplHistoryEntry } from "../hooks/replLogic";
1+
import type { ReplHistoryEntry } from "../types";
22
import { cn } from "../utils/css";
33

44
interface ReplHistoryProps extends React.HTMLAttributes<HTMLDivElement> {

packages/web-host/src/hooks/replLogic.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,10 @@
11
import { setReplVar } from "repl:api/host-state";
22
import { useMemo, useReducer, useState } from "react";
3-
import type { ReplStatus } from "../types";
3+
import type { ReplHistoryEntry, ReplStatus } from "../types";
44
import type { WasmEngine } from "./wasm";
55

66
const MAX_HISTORY_LENGTH = 50;
77

8-
export type ReplHistoryEntry =
9-
| {
10-
stdout?: string;
11-
stderr?: string;
12-
status: ReplStatus;
13-
}
14-
| {
15-
stdin: string;
16-
};
17-
188
function setExitStatusAnd$0(status: ReplStatus, stdout?: string) {
199
if (status === "success") {
2010
setReplVar({ key: "?", value: "0" });
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
1+
// wasm
2+
13
import type * as HostApiNamespace from "./generated/host-api";
4+
import type { ReplStatus } from "./generated/interfaces/repl-api-transport";
25
import type * as PluginApiNamespace from "./generated/plugin-api";
36

47
export * from "./generated/interfaces/repl-api-transport";
58

69
export type HostApi = typeof HostApiNamespace;
710
export type PluginApi = typeof PluginApiNamespace;
11+
12+
// ui
13+
14+
export type ReplHistoryEntry =
15+
| {
16+
stdout?: string;
17+
stderr?: string;
18+
status: ReplStatus;
19+
}
20+
| {
21+
stdin: string;
22+
};

0 commit comments

Comments
 (0)