mirror of https://github.com/vuejs/core.git
chore(types): reuse built-in Iterator type (#11435)
This commit is contained in:
parent
208f5c04e7
commit
87923f6af1
|
@ -173,19 +173,6 @@ function createForEach(isReadonly: boolean, isShallow: boolean) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Iterable {
|
|
||||||
[Symbol.iterator](): Iterator
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Iterator {
|
|
||||||
next(value?: any): IterationResult
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IterationResult {
|
|
||||||
value: any
|
|
||||||
done: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
function createIterableMethod(
|
function createIterableMethod(
|
||||||
method: string | symbol,
|
method: string | symbol,
|
||||||
isReadonly: boolean,
|
isReadonly: boolean,
|
||||||
|
@ -194,7 +181,7 @@ function createIterableMethod(
|
||||||
return function (
|
return function (
|
||||||
this: IterableCollections,
|
this: IterableCollections,
|
||||||
...args: unknown[]
|
...args: unknown[]
|
||||||
): Iterable & Iterator {
|
): Iterable<unknown> & Iterator<unknown> {
|
||||||
const target = (this as any)[ReactiveFlags.RAW]
|
const target = (this as any)[ReactiveFlags.RAW]
|
||||||
const rawTarget = toRaw(target)
|
const rawTarget = toRaw(target)
|
||||||
const targetIsMap = isMap(rawTarget)
|
const targetIsMap = isMap(rawTarget)
|
||||||
|
|
Loading…
Reference in New Issue