From 92717d8562be5b3ee40c70af50c7636bd12c1e92 Mon Sep 17 00:00:00 2001 From: slikts Date: Tue, 24 Jan 2023 16:53:52 +0000 Subject: [PATCH] fix(Buffer): iterable types --- src/Buffer.spec.ts | 2 +- src/Buffer.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Buffer.spec.ts b/src/Buffer.spec.ts index c8a31061..132e0152 100644 --- a/src/Buffer.spec.ts +++ b/src/Buffer.spec.ts @@ -75,7 +75,7 @@ describe('Buffer', () => { }); it('constructs from an iterable', () => { - const q = Buffer.from([1, 2, 3], 2); + const q: Iterable = Buffer.from([1, 2, 3], 2); expect([...q]).toEqual([2, 3]); }); diff --git a/src/Buffer.ts b/src/Buffer.ts index 9364a7db..42bd4178 100644 --- a/src/Buffer.ts +++ b/src/Buffer.ts @@ -61,10 +61,11 @@ export default class Buffer { return this.length > 0 ? { value: this.dequeue(), - done: false, + done: false as const, } : { - done: true, + done: true as const, + value: undefined, }; }, [Symbol.iterator]() {