google / google/closure-compiler

Incorrect handling of nullable types defined in typedefs

Open
#1,052 2 comments 0 reactions 0 assignees View on GitHub
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

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.