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

TS: Make sure components with interfaces or no props don't raise decorator assignability issues #21833

Merged
merged 2 commits into from
Mar 31, 2023

Conversation

kasperpeulen
Copy link
Contributor

Closes #21768

What I did

When using interfaces as Props for a component, decorators give TS issues when it is not used inline (so as a seperate function).

I now convert Args defined as an interface into a type, to make sure we don't get those kind of assignability issues.

The Simplify type-fest utlity seems to well-suited for this purpose:

https://github.com/sindresorhus/type-fest/blob/2e498662b7cdb8e70fbaa9864d7d860e48983a40/source/simplify.d.ts#L1-L3

The actual change is in a package outside of the monorepo, see this PR:

ComponentDriven/csf#65

How to test

See the added unit tests.

Checklist

  • Make sure your changes are tested (stories and/or unit, integration, or end-to-end tests)
  • Make sure to add/update documentation regarding your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Maintainers

  • If this PR should be tested against many or all sandboxes,
    make sure to add the ci:merged or ci:daily GH label to it.
  • Make sure this PR contains one of the labels below.

["cleanup", "BREAKING CHANGE", "feature request", "bug", "documentation", "maintenance", "dependencies", "other"]

@kasperpeulen kasperpeulen force-pushed the kasper/fix-strict-args-decorator-with-interface branch from 6f00eb4 to a08ffc7 Compare March 31, 2023 08:42
Copy link
Member

@yannbf yannbf left a comment

Choose a reason for hiding this comment

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

LGTM!

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

Successfully merging this pull request may close these issues.

[Bug]: StrictArgs is causing issues when Component is using an interface as Props
2 participants