the-dr-lazy / deox

Functional Type-safe Flux Standard Utilities
https://deox.js.org
MIT License
206 stars 12 forks source link

Support mixed keys for ofType RxJS operator #133

Closed kotarella1110 closed 4 years ago

kotarella1110 commented 4 years ago

I changed the ofType RxJS operator to use isOfType helper function too! We can pass to ofType with array mix of action type, action, and action creator as follows.

const b = createActionCreator('b');
const c = createActionCreator('c');
action$.pipe(
  ofType('a', b(), c),
    ...
)
codecov[bot] commented 4 years ago

Codecov Report

Merging #133 into next will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@         Coverage Diff         @@
##           next   #133   +/-   ##
===================================
  Coverage   100%   100%           
===================================
  Files        10     10           
  Lines        59     60    +1     
  Branches     12     12           
===================================
+ Hits         59     60    +1
Impacted Files Coverage Δ
src/of-type.ts 100% <100%> (ø) :arrow_up:

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 cc01d9d...d3f2f27. Read the comment docs.

the-dr-lazy commented 4 years ago

I changed the ofType RxJS operator to use isOfType helper function too!

Let's do it in another PR.

kotarella1110 commented 4 years ago

I changed the ofType RxJS operator to use isOfType helper function too!

Let's do it in another PR.

OK! In anothor PR, the code is as follows.

export function ofType<
  TSource extends AnyAction,
  TKey extends string | AnyAction | ActionCreator<AnyAction>,
  TSink extends TSource = ExtractAction<TKey, TSource>
>(keys: TKey | ReadonlyArray<TKey>) {
  return filter<TSource, TSink>(isOfType(keys))
}

Also, May I fix the generics of isOfType helper function to follow RxJS convention?

kotarella1110 commented 4 years ago

After this PR is merged, I willl change the ofType RxJS operator to use isOfType helper function 💚

the-dr-lazy commented 4 years ago

Well done @kotarella1110.

the-dr-lazy commented 4 years ago

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

The release is available on:

Your semantic-release bot :package::rocket:

the-dr-lazy commented 4 years ago

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

The release is available on:

Your semantic-release bot :package::rocket: