Skip to content

Provide augmented HTML typings in SvelteKit itself #10534

@dummdidumm

Description

@dummdidumm

Describe the problem

Right now, things like data-sveltekit-preload-data are added inside the Svelte repo's HTML type definitions. With sveltejs/language-tools#2109 adressed we can investigate whether or not it makes sense to have these additional types provided by SvelteKit itself.

Describe the proposed solution

Have a file inside SvelteKit that is loaded through the generated ambient.d.ts file which enhances the typings like this.

declare module "svelte/elements" {
  export interface HTMLAttributes {
    'data-sveltekit-keepfocus'?: true | '' | 'off' | undefined | null;
    // .. etc
  }
}

Alternatives considered

keep the tighter-than-it-needs-to-be-connection to Svelte's typings.

Importance

would make my life easier

Additional Information

I haven't quite figured out if this is a breaking change or not - i.e. is there something stopping us from just shipping this today and then removing the types in a future Svelte version, which the next major version then only supports? It's probably a breaking change because it would mean we need to remove the typings on the Svelte core side, so probably easiest to do along with Svelte 5.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions