-
Notifications
You must be signed in to change notification settings - Fork 66
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
Cannot use v2.1.1 in TypeScript #97
Comments
Is it possible to update the type definitions? cf. https://github.com/knex/knex/blob/master/UPGRADING.md#upgrading-to-version-0950 I also have: node_modules/connect-session-knex/typings/index.d.ts:20:5 - error TS2666: Exports and export assignments are not permitted in module augmentations.
20 export = initFunction; @gx0r ? |
It's still broken:
|
FWIW here's my working patch (using node.js with ESM ( diff --git a/typings/index.d.ts b/typings/index.d.ts
index cc2df0e156521f0ca56b52b4fc9cf3b087221a5b..ed92de0672e11428f03db5e217d9cf9edb534d86 100644
--- a/typings/index.d.ts
+++ b/typings/index.d.ts
@@ -15,6 +15,8 @@ declare module 'connect-session-knex' {
interface StoreFactory {
new (configs?: ConfigType): Store;
}
-}
-export default function initFunction(session: typeof expressSession): StoreFactory;
+ function initFunction(session: typeof expressSession): StoreFactory;
+
+ export = initFunction
+} |
+1, the above patch fixes the issue for me. |
Thank you, pushed that fix 🙏 |
and published |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It seems #89 actually breaks usage in TypeScript projects:
To be honest, I don't think the change was correct; it appears TypeScript only allows esm module syntax inside of
module
blocks.Edit: It appears, if you use
require
, it works, but now all TypeScript projects are forced to userequire
syntax. The original author could have solved their problem with:IMHO, that's preferable to disallowing
import session from 'connect-session-knex';
.The text was updated successfully, but these errors were encountered: