UNPKG

typescript-object-helper

Version:

A simple dependency to aid in mapping and instantiating typescript classes

23 lines 736 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ClassCast = exports.DNAME = void 0; exports.DNAME = 'deepObjects'; /** * This is a decorator to add to model attributes we want to keep typing for after transpile for * nested/ deep objects and arrays * Example: * * @ClassCast(Employee) * public employee: Employee = undefined; */ function ClassCast(cast) { return function ClassCastInner(target, classPropertyName) { const targetRef = target; if (!targetRef[exports.DNAME]) { targetRef[exports.DNAME] = {}; } targetRef[exports.DNAME][classPropertyName] = cast; }; } exports.ClassCast = ClassCast; //# sourceMappingURL=class-cast.js.map