microsoft / microsoft/TypeScript-Website

Please add in the documentation the syntax for Typescript arrow functions with generics and how to avoid ambiguity with JSX using a trailing comma

Open
#3,196 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.6k
Forks
1.5k
Avg merge
2d 2h
Merged PRs (30d)
7

Description

Page URL: https://www.typescriptlang.org/docs/handbook/2/generics.html

Issue: What is the syntax for Typescript arrow functions with generics?

The typescript handbook currently has nothing on arrow functions.

Thomas said this in a comment:

Newer typescript compilers also support trailing comma const foo = <T,>(x: T) => x; to sidestep the JSX ambiguity

If you add this info in the documentation people won't have to resort to that StackOverflow post to discover these features.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Generics handbook page linked in the issue and review its existing examples and surrounding syntax guidance. Document TypeScript arrow functions with generics, including the trailing-comma form that avoids ambiguity with JSX. Done means the page explains both the syntax and why the trailing comma is useful.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.