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

Missing type on boolean inside CASE #352

Closed
karlhorky opened this issue Dec 30, 2024 · 1 comment · Fixed by #354
Closed

Missing type on boolean inside CASE #352

karlhorky opened this issue Dec 30, 2024 · 1 comment · Fixed by #354

Comments

@karlhorky
Copy link
Collaborator

karlhorky commented Dec 30, 2024

Describe the bug

The type for the has_url is actually completely empty (empty string) 🤔 Haven't seen this one before.

To Reproduce
Steps to reproduce the behavior:

// 💥 Query has incorrect type annotation.
//	Expected: { has_url: boolean; }
//	Actual: { has_url: ; }[]
await sql<{ has_url: boolean }[]>`
  SELECT
    CASE
      WHEN TRUE THEN personal_intro_url_private IS NOT NULL
      ELSE tech_achievements_url_private IS NOT NULL
    END AS has_url
  FROM
    users
`;

Expected behavior

has_url receives a boolean type, as SafeQL did before the versions released for literal inference:

Screenshots

--

Desktop (please complete the following information):

  • OS: macOS Sequoia 15.2 (24C101)
  • PostgreSQL version 14.13
  • Version 3.6.0

Additional context

Problem seems to have been introduced in the versions released for literal inference:

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

Successfully merging a pull request may close this issue.

1 participant