Skip to content

Build your personal knowledge base with Trilium Notes

style(standalone): type the native transport's reply in the new fetch path

Elian Doran2858a051a3dd
diff --git a/apps/standalone/src/lightweight/bridged_request_provider.ts b/apps/standalone/src/lightweight/bridged_request_provider.ts
index ad5c6d7f77..5fbc13a03b 100644
--- a/apps/standalone/src/lightweight/bridged_request_provider.ts
+++ b/apps/standalone/src/lightweight/bridged_request_provider.ts
@@ -174,7 +174,7 @@ export default class BridgedRequestProvider implements RequestProvider {
const validated = validateFetchableUrl(resourceUrl).toString();
const id = String(this.nextId++);
- const msg = await new Promise<any>((resolve, reject) => {
+ const msg = await new Promise<BridgedResponse>((resolve, reject) => {
this.pending.set(id, { resolve, reject });
(self as unknown as Worker).postMessage({
@@ -203,3 +203,11 @@ export default class BridgedRequestProvider implements RequestProvider {
};
}
}
+
+/** What the main thread answers an HTTP_REQUEST with, for the binary shape of the exchange. */
+interface BridgedResponse {
+ status: number;
+ headers?: Record<string, string>;
+ /** Base64 for a binary response; the raw text otherwise. */
+ body?: string;
+}