Repository navigation
Update chapter 03's closure and predicate rules to TypeScript 5.4/5.5, and tidy chapter 02 - #18
Merged
Merged
Conversation
JSX trims each line of a text block and joins the lines with one space.
The Chinese copy is wrapped across source lines throughout the course, so
it rendered with spaces between Chinese characters and around full-width
punctuation: 1,572 of them in 36 files.
- 1,548 line breaks are joined by a script that walks the TypeScript
syntax tree and touches only JSX text and JSX attribute strings, never
code samples, template literals or comments. Breaks next to Latin
letters, digits, expressions, "——" or operators keep their space.
- 24 more spaces go: 20 after full-width punctuation, 3 between Chinese
text and a tag whose text is Chinese, and one {" "} between a
full-width mark and Chinese text.
- test/zh-copy-spacing.test.ts, the check DataData and AlgoAlgo use,
scans every TSX file and fails on any new stray space; CLAUDE.md states
the rule.
Apart from the one {" "}, the diff changes nothing but whitespace. The
text every edited file renders differs from master only by deleted
spaces, each next to Chinese text, so the English copy is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…; tidy chapter 02 Chapter 03 - Narrowing in callbacks follows TypeScript 5.4: a callback keeps outside narrowing when it is created after the variable's last assignment. The code note, the callout, the key point and the quiz no longer teach "never reassigned anywhere in the function"; the quiz now says where x = 42 is written, and its explanations match the rule. - Inferred type predicates (TS 5.5) are described by their real conditions: no return type, one return statement, the parameter not modified, true exactly when narrowed. Arrow functions and declarations with one parameter or several qualify. - typeof does throw in the temporal dead zone; ! is introduced as the non-null assertion, not an annotation. Chapter 02 - The readonly quiz explanation no longer claims that TypeScript never adds anything to the output (chapter 08 shows parameter properties that do); it says readonly is erased like every type annotation. Both chapters - Formal Chinese register (no 坑, 一声不吭, 一刀切, 老老实实, 一场被夸大的战争 and the like), quiz titles 本章测验 / Chapter quiz, and aria-pressed on the selectable buttons of the signature, guards and order-status visuals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Deployment failed for project tser with the following error: Learn More: https://vercel.com/renrenmimis-projects?upgradeToPro=build-rate-limit |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Branches from #9 (commit
2148ad8), so it can be merged before or after it, and independently of #10–#17.It touches chapter 02 (
app/functions/page.tsx,viz.tsx,lib/functions-data.tsx) and chapter 03 (app/narrowing/page.tsx,viz.tsx,lib/narrowing-data.tsx). It does not touch the threeORDER_*presets, which #14 owns.Summary
Fixes from the 2026-10-09 content audit (
04-TSer-内容.md):o is Paid.letorconstin its temporal dead zone.!operator):!was called "a TypeScript annotation", while the term non-null assertion appeared only in the quiz.Changes
x = 42after theif, at the end of the function, and every explanation follows the 5.4 rule.!: it is introduced as 非空断言(non-null assertion).aria-pressedon.fn-sig-seg,.nr-gx-celland.nr-os-btn.Verification
npx tsc --noEmit --incremental false: clean.npm test: 6 files, 38 tests pass, includingzh-copy-spacing.npm run build: succeeds.value = 42after the callback, reports TS2339 onstring | number.function isPaidDecl(o) { const ok = …; return ok; }declaration and a(o, i) => …arrow are both inferred aso is Paid.boolean.typeofon aletbefore its declaration throwsReferenceErrorin Node 22.next start, both languages:🤖 Generated with Claude Code