Skip to content

[Web API type definition issue] Async scroll...() methods are non-async in fact #2197

@turansky

Description

@turansky

Summary

Scroll methods are non-async currently in latest browsers

Expected vs. Actual Behavior

Expected:

scroll(options?: ScrollToOptions): void;
scroll(x: number, y: number): void;
scrollBy(options?: ScrollToOptions): void;
scrollBy(x: number, y: number): void;
scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
scrollTo(options?: ScrollToOptions): void;
scrollTo(x: number, y: number): void;

// or with optional async support

scroll(options?: ScrollToOptions): Promise<void> | void;
scroll(x: number, y: number): Promise<void> | void;
scrollBy(options?: ScrollToOptions): Promise<void> | void;
scrollBy(x: number, y: number): Promise<void> | void;
scrollIntoView(arg?: boolean | ScrollIntoViewOptions): Promise<void> | void;
scrollTo(options?: ScrollToOptions): Promise<void> | void;
scrollTo(x: number, y: number): Promise<void> | void;

Web Types 0.0.280

scroll(options?: ScrollToOptions): Promise<void>;
scroll(x: number, y: number): Promise<void>;
scrollBy(options?: ScrollToOptions): Promise<void>;
scrollBy(x: number, y: number): Promise<void>;
scrollIntoView(arg?: boolean | ScrollIntoViewOptions): Promise<void>;
scrollTo(options?: ScrollToOptions): Promise<void>;
scrollTo(x: number, y: number): Promise<void>;

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

Commit

MDN

https://developer.mozilla.org/en-US/docs/Web/API/Element/scroll
https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollBy
https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollTo

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