porsager/postgres

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

Open

#647 建立於 2023年7月20日

在 GitHub 查看
 (1 留言) (0 反應) (0 負責人)JavaScript (230 fork)batch import
Typescripthelp wanted

倉庫指標

Star
 (6,221 star)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

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

貢獻者指南