Skip to content

fix(Forms): enhance typing for FieldBlock and useFieldProps #4785

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

Merged
merged 5 commits into from
Mar 20, 2025

Conversation

langz
Copy link
Contributor

@langz langz commented Mar 19, 2025

Motivation: https://dnb-it.slack.com/archives/CMXABCHEY/p1742375173085389
Fixes #4771

CSB of the issue: https://codesandbox.io/p/sandbox/eloquent-tharp-z9pck9

For now, I've just added a stor, but not sure if that's too helpful as I don't believe the TypeScript settings in this repo is strict enough to catch/display the same errors as in the CSB of the issue.

Copy link

vercel bot commented Mar 19, 2025

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 Mar 20, 2025 2:18pm

@langz langz force-pushed the fix/typing-issues-field-props-field-block branch from d7abdf6 to 94f7b80 Compare March 19, 2025 14:52
Copy link

codesandbox-ci bot commented Mar 19, 2025

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.

@tujoworker tujoworker changed the title fix(FieldBlock) typing issues with FieldProps fix(FieldBlock): typing issues with FieldProps Mar 19, 2025
@tujoworker tujoworker changed the title fix(FieldBlock): typing issues with FieldProps fix(FieldBlock): enhance typing for FieldBlock and useFieldProps Mar 20, 2025
Copy link
Member

@tujoworker tujoworker left a comment

Choose a reason for hiding this comment

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

To test the changes, we need to enable strict mode.
Also, I look into if its possible to enable strict mode for some files only. But that is really not possible in a good way – as of now. But this would be an important step towards safer types, when a consumer uses strict mode, which is often the case.

@tujoworker tujoworker changed the title fix(FieldBlock): enhance typing for FieldBlock and useFieldProps fix(Forms): enhance typing for FieldBlock and useFieldProps Mar 20, 2025
@langz
Copy link
Contributor Author

langz commented Mar 20, 2025

To test the changes, we need to enable strict mode.

Also, I look into if its possible to enable strict mode for some files only. But that is really not possible in a good way – as of now. But this would be an important step towards safer types, when a consumer uses strict mode, which is often the case.

Agree, sounds very nice to have🤌

@tujoworker tujoworker merged commit 64070a6 into main Mar 20, 2025
10 checks passed
@tujoworker tujoworker deleted the fix/typing-issues-field-props-field-block branch March 20, 2025 15:17
@tujoworker
Copy link
Member

I'll add a bunch of links that we can follow in order to watch the progress of such a TypeScript feaeture

tujoworker pushed a commit that referenced this pull request Mar 21, 2025
## [10.69.0](v10.68.1...v10.69.0) (2025-03-21)

### ✨ Features

* **Field.SelectCountry:** add `autoComplete` support ([#4781](#4781)) ([176760b](176760b))
* **Field.SelectCountry:** enhance value type ([#4782](#4782)) ([a51ec61](a51ec61))
* **Forms:** add `CountryISO` as the value type to Field.SelectCountry ([#4791](#4791)) ([b8491ed](b8491ed))
* **Forms:** add `Field.SelectCurrency` and `Value.SelectCurrency` ([#4770](#4770)) ([279d03e](279d03e))
* **InfoCard:** add `stretch` property and don't stretch by default ([#4765](#4765)) ([d7c850d](d7c850d))
* **NumberFormat:** use component's translation for invalid aria text ([#4763](#4763)) ([f446639](f446639))
* **Table:** add view transition support to inserted table rows (accordion) ([#4764](#4764)) ([29273c8](29273c8))

### 📝 Documentation

* add link to localization docs in portal tools menu ([#4762](#4762)) ([d39353b](d39353b))
* **DatePicker:** add rationale behind why `correctInvalidDate` is not on by default ([#4776](#4776)) ([c414463](c414463))
* **Field.SelectCountry:** improve event arguments ([#4784](#4784)) ([644f9e8](644f9e8))
* **Forms:** add example on how to use `onInput` ([#4792](#4792)) ([2294b68](2294b68))

### 🐛 Bug Fixes

* **Forms:** don't show Wizard step error on small screens for the same step ([#4774](#4774)) ([74afa5e](74afa5e))
* **Forms:** enhance typing for `FieldBlock` and `useFieldProps` ([#4785](#4785)) ([64070a6](64070a6))
* **Forms:** ensure Wizard does not show invalid error ([#4786](#4786)) ([e5f913c](e5f913c))
* **NumberFormat:** ensure -0 is displayed as 0 when formatted as currency ([#4788](#4788)) ([aa02d37](aa02d37)), closes [#4691](#4691)
@tujoworker
Copy link
Member

🎉 This PR is included in version 10.69.0 🎉

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.

Type issues with FieldsProps and FieldBlock
2 participants