Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core(tsc): update for new @types/css-font-loading-module #5061

Merged
merged 1 commit into from
Apr 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions lighthouse-core/gather/gatherers/fonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
const Gatherer = require('./gatherer');
const Sentry = require('../../lib/sentry');

// TODO(bckenny): manually add 'display' for now.
// PR to add full FontFace props in https://github.com/DefinitelyTyped/DefinitelyTyped/pull/25045
/** @typedef {Exclude<keyof FontFace, 'load'|'loaded'|'status'> | 'display'} FontFaceStringKeys */
// All the property keys of FontFace where the value is a string and are worth
// using for finding font matches (see _findSameFontFamily).
/** @typedef {'family'|'style'|'weight'|'stretch'|'unicodeRange'|'variant'|'featureSettings'|'display'} FontFaceStringKeys */
Copy link
Member Author

@brendankenny brendankenny Apr 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was trying to get clever here to automate extraction of the string properties, but turns out there are string properties we don't care about, like status (which is 'unloaded' | 'loading' | 'loaded' | 'error') and not something we'd want to use to try to match up fonts). Easier to just go explicit like this.

/** @typedef {{err: {message: string, stack: string}}} FontGatherError */

/** @type {Array<FontFaceStringKeys>} */
Expand Down Expand Up @@ -42,7 +42,6 @@ function getAllLoadedFonts(descriptors) {
src: [],
};
descriptors.forEach(descriptor => {
// @ts-ignore TODO(bckenny): see above 'display' TODO
fontRule[descriptor] = fontFace[descriptor];
});

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"devDependencies": {
"@types/chrome": "^0.0.60",
"@types/configstore": "^2.1.1",
"@types/css-font-loading-module": "^0.0.1",
"@types/css-font-loading-module": "^0.0.2",
"@types/inquirer": "^0.0.35",
"@types/lodash.isequal": "^4.5.2",
"@types/node": "*",
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
version "0.9.43"
resolved "https://registry.yarnpkg.com/@types/core-js/-/core-js-0.9.43.tgz#65d646c5e8c0cd1bdee37065799f9d3d48748253"

"@types/css-font-loading-module@^0.0.1":
version "0.0.1"
resolved "https://registry.yarnpkg.com/@types/css-font-loading-module/-/css-font-loading-module-0.0.1.tgz#00f3594bcb15813282b8d5595d9d997db49b2608"
"@types/css-font-loading-module@^0.0.2":
version "0.0.2"
resolved "https://registry.yarnpkg.com/@types/css-font-loading-module/-/css-font-loading-module-0.0.2.tgz#09f1f1772975777e37851b7b7a4389d97c210add"

"@types/events@*":
version "1.2.0"
Expand Down