Skip to content

[Bug]: Types no longer allow passing a named function to describe #12483

@JoshuaKGoldberg

Description

@JoshuaKGoldberg

Version

27.0.6 and 28.0.0-alpha.4

Steps to reproduce

https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbzgEwKYGcDGVgCNVwC+cAZlBCHAOQACAVhjAPQDmANhLgIZvpUDcAKEEkArgDtMMYBHFwQATwBiEqTLkAKAJSJCQwWiw58GxSsnTZAGjja4AXgB8urfyA

Expected behavior

No type errors on describe(myFunction, () => {})

Actual behavior

Argument of type '() => void' is not assignable to parameter of type 'string'.

Additional context

Allowing taking in class/function names in describe was added in #5154 and typed in @types/jest in DefinitelyTyped/DefinitelyTyped#23102.

Tests still pass while taking in a name; it's just the typings that are incorrect.

Environment

System:
    OS: Linux 5.10 Ubuntu 20.04.3 LTS (Focal Fossa)
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
  Binaries:
    Node: 16.13.0 - /usr/bin/node
    Yarn: 3.2.0 - /usr/local/bin/yarn
    npm: 8.1.0 - /usr/bin/npm
  npmPackages:
    jest: workspace:* => 28.0.0-alpha.4

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions