Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong TypeScript export signature for next/jest #36534

Closed
1 task done
alex-4ed5ec60d opened this issue Apr 28, 2022 · 2 comments · Fixed by #36824
Closed
1 task done

Wrong TypeScript export signature for next/jest #36534

alex-4ed5ec60d opened this issue Apr 28, 2022 · 2 comments · Fixed by #36824
Labels
kind: bug Confirmed bug that is on the backlog Testing Related to testing with Next.js. TypeScript Related to types with Next.js.

Comments

@alex-4ed5ec60d
Copy link

alex-4ed5ec60d commented Apr 28, 2022

Verify canary release

  • I verified that the issue exists in Next.js canary release

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 21.4.0: Mon Feb 21 20:35:58 PST 2022; root:xnu-8020.101.4~2/RELEASE_ARM64_T6000
Binaries:
  Node: 16.13.2
  npm: 8.1.2
  Yarn: 1.22.18
  pnpm: 6.32.4
Relevant packages:
  next: 12.1.4
  react: 17.0.2
  react-dom: 17.0.2

What browser are you using? (if relevant)

N/A

How are you deploying your application? (if relevant)

N/A

Describe the Bug

The TypeScript definition requires writing require('next/jest').default to access the function while in the actual code, there is no such default property.

Expected Behavior

jest.d.ts uses export = instead of export default.

To Reproduce

// @ts-check
const nextJest = require('next/jest');

// ❌ TS2349: Cannot invoke an expression whose type lacks a call signature.
const config = nextJest();

// ❌ Uncaught TypeError: nextJest.default is not a function
const config = nextJest.default();
@alex-4ed5ec60d alex-4ed5ec60d added the bug Issue was opened via the bug report template. label Apr 28, 2022
@timneutkens timneutkens added kind: bug Confirmed bug that is on the backlog TypeScript Related to types with Next.js. Testing Related to testing with Next.js. and removed bug Issue was opened via the bug report template. labels Apr 28, 2022
@ryami333
Copy link

ryami333 commented Jun 8, 2022

@ijjk Please reopen: the error still persists after #36534. Please see my minimal reproducible example demonstrating it on 12.1.7-canary here or track my other issue (#37524) for more details.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 8, 2022

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind: bug Confirmed bug that is on the backlog Testing Related to testing with Next.js. TypeScript Related to types with Next.js.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants