Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update typings #493

Merged
merged 1 commit into from Sep 25, 2016
Merged

Update typings #493

merged 1 commit into from Sep 25, 2016

Conversation

mkozhukharenko
Copy link
Contributor

  • add typings for linkTo addon
  • action must return any since it brakes typings chain

So, having such example leads to the typescript error
error TS2322: Type 'Function' is not assignable to type '(newVal: string) => void'.

interface Props {
    onChange?(newVal: string): void,
}

class ExampleComponent extends Component<Props, void> {
    render() {
        return (
                <input onChange={this.props.onChange}>Hi!</div>
        )
    }
}

storiesOf('Example', module)
        .add('Regular use case', () => (
                <ExampleComponent onChange={action('changed')}/>
        ))

* add typings for `linkTo` addon

* action must return `any` since it brakes typings chain

So, having such example leads to the typescript error 
`error TS2322: Type 'Function' is not assignable to type '(newVal: string) => void'.`

```js
interface Props {
    onChange?(newVal: string): void,
}

class ExampleComponent extends Component<Props, void> {
    render() {
        return (
                <input onChange={this.props.onChange}>Hi!</div>
        )
    }
}

storiesOf('Example', module)
        .add('Regular use case', () => (
                <ExampleComponent onChange={action('changed')}/>
        ))
```
@arunoda
Copy link
Member

arunoda commented Sep 25, 2016

Thanks.

@arunoda arunoda merged commit c026b65 into storybookjs:master Sep 25, 2016
@shilman shilman added the misc label May 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants