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

fix(Dropdown): correct 'data' type to support interface-based types #4383

Merged
merged 4 commits into from
Dec 11, 2024

Conversation

langz
Copy link
Contributor

@langz langz commented Dec 11, 2024

Fixes the following error when using an interface for the data property:

No overload matches this call.
  Overload 1 of 2, '(props: DropdownAllProps | Readonly<DropdownAllProps>): Dropdown', gave the following error.
    Type 'MyInterface[]' is not assignable to type 'DrawerListData'.
      Type 'MyInterface[]' is not assignable to type 'DrawerListDataArray'.
        Type 'MyInterface' is not assignable to type 'DrawerListDataArrayItem'.
          Type 'MyInterface' is not assignable to type 'DrawerListDataArrayObject'.
            Index signature for type 'string' is missing in type 'MyInterface'.
  Overload 2 of 2, '(props: DropdownAllProps, context: any): Dropdown', gave the following error.
    Type 'MyInterface[]' is not assignable to type 'DrawerListData'.ts(2769)

If I would use a type instead of an interface it will work.
Here's a CSB using interface, here's a CSB using type.
But shouldn't I be able to use an interface?

Here's a CSB using interface and the fix from this PR

Copy link

vercel bot commented Dec 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
eufemia ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 11, 2024 9:15am

@langz langz changed the title fix(Dropdown): fix using interface as type for data fix(Dropdown): fix use interface as type for data Dec 11, 2024
@langz langz requested review from snorrekim and tujoworker and removed request for snorrekim December 11, 2024 08:56
Copy link

codesandbox-ci bot commented Dec 11, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@langz langz requested a review from snorrekim December 11, 2024 09:06
@langz langz changed the title fix(Dropdown): fix use interface as type for data fix(Dropdown): fix interface as type for data Dec 11, 2024
@langz langz changed the title fix(Dropdown): fix interface as type for data fix(Dropdown): fix use interface as type for data Dec 11, 2024
@langz langz changed the title fix(Dropdown): fix use interface as type for data fix(Dropdown): fix use interface as type for data Dec 11, 2024
@tujoworker tujoworker changed the title fix(Dropdown): fix use interface as type for data fix(Dropdown): correct 'data' type to support interface-based types Dec 11, 2024
@langz langz merged commit 461e258 into main Dec 11, 2024
10 checks passed
@langz langz deleted the fix/data-interface branch December 11, 2024 10:45
tujoworker pushed a commit that referenced this pull request Dec 11, 2024
## [10.60.1](v10.60.0...v10.60.1) (2024-12-11)

### 🐛 Bug Fixes

* **Dropdown:** correct 'data' type to support interface-based types ([#4383](#4383)) ([461e258](461e258))
* **Forms:** ensure Tools.Log formats arrays with square brackets ([#4384](#4384)) ([7905694](7905694))
* **Upload:** add gap between file and remove button ([#4382](#4382)) ([04c1f6a](04c1f6a))
* **Upload:** avoid scrolling when removing file from list ([#4380](#4380)) ([43a64d4](43a64d4))
* **Upload:** handling of multiple async events ([#4378](#4378)) ([fd1fef9](fd1fef9))
@tujoworker
Copy link
Member

🎉 This PR is included in version 10.60.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

2 participants