Skip to content

Conversation

@Mrtenz
Copy link
Member

@Mrtenz Mrtenz commented Apr 3, 2025

never is a subtype of all types, so in this case, if Schema[K] is never, K is used:

Schema[K] extends ExactOptionalStruct<any, any> ? K : never;

This is problematic when using a struct type like Record<string, never>. This was previously incorrectly changed into Record<string, undefined>. After this change, the type is not affected.

@Mrtenz Mrtenz marked this pull request as ready for review April 3, 2025 13:28
@Mrtenz Mrtenz requested a review from a team April 3, 2025 13:28
Copy link

@hmalik88 hmalik88 left a comment

Choose a reason for hiding this comment

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

Maybe we should add some tests for these utils?

@Mrtenz Mrtenz force-pushed the mrtenz/fix-never-type branch from e16b153 to 802df0b Compare April 3, 2025 15:23
Copy link
Member

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

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

LGTM!

@Mrtenz Mrtenz enabled auto-merge (squash) April 3, 2025 15:29
@Mrtenz Mrtenz merged commit 367fa86 into main Apr 3, 2025
21 checks passed
@Mrtenz Mrtenz deleted the mrtenz/fix-never-type branch April 3, 2025 15:33
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.

4 participants