For AI agents: the complete documentation index is available at /tc39-atlas/en/llms.txt, the full documentation bundle is available at /tc39-atlas/en/llms-full.txt, and this page is available as Markdown at /tc39-atlas/en/proposals/proposal-unused-function-parameters.md.
  • English
  • Unused Function Parameters ?

    Proposal details
    Proposal overview

    This proposal addresses the problem of unused function parameters in JavaScript, which currently require placeholder names like _ that may conflict with existing code or linters. It explores three main solutions: elisions (empty parameter slots), placeholder syntax (e.g., ? or *), and a placeholder identifier (e.g., _) with early error rules. The proposal is at an early exploratory stage, presenting multiple design options without a selected direction.

    Note

    The README below comes from the upstream repository and may contain outdated stage or status metadata. Use the proposal details above as the current source of truth.

    Unused Function Parameters

    The Problem

    doSomething((unused1, unused2, somethingUseful) => {
      doSomethingWith(somethingUseful);
    });
    
    doSomething((_, __, somethingUseful) => {
      doSomethingWith(somethingUseful);
    });

    Solutions

    Elisions

    doSomething(( , , somethingUseful) => {
      doSomethingWith(somethingUseful);
    });
    • Matches with existing destructuring
      • ([, c]) is already valid
    • Some might say it looks weird

    Placeholder Syntax

    doSomething((?, ?, somethingUseful) => {
      doSomethingWith(somethingUseful);
    });
    
    doSomething((*, *, somethingUseful) => {
      doSomethingWith(somethingUseful);
    });
    
    // etc.
    • Most explicit, clearly "using up" a parameter without binding it
    • Requires more syntax

    Placeholder Identifier

    doSomething((_, _, somethingUseful) => {
      doSomethingWith(somethingUseful);
    });
    
    doSomething((_, _, somethingUseful) => {
      print(_); // IdentifierReference : `_` early error?
      doSomethingWith(somethingUseful);
    });
    • Arguably most natural, other languages use this (C#, Rust, etc.)
    • Any valid identifiers are already valid identifiers, could conflict with existing code