The first round caught only the exact defect we already shipped. These
four catch adjacent foot-guns of the same class — silent breakage of
TypeScript consumers driven by a malformed `package.json` or a build
that emits to the wrong place.
1. `types` is listed FIRST in `exports['.']`. TypeScript's
exports-condition resolution is order-sensitive — `types` after
`import`/`require` is silently ignored under `node16` / `nodenext`
/ `bundler` resolution. A perfectly innocent refactor that re-orders
the conditions object turns the package back into `any` for half
the ecosystem; this assertion catches it before publish.
2. Every condition in `exports['.']` points at an existing file
post-build. Catches a typo in any of `types` / `import` / `require`
/ `browser` — not just `types`.
3. `main`, `module`, `browser`, `types` top-level fields all point at
existing files. Same idea for pre-`exports`-aware consumers (old
bundlers, some tooling).
4. `files` array includes the dist directory. `files` is what npm pack
ships; a misguided narrowing (`files: ["dist/cjs"]`) silently
removes the types from the published tarball even though local
`npm run build` keeps producing them.
Also added: a re-check for the core `Neurosity` class re-export in the
built types file (pairs with the firebase namespaces check).
`npm test`: 172 total (was 167), 166 pass + 6 skipped, none broken.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>