• Similar to Jest's expect, but with type-awareness. Gives you access to a number of type-matchers that let you make assertions about the form of a reference or generic type parameter.

    Type Parameters

    • Actual

    Parameters

    Returns PositiveExpectTypeOf<Actual>

    Example

    import {foo, bar} from '../foo'
    import {expectTypeOf} from 'expect-type'

    test('foo types', () => {
    // make sure `foo` has type {a: number}
    expectTypeOf(foo).toMatchTypeOf({a: 1})
    expectTypeOf(foo).toHaveProperty('a').toBeNumber()

    // make sure `bar` is a function taking a string:
    expectTypeOf(bar).parameter(0).toBeString()
    expectTypeOf(bar).returns.not.toBeAny()
    })

    Description

    See the full docs for lots more examples.

  • Similar to Jest's expect, but with type-awareness. Gives you access to a number of type-matchers that let you make assertions about the form of a reference or generic type parameter.

    Type Parameters

    • Actual

    Returns PositiveExpectTypeOf<Actual>

    Example

    import {foo, bar} from '../foo'
    import {expectTypeOf} from 'expect-type'

    test('foo types', () => {
    // make sure `foo` has type {a: number}
    expectTypeOf(foo).toMatchTypeOf({a: 1})
    expectTypeOf(foo).toHaveProperty('a').toBeNumber()

    // make sure `bar` is a function taking a string:
    expectTypeOf(bar).parameter(0).toBeString()
    expectTypeOf(bar).returns.not.toBeAny()
    })

    Description

    See the full docs for lots more examples.

Generated using TypeDoc