google / google/closure-compiler
Incorrect handling of nullable types defined in typedefs
Open
OTI
P3
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
The following code will compile, but it should not.
```
/**
* @param {!FooBar} foo
*/
function say(foo) {
};
/**
* @typedef {?{
* name: string
* }}
*/
var FooBar;
```
This bug is very bad, as it makes us believe that FooBar is non-nullable, but it's not true. In Chromium we use this syntax a lot for defining new types in externs files, and we have possibly a lot of bugs which are not caught by the Closure Compiler.
Contributor guide
Assessment
This issue has not been assessed yet.