1.0.9 • Published 2 years ago

typesafe-iteration v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
2 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

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago