public void AddModule(Type type, bool overwrite = false) { if (!overwrite && _modules.ContainsKey(type)) { throw new InvalidOperationException($"Context already contains module for '{type.FullName}'"); } _modules[type] = new TypeScriptModule() { Flags = (type.GetTypeInfo().IsGenericType ? TypeScriptModuleFlags.Generic : 0) | (type.GetTypeInfo().IsEnum ? TypeScriptModuleFlags.Primitive : 0), ManagedType = type, Name = TypeScriptHelpers.GetModuleName(type), Path = TypeScriptHelpers.GetModulePath(type), }; }
public void WriteObjectMember(PropertyInfo property, string value) { var fqTsType = GetFqTsType(property.PropertyType); WriteClassMember(TypeScriptHelpers.GetPropertyName(property.Name), fqTsType, value); }
public void WriteClassMember(PropertyInfo property, string value = null, string[] decorators = null) { var fqTsType = GetFqTsType(property.PropertyType); WriteClassMember(TypeScriptHelpers.GetPropertyName(property.Name), fqTsType, value: value, decorators: decorators); }
public void WriteInterfaceMember(PropertyInfo property) { var fqTsType = GetFqTsType(property.PropertyType); WriteInterfaceMember(TypeScriptHelpers.GetPropertyName(property.Name), fqTsType); }