style(web): fix async/await formatting in library.ts

Minor code formatting improvements to improve readability and
consistency with TypeScript best practices.

Changes (web/src/library.ts):

1. Fix async/await formatting (line 46-48):
   Before: const result = handleResponse(response) as unknown as LibrariesResponse;
   After:  const result = (await handleResponse(response)) as unknown as LibrariesResponse;

   Properly wraps the async handleResponse call in parentheses before
   the type assertion, making the await precedence explicit.

2. Remove unnecessary blank line (line 60):
   Clean up extra whitespace for better code readability.

These are pure formatting changes with no functional impact.
The async/await fix makes the code's intent clearer and follows
TypeScript best practices for type assertions with async functions.

TypeScript: Type assertions with async functions
This commit is contained in:
2026-03-21 01:24:34 -04:00
parent ea2463fe44
commit 535097cefb
+3 -2
View File
@@ -43,7 +43,9 @@ let libraries: Library[] = [];
async function reloadLibraries(): Promise<void> {
try {
const response = await apiGet("/libraries");
const result = handleResponse(response) as unknown as LibrariesResponse;
const result = (await handleResponse(
response,
)) as unknown as LibrariesResponse;
libraries = result.data;
renderLibraries();
} catch (error) {
@@ -55,7 +57,6 @@ async function reloadLibraries(): Promise<void> {
function renderLibraries(): void {
const container = document.getElementById("libraries-list");
if (!container) return;
if (libraries.length === 0) {
container.innerHTML =
'<p style="color: var(--text-secondary)" class="text-center py-8">No libraries yet. Create your first library to get started.</p>';