Skip to content

Instantly share code, notes, and snippets.

@smallgeek
Created October 29, 2019 02:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smallgeek/ee47b479687aa54e3320c71f9c8c6e80 to your computer and use it in GitHub Desktop.
Save smallgeek/ee47b479687aa54e3320c71f9c8c6e80 to your computer and use it in GitHub Desktop.
プロパティを追跡されないようにする
unTracking<T>(source: T): T {
const target = {} as T;
Object.keys(source).forEach(key => {
Object.defineProperty(target, key, { configurable: false, value: (source as any)[key] } );
});
return target;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment