-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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): enhance type safety of the AtLeast utility type #24056
base: main
Are you sure you want to change the base?
Conversation
Improve type inference accuracy by refining the AtLeast type definition, ensuring more reliable type safety across the Prisma codebase. This addresses issues with type intersection and extends compatibility with stricter type checks.
CodSpeed Performance ReportMerging #24056 will not alter performanceComparing Summary
|
Hi @de-novo! |
Hello @SevInf, Thank you for your feedback. The current implementation of the 'Property ‘id’ is optional in type ‘SupplierWhereUniqueInput’ but required in type ‘{ id: string | number; code: string | number; }’, has indeed led to some confusion during the development phase. To address this, I have opened issue #24055, proposing a change in the type definition from While type inference in both runtime and development environments is currently functioning correctly, the changes I've made were aimed at improving the type definitions. Given these improvements are more about refinement than fixing overt issues, I am unsure how to add tests that could effectively demonstrate the previous shortcomings of the AtLeast type. Could you provide specific scenarios or examples of the type of issues you would like these tests to address? Thank you for your assistance. |
Additionally, the type inference improvements suggested in issue #24055 could also benefit libraries like Typia, which utilize TypeScript types for validation. Currently, such libraries are unable to properly recognize the proposed types, rendering them unusable. However, it is expected that these improvements will resolve this issue. |
This pull request proposes improvements to the AtLeast utility type, as discussed in issue #24055 . The changes aim to address the issues highlighted in issue #20619 , specifically focusing on enhancing type inference accuracy and ensuring greater compatibility with stricter type checks. This PR introduces a refined type definition to mitigate problems related to type intersections and to bolster type safety within the Prisma codebase.