Skip to content

fix(0.x): emit type module marker in _types package.json - #579

Merged
jxom merged 1 commit into
0.xfrom
fix/0.x-types-module-marker
Nov 8, 2026
Merged

jxom merged 1 commit into
0.xfrom
fix/0.x-types-module-marker

Conversation

@jxom

@jxom jxom commented Nov 8, 2026

Copy link
Copy Markdown
Member

Supersedes #467 (thanks @javadtavakoli; credited as co-author).

build:types now writes {"type":"module"} to src/_types/package.json, matching the _esm and _cjs markers. The published root package.json has no type, so _types/**/*.d.ts currently resolve as CommonJS and ESM consumers on TypeScript node16 (or nodenext before TypeScript 5.8) get TS1479/TS1541 inside node_modules/ox/_types.

This is the same change viem shipped in wevm/viem#4903, and matches how abitype types already resolve.

Tradeoff: one types file serves both import and default, so after this change CommonJS consumers on node16 see TS1479 on import ... from 'ox' in their own files (runtime require still works). The changeset tells them to use nodenext or bundler resolution. main (1.x) is unaffected: it is ESM-only with "type": "module" at the root.

Checked with a packed tarball (pnpm build, scripts/prepublish.ts, npm pack) and tsc --noEmit --strict on TypeScript 5.9.3:

consumer node16 nodenext
ESM, before (0.14.63) 12 errors in ox/_types 0
ESM, after 0 0
CJS, after 2 × TS1479 in consumer file 0
ox@main ESM 0 0

Supersedes #467.

Co-authored-by: Javad Tavakoli <16999504+javadtavakoli@users.noreply.github.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1bc8e-d920-74b4-aabe-ef8b2e6421b2
Co-authored-by: jxom <jake@tempo.xyz>
@vercel

vercel Bot commented Nov 8, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
ox Building Building Preview Nov 8, 2026 7:48pm UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T19:49:04.447291Z 32d1dfc PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@jxom
jxom merged commit 90b00c7 into 0.x Nov 8, 2026
13 of 14 checks passed
@jxom
jxom deleted the fix/0.x-types-module-marker branch November 8, 2026 19:51
@github-actions github-actions Bot mentioned this pull request Nov 8, 2026

This branch was successfully deployed

1 active deployment
Preview — 32d1dfcf Deployed Nov 8, 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