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

Using this package is incompatible with TS flag exactOptionalPropertyTypes #1240

Open
2 tasks done
JeongJuhyeon opened this issue Jul 4, 2024 · 0 comments
Open
2 tasks done
Labels
bug Something isn't working

Comments

@JeongJuhyeon
Copy link

JeongJuhyeon commented Jul 4, 2024

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

The StorageFileApi.bucketId field type is bucketId?: string, which breaks when exactOptionalPropertyTypes is on. This causes headaches for folks trying to use the library with the flag on.

To Reproduce

  1. Create project, add @supabase/supabase-js
  2. turn on flag "exactOptionalPropertyTypes" in tsconfig
  3. tsc

Expected behavior

Compiles without errors

Additional context

  • TypeScript itself recommends using this flag. The reason it is not in strict is just to avoid breaking too much existing user code.

  • Right now, anyone with this flag on can't use the library without it failing to compile. Using skipLibCheck isn't great because it skips all .d.ts files, including user-made ones (see this issue).

  • Except for the one field I fixed, the package already follows this rule.

  • In my current project with 58 libraries, this is the only one that breaks with the flag on, indicating it's already a standard in the ecosystem.

These tweaks should make the library more robust and play better with strict TS setups, without causing issues for current users. Let me know if you need any more info!

PR Here

supabase/storage-js#205

@JeongJuhyeon JeongJuhyeon added the bug Something isn't working label Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant