basarat / basarat/typescript-book

missing property in IteratorResult<T> object on page 50 example

Open
#269 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
21.6k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

Hi,

Thanks for the great work on this book, I'm loving reading it.

I just noticed that on es6 iterator example in page 50 (pdf version) there is a missing value property on next() method.

ES6 interface definition for IteratorResult requires the value to be defined :
interface IteratorResult {
done: boolean;
value: T;
}

so on the next() else case the return should be something like:
return {
value: null,
done: true
}

Hope this helps.

Regards

Contributor guide

Open the contributing guide

Research direction

Locate the ES6 iterator example on page 50 of the PDF and compare its next() result with the IteratorResult interface shown in the issue. Update the example so the final result includes the missing value property, then verify the corrected example in the book source and rendered PDF.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.