Hacker News new | past | comments | ask | show | jobs | submit
Thanks for the reply. I was not aware of this.

In this case, I could write this:

  type Activation = "Active" | "Inactive";
  const Activation = {
    __proto__: null,
    Active: "Active",
    Inactive: "Inactive",
  } as { [K in Activation]: K };
This completely hides `__proto__` and avoid using utility types like `Exclude`.

Note that it is safe because TypeScript checks that the type assertion is valid. If I mistype a value, TypeScript will complain about the assertion.