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

[FEATURE]: Add more flexible typing for usage with exactOptionalPropertyTypes #2742

Closed
fnimick opened this issue Aug 2, 2024 · 1 comment

Comments

@fnimick
Copy link

fnimick commented Aug 2, 2024

Describe what you want

When exactOptionalPropertyTypes is set in tsconfig, passing undefined to an optional property that does not explicitly allow undefined now becomes a type error.

Drizzle currently treats unset properties and properties with undefined keys the same in e.g. value objects, but the generated type for the argument to e.g. a .values() or a .set() only allows unset types, not optional ones.

Having looked at only the postgres core, I believe that .set() can be resolve by marking the optional properties as allowing undefined as well in https://github.com/drizzle-team/drizzle-orm/blob/main/drizzle-orm/src/pg-core/query-builders/update.ts#L32
and that .values() can be resolved by marking optional properties as allowing undefined as well in https://github.com/drizzle-team/drizzle-orm/blob/main/drizzle-orm/src/table.ts#L175

@fnimick fnimick added the enhancement New feature or request label Aug 2, 2024
@L-Mario564 L-Mario564 added improvement and removed enhancement New feature or request labels Oct 24, 2024
Sukairo-02 added a commit that referenced this issue Dec 11, 2024
….set()` args, rqb config to allow undefined to still be passed with `exactOptionalPropertyTypes` typescript flag set to `true` (issue #2742)
AndriiSherman added a commit that referenced this issue Dec 11, 2024
exactOptionalPropertyTypes improvements (issue #2742)
@AndriiSherman
Copy link
Member

Fixed in drizzle-orm@0.38.1

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

No branches or pull requests

3 participants