eggjs / eggjs/egg

Egg Redis Typescript Error.

Open
#4,848 0 comments 0 reactions 0 assignees View on GitHub
Inactive
Dominant language
TypeScript
Stars
19k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

egg-redis/index.d.ts
----------------------
```
import { Redis, RedisOptions } from "ioredis";

interface ClusterOptions extends RedisOptions {
cluster?: boolean;
nodes?: RedisOptions[];
}

interface EggRedisOptions {
Redis?: Redis;
default?: object;
app?: boolean;
agent?: boolean;
client?: ClusterOptions;
clients?: Record;
}

declare module 'egg' {
interface Application {
redis: Redis & Singleton;
}

interface EggAppConfig {
redis: EggRedisOptions;
}
}

```
This code does not resolved Instance Singleton correctly due to collision of property `get()`. Please consider
```
import {Singleton} from "egg";
```
on the top of this declaration. And/Or reverse the type
```
interface Application {
redis: Singleton & Redis;
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.