-
Notifications
You must be signed in to change notification settings - Fork 342
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
TypeScript "redefinition" errors in 4.1.0 #391
Comments
@guyellis It is actually a bit tricky here. The TS definition of the store state that it is |
When you extend that class is it possible to use some sort of Omit Utility Type: https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys |
I just skimmed through this article that might have some clues on how to do this: https://medium.com/dailyjs/typescript-create-a-condition-based-subset-types-9d902cea5b8c |
@guyellis Try to align with the original typedef but it just doesn't work. callback?: () => void But the doc said the implementation should call |
released in 4.2.0 please check |
@mingchuno Some other dependencies in-use:
Excerpt of usage in code:
Error log:
|
@Koslun Try to upgrade the |
It did work now, might've been
The last resolution is for another issue: DefinitelyTyped/DefinitelyTyped#49595 (comment) |
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)"
The text was updated successfully, but these errors were encountered: