Commit 036c021b authored by Trent Apted's avatar Trent Apted Committed by Commit Bot

Suppress reportUnknownTypes in ui/webui/resources/js/assert.js

This allows client code to type-check JS with (e.g.)

js_type_check("closure_compile") {
  closure_flags = default_closure_args + [
                    "jscomp_error=strictCheckTypes",
                    "jscomp_error=reportUnknownTypes",
                  ]
  ...
}

for picking up a wide class of type errors that otherwise slip through.

Note the maintenance cost of actually _landing_ a rule with `reportUnknownTypes`
is probably too high. The purpose of this CL is to at least allow developers
to temporarily add reportUnknownTypes to validate their own type coverage accurately
in a chrome developer checkout.

Suppresses:

../../ui/webui/resources/js/assert.js:**: ERROR - [JSC_UNKNOWN_EXPR_TYPE] could not determine the type of this expression
20:   if (!condition) {
           ^^^^^^^^^
26:     const global = function() {
                       ^^^^^^^^^^^^
27:       const thisOrSelf = this || self;
                             ^^^^
29:       thisOrSelf.traceAssertionsForTesting;
          ^^^^^^^^^^
30:       return thisOrSelf;
                 ^^^^^^^^^^
32:     if (global.traceAssertionsForTesting) {
            ^^^^^^
37:  return condition;
            ^^^^^^^^^

Bug: 1000989
Change-Id: I73564b17688df1b08d2a2eb6f78177dcde39faa3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1902182Reviewed-by: default avatarDan Beam <dbeam@chromium.org>
Commit-Queue: Trent Apted <tapted@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713639}
parent aae3f9d8
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
* @param {string=} opt_message A message to show on failure. * @param {string=} opt_message A message to show on failure.
* @return {T} A non-null |condition|. * @return {T} A non-null |condition|.
* @closurePrimitive {asserts.truthy} * @closurePrimitive {asserts.truthy}
* @suppress {reportUnknownTypes} because T is not sufficiently constrained.
*/ */
/* #export */ function assert(condition, opt_message) { /* #export */ function assert(condition, opt_message) {
if (!condition) { if (!condition) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment