Skip to content

Global test types overrides causing typescript issues #38

@fredrik-j-lindberg

Description

@fredrik-j-lindberg

Relevant code or config:

  ...
  afterEach(() => {
  ...

What you did:

Ran type checking after upgrading to 3.0.1

What happened:

The afterEach cause the following issue:

error TS2722: Cannot invoke an object which is possibly 'undefined'.

Reproduction:

  1. Install and setup typescript, vitest and latest version of this lib
  2. Have a test with an afterEach
  3. Run type checking

For an easier time debugging it, make sure skipLibCheck is false as that shows the type conflicts that causes this issue.

If necessary I can provide a reproduction repo but avoiding it for now since it is hopefully decently self-explanatory

Problem description:

The new version of the lib has a global overwrite of the afterEach (and other) types here, introduced in this PR.

Suggested solution:

Not overriding the global test types. We have removed them in a patch on our end to get around this issue atm.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions