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.

[Typescript] "Footer" is not inferred from Column type

See original GitHub issue

Describe the bug (required)

I’m using Typescript with react-table, I wanted to add footer to table. However, when I define columns data Column type couldn’t infer Footer type.

Provide an example via Codesandbox! (required)

https://codesandbox.io/s/test-react-table-wwemm?file=/src/data.ts You can see Footer is causing type error

Expected behavior (Recommended)

Column type should be able to infer Footer type

Screenshot

스크린샷 2021-01-12 오후 3 25 59

Additional context

Related discussion: https://github.com/tannerlinsley/react-table/discussions/2882 (unsolved)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:5

github_iconTop GitHub Comments

2reactions
EctordAnielcommented, Mar 21, 2021

Tengo el mismo problema. captura

1reaction
minemanemocommented, May 20, 2021

I solved it by setting it like this:

  • focus is that do not modify @types/react-table.

  • Follow code is my react-table-config.d.ts (this code is base to URL)

import { UseTableColumnOptions as BasicUseTableColumnOptions } from 'react-table'

declare module 'react-table' {

  export type FooterProps<D extends object> = TableInstance<D>

  export interface UseTableColumnOptions<D extends object>
    extends BasicUseTableColumnOptions<D> {
    Footer?: Renderer<FooterProps<D>>
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

[Typescript] "Footer" is not inferred from Column type #2983
I'm using Typescript with react-table, I wanted to add footer to table. However, when I define columns data Column type couldn't infer Footer...
Read more >
Bountysource
[Typescript] "Footer" is not inferred from Column type.
Read more >
Minimal TypeScript Crash Course For React
Minimal TypeScript Crash Course For ReactWith Interactive Code Exercises · Functional Components With TypeScript · Props With TypeScript · Callback ...
Read more >
React Table Typescript "Type is not assignable" - Stack Overflow
I get an error when doing const tableInstance = useTable({ columns, data }) . Type '{ Header: string; accessor: string; }[]' is not...
Read more >
TypeScript Records and Mapped Types - WWT
Let's take a tour of TypeScript's Record and Mapped Type features by looking at their usage and evolution within a project.
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