Files
star-kitten/types/jsx.d.ts

247 lines
5.8 KiB
TypeScript

import {
type ActionRow,
type Button,
type ChannelSelectMenu,
type GuildChannelTypes,
type MentionableSelectMenu,
type PartialEmoji,
type RoleSelectMenu,
type StringSelectMenu,
type TextInput,
type UserSelectMenu,
type LabelComponent,
type ContainerComponent,
type TextDisplayComponent,
type SectionComponent,
type MediaGalleryComponent,
type SeparatorComponent,
type FileComponent,
type InteractionButton,
type URLButton,
type PremiumButton,
type ThumbnailComponent,
} from "@projectdysnomia/dysnomia";
declare namespace JSX {
type Component =
| Button
| StringSelectMenu
| UserSelectMenu
| RoleSelectMenu
| MentionableSelectMenu
| ChannelSelectMenu
| TextInput
| LabelComponent
| ContainerComponent
| TextDisplayComponent
| SectionComponent
| MediaGalleryComponent
| SeparatorComponent
| FileComponent
| InteractionButton
| URLButton
| PremiumButton
| ThumbnailComponent;
type Element = Component | Promise<Component>;
interface ElementClass {
render: any;
}
interface ElementAttributesProperty {
props: {};
}
// This tells TypeScript to check children against the 'children' property
interface ElementChildrenAttribute {
children: {};
}
interface IntrinsicElements {
// Known elements - no index signature to enforce type safety
actionRow: { children: Element | Element[] };
button: {
label: string;
customId: string;
style: number;
emoji?: PartialEmoji;
disabled?: boolean;
};
container: {
accent?: number;
spoiler?: boolean;
children: Element | Element[];
};
textDisplay: { content: string };
modal: { customId?: string; title?: string; children: Element | Element[] };
label: { label: string; children: Element };
stringSelect: {
customId: string;
placeholder?: string;
minValues?: number;
maxValues?: number;
children: Element | Element[];
};
option: {
label: string;
value: string;
description?: string;
emoji?: PartialEmoji;
default?: boolean;
};
}
}
declare module "@star-kitten/lib/discord/jsx-runtime" {
export namespace JSX {
type Component =
| Button
| StringSelectMenu
| UserSelectMenu
| RoleSelectMenu
| MentionableSelectMenu
| ChannelSelectMenu
| TextInput
| LabelComponent
| ContainerComponent
| TextDisplayComponent
| SectionComponent
| MediaGalleryComponent
| SeparatorComponent
| FileComponent
| InteractionButton
| URLButton
| PremiumButton
| ThumbnailComponent;
type Element = Component | Promise<Component>;
interface ElementClass {
render: any;
}
interface ElementAttributesProperty {
props: {};
}
// This tells TypeScript to check children against the 'children' property
interface ElementChildrenAttribute {
children: {};
}
interface IntrinsicElements {
actionRow: { children: Element | Element[] };
button: {
label: string;
customId: string;
style: number;
emoji?: PartialEmoji;
disabled?: boolean;
};
container: {
accent?: number;
spoiler?: boolean;
children: Element | Element[];
};
textDisplay: { content: string };
modal: {
customId?: string;
title?: string;
children: Element | Element[];
};
label: { label: string; children: Element };
stringSelect: {
customId: string;
placeholder?: string;
minValues?: number;
maxValues?: number;
children: Element | Element[];
};
option: {
label: string;
value: string;
description?: string;
emoji?: PartialEmoji;
default?: boolean;
};
}
}
}
declare module "@star-kitten/lib/discord/jsx-dev-runtime" {
export namespace JSX {
type Component =
| Button
| StringSelectMenu
| UserSelectMenu
| RoleSelectMenu
| MentionableSelectMenu
| ChannelSelectMenu
| TextInput
| LabelComponent
| ContainerComponent
| TextDisplayComponent
| SectionComponent
| MediaGalleryComponent
| SeparatorComponent
| FileComponent
| InteractionButton
| URLButton
| PremiumButton
| ThumbnailComponent;
type Element = Component | Promise<Component>;
interface ElementClass {
render: any;
}
interface ElementAttributesProperty {
props: {};
}
// This tells TypeScript to check children against the 'children' property
interface ElementChildrenAttribute {
children: {};
}
interface IntrinsicElements {
actionRow: { children: Element | Element[] };
button: {
label: string;
customId: string;
style: number;
emoji?: PartialEmoji;
disabled?: boolean;
};
container: {
accent?: number;
spoiler?: boolean;
children: Element | Element[];
};
textDisplay: { content: string };
modal: {
customId?: string;
title?: string;
children: Element | Element[];
};
label: { label: string; children: Element };
stringSelect: {
customId: string;
placeholder?: string;
minValues?: number;
maxValues?: number;
children: Element | Element[];
};
option: {
label: string;
value: string;
description?: string;
emoji?: PartialEmoji;
default?: boolean;
};
}
}
}