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

tsconfig generation doesn't recognize ts5.4 improvements #64018

Closed
juliusmarminge opened this issue Apr 3, 2024 · 1 comment · Fixed by #64110
Closed

tsconfig generation doesn't recognize ts5.4 improvements #64018

juliusmarminge opened this issue Apr 3, 2024 · 1 comment · Fixed by #64110
Labels
bug Issue was opened via the bug report template. locked TypeScript Related to types with Next.js.

Comments

@juliusmarminge
Copy link
Contributor

Link to the code that reproduces this issue

https://github.com/juliusmarminge/nextjs-tsconfig-gen

To Reproduce

bun i
bun dev

get this:

CleanShot 2024-04-03 at 10 55 12@2x

Current vs. Expected behavior

the tsconfig generator isn't up to date with modern ts 5.4 standards, where there is a new module: preserve option. module: preserve implies moduleResolution: Bundler, esModuleInterop: true and resolveJsonModules: true, meaning these options no longer needs to be set explicitely

the tsconfig generator still overrides the tsconfig file unnecessarily, as well as sets some quite "poor" defaults (moduleResolution: node should not be used anymore imo, it's old and dated and doesn't support reading package.json#exports conditions)

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 20.12.0
  npm: 10.5.0
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 14.2.0-canary.54 // Latest available version is detected (14.2.0-canary.54).
  eslint-config-next: N/A
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.4.3
Next.js Config:
  output: N/A

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

TypeScript (plugin, built-in types)

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

next dev (local)

Additional context

No response

@juliusmarminge juliusmarminge added the bug Issue was opened via the bug report template. label Apr 3, 2024
@github-actions github-actions bot added the TypeScript Related to types with Next.js. label Apr 3, 2024
huozhi added a commit that referenced this issue Apr 8, 2024
Fixes #64018

Adds support for modern configurations introduced in TS 5.4

Expected output: not modifying the `module`, `esModuleInterop` configs
since `module: preserve` is present

```
   We detected TypeScript in your project and reconfigured your tsconfig.json file for you. Strict-mode is set to false
 by default.
   The following suggested values were added to your tsconfig.json. These values can be changed to fit your project's n
eeds:

        - lib was set to dom,dom.iterable,esnext
        - allowJs was set to true
        - skipLibCheck was set to true
        - strict was set to false
        - noEmit was set to true
        - incremental was set to true
        - include was set to ['next-env.d.ts', '**/*.ts', '**/*.tsx']
        - exclude was set to ['node_modules']

   The following mandatory changes were made to your tsconfig.json:

        - isolatedModules was set to true (requirement for SWC / Babel)
        - jsx was set to preserve (next.js implements its own optimized jsx transform)
```

---------

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
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 Apr 22, 2024
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.

1 participant