Skip to content

Commit

Permalink
Set noImplicitOveride: true in tsconfig
Browse files Browse the repository at this point in the history
This matches the default in Deno 2.0 and makes sense for us to use given
how much we use inheritance.
  • Loading branch information
scotttrinh committed Dec 10, 2024
1 parent efbbcfa commit 04db466
Show file tree
Hide file tree
Showing 17 changed files with 49 additions and 48 deletions.
2 changes: 1 addition & 1 deletion packages/driver/src/codecs/boolean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packages/driver/src/codecs/bytes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
26 changes: 13 additions & 13 deletions packages/driver/src/codecs/datetime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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)) {
Expand Down Expand Up @@ -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(
Expand All @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(`
Expand Down Expand Up @@ -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(`
Expand Down
2 changes: 1 addition & 1 deletion packages/driver/src/codecs/ifaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions packages/driver/src/codecs/json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -101,5 +101,5 @@ export class JSONStringCodec extends ScalarCodec implements ICodec {
}

export class PgTextJSONStringCodec extends JSONStringCodec {
readonly jsonFormat = null;
override readonly jsonFormat = null;
}
4 changes: 2 additions & 2 deletions packages/driver/src/codecs/memory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
10 changes: 5 additions & 5 deletions packages/driver/src/codecs/numbers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}"`);
Expand Down Expand Up @@ -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}"`);
Expand All @@ -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}"`);
Expand All @@ -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}"`);
Expand All @@ -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}"`);
Expand Down
4 changes: 2 additions & 2 deletions packages/driver/src/codecs/numerics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down Expand Up @@ -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") {
Expand Down
10 changes: 5 additions & 5 deletions packages/driver/src/codecs/pgvector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))) {
Expand Down Expand Up @@ -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))) {
Expand Down Expand Up @@ -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)) {
Expand Down
2 changes: 1 addition & 1 deletion packages/driver/src/codecs/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
2 changes: 1 addition & 1 deletion packages/driver/src/codecs/uuid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
2 changes: 1 addition & 1 deletion packages/driver/src/datatypes/datetime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()}`;
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/driver/src/errors/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class EdgeDBError extends Error {
this._message = message ?? "";
}

get message() {
override get message() {
return (
this._message +
(this._query && this._attrs
Expand All @@ -31,7 +31,7 @@ export class EdgeDBError extends Error {
);
}

get name(): string {
override get name(): string {
return this.constructor.name;
}

Expand Down
10 changes: 5 additions & 5 deletions packages/driver/src/fetchConn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class BaseFetchConnection extends BaseRawConnection {
this.authenticatedFetch = fetch;
}

protected async _waitForMessage(): Promise<void> {
protected override async _waitForMessage(): Promise<void> {
if (this.buffer.takeMessage()) {
return;
}
Expand Down Expand Up @@ -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<BaseRawConnection["fetch"]>) {
override async fetch(...args: Parameters<BaseRawConnection["fetch"]>) {
// 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
Expand Down Expand Up @@ -183,9 +183,9 @@ class BaseFetchConnection extends BaseRawConnection {
}

export class AdminUIFetchConnection extends BaseFetchConnection {
adminUIMode = true;
override adminUIMode = true;

static create<T extends typeof BaseFetchConnection>(
static override create<T extends typeof BaseFetchConnection>(
this: T,
fetch: AuthenticatedFetch,
registry: CodecsRegistry,
Expand Down
8 changes: 4 additions & 4 deletions packages/driver/src/rawConn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export class RawConnection extends BaseRawConnection {
}
}

protected async _waitForMessage(): Promise<void> {
protected override async _waitForMessage(): Promise<void> {
if (this.buffer.takeMessage()) {
return;
}
Expand All @@ -213,7 +213,7 @@ export class RawConnection extends BaseRawConnection {
}
}

protected _sendData(data: Uint8Array): void {
protected override _sendData(data: Uint8Array): void {
this.sock.write(data);
}

Expand All @@ -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<void> {
override async close(): Promise<void> {
if (this.sock && this.connected) {
this.sock.write(
new WriteMessageBuffer().beginMessage(chars.$X).endMessage().unwrap(),
Expand Down
2 changes: 1 addition & 1 deletion packages/driver/src/reflection/strictMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class StrictMap<K, V> extends Map<K, V> {
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`);
}
Expand Down
1 change: 1 addition & 0 deletions packages/tsconfig/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"noImplicitThis": true,
"removeComments": true,
"stripInternal": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"useDefineForClassFields": true,
Expand Down

0 comments on commit 04db466

Please sign in to comment.