Skip to content

Instantly share code, notes, and snippets.

@imdfl
imdfl / property-descriptor-stack.ts
Last active September 15, 2023 16:59
Change property descriptors on an object with an undo stack
interface IPropertyDescriptorStack {
/**
* set the property descriptor of the member prop on the target object
* Fails silently, returning false
* @param props
*/
push(props: Partial<PropertyDescriptor>): boolean;
/**
* reset the property descriptor of the member prop on the target object, either to
* the state it was before the last set, or to the initial state, resetting the state stack.