Skip to content

Commit

Permalink
deps: update to typescript 3.5.3 (#9357)
Browse files Browse the repository at this point in the history
  • Loading branch information
brendankenny authored Jul 12, 2019
1 parent 3fb2c6d commit 43b96d4
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 19 deletions.
2 changes: 1 addition & 1 deletion lighthouse-core/computed/network-analysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const NetworkRecords = require('./network-records.js');
class NetworkAnalysis {
/**
* @param {Array<LH.Artifacts.NetworkRequest>} records
* @return {Omit<LH.Artifacts.NetworkAnalysis, 'throughput'>}
* @return {StrictOmit<LH.Artifacts.NetworkAnalysis, 'throughput'>}
*/
static computeRTTAndServerResponseTime(records) {
// First pass compute the estimated observed RTT to each origin's servers.
Expand Down
8 changes: 3 additions & 5 deletions lighthouse-core/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,9 @@ function cleanFlagsForSettings(flags = {}) {
const settings = {};

for (const key of Object.keys(flags)) {
// @ts-ignore - intentionally testing some keys not on defaultSettings to discard them.
if (typeof constants.defaultSettings[key] !== 'undefined') {
// Cast since key now must be able to index both Flags and Settings.
const safekey = /** @type {Extract<keyof LH.Flags, keyof LH.Config.Settings>} */ (key);
settings[safekey] = flags[safekey];
if (key in constants.defaultSettings) {
// @ts-ignore tsc can't yet express that key is only a single type in each iteration, not a union of types.
settings[key] = flags[key];
}
}

Expand Down
6 changes: 3 additions & 3 deletions lighthouse-core/gather/gather-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,11 +425,11 @@ class GatherRunner {
for (const [gathererName, phaseResultsPromises] of resultsEntries) {
try {
const phaseResults = await Promise.all(phaseResultsPromises);
// Take last defined pass result as artifact.
// Take the last defined pass result as artifact. If none are defined, the undefined check below handles it.
const definedResults = phaseResults.filter(element => element !== undefined);
const artifact = definedResults[definedResults.length - 1];
// Typecast pretends artifact always provided here, but checked below for top-level `throw`.
gathererArtifacts[gathererName] = /** @type {NonVoid<PhaseResult>} */ (artifact);
// @ts-ignore tsc can't yet express that gathererName is only a single type in each iteration, not a union of types.
gathererArtifacts[gathererName] = artifact;
} catch (err) {
// Return error to runner to handle turning it into an error audit.
gathererArtifacts[gathererName] = err;
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/lib/lantern-trace-saver.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function convertNodeTimingsToTrace(nodeTimings) {
if (startTime === endTime) endTime += 0.3;

const requestData = {requestId: requestId.toString(), frame};
/** @type {Omit<LH.TraceEvent, 'name'|'ts'|'args'>} */
/** @type {StrictOmit<LH.TraceEvent, 'name'|'ts'|'args'>} */
const baseRequestEvent = {...baseEvent, ph: 'I', s: 't', dur: 0};

const sendRequestData = {
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/report/html/renderer/report-ui-features.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ class ReportUIFeatures {
*/
onCopy(e) {
// Only handle copy button presses (e.g. ignore the user copying page text).
if (this._copyAttempt) {
if (this._copyAttempt && e.clipboardData) {
// We want to write our own data to the clipboard, not the user's text selection.
e.preventDefault();
e.clipboardData.setData('text/plain', JSON.stringify(this.json, null, 2));
Expand Down
4 changes: 3 additions & 1 deletion lighthouse-core/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,9 @@ class Runner {
// to prevent consumers from unnecessary type assertions.
const requiredArtifacts = audit.meta.requiredArtifacts
.reduce((requiredArtifacts, artifactName) => {
requiredArtifacts[artifactName] = artifacts[artifactName];
const requiredArtifact = artifacts[artifactName];
// @ts-ignore tsc can't yet express that artifactName is only a single type in each iteration, not a union of types.
requiredArtifacts[artifactName] = requiredArtifact;
return requiredArtifacts;
}, /** @type {LH.Artifacts} */ ({}));
const product = await audit.audit(requiredArtifacts, auditContext);
Expand Down
4 changes: 3 additions & 1 deletion lighthouse-core/scripts/update-report-fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ async function update(artifactName) {
throw Error('Unknown artifact name: ' + artifactName);
}
const finalArtifacts = oldArtifacts;
finalArtifacts[artifactName] = newArtifacts[artifactName];
const newArtifact = newArtifacts[artifactName];
// @ts-ignore tsc can't yet express that artifactName is only a single type in each iteration, not a union of types.
finalArtifacts[artifactName] = newArtifact;
await assetSaver.saveArtifacts(finalArtifacts, artifactPath);
}
}
Expand Down
1 change: 1 addition & 0 deletions lighthouse-viewer/app/src/lighthouse-report-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ class LighthouseReportViewer {
* @private
*/
_onPaste(e) {
if (!e.clipboardData) return;
e.preventDefault();

// Try paste as gist URL.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
"prettier": "^1.14.3",
"pretty-json-stringify": "^0.0.2",
"puppeteer": "^1.10.0",
"typescript": "3.2.2",
"typescript": "3.5.3",
"uglify-es": "3.0.15",
"url-search-params": "0.6.1",
"whatwg-fetch": "2.0.1",
Expand Down
2 changes: 1 addition & 1 deletion types/externs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ declare global {
type NonVoid<T> = T extends void ? never : T;

/** Remove properties K from T. */
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
type StrictOmit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;

/** Obtain the type of the first parameter of a function. */
type FirstParamType<T extends (arg1: any, ...args: any[]) => any> =
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7585,10 +7585,10 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=

typescript@3.2.2:
version "3.2.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.2.2.tgz#fe8101c46aa123f8353523ebdcf5730c2ae493e5"
integrity sha512-VCj5UiSyHBjwfYacmDuc/NOk4QQixbE+Wn7MFJuS0nRuPQbof132Pw4u53dm264O8LPc2MVsc7RJNml5szurkg==
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==

[email protected]:
version "3.0.15"
Expand Down

0 comments on commit 43b96d4

Please sign in to comment.