Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
chore: tweak example, skip typecasting (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
KATT authored Oct 6, 2023
1 parent 2bafe15 commit efb29e6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions examples/async/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ResponseShape>(stringIterator);

// we can now use the output as a normal object
console.log({ output });
Expand Down
3 changes: 1 addition & 2 deletions src/async/deserializeAsync.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<MockObj>(stringIterator);

expect(parsed.foo).toEqual("bar");

Expand Down

0 comments on commit efb29e6

Please sign in to comment.