Skip to content

Instantly share code, notes, and snippets.

@kourge
Last active May 29, 2018 21:31
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 kourge/d7f563043c6dac00bcbb48f46f38766f to your computer and use it in GitHub Desktop.
Save kourge/d7f563043c6dac00bcbb48f46f38766f to your computer and use it in GitHub Desktop.
symbol interfaces in angular
// 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