From 87923f6af12f8ede677a3830c269d9486d9d95de Mon Sep 17 00:00:00 2001 From: Tycho Date: Mon, 29 Jul 2024 21:26:48 +0800 Subject: [PATCH] chore(types): reuse built-in Iterator type (#11435) --- packages/reactivity/src/collectionHandlers.ts | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/packages/reactivity/src/collectionHandlers.ts b/packages/reactivity/src/collectionHandlers.ts index c39e3ed48cd..9098ad4a2e5 100644 --- a/packages/reactivity/src/collectionHandlers.ts +++ b/packages/reactivity/src/collectionHandlers.ts @@ -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( method: string | symbol, isReadonly: boolean, @@ -194,7 +181,7 @@ function createIterableMethod( return function ( this: IterableCollections, ...args: unknown[] - ): Iterable & Iterator { + ): Iterable & Iterator { const target = (this as any)[ReactiveFlags.RAW] const rawTarget = toRaw(target) const targetIsMap = isMap(rawTarget)