Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function tracked(target: object, key: string, desc: PropertyDescriptor) {
let initializer = (desc as any).initializer;
let trackedDesc = glimmerTracked(target, key, desc);
let { get: originalGet, set: originalSet } = trackedDesc;
let defaultAssigned = new WeakSet();
function set(this: any, value: unknown) {
if (typeof value === 'object' && value !== null) {
if (value instanceof Map) {
value = new TrackedMap(value);
} else if (value instanceof WeakMap) {
value = new TrackedWeakMap();
} else if (value instanceof Set) {
value = new TrackedSet(value);
} else if (value instanceof WeakSet) {
value = new TrackedWeakSet();
}
}