Skip to content

Commit

Permalink
Fix Reducer type import
Browse files Browse the repository at this point in the history
  • Loading branch information
jvanbruegge committed Apr 15, 2017
1 parent a561a0c commit 3488825
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/cycle-scripts/template/src/javascript/app.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module.exports = replacements => `${replacements.import}
const initalState = { count: 0 }
export function App (sources) {
const action$ = intent(sources.DOM)
const model$ = model(action$)
Expand All @@ -11,8 +13,6 @@ export function App (sources) {
return sinks
}
const initalState = { count: 0 }
function intent(DOM) {
const add$ = DOM.select('.add').events('click')
.${replacements.mapTo}(prevState => ({ ...prevState, count: prevState.count + 1 }))
Expand Down
8 changes: 4 additions & 4 deletions packages/cycle-scripts/template/src/typescript/app.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
module.exports = replacements => `${replacements.import}
${replacements.typeImport}
import { DOMSource, VNode } from '@cycle/dom'
import { Sources, Sinks, Reducer } from './interfaces'
import { Sources, Sinks } from './interfaces'
export type AppState = {
count : number;
count : number
}
export type AppReducer = (prevState : AppState) => AppState
const initalState : AppState = { count: 0 }
export function App({ DOM } : Sources) : Sinks {
const action$ : ${replacements.streamType}<AppReducer> = intent(DOM)
const model$ : ${replacements.streamType}<AppState> = model(action$)
Expand All @@ -18,8 +20,6 @@ export function App({ DOM } : Sources) : Sinks {
}
}
const initalState : AppState = { count: 0 }
function intent(DOM : DOMSource) : ${replacements.streamType}<AppReducer> {
const add$ = DOM.select('.add').events('click')
.${replacements.mapTo}(prevState => ({ ...prevState, count: prevState.count + 1 }))
Expand Down

0 comments on commit 3488825

Please sign in to comment.