Vue: improve error message for non-reactive properties

Created on 21 Sep 2017  路  1Comment  路  Source: vuejs/vue

What problem does this feature solve?

current error message is non helpful for vue-class-component (js or ts):

if you forget to initialize a property then you get this error:

Property or method "xxx" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option.

So of course with class based components there is no 'data option', so this isn't helpful.

Proposal is to change the error message:

Property or method "xxx" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties

What does the proposed API look like?

no changes.

good first issue improvement

Most helpful comment

I like the idea of linking docs in error messages.

>All comments

I like the idea of linking docs in error messages.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bfis picture bfis  路  3Comments

aviggngyv picture aviggngyv  路  3Comments

paceband picture paceband  路  3Comments

paulpflug picture paulpflug  路  3Comments

seemsindie picture seemsindie  路  3Comments