<commit_before>/* @flow */

import {element} from 'deku'
import dscript from 'dscript'
import {increment, decrement, incrementAsync} from './actions'

const {div, button} = dscript(element)

function dispatchEvent(dispatch: Dispatch, action: Action | Thunk): (ev: Event) => void {
    return function(ev: Event) {
        dispatch(action)
    }
}

// see https://github.com/facebook/flow/issues/307
// can't type-annotate directly when destructuring args.
type renderArgs = {dispatch: Dispatch, context: State}
export default function render({dispatch, context}: renderArgs): VirtualElement {
    return (
        div([
            `Hello! ${context.value}`,
            button({class: 'button', onClick: dispatchEvent(dispatch, increment())}, ['Increment']),
            button({class: 'button', onClick: dispatchEvent(dispatch, decrement())}, ['Decrement']),
            button({class: 'button', onClick: dispatchEvent(dispatch, incrementAsync())}, ['IncAsync']),
        ])
    )
}<commit_msg>add more specific type definitions<commit_after>/* @flow */

import {element} from 'deku'
import dscript from 'dscript'
import {increment, decrement, incrementAsync} from './actions'

const {div, button} = dscript(element)

function dispatchEvent(dispatch: Dispatch, action: Action | Thunk): (ev: Event) => void {
    return function(ev: Event) {
        dispatch(action)
    }
}

// see https://github.com/facebook/flow/issues/307
// can't type-annotate directly when destructuring args.
type RenderArgs = {dispatch: Dispatch, context: State}
export default function render({dispatch, context}: RenderArgs): VirtualElement {
    return (
        div([
            `Hello! ${context.value}`,
            button({class: 'button', onClick: dispatchEvent(dispatch, increment())}, ['Increment']),
            button({class: 'button', onClick: dispatchEvent(dispatch, decrement())}, ['Decrement']),
            button({class: 'button', onClick: dispatchEvent(dispatch, incrementAsync())}, ['IncAsync']),
        ])
    )
}
{'fraction_non_alphanumeric': 0.15201192250372578, 'fraction_numerical': 0.0029806259314456036, 'mean_word_length': 3.9484029484029484, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4965337', 'n_tokens_mistral': 559, 'n_tokens_neox': 551, 'n_words': 156}