Skip to content

🤖 User test baselines have changed #29660

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

Merged
merged 1 commit into from
Jan 31, 2019

Conversation

typescript-bot
Copy link
Collaborator

Please review the diff and merge if no changes are unexpected.
You can view the build log here.

cc @weswigham @sandersn @RyanCavanaugh

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

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

Looks like a regression. I'll have to look at what got merged yesterday.

@@ -759,7 +759,6 @@ node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighth
Type 'number' is not assignable to type 'void'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(19744,7): error TS2339: Property 'expected' does not exist on type 'Error'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20005,8): error TS2339: Property 'runLighthouseForConnection' does not exist on type 'Window'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(20015,1): error TS2554: Expected 0 arguments, but got 1.
Copy link
Member

Choose a reason for hiding this comment

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

Seems like a mistake: updateBadgeFn is initialised with function() { }, then called twice as updateBadgeFn() and once as updateBadgeFn(url). The 1-parameter call used to be an error but no longer is.

    window.runLighthouseForConnection=function(
        connection,url,options,categoryIDs,
        updateBadgeFn=function(){}){
        const config=options&&options.fastMode?new Config(fastConfig):new Config({
            extends:'lighthouse:default',
            settings:{onlyCategories:categoryIDs}});



        const runOptions=Object.assign({},options,{url,config});
        updateBadgeFn(url); // Here!

        return Runner.run(connection,runOptions).
            then(result=>{
                updateBadgeFn();
                return result;
            }).
            catch(err=>{
                updateBadgeFn();
                throw err;
            });
    };

@sandersn
Copy link
Member

Very likely a result of #29576. @ahejlsberg or @weswigham mind taking a look?

Note that I just cut-and-paste the snippet from lighthouse-background.js. I didn't confirm that the error repros standalone, but it seems likely.

@ahejlsberg
Copy link
Member

Best I can tell this change is to be expected with #29576. Assuming there is no known type for window.runLighthouseForConnection, the contextual type for the function expression is any. This means we give type any to updateBadgeFn (and issue an implicit any error if that is enabled). Previously we'd use the type inferred from the initializer (and we'd then get confused during type inference, but that doesn't apply here).

@sandersn
Copy link
Member

Ah, I see now. There should be no contextual type, because this isn't a normal assignment, it's a property-assignment declaration, just one that we don't recognise. With no contextual type, there would be no contextual type and we'd go back to the initialiser type.

We discussed whether we should recognise window.x = function() { ... } in JS just like the currently supported exports.x = function() { ... } and this.x = function() { ... }. I think the answer is yes; at least chrome-devtools-frontend uses it frequently.

So the fix is to keep #29576 and start treating window.x = function() { ... } as a declaration instead of an assignment to an undefined property.

@sandersn sandersn merged commit d2909a1 into microsoft:master Jan 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants