Created
October 29, 2019 02:27
-
-
Save smallgeek/ee47b479687aa54e3320c71f9c8c6e80 to your computer and use it in GitHub Desktop.
プロパティを追跡されないようにする
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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