```ts
export function sortByLen(words: string[]): string[] {
  return words.sort((a, b) => {
    const lenA = a.length;
    const lenB = b.length;

    if (lenA === lenB) {
      return a.localeCompare(b);
    }

    return lenA - lenB;
  });
}
```