denodrivers/redis

Property 'set' does not exist on type 'Redis'.deno-ts(2339)

Levelleor opened this issue ยท 5 comments

Is there a way to fix the issue with deno-ts complaining about redis instance not having set/get methods? It looks like Redis interface is looking for RedisCommands but isn't finding it or something?

The error I am seeing:

import { connect } from "https://deno.land/x/redis@v0.31.0/mod.ts";

const redis = await connect({
  hostname: "",
  port: ,
  password: "",
});

const ok = await redis.set("hoge", "fuga"); // Property 'set' does not exist on type 'Redis'.deno-ts(2339)
const fuga = await redis.get("hoge"); // Property 'get' does not exist on type 'Redis'.deno-ts(2339)

console.log(fuga)

deno 1.37.1 (release, x86_64-pc-windows-msvc)
v8 11.8.172.6
typescript 5.2.2

Skwai commented

Seeing this too. Will try an earlier version.

Skwai commented

Just tried last to minor versions, same issue.

An error occurred during route handling or page rendering. TypeError: this.execBulkReply is not a function

Hi, I was able to find the issue which is causing this.

// File:: Redis.ts
// RedisCommand is currently imported as a Type. It should be imported as an Interface.
// import type { RedisCommands } from "./command.ts";
import { RedisCommands } from "./command.ts";
export interface Redis extends RedisCommands {
uki00a commented

Hi, thanks for reporting the issue. I tried this as well, but could not reproduce the problem. I guess this is probably due to https://deno.land/x/redis@v0.31.0/mod.ts not being downloaded to the local cache. If possible, could you try one of the following?

  • Run deno cache command
  • Run Deno: Cache Dependencies command in vscode and reload the window

@uki00a thank you. Resolved by running a deno cache main.ts.

This is my first project with Deno and the ecosystem and I am not very familiar with it so stuff happens :)