Skip to content

fix(storage): support exactOptionalPropertyTypes - #2200

Merged
mandarini merged 5 commits into
supabase:masterfrom
7ttp:fix/storage-transform
Mar 31, 2026
Merged

mandarini merged 5 commits into
supabase:masterfrom
7ttp:fix/storage-transform

Conversation

@7ttp

@7ttp 7ttp commented Mar 30, 2026

Copy link
Copy Markdown
Member

aligns StorageFileApi and StorageError field types with their existing constructor assignments so
storage-js compiles with exactOptionalPropertyTypes enabled

also adds a small test in the existing storageFileApi suite

@7ttp
7ttp requested review from a team as code owners March 30, 2026 11:17
@pkg-pr-new

pkg-pr-new Bot commented Mar 30, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@supabase/auth-js

npm i https://pkg.pr.new/@supabase/auth-js@2200

@supabase/functions-js

npm i https://pkg.pr.new/@supabase/functions-js@2200

@supabase/postgrest-js

npm i https://pkg.pr.new/@supabase/postgrest-js@2200

@supabase/realtime-js

npm i https://pkg.pr.new/@supabase/realtime-js@2200

@supabase/storage-js

npm i https://pkg.pr.new/@supabase/storage-js@2200

@supabase/supabase-js

npm i https://pkg.pr.new/@supabase/supabase-js@2200

commit: ab63891

@mandarini mandarini left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @7ttp, thank you so much for this PR! :D

This is a nice fix, exactOptionalPropertyTypes compatibility is one of those things that trips up library consumers and it's genuinely useful to have it sorted. The type changes themselves are exactly right: status: number | undefined is the correct way to express "always present, possibly undefined" under that flag, and the StorageApiError overrides hold up cleanly without needing any changes.

One suggestion before we merge: since you've already verified the whole package compiles cleanly with the flag, the right move is to just add "exactOptionalPropertyTypes": true directly to the package's tsconfig.json. That way the guarantee is explicit in the config, any future violation will be caught by the normal build, and the test added in this PR isn't needed at all, the build already acts as the type-check gate here.

Would you be open to making that swap? Happy to help if anything is unclear.

@7ttp

7ttp commented Mar 31, 2026

Copy link
Copy Markdown
Member Author

Hi @7ttp, thank you so much for this PR! :D

This is a nice fix, exactOptionalPropertyTypes compatibility is one of those things that trips up library consumers and it's genuinely useful to have it sorted. The type changes themselves are exactly right: status: number | undefined is the correct way to express "always present, possibly undefined" under that flag, and the StorageApiError overrides hold up cleanly without needing any changes.

One suggestion before we merge: since you've already verified the whole package compiles cleanly with the flag, the right move is to just add "exactOptionalPropertyTypes": true directly to the package's tsconfig.json. That way the guarantee is explicit in the config, any future violation will be caught by the normal build, and the test added in this PR isn't needed at all, the build already acts as the type-check gate here.

Would you be open to making that swap? Happy to help if anything is unclear.

Aha, yh that def makes more sense :) 💚
i’ve updated to enable exactOptionalPropertyTypes in tsconfig.json
removed the extra test, and reverified that it compiles cleanly

Comment thread packages/core/storage-js/tsconfig.json Resolved
@mandarini
mandarini merged commit f26b924 into supabase:master Mar 31, 2026
21 checks passed
@7ttp
7ttp deleted the fix/storage-transform branch March 31, 2026 15:53
mandarini pushed a commit to supabase/ssr that referenced this pull request Apr 1, 2026
This PR updates `@supabase/supabase-js` to v2.101.1.

**Source**: supabase-js-stable-release

---

## Release Notes

## v2.101.1

## 2.101.1 (2026-03-31)

### 🩹 Fixes

- **storage:** support exactOptionalPropertyTypes
([#2200](supabase/supabase-js#2200))

### ❤️ Thank You

- Vaibhav @7ttp

This PR was created automatically.

Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
mandarini pushed a commit to supabase/supabase that referenced this pull request Apr 7, 2026
This PR updates @supabase/*-js libraries to version 2.102.1.

**Source**: supabase-js-stable-release

**Changes**:
- Updated @supabase/supabase-js to 2.102.1
- Updated @supabase/auth-js to 2.102.1
- Updated @supabase/realtime-js to 2.102.1
- Updated @supabase/postgest-js to 2.102.1
- Refreshed pnpm-lock.yaml

---

## Release Notes

## v2.102.1

## 2.102.1 (2026-04-07)

### 🩹 Fixes

- **functions:** add toJSON to FunctionsError for correct JSON
serialization
([#2226](supabase/supabase-js#2226))

### ❤️ Thank You

- oniani1
## v2.102.0

## 2.102.0 (2026-04-07)

### 🚀 Features

- **postgrest:** add automatic retries for transient errors
([#2072](supabase/supabase-js#2072))
- **postgrest:** add success discriminator field to PostgREST response
types ([#2198](supabase/supabase-js#2198))
- **supabase:** export PostgrestFilterBuilder and StorageApiError from
supabase-js ([#2222](supabase/supabase-js#2222))

### 🩹 Fixes

- **auth:** downgrade console.error to console.warn for missing session
([#2214](supabase/supabase-js#2214))
- **ci:** add --ignore-scripts to platform test installs to block post
install attacks
([#2206](supabase/supabase-js#2206))
- **postgrest:** add toJSON to PostgrestError for correct JSON
serialization
([#2212](supabase/supabase-js#2212))
- **postgrest:** reject excess properties in insert, update, and upsert
([#2186](supabase/supabase-js#2186))
- **storage:** set correct content-type for uploads
([#2211](supabase/supabase-js#2211))
- **storage:** avoid duplicate content-type headers in vector requests
([#2220](supabase/supabase-js#2220))

### ❤️ Thank You

- Clay
- Guilherme Souza
- Katerina Skroumpelou @mandarini
- oniani1
- Vaibhav @7ttp
## v2.101.1

## 2.101.1 (2026-03-31)

### 🩹 Fixes

- **storage:** support exactOptionalPropertyTypes
([#2200](supabase/supabase-js#2200))

### ❤️ Thank You

- Vaibhav @7ttp

This PR was created automatically.

Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using this package is incompatible with TS flag exactOptionalPropertyTypes

2 participants