onnxruntime/js/web/lib/build-def.d.ts
Yulong Wang 6b0c97b43f
[js/web] fix typescript type check (#18343)
### Description

This PR fixes the TypeScript type check.

Previously, when I use esbuild to replace webpack (#17745), typescript
typecheck was disabled. This causes a few TypeScript type error checked
in into the code base. This PR fixes the followings:

- Use "Node16" as default "module" value in tsconfig.json, because in
TypeScript v5, `(module == "ES2015" && moduleResolution == "Node16")` is
an invalid combination.
- Set `noUnusedParameters` to true as default. in web override it to
false because multiple code need to be updated ( a following-up PR will
do this )
- set correct project file for 'web/lib/**/*.ts' for ESLint (otherwise
WebGPU types are not populated correctly)
- fix type error in file js/web/lib/wasm/jsep/webgpu/program-manager.ts
- upgrade "@webgpu/types" to latest to fix type error in file
js/web/lib/wasm/jsep/backend-webgpu.ts
- add package script "prebuild" for web to run tsc type check
- add type check in CI yml file
2023-11-10 16:03:38 -08:00

39 lines
1.2 KiB
TypeScript

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
/* eslint-disable @typescript-eslint/naming-convention */
/**
* The interface BuildDefinitions contains a set of flags which are defined at build time.
*
* Those flags are processed in bundler for tree shaking to remove unused code.
* No flags in this file should present in production build.
*/
interface BuildDefinitions {
/**
* defines whether to disable the whole WebGL backend in the build.
*/
readonly DISABLE_WEBGL: boolean;
/**
* defines whether to disable the whole WebGpu backend in the build.
*/
readonly DISABLE_WEBGPU: boolean;
/**
* defines whether to disable the whole WebAssembly backend in the build.
*/
readonly DISABLE_WASM: boolean;
/**
* defines whether to disable proxy feature in WebAssembly backend in the build.
*/
readonly DISABLE_WASM_PROXY: boolean;
/**
* defines whether to disable multi-threading feature in WebAssembly backend in the build.
*/
readonly DISABLE_WASM_THREAD: boolean;
/**
* defines whether to disable training APIs in WebAssembly backend.
*/
readonly DISABLE_TRAINING: boolean;
}
declare const BUILD_DEFS: BuildDefinitions;