Error AtlasError Documentation and Resolution

Module declares a member locally but it is not exported

Module '{0}' declares '{1}' locally, but it is not exported.

TypeScript can see the requested name inside a module, but that module has not exposed it to importers. A local declaration or import does not automatically become a public export.

TS2459build
Module '{0}' declares '{1}' locally, but it is not exported.
  • A helper is declared in a module without an export.
  • An index file imports a symbol for internal use without re-exporting it.
  • A consumer imports an internal implementation detail instead of the supported public entry point.
  1. Find the declaration named in the diagnostic. If it is intended to be public, change function format() {} to export function format() {}.
  2. For an imported symbol that should be forwarded, add an explicit export such as export { format } from './format'. Importing it into the index file alone is not enough.
  3. If the member is intentionally private, change the consumer to use an existing public function instead of exposing an internal detail solely to silence the error.
  4. Check the import path and letter casing. A similarly named module can contain the symbol locally while the intended module exports it.
  5. Run the project type checker and test the consuming code. If this is a published library, verify the generated declaration entry point exposes the member too.
TypeScript Handbook: Modules
Fix TS2459: declared locally but not exported | Error Atlas