Use the Exclude utility type:
xxxxxxxxxx
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>;