google / google/closure-compiler

Not possible to suppress warning on initializing WebAssembly object

Open
#4,108 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

```js
/**
* @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,
...
}
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`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.