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: correct type inference for nullable and unknown types #274

Closed Newbie012 closed 2 months ago

Newbie012 commented 2 months ago

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

This commit fixes an issue where the type could be inferred as unknown and nullable when using aliases in some cases. The changes include modifications to the getDescribedTypeCast and getDescribedFuncCallByPgFn functions in the ast-describe.ts file, and additional tests have been added to ensure the correct behavior.

changeset-bot[bot] commented 2 months ago

🦋 Changeset detected

Latest commit: dd731a4c513ee0336d87e6550185e1ac4529f363

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/generate | Patch | | @ts-safeql/eslint-plugin | Patch | | @ts-safeql/shared | Patch | | @ts-safeql/sql-ast | 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/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

vercel[bot] commented 2 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/2eam4whM8sMuxtvmJxPmT3EUscWj)) | | | Sep 24, 2024 10:35am |