google / google/closure-compiler
Functions exported within immediately-invoked function expression lose their type checking
Open
Types
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
This code should produce warnings for the incorrect number of parameters and the type of the first parameter, but does not -
``` js
// ==ClosureCompiler==
// @compilation_level ADVANCED_OPTIMIZATIONS
// @output_file_name default.js
// ==/ClosureCompiler==
var globalInitialize;
(function () {
/**
* @param {number} foo
* @param {number} bar
* @param {boolean} baz
*/
function initialize(foo, bar, baz) {
if (baz) {
return foo + bar;
}
return 0;
}
globalInitialize = initialize;
}());
console.log(globalInitialize("string"));
```
Contributor guide
Assessment
This issue has not been assessed yet.