Skip to content

Commit d248668

Browse files
authored
Update to typescript 5.7.3 (#16065)
* Update to typescript 5.7.3 * update tspatch * Addressing feedback
1 parent 2d22c05 commit d248668

File tree

9 files changed

+99
-530
lines changed

9 files changed

+99
-530
lines changed

package-lock.json

Lines changed: 73 additions & 498 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@
4747
"selenium-webdriver": "^4.3.1",
4848
"ts-jest": "~29.1.0",
4949
"ts-node": "~10.9.0",
50-
"ts-patch": "3.2.1",
50+
"ts-patch": "3.3.0",
5151
"tslib": "^2.4.0",
52-
"typedoc": "^0.26.11",
53-
"typescript": "~5.5.0",
52+
"typedoc": "^0.27.6",
53+
"typescript": "~5.7.0",
5454
"webpack": "^5.73.0",
5555
"webpack-cli": "^5.1.0"
5656
},
@@ -89,7 +89,7 @@
8989
"test:performance": "playwright test -c ./playwright.config.ts --project=performance",
9090
"test:interactions": "playwright test -c ./playwright.config.ts --project=interaction",
9191
"test:escheck": "nx run-many --target=test:escheck --parallel --maxParallel=6",
92-
"test:docs": "node ./scripts/typedoc-generator.js",
92+
"test:docs": "node ./scripts/typedoc-generator.mjs",
9393
"prepare": "ts-patch install -s && npm run build:tools && npm i @dev/build-tools -D && npm run build:assets && npm run build:test-tools",
9494
"clean": "npx nx run-many --target=clean --all && npm run build:tools",
9595
"format": "npm run format:check && npm run format:fix",

packages/dev/core/src/Materials/Node/Blocks/PBR/subSurfaceBlock.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,9 @@ export class SubSurfaceBlock extends NodeMaterialBlock {
209209
, ${worldPosVarName}.xyz
210210
, viewDirectionW
211211
, ${refractionView}
212-
, ${(isWebGPU ? "uniforms." : "") + refractionBlock?._vRefractionInfosName ?? ""}
213-
, ${(isWebGPU ? "uniforms." : "") + refractionBlock?._refractionMatrixName ?? ""}
214-
, ${(isWebGPU ? "uniforms." : "") + refractionBlock?._vRefractionMicrosurfaceInfosName ?? ""}
212+
, ${(isWebGPU ? "uniforms." : "") + (refractionBlock?._vRefractionInfosName ?? "")}
213+
, ${(isWebGPU ? "uniforms." : "") + (refractionBlock?._refractionMatrixName ?? "")}
214+
, ${(isWebGPU ? "uniforms." : "") + (refractionBlock?._vRefractionMicrosurfaceInfosName ?? "")}
215215
, ${isWebGPU ? "uniforms." : ""}vLightingIntensity
216216
#ifdef SS_LINKREFRACTIONTOTRANSPARENCY
217217
, alpha

packages/dev/core/src/Meshes/Compression/dracoCompressionWorker.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ export function DecodeMesh(
232232
const ptr = decoderModule._malloc(byteLength);
233233
try {
234234
decoder.GetAttributeDataArrayForAllPoints(geometry, attribute, dataType, byteLength, ptr);
235-
const data = new info.typedArrayConstructor(info.heap.buffer, ptr, numValues);
235+
// this cast seems to be needed because of an issue with typescript, as all constructors do have the ptr and numValues arguments.
236+
const data = new (info.typedArrayConstructor as Float32ArrayConstructor)(info.heap.buffer, ptr, numValues);
236237
onAttributeData(kind, data.slice(), numComponents, byteOffset, byteStride, normalized);
237238
} finally {
238239
decoderModule._free(ptr);

packages/dev/core/src/Meshes/GreasedLine/greasedLineRibbonMesh.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ export class GreasedLineRibbonMesh extends GreasedLineBaseMesh {
237237
}
238238

239239
const v: number[] = [1, 0, numOfPaths];
240-
const doubleSided = options.ribbonOptions?.facesMode === GreasedLineRibbonFacesMode.FACES_MODE_DOUBLE_SIDED ?? false;
240+
const doubleSided = options.ribbonOptions?.facesMode === GreasedLineRibbonFacesMode.FACES_MODE_DOUBLE_SIDED;
241241

242242
const closePath = options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS && options.ribbonOptions.closePath;
243243
if (numOfPaths > 2) {

packages/dev/inspector/src/components/actionTabs/tabs/toolsTabComponent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ export class ToolsTabComponent extends PaneComponent {
166166
const engine = scene.getEngine();
167167

168168
this._previousRenderingScale = engine.getHardwareScalingLevel();
169-
engine.setHardwareScalingLevel(engine.getRenderWidth() / this._gifOptions.width ?? 1);
169+
engine.setHardwareScalingLevel(engine.getRenderWidth() / this._gifOptions.width || 1);
170170

171171
const intervalId = setInterval(() => {
172172
if (!this._gifRecorder) {

packages/dev/serializers/src/glTF/2.0/glTFExporter.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,6 @@ export class GLTFExporter {
440440

441441
private _generateJSON(shouldUseGlb: boolean, bufferByteLength: number, fileName?: string, prettyPrint?: boolean): string {
442442
const buffer: IBuffer = { byteLength: bufferByteLength };
443-
let imageName: string;
444443
let imageData: { data: ArrayBuffer; mimeType: ImageMimeType };
445444
let bufferView: IBufferView;
446445
let byteOffset: number = bufferByteLength;
@@ -496,7 +495,7 @@ export class GLTFExporter {
496495
byteOffset += imageData.data.byteLength;
497496
this._bufferViews.push(bufferView);
498497
image.bufferView = this._bufferViews.length - 1;
499-
image.name = imageName;
498+
image.name = fileName;
500499
image.mimeType = imageData.mimeType;
501500
image.uri = undefined;
502501
this._glTF.images!.push(image);

scripts/comment-analyzer.js renamed to scripts/comment-analyzer.mjs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,6 @@ function checkCommentsOnChild(child, parent, namesToCheck = []) {
159159
return errors.flat().filter((e) => e.result !== TestResultType.PASS);
160160
}
161161

162-
/**
163-
* Given a JSON data object, check for missing comments on public members.
164-
* @param {*} data the JSON data that is output from typedoc
165-
*/
166-
module.exports = {
167-
commentAnalyzer: function (data, namesToCheck = []) {
168-
return checkCommentsOnChild(data, null, namesToCheck);
169-
},
162+
export const commentAnalyzer = (data, namesToCheck = []) => {
163+
return checkCommentsOnChild(data, null, namesToCheck);
170164
};

scripts/typedoc-generator.js renamed to scripts/typedoc-generator.mjs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* eslint-disable no-console */
2-
const TypeDoc = require("typedoc");
3-
const fs = require("fs");
4-
const glob = require("glob");
5-
const { commentAnalyzer } = require("./comment-analyzer");
2+
import { Application } from "typedoc";
3+
import { readFileSync, existsSync, mkdirSync, writeFileSync } from "fs";
4+
import { globSync } from "glob";
5+
import { commentAnalyzer } from "./comment-analyzer.mjs";
66
// const { run } = require("jest");
7-
const exec = require("child_process").exec;
7+
import { exec } from "child_process";
88

99
function runCommand(command) {
1010
return new Promise((resolve, reject) => {
@@ -34,7 +34,7 @@ function generateMessageFromError(error) {
3434
}
3535

3636
async function generateTypedocAndAnalyze(entryPoints, filesChanged) {
37-
const app = await TypeDoc.Application.bootstrapWithPlugins(
37+
const app = await Application.bootstrapWithPlugins(
3838
{
3939
entryPoints,
4040
skipErrorChecking: true,
@@ -60,7 +60,7 @@ async function generateTypedocAndAnalyze(entryPoints, filesChanged) {
6060
const outputDir = "tmp";
6161
await app.generateJson(project, `${outputDir}/typedoc.json`);
6262

63-
const data = JSON.parse(fs.readFileSync(`${outputDir}/typedoc.json`, "utf8"));
63+
const data = JSON.parse(readFileSync(`${outputDir}/typedoc.json`, "utf8"));
6464
console.log("Analyzing...");
6565
const msgs = commentAnalyzer(data);
6666
// check if the message is in one of the files that has been changed
@@ -81,14 +81,14 @@ async function main() {
8181
const packages = process.argv.includes("--packages") ? process.argv[process.argv.indexOf("--packages") + 1].split(",") : ["core", "loaders", "materials", "gui", "serializers"];
8282
const full = process.argv.includes("--full");
8383
const filesChanged = (await runCommand(process.env.GIT_CHANGES_COMMAND || "git diff --name-only master")).split("\n");
84-
const files = glob.globSync(`packages/dev/@(${packages.join("|")})/src/index.ts`).filter((f) => /*!f.endsWith("index.ts") && */ !f.endsWith(".d.ts"));
84+
const files = globSync(`packages/dev/@(${packages.join("|")})/src/index.ts`).filter((f) => /*!f.endsWith("index.ts") && */ !f.endsWith(".d.ts"));
8585
console.log(files);
8686
const dirList = files.filter((file) => {
8787
return file.endsWith(".ts");
8888
});
8989

90-
if (!fs.existsSync("tmp")) {
91-
fs.mkdirSync("tmp");
90+
if (!existsSync("tmp")) {
91+
mkdirSync("tmp");
9292
}
9393

9494
await generateTypedocAndAnalyze(dirList, full ? undefined : filesChanged);
@@ -110,13 +110,13 @@ async function main() {
110110
.join("\n")}
111111
</testsuite>
112112
</testsuites>`;
113-
fs.writeFileSync("junit.xml", xml);
113+
writeFileSync("junit.xml", xml);
114114
// if in CI, save to errors.txt
115115
if (process.env.CI) {
116116
const messages = Object.keys(warnings)
117117
.map((w) => `${w} ${generateMessageFromError(Object.keys(warnings)[w])}`)
118118
.join("\n");
119-
fs.writeFileSync("errors.txt", messages);
119+
writeFileSync("errors.txt", messages);
120120
// log to the console
121121
console.log(`
122122
Found ${Object.keys(warnings).length} typedoc errors:

0 commit comments

Comments
 (0)