Skip to content

fix: preserve any type in Prettify utility type#8

Merged
mhweiner merged 1 commit into
logfoxai:mainfrom
technicalcandidate-stack:fix/prettify-any
Jan 30, 2026
Merged

fix: preserve any type in Prettify utility type#8
mhweiner merged 1 commit into
logfoxai:mainfrom
technicalcandidate-stack:fix/prettify-any

Conversation

@technicalcandidate-stack
Copy link
Copy Markdown
Contributor

The Prettify type was transforming any into { [x: string]: any } because mapped types over any produce an index signature.

This broke inference for any():
type T = Infer<typeof any()>; // was: { [x: string]: any }, should be: any

Fix by adding a guard that preserves any (and unknown):
any extends T ? T : { [K in keyof T]: T[K] } & {}

Without this guard, Prettify<any> was producing { [x: string]: any }
instead of preserving 'any'. This caused issues when using p.any()
in object schemas.

- Add conditional check: any extends T ? T : ...
- Add type-level tests for any() inference
@mhweiner mhweiner merged commit e1acfaf into logfoxai:main Jan 30, 2026
5 checks passed
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