Skip to content

Commit

Permalink
Fix typos in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
lydell committed Nov 30, 2024
1 parent 5f58e54 commit cc9db0e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/decode-constrained.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test("decode constrained", () => {
});

// `.decoder` of a codec usually accepts `unknown` – you can pass in anything.
// This function constrains us constrain so we can only decode what the codec
// This function constrains us so that we can only decode what the codec
// has encoded.
function decodeConstrained<Decoded, Encoded>(
codec: Codec<Decoded, Encoded>,
Expand Down
6 changes: 3 additions & 3 deletions examples/recursive.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ test("recursive data structure", () => {
};

// This wouldn’t work to decode it, because we’re trying to use
// `personDecoder` in the definition of `personDecoder` itself.
// `personCodec` in the definition of `personCodec` itself.
/*
const personCodec = fields<Person>({
name: string,
friends: array(personDecoder2), // ReferenceError: Cannot access 'personDecoder2' before initialization
friends: array(personCodec), // ReferenceError: Cannot access 'personCodec' before initialization
});
*/

// `recursive` lets us delay when `personDecoder` is referenced, solving the
// `recursive` lets us delay when `personCodec` is referenced, solving the
// issue.
const personCodec: Codec<Person> = fields({
name: string,
Expand Down

0 comments on commit cc9db0e

Please sign in to comment.