porsager/postgres

The type passed into the generic shouldn't have to be specified as an array

Open

#647 geöffnet am 20. Juli 2023

Auf GitHub ansehen
 (1 Kommentar) (0 Reaktionen) (0 zugewiesene Personen)JavaScript (230 Forks)batch import
Typescripthelp wanted

Repository-Metriken

Stars
 (6.221 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

Currently using the library you would pass your type as such

type User = {
  email: string
  password: string
}

const [user] = await sql<U͟s͟e͟r[]>`
  SELECT * FROM example;
`;

console.log(user.email);

Though its not a huge deal I feel as code quality would be better with simply omitting it

type User = {
  email: string
  password: string
}

const [user] = await sql<U͟s͟e͟r>`
  SELECT * FROM example;
`;

console.log(user.email);

You can even see an example of this on the typescript documentation

Contributor Guide