Skip to content

fix(tsconfig): preserve types for key-optional properties#253

Open
Eazash wants to merge 4 commits intounjs:mainfrom
Eazash:fix/preserve-key-optionals
Open

fix(tsconfig): preserve types for key-optional properties#253
Eazash wants to merge 4 commits intounjs:mainfrom
Eazash:fix/preserve-key-optionals

Conversation

@Eazash
Copy link
Copy Markdown

@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
Copy Markdown

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.

Comment thread src/tsconfig/types.ts
? undefined
: any;

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

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

4 participants