score:-2

this is similar to this question. you can basically use the builtin typescript utility type exclude.

or you could do it like this :

enum statusminimal {
  completed = 'completed',
  created = 'created'
}

enum statusextended {
  completed = 'completed',
  created = 'created'
}

type status = statusminimal | statusextended;

score:1

as far as i know there is no trivial way. see this similiar question.

i would start with minimal and extend the status enum from the minimal implementation. (i know, not what your asked for)

score:4

you can define a property/parameter based on the status and exclude the unwanted values

function test(s: exclude<status, status.cancelled>): void {}


test(status.completed)
test(status.created)
test(status.cancelled) // not assignable

playground


Related Query

More Query from same tag