Skip to content

Commit d4da062

Browse files
committed
better null fix
1 parent 86cf2bc commit d4da062

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

lighthouse-core/test/gather/gather-runner-test.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jest.mock('../../lib/stack-collector.js', () => () => Promise.resolve([]));
2727
* @param {(...args: TParams) => TReturn} fn
2828
*/
2929
function makeParamsOptional(fn) {
30-
return /** @type {(...args: Nullable<RecursivePartial<TParams>>) => TReturn} */ (fn);
30+
return /** @type {(...args: RecursivePartial<TParams>) => TReturn} */ (fn);
3131
}
3232

3333
const GatherRunner = {
@@ -54,7 +54,13 @@ const GatherRunner = {
5454
*/
5555
function makeConfig(json) {
5656
// @ts-expect-error: allow recursive partial.
57-
return new Config(json);
57+
const config = new Config(json);
58+
59+
// Since the config is for `gather-runner`, ensure it has `passes`.
60+
if (!config.passes) {
61+
throw new Error('gather-runner test configs must have `passes`');
62+
}
63+
return /** @type {Config & {passes: Array<LH.Config.Pass>}} */ (config);
5864
}
5965

6066
const LoadFailureMode = {

types/externs.d.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,6 @@ declare global {
5050
[P in K]: P;
5151
};
5252

53-
/** Make all properties in T nullable. */
54-
type Nullable<T> = {
55-
[K in keyof T]: T[K] | null;
56-
}
57-
5853
/** Make optional all properties on T and any properties on object properties of T. */
5954
type RecursivePartial<T> = {
6055
[P in keyof T]+?:

0 commit comments

Comments
 (0)