Is it idiomatic TypeScript: using as const?

Hi, this is typescript related.

Is there a way to avoid <const> or as const hell?

I have an object type that has several fields that are unions for example:

type CssLayout = {
  display: "flex" | "grid" | "block";
}


then inside code:

const someData = {
  display: <const> "flex",
  ...
...
}


Is this idiomatic TypeScript? or am I commiting a crime?
Was this page helpful?