table icon indicating copy to clipboard operation
table copied to clipboard

@types/react-table not working for 7.0.0-rc.15 and @types/react-table 7.0.2

Open thepatrykk opened this issue 6 years ago • 5 comments

I am using typescript in my react project and using:

"@types/react-table": "^7.0.2", "react-table": "^7.0.0-rc.15",

I've read the documentation about typing, so I've added in /src directory folder file react-table-config.d.ts


declare module 'react-table' {
    // take this file as-is, or comment out the sections that don't apply to your plugin configuration
}

I've checked the library for @types/react-table and it seems should fit, because in index.d.ts I found info:

reflects [email protected]

But it seems still types are missing:

image

thepatrykk avatar Jan 07 '20 19:01 thepatrykk

How are you importing ReactTable?

ggascoigne avatar Jan 07 '20 19:01 ggascoigne

import ReactTable from 'react-table' I also tried import * as ReactTable from 'react-table' both are not working

But when I am going to source it will take me to @types/react-table so it seems to import propetly:

// Project: https://github.com/tannerlinsley/react-table
// Definitions by: Guy Gascoigne-Piggford <https://github.com/ggascoigne>,
//                 Michael Stramel <https://github.com/stramel>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.5
// reflects [email protected]

// tslint:disable:no-empty-interface
// no-empty-interface is disabled to allow easy extension with declaration merging

// tslint:disable:no-unnecessary-generics
// no-unnecessary-generics is disabled because many of these definitions are either used in a generic
// context or the signatures are required to match for declaration merging

import { ComponentType, DependencyList, EffectCallback, MouseEvent, ReactElement, ReactNode } from 'react';

export {};

thepatrykk avatar Jan 07 '20 19:01 thepatrykk

ReactTable isn’t a component. You should look at some of the examples and see how it’s used.

ggascoigne avatar Jan 07 '20 19:01 ggascoigne

You write your own table component using useTable and then deal with the layout yourself.

ggascoigne avatar Jan 07 '20 19:01 ggascoigne

Ok, what a fail. It's my bad, I copy it from some example (https://deploy-preview-941--react-table.netlify.com/#/story/custom-sorting) without checking that. Sorry and thanks!

thepatrykk avatar Jan 07 '20 19:01 thepatrykk