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

Type definitions of exports are invalid #46689

Open
1 task done
remcohaszing opened this issue Mar 2, 2023 · 0 comments
Open
1 task done

Type definitions of exports are invalid #46689

remcohaszing opened this issue Mar 2, 2023 · 0 comments
Labels
bug Issue was opened via the bug report template. TypeScript Related to types with Next.js.

Comments

@remcohaszing
Copy link
Contributor

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: #202302091138~1675975749~22.04~f771a7f SMP PREEMPT_DYNAMIC Thu F
    Binaries:
      Node: 19.7.0
      npm: 9.5.1
      Yarn: 1.22.19
      pnpm: 7.27.0
    Relevant packages:
      next: 13.2.4-canary.0
      eslint-config-next: N/A
      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

N/A (not a runtime issue)

To Reproduce

Create a project with the following files:

// package.json
{
  "dependencies": {
    "@types/node": "^18.0.0",
    "@types/react": "18.0.0",
    "@types/react-dom": "^18.0.0",
    "next": "canary",
    "typescript": "^4.0.0"
  }
}
// tsconfig.json
{
  "compilerOptions": {
    "module": "commonjs",
    "jsx": "react-jsx",
    "noEmit": true
  }
}
// index.ts
import App from 'next/app'

const app = <App />

Run npm install, then typecheck using npx tsc.

Describe the Bug

This will show various errors. They are all related to Next.js using `esModuleInterop. Because of this, Next.js packages are affected by microsoft/TypeScript#52779.

Typical Next.js users don’t see this bug, because Next.js enforces people to use esModuleInterop, which hides the issue, but shouldn’t be necessary.

Expected Behavior

Next.js packages have proper type exports. This can be ensured by building without the esModuleInterop option.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

@remcohaszing remcohaszing added the bug Issue was opened via the bug report template. label Mar 2, 2023
@github-actions github-actions bot added the TypeScript Related to types with Next.js. label Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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

1 participant