Skip to content

Conversation

@MuzzaiyyanHussain
Copy link

Adds a dedicated PostgrestMaybeSingleResponse type to better represent the
existing runtime behavior of maybeSingle().

This is a type-only change and does not modify any runtime logic.

@MuzzaiyyanHussain MuzzaiyyanHussain requested review from a team as code owners December 16, 2025 08:24
@mandarini
Copy link
Contributor

@MuzzaiyyanHussain thanks for your PR. I'll review more in a bit. Can you please use npm i instead of pnpm i? And please delete pnpm-lock.yml.

@MuzzaiyyanHussain MuzzaiyyanHussain force-pushed the fix/maybe-single-response-type branch from de8d46f to e12c51e Compare December 16, 2025 09:43
@mandarini mandarini force-pushed the fix/maybe-single-response-type branch from e12c51e to 008d230 Compare January 5, 2026 14:58
@mandarini
Copy link
Contributor

Hey @MuzzaiyyanHussain, thanks for the contribution, but I don't think this PR provides a meaningful change. Let me explain:

The Types Are Semantically Identical

The current definition:

  export type PostgrestMaybeSingleResponse<T> = PostgrestSingleResponse<T | null>

Expands to (since PostgrestSingleResponse = PostgrestResponseSuccess | PostgrestResponseFailure): PostgrestResponseSuccess<T | null> | PostgrestResponseFailure

Your proposed change:

  export type PostgrestMaybeSingleResponse<T> =
    | PostgrestResponseSuccess<T | null>
    | PostgrestResponseFailure

These are exactly the same type. TypeScript will treat them identically - there's no difference for consumers of the library.

Unused Import

The PR adds an import of PostgrestMaybeSingleResponse in PostgrestBuilder.ts, but it's not used anywhere. This would likely fail linting.

I'm going to close this PR since it doesn't change any behavior or types. However, if you're experiencing an actual type issue with maybeSingle(), I'd encourage you to:

  1. Open an issue first describing the problem you encountered
  2. Include a code example showing the type error or unexpected behavior
  3. Then we can discuss the right solution

If there's a real typing problem with maybeSingle(), we definitely want to fix it - we just need to understand what issue you're trying to solve. Thanks for your interest in contributing to Supabase! 💚

@mandarini mandarini closed this Jan 5, 2026
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.

2 participants