chore(types): reuse built-in Iterator type (#11435)

This commit is contained in:
Tycho 2024-07-29 21:26:48 +08:00 committed by GitHub
parent 208f5c04e7
commit 87923f6af1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 14 deletions

View File

@ -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)