Skip to main content

interopModule

Callable

  • interopModule<D, N>(result: unknown): ModuleLike<D, N>

  • Formats the shape of an imported module to align with the ES module specification.

    For ES or ES-like modules, returns the shape as-is.

    For CommonJS modules, returns an object with the following:

    • module.exports under the default property.
    • exports.<name> under properties of the same name, and also under a default object.

    Type parameters

    • D = unknown
    • N: object = {}