Skip to content

Build error when combining cached with private getter #93

@tehhowch

Description

@tehhowch

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.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions