Discriminant

Noun · Development

Definitions

  1. A tag or value that indicates which variant of a union or enum type is currently active. In Rust, every enum variant has an implicit discriminant; in TypeScript, a literal field serves as the discriminant in discriminated unions.

    In plain English: A label on a box that tells you what kind of thing is inside, so you know how to open it correctly.

    Example: "The discriminant tells the match statement which variant to destructure."

Related Terms