Skip to content

Commit 0971f8e

Browse files
committed
Mark as readonly
1 parent 208fd80 commit 0971f8e

2 files changed

Lines changed: 24 additions & 12 deletions

File tree

packages/core/src/actions/registerActionSink.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
import { type Action } from 'redux';
2-
import { custom, function_, literal, object, safeParse, type InferOutput } from 'valibot';
2+
import { custom, function_, literal, object, pipe, readonly, safeParse, type InferOutput } from 'valibot';
33

44
const REGISTER_ACTION_SINK = 'WEB_CHAT_INTERNAL/REGISTER_ACTION_SINK' as const;
55

6-
const registerActionSinkActionSchema = object({
7-
payload: object({
8-
sink: custom<(action: Action) => void>(value => safeParse(function_(), value).success)
6+
const registerActionSinkActionSchema = pipe(
7+
object({
8+
payload: pipe(
9+
object({
10+
sink: custom<(action: Action) => void>(value => safeParse(function_(), value).success)
11+
}),
12+
readonly()
13+
),
14+
type: literal(REGISTER_ACTION_SINK)
915
}),
10-
type: literal(REGISTER_ACTION_SINK)
11-
});
16+
readonly()
17+
);
1218

1319
type RegisterActionSinkAction = InferOutput<typeof registerActionSinkActionSchema>;
1420

packages/core/src/actions/unregisterActionSink.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
import { type Action } from 'redux';
2-
import { custom, function_, literal, object, safeParse, type InferOutput } from 'valibot';
2+
import { custom, function_, literal, object, pipe, readonly, safeParse, type InferOutput } from 'valibot';
33

44
const UNREGISTER_ACTION_SINK = 'WEB_CHAT_INTERNAL/UNREGISTER_ACTION_SINK' as const;
55

6-
const unregisterActionSinkActionSchema = object({
7-
payload: object({
8-
sink: custom<(action: Action) => void>(value => safeParse(function_(), value).success)
6+
const unregisterActionSinkActionSchema = pipe(
7+
object({
8+
payload: pipe(
9+
object({
10+
sink: custom<(action: Action) => void>(value => safeParse(function_(), value).success)
11+
}),
12+
readonly()
13+
),
14+
type: literal(UNREGISTER_ACTION_SINK)
915
}),
10-
type: literal(UNREGISTER_ACTION_SINK)
11-
});
16+
readonly()
17+
);
1218

1319
type UnregisterActionSinkAction = InferOutput<typeof unregisterActionSinkActionSchema>;
1420

0 commit comments

Comments
 (0)