add iterator type checks
This commit is contained in:
parent
289ff16f66
commit
c2e7076400
@ -8,6 +8,31 @@ import * as Y from '../src/index.js'
|
|||||||
import * as t from 'lib0/testing'
|
import * as t from 'lib0/testing'
|
||||||
import * as prng from 'lib0/prng'
|
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
|
* Computing event changes after transaction should result in an error. See yjs#539
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user