Skip to content

Commit 805ec28

Browse files
committed
fix(react-intlayer): add return type to useLoadDynamic function for better type safety
1 parent 077048b commit 805ec28

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/react-intlayer/src/client/useLoadDynamic.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const createSuspender = <T>(promise: Promise<T>) => {
2525

2626
const cache = new Map<string, ReturnType<typeof createSuspender>>();
2727

28-
export const useLoadDynamic = <T>(key: string, promise: Promise<T>) => {
28+
export const useLoadDynamic = <T>(key: string, promise: Promise<T>): T => {
2929
if (!cache.has(key)) {
3030
cache.set(key, createSuspender(promise));
3131
}

packages/react-intlayer/src/server/useLoadDynamic.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { cache, use } from 'react';
22

3-
export const useLoadDynamic = <T>(_key: string, promise: Promise<T>) => {
3+
export const useLoadDynamic = <T>(_key: string, promise: Promise<T>): T => {
44
const cachedPromise = cache(async () => await promise)();
55

66
const dictionary = use(cachedPromise);

0 commit comments

Comments
 (0)