google / google/closure-compiler

Incorrect incomplete alias warning for descendent aliases

Open
#1,404 3 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
var a = {};
a.b = {};

a.b.f1 = function(){};
a.b.f2 = function(){};
a.b.f3 = function(){};

/** @record */
a.b.f2.d = function() {};

console.log(a.b);
```

With COLLAPSE_PROPERTIES on.

`a.b.f2.d` is collapsed, but all of the direct children of `a.b` still exist normally (which is the point of accessing `a.b`).

However, I still get

> input0:11: WARNING - incomplete alias created for namespace a.b
> console.log(a.b);

This makes adding a type anywhere under any existing namespace a breaking change (if you have warnings as errors).

Can you only show that warning when making an alias that has collapsed _direct_ properties?

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.