google / google/closure-compiler

Identical types reported as not matching

Open
#1,302 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'm getting a type warning comparing two types which are identical. The type is somewhat complex, using generics and unions. I suspect maybe it has something to do with a subtle difference in the way the two places were defined, e.g. `(Foo?)=` vs `(Foo|null|undefined)`, but I don't know. Here's the warning:

```
./foo.js.tmp:3585: WARNING - actual parameter 1 of callback does not match formal parameter
found : (Result<{image: (HTMLCanvasElement|HTMLImageElement|null|undefined), status: string}>|null)
required: (Result<{image: (HTMLCanvasElement|HTMLImageElement|null|undefined), status: string}>|null)
callback(Result.ok({image: pageCacheEntry.image, status: 'done'}));
```

This occurred with the following version:

```
Version: 1.0-SNAPSHOT
Built on: 2015-11-24 22:30
```

I tried to get a more recent build just in case it's already been fixed, but the current build fails due to some internal dependency issue.

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.