crazyfactory/ts-react-boilerplate

oc transpilation doesn't work with dynamic property

Closed this issue · 0 comments

Just a heads up. This won't work.

oc(product).formula.especialnesses["diameter"][diameter].extra_charge(0)

Need to change to

const extraDiameters = oc(product).formula.especialnesses.diameter(null);
    return extraDiameters !== null && extraDiameters[diameter] !== undefined
      ? extraDiameters[diameter].extra_charge
      : 0;

Seems to be a bug of oc typescript transformer. This can't and/or won't be fixed until we migrate to babel loader.