Skip to content

Fix broken examples and typos in the README - #37

Merged
NullVoxPopuli merged 1 commit into
ember-tooling:mainfrom
tylerturdenpants:fix-readme-pseudocode
Sep 8, 2026
Merged

NullVoxPopuli merged 1 commit into
ember-tooling:mainfrom
tylerturdenpants:fix-readme-pseudocode

Conversation

@tylerturdenpants

Copy link
Copy Markdown
Contributor

Several of the README's examples don't run. Each fix here was verified by executing the example against src/ and comparing to the documented output.

Broken syntax

  • The Transformer example had a stray paren before the params in both the asyncMap and asyncEach callbacks ((contents, coordinates => {), so neither block was valid JS.
  • The package.json snippet was fenced as ```js, which made it invalid JS.

Wrong API

  • The Transformer example called await t.transform(...), which is not a method on Transformer. Changed to t.asyncMap().
  • The reverseInnerCoordinates example imported reverseInnerCoordinates from the package root and called extractTemplates(file). Neither is exported from src/index.js, extractTemplates was never imported in the example, and templateInfos[0]! is a TS non-null assertion inside a ```js block. Rewritten against the public API (t.reverseInnerCoordinatesOf(t.parseResults[0], innerCoordinates)) and the heading renamed to match the method that actually exists.

Wrong documented output

  • The unprocess example claimed a result of just export default <template>hi there</template>;. The function preserves the type import and the satisfies clause, so the result block now shows what it really returns.

Docs gaps

  • Adds t.parseResultAt(coordinates) and t.toStringWithTemplatePlaceholders() to the Properties / Methods list. For parseResultAt the non-obvious part is documented: a partial coordinates object works, and { start }, { end }, or { line, column } are each enough to match.
  • Fixes prose typos: "keeping tracked of", "clasing", "any attributes are key-value pairs", "functions that wraps", "if anyone were done", and a closingTag value written as '</template' with no closing >.

All 7 JS blocks in the README now pass node --check; 3 of them failed before. Prettier, tsc --noEmit, and all 90 tests pass.

🤖 Generated with Claude Code

The Transformer example was not valid JS: both the asyncMap and asyncEach
callbacks had a stray paren before their params, and the example called
t.transform(), which is not a method on Transformer.

The reverseInnerCoordinates example imported reverseInnerCoordinates from
the package root and called extractTemplates(), neither of which is
exported from src/index.js, and used a TS non-null assertion inside a js
block. Rewritten against the public API, t.reverseInnerCoordinatesOf().

The documented unprocess output dropped the type import and the satisfies
clause that the function actually preserves. Replaced with its real
output. The package.json snippet was fenced as js, making it invalid JS.

Also documents parseResultAt() and toStringWithTemplatePlaceholders(),
which were missing from the method list, and fixes assorted prose typos.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@NullVoxPopuli NullVoxPopuli added the documentation Improvements or additions to documentation label Sep 8, 2026
@NullVoxPopuli
NullVoxPopuli merged commit 69a2a94 into ember-tooling:main Sep 8, 2026
4 checks passed
@github-actions github-actions Bot mentioned this pull request Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants