Skip to content

First module.f.mjs file. - #1452

Merged
sergey-shandar merged 14 commits into
mainfrom
second
Aug 7, 2026
Merged

First module.f.mjs file.#1452
sergey-shandar merged 14 commits into
mainfrom
second

Conversation

@sergey-shandar

@sergey-shandar sergey-shandar commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Migrate fjs/asserts/module.f.ts to authored module.f.mjs with equivalent JSDoc types and update its importers.

Dependency

This PR is stacked on #1451 (first) and must land after it. #1451 enables allowJs / checkJs, adds .mjs / .d.mts package support, and uses the verified two-pass prepack required before authored .mjs enters the repository.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
functionalscript 612330f Commit Preview URL

Branch Preview URL
Aug 07 2026, 09:09 PM

@sergey-shandar
sergey-shandar marked this pull request as draft August 7, 2026 15:46
@sergey-shandar sergey-shandar changed the title second First module.f.mjs file. Aug 7, 2026
@sergey-shandar

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e89cc9e6da

ℹ️ 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".

Comment thread fjs/asserts/module.f.mjs

@o2alexanderfedin o2alexanderfedin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving. The risky part of this change is that a TS→JSDoc translation can silently weaken a type contract while the suite stays green, so I mutated rather than read.

Proof discovery is intact

npm test on this branch and on main, same machine:

main:   Number of tests: pass: 2354, fail: 0, total: 2354
second: Number of tests: pass: 2354, fail: 0, total: 2354

No proofs were lost to the rename — fjs/dev/module.f.ts already recognises .f.mjs, and proof.f.ts next to the renamed module still resolves it.

All three type contracts survive, each confirmed by mutation

  • asserts v narrowing is live. A probe that returns a narrowed string | null compiles clean; strip asserts v from the JSDoc @type and it goes red with TS2322: Type 'string | null' is not assignable to type 'string'. The assertion signature really is carried by the @type annotation, not quietly dropped.
  • assertNotNullish still returns T. The same mutation turns its own body red ('T | null | undefined' is not assignable to 'T').
  • Assert<T> is still exported and still constrained. Assert<true> compiles; Assert<false> errors TS2344: Type 'false' does not satisfy the constraint 'true'. Worth confirming explicitly, since a JSDoc @typedef has no export keyword and it would be easy to assume the export was lost.

The other ~100 files are mechanical module.f.tsmodule.f.mjs import rewrites.

Nit, non-blocking

assertNotNullish = (a, msg = undefined) adds a default the original msg?: unknown didn't have. It's a no-op — msg is already undefined when omitted — so it just adds a token. Fine either way.

One note: this is stacked on #1451, so it inherits the packaging point I raised there.

@o2alexanderfedin o2alexanderfedin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-verified at 1c6039da after the rebase onto the updated first. Still good.

  • Nit addressedassertNotNullish is back to (a, msg) with no redundant default.
  • Proof count unchanged: npm testpass: 2354, fail: 0, total: 2354, identical to main.
  • The three type contracts still hold, re-confirmed by mutation on this head, not carried over from the last review:
    • probe relying on asserts v narrowing compiles clean; strip asserts v from the @type and it goes red (TS2322: Type 'string | null' is not assignable to type 'string').
    • the same mutation reddens assertNotNullish's own body, so its T return is still real.
    • Assert<true> compiles, Assert<false> errors TS2344.

The packaging point I raised on #1451 is resolved there (the rule was corrected rather than the code — see my comment on that PR), so nothing carries over to this one.

@sergey-shandar
sergey-shandar marked this pull request as ready for review August 7, 2026 21:03
Base automatically changed from first to main August 7, 2026 21:08
@sergey-shandar
sergey-shandar added this pull request to the merge queue Aug 7, 2026
Merged via the queue into main with commit 982dd88 Aug 7, 2026
19 checks passed
This was referenced Aug 8, 2026
@sergey-shandar
sergey-shandar deleted the second branch August 8, 2026 21:07
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