fix: add warnings (#82)

* fix: add warnings

- invalid watch handler path
- attempting to mutate readonly computed value
- attempt of mutating public property
- attempt of mutating prop

* fix: more descriptive warnings + details

* fix: test apiOptions warnings

* fix: update warning in componentProxy

* fix: update warnings in componentProxy & apiOptions

* fix: update warning in componentProxy

* fix: implemented tests for componentProxy

* fix: remove comment + small refactor
This commit is contained in:
Tim van den Eijnden
2019-10-09 20:03:21 +02:00
committed by Evan You
parent def27239bd
commit 0177355242
4 changed files with 86 additions and 5 deletions

View File

@@ -267,7 +267,7 @@ export function applyOptions(
if (isFunction(handler)) {
watch(getter, handler as WatchHandler)
} else if (__DEV__) {
// TODO warn invalid watch handler path
warn(`Invalid watch handler specified by key "${raw}"`, handler)
}
} else if (isFunction(raw)) {
watch(getter, raw.bind(ctx))
@@ -275,7 +275,7 @@ export function applyOptions(
// TODO 2.x compat
watch(getter, raw.handler.bind(ctx), raw)
} else if (__DEV__) {
// TODO warn invalid watch options
warn(`Invalid watch option: "${key}"`)
}
}
}