Last active
May 29, 2018 21:31
-
-
Save kourge/d7f563043c6dac00bcbb48f46f38766f to your computer and use it in GitHub Desktop.
symbol interfaces in angular
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
// Somewhere in `@angular/core`: | |
export const OnInit: unique symbol = Symbol('OnInit'); | |
export interface OnInit { | |
[OnInit](): void; | |
} | |
// In a component: | |
import { Component, OnInit } from '@angular/core'; | |
@Component | |
export class Foo implements OnInit { | |
[OnInit](): void { | |
// do stuff | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment