Skip to content

Commit da76b06

Browse files
committed
Make deprecated properties non-enumerable
This avoids spurious deprecation warnings in dev tools.
1 parent ca8418e commit da76b06

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

modules/deprecateObjectProperties.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ let useMembrane = false
55

66
if (__DEV__) {
77
try {
8-
Object.defineProperty({}, 'x', { get() { return true } }).x
9-
useMembrane = true
8+
if (Object.defineProperty({}, 'x', { get() { return true } }).x) {
9+
useMembrane = true
10+
}
1011
} catch(e) { }
1112
}
1213

@@ -26,7 +27,7 @@ export default function deprecateObjectProperties(object, message) {
2627
} else {
2728
Object.defineProperty(membrane, prop, {
2829
configurable: false,
29-
enumerable: true,
30+
enumerable: false,
3031
get() {
3132
warning(false, message)
3233
return object[prop]

0 commit comments

Comments
 (0)