You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
usernamer: usernamer/ko resolves to a UMD bundle under "type": "module", and types paths do not match emitted .d.ts files #26
In packages/usernamer, importing usernamer/ko fails at runtime in Node.js because exports["./ko"].default points to a UMD bundle loaded as ESM, and TypeScript cannot find declarations for either usernamer or usernamer/ko because the types paths in package.json do not match the emitted .d.ts paths.
file:///.../repro.mjs:1
import { encode, decode } from "usernamer/ko";
^^^^^^
SyntaxError: The requested module 'usernamer/ko' does not provide an export named 'decode'
(import * as ko from "usernamer/ko" and require("usernamer/ko") also fail with ReferenceError: self is not defined.)
Actual output from npx tsc --strict --module nodenext --noEmit repro.mts (also reproduces with --module preserve --moduleResolution bundler):
repro.mts(1,24): error TS7016: Could not find a declaration file for module 'usernamer'. '/.../node_modules/usernamer/dist/index.modern.js' implicitly has an 'any' type.
repro.mts(2,36): error TS7016: Could not find a declaration file for module 'usernamer/ko'. '/.../node_modules/usernamer/dist/ko/usernamer.js' implicitly has an 'any' type.
Expected:
node repro.mjs prints 귀여운 알파카 100, and tsc succeeds without errors.
Versions tested:
usernamer: 1.0.0 (npm latest) and main (53994cc1)
Node.js: v26.13.0
TypeScript: 5.9.3 and 7.0.2
In packages/usernamer/package.json, microbundle src/ko.ts -o dist/ko --no-pkg-main writes all output formats to dist/ko/usernamer.js leaving the UMD bundle in a "type": "module" package, and the chained microbundle runs emit declarations at dist/src/src/src/*.d.ts while types and exports.*.types point to dist/src/src/*.d.ts.
Activity