Skip to content
webtype.orgwebtype.orgTS1109

    ↑↓ move · ⏎ open · esc close

    TS1109

    Expression expected

    Expression expected.

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

    The parser reached a position where only a value may appear and found something that cannot start one — usually a line left half-written.

    Reproduction

    const ready = true
    const hasQuota = false
    
    const canSend = ready &&

    The build asserts this emits exactly this code.

    Why the compiler says this

    This is the parser talking, not the type checker. `&&` is a binary operator, so the grammar requires another expression after it, and the file ends instead. The message says so little because the compiler has not got far enough to know what you meant — no type has been considered yet, and none will be until the file parses.

    Fixes

    1. 01
      const ready = true
      const hasQuota = false
      
      const canSend = ready && hasQuota

      Finish the expression. The position it reports is the end of the problem, not the start: read the token before it.

    2. 02
      const ready = true
      
      const canSend = ready
      // TODO: && hasQuota, once quotas ship

      Or park the unfinished half in a comment. Code that does not parse suppresses every other diagnostic in the file, so an honest placeholder is worth more than a broken line.

    Takeaway

    TS1109 is never about types. Look at the token before the position it reports, and expect a typo rather than a misunderstanding.

    Errors