Skip to content

[Bug]: Wrong type definition for table.renderItem #5422

Open
@lschierer

Description

@lschierer

Code of conduct

  • I agree to follow this project's code of conduct.

Impacted component(s)

sp-table

Expected behavior

When implementing the renderItem property for a virtualized table, the type definition expects me to implement

(property) Table.renderItem: (item: Record<string, unknown>, index: number) => TemplateResult

the example at https://opensource.adobe.com/spectrum-web-components/components/table/#sorting-on-the-virtualized-table contradicts this, showing the Array<HTMLElement> that I found to actually work, while the implementation provided in the package uses the TemplateResult containing an entire row, including the sp-table-row elements.

I expect the documentation, the type hinting I get from editors like visual studio or zed, and the example in the package's own implementation to all match. Minimally, I expect the type hinting for editors to match what (empirically) appears to be expected.

Actual behavior

It appears to work best when I actually return an Array<HTMLElement> where the array contains the cells that go in the row.

Screenshots

No response

What browsers are you seeing the problem in?

Chrome

How can we reproduce this issue?

  1. Go to '...'
  2. Click on '....'
  3. Scroll to '....'
  4. Check console
  5. See error

Sample code or abstract reproduction which illustrates the problem

tsc shows a warning on this line of my project. I do not have a minimal reproduction set up at this time, and my project is a bit involved for a casual reproduction.

Note the table does work. It would just be a much easier developer experience if I wasn't fighting the linter.

Severity

SEV 4

Logs taken while reproducing problem

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions