import { fromJS } from 'immutable'
// Works as expected:
let { a, b: { c } } = fromJS({ a: 1, b: { c: 2 } })
console.log(a, c)
let barFn = () => {}
barFn.bar = 'baz'
// Works with plain JS, but fails with extensible-destructuring:
let { foo: { bar } } = { foo: barFn }
console.log(bar)
Take the following example:
Destructuring
a
andc
works fine, but trying to destructurebar
throwsError: cannot resolve property bar in object of type function (function barFn() {})
. Seems to be an easy fix by just changing the logic here: https://github.com/vacuumlabs/babel-plugin-extensible-destructuring/blob/master/runtime/src/runtime.js#L32-L34I'll try to make a PR soon.