Example #1
0
        /// <summary>
        /// Gets the text for the "extends" section
        /// </summary>
        /// <param name="type"></param>
        /// <param name="typeNameConverters"></param>
        /// <returns></returns>
        public string GetExtendsText(Type type, TypeNameConverterCollection typeNameConverters)
        {
            var extendsText = "";

            Type baseType = _typeService.GetBaseType(type);

            if (baseType == null)
            {
                return(extendsText);
            }

            string baseTypeName = _typeService.GetTsTypeName(baseType, typeNameConverters);

            extendsText = $" extends {baseTypeName}";

            return(extendsText);
        }
Example #2
0
        /// <summary>
        /// Gets the base type dependency for a type, if the base type exists
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        private IEnumerable <TypeDependencyInfo> GetBaseTypeDependency(Type type)
        {
            if (type.GetTypeInfo().GetCustomAttribute <TsIgnoreBaseAttribute>() != null)
            {
                yield break;
            }

            Type baseType = _typeService.GetBaseType(type);

            if (baseType == null)
            {
                yield break;
            }

            if (baseType.GetTypeInfo().IsGenericType)
            {
                baseType = baseType.GetGenericTypeDefinition();
            }

            yield return(new TypeDependencyInfo(baseType));
        }