#6895·heroui

Type declarations are published without file extensions, breaking moduleResolution: nodenext

Author: thiagocorbalanCreated Sep 21, 2026Updated Sep 22, 2026
Labelstype/bugneeds-infoP1pkg/reactpkg/stylesarea/typesarea/build

Summary

Every relative specifier in the published .d.ts files is written without a file extension. In a package with "type": "module", TypeScript under moduleResolution: "nodenext" (or "node16") cannot follow them, so the whole type surface of @heroui/react collapses to the three names that come from tailwind-variants.

The JavaScript emit is correct — it is only the declaration emit that is affected:

@heroui/[email protected]/dist relative specifiers without extension
*.js (213 modules) 386 0
*.d.ts (213 files) 386 386

Runtime is completely unaffected: import("@heroui/react") resolves and yields 538 exports.

What the consumer actually sees

The failure is misattributed, which is why I think it is worth an issue rather than a silent workaround. With the default skipLibCheck: true, the real diagnostic is suppressed and the only error left points at the import site:

a.ts(1,10): error TS2305: Module '"@heroui/react"' has no exported member 'Button'.

That reads as "HeroUI does not export Button". Turning skipLibCheck off shows the actual cause:

node_modules/@heroui/react/dist/index.d.ts(1,15): error TS2834: Relative import paths need explicit
  file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'.
node_modules/@heroui/react/dist/index.d.ts(2,15): error TS2834: ...
node_modules/@heroui/react/dist/index.d.ts(3,15): error TS2835: ... Did you mean './utils/dom.js'?

dist/index.d.ts is four lines, and three of them are unresolvable:

typescript
export * from "./components";
export * from "./hooks";
export * from "./utils/dom";
export { tv, cn, type VariantProps } from "tailwind-variants";

The same shape repeats throughout the tree (components/index.d.ts → export * from "./accordion", and so on), so no subpath entry escapes it. @heroui/styles has the same pattern.

Reproduction

bash
npm init -y
npm i @heroui/[email protected] react@19 react-dom@19 [email protected]
echo 'import { Button } from "@heroui/react";' > a.ts
json
{
  "compilerOptions": {
    "module": "nodenext",
    "moduleResolution": "nodenext",
    "target": "es2022",
    "jsx": "react-jsx",
    "strict": true,
    "noEmit": true
  },
  "files": ["a.ts"]
}
bash
npx tsc -p tsconfig.json   →  TS2305: has no exported member 'Button'

Switching only moduleResolution to "bundler" makes the same file compile, and the module resolves with 1058 names.

Environment: TypeScript 5.9.3, Node 24, npm 11, Linux. @heroui/[email protected], @heroui/[email protected].

Notes

  • There is no typesVersions field in the package, so there is no alternate declaration path to fall back to.
  • Rewriting the 386 specifiers locally (./x → ./x.js, 231 files) makes nodenext resolve the full surface with real types, which confirms the extension is the only cause.
  • #5857 appears to address exactly this and was closed without merge; it carries no human comment, so I could not tell whether it was rejected on the merits or simply went stale.

Consumers on moduleResolution: "bundler" are unaffected, which is probably why this has gone unreported — but anything published as a library and type-checked under Node's own resolution mode hits it, and the error message sends the reader to the wrong place.