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 2 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,7 +42,7 @@ class LanternEstimatedInputLatency extends LanternMetric {

/**
* @param {LH.Gatherer.Simulation.Result} simulation
* @param {Object} extras
* @param {any} extras
Copy link
Member

Choose a reason for hiding this comment

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

we're not dealing with these safely anyways, and unfortunately the templated-class solution doesn't work in tsc because these are static methods, so what do you think of one of

  • using @param {{optimistic: boolean}} extras here (and in the other lantern metrics) and @ts-ignore on the two accesses below or
  • typing extras exactly as what's used and @ts-ignore the call to getEstimateFromSimulation in lantern-metric.js

I think the intent is clearer either way, and it gives a clearer TODO of what needs to be resolved (on our side or the tsc side) to get extras properly checked.

* @return {LH.Gatherer.Simulation.Result}
*/
static getEstimateFromSimulation(simulation, extras) {
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 {any} extras
* @return {LH.Gatherer.Simulation.Result}
*/
static getEstimateFromSimulation(simulation, extras) {
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/computed/metrics/lantern-interactive.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class LanternInteractive extends LanternMetric {

/**
* @param {LH.Gatherer.Simulation.Result} simulationResult
* @param {Object} extras
* @param {any} extras
* @return {LH.Gatherer.Simulation.Result}
*/
static getEstimateFromSimulation(simulationResult, extras) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class LanternMaxPotentialFID extends LanternMetricArtifact {

/**
* @param {LH.Gatherer.Simulation.Result} simulation
* @param {Object} extras
* @param {any} extras
* @return {LH.Gatherer.Simulation.Result}
*/
static getEstimateFromSimulation(simulation, extras) {
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/computed/metrics/lantern-speed-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class LanternSpeedIndex extends LanternMetric {

/**
* @param {LH.Gatherer.Simulation.Result} simulationResult
* @param {Object} extras
* @param {any} extras
* @return {LH.Gatherer.Simulation.Result}
*/
static getEstimateFromSimulation(simulationResult, extras) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class LanternTotalBlockingTime extends LanternMetric {

/**
* @param {LH.Gatherer.Simulation.Result} simulation
* @param {Object} extras
* @param {any} extras
* @return {LH.Gatherer.Simulation.Result}
*/
static getEstimateFromSimulation(simulation, extras) {
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 {any[]} array
connorjclark marked this conversation as resolved.
Show resolved Hide resolved
*/
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: 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
2 changes: 2 additions & 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 Expand Up @@ -129,6 +130,7 @@ class SnippetRenderer {
// access the full element detail. Just being able to see the outer HTML isn't very useful.
if (details.node && dom.isDevTools()) {
const nodeContainer = dom.find('.lh-snippet__node', header);
// @ts-ignore: renderNode is protected.
connorjclark marked this conversation as resolved.
Show resolved Hide resolved
nodeContainer.appendChild(detailsRenderer.renderNode(details.node));
}

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
3 changes: 2 additions & 1 deletion 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 @@ -512,6 +512,7 @@ describe('.gotoURL', () => {
}
const replayConnection = new ReplayConnection();

// @ts-ignore: Coerce to TestDriver for looser typing in function parameters.
Copy link
Member

@brendankenny brendankenny Mar 19, 2020

Choose a reason for hiding this comment

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

since this is a real driver, it seems a little weird to cast to a fake driver type :)

One option: could ts-ignore an assertion on loadOptions instead

const loadOptions = {
  waitForLoad: true,
  /** @type {LH.Gatherer.PassContext} */
  // @ts-ignore - we don't need the entire context for the test.
  passContext: {
    passConfig: {
      pauseAfterLoadMs: 0,
      networkQuietThresholdMs: 0,
      cpuQuietThresholdMs: 0,
    },
  },
};

(though we should probably eventually have a passContext generator if we're really getting all real in this file)

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

// Redirect in log will go through
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 {any[]} TParams
connorjclark marked this conversation as resolved.
Show resolved Hide resolved
* @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 @@ -7836,10 +7836,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