[Vuejs]-Avoid mutating property BUG, Vue + Nuxt + Property Decorators

3👍

This is due to typescript compiler generated code, it is injecting an assigment into the generated class constructor.
You can confirm this by looking at the generated code in your browser’s javascript debugger.

This compiler option may help: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#the-usedefineforclassfields-flag-and-the-declare-property-modifier

Note that on a fresh vue project (created with @vue/cli) this creates a setup that does not produce the symptom.

Leave a comment