hediet / ts-typed-sql

A fully typed sql builder. Not maintained anymore, use it for your inspiration.
https://hediet.github.io/ts-typed-sql/
54 stars 4 forks source link

Cannot select expression #38

Closed phiresky closed 5 years ago

phiresky commented 5 years ago

sql.select(sql.val(123))

The 'this' context of type 'typeof import(".../typed-sql")' is not assignable to method's 'this' of type 'SelectQuery<{}, {}, NoColumnsSelected>'.
  Type 'typeof import(".../typed-sql")' is missing the following properties from type 'SelectQuery<{}, {}, NoColumnsSelected>': _orderBys, _havingCondition, _groupBys, getState, and 23 more.ts(2684)
phiresky commented 5 years ago

When importing select directly, the error is

The 'this' context of type 'void' is not assignable to method's 'this' of type 'SelectQuery<{}, {}, NoColumnsSelected>'.ts(2684)
phiresky commented 5 years ago

Ok turns out the problem is just the location and text of the error message :/

sql.select(sql.val(123).as("tmp"))

works