mirror of
https://github.com/koush/scrypted.git
synced 2026-05-06 14:10:28 +01:00
strictNullChecks: fix core utilities
- Change Express sendFile root from null to undefined - Add undefined to RefreshPromise.promise type - Add undefined to debouncer current promise type
This commit is contained in:
@@ -63,7 +63,7 @@ export class HttpResponseImpl implements HttpResponse {
|
||||
|
||||
// prefer etag
|
||||
this.res.sendFile(filePath, {
|
||||
root: null,
|
||||
root: undefined,
|
||||
dotfiles: 'allow',
|
||||
cacheControl: false,
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export interface RefreshPromise<T> {
|
||||
promise: Promise<T>;
|
||||
promise: Promise<T> | undefined;
|
||||
cacheDuration: number;
|
||||
}
|
||||
|
||||
@@ -66,12 +66,12 @@ export function timeoutFunction<T>(timeout: number, f: (isTimedOut: () => boolea
|
||||
}
|
||||
|
||||
export function createPromiseDebouncer<T>() {
|
||||
let current: Promise<T>;
|
||||
let current: Promise<T> | undefined;
|
||||
|
||||
return (func: () => Promise<T>): Promise<T> => {
|
||||
if (!current)
|
||||
current = func().finally(() => current = undefined);
|
||||
return current;
|
||||
current = func().finally(() => current = undefined as unknown as Promise<T>);
|
||||
return current!;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user