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

[js/web] fix typescript type check #18343

Merged
merged 4 commits into from
Nov 11, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 4 additions & 0 deletions js/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ module.exports = {
'use-isnan': 'error'
},
overrides: [{
files: ['web/lib/**/*.ts'],
excludedFiles: 'web/lib/wasm/proxy-worker/**/*',
parserOptions: { 'project': 'web/tsconfig.json' },
},{
files: ['node/**/*.ts'],
env: { 'es6': true, 'node': true }
}, {
Expand Down
3 changes: 1 addition & 2 deletions js/common/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"outDir": "./dist/esm",
"declaration": true,
"declarationMap": true,
"esModuleInterop": false,
"noUnusedParameters": true
"esModuleInterop": false
},
"include": ["lib"]
}
1 change: 0 additions & 1 deletion js/node/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"module": "Node16",
"outDir": "dist"
},
"include": ["lib"]
Expand Down
4 changes: 2 additions & 2 deletions js/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"module": "ES2015",
"module": "Node16",
"moduleResolution": "Node16",
"esModuleInterop": true,
"target": "ES2020",
Expand All @@ -10,7 +10,7 @@
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedParameters": false,
"noUnusedParameters": true,
"alwaysStrict": true,
"strictNullChecks": true,
"pretty": true,
Expand Down
1 change: 0 additions & 1 deletion js/tsconfig.tools.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "Node16",
"declaration": false,
"sourceMap": false
}
Expand Down
4 changes: 2 additions & 2 deletions js/web/lib/wasm/jsep/webgpu/program-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class ProgramManager {
this.backend.querySetCount * 8, GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST);

this.backend.endComputePass();
this.backend.getCommandEncoder().resolveQuerySet(this.backend.querySet, 0, 2, this.backend.queryData.buffer, 0);
this.backend.getCommandEncoder().resolveQuerySet(this.backend.querySet!, 0, 2, this.backend.queryData.buffer, 0);
this.backend.getCommandEncoder().copyBufferToBuffer(
this.backend.queryData.buffer, 0, syncData.buffer, 0, this.backend.querySetCount * 8);
this.backend.flush();
Expand All @@ -77,7 +77,7 @@ export class ProgramManager {
const kernelInfo = this.backend.kernels.get(kernelId)!;
const kernelName = `[${kernelInfo[0]}] ${kernelInfo[1]}`;

syncData.buffer.mapAsync(GPUMapMode.READ).then(() => {
void syncData.buffer.mapAsync(GPUMapMode.READ).then(() => {
const mappedData = new BigUint64Array(syncData.buffer.getMappedRange());
const startTimeU64 = mappedData[0];
const endTimeU64 = mappedData[1];
Expand Down
14 changes: 7 additions & 7 deletions js/web/package-lock.json

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

3 changes: 2 additions & 1 deletion js/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"build:doc": "node ./script/generate-webgl-operator-md && node ./script/generate-webgpu-operator-md",
"pull:wasm": "node ./script/pull-prebuilt-wasm-artifacts",
"test:e2e": "node ./test/e2e/run",
"prebuild": "tsc -p . --noEmit",
"build": "node ./script/build",
"test": "tsc --build ../scripts && node ../scripts/prepare-onnx-node-tests && node ./script/test-runner-cli",
"prepack": "node ./script/build && node ./script/prepack"
Expand All @@ -42,7 +43,7 @@
"@types/minimatch": "^5.1.2",
"@types/minimist": "^1.2.2",
"@types/platform": "^1.3.4",
"@webgpu/types": "^0.1.30",
"@webgpu/types": "^0.1.38",
"base64-js": "^1.5.1",
"chai": "^4.3.7",
"electron": "^23.1.2",
Expand Down
2 changes: 1 addition & 1 deletion js/web/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"module": "Node16",
"downlevelIteration": true,
"declaration": true,
"noUnusedParameters": false,
"typeRoots": ["./node_modules/@webgpu/types", "./node_modules/@types", "../node_modules/@types"]
},
"include": ["lib", "test"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ steps:
npm ci
workingDirectory: '$(Build.SourcesDirectory)/js'
displayName: 'npm ci /js/'
- script: |
npm run lint
workingDirectory: '$(Build.SourcesDirectory)/js'
displayName: 'run ESLint without TS type populated'
- script: |
npm ci
workingDirectory: '$(Build.SourcesDirectory)/js/common'
Expand All @@ -19,6 +15,10 @@ steps:
npm ci
workingDirectory: '$(Build.SourcesDirectory)/js/web'
displayName: 'npm ci /js/web/'
- script: |
npm run prebuild
workingDirectory: '$(Build.SourcesDirectory)/js/web'
displayName: 'run TypeScript type check in /js/web/'
- script: |
npm run lint
workingDirectory: '$(Build.SourcesDirectory)/js'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@ jobs:
npm ci
workingDirectory: '$(Build.SourcesDirectory)\js'
displayName: 'npm ci /js/'
- script: |
npm run lint
workingDirectory: '$(Build.SourcesDirectory)\js'
displayName: 'run ESLint without TS type populated'
- script: |
npm ci
workingDirectory: '$(Build.SourcesDirectory)\js\common'
fs-eire marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -115,6 +111,10 @@ jobs:
npm ci
workingDirectory: '$(Build.SourcesDirectory)\js\web'
displayName: 'npm ci /js/web/'
- script: |
npm run prebuild
workingDirectory: '$(Build.SourcesDirectory)\js\web'
displayName: 'run TypeScript type check in /js/web/'
- script: |
npm run lint
workingDirectory: '$(Build.SourcesDirectory)\js'
Expand Down
Loading