Skip to content

const { Client } = pg (destructuring a native module's default export) throws "undefined is not a constructor" #10340

Description

@proggeramlug

Problem

const { Client } = pg does not work — destructuring a named export off a native module's default export throws undefined is not a constructor. import { Client } from "pg" does work.

Why it matters

docs/examples/stdlib/database/snippets.ts contains this exact destructuring pattern as documented, runnable example code. Anyone following the documentation as written would hit this failure immediately.

What would fix it

Whatever resolves a named binding off a CJS-style native module's default export needs to handle plain object destructuring (const { X } = mod) the same way it already handles a static import { X } from "mod". This is pre-existing and unrelated to the turnloop transport migration.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions