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

Types of headers, rewrites and redirects methods don't support synchronous returns #74547

Closed
wellwelwel opened this issue Jan 6, 2025 · 3 comments
Labels
bug Issue was opened via the bug report template. locked TypeScript Related to types with Next.js.

Comments

@wellwelwel
Copy link

wellwelwel commented Jan 6, 2025

Link to the code that reproduces this issue

https://github.com/wellwelwel/next-reproduction

To Reproduce

To reproduce the issues (missing types), simply clone the above repository and run:

npm i
npm test

Current vs. Expected behavior

The expectation is that both return types will be accepted when using synchronous returns in the configuration file, as shown in the images:

  • Please note that this is a type (TypeScript) issue only. There is no conflict regarding the execution (JavaScript) of both ways.
Screenshot 2025-01-06 at 07 04 22
Screenshot 2025-01-06 at 07 43 47

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.1.0: Thu Oct 10 21:03:11 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6020
  Available memory (MB): 65536
  Available CPU cores: 24
Binaries:
  Node: 23.5.0
  npm: 11.0.0
  Yarn: 4.4.1
  pnpm: N/A
Relevant Packages:
  next: 15.1.3 // Latest available version is detected (15.1.3).
  eslint-config-next: N/A
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.7.2
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

TypeScript

Which stage(s) are affected? (Select all that apply)

Other (Deployed)

Additional context

Note

For some reason, the #74545 was closed immediately, but the link to repro is valid. Trying one more time to see if it's a false positive 🙌

@wellwelwel wellwelwel added the bug Issue was opened via the bug report template. label Jan 6, 2025
@github-actions github-actions bot added the TypeScript Related to types with Next.js. label Jan 6, 2025
@eps1lon
Copy link
Member

eps1lon commented Jan 6, 2025

Thank you for flagging. Though this is intentional behavior. Simply convert these functions to async functions to resolve this on your end.

@eps1lon eps1lon closed this as not planned Won't fix, can't repro, duplicate, stale Jan 6, 2025
@wellwelwel
Copy link
Author

wellwelwel commented Jan 6, 2025

Thank you for flagging. Though this is intentional behavior. Simply convert these functions to async functions to resolve this on your end.

Thanks for the quick reply, @eps1lon 🙋🏻‍♂️

For everyone who, like me, is using Biome instead of ESLint, here's a workaround to add in biome.json:

{
  "overrides": [
    {
      "include": ["next.config.ts"],
      "linter": {
        "rules": {
          "suspicious": {
            "useAwait": "off"
          }
        }
      }
    }
  ]
}

Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. 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 Jan 20, 2025
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. locked TypeScript Related to types with Next.js.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants