title: TypeScript - How can omit some items from an Enum in TypeScript?
body: <p>I defined an Enum to clarify APIs request status:</p>
  
  <pre><code>const enum Errcode{
      Ok=0,
      Error=1,
      AccessDeny=201,
      PostsNotFound=202,
      TagNotFound=203,
      //...
  }
  
  type SuccessErrcode =Errcode.Ok;
  type NotFoundError =Errcode.PostsNotFound|Errcode.TagNotFound;
  type ErrorErrcode=/* there */;
  </code></pre>
  
  <p>How can I define the <code>ErrorErrcode</code> that means all items of Errcode except Errcode.Ok (and it should include all items of NotFoundError)?</p>
  
  <p>I can't define the more granular types and <a href="https://www.typescriptlang.org/docs/handbook/advanced-types.html" rel="noreferrer">Union</a> them likes this:</p>
  
  <pre><code>enum SuccessErrcode {
      Ok =0,
  }
  enum NotFoundErrcode {
      PostsNotFound=202,
      TagNotFound=203,
  }
  enum ErrorErrcode {
      Error=1,
  }
  type Errcode =SuccessErrcode|NotFoundError|SuccessErrcode;
  </code></pre>
  
  <p>If I do this, I will can't use <code>Errcode.xxx</code> - for use a code, I must to know where it be assigned of.(e.g. from <code>Errcode.TagNotFound</code> to <code>NotFoundError.TagNotFound</code>). And consider that - when there have <code>TagErrcode</code> and <code>NotFoundErrcode</code>, the <code>TagNotFound=203</code> will be defined twice.</p>