Explore Library
Code QuizBeginner

Numeric Literal Type

A numeric literal type only accepts the exact numbers listed in its union.

Codetypescript
type DiceRoll = 1 | 2 | 3 | 4 | 5 | 6;

let roll: DiceRoll = 7;
console.log(roll);

What is the bug in this literal type assignment?