supabase-js
supabase-js copied to clipboard
supabase-js doesn't re-export types correctly when using pnpm
Bug report
- [X ] I confirm this is a bug with Supabase, not with my own application.
- [X ] I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
Using pnpm 7.29.1 and typescript 5.0.2 re-exported types don't resolve correctly from @supabase/supabase-js. See this screenshot

Reproduction here: https://github.com/evelant/supabase-pnpm-bug
pnpm install then open index.ts with vscode to see the problem. I'm not sure if this also happens with npm/yarn or if it's a resolution issue due to pnpm's stricter (more correct) package organization.
To Reproduce
pnpm add @supabase/supabase-js- add
import type { RealtimeChannel, RealtimePostgresChangesPayload } from "@supabase/supabase-js"in any .ts file - Observe
Module '"@supabase/supabase-js"' has no exported member 'RealtimeChannel'.
Expected behavior
If supabase-js is going to re-export types from @supabase/gotrue-js, @supabase/realtime-js, and @supabase/functions-js they should resolve correctly in all typescript versions with all major package managers (pnpm, npm, yarn, deno).
Screenshots

System information
- OS: macOS
- Browser (if applies) N/A
- Version of supabase-js: 2.13.1
- Version of Node.js: 16.19.0
- Version of typescript: 5.0.2
- Version of pnpm: 7.29.1
Additional context
I'm not exactly sure what's going wrong here. There are so many configurations and quirks with module resolution in typescript it's practically impossible to keep track of them all. I'm pretty sure other packages use a similar technique of bundling several sub-libraries together and re-exporting them like supabase-js does with the other @supabase packages so this is likely a small config issue.
Also of note, if I manually install the other packages (@supabase/realtime-js @supabase/functions-js @supabase/postgrest-js etc of the same version as depended upon by supabase-js) then the types seem to clash. I understand the desire for simplicity by putting everything in one package, but it might be more usable to make those other packages peer dependencies so they can be installed and used without these re-exporting issues.
Can confirm, same issue happens when using npm. Would love if the typescript integration was smoother!
Yep, I can also confirm that this issue does show up when I use pnpm.
- OS: Linux (Fedora 38)
- Version of supabase-js: 2.33.1
- Version of pnpm: 8.6.12
- Version of TypeScript: 5.0.4
- Version of Node: v18.17.1