react-instantsearch icon indicating copy to clipboard operation
react-instantsearch copied to clipboard

Add TypeScript definitions

Open FDiskas opened this issue 8 years ago • 18 comments

Please add typings for TypeScript Do you want to request a feature or report a bug? FEATURE

FDiskas avatar Nov 06 '17 13:11 FDiskas

Some inspiration from other react libraries:

Feel free to get started with it @FDiskas, it's not exactly a priority for us, since this is the first request for it AFAIK, but we will definitely help out with validating. Maybe something can be done to convert proptypes to TS definitions?

Haroenv avatar Nov 06 '17 13:11 Haroenv

https://yarn.pm/react-to-typescript-definitions can be tried

Haroenv avatar Nov 06 '17 14:11 Haroenv

@alexandremeunier you might have something to share here :)

mthuret avatar Nov 06 '17 14:11 mthuret

Is there any news/improvement on Types with Typescript ?

romainquellec avatar Apr 17 '18 14:04 romainquellec

There's an open PR for using a tool to generate typings, but it didn't completely work. Feel free to contribute @romainquellec :) https://github.com/algolia/react-instantsearch/pull/701

Haroenv avatar Apr 17 '18 14:04 Haroenv

Hi All, I've opened a PR to DefinitelyTyped with definitions for the types that we've been maintaining in our repo. You all could use it as a base to build out the rest of the type definitions.

https://github.com/DefinitelyTyped/DefinitelyTyped/pull/29793

gburgett avatar Oct 16 '18 20:10 gburgett

Thanks @gburgett, that's definitely a solid start for typings! We will take a look and see if there's any missing things.

I see you're documenting internals as well, is that because you use them, or because you simply wanted to add typings for everything?

Haroenv avatar Oct 17 '18 07:10 Haroenv

Thanks a lot @gburgett I'll review the PR and probably fill the missing types next week.

samouss avatar Oct 18 '18 10:10 samouss

Hi @Haroenv , I'm not sure which of them were internals. I've definitely reworked the definitions since getting feedback from the DefinitelyTyped folks, are they still exporting internal functions?

gburgett avatar Oct 18 '18 15:10 gburgett

I didn’t mean that in a way that they shouldn’t be documented, but e.g. createInstantSearch usually isn’t necessary to use, unless you’re targeting something which isn’t web, and isn’t react native either.

In definitely typed they seem to want everything documented, so that was a good call from you to make it complete!

Haroenv avatar Oct 18 '18 16:10 Haroenv

Definitely need more types. Currently, the amount of any and the lack of generic type that defines results is really bad (e.g. InstantSearchProps at react-instantsearch-dom)

ivawzh avatar Mar 03 '19 11:03 ivawzh

@ivawzh the typings are open source and not maintained by us. Feel free to contribute:

https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-instantsearch-core https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-instantsearch-dom

Haroenv avatar Mar 04 '19 09:03 Haroenv

Disappointment to Algolia's strategy and altitude.

You are asking the paid customers to create and maintain the for-profit products you sell.

Say even if I maintain the types for you, how will they get up-to-date whenever you deliver changes if you don't take the ownership yourself.

This is also ignorant of your competitors' standard. Have a look at https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/elasticsearch/index.d.ts. They are types maintained by Elasticsearch, an open-source competitor that offers free-for-ever community tier. The quality is just too obviously better than what you currently have.

ivawzh avatar Mar 07 '19 04:03 ivawzh

Thanks for your interest in the definition files of React InstantSearch! Like @Haroenv said those files are not mainly maintained by us for one simple reason: it takes a lot of time to do it manually. We maintain the definition file for the Algolia JavaScript client but not all the InstantSearch flavors available (Vanilla, Vue, React).

We choose another strategy to fill the gap with those definition files. We gradually move our codebases to TypeScript. Which means that the definition files will be automatically generated and officially supported. But this process takes times since it's a gradual migration. Hope you understand our strategy on the topic.

samouss avatar Mar 07 '19 08:03 samouss

Any way to follow your progress for the Typescript migration for each of the projects @samouss ?

jhalborg avatar Oct 17 '19 15:10 jhalborg

This is not totally representative but the GitHub language repartition is an indicator of the TypeScript migration progress:

React InstantSearch languages

We'll be explicit about the TypeScript definitions once they are available in a release.

francoischalifour avatar Oct 17 '19 15:10 francoischalifour

@samouss - I hope you had a nice weekend, and any updates on this? Big congrats on your work on Algolia's JS as it now natively supports TypeScript.

ACPK avatar Nov 29 '21 19:11 ACPK

@ACPK to focus our efforts, we have migrated InstantSearch.js (the vanilla.js) version completely to TS first, which is done now. Currently we are working on writing a new version of React InstantSearch using hooks, which internally is based on InstantSearch.js and supports typescript out of the box. You can follow along on #2870

Haroenv avatar Nov 30 '21 09:11 Haroenv

React InstantSearch Hooks is globally available now and will soon replace React InstantSearch. You can follow the upgrade guide to migrate and benefit from first-class TypeScript support.

sarahdayan avatar Dec 19 '22 11:12 sarahdayan