Skip to content

Conversation

@Eazash
Copy link

@Eazash Eazash commented Sep 17, 2025

Resolves #252

This PR adds an explicit check for key-optional properties in the StripEnums utility. This ensures that key-optional properies are not cast as any and preserve their signature

@pi0 pi0 requested a review from danielroe September 17, 2025 11:22
@codecov
Copy link

codecov bot commented Sep 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.73%. Comparing base (afdf7cb) to head (bcc17bd).
⚠️ Report is 94 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #253      +/-   ##
==========================================
+ Coverage   89.40%   93.73%   +4.33%     
==========================================
  Files           5       10       +5     
  Lines         434      447      +13     
  Branches       37       93      +56     
==========================================
+ Hits          388      419      +31     
+ Misses         46       28      -18     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

? undefined
: any;

export type StripEnums<T extends Record<string, any>> = {

Choose a reason for hiding this comment

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

Why not simply:

Suggested change
export type StripEnums<T extends Record<string, any>> = {
export type StripEnums<T extends Record<string, any>> = {
[K in keyof T]: NonNullable<T[K]> extends number ? any : T[K];
};

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.

StripEnums drops types for key-optional fields

3 participants