ember-polyfills / ember-cached-decorator-polyfill

Polyfill for RFC 566: @cached
MIT License
20 stars 6 forks source link

Build error when combining cached with private getter #93

Open tehhowch opened 3 years ago

tehhowch commented 3 years ago

Ember v3.24 polyfill v0.1.3

If I create a component that has a private getter, attempting to use the cached decorator results in a build error:

import Component from '@glimmer/component';
import { cached } from 'ember-cached-decorator-polyfill';

export default Boom extends Component {
  @cached
  get #expensiveGetter() {
    // ...
  }
}

yields

Build Error (broccoli-persistent-filter:Babel > [Babel: my-addon-name]) in my-addon-name/components/boom.js

/Users/me/apps/monorepo/packages/my-app/my-addon-name/components/boom.js: Property value expected type of string but got null

Removing the # (i.e. not using a private getter) results in a working build, as expected.

(I ran into this with a component that was located in an in-repo addon, when building the consuming application, but I did verify that it also occurs if using @cached in the consuming app directly.)