Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump knex to 1.0.2 #95

Merged
merged 2 commits into from
Feb 28, 2022
Merged

bump knex to 1.0.2 #95

merged 2 commits into from
Feb 28, 2022

Conversation

akoskm
Copy link
Contributor

@akoskm akoskm commented Feb 5, 2022

https://knexjs.org/#changelog

I assume there'll be some CI running when I make the PR, because I think this version upgrade breaks the types.

I just tried to bump knex in one of my projects and got the following error:

src/server.tsx:50:3 - error TS2322: Type 'import("/Users/akoskm/Projects/my-project/node_modules/knex/types/index").Knex<any, unknown[]>' is not assignable to type 'import("/Users/akoskm/Projects/my-project/node_modules/connect-session-knex/node_modules/knex/types/index").Knex<any, unknown[]>'.
  Types of property 'raw' are incompatible.
    Type 'import("/Users/akoskm/Projects/my-project/node_modules/knex/types/index").Knex.RawBuilder<any, any>' is not assignable to type 'import("/Users/akoskm/Projects/my-project/node_modules/connect-session-knex/node_modules/knex/types/index").Knex.RawBuilder<any, any>'.
      Types of parameters 'value' and 'value' are incompatible.
        Type 'import("/Users/akoskm/Projects/my-project/node_modules/connect-session-knex/node_modules/knex/types/index").Knex.Value' is not assignable to type 'import("/Users/akoskm/Projects/my-project/node_modules/knex/types/index").Knex.Value'.
          Type 'Raw<any>' is not assignable to type 'Value'.
            Type 'import("/Users/akoskm/Projects/my-project/node_modules/connect-session-knex/node_modules/knex/types/index").Knex.Raw<any>' is not assignable to type 'import("/Users/akoskm/Projects/my-project/node_modules/knex/types/index").Knex.Raw<any>'.
              The types returned by 'generateDdlCommands()' are incompatible between these types.
                Type 'Promise<{ pre: string[]; sql: string[]; post: string[]; }>' is not assignable to type 'Promise<{ pre: string[]; sql: string[]; check: string; post: string[]; }>'.
                  Property 'check' is missing in type '{ pre: string[]; sql: string[]; post: string[]; }' but required in type '{ pre: string[]; sql: string[]; check: string; post: string[]; }'.

50   knex,
     ~~~~

  node_modules/knex/types/index.d.ts:1941:68
    1941     generateDdlCommands(): Promise<{ pre: string[], sql: string[], check: string | null, post: string[] }>;
                                                                            ~~~~~
    'check' is declared here.
  node_modules/connect-session-knex/typings/index.d.ts:8:9
    8         knex?: Knex;
              ~~~~
    The expected type comes from property 'knex' which is declared here on type 'ConfigType'

[10:46:20 AM] Found 1 error. Watching for file changes.

Happening on this line:

const store = new KnexSessionStore({
  knex, // <- this is where the ts compiler complains about the types
  tablename: "sessions"
});

Changing:

import { Knex } from 'knex';

to

import Knex from 'knex';

solves this issue.

@akoskm akoskm marked this pull request as ready for review February 5, 2022 09:58
@akoskm
Copy link
Contributor Author

akoskm commented Feb 22, 2022

@gx0r let me know if I have to add anything else to this PR!

@gx0r gx0r merged commit 342e000 into gx0r:master Feb 28, 2022
@gx0r
Copy link
Owner

gx0r commented Feb 28, 2022

Thanks!

@akoskm akoskm deleted the ak-bump-knex-to-1x branch February 28, 2022 14:32
@akoskm
Copy link
Contributor Author

akoskm commented May 2, 2022

@gx0r can we create a release including this change?

@gx0r
Copy link
Owner

gx0r commented May 9, 2022

Yes, been ill. Will release soon.

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.

2 participants