Skip to content

Commit

Permalink
fix: use thenable in recursiveResolve (#282)
Browse files Browse the repository at this point in the history
  • Loading branch information
lpatiny authored Dec 19, 2024
1 parent 5e5a85a commit a675766
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/utils/recursiveResolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ export async function recursiveResolve(object: unknown) {
function appendPromises(object: any, promises: Array<Promise<unknown>>) {
if (typeof object !== 'object') return object;
for (const key in object) {
if (object[key] instanceof Promise) {
promises.push(object[key].then((value) => (object[key] = value)));
if (typeof object[key].then === 'function') {
promises.push(
object[key].then((value: unknown) => (object[key] = value)),
);
} else if (typeof object[key] === 'object') {
appendPromises(object[key], promises);
}
Expand Down

0 comments on commit a675766

Please sign in to comment.