microsoft / microsoft/TypeScript-Website

Somewhat unfortunate example on void return type on a fetching function

Open
#3,501 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

https://github.com/microsoft/TypeScript-Website/blame/0612591abc2d8292c8ddd084b5fb264f203b7026/packages/documentation/copy/en/declaration-files/Do's and Don'ts.md#L81

Sorry if this is overthinking - i am new to typescript.

You are giving a DO example with an interface called "Fetcher" that defines getObject but returning nothing aka void. I think I got the point of "Do write callback parameters as non-optional", but the context is somewhat unfortunate. Maybe there can be thought of a better example for non-optional callback parameters?
Another way to phrase my thought: Is it a DO to use return type void on a getter-Method?

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 in packages/documentation/copy/en/declaration-files/Do's and Don'ts.md at the linked example around line 81. Read the surrounding guidance on non-optional callback parameters and assess whether the Fetcher example clearly distinguishes that point from the question of a void return type. Done means the example or wording better communicates the intended guidance.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.