Unverified Commit 4c60b7b6 authored by Steven's avatar Steven Committed by GitHub

feat: bump minimum ts version to 4.5.2 (#47712)

Fixes an issue with newer app directory usage:

```
Failed to compile.
../../node_modules/next/dist/server/future/route-handlers/app-route-route-handler.d.ts:11:15
Type error: ',' expected.
```

---------
parent 9ab6ca5d
......@@ -164,7 +164,9 @@ module.exports = nextConfig
Since `v10.2.1` Next.js supports [incremental type checking](https://www.typescriptlang.org/tsconfig#incremental) when enabled in your `tsconfig.json`, this can help speed up type checking in larger applications.
It is highly recommended to be on at least `v4.3.2` of TypeScript to experience the [best performance](https://devblogs.microsoft.com/typescript/announcing-typescript-4-3/#lazier-incremental) when leveraging this feature.
## Minimum TypeScript Version
It is highly recommended to be on at least `v4.5.2` of TypeScript to get syntax features such as [type modifiers on import names](https://devblogs.microsoft.com/typescript/announcing-typescript-4-5/#type-on-import-names) and [performance improvements](https://devblogs.microsoft.com/typescript/announcing-typescript-4-5/#real-path-sync-native).
## Ignoring TypeScript Errors
......
......@@ -112,9 +112,9 @@ export async function verifyTypeScriptSetup({
require(tsPath)
)) as typeof import('typescript')
if (semver.lt(ts.version, '4.3.2')) {
if (semver.lt(ts.version, '4.5.2')) {
log.warn(
`Minimum recommended TypeScript version is v4.3.2, older versions can potentially be incompatible with Next.js. Detected: ${ts.version}`
`Minimum recommended TypeScript version is v4.5.2, older versions can potentially be incompatible with Next.js. Detected: ${ts.version}`
)
}
......
......@@ -34,7 +34,7 @@ describe('Minimum TypeScript Warning', () => {
it('should not show warning during next build with new version', async () => {
const content = await fs.readFile(tsFile, 'utf8')
await fs.writeFile(tsFile, content.replace('3.8.3', '4.3.4'))
await fs.writeFile(tsFile, content.replace('3.8.3', '4.5.2'))
const res = await nextBuild(appDir, [], {
stderr: true,
stdout: true,
......@@ -53,7 +53,7 @@ describe('Minimum TypeScript Warning', () => {
output += msg
}
const content = await fs.readFile(tsFile, 'utf8')
await fs.writeFile(tsFile, content.replace('3.8.3', '4.3.4'))
await fs.writeFile(tsFile, content.replace('3.8.3', '4.5.2'))
const app = await launchApp(appDir, await findPort(), {
onStdout: handleOutput,
onStderr: handleOutput,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment