Skip to content

Somewhat unfortunate example on void return type on a fetching function #3501

@ZJoscha

Description

@ZJoscha

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions