Skip to content

fix(types): add support for size and rename fieldtransformers#462

Open
Birkbjo wants to merge 2 commits intomasterfrom
fix/pick-with-field-filter-support-transformers
Open

fix(types): add support for size and rename fieldtransformers#462
Birkbjo wants to merge 2 commits intomasterfrom
fix/pick-with-field-filter-support-transformers

Conversation

@Birkbjo
Copy link
Member

@Birkbjo Birkbjo commented Dec 5, 2024

Im not sure if we want to maintain or use this anymore - and we could probably get away by using our zod-schemas as a source of truth for the types...

We recently used size and rename field transformers in categoryCombos/Edit to get the number of categoryOptions within category. . This would cause the inferred type from PickWithFieldFilters to be incorrect. This should add support for ~rename and ~size field-transformers.

  • original~rename(newName) will rename the property in the type.
  • ~size will cause the type of the property to be number. Note that there's no real validation on this, is just enforces the type to be number.
  • These work when chained, and in any order.
  • Some limitations

@netlify
Copy link

netlify bot commented Dec 5, 2024

Deploy Preview for dhis2-maintenance-app-beta ready!

Name Link
🔨 Latest commit 8b72712
🔍 Latest deploy log https://app.netlify.com/sites/dhis2-maintenance-app-beta/deploys/6751df5b715c9d00083e51fc
😎 Deploy Preview https://deploy-preview-462--dhis2-maintenance-app-beta.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

>
>

// type Test = PickWithFieldFilters<
Copy link
Contributor

Choose a reason for hiding this comment

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

ANy reason why you want to keep this code in?

@sonarqubecloud
Copy link

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.

2 participants

Comments