sequelize-typescript icon indicating copy to clipboard operation
sequelize-typescript copied to clipboard

Decorating class property failed

Open miccarrer opened this issue 3 years ago • 0 comments

Issue

I am getting FATAL Decorating class property failed. Please ensure that proposal-class-properties is enabled and runs after the decorators transform. error while creating a new Person instance.

Versions

  • sequelize: ^6.18.0
  • sequelize-typescript: ^2.1.3
  • typescript: 4.2.4

Issue type

  • [x] bug report
  • [ ] feature request

Actual behavior

I have a model Person, and when I call new Person({ name: 'Bill' }) I have following error:

 FATAL  Decorating class property failed. Please ensure that proposal-class-properties is enabled and runs after the decorators transform.

  at _initializerWarningHelper (server/db/models/Person.ts:1:1046)
  at Person.<instance_members_initializer> (server/db/models/Person.ts:9:179)
  at new Person (server/db/models/Person.ts:13:5)

Expected behavior

I want to create a new Person.

Steps to reproduce

  • Create a new Nuxt Typescript project, with command npm init nuxt-app <project-name> as recommended on Nuxt website
  • Install sequelize-typescript package
  • Create a Person model as recommended in sequelize-typescript docs
  • Create a database module, in order to initialize sequelize
  • Create a server module, in order to call database module
  • Start the application

Related code

I have uploaded this sample application on Github here

miccarrer avatar Apr 07 '22 17:04 miccarrer