Skip to content

Conversation

@raychan
Copy link
Collaborator

@raychan raychan commented Jul 28, 2017

No description provided.

declare class Knex$Knex mixins Knex$QueryBuilder, Promise, events$EventEmitter {
static (config: Knex$Config): Knex$Knex,
declare class Knex$Knex<T> mixins Knex$QueryBuilder<T>, Promise, events$EventEmitter {
static (config: Knex$Config): Knex$Knex<T>,
Copy link

@briancavalier briancavalier Jul 31, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, this all seems very tricky. There are at least a couple things I think we need to consider:

  1. We don't want to over-constrain the type parameter of Knex$Knex, since we'd like it to represent the whole database, which could contain many tables (yelp-gil-service's db is an outlier with only 1 table).
  2. Joins seem especially tricky, since they are a single operation, e.g. innerJoin that involves at least 2 types--one for each table involved in the join. They may even involve 3 types--one for each table, plus one for the result type if the two tables are joined in a projection (i.e. a subset of fields from each table). Sometimes that 3rd type might be a proper intersection of the two other types, but not always.

I have some ideas, but nothing concrete yet ... let's talk about it tomorrow if we have time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants