diff --git a/packages/driver/src/codecs/boolean.ts b/packages/driver/src/codecs/boolean.ts index 1d11eafb8..ec50124f5 100644 --- a/packages/driver/src/codecs/boolean.ts +++ b/packages/driver/src/codecs/boolean.ts @@ -21,7 +21,7 @@ import { type ICodec, ScalarCodec } from "./ifaces"; import { InvalidArgumentError } from "../errors"; export class BoolCodec extends ScalarCodec implements ICodec { - tsType = "boolean"; + override tsType = "boolean"; encode(buf: WriteBuffer, object: any): void { const typeOf = typeof object; diff --git a/packages/driver/src/codecs/bytes.ts b/packages/driver/src/codecs/bytes.ts index f356d6e7a..0bc62c593 100644 --- a/packages/driver/src/codecs/bytes.ts +++ b/packages/driver/src/codecs/bytes.ts @@ -21,7 +21,7 @@ import { type ICodec, ScalarCodec } from "./ifaces"; import { InvalidArgumentError } from "../errors"; export class BytesCodec extends ScalarCodec implements ICodec { - tsType = "Uint8Array"; + override tsType = "Uint8Array"; encode(buf: WriteBuffer, object: any): void { if (!(object instanceof Uint8Array)) { diff --git a/packages/driver/src/codecs/datetime.ts b/packages/driver/src/codecs/datetime.ts index 1422fc631..290ba5458 100644 --- a/packages/driver/src/codecs/datetime.ts +++ b/packages/driver/src/codecs/datetime.ts @@ -41,7 +41,7 @@ const TIMESHIFT = 946684800000; const DATESHIFT_ORD = ymd2ord(2000, 1, 1); export class DateTimeCodec extends ScalarCodec implements ICodec { - tsType = "Date"; + override tsType = "Date"; encode(buf: WriteBuffer, object: unknown): void { if (!(object instanceof Date)) { @@ -66,8 +66,8 @@ export class DateTimeCodec extends ScalarCodec implements ICodec { } export class LocalDateTimeCodec extends ScalarCodec implements ICodec { - tsType = "LocalDateTime"; - tsModule = "edgedb"; + override tsType = "LocalDateTime"; + override tsModule = "edgedb"; encode(buf: WriteBuffer, object: unknown): void { if (!(object instanceof LocalDateTime)) { @@ -123,8 +123,8 @@ export class LocalDateTimeCodec extends ScalarCodec implements ICodec { } export class LocalDateCodec extends ScalarCodec implements ICodec { - tsType = "LocalDate"; - tsModule = "edgedb"; + override tsType = "LocalDate"; + override tsModule = "edgedb"; encode(buf: WriteBuffer, object: unknown): void { if (!(object instanceof LocalDate)) { throw new InvalidArgumentError( @@ -142,8 +142,8 @@ export class LocalDateCodec extends ScalarCodec implements ICodec { } export class LocalTimeCodec extends ScalarCodec implements ICodec { - tsType = "LocalTime"; - tsModule = "edgedb"; + override tsType = "LocalTime"; + override tsModule = "edgedb"; encode(buf: WriteBuffer, object: unknown): void { if (!(object instanceof LocalTime)) { throw new InvalidArgumentError( @@ -199,8 +199,8 @@ export function checkValidEdgeDBDuration(duration: Duration): null | string { } export class DurationCodec extends ScalarCodec implements ICodec { - tsType = "Duration"; - tsModule = "edgedb"; + override tsType = "Duration"; + override tsModule = "edgedb"; encode(buf: WriteBuffer, object: unknown): void { if (!(object instanceof Duration)) { throw new InvalidArgumentError( @@ -283,8 +283,8 @@ export class DurationCodec extends ScalarCodec implements ICodec { } export class RelativeDurationCodec extends ScalarCodec implements ICodec { - tsType = "RelativeDuration"; - tsModule = "edgedb"; + override tsType = "RelativeDuration"; + override tsModule = "edgedb"; encode(buf: WriteBuffer, object: unknown): void { if (!(object instanceof RelativeDuration)) { throw new InvalidArgumentError(` @@ -350,8 +350,8 @@ export class RelativeDurationCodec extends ScalarCodec implements ICodec { } export class DateDurationCodec extends ScalarCodec implements ICodec { - tsType = "DateDuration"; - tsModule = "edgedb"; + override tsType = "DateDuration"; + override tsModule = "edgedb"; encode(buf: WriteBuffer, object: unknown): void { if (!(object instanceof DateDuration)) { throw new InvalidArgumentError(` diff --git a/packages/driver/src/codecs/ifaces.ts b/packages/driver/src/codecs/ifaces.ts index fa1bc0f8b..ab9dd93f5 100644 --- a/packages/driver/src/codecs/ifaces.ts +++ b/packages/driver/src/codecs/ifaces.ts @@ -101,7 +101,7 @@ export abstract class ScalarCodec extends Codec { readonly tsType: string = "unknown"; readonly tsModule: string | null = null; - getKnownTypeName(): string { + override getKnownTypeName(): string { if (this.typeName) { return this.typeName; } diff --git a/packages/driver/src/codecs/json.ts b/packages/driver/src/codecs/json.ts index 5acdcb4d5..2a3fd5d2e 100644 --- a/packages/driver/src/codecs/json.ts +++ b/packages/driver/src/codecs/json.ts @@ -25,7 +25,7 @@ import { type ICodec, ScalarCodec } from "./ifaces"; import { InvalidArgumentError, ProtocolError } from "../errors"; export class JSONCodec extends ScalarCodec implements ICodec { - tsType = "unknown"; + override tsType = "unknown"; readonly jsonFormat: number | null = 1; @@ -68,7 +68,7 @@ export class JSONCodec extends ScalarCodec implements ICodec { } export class PgTextJSONCodec extends JSONCodec { - readonly jsonFormat = null; + override readonly jsonFormat = null; } export class JSONStringCodec extends ScalarCodec implements ICodec { @@ -101,5 +101,5 @@ export class JSONStringCodec extends ScalarCodec implements ICodec { } export class PgTextJSONStringCodec extends JSONStringCodec { - readonly jsonFormat = null; + override readonly jsonFormat = null; } diff --git a/packages/driver/src/codecs/memory.ts b/packages/driver/src/codecs/memory.ts index c29fd4701..dcb6cc8e4 100644 --- a/packages/driver/src/codecs/memory.ts +++ b/packages/driver/src/codecs/memory.ts @@ -22,8 +22,8 @@ import { ConfigMemory } from "../datatypes/memory"; import { InvalidArgumentError } from "../errors"; export class ConfigMemoryCodec extends ScalarCodec implements ICodec { - tsType = "ConfigMemory"; - tsModule = "edgedb"; + override tsType = "ConfigMemory"; + override tsModule = "edgedb"; encode(buf: WriteBuffer, object: any): void { if (!(object instanceof ConfigMemory)) { diff --git a/packages/driver/src/codecs/numbers.ts b/packages/driver/src/codecs/numbers.ts index 7f6a4cf63..ba143ddf0 100644 --- a/packages/driver/src/codecs/numbers.ts +++ b/packages/driver/src/codecs/numbers.ts @@ -21,7 +21,7 @@ import { type ICodec, ScalarCodec } from "./ifaces"; import { InvalidArgumentError } from "../errors"; export class Int64Codec extends ScalarCodec implements ICodec { - tsType = "number"; + override tsType = "number"; encode(buf: WriteBuffer, object: any): void { if (typeof object !== "number") { throw new InvalidArgumentError(`a number was expected, got "${object}"`); @@ -50,7 +50,7 @@ export class Int64BigintCodec extends ScalarCodec implements ICodec { } export class Int32Codec extends ScalarCodec implements ICodec { - tsType = "number"; + override tsType = "number"; encode(buf: WriteBuffer, object: any): void { if (typeof object !== "number") { throw new InvalidArgumentError(`a number was expected, got "${object}"`); @@ -65,7 +65,7 @@ export class Int32Codec extends ScalarCodec implements ICodec { } export class Int16Codec extends ScalarCodec implements ICodec { - tsType = "number"; + override tsType = "number"; encode(buf: WriteBuffer, object: any): void { if (typeof object !== "number") { throw new InvalidArgumentError(`a number was expected, got "${object}"`); @@ -80,7 +80,7 @@ export class Int16Codec extends ScalarCodec implements ICodec { } export class Float32Codec extends ScalarCodec implements ICodec { - tsType = "number"; + override tsType = "number"; encode(buf: WriteBuffer, object: any): void { if (typeof object !== "number") { throw new InvalidArgumentError(`a number was expected, got "${object}"`); @@ -95,7 +95,7 @@ export class Float32Codec extends ScalarCodec implements ICodec { } export class Float64Codec extends ScalarCodec implements ICodec { - tsType = "number"; + override tsType = "number"; encode(buf: WriteBuffer, object: any): void { if (typeof object !== "number") { throw new InvalidArgumentError(`a number was expected, got "${object}"`); diff --git a/packages/driver/src/codecs/numerics.ts b/packages/driver/src/codecs/numerics.ts index a59c0e9a3..59b22a51a 100644 --- a/packages/driver/src/codecs/numerics.ts +++ b/packages/driver/src/codecs/numerics.ts @@ -24,7 +24,7 @@ const NUMERIC_POS = 0x0000; const NUMERIC_NEG = 0x4000; export class BigIntCodec extends ScalarCodec implements ICodec { - tsType = "bigint"; + override tsType = "bigint"; encode(buf: WriteBuffer, object: any): void { if (typeof object !== "bigint") { @@ -73,7 +73,7 @@ export class BigIntCodec extends ScalarCodec implements ICodec { } export class DecimalStringCodec extends ScalarCodec implements ICodec { - tsType = "string"; + override tsType = "string"; encode(buf: WriteBuffer, object: any): void { if (typeof object !== "string") { diff --git a/packages/driver/src/codecs/pgvector.ts b/packages/driver/src/codecs/pgvector.ts index b81d076a2..e24034eb3 100644 --- a/packages/driver/src/codecs/pgvector.ts +++ b/packages/driver/src/codecs/pgvector.ts @@ -30,7 +30,7 @@ import { SparseVector } from "../datatypes/pgvector"; export const PG_VECTOR_MAX_DIM = (1 << 16) - 1; export class PgVectorCodec extends ScalarCodec implements ICodec { - readonly tsType = "Float32Array"; + override readonly tsType = "Float32Array"; encode(buf: WriteBuffer, object: any): void { if (!(object instanceof Float32Array || Array.isArray(object))) { @@ -87,8 +87,8 @@ export class PgVectorCodec extends ScalarCodec implements ICodec { } export class PgVectorHalfVecCodec extends ScalarCodec implements ICodec { - readonly tsType = "Float16Array"; - readonly tsModule = "edgedb"; + override readonly tsType = "Float16Array"; + override readonly tsModule = "edgedb"; encode(buf: WriteBuffer, object: any): void { if (!(isFloat16Array(object) || Array.isArray(object))) { @@ -154,8 +154,8 @@ export class PgVectorHalfVecCodec extends ScalarCodec implements ICodec { } export class PgVectorSparseVecCodec extends ScalarCodec implements ICodec { - readonly tsType = "SparseVector"; - readonly tsModule = "edgedb"; + override readonly tsType = "SparseVector"; + override readonly tsModule = "edgedb"; encode(buf: WriteBuffer, object: any): void { if (!(object instanceof SparseVector)) { diff --git a/packages/driver/src/codecs/text.ts b/packages/driver/src/codecs/text.ts index 1065d1235..26d33d757 100644 --- a/packages/driver/src/codecs/text.ts +++ b/packages/driver/src/codecs/text.ts @@ -22,7 +22,7 @@ import { type ICodec, ScalarCodec } from "./ifaces"; import { InvalidArgumentError } from "../errors"; export class StrCodec extends ScalarCodec implements ICodec { - tsType = "string"; + override tsType = "string"; encode(buf: WriteBuffer, object: any): void { if (typeof object !== "string") { diff --git a/packages/driver/src/codecs/uuid.ts b/packages/driver/src/codecs/uuid.ts index 91cd179cf..9578a2552 100644 --- a/packages/driver/src/codecs/uuid.ts +++ b/packages/driver/src/codecs/uuid.ts @@ -37,7 +37,7 @@ function UUIDBufferFromString(uuid: string): Uint8Array { } export class UUIDCodec extends ScalarCodec implements ICodec { - tsType = "string"; + override tsType = "string"; encode(buf: WriteBuffer, object: any): void { if (typeof object === "string") { diff --git a/packages/driver/src/datatypes/datetime.ts b/packages/driver/src/datatypes/datetime.ts index 17afc3db7..79f58bf3c 100644 --- a/packages/driver/src/datatypes/datetime.ts +++ b/packages/driver/src/datatypes/datetime.ts @@ -274,7 +274,7 @@ export class LocalDateTime extends LocalDate { return localTimeInstances.get(this)!.nanosecond; } - toString(): string { + override toString(): string { return `${super.toString()}T${localTimeInstances.get(this)!.toString()}`; } } diff --git a/packages/driver/src/errors/base.ts b/packages/driver/src/errors/base.ts index dc956f39c..f5c3ff190 100644 --- a/packages/driver/src/errors/base.ts +++ b/packages/driver/src/errors/base.ts @@ -22,7 +22,7 @@ export class EdgeDBError extends Error { this._message = message ?? ""; } - get message() { + override get message() { return ( this._message + (this._query && this._attrs @@ -31,7 +31,7 @@ export class EdgeDBError extends Error { ); } - get name(): string { + override get name(): string { return this.constructor.name; } diff --git a/packages/driver/src/fetchConn.ts b/packages/driver/src/fetchConn.ts index 5f9f76296..6212a3df1 100644 --- a/packages/driver/src/fetchConn.ts +++ b/packages/driver/src/fetchConn.ts @@ -68,7 +68,7 @@ class BaseFetchConnection extends BaseRawConnection { this.authenticatedFetch = fetch; } - protected async _waitForMessage(): Promise { + protected override async _waitForMessage(): Promise { if (this.buffer.takeMessage()) { return; } @@ -141,11 +141,11 @@ class BaseFetchConnection extends BaseRawConnection { } } - protected _sendData(data: Uint8Array): void { + protected override _sendData(data: Uint8Array): void { this.__sendData(data); } - async fetch(...args: Parameters) { + override async fetch(...args: Parameters) { // In protocol v3 the format of the parse/execute messages depend on the // protocol version. In the fetch conn we don't know the server's supported // proto version until after the first message is sent, so the first @@ -183,9 +183,9 @@ class BaseFetchConnection extends BaseRawConnection { } export class AdminUIFetchConnection extends BaseFetchConnection { - adminUIMode = true; + override adminUIMode = true; - static create( + static override create( this: T, fetch: AuthenticatedFetch, registry: CodecsRegistry, diff --git a/packages/driver/src/rawConn.ts b/packages/driver/src/rawConn.ts index c7852b383..b8c61ecf3 100644 --- a/packages/driver/src/rawConn.ts +++ b/packages/driver/src/rawConn.ts @@ -194,7 +194,7 @@ export class RawConnection extends BaseRawConnection { } } - protected async _waitForMessage(): Promise { + protected override async _waitForMessage(): Promise { if (this.buffer.takeMessage()) { return; } @@ -213,7 +213,7 @@ export class RawConnection extends BaseRawConnection { } } - protected _sendData(data: Uint8Array): void { + protected override _sendData(data: Uint8Array): void { this.sock.write(data); } @@ -236,14 +236,14 @@ export class RawConnection extends BaseRawConnection { return tls.connect(opts); } - protected _abort(): void { + protected override _abort(): void { if (this.sock && this.connected) { this.sock.destroy(); } super._abort(); } - async close(): Promise { + override async close(): Promise { if (this.sock && this.connected) { this.sock.write( new WriteMessageBuffer().beginMessage(chars.$X).endMessage().unwrap(), diff --git a/packages/driver/src/reflection/strictMap.ts b/packages/driver/src/reflection/strictMap.ts index 3ed819b5b..647b2c0df 100644 --- a/packages/driver/src/reflection/strictMap.ts +++ b/packages/driver/src/reflection/strictMap.ts @@ -21,7 +21,7 @@ export class StrictMap extends Map { error on missing keys instead of returning an undefined. This is easier to work with when everything is strictly typed. */ - get(key: K): V { + override get(key: K): V { if (!this.has(key)) { throw new Error(`key "${key}" is not found`); } diff --git a/packages/tsconfig/base.json b/packages/tsconfig/base.json index 0c2758394..24996518c 100644 --- a/packages/tsconfig/base.json +++ b/packages/tsconfig/base.json @@ -14,6 +14,7 @@ "noImplicitThis": true, "removeComments": true, "stripInternal": true, + "noImplicitOverride": true, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, "useDefineForClassFields": true,