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(client+server): non-records inferred as records when serializing as json #5077
Conversation
The latest updates on your projects. Learn more about Vercel for Git βοΈ
1 Ignored Deployment
|
cbac018
to
2bbd6af
Compare
Should we have some sort of kitchen sink test somewhere that tests a huge vomitous mass of different inference scenarios? Kind of unfortunate how much we are breaking userland rn with these :( This current issue is part of a chain reaction from #4985 |
@@ -18,6 +18,8 @@ type IsAny<T> = 0 extends T & 1 ? true : false; | |||
// support it as both a Primitive and a NonJsonPrimitive | |||
type JsonReturnable = JsonPrimitive | undefined; | |||
|
|||
type IsRecord<T> = keyof WithoutIndexSignature<T> extends never ? true : false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll change this to have an object check as well. Even though no tests fail, this is still too broad
zArray: z.array(z.string()), | ||
zRecord: z.record(z.string()), | ||
zTuple: z.tuple([z.string(), z.number()]), | ||
zUnion: z.union([z.string(), z.number()]), | ||
zIntersection: z.intersection( | ||
z.object({ name: z.string() }), | ||
z.object({ age: z.number() }), | ||
), | ||
zLazy: z.lazy(() => z.string()), | ||
zPromise: z.promise(z.string()), | ||
zFunction: z.function(), | ||
zMap: z.map(z.string(), z.number()), | ||
zSet: z.set(z.string()), | ||
zEnum: z.enum(['foo', 'bar']), | ||
zNativeEnum: z.nativeEnum({ foo: 1, bar: 2 }), | ||
zUnknown: z.unknown(), | ||
zNullable: z.nullable(z.string()), | ||
zOptional: z.optional(z.string()), | ||
zLiteral: z.literal('foo'), | ||
zBoolean: z.boolean(), | ||
zString: z.string(), | ||
zNumber: z.number(), | ||
zBigint: z.bigint(), | ||
zDate: z.date(), | ||
zUndefined: z.undefined(), | ||
zAny: z.any(), | ||
zArrayOptional: z.array(z.string()).optional(), | ||
zArrayOrRecord: z.union([z.array(z.string()), z.record(z.string())]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
woah that's extensive
@KATT I was just about to change the |
[![Mend Renovate logo banner](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@trpc/client](https://trpc.io) ([source](https://togithub.com/trpc/trpc)) | [`10.43.7` -> `10.44.0`](https://renovatebot.com/diffs/npm/@trpc%2fclient/10.43.7/10.44.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@trpc%2fclient/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@trpc%2fclient/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@trpc%2fclient/10.43.7/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@trpc%2fclient/10.43.7/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [@trpc/next](https://trpc.io) ([source](https://togithub.com/trpc/trpc)) | [`10.43.7` -> `10.44.0`](https://renovatebot.com/diffs/npm/@trpc%2fnext/10.43.7/10.44.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@trpc%2fnext/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@trpc%2fnext/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@trpc%2fnext/10.43.7/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@trpc%2fnext/10.43.7/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [@trpc/react-query](https://trpc.io) ([source](https://togithub.com/trpc/trpc)) | [`10.43.7` -> `10.44.0`](https://renovatebot.com/diffs/npm/@trpc%2freact-query/10.43.7/10.44.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@trpc%2freact-query/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@trpc%2freact-query/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@trpc%2freact-query/10.43.7/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@trpc%2freact-query/10.43.7/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [@trpc/server](https://trpc.io) ([source](https://togithub.com/trpc/trpc)) | [`10.43.7` -> `10.44.0`](https://renovatebot.com/diffs/npm/@trpc%2fserver/10.43.7/10.44.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@trpc%2fserver/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@trpc%2fserver/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@trpc%2fserver/10.43.7/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@trpc%2fserver/10.43.7/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>trpc/trpc (@​trpc/client)</summary> ### [`v10.44.0`](https://togithub.com/trpc/trpc/releases/tag/v10.44.0) [Compare Source](https://togithub.com/trpc/trpc/compare/v10.43.7...v10.44.0) #### What's Changed - fix(client+server): non-records inferred as records when serializing as json by [@​jussisaurio](https://togithub.com/jussisaurio) in [trpc/trpc#5077 - fix(server): Response meta headers type by [@​AlexXanderGrib](https://togithub.com/AlexXanderGrib) in [trpc/trpc#5074 - feat(react): allow conditional ssr based on context by [@​jonluca](https://togithub.com/jonluca) in [trpc/trpc#4997 - fix(server): constrain the IsRecord utility type to objects by [@​jussisaurio](https://togithub.com/jussisaurio) in [trpc/trpc#5081 #### New Contributors - [@​jonluca](https://togithub.com/jonluca) made their first contribution in [trpc/trpc#4997 **Full Changelog**: trpc/trpc@v10.43.7...v10.44.0 </details> --- ### Configuration π **Schedule**: Branch creation - "after 3am,before 9am" (UTC), Automerge - "after 3am,before 9am" (UTC). π¦ **Automerge**: Enabled. β» **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. π **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/ettorepuccetti/terrarossa). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy41OS44IiwidXBkYXRlZEluVmVyIjoiMzcuNTkuOCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[![Mend Renovate logo banner](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@tabler/icons-react](https://tabler-icons.io) ([source](https://togithub.com/tabler/tabler-icons)) | [`2.41.0` -> `2.42.0`](https://renovatebot.com/diffs/npm/@tabler%2ficons-react/2.41.0/2.42.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@tabler%2ficons-react/2.42.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@tabler%2ficons-react/2.42.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@tabler%2ficons-react/2.41.0/2.42.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@tabler%2ficons-react/2.41.0/2.42.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [@trpc/client](https://trpc.io) ([source](https://togithub.com/trpc/trpc)) | [`10.43.7` -> `10.44.0`](https://renovatebot.com/diffs/npm/@trpc%2fclient/10.43.7/10.44.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@trpc%2fclient/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@trpc%2fclient/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@trpc%2fclient/10.43.7/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@trpc%2fclient/10.43.7/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [@trpc/next](https://trpc.io) ([source](https://togithub.com/trpc/trpc)) | [`10.43.7` -> `10.44.0`](https://renovatebot.com/diffs/npm/@trpc%2fnext/10.43.7/10.44.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@trpc%2fnext/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@trpc%2fnext/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@trpc%2fnext/10.43.7/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@trpc%2fnext/10.43.7/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [@trpc/react-query](https://trpc.io) ([source](https://togithub.com/trpc/trpc)) | [`10.43.7` -> `10.44.0`](https://renovatebot.com/diffs/npm/@trpc%2freact-query/10.43.7/10.44.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@trpc%2freact-query/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@trpc%2freact-query/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@trpc%2freact-query/10.43.7/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@trpc%2freact-query/10.43.7/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [@trpc/server](https://trpc.io) ([source](https://togithub.com/trpc/trpc)) | [`10.43.7` -> `10.44.0`](https://renovatebot.com/diffs/npm/@trpc%2fserver/10.43.7/10.44.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@trpc%2fserver/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@trpc%2fserver/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@trpc%2fserver/10.43.7/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@trpc%2fserver/10.43.7/10.44.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [@types/react-dom](https://togithub.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-dom) ([source](https://togithub.com/DefinitelyTyped/DefinitelyTyped)) | [`18.2.16` -> `18.2.17`](https://renovatebot.com/diffs/npm/@types%2freact-dom/18.2.16/18.2.17) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@types%2freact-dom/18.2.17?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@types%2freact-dom/18.2.17?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@types%2freact-dom/18.2.16/18.2.17?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@types%2freact-dom/18.2.16/18.2.17?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>tabler/tabler-icons (@​tabler/icons-react)</summary> ### [`v2.42.0`](https://togithub.com/tabler/tabler-icons/releases/tag/v2.42.0): Release 2.42.0 [Compare Source](https://togithub.com/tabler/tabler-icons/compare/v2.41.0...v2.42.0) <img src="https://github.com/tabler/tabler-icons/assets/1282324/00856af9-841d-4aa9-995d-121c7ddcc005" width="584" alt="" /> ##### 18 new icons: - `calendar-dot` - `copy-check` - `copy-minus` - `copy-plus` - `copy-x` - `folder-root` - `gymnastics` - `layout-bottombar-inactive` - `layout-navbar-inactive` - `layout-sidebar-inactive` - `layout-sidebar-right-inactive` - `library-minus` - `library-photo` - `library-plus` - `library` - `message-reply` - `scuba-diving` - `snowboarding` Fixed icons: `copy`, `message-chatbot`, `message-forward`, `message-report` </details> <details> <summary>trpc/trpc (@​trpc/client)</summary> ### [`v10.44.0`](https://togithub.com/trpc/trpc/releases/tag/v10.44.0) [Compare Source](https://togithub.com/trpc/trpc/compare/v10.43.7...v10.44.0) #### What's Changed - fix(client+server): non-records inferred as records when serializing as json by [@​jussisaurio](https://togithub.com/jussisaurio) in [trpc/trpc#5077 - fix(server): Response meta headers type by [@​AlexXanderGrib](https://togithub.com/AlexXanderGrib) in [trpc/trpc#5074 - feat(react): allow conditional ssr based on context by [@​jonluca](https://togithub.com/jonluca) in [trpc/trpc#4997 - fix(server): constrain the IsRecord utility type to objects by [@​jussisaurio](https://togithub.com/jussisaurio) in [trpc/trpc#5081 #### New Contributors - [@​jonluca](https://togithub.com/jonluca) made their first contribution in [trpc/trpc#4997 **Full Changelog**: trpc/trpc@v10.43.7...v10.44.0 </details> --- ### Configuration π **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). π¦ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. β» **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. π» **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/weareinreach/GLAAD). PR-URL: #258 Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Closes #5075
π― Changes
π
β Checklist