You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to restrict the values allowed in a data-attribute similarly to what is already possible with completely non-standard attributes using the svelteHTML namespace.
Today svelte will accept any value in any data-attribute and there seems to be no way to restrict it, even overriding the svelte's internal .d.ts (like non-ambient.d.ts and elements.d.ts) files seems to not have any effect.
Describe the proposed solution
Allow this:
// See https://kit.svelte.dev/docs/types#app// for information about these interfacesdeclare global {namespaceApp{// interface Error {}// interface Locals {}// interface PageData {}// interface PageState {}// interface Platform {}}namespacesvelteHTML{// enhance elementsinterfaceIntrinsicElements{// 'my-custom-element': { someattribute: string; 'on:event': (e: CustomEvent<any>) => void };}// enhance attributesinterfaceHTMLAttributes<T>{// If you want to use the beforeinstallprompt event// onbeforeinstallprompt?: (event: any) => any;// If you want to use myCustomAttribute={..} (note: all lowercase)// mycustomattribute?: any; // You can replace any with something more specific if you like'data-hello'?: 'hello';}}}export{};
Importance
nice to have
The text was updated successfully, but these errors were encountered:
Describe the problem
I would like to restrict the values allowed in a data-attribute similarly to what is already possible with completely non-standard attributes using the
svelteHTML
namespace.Today svelte will accept any value in any data-attribute and there seems to be no way to restrict it, even overriding the svelte's internal .d.ts (like
non-ambient.d.ts
andelements.d.ts
) files seems to not have any effect.Describe the proposed solution
Allow this:
Importance
nice to have
The text was updated successfully, but these errors were encountered: