question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

autoResetSelectedRows Typescript problem

See original GitHub issue

Getting error when giving autoResetSelectedRows option.

Argument of type '{ columns: any; data: any; autoResetSelectedRows: boolean; }' is not assignable to parameter of type 'TableOptions<object>'.
  Object literal may only specify known properties, and 'autoResetSelectedRows' does not exist in type 'TableOptions<object>'.ts(2345)

This is documented feature https://react-table.tanstack.com/docs/api/useRowSelect Why I’m getting this error?

Code sample:

  const {
    getTableProps,
    getTableBodyProps,
    headerGroups,
    rows,
    prepareRow,
    state: { pageIndex, pageSize, selectedRowIds },
  } = useTable(
    {
      columns,
      data,
      autoResetSelectedRows: false,
    },
    useFlexLayout,
    useRowSelect
  );

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
tannerlinsleycommented, Oct 5, 2020

Again, this library does not ship with native types (yet). So use any community types at your own risk.

1reaction
Vezarinocommented, Sep 9, 2020

While we do not use that functionality ourselves, a quick check would seem to confirm that to type check the custom function, you need to add it to the “TableOptions” interface in the configuration file, i.e.:

export interface TableOptions<D extends object>
      extends UseFiltersOptions<D>,
        UsePaginationOptions<D>
        {
          updateMyData: (rowIndex: number, columnId: string, value: unknown) => void
        }
Read more comments on GitHub >

github_iconTop Results From Across the Web

autoResetSelectedRows Typescript problem #2697 - GitHub
Getting error when giving autoResetSelectedRows option. Argument of type '{ columns: any; data: any; autoResetSelectedRows: boolean; } ...
Read more >
Typescript taking in Javascript component; How to solve errors
Update based on answer. Using the new allow JS, i still am receiving a similar error as below, Type '{ columns: MutableRefObject< ...
Read more >
react-table useRowSelect TypeScript Examples
This page shows TypeScript code examples of react-table useRowSelect.
Read more >
tannerlinsley/react-table: kitchen-sink - CodeSandbox
skipReset,\n autoResetSelectedRows: ! ... \"https:\u002F\u002Fregistry.yarnpkg.com\u002F@babel\u002Fpreset-typescript\u002F-\u002Fpreset-typescript-7.6.0.
Read more >
[Solved]-React Table - radio input for useRowSelect-Reactjs
Coding example for the question React Table - radio input for useRowSelect-Reactjs. ... Pass autoResetSelectedRows: false, to useTable function.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found