Skip to content

Fixed Iterator Type

Latest
Compare
Choose a tag to compare
@T99 T99 released this 27 Aug 15:49
· 2 commits to master since this release

After changes made for the v2.0.0 release, the type being returned for [Symbol.iterator] included undefined in the type union for the iterator result. This caused users to have to cast iteration results to their intended type:

for (person of new PersonIterator(people)) {
    let person: Person = person as Person;
}

Otherwise, TypeScript would complain that Person | undefined could not be assigned to a variable of type Person.