next.js
next.js copied to clipboard
TypeScript Auto-Install
Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:35 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T8101
Binaries:
Node: 16.17.0
npm: 8.15.0
Yarn: 1.22.17
pnpm: N/A
Relevant packages:
next: 12.3.0
eslint-config-next: 12.3.0
react: 18.2.0
react-dom: 18.2.0
What browser are you using? (if relevant)
Chrome Versión 105.0.5195.102 (Build oficial) (arm64)
How are you deploying your application? (if relevant)
next build & next start
Describe the Bug
Context
According to the latest release of Next.js at version 12.3.0, it has the feature to auto install typescript on the fly.
see: https://nextjs.org/blog/next-12-3#typescript-auto-install
When creating a new application with npm using npx create-next-app@latest when changing a file extension to .ts or .tsx the new feature does not work as expected.
This is because it only does some parts of what appears in the blog gif.
I understand that this should do the following:
- [x] Create
tsconfig.json - [ ] Install
typescript - [x] Install
@types/node - [x] Install
@types/react - [x] Create file
next-env.d
But the installation of typescript doesn't seem to be working.
UPDATE: From the VSCode terminal it does not install any packages.
Expected Behavior
I would expect the functionality to operate in the same way as it is shown in the 12.3.0 blog gif. That you can install typescript just the same.
- Additionally I think
@types/react-domshould be installed.
Link to reproduction
.
To Reproduce
- Create a new JavaScript project using
npx create-next-app@latest --use-npm. - Change the extension of some pages file from
.jsto.tsx. or from.jsxto.tsx, - You will see that it is not installed as a
typescriptdependency.
Hi, can you provide a complete reproduction, following the provided steps does not seem to reproduce the issue. Note if TypeScript isn't being installed it may already be present in your tree including globally installed.
@ijjk Step to step:
- Create a new project using
npx create-next-app@latest --use-npm - Execute project using
npm run dev - Change extension name file from
.jsto.tsx

Auto-install works when renaming .jsx file to .tsx, but doesn't work when renaming .js file to .ts
I just upgraded an app from NextJS 12.2.5 to 12.3, renamed _app.jsx to _app.tsx and it didn't install typescript automatically. All it did was install .tsconfig.json and next-env.d files.
This issue has been automatically closed because it received no activity for a month and had no reproduction to investigate. If you think it was closed by accident, please leave a comment. If you are running into a similar issue, please open a new issue with a reproduction. Thank you.
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.