Skip to content
TS2739

    ↑↓ move · ⏎ open · esc close

    TS2739

    Object is missing required properties

    Type '{}' is missing the following properties from type 'Point': x, y

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

    The target type requires several members, and the supplied object has none of them.

    Reproduction

    interface Point {
      x: number
      y: number
    }
    
    const point: Point = {}

    The build asserts this emits exactly this code.

    Why the compiler says this

    Structural typing checks the members that a value actually provides. An empty object cannot satisfy a contract promising readable numeric `x` and `y` properties, even if code intends to fill them later.

    Fixes

    1. 01
      interface Point {
        x: number
        y: number
      }
      
      const point: Point = { x: 0, y: 0 }

      Create a complete value before giving it the complete type.

    2. 02
      interface Point {
        x: number
        y: number
      }
      
      const draft: Partial<Point> = {}

      Represent an incomplete construction phase explicitly with `Partial`.

    Takeaway

    A required property is a promise available immediately. Use a different draft type if the object is not ready yet.

    Where to go next

    Errors