fix: reactive and immutable should warn for undefined

This commit is contained in:
Evan You 2019-08-19 15:01:50 -04:00
parent 685348f818
commit e53874f7e7

View File

@ -42,7 +42,7 @@ const canObserve = (value: any): boolean => {
type ObservableFactory = <T>(target?: T) => UnwrapRef<T> type ObservableFactory = <T>(target?: T) => UnwrapRef<T>
export const reactive = ((target: any = {}): any => { export const reactive = ((target: unknown): any => {
// if trying to observe an immutable proxy, return the immutable version. // if trying to observe an immutable proxy, return the immutable version.
if (immutableToRaw.has(target)) { if (immutableToRaw.has(target)) {
return target return target
@ -60,7 +60,7 @@ export const reactive = ((target: any = {}): any => {
) )
}) as ObservableFactory }) as ObservableFactory
export const immutable = ((target: any = {}): any => { export const immutable = ((target: unknown): any => {
// value is a mutable observable, retrive its original and return // value is a mutable observable, retrive its original and return
// a readonly version. // a readonly version.
if (observedToRaw.has(target)) { if (observedToRaw.has(target)) {