public TypeScriptInterface Build( CodeClass codeClass, TypeContext typeContext) { TypeScriptInterface result = null; TypeScriptInterfaceAttributeValues attributeValues = this.GetAttributeValues(codeClass); if (attributeValues != null) { string moduleName = attributeValues.Module; if (String.IsNullOrEmpty(moduleName) && codeClass.Namespace != null) { moduleName = codeClass.Namespace.FullName; } bool interfaceCreated; result = typeContext.GetOrCreateInterface( moduleName, TypeName.ParseDte(codeClass.FullName), GetInterfaceName(attributeValues), out interfaceCreated); if (!String.IsNullOrEmpty(attributeValues.Extends)) { result.Parent = typeContext.GetLiteralReference(attributeValues.Extends); } else if (codeClass.Bases.Count > 0) { // Getting the first item directly causes problems in unit tests. Get it from an enumerator. IEnumerator enumerator = codeClass.Bases.GetEnumerator(); enumerator.MoveNext(); TypeName parentTypeName = TypeName.ParseDte( ((CodeElement)enumerator.Current).FullName); if (BuilderHelper.IsValidBaseType(parentTypeName)) { result.Parent = typeContext.GetTypeReference( parentTypeName, result); } } result.IndexedType = this.GetIndexedType( result, codeClass, typeContext); Traversal.TraverseProperties( codeClass.Members, (property) => { TypeScriptMember member; if (TryGetMember( result, property, typeContext, out member)) { result.Fields.Add(member); } }); } return(result); }