feat: enable TS autocomplete for Svelte HTML element definitions (#15972)

Covers #15971.

adds autocomplete support to SvelteHTMLElements while preserving its functionality that key can be any string using string & {} TS trick.
pull/15990/head
venus 4 months ago committed by GitHub
parent 08346b51f2
commit 6928aaca06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -2066,7 +2066,7 @@ export interface SvelteHTMLElements {
failed?: import('svelte').Snippet<[error: unknown, reset: () => void]>;
};
[name: string]: { [name: string]: any };
[name: string & {}]: { [name: string]: any };
}
export type ClassValue = string | import('clsx').ClassArray | import('clsx').ClassDictionary;

@ -8,7 +8,7 @@ import * as svelteElements from './elements.js';
/**
* @internal do not use
*/
type HTMLProps<Property extends string, Override> = Omit<
type HTMLProps<Property extends keyof svelteElements.SvelteHTMLElements, Override> = Omit<
import('./elements.js').SvelteHTMLElements[Property],
keyof Override
> &
@ -250,7 +250,7 @@ declare global {
};
// don't type svelte:options, it would override the types in svelte/elements and it isn't extendable anyway
[name: string]: { [name: string]: any };
[name: string & {}]: { [name: string]: any };
}
}
}

Loading…
Cancel
Save