Type alias StringStartsWith<T, U>

StringStartsWith<T, U>: IfExtends<T, `${U}${string}`, true, false>

Check if a string starts with another string

Type Parameters

  • T extends string
  • U extends string

Example

type Result = StringStartsWith<'hello world', 'hello'>; // Result: true