React: declaration merging for react-table types doesn't work. Property doesn't exist on type 'TableInstance'

Viewed 40

I'm facing an odd issue while implementing pagination for my react-table component. The problem is what you can see in the screenshot - Property X does not exist on type 'TableInstance:

enter image description here

So I found a similar problem that someone had before and I have used the approved solution: react-table pagination properties doesn't exist on type 'TableInstance{}'

The example file is also here: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-table#example-type-file

The problem is that nothing has changed, I have described the file in the root folder and it seems that APP can't see it as you can see in the picture above.

enter image description here

I'm new to React, can someone help me with that? I was trying to find a solution by myself but I failed :(

1 Answers

Just add a triple-slash directive path pointing to the react-table-config.d.ts file so the types get augmented. It's going to be something like this:

/// <reference path="./react-table-config.d.ts" />

Including it in one place is already enough. No need to add it to every file that uses react-table.

Related