Computer scienceProgramming languagesTypeScriptData TypesBasic Types

Boolean, number, string, null, undefined and literal types

Theory

Literal types error matching

Report a typo

Match the TypeScript code snippets in the first column with the corresponding mistake in the second column. Identify the error in each literal type assignment.

Match the items from left and right columns
let language: "TypeScript" = "JavaScript";
let flag: false = true;
let flag: boolean = "on";
let isActive: true = 'true';
The literal type does not match the assigned value, despite having the same representation.
The literal type does not match the assigned boolean value.
The boolean type does not match the assigned string value.
The literal string type does not match the assigned string value.

Create a free account to access the full topic