Skip to content

fix(build): restore the react subpath types, and check the published paths - #171

Merged
jjeff merged 1 commit into
mainfrom
fix/react-subpath-types
Sep 4, 2026
Merged

jjeff merged 1 commit into
mainfrom
fix/react-subpath-types

Conversation

@jjeff

@jjeff jjeff commented Sep 3, 2026

Copy link
Copy Markdown
Owner

3.0.0 is broken for TypeScript consumers of resortable/react. Found when
a downstream app bumped to it and its lint job filled with Unsafe member access ... on a type that cannot be resolved.

What is wrong

package.json points exports["./react"].types — and the matching
typesVersions entry — at dist/types/react/index.d.ts. That file is not in
the 3.0.0 tarball. The vite-plugin-dts major upgrade in the dependency sweep
that went out with 3.0.0 changed where declarations land: they now mirror
src/ at the dist root, so the file is at dist/react/index.d.ts. The
manifest still describes the old layout.

Reproduced by type-checking a two-line consumer against each published tarball:

import { Sortable } from 'resortable'
import { useSortable } from 'resortable/react'
  • 2.3.0 — clean.
  • 3.0.0TS7016: Could not find a declaration file for module 'resortable/react'.

Confirmed under bundler, node16 and nodenext resolution. The main entry
is unaffected; only the React subpath broke.

Downstream the symptom does not look like a packaging problem at all:
useSortable resolves to any, so every property read off its events trips
@typescript-eslint/no-unsafe-member-access and the consumer's lint job
fails, in their own source files, with no mention of resortable.

Why CI did not catch it

Nothing here loads the published artifact. The unit and e2e suites run against
src/, bundle-size only weighs the bundles, and build only checks that the
build exits zero. The thing users actually install was the one thing no job
touched — which is how this shipped green.

npm run check:exports now verifies that every path named by main, module,
unpkg, types, exports and typesVersions exists after a build, and runs
in the build job. Checked against the real 3.0.0 manifest, it fails with:

package.json promises 2 file(s) that the build did not produce:

  exports../react.types
    → ./dist/types/react/index.d.ts
  typesVersions.*.react[0]
    → ./dist/types/react/index.d.ts

Also

Both build configs passed outDir: 'dist/types' to vite-plugin-dts. The
current major ignores it — output is byte-identical with the option removed —
so it is gone, replaced by a note recording where declarations actually go. A
config option describing a layout the build does not produce is a large part of
why this was invisible.

Testing

npm run check clean, 469 unit tests passing, and the consumer probe above
passes against a tarball packed from this branch under all three resolution
modes.

This wants a patch release. Anything on 3.0.0 using the React adapter with
TypeScript is broken until then, and the fix is manifest-only — no API change.

🤖 Generated with Claude Code

https://claude.ai/code/session_016znpWBRUXSTsHbJcKmVpN6


🤖 Created with Claude Code · origin interactive · 2026-09-03 19:36 UTC

…paths

3.0.0 shipped `resortable/react` with no usable types. `package.json` pointed
`exports["./react"].types`, and the matching `typesVersions` entry, at
`dist/types/react/index.d.ts` — a file that release does not contain. The
`vite-plugin-dts` major upgrade in the same release changed where declarations
land, from `dist/types/` to mirroring `src/` at the dist root, and the manifest
was never updated.

TypeScript consumers get `TS7016: Could not find a declaration file for module
'resortable/react'`, so `useSortable` resolves to `any` and every property read
off its events becomes a lint error in their own build. 2.3.0 is unaffected.
Verified both ways by type-checking a consumer against each published tarball,
under bundler, node16 and nodenext resolution.

The declared paths now match what the build produces.

Nothing here would have caught it. The unit and e2e suites run against `src/`,
and bundle-size only weighs the bundles — the artifact users install is the one
thing no job loads, which is how this shipped with CI fully green.
`npm run check:exports` now verifies every path named by `main`, `module`,
`unpkg`, `types`, `exports` and `typesVersions`, and runs in the build job. It
fails on the exact 3.0.0 manifest.

Also removes the `outDir: 'dist/types'` passed to `vite-plugin-dts` in both
build configs: the current major ignores it, and the output is byte-identical
without it. A config option that describes a layout the build does not produce
is what made this hard to see.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_016znpWBRUXSTsHbJcKmVpN6
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@jjeff
jjeff merged commit d4444ad into main Sep 4, 2026
16 checks passed
@jjeff
jjeff deleted the fix/react-subpath-types branch September 4, 2026 00:44
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 3.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant