```ts
export function clipText(text: string, from: number, to: number): string {
  if (from < 0 || from > text.length - 1) {
    throw new Error('First place is out of bounds');
  }
  if (to < 0 || to > text.length - 1) {
    throw new Error('Second place is out of bounds');
  }

  return text.substring(from, Math.min(to + 1, text.length));
}
```