TypeScript "redefinition" errors in 4.1.0
See original GitHub issue-
I’m submitting a … [x] bug report
-
Summary
Just trying out connect-mongo@4.1.0. Thank you for converting this to TypeScript!
I’m getting a number of TypeScript transpiler errors from the definitions.
For example, in lib/MongoStore.d.ts the MongoStore extends session.Store and redefines get
as:
get(sid: string, callback: (err: ErrorOrNull, session?: session.SessionData | null) => void): void;
MongoStore itself is extending (from express-session) session.Store. There get
is defined as:
get: (sid: string, callback: (err: any, session?: Express.SessionData | null) => void) => void;
From that we get this TypeScript error:
“Class ‘Store’ defines instance member property ‘get’, but extended class ‘MongoStore’ defines it as instance member function.ts(2425)”
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (2 by maintainers)
Top GitHub Comments
@Koslun Try to upgrade the
@types/express-session
to1.17.3
?@guyellis It is actually a bit tricky here. The TS definition of the store state that it is
err: any
but it is too general. In reality, it will only beError | null
. But since major store impl are not written in TS, so it does not matter before. May be I can change it back toany
🤔 Any way to bypass the error?