Skip to content
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

[v2] Typescript typings for v2? #2860

Closed
pondrejack opened this issue Jul 27, 2018 · 19 comments
Closed

[v2] Typescript typings for v2? #2860

pondrejack opened this issue Jul 27, 2018 · 19 comments

Comments

@pondrejack
Copy link

Is there a specific repo outside of @types/react-select or a working branch of @types/react-select for v2 typings? There are a lot of missing types like isMulti, isClearable, etc. Been working on PRing what I run into but new ones keep popping up.

@pondrejack pondrejack changed the title Typescript typings for v2? [v2] Typescript typings for v2? Jul 27, 2018
@burtek
Copy link

burtek commented Jul 27, 2018

I'd love to know that too. @JedWatson suggested that "he'd consider that after the final release of 2.0.0", but I did not find anything as for now

@Jtango18
Copy link

@pondrejack Have you got a fork you can share that you've been working on this in? I'd be happy to contribute to improving the mappings. The Prop Update Guide should be pretty usable in order to sort this. Lemme know if you want some help.

@Jtango18
Copy link

Jtango18 commented Jul 31, 2018

@JedWatson I'm keen to help with this, but also read your comments here and understand your potential reluctance in adding official TS support. Is that still your mindset? If so, I'm happy to do the work and lodge a pull-request with the @DefinitelyTyped crew. If you'd prefer official support be here, happy to work towards that too. Lemme know what you'd prefer.

@jonfreedman
Copy link

I'm also happy to help on a PR for the definitions with @DefinitelyTyped

@burtek
Copy link

burtek commented Jul 31, 2018

Same here :)

@m1lk1way
Copy link

same 👍

@Jtango18
Copy link

Hi @jonfreedman @burtek @m1lk1way

I've created a new repo where I'm working on some of this in isolation. Basically just fleshing out an initial index.d.ts file which I'm slowly fleshing out based on the current @DefinitelyTyped one, and digging through the v2.0 docs and source code.

Feel free to test it out in your own TS projects and see if you can find anything wrong with it. More than welcome to submit a PR if you have some time to expand on it.

See it here: https://github.com/Jtango18/updated-react-select-ts-defs

HTH

Cheers

JT

@jonfreedman
Copy link

@Jtango18 I have some changes I will create a PR for shortly, is there a reason you're targeting TypeScript Version: 3.0 ? It needs to be 2.9+ as that's when generic type arguments for JSX were introduced

@Jtango18
Copy link

Jtango18 commented Aug 1, 2018

@jonfreedman Let's take these discussions over to the repo.

@jonfreedman
Copy link

Just to close this out typings for v2 have been published overnight @ https://www.npmjs.com/package/@types/react-select

@aakashsigdel
Copy link

@jochenberger The typings are not working as it complains

ERROR in node_modules/@types/react-select/lib/components/Option.d.ts(17,12):
TS2314: Generic type 'MouseEventHandler' requires 1 type argument(s).
ERROR in node_modules/@types/react-select/lib/components/Option.d.ts(18,16):
TS2314: Generic type 'MouseEventHandler' requires 1 type argument(s).

@Wezea
Copy link

Wezea commented Aug 21, 2018

@jochenberger I'm still facing this issue.

node_modules/@types/react-select/lib/components/Option.d.ts TS2314: Generic type 'MouseEventHandler' requires 1 type argument(s).

@jonfreedman
Copy link

jonfreedman commented Aug 21, 2018

@aakashsigdel @Wezea do you have an example of how you're interacting with MouseEventHandler so we can incorporate into the DefinitelyTyped tests?

Also as per DefinitelyTyped/DefinitelyTyped#27980 can you confirm you're using the latest @types/react version?

@ch1ll0ut1
Copy link

I have the same problem because I'm using react 15. The typings of react 15 and 16 conflict with each other.

@danielkcz
Copy link

I had the same issue, but installing @types/react 16.4.13 fixed it because a default for generic argument is specified for MouseEventHandler there.

@davad
Copy link

davad commented Sep 5, 2018

Are the typings up to date now? I'm getting the following typing error when I try to pass the defaultValue prop to <Select>:

Property 'defaultValue' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<ReactSelectClass> & Readonly<{ children?: ReactNode; }> & Readonly<ReactSelectProps>'

I tried installing @types/react-select, but it didn't make a difference. Are the types in the main react-select package up to date now? Should I put together a PR to add this prop to @types/react-select?

@danielkcz
Copy link

@davad That property is already there, so it's most likely some issue in your local installation.

https://github.com/DefinitelyTyped/DefinitelyTyped/blob/2b6e08299d0793602eae13f5ea1a77fe18981c13/types/react-select/lib/Select.d.ts#L205

@davad
Copy link

davad commented Sep 5, 2018

@FredyC Found the problem. Someone else had already added an old version of @types/react-select to the project. Updated to 2.0, and it's working right now.

Thanks!

@bladey
Copy link
Contributor

bladey commented May 28, 2020

Hello -

In an effort to sustain the react-select project going forward, we're closing old issues.

We understand this might be inconvenient but in the best interest of supporting the broader community we have to direct our limited efforts to maintain the latest version.

If you aren't using the latest version of react-select please consider upgrading to see if it resolves any issues you're having.

However, if you feel this issue is still relevant and you'd like us to review it - please leave a comment and we'll do our best to get back to you!

@bladey bladey closed this as completed May 28, 2020
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

No branches or pull requests