@cycle/run
Advanced tools
Comparing version 5.2.0-rc.0 to 5.2.0-rc.1
import { CycleProgram, DisposeFunction, Drivers, MatchingDrivers, MatchingMain, Engine } from './types'; | ||
export { FantasyObserver, FantasySubscription, FantasyObservable, DevToolEnabledSource, Sources, Sinks, SinkProxies, Driver, Drivers, DisposeFunction, MatchingDrivers, MatchingMain, Main, CycleProgram, Engine, } from './types'; | ||
export { FantasyObserver, FantasySubscription, FantasyObservable, DevToolEnabledSource, Sources, Sinks, SinkProxies, Driver, Drivers, DisposeFunction, MatchingDrivers, MatchingMain, Main, CycleProgram, Engine, ToStream, } from './types'; | ||
/** | ||
@@ -4,0 +4,0 @@ * A function that prepares the Cycle application to be executed. Takes a `main` |
@@ -35,4 +35,6 @@ import { Stream } from 'xstream'; | ||
export declare type ToStream<S> = S extends FantasyObservable<infer T> ? Stream<T> : S; | ||
export declare type WidenStream<S, U> = S extends Stream<infer T> ? (T extends U ? U : never) : never; | ||
export declare type GetValidInputs<D extends Driver<any, any>> = D extends Driver<infer S, any> ? (S extends Stream<infer T> ? T : never) : never; | ||
export declare type MatchingDrivers<D extends Drivers, M extends Main> = Drivers & { | ||
[k in string & keyof Sinks<M>]: (() => Sources<D>[k]) | ((si: ToStream<Sinks<M>[k]>) => Sources<D>[k]); | ||
[k in string & keyof Sinks<M>]: (() => Sources<D>[k]) | ((si: Stream<WidenStream<ToStream<Sinks<M>[k]>, GetValidInputs<D[k]>>>) => Sources<D>[k]); | ||
}; | ||
@@ -39,0 +41,0 @@ export interface CycleProgram<D extends MatchingDrivers<D, M>, M extends MatchingMain<D, M>> { |
import { CycleProgram, DisposeFunction, Drivers, MatchingDrivers, MatchingMain, Engine } from './types'; | ||
export { FantasyObserver, FantasySubscription, FantasyObservable, DevToolEnabledSource, Sources, Sinks, SinkProxies, Driver, Drivers, DisposeFunction, MatchingDrivers, MatchingMain, Main, CycleProgram, Engine, } from './types'; | ||
export { FantasyObserver, FantasySubscription, FantasyObservable, DevToolEnabledSource, Sources, Sinks, SinkProxies, Driver, Drivers, DisposeFunction, MatchingDrivers, MatchingMain, Main, CycleProgram, Engine, ToStream, } from './types'; | ||
/** | ||
@@ -4,0 +4,0 @@ * A function that prepares the Cycle application to be executed. Takes a `main` |
@@ -35,4 +35,6 @@ import { Stream } from 'xstream'; | ||
export declare type ToStream<S> = S extends FantasyObservable<infer T> ? Stream<T> : S; | ||
export declare type WidenStream<S, U> = S extends Stream<infer T> ? (T extends U ? U : never) : never; | ||
export declare type GetValidInputs<D extends Driver<any, any>> = D extends Driver<infer S, any> ? (S extends Stream<infer T> ? T : never) : never; | ||
export declare type MatchingDrivers<D extends Drivers, M extends Main> = Drivers & { | ||
[k in string & keyof Sinks<M>]: (() => Sources<D>[k]) | ((si: ToStream<Sinks<M>[k]>) => Sources<D>[k]); | ||
[k in string & keyof Sinks<M>]: (() => Sources<D>[k]) | ((si: Stream<WidenStream<ToStream<Sinks<M>[k]>, GetValidInputs<D[k]>>>) => Sources<D>[k]); | ||
}; | ||
@@ -39,0 +41,0 @@ export interface CycleProgram<D extends MatchingDrivers<D, M>, M extends MatchingMain<D, M>> { |
{ | ||
"name": "@cycle/run", | ||
"version": "5.2.0-rc.0", | ||
"version": "5.2.0-rc.1", | ||
"description": "The Cycle.js run() function to use with xstream", | ||
@@ -38,9 +38,9 @@ "license": "MIT", | ||
"@types/mocha": "5.2.x", | ||
"@types/node": "10.5.x", | ||
"@types/node": "10.12.x", | ||
"@types/sinon": "5.0.x", | ||
"mocha": "^5.2.0", | ||
"sinon": "^6.1.4", | ||
"ts-node": "^7.0.0", | ||
"sinon": "^7.1.1", | ||
"ts-node": "^7.0.1", | ||
"tslint": "^5.11.0", | ||
"typescript": "3.0.x", | ||
"typescript": "3.2.x", | ||
"xstream": "11.x" | ||
@@ -47,0 +47,0 @@ }, |
@@ -5,3 +5,3 @@ import {Stream} from 'xstream'; | ||
function getGlobal(): any { | ||
function getGlobal(this: any): any { | ||
let globalObj: any; | ||
@@ -8,0 +8,0 @@ if (typeof window !== 'undefined') { |
@@ -36,2 +36,3 @@ import { | ||
Engine, | ||
ToStream, | ||
} from './types'; | ||
@@ -38,0 +39,0 @@ |
@@ -49,2 +49,13 @@ import {Stream} from 'xstream'; | ||
export type WidenStream<S, U> = S extends Stream<infer T> | ||
? (T extends U ? U : never) | ||
: never; | ||
export type GetValidInputs<D extends Driver<any, any>> = D extends Driver< | ||
infer S, | ||
any | ||
> | ||
? (S extends Stream<infer T> ? T : never) | ||
: never; | ||
export type MatchingDrivers<D extends Drivers, M extends Main> = Drivers & | ||
@@ -54,3 +65,5 @@ { | ||
| (() => Sources<D>[k]) | ||
| ((si: ToStream<Sinks<M>[k]>) => Sources<D>[k]) | ||
| (( | ||
si: Stream<WidenStream<ToStream<Sinks<M>[k]>, GetValidInputs<D[k]>>> | ||
) => Sources<D>[k]) | ||
}; | ||
@@ -57,0 +70,0 @@ |
@@ -32,2 +32,14 @@ // tslint:disable-next-line | ||
it('should allow to have a driver that takes a union as input', function() { | ||
function app(so: {drv: Stream<string>}) { | ||
return { | ||
drv: xs.of('foo'), | ||
}; | ||
} | ||
const {sinks, sources} = setup(app, { | ||
drv: (s: Stream<string | number>) => xs.of('foo'), | ||
}); | ||
}); | ||
it('should allow to not use all sources in main', function() { | ||
@@ -34,0 +46,0 @@ function app(so: {first: Stream<string>}) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
112310
2124