Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RegularTableElement.scrollTo shadows base HTMLElement.scrollTo method #54

Closed
telamonian opened this issue Jun 15, 2020 · 0 comments · Fixed by #65
Closed

RegularTableElement.scrollTo shadows base HTMLElement.scrollTo method #54

telamonian opened this issue Jun 15, 2020 · 0 comments · Fixed by #65
Labels
bug Concrete, reproducible bugs

Comments

@telamonian
Copy link
Contributor

telamonian commented Jun 15, 2020

I took a first stab at writing a typescript type declaration file (regular-table.d.ts). In the RegularTableElement class declaration, I had to leave out:

scrollTo(x: number, y: number, ncols: number, nrows: number): void;

This is because the above is not compatible with the signature of the base method HTMLElement.scrollTo, as defined in typescript's standard lib.dom.d.ts:

interface ScrollToOptions extends ScrollOptions {
    left?: number;
    top?: number;
    behavior?: "auto" | "smooth";
}

...

    scrollTo(options?: ScrollToOptions): void;
    scrollTo(x: number, y: number): void;

This is likely to be a pain point for anyone trying to consume regular-table in a typescript project (at the least, they won't be able to call scrollTo on a RegularTableElement instance without a cast).

Potential fixes:

  • (easy) Change the name of scrollTo. For example, we could use scrollToCell
  • (more complex) Add explicit handling of arguments to scrollTo
@telamonian telamonian added bug Concrete, reproducible bugs internal Internal refactoring and code quality improvement and removed internal Internal refactoring and code quality improvement labels Jun 15, 2020
telamonian added a commit to telamonian/regular-table that referenced this issue Jun 18, 2020
- this allows for inclusion of `scrollToCell` in index.d.ts typing
- previously, typescript complained that `RegularTableElemeent.scrollTo` shadowed base class `HTMLElement.scrollTo` method
telamonian added a commit to telamonian/regular-table that referenced this issue Jun 18, 2020
- this allows for inclusion of `scrollToCell` in index.d.ts typing
- previously, typescript complained that `RegularTableElemeent.scrollTo` shadowed base class `HTMLElement.scrollTo` method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Concrete, reproducible bugs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant