Skip to content

OOM from tsc using patched database types #1774

@rainhead

Description

@rainhead

Describe the bug

Originally sindresorhus/type-fest#1271, but they seem to think it's not their problem.

When I create a client using a Database type that has been patched with SetNonNullDeep, if I have patched more than a few key paths, tsc runs out of memory when querying a table.

The playground takes a very long time, but does eventually typecheck.

Library affected

postgrest-js

Reproduction

playground

Steps to reproduce

Run tsc on the file from the playground. With a few keypaths run through SetNonNullableDeep it takes 5-10 seconds (!), with more it takes more than a minute or runs out of memory.

System Info

tsc --version
Version 5.9.3

  System:
    OS: macOS 26.0.1
    CPU: (8) arm64 Apple M1
    Memory: 258.70 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.10.0 - /opt/homebrew/bin/node
    Yarn: 1.22.22 - /Users/rainhead/.nvm/versions/node/v20.14.0/bin/yarn
    npm: 11.6.0 - /opt/homebrew/bin/npm
    pnpm: 10.18.2 - /opt/homebrew/bin/pnpm
    Deno: 2.1.10 - /opt/homebrew/bin/deno
  Browsers:
    Chrome: 141.0.7390.77
    Firefox: 143.0.4
    Safari: 26.0.1
  npmPackages:
    @supabase/auth-js: ^2.75.0 => 2.75.0 
    @supabase/sentry-js-integration: ^0.3.0 => 0.3.0 
    @supabase/supabase-js: ^2.75.0 => 2.75.0 
    supabase: ^2.51.0 => 2.51.0

Used Package Manager

npm

Logs

Click to expand!
time tsc repro.ts
tsc repro.ts  75.25s user 5.44s system 107% cpu 1:14.84 total

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpostgrest-jsRelated to the postgrest-js library.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions