Skip to content

typings in react-table? #207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
theigor opened this issue Apr 18, 2017 · 14 comments · Fixed by #1511
Closed

typings in react-table? #207

theigor opened this issue Apr 18, 2017 · 14 comments · Fixed by #1511

Comments

@theigor
Copy link

theigor commented Apr 18, 2017

Problem Description

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.

@tannerlinsley
Copy link
Collaborator

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).

@theigor
Copy link
Author

theigor commented Apr 18, 2017

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 :)

@tannerlinsley
Copy link
Collaborator

Okay sounds good :) Going to close this for now, but feel free to open a PR whenever you feel comfortable!

@aight8
Copy link

aight8 commented Apr 25, 2017

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.

@geowarin
Copy link

Hello @aight8!
I would be interested in your typings, if you could share it, it would be great!

@ghost
Copy link

ghost commented May 23, 2017

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?

@geowarin
Copy link

geowarin commented May 23, 2017

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)

@aight8
Copy link

aight8 commented May 23, 2017

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 :)

@tannerlinsley
Copy link
Collaborator

tannerlinsley commented May 23, 2017 via email

@Aranir
Copy link

Aranir commented Jul 7, 2017

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?

@saitonakamura
Copy link

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)

@quantuminformation
Copy link

If you wrote the lib in typescript, you get the typings for free)

@quantuminformation
Copy link

All the projects I've done in UK use react + ts, none of my clients used flow either.

@stramel stramel mentioned this issue Sep 12, 2019
@danielo515
Copy link

Does anyone have types for flow?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants