mthadley/eslint-plugin-sort-destructure-keys

[Bug] TypeError: Cannot read property 'toString' of undefined

TSMMark opened this issue · 1 comments

Possibly same as #3, but I may have found the issue. I traced it back to this one destructuring expression:

const {
  id,
  [`${assetType}_remaining_payee_percentage`]: remainingPayeePercentage,
} = media || {}

Strongly believe this is due to the dynamic / interpolated key, because if the interpolated key is replaced with a static one, I no longer get the error.

Interestingly, if I pull the interpolated string into a const it works even with the dynamic lookup. I.e. with this code I get no error:

const key = `${assetType}_remaining_payee_percentage`
const {
  id,
  [key]: remainingPayeePercentage,
} = media || {}