Closed
Description
TypeScript Version: 2.6.0-rc, 2.7.0-dev.20171101
Code Runnable Gist
import * as s from "@hediet/typed-sql";
import { Pool } from "pg";
const db = new s.DbConnection(new s.PostgreQueryService(new Pool()));
const customers = s.table(
"customers",
{ name: s.tText, country: s.tText },
{ id: s.tInteger }
);
const orders = s.table(
"orders",
{ customerId: customers.id.type, orderDate: s.tText },
{ id: s.tInteger }
);
async function test() {
return await db.exec(
s
.from(customers)
.where({ country: "US" })
.leftJoin(orders)
.on({ id: orders.id })
.select(orders.$all)
);
}
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"strict": true
}
}
Expected behavior:
Correctly inferred type of test()
(Typescript 2.5.3):
function test(): Promise<{
customerId: number;
orderDate: string;
id: number;
}[]>
Actual behavior:
2.6.0-rc:
function test(): Promise<void>
2.7.0-dev.20171029:
function test(): Promise<{
[x: string]: any;
}[]>
No type errors are shown in either version.