tbleckert / react-select-search

⚡️ Lightweight select component for React
https://react-select-search.com
MIT License
676 stars 147 forks source link

Adding TypeScript declarations file. #73

Closed mrf345 closed 4 years ago

mrf345 commented 4 years ago

Problem:

Solution:

Note:

Related issues:

68


Thanks so much for the awesome component ✨

tbleckert commented 4 years ago

@mrf345 Thank you, this is awesome. Will test it out today.

mrf345 commented 4 years ago

Awesome, thanks for taking a look.

tbleckert commented 4 years ago

@mrf345 I've tested it now, sorry for the delay. A few things:

Otherwise works fine, great work!

vercel[bot] commented 4 years ago

This pull request is being automatically deployed with Vercel (learn more). To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/tbleckert/react-select-search/ea4uxd41o ✅ Preview: https://react-select-search-git-fork-mrf345-typescriptdefinition.tbleckert.now.sh

mrf345 commented 4 years ago

Hi @tbleckert , No worries and thanks for the well detailed remarks.

I've just fixed the exiting types, and added the ones that came after. Please let me know if i've missed any remark.

tbleckert commented 4 years ago

@mrf345 Nice, great work. I'll merge it in and include it in the next release

feimosi commented 4 years ago

These types are not compatible for me (latest TypeScript). Based on the errors I was getting, DomProps should look like this:

  export type DomProps = {
      tabIndex:number
      onMouseDown:(event:MouseEvent<HTMLButtonElement>) => void
      onKeyDown:(event:KeyboardEvent<HTMLButtonElement>) => void
      onKeyPress:(event:KeyboardEvent<HTMLButtonElement>) => void
      onBlur:(event:FocusEvent<HTMLButtonElement>) => void
      value:string
      disabled:boolean
  }

I'm new to this library and don't know all the options,HTMLButtonElement should probably be generic.