Skip to content
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

typscript conflict between @types/koa-session and @types/koa-generic-session #59

Open
alsoscotland opened this issue Oct 16, 2019 · 1 comment

Comments

@alsoscotland
Copy link

Thanks for maintaining the project. I am curious if there is an ETA or plan to accept
#35
#56

I am running into a typescript compilation error when trying to setup up a project with koa-redis/koa-session. I think the upgrade would alleviate the issue of conflicting session types in these two dependencies.

node_modules/@types/koa-session/index.d.ts:205:9 - error TS2717:
Subsequent property declarations must have the same type.  Property 'session' must be of type 'Session | null', but here has type 'Session | null'.

205         session: session.Session | null;
            ~~~~~~~

  node_modules/@types/koa-generic-session/index.d.ts:58:9
    58         session: koaSession.Session|null;
               ~~~~~~~
    'session' was also declared here.
@alsoscotland
Copy link
Author

Thanks for updating to v4.0.0 and koa-session. any chance of adding type definitions here. I have been using the ones at definitely typed. They are a relatively small definition but I was having a bit of trouble trying to adjust them to work and get definitely-typed running locally to confirm that an update worked.

The current definitions are:
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/koa-redis/index.d.ts

// Type definitions for koa-redis 3.0
// Project: https://github.com/koajs/koa-redis
// Definitions by: Nick Simmons <https://github.com/nsimmons>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3

import { ClientOpts } from 'redis';
import { SessionStore } from 'koa-generic-session';

declare namespace redisStore {
    interface RedisOptions extends ClientOpts {
        duplicate?: boolean;
        client?: any;
    }

    interface RedisSessionStore extends SessionStore {
        client: any;
    }
}

declare function redisStore(options: redisStore.RedisOptions): redisStore.RedisSessionStore;
export = redisStore;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant