Skip to content

Update typings#493

Merged
arunoda merged 1 commit intostorybookjs:masterfrom
mkozhukharenko:patch-1
Sep 25, 2016
Merged

Update typings#493
arunoda merged 1 commit intostorybookjs:masterfrom
mkozhukharenko:patch-1

Conversation

@mkozhukharenko
Copy link
Copy Markdown
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
Copy Markdown
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
@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Mar 26, 2025

View your CI Pipeline Execution ↗ for commit 1ab7efe

Command Status Duration Result
nx run-many -t build --parallel=3 ✅ Succeeded 46s View ↗

☁️ Nx Cloud last updated this comment at 2025-09-23 18:27:23 UTC

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.

3 participants