1
0
Эх сурвалжийг харах

fix: broken ambiguity of functions in `DataMigrationsDict`

Sv443 3 сар өмнө
parent
commit
5861bb4d00

+ 5 - 0
.changeset/red-bobcats-deny.md

@@ -0,0 +1,5 @@
+---
+"@sv443-network/userutils": patch
+---
+
+Fixed broken ambiguity of DataStore's migration function type

+ 4 - 1
lib/DataStore.ts

@@ -7,8 +7,11 @@ import type { Prettify } from "./types.js";
 
 //#region types
 
+/** Function that takes the data in the old format and returns the data in the new format. Also supports an asynchronous migration. */
+type MigrationFunc = (oldData: any) => any | Promise<any>; // eslint-disable-line @typescript-eslint/no-explicit-any
+
 /** Dictionary of format version numbers and the function that migrates to them from the previous whole integer */
-export type DataMigrationsDict = Record<number, ((oldData: unknown) => unknown | Promise<unknown>)>;
+export type DataMigrationsDict = Record<number, MigrationFunc>;
 
 /** Options for the DataStore instance */
 export type DataStoreOptions<TData> = Prettify<