Created
June 26, 2019 17:59
-
-
Save nehalist/a5167ca0f00d57f094bbdeab00af6d25 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
const CUSTOM_PROPS = 'custom:properties'; | |
function Expose(target: object, key: string) { | |
let properties: string[] | undefined = Reflect.getMetadata(CUSTOM_PROPS, target); | |
if (! properties) { | |
properties = []; | |
} | |
properties.push(key); | |
Reflect.defineMetadata(CUSTOM_PROPS, properties, target); | |
} | |
class Page { | |
@Expose content: object; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment