From bcc1034d281272b6281dc832afac75b6422fc441 Mon Sep 17 00:00:00 2001 From: James Prevett Date: Thu, 10 Oct 2024 11:11:33 -0500 Subject: [PATCH] Alias backends to interfaces --- src/IndexedDB.ts | 6 +++++- src/Storage.ts | 6 +++++- src/access.ts | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/IndexedDB.ts b/src/IndexedDB.ts index 5d89651..847c452 100644 --- a/src/IndexedDB.ts +++ b/src/IndexedDB.ts @@ -123,7 +123,7 @@ export interface IndexedDBOptions { * A file system that uses the IndexedDB key value file system. */ -export const IndexedDB = { +const _IndexedDB = { name: 'IndexedDB', options: { @@ -164,3 +164,7 @@ export const IndexedDB = { return fs; }, } as const satisfies Backend; +type _IndexedDB = typeof _IndexedDB; +// eslint-disable-next-line @typescript-eslint/no-empty-object-type +interface IndexedDB extends _IndexedDB {} +export const IndexedDB: IndexedDB = _IndexedDB; diff --git a/src/Storage.ts b/src/Storage.ts index 92faa7f..1d4fc9a 100644 --- a/src/Storage.ts +++ b/src/Storage.ts @@ -65,7 +65,7 @@ export interface WebStorageOptions { /** * A synchronous file system backed by a `Storage` (e.g. localStorage). */ -export const WebStorage = { +const _WebStorage = { name: 'WebStorage', options: { @@ -84,3 +84,7 @@ export const WebStorage = { return new StoreFS(new WebStorageStore(storage)); }, } as const satisfies Backend; +type _WebStorage = typeof _WebStorage; +// eslint-disable-next-line @typescript-eslint/no-empty-object-type +interface WebStorage extends _WebStorage {} +export const WebStorage: WebStorage = _WebStorage; diff --git a/src/access.ts b/src/access.ts index f19329c..3198b88 100644 --- a/src/access.ts +++ b/src/access.ts @@ -212,7 +212,7 @@ export class WebAccessFS extends Async(FileSystem) { } } -export const WebAccess = { +const _WebAccess = { name: 'WebAccess', options: { @@ -231,3 +231,7 @@ export const WebAccess = { return new WebAccessFS(options.handle); }, } as const satisfies Backend; +type _WebAccess = typeof _WebAccess; +// eslint-disable-next-line @typescript-eslint/no-empty-object-type +interface WebAccess extends _WebAccess {} +export const WebAccess: WebAccess = _WebAccess;