kentcdodds / match-sorter

Simple, expected, and deterministic best-match sorting of an array in JavaScript
https://npm.im/match-sorter
MIT License
3.73k stars 129 forks source link

Cleaning up some of the type paremeters so TS can type infer them #113

Closed rbusquet closed 3 years ago

rbusquet commented 3 years ago

What: I'm removing type arguments passed explicitly to well-typed functions

Why: TS can infer the returned types when generics are used correctly. Passing types variables in runtime code should be used sparingly. TS contextual type checking will do its job.

How: I identified the places where types were passed explicitly and removed them. tested with the TS server and made sure type inference is working correclty.

Checklist:

codecov[bot] commented 3 years ago

Codecov Report

Merging #113 (ddd4bb8) into master (f6180d7) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #113   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines          137       137           
  Branches        31        31           
=========================================
  Hits           137       137           
Impacted Files Coverage Δ
src/index.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f6180d7...ddd4bb8. Read the comment docs.

kentcdodds commented 3 years ago

@All-contributors please add @rbusquet for code

allcontributors[bot] commented 3 years ago

@kentcdodds

I've put up a pull request to add @rbusquet! :tada:

github-actions[bot] commented 3 years ago

:tada: This PR is included in version 6.0.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: