From efb29e6f35b14e34d470fccdeebf02af159c724d Mon Sep 17 00:00:00 2001 From: Alex / KATT Date: Fri, 6 Oct 2023 13:27:48 +0200 Subject: [PATCH] chore: tweak example, skip typecasting (#36) --- examples/async/src/client.ts | 3 +-- src/async/deserializeAsync.test.ts | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/examples/async/src/client.ts b/examples/async/src/client.ts index 5ca6bff6..e09a4a32 100644 --- a/examples/async/src/client.ts +++ b/examples/async/src/client.ts @@ -25,8 +25,7 @@ async function main() { ); // ✨ ✨ ✨ ✨ parse the response body stream ✨ ✨ ✨ ✨ ✨ - const parsedUntyped = await tsonAsync.parse(stringIterator); - const output = parsedUntyped as ResponseShape; + const output = await tsonAsync.parse(stringIterator); // we can now use the output as a normal object console.log({ output }); diff --git a/src/async/deserializeAsync.test.ts b/src/async/deserializeAsync.test.ts index acd6d6af..16cdb49b 100644 --- a/src/async/deserializeAsync.test.ts +++ b/src/async/deserializeAsync.test.ts @@ -183,8 +183,7 @@ test("e2e: stringify async iterable and promise over the network", async () => { (v) => textDecoder.decode(v), ); - const parsedRaw = await tson.parse(stringIterator); - const parsed = parsedRaw as MockObj; + const parsed = await tson.parse(stringIterator); expect(parsed.foo).toEqual("bar");