$ ./guess_the_languageProgramming Languages
Programming Languages · medium · #534

Which programming language is this?

const ROUTES = ["home", "about", "contact"] as const;
type Route = typeof ROUTES[number];
function go(r: Route) {
  location.hash = r;
}

Answer: TypeScript

as const followed by a type alias built from typeof ROUTES[number] is TypeScript-only syntax.
Play Programming Languages ▸