Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save omarkdev/07d9ee26214637c6bfc2ce6a2ddb15f7 to your computer and use it in GitHub Desktop.
Save omarkdev/07d9ee26214637c6bfc2ce6a2ddb15f7 to your computer and use it in GitHub Desktop.
function enumerable(newValue: boolean) {
return (
target: any,
propertyKey: string,
propertyDescriptor: PropertyDescriptor,
) => {
propertyDescriptor.enumerable = newValue;
}
}
class User {
name: string = 'Marcos';
@enumerable(false)
changePassword(newPassword: string) { }
}
const user = new User();
for (const key in user) {
console.log(key);
}
// name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment