From fb4f73ddeccf5b33688d59dcbebd449a1c35e33e Mon Sep 17 00:00:00 2001 From: Simon Chan <1330321+yume-chan@users.noreply.github.com> Date: Sun, 9 Jan 2022 22:54:50 +0800 Subject: [PATCH] chore: enable noImplicitOverride --- apps/demo/package.json | 2 +- libraries/adb-backend-direct-sockets/package.json | 3 +-- libraries/adb-backend-webusb/package.json | 2 +- libraries/adb-backend-ws/package.json | 2 +- libraries/adb-credential-web/package.json | 4 +--- libraries/adb/package.json | 2 +- libraries/adb/src/commands/sync/sync.ts | 2 +- libraries/adb/src/socket/close-event-emitter.ts | 6 +++--- libraries/adb/src/socket/controller.ts | 2 +- libraries/adb/src/socket/data-event-emitter.ts | 4 ++-- libraries/adb/src/socket/dispatcher.ts | 2 +- libraries/event/package.json | 2 +- libraries/scrcpy/package.json | 2 +- libraries/scrcpy/src/connection.ts | 4 ++-- libraries/scrcpy/src/decoder/tinyh264/wrapper.ts | 2 +- libraries/scrcpy/src/options/1_16.ts | 2 +- libraries/scrcpy/src/options/1_18.ts | 6 +++--- libraries/scrcpy/src/options/1_21.ts | 2 +- libraries/struct/package.json | 2 +- libraries/struct/src/types/array-buffer.ts | 2 +- .../src/types/variable-length-array-buffer.ts | 14 +++++++------- toolchain/ts-package-builder/tsconfig.base.json | 1 + 22 files changed, 34 insertions(+), 36 deletions(-) diff --git a/apps/demo/package.json b/apps/demo/package.json index f0afbf4d..9c877a53 100644 --- a/apps/demo/package.json +++ b/apps/demo/package.json @@ -41,6 +41,6 @@ "@types/react": "17.0.27", "eslint": "7.32.0", "eslint-config-next": "^12.0.7", - "typescript": "^4.4.3" + "typescript": "^4.5.4" } } diff --git a/libraries/adb-backend-direct-sockets/package.json b/libraries/adb-backend-direct-sockets/package.json index 630a372a..05c872a0 100644 --- a/libraries/adb-backend-direct-sockets/package.json +++ b/libraries/adb-backend-direct-sockets/package.json @@ -30,13 +30,12 @@ "build:watch": "build-ts-package --incremental" }, "devDependencies": { - "typescript": "^4.4.3", + "typescript": "^4.5.4", "@types/jest": "^27.4.0", "@yume-chan/ts-package-builder": "^1.0.0" }, "dependencies": { "@yume-chan/adb": "^0.0.9", - "@yume-chan/async": "^2.1.4", "@yume-chan/event": "^0.0.9", "tslib": "^2.3.1" } diff --git a/libraries/adb-backend-webusb/package.json b/libraries/adb-backend-webusb/package.json index 5e17bc9f..4f61326c 100644 --- a/libraries/adb-backend-webusb/package.json +++ b/libraries/adb-backend-webusb/package.json @@ -38,7 +38,7 @@ }, "devDependencies": { "jest": "^26.6.3", - "typescript": "^4.4.3", + "typescript": "^4.5.4", "@yume-chan/ts-package-builder": "^1.0.0" } } diff --git a/libraries/adb-backend-ws/package.json b/libraries/adb-backend-ws/package.json index bb58623a..e6ed854a 100644 --- a/libraries/adb-backend-ws/package.json +++ b/libraries/adb-backend-ws/package.json @@ -30,7 +30,7 @@ "build:watch": "build-ts-package --incremental" }, "devDependencies": { - "typescript": "^4.4.3", + "typescript": "^4.5.4", "@yume-chan/ts-package-builder": "^1.0.0" }, "dependencies": { diff --git a/libraries/adb-credential-web/package.json b/libraries/adb-credential-web/package.json index 8a38b7ea..fe73866e 100644 --- a/libraries/adb-credential-web/package.json +++ b/libraries/adb-credential-web/package.json @@ -29,13 +29,11 @@ "build:watch": "build-ts-package --incremental" }, "devDependencies": { - "typescript": "^4.4.3", + "typescript": "^4.5.4", "@yume-chan/ts-package-builder": "^1.0.0" }, "dependencies": { "@yume-chan/adb": "^0.0.9", - "@yume-chan/async": "^2.1.4", - "@yume-chan/event": "^0.0.9", "tslib": "^2.3.1" } } diff --git a/libraries/adb/package.json b/libraries/adb/package.json index 4b9cc4c5..5262265e 100644 --- a/libraries/adb/package.json +++ b/libraries/adb/package.json @@ -38,7 +38,7 @@ }, "devDependencies": { "jest": "^26.6.3", - "typescript": "^4.4.3", + "typescript": "^4.5.4", "@yume-chan/ts-package-builder": "^1.0.0" } } diff --git a/libraries/adb/src/commands/sync/sync.ts b/libraries/adb/src/commands/sync/sync.ts index 0393e859..31c8cb71 100644 --- a/libraries/adb/src/commands/sync/sync.ts +++ b/libraries/adb/src/commands/sync/sync.ts @@ -106,7 +106,7 @@ export class AdbSync extends AutoDisposable { } } - public dispose() { + public override dispose() { super.dispose(); this.stream.close(); } diff --git a/libraries/adb/src/socket/close-event-emitter.ts b/libraries/adb/src/socket/close-event-emitter.ts index bf4883f0..8a5cebcb 100644 --- a/libraries/adb/src/socket/close-event-emitter.ts +++ b/libraries/adb/src/socket/close-event-emitter.ts @@ -6,7 +6,7 @@ NoopRemoveEventListener.dispose = NoopRemoveEventListener; export class CloseEventEmitter extends EventEmitter{ private closed = false; - protected addEventListener(info: EventListenerInfo) { + protected override addEventListener(info: EventListenerInfo) { if (this.closed) { info.listener.apply(info.thisArg, [undefined, ...info.args]); return NoopRemoveEventListener; @@ -15,13 +15,13 @@ export class CloseEventEmitter extends EventEmitter{ } } - public fire() { + public override fire() { super.fire(); this.closed = true; this.listeners.length = 0; } - public dispose() { + public override dispose() { this.fire(); super.dispose(); } diff --git a/libraries/adb/src/socket/controller.ts b/libraries/adb/src/socket/controller.ts index f1670f59..a3eddf4b 100644 --- a/libraries/adb/src/socket/controller.ts +++ b/libraries/adb/src/socket/controller.ts @@ -97,7 +97,7 @@ export class AdbSocketController extends AutoDisposable implements AdbSocketInfo } } - public dispose() { + public override dispose() { this._closed = true; this.closeEvent.fire(); super.dispose(); diff --git a/libraries/adb/src/socket/data-event-emitter.ts b/libraries/adb/src/socket/data-event-emitter.ts index f1560b11..c970f8ac 100644 --- a/libraries/adb/src/socket/data-event-emitter.ts +++ b/libraries/adb/src/socket/data-event-emitter.ts @@ -9,7 +9,7 @@ export type AsyncEvent = Event; export class DataEventEmitter extends EventEmitter { private dispatchLock = new PromiseResolver(); - protected addEventListener(info: EventListenerInfo) { + protected override addEventListener(info: EventListenerInfo) { const remove = super.addEventListener(info); if (this.listeners.length === 1) { this.dispatchLock.resolve(); @@ -17,7 +17,7 @@ export class DataEventEmitter extends EventEmitter { + public override async initialize(): Promise { try { // try to unbind first await this.device.reverse.remove('localabstract:scrcpy'); @@ -80,7 +80,7 @@ export class ScrcpyClientReverseConnection extends ScrcpyClientConnection { ]; } - public dispose() { + public override dispose() { // Don't await this! // `reverse.remove`'s response will never arrive // before we read all pending data from `videoStream` diff --git a/libraries/scrcpy/src/decoder/tinyh264/wrapper.ts b/libraries/scrcpy/src/decoder/tinyh264/wrapper.ts index 82ee1aca..a6cc2818 100644 --- a/libraries/scrcpy/src/decoder/tinyh264/wrapper.ts +++ b/libraries/scrcpy/src/decoder/tinyh264/wrapper.ts @@ -47,7 +47,7 @@ export class TinyH264Wrapper extends AutoDisposable { }, [data]); } - public dispose() { + public override dispose() { super.dispose(); worker!.postMessage({ type: 'release', diff --git a/libraries/scrcpy/src/options/1_16.ts b/libraries/scrcpy/src/options/1_16.ts index d241781b..b2244665 100644 --- a/libraries/scrcpy/src/options/1_16.ts +++ b/libraries/scrcpy/src/options/1_16.ts @@ -1,4 +1,4 @@ -import { Adb } from "@yume-chan/adb"; +import { type Adb } from "@yume-chan/adb"; import Struct, { placeholder } from "@yume-chan/struct"; import { AndroidCodecLevel, AndroidCodecProfile } from "../codec"; import { ScrcpyClientConnection, ScrcpyClientForwardConnection, ScrcpyClientReverseConnection } from "../connection"; diff --git a/libraries/scrcpy/src/options/1_18.ts b/libraries/scrcpy/src/options/1_18.ts index 8311a94e..d9d6c59e 100644 --- a/libraries/scrcpy/src/options/1_18.ts +++ b/libraries/scrcpy/src/options/1_18.ts @@ -1,7 +1,7 @@ -import { Adb } from "@yume-chan/adb"; +import { type Adb } from "@yume-chan/adb"; import Struct, { placeholder } from "@yume-chan/struct"; -import { AndroidKeyEventAction, ScrcpyControlMessageType } from "../message"; -import { ScrcpyOptions1_16, ScrcpyOptions1_16Type } from "./1_16"; +import { type AndroidKeyEventAction, ScrcpyControlMessageType } from "../message"; +import { ScrcpyOptions1_16, type ScrcpyOptions1_16Type } from "./1_16"; export interface ScrcpyOptions1_18Type extends ScrcpyOptions1_16Type { powerOffOnClose: boolean; diff --git a/libraries/scrcpy/src/options/1_21.ts b/libraries/scrcpy/src/options/1_21.ts index cde78a61..317bf22e 100644 --- a/libraries/scrcpy/src/options/1_21.ts +++ b/libraries/scrcpy/src/options/1_21.ts @@ -25,7 +25,7 @@ export class ScrcpyOptions1_21 { if (key === 'encoderName') { value = '_'; diff --git a/libraries/struct/package.json b/libraries/struct/package.json index a29ea1d3..b3c40f9c 100644 --- a/libraries/struct/package.json +++ b/libraries/struct/package.json @@ -38,7 +38,7 @@ }, "devDependencies": { "jest": "^26.6.3", - "typescript": "^4.4.3", + "typescript": "^4.5.4", "@yume-chan/ts-package-builder": "^1.0.0", "@types/jest": "^27.4.0", "@types/node": "^16.11.19", diff --git a/libraries/struct/src/types/array-buffer.ts b/libraries/struct/src/types/array-buffer.ts index f758fc09..83022ce9 100644 --- a/libraries/struct/src/types/array-buffer.ts +++ b/libraries/struct/src/types/array-buffer.ts @@ -178,7 +178,7 @@ export class ArrayBufferLikeFieldValue< this.arrayBuffer = arrayBuffer; } - public set(value: TDefinition['TValue']): void { + public override set(value: TDefinition['TValue']): void { super.set(value); this.arrayBuffer = undefined; } diff --git a/libraries/struct/src/types/variable-length-array-buffer.ts b/libraries/struct/src/types/variable-length-array-buffer.ts index 5c1afef0..690a12e9 100644 --- a/libraries/struct/src/types/variable-length-array-buffer.ts +++ b/libraries/struct/src/types/variable-length-array-buffer.ts @@ -25,7 +25,7 @@ export class VariableLengthArrayBufferLikeFieldDefinition< return 0; } - protected getDeserializeSize(struct: StructValue) { + protected override getDeserializeSize(struct: StructValue) { let value = struct.value[this.options.lengthField] as number | string; if (typeof value === 'string') { value = Number.parseInt(value, this.options.lengthFieldBase ?? 10); @@ -33,7 +33,7 @@ export class VariableLengthArrayBufferLikeFieldDefinition< return value; } - public create( + public override create( options: Readonly, struct: StructValue, value: TType['TTypeScriptType'], @@ -80,7 +80,7 @@ export class VariableLengthArrayBufferLikeStructFieldValue< struct.set(lengthField, this.lengthFieldValue); } - public getSize() { + public override getSize() { if (this.length === undefined) { this.length = this.definition.type.getSize(this.value); if (this.length === -1) { @@ -92,7 +92,7 @@ export class VariableLengthArrayBufferLikeStructFieldValue< return this.length; } - public set(value: unknown) { + public override set(value: unknown) { super.set(value); this.arrayBuffer = undefined; this.length = undefined; @@ -118,11 +118,11 @@ export class VariableLengthArrayBufferLikeFieldLengthValue this.arrayBufferField = arrayBufferField; } - public getSize() { + public override getSize() { return this.originalField.getSize(); } - get() { + public override get() { let value: string | number = this.arrayBufferField.getSize(); const originalValue = this.originalField.get(); @@ -133,7 +133,7 @@ export class VariableLengthArrayBufferLikeFieldLengthValue return value; } - set() { } + public override set() { } serialize(dataView: DataView, offset: number) { this.originalField.set(this.get()); diff --git a/toolchain/ts-package-builder/tsconfig.base.json b/toolchain/ts-package-builder/tsconfig.base.json index 08074747..ce48b9e4 100644 --- a/toolchain/ts-package-builder/tsconfig.base.json +++ b/toolchain/ts-package-builder/tsconfig.base.json @@ -25,6 +25,7 @@ /* Additional Checks */ // "noUnusedLocals": true, /* Report errors on unused locals. */ // "noUnusedParameters": true, /* Report errors on unused parameters. */ + "noImplicitOverride": true, "noImplicitReturns": true, // /* Report error when not all code paths in function return a value. */ "noFallthroughCasesInSwitch": true, // /* Report errors for fallthrough cases in switch statement. */ "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */