google / google/closure-compiler

Object created with Object.create not dead code eliminated

Open
#1,745 5 comments 0 reactions 1 assignee Claimed by @Dominator008 View on GitHub
enhancement
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

When creating an object through `Object.create` and adding a property to it, it will not be removed in ADVANCED mode, even if nothing references it.

**Not** removed:

``` javascript
/** @type {!Object} */
const foo = Object.create(null); // or Object.create({});
foo.prop = 2;
```

Removed:

``` javascript
/** @type {!Object} */
const bar = {};
bar.prop = 2;
```

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.