Unexpected error when using type aliases / interfaces

This issue has been tracked since 2022-09-19.

Describe the bug
SafeQL throws an error when using type aliases and interfaces, It doesn't recognise them when they are assigned as a type annotation. I am using it with postgres.js

To Reproduce
Steps to reproduce the behavior:

async function query() {
  const ids = await sql<{ id: number }[]>`SELECT id FROM animals`;

  type Animal = { id: number };
  const ids2 = await sql<Animal[]>`SELECT id FROM animals`;
}

Expected behavior
Don't throw an error when the correct type is used

Screenshots
safeql-issue-image

Desktop (please complete the following information):

  • OS: MAC OS
  • PostgreSQL version 13
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Newbie012 wrote this answer on 2022-10-17

Thanks for the report. I actually have a TODO comment that should improve this. I'll see what I can do.

More Details About Repo
Owner Name ts-safeql
Repo Name safeql
Full Name ts-safeql/safeql
Language TypeScript
Created Date 2022-09-08
Updated Date 2023-03-16
Star Count 795
Watcher Count 5
Fork Count 14
Issue Count 7

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date