Not so much a problem but I've been using react-table for the last week or so and really like it, but it's missing types. I've been adding types here and there locally to help myself, but was wondering if there's anything on the roadmap. I can help out as I get more into it. In the meantime, I have a couple of utility functions I can add somewhere like:
export type SortDefinition = [{ id: string, desc: boolean }];
export function mapSortDefinitionToMongoose(sortby: SortDefinition) {
return sortby.reduce((acc, v, i) => {
return (v.desc ? "-" : "") + v.id + ((i < sortby.length - 1) ? ", " : "")
}, "")
}
Perhaps this kind of stuff is already in there somewhere, but I didn't notice.
@tannerlinsley - let me know.
If you wanted to add some type definitions to the repo, I think that would be great. My only requirement would be that they are compatible with both typescript and flow (or have different versions if that's not possible).
I've honestly never added typings to a project - only to existing type definitions in DefinitelyTyped so I'd have to look into how to even do it. The DefinitelyTyped docs recommend that if a project doesn't have anything yet, typings should be added directly to the project. Let me work with this thing some more before I start adding things like project-wide types :)
Okay sounds good :) Going to close this for now, but feel free to open a PR whenever you feel comfortable!
I created the whole typing in typescript. It's pretty big, additionally I found some undocumented feature and documented "feature" which are not implemented (anymore).
I left flow since a while, maintaining two typings in parallel can be pretty heavy to maintain - and I don't know about any good converter.
Are you willing to add the typings to this project anyway?
I created it because the only and currently the best table react package should at least have typings ;) I trust in the future of this package.
Hello @aight8!
I would be interested in your typings, if you could share it, it would be great!
Would love to see typings here. Its really difficult to use this in typescript without it.
@aight8 I would also be interested in getting those from you. Have you considered publishing them to DefinitelyTyped? Or submitting a pull request here for them?
This is a draft, very incomplete but it covers my (very humble) needs for now: https://gist.github.com/geowarin/204b0d3526ade379d41c70d2005c8847
@david-mk You can add it to your project and go from here.
I used generics to type the rows and the columns, it can be helpful if you explicitly type your columns.
I'm waiting on TS-6395 to use generics with react components. (workaround)
Sorry guys I had no time at all to read all the github issues the last days.
Here is the typing in gist.
https://gist.github.com/aight8/5f204cbac372cf856d80c498defe58f0
Since the last big react-table update there are some BC's - so if you want to work on it or even take the effort and publish it on deftypes, here you go :)
Submit a pr that follows convention and I'll accept it if it looks good to
everyone here. I personally don't plan on supporting it myself so whoever
submits it, prepare for the long haul ;)
On Tue, May 23, 2017 at 4:18 PM Geoffroy Warin notifications@github.com
wrote:
This is a draft, very incomplete but this covers my needs for now:
https://gist.github.com/geowarin/204b0d3526ade379d41c70d2005c8847—
You are receiving this because you modified the open/close state.Reply to this email directly, view it on GitHub
https://github.com/tannerlinsley/react-table/issues/207#issuecomment-303548543,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFUmCSdLSXYk9TbnkdxG1yDEImvW73aqks5r81slgaJpZM4NAYvx
.
First of all thank you @aight8 for the gist, its a great help already.
But I have noticed that some of the typings are outdated. Is there anyone which is supporting the typescript definitions?
I personally don't plan on supporting it myself so whoever
submits it, prepare for the long haul ;)
@tannerlinsley what if there will be unit tests on typings? Will it help you to do minor changes in typings by yourself? And let's pretend that typings has a single source of truth in typescript (flow typings is generated)
If you wrote the lib in typescript, you get the typings for free)
All the projects I've done in UK use react + ts, none of my clients used flow either.
Most helpful comment
I created the whole typing in typescript. It's pretty big, additionally I found some undocumented feature and documented "feature" which are not implemented (anymore).
I left flow since a while, maintaining two typings in parallel can be pretty heavy to maintain - and I don't know about any good converter.
Are you willing to add the typings to this project anyway?
I created it because the only and currently the best table react package should at least have typings ;) I trust in the future of this package.