Open hckhanh opened 1 week ago
Hi @hckhanh,
Can you try using the latest Upstash Redis release? we bumped Upstash Redis which should fix the issue.
Hi @CahidArda, thank you.
It's fixed now.
@CahidArda I got another error:
src/lib/upstash.ts:19:3 - error ts(2322): Type 'import("/home/runner/work/sshare/sshare/node_modules/@upstash/redis/cloudflare").Redis' is not assignable to type 'Redis'.
The types returned by 'multi()' are incompatible between these types.
19 redis: ratelimitRedis,
~~~~~
For now, I have to cast to never
to make the compilation go through
Do you think that @upstash/redis
should be declared as a peer dependency?
Hey @hckhanh, you are right, it should be a peer dependency but it should not cause any problems.
Can you share your ratelimit and redis versions? I couldn't reproduce it with their latest releases
This is my config @ytkimirti:
"@upstash/ratelimit": "2.0.4",
"@upstash/redis": "1.34.3",
{
"extends": "astro/tsconfigs/strict",
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "react",
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
}
}
@hckhanh I still can't reproduce it. Here is the code i tested with. Can you share a codesanbox link? I am not sure what we are doing differently here
import { Ratelimit } from "@upstash/ratelimit";
import { Redis } from "@upstash/redis/cloudflare";
const redis = Redis.fromEnv();
const ratelimit = new Ratelimit({
limiter: Ratelimit.fixedWindow(10, "10s"),
redis: redis,
});
console.log(ratelimit);
dependencies:
@upstash/ratelimit 2.0.4
@upstash/redis 1.34.3
astro 4.16.7
devDependencies:
typescript 5.6.2
@ytkimirti Did you initialize the application with astro and run astro check
?
This is my reproduction: https://stackblitz.com/edit/withastro-astro-gdk7od?file=src%2Flib%2Fupstash.ts
Yes you are right, thanks a lot for reproduction repo.
It's weird that it only happens with astro-check. I will look into it today
I get this error when try to use this package
package.json