#TS Conversion Issue

1 messages · Page 1 of 1 (latest)

cobalt lagoon
#

Hi All, I am currently working on ember app that is using the ember-cli version 2.15.3. I am trying to convert a service that extends Ember.Evented as well as a custom mixin from js file. For example export default Service.extend(Evented, SomeMixin, {}) works fine in js. What is the best approach to convert it to class based approach using typescript e.g. export default class MyService extends Service {}. I tried few recommendations with interface but that didn't work. I also tried extending the Service with both Evented and a Mixin with no luck. Or is it even possible with my version of Ember. Thank you!

gloomy kettle
#

@cobalt lagoon assuming you do mean Ember 2.15? If you do, I wouldn’t recommend trying to move to Typescriot there yet (rather work in getting up to 3.6-3.12) where native classes get far easier

#

If you mean Ember 3.15 then you should be able to handle Typescript fairly easily (and it gets steadily easier in the later 3.x series)

cobalt lagoon
#

thanks @gloomy kettle this is actually the setup i am working with and I can't really upgrade it since it is owned by a different team but I can certainly discuss it with them. This being said, they are in process of converting some of the services/components to typescript as well as everything new going forward is being developed in typescript (so this is where I stand ATM, trying to bring in something new while still using the old js mixins). The plain service without extending mixins etc works just fine using typescript. The ember-cli-typescript version is nearly up to date, the major there is 5. But thanks for more insights, since I am not that familiar with Ember myself.