Skip to content

Commit b518a22

Browse files
committed
Update parseJson example for clearer error typing
1 parent 0b2713f commit b518a22

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

packages/common/src/Result.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,10 @@ export const getOrThrow = <T, E>(result: Result<T, E>): T => {
380380
* const parseJson = (value: string): Result<unknown, ParseJsonError> =>
381381
* trySync(
382382
* () => JSON.parse(value) as unknown,
383-
* (error) => ({ type: "ParseJsonError", message: String(error) }),
383+
* (error): ParseJsonError => ({
384+
* type: "ParseJsonError",
385+
* message: String(error),
386+
* }),
384387
* );
385388
* ```
386389
*/

0 commit comments

Comments
 (0)