示例#1
0
        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),
            };
        }
示例#2
0
        public void WriteObjectMember(PropertyInfo property, string value)
        {
            var fqTsType = GetFqTsType(property.PropertyType);

            WriteClassMember(TypeScriptHelpers.GetPropertyName(property.Name), fqTsType, value);
        }
示例#3
0
        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);
        }
示例#4
0
        public void WriteInterfaceMember(PropertyInfo property)
        {
            var fqTsType = GetFqTsType(property.PropertyType);

            WriteInterfaceMember(TypeScriptHelpers.GetPropertyName(property.Name), fqTsType);
        }