Conversation
src/index.ts
Outdated
| export type Scope<T, R> = string | number | Lens<T, R>; | ||
|
|
||
| export function pick(selector: Selector | string) { | ||
| export function pick<T>(selector: Selector | string) { |
There was a problem hiding this comment.
Hi @goodmind, thanks for the PR.
Could you revert the changes in this part? I know it makes the typings generic for any stream library, but I don't want to make these typings less useful for xstream users. I think the approach should be like in Cycle DOM or Cycle HTTP, where RxJS users import rxjs-typings.d.ts. If that's not possible, then RxJS and most.js users should just use any casting.
There was a problem hiding this comment.
Maybe we can use here generic defaults microsoft/TypeScript#13487
There was a problem hiding this comment.
It will be even better if TypeScript supports Higher Kinded Types
There was a problem hiding this comment.
We can when TypeScript 2.3 is out. https://github.com/Microsoft/TypeScript/milestone/38
We can either revert these changes, and later update to 2.3, or wait until 2.3 is out.
src/index.ts
Outdated
| export function mix(aggregator: Aggregator) { | ||
| return function mixOperator(streamArray$: Stream<Array<Stream<any>>>): Stream<any> { | ||
| return streamArray$ | ||
| export function mix<T>(aggregator: Aggregator) { |
src/index.ts
Outdated
| const get = makeGetter(scope); | ||
| return new StateSource<R>( | ||
| this.state$.map(get).filter(s => typeof s !== 'undefined'), | ||
| xs.fromObservable<T>(this.state$).map(get).filter(s => typeof s !== 'undefined'), |
There was a problem hiding this comment.
We can avoid this one since RxJS/xstream/most.js all have map and filter. It should save us something in performance.
There was a problem hiding this comment.
According to #26
This stream passed to constructor where compose called on it
src/index.ts
Outdated
| sources[name] = new StateSource<any>(state$, name) as any; | ||
| const sinks = main(sources as So); | ||
| reducerMimic$.imitate(sinks[name]); | ||
| const imitation$ = sinks[name] && xs.fromObservable(sinks[name]); |
There was a problem hiding this comment.
I don't understand why this line is needed.
There was a problem hiding this comment.
Because without it tests failing, there is two tests with undefined sink and when we do xs.fromObservable(undefined) it fails
There was a problem hiding this comment.
Okay. Can we use a traditional if ( ) { block here?
Remove generic type params until TypeScript 2.3 is out
|
@staltz any comments? |
|
Looks good, thanks @goodmind |
|
New version v3.2.0 |
No description provided.