toPromise() — astro Function Reference
Architecture documentation for the toPromise() function in render.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD b4ab2273_2885_6a1f_2a1c_274c7b025334["toPromise()"] e0446a2c_f6ef_c306_3fa2_3d3016b94419["render.ts"] b4ab2273_2885_6a1f_2a1c_274c7b025334 -->|defined in| e0446a2c_f6ef_c306_3fa2_3d3016b94419 a4540b08_b256_31dc_609c_62af4c628a44["renderToAsyncIterable()"] a4540b08_b256_31dc_609c_62af4c628a44 -->|calls| b4ab2273_2885_6a1f_2a1c_274c7b025334 style b4ab2273_2885_6a1f_2a1c_274c7b025334 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/src/runtime/server/render/astro/render.ts lines 376–383
function toPromise<T>(fn: () => T | Promise<T>): Promise<T> {
try {
const result = fn();
return isPromise(result) ? result : Promise.resolve(result);
} catch (err) {
return Promise.reject(err);
}
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does toPromise() do?
toPromise() is a function in the astro codebase, defined in packages/astro/src/runtime/server/render/astro/render.ts.
Where is toPromise() defined?
toPromise() is defined in packages/astro/src/runtime/server/render/astro/render.ts at line 376.
What calls toPromise()?
toPromise() is called by 1 function(s): renderToAsyncIterable.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free