1.0.9 • Published 3 years ago

typesafe-iteration v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

The small lib to make typesafe iterable objects.

Problem

// iterable object with Symbol.iterator
const object = {
  a: 1
}

for (const key of object) {
  // key: string
  // object[key] ts throws index error 
}

Solution

import { init } from 'typesafe-iterations';

init();

// iterable object with Symbol.iterator
const object = {
  a: 1
}

for (const [key, value] of object.getIterator()) {
  // key: 'a'
  // object[key] doesn't throw error
}
1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago