Last active
January 29, 2018 14:59
-
-
Save ornicar/fc1d6a4b08bee7c8bcd64ffee55797e1 to your computer and use it in GitHub Desktop.
@cycle/storage is not typed like a Driver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xs,{Stream} from 'xstream' | |
import {run} from '@cycle/run' | |
import {DOMSource, makeDOMDriver, VNode} from '@cycle/dom' | |
import storageDriver,{StorageSource,StorageRequest} from '@cycle/storage' | |
export type Sources = { | |
DOM : DOMSource; | |
storage: StorageSource; | |
} | |
export type Sinks = { | |
DOM : Stream<VNode>; | |
storage: Stream<StorageRequest>; | |
} | |
function main(sources: Sources): Sinks { | |
return { | |
DOM: xs.empty(), | |
storage: xs.empty() | |
} | |
} | |
const drivers = { | |
DOM: makeDOMDriver('#root'), | |
storage: storageDriver | |
} | |
/* Argument of type '{ DOM: Driver<Stream<VNode>, MainDOMSource>; storage: (request$: Stream<StorageRequest>) => Respo...' | |
* is not assignable to parameter of type 'Drivers<Sources, Sinks>'. | |
* Types of property 'storage' are incompatible. | |
* Type '(request$: Stream<StorageRequest>) => ResponseCollection' is not assignable to type | |
* 'Driver<Stream<StorageRequest>, StorageSource>'. | |
* Type 'ResponseCollection' is not assignable to type 'StorageSource'. | |
* Property 'key' is missing in type 'ResponseCollection'. | |
*/ | |
run(main, drivers) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "storage-test", | |
"version": "0.1.0", | |
"devDependencies": { | |
"cycle-scripts": "2.1.0" | |
}, | |
"dependencies": { | |
"@cycle/dom": "^20", | |
"@cycle/run": "^4", | |
"@cycle/storage": "^5", | |
"awesome-typescript-loader": "3.2.3", | |
"typescript": "2.5.3", | |
"xstream": "11.0.0" | |
}, | |
"scripts": { | |
"start": "cycle-scripts start", | |
"test": "cycle-scripts test", | |
"build": "cycle-scripts build", | |
"eject": "cycle-scripts eject" | |
}, | |
"cca": { | |
"language": "typescript", | |
"streamLib": "xstream" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment