Skip to content
This repository was archived by the owner on Sep 29, 2025. It is now read-only.

Commit 69018d3

Browse files
authored
Publish todo app (#16)
* CompletedTodo * Intersection types * Implement completeAll() * Summary and section headers * Add example to slide 14 * Done with section 2 * Start separator * Finish slide 20 * Addition to slide 20 * Update showMarkAllAsCompleted * Start slide 21 * Finish slide 21 * Start slide 22 * Continue with todo * Optional properties * Remove completeAll() rewrite * SImplify * Remove optional properties from section 1 * Start location labels * Completely remove separator * Location labels * Done with slide 21 * Start slide 22 * Done with slide 21 * Continue with slide 22-23 * Remove react * Comment * Clarify slide 22 * Start slide 23 * Compile failure * Finish slide 23 * Update slide 23 * Simplify * Finish slide 24 * Update intro * Wordsmith * Simplify * Wordsmith * Wordsmith slide 1 * Wordsmith slide 3 * Start rewriting slide 4 * Update about me * Wordsmith slide 4 * Finish slide 5 * Wordsmith slide 6 * Finish slide 7 * Wordsmith slide 8 * Wordsmith slide 10 * Wordsmith 12 * Slide 13 wordsmith * Wordsmith 14 * Up to slide 16 * Wordsmith slide 17 * Wordsmith slide 19 * Wordsmith slide 21 * Done with wordsmith * Add to articleKeys
1 parent 34d465e commit 69018d3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+2716
-596
lines changed

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
"options": {
88
"printWidth": 48
99
}
10+
},
11+
{
12+
"files": ["snippets/snippets/**/longerWidth/*.ts"],
13+
"options": {
14+
"printWidth": 53
15+
}
1016
}
1117
]
1218
}

snippets/bin/generateSnippetsBundle.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const regenerate = () => {
99
const contents = fs.readFileSync(file, 'utf8')
1010
return `export const ${file
1111
.replace(/\.\/snippets\/snippets\/\w+\//, '')
12+
.replace(/longerWidth\//, '')
1213
.replace(/\.ts/, '')} = \`${contents
1314
.trim()
1415
.replace(/^;/m, '')

snippets/snippets/todo/bpmz.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
type CompletedTodo = Readonly<{
2+
id: number
3+
text: string
4+
done: true
5+
}>

snippets/snippets/todo/csum.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// todo must match the Todo type
1+
// Parameter "todo" must match the Todo type
22
function toggleTodo(todo: Todo) {
33
// ...
44
}

snippets/snippets/todo/dxfc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Associated data. If we're using React, this
2-
// would be the todo component’s props or state
2+
// would be the component’s props or state
33
;[
44
{ id: 1, text: 'First todo', done: false },
55
{ id: 2, text: 'Second todo', done: false }

snippets/snippets/todo/eega.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
else {
2+
// place = 'work' or { custom: string }, and
3+
// place.custom is invalid if place = 'work'
4+
return 'pinEmoji ' + place.custom
5+
}

snippets/snippets/todo/frtm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ type Todo = {
55
}
66

77
// Make sure that the input and the output
8-
// is of the correct type
8+
// are of the correct type (both must be Todo)
99
function toggleTodo(todo: Todo): Todo {
1010
// ...
1111
}

snippets/snippets/todo/hquv.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
;[
2+
// ...
3+
// ...
4+
// ...
5+
// ...
6+
// No place property
7+
{ id: 5, text: 'Read a book', done: false }
8+
]

snippets/snippets/todo/hszk.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
function completeAll(
2+
todos: readonly Todo[]
3+
): CompletedTodo[] {
4+
return todos.map(todo => ({
5+
...todo,
6+
done: true
7+
}))
8+
}

snippets/snippets/todo/jkjo.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)