client-ts: Port services/app/components/component

This commit is contained in:
Elian Doran
2024-07-25 19:21:24 +03:00
parent 65563cb29e
commit 411234dd9c
3 changed files with 21 additions and 20 deletions

View File

@@ -301,7 +301,7 @@ function dynamicRequire(moduleName: string) {
}
}
function timeLimit(promise: Promise<void>, limitMs: number, errorMessage: string) {
function timeLimit<T>(promise: Promise<T>, limitMs: number, errorMessage: string) {
if (!promise || !promise.then) { // it's not actually a promise
return promise;
}
@@ -309,7 +309,7 @@ function timeLimit(promise: Promise<void>, limitMs: number, errorMessage: string
// better stack trace if created outside of promise
const error = new Error(errorMessage || `Process exceeded time limit ${limitMs}`);
return new Promise((res, rej) => {
return new Promise<T>((res, rej) => {
let resolved = false;
promise.then(result => {