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:
Koushik Dutta
2026-04-02 13:20:13 -07:00
parent 5bfb3e5675
commit 5f040f5ff4
2 changed files with 5 additions and 5 deletions

View File

@@ -63,7 +63,7 @@ export class HttpResponseImpl implements HttpResponse {
// prefer etag
this.res.sendFile(filePath, {
root: null,
root: undefined,
dotfiles: 'allow',
cacheControl: false,
});

View File

@@ -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!;
}
}