Short answer
Log the value right before new: console.log(typeof Something, Something). If it is an object with a default or a named key, you imported the module object instead of the class: switch between import Something from and import { Something } from, or use .default when loading an ES module through require. If it is undefined, the export name is wrong. If it is a function, it may be an arrow function or a factory that must be called without new.
Why the value is not a constructor, and the fix
01
Default import versus named import
“There was an attempt to use an object or a variable as a constructor, but that object or variable is not a constructor.” MDN, TypeError: x is not a constructor
A library that exports export class Client cannot be loaded with import Client from, and one with export default class cannot be loaded with { Client }. Check the library’s docs or its type definitions for which one it is.
// library: export class Client {} import { Client } from 'some-sdk'; const client = new Client(); // library: export default class Client {} import Client from 'some-sdk';02
CommonJS and ES module interop
require() of a package that was compiled from ES modules returns an object, and the class sits on .default. Bundlers and TypeScript without esModuleInterop show the same thing the other way round. Use the property that actually holds the class.
const mod = require('some-sdk'); const Client = mod.default ?? mod.Client ?? mod; const client = new Client();03
An arrow function or a method
Arrow functions, async functions, generators and object methods written with the short syntax cannot be used with new. Write a class, or a regular function, if it really is meant to be constructed.
// TypeError: Car is not a constructor (the arrow function is the problem) const Car = (make) => { this.make = make; }; class Car { constructor(make) { this.make = make; } }04
A factory function called with new
Many libraries hand you a function that returns an instance, such as createClient(), express() or axios.create(). Call it without new.
import { createClient } from '@supabase/supabase-js'; const supabase = createClient(url, key); // no new
Checked against the vendor’s docs on : MDN: TypeError: x is not a constructor.
Rather hand it over?
Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.
- from $450App Fix TicketOne reproducible bug in an existing mobile or web app, diagnosed and fixed.See scope and start
- from $450AI-Built App RescueA Lovable, Bolt or Cursor app checked end to end in 3 days, then its worst problems fixed at a fixed price.No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.See scope and start
Related: TypeError: “x is not a function” · Node.js ERR_REQUIRE_ESM · “require is not defined”