ts-safeql / safeql

Validate and auto-generate TypeScript types from raw SQL queries in PostgreSQL.
https://safeql.dev
MIT License
1.35k stars 22 forks source link

fix: infer array of union literals #254

Closed Newbie012 closed 3 months ago

Newbie012 commented 3 months ago

fixes https://github.com/ts-safeql/safeql/issues/234

vercel[bot] commented 3 months ago

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

1 Skipped Deployment | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **safeql** | ⬜️ Ignored ([Inspect](https://vercel.com/newbie012s-projects/safeql/Dhx8p1G7CKmGuyhAMPYodMqUgw5Y)) | [Visit Preview](https://safeql-git-fix-infer-array-of-union-7cc7fc-newbie012s-projects.vercel.app) | | Aug 8, 2024 9:50pm |
changeset-bot[bot] commented 3 months ago

🦋 Changeset detected

Latest commit: 7a9cecc8425f36d9960bf771e5b03f7cd558bdad

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 17 packages | Name | Type | | ---------------------------------------- | ----- | | @ts-safeql/eslint-plugin | Patch | | @ts-safeql-demos/basic-flat-config | Patch | | @ts-safeql-demos/basic-migrations-raw | Patch | | @ts-safeql-demos/basic-transform-type | Patch | | @ts-safeql-demos/basic | Patch | | @ts-safeql-demos/big-project | Patch | | @ts-safeql-demos/config-file-flat-config | Patch | | @ts-safeql-demos/from-config-file | Patch | | @ts-safeql-demos/multi-connections | Patch | | @ts-safeql-demos/playground | Patch | | @ts-safeql-demos/postgresjs-custom-types | Patch | | @ts-safeql-demos/postgresjs-demo | Patch | | @ts-safeql-demos/vercel-postgres | Patch | | @ts-safeql/generate | Patch | | @ts-safeql/shared | Patch | | @ts-safeql/sql-ast | Patch | | @ts-safeql/test-utils | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

timvandam commented 3 months ago

Thanks for addressing this! I found one minor case where unions don't work, namely with Date | null. It yields ESLint: Invalid Query: Union types must be of the same type (found unknown (524288))(@ts-safeql/check-sql). My case specifically is an INSERT .. VALUES