Skip to content

Module 'es-toolkit/map' has no exported member 'keyBy' (ts2305) #1648

@alvar-osz

Description

@alvar-osz

Bug Report

Description

The documentation at https://es-toolkit.dev/reference/map/keyBy.html lists keyBy under the map category, which implies it should be importable via the es-toolkit/map subpath. However, attempting to do so produces a TypeScript error:

import { keyBy } from "es-toolkit/map";
// Module '"es-toolkit/map"' has no exported member 'keyBy'.ts(2305)

Steps to Reproduce

  1. Install es-toolkit@1.45.1
  2. Import keyBy from the map subpath:
    import { keyBy } from "es-toolkit/map";
  3. Observe TS error: Module '"es-toolkit/map"' has no exported member 'keyBy'.ts(2305)

Root Cause

Inspecting dist/map/index.d.ts (and .d.mts) in the published package, keyBy is not re-exported:

export { every } from './every.js';
export { filter } from './filter.js';
export { findKey } from './findKey.js';
export { findValue } from './findValue.js';
export { hasValue } from './hasValue.js';
export { mapKeys } from './mapKeys.js';
export { mapValues } from './mapValues.js';
export { reduce } from './reduce.js';
export { some } from './some.js';
// ← keyBy is missing

There is also no keyBy.d.ts / keyBy.js file under dist/map/.

Environment

es-toolkit version 1.45.1
Node.js version v25.8.0
TypeScript latest
Package manager pnpm

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions