Predict Template Literal Output
Predict Output Medium
Question
What does this code print?
Code
type Greeting = `Hello ${string}`;
const msg: Greeting = `Hello World`;
console.log(msg);
Hint
Template literal types are compile-time only — the value is a normal string at runtime.
Explanation
The template literal type Hello ${string} matches any string starting with "Hello ". The value msg is "Hello World". At runtime, template literal types are erased. Output: Hello World.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.