```ts
function topologicalSort(nodes: readonly string[], edges: readonly (readonly [string, string])[]): string[] {
    if (!nodes.length) return [];
    const graph = new Map<string, Set<string>>();
    for (const edge of edges) {
        if (!graph.has(edge[0])) graph.set(edge[0], new Set());
        if (!graph.has(edge[1])) graph.set(edge[1], new Set());
        graph.get(edge[0])!.add(edge[1]);
    }
    const indegree = nodes.reduce((acc, node) => {
        acc[node] = 0;
        for (const neighbor of graph.get(node)!) acc[neighbor]++;
        return acc;
    }, {} as { [key: string]: number });

    const queue: string[] = Object.keys(indegree).filter(node => indegree[node] === 0);
    const order: string[] = [];

    while (queue.length > 0) {
        const node = queue.shift()!;
        if (order.includes(node)) throw new Error(`Cycle detected: ${node}`);
        order.push(node);

        for (const neighbor of graph.get(node)!) {
            indegree[neighbor]--;
            if (indegree[neighbor] === 0) queue.push(neighbor);
        }
    }

    if (nodes.length !== order.length) throw new Error('Graph is not fully connected');

    return order;
}
```