Skip to content

✨ feat: add Configuration Options > Secret Messages appetizer project - #82

Merged
JoshuaKGoldberg merged 1 commit into
mainfrom
secret-messages
Jun 7, 2022
Merged

JoshuaKGoldberg merged 1 commit into
mainfrom
secret-messages

Conversation

@JoshuaKGoldberg

Copy link
Copy Markdown
Contributor

Overview

It's hard to think of configuration option appetizer projects...

@JoshuaKGoldberg JoshuaKGoldberg changed the title ✨ feat: add new Configuration Options > Secret Messages appetizer project ✨ feat: add Configuration Options > Secret Messages appetizer project Jun 7, 2022
@JoshuaKGoldberg
JoshuaKGoldberg marked this pull request as ready for review June 7, 2022 13:11
@JoshuaKGoldberg
JoshuaKGoldberg merged commit 9a952eb into main Jun 7, 2022
@JoshuaKGoldberg
JoshuaKGoldberg deleted the secret-messages branch June 7, 2022 13:11
JoshuaKGoldberg added a commit that referenced this pull request Sep 22, 2026
`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 until this PR hit it.

Three errors, all in `02-allowed-imports/index.ts`:

- `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, along with `noEmit` to avoid TS5055 overwriting
  `answer.js`.
- `message.codePointAt(i)` is not strict-safe. Its counterpart in
  `01-encoded-outputs/index.ts` already writes `message.codePointAt(i)!`,
  so this matches the sibling step.

The exercise is untouched: `npm run tsc -- --project 02-allowed-imports`
still reads the step TSConfig, and `solution.test.ts` still asserts the
reader added the options there.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
JoshuaKGoldberg added a commit that referenced this pull request Sep 22, 2026
`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 added a commit that referenced this pull request Sep 22, 2026
`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>
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.

1 participant