google / google/closure-compiler

bad check_types two objects

Open
#961 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

I am sorry about creating new issue.

``` javascript
/**
* @typedef {{ value: Array }}
*/
var firstType;

/**
* @typedef { string }
*/
var good;

/**
* @typedef {{ value: string }}
*/
var bad;

/**
* @typedef { Array<(firstType|bad)> }
*/
var list;

/**
* @param {(firstType|bad)} x
*/
var addTo = function(x) {
list.push(x);
};

var item = { value: ['33'] };
addTo(item);
```

I use object and string (firstType and good) check_types is ok. Vide online compiler: http://goo.gl/rebsT9
I use two objects (firstType and bad) check_types return warning. Vide online: http://goo.gl/h80N9u

I can for good check_types use @type, however it is falsity and check_types is functionless.

``` javascript
var item = /** @type {bad} */ ({ value: ['33'] });
addTo(item);
```

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.