From 149f51d3d9a03b41b3427679f189534eee0ed153 Mon Sep 17 00:00:00 2001 From: Sebastian Moser Date: Sat, 29 Jul 2023 09:09:51 +0100 Subject: [PATCH] Fixing syntax error in todos.md (#57) * Fixing syntax error & TypeScript warning in todos.md This fixes two small code issues that I came across was I was following the tutorial: First, a syntax error in `todoActions$`. Secondly, a TypeScript warning in the definition of `useTodos`: ``` Type 'IterableIterator' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher. ``` Replacing `[...todosMap.values()]` with `Array.from(todosMap.values())` makes that warning go away without customising TypeScript from its default value. * Revert TypeScript warning --- docs/tutorial/todos.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/tutorial/todos.md b/docs/tutorial/todos.md index 13ecec6..78cf6cb 100644 --- a/docs/tutorial/todos.md +++ b/docs/tutorial/todos.md @@ -51,10 +51,10 @@ Which is basically the same as doing this (but a lot shorter, of course :smile:) ```tsx const todoActions$ = merge( - newTodo$.pipe(map(text, id) => ({ - type: "add" as const + newTodo$.pipe(map((text, id) => ({ + type: "add" as const, payload: { id, text }, - })), + }))), editTodo$.pipe(map(payload => ({ type: "edit" as const, payload,