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(types): add support for size and rename fieldtransformers #462

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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

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.

@@ -75,3 +111,14 @@ export type PickWithFieldFilters<
>
>
>

// 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?

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