Skip to content

Chapter 4 Exercise 5 #10

Open
Open
@TheGhostHuCodes

Description

@TheGhostHuCodes

Thanks for writing this great book. I'm new to TypeScript and I'm enjoying working through it.

I noticed that the answer to Chapter 4 Exercise 5 has the function signature:

function is<T>(a: T, ...b: [T, ...T[]]): boolean

However, when I was attempting it on my own, I came up with:

function is<T>(a: T, ...b: T[]): boolean

which also seems to work. It looks like there's also an open PR (#8) with the signature:

function is<T>(a: T, ...b: [...T[]]): boolean

What's the difference, if any, between these different generic types?

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