import type { MouseEventHandler, SvelteHTMLElements } from 'svelte/elements'; export type RemoveIndexSignature = { [K in keyof T as Signature extends K ? never : K]: T[K]; }; export type HTMLElementAttributes = RemoveIndexSignature; export interface RuneComponent { action?: (_element: HTMLElementTagNameMap[TElementTagName]) => { destroy?: () => void; update?: () => void; } | void; props: HTMLElementAttributes[TElementTagName] & { onclickoutside?: MouseEventHandler; }; [key: string]: unknown; } /** * Transforms the optional fields of a given object type into required fields, * preserving their types as `T | undefined`. Required fields in the original * type remain unchanged. * * @example * // Input * type MyRecord = { * field1?: string; // optional * field2: number; // required * }; * * // Output * type MyRecord = { * field1: string | undefined; // made required with `T | undefined` * field2: number; // unchanged (already required) * } */ export type NullablyRequired = { [P in keyof T & keyof any]: T[P]; };