diff --git a/jest/async-storage-mock.d.ts b/jest/async-storage-mock.d.ts new file mode 100644 index 00000000..4cd864a0 --- /dev/null +++ b/jest/async-storage-mock.d.ts @@ -0,0 +1,9 @@ +import type { + AsyncStorageHook, + AsyncStorageStatic, +} from '../lib/typescript/types'; + +export function useAsyncStorage(key: string): AsyncStorageHook; + +declare const AsyncStorage: AsyncStorageStatic; +export default AsyncStorage; diff --git a/src/index.ts b/src/index.ts index 9168539f..618a74ad 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,14 +1,5 @@ import AsyncStorage from './AsyncStorage'; -import type { AsyncStorageHook, AsyncStorageStatic } from './types'; export { useAsyncStorage } from './hooks'; -export type { AsyncStorageStatic } from './types'; export default AsyncStorage; - -// @ts-ignore AsyncStorage mock module -declare module '@react-native-async-storage/async-storage/jest/async-storage-mock' { - export function useAsyncStorage(key: string): AsyncStorageHook; - const AsyncStorageLib: AsyncStorageStatic; - export default AsyncStorageLib; -}