Repository navigation
Qualify chapter 09's module and declaration-lookup rules, and update chapter 08's details - #21
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>
…ter 08's details Chapter 09 - Whether a file is a module is decided by the file only with the default moduleDetection: with "force", which TypeScript 5.9's tsc --init writes, every non-declaration file is a module. The callout (title and text) and the quiz now say so; declaration files still follow the top-level import/export rule, so the .d.ts discussion is unchanged. - The three sources of a library's types are a checklist, not the compiler's lookup order: a declare module you have already written takes precedence over the package's types and @types. The section summary, the flow's first and last frames and the key point say so, with the practical advice to delete a stopgap declaration once real types exist. Chapter 08 - Since TypeScript 5.1 a getter and a setter may have unrelated types when both are annotated; #field keeps a value out of JSON.stringify and logs, but DevTools still shows it. Both chapters - Formal Chinese register (老老实实, 撞上, 坑) and the course terms 注解 / 标记 instead of 标注; quiz titles 本章测验 / Chapter quiz; aria-pressed on the segmented buttons of the member, placement, erasure and output 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 |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 06cb4c6806
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| not decide whether a given file is a module. By default the | ||
| file itself does that, by having a top-level import or export. | ||
| A separate option, <code>moduleDetection</code>, can change the | ||
| rule: with <code>"force"</code>, every non-declaration | ||
| file is treated as a module, and that is what{" "} |
There was a problem hiding this comment.
Account for all automatic module-detection signals
With the default moduleDetection: "auto", top-level imports and exports are not the only signals: under module: "node16"/"nodenext", a surrounding package.json with "type": "module" also makes an import-free .ts file a module, and automatic JSX modes provide another signal. Consequently, the new explanation and the corresponding quiz incorrectly classify such files as global scripts; describe the full auto behavior or explicitly qualify the rule as moduleDetection: "legacy".
Useful? React with 👍 / 👎.
| for (const m of raw.matchAll(/(\S)( +)(\S)/g)) { | ||
| const a = m[1], b = m[3]; | ||
| const stray = (PUNCT.test(a) || (a === "…" && closesChinese(raw, m.index!))) && ZH.test(b) && b !== "—"; | ||
| if (stray) at(start + m.index!, `space ${a} ${b}`); |
There was a problem hiding this comment.
Detect same-line spaces between Chinese characters
The same-line check only treats punctuation or an ellipsis as a problematic left edge, so an ordinary Han-space-Han sequence is silently accepted despite the test's stated invariant. For example, the current app/type-magic/page.tsx:1775 text 模板字面量类型 的 passes this test, leaving exactly the rendered stray space the new suite is intended to prevent.
Useful? React with 👍 / 👎.
Branches from #9 (commit
2148ad8), so it can be merged before or after it, and independently of #10–#20.It touches chapter 08 (
app/classes/page.tsx,viz.tsx,lib/classes-data.tsx) and chapter 09 (app/modules/page.tsx,viz.tsx,lib/modules-data.tsx).Summary
Fixes from the 2026-10-09 content audit (
04-TSer-内容.md):moduleDetectiondecides the rule as well. TypeScript 5.9'stsc --init, which the prologue tells readers to run, writes"force".const TAXcompile without the TS2451 that the quiz describes.declare module "x"that you wrote takes precedence over the package's own types and over@types.any.import typemarker.Changes
moduleDetectionand"force", and notes that.d.tsfiles are not affected.JSON.stringifyand logs, but not out of DevTools.aria-pressedon theseg-btnbuttons.Verification
npx tsc --noEmit --incremental false: clean.npm test: 6 files, 38 tests pass, includingzh-copy-spacing.npm run build: succeeds.tsc5.9.3 in scratch projects:moduleDetection: thetsc --initconfig compiles the two scripts, and--moduleDetection autoreports TS2451.declare module "boba-ui", the package'srenderis missing (TS2305), and a shorthanddeclare module "boba-ui";hides a TS2554.#vaultCodeinprivateProperties.next start, both languages: the new text is present, the old claims are gone, and there are 0 console errors.🤖 Generated with Claude Code