Skip to content

Commit

Permalink
add iterator type checks
Browse files Browse the repository at this point in the history
  • Loading branch information
dmonad committed Nov 20, 2023
1 parent 289ff16 commit c2e7076
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/y-map.tests.js
Expand Up @@ -8,6 +8,31 @@ import * as Y from '../src/index.js'
import * as t from 'lib0/testing'
import * as prng from 'lib0/prng'

/**
* @param {t.TestCase} _tc
*/
export const testIterators = _tc => {
const ydoc = new Y.Doc()
/**
* @type {Y.Map<number>}
*/
const ymap = ydoc.getMap()
// we are only checking if the type assumptions are correct
/**
* @type {Array<number>}
*/
const vals = Array.from(ymap.values())
/**
* @type {Array<[string,number]>}
*/
const entries = Array.from(ymap.entries())
/**
* @type {Array<string>}
*/
const keys = Array.from(ymap.keys())
console.log(vals, entries, keys)
}

/**
* Computing event changes after transaction should result in an error. See yjs#539
*
Expand Down

0 comments on commit c2e7076

Please sign in to comment.