adopted-ember-addons / ember-cp-validations

Ember computed property based validations

Home Page:https://adopted-ember-addons.github.io/ember-cp-validations/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Running ember-cp-validations using typescript

gabrieltrita opened this issue · comments

Environment

  • Ember Version: 3.20.2
  • Ember CLI Version: 3.20.2
  • Ember CP Validations Version: 4.0.0-beta.10
  • Typescript: 4.5.4

Steps to Reproduce

Hello everyone! I'm using native class in my project and we're migrating to Typescript. We have models like this in the current project:

const Validations = buildValidations({
  name: [
    validator('presence', true),
  ]
});

export default class UserModel extends Model.extend(Validations) {
...
}

when changing to typescript the Model.extend(Validations) stops working. Does anyone have an alternative? I've seen decorators like hasValidations implemented in the past, but it's been removed. I wanted to know if we have any alternative for the typescript. Thanks!