АД
Size: a a a
АД
DT
DT
A
АД
Вキ
АО
Вキ
E
DT
DT
АО
DT
DT
export function checkType(type: string) {
return (target: object, property: string) => {
let _val = target[property];
delete target[property];
Object.defineProperty(target, property, {
set: function set(newVal) {
const newValType = typeof newVal;
if (newValType !== type) {
throw new TypeError(`Invalid ${property} type (${newValType}). Should be ${type}.`);
}
_val = newVal;
},
get: function get() {
return _val;
},
enumerable: true,
configurable: true,
});
};
}
@Input() @checkType('number') public defautDate: number;
МД
МД
DT