Skip to content

Correct the prologue and chapter 01: tsc still emits on errors, and arithmetic on any is a number - #17

Merged
renrenmimi merged 2 commits into
masterfrom
fix/content-home-types
Oct 10, 2026
Merged

renrenmimi merged 2 commits into
masterfrom
fix/content-home-types

Conversation

@renrenmimi

Copy link
Copy Markdown
Owner

Branches from #9 (commit 2148ad8), so it can be merged before or after it, and independently of #10–#16.

It touches the prologue (app/page.tsx, app/home-viz.tsx, lib/home-data.tsx) and chapter 01 (app/types/page.tsx apart from the WIDEN_CONST preset that #14 owns, app/types/viz.tsx, lib/types-data.tsx). It also changes one string in lib/curriculum.ts: the prologue's Chinese essence, at line 55, far from the chapterByPath region that #10 changes.

Summary

Fixes from the 2026-10-09 content audit (04-TSer-内容.md):

  • B1 (high)
    • The error: the prologue said tsc refuses to write output when there is a type error. The local-run task even asked the reader to "see the compiler refuse".
    • What tsc actually does: it writes order.js anyway and exits with code 2. Chapter 10 and the finale say so.
  • B2 (high): chapter 01's any example was wrong. data.prise * 2 is a number, so the next line total.toUpperCase() is reported as TS2339. The callout and the quiz also said "a result computed from it" becomes any.
  • B5: the diff task said "everything else is the same", but TypeScript 5.9's tsc --init also adds "use strict", an exports line, a source-map comment and .d.ts/.map files.
  • B14:
    • "Every line of JavaScript is still valid" was stated without qualification.
    • "Every error message has three parts" is not true of every message.
    • The text implied null only appears if someone assigns it by hand.
    • The timeline quoted an abbreviated TS2551 message.
    • Chapter 01's Chinese text alone had a "95%" figure.
  • B21 (chapter quiz titles): the quiz sections used the gaming term 通关测验.
  • B22 (register): colloquial Chinese in these two chapters, including 炸, 坑, 吭声, 十万八千里, 人话, 红线伺候, 认个脸, 当场落网, 姿势 and 围观.
  • B23 (terms): hover → 悬停, Labs → 动手任务, 标注 → 注解.
  • A26 (chapter 01 visual): the ID-card wall and the type-lens lines did not expose their selected state.

Changes

  • Prologue
    • Terminal comments: they now read "reports totle, still writes order.js" / 「order.js 仍会生成」.
    • tsc note: it says the two jobs are independent: by default a type error does not stop the .js.
    • Local-run task solution: it explains the extra diff lines and files. It also states that tsc reports TS2322, exits non-zero and still rewrites order.js, with a pointer to noEmitOnError in chapter 10.
    • Superset statements: reworded to "valid syntax, and the checker may then point out problems".
    • Error-message statement: reworded to "most messages can be read in three parts".
    • null statement: now says null is put there on purpose by some code, including APIs such as document.querySelector.
    • Full TS2551 message: the timeline now quotes "… on type '{ drink: string; total: number; }'. Did you mean 'total'?".
  • Chapter 01
    • any.ts: it now reads const price = data.prise; and then price.toUpperCase(). Both lines stay silent and fail only at run time, with Cannot read properties of undefined (reading 'toUpperCase').
    • Note, callout and quiz explanation: they say a property read or a call on any gives any, while arithmetic still gives number.
  • Copy: the Chinese register throughout, 本章测验 for the quiz titles, the 悬停 / 动手任务 / 注解 terms, the matching essence in lib/curriculum.ts, and a Chinese title that now matches the English one ("seven basic types").
  • Visual: aria-pressed on .tp-wall-chip and .tp-lens-line.

Verification

  • npx tsc --noEmit --incremental false: clean.
  • npm test: 6 files, 38 tests pass. This includes zh-copy-spacing, and every rewritten Chinese paragraph is on one line.
  • npm run build: succeeds.
  • New any.ts: compiled with the lab's worker and TypeScript 5.9.3, both language versions give 0 diagnostics, and label is any. The runtime message was checked in Node 22.
  • tsc claims: the prologue's claims (TS2322, exit code 2, order.js rewritten, the extra diff lines) were verified with the real tsc 5.9.3 and its tsc --init config during the audit.
  • Headless Chrome against a local next start, both languages:

🤖 Generated with Claude Code

renrenmimi and others added 2 commits October 9, 2026 16:07
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>
…rithmetic is number

Prologue
- tsc writes the .js even when it reports a type error (noEmitOnError is off, including in
  the tsconfig.json that tsc --init writes). The terminal comments, the tsc note and the
  local-run task no longer say the compiler refuses or produces nothing; the task now says
  it reports TS2322, exits non-zero and still rewrites order.js, and points to chapter 10.
- The diff task describes what TypeScript 5.9's tsc --init really produces: "use strict",
  the exports line, the sourceMappingURL comment and the .d.ts/.map files.
- "Every line of JavaScript is still valid" becomes valid syntax that the checker may
  still flag; not every error message has a suggestion; null also comes from APIs; the
  timeline quotes the full TS2551 message.

Chapter 01
- The any example no longer contradicts the compiler: data.prise * 2 is a number, so the
  next line was an error (TS2339). It now reads a property, which really stays any, and the
  note, the callout and the quiz explanation say that arithmetic on any gives number.
- The Chinese-only "95%" now says "most of the time", as the English does.

Both chapters and the prologue's sidebar summary
- Chinese copy in a formal register: no 炸, 坑, 吭声, 十万八千里, 人话, 认个脸 and similar;
  quiz titles read 本章测验 as on the sister sites; 悬停 instead of hover; 动手任务
  instead of Labs; 注解 instead of 标注.
- The ID-card and type-lens buttons in the chapter 01 visual expose aria-pressed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 10, 2026 05:45
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@vercel

vercel Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
tser Ready Ready Preview Oct 10, 2026 5:45am UTC

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This branch was successfully deployed

1 active deployment
Preview — ace7cf40 Deployed Oct 10, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants