microsoft / microsoft/TypeScript

Function type definition with anonymous arguments and optional parentheses for single argument

Offen
#52,914 2 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Awaiting More Feedback Suggestion
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.4k
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
117

Beschreibung

Suggestion

🔍 Search Terms

anonymous type argument, optional parentheses

List of keywords you searched for before creating this issue. Write them down here so that others can find this suggestion more easily and help provide feedback.

✅ Viability Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

⭐ Suggestion

Like a anonymous function and anonymous type, it could be nice a type definition with anonymous arguments. Also, as in function definition, function type definition with single argument, the parentheses could be optional.

📃 Motivating Example

This simple enhancement let a more clean and lean code syntaxe.

💻 Use Cases

// currently
function f(callback:(...args: string[]) => void) { ... }

// anonymous arguments
function f(callback: (...string[]) => void) { ... }

// anonymous argument + optional parentheses
function f(callback: ...string[] => void) { ... }

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Das Issue identifiziert keine Implementierungsdateien, Einstiegspunkte oder Tests; beginne mit den motivierenden Beispielen und den angeforderten Syntaxformen. Als erledigt gilt die Aufgabe, wenn die Formen für anonyme Argumente und optionale Klammern wie beschrieben akzeptiert werden, ohne das erzeugte JavaScript zu ändern, und eine Regressionstestabdeckung hinzugefügt wurde.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
compilers
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
32/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.