google / google/closure-compiler
Interface with property is kept in minified code in advanced mode
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
I have an interface with a property:
``` javascript
/**
* @interface
*/
class Interface {
get property() {}
method() {}
}
```
Then I implement it:
``` javascript
/**
* @implements Interface
*/
class Implementation {
constructor(property) {
this.property = property;
}
method() {
return this.property;
}
}
```
And compile it with advanced mode (v20151216.2.0):
``` javascript
Object.defineProperties(function(){}.prototype,{a:{configurable:!0,enumerable:!0,get:function(){}}});function a(c){this.a=c}window.b=a;alert((new a("test")).a);
```
The strange thing is that the interface is kept even though it isn't directly used. If I use a getter instead, I get the following code:
``` javascript
function b(c){this.a=c}window.a=b;alert((new b("test")).a);
```
Which is what I would have expected from the interface with a property as well. I will just use getters for now, but thought it's worth reporting.
Contributor guide
Assessment
This issue has not been assessed yet.