As of TypeScript 2.8 and the addition of conditional types, you can use the built-in Exclude to exclude certain enum values:
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 = Exclude<Errcode, Errcode.Ok>;
Typescript Playground