Skip to content

Conversation

@Kanata844
Copy link
Contributor

No description provided.

interface Props {
selectedChannelId?: Id<"channels">;
screenMode: string;
Copy link
Contributor

@aster-void aster-void Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

selectedChannelId と screenMode は

screenMode = "channel" -> selectedChannelId は必須
screenMode = "personalization" -> selectedChannelId は不要

という関係にあるので、その関連性を反映した型にするといいね

type Selection =
  | {
      type: "chat";
      channelId: Id<"channels">;
  | {
      type: "personalization";
    };

import Personalization from "./Personalization.svelte";
let selectedChannelId = $state<Id<"channels"> | undefined>(undefined);
let screenMode = $state("chat");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これは、文字列ならなんでもとれるわけではなく、 "chat" か "personalization" の二択だと思うので、それを反映した型をつけるといいね

let screenMode = $state<"chat" | "personalization">("chat");

@aster-void aster-void merged commit dc2fe4d into main Sep 10, 2025
3 checks passed
@aster-void aster-void deleted the feat/personalization branch September 10, 2025 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants