You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am sure just is this a user error -- but I have some pretty simple TS code and it's throwing me a TS error. The code and error follow:
import { createHandyClient, IHandyRedis } from 'handy-redis';
import { BaseStore } from 'koa-session-ts';
import { ClientOpts } from '../../node_modules/@types/redis';
/**
* RedisStore for koa-session
*
* @param {object} options the options pass to node_redis
* @returns RedisStore instance
*/
export class RedisSessionStore extends BaseStore {
// Class members
readonly client: IHandyRedis;
constructor(options?: ClientOpts) {
super();
this.client = createHandyClient(options); // Error is here at options
It doesn't like the options I pass in ..following problem
I also tried to set the options to type ICreateHandyClient but effectively the same error..
I am using TS 2.9.2
[ts]
Argument of type 'ClientOpts | undefined' is not assignable to parameter of type 'RedisClient'.
Type 'undefined' is not assignable to type 'RedisClient'.
(parameter) options: ClientOpts | undefined
It looks like it's taking only the last definition in the Interface or something .. ??
Again, I am probably just doing something wrong here ...
Thanks
The text was updated successfully, but these errors were encountered:
Hi - your code is working for me with this change:
import { createHandyClient, IHandyRedis } from 'handy-redis';
import { BaseStore } from 'koa-session-ts';
-import { ClientOpts } from '../../node_modules/@types/redis';+import { ClientOpts } from 'redis';
The @types/redis package is actually a prod dependency for handy-redis (this might change in a future major version of this library though). If this still doesn't work for you, try npm uninstall @types/redis, and feel free to reopen this ticket if you have problems after that.
I am sure just is this a user error -- but I have some pretty simple TS code and it's throwing me a TS error. The code and error follow:
It doesn't like the options I pass in ..following problem
I also tried to set the options to type ICreateHandyClient but effectively the same error..
I am using TS 2.9.2
It looks like it's taking only the last definition in the Interface or something .. ??
Again, I am probably just doing something wrong here ...
Thanks
The text was updated successfully, but these errors were encountered: