Nextjs: static class / use function

Solution 1:

Neither. The better solution for static utility functions is to use named exports:

// tool.js:
export function titleCase(value: string) {
    return value.charAt(0).toUpperCase() + value.slice(1).toLowerCase();
}

Shorter, no unnecessary intermediate objects, and good for tree-shaking.