bcherny / bcherny/programming-typescript-answers

Chapter 4 Exercise 5

Open
#10 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
555
Forks
154
PR merge metrics
No merged PRs in 30d

Description

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:

```typescript
function is(a: T, ...b: [T, ...T[]]): boolean
```

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

```typescript
function is(a: T, ...b: T[]): boolean
```

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

```typescript
function is(a: T, ...b: [...T[]]): boolean
```

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the Chapter 4 Exercise 5 answer and compare its displayed signature with the alternatives in the issue and open PR #8. Done means the answer clearly explains the distinction between these generic parameter forms and identifies the appropriate signature.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.