question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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 https://github.com/DefinitelyTyped/DefinitelyTyped/pull/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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

0reactions
github-actions[bot]commented, Mar 27, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Bug]: Types no longer allow passing a named function to ...
[Bug]: Types no longer allow passing a named function to describe · Summary · Jobs. Questions · Bug reports without reproductions · Run...
Read more >
Bug Patterns - Error Prone
The called constructor accepts a parameter with the same name and type as one of its caller's parameters, but its caller doesn't pass...
Read more >
Bug descriptions — spotbugs 4.7.3 documentation
This document lists the standard bug patterns reported by SpotBugs. ... Class implements Cloneable but does not define or use the clone method....
Read more >
Bug Descriptions - fb-contrib
This method passes an array as the key to a Map, element in a Set, or item in a List when the contains...
Read more >
javascript - How to define type for a function callback (as any ...
The Function type accepts any function-like value. It provides no type safety when calling the function, which can be a common source of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found