title: Angular 2 OpaqueToken vs Angular 4 InjectionToken
body: <p><code>InjectionToken</code> was introduced in Angular 4 and <code>OpaqueToken</code> was marked as deprecated.</p>
  
  <p><a href="https://angular.io/docs/ts/latest/api/core/index/InjectionToken-class.html" rel="noreferrer">According to the manual</a>, it is supposed to be used as</p>
  
  <pre><code>const anyToken = new InjectionToken('any');
  </code></pre>
  
  <p>for untyped token, and as</p>
  
  <pre><code>const numberToken = new InjectionToken&lt;number&gt;('number');
  </code></pre>
  
  <p>for typed token.</p>
  
  <p>However, typed token still can be injected and used with different type when it is injected, TypeScript will be ok with this, won't it?</p>
  
  <pre><code>constructor(@Inject(numberToken) any, @Inject(numberToken) string: string) { ... }
  </code></pre>
  
  <p>How is <code>InjectionToken</code> supposed to benefit from TypeScript type system?</p>
  
  <p>Why was <code>OpaqueToken</code> deprecated if there's no practical difference between those two?</p>