Global Namespace Merging

Within initializeTypeChecker the following code exists:

  1. // Initialize global symbol table
  2. forEach(host.getSourceFiles(), file => {
  3. if (!isExternalModule(file)) {
  4. mergeSymbolTable(globals, file.locals);
  5. }
  6. });

Which basically merges all the global symbols into the let globals: SymbolTable = {}; (in createTypeChecker) SymbolTable. mergeSymbolTable primarily calls mergeSymbol.