From d696b8b52cf5260e05c567f9029a759029820d56 Mon Sep 17 00:00:00 2001 From: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com> Date: Fri, 24 May 2024 18:29:08 +0100 Subject: [PATCH] Change abstract class name --- packages/lib/src/datastore.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/lib/src/datastore.ts b/packages/lib/src/datastore.ts index 3a44cf39..d07f1318 100644 --- a/packages/lib/src/datastore.ts +++ b/packages/lib/src/datastore.ts @@ -51,7 +51,7 @@ export class JsonDatastoreProvider< > extends DatastoreProvider { constructor( private filePath: string, - private fromJson: (json: J) => V, + private fromJson: (json: J) => V = v => v as any, private migrations: (rawJson: Record) => Record = v => v as any, private finalise: (obj: V) => V = v => v, ) { @@ -92,7 +92,7 @@ export class JsonIdDatastoreProvider< > extends DatastoreProvider { constructor( private filePath: string, - private fromJson: (json: J) => V, + private fromJson: (json: J) => V = v => v as any, private migrations: (rawJson: Array) => Array = v => v as any, private finalise: (obj: V) => V = v => v, ) { @@ -129,7 +129,7 @@ export class JsonIdDatastoreProvider< } // Implements a similar interface to a map -export abstract class BaseDatastore< +export abstract class Datastore< K extends DatastoreKey, V extends DatastoreValue, > extends EventEmitter { @@ -196,10 +196,10 @@ export abstract class BaseDatastore< } // General key value mapping which can be saved and loaded with the file system -export class Datastore< +export class KeyValueDatastore< K extends DatastoreKey, V extends DatastoreValue, -> extends BaseDatastore { +> extends Datastore { // Set the value in the datastore, be careful of race conditions if you await any functions before calling set set(key: K, value: V) { this.data.set(key, value); @@ -236,7 +236,7 @@ export class Datastore< // A special implementation of the datastore to work directly with subscribable values export class SubscribableDatastore< V extends SubscribableValue, -> extends BaseDatastore { +> extends Datastore { // Set the value in the datastore, be careful of race conditions if you await any functions before calling set set(value: V) { this.data.set(value.id, value);