Skip to content

Commit

Permalink
core(tsc): NetworkRequest.RESOURCE_TYPES type fix (#5851)
Browse files Browse the repository at this point in the history
  • Loading branch information
brendankenny committed Aug 17, 2018
1 parent 52826e5 commit dee7411
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ class CacheHeaders extends Audit {
static isCacheableAsset(record) {
const CACHEABLE_STATUS_CODES = new Set([200, 203, 206]);

/** @type {Set<LH.Crdp.Page.ResourceType>} */
const STATIC_RESOURCE_TYPES = new Set([
NetworkRequest.TYPES.Font,
NetworkRequest.TYPES.Image,
Expand Down
1 change: 1 addition & 0 deletions lighthouse-core/gather/computed/critical-request-chains.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class CriticalRequestChains extends ComputedArtifact {
// XHRs are fetched at High priority, but we exclude them, as they are unlikely to be critical
// Images are also non-critical.
// Treat any missed images, primarily favicons, as non-critical resources
/** @type {Array<LH.Crdp.Page.ResourceType>} */
const nonCriticalResourceTypes = [
NetworkRequest.TYPES.Image,
NetworkRequest.TYPES.XHR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const CHROME_EXTENSION_PROTOCOL = 'chrome-extension:';
const compressionHeaders = ['content-encoding', 'x-original-content-encoding'];
const compressionTypes = ['gzip', 'br', 'deflate'];
const binaryMimeTypes = ['image', 'audio', 'video'];
/** @type {Array<LH.Crdp.Page.ResourceType>} */
const textResourceTypes = [
NetworkRequest.TYPES.Document,
NetworkRequest.TYPES.Script,
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/lib/network-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const SECURE_SCHEMES = ['data', 'https', 'wss', 'blob', 'chrome', 'chrome-extens
* @property {string} securityOrigin
*/

/** @type {Record<LH.Crdp.Page.ResourceType, LH.Crdp.Page.ResourceType>} */
/** @type {SelfMap<LH.Crdp.Page.ResourceType>} */
const RESOURCE_TYPES = {
XHR: 'XHR',
Fetch: 'Fetch',
Expand Down

0 comments on commit dee7411

Please sign in to comment.