zulip/web/src/types.ts
Sayam Samal 203ca08446 components: Restructure component type declarations.
This commit moves the ComponentIntent type to types.ts since it is
common across all the components, and also moves the ActionButton type
from banners.ts to buttons.ts since it is specific to the button
component.

On top of that, the commit also updates the type declarations to be
based off of array declarations to make it easier to modify them
programmatically.
2025-04-07 18:22:16 -07:00

30 lines
739 B
TypeScript

import {z} from "zod";
// TODO/typescript: Move this to server_events
export const topic_link_schema = z.object({
text: z.string(),
url: z.string(),
});
export type TopicLink = z.infer<typeof topic_link_schema>;
export type HTMLSelectOneElement = HTMLSelectElement & {type: "select-one"};
export const anonymous_group_schema = z.object({
direct_subgroups: z.array(z.number()),
direct_members: z.array(z.number()),
});
export const group_setting_value_schema = z.union([z.number(), anonymous_group_schema]);
export const COMPONENT_INTENT_VALUES = [
"neutral",
"brand",
"info",
"success",
"warning",
"danger",
] as const;
export type ComponentIntent = (typeof COMPONENT_INTENT_VALUES)[number];