TypeScript Coach

TypeScript Coach

  • Learn
  • Tutorials
  • About
  • API
  • Learn TypeScript

    • Basics
    • Objects
    • Functions
    • Promises
    • Types
    • Advanced Types
    • Utility Types
    • Classes
    • Modules
    • Namespaces
    • Decorators
  • Node.js

    • fsFile System
    • pathFile Paths
    • osOperating System
  • Tutorials

    • TypeScript Compiler
    • Bundlers
    • React + TSX
    • Databases
    • Unit Testing
    • Networking
    • Express
    • Command Line Interfaces
    • Dates and Timezones
  • Sign in

String types

TypeScript includes a set of types that can be used for string manipulation.

Uppercase

// Use a template literal to construct a type
type CacheKey<T extends string> = `CACHE-${ Uppercase<T> }`
type BlogCache = CacheKey<'blog'>

Template literals

  • https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html#uppercasestringtype

Was this page helpful?

Built with ❤️ by keshav  |  terms of service |  privacy policy

Follow on XGitHub repository