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

TypeScript error when importing next/image with "type": "module" and "moduleResolution": "nodenext" #47279

Closed
1 task done
michaelhays opened this issue Mar 18, 2023 · 2 comments
Labels
bug Issue was opened via the bug report template. TypeScript Related to types with Next.js.

Comments

@michaelhays
Copy link

Verify canary release

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

Provide environment information

Operating System:
      Platform: linux
      Arch: x64
      Version: #36~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Feb 17 15:17:25 UTC 2
    Binaries:
      Node: 18.12.1
      npm: 8.19.2
      Yarn: N/A
      pnpm: 7.29.1
    Relevant packages:
      next: 13.2.5-canary.8
      eslint-config-next: 13.2.4
      react: 18.2.0
      react-dom: 18.2.0

Which area(s) of Next.js are affected? (leave empty if unsure)

TypeScript

Link to the code that reproduces this issue

https://github.com/michaelhays/next-ts-import

To Reproduce

In a new Next.js project, add "type": "module" to package.json, and set "moduleResolution": "nodenext" in tsconfig.json.

Importing next/image (or any next/* package) throws a TypeScript error, though the package is actually found when running the app.

Describe the Bug

import

Expected Behavior

The import should be found by TypeScript.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

@michaelhays michaelhays added the bug Issue was opened via the bug report template. label Mar 18, 2023
@github-actions github-actions bot added the TypeScript Related to types with Next.js. label Mar 18, 2023
@balazsorban44
Copy link
Member

Duplicate of #46078

@balazsorban44 balazsorban44 marked this as a duplicate of #46078 Mar 19, 2023
@github-actions
Copy link
Contributor

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 Apr 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. TypeScript Related to types with Next.js.
Projects
None yet
Development

No branches or pull requests

2 participants