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

Typescript error: RedisClientType type is missing on property #2873

Open
golopot opened this issue Nov 30, 2024 · 2 comments
Open

Typescript error: RedisClientType type is missing on property #2873

golopot opened this issue Nov 30, 2024 · 2 comments
Labels

Comments

@golopot
Copy link

golopot commented Nov 30, 2024

Description

The RedisClientType type appears to be missing the on method. This causes a type-checking error when using .on to handle events. Below is an example that triggers the error:

import { createClient } from "redis";
const redis = createClient().on("error", (err) => {});
//                           ~~ Property 'on' does not exist on type 'RedisClientType...

Node.js Version

v22.9.0

Redis Server Version

not relevant

Node Redis Version

[email protected]

Platform

not relevant

Logs

No response

@golopot golopot added the Bug label Nov 30, 2024
@100xlongx
Copy link

100xlongx commented Dec 19, 2024

having the same issue when using this redis package in my turborepo, i get 'Property 'on' does not exist on type 'RedisClientType'.

however, was able to create a fresh project with bun and run this library with no issues, the issue only happens with pnpm

@MZPL
Copy link

MZPL commented Dec 24, 2024

I was surprised to see typing errors with on and once methods in both mongoose and redis. Downgrading to TS 5.4.5 was a one way to solve the issue, but are you perhaps using discord.js (or other packages depending on it)? They were using module augmentation to change EventEmitter typings, which caused issues after TS 5.5 release. See this. It's been fixed for a while now, and after upgrading the package, typings are working fine with the latest TS installed.

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

No branches or pull requests

3 participants