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

deps(typescript): update to 3.8.3 #10461

Merged
merged 9 commits into from
Apr 8, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ class LanternEstimatedInputLatency extends LanternMetric {

/**
* @param {LH.Gatherer.Simulation.Result} simulation
* @param {Object} extras
* @param {import('./lantern-metric.js').Extras} extras
* @return {LH.Gatherer.Simulation.Result}
*/
static getEstimateFromSimulation(simulation, extras) {
if (!extras.fmpResult) throw new Error('missing fmpResult');

// Intentionally use the opposite FMP estimate, a more pessimistic FMP means that more tasks
// are excluded from the EIL computation, so a higher FMP means lower EIL for same work.
const fmpTimeInMs = extras.optimistic
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/computed/metrics/lantern-first-cpu-idle.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class LanternFirstCPUIdle extends LanternInteractive {

/**
* @param {LH.Gatherer.Simulation.Result} simulation
* @param {Object} extras
* @param {{optimistic: boolean, fmpResult: LH.Artifacts.LanternMetric}} extras
* @return {LH.Gatherer.Simulation.Result}
*/
static getEstimateFromSimulation(simulation, extras) {
Expand Down
4 changes: 3 additions & 1 deletion lighthouse-core/computed/metrics/lantern-interactive.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@ class LanternInteractive extends LanternMetric {

/**
* @param {LH.Gatherer.Simulation.Result} simulationResult
* @param {Object} extras
* @param {import('./lantern-metric.js').Extras} extras
* @return {LH.Gatherer.Simulation.Result}
*/
static getEstimateFromSimulation(simulationResult, extras) {
if (!extras.fmpResult) throw new Error('missing fmpResult');

const lastTaskAt = LanternInteractive.getLastLongTaskEndTime(simulationResult.nodeTimings);
const minimumTime = extras.optimistic
? extras.fmpResult.optimisticEstimate.timeInMs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ class LanternMaxPotentialFID extends LanternMetricArtifact {

/**
* @param {LH.Gatherer.Simulation.Result} simulation
* @param {Object} extras
* @param {import('./lantern-metric.js').Extras} extras
* @return {LH.Gatherer.Simulation.Result}
*/
static getEstimateFromSimulation(simulation, extras) {
if (!extras.fcpResult) throw new Error('missing fcpResult');

// Intentionally use the opposite FCP estimate, a more pessimistic FCP means that more tasks
// are excluded from the FID computation, so a higher FCP means lower FID for same work.
const fcpTimeInMs = extras.optimistic
Expand Down
18 changes: 13 additions & 5 deletions lighthouse-core/computed/metrics/lantern-metric.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ const LoadSimulator = require('../load-simulator.js');
/** @typedef {import('../../lib/dependency-graph/network-node')} NetworkNode */
/** @typedef {import('../../lib/dependency-graph/simulator/simulator')} Simulator */

/**
* @typedef Extras
* @property {boolean} optimistic
* @property {LH.Artifacts.LanternMetric=} fcpResult
* @property {LH.Artifacts.LanternMetric=} fmpResult
* @property {LH.Artifacts.LanternMetric=} interactiveResult
* @property {{speedIndex: number}=} speedline
*/

class LanternMetricArtifact {
/**
* @param {Node} dependencyGraph
Expand Down Expand Up @@ -75,7 +84,7 @@ class LanternMetricArtifact {

/**
* @param {LH.Gatherer.Simulation.Result} simulationResult
* @param {any=} extras
* @param {Extras} extras
connorjclark marked this conversation as resolved.
Show resolved Hide resolved
* @return {LH.Gatherer.Simulation.Result}
*/
static getEstimateFromSimulation(simulationResult, extras) { // eslint-disable-line no-unused-vars
Expand All @@ -85,7 +94,7 @@ class LanternMetricArtifact {
/**
* @param {LH.Artifacts.MetricComputationDataInput} data
* @param {LH.Audit.Context} context
* @param {any=} extras
* @param {Omit<Extras, 'optimistic'>=} extras
Copy link
Member

Choose a reason for hiding this comment

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

since requirements aren't changing very quickly any more, at some point we should take a pass at these extras to see if we can untangle them a bit :)

* @return {Promise<LH.Artifacts.LanternMetric>}
*/
static async computeMetricWithGraphs(data, context, extras) {
Expand All @@ -111,13 +120,12 @@ class LanternMetricArtifact {

const optimisticEstimate = this.getEstimateFromSimulation(
optimisticSimulation.timeInMs < optimisticFlexSimulation.timeInMs ?
optimisticSimulation : optimisticFlexSimulation,
Object.assign({}, extras, {optimistic: true})
optimisticSimulation : optimisticFlexSimulation, {...extras, optimistic: true}
);

const pessimisticEstimate = this.getEstimateFromSimulation(
pessimisticSimulation,
Object.assign({}, extras, {optimistic: false})
{...extras, optimistic: false}
);

const coefficients = this.getScaledCoefficients(simulator.rtt);
Expand Down
5 changes: 4 additions & 1 deletion lighthouse-core/computed/metrics/lantern-speed-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,13 @@ class LanternSpeedIndex extends LanternMetric {

/**
* @param {LH.Gatherer.Simulation.Result} simulationResult
* @param {Object} extras
* @param {import('./lantern-metric.js').Extras} extras
* @return {LH.Gatherer.Simulation.Result}
*/
static getEstimateFromSimulation(simulationResult, extras) {
if (!extras.fcpResult) throw new Error('missing fcpResult');
if (!extras.speedline) throw new Error('missing speedline');

const fcpTimeInMs = extras.fcpResult.pessimisticEstimate.timeInMs;
const estimate = extras.optimistic
? extras.speedline.speedIndex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ class LanternTotalBlockingTime extends LanternMetric {

/**
* @param {LH.Gatherer.Simulation.Result} simulation
* @param {Object} extras
* @param {import('./lantern-metric.js').Extras} extras
* @return {LH.Gatherer.Simulation.Result}
*/
static getEstimateFromSimulation(simulation, extras) {
if (!extras.fcpResult) throw new Error('missing fcpResult');
if (!extras.interactiveResult) throw new Error('missing interactiveResult');

// Intentionally use the opposite FCP estimate. A pessimistic FCP is higher than equal to an
// optimistic FCP, which means potentially more tasks are excluded from the Total Blocking Time
// computation. So a more pessimistic FCP gives a more optimistic Total Blocking Time for the
Expand Down
4 changes: 2 additions & 2 deletions lighthouse-core/config/experimental-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ const config = {
'byte-efficiency/duplicated-javascript',
'legacy-javascript',
],
// @ts-ignore: `title` is required in CategoryJson. setting to the same value as the default
// config is awkward - easier to omit the property here. Will defer to default config.
categories: {
// @ts-ignore: `title` is required in CategoryJson. setting to the same value as the default
// config is awkward - easier to omit the property here. Will defer to default config.
'performance': {
auditRefs: [
{id: 'duplicated-javascript', weight: 0, group: 'load-opportunities'},
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/config/lr-mobile-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const config = {
audits: [
'metrics/first-contentful-paint-3g',
],
// @ts-ignore TODO(bckenny): type extended Config where e.g. category.title isn't required
categories: {
// @ts-ignore TODO(bckenny): type extended Config where e.g. category.title isn't required
performance: {
auditRefs: [
{id: 'first-contentful-paint-3g', weight: 0},
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/lib/cdt/SDK.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const SDK = {
* relies on this, but only for a couple method return values. To avoid global pollution,
* we explicitly set the extension functions on the return values.
*
* @param {Array} array
* @param {unknown[]} array
*/
function extendArray(array) {
// @ts-ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
/* globals self Util */

/** @typedef {import('./dom.js')} DOM */
/** @typedef {import('./details-renderer.js')} DetailsRenderer */

class CriticalRequestChainRenderer {
/**
Expand Down
1 change: 0 additions & 1 deletion lighthouse-core/report/html/renderer/details-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,6 @@ class DetailsRenderer {
/**
* @param {LH.Audit.Details.NodeValue} item
* @return {Element}
* @protected
*/
renderNode(item) {
const element = this._dom.createElement('span', 'lh-node');
Expand Down
1 change: 1 addition & 0 deletions lighthouse-core/report/html/renderer/report-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* Dummy text for ensuring report robustness: </script> pre$`post %%LIGHTHOUSE_JSON%%
*/

/** @typedef {import('./category-renderer')} CategoryRenderer */
/** @typedef {import('./dom.js')} DOM */

/* globals self, Util, DetailsRenderer, CategoryRenderer, I18n, PerformanceCategoryRenderer, PwaCategoryRenderer */
Expand Down
2 changes: 2 additions & 0 deletions lighthouse-core/report/html/renderer/report-ui-features.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

/* globals getFilenamePrefix Util */

/** @typedef {import('./dom')} DOM */

/**
* @param {HTMLTableElement} tableEl
* @return {Array<HTMLTableRowElement>}
Expand Down
1 change: 1 addition & 0 deletions lighthouse-core/report/html/renderer/snippet-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
/* globals self, Util */

/** @typedef {import('./details-renderer')} DetailsRenderer */
/** @typedef {import('./dom')} DOM */

/** @enum {number} */
const LineVisibility = {
Expand Down
2 changes: 2 additions & 0 deletions lighthouse-core/report/html/renderer/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

/* globals self, URL */

/** @typedef {import('./i18n')} I18n */

const ELLIPSIS = '\u2026';
const NBSP = '\xa0';
const PASS_THRESHOLD = 0.9;
Expand Down
7 changes: 4 additions & 3 deletions lighthouse-core/test/gather/driver-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ async function flushAllTimersAndMicrotasks(ms = 1000) {
* @property {(...args: RecursivePartial<Parameters<Driver['goOnline']>>) => ReturnType<Driver['goOnline']>} goOnline
*/

/** @typedef {Driver & DriverMockMethods} TestDriver */
/** @typedef {Omit<Driver, keyof DriverMockMethods> & DriverMockMethods} TestDriver */
Copy link
Member

Choose a reason for hiding this comment

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

👍 nice


/** @type {TestDriver} */
let driver;
Expand Down Expand Up @@ -492,8 +492,7 @@ describe('.gotoURL', () => {
}
}
const replayConnection = new ReplayConnection();

const driver = /** @type {TestDriver} */ (new Driver(replayConnection));
const driver = new Driver(replayConnection);

// Redirect in log will go through
const startUrl = 'http://en.wikipedia.org/';
Expand All @@ -503,6 +502,8 @@ describe('.gotoURL', () => {

const loadOptions = {
waitForLoad: true,
/** @type {LH.Gatherer.PassContext} */
// @ts-ignore - we don't need the entire context for the test.
passContext: {
passConfig: {
pauseAfterLoadMs: 0,
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/test/gather/gather-runner-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const {createMockSendCommandFn} = require('./mock-commands.js');
jest.mock('../../lib/stack-collector.js', () => () => Promise.resolve([]));

/**
* @template {Array} TParams
* @template {unknown[]} TParams
* @template TReturn
* @param {(...args: TParams) => TReturn} fn
*/
Expand Down
2 changes: 2 additions & 0 deletions lighthouse-viewer/app/src/viewer-ui-features.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

/* global ReportUIFeatures, ReportGenerator */

/** @typedef {import('../../../lighthouse-core/report/html/renderer/dom')} DOM */

/**
* Extends ReportUIFeatures to add an (optional) ability to save to a gist and
* generates the saved report from a browserified ReportGenerator.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
"pretty-json-stringify": "^0.0.2",
"puppeteer": "^1.19.0",
"terser": "^4.2.0",
"typescript": "3.5.3"
"typescript": "3.8.3"
},
"dependencies": {
"axe-core": "3.5.1",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7810,10 +7810,10 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=

typescript@3.5.3:
version "3.5.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.3.tgz#c830f657f93f1ea846819e929092f5fe5983e977"
integrity sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g==
typescript@3.8.3:
version "3.8.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.3.tgz#409eb8544ea0335711205869ec458ab109ee1061"
integrity sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==

uglify-js@^3.1.4:
version "3.4.9"
Expand Down