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 to ts 3.1 for new protocol defs #5942

Merged
merged 2 commits into from
Aug 31, 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
4 changes: 2 additions & 2 deletions lighthouse-core/audits/byte-efficiency/unused-css-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ class UnusedCSSRules extends ByteEfficiencyAudit {
}

const usage = UnusedCSSRules.computeUsage(stylesheetInfo);
const result = {url}; // Assign to temporary to keep tsc happy about index signature.
return Object.assign(result, usage);
// @ts-ignore TODO(bckenny): fix index signature on ByteEfficiencyItem.
return Object.assign({url}, usage);
}

/**
Expand Down
3 changes: 1 addition & 2 deletions lighthouse-core/report/html/renderer/report-ui-features.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ class ReportUIFeatures {
this._setupHeaderAnimation();
this._resetUIState();
this._document.addEventListener('keydown', this.printShortCutDetect);
// @ts-ignore - TODO(bckenny): tsc thinks document can't listen for `copy`. Remove ignore in 3.1.
this._document.addEventListener('copy', this.onCopy);
}

Expand All @@ -114,7 +113,7 @@ class ReportUIFeatures {

/**
* Handle media query change events.
* @param {MediaQueryList} mql
* @param {MediaQueryList|MediaQueryListEvent} mql
*/
onMediaQueryChange(mql) {
const root = this._dom.find('.lh-root', this._document);
Expand Down
8 changes: 6 additions & 2 deletions lighthouse-viewer/app/src/drag-and-drop.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ class DragAndDrop {
document.addEventListener('dragover', e => {
e.stopPropagation();
e.preventDefault();
e.dataTransfer.dropEffect = 'copy'; // Explicitly show as copy action.
if (e.dataTransfer) {
e.dataTransfer.dropEffect = 'copy'; // Explicitly show as copy action.
}
});

document.addEventListener('dragenter', _ => {
Expand All @@ -53,7 +55,9 @@ class DragAndDrop {
this._resetDraggingUI();

// Note, this ignores multiple files in the drop, only taking the first.
this._fileHandlerCallback(e.dataTransfer.files[0]);
if (e.dataTransfer) {
this._fileHandlerCallback(e.dataTransfer.files[0]);
}
});
}

Expand Down
6 changes: 3 additions & 3 deletions lighthouse-viewer/app/src/lighthouse-report-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class LighthouseReportViewer {
let saveCallback = null;
if (!this._reportIsFromGist) {
saveCallback = this._onSaveJson;
history.pushState({}, undefined, LighthouseReportViewer.APP_URL);
history.pushState({}, '', LighthouseReportViewer.APP_URL);
}

const features = new ViewerUIFeatures(dom, saveCallback);
Expand Down Expand Up @@ -257,7 +257,7 @@ class LighthouseReportViewer {
}

this._reportIsFromGist = true;
history.pushState({}, undefined, `${LighthouseReportViewer.APP_URL}?gist=${id}`);
history.pushState({}, '', `${LighthouseReportViewer.APP_URL}?gist=${id}`);

return id;
}).catch(err => logger.log(err.message));
Expand Down Expand Up @@ -335,7 +335,7 @@ class LighthouseReportViewer {

const match = url.pathname.match(/[a-f0-9]{5,}/);
if (match) {
history.pushState({}, undefined, `${LighthouseReportViewer.APP_URL}?gist=${match[0]}`);
history.pushState({}, '', `${LighthouseReportViewer.APP_URL}?gist=${match[0]}`);
this._loadFromDeepLink();
}
} catch (err) {
Expand Down
3 changes: 2 additions & 1 deletion lighthouse-viewer/app/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ function loadScript(src) {
script.src = src;
script.onload = resolve;
script.onerror = reject;
document.head.appendChild(script);
// document.head is defined.
/** @type {HTMLHeadElement} */ (document.head).appendChild(script);
});
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
"pretty-json-stringify": "^0.0.2",
"puppeteer": "1.4.0",
"sinon": "^2.3.5",
"typescript": "3.0.1",
"typescript": "3.1.0-dev.20180831",
"vscode-chrome-debug-core": "^3.23.8",
"zone.js": "^0.7.3"
},
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6199,9 +6199,9 @@ typedarray@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"

typescript@3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.0.1.tgz#43738f29585d3a87575520a4b93ab6026ef11fdb"
typescript@3.1.0-dev.20180831:
version "3.1.0-dev.20180831"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.1.0-dev.20180831.tgz#d1c0c715f17368417cad96bda042cf26d56f3d61"

uglify-js@^2.6:
version "2.7.3"
Expand Down