# type-safe-jest-spy

> Helps you write faster spies by automatically inferring the real implementation's type signature

Latest version **0.0.3** (published 2018-12-17) · GPL-3.0 license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install type-safe-jest-spy
pnpm add type-safe-jest-spy
yarn add type-safe-jest-spy
bun add type-safe-jest-spy
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2018-12-17 |
| First published | 2018-12-17 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 38.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Dan Greene |
| Maintainers | dgreene1 |

## Links

- npm: https://www.npmjs.com/package/type-safe-jest-spy
- Repository: https://github.com/dgreene1/typeSafeJestSpy
- Homepage: https://github.com/dgreene1/typeSafeJestSpy#readme
- Issues: https://github.com/dgreene1/typeSafeJestSpy/issues
- npm.io page: https://npm.io/package/type-safe-jest-spy

## Recent versions

- 0.0.3 (latest) — 2018-12-17
- 0.0.6 (staging) — 2019-01-31
- 0.0.2 — 2018-12-17
- 0.0.1 — 2018-12-17

## README

# typeSafeJestSpy
A very thing layer that helps you write faster spies by automatically inferring the real implementation's type signature

# Why would you use this?

  * Have you ever made a spy for entirely the wrong function?
  * Have you ever returned bad data from a spy by accident?
    * i.e. you knew that the method you were replacing was supposed to return a string... but you accidentally returned a number?

Aciddental mistakes with spies are a thing of the past with typeSafeJestSpy! :)

# How do you use this?
  * Please see the unit tests in the test folder for usage examples

Simply send your Jest spy into a function of this library and then the following Jest spy functions will require you to return the correct type:
  * `mockImplementation`
  * `mockImplementationOnce`
  * `mockResolvedValue`
  * `mockResolvedValueOnce`

# Caveats
Please see the version of Jest in my package.json to see what this micro-library thinks is the way that Jest behaves. If your version of Jest is wildly different, then

  * you might get irregular behavior.
  * you might find that Jest has introduced a typesafe version itself, in which case this library would no longer be required

---
_Source: https://npm.io/package/type-safe-jest-spy · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
