anchor.diff:                  (expandedDeps - gpsKeys) |> Set.remove (typeRefToTypeKey t)
               let delegateSignature, localSignature =
                   constrainedTypeReferenceCode (TypeRef(ns, fixedGps)) []
  -            let currentNamespace = extractNamespaceCode t
  +            let localTypeCode = extractNamespace t |> localTypeReferenceCode
               let parameterCode = 
                   match fixedPs with
                   | [] -> "unit"
  -                | _ -> fixedPs 
  -                       |> Seq.map (localTypeReferenceCode currentNamespace)
  -                       |> String.concat " * "
  -            let returnCode = localTypeReferenceCode currentNamespace fixedR
  +                | _ -> fixedPs |> Seq.map localTypeCode |> String.concat " * "
  +            let returnCode = localTypeCode fixedR
               let delegateDeclaration =
                   sprintf """
   namespace %s
   type %s = delegate of %s -> %s
  -"""                 currentNamespace localSignature parameterCode returnCode
  +"""                 (namespaceComponentCode t) localSignature parameterCode returnCode
               Some(delegateDeclaration,
                    dependencies,
                    typeRefToTypeKey t, 
  
positive.code:     let predefinedNs =
          predefinedTypeKeys |> Set.map fst
  
      let nameCode ns =
          match ns with
          | [] -> None
          | ["Array"] -> Some "array"
          | [genericParam] when genericParam.StartsWith("'") ->
              Some(Identifier.sanitise genericParam)
          | _ -> 
              let isPredefined = predefinedNs.Contains ns
              let sanitise =
                  if isPredefined then id
                  else Identifier.sanitise
              let subTypeSpace = ns |> List.rev |> List.map sanitise |> String.concat "." 
              if isPredefined then Some subTypeSpace
              else
                  let fullTypeSpace = sprintf "FunScript.TypeScript.%s" subTypeSpace
                  Some fullTypeSpace
  
      let namespaceCode ns =
          match nameCode ns with
          | None -> "FunScript.TypeScript"
          | Some namespaceCode -> namespaceCode
  
      let extractNamespaceCode = function
          | TypeRef([], _) -> failwith "Expected a valid TypeRef"
          | TypeRef(_::ns, _) -> namespaceCode ns
  
      /// Tries to return a (name * namespace * parameter list) tuple for declaring
      /// types. This doesn't search the type space to resolve the type.
      let (|TypeDeclarationId|_|) = function
          | TypeRef(n::ns, gps) -> Some(Identifier.sanitise n, namespaceCode ns, gps)
          | _ -> None
  
      let enumCode t ms =
  
negative.code:                     | Some r -> TypeRef(r, ps)
                      | None -> failwithf "[ERROR] Unable to resolve TypeRef: %A (from TypeRef: %A)" t baseT)
  
      /// This is to work around the restriction where you cannot have a type parameter
      /// that `a :> `b[]
      let replaceArrayWithIList x =
  