Skip to content
TS2351

    ↑↓ move · ⏎ open · esc close

    TS2351

    Expression is not constructable

    This expression is not constructable.

    The compiler’s own words. Not translated — this is the string you pasted into a search box.

    The value after `new` has no construct signature, so it cannot create an instance.

    Reproduction

    const value = {}
    
    new value()

    The build asserts this emits exactly this code.

    Why the compiler says this

    `new` requires a class or constructor function whose type describes the instance it creates. An ordinary object is already a value; it is not a recipe for producing another one.

    Fixes

    1. 01
      class Value {
        readonly ok = true
      }
      
      const value = new Value()

      Use a class when callers should construct distinct instances.

    2. 02
      const makeValue = () => ({ ok: true })
      
      const value = makeValue()

      Use a factory call without `new` when a plain object is sufficient.

    Takeaway

    A construct signature describes what `new` can do. If the type has none, either the wrong value was imported or `new` does not belong there.

    Where to go next

    Errors