question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 3 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mingchunocommented, Apr 30, 2021

@Koslun Try to upgrade the @types/express-session to 1.17.3?

1reaction
mingchunocommented, Feb 23, 2021

@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 be Error | null. But since major store impl are not written in TS, so it does not matter before. May be I can change it back to any 🤔 Any way to bypass the error?

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript: Any way to get a compile-time error when I ...
In this case, I WANT a compile-time error. And, I get one. TypeScript gives "Duplicate identifier 'name'" at compile time. Life is good....
Read more >
Announcing TypeScript 4.1 - Microsoft Developer Blogs
But beyond error-checking, TypeScript powers things like completions, quick fixes, and refactorings for both TypeScript and JavaScript in some ...
Read more >
Swift Packages | Apple Developer Forums
When I attempt to import my dependency into my code and build, I'm getting the following error: Could not find module '<swift package...
Read more >
What's New — Node.js - MongoDB
Redefinition of the ChangeStream class as an async iterable. ... The following code causes a TypeScript compilation error because the name property value ......
Read more >
Bug listing with status RESOLVED with resolution OBSOLETE ...
... Bug:144994 - "stabilise xen-4.1.0" status:RESOLVED resolution:OBSOLETE severity: ... Bug:189823 - "error in link at Gentoo Network Appliance (GNAP) User ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found