google / google/closure-compiler

property type wrong

Open
#2,439 17 comments 0 reactions 0 assignees View on GitHub
internal-issue-created triage-done
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

I have several boolean properties defined with `Object.defineProperties` on my class prototype returning the value with a `get` function. Unfortunately, I cannot use them as parameter where a boolean is required:
```
myfile.js:309: ERROR - actual parameter 2 of Date.prototype.strftime does not match formal parameter
found : {get: function (this:myCtrl): boolean}
required: (boolean|undefined)
return this.format ? d.strftime(this.format, this.showUtc) : d.toString();
^^^^^^^^^^^^
```
Casting to `boolean` also does not work, though coercing the value with `!!` does work.

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.