Closed m-mujica closed 4 years ago
Defining an element like this:
class MyElement extends StacheElement { static get view() { return "<p>hello</p>"; } static get props() { return { thisIsNull: { default: null }, thisIsUndefined: { default: undefined } }; } }
causes the following line to throw an error https://github.com/canjs/can-observable-mixin/blob/fa5a085a9bed861175adc63f5dc7d230b584807c/src/define.js#L880.
A workaround is to add a type like thisIsNull: { default: null, type: type.maybe(String) }.
thisIsNull: { default: null, type: type.maybe(String) }
What should can-observable-mixin set type to if the default value is null / undefined?
can-observable-mixin
type
I think we should just prevent this error so that it is basically a type.Any.
type.Any
Defining an element like this:
causes the following line to throw an error https://github.com/canjs/can-observable-mixin/blob/fa5a085a9bed861175adc63f5dc7d230b584807c/src/define.js#L880.
A workaround is to add a type like
thisIsNull: { default: null, type: type.maybe(String) }
.What should
can-observable-mixin
settype
to if the default value is null / undefined?