8000 TypeScript OOM when exporting remeda types with `declaration` enabled · Issue #1253 · remeda/remeda · GitHub
[go: up one dir, main page]

Skip to content

TypeScript OOM when exporting remeda types with declaration enabled #1253

@eranhirsch

Description

@eranhirsch

When building a package that uses Remeda types in it's exported types TypeScript OOMs because our types are not exported by name, and thus require TypeScript to inline them. The more generic the exported type, the more this inlining becomes challenging, up to the point where TypeScript goes into an infinite loop recursing deeper and deeper into the type.

The fix is for us to export our returned types so that TypeScript can short-circuit this process and use our named exports directly.

See: #1175 (comment)

Functions known to cause issues: split, join, pick, omit...

Workarounds

  • Avoid exporting generic functions that wrap these utilities
  • Use explicit literal types instead of generics
  • If you don't need .d.ts output, disable declaration

Metadata

Metadata

Assignees

No one assigned

    Labels

    typingSomething type relatedv3Issues and PRs related to Remeda v3 (3.0.0) major version bump.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0