Browse Source

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

Tycho 1 year ago
parent
commit
87923f6af1
1 changed files with 1 additions and 14 deletions
  1. 1 14
      packages/reactivity/src/collectionHandlers.ts

+ 1 - 14
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<unknown> & Iterator<unknown> {
     const target = (this as any)[ReactiveFlags.RAW]
     const rawTarget = toRaw(target)
     const targetIsMap = isMap(rawTarget)