# @types/rewire

> TypeScript definitions for rewire

Latest version **2.5.30** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/rewire
pnpm add @types/rewire
yarn add @types/rewire
bun add @types/rewire
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.5.30 |
| Published | 2023-11-07 |
| First published | 2016-05-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51449 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/rewire
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/rewire
- npm.io page: https://npm.io/package/@types/rewire

## Recent versions

- 2.5.30 (latest) — 2023-11-07
- 2.5.28 (ts2.0) — 2017-06-02
- 2.5.29 — 2023-10-18
- 2.5.27 — 2016-09-19
- 2.5.26 — 2016-07-14
- 2.5.25-alpha — 2016-07-08
- 2.5.24-alpha — 2016-07-04
- 2.5.23-alpha — 2016-07-02
- 2.5.22-alpha — 2016-07-01
- 2.5.21-alpha — 2016-07-01
- 2.5.20-alpha — 2016-05-25
- 2.5.19-alpha — 2016-05-20
- 2.5.14-alpha — 2016-05-19
- 2.5.13-alpha — 2016-05-17

## README

# Installation
> `npm install --save @types/rewire`

# Summary
This package contains type definitions for rewire (https://github.com/jhnns/rewire).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/rewire.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/rewire/index.d.ts)
````ts
declare namespace RewireInterfaces {
    interface RewiredModule {
        /**
         * Takes all enumerable keys of obj as variable names and sets the values respectively. Returns a function which can be called to revert the change.
         */
        __set__(obj: { [variable: string]: any }): () => void;
        /**
         * Sets the internal variable name to the given value. Returns a function which can be called to revert the change.
         */
        __set__(name: string, value: any): () => void;
        /**
         * Returns the private variable with the given name.
         */
        __get__<T = any>(name: string): T;
        /**
         * Returns a function which - when being called - sets obj, executes the given callback and reverts obj. If callback returns a promise, obj is only reverted after
         * the promise has been resolved or rejected. For your convenience the returned function passes the received promise through.
         */
        __with__(obj: { [variable: string]: any }): (callback: () => any) => any;
    }
}

/**
 * Returns a rewired version of the module found at filename. Use rewire() exactly like require().
 */
declare function rewire<T = { [key: string]: any }>(filename: string): RewireInterfaces.RewiredModule & T;
export = rewire;

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 15:11:36 GMT
 * Dependencies: none

# Credits
These definitions were written by [Borislav Zhivkov](https://github.com/borislavjivkov), and [Federico Caselli](https://github.com/CaselIT).

---
_Source: https://npm.io/package/@types/rewire · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
