Skip to content

fix: make secret-messages type-check at the project level - #339

Merged
JoshuaKGoldberg merged 1 commit into
mainfrom
fix-secret-messages-project-tsc
Sep 22, 2026
Merged

JoshuaKGoldberg merged 1 commit into
mainfrom
fix-secret-messages-project-tsc

Conversation

@JoshuaKGoldberg

@JoshuaKGoldberg JoshuaKGoldberg commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

PR Checklist

Overview

A project-level tsc compiles both steps against secret-messages/tsconfig.json and never reads the step TSConfigs.

  • Adds allowJs and resolveJsonModule to the project TSConfig, plus noEmit — without it allowJs hits TS5055 overwriting answer.js.
  • Switches both steps from codePointAt to charCodeAt, which returns number rather than number | undefined and pairs more naturally with fromCharCode.

`check-solutions.sh "tsc"` runs a bare `npm run tsc` in every project,
which for secret-messages compiles both steps against the project-level
TSConfig. That has failed since the project was added in #82, but the
all-projects branch only runs when a PR touches no `projects/**` files,
so it went unnoticed.

`answer.js` and `guesses.json` need `allowJs` and `resolveJsonModule`,
which exist only in the step's own TSConfig -- the file the reader fills
in, and which a project-level `tsc` never reads. Adds them to the
project TSConfig, with `noEmit` to avoid TS5055 overwriting `answer.js`.

`message.codePointAt(i)` is typed `number | undefined`, so it needs a
non-null assertion under `strict`. Switches both steps to `charCodeAt`,
which returns `number` and pairs more naturally with `fromCharCode`.
That also drops the `!` from `01-encoded-outputs`, which was the only
non-null assertion in the repository -- worth avoiding in a chapter 13
project regardless. Output is unchanged: the two differ only for
characters above the BMP, and these messages are ASCII.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@JoshuaKGoldberg
JoshuaKGoldberg force-pushed the fix-secret-messages-project-tsc branch from 476d444 to 7514b70 Compare September 22, 2026 13:17
@JoshuaKGoldberg
JoshuaKGoldberg marked this pull request as ready for review September 22, 2026 13:24
@JoshuaKGoldberg
JoshuaKGoldberg merged commit 2849444 into main Sep 22, 2026
7 checks passed
@JoshuaKGoldberg
JoshuaKGoldberg deleted the fix-secret-messages-project-tsc branch September 22, 2026 13:24
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.

🐛 Bug: [secret-messages] project-level tsc fails

1 participant