Skip to content

[Web API type definition issue] document.startViewTransition typed as always present #2142

@KieranP

Description

@KieranP

Summary

document.startViewTransition is typed as always present, even though it is not available on Firefox

Expected vs. Actual Behavior

document.startViewTransition should be typed function | undefined. Currently just typed function.

This means that using this safety check like if (!document.startViewTransition) return results in triggering TSLints @typescript-eslint/no-unnecessary-condition

But startViewTransition isn't available on Firefox, so the check is needed.

To improve this, I highly recommend that typed use baseline status in determining what a type should be. if an API is not Baseline Wildly Available, it should probably be typed as possibly undefined

Playground Link

No response

Browser Support

  • This API is supported in at least two major browser engines (not two Chromium-based browsers).

Have Tried The Latest Releases

  • This issue applies to the latest release of TypeScript.
  • This issue applies to the latest release of @types/web.

Additional Context

No response

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