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

chore: upgrade typescript to 5.6.2 #70038

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
"@types/html-validator": "5.0.3",
"@types/http-proxy": "1.17.3",
"@types/jest": "29.5.5",
"@types/node": "20.12.3",
"@types/node": "20.16.9",
"@types/node-fetch": "2.6.1",
"@types/react": "npm:types-react@19.0.0-rc.0",
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.0",
Expand Down Expand Up @@ -245,7 +245,7 @@
"tree-kill": "1.2.2",
"tsec": "0.2.1",
"turbo": "2.1.2",
"typescript": "5.5.3",
"typescript": "5.6.2",
"unfetch": "4.2.0",
"wait-port": "0.2.2",
"webpack": "5.90.0",
Expand All @@ -264,7 +264,7 @@
"webpack": "5.90.0",
"browserslist": "4.22.2",
"caniuse-lite": "1.0.30001579",
"@types/node": "20.12.3",
"@types/node": "22.5.4",
"@babel/core": "7.22.5",
"@babel/parser": "7.22.5",
"@babel/types": "7.22.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ export class ClientReferenceManifestPlugin {
const concatenatedMod = connection.module
const concatenatedModId =
compilation.chunkGraph.getModuleId(concatenatedMod)
recordModule(concatenatedModId, clientEntryMod)
recordModule(concatenatedModId!, clientEntryMod)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ type Paths = { [match: string]: string[] }
* Largely based on how the TypeScript compiler handles it:
* https://github.com/microsoft/TypeScript/blob/1a9c8197fffe3dace5f8dca6633d450a88cba66d/src/compiler/moduleNameResolver.ts#L1362
*/
export class JsConfigPathsPlugin implements webpack.ResolvePluginInstance {
export class JsConfigPathsPlugin implements webpack.WebpackPluginInstance {
paths: Paths
resolvedBaseUrl: ResolvedBaseUrl
jsConfigPlugin: true
Expand Down
3 changes: 2 additions & 1 deletion packages/next/src/build/webpack/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ export function traverseModules(
// TODO: Update type so that it doesn't have to be cast.
) as Iterable<NormalModule>
for (const mod of chunkModules) {
const modId = compilation.chunkGraph.getModuleId(mod)?.toString()
const modId =
compilation.chunkGraph.getModuleId(mod)?.toString() ?? null
callback(mod, chunk, chunkGroup, modId)
const anyModule = mod as any
if (anyModule.modules) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ module.exports = function () {
if (idx >= 0) registeredStatusHandlers.splice(idx, 1);
},

//inherit from previous dispose call
// inherit from previous dispose call
data: currentModuleData[moduleId]
};
currentChildModule = undefined;
Expand All @@ -215,7 +215,7 @@ module.exports = function () {
for (var i = 0; i < registeredStatusHandlers.length; i++)
results[i] = registeredStatusHandlers[i].call(null, newStatus);

return Promise.all(results);
return Promise.all(results).then(function () {});
}

function unblock() {
Expand Down Expand Up @@ -293,11 +293,10 @@ module.exports = function () {
return waitForBlockingPromises(function () {
if (applyOnUpdate) {
return internalApply(applyOnUpdate);
} else {
devjiwonchoi marked this conversation as resolved.
Show resolved Hide resolved
return setStatus("ready").then(function () {
return updatedModules;
});
}
return setStatus("ready").then(function () {
return updatedModules;
});
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,12 @@ module.exports = function () {
if ($hasOwnProperty$(currentUpdate, moduleId)) {
var newModuleFactory = currentUpdate[moduleId];
/** @type {TODO} */
var result;
if (newModuleFactory) {
devjiwonchoi marked this conversation as resolved.
Show resolved Hide resolved
result = getAffectedModuleEffects(moduleId);
} else {
result = {
type: "disposed",
moduleId: moduleId
};
}
var result = newModuleFactory
? getAffectedModuleEffects(moduleId)
: {
type: "disposed",
moduleId: moduleId
};
/** @type {Error|false} */
var abortError = false;
var doApply = false;
Expand Down Expand Up @@ -376,17 +373,17 @@ module.exports = function () {
moduleId: moduleId,
module: $moduleCache$[moduleId]
});
} catch (err2) {
} catch (err1) {
if (options.onErrored) {
options.onErrored({
type: "self-accept-error-handler-errored",
moduleId: moduleId,
error: err2,
error: err1,
originalError: err
});
}
if (!options.ignoreErrored) {
reportError(err2);
reportError(err1);
reportError(err);
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/compiled/debug/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/next/src/compiled/unistore/unistore.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ module.exports = function () {
if (idx >= 0) registeredStatusHandlers.splice(idx, 1);
},

//inherit from previous dispose call
// inherit from previous dispose call
data: currentModuleData[moduleId]
};
currentChildModule = undefined;
Expand All @@ -215,7 +215,7 @@ module.exports = function () {
for (var i = 0; i < registeredStatusHandlers.length; i++)
results[i] = registeredStatusHandlers[i].call(null, newStatus);

return Promise.all(results);
return Promise.all(results).then(function () {});
}

function unblock() {
Expand Down Expand Up @@ -293,11 +293,10 @@ module.exports = function () {
return waitForBlockingPromises(function () {
if (applyOnUpdate) {
return internalApply(applyOnUpdate);
} else {
return setStatus("ready").then(function () {
return updatedModules;
});
}
return setStatus("ready").then(function () {
return updatedModules;
});
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,12 @@ module.exports = function () {
if ($hasOwnProperty$(currentUpdate, moduleId)) {
var newModuleFactory = currentUpdate[moduleId];
/** @type {TODO} */
var result;
if (newModuleFactory) {
result = getAffectedModuleEffects(moduleId);
} else {
result = {
type: "disposed",
moduleId: moduleId
};
}
var result = newModuleFactory
? getAffectedModuleEffects(moduleId)
: {
type: "disposed",
moduleId: moduleId
};
/** @type {Error|false} */
var abortError = false;
var doApply = false;
Expand Down Expand Up @@ -376,17 +373,17 @@ module.exports = function () {
moduleId: moduleId,
module: $moduleCache$[moduleId]
});
} catch (err2) {
} catch (err1) {
if (options.onErrored) {
options.onErrored({
type: "self-accept-error-handler-errored",
moduleId: moduleId,
error: err2,
error: err1,
originalError: err
});
}
if (!options.ignoreErrored) {
reportError(err2);
reportError(err1);
reportError(err);
}
}
Expand Down
6 changes: 3 additions & 3 deletions packages/next/src/compiled/webpack/bundle5.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/next/src/server/dev/hot-reloader-webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ export default class HotReloaderWebpack implements NextJsHotReloaderInterface {
}

this.multiCompiler.hooks.done.tap('NextjsHotReloader', () => {
inputFileSystem.purge!()
inputFileSystem?.purge!()
})
watchCompilers(
this.multiCompiler.compilers[0],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export class HeadersAdapter extends Headers {
}
}

public *entries(): IterableIterator<[string, string]> {
public *entries(): HeadersIterator<[string, string]> {
for (const key of Object.keys(this.headers)) {
const name = key.toLowerCase()
// We assert here that this is a string because we got it from the
Expand All @@ -208,14 +208,14 @@ export class HeadersAdapter extends Headers {
}
}

public *keys(): IterableIterator<string> {
public *keys(): HeadersIterator<string> {
for (const key of Object.keys(this.headers)) {
const name = key.toLowerCase()
yield name
}
}

public *values(): IterableIterator<string> {
public *values(): HeadersIterator<string> {
for (const key of Object.keys(this.headers)) {
// We assert here that this is a string because we got it from the
// Object.keys() call above.
Expand All @@ -225,7 +225,7 @@ export class HeadersAdapter extends Headers {
}
}

public [Symbol.iterator](): IterableIterator<[string, string]> {
public [Symbol.iterator](): HeadersIterator<[string, string]> {
return this.entries()
}
}
8 changes: 4 additions & 4 deletions packages/next/types/$$compiled.internal.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ declare module 'next/dist/compiled/amphtml-validator' {
}

declare module 'next/dist/compiled/superstruct' {
import m from 'superstruct'
import * as m from 'superstruct'
export = m
}
declare module 'next/dist/compiled/async-retry'
Expand Down Expand Up @@ -325,7 +325,7 @@ declare module 'next/dist/compiled/picomatch' {
export = m
}
declare module 'next/dist/compiled/nanoid/index.cjs' {
import m from 'nanoid'
import * as m from 'nanoid'
export = m
}
declare module 'next/dist/compiled/ora' {
Expand Down Expand Up @@ -371,7 +371,7 @@ declare module 'next/dist/compiled/tar' {
}

declare module 'next/dist/compiled/terser' {
import m from 'terser'
import * as m from 'terser'
export = m
}
declare module 'next/dist/compiled/semver' {
Expand Down Expand Up @@ -400,7 +400,7 @@ declare module 'next/dist/compiled/unistore' {
export = m
}
declare module 'next/dist/compiled/web-vitals' {
import m from 'web-vitals'
import * as m from 'web-vitals'
export = m
}
declare module 'next/dist/compiled/web-vitals-attribution' {}
Expand Down
Loading
Loading