diff --git a/package.json b/package.json index 43ee583..f3d6396 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "idmp", - "version": "1.15.1", + "version": "1.15.2", "keywords": [ "deduplicate network requests", "idempotent function", diff --git a/plugins/browser-storage/src/index.ts b/plugins/browser-storage/src/index.ts index cbd1117..19cff5e 100644 --- a/plugins/browser-storage/src/index.ts +++ b/plugins/browser-storage/src/index.ts @@ -3,6 +3,8 @@ import { getOptions, type Idmp, type IdmpOptions, type IdmpPromise } from 'idmp' const udf = undefined type StorageType = 'localStorage' | 'sessionStorage' +type NonVoid = T extends void ? never : T + const getCacheKey = (globalKey: string) => `@idmp/v1/${globalKey}` const initStorage = (storageType: StorageType) => { @@ -66,7 +68,7 @@ const storageIdmpWrap = ( const storage = initStorage(storageType) const newIdmp = ( globalKey: string, - promiseFunc: IdmpPromise, + promiseFunc: IdmpPromise>, options?: IdmpOptions, ) => { const finalOptions = getOptions(options) diff --git a/plugins/node-fs/src/index.ts b/plugins/node-fs/src/index.ts index 7f76845..d30fa41 100644 --- a/plugins/node-fs/src/index.ts +++ b/plugins/node-fs/src/index.ts @@ -48,10 +48,12 @@ const getData = async (key: string) => { return data as T } +type NonVoid = T extends void ? never : T + const fsIdmpWrap = (_idmp: Idmp) => { const newIdmp = ( globalKey: string, - promiseFunc: IdmpPromise, + promiseFunc: IdmpPromise>, options?: IdmpOptions, ) => { const finalOptions = getOptions(options)