Пример #1
0
        public string ProvideParameterType(IModelType type, bool inModelsModule = false)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            var builder = new StringBuilder("");

            if (type.IsPrimaryType(KnownPrimaryType.Date) ||
                type.IsPrimaryType(KnownPrimaryType.DateTime) ||
                type.IsPrimaryType(KnownPrimaryType.DateTimeRfc1123) ||
                type.IsPrimaryType(KnownPrimaryType.UnixTime))
            {
                builder.Append("Date | string");
            }
            else if (type.IsSequenceContainingDateKind())
            {
                builder.Append("Array<Date> | Array<string>");
            }
            else if (type.IsDictionaryContainingDateKind())
            {
                builder.Append("{ [key: string]: Date } | { [key: string]: string }");
            }
            else
            {
                builder.Append(type.TSType(inModelsModule));
            }
            return(builder.ToString());
        }