Skip to content
Literal unions

Union of statuses

Define a Status union (e.g., "idle" | "loading" | "success" | "error"), a function that accepts only those values, and show that other strings are compile-time errors.

Solution

Loading...
Run your code to see output and diagnostics.

Built by Antigravity. The source code is available on GitHub.