Quantcast
Channel: MarsHut
Viewing all articles
Browse latest Browse all 6551

IThenable and non-nullable types

$
0
0
When trying to tighten up the types in my code, I'm getting a number of
warnings that seem spurious e.g.

foo.js:152: WARNING - actual parameter 1 of foo does not match formal
parameter
found : (IThenable.<Object.<string,?>>|null)
required: (IThenable.<(Object.<string,?>|null)>|null)
foo(factory.getVersions(this.params))

Where the actual type (a promise for a non-null object) is stricter than
the requirement (a promise for a nullable object).

Similarly I've run into issues trying objects as @type {!IThenable.<XYZ>},
because IThenable.prototype.then seems to return a nullable type, but I
don't think promises actually return null values from then(). Are there
any good ways to avoid these problems?

You received this message because you are subscribed to the Google Groups "Closure Compiler Discuss" group.

To view this discussion on the web visit https://groups.google.com/d/msgid/closure-compiler-discuss/93186c8f-04fa-4b1f-b60f-854a92809114%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Viewing all articles
Browse latest Browse all 6551

Trending Articles