question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

closure compile checking is broken

See original GitHub issue

Folks with up-to-date dependencies were having a broken build with npm test. However folks like me and @brendankenny who haven’t typed "npm i` in a while are fine. Also Travis is fine because of cached node_modules.

However if you have up to date dependencies (i assume a new closure compiler is the issue), then you’ll see something like the error log below.

I’ve temporarily disabled npm run closure from our npm test run (https://github.com/GoogleChrome/lighthouse/commit/013b3f2ed16eee2fdf0cde78f67dc37d165eec9c) to make the green build while we figure out how we want to address this.


~/code/lighthouse on (master)
▸ npm run closure

> lighthouse@1.1.4 closure /Users/paulirish/code/lighthouse
> cd lighthouse-core && closure/closure-type-checking.js

[10:51:43] Closure compilation failed. Check `closure-error.log` for details.

/Users/paulirish/code/lighthouse/node_modules/orchestrator/index.js:153
            throw err;
            ^
Error: Compilation error:

java -jar /Users/paulirish/code/lighthouse/node_modules/google-closure-compiler/compiler.jar --compilation_level=SIMPLE --process_common_js_modules=true --new_type_inf=true --checks_only=true --language_in=ECMASCRIPT6_STRICT --language_out=ECMASCRIPT5_STRICT --warning_level=VERBOSE --jscomp_error=checkTypes --jscomp_error=conformanceViolations --jscomp_warning=accessControls --jscomp_warning=checkRegExp --jscomp_warning=const --jscomp_warning=missingProperties --jscomp_warning=missingReturn --jscomp_warning=newCheckTypes --jscomp_warning=strictModuleDepCheck --jscomp_warning=typeInvalidation --jscomp_warning=undefinedNames --jscomp_warning=visibility --conformance_configs=closure/conformance_config.textproto --json_streams BOTH

/aggregator/aggregate.js:213: WARNING - parameter results does not appear in Aggregate$$module$$aggregator$aggregate.aggregate's parameter list
  static aggregate(aggregation, auditResults) {
  ^

/audits/aria-allowed-attr.js:48: WARNING - Formatter$$module$$audits$aria_allowed_attr.SUPPORTED_FORMATS is never defined
        formatter: Formatter.SUPPORTED_FORMATS.ACCESSIBILITY,
                   ^

/audits/aria-allowed-attr.js:48: WARNING - Property SUPPORTED_FORMATS never defined on Formatter$$module$$audits$aria_allowed_attr of type Formatter$$module$$audits$aria_allowed_attr{}
        formatter: Formatter.SUPPORTED_FORMATS.ACCESSIBILITY,
                   ^

/audits/aria-valid-attr.js:48: WARNING - Formatter$$module$$audits$aria_valid_attr.SUPPORTED_FORMATS is never defined
        formatter: Formatter.SUPPORTED_FORMATS.ACCESSIBILITY,
                   ^

/audits/aria-valid-attr.js:48: WARNING - Property SUPPORTED_FORMATS never defined on Formatter$$module$$audits$aria_valid_attr of type Formatter$$module$$audits$aria_valid_attr{}
        formatter: Formatter.SUPPORTED_FORMATS.ACCESSIBILITY,
                   ^

/audits/audit.js:26: WARNING - Returned type does not match declared return type.
Expected : String
Found    : string

    return DEFAULT_PASS;
    ^

/audits/cache-start-url.js:59: WARNING - All constants must be typed. The compiler could not infer the type of this constant. Please use an explicit type annotation.
    const startURL = manifest.start_url.value;
          ^

/audits/cache-start-url.js:60: WARNING - All constants must be typed. The compiler could not infer the type of this constant. Please use an explicit type annotation.
    const altStartURL = startURL
          ^

/audits/color-contrast.js:48: WARNING - Formatter$$module$$audits$color_contrast.SUPPORTED_FORMATS is never defined
        formatter: Formatter.SUPPORTED_FORMATS.ACCESSIBILITY,
                   ^

/audits/color-contrast.js:48: WARNING - Property SUPPORTED_FORMATS never defined on Formatter$$module$$audits$color_contrast of type Formatter$$module$$audits$color_contrast{}
        formatter: Formatter.SUPPORTED_FORMATS.ACCESSIBILITY,
                   ^

/audits/critical-request-chains.js:42: WARNING - All constants must be typed. The compiler could not infer the type of this constant. Please use an explicit type annotation.
  static audit(artifacts) {
                          ^

/audits/critical-request-chains.js:44: WARNING - Property requestCriticalRequestChains never defined on artifacts of type Artifacts
    return artifacts.requestCriticalRequestChains(networkRecords).then(chains => {
           ^

/audits/critical-request-chains.js:67: WARNING - Formatter$$module$$audits$critical_request_chains.SUPPORTED_FORMATS is never defined
          formatter: Formatter.SUPPORTED_FORMATS.CRITICAL_REQUEST_CHAINS,
                     ^

/audits/critical-request-chains.js:67: WARNING - Property SUPPORTED_FORMATS never defined on Formatter$$module$$audits$critical_request_chains of type Formatter$$module$$audits$critical_request_chains{}
          formatter: Formatter.SUPPORTED_FORMATS.CRITICAL_REQUEST_CHAINS,
                     ^

/audits/estimated-input-latency.js:46: WARNING - Cannot call non-function type null
    const tracingProcessor = new TracingProcessor();
                             ^

/audits/estimated-input-latency.js:48: WARNING - Cannot access property getRiskToResponsiveness of non-object type null.
    const latencyPercentiles = TracingProcessor.getRiskToResponsiveness(model, trace, startTime);
                               ^

/audits/estimated-input-latency.js:59: WARNING - Cannot access property getLogNormalDistribution of non-object type null.
    const distribution = TracingProcessor.getLogNormalDistribution(SCORING_MEDIAN,
                         ^

/audits/estimated-input-latency.js:70: WARNING - Formatter$$module$$audits$estimated_input_latency.SUPPORTED_FORMATS is never defined
        formatter: Formatter.SUPPORTED_FORMATS.ESTIMATED_INPUT_LATENCY
                   ^

/audits/estimated-input-latency.js:70: WARNING - Property SUPPORTED_FORMATS never defined on Formatter$$module$$audits$estimated_input_latency of type Formatter$$module$$audits$estimated_input_latency{}
        formatter: Formatter.SUPPORTED_FORMATS.ESTIMATED_INPUT_LATENCY
                   ^

/audits/estimated-input-latency.js:82: WARNING - All constants must be typed. The compiler could not infer the type of this constant. Please use an explicit type annotation.
    const trace = artifacts.traces[this.DEFAULT_PASS];
          ^

/audits/estimated-input-latency.js:84: WARNING - Property requestSpeedline never defined on artifacts of type Artifacts
    return artifacts.requestSpeedline(trace)
           ^

/audits/first-meaningful-paint.js:54: WARNING - All constants must be typed. The compiler could not infer the type of this constant. Please use an explicit type annotation.
  static audit(artifacts) {
                          ^

/audits/first-meaningful-paint.js:56: WARNING - Property traceEvents never defined on Object
      const traceContents = artifacts.traces[this.DEFAULT_PASS].traceEvents;
                            ^

/audits/first-meaningful-paint.js:90: WARNING - Formatter$$module$$audits$first_meaningful_paint.SUPPORTED_FORMATS is never defined
          formatter: Formatter.SUPPORTED_FORMATS.NULL
                     ^

/audits/first-meaningful-paint.js:90: WARNING - Property SUPPORTED_FORMATS never defined on Formatter$$module$$audits$first_meaningful_paint of type Formatter$$module$$audits$first_meaningful_paint{}
          formatter: Formatter.SUPPORTED_FORMATS.NULL
                     ^

/audits/first-meaningful-paint.js:93: WARNING - Invalid type for parameter 1 of function .
Expected : function(*):?
Found    : function({message:?} (loose)):?
More details:
The expected and found types are functions which have incompatible types for argument 1.
Expected a supertype of : *
but found               : {message:?} (loose)
    }).catch(err => {
             ^

/audits/first-meaningful-paint.js:126: WARNING - Cannot access property getLogNormalDistribution of non-object type null.
    const distribution = TracingProcessor.getLogNormalDistribution(SCORING_MEDIAN,
                         ^

/audits/image-alt.js:48: WARNING - Formatter$$module$$audits$image_alt.SUPPORTED_FORMATS is never defined
        formatter: Formatter.SUPPORTED_FORMATS.ACCESSIBILITY,
                   ^

/audits/image-alt.js:48: WARNING - Property SUPPORTED_FORMATS never defined on Formatter$$module$$audits$image_alt of type Formatter$$module$$audits$image_alt{}
        formatter: Formatter.SUPPORTED_FORMATS.ACCESSIBILITY,
                   ^

/audits/is-on-https.js:40: WARNING - Property value never defined on artifacts.HTTPS of type Boolean
      rawValue: artifacts.HTTPS.value,
                ^

/audits/is-on-https.js:41: WARNING - Property debugString never defined on artifacts.HTTPS of type Boolean
      debugString: artifacts.HTTPS.debugString
                   ^

/audits/label.js:48: WARNING - Formatter$$module$$audits$label.SUPPORTED_FORMATS is never defined
        formatter: Formatter.SUPPORTED_FORMATS.ACCESSIBILITY,
                   ^

/audits/label.js:48: WARNING - Property SUPPORTED_FORMATS never defined on Formatter$$module$$audits$label of type Formatter$$module$$audits$label{}
        formatter: Formatter.SUPPORTED_FORMATS.ACCESSIBILITY,
                   ^

/audits/manifest-background-color.js:41: WARNING - Returned type does not match declared return type.
Expected : boolean
Found    : boolean|string|undefined
More details:
The found type is a union that includes an unexpected type: string
    return manifest !== undefined &&
    ^

/audits/manifest-background-color.js:56: WARNING - Formatter$$module$$audits$manifest_background_color.SUPPORTED_FORMATS is never defined
        formatter: Formatter.SUPPORTED_FORMATS.NULL
                   ^

/audits/manifest-background-color.js:56: WARNING - Property SUPPORTED_FORMATS never defined on Formatter$$module$$audits$manifest_background_color of type Formatter$$module$$audits$manifest_background_color{}
        formatter: Formatter.SUPPORTED_FORMATS.NULL
                   ^

/audits/screenshots.js:49: WARNING - Property requestScreenshots never defined on artifacts of type Artifacts
    return artifacts.requestScreenshots(trace).then(screenshots => {
           ^

/audits/screenshots.js:60: WARNING - Formatter$$module$$audits$screenshots.SUPPORTED_FORMATS is never defined
          formatter: Formatter.SUPPORTED_FORMATS.NULL,
                     ^

/audits/screenshots.js:60: WARNING - Property SUPPORTED_FORMATS never defined on Formatter$$module$$audits$screenshots of type Formatter$$module$$audits$screenshots{}
          formatter: Formatter.SUPPORTED_FORMATS.NULL,
                     ^

/audits/service-worker.js:20: WARNING - All constants must be typed. The compiler could not infer the type of this constant. Please use an explicit type annotation.
const url = /** @type {*} */ ({});
      ^

/audits/speed-index-metric.js:49: WARNING - All constants must be typed. The compiler could not infer the type of this constant. Please use an explicit type annotation.
  static audit(artifacts) {
                          ^

/audits/speed-index-metric.js:59: WARNING - Property requestSpeedline never defined on artifacts of type Artifacts
    return artifacts.requestSpeedline(trace).then(speedline => {
           ^

/audits/speed-index-metric.js:87: WARNING - Cannot access property getLogNormalDistribution of non-object type null.
      const distribution = TracingProcessor.getLogNormalDistribution(SCORING_MEDIAN,
                           ^

/audits/speed-index-metric.js:112: WARNING - Formatter$$module$$audits$speed_index_metric.SUPPORTED_FORMATS is never defined
          formatter: Formatter.SUPPORTED_FORMATS.SPEEDLINE,
                     ^

/audits/speed-index-metric.js:112: WARNING - Property SUPPORTED_FORMATS never defined on Formatter$$module$$audits$speed_index_metric of type Formatter$$module$$audits$speed_index_metric{}
          formatter: Formatter.SUPPORTED_FORMATS.SPEEDLINE,
                     ^

/audits/tabindex.js:48: WARNING - Formatter$$module$$audits$tabindex.SUPPORTED_FORMATS is never defined
        formatter: Formatter.SUPPORTED_FORMATS.ACCESSIBILITY,
                   ^

/audits/tabindex.js:48: WARNING - Property SUPPORTED_FORMATS never defined on Formatter$$module$$audits$tabindex of type Formatter$$module$$audits$tabindex{}
        formatter: Formatter.SUPPORTED_FORMATS.ACCESSIBILITY,
                   ^

/audits/time-to-interactive.js:59: WARNING - All constants must be typed. The compiler could not infer the type of this constant. Please use an explicit type annotation.
  static audit(artifacts) {
                          ^

/audits/time-to-interactive.js:60: WARNING - All constants must be typed. The compiler could not infer the type of this constant. Please use an explicit type annotation.
    const trace = artifacts.traces[Audit.DEFAULT_PASS];
          ^

/audits/time-to-interactive.js:60: WARNING - Invalid type for index.
Expected : number
Found    : String

    const trace = artifacts.traces[Audit.DEFAULT_PASS];
                                   ^

/audits/time-to-interactive.js:61: WARNING - Property requestSpeedline never defined on artifacts of type Artifacts
    const pendingSpeedline = artifacts.requestSpeedline(trace);
                             ^

/audits/time-to-interactive.js:76: WARNING - Cannot call non-function type null
      const tracingProcessor = new TracingProcessor();
                               ^

/audits/time-to-interactive.js:77: WARNING - Invalid type for index.
Expected : number
Found    : String

      const trace = artifacts.traces[Audit.DEFAULT_PASS];
                                     ^

/audits/time-to-interactive.js:85: WARNING - All constants must be typed. The compiler could not infer the type of this constant. Please use an explicit type annotation.
      const fMPts = timings.fMPfull + timings.navStart;
            ^

/audits/time-to-interactive.js:119: WARNING - Cannot access property getRiskToResponsiveness of non-object type null.
        const latencies = TracingProcessor.getRiskToResponsiveness(
                          ^

/audits/time-to-interactive.js:136: WARNING - Cannot access property getLogNormalDistribution of non-object type null.
      const distribution = TracingProcessor.getLogNormalDistribution(SCORING_MEDIAN,
                           ^

/audits/time-to-interactive.js:163: WARNING - Formatter$$module$$audits$time_to_interactive.SUPPORTED_FORMATS is never defined
          formatter: Formatter.SUPPORTED_FORMATS.NULL
                     ^

/audits/time-to-interactive.js:163: WARNING - Property SUPPORTED_FORMATS never defined on Formatter$$module$$audits$time_to_interactive of type Formatter$$module$$audits$time_to_interactive{}
          formatter: Formatter.SUPPORTED_FORMATS.NULL
                     ^

/audits/unused-css.js:40: WARNING - Property UnusedCss never defined on artifacts of type Artifacts
    const unusedcss = artifacts.UnusedCss;
                      ^

/audits/user-timings.js:129: WARNING - All constants must be typed. The compiler could not infer the type of this constant. Please use an explicit type annotation.
  static audit(artifacts) {
                          ^

/audits/user-timings.js:130: WARNING - Returned type does not match declared return type.
Expected : AuditResult
Found    : Promise<?>
More details:
The found type is missing property score
    return new Promise((resolve, reject) => {
    ^

/audits/user-timings.js:133: WARNING - Property traceEvents never defined on Object
        artifacts.traces[this.DEFAULT_PASS].traceEvents;
        ^

/audits/user-timings.js:142: WARNING - Formatter$$module$$audits$user_timings.SUPPORTED_FORMATS is never defined
          formatter: Formatter.SUPPORTED_FORMATS.USER_TIMINGS,
                     ^

/audits/user-timings.js:142: WARNING - Property SUPPORTED_FORMATS never defined on Formatter$$module$$audits$user_timings of type Formatter$$module$$audits$user_timings{}
          formatter: Formatter.SUPPORTED_FORMATS.USER_TIMINGS,
                     ^

/audits/user-timings.js:146: WARNING - Invalid type for parameter 1 of function .
Expected : function(*):?
Found    : function({message:?} (loose)):?
More details:
The expected and found types are functions which have incompatible types for argument 1.
Expected a supertype of : *
but found               : {message:?} (loose)
    }).catch(err => {
             ^

/audits/critical-request-chains.js:44: ERROR - Violation: References to object props that are typed as `unknown` are discouraged. See https://github.com/google/closure-compiler/wiki/JS-Conformance-Framework#banunknowntypedclasspropsreferences
The property "requestCriticalRequestChains" on type "Artifacts"
    return artifacts.requestCriticalRequestChains(networkRecords).then(chains => {
           ^

/audits/dobetterweb/appcache-manifest.js:41: ERROR - Violation: References to object props that are typed as `unknown` are discouraged. See https://github.com/google/closure-compiler/wiki/JS-Conformance-Framework#banunknowntypedclasspropsreferences
The property "AppCacheManifest" on type "Artifacts"
    if (typeof artifacts.AppCacheManifest === 'undefined' ||
               ^

/audits/dobetterweb/appcache-manifest.js:42: ERROR - Violation: References to object props that are typed as `unknown` are discouraged. See https://github.com/google/closure-compiler/wiki/JS-Conformance-Framework#banunknowntypedclasspropsreferences
The property "AppCacheManifest" on type "Artifacts"
        artifacts.AppCacheManifest === -1) {
        ^

/audits/dobetterweb/appcache-manifest.js:49: ERROR - Violation: References to object props that are typed as `unknown` are discouraged. See https://github.com/google/closure-compiler/wiki/JS-Conformance-Framework#banunknowntypedclasspropsreferences
The property "AppCacheManifest" on type "Artifacts"
    const usingAppcache = artifacts.AppCacheManifest !== null;
                          ^

/audits/dobetterweb/appcache-manifest.js:50: ERROR - Violation: References to object props that are typed as `unknown` are discouraged. See https://github.com/google/closure-compiler/wiki/JS-Conformance-Framework#banunknowntypedclasspropsreferences
The property "AppCacheManifest" on type "Artifacts"
    const displayValue = usingAppcache ? `<html manifest="${artifacts.AppCacheManifest}">` : '';
                                                            ^

/audits/dobetterweb/no-websql.js:46: ERROR - Violation: References to object props that are typed as `unknown` are discouraged. See https://github.com/google/closure-compiler/wiki/JS-Conformance-Framework#banunknowntypedclasspropsreferences
The property "WebSQL" on type "Artifacts"
    if (typeof artifacts.WebSQL === 'undefined' ||
               ^

/audits/dobetterweb/no-websql.js:47: ERROR - Violation: References to object props that are typed as `unknown` are discouraged. See https://github.com/google/closure-compiler/wiki/JS-Conformance-Framework#banunknowntypedclasspropsreferences
The property "WebSQL" on type "Artifacts"
        artifacts.WebSQL.database === -1) {
        ^

/audits/dobetterweb/no-websql.js:50: ERROR - Violation: References to object props that are typed as `unknown` are discouraged. See https://github.com/google/closure-compiler/wiki/JS-Conformance-Framework#banunknowntypedclasspropsreferences
The property "WebSQL" on type "Artifacts"
        debugString: (artifacts.WebSQL ?
                      ^

/audits/dobetterweb/no-websql.js:51: ERROR - Violation: References to object props that are typed as `unknown` are discouraged. See https://github.com/google/closure-compiler/wiki/JS-Conformance-Framework#banunknowntypedclasspropsreferences
The property "WebSQL" on type "Artifacts"
            artifacts.WebSQL.debugString : 'WebSQL gatherer did not run')
            ^

/audits/dobetterweb/no-websql.js:55: ERROR - Violation: References to object props that are typed as `unknown` are discouraged. See https://github.com/google/closure-compiler/wiki/JS-Conformance-Framework#banunknowntypedclasspropsreferences
The property "WebSQL" on type "Artifacts"
    const db = artifacts.WebSQL.database;
               ^

/audits/estimated-input-latency.js:84: ERROR - Violation: References to object props that are typed as `unknown` are discouraged. See https://github.com/google/closure-compiler/wiki/JS-Conformance-Framework#banunknowntypedclasspropsreferences
The property "requestSpeedline" on type "Artifacts"
    return artifacts.requestSpeedline(trace)
           ^

/audits/screenshots.js:49: ERROR - Violation: References to object props that are typed as `unknown` are discouraged. See https://github.com/google/closure-compiler/wiki/JS-Conformance-Framework#banunknowntypedclasspropsreferences
The property "requestScreenshots" on type "Artifacts"
    return artifacts.requestScreenshots(trace).then(screenshots => {
           ^

/audits/speed-index-metric.js:59: ERROR - Violation: References to object props that are typed as `unknown` are discouraged. See https://github.com/google/closure-compiler/wiki/JS-Conformance-Framework#banunknowntypedclasspropsreferences
The property "requestSpeedline" on type "Artifacts"
    return artifacts.requestSpeedline(trace).then(speedline => {
           ^

/audits/time-to-interactive.js:61: ERROR - Violation: References to object props that are typed as `unknown` are discouraged. See https://github.com/google/closure-compiler/wiki/JS-Conformance-Framework#banunknowntypedclasspropsreferences
The property "requestSpeedline" on type "Artifacts"
    const pendingSpeedline = artifacts.requestSpeedline(trace);
                             ^

/audits/unused-css.js:40: ERROR - Violation: References to object props that are typed as `unknown` are discouraged. See https://github.com/google/closure-compiler/wiki/JS-Conformance-Framework#banunknowntypedclasspropsreferences
The property "UnusedCss" on type "Artifacts"
    const unusedcss = artifacts.UnusedCss;
                      ^

15 error(s), 65 warning(s), 88.3% typed

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
wardpeetcommented, Oct 5, 2016

Than I think TS will be easier to manage because you write your code as is and not on the side like CC.

0reactions
brendankennycommented, Aug 9, 2017

obsolete 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Frequently Asked Questions | Closure Compiler
The Closure Compiler intentionally adds line breaks every 500 characters or so. Firewalls and proxies sometimes corrupt or ignore large ...
Read more >
Type checking with closure compiler not implicitly on?
Thank you, it works. Got a lot of warnings about goog.events having unknown types and console.log is broken but it does what I...
Read more >
Closure Compiler v20201207 released - Google Groups
Fixed https://github.com/google/closure-compiler/issues/3733, which caused incorrect collapsing of properties, generating broken code.
Read more >
FreshPorts -- www/closure-compiler
Description: Closure Compiler is a JavaScript optimizing compiler. It parses your JavaScript, analyzes it, removes dead code and rewrites and minimizes what's ...
Read more >
Don't forget about Google Closure - Clojurescript Made Easy
The Closure Compiler provides significant features such as dead code removal and minimization. (For more details, check out Luke ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found