Skip to content
Justice Tech School

Template Literal Types

Build string types from others with template syntax.

Example
type Event = `on${Capitalize<"click" | "hover">}`;
const e: Event = "onClick";
console.log(e);

Result

onClick

Exercise

Template type.

type T = `a${}`

Quiz Test

What do they create?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.