downshift version: 3.3.1node version: 10.16.3npm (or yarn) version: 6.9.0Relevant code or config
Example in typescript playground (copied directly from first example in useSelect documentation)
What you did:
Copied code directly from first example in docs
What happened:
Argument of type '{ items: string[]; }' is not assignable to parameter of type 'UseSelectInterface<unknown>'.
Object literal may only specify known properties, and 'items' does not exist in type 'UseSelectInterface<unknown>'.
Reproduction repository:
Reproduction typescript playground is linked above
Problem description:
There are several problems here:
Suggested solution:
Change
export function useSelect<Item>(
props: UseSelectInterface<Item>,
): UseSelectReturnValue<Item>
to
export function useSelect<Item>(
props: UseSelectProps<Item>,
): UseSelectReturnValue<Item>
But I am not sure what to do with stateChangeTypes (which change above would not fix).
My currect workaround in TS playground
Thank you for reporting this! Will take a look but can you create a PR with the fix? maybe you will be faster, I am currently working on fixing https://github.com/downshift-js/downshift/issues/762
Submitted as #765
awesome, thanks a lot! this will be a breaking change and I'd batch it up with a v4 release.
There is also https://github.com/downshift-js/downshift/pull/748 that is a breaking change.
Maybe we can batch these 2 together? What do you think about the other one?
Maybe. While this technically is breaking change the previous version is so broken that you literally cannot use it with typescript without casting to any or similar so I wouldn't worry too much about it being breaking.
I second @CodeWitchBella. This was really confusing to me after installing downshift in a new cra-app with TS.
I am merging this today or tomorrow as a fix. @CodeWitchBella can you install kcd scripts globally and try to run that contributors script again?
:tada: This issue has been resolved in version 3.3.3 :tada:
The release is available on:
npm package (@latest dist-tag)Your semantic-release bot :package::rocket:
Most helpful comment
Maybe. While this technically is breaking change the previous version is so broken that you literally cannot use it with typescript without casting to any or similar so I wouldn't worry too much about it being breaking.