closure-compiler icon indicating copy to clipboard operation
closure-compiler copied to clipboard

Not possible to suppress warning on initializing WebAssembly object

Open kripken opened this issue 10 months ago • 2 comments

/** 
 * @suppress{checkTypes, duplicate, const}
 */
var WebAssembly = {};
$ google-closure-compiler --compilation_level ADVANCED_OPTIMIZATIONS --language_in ECMASCRIPT_2020 --language_out NO_TRANSPILE --emit_use_strict=false --js a.js --js_output_file tmp5qadu4_7.cc.js --formatting PRETTY_PRINT

externs.zip//webassembly.js:29:18: WARNING - [JSC_TYPE_MISMATCH] initializing variable
found   : {
  CompileError: (typeof WebAssembly.CompileError),
  Exception: (typeof WebAssembly.Exception),
  Instance: (typeof WebAssembly.Instance),
  LinkError: (typeof WebAssembly.LinkError),
  Memory: (typeof WebAssembly.Memory),
  Module: (typeof WebAssembly.Module),
  RuntimeError: (typeof WebAssembly.RuntimeError),
  Table: (typeof WebAssembly.Table),
  Tag: (typeof WebAssembly.Tag),
  compile: function((ArrayBuffer|ArrayBufferView)): Promise<WebAssembly.Module>,
  ...
}
required: {}
  29| var WebAssembly = {};
                        ^^

0 error(s), 1 warning(s), 100.0% typed

Two out of the three suppressions work, avoiding a warning on const-ness and duplication, but the checkTypes does not avoid the JSC_TYPE_MISMATCH warning on initializing variable found.

kripken avatar Aug 09 '23 19:08 kripken