-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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: update to typescript 3.5.3 #9357
Conversation
@@ -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'>} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
caused by microsoft/TypeScript#30552. See that thread for the drama over strictness :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow, that is some good drama. I personally found microsoft/TypeScript#30825 more enjoyable to follow :)
Kinda nuts it's a useless version of Omit
for me, I got excited for a second I wouldn't have to copy this everywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow, that is some good drama. I personally found microsoft/TypeScript#30825 more enjoyable to follow :)
oh yeah, whoops, that's a way better link
if (this._copyAttempt) { | ||
// Only handle copy button presses (e.g. ignore the user copying page text) and | ||
// when the clipboard is available. | ||
if (this._copyAttempt && e.clipboardData) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've seen this error for a long time in VS Code. Did only newer TS emit this error? maybe my editor is set to typescript@next
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've seen this error for a long time in VS Code. Did only newer TS emit this error? maybe my editor is set to typescript@next ...
they change the browser definitions from time to time, so it's possible. If you do the "Select typescript version" command in vs code do you have "Use VS Code's version" selected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -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 last defined pass result as artifact. If there is none, handled by the undefined check below. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feels like not quite a sentence :)
maybe something like?
// Take last defined pass result as artifact. If there is none, handled by the undefined check below. | |
// Take last defined pass result as artifact. The undefined case is handled by the undefined check below. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tried to improve it :)
@@ -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'>} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow, that is some good drama. I personally found microsoft/TypeScript#30825 more enjoyable to follow :)
Kinda nuts it's a useless version of Omit
for me, I got excited for a second I wouldn't have to copy this everywhere
@@ -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') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I seem to remember being very careful about in
vs undefined
for constants.defaultSettings
but that might have just been on the delete
vs. = undefined
side.
the PR (#4960) doesn't seem to suggest there was anything special about this, and in
should be even more inclusive for our purposes, so we're probably fine 🤷♂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I seem to remember being very careful about in vs undefined for constants.defaultSettings but that might have just been on the delete vs. = undefined side.
yeah, I was thinking since it's just the constants this should be ok (we won't have set anything to undefined
to try to mark them as unset), but I can also switch it to an undefined check. It doesn't help the compiler either way since we have to do @ts-ignore
on the next line regardless :)
Did something happen to the test set of files? travis failed on test-lantern 😬 EDIT: works fine for me locally, might be travis specific |
hmm, looks like the test files aren't downloading. Didn't this happen once before? I don't remember what we did (if anything).
|
oh, that's what you were saying :) I thought you meant did this PR change any of the files that trigger the tests |
just needed some time off, I guess :) |
unblocks #9267, maybe others?
3.4 crashed on our code base due to out of control unionings. 3.5 introduced a limit to union construction, but the underlying error just morphed into "Expression produces a union type that is too complex to represent" :)
The main cause was microsoft/TypeScript#30769, improving soundness of assigning to an object with enumerated keys (e.g. our artifacts object, where the error was occurring).
The problem is that tsc doesn't have a notion of a type being a single member of a union (e.g. when looping over the artifact keys, inside the loop it sees the union of all artifact keys, not a single key within that union). So while that change improved soundness, our unsound (due to tsc's limitations, but, notably, still correct) assignments to
artifacts[keyof artifacts]
caused a new error that had been ignored before. Whatever value was written to that property had to match the constraints of all possible types ofartifacts[keyof artifacts]
simultaneously (it had to be aScriptElements
and aManifest
and aStartUrl
and aViewportDimensions
and a...), which caused tsc to give up while trying to find the intersection of all those constraints (which the RHS wouldn't have matched anyways).See that PR for a long discussion on the benefits and the ways the downsides could be worked around. I'm excited about the
oneof
proposal.@ts-ignore
seemed like the best approach for these, since it leaves us open for removing sometime in the future if there becomes a way to express what we mean.Compilation time over 3.2 decreases slightly, by about 10% on my machine.