2.0.2 • Published 1 month ago

@japa/expect-type v2.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

@japa/expect-type

Write assertions for TypeScript types

gh-workflow-image npm-image license-image

The expect-type plugin of Japa helps you write assertions against the TypeScript types. There is no runtime behavior with the expect-type plugin and you need to compile your code to view the assertion errors.

The plugins wraps expect-type under the hood.

Complete API documentation

Installation

Install the package from the npm registry as follows:

npm i @japa/expect-type

yarn add @japa/expect-type

Usage

You can use this package with the @japa/runner as follows.

import { expectTypeOf } from '@japa/expect-type'
import { configure } from '@japa/runner'

configure({
  plugins: [expectTypeOf()]
})

Once done, you will be able to access the expectTypeOf property on the test context.

test('test title', ({ expectTypeOf }) => {
  expectTypeOf({ foo: 'bar' }).toEqualTypeOf<{ foo: string }>()
})
2.0.2

1 month ago

2.0.1

5 months ago

2.0.0-1

8 months ago

2.0.0

7 months ago

2.0.0-0

11 months ago

1.0.3

1 year ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago