Skip to content

Add View Transition types #15415

@Turbocat6413

Description

@Turbocat6413

The problem

Previously, only the following use case was available when using the View Transition API:

document.startViewTransition(() => updateTheDOMSomehow(data));
Now all major browsers (except Firefox) support View Transition types, but Svelte doesn't provide needed typescript types

Solution

New types should be added according to the standard

const direction = determineBackwardsOrForwards();

const t = document.startViewTransition({
  update: updateTheDOMSomehow,
  types: ['slide', direction],
});

Example from Chrome for developers

Importance

Without this, it is extremely difficult to use the View Transition API in conjunction with TypeScript

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions