webark / ember-component-css

An Ember CLI addon which allows you to specify styles for individual components
MIT License
540 stars 115 forks source link

Issues with ember-component-css and ember-cli-typescript #329

Open psbanka opened 5 years ago

psbanka commented 5 years ago

Hello. I am having an issue with the latest ember-cli-typescript and ember-component-css. I'm getting a

Cannot set property styleNamespace of [object Object] which has only a getter

Sometimes a person needs to use the styleNamespace attribute within, for example, a computed properties of the component, and it's therefore useful to define styleNamespace: string within the class so that TypeScript can type-check it properly. This, however, results in the above error.

Any ideas?

webark commented 5 years ago

@psbanka and this is in the component, not a controller correct?

psbanka commented 5 years ago

Yes, that is correct

webark commented 5 years ago

https://github.com/ebryn/ember-component-css/blob/6c669ed44deb26d66b9ee98641fd3d10a53fcf49/addon/initializers/component-styles.js#L37-L41

you could redefine the whole computed property. Or maybe we could move the setting of this to the init.