From 0b7cf270b45e73d0d2b8257b77a8c630f24a27ed Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Wed, 7 Jan 2026 16:17:45 -0800 Subject: [PATCH 1/7] set to warn --- js/eslint.config.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/eslint.config.mjs b/js/eslint.config.mjs index dde4a4dd76eca..40aa127bd5a51 100644 --- a/js/eslint.config.mjs +++ b/js/eslint.config.mjs @@ -139,7 +139,7 @@ export default [ }, ], - '@typescript-eslint/no-unnecessary-type-assertion': 'error', + '@typescript-eslint/no-unnecessary-type-assertion': 'warn', '@typescript-eslint/no-unused-vars': [ 'error', From 56df96e3adcaa2f46ba39a99b815c7f7362ce345 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Wed, 7 Jan 2026 16:19:11 -0800 Subject: [PATCH 2/7] comment --- js/eslint.config.mjs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/eslint.config.mjs b/js/eslint.config.mjs index 40aa127bd5a51..659c02ff0abd6 100644 --- a/js/eslint.config.mjs +++ b/js/eslint.config.mjs @@ -139,6 +139,8 @@ export default [ }, ], + // extra type assertions are sometimes needed for complex scenarios + // https://eslint.org/docs/latest/use/configure/rules#rule-severities '@typescript-eslint/no-unnecessary-type-assertion': 'warn', '@typescript-eslint/no-unused-vars': [ From d0c13d24d6d2bf412679591741567b6833331c10 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Thu, 8 Jan 2026 10:08:40 -0800 Subject: [PATCH 3/7] actually fix problem --- js/eslint.config.mjs | 2 +- js/web/lib/wasm/jsep/backend-webgpu.ts | 13 ++++++------- js/web/lib/wasm/jsep/backend-webnn.ts | 2 +- js/web/lib/wasm/jsep/init.ts | 2 +- js/web/lib/wasm/proxy-worker/main.ts | 2 +- js/web/lib/wasm/run-options.ts | 4 ++-- js/web/lib/wasm/wasm-core-impl.ts | 4 ++-- 7 files changed, 14 insertions(+), 15 deletions(-) diff --git a/js/eslint.config.mjs b/js/eslint.config.mjs index 659c02ff0abd6..4ad3f9a9a6f9d 100644 --- a/js/eslint.config.mjs +++ b/js/eslint.config.mjs @@ -141,7 +141,7 @@ export default [ // extra type assertions are sometimes needed for complex scenarios // https://eslint.org/docs/latest/use/configure/rules#rule-severities - '@typescript-eslint/no-unnecessary-type-assertion': 'warn', + '@typescript-eslint/no-unnecessary-type-assertion': 'error', '@typescript-eslint/no-unused-vars': [ 'error', diff --git a/js/web/lib/wasm/jsep/backend-webgpu.ts b/js/web/lib/wasm/jsep/backend-webgpu.ts index e486e4b0e043d..41d3f72872b30 100644 --- a/js/web/lib/wasm/jsep/backend-webgpu.ts +++ b/js/web/lib/wasm/jsep/backend-webgpu.ts @@ -247,7 +247,7 @@ export class WebGpuBackend { const requireFeatureIfAvailable = (feature: GPUFeatureName) => adapter.features.has(feature) && requiredFeatures.push(feature) && true; // Try chromium-experimental-timestamp-query-inside-passes and fallback to timestamp-query - if (!requireFeatureIfAvailable('chromium-experimental-timestamp-query-inside-passes' as GPUFeatureName)) { + if (!requireFeatureIfAvailable('chromium-experimental-timestamp-query-inside-passes')) { requireFeatureIfAvailable('timestamp-query'); } requireFeatureIfAvailable('shader-f16'); @@ -263,7 +263,7 @@ export class WebGpuBackend { this.kernelCustomData = new Map(); // set up flags for logger - configureLogger(env.logLevel!, !!env.debug); + configureLogger(env.logLevel, !!env.debug); // TODO: set up flags @@ -341,10 +341,10 @@ export class WebGpuBackend { let queryReadBuffer: GPUBuffer; if (this.queryType !== 'none') { this.commandEncoder.resolveQuerySet( - this.querySet!, + this.querySet, 0, this.pendingDispatchNumber * 2, - this.queryResolveBuffer!, + this.queryResolveBuffer, 0, ); @@ -356,7 +356,7 @@ export class WebGpuBackend { this.pendingQueries.set(queryReadBuffer, this.pendingKernels); this.pendingKernels = []; this.commandEncoder.copyBufferToBuffer( - this.queryResolveBuffer!, + this.queryResolveBuffer, 0, queryReadBuffer, 0, @@ -827,8 +827,7 @@ export class WebGpuBackend { return; } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this.computePassEncoder as any).writeTimestamp(this.querySet, index); + this.computePassEncoder.writeTimestamp(this.querySet, index); } setQueryType(): void { this.queryType = 'none'; diff --git a/js/web/lib/wasm/jsep/backend-webnn.ts b/js/web/lib/wasm/jsep/backend-webnn.ts index 0bb1b09687018..67779313d6d84 100644 --- a/js/web/lib/wasm/jsep/backend-webnn.ts +++ b/js/web/lib/wasm/jsep/backend-webnn.ts @@ -103,7 +103,7 @@ export class WebNNBackend { private mlOpSupportLimitsBySessionId = new Map(); constructor(env: Env) { - configureLogger(env.logLevel!, !!env.debug); + configureLogger(env.logLevel, !!env.debug); } public get currentSessionId(): number { diff --git a/js/web/lib/wasm/jsep/init.ts b/js/web/lib/wasm/jsep/init.ts index 50fb26fef1d41..0476da3ebd586 100644 --- a/js/web/lib/wasm/jsep/init.ts +++ b/js/web/lib/wasm/jsep/init.ts @@ -200,7 +200,7 @@ export const init = async ( // eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires const webGpuBackendImpl = require('./backend-webgpu').WebGpuBackend; const backend = new webGpuBackendImpl(); - await backend.initialize(env, gpuAdapter!); + await backend.initialize(env, gpuAdapter); jsepInit('webgpu', [ // backend diff --git a/js/web/lib/wasm/proxy-worker/main.ts b/js/web/lib/wasm/proxy-worker/main.ts index 163bac4eb676d..e65c8b5b0b579 100644 --- a/js/web/lib/wasm/proxy-worker/main.ts +++ b/js/web/lib/wasm/proxy-worker/main.ts @@ -109,7 +109,7 @@ if (isProxyWorker) { case 'init-wasm': initializeWebAssembly(message!.wasm).then( () => { - initRuntime(message!).then( + initRuntime(message).then( () => { postMessage({ type }); }, diff --git a/js/web/lib/wasm/run-options.ts b/js/web/lib/wasm/run-options.ts index a0ef57df31129..41d10704ca911 100644 --- a/js/web/lib/wasm/run-options.ts +++ b/js/web/lib/wasm/run-options.ts @@ -41,8 +41,8 @@ export const setRunOptions = (options: InferenceSession.RunOptions): [number, nu } runOptionsHandle = wasm._OrtCreateRunOptions( - runOptions.logSeverityLevel!, - runOptions.logVerbosityLevel!, + runOptions.logSeverityLevel, + runOptions.logVerbosityLevel, !!runOptions.terminate!, tagDataOffset, ); diff --git a/js/web/lib/wasm/wasm-core-impl.ts b/js/web/lib/wasm/wasm-core-impl.ts index 18c536d8d9217..4be34a01bac8f 100644 --- a/js/web/lib/wasm/wasm-core-impl.ts +++ b/js/web/lib/wasm/wasm-core-impl.ts @@ -92,7 +92,7 @@ const initOrt = (numThreads: number, loggingLevel: number): void => { */ export const initRuntime = async (env: Env): Promise => { // init ORT - initOrt(env.wasm.numThreads!, logLevelStringToEnum(env.logLevel)); + initOrt(env.wasm.numThreads, logLevelStringToEnum(env.logLevel)); }; /** @@ -955,7 +955,7 @@ export const run = async ( gpuBuffer, download: async () => { const arrayBuffer = await downloadDataFunction(); - const data = new (tensorTypeToTypedArrayConstructor(type!))(arrayBuffer); + const data = new (tensorTypeToTypedArrayConstructor(type))(arrayBuffer); return data as Tensor.DataTypeMap[Tensor.GpuBufferDataTypes]; }, dispose: () => { From 708161df3d6dd8a4e3cfcc516558e688fe7dc28b Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Thu, 8 Jan 2026 10:12:04 -0800 Subject: [PATCH 4/7] update baseline-browser-mapping --- js/package-lock.json | 13 +++++++------ js/package.json | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/js/package-lock.json b/js/package-lock.json index a13f1ae373f4b..ae1c8dc689753 100644 --- a/js/package-lock.json +++ b/js/package-lock.json @@ -16,6 +16,7 @@ "@types/npmlog": "^4.1.4", "@typescript-eslint/eslint-plugin": "^8.46.2", "@typescript-eslint/parser": "^8.46.2", + "baseline-browser-mapping": "^2.9.13", "dir-compare": "^4.2.0", "esbuild": "^0.25.0", "esbuild-plugin-polyfill-node": "^0.3.0", @@ -1623,9 +1624,9 @@ ] }, "node_modules/baseline-browser-mapping": { - "version": "2.8.20", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.8.20.tgz", - "integrity": "sha512-JMWsdF+O8Orq3EMukbUN1QfbLK9mX2CkUmQBcW2T0s8OmdAUL5LLM/6wFwSrqXzlXB13yhyK9gTKS1rIizOduQ==", + "version": "2.9.13", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.13.tgz", + "integrity": "sha512-WhtvB2NG2wjr04+h77sg3klAIwrgOqnjS49GGudnUPGFFgg7G17y7Qecqp+2Dr5kUDxNRBca0SK7cG8JwzkWDQ==", "dev": true, "license": "Apache-2.0", "bin": { @@ -6958,9 +6959,9 @@ "dev": true }, "baseline-browser-mapping": { - "version": "2.8.20", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.8.20.tgz", - "integrity": "sha512-JMWsdF+O8Orq3EMukbUN1QfbLK9mX2CkUmQBcW2T0s8OmdAUL5LLM/6wFwSrqXzlXB13yhyK9gTKS1rIizOduQ==", + "version": "2.9.13", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.13.tgz", + "integrity": "sha512-WhtvB2NG2wjr04+h77sg3klAIwrgOqnjS49GGudnUPGFFgg7G17y7Qecqp+2Dr5kUDxNRBca0SK7cG8JwzkWDQ==", "dev": true }, "binary-extensions": { diff --git a/js/package.json b/js/package.json index cb8b09f4247a6..18cd765dff85a 100644 --- a/js/package.json +++ b/js/package.json @@ -10,6 +10,7 @@ "@types/npmlog": "^4.1.4", "@typescript-eslint/eslint-plugin": "^8.46.2", "@typescript-eslint/parser": "^8.46.2", + "baseline-browser-mapping": "^2.9.13", "dir-compare": "^4.2.0", "esbuild": "^0.25.0", "esbuild-plugin-polyfill-node": "^0.3.0", From c08b778627b3e05495abfd3806820f10ad0091cd Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Thu, 8 Jan 2026 10:17:23 -0800 Subject: [PATCH 5/7] rmv comment --- js/eslint.config.mjs | 2 -- 1 file changed, 2 deletions(-) diff --git a/js/eslint.config.mjs b/js/eslint.config.mjs index 4ad3f9a9a6f9d..dde4a4dd76eca 100644 --- a/js/eslint.config.mjs +++ b/js/eslint.config.mjs @@ -139,8 +139,6 @@ export default [ }, ], - // extra type assertions are sometimes needed for complex scenarios - // https://eslint.org/docs/latest/use/configure/rules#rule-severities '@typescript-eslint/no-unnecessary-type-assertion': 'error', '@typescript-eslint/no-unused-vars': [ From eca4142c732c8190049d037cdf60effbce5f82f6 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Thu, 8 Jan 2026 10:29:46 -0800 Subject: [PATCH 6/7] suppress --- js/web/lib/wasm/jsep/backend-webgpu.ts | 17 +++++++++++------ js/web/lib/wasm/jsep/backend-webnn.ts | 3 ++- js/web/lib/wasm/jsep/init.ts | 3 ++- js/web/lib/wasm/proxy-worker/main.ts | 3 ++- js/web/lib/wasm/run-options.ts | 6 ++++-- js/web/lib/wasm/wasm-core-impl.ts | 6 ++++-- 6 files changed, 25 insertions(+), 13 deletions(-) diff --git a/js/web/lib/wasm/jsep/backend-webgpu.ts b/js/web/lib/wasm/jsep/backend-webgpu.ts index 41d3f72872b30..5acf129a73cee 100644 --- a/js/web/lib/wasm/jsep/backend-webgpu.ts +++ b/js/web/lib/wasm/jsep/backend-webgpu.ts @@ -247,7 +247,7 @@ export class WebGpuBackend { const requireFeatureIfAvailable = (feature: GPUFeatureName) => adapter.features.has(feature) && requiredFeatures.push(feature) && true; // Try chromium-experimental-timestamp-query-inside-passes and fallback to timestamp-query - if (!requireFeatureIfAvailable('chromium-experimental-timestamp-query-inside-passes')) { + if (!requireFeatureIfAvailable('chromium-experimental-timestamp-query-inside-passes' as GPUFeatureName)) { requireFeatureIfAvailable('timestamp-query'); } requireFeatureIfAvailable('shader-f16'); @@ -263,7 +263,8 @@ export class WebGpuBackend { this.kernelCustomData = new Map(); // set up flags for logger - configureLogger(env.logLevel, !!env.debug); + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion + configureLogger(env.logLevel!, !!env.debug); // TODO: set up flags @@ -341,10 +342,12 @@ export class WebGpuBackend { let queryReadBuffer: GPUBuffer; if (this.queryType !== 'none') { this.commandEncoder.resolveQuerySet( - this.querySet, + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion + this.querySet!, 0, this.pendingDispatchNumber * 2, - this.queryResolveBuffer, + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion + this.queryResolveBuffer!, 0, ); @@ -356,7 +359,8 @@ export class WebGpuBackend { this.pendingQueries.set(queryReadBuffer, this.pendingKernels); this.pendingKernels = []; this.commandEncoder.copyBufferToBuffer( - this.queryResolveBuffer, + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion + this.queryResolveBuffer!, 0, queryReadBuffer, 0, @@ -827,7 +831,8 @@ export class WebGpuBackend { return; } - this.computePassEncoder.writeTimestamp(this.querySet, index); + // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unnecessary-type-assertion + (this.computePassEncoder as any).writeTimestamp(this.querySet, index); } setQueryType(): void { this.queryType = 'none'; diff --git a/js/web/lib/wasm/jsep/backend-webnn.ts b/js/web/lib/wasm/jsep/backend-webnn.ts index 67779313d6d84..43c0f54fc0f94 100644 --- a/js/web/lib/wasm/jsep/backend-webnn.ts +++ b/js/web/lib/wasm/jsep/backend-webnn.ts @@ -103,7 +103,8 @@ export class WebNNBackend { private mlOpSupportLimitsBySessionId = new Map(); constructor(env: Env) { - configureLogger(env.logLevel, !!env.debug); + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion + configureLogger(env.logLevel!, !!env.debug); } public get currentSessionId(): number { diff --git a/js/web/lib/wasm/jsep/init.ts b/js/web/lib/wasm/jsep/init.ts index 0476da3ebd586..cf30408798781 100644 --- a/js/web/lib/wasm/jsep/init.ts +++ b/js/web/lib/wasm/jsep/init.ts @@ -200,7 +200,8 @@ export const init = async ( // eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires const webGpuBackendImpl = require('./backend-webgpu').WebGpuBackend; const backend = new webGpuBackendImpl(); - await backend.initialize(env, gpuAdapter); + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion + await backend.initialize(env, gpuAdapter!); jsepInit('webgpu', [ // backend diff --git a/js/web/lib/wasm/proxy-worker/main.ts b/js/web/lib/wasm/proxy-worker/main.ts index e65c8b5b0b579..182758d0bc3e3 100644 --- a/js/web/lib/wasm/proxy-worker/main.ts +++ b/js/web/lib/wasm/proxy-worker/main.ts @@ -109,7 +109,8 @@ if (isProxyWorker) { case 'init-wasm': initializeWebAssembly(message!.wasm).then( () => { - initRuntime(message).then( + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion + initRuntime(message!).then( () => { postMessage({ type }); }, diff --git a/js/web/lib/wasm/run-options.ts b/js/web/lib/wasm/run-options.ts index 41d10704ca911..a910ef9e0ccf3 100644 --- a/js/web/lib/wasm/run-options.ts +++ b/js/web/lib/wasm/run-options.ts @@ -41,8 +41,10 @@ export const setRunOptions = (options: InferenceSession.RunOptions): [number, nu } runOptionsHandle = wasm._OrtCreateRunOptions( - runOptions.logSeverityLevel, - runOptions.logVerbosityLevel, + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion + runOptions.logSeverityLevel!, + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion + runOptions.logVerbosityLevel!, !!runOptions.terminate!, tagDataOffset, ); diff --git a/js/web/lib/wasm/wasm-core-impl.ts b/js/web/lib/wasm/wasm-core-impl.ts index 4be34a01bac8f..61a7e12fd781c 100644 --- a/js/web/lib/wasm/wasm-core-impl.ts +++ b/js/web/lib/wasm/wasm-core-impl.ts @@ -92,7 +92,8 @@ const initOrt = (numThreads: number, loggingLevel: number): void => { */ export const initRuntime = async (env: Env): Promise => { // init ORT - initOrt(env.wasm.numThreads, logLevelStringToEnum(env.logLevel)); + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion + initOrt(env.wasm.numThreads!, logLevelStringToEnum(env.logLevel)); }; /** @@ -955,7 +956,8 @@ export const run = async ( gpuBuffer, download: async () => { const arrayBuffer = await downloadDataFunction(); - const data = new (tensorTypeToTypedArrayConstructor(type))(arrayBuffer); + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion + const data = new (tensorTypeToTypedArrayConstructor(type!))(arrayBuffer); return data as Tensor.DataTypeMap[Tensor.GpuBufferDataTypes]; }, dispose: () => { From 5c16bf8899f80701d41df265fe458121d1b42887 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Mon, 12 Jan 2026 12:39:13 -0800 Subject: [PATCH 7/7] Revert "suppress" This reverts commit eca4142c732c8190049d037cdf60effbce5f82f6. --- js/web/lib/wasm/jsep/backend-webgpu.ts | 17 ++++++----------- js/web/lib/wasm/jsep/backend-webnn.ts | 3 +-- js/web/lib/wasm/jsep/init.ts | 3 +-- js/web/lib/wasm/proxy-worker/main.ts | 3 +-- js/web/lib/wasm/run-options.ts | 6 ++---- js/web/lib/wasm/wasm-core-impl.ts | 6 ++---- 6 files changed, 13 insertions(+), 25 deletions(-) diff --git a/js/web/lib/wasm/jsep/backend-webgpu.ts b/js/web/lib/wasm/jsep/backend-webgpu.ts index 5acf129a73cee..41d3f72872b30 100644 --- a/js/web/lib/wasm/jsep/backend-webgpu.ts +++ b/js/web/lib/wasm/jsep/backend-webgpu.ts @@ -247,7 +247,7 @@ export class WebGpuBackend { const requireFeatureIfAvailable = (feature: GPUFeatureName) => adapter.features.has(feature) && requiredFeatures.push(feature) && true; // Try chromium-experimental-timestamp-query-inside-passes and fallback to timestamp-query - if (!requireFeatureIfAvailable('chromium-experimental-timestamp-query-inside-passes' as GPUFeatureName)) { + if (!requireFeatureIfAvailable('chromium-experimental-timestamp-query-inside-passes')) { requireFeatureIfAvailable('timestamp-query'); } requireFeatureIfAvailable('shader-f16'); @@ -263,8 +263,7 @@ export class WebGpuBackend { this.kernelCustomData = new Map(); // set up flags for logger - // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion - configureLogger(env.logLevel!, !!env.debug); + configureLogger(env.logLevel, !!env.debug); // TODO: set up flags @@ -342,12 +341,10 @@ export class WebGpuBackend { let queryReadBuffer: GPUBuffer; if (this.queryType !== 'none') { this.commandEncoder.resolveQuerySet( - // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion - this.querySet!, + this.querySet, 0, this.pendingDispatchNumber * 2, - // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion - this.queryResolveBuffer!, + this.queryResolveBuffer, 0, ); @@ -359,8 +356,7 @@ export class WebGpuBackend { this.pendingQueries.set(queryReadBuffer, this.pendingKernels); this.pendingKernels = []; this.commandEncoder.copyBufferToBuffer( - // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion - this.queryResolveBuffer!, + this.queryResolveBuffer, 0, queryReadBuffer, 0, @@ -831,8 +827,7 @@ export class WebGpuBackend { return; } - // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unnecessary-type-assertion - (this.computePassEncoder as any).writeTimestamp(this.querySet, index); + this.computePassEncoder.writeTimestamp(this.querySet, index); } setQueryType(): void { this.queryType = 'none'; diff --git a/js/web/lib/wasm/jsep/backend-webnn.ts b/js/web/lib/wasm/jsep/backend-webnn.ts index 43c0f54fc0f94..67779313d6d84 100644 --- a/js/web/lib/wasm/jsep/backend-webnn.ts +++ b/js/web/lib/wasm/jsep/backend-webnn.ts @@ -103,8 +103,7 @@ export class WebNNBackend { private mlOpSupportLimitsBySessionId = new Map(); constructor(env: Env) { - // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion - configureLogger(env.logLevel!, !!env.debug); + configureLogger(env.logLevel, !!env.debug); } public get currentSessionId(): number { diff --git a/js/web/lib/wasm/jsep/init.ts b/js/web/lib/wasm/jsep/init.ts index cf30408798781..0476da3ebd586 100644 --- a/js/web/lib/wasm/jsep/init.ts +++ b/js/web/lib/wasm/jsep/init.ts @@ -200,8 +200,7 @@ export const init = async ( // eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires const webGpuBackendImpl = require('./backend-webgpu').WebGpuBackend; const backend = new webGpuBackendImpl(); - // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion - await backend.initialize(env, gpuAdapter!); + await backend.initialize(env, gpuAdapter); jsepInit('webgpu', [ // backend diff --git a/js/web/lib/wasm/proxy-worker/main.ts b/js/web/lib/wasm/proxy-worker/main.ts index 182758d0bc3e3..e65c8b5b0b579 100644 --- a/js/web/lib/wasm/proxy-worker/main.ts +++ b/js/web/lib/wasm/proxy-worker/main.ts @@ -109,8 +109,7 @@ if (isProxyWorker) { case 'init-wasm': initializeWebAssembly(message!.wasm).then( () => { - // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion - initRuntime(message!).then( + initRuntime(message).then( () => { postMessage({ type }); }, diff --git a/js/web/lib/wasm/run-options.ts b/js/web/lib/wasm/run-options.ts index a910ef9e0ccf3..41d10704ca911 100644 --- a/js/web/lib/wasm/run-options.ts +++ b/js/web/lib/wasm/run-options.ts @@ -41,10 +41,8 @@ export const setRunOptions = (options: InferenceSession.RunOptions): [number, nu } runOptionsHandle = wasm._OrtCreateRunOptions( - // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion - runOptions.logSeverityLevel!, - // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion - runOptions.logVerbosityLevel!, + runOptions.logSeverityLevel, + runOptions.logVerbosityLevel, !!runOptions.terminate!, tagDataOffset, ); diff --git a/js/web/lib/wasm/wasm-core-impl.ts b/js/web/lib/wasm/wasm-core-impl.ts index 61a7e12fd781c..4be34a01bac8f 100644 --- a/js/web/lib/wasm/wasm-core-impl.ts +++ b/js/web/lib/wasm/wasm-core-impl.ts @@ -92,8 +92,7 @@ const initOrt = (numThreads: number, loggingLevel: number): void => { */ export const initRuntime = async (env: Env): Promise => { // init ORT - // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion - initOrt(env.wasm.numThreads!, logLevelStringToEnum(env.logLevel)); + initOrt(env.wasm.numThreads, logLevelStringToEnum(env.logLevel)); }; /** @@ -956,8 +955,7 @@ export const run = async ( gpuBuffer, download: async () => { const arrayBuffer = await downloadDataFunction(); - // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion - const data = new (tensorTypeToTypedArrayConstructor(type!))(arrayBuffer); + const data = new (tensorTypeToTypedArrayConstructor(type))(arrayBuffer); return data as Tensor.DataTypeMap[Tensor.GpuBufferDataTypes]; }, dispose: () => {