Skip to content

Commit

Permalink
add type to missingSupportCache
Browse files Browse the repository at this point in the history
  • Loading branch information
cmrn authored and clshortfuse committed Aug 23, 2024
1 parent 010ce5c commit 85d805d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/BrowserSelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export default class BrowserSelection {
return result;
}

/** @readonly */
/** @type {Map<string, MissingSupportResult>} @readonly */
static #missingSupportCache = new Map();

/**
Expand All @@ -179,7 +179,7 @@ export default class BrowserSelection {
// browserslist only uses `path` if `query` is not provided.
const key = query ? JSON.stringify(query) : path;

if (this.#missingSupportCache.has(key)) {
if (key && this.#missingSupportCache.has(key)) {
return this.#missingSupportCache.get(key);
}

Expand All @@ -188,7 +188,7 @@ export default class BrowserSelection {
browsers: selection.list(),
features: selection.compileBrowserSupport(),
};
this.#missingSupportCache.set(key, result);
if (key) this.#missingSupportCache.set(key, result);
return result;
}
}

0 comments on commit 85d805d

Please sign in to comment.