Skip to content
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

hide never values in intellisense for jsonify #3264

Merged
merged 3 commits into from
Nov 26, 2022
Merged

Conversation

sachinraja
Copy link
Member

continuation of #3261

@vercel
Copy link

vercel bot commented Nov 25, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
next-prisma-starter ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Nov 26, 2022 at 10:30PM (UTC)
www ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Nov 26, 2022 at 10:30PM (UTC)

Copy link
Member

@KATT KATT left a comment

Choose a reason for hiding this comment

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

Comment on lines +62 to +65
Pick<T, FilterDefinedKeys<T>> & {
// Property _is_ a union with `defined`. Set as optional (via `?`) and remove `undefined` from the union
[k in keyof Omit<T, FilterDefinedKeys<T>>]?: Exclude<T[k], undefined>;
};
Copy link
Member

@KATT KATT Nov 26, 2022

Choose a reason for hiding this comment

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

This looks quite "heavy" but before looked heavy too... reminds me of our OmitNeverKeys that ended up being slow.

FWIW, I think it's fine to expose never keys.... maybe an even better thing would be some DX like this:

const output = {
  bigint: 0n,
}

// ... then
serializedOutput.bigint
//                ^? Error<"This type is not JSON-serializable">

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah this is the same as before, I just refactored it a bit. This part doesn't change with the never keys. It just has to be done unless we somehow come up with something more optimized.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants