code: def link(self):
          
  
          type_specs = {}
          types = []
  
          for name, type_spec in self.scope.type_specs.items():
              type_spec = type_spec.link(self.scope)
              type_specs[name] = type_spec
  
              if type_spec.surface is not None:
                  self.scope.add_surface(name, type_spec.surface)
                  types.append(type_spec.surface)
  
          self.scope.type_specs = type_specs
          self.scope.add_surface('__types__', tuple(types))
docs: Resolve and link all types in the scope.