porsager/postgres

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

开放

#647 创建于 2023年7月20日

 (1 条评论) (0 个反应) (0 位负责人)JavaScript (230 个派生)batch import
Typescripthelp wanted

仓库指标

星标
 (6,221 个星标)
PR 合并指标
 (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

贡献者指南