mweibel / connect-session-sequelize

Sequelize SessionStore for Express/Connect
212 stars 72 forks source link

Type definition fixes #120

Closed emilio-notable closed 4 years ago

emilio-notable commented 4 years ago

I was having issues importing this library with TS so I started looking at the index.d.ts. I don't have a lot of experience with TS, so I might be wrong, but looking at the docs here it seems that export default only works if the project has the config esModuleInterop: true, and mentions export = should work everywhere (and i also had to add the declare namespace init {} to make it work).

It also looks like declare module 'connect-session-sequelize' { is only used when declaring types for another library from your own project, so maybe is not necessary here?

Finally, I added the tableName?: string; option, since it looked like it was missing (happy to open another PR for this if you guys think it would be better)

Thanks!

EDIT: also added stopExpiringSessions to the type definition

mweibel commented 4 years ago

@AlanMorel please review :)

(btw, @AlanMorel, I'd like to make you a team member so you can review these PRs. Ok for you?)

mweibel commented 4 years ago

@emilio-notable I merged #119 - please fix conflicts.

emilio-notable commented 4 years ago

@emilio-notable I merged #119 - please fix conflicts.

👍 just rebased

AlanMorel commented 4 years ago

@mweibel Sure yeah, you can add me as a team member :)

These changes look good to me, tested it locally and no issues. This is the proper way to do it when defining types for your own library, I am also very new to TypeScript and so I didn't know this until now so thanks for teaching me something @emilio-notable !