Skip to content

@storybook/addon-knobs: groupId - #24797

Merged
mhegazy merged 5 commits into
DefinitelyTyped:masterfrom
joscha:joscha/addon-knobs-group
Apr 11, 2018
Merged

mhegazy merged 5 commits into
DefinitelyTyped:masterfrom
joscha:joscha/addon-knobs-group

Conversation

@joscha

@joscha joscha commented Apr 8, 2018 •

Copy link
Copy Markdown
Contributor

Please fill in this template.

  • Use a meaningful title for the pull request. Include the name of the package modified.

  • Test the change in your own code. (Compile and run.)

  • Add or edit tests to reflect the change. (Run with npm test.)

  • Follow the advice from the readme.

  • Avoid common mistakes.

  • Run npm run lint package-name (or tsc if no tslint.json is present).

  • Provide a URL to documentation or source code which provides context for the suggested changes: @storybook/addon-knobs wrong types for typescript in @types/storybook__addon-knobs storybookjs/storybook#3374,

  • Increase the version number in the header if appropriate.

  • If you are making substantial changes, consider adding a tslint.json containing { "extends": "dtslint/dt.json" }.

@typescript-bot

typescript-bot commented Apr 8, 2018 •

Copy link
Copy Markdown
Contributor

@joscha Thank you for submitting this PR!

🔔 @martynaskadisa - please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead.

@typescript-bot

typescript-bot commented Apr 8, 2018 •

Copy link
Copy Markdown
Contributor

@joscha The Travis CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks!

@typescript-bot

Copy link
Copy Markdown
Contributor

A definition author has approved this PR ⭐️. A maintainer will merge this PR shortly. If it shouldn't be merged yet, please leave a comment saying so and we'll wait. Thank you for your contribution to DefinitelyTyped!

Comment thread types/storybook__addon-knobs/index.d.ts Outdated
max: number;
step: number;
}
} | {};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{} is a super type of any other type. so this type is basically {} which is almost any.

did you mean to make the properties optional instead?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e.g.:

{
     range?: boolean;
     min?: number;
     max?: number;
     step?: number;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also switching from interface to type is a breaking change to users who can extend this type today. if you do not think users are doing this today, then it should be fine.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The {} is deliberate, we either need to pass all of them or the default options when omitting them (e.g. an empty object).
Regarding the interface change, I don't think people would extend, but you never know, so I will create an intermediate type.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The {} is deliberate, we either need to pass all of them or the default options when omitting them (e.g. an empty object).

then write it as:

{
     range: boolean;
     min: number;
     max: number;
     step: number;
} | {
     range?: undefined;
     min?: undefined;
     max?: undefined;
     step?: undefined;
};

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, ptal

@typescript-bot typescript-bot added Revision needed This PR needs code changes before it can be merged. and removed Merge:Express labels Apr 9, 2018
@typescript-bot typescript-bot added The Travis CI build failed and removed Revision needed This PR needs code changes before it can be merged. labels Apr 10, 2018
@mhegazy

mhegazy commented Apr 10, 2018

Copy link
Copy Markdown
Contributor

@joscha there are a couple of lint failures that were introduced. can you take a look.

@typescript-bot

Copy link
Copy Markdown
Contributor

🔔 @mhegazy - Thanks for your review of this PR! Can you please look at the new code and update your review status if appropriate?

@mhegazy
mhegazy merged commit ddfe9e6 into DefinitelyTyped:master Apr 11, 2018
@Pk-T

Pk-T commented Nov 5, 2018 •

Copy link
Copy Markdown

Few knob types like radio, button are missing definition, maybe it got introduced later in storybook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author is Owner The author of this PR is a listed owner of the package.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants