Skip to content

Commit ce9670f

Browse files
authored
Upgrade TypeScript to v5.5.2 (vercel#67113)
1 parent 5c92390 commit ce9670f

File tree

13 files changed

+74
-116
lines changed

13 files changed

+74
-116
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@
236236
"tree-kill": "1.2.2",
237237
"tsec": "0.2.1",
238238
"turbo": "2.0.6-canary.0",
239-
"typescript": "5.4.5",
239+
"typescript": "5.5.2",
240240
"unfetch": "4.2.0",
241241
"wait-port": "0.2.2",
242242
"webpack": "5.90.0",

packages/next/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/// <reference types="./types/global" />
2+
/// <reference types="./types/compiled" />
23
/// <reference path="./dist/styled-jsx/types/index.d.ts" />
34
/// <reference path="./amp.d.ts" />
45
/// <reference path="./app.d.ts" />

packages/next/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@
321321
"util": "0.12.4",
322322
"vm-browserify": "1.1.2",
323323
"watchpack": "2.4.0",
324-
"web-vitals": "3.0.0",
324+
"web-vitals": "4.2.1",
325325
"webpack": "5.90.0",
326326
"webpack-sources1": "npm:webpack-sources@1.4.3",
327327
"webpack-sources3": "npm:webpack-sources@3.2.3",

packages/next/src/compiled/web-vitals-attribution/web-vitals.attribution.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/next/src/compiled/web-vitals/web-vitals.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/next/src/server/app-render/action-handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ async function createForwardedActionResponse(
182182
const fetchUrl = new URL(`${origin}${basePath}${workerPathname}`)
183183

184184
try {
185-
let body: BodyInit | AsyncIterable<any> | undefined
185+
let body: BodyInit | ReadableStream<Uint8Array> | undefined
186186
if (
187187
// The type check here ensures that `req` is correctly typed, and the
188188
// environment variable check provides dead code elimination.

packages/next/src/server/stream-utils/node-web-streams-helper.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,8 @@ export async function streamToBuffer(
8787
): Promise<Buffer> {
8888
const buffers: Buffer[] = []
8989

90-
// @ts-expect-error TypeScript gets this wrong (https://nodejs.org/api/webstreams.html#async-iteration)
9190
for await (const chunk of stream) {
92-
buffers.push(chunk)
91+
buffers.push(Buffer.from(chunk))
9392
}
9493

9594
return Buffer.concat(buffers)
@@ -101,7 +100,6 @@ export async function streamToString(
101100
const decoder = new TextDecoder('utf-8', { fatal: true })
102101
let string = ''
103102

104-
// @ts-expect-error TypeScript gets this wrong (https://nodejs.org/api/webstreams.html#async-iteration)
105103
for await (const chunk of stream) {
106104
string += decoder.decode(chunk, { stream: true })
107105
}

packages/next/src/types.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
/// <reference types="node" />
2-
/// <reference types="react" />
3-
/// <reference types="react/experimental" />
4-
/// <reference types="react-dom" />
5-
/// <reference types="react-dom/experimental" />
1+
/// <reference types="node" preserve="true" />
2+
/// <reference types="react" preserve="true" />
3+
/// <reference types="react/experimental" preserve="true" />
4+
/// <reference types="react-dom" preserve="true" />
5+
/// <reference types="react-dom/experimental" preserve="true" />
66

77
import type { Agent as HttpAgent } from 'http'
88
import type { Agent as HttpsAgent } from 'https'

packages/next/taskfile.js

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2589,10 +2589,7 @@ export async function diagnostics(task, opts) {
25892589
}
25902590

25912591
export async function build(task, opts) {
2592-
await task.serial(
2593-
['precompile', 'compile', 'generate_types', 'rewrite_compiled_references'],
2594-
opts
2595-
)
2592+
await task.serial(['precompile', 'compile', 'generate_types'], opts)
25962593
}
25972594

25982595
export async function generate_types(task, opts) {
@@ -2601,37 +2598,6 @@ export async function generate_types(task, opts) {
26012598
})
26022599
}
26032600

2604-
/**
2605-
* TypeScript will emit references to the compiled types used to type the implementation.
2606-
* The declarations however don't need such detailed types.
2607-
* We rewrite the references to reference a more lightweight solution instead.
2608-
* @param {import('taskr').Task} task
2609-
*/
2610-
export async function rewrite_compiled_references(task, opts) {
2611-
const declarationDirectory = join(__dirname, 'dist')
2612-
const declarationFiles = glob.sync('**/*.d.ts', { cwd: declarationDirectory })
2613-
2614-
for (const declarationFile of declarationFiles) {
2615-
const content = await fs.readFile(
2616-
join(declarationDirectory, declarationFile),
2617-
'utf8'
2618-
)
2619-
// Rewrite
2620-
// /// <reference path="../../../../types/$$compiled.internal.d.ts" />
2621-
// to
2622-
// /// <reference path="../../../../types/compiled.d.ts" />
2623-
if (content.indexOf('/types/$$compiled.internal.d.ts" />') !== -1) {
2624-
await fs.writeFile(
2625-
join(declarationDirectory, declarationFile),
2626-
content.replace(
2627-
/\/types\/\$\$compiled\.internal\.d\.ts" \/>/g,
2628-
'/types/compiled.d.ts" />'
2629-
)
2630-
)
2631-
}
2632-
}
2633-
}
2634-
26352601
export default async function (task) {
26362602
const opts = { dev: true }
26372603
await task.clear('dist')

packages/next/tsconfig.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
"extends": "../../tsconfig-tsec.json",
33
"compilerOptions": {
44
"strict": true,
5-
"module": "esnext",
6-
"target": "ES2017",
5+
"stripInternal": true,
76
"esModuleInterop": true,
8-
"moduleResolution": "node",
7+
"verbatimModuleSyntax": true,
98
"jsx": "react-jsx",
10-
"stripInternal": true,
11-
"verbatimModuleSyntax": true
9+
"module": "ESNext",
10+
"target": "ES2018",
11+
"moduleResolution": "node"
1212
},
1313
"exclude": [
1414
"dist",

packages/next/types.d.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,2 @@
1-
// Triple slash directives are copied from src/types.ts.
2-
// TypeScript currently does not preserve the tripple-slash directives.
3-
// Once https://github.com/microsoft/TypeScript/pull/57681 is released, we can remove the triple slash directives here.
4-
/// <reference types="react" />
5-
/// <reference types="react/experimental" />
6-
/// <reference types="react-dom" />
7-
/// <reference types="react-dom/experimental" />
81
export * from './dist/types'
92
export { default } from './dist/types'

0 commit comments

Comments
 (0)