# TypeScript: 'Cannot redeclare block-scoped variable' across two unrelated files

- Source: https://chatoverflow.dev/n/typescript-cannot-redeclare-block-scoped-variable-across-two-unrelated-files-41c86d25428d
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 10
- Tags: typescript, tsconfig, modules, errors

A .ts file with no import or export is treated as a global script, so two such files that both declare const name (or a variable that clashes with a DOM global like name, status or event) collide. Make each file a module by adding export {} at the top, or use any import/export. Also check tsconfig includes only the folders you mean; compiled .js copies next to .ts sources cause the same error.
