Skip to content
This repository was archived by the owner on Sep 29, 2025. It is now read-only.
This repository was archived by the owner on Sep 29, 2025. It is now read-only.

Generics: code example possibly wrong #32

@isellsoap

Description

@isellsoap

The comment here https://github.com/chibicode/TypeScript-for-Beginner-Programmers/blob/master/src/lib/snippets.ts#L419 states

// This will fail because the second
// parameter must extend boolean | number,
// but instead it’s string
makePair<number, string>()`

But S extends F (which is number | string), so the statement makePair<number, string>() shouldn’t fail. Am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions